w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

dvicore.c
Go to the documentation of this file.
1 /* dvipos-20070107
2 
3  Copyright (C) 2003 by Jin-Hwan <chofchof@ktug.or.kr>
4 
5  Includes two small fixes by Sanjoy Mahajan <sanjoy@mit.edu>. See
6  the ChangeLog.
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22 
23 #include "utils.h"
24 #include "dvicore.h"
25 #include "tfm.h"
26 
27 #include <math.h>
28 #include <time.h>
29 
30 /* Global variables */
31 int dvi_pages = 0;
32 
33 /* Internal variables */
34 static FILE *dvi_file;
38 static int current_page, new_dvi_pages = 0;
39 
40 #define DVI_MAX_STACK_DEPTH 256
41 static int dvi_stack_depth = 0;
42 static struct dvi_register {
43  SIGNED_QUAD h, v, w, x, y, z, d, hh, vv;
45 
46 static int cur_font = -1, num_dvi_fonts = 0, max_dvi_fonts = 0;
47 static struct dvi_font {
48  SIGNED_QUAD size, id; /* size == scaled_size */
49  int tfm_id, used; char *name;
51 
53 static double tfm_conv, true_conv, conv, resolution;
54 
59 
60 typedef struct a_bbox {
61  SIGNED_QUAD h1, v1, h2, v2, fb, cb; /* first and current baseline */
62  int type, lev_s;
63  char *tag;
64  struct a_bbox *next;
65 } BBOX;
66 static BBOX page_bbox;
67 
68 static char comment[257];
69 
70 /* Internal buffer */
71 #define DVI_BUFFER_SIZE 1024
72 static int dvi_buffer_len = 0;
73 static unsigned char dvi_buffer[DVI_BUFFER_SIZE];
74 
76 {
77  BBOX *bb = &page_bbox;
78 
79  if (do_smashchars) height = depth = 0;
80 
81  while (bb) {
82  if (bb->fb == -WEB_INFINITY) bb->fb = dvi_state.v;
83  bb->cb = dvi_state.v;
84  if (bb->h1 > dvi_state.h) bb->h1 = dvi_state.h;
85  if (bb->v1 > dvi_state.v - height) bb->v1 = dvi_state.v - height;
86  if (bb->h2 < dvi_state.h + width) bb->h2 = dvi_state.h + width;
87  if (bb->v2 < dvi_state.v + depth) bb->v2 = dvi_state.v + depth;
88  bb = bb->next;
89  }
90 }
91 
92 #define PAGE_TYPE 0
93 #define BOX_TYPE 1
94 #define LINES_TYPE 2
95 #define LINES_TYPE_SUSPEND 3
96 
97 static void draw_frame (BBOX *bb)
98 {
100 
101  width = bb->h2 - bb->h1 + 2 * rule_width;
102  height = bb->v2 - bb->v1 + 2 * rule_width;
103 
104  /* color special */
107  switch (bb->type) {
108  case BOX_TYPE:
109  fwrite("color push rgb 0 1 0", 1, 20, frmfp);
110  break;
111  case LINES_TYPE:
112  fwrite("color push rgb 0 0 1", 1, 20, frmfp);
113  break;
114  case PAGE_TYPE:
115  default:
116  fwrite("color push rgb 1 0 0", 1, 20, frmfp);
117  break;
118  }
119  dbg_location += 20;
120 
121  /* push the current state */
123 
124  /* move to ll corner plus (-rule_width,rule_width) */
129 
130  /* draw a horizontal line connecting ll corner to lr corner */
134 
135  /* draw a vertical line connecting ll corner to ul corner */
139 
140  /* push the location of ll corner */
142 
143  /* move to ul corner plus (-rule_width,0) */
145  put_signed_quad(-bb->v2 + bb->v1 - rule_width, frmfp);
146 
147  /* draw a horizontal line connecting ul corner to ur corner */
151 
152  /* restore the location of ll corner */
154 
155  /* move to lr corner plus (0,rule_width) */
157  put_signed_quad(-bb->h1 + bb->h2 + rule_width, frmfp);
158 
159  /* draw a vertical line connecting ll corner to ul corner */
163 
164  /* restore the original location */
166 
167  /* restore color special */
170  fwrite("color pop", 1, 9, frmfp);
171  dbg_location += 9;
172 }
173 
174 static void reset_bbox (BBOX *bb)
175 {
176  bb->h1 = bb->v1 = WEB_INFINITY;
177  bb->h2 = bb->v2 = -WEB_INFINITY;
178  bb->fb = bb->cb = -WEB_INFINITY;
179 }
180 
181 static void clear_bbox (int init)
182 {
183  /* calculate bounding box of each page */
186  if (init) {
187  page_bbox.tag = xstrdup("pagebb");
188  page_bbox.next = NULL;
189  }
190 }
191 
192 static void new_bbox (char *tag, int type)
193 {
194  BBOX *bb = &page_bbox;
195 
196  while (bb->next) {
197 // if (strcmp(tag, (bb->next)->tag) == 0) {
198 // msg_out(M_WARNING, "Warning: Found an entry with the same tag (%s).\n", tag);
199 // return;
200 // }
201  bb = bb->next;
202  }
203 
204  /* allocate a new entry */
205  bb = bb->next = (BBOX *)xmalloc(sizeof(BBOX));
206  bb->tag = xstrdup(tag);
207  bb->next = NULL;
208  bb->lev_s = dvi_stack_depth;
209  bb->type = type;
210 
211  reset_bbox(bb);
212 
213  if (bbxfp && bb->type == LINES_TYPE)
214  fprintf(bbxfp, "\n## KEY & TAG\nbeglines & \"%s\"\n", bb->tag);
215 }
216 
217 static void write_bbox (BBOX *bb)
218 {
219  if (bbxfp) {
220  fprintf(bbxfp, "\"%ld.%04lX & ",
221  (bb->fb / 65536), (bb->fb < 0 ? -1 : 1) * (bb->fb % 65536));
222  fprintf(bbxfp, "\"%ld.%04lX \"%ld.%04lX \"%ld.%04lX \"%ld.%04lX & ",
223  (bb->v1 / 65536), (bb->v1 < 0 ? -1 : 1) * (bb->v1 % 65536),
224  (bb->h1 / 65536), (bb->h1 < 0 ? -1 : 1) * (bb->h1 % 65536),
225  (bb->v2 / 65536), (bb->v2 < 0 ? -1 : 1) * (bb->v2 % 65536),
226  (bb->h2 / 65536), (bb->h2 < 0 ? -1 : 1) * (bb->h2 % 65536));
227  fprintf(bbxfp, "\"%ld.%04lX\n",
228  (bb->cb / 65536), (bb->cb < 0 ? -1 : 1) * (bb->cb % 65536));
229 /*
230  fprintf(bbxfp, "\"%ld & ", bb->fb);
231  fprintf(bbxfp, "\"%ld \"%ld \"%ld \"%ld & ", bb->v1, bb->h1, bb->v2, bb->h2);
232  fprintf(bbxfp, "\"%ld\n", bb->cb);
233 */
234  }
235 }
236 
237 static void flush_bbox (BBOX *bb)
238 {
239  if (bb == NULL) return;
240  if (frmfp) draw_frame(bb);
241  if (bbxfp) {
242  switch (bb->type) {
243  case PAGE_TYPE:
244  fprintf(bbxfp, "\n## KEY & PAGENO & ENTRY-V & TOP-V LEFT-H BOTTOM-V RIGHT-H & EXIT-V\n");
245  fprintf(bbxfp, "%s & %d & ", "pagebb", current_page);
246  write_bbox(bb);
247  break;
248  case BOX_TYPE:
249  fprintf(bbxfp, "\n## KEY & TAG & ENTRY-V & TOP-V LEFT-H BOTTOM-V RIGHT-H & EXIT-V\n");
250  fprintf(bbxfp, "%s & \"%s\" & ", "box", bb->tag);
251  write_bbox(bb);
252  break;
253  case LINES_TYPE:
254  fprintf(bbxfp, " %s & ", "line");
255  write_bbox(bb);
256  break;
257  case LINES_TYPE_SUSPEND:
258  bb->type = LINES_TYPE;
259  fprintf(bbxfp, "\n[resume]lines & \"%s\"\n", bb->tag);
260  fprintf(bbxfp, " %s & ", "line");
261  write_bbox(bb);
262  default:
263  break;
264  }
265  }
266 }
267 
268 static void close_bbox (char *tag)
269 {
270  BBOX *obb = &page_bbox, *nbb = obb->next;
271 
272  /* find the entry with the same tag */
273  while (nbb)
274  if (strcmp(nbb->tag, tag) == 0) {
275  flush_bbox(nbb);
276  if (bbxfp && nbb->type == LINES_TYPE)
277  fprintf(bbxfp, "endlines & \"%s\"\n", nbb->tag);
278  free(nbb->tag);
279  obb->next = (nbb->next ? nbb->next : NULL);
280  free(nbb);
281  break;
282  } else {
283  if (bbxfp && nbb->type == LINES_TYPE) {
284  fprintf(bbxfp, "[suspend]lines & \"%s\"\n", nbb->tag);
285  nbb->type = LINES_TYPE_SUSPEND;
286  }
287  obb = nbb;
288  nbb = nbb->next;
289  }
290 }
291 
293 {
294  dvi_location++;
295  return get_unsigned_byte(dvi_file);
296 }
297 
299 {
300  dvi_location++;
301  return get_signed_byte(dvi_file);
302 }
303 
305 {
306  dvi_location += 2;
307  return get_unsigned_pair(dvi_file);
308 }
309 
311 {
312  dvi_location += 2;
313  return get_signed_pair(dvi_file);
314 }
315 
317 {
318  dvi_location += 3;
320 }
321 
323 {
324  dvi_location += 3;
325  return get_signed_triple(dvi_file);
326 }
327 
328 #if 0
329 /* Not used */
330 static UNSIGNED_PAIR dvi_unsigned_quad (void)
331 {
332  dvi_location += 4;
333  return get_unsigned_quad(dvi_file);
334 }
335 #endif
336 
338 {
339  dvi_location += 4;
340  return get_signed_quad(dvi_file);
341 }
342 
344 {
346  UNSIGNED_BYTE b0, b1, b2, b3;
347 
348  alpha = 16;
349  while (z >= 0x800000L) {
350  z = z / 2;
351  alpha = alpha + alpha;
352  }
353  beta = 256 / alpha;
354  alpha = alpha * z;
355 
356  b0 = (b >> 24) & 0xFF; b1 = (b >> 16) & 0xFF;
357  b2 = (b >> 8) & 0xFF; b3 = b & 0xFF;
358 
359  result = (((((b3 * z) / 0x100) + (b2 * z)) / 0x100) + (b1 * z)) / beta;
360 
361  if (b0 == 255) result -= alpha;
362  else if (b0 != 0)
363  msg_out(M_FAIL, "[fatal] sqxfw(): TFM file is bad.\n");
364 
365  return result;
366 }
367 
368 static SIGNED_QUAD xround (double p)
369 {
370  if (p < 0)
371  return (SIGNED_QUAD)ceil(p - .5);
372  else
373  return (SIGNED_QUAD)floor(p + .5);
374 }
375 
376 #define LINE_LENGTH 79
377 /* 69. The flush_text procedure will empty the buffer if there is something
378  * in it. */
379 static void flush_text (void)
380 {
381  if (dvi_buffer_len > 0) {
383  msg_out(M_DEBUG, "[%s]\n", dvi_buffer);
384  dvi_buffer_len = 0;
385  }
386 }
387 
388 /* 70. And the out_text procedure puts something in it. */
389 static void out_text (char c)
390 {
391  if (dvi_buffer_len == LINE_LENGTH - 2) flush_text();
393 }
394 
395 #define WEB_INFINITY 0x7FFFFFFFL //017777777777
396 #define MAX_DRIFT 2
397 #define PIXEL_ROUND(p) xround(conv*(p))
398 
399 static void move_right (SIGNED_QUAD q)
400 {
401  SIGNED_QUAD h, hh, hhh;
402 
403  h = dvi_state.h; hh = dvi_state.hh;
404 
405  if (h > 0 && q > 0 && h > WEB_INFINITY - q) {
406  msg_out(M_DEBUG, " arithmetic overflow! parameter changed from '%ld' to '%ld'\n", q, WEB_INFINITY - h);
407  q = WEB_INFINITY - h;
408  }
409  if (h < 0 && q < 0 && -h > q + WEB_INFINITY) {
410  msg_out(M_DEBUG, " arithmetic overflow! parameter changed from '%ld' to '%ld'\n", q, (-h) - WEB_INFINITY);
411  q = (-h) - WEB_INFINITY;
412  }
413  hhh = PIXEL_ROUND(h + q);
414  if (labs(hhh - hh) > MAX_DRIFT) {
415  if (hhh > hh) hh = hhh - MAX_DRIFT;
416  else hh = hhh + MAX_DRIFT;
417  }
418  msg_out(M_DEBUG, " h:=%ld", h);
419  if (q >= 0) msg_out(M_DEBUG, "+");
420  msg_out(M_DEBUG, "%ld=%ld, hh:=%ld", q, h + q, hh);
421  h = h + q;
422  if (labs(h) > max_h_so_far) {
423  if (labs(h) > max_h + 99) {
424  msg_out(M_DEBUG, " warning: |h|>%ld!", max_h);
425  max_h = labs(h);
426  }
427  max_h_so_far = labs(h);
428  }
429  msg_out(M_DEBUG, " \n");
430  dvi_state.h = h; dvi_state.hh = hh;
431 }
432 
433 /* 92. <Finish a command that sets v = v + p, then goto done> */
434 static void move_down (SIGNED_QUAD p)
435 {
436  SIGNED_QUAD v, vv, vvv;
437 
438  v = dvi_state.v; vv = dvi_state.vv;
439 
440  if (v > 0 && p > 0 && v > WEB_INFINITY - p) {
441  msg_out(M_DEBUG, " arithmetic overflow! parameter changed from '%ld' to '%ld'\n", p, WEB_INFINITY - v);
442  p = WEB_INFINITY - v;
443  }
444  if (v < 0 && p < 0 && -v > p + WEB_INFINITY) {
445  msg_out(M_DEBUG, " arithmetic overflow! parameter changed from '%ld' to '%ld'\n", p, (-v) - WEB_INFINITY);
446  p = (-v) - WEB_INFINITY;
447  }
448  vvv = PIXEL_ROUND(v + p);
449  if (labs(vvv - vv) > MAX_DRIFT) {
450  if (vvv > vv) vv = vvv - MAX_DRIFT;
451  else vv = vvv + MAX_DRIFT;
452  }
453  msg_out(M_DEBUG, " v:=%ld", v);
454  if (p >= 0) msg_out(M_DEBUG, "+");
455  msg_out(M_DEBUG, "%ld=%ld, vv:=%ld", p, v + p, vv);
456  v = v + p;
457  if (labs(v) > max_v_so_far) {
458  if (labs(v) > max_v + 99) {
459  msg_out(M_DEBUG, " warning: |v|>%ld!", max_v);
460  max_v = labs(v);
461  }
462  max_v_so_far = labs(v);
463  }
464  msg_out(M_DEBUG, " \n");
465  dvi_state.v = v; dvi_state.vv = vv;
466 }
467 
468 /* 84. Rounding to the nearest pixel is best done in the manner shown here,
469  * so as to be inoffensive to the eye: When the horizontal motion is small,
470  * like a kern, hh changes by rounding the kern; but when the motion is
471  * large, hh changes by rounding the true position h so that accumulated
472  * rounding errors disappear. We allow a larger space in the negative
473  * direction than in the positive one, because \TeX{} makes comparatively
474  * large backspaces when it positions accents. */
475 static void out_space (SIGNED_QUAD p)
476 {
477  SIGNED_QUAD font_space;
478 
479  font_space = (cur_font >= 0 ? dvi_fonts[cur_font].size / 6 : 0);
480 
481  if (p >= font_space || p <= -4 * font_space) {
482  out_text(' ');
484  } else
486 
487  move_right(p);
488 }
489 
490 /* 85. Vertical motion is done similarly, but with the threshold between
491  * ``small'' and ``large'' increased by a factor of five. The idea is to
492  * make fractions like ``1\over2'' round consistently, but to absorb
493  * accumulated rounding errors in the baseline-skip moves. */
494 static void out_vmove (SIGNED_QUAD p)
495 {
496  SIGNED_QUAD font_space;
497 
498  font_space = (cur_font >= 0 ? dvi_fonts[cur_font].size / 6 : 0);
499 
500  if (labs(p) >= 5 * font_space)
502  else
504 
505  move_down(p);
506 }
507 
509 {
510  SIGNED_QUAD x = 0; /* avoid uninitialized warning */
511 
512  msg_out(M_DEBUG, "%ld: ", dvi_location);
513  switch (opcode) {
514  case RIGHT1:
515  x = dvi_signed_byte();
516  if (frmfp) put_signed_byte(x, frmfp);
517  msg_out(M_DEBUG, "right1");
518  break;
519  case RIGHT2:
520  x = dvi_signed_pair();
521  if (frmfp) put_signed_pair(x, frmfp);
522  msg_out(M_DEBUG, "right2");
523  break;
524  case RIGHT3:
525  x = dvi_signed_triple();
527  msg_out(M_DEBUG, "right3");
528  break;
529  case RIGHT4:
530  x = dvi_signed_quad();
531  if (frmfp) put_signed_quad(x, frmfp);
532  msg_out(M_DEBUG, "right4");
533  break;
534  case W0:
535  x = dvi_state.w;
536  msg_out(M_DEBUG, "w0");
537  break;
538  case W1:
539  x = dvi_state.w = dvi_signed_byte();
540  if (frmfp) put_signed_byte(x, frmfp);
541  msg_out(M_DEBUG, "w1");
542  break;
543  case W2:
544  x = dvi_state.w = dvi_signed_pair();
545  if (frmfp) put_signed_pair(x, frmfp);
546  msg_out(M_DEBUG, "w2");
547  break;
548  case W3:
551  msg_out(M_DEBUG, "w3");
552  break;
553  case W4:
554  x = dvi_state.w = dvi_signed_quad();
555  if (frmfp) put_signed_quad(x, frmfp);
556  msg_out(M_DEBUG, "w4");
557  break;
558  case X0:
559  x = dvi_state.x;
560  msg_out(M_DEBUG, "x0");
561  break;
562  case X1:
563  x = dvi_state.x = dvi_signed_byte();
564  if (frmfp) put_signed_byte(x, frmfp);
565  msg_out(M_DEBUG, "x1");
566  break;
567  case X2:
568  x = dvi_state.x = dvi_signed_pair();
569  if (frmfp) put_signed_pair(x, frmfp);
570  msg_out(M_DEBUG, "x2");
571  break;
572  case X3:
575  msg_out(M_DEBUG, "x3");
576  break;
577  case X4:
578  x = dvi_state.x = dvi_signed_quad();
579  if (frmfp) put_signed_quad(x, frmfp);
580  msg_out(M_DEBUG, "x4");
581  break;
582  }
583  msg_out(M_DEBUG, " %ld", x);
584 
585  if (!dvi_state.d)
586  out_space(x);
587  else
588  out_vmove(x);
589 }
590 
592 {
593  SIGNED_QUAD y = 0; /* avoid uninitialized warning */
594 
595  flush_text();
596  msg_out(M_DEBUG, "%ld: ", dvi_location);
597  switch (opcode) {
598  case DOWN1:
599  y = dvi_signed_byte();
600  if (frmfp) put_signed_byte(y, frmfp);
601  msg_out(M_DEBUG, "down1");
602  break;
603  case DOWN2:
604  y = dvi_signed_pair();
605  if (frmfp) put_signed_pair(y, frmfp);
606  msg_out(M_DEBUG, "down2");
607  break;
608  case DOWN3:
609  y = dvi_signed_triple();
611  msg_out(M_DEBUG, "down3");
612  break;
613  case DOWN4:
614  y = dvi_signed_quad();
615  if (frmfp) put_signed_quad(y, frmfp);
616  msg_out(M_DEBUG, "down4");
617  break;
618  case Y0:
619  y = dvi_state.y;
620  msg_out(M_DEBUG, "y0");
621  break;
622  case Y1:
623  y = dvi_state.y = dvi_signed_byte();
624  if (frmfp) put_signed_byte(y, frmfp);
625  msg_out(M_DEBUG, "y1");
626  break;
627  case Y2:
628  y = dvi_state.y = dvi_signed_pair();
629  if (frmfp) put_signed_pair(y, frmfp);
630  msg_out(M_DEBUG, "y2");
631  break;
632  case Y3:
635  msg_out(M_DEBUG, "y3");
636  break;
637  case Y4:
638  y = dvi_state.y = dvi_signed_quad();
639  if (frmfp) put_signed_quad(y, frmfp);
640  msg_out(M_DEBUG, "y4");
641  break;
642  case Z0:
643  y = dvi_state.z;
644  msg_out(M_DEBUG, "z0");
645  break;
646  case Z1:
647  y = dvi_state.z = dvi_signed_byte();
648  if (frmfp) put_signed_byte(y, frmfp);
649  msg_out(M_DEBUG, "z1");
650  break;
651  case Z2:
652  y = dvi_state.z = dvi_signed_pair();
653  if (frmfp) put_signed_pair(y, frmfp);
654  msg_out(M_DEBUG, "z2");
655  break;
656  case Z3:
659  msg_out(M_DEBUG, "z3");
660  break;
661  case Z4:
662  y = dvi_state.z = dvi_signed_quad();
663  if (frmfp) put_signed_pair(y, frmfp);
664  msg_out(M_DEBUG, "z4");
665  break;
666  }
667  msg_out(M_DEBUG, " %ld", y);
668 
669  if (!dvi_state.d)
670  out_vmove(y);
671  else
672  out_space(-y);
673 }
674 
675 #define RULE_PIXELS(p) (SIGNED_QUAD)ceil(conv*(p))
676 
677 /* 90. <Finish a command that either sets or puts a rule, then goto
678  * move_right or done> */
680 {
682 
683  flush_text();
684  switch (opcode) {
685  case SET_RULE:
686  msg_out(M_DEBUG, "%ld: setrule", dvi_location);
687  break;
688  case PUT_RULE:
689  msg_out(M_DEBUG, "%ld: putrule", dvi_location);
690  break;
691  }
692 
694  if (frmfp) {
696  }
697  msg_out(M_DEBUG, " height %ld width %ld", height, width);
698  if (height <= 0 || width <= 0)
699  msg_out(M_DEBUG, " (invisible) \n");
700  else {
701  msg_out(M_DEBUG, " %ldx%ld pixels \n", RULE_PIXELS(height), RULE_PIXELS(width));
702  calc_bbox(width, height, 0);
703  }
704 
705  /*
706  * SET_RULE: Typeset a solid black rectangle of height |a| and width |b|,
707  * with its bottom left corner at |(h,v)|. Then set |h:=h+b|. If either
708  * |a<=0| or |b<=0|, nothing should be typeset. Note that if |b<0|, the
709  * value of |h| will decrease even though nothing else happens.
710  */
711  if (opcode == SET_RULE) {
713  move_right(width);
714  }
715 }
716 
717 /* 89. <Finish a command that either sets or puts a character, then
718  * goto move_right or done> */
719 static void fin_set (UNSIGNED_BYTE p, int move)
720 {
722 
723  if (cur_font < 0)
724  msg_out(M_FAIL, "[fatal] fin_set(): No font selected.\n");
725 
729 
731 
732  if (!move) return;
733 
734  if (!dvi_state.d) {
736  move_right(width);
737  } else {
739  move_down(width);
740  }
741 }
742 
743 /* 88. Translate a set_char command. */
745 {
746  if (opcode > 32 && opcode < 127) /* from '!' to '~' */
747  out_text((char)(opcode - SET_CHAR_0));
748  else
749  flush_text();
750  msg_out(M_DEBUG, "%ld: setchar%d", dvi_location, opcode - SET_CHAR_0);
751 
752  fin_set(opcode - SET_CHAR_0, 1);
753 }
754 
755 /* 89. <Finish a command that either sets or puts a character, then
756  * goto move_right or done> */
758 {
759  SIGNED_QUAD ch = 0; /* avoid uninitialized warning */
760 
761  flush_text();
762  msg_out(M_DEBUG, "%ld: ", dvi_location);
763 
764  switch (opcode) {
765  case SET1:
766  ch = dvi_unsigned_byte();
768  break;
769  case SET2:
770  ch = dvi_unsigned_pair();
772  break;
773  case SET3:
776  break;
777  case SET4:
778  ch = dvi_signed_quad();
779  if (frmfp) put_signed_quad(ch, frmfp);
780  break;
781  }
782  msg_out(M_DEBUG, " set%c %ld ", '1' + (opcode - SET1), ch);
783 
784  fin_set(ch, 1);
785 }
786 
787 /* 89. <Finish a command that either sets or puts a character, then
788  * goto move_right or done> */
790 {
791  SIGNED_QUAD ch = 0; /* avoid uninitialized warning */
792 
793  flush_text();
794  msg_out(M_DEBUG, "%ld: ", dvi_location);
795  switch (opcode) {
796  case PUT1:
797  ch = dvi_unsigned_byte();
799  break;
800  case PUT2:
801  ch = dvi_unsigned_pair();
803  break;
804  case PUT3:
807  break;
808  case PUT4:
809  ch = dvi_signed_quad();
810  if (frmfp) put_signed_quad(ch, frmfp);
811  break;
812  }
813  msg_out(M_DEBUG, " put%c %ld ", '1' + (opcode - PUT1), ch);
814 
815  fin_set(ch, 0);
816 }
817 
818 static void show_state (void)
819 {
820  msg_out(M_DEBUG, "level %d:(h=%ld,v=%ld,w=%ld,x=%ld,y=%ld,z=%ld,hh=%ld,vv=%ld) \n", dvi_stack_depth, dvi_state.h, dvi_state.v, dvi_state.w, dvi_state.x, dvi_state.y, dvi_state.z, dvi_state.hh, dvi_state.vv);
821 }
822 
823 static void do_push (void)
824 {
825  flush_text();
826  msg_out(M_DEBUG, "%ld: push \n", dvi_location);
827  show_state();
830  else
831  msg_out(M_FAIL, "[fatal] do_push(): DVI stack exceeded.\n");
832 }
833 
834 static void do_pop (void)
835 {
836  BBOX *bb;
837 
838  if (dvi_stack_depth > 0)
840  else
841  msg_out(M_FAIL, "[fatal] do_pop(): Tried to pop an empty stack.\n");
842  flush_text();
843  msg_out(M_DEBUG, "%ld: pop \n", dvi_location);
844  show_state();
845 
846  /* reset bounding boxes */
847  bb = page_bbox.next;
848  while (bb) {
849  if (bb->lev_s == dvi_stack_depth + 1 && bb->type == LINES_TYPE) {
850  flush_bbox(bb);
851  reset_bbox(bb);
852  }
853  bb = bb->next;
854  }
855 }
856 
858 {
859  register int i;
860  SIGNED_QUAD id = 0; /* avoid uninitialized warning */
861 
862  flush_text();
863  msg_out(M_DEBUG, "%ld: ", dvi_location);
864  if (opcode >= FNT_NUM_0 && opcode <= FNT_NUM_63) {
865  id = opcode - FNT_NUM_0;
866  msg_out(M_DEBUG, "fntnum%ld ", id);
867  } else {
868  switch (opcode) {
869  case FNT1:
870  id = dvi_unsigned_byte();
871  if (frmfp) put_unsigned_byte(id, frmfp);
872  break;
873  case FNT2:
874  id = dvi_unsigned_pair();
875  if (frmfp) put_unsigned_pair(id, frmfp);
876  break;
877  case FNT3:
878  id = dvi_unsigned_triple();
879  if (frmfp) put_unsigned_triple(id, frmfp);
880  break;
881  case FNT4:
882  id = dvi_signed_quad();
883  if (frmfp) put_signed_quad(id, frmfp);
884  break;
885  }
886  msg_out(M_DEBUG, "fnt%c %ld ", '1' + (opcode - FNT1), id);
887  }
888 
889  for (i = 0; i < num_dvi_fonts; i++)
890  if (dvi_fonts[i].id == id) break;
891 
892  if (i == num_dvi_fonts)
893  msg_out(M_FAIL, "[fatal] do_fnt_num(): Tried to select a font (ID %ld) that hasn't been defined.\n", id);
894 
895  msg_out(M_DEBUG, "current font is %s \n", dvi_fonts[i].name);
896 
897  if (!dvi_fonts[i].used) {
899  dvi_fonts[i].used = 1;
900  }
901 
902  cur_font = i;
903 }
904 
905 static void do_pos_special (unsigned char *buffer, SIGNED_QUAD buffer_len)
906 {
907  unsigned char *cmd, *tag, *p;
908  SIGNED_QUAD x, y;
909  SIGNED_QUAD w = 0, h = 0, d = 0; /* avoid uninitialized warning */
910  double w_pt, h_pt, d_pt; /* in pt */
911  int parsed = 0; /* how many conversions the sscanf managed */
912 
913  struct /* see \doregisterparoptions in ConTeXt's core-pos.tex */
914  {
915  double hsize, leftskip, rightskip, hangindent, parindent;
916  SIGNED_QUAD hangafter;
917  } list;
918 
919  for (p = buffer; p - buffer < buffer_len && isspace(*p); p++)
920  ; /* skip white chars */
921  if (strncmp((char *)p, "pos:", 4)) return;
922 
923  for (cmd = p; p - buffer < buffer_len && !isspace(*p); p++)
924  ; /* retrieve POS command */
925 
926  for (*p++ = 0; p - buffer < buffer_len && isspace(*p); p++)
927  ; /* skip white chars */
928 
929  /* retrieve POS identification */
930  if (*p == '"')
931  for (tag = ++p; p - buffer < buffer_len && *p != '"'; p++);
932  else
933  for (tag = p; p - buffer < buffer_len && !isspace(*p); p++);
934  *p = 0;
935 
936  for (p++; p - buffer < buffer_len && isspace(*p); p++)
937  ; /* skip white chars */
938  if (p - buffer < buffer_len)
939  {
940  /* hangafter is a number, not a dimension, hence its %ld */
941  parsed = sscanf((char *)p, "%lfpt %lfpt %lfpt %lfpt,%lfpt,%lfpt,%lfpt,%ld,%lfpt",
942  &w_pt, &h_pt, &d_pt,
943  &list.hsize, &list.leftskip, &list.rightskip,
944  &list.hangindent, &list.hangafter, &list.parindent);
945  /* convert pt to sp. Forget about rounding (add 0.5 if you want it). */
946  w = w_pt * 65536;
947  h = h_pt * 65536;
948  d = d_pt * 65536;
949  }
950 
951  x = dvi_state.h + denominator / 100;
952  y = max_v - dvi_state.v;
953 
954  if (strcmp((char *)cmd, "pos:pxy") == 0)
955  fprintf(outfp, "\\pospxy{%s}{%d}{%ldsp}{%ldsp}\n", tag, current_page, x, y);
956  else if (strcmp((char *)cmd, "pos:pxywhd") == 0)
957  fprintf(outfp, "\\pospxywhd{%s}{%d}{%ldsp}{%ldsp}{%ldsp}{%ldsp}{%ldsp}\n", tag, current_page, x, y, w, h, d);
958  else if (strcmp((char *)cmd, "pos:pxyplus") == 0) {
959  if (parsed < 9)
960  fprintf(stderr, "dvipos: only %d conversions for \\pospxyplus but 9 are needed\nBeward: Coordinates in the output may therefore be junk. Continuing anyway...", parsed);
961  fprintf(outfp, "\\pospxyplus{%s}{%d}{%ldsp}{%ldsp}{%ldsp}{%ldsp}{%ldsp}", tag, current_page, x, y, w, h, d);
962  fprintf(outfp, "{%lfpt,%lfpt,%lfpt,%lfpt,%ld,%lfpt}\n",
963  list.hsize, list.leftskip, list.rightskip,
964  list.hangindent, list.hangafter, list.parindent);
965  }
966  else if (strcmp((char *)cmd, "pos:begbox") == 0)
967  new_bbox((char *)tag, BOX_TYPE);
968  else if (strcmp((char *)cmd, "pos:endbox") == 0)
969  close_bbox((char *)tag);
970  else if (strcmp((char *)cmd, "pos:beglines") == 0)
971  new_bbox((char *)tag, LINES_TYPE);
972  else if (strcmp((char *)cmd, "pos:endlines") == 0)
973  close_bbox((char *)tag);
974 }
975 
977 {
978  SIGNED_QUAD size = 0; /* avoid uninitialized warning */
979  unsigned char *sp_buf;
980 
981  flush_text();
982  msg_out(M_DEBUG, "%ld: xxx ", dvi_location);
983  switch (opcode) {
984  case XXX1:
987  break;
988  case XXX2:
991  break;
992  case XXX3:
995  break;
996  case XXX4:
997  size = dvi_signed_quad();
999  break;
1000  }
1001 
1002  sp_buf = (unsigned char *)calloc(size+1, sizeof(unsigned char));
1003  if (fread(sp_buf, sizeof(unsigned char), size, dvi_file) != size)
1004  msg_out(M_FAIL, "[fatal] do_xxx(): Failed to read the special commands with size %d.\n", size);
1005  if (frmfp) {
1006  fwrite(sp_buf, sizeof(unsigned char), size, frmfp);
1007  dbg_location += size;
1008  }
1009 
1010  msg_out(M_DEBUG, "'%s' \n", sp_buf);
1011  dvi_location += size;
1012 
1013  do_pos_special(sp_buf, size); /* defined in dvispec.c */
1014 
1015  free(sp_buf);
1016 }
1017 
1018 static void dvi_clear_state (void)
1019 {
1020  cur_font = -1; /* set current font undefined */
1021  dvi_stack_depth = 0;
1022  dvi_state.h = 0; dvi_state.v = 0; dvi_state.w = 0;
1023  dvi_state.x = 0; dvi_state.y = 0; dvi_state.z = 0;
1024  dvi_state.hh = 0; dvi_state.vv = 0;
1025  dvi_state.d = 0; /* direction for ASCII pTeX */
1026 }
1027 
1028 static void do_bop (void)
1029 {
1030  int i;
1031 
1032  msg_out(M_DEBUG, " \n%ld: beginning of page %d \n", dvi_location, current_page);
1033  if (frmfp) {
1034  for (i = 0; i < 10; i++) put_signed_quad(dvi_signed_quad(), frmfp);
1035  /* the previous page location */
1036  dvi_signed_quad();
1039  } else
1040  for (i = 0; i < 11; i++) dvi_signed_quad();
1041  dvi_clear_state();
1042  clear_bbox(0);
1043 }
1044 
1045 static void do_eop (void)
1046 {
1047  BBOX *bb;
1048 
1049  flush_text();
1050  msg_out(M_DEBUG, "%ld: eop ", dvi_location);
1051  msg_out(M_DEBUG, "[%ld %ld %ld %ld]", page_bbox.h1, page_bbox.v1, page_bbox.h2, page_bbox.v2);
1052 
1053  /* reset bounding boxes */
1054  bb = page_bbox.next;
1055  while (bb) {
1056  reset_bbox(bb);
1057  bb = bb->next;
1058  }
1059 
1062 }
1063 
1064 static void do_dir (void)
1065 {
1068  msg_out(M_DEBUG, "%ld: dir %d \n", dvi_location-1, dvi_state.d);
1069 }
1070 
1072 {
1073  register int dlen, flen;
1074  SIGNED_QUAD id;
1075  char *fnt_buf;
1076 
1077  flush_text();
1078  switch (opcode) {
1079  case FNT_DEF1:
1080  id = dvi_unsigned_byte();
1081  if (frmfp) put_unsigned_byte(id, frmfp);
1082  msg_out(M_DEBUG, "%ld: fntdef1 %ld: ", dvi_location-1, id);
1083  break;
1084  case FNT_DEF2:
1085  id = dvi_unsigned_pair();
1086  if (frmfp) put_unsigned_pair(id, frmfp);
1087  msg_out(M_DEBUG, "%ld: fntdef2 %ld: ", dvi_location-2, id);
1088  break;
1089  case FNT_DEF3:
1090  id = dvi_unsigned_triple();
1091  if (frmfp) put_unsigned_triple(id, frmfp);
1092  msg_out(M_DEBUG, "%ld: fntdef3 %ld: ", dvi_location-3, id);
1093  break;
1094  case FNT_DEF4:
1095  id = dvi_signed_quad();
1096  if (frmfp) put_signed_quad(id, frmfp);
1097  msg_out(M_DEBUG, "%ld: fntdef4 %ld: ", dvi_location-4, id);
1098  break;
1099  }
1100 
1101  /* the checksum that TeX found in the TFM file for this font */
1103  else dvi_signed_quad();
1104  /* a fixed-point scale factor */
1106  else dvi_signed_quad();
1107  /* the "design size" */
1109  else dvi_signed_quad();
1110  /* the length of the "area" or directory */
1111  dlen = dvi_unsigned_byte();
1112  if (frmfp) put_unsigned_byte(dlen, frmfp);
1113  /* the length of the font name itself */
1114  flen = dvi_unsigned_byte();
1115  if (frmfp) put_unsigned_byte(flen, frmfp);
1116 
1117  /* the external name of the font */
1118  fnt_buf = (char *)calloc(dlen+flen+1, sizeof(char));
1119  flen = fread(fnt_buf, sizeof(char), dlen+flen, dvi_file);
1120  if (frmfp) {
1121  fwrite(fnt_buf, sizeof(char), flen, frmfp);
1122  dbg_location += flen;
1123  }
1124  fnt_buf[flen] = 0;
1125  msg_out(M_DEBUG, "%s \n", fnt_buf);
1126  dvi_location += flen;
1127  free(fnt_buf);
1128 }
1129 
1130 /* 110. The conversion factor \emph{conv} is figured as follows: There are
1131  * exactly $n/d$ decimicrons per DVI unit, and 254000 decimicrons per inch,
1132  * and \emph{resolution} pixels per inch. Then we have to adjust this by
1133  * the stated amount of magnification. */
1134 static void compute_conversion_factors (void)
1135 {
1136  if ((numerator = dvi_signed_quad()) <= 0)
1137  msg_out(M_FAIL, "Bad DVI file: numerator is %d!\n", numerator);
1138 
1139  if ((denominator = dvi_signed_quad()) <= 0)
1140  msg_out(M_FAIL, "Bad DVI file: denominator is %d!\n", denominator);
1141 
1142  msg_out(M_DEBUG, "numerator/denominator=%ld/%ld\n", numerator, denominator);
1143 
1144  tfm_conv = ((double)25400000.0/numerator) * (denominator/(double)473628672)/16.0;
1145  conv = (numerator/(double)254000.0) * (resolution/denominator);
1146 
1147  dvi_mag = mag = dvi_signed_quad();
1148  if (new_mag > 0)
1149  mag = new_mag; /* override the existing maginification */
1150  else if (mag <= 0)
1151  msg_out(M_FAIL, "Bad DVI file: magnification is %d!\n", mag);
1152 
1153  true_conv = conv;
1154  conv = true_conv * (mag/(double)1000.0);
1155 
1156  msg_out(M_DEBUG, "magnification=%ld; %16.8f pixels per DVI unit\n", mag, conv);
1157 }
1158 
1159 /* 109. A DVI-reading program that reads the postamble first need not look
1160  * at the preamble; but DVItype looks at the preamble in order to do error
1161  * checking, and to display the introductory comment. */
1162 static void process_preamble (void)
1163 {
1164  fseek(dvi_file, 0L, SEEK_SET);
1165 
1166  /* fetch the first byte */
1167  if (dvi_unsigned_byte() != PRE)
1168  msg_out(M_FAIL, "First byte isn't start of preamble!\n");
1169  /* fetch the identification byte */
1170  if ((id = dvi_unsigned_byte()) != DVI_ID && id != DVIV_ID)
1171  msg_out(M_FAIL, "identification in byte 1 should be %d or %d.\n", DVI_ID, DVIV_ID);
1172 
1174 
1175  /* fetch the introductory comment */
1176  comment[fread(comment, sizeof(char), dvi_unsigned_byte(), dvi_file)] = 0;
1177  msg_out(M_DEBUG, "'%s'\n", comment);
1178 }
1179 
1180 /* 19. The last page in a DVI file is followed by `\emph{post}'; this command
1181  * introduces the postamble, which summarizes important facts that \TeX{} has
1182  * accumulated about the file, making it possible to print subsets of the data
1183  * with reasonable efficiency. The postamble has the form
1184  *
1185  * post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2]
1186  * <font definitions>
1187  * post_post q[4] i[1] 223's[>=4]
1188  *
1189  * Here $p$ is a pointer to the final bop in the file. The next three
1190  * parameters, $num$, $den$, and $mag$, are duplicates of the quantities that
1191  * appeared in the preamble.
1192  */
1193 
1194 /* 103. Reading the postamble. Now imagine that we are reading the DVI file
1195  * and positioned just four bytes after the \emph{post} command. That,
1196  * in fact, is the situation, when the following part of DVItype is called
1197  * upon to read, translate, and check the rest of the postamble. */
1198 
1199 /* 20. The curious way to finish off a DVI file makes it feasible for
1200  * DVI-reading programs to find the postamble first, on most computers,
1201  * even though \TeX{} wants to write the postamble last. Most operating
1202  * systems permit random access to individual words or bytes of a file,
1203  * so the DVI reader can start at the end and skip backwards over the
1204  * 223's until finding the identification byte. Then it can back up four
1205  * bytes, read $q$, and move to byte $q$ of the file. This byte should,
1206  * of course, contain the value 248 (\emph{post}); now the postamble can
1207  * be read, so the DVI reader discovers all the information needed for
1208  * typesetting the pages. Note that it is also possible to skip through
1209  * the DVI file at reasonably high speed to locate a particular page,
1210  * if that proves desirable. This saves a lot of time, since DVI files
1211  * used in production jobs tend to be large. */
1212 static void read_postamble (void)
1213 {
1215  SIGNED_QUAD current_location = dvi_fsize;
1216 
1217  /* scan backwards through PADDING */
1218  do {
1219  current_location--;
1220  fseek(dvi_file, current_location, SEEK_SET);
1221  } while((opcode = dvi_unsigned_byte()) == PADDING && current_location > 0);
1222 
1223  /* current_location now points to the identification byte */
1224  if (dvi_fsize <= current_location + 4)
1225  msg_out(M_FAIL, "Bad DVI file: not enough signature bytes at end of file (%ld)\n", dvi_fsize - current_location - 1);
1226 
1227  post_post_location = current_location - 5;
1229  if ((opcode = dvi_unsigned_byte()) != POST_POST)
1230  msg_out(M_FAIL, "[fatal] Found (%d) where POST_POST should be.\n", opcode);
1231 
1232  /* now points to the pointer $q$ to the \emph{post} command */
1235  if ((opcode = dvi_unsigned_byte()) != POST)
1236  msg_out(M_FAIL, "[fatal] Found (%d) where POST should be\n", opcode);
1237 
1238  msg_out(M_DEBUG, "Postamble starts at byte %ld.\n", post_location);
1239 
1240  dvi_signed_quad(); /* skip the first four bytes; p[4] */
1241 
1242  if (dvi_signed_quad() != numerator)
1243  msg_out(M_FAIL, "Bad DVI file: numerator doesn't match the preamble!\n");
1244 
1245  if (dvi_signed_quad() != denominator)
1246  msg_out(M_FAIL, "Bad DVI file: denominator doesn't match the preamble!\n");
1247 
1248  if (dvi_signed_quad() != mag && new_mag == 0)
1249  msg_out(M_FAIL, "Bad DVI file: magnification doesn't match the preamble!\n");
1250 
1251  max_v = dvi_signed_quad();
1252  max_h = dvi_signed_quad();
1253  msg_out(M_DEBUG, "maxv=%ld, maxh=%ld, ", max_v, max_h);
1254 
1256  msg_out(M_FAIL, "[fatal] maxstackdepth %d exceeds DVI_MAX_STACK_DEPTH %d\n", max_s, DVI_MAX_STACK_DEPTH);
1258  msg_out(M_DEBUG, "maxstackdepth=%d, totalpages=%d\n", max_s, total_pages);
1259 }
1260 
1261 static void find_page_location (void)
1262 {
1263  int i;
1264 
1265  /* Read the total page number */
1267  if ((dvi_pages = dvi_unsigned_pair()) == 0)
1268  msg_out(M_FAIL, "[fatal] Total page number is zero.\n");
1269 
1270  /* Read the location of each page */
1274  if (page_location[dvi_pages-1] + 41 > dvi_fsize)
1275  msg_out(M_FAIL, "[fatal] The location of the page %d was broken.\n", dvi_pages);
1276  for (i = dvi_pages-2; i >= 0; i--) {
1277  fseek(dvi_file, page_location[i+1] + 41, SEEK_SET);
1279  if (page_location[i] + 41 > dvi_fsize)
1280  msg_out(M_FAIL, "[fatal] The location of the page %d was broken.\n", i+1);
1281  }
1282 }
1283 
1284 /* 59. The following subroutine does the necessary things when a fnt_def
1285  * command is being processed. */
1287 {
1288  SIGNED_QUAD q, d, m;
1289  int p, n;
1290  char *name;
1291 
1292  if (num_dvi_fonts >= max_dvi_fonts) {
1294  dvi_fonts = (struct dvi_font *)realloc(dvi_fonts, max_dvi_fonts * sizeof(struct dvi_font));
1295  }
1296 
1297  dvi_signed_quad(); /* font_check_sum */
1298  q = dvi_signed_quad(); /* font_scaled_size */
1299  d = dvi_signed_quad(); /* font_design_size */
1300 
1301  if (q <= 0 || d <= 0) m = 1000;
1302  else m = xround((1000.0*conv*q)/(true_conv*d));
1303 
1304  p = dvi_unsigned_byte();
1305  n = dvi_unsigned_byte();
1306 
1307  msg_out(M_DEBUG, "Font %ld: ", e);
1308 
1309  /* Retrieve the directory name and the font name */
1310  name = (char *)calloc(p+n+1, sizeof(char));
1311  if (p + n > 0) {
1312  if (fread(name, sizeof(char), p+n, dvi_file) != p+n)
1313  msg_out(M_FAIL, "[fatal] Failed to retrieve a font name.\n");
1314  }
1315  name[p+n] = 0;
1316 
1317  msg_out(M_DEBUG, "%s", (p + n > 0 ? name : "null font name!"));
1318 
1319  if (m != 1000)
1320  msg_out(M_DEBUG, " scaled %ld", m);
1321 
1323  dvi_fonts[num_dvi_fonts].size = q; /* scaled_size */
1326 
1327  msg_out(M_DEBUG, "---loaded at size %ld DVI units \n", q);
1328  d = xround((100.0*conv*q)/(true_conv*d));
1329  if (d != 100)
1330  msg_out(M_DEBUG, " (this font is magnified %ld%c) \n", d, '%');
1331 
1332  num_dvi_fonts++;
1333 }
1334 
1335 static void process_fonts (void)
1336 {
1338 // fseek(dvi_file, post_location+29, SEEK_SET);
1339  while ((opcode = dvi_unsigned_byte()) != POST_POST)
1340  switch (opcode) {
1341  case FNT_DEF1: define_font(dvi_unsigned_byte()); break;
1342  case FNT_DEF2: define_font(dvi_unsigned_pair()); break;
1343  case FNT_DEF3: define_font(dvi_unsigned_triple()); break;
1344  case FNT_DEF4: define_font(dvi_signed_quad()); break;
1345  default: msg_out(M_FAIL, "Bad DVI file: byte %ld is not postpost!\n", dvi_location);
1346  }
1347 }
1348 
1349 void dvi_init (int m, int r)
1350 {
1351  time_t tm = time(NULL);
1352  /* get all variables initialized */
1353  dvi_file = infp;
1354  new_mag = (SIGNED_QUAD)m;
1355  resolution = (double)r;
1356 
1357  /* 73. Three characteristics of the pages (their max_v, max_h, and max_s)
1358  * are specified in the postamble, and a warning message is printed if
1359  * their limits are exceeded. Actually max_v is set to the maximum height
1360  * plus depth of a page, and max_h to the maximum width, for purposes of
1361  * page layout. Since characters can legally be set outside of the page
1362  * boundaries, it is not an error when max_v or max_h is exceeded. But
1363  * max_s should not be exceeded.
1364  * The postamble also specifies the total number of pages; DVItype
1365  * checks to see if this total is accurate. */
1366 // max_v = max_h = 017777777777 - 99;
1367 // max_s = stack_size + 1;
1369 
1370  /* Calculate the file size of the DVI file */
1371  fseek(dvi_file, 0L, SEEK_END);
1373  rewind(dvi_file);
1374 
1375  /* process the preamble */
1376  process_preamble();
1377 
1378  /* reading the postamble */
1379  read_postamble();
1380 
1381  /* process the font definitions of the postamble */
1382  process_fonts();
1383 
1384  /* Find the post opcode */
1386 
1388 
1389  if (bbxfp) {
1390  fprintf(bbxfp, "%%!! DVIpos, version (%s), output file\n", VERSION);
1391  fprintf(bbxfp, "%% This_position_filename: \"%s\"\n", bbxfname);
1392  fprintf(bbxfp, "%% Command_line_to_dvipos:\n");
1393  fprintf(bbxfp, "%%+ <THE_COMMAND_LINE>\n");
1394  fprintf(bbxfp, "%%+ <THE_COMMAND_LINE CONTINUED>\n");
1395  fprintf(bbxfp, "%% Processing_data_and_time: %s", ctime(&tm));
1396  fprintf(bbxfp, "%% Input_filename: \"%s\"\n", infname);
1397  if (frmfp)
1398  fprintf(bbxfp, "%% DVI_debug_output_filename: \"%s\"\n", frmfname);
1399  fprintf(bbxfp, "%% DVI_standard: %d\n", id);
1400  fprintf(bbxfp, "%% DVI_mag: %ld\n", dvi_mag);
1401  fprintf(bbxfp, "%% DVI_mag_requested: %ld\n", mag);
1402  }
1403 
1404  if (frmfp) {
1405  int count = 15 + strlen(comment);
1406  char *buf = (char *)xmalloc(count);
1407  fseek(dvi_file, 0L, SEEK_SET);
1408  fread(buf, 1, count, dvi_file);
1409  sput_signed_quad(buf+10, mag);
1410  fwrite(buf, 1, count, frmfp);
1411  dbg_location += count;
1412  free(buf);
1413  }
1414 }
1415 
1416 void dvi_close (void)
1417 {
1418  int i;
1419 
1420  if (frmfp) {
1421  char *buf;
1422  int count = post_post_location - post_location - 29;
1423  SIGNED_QUAD new_post_location = dbg_location; /* new post_location */
1433  buf = (char *)xmalloc(count);
1435  fread(buf, 1, count, dvi_file);
1436  fwrite(buf, 1, count, frmfp);
1437  free(buf);
1438  dbg_location += count;
1440  put_signed_quad(new_post_location, frmfp);
1441  put_unsigned_byte(id, frmfp);
1442  for (i = 0; i < 3; i++)
1443  put_unsigned_byte(223, frmfp);
1444  while (dbg_location % 4 != 3)
1445  put_unsigned_byte(223, frmfp);
1446  }
1447 
1448  tfm_close_all();
1449  fclose(dvi_file);
1451  for (i = 0; i < num_dvi_fonts; i++) free(dvi_fonts[i].name);
1452  if (dvi_fonts) free(dvi_fonts);
1453 }
1454 
1455 /* 79. Here is the overall setup. */
1456 void dvi_do_page (int n)
1457 {
1458  dvi_location = page_location[n-1] - 1;
1459  current_page = n;
1460  new_dvi_pages++;
1461 
1462  /* Position to beginning of page */
1464 
1465  /* set current font undefined; initialize the state variables */
1466  dvi_clear_state();
1467 
1468  /* 80. Translate the next command in the DVI file until finding EOP. */
1469  for (;;) {
1471 
1473 
1474  /* SET_CHAR_0 - SET_CHAR_127 */
1475  if (opcode >= SET_CHAR_0 && opcode <= SET_CHAR_127) {
1476  do_setchar(opcode);
1477  continue;
1478  }
1479 
1480  /* FNT_NUM_0 - FNT_NUM_63 */
1481  if (opcode >= FNT_NUM_0 && opcode <= FNT_NUM_63) {
1482  do_fnt_num(opcode);
1483  continue;
1484  }
1485 
1486  switch (opcode) {
1487  case SET1:
1488  case SET2:
1489  case SET3:
1490  case SET4: do_set(opcode); break;
1491  case PUT1:
1492  case PUT2:
1493  case PUT3:
1494  case PUT4: do_put(opcode); break;
1495  case SET_RULE:
1496  case PUT_RULE: do_rule(opcode); break;
1497  case NOP: msg_out(M_DEBUG, "%ld: nop \n", dvi_location); break;
1498  case BOP: do_bop(); break;
1499  case EOP: do_eop(); return;
1500  case PUSH: do_push(); break;
1501  case POP: do_pop(); break;
1502  case RIGHT1:
1503  case RIGHT2:
1504  case RIGHT3:
1505  case RIGHT4:
1506  case W0:
1507  case W1:
1508  case W2:
1509  case W3:
1510  case W4:
1511  case X0:
1512  case X1:
1513  case X2:
1514  case X3:
1515  case X4: do_space(opcode); break;
1516  case DOWN1:
1517  case DOWN2:
1518  case DOWN3:
1519  case DOWN4:
1520  case Y0:
1521  case Y1:
1522  case Y2:
1523  case Y3:
1524  case Y4:
1525  case Z0:
1526  case Z1:
1527  case Z2:
1528  case Z3:
1529  case Z4: do_vmove(opcode); break;
1530  case FNT1:
1531  case FNT2:
1532  case FNT3:
1533  case FNT4: do_fnt_num(opcode); break;
1534  case XXX1:
1535  case XXX2: /* Not used in general */
1536  case XXX3: /* Not used in general */
1537  case XXX4: do_xxx(opcode); break;
1538  case FNT_DEF1:
1539  case FNT_DEF2:
1540  case FNT_DEF3:
1541  case FNT_DEF4: do_fnt_def(opcode); break;
1542  case DIR: do_dir(); break;
1543  case PRE:
1544  case POST:
1545  case POST_POST:
1546  default:
1547  msg_out(M_FAIL, "[fatal] Unexpected opcode (%d).", opcode);
1548  }
1549  }
1550 }
q
Definition: afm2pl.c:2287
FILE * infp
Definition: aftopl.c:21
FILE * outfp
Definition: aftopl.c:22
#define width(a)
Definition: aptex-macros.h:198
#define type(a)
Definition: aptex-macros.h:171
#define depth(a)
Definition: aptex-macros.h:199
#define count(a)
Definition: aptex-macros.h:781
#define name
#define height(a)
Definition: aptex-macros.h:200
#define n
Definition: t4ht.c:1290
#define b
Definition: jpegint.h:372
#define SET_CHAR_0
Definition: dd.h:686
#define FNT_NUM_0
Definition: dd.h:706
#define free(a)
Definition: decNumber.cpp:310
#define POP
Definition: dtl.h:135
#define Y0
Definition: dtl.h:159
#define PUT2
Definition: dtl.h:127
#define X4
Definition: dtl.h:152
#define DOWN4
Definition: dtl.h:157
#define X1
Definition: dtl.h:149
#define RIGHT4
Definition: dtl.h:140
#define Y1
Definition: dtl.h:160
#define Y2
Definition: dtl.h:161
#define Z2
Definition: dtl.h:167
#define W3
Definition: dtl.h:145
#define PUSH
Definition: dtl.h:134
#define Z1
Definition: dtl.h:166
#define Z0
Definition: dtl.h:165
#define DOWN3
Definition: dtl.h:156
#define Z3
Definition: dtl.h:168
#define RIGHT2
Definition: dtl.h:138
#define Y4
Definition: dtl.h:163
#define W0
Definition: dtl.h:142
#define Y3
Definition: dtl.h:162
#define SET3
Definition: dtl.h:122
#define PUT3
Definition: dtl.h:128
#define EOP
Definition: dtl.h:133
#define X2
Definition: dtl.h:150
#define RIGHT1
Definition: dtl.h:137
#define X0
Definition: dtl.h:148
#define BOP
Definition: dtl.h:132
#define SET4
Definition: dtl.h:123
#define SET1
Definition: dtl.h:120
#define RIGHT3
Definition: dtl.h:139
#define DOWN2
Definition: dtl.h:155
#define PUT4
Definition: dtl.h:129
#define W1
Definition: dtl.h:143
#define W2
Definition: dtl.h:144
#define PUT1
Definition: dtl.h:126
#define W4
Definition: dtl.h:146
#define DOWN1
Definition: dtl.h:154
#define SET2
Definition: dtl.h:121
#define X3
Definition: dtl.h:151
#define Z4
Definition: dtl.h:169
int z
Definition: dviconv.c:26
int w
Definition: dviconv.c:26
int v
Definition: dviconv.c:10
int h
Definition: dviconv.c:9
#define fread
Definition: xxstdio.h:25
#define fseek
Definition: xxstdio.h:30
#define ftell
Definition: xxstdio.h:31
int strcmp()
Definition: coll.cpp:143
int sscanf()
long hh
Definition: dvi2xx.h:579
long vv
Definition: dvi2xx.h:581
static void do_bop(void)
Definition: dvicore.c:1028
static SIGNED_QUAD * page_location
Definition: dvicore.c:36
static SIGNED_QUAD max_h_so_far
Definition: dvicore.c:56
static int current_page
Definition: dvicore.c:38
static SIGNED_PAIR dvi_signed_triple(void)
Definition: dvicore.c:322
#define PAGE_TYPE
Definition: dvicore.c:92
static void do_push(void)
Definition: dvicore.c:823
static void do_dir(void)
Definition: dvicore.c:1064
static UNSIGNED_PAIR dvi_unsigned_triple(void)
Definition: dvicore.c:316
static double resolution
Definition: dvicore.c:53
static SIGNED_QUAD prev_page_location
Definition: dvicore.c:37
static void dvi_clear_state(void)
Definition: dvicore.c:1018
#define PIXEL_ROUND(p)
Definition: dvicore.c:397
static void do_rule(UNSIGNED_BYTE opcode)
Definition: dvicore.c:679
static void define_font(SIGNED_QUAD e)
Definition: dvicore.c:1286
static void flush_text(void)
Definition: dvicore.c:379
int dvi_pages
Definition: dvicore.c:31
static SIGNED_PAIR max_s_so_far
Definition: dvicore.c:58
static void flush_bbox(BBOX *bb)
Definition: dvicore.c:237
static SIGNED_QUAD max_v
Definition: dvicore.c:56
static struct dvi_font * dvi_fonts
static SIGNED_QUAD max_v_so_far
Definition: dvicore.c:56
static void do_space(UNSIGNED_BYTE opcode)
Definition: dvicore.c:508
static FILE * dvi_file
Definition: dvicore.c:34
static void do_put(UNSIGNED_BYTE opcode)
Definition: dvicore.c:789
static void draw_frame(BBOX *bb)
Definition: dvicore.c:97
static SIGNED_QUAD max_h
Definition: dvicore.c:56
static UNSIGNED_BYTE dvi_unsigned_byte(void)
Definition: dvicore.c:292
static void fin_set(UNSIGNED_BYTE p, int move)
Definition: dvicore.c:719
static int dvi_stack_depth
Definition: dvicore.c:41
static SIGNED_PAIR dvi_signed_pair(void)
Definition: dvicore.c:310
static SIGNED_PAIR max_s
Definition: dvicore.c:57
#define WEB_INFINITY
Definition: dvicore.c:395
static void read_postamble(void)
Definition: dvicore.c:1212
static UNSIGNED_BYTE id
Definition: dvicore.c:55
static void show_state(void)
Definition: dvicore.c:818
static SIGNED_PAIR dvi_signed_quad(void)
Definition: dvicore.c:337
static void do_set(UNSIGNED_BYTE opcode)
Definition: dvicore.c:757
static int new_dvi_pages
Definition: dvicore.c:38
static BBOX page_bbox
Definition: dvicore.c:66
static SIGNED_PAIR total_pages
Definition: dvicore.c:57
static void move_right(SIGNED_QUAD q)
Definition: dvicore.c:399
static SIGNED_QUAD new_mag
Definition: dvicore.c:52
static unsigned char dvi_buffer[1024]
Definition: dvicore.c:73
static SIGNED_QUAD post_post_location
Definition: dvicore.c:36
static void do_eop(void)
Definition: dvicore.c:1045
static SIGNED_QUAD dvi_location
Definition: dvicore.c:35
static void close_bbox(char *tag)
Definition: dvicore.c:268
static void do_xxx(UNSIGNED_BYTE opcode)
Definition: dvicore.c:976
static SIGNED_QUAD post_location
Definition: dvicore.c:36
static SIGNED_QUAD xround(double p)
Definition: dvicore.c:368
static void reset_bbox(BBOX *bb)
Definition: dvicore.c:174
static void do_pop(void)
Definition: dvicore.c:834
static double tfm_conv
Definition: dvicore.c:53
#define LINES_TYPE_SUSPEND
Definition: dvicore.c:95
#define DVI_MAX_STACK_DEPTH
Definition: dvicore.c:40
static void clear_bbox(int init)
Definition: dvicore.c:181
static SIGNED_BYTE dvi_signed_byte(void)
Definition: dvicore.c:298
static double conv
Definition: dvicore.c:53
static char comment[257]
Definition: dvicore.c:68
static int max_dvi_fonts
Definition: dvicore.c:46
static void out_text(char c)
Definition: dvicore.c:389
void dvi_do_page(int n)
Definition: dvicore.c:1456
#define RULE_PIXELS(p)
Definition: dvicore.c:675
static SIGNED_QUAD denominator
Definition: dvicore.c:52
void dvi_close(void)
Definition: dvicore.c:1416
static void compute_conversion_factors(void)
Definition: dvicore.c:1134
static struct dvi_register dvi_stack[256]
static int cur_font
Definition: dvicore.c:46
static SIGNED_PAIR page_count
Definition: dvicore.c:58
static SIGNED_QUAD dvi_mag
Definition: dvicore.c:52
#define BOX_TYPE
Definition: dvicore.c:93
static struct dvi_register dvi_state
struct a_bbox BBOX
static double true_conv
Definition: dvicore.c:53
static void do_fnt_def(UNSIGNED_BYTE opcode)
Definition: dvicore.c:1071
static void do_setchar(UNSIGNED_BYTE opcode)
Definition: dvicore.c:744
#define LINE_LENGTH
Definition: dvicore.c:376
static void do_pos_special(unsigned char *buffer, SIGNED_QUAD buffer_len)
Definition: dvicore.c:905
static void write_bbox(BBOX *bb)
Definition: dvicore.c:217
static UNSIGNED_PAIR dvi_unsigned_pair(void)
Definition: dvicore.c:304
static void move_down(SIGNED_QUAD p)
Definition: dvicore.c:434
static void do_fnt_num(UNSIGNED_BYTE opcode)
Definition: dvicore.c:857
static void calc_bbox(SIGNED_QUAD width, SIGNED_QUAD height, SIGNED_QUAD depth)
Definition: dvicore.c:75
static void out_space(SIGNED_QUAD p)
Definition: dvicore.c:475
static void out_vmove(SIGNED_QUAD p)
Definition: dvicore.c:494
#define MAX_DRIFT
Definition: dvicore.c:396
static SIGNED_QUAD sqxfw(SIGNED_QUAD z, SIGNED_QUAD b)
Definition: dvicore.c:343
#define LINES_TYPE
Definition: dvicore.c:94
static int num_dvi_fonts
Definition: dvicore.c:46
static SIGNED_QUAD dvi_fsize
Definition: dvicore.c:35
static void do_vmove(UNSIGNED_BYTE opcode)
Definition: dvicore.c:591
static SIGNED_QUAD mag
Definition: dvicore.c:52
void dvi_init(int m, int r)
Definition: dvicore.c:1349
static void find_page_location(void)
Definition: dvicore.c:1261
static void process_fonts(void)
Definition: dvicore.c:1335
#define DVI_BUFFER_SIZE
Definition: dvicore.c:71
static SIGNED_QUAD numerator
Definition: dvicore.c:52
static int dvi_buffer_len
Definition: dvicore.c:72
static void process_preamble(void)
Definition: dvicore.c:1162
static void new_bbox(char *tag, int type)
Definition: dvicore.c:192
#define MAX_FONTS_STEP
Definition: dvicore.h:134
SIGNED_QUAD dbg_location
Definition: dvipos.c:38
char * frmfname
Definition: dvipos.c:37
FILE * frmfp
Definition: dvipos.c:36
char * bbxfname
Definition: dvipos.c:37
FILE * bbxfp
Definition: dvipos.c:36
SIGNED_QUAD rule_width
Definition: dvipos.c:38
char * infname
Definition: dvipos.c:37
int do_smashchars
Definition: dvipos.c:35
@ VERSION
Definition: genrb.cpp:69
__gmp_expr< mpf_t, __gmp_unary_expr< __gmp_expr< mpf_t, U >, __gmp_ceil_function > > ceil(const __gmp_expr< mpf_t, U > &expr)
Definition: gmpxx.h:3340
#define c(n)
Definition: gpos-common.c:150
#define d(n)
Definition: gpos-common.c:151
#define PRE
Definition: hbf2gf.c:42
#define XXX3
Definition: hbf2gf.c:55
#define XXX2
Definition: hbf2gf.c:54
#define POST
Definition: hbf2gf.c:60
#define XXX1
Definition: hbf2gf.c:53
#define XXX4
Definition: hbf2gf.c:56
#define SEEK_SET
Definition: jmemansi.c:26
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
#define SEEK_END
Definition: ftzconf.h:251
kerning y
Definition: ttdriver.c:212
#define hsize
Definition: gd_gif_out.c:57
#define beta
Definition: gd_nnquant.c:55
voidp calloc()
#define POST_POST
Definition: commands.h:259
#define FNT_DEF1
Definition: commands.h:253
#define FNT2
Definition: commands.h:246
#define FNT_DEF3
Definition: commands.h:255
#define FNT1
Definition: commands.h:245
#define FNT3
Definition: commands.h:247
#define DIR
Definition: commands.h:261
#define FNT4
Definition: commands.h:248
#define FNT_DEF2
Definition: commands.h:254
#define PUT_RULE
Definition: commands.h:147
#define SET_RULE
Definition: commands.h:142
#define FNT_DEF4
Definition: commands.h:256
#define xstrdup(s)
Definition: writet1.c:34
#define xmalloc(size)
Definition: writet1.c:33
#define buf
#define SET_CHAR_127
Definition: dvicodes.h:30
#define PADDING
Definition: dvicodes.h:118
#define DVI_ID
Definition: dvicodes.h:101
#define FNT_NUM_63
Definition: dvicodes.h:80
#define DVIV_ID
Definition: dvicodes.h:102
signed int get_signed_triple(FILE *file)
Definition: numbers.c:87
unsigned char get_unsigned_byte(FILE *file)
Definition: numbers.c:32
signed char get_signed_byte(FILE *file)
Definition: numbers.c:46
unsigned int get_unsigned_triple(FILE *file)
Definition: numbers.c:77
int32_t get_signed_quad(FILE *file)
Definition: numbers.c:97
uint32_t get_unsigned_quad(FILE *file)
Definition: numbers.c:107
signed short get_signed_pair(FILE *file)
Definition: numbers.c:69
unsigned short get_unsigned_pair(FILE *file)
Definition: numbers.c:55
fixword tfm_get_fw_width(int font_id, int32_t ch)
Definition: tfm.c:976
int tfm_open(const char *tfm_name, int must_exist)
Definition: tfm.c:833
fixword tfm_get_fw_depth(int font_id, int32_t ch)
Definition: tfm.c:1038
fixword tfm_get_fw_height(int font_id, int32_t ch)
Definition: tfm.c:1007
void tfm_close_all(void)
Definition: tfm.c:958
unsigned UNSIGNED_PAIR
Definition: numbers.h:35
int UNSIGNED_BYTE
Definition: numbers.h:34
int SIGNED_BYTE
Definition: numbers.h:34
int SIGNED_PAIR
Definition: numbers.h:34
long SIGNED_QUAD
Definition: numbers.h:36
void put_signed_pair(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:125
void sput_signed_quad(char *buf, SIGNED_QUAD quad)
Definition: utils.c:156
void put_signed_triple(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:137
void put_signed_quad(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:143
void put_signed_byte(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:112
void put_unsigned_byte(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:106
void msg_out(int level, const char *fmt,...)
Definition: utils.c:212
void put_unsigned_triple(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:131
void put_unsigned_pair(SIGNED_QUAD quad, FILE *fp)
Definition: utils.c:119
#define M_FAIL
Definition: utils.h:68
#define M_DEBUG
Definition: utils.h:71
#define fclose
Definition: debug.h:100
#define fprintf
Definition: mendex.h:64
#define floor(x)
Definition: cpascal.h:52
Code related to b fwrite(a, sizeof(char), b, stdout) @d C_printf(c
#define b0
Definition: texmfmem.h:168
#define b1
Definition: texmfmem.h:169
#define b3
Definition: texmfmem.h:171
#define b2
Definition: texmfmem.h:170
long time_t
Definition: types.h:18
int strncmp()
#define NOP
Definition: tif_getimage.c:684
cell * list
Definition: list_routines.h:30
static struct tm tm
Definition: localtime.c:216
#define realloc
Definition: glob.c:206
#define cmd(arg)
Definition: mitsu.h:44
float x
Definition: cordic.py:15
#define labs
Definition: p2c.h:477
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld init[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
static enum alpha_handling alpha
Definition: pngtopnm.c:70
static int size
Definition: ppmlabel.c:24
int r
Definition: ppmqvga.c:68
time_t time()
char * ctime()
#define isspace(ch)
Definition: utype.h:87
ShellFileEnvironment e
Definition: sh6.c:388
Definition: tables.h:434
Definition: dvicore.c:60
SIGNED_QUAD v2
Definition: dvicore.c:61
char * tag
Definition: dvicore.c:63
SIGNED_QUAD cb
Definition: dvicore.c:61
int type
Definition: dvicore.c:62
SIGNED_QUAD h2
Definition: dvicore.c:61
struct a_bbox * next
Definition: dvicore.c:64
SIGNED_QUAD fb
Definition: dvicore.c:61
SIGNED_QUAD h1
Definition: dvicore.c:61
SIGNED_QUAD v1
Definition: dvicore.c:61
int lev_s
Definition: dvicore.c:62
Definition: utils.c:300
int tfm_id
Definition: dvicore.c:49
SIGNED_QUAD id
Definition: dvicore.c:48
char * name
Definition: dvicore.c:49
SIGNED_QUAD size
Definition: dvicore.c:48
int used
Definition: dvicore.c:49
SIGNED_QUAD hh
Definition: dvicore.c:43
SIGNED_QUAD z
Definition: dvicore.c:43
SIGNED_QUAD w
Definition: dvicore.c:43
SIGNED_QUAD h
Definition: dvicore.c:43
SIGNED_QUAD d
Definition: dvicore.c:43
SIGNED_QUAD vv
Definition: dvicore.c:43
SIGNED_QUAD y
Definition: dvicore.c:43
SIGNED_QUAD v
Definition: dvicore.c:43
SIGNED_QUAD x
Definition: dvicore.c:43
Definition: xmlparse.c:179
#define FILE
Definition: t1stdio.h:34
ch
Definition: t4ht.c:1443
*job_name strlen((char *) job_name) - 4)
tag int tag
Definition: tex4ht.c:2554
m
Definition: tex4ht.c:3990
@ L
Definition: ubidiimp.h:45
#define SIGNED_QUAD
Definition: vf_ng.c:19