/*---------------------------------------------------------*
 | Author:  Maurizio Loreti, aka MLO or I3NOO.             |
 | Address: University of Padova - Department of Physics   |
 |          Via F. Marzolo, 8 - 35131 PADOVA - Italy       |
 | Phone:   (39)(49) 844-313         FAX: (39)(49) 844-245 |
 | E-Mail:  LORETI at IPDINFN (BITNET); or VAXFPD::LORETI  |
 |         (DECnet) - VAXFPD is node 38.257 i.e. 39169; or |
 |          LORETI@PADOVA.INFN.IT (INTERNET).              |
 | Home: Via G. Donizetti 6 - 35010 CADONEGHE (PD) - Italy |
 *---------------------------------------------------------*/

/**
 | Printer port constants
**/

#define PORT_NAME       "pf.port"

/**
 | Constants to be used in printer initialisation
**/

#define PORTRAIT        0               /* Orientation */
#define LANDSCAPE       1
#define ROMAN           0               /* Style */
#define ITALIC          1
#define P10CPI          0               /* Pitch & Spacing */
#define P12CPI          1
#define P16_67CPI       2
#define P20CPI          3
#define P24CPI          4
#define PROPORTIONAL    -1
#define COURIER         3               /* Font */
#define GOTHIC          6
#define TIMES           4101
#define DRAFT_Q         1               /* Quality */
#define LETTER_Q        2

/**
 | Other #define's
**/

#define VERSION         "2.16"          /* Guess what is this ... */
#define LAST_CHANGE     "920422"

#define REVISION        33              /* Library revision (Kickstart 1.2 */
#define REVISION_2      37              /*   or Kickstart 2.04) */

#define BLUE_PEN        0               /* Workbench 1.3 defaults */
#define WHITE_PEN       1
#define BLACK_PEN       2
#define RED_PEN         3

#define LO_MESSAGE      0x1             /* Flag bits for LibOpen() */
#define LO_ABORT        0x10

#ifndef	DSIZE                           /* Size of file names (reqbase.h) */
#define	DSIZE	          130
#define	FCHARS	        30
#endif

#define MAX_FILES       50              /* Maximum number of selected files */
#define DIR_MAX         (DSIZE+1)       /* Directory names size */
#define FIL_MAX         (FCHARS+1)      /* File names size */
#define TOT_MAX         (DSIZE+FCHARS+2)

#define LINE_LENGTH     256             /* Input line buffer length */

#define OUTPUT_LENGTH   80              /* Various parameters for the 2-page */
#define SIDE_LENGTH     3               /*   mode: output text length, width */
#define SEP_LENGTH      5               /*     of the  blank borders,  space */
#define PAGE_LENGTH     55              /*       between pages on sheet, ... */

#define TOTAL_LENGTH    (OUTPUT_LENGTH + 2 * SIDE_LENGTH)
#define BUFFER_SIZE     (OUTPUT_LENGTH * PAGE_LENGTH)

#define ESC             '\x1B'          /* Special characters */
#define FORM_FEED       '\x0C'
#define H_LINE          '\xC4'          /* Semigraphic characters (PC-8) */
#define V_LINE          '\xB3'
#define NE              '\xBF'
#define SE              '\xD9'
#define SW              '\xC0'
#define NW              '\xDA'

#define UP              1               /* Internal flags */
#define DOWN            2

#define SINGLE_PAGE     1
#define LEFT_PAGE       2
#define RIGHT_PAGE      3

/**
 | Structures
**/

typedef struct sPageBuffer {            /* Page buffer pointers (2-p mode) */
  char *line[PAGE_LENGTH];
} PageBuffer;

typedef union uPrinterIO {              /* Exec I/O structure (printer) */
  struct IOStdReq ios;
  struct IODRPReq iod;
  struct IOPrtCmdReq iop;
} PrintIO;

/**
 | ANSI prototypes (for functions called in more than one file)
**/

void    main(int argc, char **argv);

void    Cleanup(int code);
void    DoOutput(char *FileName);
void    ExitProgram(void);
void    FlushBuffers(void);
void    InitPrinter(void);
void   *LibOpen(char *Name, long Rev, USHORT flag);
void    SetSpecialMode(void);
char  **Setup(int *pArgc, char **argv);
void    SetupWB(void);
void    windowOff(void);
