Debian Codegraph @

texk/dviljk/dvi2xx.h

raw
1 /* $Id: dvi2xx.h,v 2.3 1996/05/20 11:05:57 neumann Exp $ */
2 #ifndef DVI2XX_H
3 #define DVI2XX_H
4 /**********************************************************************
5 ************************ Global Definitions ************************
6 **********************************************************************/
7 /* #define IBM3812 */
8 /* #define LJ */
9 /* #define DRAWGLYPH */
10
11 #ifdef KPATHSEA
12 #include <kpathsea/config.h>
13 #include <kpathsea/c-std.h>
14 #include <kpathsea/c-limits.h>
15 #include <kpathsea/c-pathch.h>
16 #include <kpathsea/magstep.h>
17 #include <kpathsea/proginit.h>
18 #include <kpathsea/progname.h>
19 #include <kpathsea/tex-file.h>
20 #include <kpathsea/tex-glyph.h>
21 #include <kpathsea/tex-hush.h>
22 #include <kpathsea/tex-make.h>
23 #include <kpathsea/version.h>
24 #include <stdarg.h>
25 #include <c-auto.h>
26 #else
27 #include <string.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <unistd.h>
31 #ifdef unix
32 #include <limits.h>
33 #endif
34 #endif
35
36 #include <signal.h>
37 #include <ctype.h>
38 #ifdef vms
39 #include <file.h>
40 #else
41 # ifndef __riscos
42 # include <fcntl.h>
43 # endif
44 #endif
45 #ifdef MSC5
46 #include <dos.h> /* only for binaryopen on device */
47 #endif
48
49
50 #include "config.h"
51 #include "commands.h"
52
53 #define DVIFORMAT 2
54 #ifndef UNKNOWN
55 #define UNKNOWN -1
56 #endif
57 #define FIRSTFNTCHAR 0
58
59 #ifdef __riscos
60 # ifdef RISC_USE_OSL
61 # define MAXOPEN_OS 16
62 # else
63 # define MAXOPEN_OS 8 /* don't know if this IS the maximum */
64 # endif
65 #else
66 # ifdef OPEN_MAX /* ... in a friendly unix system */
67 # ifndef vms
68 # define MAXOPEN_OS (OPEN_MAX - 8)
69 # else
70 # define MAXOPEN_OS 12 /* OPEN_MAX seems to be 8 on VMS systems */
71 # endif
72 # else
73 # ifdef __DJGPP__
74 # if __DJGPP_MINOR__ <= 1
75 /* DJGPP needs few handles free in the first 20, or else child programs
76 (called by MakeTeX... scripts) won't run, since the stub loader
77 cannot open the .exe program. This is because DOS only copies the
78 first 20 handles to the child program. */
79 # define MAXOPEN_OS 5
80 # else
81 /* DJGPP v2.02 and later works around this. Assume they have at least
82 FILES=30 in their CONFIG.SYS (everybody should). */
83 # define MAXOPEN_OS 20
84 # endif
85 # else
86 # define MAXOPEN_OS 12 /* limit on number of open font files */
87 # endif
88 # endif
89 #endif
90
91 #ifdef LJ_RESIDENT_FONTS
92 /* we have to read tfm files as well */
93 #define MAXOPEN (MAXOPEN_OS - 1)
94 #else
95 #define MAXOPEN MAXOPEN_OS
96 #endif
97
98 #define NFNTCHARS LASTFNTCHAR+1
99 #define STACK_SIZE 100 /* DVI-stack size */
100 #define NONEXISTANT -1 /* offset for PXL files not found */
101 #ifdef RISC_USE_OSL
102 # define NO_FILE (FPNULL-1)
103 #else
104 # define NO_FILE ((FILE *)-1)
105 #endif
106 #define NEW(A) ((A *) malloc(sizeof(A)))
107 #define EQ(a,b) (strcmp(a,b)==0)
108 #define MM_TO_PXL(x) (int)(((x)*RESOLUTION*10)/254)
109 #define PT_TO_PXL(x) (int)((long4)((x)*RESOLUTION*100l)/7224)
110 #define PT_TO_DVI(x) (long4)((x)*65536l)
111 #define BINOPEN(f) BOPENCMD(f,READ_BINARY)
112 /* SMALL_SIZE characters are loaded into font storage of the printer */
113 /* LARGE_SIZE characters are rastered */
114 /* HUGE_SIZE characters are not loaded into the memory of the host */
115 #define SMALL_SIZE (unsigned char) 0
116 #define LARGE_SIZE (unsigned char) 1
117 #define HUGE_SIZE (unsigned char) 2
118 #define HUGE_CHAR_PATTERN 32767l
119 #define BYTES_PER_PIXEL_LINE 500 /* max number of bytes per pixel line */
120 #define MAX_SPECIAL_DEFPOINTS 80 /* max number of defpoint specials */
121
122
123 #define PK_POST 245
124 #define PK_PRE 247
125 #define PK_ID 89
126
127 /* to speedup the program a little: redefinition of PixRound and PutWord */
128 /*#define PIXROUND(x,c) ((((double)x+(double)(c>>1))/(double)c)+0.5)*/
129 #define PIXROUND(x,c) (((x)+c)/c)
130 #define PUTWORD(w) EMITC( ((unsigned char)(w>>8) & 0xff)), EMITC((unsigned char)(w & 0xff))
131 /*************************************************************************/
132 #ifdef RISC_BUFFER
133 # define EMIT emsize = sprintf
134 # define EMFLUSH b_wrtmult(outfp,embuf,emsize)
135 # define EMTO embuf
136 # define EMIT1(a) emsize = sprintf(embuf,a), EMFLUSH
137 # define EMIT2(a,b) emsize = sprintf(embuf,a,b), EMFLUSH
138 # define EMIT3(a,b,c) emsize = sprintf(embuf,a,b,c), EMFLUSH
139 # define EMIT4(a,b,c,d) emsize = sprintf(embuf,a,b,c,d), EMFLUSH
140 #else
141 # ifdef RISC_USE_OSL
142 # define EMIT emsize = sprintf
143 # define EMFLUSH write_multi(embuf,1,emsize,outfp)
144 # define EMTO embuf
145 # define EMIT1(a) emsize = sprintf(embuf,a), EMFLUSH
146 # define EMIT2(a,b) emsize = sprintf(embuf,a,b), EMFLUSH
147 # define EMIT3(a,b,c) emsize = sprintf(embuf,a,b,c), EMFLUSH
148 # define EMIT4(a,b,c,d) emsize = sprintf(embuf,a,b,c,d), EMFLUSH
149 # else
150 # define EMIT fprintf /* output a formatted string */
151 # define EMTO outfp
152 # define EMIT1(a) fprintf(outfp,a)
153 # define EMIT2(a,b) fprintf(outfp,a,b)
154 # define EMIT3(a,b,c) fprintf(outfp,a,b,c)
155 # define EMIT4(a,b,c,d) fprintf(outfp,a,b,c,d)
156 # endif
157 #endif
158 #ifndef vms
159 # ifdef RISC_BUFFER
160 # define EMITB(len,b) b_wrtmult(outfp,b,len) /* output binary data of len*/
161 # else
162 # define EMITB(len,b) write_multi(b,1,len,outfp)
163 # endif
164 #else
165 /* VMS doesn't like to use fwrite on a file with fixed record sizes,
166 so use number of putc calls */
167 # define EMITB(len,b) for (kk = 0;kk < len; kk++) fputc(*(b+kk),outfp);
168 #endif
169 #define EMITWORD(w) PUTWORD((w)) /* output a 2 byte word of data */
170
171 #define MoveOver(b) h += (long4) b
172 #define MoveDown(a) v += (long4) a
173 #define qfprintf if (!G_quiet) fprintf
174 #define qprintf if (!G_quiet) printf
175 #define LARGER(a,b) (((a)>(b)) ? (a) : (b))
176
177 #ifdef IBM3812
178 #define PRINTER "IBM 3812 pageprinter"
179 #define EMITC(c) PMPoutC(c) /* output a single character */
180 #define PMPcont(l) PMPout(-1,(char *)l) /* next l bytes continuous */
181 #define PMPflush PMPout(0l,"") /* flush PMP-buffer */
182 #define EMITL(l,d) PMPout((int)l,d) /* EMIT-logical: via PMP-buffer */
183 #define hconvRESOLUTION 240
184 #define vconvRESOLUTION 240
185 #define CHAR_WIDTH_LARGE 100 /* limit for loading into printer font */
186 #define CHAR_HEIGTH_LARGE 127 /* limit for loading into printer font */
187 #define OUTBUFSIZE 20000 /* size of output buffer for PMP cmds */
188 /* has to be less max(signed int) */
189 #define MAXFONTSTORAGE 130000l /* font storage in the 3812 pageprinter */
190 #define EMITFILE_EXTENSION ".pmp" /* default extension of emit file */
191 #define XDEFAULTOFF ((int)(0.72*RESOLUTION))/* default x and y offset */
192 #define YDEFAULTOFF RESOLUTION
193 #define CHARSTRINGMAX 80 /* bufferlength for SetString */
194 #define MAX_PAGE_WIDTH 2040
195 #define MAX_PAGE_HEIGHT 3360
196 /**********************************************************************/
197 /************** Positioning for the 3812 ****************************/
198 /**********************************************************************/
199 #define VERT_HALF(n) ((short)((n+1)>>1)-1)
200 #define HOR_HALF(n) ((short)(n>>1))
201 #define MoveHor(n) if ((n)!=0) { PMPcont(3); PMPout(1,"\342"); EMITWORD((n)); }
202 #define MoveVert(n) if ((n)!=0) { PMPcont(3); PMPout(1,"\343"); EMITWORD((n)); }
203 #endif /* IBM 3812 */
204
205 #ifdef LJ
206 # ifdef LJ4
207 # ifdef LJ4L
208 # define PRINTER "HP Laserjet 4L"
209 # else
210 # define PRINTER "HP Laserjet 4"
211 # endif
212 # else
213 # ifdef LJ2P
214 # define PRINTER "HP LaserJet IIP"
215 # else
216 # ifdef LJ2
217 # define PRINTER "HP LaserJet 2"
218 # else
219 # define PRINTER "HP LaserJet"
220 # endif
221 # endif
222 # endif
223
224 # ifdef LJ4
225 # ifdef LJ4L
226 int RESOLUTION = 300;
227 const char *MFMODE = MFMODE300;
228 # else
229 int RESOLUTION = 600;
230 const char *MFMODE = MFMODE600;
231 # endif
232 # else
233 # define RESOLUTION 300
234 # endif
235 # define hconvRESOLUTION RESOLUTION
236 # define vconvRESOLUTION RESOLUTION
237 # ifdef LJ2
238 /* the printer limit of the LJ2P is actually 16384x16384,
239 * but to exploit it, one would need lots of memory in the printer
240 */
241 # define CHAR_WIDTH_LARGE 200 /* limit for loading into printer font */
242 # define CHAR_HEIGTH_LARGE 255 /* y_offset reaches the same size! */
243 # else /* such as LaserJet+, Laserjet II */
244 # define CHAR_WIDTH_LARGE 100 /* limit for loading into printer font */
245 # define CHAR_HEIGTH_LARGE 127 /* y_offset reaches the same size! */
246 # endif
247 # define EMITFILE_EXTENSION ".lj" /* default extension of emit file */
248 # ifndef MAX_FONTS_PER_PAGE
249 # define MAX_FONTS_PER_PAGE 16 /* maximum number of fonts per page */
250 # endif
251 # define HANDLE_MAX_FONTS 255 /* max nr of fonts handled (rasterfont) */
252 # define FONTS_DOWNLOADABLE 32 /* max nr of fonts that can be downloaded */
253 # ifdef SHARP_JX_9500
254 # define MAXFONTSTORAGE (200l*1024l) /* standard user memory */
255 # else
256 # define MAXFONTSTORAGE (395l*1024l) /* standard user memory */
257 # endif
258 # ifdef RISC_BUFFER
259 # define EMITC(c) b_write(outfp,c) /* output a single character */
260 # else
261 # define EMITC(c) write_byte(outfp,c) /* output a single character */
262 # endif
263 # define EMITL(l,d) EMITB(l,d) /* EMIT-logical = EMITB */
264
265 # define XDEFAULTOFF ((int)(0.72*RESOLUTION))
266 # define YDEFAULTOFF RESOLUTION
267 #ifdef NEVER
268 # define XDEFAULTOFF RESOLUTION /*x default offset on page 1in (LJ2)*/
269 # define YDEFAULTOFF RESOLUTION /* y default offset on page 1inch */
270 #endif
271 # ifndef vms
272 # define INT_ASCII(b,i) \
273 if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%hd",i)
274 # else
275 # define INT_ASCII(b,i) \
276 if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%d",i)
277 # endif
278 #endif
279
280
281 #ifndef SEVENBIT
282 #define VisChar(c) (unsigned char)(c)
283 #endif
284
285 /* Used to be a function. buf is always an array, never a pointer.
286 Without that invariant, we would have to introduce full dynamic
287 memory management in this driver -- probably it would be easier to
288 write a new one. [27 Jun 07 -js] */
289 #define GetBytes(fp,buf,n) \
290 ( sizeof(buf) != sizeof(void *) && sizeof(buf) > n ? \
291 (void)read_multi(buf, 1, n, fp) \
292 : Fatal("Try to read %d bytes in an array of size %d", n, sizeof(buf)) )
293
294
295 /**********************************************************************/
296 /*********************** external definitions ***********************/
297 /**********************************************************************/
298
299 #ifndef WIN32
300 #ifndef _AMIGA
301 # ifndef unix
302 long access(char *, int); /* all the other ones known under RISC OS */
303 # ifndef __riscos
304 FILEPTR BOPENCMD();
305 void exit();
306 int fclose();
307 int fprintf();
308 int fseek();
309 /*char *index();*/
310 int printf();
311 int sscanf();
312 int strcmp();
313 char *strcpy();
314 char *strncpy();
315 # ifdef MSC5
316 unsigned int strlen();
317 # endif
318 void free();
319 void setbuf();
320 # endif
321
322 # ifdef MSC5
323 int intdos();
324 # endif
325 # endif
326 #endif
327 #else /* WIN32 */
328 #include <string.h>
329 #include <stdio.h>
330 #include <stdlib.h>
331 #endif
332
333 #ifndef USEPXL
334 /* interface to gf.c */
335 extern FILEPTR gfin;
336 extern int checksum;
337 extern long4 tfm_wd[], char_pointer[];
338 extern char char_exists[];
339 extern int num_cols, num_rows, num_bytes, x_offset, y_offset;
340 extern unsigned char bits[];
341 extern int gf_font_max_m, gf_font_max_n, gf_font_min_n;
342 extern int gettochar();
343 extern void readbits();
344 extern void readpost();
345 extern void seekpost();
346 extern int seekchar();
347 #endif
348
349 /**********************************************************************/
350 /********************** Special Data Structures ***********************/
351 /**********************************************************************/
352
353 typedef enum { None, String, Integer /*, Number, Dimension*/ } ValTyp;
354 typedef struct {
355 char *Key; /* the keyword string */
356 char *Val; /* the value string */
357 ValTyp vt; /* the value type */
358 union { /* the decoded value */
359 int i;
360 float n;
361 } v;
362 } KeyWord;
363 typedef struct {
364 int KeyId; /* the keyword ID */
365 const char *Entry;
366 ValTyp Typ;
367 } KeyDesc;
368
369 /**********************************************************************/
370 /*********************** Font Data Structures ***********************/
371 /**********************************************************************/
372
373 struct char_entry { /* character entry */
374 #ifdef USEPXL
375 unsigned short width, height; /* width and height in pixels */
376 short xOffset, yOffset, yyOffset; /* x offset and y offset in pixels*/
377 #endif
378 struct {
379 bool isloaded;
380 union {
381 long4 fileOffset;
382 long4 *pixptr;
383 } address;
384 } where;
385 long4 tfmw; /* TFM width */
386 long4 cw; /* character width in pixels */
387 unsigned char flag_byte; /* for PK-files */
388 unsigned char charsize;
389 };
390 struct font_entry { /* font entry */
391 long4 k, c, s, d;
392 int a, l;
393 char n[STRSIZE]; /* FNT_DEF command parameters */
394 long4 font_mag; /* computed from FNT_DEF s and d parameters */
395 /*char psname[STRSIZE];*/ /* PostScript name of the font */
396 char *name; /* full name of PXL file */
397 FILEPTR font_file_id; /* file identifier (NO_FILE if none) */
398 #ifdef USEPXL
399 long4 magnification; /* magnification read from PXL file */
400 long4 designsize; /* design size read from PXL file */
401 #endif
402 struct char_entry ch[NFNTCHARS]; /* character information */
403 struct font_entry *next;
404 unsigned short ncdl; /* #of different chars actually downloaded */
405 unsigned short plusid; /* Font id in Printer */
406 bool used_on_this_page;
407 #ifdef LJ_RESIDENT_FONTS
408 bool resident_p; /* is font resident in printer? */
409 char symbol_set[40]; /* symbol set value (resident fonts) */
410 unsigned short resid; /* typeface id (resident fonts) */
411 unsigned spacing; /* 0=monospace, 1=variable (resident fonts) */
412 unsigned style; /* upright/italic/... (resident fonts) */
413 int weight; /* regular/bold/... (resident fonts) */
414 double pitch; /* chars per inch (monospaced resident fonts)*/
415 #endif
416 enum PxlId {
417 id1001, id1002, pk89 } id;
418 #ifdef LJ
419 unsigned short max_width, max_height, max_yoff;
420 #endif
421 };
422
423
424 struct pixel_list {
425 FILEPTR pixel_file_id; /* file identifier */
426 int use_count; /* count of "opens" */
427 };
428
429 #ifdef __riscos
430 typedef struct {
431 int scalex;
432 int scaley;
433 int cropl;
434 int cropb;
435 int cropr;
436 int cropt;
437 } diagtrafo; /* to be passed to diagrams */
438 #endif
439
440
441 /**********************************************************************/
442 /************************* Global Procedures ************************/
443 /**********************************************************************/
444 /* Note: Global procedures are declared here in alphabetical order, with
445 those which do not return values typed "void". Their bodies occur in
446 alphabetical order following the main() procedure. The names are
447 kept unique in the first 6 characters for portability. */
448
449 double ActualFactor(long4);
450 void AllDone(bool);
451 #ifdef MSC5
452 void AssureBinary(FILEPTR); /* DOS and Microsoft C dependent !!! */
453 #endif
454 void CloseFiles(void);
455 void my_CopyFile(const char *);
456 void CopyHPFile(char *);
457 void DecodeArgs(int, char *[]);
458 #ifdef __riscos
459 void diagram(char *, diagtrafo *);
460 void *xosfile_set_type(char *, int);
461 void MakeMetafontFile(char *, char *, int);
462 #endif
463 void DoBop(void);
464 long4 DoConv(long4, long4, int);
465 void DoSpecial(char *, int);
466 void EmitChar(long4, struct char_entry *);
467 void FindPostAmblePtr(long *);
468 void FormFeed(void);
469 void GetFontDef(void);
470 char *GetKeyStr(char *, KeyWord *);
471 bool GetKeyVal(KeyWord *, KeyDesc[], int, int *);
472 bool IsSame(const char *, const char *);
473 void LoadAChar(long4, register struct char_entry *);
474 void OpenFontFile(void);
475 long4 PixRound(long4, long4);
476 void PkRaster(struct char_entry *, int);
477 void RasterLine(struct char_entry *, unsigned int,
478 unsigned int, unsigned char *);
479 void RasterChar(struct char_entry *);
480 void ReadFontDef(long4);
481 void ReadPostAmble(bool);
482 void SetChar(long4, short, int, bool, bool);
483 void SetFntNum(long4, bool);
484 void SetPosn(long4, long4);
485 void SetRule(long4, long4, int);
486 void SetString(short, int);
487 long4 SignExtend(FILEPTR, int);
488 void SkipFontDef(void);
489 unsigned char skip_specials(long4 *);
490 #ifdef LJ4
491 int CompressLine2(unsigned char *, unsigned char *, int);
492 int CompressLine3(unsigned char *, unsigned char *, int);
493 void CompressedCharLine(struct char_entry *,int,unsigned char *);
494 #endif
495 #ifdef IBM3812
496 void PMPout(int, char *);
497 void PMPoutC(char);
498 #endif
499
500 /* buffer IO */
501 char b_read(FILEPTR);
502 #ifdef RISC_BUFFER
503 void b_write(FILEPTR, char);
504 void b_wrtmult(FILEPTR, char *, int);
505 void b_oflush(FILEPTR);
506 #endif
507
508
509 /**********************************************************************/
510 /************************* Global Variables *************************/
511 /**********************************************************************/
512 bool ManualFeed = _FALSE;
513 long4 FirstPage = -1000000; /* first page to print (uses count0) */
514 long4 LastPage = 1000000; /* last page to print */
515 long4 PrintPages = 1000000; /* nr of pages to print */
516 bool FirstPageSpecified = _FALSE;
517 bool LastPageSpecified = _FALSE;
518 #ifndef KPATHSEA
519 char *PXLpath = FONTAREA;
520 #endif
521 char *G_progname; /* program name */
522 char *filename; /* DVI file name */
523 char *rootname; /* DVI filename without extension */
524 const char *HeaderFileName = ""; /* file name & path of Headerfile */
525 const char *EmitFileName = ""; /* file name & path for output */
526 char tmp_dir[STRSIZE] = ""; /* temporary directory for auxiliary files */
527 enum { Ignore, PSFile_dvilj /*, PSFile_dvips */ } PSFileSyntaxTyp = PSFile_dvilj;
528 #ifdef IBM3812
529 bool FirstAlternate = _FALSE; /* first page from alternate casette ? */
530 #endif
531 bool Reverse = _FALSE; /* process DVI pages in reverse order? */
532 bool Landscape = _FALSE; /* print document in ladscape mode */
533 bool my_ResetPrinter = _TRUE; /* reset printer at the begin of the job */
534 bool DoublePage = _FALSE; /* print on both sides of a paper */
535 bool PrintSecondPart = _TRUE; /* print First Part when DoublePage */
536 bool PrintFirstPart = _TRUE; /* print Second Part when DoublePage */
537 bool PrintEmptyPages = _TRUE; /* print Empty pages in DoublePage mode */
538 short PageParity = 1;
539 #ifdef MAKETEXPK
540 #ifdef KPATHSEA
541 bool makeTexPK = MAKE_TEX_PK_BY_DEFAULT;
542 #else
543 bool makeTexPK = _TRUE;
544 #endif
545 #endif
546
547 #ifdef LJ
548 bool kyocera_mode = _FALSE; /* bug fixes for Kyocera F-1200 LJ-Emulation */
549 bool brother_mode = _FALSE; /* bug fixes for Brother HL-8D LJ-Emulation */
550 #ifdef LJ2P
551 int DuplexMode = 0;
552 #endif
553 #ifdef LJ4
554 bool econoMode = _FALSE;
555 bool LJ6 = _FALSE;
556 #endif
557 bool PrintTestPage = _FALSE; /* print testpage with pagecounter after job */
558 unsigned short pagesize = 0; /* page size value */
559 unsigned short pgsiz_dots = 0; /* page size in dots (for rule-clipping)*/
560 #endif
561
562
563 #ifndef vms
564 short G_errenc = 0; /* has an error been encountered? */
565 #else
566 long4 G_errenc = SS$_NORMAL; /* has an error been encountered? */
567 #endif
568 bool G_header = _FALSE; /* copy header file to output? */
569 bool G_quiet = _FALSE; /* for quiet operation */
570 bool G_verbose = _FALSE; /* inform user about pxl-files used */
571 bool G_nowarn = _FALSE; /* don't print out warnings */
572 short x_origin; /* x-origin in dots */
573 short y_origin; /* y-origin in dots */
574 short x_goffset; /* global x-offset in dots */
575 short y_goffset; /* global y-offset in dots */
576 unsigned short ncopies = 1; /* number of copies to print */
577 long4 hconv, vconv; /* converts DVI units to pixels */
578 long4 h; /* current horizontal position */
579 long4 hh = 0; /* current h on device */
580 long4 v; /* current vertical position */
581 long4 vv = 0; /* current v on device */
582 long4 mag; /* magnification specified in preamble */
583 long usermag = 0; /* user specified magnification */
584 int ndone = 0; /* number of pages converted */
585 int nopen = 0; /* number of open PXL files */
586 #ifdef vms
587 int kk; /* loop variable for EMITB */
588 #endif
589 FILEPTR outfp = FPNULL; /* output file */
590 FILEPTR pxlfp; /* PXL file pointer */
591 FILEPTR dvifp = FPNULL; /* DVI file pointer */
592 struct font_entry *prevfont = NULL; /* font_entry pointer previous font*/
593 struct font_entry *fontptr; /* font_entry pointer */
594 struct font_entry *hfontptr = NULL; /* font_entry pointer */
595 struct font_entry *pfontptr = NULL; /* previous font_entry pointer */
596 struct pixel_list pixel_files[MAXOPEN+1]; /* list of open PXL files */
597 long postambleptr; /* Pointer to the postamble */
598 long ppagep; /* previous page pointer */
599 static int last_ry = UNKNOWN; /* last y-position on page */
600 static int last_rx = UNKNOWN; /* last x-position on page */
601 long4 StartPrintPages; /* notpad for double paged output */
602 int WouldPrint = 0;
603 bool ZeroPage = _FALSE; /* Document starts with a Zero Page */
604 bool EvenPage = _FALSE; /* Document starts with an even Page */
605 long4 LastPtobePrinted = 0;
606 int G_ncdl = 0;
607
608 long allocated_storage = 0; /* size of mallocated storage (statistics) */
609 long4 power[32] ;
610 long4 gpower[33] ;
611
612 unsigned char buffin[BUFFSIZE]; /* Input buffer; always used for Copy[HP]File */
613 int binumber=0; /* number of valid bytes in input buffer */
614 int biact=0; /* number of next byte to read from input buffer */
615 #ifdef RISC_BUFFER
616 char buffout[BUFFSIZE]; /* Output buffer; used if RISC_BUFFER defined */
617 int boact=0; /* number of next byte to write to output buffer */
618 #endif
619
620 #ifdef LJ4
621 # define DEFAULT_COMPRESS_MODE 3
622 # define DEFAULT_COMPRESS_WIDTH 0
623 # define COMPRESS_WIDTH0 0
624 # define COMPRESS_WIDTH2 72
625 # define COMPRESS_WIDTH3 0
626 /* Raster chars compression */
627 int CompressCharWidth = -1; /* Value to be determined dependent at runtime */
628 int CompressCharMode; /* Used only from within RasterChar/Line */
629 int UseCompression = DEFAULT_COMPRESS_MODE; /* This performs very well with Characters */
630 /* Shared by both compression types */
631 unsigned char *PrevLine = NULL; /* Holds last raster line; set at runtime */
632 int PrevSize = 0; /* Size of PrevLine */
633 /* Downloaded chars compression */
634 int CChar_Off, CChar_Last; /* For compressed character downloading */
635 bool CompressFontMode = _TRUE; /* Download characters compressed */
636 #endif /* LJ4 */
637
638 #ifdef RISC_USE_OSL
639 char embuf[STRSIZE]; /* Buffer for emitting stuff */
640 int emsize; /* Number of bytes written in buffer */
641 #else
642 # ifdef RISC_BUFFER
643 char embuf[STRSIZE];
644 int emsize;
645 # endif
646 #endif
647
648 #ifdef __riscos
649 #define DIAGDIRSIZE 32
650 char diagdir[DIAGDIRSIZE] = "LJdiag"; /* Prefix name of directory for
651 cached printouts */
652 bool cachediag = _FALSE; /* cache PDriver's output in document folder */
653 bool printdiag = _TRUE; /* printf diagrams */
654 FILEPTR metafile = FPNULL; /* Filepointer of file containing
655 metafont directives*/
656
657 char MFFileName[STRSIZE];
658 int RasterMultipass = 0;
659 #endif
660
661 #ifdef DEBUG
662 int Debug = 0;
663 #define DEBUG_START() do { if (Debug) {
664 #define DEBUG_END() fflush (stdout); } } while (0)
665 #define DEBUG_PRINT(str) \
666 DEBUG_START (); fputs (str, stdout); DEBUG_END ()
667 #define DEBUG_PRINT1(str, e1) \
668 DEBUG_START (); printf (str, e1); DEBUG_END ()
669 #else
670 #define DEBUG_PRINT(str)
671 #define DEBUG_PRINT1(str, e1)
672 #endif
673
674 #ifdef LJ
675 int fonts_used_on_this_page = MAX_FONTS_PER_PAGE+1;
676 char rasterfont[HANDLE_MAX_FONTS];
677 /* raster if fonts/page>MAX_FONTS_PER_PAGE*/
678 #ifdef LJ_RESIDENT_FONTS
679 unsigned resident_count = 0;
680 #ifndef KPATHSEA
681 char *TFMpath = DEFAULT_TFM_PATH;
682 #endif
683 #endif
684 #endif
685
686 long used_fontstorage = 0;
687
688 #ifdef IBM3812
689 char PMPformat[20];
690 char CharString[CHARSTRINGMAX];
691 unsigned int CharStringPos = 0;
692 #define CharStringOut \
693 if (CharStringPos>0) { \
694 PMPcont(CharStringPos+1);\
695 PMPoutC((unsigned char)CharStringPos);\
696 PMPout(CharStringPos, CharString); \
697 CharStringPos=0; }
698 #endif
699
700
701 /************************timing stuff*********************/
702 #ifdef TIMING
703 # ifdef BSD_TIME_CALLS
704 # ifndef vms
705 # include <sys/timeb.h>
706 # else
707 # include <timeb.h>
708 # endif
709 struct timeb timebuffer;
710 double start_time;
711 # else
712 # ifdef __riscos
713 # include <sys/times.h>
714 # else
715 # include <sys/time.h>
716 struct timeval Tp;
717 double start_time;
718 # endif
719 # endif
720 #endif /* TIMING */
721
722
723 #endif /* DVI2XX_H */