Debian Codegraph @

texk/xdvipsk/skippage.c

raw
1 /*
2 * Skips over a page, collecting possible font definitions. A very simple
3 * case statement insures we maintain sync with the dvi file by collecting
4 * the necessary parameters; but font definitions must be processed normally.
5 */
6 #ifndef XDVIPSK
7 #include "dvips.h" /* The copyright notice in that file is included too! */
8 #else
9 #include "xdvips.h" /* The copyright notice in that file is included too! */
10 #endif /* XDVIPSK */
11
12 /*
13 * The external declarations:
14 */
15 #include "protos.h"
16
17 /*
18 * And now the big routine.
19 */
20 void
21 skippage(void)
22 {
23 register shalfword cmd;
24 register integer i;
25
26 #ifdef DEBUG
27 if (dd(D_PAGE))
28 #ifdef SHORTINT
29 fprintf(stderr,"Skipping page %ld\n", pagenum);
30 #else /* ~SHORTINT */
31 fprintf(stderr,"Skipping page %d\n", pagenum);
32 #endif /* ~SHORTINT */
33 #endif /* DEBUG */
34 /* skipover(40); skip rest of bop command? how did this get in here? */
35 bopcolor(0);
36 while ((cmd=dvibyte())!=140) {
37 switch (cmd) {
38 case 255: /* pTeX's dir or undefined */
39 if (!noptex) {
40 cmd = dvibyte();
41 break;
42 }
43 /* illegal commands */
44 case 139: case 247: case 248: case 249: /* bop, pre, post, post_post */
45 case 250: case 251: case 252: case 253: case 254: /* undefined */
46 sprintf(errbuf,
47 "! DVI file contains unexpected command (%d)",cmd);
48 error(errbuf);
49 /* eight byte commands */
50 case 132: case 137:
51 cmd = dvibyte();
52 cmd = dvibyte();
53 cmd = dvibyte();
54 cmd = dvibyte();
55 /* four byte commands */
56 case 131: case 136:
57 case 146: case 151: case 156: case 160: case 165: case 170: case 238:
58 cmd = dvibyte();
59 /* three byte commands */
60 case 130: case 135:
61 case 145: case 150: case 155: case 159: case 164: case 169: case 237:
62 cmd = dvibyte();
63 /* two byte commands */
64 case 129: case 134:
65 case 144: case 149: case 154: case 158: case 163: case 168: case 236:
66 cmd = dvibyte();
67 /* one byte commands */
68 case 128: case 133:
69 case 143: case 148: case 153: case 157: case 162: case 167: case 235:
70 cmd = dvibyte();
71 break;
72 /* specials */
73 #ifndef XDVIPSK
74 case 239: i = dvibyte(); predospecial(i, 0); break;
75 case 240: i = twobytes(); predospecial(i, 0); break;
76 case 241: i = threebytes(); predospecial(i, 0); break;
77 case 242: i = signedquad(); predospecial(i, 0); break;
78 #else /* XDVIPSK */
79 case 239: i = dvibyte(); predospecial(i, 0, FALSE); break;
80 case 240: i = twobytes(); predospecial(i, 0, FALSE); break;
81 case 241: i = threebytes(); predospecial(i, 0, FALSE); break;
82 case 242: i = signedquad(); predospecial(i, 0, FALSE); break;
83 #endif /* XDVIPSK */
84 /* font definition */
85 case 243: case 244: case 245: case 246:
86 fontdef(cmd - 242);
87 break;
88 default:;
89 }
90 }
91 }