Back to index

tetex-bin  3.0
dvi2xx.h
Go to the documentation of this file.
00001 /* $Id: dvi2xx.h,v 2.3 1996/05/20 11:05:57 neumann Exp $ */
00002 #ifndef DVI2XX_H
00003 #define DVI2XX_H
00004 /**********************************************************************
00005  ************************  Global Definitions  ************************
00006  **********************************************************************/
00007 /* #define IBM3812 */
00008 /* #define LJ */
00009 /* #define DRAWGLYPH */
00010 
00011 #ifdef KPATHSEA
00012 #include <kpathsea/config.h>
00013 #include <kpathsea/c-limits.h>
00014 #include <kpathsea/c-memstr.h>
00015 #include <kpathsea/magstep.h>
00016 #include <kpathsea/proginit.h>
00017 #include <kpathsea/progname.h>
00018 #include <kpathsea/tex-glyph.h>
00019 #include <kpathsea/tex-hush.h>
00020 #include <kpathsea/tex-make.h>
00021 #include <kpathsea/c-vararg.h>
00022 #include <c-auto.h>
00023 #else
00024 #include <string.h>
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 #ifdef  unix
00028 #include <limits.h>
00029 #endif
00030 #endif
00031 
00032 #include <signal.h>
00033 #include <ctype.h>
00034 #ifdef vms
00035 #include <file.h>
00036 #else
00037 # ifndef __riscos
00038 # include <fcntl.h>
00039 # endif
00040 #endif
00041 #ifdef MSC5
00042 #include <dos.h>     /* only for binaryopen on device  */
00043 #endif
00044 #if defined (unix) && !defined (KPATHSEA)
00045 #include <limits.h>
00046 #endif
00047 
00048 
00049 #include "config.h"
00050 #include "commands.h"
00051 
00052 #define  DVIFORMAT     2
00053 #ifndef UNKNOWN
00054 #define  UNKNOWN      -1
00055 #endif
00056 #define  FIRSTFNTCHAR  0
00057 
00058 #ifdef __riscos
00059 # ifdef RISC_USE_OSL
00060 #  define MAXOPEN_OS    16
00061 # else
00062 #  define MAXOPEN_OS    8      /* don't know if this IS the maximum */
00063 # endif
00064 #else
00065 # ifdef   OPEN_MAX                    /* ... in a friendly unix system  */
00066 #  ifndef vms
00067 #   define MAXOPEN_OS (OPEN_MAX - 8)
00068 #  else
00069 #   define  MAXOPEN_OS 12     /* OPEN_MAX seems to be 8 on VMS systems */
00070 #  endif
00071 # else
00072 #  ifdef __DJGPP__
00073 #   if __DJGPP_MINOR__ <= 1
00074     /* DJGPP needs few handles free in the first 20, or else child programs
00075        (called by MakeTeX... scripts) won't run, since the stub loader
00076        cannot open the .exe program.  This is because DOS only copies the
00077        first 20 handles to the child program.  */
00078 #    define MAXOPEN_OS   5
00079 #   else
00080     /* DJGPP v2.02 and later works around this.  Assume they have at least
00081        FILES=30 in their CONFIG.SYS (everybody should).  */
00082 #    define MAXOPEN_OS  20
00083 #   endif
00084 #  else
00085 #   define  MAXOPEN_OS  12     /* limit on number of open font files */
00086 #  endif
00087 # endif
00088 #endif
00089 
00090 #ifdef LJ_RESIDENT_FONTS
00091 /* we have to read tfm files as well */
00092 #define  MAXOPEN       (MAXOPEN_OS - 1)
00093 #else
00094 #define  MAXOPEN       MAXOPEN_OS
00095 #endif
00096 
00097 #define  NFNTCHARS       LASTFNTCHAR+1
00098 #define  STACK_SIZE      100     /* DVI-stack size                     */
00099 #define  NONEXISTANT     -1      /* offset for PXL files not found     */
00100 #ifdef RISC_USE_OSL
00101 # define  NO_FILE        (FPNULL-1)
00102 #else
00103 # define  NO_FILE        ((FILE *)-1)
00104 #endif
00105 #define  NEW(A) ((A *)  malloc(sizeof(A)))
00106 #define  EQ(a,b)        (strcmp(a,b)==0)
00107 #define  MM_TO_PXL(x)   (int)(((x)*RESOLUTION*10)/254)
00108 #define  PT_TO_PXL(x)   (int)((long4)((x)*RESOLUTION*100l)/7224)
00109 #define  PT_TO_DVI(x)   (long4)((x)*65536l)
00110 #define  BINOPEN(f) BOPENCMD(f,READ_BINARY)
00111 /* SMALL_SIZE characters are loaded into font storage of the printer   */
00112 /* LARGE_SIZE characters are rastered                                  */
00113 /* HUGE_SIZE characters are not loaded into the memory of the host     */
00114 #define  SMALL_SIZE (unsigned char) 0
00115 #define  LARGE_SIZE (unsigned char) 1
00116 #define  HUGE_SIZE  (unsigned char) 2
00117 #define  HUGE_CHAR_PATTERN 32767l
00118 #define  BYTES_PER_PIXEL_LINE 500    /* max number of bytes per pixel line */
00119 
00120 
00121 #define PK_POST 245
00122 #define PK_PRE 247
00123 #define PK_ID 89
00124 
00125 /* to speedup the program a little: redefinition of PixRound and PutWord */
00126 /*#define PIXROUND(x,c) ((((double)x+(double)(c>>1))/(double)c)+0.5)*/
00127 #define PIXROUND(x,c) (((x)+c)/c)
00128 #define PUTWORD(w)  EMITC( ((unsigned char)(w>>8) & 0xff)), EMITC((unsigned char)(w & 0xff))
00129 /*************************************************************************/
00130 #ifdef RISC_BUFFER
00131 # define   EMIT           emsize = sprintf
00132 # define   EMFLUSH        b_wrtmult(outfp,embuf,emsize)
00133 # define   EMTO           embuf
00134 # define   EMIT1(a)       emsize = sprintf(embuf,a), EMFLUSH
00135 # define   EMIT2(a,b)     emsize = sprintf(embuf,a,b), EMFLUSH
00136 # define   EMIT3(a,b,c)   emsize = sprintf(embuf,a,b,c), EMFLUSH
00137 # define   EMIT4(a,b,c,d) emsize = sprintf(embuf,a,b,c,d), EMFLUSH
00138 #else
00139 # ifdef RISC_USE_OSL
00140 #  define  EMIT           emsize = sprintf
00141 #  define  EMFLUSH        write_multi(embuf,1,emsize,outfp)
00142 #  define  EMTO           embuf
00143 #  define  EMIT1(a)       emsize = sprintf(embuf,a), EMFLUSH
00144 #  define  EMIT2(a,b)     emsize = sprintf(embuf,a,b), EMFLUSH
00145 # define   EMIT3(a,b,c)   emsize = sprintf(embuf,a,b,c), EMFLUSH
00146 # define   EMIT4(a,b,c,d) emsize = sprintf(embuf,a,b,c,d), EMFLUSH
00147 # else
00148 #  define  EMIT           fprintf            /* output a formatted string   */
00149 #  define  EMTO           outfp
00150 #  define  EMIT1(a)       fprintf(outfp,a)
00151 #  define  EMIT2(a,b)     fprintf(outfp,a,b)
00152 #  define  EMIT3(a,b,c)   fprintf(outfp,a,b,c)
00153 #  define  EMIT4(a,b,c,d) fprintf(outfp,a,b,c,d)
00154 # endif
00155 #endif
00156 #ifndef vms
00157 # ifdef RISC_BUFFER
00158 #  define  EMITB(len,b)   b_wrtmult(outfp,b,len) /* output binary data of len*/
00159 # else
00160 #  define  EMITB(len,b)   write_multi(b,1,len,outfp)
00161 # endif
00162 #else
00163     /* VMS doesn't like to use fwrite on a file with fixed record sizes,
00164        so use number of putc calls */
00165 # define  EMITB(len,b)   for (kk = 0;kk < len; kk++) fputc(*(b+kk),outfp);
00166 #endif
00167 #define  EMITWORD(w)     PUTWORD((w))        /* output a 2 byte word of data */
00168 
00169 #define  MoveOver(b)  h += (long4) b
00170 #define  MoveDown(a)  v += (long4) a
00171 #define  qfprintf if (!G_quiet) fprintf
00172 #define  qprintf  if (!G_quiet) printf
00173 #define  LARGER(a,b) (((a)>(b)) ? (a) : (b))
00174 
00175 #ifdef IBM3812
00176 #define  PRINTER      "IBM 3812 pageprinter"
00177 #define  EMITC(c)      PMPoutC(c)               /* output a single character */
00178 #define  PMPcont(l)    PMPout(-1,(char *)l)       /* next l bytes continuous */
00179 #define  PMPflush      PMPout(0l,"")                     /* flush PMP-buffer */
00180 #define  EMITL(l,d)    PMPout((int)l,d)      /* EMIT-logical: via PMP-buffer */
00181 #define  hconvRESOLUTION   240
00182 #define  vconvRESOLUTION   240
00183 #define  CHAR_WIDTH_LARGE  100       /*  limit for loading into printer font */
00184 #define  CHAR_HEIGTH_LARGE 127       /*  limit for loading into printer font */
00185 #define  OUTBUFSIZE     20000        /*   size of output buffer for PMP cmds */
00186                       /*   has to be less max(signed int)     */
00187 #define  MAXFONTSTORAGE      130000l /* font storage in the 3812 pageprinter */
00188 #define  EMITFILE_EXTENSION    ".pmp"      /* default extension of emit file */
00189 #define  XDEFAULTOFF     ((int)(0.72*RESOLUTION))/* default x and y offset   */
00190 #define  YDEFAULTOFF    RESOLUTION
00191 #define  CHARSTRINGMAX  80                /* bufferlength for SetString      */
00192 #define  MAX_PAGE_WIDTH  2040
00193 #define  MAX_PAGE_HEIGHT 3360
00194 /**********************************************************************/
00195 /**************  Positioning for the 3812  ****************************/
00196 /**********************************************************************/
00197 #define VERT_HALF(n) ((short)((n+1)>>1)-1)
00198 #define HOR_HALF(n)  ((short)(n>>1))
00199 #define MoveHor(n)  if ((n)!=0) { PMPcont(3); PMPout(1,"\342"); EMITWORD((n)); }
00200 #define MoveVert(n) if ((n)!=0) { PMPcont(3); PMPout(1,"\343"); EMITWORD((n)); }
00201 #endif /* IBM 3812 */
00202 
00203 #ifdef LJ
00204 # ifdef LJ4
00205 #  ifdef LJ4L
00206 #  define  PRINTER       "HP Laserjet 4L"
00207 #  else
00208 #  define  PRINTER       "HP Laserjet 4"
00209 #  endif
00210 # else
00211 #  ifdef LJ2P
00212 #   define  PRINTER       "HP LaserJet IIP"
00213 #  else
00214 #   ifdef LJ2
00215 #    define  PRINTER       "HP LaserJet 2"
00216 #   else
00217 #    define  PRINTER       "HP LaserJet"
00218 #   endif
00219 #  endif
00220 # endif
00221 
00222 # ifdef LJ4
00223 #  ifdef LJ4L
00224 int   RESOLUTION = 300;
00225 char *MFMODE     = MFMODE300;
00226 #  else
00227 int   RESOLUTION = 600;
00228 char *MFMODE     = MFMODE600;
00229 #  endif
00230 # else
00231 #  define RESOLUTION 300
00232 # endif
00233 # define  hconvRESOLUTION   RESOLUTION
00234 # define  vconvRESOLUTION   RESOLUTION
00235 # ifdef LJ2
00236 /* the printer limit of the LJ2P is actually 16384x16384,
00237   * but to exploit it, one would need lots of memory in the printer
00238  */
00239 #  define  CHAR_WIDTH_LARGE  200     /* limit for loading into printer font */
00240 #  define  CHAR_HEIGTH_LARGE 255         /* y_offset reaches the same size! */
00241 # else   /* such as LaserJet+, Laserjet II */
00242 #  define  CHAR_WIDTH_LARGE  100     /* limit for loading into printer font */
00243 #  define  CHAR_HEIGTH_LARGE 127         /* y_offset reaches the same size! */
00244 # endif
00245 # define  EMITFILE_EXTENSION  ".lj"       /* default extension of emit file */
00246 # ifndef MAX_FONTS_PER_PAGE
00247 #  define  MAX_FONTS_PER_PAGE 16        /* maximum number of fonts per page */
00248 # endif
00249 # define  HANDLE_MAX_FONTS  255      /* max nr of fonts handled (rasterfont) */
00250 # define  FONTS_DOWNLOADABLE 32    /* max nr of fonts that can be downloaded */
00251 # ifdef SHARP_JX_9500
00252 #  define  MAXFONTSTORAGE (200l*1024l)               /* standard user memory */
00253 # else
00254 #  define  MAXFONTSTORAGE (395l*1024l)               /* standard user memory */
00255 # endif
00256 # ifdef RISC_BUFFER
00257 #  define EMITC(c)       b_write(outfp,c)       /* output a single character */
00258 # else
00259 #  define EMITC(c)       write_byte(outfp,c)    /* output a single character */
00260 # endif
00261 # define  EMITL(l,d)     EMITB(l,d)                  /* EMIT-logical = EMITB */
00262 
00263 # define  XDEFAULTOFF   ((int)(0.72*RESOLUTION))
00264 # define  YDEFAULTOFF   RESOLUTION
00265 #ifdef NEVER
00266 # define  XDEFAULTOFF   RESOLUTION   /*x default offset on page 1in (LJ2)*/
00267 # define  YDEFAULTOFF   RESOLUTION    /* y default offset on page 1inch */
00268 #endif
00269 # define  max(x,y)       if ((y)>(x)) x = y
00270 # ifndef vms
00271 #  define  INT_ASCII(b,i) \
00272    if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%hd",i)
00273 # else
00274 #  define  INT_ASCII(b,i) \
00275    if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%d",i)
00276 # endif
00277 #endif
00278 
00279 
00280 #ifndef SEVENBIT
00281 #define VisChar(c) (unsigned char)(c)
00282 #endif
00283 
00284 #define GetBytes(fp,buf,n) read_multi(buf,1,n,fp) /* used to be a function */
00285 
00286 
00287 /**********************************************************************/
00288 /***********************  external definitions  ***********************/
00289 /**********************************************************************/
00290 
00291 #ifndef WIN32
00292 #ifndef _AMIGA
00293 # ifndef unix
00294 #  if NeedFunctionPrototypes
00295 long    access(char *, int);      /* all the other ones known under RISC OS */
00296 #  else
00297 long    access();
00298 #  endif
00299 #  ifndef __riscos
00300 FILEPTR BOPENCMD();
00301 void    exit();
00302 int     fclose();
00303 int     fprintf();
00304 int     fseek();
00305 /*char   *index();*/
00306 int     printf();
00307 int     sscanf();
00308 int     strcmp();
00309 char   *strcpy();
00310 #   ifdef MSC5
00311 unsigned int strlen();
00312 #   endif
00313 void    free();
00314 void    setbuf();
00315 #  endif
00316 
00317 #  ifdef MSC5
00318 int     intdos();
00319 #  endif
00320 # endif
00321 #endif
00322 #else /* WIN32 */
00323 #include <string.h>
00324 #include <stdio.h>
00325 #include <stdlib.h>
00326 #undef CopyFile
00327 #define CopyFile LJCopyFile
00328 #define ResetPrinter LJResetPrinter
00329 #endif
00330 
00331 #ifndef USEPXL
00332 /* interface to gf.c */
00333 extern FILEPTR gfin;
00334 extern int checksum;
00335 extern long4 tfm_wd[], char_pointer[];
00336 extern char char_exists[];
00337 extern int num_cols, num_rows, num_bytes, x_offset, y_offset;
00338 extern unsigned char bits[];
00339 extern int gf_font_max_m, gf_font_max_n, gf_font_min_n;
00340 extern int gettochar();
00341 extern void readbits();
00342 extern void readpost();
00343 extern void seekpost();
00344 extern int seekchar();
00345 #endif
00346 
00347 /**********************************************************************/
00348 /********************** Special Data Structures ***********************/
00349 /**********************************************************************/
00350 
00351 typedef enum  { None, String, Integer /*, Number, Dimension*/ }
00352 
00353 
00354 ValTyp;
00355 typedef struct {
00356   char    *Key;       /* the keyword string */
00357   char    *Val;       /* the value string */
00358   ValTyp  vt;         /* the value type */
00359   union {         /* the decoded value */
00360     int     i;
00361     float   n;
00362   } v;
00363 } KeyWord;
00364 typedef struct {
00365   char    *Entry;
00366   ValTyp  Typ;
00367 } KeyDesc;
00368 
00369 /**********************************************************************/
00370 /***********************  Font Data Structures  ***********************/
00371 /**********************************************************************/
00372 
00373 struct char_entry {             /* character entry */
00374 #ifdef USEPXL
00375     unsigned short  width, height;      /* width and height in pixels */
00376     short   xOffset, yOffset, yyOffset; /* x offset and y offset in pixels*/
00377 #endif
00378     struct {
00379         bool isloaded;
00380         union {
00381             long4    fileOffset;
00382             long4    *pixptr;
00383         } address;
00384     } where;
00385     long4    tfmw;             /* TFM width                 */
00386     long4    cw;               /* character width in pixels */
00387     unsigned char   flag_byte;          /* for PK-files    */
00388     unsigned char   charsize;
00389 };
00390 struct font_entry {    /* font entry */
00391     long4    k, c, s, d;
00392     int     a, l;
00393     char n[STRSIZE];          /* FNT_DEF command parameters                */
00394     long4    font_mag;         /* computed from FNT_DEF s and d parameters  */
00395     /*char psname[STRSIZE];*/ /* PostScript name of the font               */
00396     char    name[STRSIZE];    /* full name of PXL file                     */
00397     FILEPTR font_file_id;      /* file identifier (NO_FILE if none)         */
00398 #ifdef USEPXL
00399     long4    magnification;    /* magnification read from PXL file          */
00400     long4    designsize;       /* design size read from PXL file            */
00401 #endif
00402     struct char_entry ch[NFNTCHARS];   /* character information            */
00403     struct font_entry *next;
00404     unsigned short ncdl;      /* #of different chars actually downloaded   */
00405     unsigned short plusid;    /* Font id in Printer                        */
00406     bool used_on_this_page;
00407 #ifdef LJ_RESIDENT_FONTS
00408     bool resident_p;          /* is font resident in printer?              */
00409     char symbol_set[40];      /* symbol set value (resident fonts)         */
00410     unsigned short resid;     /* typeface id (resident fonts)              */
00411     unsigned spacing;         /* 0=monospace, 1=variable (resident fonts)  */
00412     unsigned style;           /* upright/italic/... (resident fonts)       */
00413     int weight;               /* regular/bold/... (resident fonts)         */
00414     double pitch;             /* chars per inch (monospaced resident fonts)*/
00415 #endif
00416     enum PxlId {
00417         id1001, id1002, pk89    } id;
00418 #ifdef LJ
00419     unsigned short max_width, max_height, max_yoff;
00420 #endif
00421 };
00422 
00423 
00424 struct pixel_list {
00425     FILEPTR pixel_file_id;    /* file identifier  */
00426     int     use_count;        /* count of "opens" */
00427 };
00428 
00429 #ifdef __riscos
00430 typedef struct {
00431   int scalex;
00432   int scaley;
00433   int cropl;
00434   int cropb;
00435   int cropr;
00436   int cropt;
00437 } diagtrafo;                  /* to be passed to diagrams */
00438 #endif
00439 
00440 
00441 /**********************************************************************/
00442 /*************************  Global Procedures  ************************/
00443 /**********************************************************************/
00444 /* Note: Global procedures are declared here in alphabetical order, with
00445    those which do not return values typed "void".  Their bodies occur in
00446    alphabetical order following the main() procedure.  The names are
00447    kept unique in the first 6 characters for portability. */
00448 
00449 #if NeedFunctionPrototypes
00450 # define DVIPROTO(x) x
00451 #if NeedVarargsPrototypes
00452 # define DVIELI() (char *fmt, ...)
00453 #else
00454 # define DVIELI() ()
00455 #endif
00456 #else
00457 # define DVIPROTO(x) ()
00458 # define DVIELI() ()
00459 #endif
00460 
00461 double  ActualFactor DVIPROTO((long4));
00462 void    AllDone DVIPROTO((bool));
00463 #ifdef  MSC5
00464 void    AssureBinary DVIPROTO((FILEPTR));  /* DOS and Microsoft C dependent !!! */
00465 #endif
00466 void    CloseFiles DVIPROTO((void));
00467 void    CopyFile DVIPROTO((char *));
00468 void    CopyHPFile DVIPROTO((char *));
00469 void    DecodeArgs DVIPROTO((int, char *[]));
00470 #ifdef __riscos
00471 void    diagram DVIPROTO((char *, diagtrafo *));
00472 void   *xosfile_set_type DVIPROTO((char *, int));
00473 void    MakeMetafontFile DVIPROTO((char *, char *, int));
00474 #endif
00475 void    DoBop DVIPROTO((void));
00476 long4   DoConv DVIPROTO((long4, long4, int));
00477 void    DoSpecial DVIPROTO((char *, int));
00478 void    EmitChar DVIPROTO((long4, struct char_entry *));
00479 void    Fatal DVIELI();
00480 void    FindPostAmblePtr DVIPROTO((long *));
00481 void    FormFeed DVIPROTO((void));
00482 void    GetFontDef DVIPROTO((void));
00483 char    *GetKeyStr DVIPROTO((char *, KeyWord *));
00484 bool    GetKeyVal DVIPROTO((KeyWord *, KeyDesc[], int, int *));
00485 bool    IsSame DVIPROTO((char *, char *));
00486 void    LoadAChar DVIPROTO((long4, register struct char_entry *));
00487 long4   NoSignExtend DVIPROTO((FILEPTR, int));
00488 void    OpenFontFile DVIPROTO((void));
00489 long4   PixRound DVIPROTO((long4, long4));
00490 void    PkRaster DVIPROTO((struct char_entry *, int)); 
00491 void    RasterLine DVIPROTO((struct char_entry *, unsigned int, 
00492                           unsigned int, unsigned char *));
00493 void    RasterChar DVIPROTO((struct char_entry *));
00494 void    ReadFontDef DVIPROTO((long4));
00495 void    ReadPostAmble DVIPROTO((bool));
00496 void    SetChar DVIPROTO((long4, short, int, bool, bool));
00497 void    SetFntNum DVIPROTO((long4, bool));
00498 void    SetPosn DVIPROTO((long4, long4));
00499 void    SetRule DVIPROTO((long4, long4, int));
00500 void    SetString DVIPROTO((short, int));
00501 long4   SignExtend DVIPROTO((FILEPTR, int));
00502 void    SkipFontDef DVIPROTO((void));
00503 bool    tfm_read_info  DVIPROTO((char *, tfm_info_type *));
00504 void    Warning DVIELI();
00505 unsigned char   skip_specials DVIPROTO((long4 *));
00506 #ifdef LJ4
00507 int     CompressLine2 DVIPROTO((unsigned char *, unsigned char *, int));
00508 int     CompressLine3 DVIPROTO((unsigned char *, unsigned char *, int));
00509 void    CompressedCharLine DVIPROTO((struct char_entry *,int,unsigned char *));
00510 #endif
00511 #ifdef IBM3812
00512 void    PMPout DVIPROTO((int, char *));
00513 void    PMPoutC DVIPROTO((char));
00514 #endif
00515 
00516 /* buffer IO */
00517 char   b_read DVIPROTO((FILEPTR));
00518 #ifdef RISC_BUFFER
00519 void   b_write DVIPROTO((FILEPTR, char));
00520 void   b_wrtmult DVIPROTO((FILEPTR, char *, int));
00521 void   b_oflush DVIPROTO((FILEPTR));
00522 #endif
00523 
00524 
00525 /**********************************************************************/
00526 /*************************  Global Variables  *************************/
00527 /**********************************************************************/
00528 bool    ManualFeed = _FALSE;
00529 long4    FirstPage  = -1000000;  /* first page to print (uses count0)   */
00530 long4    LastPage   = 1000000;   /* last page to print                  */
00531 long4    PrintPages = 1000000;   /* nr of pages to print                */
00532 bool    FirstPageSpecified = _FALSE;
00533 bool    LastPageSpecified = _FALSE;
00534 #ifndef KPATHSEA
00535 char   *PXLpath = FONTAREA;
00536 #endif
00537 char    G_progname[STRSIZE];     /* program name                        */
00538 char    filename[STRSIZE];       /* DVI file name                       */
00539 char    rootname[STRSIZE];       /* DVI filename without extension      */
00540 char   *HeaderFileName = "";     /* file name & path of Headerfile      */
00541 char   *EmitFileName = "";       /* file name & path for output         */
00542 #ifdef IBM3812
00543 bool    FirstAlternate = _FALSE; /* first page from alternate casette ?   */
00544 #endif
00545 bool    Reverse = _FALSE;        /* process DVI pages in reverse order?   */
00546 bool    Landscape = _FALSE;      /* print document in ladscape mode       */
00547 bool    ResetPrinter = _TRUE;    /* reset printer at the begin of the job */
00548 bool    DoublePage = _FALSE;     /* print on both sides of a paper        */
00549 bool    PrintSecondPart = _TRUE; /* print First Part when DoublePage      */
00550 bool    PrintFirstPart  = _TRUE; /* print Second Part when DoublePage     */
00551 bool    PrintEmptyPages = _TRUE; /* print Empty pages in DoublePage mode  */
00552 short   PageParity = 1;
00553 #ifdef MAKETEXPK
00554 #ifdef KPATHSEA
00555 bool    makeTexPK = MAKE_TEX_PK_BY_DEFAULT;
00556 #else
00557 bool    makeTexPK = _TRUE;
00558 #endif
00559 #endif
00560 
00561 #ifdef LJ
00562 bool    kyocera_mode = _FALSE;  /* bug fixes for Kyocera F-1200 LJ-Emulation */
00563 bool    brother_mode = _FALSE;  /* bug fixes for Brother HL-8D LJ-Emulation */
00564 #ifdef LJ2P
00565 int     DuplexMode = 0;
00566 #endif
00567 #ifdef LJ4
00568 bool    econoMode = _FALSE;
00569 bool    LJ6 = _FALSE;
00570 #endif
00571 bool    PrintTestPage = _FALSE; /* print testpage with pagecounter after job */
00572 unsigned short pagesize = 0;    /* page size value                      */
00573 unsigned short pgsiz_dots = 0;  /* page size in dots (for rule-clipping)*/
00574 #endif
00575 
00576 
00577 #ifndef vms
00578 short   G_errenc = 0;           /* has an error been encountered?      */
00579 #else
00580 long4    G_errenc = SS$_NORMAL;  /* has an error been encountered?      */
00581 #endif
00582 bool    G_header = _FALSE;      /* copy header file to output?         */
00583 bool    G_quiet = _FALSE;       /* for quiet operation                 */
00584 bool    G_verbose = _FALSE;     /* inform user about pxl-files used    */
00585 bool    G_nowarn = _FALSE;      /* don't print out warnings            */
00586 short   x_origin;               /* x-origin in dots                    */
00587 short   y_origin;               /* y-origin in dots                    */
00588 short   x_goffset;              /* global x-offset in dots             */
00589 short   y_goffset;              /* global y-offset in dots             */
00590 unsigned short ncopies = 1;     /* number of copies to print           */
00591 long4    hconv, vconv;           /* converts DVI units to pixels        */
00592 long4    den;                    /* denominator specified in preamble   */
00593 long4    num;                    /* numerator specified in preamble     */
00594 long4    h;                      /* current horizontal position         */
00595 long4    hh = 0;                 /* current h on device                 */
00596 long4    v;                      /* current vertical position           */
00597 long4    vv = 0;                 /* current v on device                 */
00598 long4    mag;                    /* magnification specified in preamble */
00599 long     usermag = 0;            /* user specified magnification        */
00600 int      ndone = 0;              /* number of pages converted           */
00601 int      nopen = 0;              /* number of open PXL files            */
00602 #ifdef vms
00603 int    kk;                   /* loop variable for EMITB        */
00604 #endif
00605 FILEPTR outfp = FPNULL;          /* output file                         */
00606 FILEPTR pxlfp;                   /* PXL file pointer                    */
00607 FILEPTR dvifp  = FPNULL;         /* DVI file pointer                    */
00608 struct font_entry *prevfont = NULL; /* font_entry pointer previous font*/
00609 struct font_entry *fontptr;      /* font_entry pointer                  */
00610 struct font_entry *hfontptr = NULL; /* font_entry pointer              */
00611 struct font_entry *pfontptr = NULL; /* previous font_entry pointer     */
00612 struct pixel_list pixel_files[MAXOPEN+1]; /* list of open PXL files    */
00613 long   postambleptr;            /* Pointer to the postamble            */
00614 long   ppagep;                  /* previous page pointer               */
00615 static int      last_ry = UNKNOWN;      /* last y-position on page     */
00616 static int      last_rx = UNKNOWN;      /* last x-position on page     */
00617 long4  StartPrintPages;         /* notpad for double paged output      */
00618 int    WouldPrint    = 0;
00619 bool   ZeroPage = _FALSE;       /* Document starts with a Zero Page    */
00620 bool   EvenPage = _FALSE;       /* Document starts with an even Page   */
00621 long4  LastPtobePrinted = 0;
00622 int    G_ncdl = 0;
00623 
00624 long     allocated_storage = 0; /* size of mallocated storage (statistics) */
00625 long4    power[32] ;
00626 long4    gpower[33] ;
00627 
00628 unsigned char buffin[BUFFSIZE]; /* Input buffer; always used for Copy[HP]File */
00629 int binumber=0;            /* number of valid bytes in input buffer */
00630 int biact=0;               /* number of next byte to read from input buffer */
00631 #ifdef RISC_BUFFER
00632 char buffout[BUFFSIZE];    /* Output buffer; used if RISC_BUFFER defined */
00633 int boact=0;               /* number of next byte to write to output buffer */
00634 #endif
00635 
00636 #ifdef LJ4
00637 # define DEFAULT_COMPRESS_MODE  3
00638 # define DEFAULT_COMPRESS_WIDTH 0
00639 # define COMPRESS_WIDTH0        0
00640 # define COMPRESS_WIDTH2        72
00641 # define COMPRESS_WIDTH3        0
00642 /* Raster chars compression */
00643 int CompressCharWidth = -1;  /* Value to be determined dependent at runtime */
00644 int CompressCharMode;        /* Used only from within RasterChar/Line */
00645 int UseCompression = DEFAULT_COMPRESS_MODE; /* This performs very well with Characters */
00646 /* Shared by both compression types */
00647 unsigned char *PrevLine = NULL; /* Holds last raster line; set at runtime */
00648 int PrevSize = 0;               /* Size of PrevLine */
00649 /* Downloaded chars compression */
00650 int CChar_Off, CChar_Last;      /* For compressed character downloading */
00651 bool CompressFontMode = _TRUE;  /* Download characters compressed */
00652 #endif /* LJ4 */
00653 
00654 #ifdef RISC_USE_OSL
00655 char   embuf[STRSIZE];         /* Buffer for emitting stuff */
00656 int    emsize;                 /* Number of bytes written in buffer */
00657 #else
00658 # ifdef RISC_BUFFER
00659 char   embuf[STRSIZE];
00660 int    emsize;
00661 # endif
00662 #endif
00663 
00664 #ifdef __riscos
00665 #define DIAGDIRSIZE 32
00666 char diagdir[DIAGDIRSIZE] = "LJdiag"; /* Prefix name of directory for
00667                                     cached printouts */
00668 bool cachediag = _FALSE;       /* cache PDriver's output in document folder */
00669 bool printdiag = _TRUE;        /* printf diagrams */
00670 FILEPTR metafile = FPNULL;     /* Filepointer of file containing
00671                               metafont directives*/
00672 
00673 char MFFileName[STRSIZE];
00674 int RasterMultipass = 0;
00675 #endif
00676 
00677 #ifdef DEBUG
00678 int Debug = 0;
00679 #define DEBUG_START() do { if (Debug) {
00680 #define DEBUG_END()        fflush (stdout); } } while (0)
00681 #define DEBUG_PRINT(str)                                       \
00682   DEBUG_START (); fputs (str, stdout); DEBUG_END ()
00683 #define DEBUG_PRINT1(str, e1)                                         \
00684   DEBUG_START (); printf (str, e1); DEBUG_END ()
00685 #else
00686 #define DEBUG_PRINT(str)
00687 #define DEBUG_PRINT1(str, e1)
00688 #endif
00689 
00690 #ifdef LJ
00691 int   fonts_used_on_this_page = MAX_FONTS_PER_PAGE+1;
00692 char  rasterfont[HANDLE_MAX_FONTS];
00693     /* raster if fonts/page>MAX_FONTS_PER_PAGE*/
00694 #ifdef LJ_RESIDENT_FONTS
00695 unsigned resident_count = 0;
00696 #ifndef KPATHSEA
00697 char *TFMpath = DEFAULT_TFM_PATH;
00698 #endif
00699 #endif
00700 #endif
00701 
00702 long     used_fontstorage = 0;
00703 
00704 #ifdef IBM3812
00705 char    PMPformat[20];
00706 char    CharString[CHARSTRINGMAX];
00707 unsigned int CharStringPos = 0;
00708 #define CharStringOut \
00709     if (CharStringPos>0) { \
00710         PMPcont(CharStringPos+1);\
00711         PMPoutC((unsigned char)CharStringPos);\
00712         PMPout(CharStringPos, CharString); \
00713         CharStringPos=0; }
00714 #endif
00715 
00716 
00717 /************************timing stuff*********************/
00718 #ifdef TIMING
00719 # ifdef BSD_TIME_CALLS
00720 #  ifndef vms
00721 #   include <sys/timeb.h>
00722 #  else
00723 #   include <timeb.h>
00724 #  endif
00725 struct timeb timebuffer;
00726 double  start_time;
00727 # else
00728 #  ifdef __riscos
00729 #   include <sys/times.h>
00730 #  else
00731 #   include <sys/time.h>
00732 struct timeval Tp;
00733 double  start_time;
00734 #  endif
00735 # endif
00736 #endif /* TIMING */
00737 
00738 
00739 #endif /* DVI2XX_H */