\manual DVICLASS(3){} \name DVI\_DT, DVI\_OpLen---DVI opcode classification tables \synopsis DVI\_DT(code) int code; DVI\_OpLen(code) int code; \endsyn \description These macros compress DVI code values according to `classification' and `opcode length'. \i{DVI\_DT} returns one of the following values: \beginlist{5em} \listentry{\lit{DT\_CHAR}} A literal character code ($0 \le code \le 127$). \listentry{\lit{DT\_SET}} A \lit{set} code (set a character and advance). \listentry{\lit{DT\_SETRULE}} A \lit{set\_rule} code. \listentry{\lit{DT\_PUT}} A \lit{put} code (set a character but do not advance). \listentry{\lit{DT\_PUTRULE}} A \lit{put\_rule} code (set a rule but do not advance). \listentry{\lit{DT\_NOP}} A \lit{nop} code. \listentry{\lit{DT\_BOP}} A \lit{bop} code. \listentry{\lit{DT\_EOP}} An \lit{eop} code. \listentry{\lit{DT\_PUSH}} A \lit{push}. \listentry{\lit{DT\_POP}} A \lit{pop}. \listentry{\lit{DT\_RIGHT}} Any of the several \lit{right} codes. \listentry{\lit{DT\_W0}} A \lit{w0}. \listentry{\lit{DT\_W}} One of the \lit{w}s. \listentry{\lit{DT\_X0}} An \lit{x0}. \listentry{\lit{DT\_X}} One of the \lit{x}s. \listentry{\lit{DT\_DOWN}} A \lit{down}. \listentry{\lit{DT\_Y0}} A \lit{y0}. \listentry{\lit{DT\_Y}} A \lit{y}. \listentry{\lit{DT\_Z0}} A \lit{z0}. \listentry{\lit{DT\_Z}} A \lit{z}. \listentry{\lit{DT\_FNTNUM}} A parameterless font selector (\lit{fntnum0}, \lit{fntnum1}, \dots, \lit{fntnum63}). \listentry{\lit{DT\_FNT}} A parameterised font selector (\lit{fnt1}, \dots, \lit{fnt4}). \listentry{\lit{DT\_XXX}} A \lit{xxx}: a special. \listentry{\lit{DT\_FNTDEF}} A \lit{fntdef}. \listentry{\lit{DT\_PRE}} A \lit{pre}. \listentry{\lit{DT\_POST}} A \lit{post}. \listentry{\lit{DT\_POSTPOST}} A \lit{postpost}. \listentry{\lit{DT\_UNDEF}} An undefined DVI opcode (in $[250..255]$). \endlist \i{DVI\_OpLen} returns the length of the first parameter, as one of the following values: \beginlist{5em} \listentry{\lit{DPL\_NONE}} No (or implicit) parameter, or it cannot be determined so simply, e.g., \lit{bop}, or \lit{post}. \listentry{\lit{DPL\_SGN1}} A signed one-byte parameter $-128 \le p \le 127$. \listentry{\lit{DPL\_SGN2}} A signed two-byte parameter $-32768 \le p \le 32767$. \listentry{\lit{DPL\_SGN3}} A signed three-byte parameter $-8388608 \le p \le 8388607$. \listentry{\lit{DPL\_SGN4}} A signed four-byte parameter $-2147483648 \le p \le 2147483647$. \listentry{\lit{DPL\_UNS1}} An unsigned one-byte parameter $0 \le p \le 255$. \listentry{\lit{DPL\_UNS2}} An unsigned two-byte parameter $0 \le p \le 65535$. \listentry{\lit{DPL\_UNS3}} An unsigned three-byte parameter $0 \le p \le 16777215$. \endlist These values are intended to be used to simplify \lit{switch} statements that decode DVI files. A program that must interpret the opcodes can use code similar to the following: \vskip 0pt plus1fil \begincode \vbox{ op = getc(dvi\_file); switch (DVI\_OpLen(op)) { case DPL\_NONE: {\it /* do nothing */} break; case DPL\_SGN1: {\it /* get a one byte signed parameter */} param = Sign8(getc(dvi\_file)); break; case DPL\_SGN2: {\it /* get a two byte signed parameter */} fGetWord(dvi\_file, param); param = Sign16(param); break; {\rm$\vdots$} case DPL\_UNS3: {\it /* get a three byte unsigned parameter */} fGet3Byte(dvi\_file, param); break; } switch (DVI\_DT(op)) { case DT\_CHAR: set\_char\_and\_advance(op); break; case DT\_SET: set\_char\_and\_advance(param); break; {\rm$\vdots$} } } \endcode In other words, ## other words ##