/*---------------------------------------------------------*
 | File: PF.h - #include for PF.c (see there for comments) |
 +---------------------------------------------------------+
 | 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 DECnet node 38.257 or 39169 |
 | Home: Via G. Donizetti 6 - 35010 CADONEGHE (PD) - Italy |
 *---------------------------------------------------------*/

/**
 | Other #include's
**/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "mlo.h"

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

#define OUTPUT_DEVICE   "PAR:"          /* Output device */
#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           1               /* Quality */
#define LETTER          2

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

#define VERSION         1.15            /* Guess what is this ... */
#define LAST_CHANGE     910609

#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;

/**
 | Global variables
**/

BYTE Orientation        = PORTRAIT;     /* Print default:  Courier,  10 */
BYTE Style              = ROMAN;        /*   cpi pitch, letter quality, */
short Pitch             = P10CPI;       /*     portrait,  roman, 6 lpi, */
short Font              = COURIER;      /*       12pt high characters.  */
BYTE Height             = 12;
BYTE Lpi                = 6;
BYTE Quality            = LETTER;
short PageMode          = SINGLE_PAGE;
short nBlanks           = 0;            /* No leading blanks */
short nTabs             = 8;            /* Tab stops every 8 characters */

FILE *fp;                               /* Current input file pointer */
FILE *prt;                              /* Printer device */
char inBuffer[LINE_LENGTH];             /* Input buffer, and      */
char *Buffer = inBuffer;                /*   our pointer into it. */
PageBuffer *pPB;                        /* Page buffer (2-page mode) */
short ThisLine;                         /* Line in the page */
