We need to compile our own (patched) version of the app on Windows.
See #11325
--- /dev/null
+This file is public domain.
+Originally written 1995, Geoffrey Tobin.
+The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+README for DTL package - Thu 9 March 1995
+-----------------------------------------
+Author: Geoffrey Tobin <G.Tobin@ee.latrobe.edu.au>
+Version: 0.6.1
+CTAN Archive-path: dviware/dtl
+Brief Description:
+ DTL (DVI Text Language) files are equivalent to TeX's DVI files,
+ but are humanly readable, instead of binary. Two programs are
+ provided to translate between DVI and DTL: dv2dt, dt2dv.
+ dt2dv warns if byte addresses or string lengths recorded in a DTL
+ file are incorrect, then overrides them. This makes DTL files
+ editable. It also allows quoted apostrophes (\') and quoted quotes
+ (\\) in strings. The current DTL variety, sequences-6, separates
+ font paths into directory and font, which makes them freely editable.
+ In this release, DTL line numbers are correctly calculated, and three
+ memory leaks have been fixed.
+Keywords: dvi, TeX
+Includes:
+ Makefile README dt2dv.c dtl.h dv2dt.c
+ man2ps dtl.doc dvi.doc dt2dv.man dv2dt.man
+ hello.tex example.tex tripvdu.tex edited.txt
+
+Motivation:
+
+ When TeX has typeset a document, it writes its handiwork to a DVI
+file, for DVI processing software (such as viewers, printer drivers,
+dvidvi, and dvicopy) to read.
+
+The file dvi.doc lists the DVI file commands, with their opcodes
+(byte values), nominal command names, arguments, and meanings. For a
+detailed description of DVI file structure, see one of these:
+1. Donald E. Knuth's book _TeX: The Program_;
+2. The file tex.web, which contains source and documentation for TeX:
+ CTAN: systems/knuth/tex/tex.web
+3. The source for Knuth's dvitype program:
+ CTAN: systems/knuth/texware/dvitype.web
+4. Joachim Schrod's DVI drivers standard document, the relevant part
+ of which is at
+ CTAN: dviware/driv-standard/level-0
+
+Sometimes human beings are interested to see exactly what TeX has
+produced, for example when viewing or printing of the DVI file gives
+unexpected results. However, a DVI file is a compact binary
+representation, so we need software to display its contents.
+
+Binary file editors, when available, can show the DVI bytes, but not
+their meanings, except for the portions that represent embedded text.
+In particular, the command names are not shown, and the command
+boundaries are not respected.
+
+By contrast, Knuth's dvitype program is designed as an example of a
+DVI driver. However, dvitype is inconvenient for studying the DVI
+file alone, for the following reasons:
+1. Being a DVI driver, dvitype endeavors to read the TFM font metric
+files referenced in the DVI file. If a TFM file is absent, dvitype
+quits with an error message.
+2. When it starts, it prompts the user interactively for each of a
+series of options.
+3. Even the least verbose option gives masses of information that is
+not contained in the DVI file, coming instead from a combination of
+the data in the DVI file and TFM files.
+4. It does NOT show the DVI information in a way that accurately
+reflects the structure of the DVI file.
+5. Its output, if redirected to a file, produces a very large file.
+6. There is no automated procedure for converting the output of
+dvitype back to a DVI file, and doing it by hand is totally
+unreasonable.
+
+The first disadvantage is a killer if a TFM file is absent.
+Disadvantages two to four make dvitype very inconvenient for studying
+a DVI file. The fifth problem makes dvitype's output tedious,
+disk-hungry (so one deletes it almost immediately), and unsuitable for
+file transfer.
+
+The sixth disadvantage of dvitype is important to those people who are
+interested in editing DVI files. Since the DVI files refer explicitly
+to their own internal byte addresses, it's very easy to mess up a DVI
+file if one were to try to edit it directly, even apart from the problem
+of how to recognise a command.
+
+So an exact, concise, textual representation of a DVI file is needed,
+but dvitype does not produce one.
+
+Resolution:
+
+ Therefore, working from Joachim Schrod's description, I designed DTL
+and its conversion programs dv2dt (DVI -> DTL) and dt2dv (DTL -> DVI),
+which are provided as C sources:
+
+ dtl.h
+ dv2dt.c
+ dt2dv.c
+
+Although I was motivated by the TFM <-> PL conversion provided by
+Knuth's tftopl and pltotf programs, I deliberately designed DTL to be
+a much more concise and literal translation than the `property list'
+structure exemplified by PL. The result is that a DTL file is
+typically three times the size of its equivalent DVI file. The
+document dtl.doc lists the correspondence between the DTL command
+names and the (nominal) DVI command names.
+
+A clear advantage of an exact two-way conversion is that we can check
+(and prove) whether the converters worked truly on a given DVI file.
+The provided plain TeX files:
+ example.tex
+ tripvdu.tex
+can be used to test whether the compiled programs are behaving
+sensibly. Whereas example.tex is a simple document that uses a
+variety of plain TeX commands, tripvdu.tex provides a kind of
+`trip test' for DVI processor programs. Both documents are taken,
+with permission, from Andrew K. Trevorrow's dvitovdu (alias dvi2vdu)
+distribution (and are also part of the dvgt viewer distribution).
+
+The Makefile might have to be edited for your site, as it assumes
+gcc for your C compiler. Makefile compiles dv2dt and dt2dv, then
+runs tex on example.tex and tripvdu.tex, and also converts the
+resulting DVI files to DTL files, back to DVI files (with a change
+of name), then back again to DTL files, so that the results can be
+compared using a textual differencing program. (Many computer systems
+have such a program; on unix, as assumed by Makefile, this is named
+`diff'; ms-dos has one named `comp'.) This should produce a
+zero-length .dif file for each document, proving that the two DTL
+files are identical.
+
+A keen tester might also use a binary difference program on the DVI
+files, to check that they are identical, as they need to be. (On unix
+systems, the `diff' program suffices for that purpose.)
+
+Note:
+
+ In representing numeric quantities, I have mainly opted to use
+decimal notation, as this is how most of us are trained to think.
+However, for the checksums in the `fd' (font definition) commands, I
+chose octal notation, as this is used for checksums in Knuth's PL
+files, against which DVI files must be compared when a DVI driver
+loads a font.
+
+Caveat:
+
+The length of DTL commands is limited by the size of the line buffer
+in dt2dv.c.
+
+End of README
--- /dev/null
+/* dt2dv - convert human-readable "DTL" file to DVI format
+ - this is intended to invert dv2dt version 0.6.0
+
+ This file is public domain.
+ Originally written 1995, Geoffrey Tobin.
+ The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+ This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+ - version 0.6.1 - 14:38 GMT +11 Thu 9 March 1995
+ - Geoffrey Tobin G.Tobin@ee.latrobe.edu.au
+ - fixes: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca
+ Nelson H. F. Beebe beebe@math.utah.edu
+ - Reference: "The DVI Driver Standard, Level 0",
+ by The TUG DVI Driver Standards Committee.
+ Appendix A, "Device-Independent File Format".
+*/
+
+/* unix version; read from stdin, write to stdout, by default. */
+
+#include <ctype.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "dtl.h"
+
+/* by default, read and write regular files */
+int rd_stdin = 0;
+int wr_stdout = 0;
+
+/* maximum number of characters in a DTL input line */
+#define MAXLINE 1024
+
+/* input line */
+typedef struct
+{
+ COUNT num; /* current line number */
+ size_t max; /* capacity of buf */
+ S4 wrote; /* number of characters written into buf */
+ size_t read; /* position in buf of next character to read from buf */
+ char * buf; /* line buffer */
+} Line;
+
+char linebuf[MAXLINE+1];
+
+Line dtl_line = {0, 0, 0, MAXLINE, linebuf};
+
+/* a DTL token either is:
+ a quoted string (admitting an escape character),
+ or BCOM (if that is a nonempty string),
+ or ECOM (if that is a nonempty string),
+ or a string _not_ including ECOM_CHAR or space.
+*/
+
+/* maximum expected length of a DTL token */
+#define MAXTOKLEN 255
+typedef char Token[MAXTOKLEN+1];
+
+typedef unsigned char Byte;
+typedef char Boolean;
+
+#define true 1
+#define false 0
+
+/* command prefixes */
+typedef struct
+{
+ Byte first_code;
+ char * name;
+ Boolean has_suffix;
+ Byte first_suffix, last_suffix;
+} CmdPrefix;
+
+CmdPrefix cmd_prefixes [] =
+{
+ {0, SETCHAR, true, 0, 127},
+ {128, SET, true, 1, 4},
+ {132, SETRULE, false, 0, 0},
+ {133, PUT, true, 1, 4},
+ {137, PUTRULE, false, 0, 0},
+ {138, NOP, false, 0, 0},
+ {139, BOP, false, 0, 0},
+ {140, EOP, false, 0, 0},
+ {141, PUSH, false, 0, 0},
+ {142, POP, false, 0, 0},
+ {143, RIGHT, true, 1, 4},
+ {147, W, true, 0, 4},
+ {152, X, true, 0, 4},
+ {157, DOWN, true, 1, 4},
+ {161, Y, true, 0, 4},
+ {166, Z, true, 0, 4},
+ {171, FONTNUM, true, 0, 63},
+ {235, FONT, true, 1, 4},
+ {239, SPECIAL, true, 1, 4},
+ {243, FONTDEF, true, 1, 4},
+ {247, PRE, false, 0, 0},
+ {248, POST, false, 0, 0},
+ {249, POSTPOST, false, 0, 0},
+ {250, OPCODE, true, 250, 255}
+};
+/* cmd_prefixes[] */
+
+/* Number of DVI commands, including those officially undefined */
+#define NCMDS 256
+
+/* table of command name (string) pointers */
+typedef char * CmdTable [NCMDS];
+
+/* initially all command name pointers are NULL */
+CmdTable cmd_table;
+
+/* operation's opcode, name, number of args, string of arguments. */
+typedef struct
+{
+ int code;
+ char * name;
+ int nargs;
+ char * args;
+} op_info;
+
+/* name of table, first opcode, last opcode, pointer to opcode info. */
+typedef struct
+{
+ char * name;
+ int first;
+ int last;
+ op_info * list;
+} op_table;
+
+/* Table for opcodes 128 to 170 inclusive. */
+
+op_info op_info_128_170 [] =
+{
+ {128, SET1, 1, "1"},
+ {129, SET2, 1, "2"},
+ {130, SET3, 1, "3"},
+ {131, SET4, 1, "-4"},
+ {132, SETRULE, 2, "-4 -4"},
+ {133, PUT1, 1, "1"},
+ {134, PUT2, 1, "2"},
+ {135, PUT3, 1, "3"},
+ {136, PUT4, 1, "-4"},
+ {137, PUTRULE, 2, "-4 -4"},
+ {138, NOP, 0, ""},
+ /* bop: not counting last argument, a signed address: */
+ {139, BOP, 10, "-4 -4 -4 -4 -4 -4 -4 -4 -4 -4"},
+ {140, EOP, 0, ""},
+ {141, PUSH, 0, ""},
+ {142, POP, 0, ""},
+ {143, RIGHT1, 1, "-1"},
+ {144, RIGHT2, 1, "-2"},
+ {145, RIGHT3, 1, "-3"},
+ {146, RIGHT4, 1, "-4"},
+ {147, W0, 0, ""},
+ {148, W1, 1, "-1"},
+ {149, W2, 1, "-2"},
+ {150, W3, 1, "-3"},
+ {151, W4, 1, "-4"},
+ {152, X0, 0, ""},
+ {153, X1, 1, "-1"},
+ {154, X2, 1, "-2"},
+ {155, X3, 1, "-3"},
+ {156, X4, 1, "-4"},
+ {157, DOWN1, 1, "-1"},
+ {158, DOWN2, 1, "-2"},
+ {159, DOWN3, 1, "-3"},
+ {160, DOWN4, 1, "-4"},
+ {161, Y0, 0, ""},
+ {162, Y1, 1, "-1"},
+ {163, Y2, 1, "-2"},
+ {164, Y3, 1, "-3"},
+ {165, Y4, 1, "-4"},
+ {166, Z0, 0, ""},
+ {167, Z1, 1, "-1"},
+ {168, Z2, 1, "-2"},
+ {169, Z3, 1, "-3"},
+ {170, Z4, 1, "-4"}
+};
+/* op_info op_info_128_170 [] */
+
+op_table op_128_170 = {"op_128_170", 128, 170, op_info_128_170};
+
+/* Table for fnt1 to fnt4 (opcodes 235 to 238) inclusive. */
+
+op_info fnt_n [] =
+{
+ {235, FONT1, 1, "1"},
+ {236, FONT2, 1, "2"},
+ {237, FONT3, 1, "3"},
+ {238, FONT4, 1, "-4"}
+};
+/* op_info fnt_n [] */
+
+op_table fnt = {FONT, 235, 238, fnt_n};
+
+
+/* Function prototypes */
+
+Void mem_viol ARGS((int sig));
+Void give_help (VOID);
+int parse ARGS((char * s));
+Void process ARGS((char * s));
+
+Void no_op (VOID);
+Void dtl_stdin (VOID);
+Void dvi_stdout (VOID);
+
+int open_dtl ARGS((char * dtl_file, FILE ** pdtl));
+int open_dvi ARGS((char * dvi_file, FILE ** pdvi));
+
+int dt2dv ARGS((FILE * dtl, FILE * dvi));
+
+Void * gmalloc ARGS((long int size));
+
+Void dinfo (VOID);
+Void dexit ARGS((int n));
+
+int cons_cmds ARGS((int nprefixes, CmdPrefix * prefix, CmdTable cmds));
+Void free_cmds ARGS((CmdTable cmd_table));
+
+int get_line ARGS((FILE * fp, Line * line, int max));
+int read_line_char ARGS((FILE * fp, int * ch));
+int read_char ARGS((FILE * fp, int * ch));
+int unread_char (VOID);
+int read_string_char ARGS((FILE * fp, int * ch));
+
+COUNT read_variety ARGS((FILE * dtl));
+COUNT read_token ARGS((FILE * dtl, char * token));
+COUNT skip_space ARGS((FILE * fp, int * ch));
+COUNT read_misc ARGS((FILE * fp, Token token));
+COUNT read_mes ARGS((FILE * fp, char * token));
+
+int find_command ARGS((char * command, int * opcode));
+int xfer_args ARGS((FILE * dtl, FILE * dvi, int opcode));
+
+int set_seq ARGS((FILE * dtl, FILE * dvi));
+
+int check_byte ARGS((int byte));
+int put_byte ARGS((int onebyte, FILE * dvi));
+
+U4 xfer_hex ARGS((int n, FILE * dtl, FILE * dvi));
+U4 xfer_oct ARGS((int n, FILE * dtl, FILE * dvi));
+U4 xfer_unsigned ARGS((int n, FILE * dtl, FILE * dvi));
+S4 xfer_signed ARGS((int n, FILE * dtl, FILE * dvi));
+
+int check_bmes ARGS((FILE * dtl));
+int check_emes ARGS((FILE * dtl));
+
+Void init_Lstring ARGS((Lstring * lsp, long int n));
+Void de_init_Lstring ARGS((Lstring * lsp));
+Lstring * alloc_Lstring ARGS((long int n));
+Void free_Lstring ARGS((Lstring * lstr));
+Void ls_putb ARGS((int ch, Lstring * lstr));
+
+S4 get_Lstring ARGS((FILE * dtl, Lstring * lstr));
+Void put_Lstring ARGS((const Lstring * lstr, FILE * dvi));
+U4 xfer_len_string ARGS((int n, FILE * dtl, FILE * dvi));
+
+U4 get_unsigned ARGS((FILE * dtl));
+S4 get_signed ARGS((FILE * dtl));
+
+int put_unsigned ARGS((int n, U4 unum, FILE * dvi));
+int put_signed ARGS((int n, S4 snum, FILE * dvi));
+
+S4 xfer_bop_address ARGS((FILE * dtl, FILE * dvi));
+S4 xfer_postamble_address ARGS((FILE * dtl, FILE * dvi));
+
+int put_table ARGS((op_table table, int opcode, FILE * dtl, FILE * dvi));
+
+U4 special ARGS((FILE * dtl, FILE * dvi, int n));
+int fontdef ARGS((FILE * dtl, FILE * dvi, int n));
+
+U4 preamble ARGS((FILE * dtl, FILE * dvi));
+int postamble ARGS((FILE * dtl, FILE * dvi));
+int post_post ARGS((FILE * dtl, FILE * dvi));
+
+
+typedef struct
+{
+ char * keyword; /* command line option keyword */
+ int * p_var; /* pointer to option variable */
+ char * desc; /* description of keyword and value */
+ Void (* p_fn) (VOID); /* pointer to function called when option is set */
+} Options;
+
+Options opts[] =
+{
+ {"-debug", &debug, "detailed debugging", no_op},
+ {"-group", &group, "each DTL command is in parentheses", no_op},
+ {"-si", &rd_stdin, "read all DTL commands from standard input", dtl_stdin},
+ {"-so", &wr_stdout, "write all DVI commands to standard output", dvi_stdout},
+ {NULL, NULL, NULL, NULL}
+};
+/* opts[] */
+
+char * progname = ""; /* intended for name of this program */
+int nfile = 0; /* number of filename arguments on the command line */
+
+#define PRINT_PROGNAME fprintf (stderr, "%s ", progname)
+
+/* Harbison & Steele (1991) warn that some C implementations */
+/* of free() do not treat NULL pointers correctly. */
+#define gfree(p) {if (p) free (p);}
+
+
+FILE * dtl_fp = NULL;
+FILE * dvi_fp = NULL;
+
+char * dtl_filename = "";
+char * dvi_filename = "";
+
+
+int
+main
+#ifdef STDC
+ (int argc, char * argv[])
+#else
+ (argc, argv)
+ int argc;
+ char * argv[];
+#endif
+{
+ Void (*handler) ARGS((int)); /* Previous signal handler */
+ int i;
+
+ progname = argv[0]; /* name of this program */
+
+ /* memory violation signal handler */
+
+ handler = (Void (*) ARGS((int))) signal (SIGSEGV, mem_viol);
+
+#ifndef __DATE__
+#define __DATE__ ""
+#endif
+
+#ifndef __TIME__
+#define __TIME__ ""
+#endif
+
+#if STDC
+#define C_LEVEL ""
+#else /* NOT STDC */
+#define C_LEVEL "non-"
+#endif /* NOT STDC */
+
+ /* message about program and compiler */
+ /* NB: LTU EE's Sun/OS library is BSD, even though gcc 2.2.2 is ANSI */
+
+ fprintf (stderr, "\n");
+ fprintf (stderr,
+ "Program \"%s\" version %s compiled %s %s in %sstandard C.\n",
+ progname, VERSION, __DATE__, __TIME__, C_LEVEL);
+
+ /* interpret command line arguments */
+
+ nfile = 0;
+ dtl_fp = dvi_fp = NULL;
+ dtl_filename = dvi_filename = "";
+
+ for (i=1; i < argc; i++)
+ {
+ /* parse options, followed by any explicit filenames */
+ parse (argv[i]);
+ }
+
+ if (nfile != 2) /* not exactly two files specified, so give help */
+ give_help();
+ else
+ /* the real works */
+ dt2dv (dtl_fp, dvi_fp);
+
+ return 0; /* OK */
+}
+/* end main */
+
+
+Void
+mem_viol
+#ifdef STDC
+ (int sig)
+#else
+ (sig)
+ int sig;
+#endif
+{
+ Void (* handler) ARGS((int));
+ handler = (Void (*) ARGS((int))) signal (SIGSEGV, mem_viol);
+ if (sig != SIGSEGV)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(mem_viol) : called with wrong signal!\n");
+ }
+ PRINT_PROGNAME;
+ fprintf (stderr, "(mem_viol) : RUNTIME MEMORY ERROR : memory violation, ");
+ fprintf (stderr, "dtl line >= ");
+ fprintf (stderr, WF, dtl_line.num);
+ fprintf (stderr, "\n");
+ dexit (1);
+}
+/* mem_viol */
+
+
+Void
+give_help (VOID)
+{
+ int i;
+ char * keyword;
+ fprintf (stderr, "usage: ");
+ PRINT_PROGNAME;
+ fprintf (stderr, "[options] dtl_file dvi_file");
+ fprintf (stderr, "\n");
+ for (i=0; (keyword = opts[i].keyword) != NULL; i++)
+ {
+ fprintf (stderr, " ");
+ fprintf (stderr, "[%s]", keyword);
+ fprintf (stderr, " ");
+ fprintf (stderr, "%s", opts[i].desc);
+ fprintf (stderr, "\n");
+ }
+ fprintf (stderr, "Messages, like this one, go to stderr.\n");
+}
+/* give_help */
+
+
+Void no_op (VOID)
+/* do nothing */
+{
+}
+
+Void dtl_stdin (VOID)
+{
+ extern FILE * dtl_fp;
+ extern int nfile;
+
+ dtl_fp = stdin;
+ dtl_filename = "Standard Input";
+ ++ nfile;
+}
+
+Void dvi_stdout (VOID)
+{
+ extern FILE * dvi_fp;
+ extern int nfile;
+
+ /* ! Perilous to monitors! */
+ dvi_fp = stdout;
+ dvi_filename = "Standard Output";
+ ++ nfile;
+}
+
+
+int
+parse
+#ifdef STDC
+ (char * s)
+#else
+ (s)
+ char * s;
+#endif
+/* parse one command-line argument, `s' */
+{
+ int i;
+ char * keyword;
+ for (i=0; (keyword = opts[i].keyword) != NULL; i++)
+ {
+ if (strncmp (s, keyword, strlen (keyword)) == 0)
+ {
+ Void (*pfn) (VOID);
+ (*(opts[i].p_var)) = 1; /* turn option on */
+ if ((pfn = opts[i].p_fn) != NULL)
+ (*pfn) (); /* call option function */
+ return i;
+ }
+ }
+ /* reached here, so not an option: assume it's a filename */
+ process (s);
+ return i;
+}
+/* parse */
+
+
+int
+open_dtl
+#ifdef STDC
+ (char * dtl_file, FILE ** pdtl)
+#else
+ (dtl_file, pdtl)
+ char * dtl_file;
+ FILE ** pdtl;
+#endif
+/* I: dtl_file; I: pdtl; O: *pdtl. */
+{
+ extern char * dtl_filename;
+
+ dtl_filename = dtl_file;
+
+ if (dtl_filename == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(open_dtl) : INTERNAL ERROR : dtl file's name is NULL.\n");
+ dexit (1);
+ }
+
+ if (pdtl == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(open_dtl) : INTERNAL ERROR : address of dtl variable is NULL.\n");
+ dexit (1);
+ }
+
+ *pdtl = fopen (dtl_file, "r");
+
+ if (*pdtl == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(open_dtl) : DTL FILE ERROR : Cannot open \"%s\" for text reading.\n",
+ dtl_file);
+ dexit (1);
+ }
+
+ return 1; /* OK */
+}
+/* open_dtl */
+
+
+int
+open_dvi
+#ifdef STDC
+ (char * dvi_file, FILE ** pdvi)
+#else
+ (dvi_file, pdvi)
+ char * dvi_file;
+ FILE ** pdvi;
+#endif
+/* I: dvi_file; I: pdvi; O: *pdvi. */
+{
+ extern char * dvi_filename;
+
+ dvi_filename = dvi_file;
+
+ if (dvi_filename == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(open_dvi) : INTERNAL ERROR : dvi file's name is NULL.\n");
+ dexit (1);
+ }
+
+ if (pdvi == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(open_dvi) : INTERNAL ERROR : address of dvi variable is NULL.\n");
+ dexit (1);
+ }
+
+ *pdvi = fopen (dvi_file, "wb");
+
+ if (*pdvi == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(open_dvi) : DVI FILE ERROR : Cannot open \"%s\" for binary writing.\n",
+ dvi_file);
+ dexit (1);
+ }
+
+ return 1; /* OK */
+}
+/* open_dvi */
+
+
+Void
+process
+#ifdef STDC
+ (char * s)
+#else
+ (s)
+ char * s;
+#endif
+{
+ extern FILE * dtl_fp, * dvi_fp;
+ extern int nfile;
+ if (dtl_fp == NULL) /* first filename assumed to be DTL input */
+ {
+ open_dtl (s, &dtl_fp);
+ }
+ else if (dvi_fp == NULL) /* second filename assumed to be DVI output */
+ {
+ open_dvi (s, &dvi_fp);
+ }
+ else
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(process) : at most two filenames allowed.\n");
+ exit (1);
+ }
+ ++ nfile;
+}
+/* process */
+
+
+COUNT dtl_read = 0; /* bytes read from dtl file */
+COUNT dvi_written = 0; /* bytes written to dvi file */
+word_t last_bop_address = -1; /* byte address of last bop; first bop uses -1 */
+word_t postamble_address = -1; /* byte address of postamble */
+COUNT ncom = 0; /* commands successfully read and interpreted from dtl file */
+COUNT com_read = 0; /* bytes read in current (command and arguments), */
+ /* since and including the opening BCOM_CHAR, if any */
+
+
+int
+put_byte
+#ifdef STDC
+ (int byte, FILE * dvi)
+#else
+ (byte, dvi)
+ int byte;
+ FILE * dvi;
+#endif
+/* write byte into dvi file */
+{
+ check_byte (byte);
+/* if (fprintf (dvi, "%c", byte) != 1) */
+ if (fprintf (dvi, "%c", byte) < 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_byte) : DVI FILE ERROR (%s) : cannot write to dvi file.\n",
+ dtl_filename);
+ dexit (1);
+ }
+ ++ dvi_written;
+ return 1; /* OK */
+}
+/* put_byte */
+
+
+int
+dt2dv
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+{
+ int nprefixes = 0; /* number of prefixes in cmd_prefixes[] list. */
+ static Token dtl_cmd = ""; /* DTL command name */
+ COUNT nread = 0; /* number of bytes read by a function from dtl file. */
+
+ nprefixes = sizeof (cmd_prefixes) / sizeof (CmdPrefix);
+
+ /* Construct array of all NCMDS == 256 DTL commands */
+
+ (Void) cons_cmds (nprefixes, cmd_prefixes, cmd_table);
+
+ /* DTL commands have the form "[ ]*command arg ... arg[ ]*", */
+ /* possibly enclosed in a BCOM, ECOM pair, */
+ /* and are separated by optional whitespace, typically newlines. */
+ /* That is, each command and its arguments are parenthesised, */
+ /* with optional spaces after the BCOM and before the ECOM, if any. */
+
+ /* dt2dv is now at the very start of the DTL file */
+
+ dtl_line.num = 0;
+ dtl_read = 0;
+
+ /* The very first thing should be the "variety" signature */
+
+ nread = read_variety (dtl);
+
+ /* while not end of dtl file or reading error, */
+ /* read, interpret, and write commands */
+
+ while (!feof (dtl))
+ {
+ int opcode;
+
+ com_read = 0;
+
+ if (group)
+ {
+ /* BCOM check */
+ static Token token = ""; /* DTL token */
+ nread = read_token (dtl, token);
+ /* test for end of input, or reading error */
+ if (strlen (token) == 0)
+ {
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dt2dv) : end of input, or reading error.\n");
+ }
+ break;
+ }
+ /* test whether this command begins correctly */
+ else if (strcmp (token, BCOM) != 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dt2dv) : DTL FILE ERROR (%s) : ", dtl_filename);
+ fprintf (stderr, "command must begin with \"%s\", ", BCOM);
+ fprintf (stderr, "not `%c' (char %d).\n", token[0], token[0]);
+ dexit (1);
+ }
+ /* end BCOM check */
+ }
+
+ /* read the command name */
+ nread = read_token (dtl, dtl_cmd);
+ /* test for end of input, or reading error */
+ if (strlen (dtl_cmd) == 0)
+ {
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(dt2dv) : end of input, or reading error.\n");
+ }
+ break;
+ }
+ else
+ {
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dt2dv) : command ");
+ fprintf (stderr, WF, ncom);
+ fprintf (stderr, " = \"%s\".\n", dtl_cmd);
+ }
+
+ /* find opcode for this command */
+ if (find_command (dtl_cmd, &opcode) == 1)
+ {
+ /* write the opcode, if we can */
+ put_byte (opcode, dvi);
+
+ /* treat the arguments, if any */
+ xfer_args (dtl, dvi, opcode);
+ }
+ else if (dtl_cmd[0] == BSEQ_CHAR)
+ {
+ /* sequence of font characters for SETCHAR */
+ set_seq (dtl, dvi);
+ }
+ else
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(dt2dv) : DTL FILE ERROR (%s) : unknown command \"%s\".\n",
+ dtl_filename, dtl_cmd);
+ dexit (1);
+ }
+ }
+
+ if (group)
+ {
+ /* seek ECOM after command's last argument and optional whitespace */
+ static Token token = ""; /* DTL token */
+ nread = read_token (dtl, token);
+ /* test for end of input, or reading error */
+ if (strlen (token) == 0)
+ {
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(dt2dv) : end of input, or reading error.\n");
+ }
+ break;
+ }
+ if (strcmp (token, ECOM) != 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dt2dv) : DTL FILE ERROR (%s) : ", dtl_filename);
+ fprintf (stderr, "ECOM (\"%s\") expected, not `%c' (char %d).\n",
+ ECOM, token[0], token[0]);
+ dexit (1);
+ }
+ /* end ECOM check */
+ }
+
+ ++ ncom; /* one more command successfully read and interpreted */
+ }
+ /* end while */
+
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dt2dv) :\n");
+ fprintf (stderr, "Read (from file \"%s\") ", dtl_filename);
+ fprintf (stderr, WF, dtl_read);
+ fprintf (stderr, " DTL bytes (");
+ fprintf (stderr, UF4, dtl_line.num);
+ fprintf (stderr, " lines);\n");
+ fprintf (stderr, "wrote (to file \"%s\") ", dvi_filename);
+ fprintf (stderr, WF, dvi_written);
+ fprintf (stderr, " DVI bytes;\n");
+ fprintf (stderr, "completely interpreted ");
+ fprintf (stderr, WF, ncom);
+ fprintf (stderr, " DVI command%s.\n", (ncom == 1 ? "" : "s"));
+ fprintf (stderr, "\n");
+
+ (Void) free_cmds (cmd_table);
+
+ return 1; /* OK */
+}
+/* dt2dv */
+
+
+Void *
+gmalloc
+#ifdef STDC
+ (long int size)
+#else
+ (size)
+ long int size;
+#endif
+{
+ Void * p = NULL;
+ if (size < 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(gmalloc) : INTERNAL ERROR : ");
+ fprintf (stderr,
+ "unreasonable request to malloc %ld bytes\n",
+ size);
+ dexit (1);
+ }
+ p = (Void *) malloc ((size_t) size);
+ if (p == NULL)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(gmalloc) : MEMORY ALLOCATION ERROR : ");
+ fprintf (stderr,
+ "operating system failed to malloc %ld bytes\n",
+ size);
+ dexit (1);
+ }
+ return (p);
+}
+/* gmalloc */
+
+
+Void
+dinfo (VOID)
+{
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dinfo) : ");
+ fprintf (stderr, "Current DTL input line ");
+ fprintf (stderr, UF4, dtl_line.num);
+ fprintf (stderr, " :\n");
+ fprintf (stderr, "\"%s\"\n", dtl_line.buf);
+ fprintf (stderr, "Read ");
+ fprintf (stderr, WF, dtl_read);
+ fprintf (stderr, " DTL bytes (");
+ fprintf (stderr, WF, com_read);
+ fprintf (stderr, " in current command), wrote ");
+ fprintf (stderr, WF, dvi_written);
+ fprintf (stderr, " DVI bytes.\n");
+ fprintf (stderr, "Successfully interpreted ");
+ fprintf (stderr, WF, ncom);
+ fprintf (stderr, " DVI command%s.\n", (ncom == 1 ? "" : "s"));
+}
+/* dinfo */
+
+
+Void
+dexit
+#ifdef STDC
+ (int n)
+#else
+ (n)
+ int n;
+#endif
+{
+ dinfo();
+ PRINT_PROGNAME;
+ fprintf (stderr, "(dexit) : exiting with status %d.\n", n);
+ exit (n);
+}
+/* dexit */
+
+
+int
+cons_cmds
+#ifdef STDC
+ (int nprefixes, CmdPrefix * prefix, CmdTable cmds)
+#else
+ (nprefixes, prefix, cmds)
+ int nprefixes;
+ CmdPrefix * prefix;
+ CmdTable cmds;
+#endif
+{
+ int code; /* first opcode for a given command prefix */
+ int opcode; /* command's opcode */
+ int nsuffixes; /* number of commands with a given prefix */
+ int isuffix; /**** integer suffix, of at most three digits ****/
+ String suffix; /* suffix string generated from integer suffix */
+ size_t plen = 0; /* prefix length */
+ size_t slen; /* suffix length */
+ size_t clen; /* whole command name length */
+ int i, j; /* loop indices */
+
+ for (i=0; i < nprefixes; prefix++, i++)
+ {
+ code = prefix->first_code;
+ if (code < 0 || code > 255)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(cons_cmds) : INTERNAL ERROR : ");
+ fprintf (stderr,
+ "prefix listed internally with code = %d, must be 0 to 255\n",
+ code);
+ dexit (1);
+ }
+ if (prefix->has_suffix)
+ {
+ plen = strlen (prefix->name);
+ /**** Suffixes in DTL are Integers, in Sequence */
+ if (prefix->last_suffix < prefix->first_suffix)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(cons_cmds) : INTERNAL ERROR : ");
+ fprintf (stderr,
+ "prefix's last suffix %d < first suffix (%d)\n",
+ prefix->last_suffix, prefix->first_suffix);
+ dexit (1);
+ }
+ nsuffixes = prefix->last_suffix - prefix->first_suffix + 1;
+ opcode = prefix->first_code;
+ for (j=0; j < nsuffixes; j++, opcode++)
+ {
+ isuffix = prefix->first_suffix + j;
+ if (0 <= code && code <= 127) /* SETCHAR */
+ {
+ /* SETCHAR's suffix is written in uppercase hexadecimal */
+ sprintf (suffix, "%02X", isuffix);
+ }
+ else /* 128 <= code && code <= 255 */ /* other DTL commands */
+ {
+ /* other commands' suffices are written in decimal */
+ sprintf (suffix, "%d", isuffix);
+ }
+ slen = strlen (suffix);
+ clen = plen + slen;
+ cmds[opcode] = (char *) gmalloc (clen+1);
+ strcpy (cmds[opcode], prefix->name);
+ strcat (cmds[opcode], suffix);
+ }
+ }
+ else /* command name = prefix */
+ {
+ plen = strlen (prefix->name);
+ clen = plen;
+ opcode = prefix->first_code;
+ cmds[opcode] = (char *) gmalloc (clen+1);
+ strcpy (cmds[opcode], prefix->name);
+ }
+ }
+
+ return 1; /* OK */
+}
+/* cons_cmds */
+
+
+Void
+free_cmds
+#ifdef STDC
+ (CmdTable cmd_table)
+#else
+ (cmd_table)
+ CmdTable cmd_table;
+#endif
+{
+ int i;
+ for (i=0; i < NCMDS; i++)
+ gfree (cmd_table[i]);
+}
+/* free_cmds */
+
+
+int
+get_line
+#ifdef STDC
+ (FILE * fp, Line * line, int max)
+#else
+ (fp, line, max)
+ FILE * fp;
+ Line * line;
+ int max;
+#endif
+/* read a (Line *) line from fp, return length */
+/* adapted from K&R (second, alias ANSI C, edition, 1988), page 165 */
+{
+ if (fgets (line->buf, max, fp) == NULL)
+ return 0;
+ else
+ {
+ ++ line->num;
+ line->wrote = strlen (line->buf);
+ line->read = 0;
+ return 1;
+ }
+}
+/* get_line */
+
+
+int
+read_line_char
+#ifdef STDC
+ (FILE * fp, int * ch)
+#else
+ (fp, ch)
+ FILE * fp;
+ int * ch;
+#endif
+/* read one character from dtl_line if possible, */
+/* otherwise read another dtl_line from fp */
+/* return 1 if a character is read, 0 if at end of fp file */
+{
+ extern Line dtl_line;
+ if (dtl_line.wrote == 0 || dtl_line.read >= dtl_line.wrote)
+ {
+ int line_status;
+ /* refill line buffer */
+ line_status = get_line (fp, &dtl_line, MAXLINE);
+ if (line_status == 0)
+ {
+ /* at end of DTL file */
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_line_char) : end of DTL file\n");
+ dinfo();
+ }
+ return 0;
+ }
+ else
+ {
+ /* new DTL line was read */
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_line_char) : new DTL input line:\n");
+ fprintf (stderr, "\"%s\"\n", dtl_line.buf);
+ }
+ }
+ }
+ *ch = dtl_line.buf [dtl_line.read ++];
+ ++ dtl_read;
+ ++ com_read; /* count another DTL command character */
+ return 1;
+}
+/* read_line_char */
+
+
+int
+read_char
+#ifdef STDC
+ (FILE * fp, int * ch)
+#else
+ (fp, ch)
+ FILE * fp;
+ int * ch;
+#endif
+/* Read next character, if any, from file fp. */
+/* Write it into *ch. */
+/* If no character is read, then *ch value < 0. */
+/* Return 1 if OK, 0 if EOF or error. */
+{
+ int status = 1;
+ int c; /* in case ch points awry, we still have something in c. */
+
+ c = EOF;
+ if (read_line_char (fp, &c) == 0)
+ {
+ /* end of fp file, or error reading it */
+ status = 0;
+ }
+ else
+ {
+ if (c > 255)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(read_char) : character %d not in range 0 to 255\n",
+ c);
+ dinfo();
+ status = 0;
+ }
+ else if ( ! isprint (c) && ! isspace (c))
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(read_char) : character %d %s.\n",
+ c,
+ "not printable and not white space");
+ dinfo();
+ status = 0;
+ }
+ }
+ *ch = c;
+
+ return status;
+}
+/* read_char */
+
+
+COUNT
+read_variety
+#ifdef STDC
+ (FILE * dtl)
+#else
+ (dtl)
+ FILE * dtl;
+#endif
+/* read and check DTL variety signature */
+/* return number of DTL bytes written */
+/* DTL variety is _NEVER_ grouped by BCOM and ECOM. */
+/* Uniformity here enables the program easily to modify its behavior. */
+{
+ COUNT vread = 0; /* number of DTL bytes read by read_variety */
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ static Token token = "";
+
+ /* read the DTL VARIETY keyword */
+ nread = read_token (dtl, token);
+ vread += nread;
+ /* test whether signature begins correctly */
+ if (strcmp (token, "variety") != 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_variety) : DTL FILE ERROR (%s) : ", dtl_filename);
+ fprintf (stderr, "DTL signature must begin with \"%s\", not \"%s\".\n",
+ "variety", token);
+ dexit (1);
+ }
+
+ /* read the DTL variety */
+ nread = read_token (dtl, token);
+ vread += nread;
+ /* test whether variety is correct */
+ if (strcmp (token, VARIETY) != 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_variety) : DTL FILE ERROR (%s) : ", dtl_filename);
+ fprintf (stderr, "DTL variety must be \"%s\", not \"%s\".\n",
+ VARIETY, token);
+ dexit (1);
+ }
+
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_variety) : DTL variety %s is OK.\n", VARIETY);
+
+ return vread; /* OK */
+}
+/* read_variety */
+
+
+COUNT
+skip_space
+#ifdef STDC
+ (FILE * fp, int * ch)
+#else
+ (fp, ch)
+ FILE * fp;
+ int * ch;
+#endif
+/* Skip whitespace characters in file fp. */
+/* Write in *ch the last character read from fp, */
+/* or < 0 if fp could not be read. */
+/* Return number of characters read from fp. */
+{
+ int c; /* character read (if any) */
+ COUNT count; /* number (0 or more) of whitespace characters read */
+ int nchar; /* number (0 or 1) of characters read by read_char */
+
+ /* loop ends at: end of fp file, or reading error, or not a white space */
+ for (count=0; ((nchar = read_char (fp, &c)) == 1 && isspace (c)); ++count)
+ {
+ /* otherwise, more white spaces to skip */
+ if (debug)
+ {
+ /* report when each DTL end of line is reached */
+ if (c == '\n')
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(skip_space) : ");
+ fprintf (stderr, "end of DTL line (at least) ");
+ fprintf (stderr, WF, dtl_line.num);
+ fprintf (stderr, "\n");
+ }
+ }
+ }
+
+ if (nchar == 0)
+ {
+ c = -1;
+ }
+
+ *ch = c; /* c will be < 0 if read_char could not read fp */
+ return (count + nchar);
+}
+/* skip_space */
+
+
+COUNT
+read_token
+#ifdef STDC
+ (FILE * dtl, char * token)
+#else
+ (dtl, token)
+ FILE * dtl;
+ char * token;
+#endif
+/* read next token from dtl file. */
+/* return number of DTL bytes read. */
+/* A token is one of:
+ a string from BMES_CHAR to the next unescaped EMES_CHAR, inclusive;
+ BCOM or ECOM, unless these are empty strings;
+ BSEQ or ESEQ;
+ any other sequence of non-whitespace characters.
+*/
+{
+ COUNT nread; /* number of DTL bytes read by read_token */
+ int ch; /* most recent character read */
+
+ nread = 0;
+
+ /* obtain first non-space character */
+ /* add to nread the number of characters read from dtl by skip_space */
+ nread += skip_space (dtl, &ch);
+
+ if (ch < 0)
+ {
+ /* end of dtl file */
+ /* write an empty token */
+ strcpy (token, "");
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_token) : end of dtl file.\n");
+ }
+ }
+ else if (group && ch == BCOM_CHAR)
+ {
+ strcpy (token, BCOM);
+ }
+ else if (group && ch == ECOM_CHAR)
+ {
+ strcpy (token, ECOM);
+ }
+ else
+ {
+ token[0] = ch;
+ token[1] = '\0';
+ if (ch == BMES_CHAR) /* string token; read until unescaped EMES_CHAR */
+ {
+ nread += read_mes (dtl, token+1);
+ }
+ else if (ch == BSEQ_CHAR || ch == ESEQ_CHAR)
+ {
+ /* token is complete */
+ }
+ else /* any other string not containing (ECOM_CHAR or) whitespace */
+ {
+ nread += read_misc (dtl, token+1);
+ }
+ }
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(read_token) : token = \"%s\"\n", token);
+ }
+
+ return (nread); /* number of bytes read from dtl file */
+}
+/* read_token */
+
+
+#define CHAR_OK 1
+#define CHAR_FAIL 0
+#define CHAR_EOS (-1)
+
+int
+read_string_char
+#ifdef STDC
+ (FILE * fp, int * ch)
+#else
+ (fp, ch)
+ FILE * fp;
+ int * ch;
+#endif
+{
+ int status = CHAR_OK; /* OK so far */
+ int c;
+
+ if (read_char (fp, &c) == 0)
+ status = CHAR_FAIL; /* fail */
+
+ if (c == EMES_CHAR) /* end-of-string char */
+ {
+ status = CHAR_EOS; /* end of string */
+ }
+ else if (c == ESC_CHAR) /* escape character */
+ {
+ /* accept the next character literally, even ESC_CHAR and EMES_CHAR */
+ if (read_char (fp, &c) == 0)
+ status = CHAR_FAIL; /* fail */
+ }
+
+ *ch = c;
+ return status;
+}
+/* read_string_char */
+
+
+COUNT
+read_misc
+#ifdef STDC
+ (FILE * fp, Token token)
+#else
+ (fp, token)
+ FILE * fp;
+ Token token;
+#endif
+{
+ int c;
+ int count;
+ /* loop ends at: end of fp file, or reading error, or a space */
+ for (count=0; count <= MAXTOKLEN; ++count)
+ {
+ if (read_char (fp, &c) == 0 || isspace (c))
+ break;
+ if (group && c == ECOM_CHAR)
+ {
+ (Void) unread_char ();
+ break;
+ }
+
+ token[count] = c;
+ }
+ token[count] = '\0';
+ return count;
+}
+/* read_misc */
+
+
+COUNT
+read_mes
+#ifdef STDC
+ (FILE * fp, char * token)
+#else
+ (fp, token)
+ FILE * fp;
+ char * token;
+#endif
+/* called **AFTER** a BMES_CHAR has been read */
+/* read file fp for characters up to next unescaped EMES_CHAR */
+/* this is called a "string token" */
+/* write string, including EMES_CHAR, into token[] */
+/* return number of characters read from fp */
+{
+ COUNT dtl_count; /* number of DTL characters read by read_mes from fp */
+ int more; /* flag more == 0 to terminate loop */
+ int escape; /* flag escape == 1 if previous character was ESC_CHAR */
+ int ch; /* current DTL character */
+
+ escape = 0;
+ more = 1;
+ dtl_count = 0;
+ while (more)
+ {
+ if (read_char (fp, &ch) == 0)
+ {
+ /* end of fp file, or reading error */
+ more = 0;
+ }
+ else /* error checking passed */
+ {
+ ++ dtl_count;
+ if (ch == EMES_CHAR && escape == 0) /* end of string */
+ {
+ /* include final EMES_CHAR */
+ * token ++ = ch;
+ more = 0;
+ }
+ else if (ch == ESC_CHAR && escape == 0)
+ {
+ /* next character is not end of string */
+ escape = 1;
+ }
+ else
+ {
+ /* store any other character, */
+ /* including escaped EMES_CHAR and ESC_CHAR*/
+ * token ++ = ch;
+ escape = 0;
+ }
+ }
+ }
+ * token = '\0';
+ return dtl_count;
+}
+/* read_mes */
+
+
+int
+unread_char (VOID)
+/* wind input back, to allow rereading of one character */
+/* return 1 if this works, 0 on error */
+{
+ extern Line dtl_line;
+ int status;
+ if (dtl_line.read > 0)
+ {
+ -- dtl_line.read; /* back up one character in dtl_line */
+ -- dtl_read; /* correct the count of DTL characters */
+ -- com_read; /* count another DTL command character */
+ status = 1; /* OK */
+ }
+ else /* current DTL line is empty */
+ {
+ status = 0; /* error */
+ }
+ return status;
+}
+/* unread_char */
+
+
+int
+find_command
+#ifdef STDC
+ (char * command, int * opcode)
+#else
+ (command, opcode)
+ char * command;
+ int * opcode;
+#endif
+{
+ int found;
+ int i;
+
+ found = 0;
+ for (i=0; i < NCMDS; i++)
+ {
+ if ((cmd_table[i] != 0) && (strcmp (command, cmd_table[i]) == 0))
+ {
+ found = 1;
+ break;
+ }
+ }
+
+ *opcode = i;
+
+ return found;
+}
+/* find_command */
+
+
+int
+check_byte
+#ifdef STDC
+ (int byte)
+#else
+ (byte)
+ int byte;
+#endif
+{
+ if (byte < 0 || byte > 255)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(check_byte) : INTERNAL ERROR : ");
+ fprintf (stderr, "byte %d not in the range of 0 to 255.\n", byte);
+ dexit (1);
+ }
+ return 1; /* OK */
+}
+/* check_byte */
+
+
+int
+xfer_args
+#ifdef STDC
+ (FILE * dtl, FILE * dvi, int opcode)
+#else
+ (dtl, dvi, opcode)
+ FILE * dtl;
+ FILE * dvi;
+ int opcode;
+#endif
+{
+ int n;
+
+ if (opcode >= 0 && opcode <= 127)
+ ; /* SETCHAR uses no data */
+ else if (opcode >= 128 && opcode <= 170)
+ {
+ word_t this_bop_address = last_bop_address;
+
+ if (opcode == 139) /* BOP */
+ {
+ this_bop_address = dvi_written - 1;
+ }
+ put_table (op_128_170, opcode, dtl, dvi);
+ if (opcode == 139) /* BOP */
+ {
+ xfer_bop_address (dtl, dvi);
+ last_bop_address = this_bop_address;
+ }
+ }
+ else if (opcode >= 171 && opcode <= 234)
+ ; /* FONTNUM uses no data */
+ else if (opcode >= 235 && opcode <= 238)
+ put_table (fnt, opcode, dtl, dvi);
+ else if (opcode >= 239 && opcode <= 242)
+ {
+ n = opcode - 238;
+ special (dtl, dvi, n);
+ }
+ else if (opcode >= 243 && opcode <= 246)
+ {
+ n = opcode - 242;
+ fontdef (dtl, dvi, n);
+ }
+ else if (opcode == 247)
+ preamble (dtl, dvi);
+ else if (opcode == 248)
+ postamble (dtl, dvi);
+ else if (opcode == 249)
+ post_post (dtl, dvi);
+ else if (opcode >= 250 && opcode <= 255)
+ ; /* these, undefined, opcodes use no data */
+ else
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(xfer_args) : opcode %d not handled.\n",
+ opcode);
+ }
+
+ return 1; /* OK */
+}
+/* xfer_args */
+
+
+int
+set_seq
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* Called _after_ a BSEQ_CHAR command */
+/* Read bytes from dtl file, */
+/* writing corresponding SETCHAR or SET1 commands to DVI file, */
+/* _until_ unescaped ESEQ_CHAR is found */
+/* Return 1 if OK, 0 on error */
+/**** dt2dv assumes 8 bit characters, ****/
+/**** but some day one might change that. ****/
+{
+ int status = 1; /* status = 1 if OK, 0 if error */
+ int more; /* sequence of font characters continuing? */
+ int escape = 0; /* flag set if previous character was an escape */
+ int ch; /* character read from DTL file */
+ more = 1;
+ while (more)
+ {
+ /* ignore read_char status, to allow unprintable characters */
+ (Void) read_char (dtl, &ch);
+ /* but check for end of dtl file, or serious file reading error */
+ if (ch < 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(set_seq) : ");
+ fprintf (stderr, "end of dtl file, ");
+ fprintf (stderr, "or serious dtl file reading error\n");
+ dinfo();
+ more = 0;
+ status = 0; /* bad news */
+ }
+ else /* read dtl file, okay */
+ {
+ if (ch == ESC_CHAR && escape == 0) /* escape next character */
+ {
+ escape = 1;
+ }
+ else
+ {
+ if (ch == ESEQ_CHAR && escape == 0) /* end of sequence */
+ {
+ more = 0;
+ }
+ else if (ch <= 127) /* can use SETCHAR */
+ {
+ put_byte (ch, dvi);
+ }
+ else if (ch <= 255) /* can use SET1 */
+ {
+ put_byte (128, dvi); /* SET1 opcode */
+ put_unsigned (1, (U4) ch, dvi);
+ }
+ else
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(set_seq) : ");
+ fprintf (stderr,
+ "ERROR : DTL character %d is not in range 0 to 255\n",
+ ch);
+ dexit (1);
+ more = 0;
+ status = 0; /* Error, because dt2dv assumes 8 bit characters */
+ }
+ escape = 0; /* current ch is not an escape character */
+ }
+ }
+ }
+ return status;
+}
+/* set_seq */
+
+
+U4
+xfer_hex
+#ifdef STDC
+ (int n, FILE * dtl, FILE * dvi)
+#else
+ (n, dtl, dvi)
+ int n;
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* translate unsigned n-byte hexadecimal number from dtl to dvi file. */
+/* return value of hexadecimal number */
+{
+ U4 unum = 0; /* at most this space needed */
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ int nconv = 0; /* number of arguments converted by sscanf */
+ static Token token = ""; /* DTL token */
+
+ if (n < 1 || n > 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(xfer_hex) : INTERNAL ERROR : asked for %d bytes. Must be 1 to 4.\n",
+ n);
+ dexit (1);
+ }
+
+ nread = read_token (dtl, token);
+
+ nconv = sscanf (token, XF4, &unum);
+
+ if (nconv < 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_hex) : DTL FILE ERROR (%s) : %s \"%s\".\n",
+ dtl_filename, "hexadecimal number expected, not", token);
+ dexit (1);
+ }
+
+ put_unsigned (n, unum, dvi);
+
+ return unum;
+}
+/* xfer_hex */
+
+
+U4
+xfer_oct
+#ifdef STDC
+ (int n, FILE * dtl, FILE * dvi)
+#else
+ (n, dtl, dvi)
+ int n;
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* translate unsigned n-byte octal number from dtl to dvi file. */
+/* return value of octal number */
+{
+ U4 unum = 0; /* at most this space needed */
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ int nconv = 0; /* number of arguments converted by sscanf */
+ static Token token = ""; /* DTL token */
+
+ if (n < 1 || n > 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(xfer_oct) : INTERNAL ERROR : asked for %d bytes. Must be 1 to 4.\n",
+ n);
+ dexit (1);
+ }
+
+ nread = read_token (dtl, token);
+
+ nconv = sscanf (token, OF4, &unum);
+
+ if (nconv < 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_oct) : DTL FILE ERROR (%s) : %s \"%s\".\n",
+ dtl_filename, "octal number expected, not", token);
+ dexit (1);
+ }
+
+ put_unsigned (n, unum, dvi);
+
+ return unum;
+}
+/* xfer_oct */
+
+
+U4
+xfer_unsigned
+#ifdef STDC
+ (int n, FILE * dtl, FILE * dvi)
+#else
+ (n, dtl, dvi)
+ int n;
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* translate unsigned n-byte number from dtl to dvi file. */
+/* return value of unsigned number */
+{
+ U4 unum = 0; /* at most this space needed */
+
+ unum = get_unsigned (dtl);
+ put_unsigned (n, unum, dvi);
+
+ return unum;
+}
+/* xfer_unsigned */
+
+
+S4
+xfer_signed
+#ifdef STDC
+ (int n, FILE * dtl, FILE * dvi)
+#else
+ (n, dtl, dvi)
+ int n;
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* translate signed n-byte number from dtl to dvi file. */
+/* return value of signed number */
+{
+ S4 snum = 0;
+
+ snum = get_signed (dtl);
+ put_signed (n, snum, dvi);
+
+ return snum;
+}
+/* xfer_signed */
+
+
+U4
+get_unsigned
+#ifdef STDC
+ (FILE * dtl)
+#else
+ (dtl)
+ FILE * dtl;
+#endif
+/* read unsigned number from dtl file. */
+/* return value of unsigned number */
+{
+ U4 unum = 0; /* at most this space needed */
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ int nconv = 0; /* number of arguments converted by sscanf */
+ static Token token = ""; /* DTL token */
+
+ nread = read_token (dtl, token);
+
+ nconv = sscanf (token, UF4, &unum);
+
+ if (nconv < 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_unsigned) : DTL FILE ERROR (%s) : %s \"%s\".\n",
+ dtl_filename, "unsigned number expected, not", token);
+ dexit (1);
+ }
+
+ return unum;
+}
+/* get_unsigned */
+
+
+S4
+get_signed
+#ifdef STDC
+ (FILE * dtl)
+#else
+ (dtl)
+ FILE * dtl;
+#endif
+/* read signed number from dtl file. */
+/* return value of signed number */
+{
+ S4 snum = 0;
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ int nconv = 0; /* number of sscanf arguments converted and assigned */
+ static Token token = "";
+
+ nread = read_token (dtl, token);
+
+ nconv = sscanf (token, SF4, &snum);
+
+ if (nconv < 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_signed) : DTL FILE ERROR (%s) : %s \"%s\".\n",
+ dtl_filename, "signed number expected, not", token);
+ dexit (1);
+ }
+
+ return snum;
+}
+/* get_signed */
+
+
+int
+put_unsigned
+#ifdef STDC
+ (int n, U4 unum, FILE * dvi)
+#else
+ (n, unum, dvi)
+ int n;
+ U4 unum;
+ FILE * dvi;
+#endif
+/* put unsigned in-byte integer to dvi file */
+/* DVI format uses Big-endian storage of numbers: */
+/* most significant byte is first. */
+/* return number of bytes written. */
+{
+ Byte ubyte[4]; /* at most 4 bytes needed in DVI format */
+ int i;
+
+ if (n < 1 || n > 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_unsigned) : INTERNAL ERROR : asked for %d bytes. Must be 1 to 4.\n",
+ n);
+ dexit (1);
+ }
+
+ /* Big-endian storage. */
+ for (i = 0; i < n; i++)
+ {
+ ubyte[i] = (Byte) (unum % 256);
+ unum /= 256;
+ }
+ /* Reverse order for big-endian representation. */
+ for (i = n-1; i >= 0; i--)
+ {
+ put_byte ((int) ubyte[i], dvi);
+ }
+
+ return n;
+}
+/* put_unsigned */
+
+
+int
+put_signed
+#ifdef STDC
+ (int n, S4 snum, FILE * dvi)
+#else
+ (n, snum, dvi)
+ int n;
+ S4 snum;
+ FILE * dvi;
+#endif
+/* put signed in-byte integer to dvi file */
+/* DVI format uses 2's complement Big-endian storage of signed numbers: */
+/* most significant byte is first. */
+/* return number of bytes written. */
+{
+ /* Will this deal properly with the sign? */
+
+ if (n < 1 || n > 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_signed) : INTERNAL ERROR : asked for %d bytes. Must be 1 to 4.\n",
+ n);
+ dexit (1);
+ }
+
+ /* How do we ensure 2's complement representation? */
+ /* Here's a trick that I hope is portable, given ANSI C. */
+ /* See K&R (2nd edition), Appendix A6.2 "Integral Conversions". */
+
+ /* Convert snum to U4 data type */
+ put_unsigned (n, (U4) snum, dvi);
+
+ return n;
+}
+/* put_signed */
+
+
+int
+check_bmes
+#ifdef STDC
+ (FILE * dtl)
+#else
+ (dtl)
+ FILE * dtl;
+#endif
+/* check that a BMES_CHAR is the next non-whitespace character in dtl */
+{
+ int ch; /* next non-whitespace character in dtl */
+
+ /* `(Void)' because we ignore the number of spaces skipped */
+ (Void) skip_space (dtl, &ch);
+
+ if (ch < 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(check_bmes) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "end of dtl file, or reading error\n");
+ dexit (1);
+ }
+
+ if (ch != BMES_CHAR)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(check_bmes) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "BMES_CHAR (`%c') %s, not `%c' (char %d).\n",
+ BMES_CHAR, "expected before string", ch, ch);
+ dexit (1);
+ }
+
+ return 1; /* OK */
+}
+/* check_bmes */
+
+
+int
+check_emes
+#ifdef STDC
+ (FILE * dtl)
+#else
+ (dtl)
+ FILE * dtl;
+#endif
+/* check that an EMES_CHAR is the next character in dtl */
+{
+ int ch; /* dtl character */
+
+ if (read_char (dtl, &ch) == 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(check_emes) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "end of dtl file, or reading error\n");
+ dexit (1);
+ }
+
+ if (ch != EMES_CHAR)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(check_emes) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "EMES_CHAR (`%c') %s, not `%c' (char %d).\n",
+ EMES_CHAR, "expected to follow string", ch, ch);
+ dexit (1);
+ }
+
+ return 1; /* OK */
+}
+/* check_emes */
+
+
+/* Size typically used in this program for Lstring variables */
+#define LSIZE 1024
+
+
+Void
+init_Lstring
+#ifdef STDC
+ (Lstring * lsp, long int n)
+#else
+ (lsp, n)
+ Lstring * lsp;
+ long int n;
+#endif
+{
+ lsp->l = 0;
+ lsp->m = n;
+ lsp->s = (char *) gmalloc (n);
+}
+/* init_Lstring */
+
+
+Void
+de_init_Lstring
+#ifdef STDC
+ (Lstring * lsp)
+#else
+ (lsp)
+ Lstring * lsp;
+#endif
+{
+ lsp->l = 0;
+ lsp->m = 0;
+ free (lsp->s);
+ lsp->s = NULL; /* to be sure */
+}
+/* de_init_Lstring */
+
+
+Lstring *
+alloc_Lstring
+#ifdef STDC
+ (long int n)
+#else
+ (n)
+ long int n;
+#endif
+{
+ Lstring * lsp;
+ lsp = (Lstring *) gmalloc (sizeof (Lstring));
+ init_Lstring (lsp, n);
+ return (lsp);
+}
+/* alloc_Lstring */
+
+
+Void
+free_Lstring
+#ifdef STDC
+ (Lstring * lstr)
+#else
+ (lstr)
+ Lstring * lstr;
+#endif
+{
+ free (lstr->s);
+ free (lstr);
+}
+/* free_Lstring */
+
+
+Void
+ls_putb
+#ifdef STDC
+ (int ch, Lstring * lstr)
+#else
+ (ch, lstr)
+ int ch;
+ Lstring * lstr;
+#endif
+/* write byte ch into Lstring *lstr */
+{
+ if (lstr->l >= lstr->m)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(ls_putb) : ERROR : No more room in Lstring.\n");
+ dexit (1);
+ }
+ else
+ {
+ lstr->s [(lstr->l)++] = ch;
+ }
+}
+/* ls_putb */
+
+
+long int
+get_Lstring
+#ifdef STDC
+ (FILE * dtl, Lstring * lstr)
+#else
+ (dtl, lstr)
+ FILE * dtl;
+ Lstring * lstr;
+#endif
+/* get a string from dtl file, store as an Lstring in *lstr. */
+/* lstr must already be allocated and initialised. */
+/* return length of Lstring *lstr */
+{
+ U4 nch;
+ int char_status = CHAR_OK; /* OK so far */
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_Lstring) : entering get_Lstring.\n");
+ }
+
+ check_bmes (dtl);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(get_Lstring) : string is: \"");
+ }
+
+ for (nch=0; ; nch++)
+ {
+ int ch;
+
+ char_status = read_string_char (dtl, &ch);
+
+ if (char_status == CHAR_FAIL)
+ {
+ /* end of dtl file, or reading error */
+ fprintf (stderr, "\n");
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_Lstring) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "cannot read string[");
+ fprintf (stderr, UF4, nch);
+ fprintf (stderr, "] from dtl file.\n");
+ dexit (1);
+ }
+
+ if (debug)
+ {
+ fprintf (stderr, "%c", ch);
+ }
+
+ if (char_status == CHAR_EOS)
+ {
+ if (ch != EMES_CHAR)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_Lstring) : INTERNAL ERROR : ");
+ fprintf (stderr, "char_status = CHAR_FAIL,\n");
+ fprintf (stderr,
+ "but ch = %c (char %d) is not EMES_CHAR = %c (char %d)\n",
+ ch, ch, EMES_CHAR, EMES_CHAR);
+ dexit (1);
+ }
+ (Void) unread_char ();
+ break; /* end of string */
+ }
+ else if (char_status == CHAR_OK)
+ {
+ ls_putb (ch, lstr);
+ }
+ else
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_Lstring) : INTERNAL ERROR : ");
+ fprintf (stderr, "char_status = %d is unfamiliar!\n", char_status);
+ dexit (1);
+ }
+ }
+ /* end for */
+
+ if (debug)
+ {
+ fprintf (stderr, "\".\n");
+ }
+
+ check_emes (dtl);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(get_Lstring) : leaving get_Lstring.\n");
+ }
+
+ return (lstr->l);
+}
+/* get_Lstring */
+
+
+Void
+put_Lstring
+#ifdef STDC
+ (const Lstring * lstr, FILE * dvi)
+#else
+ (str, dvi)
+ Lstring lstr;
+ FILE * dvi;
+#endif
+{
+ size_t fwret;
+ fwret = fwrite ((lstr->s), sizeof (char), (size_t) (lstr->l), dvi);
+
+ dvi_written += fwret;
+
+ if (fwret < lstr->l)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_Lstring) : DVI File ERROR : not all bytes written ");
+ fprintf (stderr, "(%ld of %ld).\n",
+ (long int) fwret, (long int) (lstr->l));
+ dexit (1);
+ }
+}
+/* put_Lstring */
+
+
+U4
+xfer_len_string
+#ifdef STDC
+ (int n, FILE * dtl, FILE * dvi)
+#else
+ (n, dtl, dvi)
+ int n;
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* transfer (length and) quoted string from dtl to dvi file, */
+/* return number of bytes written to dvi file. */
+{
+ U4 k, k2;
+ Lstring lstr;
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_len_string) : entering xfer_len_string.\n");
+ }
+
+ init_Lstring (&lstr, LSIZE);
+
+ /* k[n] : length of special string */
+
+ k = get_unsigned (dtl);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_len_string) : string's nominal length k = ");
+ fprintf (stderr, UF4, k);
+ fprintf (stderr, " characters.\n");
+ }
+
+ k2 = get_Lstring (dtl, &lstr);
+
+ if (k2 != k)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_len_string) : WARNING : string length (");
+ fprintf (stderr, UF4, k);
+ fprintf (stderr, ") in DTL file is wrong\n");
+ fprintf (stderr, "Writing correct value (");
+ fprintf (stderr, UF4, k2);
+ fprintf (stderr, ") to DVI file\n");
+ }
+
+ put_unsigned (n, k2, dvi);
+
+ put_Lstring (&lstr, dvi);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_len_string) : leaving xfer_len_string.\n");
+ }
+
+ de_init_Lstring (&lstr);
+
+ return (n + k2);
+}
+/* xfer_len_string */
+
+
+S4
+xfer_bop_address
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* translate signed 4-byte bop address from dtl to dvi file. */
+/* return value of bop address written to DVI file */
+{
+ S4 snum = 0; /* at most this space needed for byte address */
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ int nconv = 0; /* number of arguments converted by sscanf */
+ static Token token = ""; /* DTL token */
+
+ nread += read_token (dtl, token);
+
+ nconv = sscanf (token, SF4, &snum);
+
+ if (nconv != 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_bop_address) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "signed number expected, not \"%s\".\n", token);
+ dexit (1);
+ }
+
+ if (snum != last_bop_address)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_bop_address) : WARNING : byte address (");
+ fprintf (stderr, WF, snum);
+ fprintf (stderr, ")\n");
+ fprintf (stderr, "for previous bop in DTL file is wrong\n");
+ fprintf (stderr, "Writing correct value (");
+ fprintf (stderr, WF, last_bop_address);
+ fprintf (stderr, ") to DVI file\n");
+ }
+
+ put_signed (4, last_bop_address, dvi);
+
+ return last_bop_address;
+}
+/* xfer_bop_address */
+
+
+S4
+xfer_postamble_address
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* translate signed 4-byte postamble address from dtl to dvi file. */
+/* return value of postamble address written to DVI file */
+{
+ S4 snum = 0; /* at most this space needed for byte address */
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ int nconv = 0; /* number of arguments converted by sscanf */
+ static Token token = ""; /* DTL token */
+
+ nread += read_token (dtl, token);
+
+ nconv = sscanf (token, SF4, &snum);
+
+ if (nconv != 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_postamble_address) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "signed number expected, not \"%s\".\n", token);
+ dexit (1);
+ }
+
+ if (snum != postamble_address)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(xfer_postamble_address) : WARNING : byte address (");
+ fprintf (stderr, WF, snum);
+ fprintf (stderr, ")\n");
+ fprintf (stderr, "for postamble in DTL file is wrong\n");
+ fprintf (stderr, "Writing correct value (");
+ fprintf (stderr, WF, postamble_address);
+ fprintf (stderr, ") to DVI file\n");
+ }
+
+ put_signed (4, postamble_address, dvi);
+
+ return postamble_address;
+}
+/* xfer_postamble_address */
+
+
+int
+put_table
+#ifdef STDC
+ (op_table table, int opcode, FILE * dtl, FILE * dvi)
+#else
+ (table, opcode, dtl, dvi)
+ op_table table;
+ int opcode;
+ FILE * dtl;
+ FILE * dvi;
+#endif
+{
+ /* table: {char * name; int first, last; op_info * list; }; */
+ /* op_info: {int code; char * name; int nargs; char * args; }; */
+
+ op_info op; /* entry in table */
+ int i;
+ int pos; /* current position in string being scanned */
+ static String args = "";
+
+ /* Defensive programming. */
+ if (opcode < table.first || opcode > table.last)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_table) : DTL FILE (OR INTERNAL) ERROR : opcode %d ", opcode);
+ fprintf (stderr, "is outside table %s [ %d to %d ] !\n",
+ table.name, table.first, table.last);
+ dexit (1);
+ }
+
+ op = table.list [ opcode - table.first ];
+
+ /* More defensive programming. */
+ if (opcode != op.code)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_table) : INTERNAL ERROR : opcode %d for command \"%s\"",
+ opcode, op.name);
+ fprintf (stderr, " faulty in table \"%s\".\n", table.name);
+ dexit (1);
+ }
+
+ /* process all the arguments, according to size and sign */
+
+ strncpy (args, op.args, MAXSTRLEN);
+
+ pos = 0;
+ for (i=0; i < op.nargs; i++)
+ {
+ int argtype = 0;
+ int nscan = 0; /* number of bytes read by sscanf */
+ int nconv = 0; /* number of sscanf arguments converted & assigned */
+
+ /* sscanf() does NOT advance over its input: */
+ /* C strings lack internal state information, which C files have. */
+ /* On Sun/OS, sscanf calls ungetc on the string it reads, */
+ /* which therefore has to be writable. */
+
+ nconv = sscanf (args + pos, "%d%n", &argtype, &nscan);
+
+ if (nconv < 1 || nscan < 1)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr,
+ "(put_table) : INTERNAL ERROR : internal read of table %s failed!\n",
+ table.name);
+ dexit (1);
+ }
+
+ pos += nscan;
+
+ if (argtype < 0)
+ xfer_signed (-argtype, dtl, dvi);
+ else
+ xfer_unsigned (argtype, dtl, dvi);
+ }
+ /* end for */
+
+ return 1; /* OK */
+}
+/* put_table */
+
+
+/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+
+U4
+special
+#ifdef STDC
+ (FILE * dtl, FILE * dvi, int n)
+#else
+ (dtl, dvi, n)
+ FILE * dtl;
+ FILE * dvi;
+ int n;
+#endif
+/* read special (1 <= n <= 4 byte) data from dtl, and write in dvi */
+/* return number of bytes written */
+{
+ U4 nk;
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(special) : entering special.\n");
+ }
+
+ if (n < 1 || n > 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(special) : DTL FILE ERROR (%s) : special %d, ",
+ dtl_filename, n);
+ fprintf (stderr, "range is 1 to 4.\n");
+ dexit (1);
+ }
+
+ /* k[n] : length of special string */
+ /* x[k] : special string */
+ /* nk = n + k */
+ nk = xfer_len_string (n, dtl, dvi);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(special) : leaving special.\n");
+ }
+
+ return (nk);
+}
+/* special */
+
+
+int
+fontdef
+#ifdef STDC
+ (FILE * dtl, FILE * dvi, int suffix)
+#else
+ (dtl, dvi, suffix)
+ FILE * dtl;
+ FILE * dvi;
+ int suffix;
+#endif
+/* read fontdef fnt_def1 .. fnt_def4 from dtl, and write in dvi */
+/* suffix is the fontdef suffix : 1 to 4 */
+/* return number of bytes written */
+{
+ U4 a, l, a2, l2;
+ U4 k;
+ Lstring lstr1, lstr2;
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : entering fontdef.\n");
+ }
+
+ if (suffix < 1 || suffix > 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "font def %d, but range is 1 to 4.\n", suffix);
+ dexit (1);
+ }
+
+ init_Lstring (&lstr1, LSIZE);
+ init_Lstring (&lstr2, LSIZE);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : about to read font number.\n");
+ }
+
+ /* k[suffix] : font number */
+ if (suffix == 4)
+ k = xfer_signed (suffix, dtl, dvi);
+ else
+ k = xfer_unsigned (suffix, dtl, dvi);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : font ");
+ fprintf (stderr, UF4, k);
+ fprintf (stderr, ".\n");
+ }
+
+#ifdef HEX_CHECKSUM
+ /* c[4] : (hexadecimal) checksum : I (gt) would prefer this */
+ xfer_hex (4, dtl, dvi);
+#else /NOT HEX_CHECKSUM */
+ /* c[4] : checksum (octal, for comparison with tftopl's .pl file) */
+ xfer_oct (4, dtl, dvi);
+#endif
+
+ /* s[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* d[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* If DTL file's edited, a and l may be wrong. */
+
+ /* a[1] : length of font `area' (directory) portion of pathname string */
+ a = get_unsigned (dtl);
+
+ /* l[1] : length of font portion of pathname string */
+ l = get_unsigned (dtl);
+
+ /* n[a+l] : font pathname string <= area + font */
+
+ a2 = get_Lstring (dtl, &lstr1);
+
+ if (a2 != a)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : WARNING : font area string's length (");
+ fprintf (stderr, UF4, a);
+ fprintf (stderr, ") in DTL file is wrong\n");
+ fprintf (stderr, "Writing correct value (");
+ fprintf (stderr, UF4, a2);
+ fprintf (stderr, ") to DVI file\n");
+ }
+
+ put_unsigned (1, a2, dvi);
+
+ l2 = get_Lstring (dtl, &lstr2);
+
+ if (l2 != l)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : WARNING : font string's length (");
+ fprintf (stderr, UF4, l);
+ fprintf (stderr, ") in DTL file is wrong\n");
+ fprintf (stderr, "Writing correct value (");
+ fprintf (stderr, UF4, l2);
+ fprintf (stderr, ") to DVI file\n");
+ }
+
+ put_unsigned (1, l2, dvi);
+
+ put_Lstring (&lstr1, dvi);
+ put_Lstring (&lstr2, dvi);
+
+ de_init_Lstring (&lstr2);
+ de_init_Lstring (&lstr1);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(fontdef) : leaving fontdef.\n");
+ }
+
+ return (suffix + 4*4 + 2*1 + a2 + l2);
+}
+/* fontdef */
+
+
+U4
+preamble
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* read preamble from dtl, and write in dvi */
+/* return number of bytes written */
+{
+ U4 k1;
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(preamble) : entering preamble.\n");
+ }
+
+ /* i[1] */
+ xfer_unsigned (1, dtl, dvi);
+
+ /* num[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* den[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* mag[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* k[1] : length of comment */
+ /* x[k] : comment string */
+ /* k1 = 1 + k */
+ k1 = xfer_len_string (1, dtl, dvi);
+
+ if (debug)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(preamble) : leaving preamble.\n");
+ }
+
+ return (1 + 3*4 + k1);
+}
+/* preamble */
+
+
+int
+postamble
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* read postamble from dtl, and write in dvi */
+/* return number of bytes written */
+{
+ postamble_address = dvi_written - 1;
+
+ /* p[4] : DVI address of previous bop command */
+ /* --- unsigned? --- or signed, as I assume? */
+ /* For, surely p should be -1 if the DVI file has NO bop? */
+ xfer_bop_address (dtl, dvi);
+
+ /* num[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* den[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* mag[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* l[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* u[4] */
+ xfer_unsigned (4, dtl, dvi);
+
+ /* s[2] */
+ xfer_unsigned (2, dtl, dvi);
+
+ /* t[2] */
+ xfer_unsigned (2, dtl, dvi);
+
+ return (6*4 + 2*2);
+}
+/* postamble */
+
+
+int
+post_post
+#ifdef STDC
+ (FILE * dtl, FILE * dvi)
+#else
+ (dtl, dvi)
+ FILE * dtl;
+ FILE * dvi;
+#endif
+/* read post_post from dtl, and write in dvi */
+/* return number of bytes written */
+{
+ /* hope I'm writing the "223" bytes in an 8-bit clean way */
+ int n223 = 0; /* number of "223" bytes in final padding */
+
+ /* q[4] : DVI address of post command */
+ /* --- unsigned? --- or signed, as I assume? */
+ /* what happens if there is NO postamble command? */
+ /* shouldn't q be -1 then? */
+
+ xfer_postamble_address (dtl, dvi);
+
+ /* i[1] : DVI identification byte = 2 */
+ xfer_unsigned (1, dtl, dvi);
+
+ for (n223 = 0; true; n223++)
+ {
+ COUNT nread = 0; /* number of DTL bytes read by read_token */
+ static Token token;
+
+ strcpy (token, "");
+
+ nread = read_token (dtl, token);
+
+ /* check whether end of dtl file */
+ if (nread == 0)
+ {
+ if (group)
+ {
+ /* dtl file shouldn't end before an ECOM */
+ PRINT_PROGNAME;
+ fprintf (stderr, "(post_post) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "premature end of DTL file!\n");
+ fprintf (stderr,
+ "%d complete iterations of \"padding byte\" loop;\n", n223);
+ fprintf (stderr, "troublesome token = \"%s\"\n", token);
+ dexit (1);
+ }
+ /* leave the "223" loop */
+ break;
+ }
+ else if (strcmp (token, "223") == 0)
+ {
+ /* token is a "223" padding byte */
+ /* loop again */
+ }
+ else
+ {
+ /* read a non-empty token that wasn't "223" */
+ (Void) unread_char ();
+ if (group)
+ {
+ if (strcmp (token, ECOM) == 0)
+ {
+ /* end of DTL's post_post command */
+ }
+ else
+ {
+ /* error : expected end of post_post */
+ PRINT_PROGNAME;
+ fprintf (stderr, "(post_post) : DTL FILE ERROR (%s) : ",
+ dtl_filename);
+ fprintf (stderr, "token \"%s\" should be ECOM (\"%s\")\n",
+ token, ECOM);
+ dexit (1);
+ }
+ }
+ /* leave the "223" loop */
+ break;
+ }
+ }
+ /* end for */
+
+ if (n223 < 4)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(post_post) : DTL FILE ERROR (%s) : \n",
+ dtl_filename);
+ fprintf (stderr, "fewer than four `223' padding bytes.\n");
+ fprintf (stderr, "Will write at least four `223' padding bytes.\n");
+ }
+
+ /* check whether the DVI file size is a multiple of 4 bytes */
+ if ((dvi_written + n223) % 4 != 0)
+ {
+ PRINT_PROGNAME;
+ fprintf (stderr, "(post_post) : WARNING : \n");
+ fprintf (stderr, "DVI size ");
+ fprintf (stderr, WF, dvi_written);
+ fprintf (stderr, " (bytes) wouldn't be a multiple of 4 !\n");
+ fprintf (stderr,
+ "Will write (at least four) `223' padding bytes until it is.\n");
+ }
+
+ /* final padding of DVI file by "223" bytes to a multiple of 4 bytes, */
+ /* with at least 4 bytes */
+
+ for (n223 = 0; (n223 < 4) || (dvi_written % 4 != 0); n223++)
+ {
+ /* add a "223" padding byte */
+ put_byte (223, dvi);
+ }
+
+ return (4 + 1 + n223);
+}
+/* post_post */
+
+
+/* end of dt2dv.c */
--- /dev/null
+.\" This file is public domain.
+.\" Originally written 1995, Geoffrey Tobin.
+.\" The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+.\" This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+.\" ====================================================================
+.\" @Troff-man-file{
+.\" author = "Nelson H. F. Beebe and Geoffrey R. D. Tobin",
+.\" version = "0.6.0",
+.\" date = "08 March 1995",
+.\" time = "19:57:00 GMT +11",
+.\" filename = "dt2dv.man",
+.\" address = "Center for Scientific Computing
+.\" Department of Mathematics
+.\" University of Utah
+.\" Salt Lake City, UT 84112
+.\" USA",
+.\" telephone = "+1 801 581 5254",
+.\" FAX = "+1 801 581 4148",
+.\" checksum = "03708 156 634 4989",
+.\" email = "beebe@math.utah.edu (Internet)",
+.\" codetable = "ISO/ASCII",
+.\" keywords = "DVI, TeX",
+.\" supported = "no",
+.\" docstring = "This file contains the UNIX manual pages
+.\" for the dt2dv utility, a program for
+.\" converting a DTL text representation of a TeX
+.\" DVI file, usually produced by the companion
+.\" dv2dt utility, back to a binary DVI file.
+.\"
+.\" The checksum field above contains a CRC-16
+.\" checksum as the first value, followed by the
+.\" equivalent of the standard UNIX wc (word
+.\" count) utility output of lines, words, and
+.\" characters. This is produced by Robert
+.\" Solovay's checksum utility.",
+.\" }
+.\" ====================================================================
+.if t .ds Te T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
+.if n .ds Te TeX
+.TH DT2DV 1 "08 March 1995" "Version 0.6.0"
+.\"======================================================================
+.SH NAME
+dt2dv \- convert a DTL text representation of a TeX DVI file to a binary DVI file
+.\"======================================================================
+.SH SYNOPSIS
+.B dt2dv
+.RB [ \-debug ]
+.RB [ \-group ]
+.RB [ \-si ]
+.RB [ \-so ]
+.I [input-DTL-file]
+.I [output-DVI-file]
+.PP
+In the absence of the
+.B \-si
+and
+.B \-so
+options,
+both file arguments are
+.IR required
+in the order
+.B input-DTL-file output-DVI-file .
+But also see the OPTIONS section below.
+No default file extensions are supplied.
+.\"======================================================================
+.SH DESCRIPTION
+.B dt2dv
+converts a text representation of a \*(Te\& DVI
+file, usually produced by the companion
+.BR dv2dt (1)
+utility, back to a binary DVI file. DTL
+.RI ( "DVI Text Language" )
+files can be edited, with care, and then restored
+to DVI form for processing by any \*(Te\& DVI
+driver program. In DTL files, font directory names
+and font names are preceded by a length field,
+which must be updated if the names are modified.
+.PP
+.BR dvitype (1)
+can also display a textual representation of DVI
+files, but in some implementations at least, it
+cannot be used in batch mode, and its output is
+not well-suited for conversion back to a DVI file.
+.PP
+The format of \*(Te\& DVI files is fully described
+in
+Donald E. Knuth,
+.IR "\*(Te\&: The Program" ,
+Addison-Wesley (1986), ISBN 0-201-13437-3, as well
+as in the
+.BR dvitype (1)
+literate program source code. Brief descriptions
+of the DTL and DVI formats are given in
+.BR dv2dt (1).
+.\"======================================================================
+.SH OPTIONS
+.\"-----------------------------------------------
+.TP \w'\-debug'u+3n
+.B \-debug
+Turn on detailed debugging output.
+.\"-----------------------------------------------
+.TP
+.B \-group
+Expect each DTL command to be in parentheses.
+.\"-----------------------------------------------
+.TP
+.B \-si
+Read all DTL commands from standard input.
+.\"-----------------------------------------------
+.TP
+.B \-so
+Write all DVI commands to standard output.
+.\"======================================================================
+.SH "SEE ALSO"
+.BR dv2dt (1),
+.BR dvitype (1),
+.BR tex (1).
+.\"======================================================================
+.SH FILES
+.TP \w'\fI*.dvi\fP'u+3n
+.I *.dvi
+binary \*(Te\& DVI file.
+.TP
+.I *.dtl
+text representation of a \*(Te\& DVI file in
+.I "DVI Text Language"
+format.
+.\"======================================================================
+.SH AUTHOR
+.B dt2dv
+and
+.BR dv2dt (1)
+were written by
+.RS
+.nf
+Geoffrey Tobin
+Department of Electronic Engineering
+La Trobe University
+Bundoora, Victoria 3083
+Australia
+Tel: +61 3 479 3736
+FAX: +61 3 479 3025
+Email: <G.Tobin@ee.latrobe.edu.au>
+.fi
+.RE
+.PP
+These manual pages were written primarily by
+.RS
+.nf
+Nelson H. F. Beebe, Ph.D.
+Center for Scientific Computing
+Department of Mathematics
+University of Utah
+Salt Lake City, UT 84112
+Tel: +1 801 581 5254
+FAX: +1 801 581 4148
+Email: <beebe@math.utah.edu>
+.fi
+.RE
+.\"==============================[The End]==============================
--- /dev/null
+This file is public domain.
+Originally written 1995, Geoffrey Tobin.
+The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+``dtl.doc''
+Wed 8 March 1995
+Geoffrey Tobin
+
+Correspondence between DTL and DVI files.
+-----------------------------------------
+
+DTL variety sequences-6, version 0.6.0
+--------------------------------------
+
+Note: `DTL' stands for `Device-Independent Text Language', and is an
+ASCII text representation of a DVI file.
+
+References for DVI file structure:
+----------------------------------
+
+In this distribution:
+
+ dvi.doc
+
+In the TeX archives:
+
+ CTAN: dviware/driv-standard/level-0/dvistd0.tex
+
+ "The DVI Driver Standard, Level 0",
+ by The TUG DVI Driver Standards Committee (now defunct)
+ chaired by Joachim Schrod.
+ Appendix A, "Device-Independent File Format",
+ section A.2, "Summary of DVI commands".
+
+DTL Commands
+------------
+
+ variety <variety-name> Specifies name of DTL file type.
+
+Naturally, `variety' has no DVI equivalent.
+
+The other DTL commands correspond one-to-one with DVI commands, but I
+have used briefer names (except for `special') than those used in the
+DVI standards document.
+
+ DTL : DVI
+
+ (text) : series of set_char commands, for printable ASCII text
+ \( : literal ASCII left parenthesis in (text)
+ \) : literal ASCII right parenthesis in (text)
+ \\ : literal ASCII backslash in (text)
+ \" : literal ASCII double quote in (text)
+ \XY : set_char for character with hexadecimal code XY,
+ not in parentheses, but by itself for readability
+ s1, s2, s2, s3 : set, with (1,2,3,4)-byte charcodes
+ sr : set_rule
+ p1, p2, p2, p3 : put, with (1,2,3,4)-byte charcodes
+ pr : put_rule
+ nop : nop (do nothing)
+ bop : bop (beginning of page)
+ eop : eop (end of page)
+ [ : push
+ ] : pop
+ r1, r2, r3, r4 : right, with (1,2,3,4)-byte argument
+ w0, w1, w2, w3, w4 : as in DVI
+ x0, x1, x2, x3, x4 : as in DVI
+ d1, d2, d3, d4 : down, with (1,2,3,4)-byte argument
+ y0, y1, y2, y3, y4 : as in DVI
+ z0, z1, z2, z3, z4 : as in DVI
+ fn : fnt_num (set current font to font number in 0 to 63)
+ f1, f2, f3, f4 : fnt (set current font to (1,2,3,4)-byte font number)
+ special : xxx (special commands with (1,2,3,4)-byte string length)
+ fd : fnt_def (assign a number to a named font)
+ pre : preamble
+ post : post (begin postamble)
+ post_post : post_post (end postamble)
+ opcode : undefined DVI command (250 to 255)
+
+---------------
+EOF ``dtl.doc''
+---------------
--- /dev/null
+/* dtl.h
+
+ This file is public domain.
+ Originally written 1995, Geoffrey Tobin.
+ The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+ This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+ - header for dv2dt.c and dt2dv.c, conversion programs
+ for human-readable "DTL" <-> DVI.
+ - (ANSI C) version 0.6.0 - 18:31 GMT +11 Wed 8 March 1995
+ - author: Geoffrey Tobin G.Tobin@ee.latrobe.edu.au
+ - patch: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca
+ - Reference: "The DVI Driver Standard, Level 0",
+ by The TUG DVI Driver Standards Committee.
+ Appendix A, "Device-Independent File Format".
+*/
+
+/* variety of DTL produced */
+#define VARIETY "sequences-6"
+
+/* version of DTL programs */
+#define VERSION "0.6.0"
+
+/* Test for ANSI/ISO Standard C */
+#if (defined(__cplusplus) || defined(__STDC__) || defined(c_plusplus))
+#define STDC 1
+#else
+#define STDC 0
+#endif
+
+/* Version (Traditional or ANSI) of C affects prototype and type definitions */
+#if STDC
+#define ARGS(parenthesized_list) parenthesized_list
+#else /* NOT STDC */
+#define ARGS(parenthesized_list) ()
+#endif /* NOT STDC */
+
+#if STDC
+#define Void void
+#define VOID void
+#define FILE_BEGIN SEEK_SET
+#else /* NOT STDC */
+#define Void int
+#define VOID
+#define FILE_BEGIN 0
+#endif /* NOT STDC */
+
+/* types to store 4 byte signed and unsigned integers */
+typedef long S4;
+typedef unsigned long U4;
+/* scanf and printf formats to read or write those */
+#define SF4 "%ld"
+#define UF4 "%lu"
+/* 4 byte hexadecimal */
+/* #define XF4 "%04lx" */
+#define XF4 "%lx"
+/* 4 byte octal */
+#define OF4 "%lo"
+
+/* type for byte count for DVI file */
+/* COUNT must be large enough to hold a U4 (unsigned 4 byte) value */
+typedef U4 COUNT;
+
+/* size of a TeX and DVI word is 32 bits; in some systems a `long int' is needed */
+typedef long int word_t;
+/* format for a DVI word */
+#define WF "%ld"
+
+/* string of 8-bit characters for machine: keyboard, screen, memory */
+
+#define MAXSTRLEN 256
+typedef char String[MAXSTRLEN+1];
+
+/* string s of length l and maximum length m */
+typedef struct {int l; int m; char * s;} Lstring;
+
+int debug = 0; /* normally, debugging is off */
+
+/* Is each DTL command parenthesised by a BCOM and an ECOM? */
+
+int group = 0; /* by default, no grouping */
+
+/* signals of beginning and end of a command and its arguments */
+/* these apply only if group is nonzero */
+
+# define BCOM "{"
+# define ECOM "}"
+
+# define BCOM_CHAR '{'
+# define ECOM_CHAR '}'
+
+/* beginning and end of a message string */
+
+#define BMES "'"
+#define EMES BMES
+
+#define BMES_CHAR '\''
+#define EMES_CHAR BMES_CHAR
+
+/* beginning and end of sequence of font characters */
+
+#define BSEQ "("
+#define ESEQ ")"
+
+#define BSEQ_CHAR '('
+#define ESEQ_CHAR ')'
+
+/* escape and quote characters */
+
+#define ESC_CHAR '\\'
+#define QUOTE_CHAR '\"'
+
+/* command names in DTL */
+
+#define SETCHAR "\\"
+#define SET "s"
+#define SET1 "s1"
+#define SET2 "s2"
+#define SET3 "s3"
+#define SET4 "s4"
+#define SETRULE "sr"
+#define PUT "p"
+#define PUT1 "p1"
+#define PUT2 "p2"
+#define PUT3 "p3"
+#define PUT4 "p4"
+#define PUTRULE "pr"
+#define NOP "nop"
+#define BOP "bop"
+#define EOP "eop"
+#define PUSH "["
+#define POP "]"
+#define RIGHT "r"
+#define RIGHT1 "r1"
+#define RIGHT2 "r2"
+#define RIGHT3 "r3"
+#define RIGHT4 "r4"
+#define W "w"
+#define W0 "w0"
+#define W1 "w1"
+#define W2 "w2"
+#define W3 "w3"
+#define W4 "w4"
+#define X "x"
+#define X0 "x0"
+#define X1 "x1"
+#define X2 "x2"
+#define X3 "x3"
+#define X4 "x4"
+#define DOWN "d"
+#define DOWN1 "d1"
+#define DOWN2 "d2"
+#define DOWN3 "d3"
+#define DOWN4 "d4"
+#define Y "y"
+#define Y0 "y0"
+#define Y1 "y1"
+#define Y2 "y2"
+#define Y3 "y3"
+#define Y4 "y4"
+#define Z "z"
+#define Z0 "z0"
+#define Z1 "z1"
+#define Z2 "z2"
+#define Z3 "z3"
+#define Z4 "z4"
+#define FONT "f"
+#define FONT1 "f1"
+#define FONT2 "f2"
+#define FONT3 "f3"
+#define FONT4 "f4"
+#define FONTDEF "fd"
+#define FONTNUM "fn"
+#define SPECIAL "special"
+#define PRE "pre"
+#define POST "post"
+#define POSTPOST "post_post"
+#define OPCODE "opcode"
+
+/* end dtl.h */
--- /dev/null
+/* dv2dt - convert DVI file to human-readable "DTL" format.
+
+ This file is public domain.
+ Originally written 1995, Geoffrey Tobin.
+ The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+ This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+ - (ANSI C) version 0.6.0 - 17:54 GMT +11 Wed 8 March 1995
+ - author: Geoffrey Tobin ecsgrt@luxor.latrobe.edu.au
+ - patch: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca
+ - Reference: "The DVI Driver Standard, Level 0",
+ by The TUG DVI Driver Standards Committee.
+ Appendix A, "Device-Independent File Format".
+*/
+
+/* unix version; read from stdin, write to stdout, by default. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "dtl.h"
+
+#define PRINT_BCOM if (group) fprintf (dtl, "%s", BCOM)
+#define PRINT_ECOM if (group) fprintf (dtl, "%s", ECOM)
+
+/*
+ operation's:
+ opcode,
+ name,
+ number of args,
+ string of arguments.
+*/
+struct op_info_st {int code; char * name; int nargs; char * args; };
+
+typedef struct op_info_st op_info;
+
+/*
+ table's:
+ name,
+ first opcode,
+ last opcode,
+ pointer to opcode info.
+*/
+struct op_table_st {char * name; int first; int last; op_info * list; };
+
+typedef struct op_table_st op_table;
+
+/* Table for opcodes 128 to 170 inclusive. */
+
+op_info op_info_128_170 [] =
+{
+ {128, "s1", 1, "1"},
+ {129, "s2", 1, "2"},
+ {130, "s3", 1, "3"},
+ {131, "s4", 1, "-4"},
+ {132, "sr", 2, "-4 -4"},
+ {133, "p1", 1, "1"},
+ {134, "p2", 1, "2"},
+ {135, "p3", 1, "3"},
+ {136, "p4", 1, "-4"},
+ {137, "pr", 2, "-4 -4"},
+ {138, "nop", 0, ""},
+ {139, "bop", 11, "-4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4"},
+ {140, "eop", 0, ""},
+ {141, "[", 0, ""},
+ {142, "]", 0, ""},
+ {143, "r1", 1, "-1"},
+ {144, "r2", 1, "-2"},
+ {145, "r3", 1, "-3"},
+ {146, "r4", 1, "-4"},
+ {147, "w0", 0, ""},
+ {148, "w1", 1, "-1"},
+ {149, "w2", 1, "-2"},
+ {150, "w3", 1, "-3"},
+ {151, "w4", 1, "-4"},
+ {152, "x0", 0, ""},
+ {153, "x1", 1, "-1"},
+ {154, "x2", 1, "-2"},
+ {155, "x3", 1, "-3"},
+ {156, "x4", 1, "-4"},
+ {157, "d1", 1, "-1"},
+ {158, "d2", 1, "-2"},
+ {159, "d3", 1, "-3"},
+ {160, "d4", 1, "-4"},
+ {161, "y0", 0, ""},
+ {162, "y1", 1, "-1"},
+ {163, "y2", 1, "-2"},
+ {164, "y3", 1, "-3"},
+ {165, "y4", 1, "-4"},
+ {166, "z0", 0, ""},
+ {167, "z1", 1, "-1"},
+ {168, "z2", 1, "-2"},
+ {169, "z3", 1, "-3"},
+ {170, "z4", 1, "-4"}
+}; /* op_info op_info_128_170 [] */
+
+op_table op_128_170 = {"op_128_170", 128, 170, op_info_128_170};
+
+/* Table for font with 1 to 4 bytes (opcodes 235 to 238) inclusive. */
+
+op_info fnt_n [] =
+{
+ {235, "f1", 1, "1"},
+ {236, "f2", 1, "2"},
+ {237, "f3", 1, "3"},
+ {238, "f4", 1, "-4"}
+}; /* op_info fnt_n [] */
+
+op_table fnt = {"f", 235, 238, fnt_n};
+
+
+/* function prototypes */
+
+int open_dvi ARGS((char * dvi_file, FILE ** dvi));
+int open_dtl ARGS((char * dtl_file, FILE ** dtl));
+int dv2dt ARGS((FILE * dvi, FILE * dtl));
+
+COUNT wunsigned ARGS((int n, FILE * dvi, FILE * dtl));
+COUNT wsigned ARGS((int n, FILE * dvi, FILE * dtl));
+S4 rsigned ARGS((int n, FILE * dvi));
+U4 runsigned ARGS((int n, FILE * dvi));
+
+COUNT wtable ARGS((op_table table, int opcode, FILE * dvi, FILE * dtl));
+
+COUNT setseq ARGS((int opcode, FILE * dvi, FILE * dtl));
+Void setpchar ARGS((int charcode, FILE * dtl));
+Void xferstring ARGS((int k, FILE * dvi, FILE * dtl));
+
+COUNT special ARGS((FILE * dvi, FILE * dtl, int n));
+COUNT fontdef ARGS((FILE * dvi, FILE * dtl, int n));
+COUNT preamble ARGS((FILE * dvi, FILE * dtl));
+COUNT postamble ARGS((FILE * dvi, FILE * dtl));
+COUNT postpost ARGS((FILE * dvi, FILE * dtl));
+
+
+String program; /* name of dv2dt program */
+
+int
+main
+#ifdef STDC
+ (int argc, char * argv[])
+#else
+ (argc, argv)
+ int argc;
+ char * argv[];
+#endif
+{
+ FILE * dvi = stdin;
+ FILE * dtl = stdout;
+
+ /* Watch out: C's standard library's string functions are dicey */
+ strncpy (program, argv[0], MAXSTRLEN);
+
+ if (argc > 1)
+ open_dvi (argv[1], &dvi);
+
+ if (argc > 2)
+ open_dtl (argv[2], &dtl);
+
+ dv2dt (dvi, dtl);
+
+ return 0; /* OK */
+}
+/* end main */
+
+int
+open_dvi
+#ifdef STDC
+ (char * dvi_file, FILE ** pdvi)
+#else
+ (dvi_file, pdvi)
+ char * dvi_file;
+ FILE ** pdvi;
+#endif
+/* I: dvi_file; I: pdvi; O: *pdvi. */
+{
+ if (pdvi == NULL)
+ {
+ fprintf (stderr, "%s: address of dvi variable is NULL.\n", program);
+ exit (1);
+ }
+
+ *pdvi = fopen (dvi_file, "rb");
+
+ if (*pdvi == NULL)
+ {
+ fprintf (stderr, "%s: Cannot open \"%s\" for binary reading.\n",
+ program, dvi_file);
+ exit (1);
+ }
+
+ return 1; /* OK */
+}
+/* open_dvi */
+
+int
+open_dtl
+#ifdef STDC
+ (char * dtl_file, FILE ** pdtl)
+#else
+ (dtl_file, pdtl)
+ char * dtl_file;
+ FILE ** pdtl;
+#endif
+/* I: dtl_file; I: pdtl; O: *pdtl. */
+{
+ if (pdtl == NULL)
+ {
+ fprintf (stderr, "%s: address of dtl variable is NULL.\n", program);
+ exit (1);
+ }
+
+ *pdtl = fopen (dtl_file, "w");
+
+ if (*pdtl == NULL)
+ {
+ fprintf (stderr, "%s: Cannot open \"%s\" for text writing.\n",
+ program, dtl_file);
+ exit (1);
+ }
+
+ return 1; /* OK */
+}
+/* open_dtl */
+
+int
+dv2dt
+#ifdef STDC
+ (FILE * dvi, FILE * dtl)
+#else
+ (dvi, dtl)
+ FILE * dvi;
+ FILE * dtl;
+#endif
+{
+ int opcode;
+ COUNT count; /* intended to count bytes to DVI file; as yet unused. */
+
+ PRINT_BCOM;
+ fprintf (dtl, "variety ");
+/* fprintf (dtl, BMES); */
+ fprintf (dtl, VARIETY);
+/* fprintf (dtl, EMES); */
+ PRINT_ECOM;
+ fprintf (dtl, "\n");
+
+ /* start counting DVI bytes */
+ count = 0;
+ while ((opcode = fgetc (dvi)) != EOF)
+ {
+ PRINT_BCOM; /* start of command and parameters */
+ if (opcode < 0 || opcode > 255)
+ {
+ count += 1;
+ fprintf (stderr, "%s: Non-byte from \"fgetc()\"!\n", program);
+ exit (1);
+ }
+ else if (opcode <= 127)
+ {
+ /* setchar commands */
+ /* count += 1; */
+ /* fprintf (dtl, "%s%d", SETCHAR, opcode); */
+ count +=
+ setseq (opcode, dvi, dtl);
+ }
+ else if (opcode >= 128 && opcode <= 170)
+ {
+ count +=
+ wtable (op_128_170, opcode, dvi, dtl);
+ }
+ else if (opcode >= 171 && opcode <= 234)
+ {
+ count += 1;
+ fprintf (dtl, "%s%d", FONTNUM, opcode - 171);
+ }
+ else if (opcode >= 235 && opcode <= 238)
+ {
+ count +=
+ wtable (fnt, opcode, dvi, dtl);
+ }
+ else if (opcode >= 239 && opcode <= 242)
+ {
+ count +=
+ special (dvi, dtl, opcode - 238);
+ }
+ else if (opcode >= 243 && opcode <= 246)
+ {
+ count +=
+ fontdef (dvi, dtl, opcode - 242);
+ }
+ else if (opcode == 247)
+ {
+ count +=
+ preamble (dvi, dtl);
+ }
+ else if (opcode == 248)
+ {
+ count +=
+ postamble (dvi, dtl);
+ }
+ else if (opcode == 249)
+ {
+ count +=
+ postpost (dvi, dtl);
+ }
+ else if (opcode >= 250 && opcode <= 255)
+ {
+ count += 1;
+ fprintf (dtl, "opcode%d", opcode);
+ }
+ else
+ {
+ count += 1;
+ fprintf (stderr, "%s: unknown byte.\n", program);
+ exit (1);
+ }
+ PRINT_ECOM; /* end of command and parameters */
+ fprintf (dtl, "\n");
+ if (fflush (dtl) == EOF)
+ {
+ fprintf (stderr, "%s: fflush on dtl file gave write error!\n", program);
+ exit (1);
+ }
+ } /* end while */
+
+ return 1; /* OK */
+}
+/* dv2dt */
+
+
+COUNT
+wunsigned
+#ifdef STDC
+ (int n, FILE * dvi, FILE * dtl)
+#else
+ (n, dvi, dtl)
+ int n;
+ FILE * dvi;
+ FILE * dtl;
+#endif
+{
+ U4 unum;
+
+ fprintf (dtl, " ");
+ unum = runsigned (n, dvi);
+ fprintf (dtl, UF4, unum);
+ return n;
+}
+/* end wunsigned */
+
+COUNT
+wsigned
+#ifdef STDC
+ (int n, FILE * dvi, FILE * dtl)
+#else
+ (n, dvi, dtl)
+ int n;
+ FILE * dvi;
+ FILE * dtl;
+#endif
+{
+ S4 snum;
+
+ fprintf (dtl, " ");
+ snum = rsigned (n, dvi);
+ fprintf (dtl, SF4, snum);
+ return n;
+}
+/* end wsigned */
+
+U4
+runsigned
+#ifdef STDC
+ (int n, FILE * dvi)
+#else
+ (n, dvi)
+ int n;
+ FILE * dvi;
+#endif
+/* read 1 <= n <= 4 bytes for an unsigned integer from dvi file */
+/* DVI format uses Big-endian storage of numbers. */
+{
+ U4 integer;
+ int ibyte = 0;
+ int i;
+
+ if (n < 1 || n > 4)
+ {
+ fprintf (stderr,
+ "%s: runsigned() asked for %d bytes. Must be 1 to 4.\n", program, n);
+ exit (1);
+ }
+
+ /* Following calculation works iff storage is big-endian. */
+ integer = 0;
+ for (i = 0; i < n; i++)
+ {
+ integer *= 256;
+ ibyte = fgetc (dvi);
+ integer += ibyte;
+ }
+
+ return integer;
+}
+/* end runsigned */
+
+S4
+rsigned
+#ifdef STDC
+ (int n, FILE * dvi)
+#else
+ (n, dvi)
+ int n;
+ FILE * dvi;
+#endif
+/* read 1 <= n <= 4 bytes for a signed integer from dvi file */
+/* DVI format uses Big-endian storage of numbers. */
+{
+ S4 integer;
+ int ibyte = 0;
+ int i;
+
+ if (n < 1 || n > 4)
+ {
+ fprintf (stderr,
+ "%s: rsigned() asked for %d bytes. Must be 1 to 4.\n", program, n);
+ exit (1);
+ }
+
+ /* Following calculation works iff storage is big-endian. */
+ integer = 0;
+ for (i = 0; i < n; i++)
+ {
+ integer *= 256;
+ ibyte = fgetc (dvi);
+ /* Big-endian implies sign byte is first byte. */
+ if (i == 0 && ibyte >= 128)
+ {
+ ibyte -= 256;
+ }
+ integer += ibyte;
+ }
+
+ return integer;
+}
+/* end rsigned */
+
+COUNT
+wtable
+#ifdef STDC
+ (op_table table, int opcode, FILE * dvi, FILE * dtl)
+#else
+ (table, opcode, dvi, dtl)
+ op_table table;
+ int opcode;
+ FILE * dvi;
+ FILE * dtl;
+#endif
+/* write command with given opcode in given table */
+/* return number of DVI bytes in this command */
+{
+ op_info op; /* pointer into table of operations and arguments */
+ COUNT bcount = 0; /* number of bytes in arguments of this opcode */
+ String args; /* arguments string */
+ int i; /* count of arguments read from args */
+ int pos; /* position in args */
+
+ /* Defensive programming. */
+ if (opcode < table.first || opcode > table.last)
+ {
+ fprintf (stderr,
+ "%s: opcode %d is outside table %s [ %d to %d ] !\n",
+ program, opcode, table.name, table.first, table.last);
+ exit (1);
+ }
+
+ op = table.list [opcode - table.first];
+
+ /* Further defensive programming. */
+ if (op.code != opcode)
+ {
+ fprintf (stderr, "%s: internal table %s wrong!\n", program, table.name);
+ exit (1);
+ }
+
+ bcount = 1;
+ fprintf (dtl, "%s", op.name);
+
+ /* NB: sscanf does an ungetc, */
+ /* so args must be writable. */
+
+ strncpy (args, op.args, MAXSTRLEN);
+
+ pos = 0;
+ for (i = 0; i < op.nargs; i++)
+ {
+ int argtype; /* sign and number of bytes in current argument */
+ int nconv; /* number of successful conversions from args */
+ int nread; /* number of bytes read from args */
+
+ nconv = sscanf (args + pos, "%d%n", &argtype, &nread);
+
+ /* internal consistency checks */
+ if (nconv != 1 || nread <= 0)
+ {
+ fprintf (stderr,
+ "%s: internal read of table %s failed!\n", program, table.name);
+ exit (1);
+ }
+
+ pos += nread;
+
+ bcount += ( argtype < 0 ?
+ wsigned (-argtype, dvi, dtl) :
+ wunsigned (argtype, dvi, dtl) ) ;
+ } /* end for */
+
+ return bcount;
+
+}
+/* wtable */
+
+COUNT
+setseq
+#ifdef STDC
+ (int opcode, FILE * dvi, FILE * dtl)
+#else
+ (opcode, dvi, dtl)
+ int opcode;
+ FILE * dvi;
+ FILE * dtl;
+#endif
+/* write a sequence of setchar commands */
+/* return count of DVI bytes interpreted into DTL */
+{
+ int charcode = opcode; /* fortuitous */
+ int ccount = 0;
+
+ if (!isprint (charcode))
+ {
+ ccount = 1;
+ fprintf (dtl, "%s%02X", SETCHAR, opcode);
+ }
+ else
+ {
+ /* start of sequence of font characters */
+ fprintf (dtl, BSEQ);
+
+ /* first character */
+ ccount = 1;
+ setpchar (charcode, dtl);
+
+ /* subsequent characters */
+ while ((opcode = fgetc (dvi)) != EOF)
+ {
+ if (opcode < 0 || opcode > 127)
+ {
+ break; /* not a setchar command, so sequence has ended */
+ }
+ charcode = opcode; /* fortuitous */
+ if (!isprint (charcode)) /* not printable ascii */
+ {
+ break; /* end of font character sequence, as for other commands */
+ }
+ else /* printable ASCII */
+ {
+ ccount += 1;
+ setpchar (charcode, dtl);
+ }
+ } /* end for loop */
+
+ /* prepare to reread opcode of next DVI command */
+ if (ungetc (opcode, dvi) == EOF)
+ {
+ fprintf (stderr, "setseq: cannot push back a byte\n");
+ exit (1);
+ }
+
+ /* end of sequence of font characters */
+ fprintf (dtl, ESEQ);
+ }
+ return ccount;
+}
+/* setseq */
+
+Void
+setpchar
+#ifdef STDC
+ (int charcode, FILE * dtl)
+#else
+ (charcode, dtl)
+ int charcode;
+ FILE * dtl;
+#endif
+/* set printable character */
+{
+ switch (charcode)
+ {
+ case ESC_CHAR:
+ fprintf (dtl, "%c", ESC_CHAR);
+ fprintf (dtl, "%c", ESC_CHAR);
+ break;
+ case QUOTE_CHAR:
+ fprintf (dtl, "%c", ESC_CHAR);
+ fprintf (dtl, "%c", QUOTE_CHAR);
+ break;
+ case BSEQ_CHAR:
+ fprintf (dtl, "%c", ESC_CHAR);
+ fprintf (dtl, "%c", BSEQ_CHAR);
+ break;
+ case ESEQ_CHAR:
+ fprintf (dtl, "%c", ESC_CHAR);
+ fprintf (dtl, "%c", ESEQ_CHAR);
+ break;
+ default:
+ fprintf (dtl, "%c", charcode);
+ break;
+ }
+}
+/* setpchar */
+
+Void
+xferstring
+#ifdef STDC
+ (int k, FILE * dvi, FILE * dtl)
+#else
+ (k, dvi, dtl)
+ int k;
+ FILE * dvi;
+ FILE * dtl;
+#endif
+/* copy string of k characters from dvi file to dtl file */
+{
+ int i;
+ int ch;
+
+ fprintf (dtl, " ");
+ fprintf (dtl, "'");
+ for (i=0; i < k; i++)
+ {
+ ch = fgetc (dvi);
+ if (ch == ESC_CHAR || ch == EMES_CHAR)
+ {
+ fprintf (dtl, "%c", ESC_CHAR);
+ }
+ fprintf (dtl, "%c", ch);
+ }
+ fprintf (dtl, "'");
+}
+/* xferstring */
+
+COUNT
+special
+#ifdef STDC
+ (FILE * dvi, FILE * dtl, int n)
+#else
+ (dvi, dtl, n)
+ FILE * dvi;
+ FILE * dtl;
+ int n;
+#endif
+/* read special 1 .. 4 from dvi and write in dtl */
+/* return number of DVI bytes interpreted into DTL */
+{
+ U4 k;
+
+ if (n < 1 || n > 4)
+ {
+ fprintf (stderr, "%s: special %d, range is 1 to 4.\n", program, n);
+ exit (1);
+ }
+
+ fprintf (dtl, "%s%d", SPECIAL, n);
+
+ /* k[n] = length of special string */
+ fprintf (dtl, " ");
+ k = runsigned (n, dvi);
+ fprintf (dtl, UF4, k);
+
+ /* x[k] = special string */
+ xferstring (k, dvi, dtl);
+
+ return (1 + n + k);
+}
+/* end special */
+
+COUNT
+fontdef
+#ifdef STDC
+ (FILE * dvi, FILE * dtl, int n)
+#else
+ (dvi, dtl, n)
+ FILE * dvi;
+ FILE * dtl;
+ int n;
+#endif
+/* read fontdef 1 .. 4 from dvi and write in dtl */
+/* return number of DVI bytes interpreted into DTL */
+{
+ U4 ku, c, s, d, a, l;
+ S4 ks;
+
+ if (n < 1 || n > 4)
+ {
+ fprintf (stderr, "%s: font def %d, range is 1 to 4.\n", program, n);
+ exit (1);
+ }
+
+ fprintf (dtl, "%s%d", FONTDEF, n);
+
+ /* k[n] = font number */
+ fprintf (dtl, " ");
+ if (n == 4)
+ {
+ ks = rsigned (n, dvi);
+ fprintf (dtl, SF4, ks);
+ }
+ else
+ {
+ ku = runsigned (n, dvi);
+ fprintf (dtl, UF4, ku);
+ }
+
+ /* c[4] = checksum */
+ fprintf (dtl, " ");
+ c = runsigned (4, dvi);
+#ifdef HEX_CHECKSUM
+ fprintf (dtl, XF4, c);
+#else /* NOT HEX_CHECKSUM */
+ /* write in octal, to allow quick comparison with tftopl's output */
+ fprintf (dtl, OF4, c);
+#endif
+
+ /* s[4] = scale factor */
+ fprintf (dtl, " ");
+ s = runsigned (4, dvi);
+ fprintf (dtl, UF4, s);
+
+ /* d[4] = design size */
+ fprintf (dtl, " ");
+ d = runsigned (4, dvi);
+ fprintf (dtl, UF4, d);
+
+ /* a[1] = length of area (directory) name */
+ a = runsigned (1, dvi);
+ fprintf (dtl, " ");
+ fprintf (dtl, UF4, a);
+
+ /* l[1] = length of font name */
+ l = runsigned (1, dvi);
+ fprintf (dtl, " ");
+ fprintf (dtl, UF4, l);
+
+ /* n[a+l] = font pathname string => area (directory) + font */
+ xferstring (a, dvi, dtl);
+ xferstring (l, dvi, dtl);
+
+ return (1 + n + 4 + 4 + 4 + 1 + 1 + a + l);
+}
+/* end fontdef */
+
+COUNT
+preamble
+#ifdef STDC
+ (FILE * dvi, FILE * dtl)
+#else
+ (dvi, dtl)
+ FILE * dvi;
+ FILE * dtl;
+#endif
+/* read preamble from dvi and write in dtl */
+/* return number of DVI bytes interpreted into DTL */
+{
+ U4 id, num, den, mag, k;
+
+ fprintf (dtl, "pre");
+
+ /* i[1] = DVI format identification */
+ fprintf (dtl, " ");
+ id = runsigned (1, dvi);
+ fprintf (dtl, UF4, id);
+
+ /* num[4] = numerator of DVI unit */
+ fprintf (dtl, " ");
+ num = runsigned (4, dvi);
+ fprintf (dtl, UF4, num);
+
+ /* den[4] = denominator of DVI unit */
+ fprintf (dtl, " ");
+ den = runsigned (4, dvi);
+ fprintf (dtl, UF4, den);
+
+ /* mag[4] = 1000 x magnification */
+ fprintf (dtl, " ");
+ mag = runsigned (4, dvi);
+ fprintf (dtl, UF4, mag);
+
+ /* k[1] = length of comment */
+ fprintf (dtl, " ");
+ k = runsigned (1, dvi);
+ fprintf (dtl, UF4, k);
+
+ /* x[k] = comment string */
+ xferstring (k, dvi, dtl);
+
+ return (1 + 1 + 4 + 4 + 4 + 1 + k);
+}
+/* end preamble */
+
+COUNT
+postamble
+#ifdef STDC
+ (FILE * dvi, FILE * dtl)
+#else
+ (dvi, dtl)
+ FILE * dvi;
+ FILE * dtl;
+#endif
+/* read postamble from dvi and write in dtl */
+/* return number of bytes */
+{
+ U4 p, num, den, mag, l, u, s, t;
+
+ fprintf (dtl, "post");
+
+ /* p[4] = pointer to final bop */
+ fprintf (dtl, " ");
+ p = runsigned (4, dvi);
+ fprintf (dtl, UF4, p);
+
+ /* num[4] = numerator of DVI unit */
+ fprintf (dtl, " ");
+ num = runsigned (4, dvi);
+ fprintf (dtl, UF4, num);
+
+ /* den[4] = denominator of DVI unit */
+ fprintf (dtl, " ");
+ den = runsigned (4, dvi);
+ fprintf (dtl, UF4, den);
+
+ /* mag[4] = 1000 x magnification */
+ fprintf (dtl, " ");
+ mag = runsigned (4, dvi);
+ fprintf (dtl, UF4, mag);
+
+ /* l[4] = height + depth of tallest page */
+ fprintf (dtl, " ");
+ l = runsigned (4, dvi);
+ fprintf (dtl, UF4, l);
+
+ /* u[4] = width of widest page */
+ fprintf (dtl, " ");
+ u = runsigned (4, dvi);
+ fprintf (dtl, UF4, u);
+
+ /* s[2] = maximum stack depth */
+ fprintf (dtl, " ");
+ s = runsigned (2, dvi);
+ fprintf (dtl, UF4, s);
+
+ /* t[2] = total number of pages (bop commands) */
+ fprintf (dtl, " ");
+ t = runsigned (2, dvi);
+ fprintf (dtl, UF4, t);
+
+/* return (29); */
+ return (1 + 4 + 4 + 4 + 4 + 4 + 4 + 2 + 2);
+}
+/* end postamble */
+
+COUNT
+postpost
+#ifdef STDC
+ (FILE * dvi, FILE * dtl)
+#else
+ (dvi, dtl)
+ FILE * dvi;
+ FILE * dtl;
+#endif
+/* read post_post from dvi and write in dtl */
+/* return number of bytes */
+{
+ U4 q, id;
+ int b223; /* hope this is 8-bit clean */
+ int n223; /* number of "223" bytes in final padding */
+
+ fprintf (dtl, "post_post");
+
+ /* q[4] = pointer to post command */
+ fprintf (dtl, " ");
+ q = runsigned (4, dvi);
+ fprintf (dtl, UF4, q);
+
+ /* i[1] = DVI identification byte */
+ fprintf (dtl, " ");
+ id = runsigned (1, dvi);
+ fprintf (dtl, UF4, id);
+
+ /* final padding by "223" bytes */
+ /* hope this way of obtaining b223 is 8-bit clean */
+ for (n223 = 0; (b223 = fgetc (dvi)) == 223; n223++)
+ {
+ fprintf (dtl, " ");
+ fprintf (dtl, "%d", 223);
+ }
+ if (n223 < 4)
+ {
+ fprintf (stderr,
+ "%s: bad post_post: fewer than four \"223\" bytes.\n", program);
+ exit (1);
+ }
+ if (b223 != EOF)
+ {
+ fprintf (stderr,
+ "%s: bad post_post: doesn't end with a \"223\".\n", program);
+ exit (1);
+ }
+
+ return (1 + 4 + 1 + n223);
+}
+/* end postpost */
+
+/* end of "dv2dt.c" */
--- /dev/null
+.\" This file is public domain.
+.\" Originally written 1995, Geoffrey Tobin.
+.\" The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+.\" This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+.\" ====================================================================
+.\" @Troff-man-file{
+.\" author = "Nelson H. F. Beebe and Geoffrey Tobin",
+.\" version = "0.6.0",
+.\" date = "08 March 1995",
+.\" time = "19:52:00 GMT +11",
+.\" filename = "dv2dt.man",
+.\" address = "Center for Scientific Computing
+.\" Department of Mathematics
+.\" University of Utah
+.\" Salt Lake City, UT 84112
+.\" USA",
+.\" telephone = "+1 801 581 5254",
+.\" FAX = "+1 801 581 4148",
+.\" checksum = "32328 715 2191 12898",
+.\" email = "beebe@math.utah.edu (Internet)",
+.\" codetable = "ISO/ASCII",
+.\" keywords = "DVI, TeX",
+.\" supported = "no",
+.\" docstring = "This file contains the UNIX manual pages
+.\" for the dv2dt utility, a program for
+.\" converting a binary TeX DVI file to an
+.\" editable text representation in DTL (DVI Text
+.\" Language). The companion dt2dv utility can
+.\" convert the output DTL file back to a binary
+.\" DVI file.
+.\"
+.\" The checksum field above contains a CRC-16
+.\" checksum as the first value, followed by the
+.\" equivalent of the standard UNIX wc (word
+.\" count) utility output of lines, words, and
+.\" characters. This is produced by Robert
+.\" Solovay's checksum utility.",
+.\" }
+.\" ====================================================================
+.if t .ds Te T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
+.if n .ds Te TeX
+.if t .ds Xe X\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'T
+.if n .ds Xe XeT
+.TH DV2DT 1 "08 March 1995" "Version 0.6.0"
+.\"======================================================================
+.SH NAME
+dv2dt \- convert a binary TeX DVI file to DTL text representation
+.\"======================================================================
+.SH SYNOPSIS
+.B dv2dt
+.I input-DVI-file
+.I output-DTL-file
+.PP
+If the filenames are omitted, then
+.I stdin
+and
+.I stdout
+are assumed.
+.\"======================================================================
+.SH DESCRIPTION
+.B dv2dt
+converts a binary \*(Te\& DVI file to an editable
+text file in DTL
+.RI ( "DVI Text Language" )
+format. The companion
+.BR dt2dv (1)
+utility can convert the DTL file back to a binary
+DVI file.
+.\"======================================================================
+.SH "DVI COMMAND DESCRIPTION"
+\*(Te\& DVI files contain a compact binary
+description of typeset pages, as a stream of
+operation code bytes, each immediately followed by
+zero or more parameter bytes. The format of DVI
+files is fully described in Donald E. Knuth,
+.IR "\*(Te\&: The Program" ,
+Addison-Wesley (1986), ISBN 0-201-13437-3, as well
+as in the
+.BR dvitype (1)
+literate program source code.
+.PP
+For convenience, we provide a summary of DVI
+commands here. In the following list, operation
+code bytes are given as unsigned decimal values,
+followed by their symbolic names (not present in
+the DVI file), and a short description. A
+designation like
+.I b[+n]
+means that the operation code byte is followed by
+a parameter
+.I b
+which uses
+.I n
+bytes, and is signed. Without the plus sign, the
+parameter is unsigned. Signed integer parameter
+values are always represented in two's complement
+arithmetic, which is the system followed by most
+computers manufactured today, including all
+personal computers and workstations.
+.if n .TP \w'\fI128_set1__c[1]\fP'u+3n
+.if t .TP \w'\fI243_fnt_def1__k[1]_c[4]_s[4]_d[4]_a[1]_l[1]_n[a+l]\fP'u+3n
+.I "0 set_char_0"
+Set character 0 from current font.
+.TP
+.I .\|.\|.
+.TP
+.I "127 set_char_127"
+Set character 127 from current font.
+.TP
+.I "128 set1 c[1]"
+Set 1-byte unsigned character (uchar) number
+.IR c .
+.TP
+.I "129 set2 c[2]"
+Set 2-byte uchar number
+.IR c .
+.TP
+.I "130 set3 c[3]"
+Set 3-byte uchar number
+.IR c .
+.TP
+.I "131 set4 c[+4]"
+Set 4-byte signed character (schar) number
+.IR c .
+.TP
+.I "132 set_rule a[+4] b[+4]"
+Set rule, height
+.IR a ,
+width
+.IR b .
+.TP
+.I "133 put1 c[1]"
+Put 1-byte uchar
+.IR c .
+.TP
+.I "134 put2 c[2]"
+Put 2-byte uchar
+.IR c .
+.TP
+.I "135 put3 c[3]"
+Put 3-byte uchar
+.IR c .
+.TP
+.I "136 put4 c[+4]"
+Put 4-byte schar
+.IR c .
+.TP
+.I "137 put_rule a[+4] b[+4]"
+Put rule, height
+.IR a ,
+width
+.IR b .
+.TP
+.I "138 nop"
+Do nothing.
+.TP
+.I "139 bop c0[+4] .\|.\|. c9[+4] p[+4]"
+Beginning of page. The parameters
+.I "c0 .\|.\|. c9"
+are the \*(Te\& page counters, the contents of
+\*(Te\& count registers
+.IR "\ecount0 .\|.\|. \ecount9" .
+The parameter
+.I p
+is the byte offset from the beginning of the DVI
+file of the previous
+.I bop
+operation code byte. The first such command in
+the file has
+.IR "p = \-1" .
+.TP
+.I "140 eop"
+End of page.
+.TP
+.I "141 push"
+Push
+.RI ( h,v,w,x,y,z )
+onto stack.
+.TP
+.I "142 pop"
+Pop
+.RI ( h,v,w,x,y,z )
+from stack.
+.TP
+.I "143 right1 b[+1]"
+Move right
+.I b
+units.
+.TP
+.I "144 right2 b[+2]"
+Move right
+.I b
+units.
+.TP
+.I "145 right3 b[+3]"
+Move right
+.I b
+units.
+.TP
+.I "146 right4 b[+4]"
+Move right
+.I b
+units.
+.TP
+.I "147 w0"
+Move right
+.I w
+units.
+.TP
+.I "148 w1 b[+1]"
+Move right
+.I b
+units, and set
+.IR "w = b" .
+.TP
+.I "149 w2 b[+2]"
+Move right
+.I b
+units, and set
+.IR "w = b" .
+.TP
+.I "150 w3 b[+3]"
+Move right
+.I b
+units, and set
+.IR "w = b" .
+.TP
+.I "151 w4 b[+4]"
+Move right
+.I b
+units, and set
+.IR "w = b" .
+.TP
+.I "152 x0"
+Move right
+.I x
+units.
+.TP
+.I "153 x1 b[+1]"
+Move right
+.I b
+units, and set
+.IR "x = b" .
+.TP
+.I "154 x2 b[+2]"
+Move right
+.I b
+units, and set
+.IR "x = b" .
+.TP
+.I "155 x3 b[+3]"
+Move right
+.I b
+units, and set
+.IR "x = b" .
+.TP
+.I "156 x4 b[+4]"
+Move right
+.I b
+units, and set
+.IR "x = b" .
+.TP
+.I "157 down1 a[+1]"
+Move down
+.I a
+units.
+.TP
+.I "158 down2 a[+2]"
+Move down
+.I a
+units.
+.TP
+.I "159 down3 a[+3]"
+Move down
+.I a
+units.
+.TP
+.I "160 down4 a[+4]"
+Move down
+.I a
+units.
+.TP
+.I "161 y0"
+Move right
+.I y
+units.
+.TP
+.I "162 y1 a[+1]"
+Move right
+.I a
+units, and set
+.IR "y = a" .
+.TP
+.I "163 y2 a[+2]"
+Move right
+.I a
+units, and set
+.IR "y = a" .
+.TP
+.I "164 y3 a[+3]"
+Move right
+.I a
+units, and set
+.IR "y = a" .
+.TP
+.I "165 y4 a[+4]"
+Move right
+.I a
+units, and set
+.IR "y = a" .
+.TP
+.I "166 z0"
+Move right
+.I z
+units.
+.TP
+.I "167 z1 a[+1]"
+Move right
+.I a
+units, and set
+.IR "z = a" .
+.TP
+.I "168 z2 a[+2]"
+Move right
+.I a
+units, and set
+.IR "z = a" .
+.TP
+.I "169 z3 a[+3]"
+Move right
+.I a
+units, and set
+.IR "z = a" .
+.TP
+.I "170 z4 a[+4]"
+Move right
+.I a
+units, and set
+.IR "z = a" .
+.TP
+.I "171 fnt_num_0"
+Set current font number
+.IR "(f) = 0" .
+.TP
+.I .\|.\|.
+.TP
+.I "234 fnt_num_63"
+Set
+.IR "f = 63" .
+.TP
+.I "235 fnt1 k[1]"
+Set
+.IR "f = k" .
+.TP
+.I "236 fnt2 k[2]"
+Set
+.IR "f = k" .
+.TP
+.I "237 fnt3 k[3]"
+Set
+.IR "f = k" .
+.TP
+.I "238 fnt4 k[+4]"
+Set
+.IR "f = k" .
+.TP
+.I "239 xxx1 k[1] x[k]"
+Special string
+.I x
+with
+.I k
+bytes.
+.TP
+.I "240 xxx2 k[2] x[k]"
+Special string
+.I x
+with
+.I k
+bytes.
+.TP
+.I "241 xxx3 k[3] x[k]"
+Special string
+.I x
+with
+.I k
+bytes.
+.TP
+.I "242 xxx4 k[4] x[k]"
+Special string
+.I x
+with (unsigned)
+.I k
+bytes.
+.TP
+.I "243 fnt_def1 k[1] c[4] s[4] d[4] a[1] l[1] n[a+l]"
+Define font
+.IR k .
+The parameters are:
+.RS
+.TP \w'\fIm\fP'u+3n
+.I c
+Checksum for TFM file.
+.TP
+.I s
+Scale factor, in DVI units.
+.TP
+.I d
+Design size, in DVI units.
+.TP
+.I a
+Length of the ``area'' or directory.
+.TP
+.I l
+Length of the font name.
+.TP
+.I n
+Area and font name string(s).
+.RE
+.TP
+.I "244 fnt_def2 k[2] c[4] s[4] d[4] a[1] l[1] n[a+l]"
+Define font
+.IR k .
+.TP
+.I "245 fnt_def3 k[3] c[4] s[4] d[4] a[1] l[1] n[a+l]"
+Define font
+.IR k .
+.TP
+.I "246 fnt_def4 k[+4] c[4] s[4] d[4] a[1] l[1] n[a+l]"
+Define font
+.IR k .
+.TP
+.I "247 pre i[1] num[4] den[4] mag[4] k[1] x[k]"
+Begin preamble. The parameters are:
+.RS
+.TP \w'\fInum\fP'u+3n
+.I i
+DVI format. Standard \*(Te\& has
+.IR "ID = 2" ,
+and \*(Te\&-\*(Xe\& has
+.IR "ID = 3" .
+.TP
+.I num
+Numerator of 100 nm / DVI unit.
+.TP
+.I den
+Denominator of 100 nm / DVI unit.
+.TP
+.I mag
+1000 * magnification.
+.TP
+.I k
+Comment length.
+.TP
+.I x
+Comment string.
+.RE
+.TP
+.I "248 post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2]"
+Begin postamble. The parameters are:
+.RS
+.TP \w'\fInum\fP'u+3n
+.I p
+Pointer to final bop.
+.TP
+.I "num, den, mag"
+Duplicates of values in preamble.
+.TP
+.I l
+Height-plus-depth of tallest page, in DVI units.
+.TP
+.I u
+Width of widest page, in DVI units.
+.TP
+.I s
+Maximum stack depth needed to process this DVI file.
+.TP
+.I t
+Total number of pages
+.RI ( bop
+commands) present.
+.RE
+.TP
+.I "249 post_post q[4] i[1] 223 .\|.\|. 223"
+End postamble. The parameters are:
+.RS
+.TP \w'\fI223\fP'u+3n
+.I q
+Byte offset from the beginning of the DVI file to
+the
+.I post
+command that started the postamble.
+.TP
+.I i
+DVI format ID, as in the preamble.
+.TP
+.I
+223
+At least four
+.I 223
+bytes.
+.RE
+.TP
+.I "250"
+Undefined.
+.TP
+.I .\|.\|.
+.TP
+.I "255"
+Undefined.
+.\"======================================================================
+.SH "DTL COMMAND DESCRIPTION"
+A DTL file contains one line per command, with a
+limit of 1024 characters per line. Each command
+contains a symbolic operation name, followed by
+zero or more parameter values. The parameter
+value descriptions are not repeated here; they can
+be found in the previous section.
+.TP \w'\fIw0,_w1,_w2,_w3,_w4\fP'u+3n
+variety <variety-name>
+This command specifies the name of the DTL file
+type; it has no DVI file equivalent.
+.TP
+.I (text)
+Series of set_char commands, for printable ASCII text.
+.TP
+.I \e(
+Literal ASCII left parenthesis in (text).
+.TP
+.I \e)
+Literal ASCII right parenthesis in (text).
+.TP
+.I \e\e
+Literal ASCII backslash in (text).
+.TP
+.I \e"
+Literal ASCII double quote in (text).
+.TP
+.I \eXY
+Set_char for character with hexadecimal code XY,
+not in parentheses, but by itself for readability.
+.TP
+.I "s1, s2, s2, s3"
+Set, with (1,2,3,4)-byte charcodes.
+.TP
+.I sr
+.IR set_rule .
+.TP
+.I "p1, p2, p2, p3"
+Put, with (1,2,3,4)-byte charcodes.
+.TP
+.I pr
+.IR put_rule .
+.TP
+.I nop
+.I nop
+(do nothing).
+.TP
+.I bop
+.I bop
+(beginning of page).
+.TP
+.I eop
+.I eop
+(end of page).
+.TP
+.I [
+Push.
+.TP
+.I ]
+Pop.
+.TP
+.I "r1, r2, r3, r4"
+Right, with (1,2,3,4)-byte argument.
+.TP
+.I "w0, w1, w2, w3, w4"
+As in DVI.
+.TP
+.I "x0, x1, x2, x3, x4"
+As in DVI.
+.TP
+.I "d1, d2, d3, d4"
+Down, with (1,2,3,4)-byte argument.
+.TP
+.I "y0, y1, y2, y3, y4"
+As in DVI.
+.TP
+.I "z0, z1, z2, z3, z4"
+As in DVI.
+.TP
+.I fn
+.I fnt_num
+(set current font to font number in 0 to 63).
+.TP
+.I "f1, f2, f3, f4"
+.I fnt
+(set current font to (1,2,3,4)-byte font number).
+.TP
+.I special
+.I xxx
+(special commands with (1,2,3,4)-byte string length).
+.TP
+.I fd
+.I fnt_def
+(assign a number to a named font).
+.TP
+.I pre
+Preamble.
+.TP
+.I post
+.I post
+(begin postamble).
+.TP
+.I post_post
+.I post_post
+(end postamble).
+.TP
+.I opcode
+Undefined DVI command (250 to 255).
+.\"======================================================================
+.SH "SAMPLE DTL FILE"
+The following 2-line \*(Te\& file
+.RS
+.nf
+Hello.
+\ebye
+.fi
+.RE
+when processed with the commands
+.RS
+.nf
+tex hello.tex
+dv2dt hello.dvi hello.dtl
+.fi
+.RE
+produces this DTL file:
+.RS
+.nf
+variety sequences-6
+pre 2 25400000 473628672 1000 27 ' TeX output 1995.03.02:2334'
+bop 1 0 0 0 0 0 0 0 0 0 -1
+[
+d3 -917504
+]
+d4 42152922
+[
+d4 -41497562
+[
+r3 1310720
+fd1 0 11374260171 655360 655360 0 5 '' 'cmr10'
+fn0
+(Hello.)
+]
+]
+d3 1572864
+[
+r4 15229091
+(1)
+]
+eop
+post 42 25400000 473628672 1000 43725786 30785863 2 1
+fd1 0 11374260171 655360 655360 0 5 'cmr10'
+post_post 152 2 223 223 223 223
+.fi
+.RE
+The command
+.RS
+.nf
+dt2dv hello.dtl hello.dvi
+.fi
+.RE
+will reconstruct the original DVI file.
+.\"======================================================================
+.SH "SEE ALSO"
+.BR dt2dv (1),
+.BR dvitype (1),
+.BR tex (1).
+.\"======================================================================
+.SH FILES
+.TP \w'\fI*.dvi\fP'u+3n
+.I *.dvi
+binary \*(Te\& DVI file.
+.TP
+.I *.dtl
+text representation of a \*(Te\& DVI file in
+.I "DVI Text Language"
+format.
+.\"======================================================================
+.SH AUTHOR
+.B dv2dt
+and
+.BR dt2dv (1)
+were written by
+.RS
+.nf
+Geoffrey Tobin
+Department of Electronic Engineering
+La Trobe University
+Bundoora, Victoria 3083
+Australia
+Tel: +61 3 479 3736
+FAX: +61 3 479 3025
+Email: <G.Tobin@ee.latrobe.edu.au>
+.fi
+.RE
+.PP
+These manual pages were primarily written by
+.RS
+.nf
+Nelson H. F. Beebe, Ph.D.
+Center for Scientific Computing
+Department of Mathematics
+University of Utah
+Salt Lake City, UT 84112
+Tel: +1 801 581 5254
+FAX: +1 801 581 4148
+Email: <beebe@math.utah.edu>
+.fi
+.RE
+.\"==============================[The End]==============================
--- /dev/null
+This file is public domain.
+Originally written 1995, Geoffrey Tobin.
+The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+``dvi.doc''
+Mon 27 Feb 1995
+Geoffrey Tobin
+
+Description of the DVI file structure.
+--------------------------------------
+
+Reference:
+----------
+
+ CTAN: dviware/driv-standard/level-0/dvistd0.tex
+
+ "The DVI Driver Standard, Level 0",
+ by The TUG DVI Driver Standards Committee (now defunct)
+ chaired by Joachim Schrod.
+ Appendix A, "Device-Independent File Format",
+ section A.2, "Summary of DVI commands".
+
+
+DVI Commands
+------------
+Listed in the free format:
+"Opcode Symbol Parameter[Signed? Bytes] ... Action".
+
+
+ 0 set_char_0 - set character 0 from current font
+ ...
+ 127 set_char_127 - set character 127 from current font
+
+ 128 set1 c[1] - set 1-byte unsigned character (uchar) number c
+ 129 set2 c[2] - set 2-byte uchar number c
+ 130 set3 c[3] - set 3-byte uchar number c
+ 131 set4 c[+4] - set 4-byte signed character (schar) number c
+
+ 132 set_rule a[+4] b[+4] - set rule, height a, width b
+
+ 133 put1 c[1] - put 1-byte uchar c
+ 134 put2 c[2] - put 2-byte uchar
+ 135 put3 c[3] - put 3-byte uchar
+ 136 put4 c[+4] - put 4-byte schar
+
+ 137 put_rule a[+4] b[+4] - put rule, height a, width b
+
+ 138 nop - do nothing
+
+ 139 bop c0[+4] ... c9[+4] p[+4] - beginning of page
+ 140 eop - end of page
+
+ 141 push - push (h,v,w,x,y,z) onto stack
+ 142 pop - pop (h,v,w,x,y,z) from stack
+
+ 143 right1 b[+1] - move right b units
+ 144 right2 b[+2] - move right b units
+ 145 right3 b[+3] - move right b units
+ 146 right4 b[+4] - move right b units
+
+ 147 w0 - move right w units
+ 148 w1 b[+1] - move right b units, and set w = b
+ 149 w2 b[+2] - move right b units, and set w = b
+ 150 w3 b[+3] - move right b units, and set w = b
+ 151 w4 b[+4] - move right b units, and set w = b
+
+ 152 x0 - move right x units
+ 153 x1 b[+1] - move right b units, and set x = b
+ 154 x2 b[+2] - move right b units, and set x = b
+ 155 x3 b[+3] - move right b units, and set x = b
+ 156 x4 b[+4] - move right b units, and set x = b
+
+ 157 down1 a[+1] - move down a units
+ 158 down2 a[+2] - move down a units
+ 159 down3 a[+3] - move down a units
+ 160 down4 a[+4] - move down a units
+
+ 161 y0 - move right y units
+ 162 y1 a[+1] - move right a units, and set y = a
+ 163 y2 a[+2] - move right a units, and set y = a
+ 164 y3 a[+3] - move right a units, and set y = a
+ 165 y4 a[+4] - move right a units, and set y = a
+
+ 166 z0 - move right z units
+ 167 z1 a[+1] - move right a units, and set z = a
+ 168 z2 a[+2] - move right a units, and set z = a
+ 169 z3 a[+3] - move right a units, and set z = a
+ 170 z4 a[+4] - move right a units, and set z = a
+
+ 171 fnt_num_0 - set current font number (f) = 0
+ ...
+ 234 fnt_num_63 - set f = 63
+
+ 235 fnt1 k[1] - set f = k
+ 236 fnt2 k[2] - set f = k
+ 237 fnt3 k[3] - set f = k
+ 238 fnt4 k[+4] - set f = k
+
+ 239 xxx1 k[1] x[k] - special string x with k bytes
+ 240 xxx2 k[2] x[k] - special string x with k bytes
+ 241 xxx3 k[3] x[k] - special string x with k bytes
+ 242 xxx4 k[4] x[k] - special string x with (unsigned) k bytes
+
+ 243 fnt_def1 k[1] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
+ 244 fnt_def2 k[2] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
+ 245 fnt_def3 k[3] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
+ 246 fnt_def4 k[+4] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
+
+ 247 pre i[1] num[4] den[4] mag[4] k[1] x[k] - begin preamble
+
+ 248 post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2] - begin postamble
+ 249 post_post q[4] i[1] 223 ... 223 - end postamble
+
+ 250 - undefined
+ ...
+ 255 - undefined
+
+In bop:
+
+ c0[+4] ... c9[+4] = page counters, \`a la TeX.
+ p[+4] = pointer to previous bop (its byte address); first bop has p = -1 .
+
+In the font definitions:
+
+ c[4] = check sum for TFM file.
+ s[4] = scale factor, in DVI units.
+ d[4] = design size, in DVI units.
+ a[1] = length of the "area" or directory.
+ l[1] = length of the font name.
+ n[a+l] = area and font name string(s).
+
+In the preamble:
+
+ i[1] = DVI format ID = 2, except TeX-XeT has 3.
+ num[4] = numerator of 100 nm / DVI unit.
+ den[4] = denominator of 100 nm / DVI unit.
+ mag[4] = 1000 * magnification.
+ k[1] = comment length.
+ x[k] = comment string.
+
+In the postamble:
+
+ p[4] = pointer to final bop.
+ num[4], den[4], mag[4] = duplicates of values in preamble.
+ l[4] = height-plus-depth of tallest page, in DVI units.
+ u[4] = width of widest page, in DVI units.
+ s[2] = maximum stack depth needed to process this DVI file.
+ t[2] = total number of pages (bop commands) present.
+
+In the post-postamble:
+
+ q[4] = pointer to the "post" command that started the postamble.
+ i[1] = DVI format ID, as in the preamble.
+ 223 ... 223 = at least four "223" bytes.
+
+---------------
+EOF ``dvi.doc''
+---------------
--- /dev/null
+variety sequences-6
+pre 2 25400000 473628672 1000 27 '\'TeX output 1995.03.08:2032*ADDED_JUNK*'
+bop 1 0 0 0 0 0 0 0 0 0 -1
+[
+d3 -917504
+]
+d4 45941966
+[
+d4 -44998066
+[
+r4 8497024
+fd1 50 11374260171 1359216 655360 0 5 '~/test/pl/' 'cmr10'
+fn50
+(T)
+[
+r3 -226584
+d3 292608
+(E)
+]
+r3 528538
+(Xnical)
+r3 453072
+(T)
+r3 -37758
+(yp)
+r3 37757
+(esetting)
+]
+d3 6662197
+[
+fd1 23 3274421126 655360 655360 0 6 '' 'cmbx10'
+fn23
+(What)
+w3 251220
+(is)
+w0
+(T)
+[
+r3 -125636
+d3 145635
+(E)
+]
+r3 275315
+(X?)
+]
+z3 1291389
+[
+r3 1310720
+fd1 0 11374260171 655360 655360 0 5 '' 'cmr10'
+fn0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w3 287604
+(\(pronounced)
+w0
+(\\tec)
+x2 -18205
+(k\"\))
+w0
+(is)
+w0
+(a)
+w0
+(computerized)
+w0
+(t)
+x0
+(yp)
+r2 18205
+(esetting)
+w0
+(system)
+w0
+(dev)
+x0
+(elop)
+r2 18205
+(ed)
+w0
+(b)
+x0
+(y)
+w0
+(Donald)
+w0
+(Kn)
+x0
+(uth)
+w0
+(and)
+]
+y3 786432
+[
+(others)
+w3 223564
+(at)
+w0
+(Stanford)
+w0
+(Univ)
+w2 -18205
+(ersit)
+w0
+(y)
+r3 -54614
+(.)
+r3 306603
+(It)
+w3 223564
+(is)
+w0
+(used)
+w0
+(to)
+w0
+(create)
+w0
+(high-qualit)
+x2 -18205
+(y)
+w0
+(do)
+r2 18205
+(cumen)
+x0
+(ts,)
+r3 224841
+(particularly)
+w0
+(those)
+w0
+(con)
+x0
+(taining)
+]
+y0
+[
+(mathematics.)
+r3 372135
+(The)
+w3 245408
+(name)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(is)
+w0
+(an)
+w0
+(upp)
+r2 18205
+(ercase)
+w0
+(form)
+w0
+(of)
+w0
+(the)
+w0
+(Greek)
+w0
+(letters)
+w0
+fd1 6 1350061076 655360 655360 0 6 '' 'cmmi10'
+fn6
+\1C
+r3 74183
+\0F
+\1F
+fn0
+(,)
+r3 252146
+(the)
+w0
+\0C
+(rst)
+w0
+(three)
+w0
+(letters)
+w0
+(of)
+w0
+(a)
+]
+y0
+[
+(Greek)
+w3 211436
+(w)
+x2 -18205
+(ord)
+w0
+(meaning)
+w0
+fd1 33 16053430112 655360 655360 0 6 '' 'cmsl10'
+fn33
+(art)
+w0
+fn0
+(as)
+w0
+(w)
+x0
+(ell)
+w0
+(as)
+w0
+fn33
+(tec)
+x0
+(hnology)
+fn0
+(.)
+r3 288932
+(The)
+w0
+(lo)
+x0
+(w)
+x0
+(ering)
+w0
+(of)
+w0
+(the)
+w0
+(\\E\")
+r3 211429
+(is)
+w0
+(a)
+w0
+(reminder)
+w0
+(that)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(is)
+w0
+(ab)
+r2 18205
+(out)
+]
+y0
+[
+(t)
+w2 -18205
+(yp)
+x2 18205
+(esetting,)
+r3 231398
+(whic)
+w0
+(h)
+w3 228809
+(can)
+w0
+(b)
+x0
+(e)
+w0
+(though)
+r2 -18205
+(t)
+w0
+(of)
+w0
+(as)
+w0
+(the)
+w0
+(next)
+w0
+(stage)
+w0
+(b)
+x0
+(ey)
+x2 -18205
+(ond)
+w0
+(w)
+x0
+(ord)
+w0
+(pro)
+r2 18205
+(cessing.)
+r3 322338
+(On)
+w0
+(devices)
+w0
+(where)
+w0
+(suc)
+x0
+(h)
+]
+y0
+[
+(lo)
+w2 -18205
+(w)
+w0
+(ering)
+w3 218453
+(is)
+w0
+(di)
+\0E
+(cult)
+w0
+(or)
+w0
+(imp)
+r2 18205
+(ossible)
+w0
+(y)
+x2 -18205
+(ou)
+w0
+(ma)
+x0
+(y)
+w0
+(see)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(written)
+w0
+(as)
+w0
+fd1 29 33772436170 655360 655360 0 6 '' 'cmtt10'
+fn29
+(TeX)
+fn0
+(.)
+]
+z0
+[
+r3 1310720
+(Most)
+w3 289550
+(w)
+x2 -18205
+(ord)
+w0
+(pro)
+r2 18205
+(cessors)
+w0
+(allo)
+x0
+(w)
+w0
+(y)
+x0
+(ou)
+w0
+(to)
+w0
+(create)
+w0
+(and)
+w0
+(mo)
+x2 18205
+(dify)
+w0
+(a)
+w0
+(do)
+x0
+(cumen)
+x2 -18205
+(t)
+w0
+(in)
+x0
+(teractiv)
+x0
+(ely)
+w0
+(|)
+w0
+(what)
+w0
+(y)
+x0
+(ou)
+w0
+(see)
+]
+y0
+[
+(on)
+w3 278277
+(the)
+w0
+(screen)
+w0
+(is)
+w0
+(usually)
+w0
+(what)
+w0
+(y)
+x2 -18205
+(our)
+w0
+(output)
+w0
+(will)
+w0
+(lo)
+r2 18205
+(ok)
+w0
+(lik)
+x0
+(e.)
+r3 470743
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(do)
+r2 18205
+(es)
+w0
+fd1 36 37500023472 655360 655360 0 6 '' 'cmti10'
+fn36
+(not)
+w0
+fn0
+(w)
+x0
+(ork)
+w0
+(in)
+w0
+(this)
+w0
+(w)
+x0
+(a)
+x0
+(y)
+r3 -54614
+(.)
+r3 470743
+(Lik)
+x0
+(e)
+w0
+(other)
+]
+y0
+[
+(t)
+x2 -18205
+(yp)
+r2 18205
+(esetting)
+w3 233773
+(systems)
+w0
+(\(suc)
+x0
+(h)
+w0
+(as)
+w0
+(SCRIBE)
+r3 233758
+(and)
+w0
+fn33
+(tro)
+\0B
+r3 126826
+fn0
+(\),)
+r3 237603
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(is)
+w0
+(kno)
+x0
+(wn)
+w0
+(as)
+w0
+(a)
+w0
+(\\do)
+r2 18205
+(cumen)
+x0
+(t)
+w0
+(compiler\".)
+r3 337231
+(Using)
+w0
+(y)
+x0
+(our)
+]
+y0
+[
+(fa)
+w2 -18205
+(v)
+w0
+(ourite)
+w3 208726
+(text)
+w0
+(editor)
+w0
+(y)
+x2 -18205
+(ou)
+w0
+(need)
+w0
+(to)
+w0
+(create)
+w0
+(a)
+w0
+\0C
+(le)
+w0
+(con)
+x0
+(taining)
+w0
+(the)
+w0
+(text)
+w0
+(of)
+w0
+(y)
+x0
+(our)
+w0
+(man)
+x0
+(uscript)
+w0
+(along)
+w0
+(with)
+w0
+(the)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+]
+y0
+[
+(t)
+x2 -18205
+(yp)
+r2 18205
+(esetting)
+w3 180582
+(commands.)
+r3 278648
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(giv)
+x0
+(es)
+w0
+(y)
+x0
+(ou)
+w0
+(the)
+w0
+(abilit)
+x0
+(y)
+w0
+(to)
+w0
+(pro)
+r2 18205
+(duce)
+w0
+(prin)
+x0
+(ted)
+w0
+(matter)
+w0
+(with)
+w0
+(a)
+w0
+(qualit)
+x0
+(y)
+w0
+(matc)
+x0
+(hing)
+w0
+(that)
+]
+y0
+[
+(found)
+w3 229642
+(in)
+w0
+(b)
+w2 18205
+(o)
+w0
+(oks,)
+r3 232439
+(dep)
+w0
+(ending)
+w3 229642
+(on)
+w0
+(the)
+w0
+(output)
+w0
+(device.)
+r3 324837
+(Adelaide)
+w0
+(Univ)
+w2 -18205
+(ersit)
+w0
+(y)
+w3 229642
+(has)
+w0
+(an)
+w0
+fd1 43 21413374024 655360 655360 0 7 '' 'cmcsc10'
+fn43
+(ima)
+r2 -14564
+(gen)
+w0
+fn0
+(laser)
+w0
+(prin)
+r2 -18205
+(ter)
+w0
+(with)
+]
+y0
+[
+(a)
+w3 253600
+(resolution)
+w0
+(of)
+w0
+(240)
+w0
+(dots)
+w0
+(p)
+r2 18205
+(er)
+w0
+(inc)
+x2 -18205
+(h.)
+r3 396711
+(This)
+w0
+(publication)
+w0
+(sho)
+x0
+(ws)
+w0
+(b)
+r2 18205
+(oth)
+w0
+(the)
+w0
+(capabilities)
+w0
+(of)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(and)
+w0
+(the)
+w0
+(output)
+]
+y0
+[
+(qualit)
+x2 -18205
+(y)
+w3 218453
+(of)
+w0
+(the)
+w0
+(laser)
+w0
+(prin)
+x0
+(ter.)
+]
+d3 2000498
+[
+fn23
+(F)
+r3 -62805
+(on)
+r2 -20935
+(ts)
+]
+z0
+[
+r3 1310720
+fn0
+(One)
+w3 191328
+(of)
+w0
+(the)
+w0
+(more)
+w0
+(ob)
+x2 -18205
+(vious)
+w0
+(adv)
+r3 -36409
+(an)
+x0
+(tages)
+w0
+(of)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(is)
+w0
+(the)
+w0
+(large)
+w0
+(range)
+w0
+(of)
+w0
+(fon)
+x0
+(ts)
+w0
+(from)
+w0
+(whic)
+x0
+(h)
+w0
+(y)
+x0
+(ou)
+w0
+(can)
+w0
+(c)
+x0
+(ho)
+r2 18205
+(ose.)
+r3 282230
+(A)
+]
+y0
+[
+(fon)
+x2 -18205
+(t)
+w3 184195
+(is)
+w0
+(a)
+w0
+(collection)
+w0
+(of)
+w0
+(c)
+x0
+(haracters)
+w0
+(eac)
+x0
+(h)
+w0
+(ha)
+x0
+(ving)
+w0
+(a)
+w0
+(similar)
+w0
+(size)
+w0
+(and)
+w0
+(st)
+x0
+(yle.)
+r3 279852
+(Some)
+w0
+(of)
+w0
+(the)
+w0
+(fon)
+x0
+(ts)
+w0
+(curren)
+x0
+(tly)
+w0
+(a)
+x0
+(v)
+r3 -36409
+(ailable)
+]
+y0
+[
+(include:)
+]
+y3 1398888
+[
+[
+w3 1542753
+(roman)
+w0
+fn33
+(slan)
+r2 -18205
+(ted)
+w0
+fn36
+(italic)
+w0
+fn23
+(b)
+r2 20935
+(oldface)
+w0
+fn29
+(typewriter)
+w0
+fd1 19 15510736522 655360 655360 0 6 '' 'cmss10'
+fn19
+(sans)
+r3 218453
+(serif)
+w0
+fn43
+(small)
+r3 247578
+(caps)
+]
+]
+y0
+[
+fn0
+(Man)
+x2 -18205
+(y)
+w3 218453
+(of)
+w0
+(these)
+w0
+(also)
+w0
+(come)
+w0
+(in)
+w0
+(a)
+w0
+(v)
+r3 -36409
+(ariet)
+x0
+(y)
+w0
+(of)
+w0
+(sizes:)
+]
+d3 1749323
+[
+[
+r3 5158746
+fn50
+(from)
+w3 453072
+(the)
+w0
+(v)
+r3 -37758
+(ery)
+w0
+(big)
+fn0
+(,)
+x3 436906
+fd1 1 15755105707 589824 589824 0 4 '' 'cmr9'
+fn1
+(to)
+w3 202068
+(the)
+w0
+(v)
+r2 -16839
+(ery)
+w0
+(small)
+fn0
+(,)
+x0
+fd1 5 20600715532 327680 327680 0 4 '' 'cmr5'
+fn5
+(to)
+w3 154740
+(the)
+w0
+(ridiculous)
+fn0
+(.)
+]
+]
+y0
+[
+(Apart)
+w3 195079
+(from)
+w0
+(a)
+w0
+(large)
+w0
+(selection)
+w0
+(of)
+w0
+(mathematical)
+w0
+(sym)
+w2 -18205
+(b)
+x2 18205
+(ols,)
+r3 199754
+(man)
+w0
+(y)
+w3 195079
+(sp)
+x0
+(ecial)
+w0
+(c)
+x2 -18205
+(haracters)
+w0
+(and)
+w0
+(accen)
+x0
+(ts)
+w0
+(are)
+w0
+(a)
+x0
+(v)
+r3 -36409
+(ailable:)
+]
+y0
+[
+[
+[
+[
+[
+[
+[
+[
+r3 1427428
+d2 -19753
+(c)
+]
+]
+]
+[
+[
+[
+r3 1245383
+fd1 12 4110426232 655360 655360 0 6 '' 'cmsy10'
+fn12
+\0D
+]
+]
+]
+]
+]
+[
+r3 3146127
+fn36
+($)
+]
+[
+[
+r3 4895543
+fn12
+(x)
+]
+]
+[
+[
+r3 6432199
+({)
+]
+]
+[
+[
+r3 8078080
+(y)
+]
+]
+[
+[
+r4 9614734
+(z)
+]
+]
+[
+r4 11151388
+\0E
+]
+[
+r4 12724452
+\0D
+]
+[
+r4 14625196
+( )
+]
+[
+r4 16525940
+(!)
+]
+[
+r4 18426684
+(4)
+]
+[
+r4 20254610
+(|)
+]
+[
+r4 22009719
+fn0
+\12
+r3 -327681
+(a)
+]
+[
+r4 23564578
+\13
+r3 -309476
+(e)
+]
+[
+r4 25119437
+\18
+r3 -291271
+(c)
+]
+[
+r4 26656091
+(^)
+r3 -327681
+(o)
+]
+[
+r4 28247360
+\7F
+r3 -345886
+(u)
+]
+]
+]
+]
+y0
+[
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w3 193975
+(do)
+r2 18205
+(es)
+w0
+(a)
+w0
+(few)
+w0
+(subtle)
+w0
+(things)
+w0
+(automatically)
+r3 -54614
+(.)
+r3 283112
+(Certain)
+w0
+(sequences)
+w0
+(of)
+w0
+(c)
+x2 -18205
+(haracters)
+w0
+(in)
+w0
+(y)
+x0
+(our)
+w0
+(text)
+w0
+(will)
+w0
+(b)
+r2 18205
+(e)
+w0
+(replaced)
+]
+y3 786432
+[
+(b)
+x2 -18205
+(y)
+w3 195273
+fn33
+(ligatures)
+w0
+fn0
+(in)
+w0
+(the)
+w0
+(prin)
+x0
+(ted)
+w0
+(output)
+w0
+(\(consider)
+w0
+(the)
+w0
+(\\)
+fn29
+(ffi)
+fn0
+(\")
+w0
+(in)
+w0
+(\\di)
+\0E
+(cult\"\),)
+r3 199910
+(while)
+w0
+(other)
+w0
+(pairs)
+w0
+(of)
+w0
+(c)
+x0
+(haracters)
+w0
+(need)
+]
+y0
+[
+(to)
+w3 240111
+(b)
+x2 18205
+(e)
+w0
+fn33
+(k)
+r2 -18205
+(erned)
+w0
+fn0
+(\(e.g.,)
+r3 245525
+(the)
+w0
+(\\o\")
+w0
+(and)
+w0
+(\\x\")
+w0
+(in)
+w0
+(\\b)
+x0
+(o)
+r2 -18205
+(x\")
+w0
+(lo)
+x0
+(ok)
+w0
+(b)
+x0
+(etter)
+w0
+(if)
+w0
+(they)
+w0
+(are)
+w0
+(mo)
+w2 -18205
+(v)
+w0
+(ed)
+w3 240111
+(closer)
+w0
+(together\).)
+r3 356245
+(The)
+w0
+(range)
+]
+y0
+[
+(and)
+w3 218453
+(qualit)
+x2 -18205
+(y)
+w0
+(of)
+w0
+(fon)
+x0
+(ts)
+w0
+(a)
+x0
+(v)
+r3 -36409
+(ailable)
+w0
+(will)
+w0
+(con)
+x0
+(tin)
+x0
+(ue)
+w0
+(to)
+w0
+(impro)
+x0
+(v)
+x0
+(e.)
+]
+d3 2000498
+[
+fn23
+(Mathematics)
+]
+z0
+[
+r3 1310720
+fn0
+(A)
+r3 270774
+(ma)
+r3 36408
+(jor)
+w3 270827
+(design)
+w0
+(goal)
+w0
+(of)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(w)
+x2 -18205
+(as)
+w0
+(to)
+w0
+(simplify)
+w0
+(the)
+w0
+(task)
+w0
+(of)
+w0
+(t)
+x0
+(yp)
+r2 18205
+(esetting)
+w0
+(mathematics)
+w0
+(|)
+w0
+(and)
+w0
+(to)
+w0
+(do)
+w0
+(it)
+]
+y0
+[
+(prop)
+x2 18205
+(erly)
+r3 -54614
+(.)
+r3 356376
+(Mathematicians)
+w3 240155
+(will)
+w0
+(b)
+x0
+(e)
+w0
+(pleasan)
+x2 -18205
+(tly)
+w0
+(surprised)
+w0
+(at)
+w0
+(the)
+w0
+(ease)
+w0
+(with)
+w0
+(whic)
+x0
+(h)
+w0
+(form)
+x0
+(ulae)
+w0
+(and)
+w0
+(expressions)
+]
+y0
+[
+(can)
+w3 171378
+(b)
+r2 18205
+(e)
+w0
+(created;)
+r3 187070
+(from)
+w0
+(simple)
+w0
+(in-line)
+w0
+(equations)
+w0
+(suc)
+r2 -18205
+(h)
+w0
+(as)
+w0
+fn6
+(e)
+[
+d3 -237825
+fd1 9 6031313562 458752 458752 0 5 '' 'cmmi7'
+fn9
+(i)
+\19
+]
+r3 723155
+fn0
+(=)
+x3 182040
+fn12
+\00
+fn0
+(1)
+w0
+(and)
+w0
+fn6
+(f)
+[
+d3 98303
+fn9
+(n)
+fd1 3 33144720122 458752 458752 0 4 '' 'cmr7'
+fn3
+(+2)
+]
+r3 1202329
+fn0
+(=)
+x0
+fn6
+(f)
+[
+d3 98303
+fn9
+(n)
+fn3
+(+1)
+]
+r3 1071773
+fn0
+(+)
+r3 51484
+fn6
+(f)
+[
+d3 98303
+fn9
+(n)
+]
+r3 356734
+fn0
+(,)
+r3 180793
+(to)
+w0
+(more)
+w0
+(extra)
+w2 -18205
+(v)
+r3 -36409
+(agan)
+w0
+(t)
+]
+y0
+[
+(displa)
+r2 -18205
+(ys:)
+]
+d3 1283093
+[
+[
+[
+[
+r4 9051774
+d3 -622596
+fd1 18 37254272422 655360 655360 0 6 '' 'cmex10'
+fn18
+(X)
+]
+]
+d3 788255
+[
+r4 9044832
+fn9
+(k)
+r2 11074
+fd1 15 11710361205 458752 458752 0 5 '' 'cmsy7'
+fn15
+\15
+fn3
+(1)
+]
+]
+[
+[
+r4 10114572
+d3 -606895
+fn18
+(p)
+]
+[
+r4 10769933
+d3 -606895
+pr 26213 2515167
+d3 606895
+[
+fn6
+(x)
+[
+d3 98303
+fn9
+(k)
+]
+r3 468080
+fn12
+\00
+[
+r3 145632
+fn0
+(ln)
+]
+r3 800991
+fn6
+(k)
+]
+]
+]
+r4 14122501
+fn12
+(6)
+fn0
+(=)
+[
+r3 837401
+d3 -892025
+fn18
+(Z)
+]
+[
+d3 -730007
+[
+r3 1492762
+fn15
+(1)
+]
+d3 1327120
+[
+r3 1201491
+fn3
+(0)
+]
+]
+[
+[
+[
+d3 -443356
+[
+r3 2235866
+fn6
+(e)
+[
+d3 -237825
+fn15
+\00
+fn9
+(x)
+[
+d3 -197774
+fn5
+(3)
+]
+]
+r3 1140965
+fn0
+(+)
+[
+[
+r3 145632
+d3 -472040
+fn12
+(p)
+]
+[
+r3 691767
+d3 -472040
+pr 26213 374556
+d3 472040
+[
+fn6
+(x)
+]
+]
+]
+]
+r3 2235866
+d3 292622
+pr 26213 3022167
+d3 703781
+[
+[
+[
+r2 29925
+fn0
+(\()
+]
+r3 284788
+(123)
+w3 145632
+fn12
+\00
+w0
+fn6
+(x)
+[
+fn0
+(\))
+]
+]
+[
+r3 2698240
+d3 -329502
+fn3
+(3)
+]
+]
+]
+]
+]
+r3 5445900
+fn6
+(dx)
+]
+d3 1840951
+[
+fn0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w3 234265
+(lo)
+r2 18205
+(oks)
+w0
+(after)
+w0
+(most)
+w0
+(of)
+w0
+(the)
+w0
+(nitt)
+x2 -18205
+(y)
+w0
+(gritt)
+x0
+(y)
+w0
+(details,)
+r3 238217
+(suc)
+x0
+(h)
+w0
+(as)
+w0
+(spacing)
+w0
+(things)
+w0
+(correctly)
+w0
+(and)
+w0
+(c)
+x0
+(ho)
+r2 18205
+(osing)
+w0
+(the)
+w0
+(righ)
+x0
+(t)
+]
+y0
+[
+(sizes)
+w3 219059
+(for)
+w0
+(sup)
+x2 18205
+(erscripts,)
+w3 219210
+(paren)
+r2 -18205
+(theses,)
+w0
+(square)
+w3 219059
+(ro)
+x0
+(ot)
+w0
+(signs)
+w0
+(etc.)
+r3 293088
+(\(The)
+w0
+(disco)
+w2 -18205
+(v)
+w0
+(erer)
+w3 219059
+(of)
+w0
+(the)
+w0
+(ab)
+x0
+(o)
+w2 -18205
+(v)
+w0
+(e)
+w3 219059
+(relation)
+w0
+(wishes)
+w0
+(to)
+]
+y0
+[
+(remain)
+r3 218453
+(anon)
+r2 -18205
+(ymous.\))
+]
+]
+d3 1572864
+[
+r4 14755470
+(1)
+]
+eop
+bop 2 0 0 0 0 0 0 0 0 0 42
+[
+d3 -917504
+]
+d4 45941966
+[
+d4 -45286606
+[
+fn23
+(Alignmen)
+r2 -20935
+(t)
+]
+z3 1310720
+[
+r3 1310720
+fn0
+(The)
+w3 233605
+(preparation)
+w0
+(of)
+w0
+(tabular)
+w0
+(material)
+w0
+(suc)
+r2 -18205
+(h)
+w0
+(as)
+w0
+(in)
+w0
+(lists)
+w0
+(and)
+w0
+(matrices)
+w0
+(can)
+w0
+(b)
+x2 18205
+(e)
+w0
+(a)
+w0
+(tedious)
+w0
+(job)
+w0
+(for)
+w0
+(a)
+w0
+(p)
+x0
+(erson)
+]
+y3 786432
+[
+(armed)
+w3 246414
+(only)
+w0
+(with)
+w0
+(a)
+w0
+(t)
+r2 -18205
+(yp)
+x2 18205
+(ewriter)
+w0
+(and)
+w0
+(a)
+w0
+(b)
+x0
+(ottle)
+w0
+(of)
+w0
+(correction)
+w0
+\0D
+(uid.)
+r3 375153
+(With)
+w0
+(a)
+w0
+(little)
+w0
+(help)
+w0
+(from)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X,)
+w0
+(computers)
+]
+y0
+[
+(can)
+w3 218453
+(mak)
+x2 -18205
+(e)
+w0
+(it)
+w0
+(so)
+w0
+(m)
+x0
+(uc)
+x0
+(h)
+w0
+(easier:)
+]
+d3 4351589
+[
+[
+r3 1026505
+d3 -3473407
+pr 26214 16577003
+z3 557056
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 4548394
+(Oldest)
+x3 218453
+(pla)
+w2 -18205
+(y)
+w0
+(ers)
+x0
+(to)
+x0
+(represen)
+w0
+(t)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y0
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 4814178
+(England)
+w3 218453
+(in)
+w0
+(a)
+w0
+(T)
+r3 -54614
+(est)
+w0
+(Matc)
+r2 -18205
+(h)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y3 255590
+pr 26214 16577003
+z0
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 2004253
+(Name)
+]
+[
+r3 5638900
+d3 229376
+sr 786432 26214
+]
+[
+r3 7203972
+(Age)
+]
+[
+r4 9853302
+d3 229376
+sr 786432 26214
+]
+[
+r4 12282175
+(V)
+r3 -54614
+(ersus)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y0
+pr 26214 16577003
+z0
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 836891
+(W.Rho)
+r2 18205
+(des)
+]
+[
+r3 5638900
+d3 229376
+sr 786432 26214
+]
+[
+r3 6475791
+(52y)
+r3 218453
+(165d)
+]
+[
+r4 9853302
+d3 229376
+sr 786432 26214
+]
+[
+r4 10690193
+(W)
+r3 -54614
+(est)
+w3 218453
+(Indies,)
+w0
+(1930)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y0
+pr 26214 16577003
+z0
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 836891
+(W.G.Grace)
+]
+[
+r3 5638900
+d3 229376
+sr 786432 26214
+]
+[
+r3 6475791
+(50y)
+r3 218453
+(320d)
+]
+[
+r4 9853302
+d3 229376
+sr 786432 26214
+]
+[
+r4 11383780
+(Australia,)
+r3 218453
+(1899)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y0
+pr 26214 16577003
+z0
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 836891
+(G.Gunn)
+]
+[
+r3 5638900
+d3 229376
+sr 786432 26214
+]
+[
+r3 6475791
+(50y)
+r3 218453
+(303d)
+]
+[
+r4 9853302
+d3 229376
+sr 786432 26214
+]
+[
+r4 10690193
+(W)
+r3 -54614
+(est)
+w3 218453
+(Indies,)
+w0
+(1929)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y0
+pr 26214 16577003
+z0
+[
+[
+d3 229376
+sr 786432 26214
+]
+[
+r3 836891
+(J.Southerton)
+fn1
+(*)
+]
+[
+r3 5638900
+d3 229376
+sr 786432 26214
+]
+[
+r3 6475791
+fn0
+(49y)
+r3 218453
+(139d)
+]
+[
+r4 9853302
+d3 229376
+sr 786432 26214
+]
+[
+r4 11383780
+(Australia,)
+r3 218453
+(1877)
+]
+[
+r4 16550791
+d3 229376
+sr 786432 26214
+]
+]
+y0
+pr 26214 16577003
+d3 753664
+[
+[
+fn1
+(*)
+w3 202068
+(\(This)
+w0
+(w)
+r2 -16839
+(as)
+w0
+(actually)
+w0
+(his)
+w0
+(T)
+r3 -50517
+(est)
+w0
+(debut.\))
+]
+]
+]
+r4 19971651
+fn6
+(A)
+w3 182040
+fn0
+(=)
+[
+[
+d3 -1710506
+[
+w0
+fn18
+(0)
+]
+d3 1153446
+[
+w0
+(B)
+]
+d3 393220
+[
+w0
+(B)
+]
+d3 419433
+[
+w0
+(@)
+]
+]
+[
+d3 -1361692
+[
+[
+r3 966613
+fn6
+(a)
+[
+d3 98303
+fn3
+(11)
+]
+]
+[
+r3 2727444
+fn6
+(a)
+[
+d3 98303
+fn3
+(12)
+]
+]
+[
+[
+r3 4386367
+fn6
+(:)
+w3 109224
+(:)
+w0
+(:)
+]
+]
+[
+r3 5908219
+(a)
+[
+d3 98303
+fn3
+(1)
+fn9
+(n)
+]
+]
+]
+y0
+[
+[
+r3 966613
+fn6
+(a)
+[
+d3 98303
+fn3
+(21)
+]
+]
+[
+r3 2727444
+fn6
+(a)
+[
+d3 98303
+fn3
+(22)
+]
+]
+[
+[
+r3 4386367
+fn6
+(:)
+w3 109224
+(:)
+w0
+(:)
+]
+]
+[
+r3 5908219
+(a)
+[
+d3 98303
+fn3
+(2)
+fn9
+(n)
+]
+]
+]
+d3 1150519
+[
+[
+[
+d3 -524288
+[
+r3 1326418
+fn0
+(.)
+]
+y3 262144
+[
+r3 1326418
+(.)
+]
+y0
+[
+r3 1326418
+(.)
+]
+]
+]
+[
+[
+d3 -524288
+[
+r3 3087249
+(.)
+]
+y3 262144
+[
+r3 3087249
+(.)
+]
+y0
+[
+r3 3087249
+(.)
+]
+]
+]
+[
+[
+[
+d3 -458752
+[
+r3 4422775
+(.)
+]
+]
+[
+r3 4677636
+d3 -262144
+(.)
+]
+[
+r3 4932497
+d3 -65536
+(.)
+]
+]
+]
+[
+[
+d3 -524288
+[
+r3 6299389
+(.)
+]
+y3 262144
+[
+r3 6299389
+(.)
+]
+y0
+[
+r3 6299389
+(.)
+]
+]
+]
+]
+y0
+[
+[
+r3 864705
+fn6
+(a)
+[
+d3 98303
+fn9
+(m)
+fn3
+(1)
+]
+]
+[
+r3 2625536
+fn6
+(a)
+[
+d3 98303
+fn9
+(m)
+fn3
+(2)
+]
+]
+[
+[
+r3 4386367
+fn6
+(:)
+w3 109224
+(:)
+w0
+(:)
+]
+]
+[
+r3 5806311
+(a)
+[
+d3 98303
+fn9
+(mn)
+]
+]
+]
+y0
+]
+[
+d3 -1710506
+[
+r3 7083736
+fn18
+(1)
+]
+d3 1153446
+[
+r3 7083736
+(C)
+]
+d3 393220
+[
+r3 7083736
+(C)
+]
+d3 419433
+[
+r3 7083736
+(A)
+]
+]
+]
+]
+d3 5003308
+[
+fn23
+(Other)
+r3 251220
+(features)
+]
+z0
+[
+r3 1310720
+fn0
+(Space)
+w3 276499
+(do)
+x2 18205
+(es)
+w0
+(not)
+w0
+(p)
+x0
+(ermit)
+w0
+(examples)
+w0
+(of)
+w0
+(all)
+w0
+(the)
+w0
+(things)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(can)
+w0
+(do.)
+r3 465410
+(Here)
+w0
+(are)
+w0
+(some)
+w0
+(more)
+w0
+(features)
+w0
+(y)
+r2 -18205
+(ou)
+]
+y0
+[
+(migh)
+w2 -18205
+(t)
+x3 218453
+(lik)
+w0
+(e)
+x0
+(to)
+x0
+(kno)
+w0
+(w)
+x0
+(ab)
+r2 18205
+(out:)
+]
+z0
+[
+[
+r3 655359
+fn12
+\0F
+]
+r3 1310720
+fn0
+(Multi-column)
+w3 218453
+(output)
+w0
+(can)
+w0
+(b)
+r2 18205
+(e)
+w0
+(generated.)
+]
+y0
+[
+[
+r3 655359
+fn12
+\0F
+]
+r3 1310720
+fn0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w3 161606
+(has)
+w0
+(a)
+w0
+(v)
+x2 -18205
+(ery)
+w0
+(sophisticated)
+w0
+(paragraph)
+w0
+(building)
+w0
+(algorithm)
+w0
+(and)
+w0
+(rarely)
+w0
+(needs)
+w0
+(to)
+w0
+(resort)
+w0
+(to)
+w0
+(h)
+x0
+(yphenation.)
+]
+y0
+[
+r3 1310720
+(P)
+x2 -18205
+(aragraphs)
+w3 218453
+(can)
+w0
+(b)
+r2 18205
+(e)
+w0
+(inden)
+x0
+(ted)
+w0
+(and)
+w0
+(shap)
+r2 18205
+(ed)
+w0
+(in)
+w0
+(man)
+x0
+(y)
+w0
+(di)
+\0B
+(eren)
+x0
+(t)
+w0
+(w)
+x0
+(a)
+x0
+(ys.)
+]
+y0
+[
+[
+r3 655359
+fn12
+\0F
+]
+r3 1310720
+fn0
+(Automatic)
+w3 218453
+(insertion)
+w0
+(of)
+w0
+(fo)
+x2 18205
+(otnotes,)
+[
+fn12
+(y)
+]
+r3 509724
+fn0
+(running)
+w0
+(heads,)
+w0
+(page)
+w0
+(n)
+w2 -18205
+(um)
+w0
+(b)
+x0
+(ers)
+r3 218453
+(etc.)
+]
+y0
+[
+[
+r3 655359
+fn12
+\0F
+]
+r3 1310720
+fn0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w3 247230
+(mak)
+x2 -18205
+(es)
+w0
+(pro)
+x0
+(vision)
+w0
+(for)
+w0
+(generating)
+w0
+(a)
+w0
+(table)
+w0
+(of)
+w0
+(con)
+x0
+(ten)
+x0
+(ts,)
+r3 254424
+(a)
+w0
+(bibliograph)
+x0
+(y)
+r3 -54614
+(,)
+r3 254424
+(ev)
+x0
+(en)
+w0
+(an)
+w0
+(index.)
+r3 377602
+(Automatic)
+]
+y0
+[
+r3 1310720
+(section)
+x3 218453
+(n)
+w2 -18205
+(um)
+w0
+(b)
+w2 18205
+(ering)
+x0
+(and)
+x0
+(cross)
+x0
+(referencing)
+x0
+(are)
+x0
+(also)
+x0
+(p)
+w0
+(ossible.)
+]
+y0
+[
+[
+r3 655359
+fn12
+\0F
+]
+r3 1310720
+fn0
+(A)
+r3 189261
+(p)
+r2 18205
+(o)
+w2 -18205
+(w)
+w0
+(erful)
+w3 189289
+(macro)
+w0
+(facilit)
+x2 -18205
+(y)
+w0
+(is)
+w0
+(built)
+w0
+(in)
+x0
+(to)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X.)
+w0
+(This)
+w0
+(lets)
+w0
+(y)
+x0
+(ou)
+w0
+(do)
+w0
+(some)
+w0
+(v)
+x0
+(ery)
+w0
+(useful)
+w0
+(things,)
+r3 195122
+(lik)
+x0
+(e)
+w0
+(creating)
+w0
+(an)
+]
+y0
+[
+r3 1310720
+(abbreviation)
+w3 207360
+(for)
+w0
+(a)
+w0
+(commonly)
+w0
+(used)
+w0
+(phrase,)
+r3 209578
+(or)
+w0
+(de)
+\0C
+(ning)
+w0
+(a)
+w0
+(new)
+w0
+(command)
+w0
+(that)
+w0
+(will)
+w0
+(ha)
+w2 -18205
+(v)
+w0
+(e)
+w3 207360
+(v)
+r3 -36409
+(arying)
+w0
+(e)
+\0B
+(ects)
+]
+y0
+[
+r3 1310720
+(dep)
+r2 18205
+(ending)
+w3 273457
+(on)
+w0
+(the)
+w0
+(parameters)
+w0
+(it)
+w0
+(is)
+w0
+(giv)
+x2 -18205
+(en.)
+r3 456282
+(A)
+r3 273401
+(macro)
+w0
+(pac)
+x0
+(k)
+r3 -36409
+(age)
+w0
+(can)
+w0
+(enhance)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(b)
+x0
+(y)
+w0
+(making)
+w0
+(it)
+w0
+(m)
+x0
+(uc)
+x0
+(h)
+]
+y0
+[
+r3 1310720
+(easier)
+w3 218453
+(to)
+w0
+(generate)
+w0
+(a)
+w0
+(do)
+r2 18205
+(cumen)
+r2 -18205
+(t)
+w0
+(in)
+w0
+(a)
+w0
+(prede)
+\0C
+(ned)
+w0
+(format.)
+]
+d3 2097152
+[
+fn23
+(What)
+w3 251220
+(CAN'T)
+w0
+(T)
+[
+r3 -125636
+d3 145635
+(E)
+]
+r3 275315
+(X)
+w0
+(do?)
+]
+z0
+[
+r3 1310720
+fn0
+(Complex)
+w3 242946
+(graphics)
+w0
+(suc)
+x2 -18205
+(h)
+w0
+(as)
+w0
+(diagrams)
+w0
+(and)
+w0
+(illustrations)
+w0
+(p)
+r2 18205
+(ose)
+w0
+(a)
+w0
+(ma)
+r3 36408
+(jor)
+w0
+(problem)
+w0
+(|)
+w0
+(at)
+w0
+(the)
+w0
+(momen)
+x0
+(t)
+w0
+(y)
+x0
+(ou)
+]
+y0
+[
+(ha)
+w2 -18205
+(v)
+w0
+(e)
+w3 243107
+(to)
+w0
+(lea)
+w2 -18205
+(v)
+w0
+(e)
+w3 243107
+(an)
+w0
+(appropriate)
+w0
+(amoun)
+r2 -18205
+(t)
+w0
+(of)
+w0
+(blank)
+w0
+(space)
+w0
+(and)
+w0
+(paste)
+w0
+(them)
+w0
+(in)
+w0
+(later.)
+r3 365233
+(Graphic)
+w0
+(facilities)
+w0
+(are)
+w0
+(the)
+]
+y0
+[
+(sub)
+r3 36408
+(ject)
+w3 218453
+(of)
+w0
+(curren)
+x2 -18205
+(t)
+w0
+(researc)
+x0
+(h.)
+]
+d3 2097152
+[
+fn23
+(T)
+[
+r3 -125636
+d3 145635
+(E)
+]
+r3 275315
+(X)
+w3 251220
+(and)
+w0
+(V)
+r3 -83740
+(AX/VMS)
+]
+z0
+[
+r3 1310720
+fn0
+(The)
+w3 185026
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(source)
+w0
+\0C
+(le)
+w0
+(used)
+w0
+(to)
+w0
+(generate)
+w0
+(this)
+w0
+(do)
+r2 18205
+(cumen)
+x2 -18205
+(t)
+w0
+(is)
+w0
+(a)
+x0
+(v)
+r3 -36409
+(ailable)
+w0
+(for)
+w0
+(insp)
+r2 18205
+(ection)
+w0
+(on)
+w0
+(an)
+x0
+(y)
+w0
+(V)
+r3 -72819
+(AX)
+r3 184993
+(no)
+r2 18205
+(de)
+w0
+(that)
+]
+y0
+[
+(has)
+w3 218453
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X|)
+w0
+(just)
+w0
+(t)
+x2 -18205
+(yp)
+r2 18205
+(e)
+w0
+(`)
+fn29
+(scroll)
+r3 344061
+(tex_inputs:example.tex)
+fn0
+('.)
+r3 291271
+(A)
+w0
+(few)
+w0
+(steps)
+w0
+(are)
+w0
+(needed)
+w0
+(to)
+w0
+(prin)
+x0
+(t)
+w0
+(suc)
+x0
+(h)
+w0
+(a)
+w0
+\0C
+(le:)
+]
+z0
+[
+[
+r3 145633
+(\(1\))
+]
+r3 1310720
+(T)
+r2 -18205
+(yp)
+x2 18205
+(e)
+w3 221172
+(`)
+fn29
+(tex)
+r3 344061
+(example)
+fn0
+(')
+w0
+(to)
+w0
+(\\compile\")
+w0
+(the)
+w0
+\0C
+(le.)
+r3 299428
+(\(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(lo)
+x0
+(oks)
+w0
+(for)
+w0
+(a)
+w0
+fn29
+(.tex)
+w0
+fn0
+\0C
+(le)
+w0
+(b)
+r2 -18205
+(y)
+w0
+(default.)
+r3 299428
+(If)
+w0
+(it)
+w0
+(can't)
+w0
+\0C
+(nd)
+w0
+(the)
+]
+y0
+[
+r3 1310720
+(giv)
+x2 -18205
+(en)
+w3 194490
+\0C
+(le)
+w0
+(in)
+w0
+(y)
+x0
+(our)
+w0
+(curren)
+x0
+(t)
+w0
+(directory)
+w0
+(it)
+w0
+(will)
+w0
+(lo)
+r2 18205
+(ok)
+w0
+(in)
+w0
+fn29
+(tex_inputs)
+fn0
+(.\))
+r3 283284
+(Tw)
+x0
+(o)
+w0
+(new)
+w0
+\0C
+(les)
+w0
+(will)
+w0
+(b)
+r2 18205
+(e)
+w0
+(created)
+w0
+(in)
+w0
+(y)
+x0
+(our)
+]
+y0
+[
+r3 1310720
+(curren)
+x2 -18205
+(t)
+w3 231698
+(directory:)
+r3 317761
+fn29
+(example.dvi)
+w0
+fn0
+(and)
+w0
+fn29
+(example.lis)
+fn0
+(.)
+r3 331007
+(The)
+w0
+(former)
+w0
+(is)
+w0
+(a)
+w0
+(device)
+w0
+(indep)
+r2 18205
+(enden)
+x0
+(t)
+w0
+(description)
+]
+y0
+[
+r3 1310720
+(of)
+w3 218453
+(the)
+w0
+(do)
+r2 18205
+(cumen)
+r2 -18205
+(t;)
+w0
+(the)
+w0
+(latter)
+w0
+(is)
+w0
+(simply)
+w0
+(a)
+w0
+(log)
+w0
+(of)
+w0
+(the)
+w0
+(T)
+[
+r3 -109250
+d3 141084
+(E)
+]
+r3 254840
+(X)
+w0
+(run.)
+]
+y0
+[
+[
+r3 145633
+(\(2\))
+]
+r3 1310720
+(T)
+r2 -18205
+(yp)
+x2 18205
+(e)
+w3 186484
+(`)
+fn29
+(dvitovdu)
+r3 344061
+(example)
+fn0
+(')
+w0
+(to)
+w0
+(preview)
+w0
+(the)
+w0
+(do)
+x0
+(cumen)
+r2 -18205
+(t)
+w0
+(on)
+w0
+(a)
+w0
+(terminal)
+w0
+(screen.)
+r3 280615
+(This)
+w0
+(program)
+w0
+(can)
+w0
+(b)
+x0
+(e)
+w0
+(used)
+]
+y0
+[
+r3 1310720
+(to)
+w3 218453
+(detect)
+w0
+(a)
+w0
+(v)
+r3 -36409
+(ariet)
+x2 -18205
+(y)
+w0
+(of)
+w0
+(formatting)
+w0
+(problems,)
+w0
+(sa)
+x0
+(ving)
+w0
+(b)
+x2 18205
+(oth)
+w0
+(time)
+w0
+(and)
+w0
+(pap)
+x0
+(er.)
+]
+y0
+[
+[
+r3 145633
+(\(3\))
+]
+r3 1310720
+(T)
+x2 -18205
+(yp)
+r2 18205
+(e)
+w3 263820
+(`)
+fn29
+(imprint)
+r3 344061
+(example)
+fn0
+(')
+w0
+(to)
+w0
+(prin)
+x0
+(t)
+w0
+(the)
+w0
+(do)
+r2 18205
+(cumen)
+x0
+(t.)
+r3 427373
+(\(Note)
+w0
+(that)
+w0
+(the)
+w0
+(D)
+x0
+(VIto)
+r3 -98300
+(VDU)
+x3 263775
+(and)
+w0
+(IMPRINT)
+x0
+(com-)
+]
+y0
+[
+r3 1310720
+(mands)
+w3 218453
+(accept)
+w0
+(a)
+w0
+fn29
+(.dvi)
+w0
+fn0
+\0C
+(le)
+w0
+(b)
+r2 -18205
+(y)
+w0
+(default\).)
+]
+z0
+[
+r3 1310720
+(Detailed)
+w3 218453
+(help)
+w0
+(on)
+w0
+(all)
+w0
+(these)
+w0
+(commands)
+w0
+(is)
+w0
+(a)
+x2 -18205
+(v)
+r3 -36409
+(ailable)
+w0
+(on-line)
+w0
+(|)
+w0
+(try)
+w0
+(t)
+x0
+(yping)
+w0
+(`)
+fn29
+(help)
+r3 344061
+(tex)
+fn0
+(')
+w0
+(to)
+w0
+(get)
+w0
+(started.)
+]
+d3 4533411
+pr 26214 9472573
+d3 727450
+[
+[
+[
+r3 691769
+fn12
+(y)
+]
+]
+r3 1310720
+fn1
+(Here)
+w3 202068
+(is)
+w0
+(a)
+w0
+(fo)
+r2 16839
+(otnote.)
+]
+]
+d3 1572864
+[
+r4 14755470
+fn0
+(2)
+]
+eop
+post 4784 25400000 473628672 1000 47514830 29838620 9 2
+fd1 50 11374260171 1359216 655360 0 5 '' 'cmr10'
+fd1 43 21413374024 655360 655360 0 7 '' 'cmcsc10'
+fd1 36 37500023472 655360 655360 0 6 '' 'cmti10'
+fd1 33 16053430112 655360 655360 0 6 '' 'cmsl10'
+fd1 29 33772436170 655360 655360 0 6 '' 'cmtt10'
+fd1 23 3274421126 655360 655360 0 6 '' 'cmbx10'
+fd1 19 15510736522 655360 655360 0 6 '' 'cmss10'
+fd1 18 37254272422 655360 655360 0 6 '' 'cmex10'
+fd1 15 11710361205 458752 458752 0 5 '' 'cmsy7'
+fd1 12 4110426232 655360 655360 0 6 '' 'cmsy10'
+fd1 9 6031313562 458752 458752 0 5 '' 'cmmi7'
+fd1 6 1350061076 655360 655360 0 6 '' 'cmmi10'
+fd1 5 20600715532 327680 327680 0 4 '' 'cmr5'
+fd1 3 33144720122 458752 458752 0 4 '' 'cmr7'
+fd1 1 15755105707 589824 589824 0 4 '' 'cmr9'
+fd1 0 11374260171 655360 655360 0 5 '' 'cmr10'
+post_post 9603 2 223 223 223 223 223 223 223
--- /dev/null
+% This file is public domain.
+% Originally written 1995, Geoffrey Tobin.
+% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+% This is the TeX source file for the "TeXnical Typesetting" document.
+% Notice how you can put in comments? If TeX sees a % it simply ignores
+% the rest of the line.
+
+% A4 paper is 8.3in wide and 11.7in high; we set the page dimensions so that
+% there are 1in margins all around:
+\hsize 6.3in % page width
+\vsize 9.7in % page height
+
+\parskip 8pt plus 2pt minus 1pt % glue before a paragraph
+
+% Define a few extra fonts for later use:
+\font\bigrm=cmr10 scaled\magstep4 % big version of the standard roman font
+\font\ninerm=cmr9 % 9pt roman
+\font\fiverm=cmr5 % 5pt roman
+\font\sm=cmcsc10 % caps and small caps
+\font\ss=cmss10 % sans serif
+
+% Here's a macro that we'll use to produce all subheadings:
+\def\subhead#1{\bigskip % extra glue before subheading
+ \noindent{\bf #1}\par % unindented boldface subheading
+ \nobreak} % prevent a page break after subheading
+
+\centerline{\bigrm \TeX nical Typesetting}
+
+\vskip 2.5cm % dimensions can be metric
+
+\subhead{What is \TeX?}
+
+\TeX\ (pronounced ``teck'') is a computerized typesetting system developed by
+Donald Knuth and others at Stanford University. It is used to create
+high-quality documents, particularly those containing mathematics.
+The name \TeX\ is an uppercase form of the Greek letters $\tau\epsilon\chi$,
+the first three letters of a Greek word meaning {\sl art} as well as
+{\sl technology}.
+The lowering of the ``E'' is a reminder that \TeX\ is about typesetting,
+which can be thought of as the next stage beyond word processing.
+On devices where such lowering is difficult or impossible you may see \TeX\
+written as {\tt TeX}.
+
+% the above blank line ends the first paragraph
+
+Most word processors allow you to
+create and modify a document interactively --- what
+you see on the screen is usually what your output will look like.
+\TeX\ does {\it not} work in this way.
+Like other typesetting systems (such as SCRIBE and
+{\sl troff\/}), \TeX\ is known as a ``document compiler''. Using your
+favourite text editor you need to create a file containing the
+text of your manuscript along with the \TeX\ typesetting commands.
+\TeX\ gives you the ability to produce printed matter with a quality
+matching that found in books, depending on the output device.
+Adelaide University has an {\sm imagen} laser printer
+with a resolution of 240 dots per inch.
+This publication shows both the capabilities of \TeX\ and
+the output quality of the laser printer.
+
+\subhead{Fonts}
+
+One of the more obvious advantages of \TeX\ is the large range of fonts from
+which you can choose. A font is a collection of characters each having a
+similar size and style. Some of the fonts currently available include:
+$$ % enter display math mode just to get space above and below \line
+\line
+ {\hfil % infinitely stretchable glue
+ \rm roman\hfil \sl slanted\hfil \it italic\hfil \bf boldface\hfil
+ \tt typewriter\hfil \ss sans serif\hfil \sm small caps\hfil
+ } % take care to ensure each { has a matching }
+$$
+Many of these also come in a variety of sizes:
+$$
+\centerline{{\bigrm from the very big},~ % extra space after comma
+ {\ninerm to the very small},~
+ {\fiverm to the ridiculous}.}
+$$
+Apart from a large selection of mathematical symbols,
+many special characters and accents are available:
+$$
+\vbox
+ {\tabskip 10pt plus 1fil % glue before and after all columns
+ \halign to\hsize
+ {& \hfil#\hfil\cr % specify a variable number of centred columns
+ \copyright& \it\$& \S& \P& \dag& \ddag&
+ $\circ$& $\bigcirc$& % some symbols must be accessed from math mode
+ $\leftarrow$& $\rightarrow$& $\triangle$& $\clubsuit$&
+ \`a& \'e& \c c& \^o& \"u\cr
+ }
+ }
+$$
+\TeX\ does a few subtle things automatically.
+Certain sequences of characters in your text will
+be replaced by {\sl ligatures} in the printed output (consider the ``{\tt ffi}''
+in ``difficult''), while other pairs of characters need to be {\sl kerned}
+(e.g., the ``o'' and ``x'' in ``box'' look better if they are moved closer
+together). The range and quality of fonts available will continue to improve.
+
+\subhead{Mathematics}
+
+A major design goal of \TeX\ was to simplify the task of typesetting
+mathematics --- and to do it properly. Mathematicians will be pleasantly
+surprised at the ease with which formulae and expressions can be created;
+from simple in-line equations
+such as $e^{i\pi}=-1$ and $f_{n+2}=f_{n+1}+f_n$, to more extravagant displays:
+$$
+\sum_{k\ge1} \sqrt{x_k-\ln k}\quad\ne\quad
+\int_{0}^\infty {e^{-x^3}+\sqrt{x} \over \left(123-x\right)^3} \,dx
+$$
+\TeX\ looks after most of the nitty gritty details, such as spacing things
+correctly and choosing the right sizes for superscripts, parentheses,
+square root signs etc. (The discoverer of the above relation wishes to
+remain anonymous.)
+
+\subhead{Alignment}
+
+The preparation of tabular material such as in lists and matrices can be a
+tedious job for a person armed only with a typewriter and a bottle of
+correction fluid. With a little help from \TeX, computers can make it so
+much easier:
+$$
+\vcenter % a vertically centred \vbox
+ {\tabskip 0pt % no space before column 1
+ \halign to 3.5in % width of table
+ {\strut#& % col 1 is a strut
+ \vrule#\tabskip .5em plus2em& % col 2 is a vrule; also set col spacing
+ #\hfil& % col 3 is left justified
+ \vrule#& % col 4 is a vrule
+ \hfil#\hfil& % col 5 is centred
+ \vrule#& % col 6 is a vrule
+ \hfil#& % col 7 is right justified
+ \vrule#\tabskip 0pt % col 8 is a vrule; no space after it
+ \cr % end of the preamble
+ \noalign{\hrule}
+ & & \multispan5 \hfil Oldest players to represent\hfil& \cr
+ & & \multispan5 \hfil England in a Test Match\hfil& \cr
+ \noalign{\hrule}
+ & & \omit\hfil Name\hfil& & % \omit ignores template in preamble
+ \omit\hfil Age\hfil& &
+ \omit\hfil Versus\hfil& \cr
+ \noalign{\hrule}
+ & & W.Rhodes& & 52y 165d& & West Indies, 1930& \cr
+ \noalign{\hrule}
+ & & W.G.Grace& & 50y 320d& & Australia, 1899& \cr
+ \noalign{\hrule}
+ & & G.Gunn& & 50y 303d& & West Indies, 1929& \cr
+ \noalign{\hrule}
+ & & J.Southerton{\ninerm*}& & 49y 139d& & Australia, 1877& \cr
+ \noalign{\hrule\smallskip}
+ & \multispan7\ninerm* (This was actually his Test debut.)\hfil \cr
+ }
+ }
+\hskip .5in % space between table and matrix
+A=\pmatrix % parenthesized matrix
+ {a_{11}& a_{12}& \ldots& a_{1n}\cr
+ a_{21}& a_{22}& \ldots& a_{2n}\cr
+ \vdots& \vdots& \ddots& \vdots\cr
+ a_{m1}& a_{m2}& \ldots& a_{mn}\cr
+ }
+$$
+
+\vskip -\the\belowdisplayskip % avoid too much space below display
+
+\subhead{Other features}
+
+Space does not permit examples of all the things \TeX\ can do. Here are some
+more features you might like to know about:
+
+\item{$\bullet$}
+Multi-column output can be generated.
+
+{\parskip=0pt % temporarily turn off the skipping between paragraphs
+\item{$\bullet$}
+\TeX\ has a very sophisticated paragraph building algorithm and rarely needs
+to resort to hyphenation. Paragraphs can be indented and shaped in many
+different ways.
+
+\item{$\bullet$}
+Automatic insertion of footnotes,\footnote{\dag}{\ninerm Here is
+a footnote.} running heads, page numbers etc.
+
+\item{$\bullet$}
+\TeX\ makes provision for generating a table of contents, a bibliography, even
+an index. Automatic section numbering and cross referencing are also possible.
+
+\item{$\bullet$}
+A powerful macro facility is built into \TeX. This lets you do some very
+useful things, like creating an abbreviation for a commonly used phrase, or
+defining a new command that will have varying effects depending on the
+parameters it is given. A macro package can enhance \TeX\ by making it much
+easier to generate a document in a predefined format.
+\par % end the last paragraph BEFORE ending the group
+} % \parskip will now revert to its previous value
+
+\subhead{What CAN'T \TeX\ do?}
+
+Complex graphics such as diagrams and illustrations pose
+a major problem --- at the moment you have to leave an appropriate amount of
+blank space and paste them in later.
+Graphic facilities are the subject of current research.
+
+\subhead{\TeX\ and VAX/VMS}
+
+The \TeX\ source file used to generate this document is available for
+inspection on any VAX node that has \TeX ---
+just type `{\tt scroll tex\char'137 inputs:example.tex}'.
+A few steps are needed to print such a file:
+
+\item{(1)}
+Type `{\tt tex example}' to ``compile'' the file.
+(\TeX\ looks for a {\tt .tex} file by default. If it can't find the given
+file in your current directory it will look in {\tt tex\char'137 inputs}.)
+Two new files will be created in your current directory:
+{\tt example.dvi} and {\tt example.lis}.
+The former is a device independent description of the document;
+the latter is simply a log of the \TeX\ run.
+
+{\parskip=0pt % temporarily turn off \parskip
+\item{(2)}
+Type `{\tt dvitovdu example}' to preview the document on a terminal screen.
+This program can be used to detect a variety of formatting problems,
+saving both time and paper.
+
+\item{(3)}
+Type `{\tt imprint example}' to print the document.
+(Note that the DVIto\kern-.15em VDU and IMPRINT commands
+accept a {\tt .dvi} file by default).
+
+} % restore \parskip
+
+Detailed help on all these commands is available on-line --- try typing
+`{\tt help tex}' to get started.
+
+\bye
--- /dev/null
+% This file is public domain.
+% Originally written 1995, Geoffrey Tobin.
+% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+Hello.
+\bye
--- /dev/null
+#!/bin/sh
+# This file is public domain.
+# Originally written 1995, Geoffrey Tobin.
+# The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+# This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+#
+# Filter for converting "troff -mxx" to PostScript. This script is
+# normally linked to the names man2ps, ms2ps, me2ps, and mm2ps.
+#
+# Usage:
+# man2ps [<] cc.1 >cc.ps
+# me2ps [<] foo.me >foo.ps
+# mm2ps [<] foo.mm >foo.ps
+# ms2ps [<] foo.ms >foo.ps
+#
+# [08-May-1993]
+
+# Choose a troff format according to the scrip name.
+case `basename $0` in
+ man*) FORMAT=-man ;;
+ me*) FORMAT=-me ;;
+ mm*) FORMAT=-mm ;;
+ ms*) FORMAT=-ms ;;
+ *) echo "Unknown troff format:" ; exit 1 ;;
+esac
+
+# We can use either GNU groff or Sun Solaris troff + dpost
+if [ -x /usr/local/bin/groff ]
+then # GNU groff
+ TROFF="groff $FORMAT"
+ TROFF2PS="cat"
+elif [ -x /usr/lib/lp/postscript/dpost ]
+then # Solaris 2.1
+ TROFF="troff $FORMAT"
+ TROFF2PS="/usr/lib/lp/postscript/dpost"
+else
+ echo "Cannot find troff-to-PostScript filter"
+ exit 1
+fi
+
+tbl $* | eqn | $TROFF | $TROFF2PS
--- /dev/null
+% This file is public domain.
+% Originally written 1995, Geoffrey Tobin.
+% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
+% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
+
+% TeX source file for creating TRIPVDU.DVI, a torture file for DVItoVDU
+% (using the same philosophy as Donald Knuth's torture test for TeX).
+
+\nopagenumbers
+\topskip 0pt
+\parindent 0pt
+\parskip 0pt
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 1
+% This page is completely empty but has some \special stuff.
+
+\message{Empty page.}
+\null
+\special{DVItoVDU should warn user that it is ignoring this stuff.}
+\special{And this.}
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 2
+% This page has 1 black pixel at (0,0).
+
+\message{1 black pixel at (0,0).}
+\hrule height 1sp width 1sp depth 0sp
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 3
+% This page will fill an A4 sheet with black pixels, assuming A4 paper is
+% 8.3in by 11.7in and (0,0) is 1in from the top and left edges.
+
+\message{A4 sheet full of black pixels.}
+{% change page size and location temporarily
+\hsize 10in
+\vsize 12in
+\hoffset -1in
+\voffset -1in
+% Because ref pts of rules are at BOTTOM left corner we first need to output
+% a rule that will guarantee Minv = -1in, then output the large rule with
+% slightly less than A4 height.
+\hrule height 1sp width 8.299in depth 0sp
+\hrule height 11.695in width 8.299in depth 0sp
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 4
+% This page is 1 pixel wider than page 3.
+% DVItoVDU should detect that page is too wide for A4 paper.
+
+\message{As above but 1 pixel too wide.}
+\hrule height 1sp width 8.301in depth 0sp
+\hrule height 11.695in width 8.301in depth 0sp
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 5
+% This page is 1 pixel longer than page 3.
+% DVItoVDU should detect that page is too low for A4 paper.
+
+\message{As above but 1 pixel too low.}
+\hrule height 11.701in width 8.299in depth 0sp
+\vfil\eject
+
+}% reset page size and location
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 6
+% This page has a rulelist with a full ruletable (= 300 rules).
+% Note that DVItoVDU does not impose any limits
+% on the number of rules or characters in a page. Pages 6 to 9
+% test the list manipulating code in DVIReader and DVItoVDU.
+
+\message{Page with ruletablesize rules.}
+\newcount\temp
+\temp=300
+\loop\ifnum\temp>0
+ \hrule height 1sp width \hsize % 1 pixel high
+ \vfil
+ \advance\temp by -1
+\repeat
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 7
+% This page has ruletablesize+1 rules (so rulelist has 2 nodes).
+
+\message{Page with ruletablesize+1 rules.}
+\temp=301
+\loop\ifnum\temp>0
+ \hrule height 1sp width \hsize % 1 pixel high
+ \vfil
+ \advance\temp by -1
+\repeat
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 8
+% This page has a charlist with a full chartable (= 3000 characters).
+
+\message{Page with chartablesize characters from one font.}
+\font\small=cmr5
+{\small \offinterlineskip
+ \temp=30
+ \loop\ifnum\temp>0
+ \leftline{iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+ iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii} % 100 chars
+ \advance\temp by -1
+ \repeat
+}
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 9
+% This page has chartablesize+1 characters (so charlist has 2 nodes).
+
+\message{Page with chartablesize+1 characters from one font.}
+{\small \offinterlineskip
+ \temp=30
+ \loop\ifnum\temp>0
+ \leftline{iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
+ iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii} % 100 chars
+ \advance\temp by -1
+ \repeat
+ \leftline{i} % the extra character
+}
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 10
+
+\message{Multiple TeX page counters.}
+\footline={\hss\tenrm\folio\hss} % turn on page numbers
+\pageno=0
+\count1=1 \count2=2 \count3=3 \count4=4 \count9=9
+\noindent
+This is \TeX\ page [0.1.2.3.4.....9].
+\vfil\eject
+
+\count1=0 \count2=0 \count3=0 \count4=0 \count9=0 % reset TeX counters
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 11
+
+\message{Negative TeX page.}
+\pageno=-11
+\noindent
+This is \TeX\ page [-11].
+\vfil\eject
+
+\pageno=12 % DVI page = TeX page again
+\nopagenumbers % turn off page numbers again
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 12
+% This page has characters from many fonts.
+% Note that the page is off the right edge of A4 paper.
+
+\message{Page with characters from many fonts.}
+% avoid redefining plain TeX's \i, \j etc.
+\font\Fb=cmr5
+\font\Fc=cmr5 scaled\magstep5
+\font\Fe=cmr10 scaled\magstep5
+\font\Fg=cmbx10
+\font\Fh=cmbx10 scaled\magstep5
+\font\Fj=cmsl10
+\font\Fk=cmsl10 scaled\magstep5
+\font\Fm=cmtt10
+\font\Fn=cmtt10 scaled\magstep5
+\font\Fo=cmss10
+\font\Fp=cmcsc10
+\font\Fq=cmdunh10
+
+\leftline{\Fb These characters are from CMR5 at mag 1000.}
+\leftline{\Fc These characters are from CMR5 at mag 2488.}
+\leftline{\tenrm These characters are from CMR10 at mag 1000.}
+\leftline{\Fe These characters are from CMR10 at mag 2488.}
+\leftline{\Fg These characters are from CMBX10 at mag 1000.}
+\leftline{\Fh These characters are from CMBX10 at mag 2488.}
+\leftline{\Fj These characters are from CMSL10 at mag 1000.}
+\leftline{\Fk These characters are from CMSL10 at mag 2488.}
+\leftline{\Fm These characters are from CMTT10 at mag 1000.}
+\leftline{\Fn These characters are from CMTT10 at mag 2488.}
+\leftline{\Fo These characters are from CMSS10 at mag 1000.}
+\leftline{\Fp These characters are from CMCSC10 at mag 1000.}
+\leftline{\Fq These characters are from CMDUNH10 at mag 1000.}
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 13
+% This page has characters from many fonts, some of which have no corresponding
+% PXL file. DVItoVDU should warn user about non-existent font files and
+% continue as best it can by loading dummy font info.
+% Note that the page is off the right edge of A4 paper.
+
+\message{Page with characters from fonts at unknown magnifications.}
+% PXL files do not exist at the requested magnifications:
+\font\Fr=cmr5 scaled 500
+\font\Fs=cmr5 scaled 3000
+\font\Ft=cmr10 scaled 200
+\font\Fu=cmr10 scaled 5000
+\font\Fv=cmsl10 scaled 49
+\font\Fw=cmsl10 scaled 10000
+
+\leftline{\Fr CMR5 at mag 500 does not exist.}
+\leftline{\Fb These characters are from CMR5 at mag 1000.}
+\leftline{\Fs CMR5 at mag 3000 does not exist.}
+\leftline{\Ft CMR10 at mag 200 does not exist.}
+\leftline{\tenrm These characters are from CMR10 at mag 1000.}
+\leftline{\Fu CMR10 at mag 5000 does not exist.}
+\leftline{\Fv CMSL10 at mag 49 does not exist.}
+\leftline{\Fj These characters are from CMSL10 at mag 1000.}
+\leftline{\Fw CMSL10 at mag 10000 does not exist.}
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 14
+% This page has a paragraph illustrating most of the characters from the
+% standard roman TeX text font.
+
+\message{Standard paragraph.}
+\rm
+Our task is to create a paragraph illustrating what a typical piece of text
+looks like in the standard \TeX\ font. It should be stressed that not all
+\TeX\ fonts can be used for typesetting text. We need to show most of the
+characters in this font---for instance, something like ``the quick brown fox
+jumps over a lazy dog'' would use all the lower-case letters. Hmmm \dots\
+how about ``THE QUICK BROWN FOX JUMPS OVER 9876543210 LAZY DOGS'' to make
+sure we show all the upper-case letters and digits? Such a paragraph would
+hardly be typical! Then there's ligatures (try and fit in words like
+fluffy, waffle, firefly, difficult) and examples of kerning (boxer, cooked,
+vowel). Not to mention the various accents and other special letters:
+prot\'eg\'e, r\^ole, na\"\i ve, \AE sop's \OE vres en fran\c cais.
+But how do we put all this stuff into a paragraph that makes sense!?
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 15
+
+\message{Page in bottom half of A4 paper.}
+\null\vfil
+\centerline{Page in bottom half of A4 paper.}
+\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 16
+
+\message{Page completely above left of A4 paper.}
+\voffset -3in
+\hoffset -9in
+\leftline{Page completely above left of A4 paper.}
+\vfil\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 17
+
+\message{Page completely below right of A4 paper.}
+\voffset 3in
+\hoffset 9in
+\null\vfil
+\rightline{Page completely below right of A4 paper.}
+\eject
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DVI page 18
+
+\message{Page beyond all edges of A4 paper.}
+\voffset -3in
+\hoffset -3in
+\vsize 15in
+\hsize 15in
+\line{Page beyond all edges of A4 paper.\hfil
+ Page beyond all edges of A4 paper.}
+\vfil
+\line{Page beyond all edges of A4 paper.\hfil
+ Page beyond all edges of A4 paper.}
+\eject
+\voffset 0in \hoffset 0in % offsets back to normal
+
+\bye