Date: 20-MAR-1989 17:21:05 GMT From: PHYOKANE@CS8700.UCG.IE To: abbottp@ASTON.AC.UK Subject: file checkpage.h sender: hea"phyokane@cs8700.ucg.ie" /* -*-C-*- checkpage.h */ /*-->checkpage*/ /**********************************************************************/ /***************************** checkpage ******************************/ /**********************************************************************/ void checkpage(bytepos) /* check page whose BOP is at bytepos */ long bytepos; { register BYTE command; /* current command */ register INT16 i; /* command parameter; loop index */ char tc; /* temporary character */ INT32 k; /* temporary parameter */ INT16 page_number; /* TeX's \count0 parameter */ BOOLEAN seen_bop; /* flag for noting processing of BOP */ /*********************************************************************** Check all commands between the BOP at bytepos and the next EOP, downloading any characters not already loaded. ***********************************************************************/ seen_bop = FALSE; /* this is first time through */ (void) FSEEK(dvifp,bytepos,0); /* start at the desired position */ for (;;) /* "infinite" loop - exits when POST or second BOP met */ { command = (BYTE)nosignex(dvifp,(BYTE)1); switch (command) { case SET1: case SET2: case SET3: case SET4: (void)checkchldd((BYTE)nosignex(dvifp,(BYTE)(command-SET1+1))); break; case SET_RULE: (void) nosignex(dvifp,(BYTE)4); (void) nosignex(dvifp,(BYTE)4); break; case PUT1: case PUT2: case PUT3: case PUT4: (void)checkchldd((BYTE)nosignex(dvifp,(BYTE)(command-PUT1+1))); break; case PUT_RULE: (void) nosignex(dvifp,(BYTE)4); (void) nosignex(dvifp,(BYTE)4); break; case NOP: break; case BOP: if (seen_bop) return; /* we have been here already */ seen_bop = TRUE; for (i=0; i<=9; i++) (void)(INT32)signex(dvifp,(BYTE)4); if (!quiet) (void)fprintf(stderr,"*"); (void) nosignex(dvifp,(BYTE)4); /* skip prev. page ptr */ (void)bopact(); fontptr = (struct font_entry*)NULL; break; case EOP: return; case PUSH: break; case POP: break; case RIGHT1: case RIGHT2: case RIGHT3: case RIGHT4: (void)signex(dvifp,(BYTE)(command-RIGHT1+1)); break; case W0: break; case W1: case W2: case W3: case W4: (void)signex(dvifp,(BYTE)(command-W1+1)); break; case X0: break; case X1: case X2: case X3: case X4: (void)signex(dvifp,(BYTE)(command-X1+1)); break; case DOWN1: case DOWN2: case DOWN3: case DOWN4: (void)signex(dvifp,(BYTE)(command-DOWN1+1)); break; case Y0: break; case Y1: case Y2: case Y3: case Y4: (void)signex(dvifp,(BYTE)(command-Y1+1)); break; case Z0: break; case Z1: case Z2: case Z3: case Z4: (void) signex(dvifp,(BYTE)(command-Z1+1)); break; case FNT1: case FNT2: case FNT3: case FNT4: (void)setfntnm((INT32)nosignex(dvifp, (BYTE)(command-FNT1+1))); break; case XXX1: case XXX2: case XXX3: case XXX4: k = (INT32)nosignex(dvifp,(BYTE)(command-XXX1+1)); while (k--) { (void)nosignex(dvifp,(BYTE)1); } break; case FNT_DEF1: case FNT_DEF2: case FNT_DEF3: case FNT_DEF4: if (preload) (void)skipfont ((INT32) nosignex(dvifp, (BYTE)(command-FNT_DEF1+1))); else (void)readfont ((INT32) nosignex(dvifp, (BYTE)(command-FNT_DEF1+1))); break; case PRE: (void)fatal("checkpage(): PRE occurs within file"); break; case POST: break; case POST_POST: (void)fatal("checkpage(): POST_POST with no preceding POST"); break; default: if (command >= FONT_00 && command <= FONT_63) (void)setfntnm((INT32)(command - FONT_00)); else if (command >= SETC_000 && command <= SETC_127) (void)checkchldd((BYTE)(command-SETC_000)); else { (void)sprintf(message,"checkpage(): %d is an undefined command", command); (void)fatal(message); } break; } } }