Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
dvirle1.c
Go to the documentation of this file.
1 #ifndef lint
2 static char rcsid[] = "$Id: dvirle1.c,v 3.0.1.3 1992/02/28 22:12:53 spencer Exp $";
3 #endif
4 
5 /*
6  * DviRLE1 -- First half of DVI to RLE driver
7  *
8  * Reads DVI version 2 files and converts to an intermediate form that
9  * is read by dvirle2. Most of the work consists of converting DVI units
10  * to RLE units, sorting pages, and rotating positions if the -h
11  * flag is given.
12  *
13  * TODO:
14  * think about fonts with characters outside [0..127]
15  */
16 
17 /*
18  * Converted from "verser1" written by Chris Torek.
19  */
20 
21 
22 #include "rle_config.h"
23 
24 #include <stdio.h>
25 #include "types.h"
26 #include "conv.h"
27 #include "dviclass.h"
28 #include "dvicodes.h"
29 #include "error.h"
30 #include "fio.h"
31 #include "font.h"
32 #include "gripes.h"
33 #include "dvistate.h"
34 
35 #include "dvirle.h"
36 
37 char *ProgName;
38 extern char *optarg;
39 extern int optind;
40 
41 /* Global variables. */
42 char serrbuf[BUFSIZ]; /* buffer for stderr */
43 
44 CONST_DECL char *DVIFileName; /* Name of input dvi file */
45 
46 CONST_DECL char *TeXFontDesc; /* getenv(CONFENV): passed to dvirle2 */
47 
48 /* arrays containing page info */
49 int Chars; /* number of chars {left,} on page */
50 int MaxChars; /* total space for chars */
51 int *yx; /* contains (y<<16|x) for each char */
52 int *fcp; /* contains (font<<14|char<<7|part) */
53 int *nextyx; /* pointer to next yx area */
54 int *nextfcp; /* pointer to next fcp area */
55 
56 /*
57  * A few experiments showed that the typical job uses less than 3200
58  * characters per page. This is an extensible array, so the initial value
59  * affects only efficiency.
60  */
61 #ifndef InitialChars
62 #define InitialChars 4000 /* initial number of chars to allocate */
63 #endif
64 
65 /*
66  * If there are many characters and rules that do not fit on a page,
67  * these flags help reduce error output.
68  */
69 int TopEMsg; /* true => gave error message about top */
70 int BottomEMsg; /* true => gave error message about bottom */
71 int LeftEMsg; /* true => gave error message about left */
72 int RightEMsg; /* true => gave error message about right */
73 int RuleEMsg; /* true => gave error message about rule */
74 
75 int CFlag; /* -c => center output */
76 int HFlag; /* -h => horizontal (sideways) output */
77 int SFlag; /* -s => silent (no page #s) */
78 int Debug; /* -D => debug flag */
79 
80 int BottomMargin; /* bottom margin (in pixels) */
81 int TopMargin; /* top margin (in pixels) */
82 int WidestPageWidth; /* width of widest page (in pixels) */
83 int TallestPageHeight; /* height of tallest page (in pixels) */
84 int PageWidth; /* Width of widest page + margins */
85 int PageHeight; /* Height of tallest page + margins */
86 
87 
88 /* Absolute value */
89 #define ABS(n) ((n) >= 0 ? (n) : -(n))
90 
91 
92 /*
93  * Compute the pixel widths of the characters in the given font.
94  */
95 void
96 ComputeCWidths(f)
97  register struct font *f;
98 {
99  register struct glyph *g;
100  register int i;
101 
102  for (i = 0; i < 128; i++) {
103  g = GLYPH(f, i);
104  if (GVALID(g))
105  g->g_pixwidth = fromSP(g->g_tfmwidth);
106  }
107 }
108 
109 /*
110  * Have run out of room in the current yx and fcp arrays, so expand them.
111  */
112 void
113 ExpandArrays()
114 {
115  register unsigned newsize;
116 
117  MaxChars <<= 1;
118  newsize = MaxChars * sizeof *yx;
119  if ((yx = (int *) realloc((char *) yx, newsize)) == NULL)
120  GripeOutOfMemory(newsize, "yx array");
121  if ((fcp = (int *) realloc((char *) fcp, newsize)) == NULL)
122  GripeOutOfMemory(newsize, "fcp array");
123  Chars = MaxChars >> 1;
124  nextyx = &yx[Chars];
125  nextfcp = &fcp[Chars];
126  --Chars; /* we're about to use one */
127 }
128 
129 /*
130  * Sort the page arrays so that the values in yx are in ascending order. We
131  * use a Shell sort.
132  */
133 void
134 SortPage()
135 {
136  register int i, j, k, delta, *y, *f;
137 
138  /*
139  * Chars is currently the number of chars on the page, not the number
140  * of chars left in the array.
141  */
142  y = yx;
143  f = fcp;
144  delta = 1;
145  while (9 * delta + 4 < Chars)
146  delta = 3 * delta + 1;
147  while (delta > 0) {
148  for (i = delta; i < Chars; i++) {
149  if (y[j = i - delta] < y[i]) {
150  register int t1 = y[i];
151  register int t2 = f[i];
152 
153  k = i;
154  do {
155  y[k] = y[j];
156  f[k] = f[j];
157  k = j;
158  j -= delta;
159  } while (j >= 0 && y[j] < t1);
160  y[k] = t1;
161  f[k] = t2;
162  }
163  }
164  delta /= 3;
165  }
166 }
167 
168 /*
169  * Assign a unique number to each font in the DVI file.
170  * Compute character widths for all the glyphs.
171  */
172 struct font *
173 DefineFont(name, dvimag, dvidsz)
174  char *name;
175  i32 dvimag, dvidsz;
176 {
177  register struct font *f;
178  char *path;
179  int len;
180  static int next; /* dvirle2 knows that we use sequential indicies */
181 
182  if (next >= NFONTS) /* fix this later */
183  error(1, 0, "too many fonts (%d) used", next);
184 
185  f = GetRasterlessFont(name, dvimag, dvidsz, "versatec", &path);
186  if (f == NULL) {
187  GripeCannotGetFont(name, dvimag, dvidsz, "versatec", path);
188  return (NULL);
189  }
190  if (Debug) {
191  (void) fprintf(stderr, "[%s -> %s]\n", Font_TeXName(f), path);
192  (void) fflush(stderr);
193  }
194  if (next == 0) {
195  /*
196  * dvirle2 also needs the conversion factor,
197  * before the first font.
198  */
199  PutLong(stdout, 300); /* dots per inch */
200  PutLong(stdout, ds.ds_usermag);
201  PutLong(stdout, ds.ds_num);
202  PutLong(stdout, ds.ds_denom);
203  PutLong(stdout, ds.ds_dvimag);
204  }
205  putbyte(stdout, 1); /* signal another font */
206  PutLong(stdout, f->f_checksum);
207  PutLong(stdout, dvimag);
208  PutLong(stdout, dvidsz);
209  len = strlen(name);
210  PutLong(stdout, len);
211  (void) fputs(name, stdout);
212  ComputeCWidths(f);
213  f->f_un.f_int = next++;
214  return (f);
215 }
216 
217 /*
218  * Start a new page (interpreter found a DVI_BOP).
219  */
220 void
221 BeginPage(count)
222  i32 *count;
223 {
224 
225  if (!SFlag) {
226  if (nextyx)
227  (void) putc(' ', stderr);
228  (void) fprintf(stderr, "[%d", (int)count[0]);
229  (void) fflush(stderr);
230  }
231 
232  /* Chars now becomes "number of characters left" */
233  Chars = MaxChars; /* empty the arrays */
234  nextyx = yx;
235  nextfcp = fcp;
236 
237  TopEMsg = 0;
238  BottomEMsg = 0;
239  LeftEMsg = 0;
240  RightEMsg = 0;
241  RuleEMsg = 0;
242 }
243 
244 /*
245  * End a page (process a DVI_EOP).
246  */
247 void
248 EndPage()
249 {
250  register int i, *y, *f, t, v, oldv;
251 
252  /* Chars now becomes "number of characters on page" */
253  i = Chars = MaxChars - Chars;
254 
255  SortPage();
256 
257  if (!SFlag) {
258  putc(']', stderr);
259  (void) fflush(stderr);
260  }
261  y = yx;
262  f = fcp;
263  if ( HFlag )
264  oldv = PageWidth;
265  else
266  oldv = PageHeight;
267  while (--i >= 0) {
268  if ( Debug > 1 )
269  fprintf( stderr, "oldv: %ld, yx: %lx (%d,%d), fcp: %lx\n",
270  oldv, *y, (*y >> 16), (*y & 0xffff), *f );
271  v = *y >> 16;
272  t = oldv - v;
273  if (*f >= 0) { /* setting a character */
274  t = (t << 16) | (*y++ & 0xffff);
275  PutLong(stdout, t);
276  t = *f++;
277  PutLong(stdout, t); /* move down & place char */
278  } else { /* setting a rule */
279  y++;
280  if (t > 0) { /* need to move down first */
281  t = -t;
282  PutLong(stdout, -1);
283  PutLong(stdout, t);
284  }
285  t = *f++ & 0x7fffffff;
286  PutLong(stdout, -1);
287  PutLong(stdout, t); /* place rule */
288  }
289  oldv = v;
290  }
291 
292  /* Make all pages the same length */
293  if (HFlag)
294  t = -PageWidth;
295  else
296  t = -PageHeight;
297  if (t) {
298  PutLong(stdout, -1); /* move down */
299  PutLong(stdout, t);
300  }
301  PutLong(stdout, -1);
302  PutLong(stdout, 0); /* end of page */
303 }
304 
305 /*
306  * Perform a \special.
307  * This version ignores all, with a warning.
308  */
309 void
310 DoSpecial(len)
311  i32 len; /* length of the \special string */
312 {
313 
314  error(0, 0, "warning: ignoring \\special");
315  (void) fseek(ds.ds_fp, (long) len, 1);
316 }
317 
318 
319 #ifndef lint
320 #define maxysize min(MaxCharHeight, 255)
321 #else
322 #define maxysize 255
323 #endif
324 
325 /*
326  * Set a rule at dvi_hh, dvi_vv, where h is the height of the rule
327  * and w is the width (both in pixels). (dvi_hh,dvi_vv) is the lower
328  * left corner of the rule.
329  */
330 void
331 SetRule(h, w)
332  register int h, w;
333 {
334  register int y; /* temporary y value */
335  register int x; /* temporary x value */
336  register int ymax; /* bottommost (versatec-wise) y coord */
337  register int xmax; /* rightmost (versatec-wise) x coord */
338  register int ymin; /* topmost y coord */
339  register int xmin; /* leftmost x coord */
340  int anybad = 0;
341 
342  if (!HFlag) {
343  xmin = dvi_hh;
344  ymax = dvi_vv;
345  ymin = ymax - h;
346  xmax = xmin + w;
347  } else {
348  ymin = dvi_hh;
349  xmin = MaxPageWidth - dvi_vv - 1;/* ???DO I NEED -1 ANYMORE?? */
350  xmax = xmin + h;
351  ymax = ymin + w;
352 #ifdef notdef
353  if (ymax > MaxPageHeight)
354  ymax = MaxPageHeight, anybad++;
355 #endif
356  }
357  if (ymin < 0)
358  ymin = 0, anybad++;
359  if (xmin < 0)
360  xmin = 0, anybad++;
361  if (xmax > MaxPageWidth)
362  xmax = MaxPageWidth, anybad++;
363  if (anybad && !RuleEMsg) {
364  error(0, 0, "WARNING: rule(s) off page edge; clipped to fit");
365  RuleEMsg++;
366  }
367  for (y = ymax; y > ymin; y -= h) {
368  for (x = xmin; x < xmax; x += w) {
369  h = y - ymin;
370  h = min(h, maxysize);
371  w = xmax - x;
372  w = min(w, 255);
373  if (--Chars < 0)
374  ExpandArrays();
375  *nextyx++ = (y << 16) | x;
376  *nextfcp++ = (1 << 31) | (x << 16) | (h << 8) | w;
377  }
378  }
379 }
380 
381 /*
382  * Check the range of a character, to be sure the device can handle it.
383  * Called for DVI_SET and DVI_PUT opcodes only.
384  */
385 int
386 CheckChar(c)
387  i32 c;
388 {
389  /* this driver needs work for codes > 127 */
390 
391  if ((ui32)c > 127) {
392  error(0, 0, "Warning: character code %ld too big",
393  (long)c);
394  return (1);
395  }
396  return (0);
397 }
398 
399 /*
400  * Main page loop. This reads one page of the DVI file.
401  * Returns 1 for EOP and 0 for end of last page (POST).
402  */
403 int
404 PageLoop()
405 {
406  static struct font NoFont; /* font with zero pspace, etc */
407  register int c;
408  register i32 p = 0;
409  register struct font *f = &NoFont;
410  register FILE *fp = ds.ds_fp;
411  int doingpage = 0, advance;
412 
413  static char warn[] = "\
414 WARNING: text object(s) run off %s of page; ignored";
415 #define CHECK(cond, msg, flag)
416  if (cond) {
417  if (!flag) {
418  error(0, 0, warn, msg);
419  flag = 1;
420  }
421  goto ignore;
422  }
423 
424  /*
425  * This would be a `for (;;)', but that makes the function
426  * crawl off the right of the screen.
427  *
428  * We handle ordinary characters early, as they are the
429  * most common opcodes in DVI files, and doing so makes the
430  * loop run faster.
431  */
432 loop:
433  c = fgetbyte(fp);
434  if (DVI_IsChar(c)) {
435  register struct glyph *g;
436  register int ulcx, ulcy, height;
437 
438  p = c;
439  advance = 1;
440 do_char:
441  g = GLYPH(f, p);
442  if (!GVALID(g)) {
443  GripeBadGlyph(p, f);
444  goto loop;
445  }
446  if (!HFlag) {
447  ulcy = dvi_vv + g->g_height - g->g_yorigin;
448  ulcx = dvi_hh - g->g_xorigin;
449  height = g->g_height;
450  CHECK(ulcy < 0, "top", TopEMsg);
451  CHECK(ulcx < 0, "left", LeftEMsg);
452  CHECK(ulcx + g->g_width >= MaxPageWidth,
453  "right", RightEMsg);
454  } else {/* rotate & translate */
455  ulcy = dvi_hh + g->g_width - g->g_xorigin;
456  ulcx = MaxPageWidth -
457  (dvi_vv + g->g_height - g->g_yorigin);
458  height = g->g_width;
459  CHECK(ulcy < 0, "left", LeftEMsg);
460 #ifdef notdef
461  CHECK(ulcy + height >= MaxPageHeight,
462  "right", RightEMsg);
463 #endif
464  CHECK(ulcx < 0, "bottom", BottomEMsg);
465  CHECK(ulcx + g->g_height >= MaxPageWidth,
466  "top", TopEMsg);
467  }
468  for (c = 0; height > 0; c++) {
469  if (--Chars < 0)
470  ExpandArrays();
471  *nextyx++ = (ulcy << 16) | ulcx;
472  *nextfcp++ = (f->f_un.f_int << FONTSHIFT) |
473  ((p & CHARMASK) << CHARSHIFT) | c;
474  height -= MaxCharHeight;
475  ulcy += MaxCharHeight;
476  }
477 ignore:
478  if (advance) {
479  dvi_h += g->g_tfmwidth;
480  dvi_hh += g->g_pixwidth;
481  p = fromSP(dvi_h);
482  FIXDRIFT(dvi_hh, p);
483  }
484  goto loop;
485  }
486 
487  if (c == EOF) /* unexpected end of DVI file */
488  GripeUnexpectedDVIEOF();
489 
490  /*
491  * Gather up a parameter, if known.
492  */
493  switch (DVI_OpLen(c)) {
494 
495  case DPL_NONE:
496  break;
497 
498  case DPL_SGN1:
499  p = fgetbyte(fp);
500  p = Sign8(p);
501  break;
502 
503  case DPL_SGN2:
504  fGetWord(fp, p);
505  p = Sign16(p);
506  break;
507 
508  case DPL_SGN3:
509  fGet3Byte(fp, p);
510  p = Sign24(p);
511  break;
512 
513  case DPL_SGN4:
514  fGetLong(fp, p);
515  break;
516 
517  case DPL_UNS1:
518  p = fgetbyte(fp);
519  p = UnSign8(p);
520  break;
521 
522  case DPL_UNS2:
523  fGetWord(fp, p);
524  p = UnSign16(p);
525  break;
526 
527  case DPL_UNS3:
528  fGet3Byte(fp, p);
529  p = UnSign24(p);
530  break;
531 
532  default:
533  panic("DVI_OpLen(%d) = %d", c, DVI_OpLen(c));
534  /* NOTREACHED */
535  }
536 
537  /*
538  * Now switch on the type.
539  */
540  switch (DVI_DT(c)) {
541 
542  case DT_SET:
543  advance = 1;
544  if (CheckChar(p))
545  goto loop;
546  goto do_char;
547 
548  case DT_PUT:
549  advance = 0;
550  if (CheckChar(p))
551  goto loop;
552  goto do_char;
553 
554  case DT_SETRULE:
555  DVIRule(SetRule, 1);
556  goto loop;
557 
558  case DT_PUTRULE:
559  DVIRule(SetRule, 0);
560  goto loop;
561 
562  case DT_NOP:
563  goto loop;
564 
565  case DT_BOP:
566  if (doingpage)
567  GripeUnexpectedOp("BOP (already in page)");
568  DVIBeginPage(BeginPage);
569  doingpage = 1;
570  goto loop;
571 
572  case DT_EOP:
573  if (!doingpage)
574  GripeUnexpectedOp("EOP (no BOP)");
575  EndPage();
576  return (1);
577 
578  case DT_PUSH:
579  *ds.ds_sp++ = ds.ds_cur;
580  goto loop;
581 
582  case DT_POP:
583  ds.ds_cur = *--ds.ds_sp;
584  goto loop;
585 
586  case DT_W0:
587  p = dvi_w;
588  goto right;
589 
590  case DT_W:
591  dvi_w = p;
592  goto right;
593 
594  case DT_X0:
595  p = dvi_x;
596  goto right;
597 
598  case DT_X:
599  dvi_x = p;
600  goto right;
601 
602  case DT_RIGHT:
603 right:
604  dvi_h += p;
605  if (F_SMALLH(f, p)) {
606  dvi_hh += fromSP(p);
607  p = fromSP(dvi_h);
608  FIXDRIFT(dvi_hh, p);
609  } else
610  dvi_hh = fromSP(dvi_h);
611  goto loop;
612 
613  case DT_Y0:
614  p = dvi_y;
615  goto down;
616 
617  case DT_Y:
618  dvi_y = p;
619  goto down;
620 
621  case DT_Z0:
622  p = dvi_z;
623  goto down;
624 
625  case DT_Z:
626  dvi_z = p;
627  goto down;
628 
629  case DT_DOWN:
630 down:
631  dvi_v += p;
632  if (F_SMALLV(f, p)) {
633  dvi_vv += fromSP(p);
634  p = fromSP(dvi_v);
635  FIXDRIFT(dvi_vv, p);
636  } else
637  dvi_vv = fromSP(dvi_v);
638  goto loop;
639 
640  case DT_FNTNUM:
641  f = DVIFindFont((i32)(c - DVI_FNTNUM0));
642  goto loop;
643 
644  case DT_FNT:
645  f = DVIFindFont(p);
646  goto loop;
647 
648  case DT_XXX:
649  DoSpecial(p);
650  goto loop;
651 
652  case DT_FNTDEF:
653  SkipFontDef(fp);
654  goto loop;
655 
656  case DT_PRE:
657  GripeUnexpectedOp("PRE");
658  /* NOTREACHED */
659 
660  case DT_POST:
661  if (doingpage) {
662  GripeUnexpectedOp("POST (no EOP)");
663  /* NOTREACHED */
664  }
665  return (0);
666 
667  case DT_POSTPOST:
668  GripeUnexpectedOp("POSTPOST");
669  /* NOTREACHED */
670 
671  case DT_UNDEF:
672  GripeUndefinedOp(c);
673  /* NOTREACHED */
674 
675  default:
676  panic("DVI_DT(%d) = %d", c, DVI_DT(c));
677  /* NOTREACHED */
678  }
679  /* NOTREACHED */
680 }
681 
682 
683 void
685  int argc;
686  register char **argv;
687 {
688  register int c;
689  register CONST_DECL char *s;
690  int lmargin;
691  FILE *fp = stdin;
692 
693  setbuf(stderr, serrbuf);
694 
695  ProgName = *argv;
696  ds.ds_usermag = 1000;
697  ds.ds_maxdrift = DefaultMaxDrift;
698  DVIFileName = "`stdin'";
699 
700  while ((c = getopt(argc, argv, "cd:hm:sD")) != EOF) {
701  switch (c) {
702 
703  case 'c':
704  CFlag++;/* centered output */
705  break;
706 
707  case 'd': /* max drift value */
708  ds.ds_maxdrift = atoi(optarg);
709  break;
710 
711  case 'h': /* horizontal output */
712  HFlag++;
713  break;
714 
715  case 'm': /* magnification */
716  ds.ds_usermag = atoi(optarg);
717  break;
718 
719  case 's': /* silent */
720  SFlag++;
721  break;
722 
723  case 'D':
724  Debug++;
725  break;
726 
727  case '?':
728  (void) fprintf(stderr, "\
729 Usage: %s [-c] [-h] [-m mag] [-s] [file]\n",ProgName);
730  (void) fflush(stderr);
731  exit(1);
732  }
733  }
734 
735  if (optind < argc)
736  if ((fp = fopen(DVIFileName = argv[optind], "r")) == NULL)
737  error(1, -1, "can't open %s", argv[optind]);
738 
739 #ifdef notdef
740  if (MakeSeekable(stdin))
741  error(1, 0,
742  "unable to copy input to temp file (see the manual)");
743 #endif
744 
745  if ((TeXFontDesc = getenv(CONFENV)) == NULL)
746  TeXFontDesc = "";
747 
748  c = (VERSION << 1) + (HFlag ? 1 : 0);
749  putbyte(stdout, c);
750  c = strlen(s = TeXFontDesc);
751  PutLong(stdout, c);
752  while (--c >= 0)
753  putbyte(stdout, *s++);
754 
755  /* the margin offsets here are 0; margins computed later */
756  DVISetState(fp, DefineFont, 300, 0, 0);
757  putbyte(stdout, 0); /* Signal end of fonts. */
758  TallestPageHeight = fromSP(ds.ds_maxheight);
759  WidestPageWidth = fromSP(ds.ds_maxwidth);
760 
761  /*
762  * The character plotter must check each character to ensure it
763  * is on the page, because the widest and tallest page values from
764  * the DVI file are not always accurate; so these tests do little
765  * save to keep one from finding the offending object. Accordingly,
766  * I have disabled them. 20 May 1984 ACT.
767  */
768 #ifdef notdef
769  if (HFlag) {
770  if (MaxPageWidth - MinimumLeftMargin < TallestPageHeight)
771  error(1, 0, "text object too high!");
772  if (MaxPageHeight - MinimumTopMargin < WidestPageWidth)
773  error(1, 0, "text object too wide!");
774  } else { /* page height can be safely ignored */
775  if (MaxPageWidth - MinimumLeftMargin < WidestPageWidth)
776  error(1, 0, "text object too wide!");
777  }
778 #endif
779 
780  /* Determine margins */
781  if (CFlag) {
782  lmargin = (MaxPageWidth - WidestPageWidth) >> 1;
783  if (lmargin < MinimumLeftMargin) {
784  lmargin = MinimumLeftMargin;
785  error(0, 0, "\
786 cannot center (page too wide); placing flush left instead");
787  }
788  } else
790 
791  if (HFlag) {
793  if (TopMargin < 0)
794  TopMargin = 0;
796  if (BottomMargin < 0)
797  BottomMargin = 0;
798  } else {
801  }
802 
805  if ( HFlag )
806  {
807  if ( PageHeight > MaxPageWidth )
808  {
809  fprintf( stderr,
810  "Page too high (%d bits), truncated to %d bits\n",
813  }
814  PutLong(stdout, PageWidth);
815  PutLong(stdout, PageHeight);
816  }
817  else
818  {
819  if ( PageWidth > MaxPageWidth )
820  {
821  fprintf( stderr,
822  "Page too wide (%d bits), truncated to %d bits\n",
825  }
826  PutLong(stdout, PageHeight);
827  PutLong(stdout, PageWidth);
828  }
829 
830  /* set the `fresh page' margins */
831  ds.ds_fresh.hh = lmargin;
832  ds.ds_fresh.vv = TopMargin;
833  ds.ds_fresh.h = toSP(ds.ds_fresh.hh);
834  ds.ds_fresh.v = toSP(ds.ds_fresh.vv);
835 
836  /* Allocate arrays */
838  if ((yx = (int *) malloc(InitialChars * sizeof *yx)) == NULL)
839  GripeOutOfMemory(InitialChars * sizeof *yx, "yx array");
840  if ((fcp = (int *) malloc(InitialChars * sizeof *fcp)) == NULL)
841  GripeOutOfMemory(InitialChars * sizeof *fcp, "fcp array");
842 
843  while (PageLoop())
844  /* void */;
845 
846  exit(0);
847  /* NOTREACHED */
848 }
849 
850 /* Assume that if F_DUPFD is defined, dup2() is not. Therefore, define it. */
851 #ifdef F_DUPFD
852 #include <fcntl.h>
853 dup2( fd1, fd2 )
854 int fd1, fd2;
855 {
856  close(fd2);
857  return fcntl( fd1, F_DUPFD, fd2 );
858 }
859 #endif
int RuleEMsg
Definition: dvirle1.c:73
#define InitialChars
Definition: dvirle1.c:62
int RightEMsg
Definition: dvirle1.c:72
int BottomEMsg
Definition: dvirle1.c:70
void main(int argc, char **argv)
Definition: aliastorle.c:121
#define MaxCharHeight
Definition: dvirle.h:38
#define MaxPageHeight
Definition: dvirle.h:39
int * nextyx
Definition: dvirle1.c:53
int HFlag
Definition: dvirle2.c:69
int LeftEMsg
Definition: dvirle1.c:71
#define CHARSHIFT
Definition: dvirle.h:31
char TeXFontDesc[256]
Definition: dvirle2.c:64
int PageWidth
Definition: dvirle2.c:83
const char * DVIFileName
Definition: dvirle1.c:44
int optind
Definition: getopt.c:30
int BottomMargin
Definition: dvirle1.c:80
#define DefaultMaxDrift
Definition: dvirle.h:42
char * ProgName
Definition: dvirle2.c:57
int Chars
Definition: dvirle1.c:49
char serrbuf[ 8192 ]
Definition: dvirle1.c:42
#define CHARMASK
Definition: dvirle.h:32
int MaxChars
Definition: dvirle1.c:50
#define DefaultBottomMargin
Definition: dvirle.h:48
#define MinimumLeftMargin
Definition: dvirle.h:45
int * fcp
Definition: dvirle1.c:52
#define min(a, b)
Definition: dvirle.h:51
#define DefaultLeftMargin
Definition: dvirle.h:44
#define CONST_DECL
Definition: rle_config.h:42
int TallestPageHeight
Definition: dvirle1.c:83
#define FONTSHIFT
Definition: dvirle.h:30
int SFlag
Definition: dvirle2.c:70
#define maxysize
Definition: dvirle1.c:320
#define VERSION
Definition: dvirle.h:26
int PageHeight
Definition: dvirle2.c:83
#define NFONTS
Definition: dvirle.h:28
int * nextfcp
Definition: dvirle1.c:54
#define CHECK(cond, msg, flag)
bool Debug
Definition: rleClock.c:116
int CFlag
Definition: dvirle1.c:75
int TopEMsg
Definition: dvirle1.c:69
int TopMargin
Definition: dvirle1.c:81
char * optarg
Definition: getopt.c:29
static char rcsid[]
Definition: dvirle1.c:2
int * yx
Definition: dvirle1.c:51
#define DefaultTopMargin
Definition: dvirle.h:46
int WidestPageWidth
Definition: dvirle1.c:82
#define MaxPageWidth
Definition: dvirle.h:40