
/* Print_Spool.h    V1.0.0    27-Mar-1988    ) Frangois Gagnon */


/*
   Copyright ) 1988  Frangois Gagnon,  All Rights Reserved.

   The author does not make any warranty expressed or implied,
   or assumes any liability or responsiblity for the use of
   this software.

   Permission is hereby granted to copy, reproduce, redistribute
   or otherwise use this software as long as it is for non-profit.
   This notice and the above copyright notice must remain intact
   and appear on all copies.

   Permission is also granted to correct any problems with this
   software, but modifications and improvements are reserved by
   the author.
*/

/*****************************************/
/* Definition of the Command information */
/*****************************************/

#define	PS_Insert	11	/* Insert a name in the list	*/
/* This command inserts a list of names into the print queue. If the	*/
/* spooler is in the Wait_State, it will go to Exec_State and will	*/
/* start to print the first file.					*/

#define PS_Update	12	/* Update names from the list	*/
/* This command updates the options and flags values of the files that	*/
/* match the specified pattern. The file being printed will be affected */
/* by this command but the value will only be used if multiple copies	*/
/* of the file are to be printed. A copy of the modified entries are	*/
/* sent back to the requesting program. 				*/

#define PS_Remove	13	/* Remove names from the list	*/
/* This command removes the files that match the specified pattern. The */
/* file being printed will be affected by this command and the affected */
/* entries are sent back to the requesting program.			*/

#define PS_Report	14	/* Report the names of the list */
/* This command requests that the status of the spooler with a copy of	*/
/* the print queue be sent to the requesting program.			*/

#define PS_Return	15	/* Return when all completed	*/
/* This command toggles the flag indicating wheter the program must	*/
/* terminate its execution after the last file is printed. It will	*/
/* normally wait for a new file to print instead of terminating. It is	*/
/* still possible to modify the print queue even if the flag is set.	*/
/* Great care nust be taken not to loose messages.			*/

#define PS_Change	16	/* Change the paper format	*/
/* This command indicates that the format of the paper has been changed */
/* to the format required for the next file.				*/
^L
#define PS_Freeze	21	/* Freeze the printing activity */
/* This command requests that the spooler stops printing the current	*/
/* file immediately and waits for further commands. The printing can be */
/* restarted from the point it was stopped. This command will only be	*/
/* executed if the spooler is waiting for a file name or printing one.	*/
/* It will also overide a PS_Finish command by forgeting it was ever	*/
/* executed.								*/

#define PS_Finish	22	/* Finish the printing activity */
/* This command requests that the spooler stops after printing the	*/
/* current file and waits for further commands. This command will	*/
/* override a PS_Freeze command by resuming the printing.		*/

#define PS_Resets	23	/* Resets the printing activity */
/* This command requests that the spooler stops printing the current	*/
/* file immediately and waits for further commands. The File_Copy	*/
/* counter is not decremented. This command will override the PS_Freeze */
/* command.								*/

#define PS_Cancel	24	/* Cancel the printing activity */
/* This command requests that the spooler stops printing the current	*/
/* file immediately and waits for further commands. The File_Copy	*/
/* counter is decremented as if the file was completed.	It will 	*/
/* override the PS_Freeze command.					*/

#define PS_Resume	25	/* Resume the printing activity	*/
/* This command restarts the spooler activity after being stopped by	*/
/* one of the others control commands. The command will also cancel a	*/
/* PS_Finish which as not yet completed for the current file.		*/

/*****************************************/
/* Definition of the Options information */
/*****************************************/

#define Line_Density	0x03	/* 10, 12 or 17 chars per inch	*/
#define Line_Formats	0x04	/* 8 or 13 inches page wide	*/
#define Page_Density	0x08	/* 6 or 8 lines per inch	*/
#define Page_Formats	0x10	/* 8.5 or 11 inches page long	*/
#define Opts_Headers	0x20	/* Add headers to pages  */
#define Opts_Numbers	0x40	/* Add numbers to lines  */

#define Flag_Quality	0x01	/* Type of char printing */
#define Flag_Deleted	0x02	/* Delete after pinting  */

#define Line_10 	0x00	/* 10 chars per inch */
#define Line_12 	0x01	/* 12 chars per inch */
#define Line_17 	0x02	/* 17 chars per inch */
#define Line_8		0x00	/* 8 inchs wide  */
#define Line_13 	0x04	/* 13 inchs wide */

#define Page_6		0x00	/* 6 lines per inch  */
#define Page_8		0x08	/* 8 lines per inch  */
#define Page_85 	0x00	/* 8.5 inchs long */
#define Page_11 	0x10	/* 11 inchs long  */

#define Flag_Updated	0x80	/* If update was successful */
#define Flag_Partial	0x80	/* If the result is partial */
^L
/*************************************/
/* Defintion of the File information */
/*************************************/

#define Name_Size	96	/* Maximum number of character	*/
#define Date_Size	20	/* Exact number of character	*/

typedef struct	Detail_File
	{ struct Detail_File   *File_Next;
	  char			File_Name[Name_Size];
	  short  		File_Copy;
	  byte			File_Opts;
	  byte			File_Flag;
	  char			File_Date[Date_Size];
	  long			File_Size;
	} File;

/*****************************************/
/* Definition of the Spooler information */
/*****************************************/

#define Wait_State	0	/* Waiting for a file to print     */
#define Page_State	1	/* Waiting to change the paper     */
#define Open_State	2	/* Waiting to access the printer   */
#define Exec_State	3	/* Is currently printing a file	   */
#define File_State	4	/* Will be stopped after the file  */
#define Susp_State	5	/* Suspended between two files	   */
#define Stop_State	6	/* Stopped in the middle of a file */

typedef struct	Status_Info
	{ byte	Vers_State; /* Current version of spooler   */
	  byte	Prog_State; /* Current state of the spooler */
	  byte	Opts_State; /* Current options for printing */
	  bool	Flag_State; /* If must terminate execution  */
	  long	Char_Print; /* Number of chars printed */
	  long	Line_Print; /* Number of lines printed */
	  long	Page_Print; /* Number of pages printed */
	  File *File_Print; /* List of files to print  */
	} Info;

/*************************************/
/* Definition of Control information */
/*************************************/

#define	SPOOLNAME	"SPOOL"
#define	PROTOCOL	1

union	Details { File *Insert, *Update;
		  char	Remove[Name_Size];
		  Info  Status;
		};

struct	Inform	{ struct Message Packet;
		  short 	 Number, Action;
		  union  Details Detail;
		};
