summaryrefslogtreecommitdiff
path: root/dviware/beebe/src
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/beebe/src
Initial commit
Diffstat (limited to 'dviware/beebe/src')
-rw-r--r--dviware/beebe/src/00arit.c92
-rw-r--r--dviware/beebe/src/00dir.cmd185
-rw-r--r--dviware/beebe/src/00dir.lst189
-rw-r--r--dviware/beebe/src/00tdir.cmd189
-rw-r--r--dviware/beebe/src/00tdir.lst189
-rw-r--r--dviware/beebe/src/abortrun.h43
-rw-r--r--dviware/beebe/src/actfact.h42
-rw-r--r--dviware/beebe/src/alldone.h23
-rw-r--r--dviware/beebe/src/atari/makefile.ast504
-rw-r--r--dviware/beebe/src/bintnx.c51
-rw-r--r--dviware/beebe/src/bintnxvm.c390
-rw-r--r--dviware/beebe/src/bitmap.h64
-rw-r--r--dviware/beebe/src/chargf.h344
-rw-r--r--dviware/beebe/src/charpk.h344
-rw-r--r--dviware/beebe/src/charpxl.h55
-rw-r--r--dviware/beebe/src/clrbmap.h53
-rw-r--r--dviware/beebe/src/clrrow.h16
-rw-r--r--dviware/beebe/src/commands.h114
-rw-r--r--dviware/beebe/src/cuseri.c58
-rw-r--r--dviware/beebe/src/cvt.c70
-rw-r--r--dviware/beebe/src/dbgopen.h26
-rw-r--r--dviware/beebe/src/derun.c137
-rw-r--r--dviware/beebe/src/dispchar.h166
-rw-r--r--dviware/beebe/src/dumpchar.h34
-rw-r--r--dviware/beebe/src/dvi.xrf3478
-rw-r--r--dviware/beebe/src/dvialw.c1935
-rw-r--r--dviware/beebe/src/dvialw.ps296
-rw-r--r--dviware/beebe/src/dvibit.c1027
-rw-r--r--dviware/beebe/src/dvica2.c1048
-rw-r--r--dviware/beebe/src/dvican.c809
-rw-r--r--dviware/beebe/src/dvidjp.c579
-rw-r--r--dviware/beebe/src/dvie72.c712
-rw-r--r--dviware/beebe/src/dvieps.c722
-rw-r--r--dviware/beebe/src/dvifile.h158
-rw-r--r--dviware/beebe/src/dvigd.c344
-rw-r--r--dviware/beebe/src/dvihead.h359
-rw-r--r--dviware/beebe/src/dviimp.c711
-rw-r--r--dviware/beebe/src/dviinit.h374
-rw-r--r--dviware/beebe/src/dvijep.c1120
-rw-r--r--dviware/beebe/src/dvijet.c333
-rw-r--r--dviware/beebe/src/dvil3p.c340
-rw-r--r--dviware/beebe/src/dvil75.c325
-rw-r--r--dviware/beebe/src/dvim72.c517
-rw-r--r--dviware/beebe/src/dvimac.c517
-rw-r--r--dviware/beebe/src/dvimpi.c430
-rw-r--r--dviware/beebe/src/dvio72.c354
-rw-r--r--dviware/beebe/src/dvioki.c354
-rw-r--r--dviware/beebe/src/dviprx.c335
-rw-r--r--dviware/beebe/src/dviterm.h96
-rw-r--r--dviware/beebe/src/dvitos.c513
-rw-r--r--dviware/beebe/src/errshow.c105
-rw-r--r--dviware/beebe/src/f20open.h77
-rw-r--r--dviware/beebe/src/fatal.h81
-rw-r--r--dviware/beebe/src/fillrect.h52
-rw-r--r--dviware/beebe/src/findpost.h31
-rw-r--r--dviware/beebe/src/fixpos.h36
-rw-r--r--dviware/beebe/src/fontfile.h242
-rw-r--r--dviware/beebe/src/fontsub.h150
-rw-r--r--dviware/beebe/src/gblprocs.h494
-rw-r--r--dviware/beebe/src/gblvars.h324
-rw-r--r--dviware/beebe/src/gendefs.h113
-rw-r--r--dviware/beebe/src/getbmap.h35
-rw-r--r--dviware/beebe/src/getbytes.h18
-rw-r--r--dviware/beebe/src/getfntdf.h25
-rw-r--r--dviware/beebe/src/getlog.c33
-rw-r--r--dviware/beebe/src/getpgtab.h40
-rw-r--r--dviware/beebe/src/inch.h104
-rw-r--r--dviware/beebe/src/initglob.h122
-rw-r--r--dviware/beebe/src/keybrd.c920
-rw-r--r--dviware/beebe/src/keydef.h50
-rw-r--r--dviware/beebe/src/keytst.c116
-rw-r--r--dviware/beebe/src/loadchar.h66
-rw-r--r--dviware/beebe/src/machdefs.h834
-rw-r--r--dviware/beebe/src/main.h199
-rw-r--r--dviware/beebe/src/makefile524
-rw-r--r--dviware/beebe/src/movedown.h35
-rw-r--r--dviware/beebe/src/moveover.h38
-rw-r--r--dviware/beebe/src/moveto.h16
-rw-r--r--dviware/beebe/src/nosignex.h22
-rw-r--r--dviware/beebe/src/openfont.h324
-rw-r--r--dviware/beebe/src/option.h337
-rw-r--r--dviware/beebe/src/outrow.h27
-rw-r--r--dviware/beebe/src/pc/makefile.msc524
-rw-r--r--dviware/beebe/src/prtpage.h299
-rw-r--r--dviware/beebe/src/prxbmap.h132
-rw-r--r--dviware/beebe/src/qsort.c80
-rw-r--r--dviware/beebe/src/readfont.h41
-rw-r--r--dviware/beebe/src/readgf.h178
-rw-r--r--dviware/beebe/src/readpk.h166
-rw-r--r--dviware/beebe/src/readpost.h59
-rw-r--r--dviware/beebe/src/readpxl.h78
-rw-r--r--dviware/beebe/src/reldfont.h97
-rw-r--r--dviware/beebe/src/rulepxl.h22
-rw-r--r--dviware/beebe/src/setchar.h50
-rw-r--r--dviware/beebe/src/setfntnm.h34
-rw-r--r--dviware/beebe/src/setrule.h30
-rw-r--r--dviware/beebe/src/signex.h57
-rw-r--r--dviware/beebe/src/skgfspec.h48
-rw-r--r--dviware/beebe/src/skipfont.h23
-rw-r--r--dviware/beebe/src/skpkspec.h48
-rw-r--r--dviware/beebe/src/special.h14
-rw-r--r--dviware/beebe/src/strchr.h35
-rw-r--r--dviware/beebe/src/strcm2.h33
-rw-r--r--dviware/beebe/src/strid2.h37
-rw-r--r--dviware/beebe/src/strrchr.h29
-rw-r--r--dviware/beebe/src/tctos.h21
-rw-r--r--dviware/beebe/src/tops20/makefile.d2041
-rw-r--r--dviware/beebe/src/tops20/makefile.kcc470
-rw-r--r--dviware/beebe/src/tops20/makefile.pcc502
-rw-r--r--dviware/beebe/src/tops20/zrmkcc.c13
-rw-r--r--dviware/beebe/src/tosprx.c388
-rw-r--r--dviware/beebe/src/typedefs.h48
-rw-r--r--dviware/beebe/src/unix/makefile.unx529
-rw-r--r--dviware/beebe/src/usage.h80
-rw-r--r--dviware/beebe/src/vms/00make.com71
-rw-r--r--dviware/beebe/src/vms/ccom.com79
-rw-r--r--dviware/beebe/src/vms/makefile.vms520
-rw-r--r--dviware/beebe/src/vms/vaxvms.c1023
-rw-r--r--dviware/beebe/src/warning.h78
-rw-r--r--dviware/beebe/src/zerom.mac25
120 files changed, 32756 insertions, 0 deletions
diff --git a/dviware/beebe/src/00arit.c b/dviware/beebe/src/00arit.c
new file mode 100644
index 0000000000..91fa6ccda3
--- /dev/null
+++ b/dviware/beebe/src/00arit.c
@@ -0,0 +1,92 @@
+/***********************************************************************
+Test properties of the host arithmetic, and determine whether right
+shifts propagate the sign bit. This should be run three times:
+
+ cc -DSIZE=short 00arit.c
+ cc -DSIZE=int 00arit.c
+ cc -DSIZE=long 00arit.c
+
+[11-Apr-87]
+***********************************************************************/
+#include <stdio.h>
+
+#ifndef SIZE
+#define SIZE int
+#endif
+
+typedef SIZE INT;
+typedef unsigned SIZE UINT;
+
+UINT store();
+void store2();
+
+main()
+{
+ int wordsize;
+ int k;
+ UINT mask;
+ INT s;
+ UINT u;
+
+ s = ~0;
+ if (s == 0)
+ (void)printf("One's complement host arithmetic\n\n");
+ else if (s == -1)
+ (void)printf("Two's complement host arithmetic\n\n");
+ else
+ (void)printf("Unrecognized host arithmetic architecture\n\n");
+
+ mask = 1;
+ wordsize = 1;
+ s = (INT)mask;
+ while ((store(mask << 1) != 0) && (wordsize < 129))
+ {
+ mask = store(mask << 1);
+ s = (INT)mask;
+ wordsize++;
+ }
+ if (wordsize > 128)
+ {
+ (void)printf(
+ "Something looks wrong--host has more than %d bits in an integer!\n\n",
+ wordsize);
+ exit(1);
+ }
+ else
+ (void)printf("There are %d bits in an integer\n\n",wordsize);
+
+ (void)printf("Test of right-shift of signed integer\n");
+ s = (INT)mask;
+ for (k = 0; k <= wordsize; ++k)
+ {
+ (void)printf(" (int)0x%lx >> %2d = %lx\n",
+ (long)mask,k,(long)((INT)(s>>k)));
+ }
+ (void)printf("\n\n\n");
+
+ (void)printf("Test of right-shift of unsigned integer\n");
+ u = (UINT)mask;
+ for (k = 0; k <= wordsize; ++k)
+ {
+ (void)printf(" (unsigned)0x%lx >> %2d = %lx\n",
+ (long)((unsigned)mask),k,(long)((UINT)(u>>k)));
+ }
+ exit(0);
+}
+
+static INT word;
+
+UINT
+store(u) /* force memory store */
+UINT u;
+{
+ word = u; /* store k globally */
+ store2(); /* possibly change it */
+ return (word); /* return changed value */
+}
+
+void
+store2()
+{
+ word = word;
+}
diff --git a/dviware/beebe/src/00dir.cmd b/dviware/beebe/src/00dir.cmd
new file mode 100644
index 0000000000..917690cc52
--- /dev/null
+++ b/dviware/beebe/src/00dir.cmd
@@ -0,0 +1,185 @@
+
+get 00arit.c
+get 00mail.1
+get 00mail.10
+get 00mail.11
+get 00mail.12
+get 00mail.13
+get 00mail.14
+get 00mail.15
+get 00mail.16
+get 00mail.17
+get 00mail.2
+get 00mail.3
+get 00mail.4
+get 00mail.5
+get 00mail.6
+get 00mail.7
+get 00mail.8
+get 00mail.9
+get 00make.com
+get 00readme.txt
+get 00revhst.txt
+get 00tdir.cmd
+get 00tdir.lst
+get 01readme.txt
+get abortrun.h
+get actfact.h
+get alldone.h
+get bintnx.c
+get bintnxvms.c
+get bitmap.h
+get ccom.com
+get chargf.h
+get charpk.h
+get charpxl.h
+get clrbmap.h
+get clrrow.h
+get commands.h
+get cuseri.c
+get cvt.c
+get dbgopen.h
+get derun.c
+get dispchar.h
+get dumpchar.h
+get dvi.tarz
+get dvi.xrf
+get dvialw.c
+get dvialw.dif
+get dvialw.ps
+get dvibit.c
+get dvica2.c
+get dvican.c
+get dvie72.c
+get dvieps.c
+get dviexe.arc
+get dvifile.h
+get dvigd.c
+get dvihead.h
+get dviimp.c
+get dviinit.h
+get dvijep.c
+get dvijep.dif
+get dvijet.c
+get dvil3p.c
+get dvil75.c
+get dvim72.c
+get dvimac.c
+get dvimpi.c
+get dvio72.c
+get dvioki.c
+get dviprx.c
+get dviterm.h
+get dvitos.c
+get errshow.c
+get f20open.h
+get fatal.h
+get fillrect.h
+get findpost.h
+get fixpos.h
+get fontfile.h
+get fontsub.h
+get foo.aux
+get foo.dvi
+get foo.dvi-alw
+get foo.lst
+get gblprocs.h
+get gblvars.h
+get gendefs.h
+get getbmap.h
+get getbytes.h
+get getfntdf.h
+get getlog.c
+get getpgtab.h
+get hd.c
+get inch.h
+get initglob.h
+get keybrd.c
+get keydef.h
+get keytst.c
+get loadchar.h
+get lpt.ps
+get lptops.1l
+get lptops.c
+get lptops.hlp
+get lw78.c
+get machdefs.h
+get main.h
+get makefile.
+get makefile.ast
+get makefile.kcc
+get makefile.msc
+get makefile.pcc
+get makefile.unx
+get makefile.vms
+get movedown.h
+get moveover.h
+get moveto.h
+get nosignex.h
+get openfont.h
+get option.h
+get outrow.h
+get pcmake.arc
+get pcmake.uue
+get prtpage.h
+get prxbmap.h
+get qsort.c
+get readfont.h
+get readgf.h
+get readpk.h
+get readpost.h
+get readpxl.h
+get reldfont.h
+get rulepxl.h
+get setchar.h
+get setfntnm.h
+get setrule.h
+get signex.h
+get skgfspec.h
+get skipfont.h
+get skpkspec.h
+get special.h
+get story.dvi
+get story.dvi-alw
+get story.dvi-can
+get story.dvi-e72
+get story.dvi-eps
+get story.dvi-err
+get story.dvi-imp
+get story.dvi-jep
+get story.dvi-jet
+get story.dvi-l75
+get story.dvi-m72
+get story.dvi-mac
+get story.dvi-mpi
+get story.dvi-o72
+get story.dvi-oki
+get story.dvi-prx
+get story.dvi-tos
+get story.lst
+get story.tex
+get strchr.h
+get strcm2.h
+get strid2.h
+get strrchr.h
+get tctos.h
+get texidx.c
+get texidx.hlp
+get tosprx.c
+get typedefs.h
+get unhd.c
+get usage.h
+get vaxvms.c
+get warning.h
+get ws87.pas
+get wsltex.c
+get wsltex.let
+get wsltex.pas
+get xport.arc
+get xref.
+get xref1.awk
+get xref2.awk
+get xref3.awk
+get xxu.c
+get zerom.mac
+get zrmkcc.c
diff --git a/dviware/beebe/src/00dir.lst b/dviware/beebe/src/00dir.lst
new file mode 100644
index 0000000000..0a8ab32291
--- /dev/null
+++ b/dviware/beebe/src/00dir.lst
@@ -0,0 +1,189 @@
+
+ APS:<TEX.DVI>
+ 00ARIT.C.7;P777752 1 2050(7) 24-Oct-87 17:03:01 BEEBE
+ 00MAIL.1.1;P777752 2 4309(7) 25-Feb-87 11:42:07 BEEBE
+ 00MAIL.10.2;P777752 8 18741(7) 20-Aug-87 09:09:32 BEEBE
+ 00MAIL.11.1;P777752 2 4806(7) 20-Aug-87 17:15:20 BEEBE
+ 00MAIL.12.1;P777752 14 34981(7) 28-Sep-87 20:59:15 BEEBE
+ 00MAIL.13.1;P777752 10 23794(7) 1-Oct-87 14:08:50 BEEBE
+ 00MAIL.14.12;P777752 13 30795(7) 2-Nov-87 11:29:33 BEEBE
+ 00MAIL.15.1;P777752 4 8683(7) 9-Dec-87 18:14:03 BEEBE
+ 00MAIL.16.1;P777752 11 26288(7) 30-May-88 19:44:56 BEEBE
+ 00MAIL.17.1;P777752 3 5140(7) 31-May-88 18:42:20 BEEBE
+ 00MAIL.2.1;P777752 4 8696(7) 25-Feb-87 11:42:13 BEEBE
+ 00MAIL.3.1;P777752 5 10513(7) 25-Feb-87 11:42:20 BEEBE
+ 00MAIL.4.1;P777752 2 3124(7) 25-Feb-87 11:42:47 BEEBE
+ 00MAIL.5.1;P777752 1 1674(7) 26-Feb-87 14:00:42 BEEBE
+ 00MAIL.6.1;P777752 3 5339(7) 4-Mar-87 18:30:14 BEEBE
+ 00MAIL.7.1;P777752 2 3592(7) 20-Apr-87 18:10:06 BEEBE
+ 00MAIL.8.4;P777752 4 9311(7) 29-Apr-87 18:56:00 BEEBE
+ 00MAIL.9.1;P777752 4 9284(7) 22-Jul-87 13:28:31 BEEBE
+ 00MAKE.COM.1;P777752 2 2735(7) 22-Jan-87 14:51:22 BEEBE
+ 00README.TXT.13;P777752 3 5126(7) 28-Jan-87 18:06:59 BEEBE
+ 00REVHST.TXT.219;P777752 40 100955(7) 7-Jun-88 20:56:58 BEEBE
+ 00TDIR.CMD.1;P777752 2 2787(7) 7-Jun-88 20:59:55 BEEBE
+ 00TDIR.LST.1;P777752 6 13377(7) 7-Jun-88 20:59:44 BEEBE
+ 01README.TXT.1;P777752 3 5780(7) 17-Nov-87 14:06:42 BEEBE
+ ABORTRUN.H.4;P777752 1 1219(7) 4-Mar-87 17:21:50 BEEBE
+ ACTFACT.H.1;P777752 1 1482(7) 24-Mar-86 21:07:21 BEEBE
+ ALLDONE.H.3;P777752 1 732(7) 21-Dec-86 16:17:37 BEEBE
+ BINTNX.C.2;P777752 1 1125(7) 24-Oct-87 17:06:56 BEEBE
+ BINTNXVMS.C.2;P777752 5 10823(7) 24-Oct-87 17:05:57 BEEBE
+ BITMAP.H.4;P777752 1 2490(7) 15-Aug-87 08:04:10 BEEBE
+ CCOM.COM.1;P777752 1 2419(7) 22-Jan-87 14:52:00 BEEBE
+ CHARGF.H.14;P777752 5 10691(7) 21-Oct-87 15:30:34 BEEBE
+ CHARPK.H.13;P777752 5 10896(7) 21-Oct-87 15:31:04 BEEBE
+ CHARPXL.H.8;P777752 1 1600(7) 21-Oct-87 15:31:15 BEEBE
+ CLRBMAP.H.3;P777752 1 1358(7) 22-Jun-87 10:59:42 BEEBE
+ CLRROW.H.2;P777752 1 511(7) 27-Apr-86 23:50:07 BEEBE
+ COMMANDS.H.1;P777752 2 3161(7) 26-Apr-86 15:42:05 BEEBE
+ CUSERI.C.4;P777752 1 1261(7) 28-Oct-87 17:39:55 BEEBE
+ CVT.C.1;P777752 1 1568(7) 22-Aug-87 10:56:12 BEEBE
+ DBGOPEN.H.5;P777752 1 831(7) 21-Oct-87 10:14:03 BEEBE
+ DERUN.C.1;P777752 2 3068(7) 24-Mar-86 21:09:51 BEEBE
+ DISPCHAR.H.6;P777752 3 6000(7) 21-Oct-87 10:14:31 BEEBE
+ DOC.DIRECTORY.1;P20202 0 0(0) 26-Mar-88 03:35:51 OPERATOR
+ DUMPCHAR.H.1;P777752 1 1100(7) 24-Mar-86 21:11:16 BEEBE
+ DVI.TARZ.1;P777752 505 1040384(8) 17-Nov-87 21:56:22 BEEBE
+ DVI.XRF.6;P777752 97 247105(7) 17-Nov-87 21:08:06 BEEBE
+ DVIALW.C.79;P777752 24 58917(7) 3-Feb-88 16:38:28 BEEBE
+ DVIALW.DIF.1;P777752 1 30(7) 7-Jun-88 16:38:59 BEEBE
+ DVIALW.PS.17;P777752 4 9351(7) 18-Sep-87 17:48:10 BEEBE
+ DVIBIT.C.51;P777752 12 29914(7) 1-Nov-87 12:08:14 BEEBE
+ DVICA2.C.33;P777752 13 31705(7) 1-Nov-87 10:20:50 BEEBE
+ DVICAN.C.68;P777752 10 25361(7) 1-Nov-87 11:56:32 BEEBE
+ DVIE72.C.10;P777752 8 20093(7) 14-Nov-87 08:41:30 BEEBE
+ DVIEPS.C.13;P777752 8 20093(7) 14-Nov-87 08:41:54 BEEBE
+ DVIEXE.ARC.1;P777752 169 344232(8) 30-May-88 23:57:40 BEEBE
+ DVIFILE.H.10;P777752 3 5259(7) 15-Aug-87 15:45:22 BEEBE
+ DVIGD.C.21;P777752 5 11034(7) 1-Nov-87 10:57:29 BEEBE
+ DVIHEAD.H.14;P777752 7 16934(7) 14-Nov-87 19:58:04 BEEBE
+ DVIIMP.C.27;P777752 9 22707(7) 1-Nov-87 10:33:41 BEEBE
+ DVIINIT.H.41;P777752 5 10863(7) 24-Oct-87 16:55:24 BEEBE
+ DVIJEP.C.74;P777752 15 38306(7) 30-May-88 19:18:54 BEEBE
+ DVIJEP.DIF.1;P777752 1 443(7) 7-Jun-88 16:38:47 BEEBE
+ DVIJET.C.19;P777752 4 9713(7) 1-Nov-87 10:58:13 BEEBE
+ DVIL3P.C.9;P777752 4 9842(7) 1-Nov-87 11:27:08 BEEBE
+ DVIL75.C.11;P777752 4 9356(7) 1-Nov-87 11:26:37 BEEBE
+ DVIM72.C.19;P777752 6 14252(7) 1-Nov-87 11:09:47 BEEBE
+ DVIMAC.C.19;P777752 6 14253(7) 1-Nov-87 11:09:49 BEEBE
+ DVIMPI.C.19;P777752 5 12309(7) 1-Nov-87 11:01:57 BEEBE
+ DVIO72.C.21;P777752 4 10025(7) 1-Nov-87 11:04:11 BEEBE
+ DVIOKI.C.21;P777752 4 10026(7) 1-Nov-87 11:05:22 BEEBE
+ DVIPRX.C.22;P777752 4 9713(7) 1-Nov-87 11:15:21 BEEBE
+ DVITERM.H.15;P777752 1 2434(7) 21-Oct-87 15:04:45 BEEBE
+ DVITOS.C.20;P777752 7 15964(7) 1-Nov-87 10:51:32 BEEBE
+ ERRSHOW.C.3;P777752 1 2149(7) 24-Oct-87 17:03:41 BEEBE
+ F20OPEN.H.6;P777752 1 2135(7) 1-Nov-87 11:25:25 BEEBE
+ FATAL.H.10;P777752 1 2349(7) 15-Aug-87 09:58:03 BEEBE
+ FILLRECT.H.3;P777752 1 1695(7) 9-Sep-86 12:43:32 BEEBE
+ FINDPOST.H.4;P777752 1 849(7) 15-Dec-86 17:23:46 BEEBE
+ FIXPOS.H.1;P777752 1 1202(7) 29-Mar-86 19:09:52 BEEBE
+ FONTFILE.H.21;P777752 3 7179(7) 15-Aug-87 09:58:41 BEEBE
+ FONTSUB.H.6;P777752 3 5185(7) 21-Dec-86 16:15:54 BEEBE
+ FOO.AUX.3;P777752 1 145(7) 7-Jun-88 17:22:49 BEEBE
+ FOO.DVI.3;P777752 1 824(8) 7-Jun-88 17:22:52 BEEBE
+ FOO.DVI-ALW.3;P777752 7 17360(7) 7-Jun-88 17:22:58 BEEBE
+ FOO.LST.3;P777752 1 1676(7) 7-Jun-88 17:22:38 BEEBE
+ GBLPROCS.H.37;P777752 5 10630(7) 17-Nov-87 20:18:36 BEEBE
+ GBLVARS.H.44;P777752 6 14168(7) 23-Oct-87 13:35:38 BEEBE
+ GENDEFS.H.24;P777752 2 3811(7) 1-Nov-87 10:15:09 BEEBE
+ GETBMAP.H.9;P777752 1 975(7) 29-Oct-87 08:07:19 BEEBE
+ GETBYTES.H.1;P777752 1 504(7) 29-Mar-86 10:46:41 BEEBE
+ GETFNTDF.H.3;P777752 1 844(7) 28-Apr-86 17:54:23 BEEBE
+ GETLOG.C.11;P777752 1 766(7) 15-Aug-87 08:05:38 BEEBE
+ GETPGTAB.H.4;P777752 1 1169(7) 15-Dec-86 17:23:56 BEEBE
+ HD.C.12;P777752 1 2116(7) 15-Aug-87 09:59:07 BEEBE
+ INCH.H.4;P777752 2 3095(7) 18-Dec-86 11:29:06 BEEBE
+ INITGLOB.H.19;P777752 2 4129(7) 7-Jun-88 20:57:30 BEEBE
+ KEYBRD.C.6;P777752 11 26298(7) 16-Nov-87 11:04:24 BEEBE
+ KEYDEF.H.3;P777752 1 1187(7) 16-Nov-87 11:03:28 BEEBE
+ KEYTST.C.5;P777752 1 2338(7) 16-Nov-87 10:48:40 BEEBE
+ LOADCHAR.H.8;P777752 2 2735(7) 13-Nov-86 09:00:30 BEEBE
+ LPT.PS.2;P777752 2 4901(7) 6-Feb-88 12:08:31 BEEBE
+ LPTOPS.1L.3;P777752 4 8330(7) 5-May-88 12:05:58 BEEBE
+ LPTOPS.C.25;P777752 20 50215(7) 4-May-88 10:51:00 BEEBE
+ LPTOPS.HLP.2;P777752 3 6734(7) 3-May-88 19:04:53 BEEBE
+ LW78.C.30;P777752 9 22709(7) 1-Nov-87 11:24:01 BEEBE
+ MACHDEFS.H.90;P777752 11 25658(7) 17-Nov-87 19:53:52 BEEBE
+ MAIN.H.26;P777752 2 4987(7) 14-Nov-87 19:58:00 BEEBE
+ MAKEFILE..26;P777752 7 17116(7) 30-Oct-87 14:05:27 BEEBE
+ MAKEFILE.AST.14;P777752 8 18372(7) 31-Oct-87 11:51:48 BEEBE
+ MAKEFILE.KCC.48;P777752 7 16307(7) 31-Oct-87 11:52:01 BEEBE
+ MAKEFILE.MSC.13;P777752 8 18188(7) 16-Nov-87 15:53:58 BEEBE
+ MAKEFILE.PCC.23;P777752 7 17107(7) 31-Oct-87 11:52:17 BEEBE
+ MAKEFILE.UNX.29;P777752 8 19064(7) 17-Nov-87 20:15:12 BEEBE
+ MAKEFILE.VMS.17;P777752 8 18435(7) 31-Oct-87 11:52:50 BEEBE
+ MOVEDOWN.H.4;P777752 1 1223(7) 6-Jan-87 22:55:19 BEEBE
+ MOVEOVER.H.6;P777752 1 1384(7) 6-Jan-87 22:55:31 BEEBE
+ MOVETO.H.1;P777752 1 339(7) 24-Mar-86 21:32:47 BEEBE
+ NOSIGNEX.H.1;P777752 1 614(7) 24-Mar-86 21:33:05 BEEBE
+ OPENFONT.H.53;P777752 5 11433(7) 1-Nov-87 11:23:27 BEEBE
+ OPTION.H.45;P777752 4 8149(7) 14-Nov-87 18:10:56 BEEBE
+ OUTROW.H.1;P777752 1 1050(7) 26-Apr-86 15:56:27 BEEBE
+ PCMAKE.ARC.2;P777752 34 69166(8) 18-Nov-87 11:34:23 BEEBE
+ PCMAKE.UUE.1;P777752 38 96868(7) 20-Jan-88 17:36:55 BEEBE
+ PRTPAGE.H.42;P777752 4 7685(7) 30-Oct-87 17:12:54 BEEBE
+ PRXBMAP.H.3;P777752 2 4323(7) 15-Aug-87 10:44:24 BEEBE
+ QSORT.C.1;P777752 1 2115(7) 14-Nov-87 23:19:24 BEEBE
+ READFONT.H.10;P777752 1 1298(7) 10-Apr-87 12:26:38 BEEBE
+ READGF.H.22;P777752 3 5648(7) 10-Oct-87 19:37:31 BEEBE
+ READPK.H.14;P777752 3 6178(7) 30-Sep-87 14:53:40 BEEBE
+ READPOST.H.5;P777752 1 1835(7) 21-Oct-87 15:20:22 BEEBE
+ READPXL.H.11;P777752 2 2927(7) 30-Sep-87 14:46:31 BEEBE
+ RELDFONT.H.5;P777752 2 2895(7) 30-Sep-87 14:30:17 BEEBE
+ RULEPXL.H.1;P777752 1 627(7) 24-Mar-86 21:34:51 BEEBE
+ SETCHAR.H.8;P777752 1 1405(7) 26-Oct-87 10:23:06 BEEBE
+ SETFNTNM.H.5;P777752 1 943(7) 31-Dec-86 14:13:09 BEEBE
+ SETRULE.H.1;P777752 1 826(7) 29-Mar-86 19:06:47 BEEBE
+ SIGNEX.H.4;P777752 1 1870(7) 14-Aug-87 14:02:18 BEEBE
+ SKGFSPEC.H.3;P777752 1 1197(7) 15-Dec-86 17:24:39 BEEBE
+ SKIPFONT.H.1;P777752 1 594(7) 24-Mar-86 21:35:59 BEEBE
+ SKPKSPEC.H.3;P777752 1 1197(7) 15-Dec-86 17:25:31 BEEBE
+ SPECIAL.H.3;P777752 1 479(7) 28-Apr-86 17:49:58 BEEBE
+ STORY.DVI.1;P777752 1 672(8) 28-Jan-87 16:46:39 BEEBE
+ STORY.DVI-ALW.3;P777752 6 12950(7) 28-Oct-87 16:51:51 BEEBE
+ STORY.DVI-CAN.2;P777752 8 15992(8) 28-Oct-87 16:52:11 BEEBE
+ STORY.DVI-E72.1;P777752 4 6400(8) 28-Oct-87 16:52:28 BEEBE
+ STORY.DVI-EPS.1;P777752 23 46708(8) 28-Oct-87 16:52:41 BEEBE
+ STORY.DVI-ERR.6;P777752 1 1955(7) 28-Oct-87 17:01:19 BEEBE
+ STORY.DVI-IMP.2;P777752 3 4876(8) 28-Oct-87 16:55:12 BEEBE
+ STORY.DVI-JEP.2;P777752 4 6164(8) 28-Oct-87 16:55:24 BEEBE
+ STORY.DVI-JET.2;P777752 5 8536(8) 28-Oct-87 16:55:41 BEEBE
+ STORY.DVI-L75.1;P777752 8 18855(7) 28-Oct-87 16:56:14 BEEBE
+ STORY.DVI-M72.2;P777752 5 10120(8) 28-Oct-87 16:57:24 BEEBE
+ STORY.DVI-MAC.2;P777752 9 17184(8) 28-Oct-87 16:57:51 BEEBE
+ STORY.DVI-MPI.2;P777752 8 19085(7) 28-Oct-87 16:58:44 BEEBE
+ STORY.DVI-O72.2;P777752 5 10310(7) 28-Oct-87 16:59:14 BEEBE
+ STORY.DVI-OKI.2;P777752 6 14055(7) 28-Oct-87 16:59:32 BEEBE
+ STORY.DVI-PRX.2;P777752 5 11365(7) 28-Oct-87 17:00:56 BEEBE
+ STORY.DVI-TOS.2;P777752 17 42895(7) 28-Oct-87 17:01:13 BEEBE
+ STORY.LST.1;P777752 1 192(7) 28-Jan-87 16:46:34 BEEBE
+ STORY.TEX.1;P777752 1 393(7) 28-Mar-86 21:41:50 BEEBE
+ STRCHR.H.5;P777752 1 782(7) 1-Nov-87 11:23:37 BEEBE
+ STRCM2.H.2;P777752 1 882(7) 15-Dec-86 17:24:45 BEEBE
+ STRID2.H.6;P777752 1 1175(7) 19-Dec-86 22:13:43 BEEBE
+ STRRCHR.H.3;P777752 1 817(7) 1-Nov-87 11:23:50 BEEBE
+ TCTOS.H.8;P777752 1 777(7) 24-Oct-87 16:57:20 BEEBE
+ TEXIDX.C.14;P777752 18 44413(7) 13-Jan-88 11:51:49 BEEBE
+ TEXIDX.HLP.2;P777752 3 6947(7) 7-Jan-88 13:50:44 BEEBE
+ TOSPRX.C.14;P777752 5 10302(7) 14-Nov-87 22:21:34 BEEBE
+ TYPEDEFS.H.2;P777752 1 1441(7) 18-Dec-86 15:35:30 BEEBE
+ UNHD.C.7;P777752 1 1208(7) 15-Aug-87 10:04:04 BEEBE
+ USAGE.H.11;P777752 1 2429(7) 31-Oct-87 11:18:54 BEEBE
+ VAXVMS.C.14;P777752 12 28521(7) 14-Apr-88 10:13:00 BEEBE
+ WARNING.H.7;P777752 1 2244(7) 21-Feb-87 16:29:58 BEEBE
+ WS87.PAS.1;P777752 1 1101(7) 10-Oct-85 16:48:16 BEEBE
+ WSLTEX.C.5;P777752 10 24229(7) 15-Aug-87 12:34:53 BEEBE
+ WSLTEX.LET.2;P777752 2 3066(7) 5-Jan-86 17:22:46 BEEBE
+ WSLTEX.PAS.2;P777752 6 12885(7) 5-Jan-86 17:15:57 BEEBE
+ XPORT.ARC.1;P777752 7 13895(8) 27-Mar-87 22:00:32 BEEBE
+ XREF..5;P777752 1 643(7) 27-Oct-87 20:04:13 BEEBE
+ XREF1.AWK.2;P777752 1 1501(7) 20-Jul-87 14:01:22 BEEBE
+ XREF2.AWK.2;P777752 1 2081(7) 9-Sep-87 09:52:31 BEEBE
+ XREF3.AWK.2;P777752 1 2386(7) 9-Sep-87 09:53:19 BEEBE
+ XXU.C.5;P777752 3 5480(7) 24-Oct-87 17:08:45 BEEBE
+ ZEROM.MAC.1;P777752 1 641(7) 28-Mar-86 11:45:39 BEEBE
+ ZRMKCC.C.1;P777752 1 345(7) 21-Feb-87 15:43:01 BEEBE
+
+ Total of 1609 pages in 185 files
diff --git a/dviware/beebe/src/00tdir.cmd b/dviware/beebe/src/00tdir.cmd
new file mode 100644
index 0000000000..86627ba1dc
--- /dev/null
+++ b/dviware/beebe/src/00tdir.cmd
@@ -0,0 +1,189 @@
+
+ APS:<TEX.DVI>
+ 00DIR.CMD.1;P777752 2 2789(7) 7-Jun-88 20:58:36 BEEBE
+ 00DIR.LST.1;P777752 6 13377(7) 7-Jun-88 20:58:25 BEEBE
+ INITGLOB.H.19;P777752 2 4129(7) 7-Jun-88 20:57:30 BEEBE
+ 00REVHST.TXT.219;P777752 40 100955(7) 7-Jun-88 20:56:58 BEEBE
+ FOO.DVI-ALW.3;P777752 7 17360(7) 7-Jun-88 17:22:58 BEEBE
+ FOO.DVI.3;P777752 1 824(8) 7-Jun-88 17:22:52 BEEBE
+ FOO.AUX.3;P777752 1 145(7) 7-Jun-88 17:22:49 BEEBE
+ FOO.LST.3;P777752 1 1676(7) 7-Jun-88 17:22:38 BEEBE
+ DVIALW.DIF.1;P777752 1 30(7) 7-Jun-88 16:38:59 BEEBE
+ DVIJEP.DIF.1;P777752 1 443(7) 7-Jun-88 16:38:47 BEEBE
+ 00MAIL.17.1;P777752 3 5140(7) 31-May-88 18:42:20 BEEBE
+ DVIEXE.ARC.1;P777752 169 344232(8) 30-May-88 23:57:40 BEEBE
+ 00MAIL.16.1;P777752 11 26288(7) 30-May-88 19:44:56 BEEBE
+ DVIJEP.C.74;P777752 15 38306(7) 30-May-88 19:18:54 BEEBE
+ LPTOPS.1L.3;P777752 4 8330(7) 5-May-88 12:05:58 BEEBE
+ LPTOPS.C.25;P777752 20 50215(7) 4-May-88 10:51:00 BEEBE
+ LPTOPS.HLP.2;P777752 3 6734(7) 3-May-88 19:04:53 BEEBE
+ VAXVMS.C.14;P777752 12 28521(7) 14-Apr-88 10:13:00 BEEBE
+ DOC.DIRECTORY.1;P20202 0 0(0) 26-Mar-88 03:35:51 OPERATOR
+ LPT.PS.2;P777752 2 4901(7) 6-Feb-88 12:08:31 BEEBE
+ DVIALW.C.79;P777752 24 58917(7) 3-Feb-88 16:38:28 BEEBE
+ PCMAKE.UUE.1;P777752 38 96868(7) 20-Jan-88 17:36:55 BEEBE
+ TEXIDX.C.14;P777752 18 44413(7) 13-Jan-88 11:51:49 BEEBE
+ TEXIDX.HLP.2;P777752 3 6947(7) 7-Jan-88 13:50:44 BEEBE
+ 00MAIL.15.1;P777752 4 8683(7) 9-Dec-87 18:14:03 BEEBE
+ PCMAKE.ARC.2;P777752 34 69166(8) 18-Nov-87 11:34:23 BEEBE
+ DVI.TARZ.1;P777752 505 1040384(8) 17-Nov-87 21:56:22 BEEBE
+ DVI.XRF.6;P777752 97 247105(7) 17-Nov-87 21:08:06 BEEBE
+ GBLPROCS.H.37;P777752 5 10630(7) 17-Nov-87 20:18:36 BEEBE
+ MAKEFILE.UNX.29;P777752 8 19064(7) 17-Nov-87 20:15:12 BEEBE
+ MACHDEFS.H.90;P777752 11 25658(7) 17-Nov-87 19:53:52 BEEBE
+ 01README.TXT.1;P777752 3 5780(7) 17-Nov-87 14:06:42 BEEBE
+ MAKEFILE.MSC.13;P777752 8 18188(7) 16-Nov-87 15:53:58 BEEBE
+ KEYBRD.C.6;P777752 11 26298(7) 16-Nov-87 11:04:24 BEEBE
+ KEYDEF.H.3;P777752 1 1187(7) 16-Nov-87 11:03:28 BEEBE
+ KEYTST.C.5;P777752 1 2338(7) 16-Nov-87 10:48:40 BEEBE
+ QSORT.C.1;P777752 1 2115(7) 14-Nov-87 23:19:24 BEEBE
+ TOSPRX.C.14;P777752 5 10302(7) 14-Nov-87 22:21:34 BEEBE
+ DVIHEAD.H.14;P777752 7 16934(7) 14-Nov-87 19:58:04 BEEBE
+ MAIN.H.26;P777752 2 4987(7) 14-Nov-87 19:58:00 BEEBE
+ OPTION.H.45;P777752 4 8149(7) 14-Nov-87 18:10:56 BEEBE
+ DVIEPS.C.13;P777752 8 20093(7) 14-Nov-87 08:41:54 BEEBE
+ DVIE72.C.10;P777752 8 20093(7) 14-Nov-87 08:41:30 BEEBE
+ 00MAIL.14.12;P777752 13 30795(7) 2-Nov-87 11:29:33 BEEBE
+ DVIBIT.C.51;P777752 12 29914(7) 1-Nov-87 12:08:14 BEEBE
+ DVICAN.C.68;P777752 10 25361(7) 1-Nov-87 11:56:32 BEEBE
+ DVIL3P.C.9;P777752 4 9842(7) 1-Nov-87 11:27:08 BEEBE
+ DVIL75.C.11;P777752 4 9356(7) 1-Nov-87 11:26:37 BEEBE
+ F20OPEN.H.6;P777752 1 2135(7) 1-Nov-87 11:25:25 BEEBE
+ LW78.C.30;P777752 9 22709(7) 1-Nov-87 11:24:01 BEEBE
+ STRRCHR.H.3;P777752 1 817(7) 1-Nov-87 11:23:50 BEEBE
+ STRCHR.H.5;P777752 1 782(7) 1-Nov-87 11:23:37 BEEBE
+ OPENFONT.H.53;P777752 5 11433(7) 1-Nov-87 11:23:27 BEEBE
+ DVIPRX.C.22;P777752 4 9713(7) 1-Nov-87 11:15:21 BEEBE
+ DVIMAC.C.19;P777752 6 14253(7) 1-Nov-87 11:09:49 BEEBE
+ DVIM72.C.19;P777752 6 14252(7) 1-Nov-87 11:09:47 BEEBE
+ DVIOKI.C.21;P777752 4 10026(7) 1-Nov-87 11:05:22 BEEBE
+ DVIO72.C.21;P777752 4 10025(7) 1-Nov-87 11:04:11 BEEBE
+ DVIMPI.C.19;P777752 5 12309(7) 1-Nov-87 11:01:57 BEEBE
+ DVIJET.C.19;P777752 4 9713(7) 1-Nov-87 10:58:13 BEEBE
+ DVIGD.C.21;P777752 5 11034(7) 1-Nov-87 10:57:29 BEEBE
+ DVITOS.C.20;P777752 7 15964(7) 1-Nov-87 10:51:32 BEEBE
+ DVIIMP.C.27;P777752 9 22707(7) 1-Nov-87 10:33:41 BEEBE
+ DVICA2.C.33;P777752 13 31705(7) 1-Nov-87 10:20:50 BEEBE
+ GENDEFS.H.24;P777752 2 3811(7) 1-Nov-87 10:15:09 BEEBE
+ MAKEFILE.VMS.17;P777752 8 18435(7) 31-Oct-87 11:52:50 BEEBE
+ MAKEFILE.PCC.23;P777752 7 17107(7) 31-Oct-87 11:52:17 BEEBE
+ MAKEFILE.KCC.48;P777752 7 16307(7) 31-Oct-87 11:52:01 BEEBE
+ MAKEFILE.AST.14;P777752 8 18372(7) 31-Oct-87 11:51:48 BEEBE
+ USAGE.H.11;P777752 1 2429(7) 31-Oct-87 11:18:54 BEEBE
+ PRTPAGE.H.42;P777752 4 7685(7) 30-Oct-87 17:12:54 BEEBE
+ MAKEFILE..26;P777752 7 17116(7) 30-Oct-87 14:05:27 BEEBE
+ GETBMAP.H.9;P777752 1 975(7) 29-Oct-87 08:07:19 BEEBE
+ CUSERI.C.4;P777752 1 1261(7) 28-Oct-87 17:39:55 BEEBE
+ STORY.DVI-ERR.6;P777752 1 1955(7) 28-Oct-87 17:01:19 BEEBE
+ STORY.DVI-TOS.2;P777752 17 42895(7) 28-Oct-87 17:01:13 BEEBE
+ STORY.DVI-PRX.2;P777752 5 11365(7) 28-Oct-87 17:00:56 BEEBE
+ STORY.DVI-OKI.2;P777752 6 14055(7) 28-Oct-87 16:59:32 BEEBE
+ STORY.DVI-O72.2;P777752 5 10310(7) 28-Oct-87 16:59:14 BEEBE
+ STORY.DVI-MPI.2;P777752 8 19085(7) 28-Oct-87 16:58:44 BEEBE
+ STORY.DVI-MAC.2;P777752 9 17184(8) 28-Oct-87 16:57:51 BEEBE
+ STORY.DVI-M72.2;P777752 5 10120(8) 28-Oct-87 16:57:24 BEEBE
+ STORY.DVI-L75.1;P777752 8 18855(7) 28-Oct-87 16:56:14 BEEBE
+ STORY.DVI-JET.2;P777752 5 8536(8) 28-Oct-87 16:55:41 BEEBE
+ STORY.DVI-JEP.2;P777752 4 6164(8) 28-Oct-87 16:55:24 BEEBE
+ STORY.DVI-IMP.2;P777752 3 4876(8) 28-Oct-87 16:55:12 BEEBE
+ STORY.DVI-EPS.1;P777752 23 46708(8) 28-Oct-87 16:52:41 BEEBE
+ STORY.DVI-E72.1;P777752 4 6400(8) 28-Oct-87 16:52:28 BEEBE
+ STORY.DVI-CAN.2;P777752 8 15992(8) 28-Oct-87 16:52:11 BEEBE
+ STORY.DVI-ALW.3;P777752 6 12950(7) 28-Oct-87 16:51:51 BEEBE
+ XREF..5;P777752 1 643(7) 27-Oct-87 20:04:13 BEEBE
+ SETCHAR.H.8;P777752 1 1405(7) 26-Oct-87 10:23:06 BEEBE
+ XXU.C.5;P777752 3 5480(7) 24-Oct-87 17:08:45 BEEBE
+ BINTNX.C.2;P777752 1 1125(7) 24-Oct-87 17:06:56 BEEBE
+ BINTNXVMS.C.2;P777752 5 10823(7) 24-Oct-87 17:05:57 BEEBE
+ ERRSHOW.C.3;P777752 1 2149(7) 24-Oct-87 17:03:41 BEEBE
+ 00ARIT.C.7;P777752 1 2050(7) 24-Oct-87 17:03:01 BEEBE
+ TCTOS.H.8;P777752 1 777(7) 24-Oct-87 16:57:20 BEEBE
+ DVIINIT.H.41;P777752 5 10863(7) 24-Oct-87 16:55:24 BEEBE
+ GBLVARS.H.44;P777752 6 14168(7) 23-Oct-87 13:35:38 BEEBE
+ CHARPXL.H.8;P777752 1 1600(7) 21-Oct-87 15:31:15 BEEBE
+ CHARPK.H.13;P777752 5 10896(7) 21-Oct-87 15:31:04 BEEBE
+ CHARGF.H.14;P777752 5 10691(7) 21-Oct-87 15:30:34 BEEBE
+ READPOST.H.5;P777752 1 1835(7) 21-Oct-87 15:20:22 BEEBE
+ DVITERM.H.15;P777752 1 2434(7) 21-Oct-87 15:04:45 BEEBE
+ DISPCHAR.H.6;P777752 3 6000(7) 21-Oct-87 10:14:31 BEEBE
+ DBGOPEN.H.5;P777752 1 831(7) 21-Oct-87 10:14:03 BEEBE
+ READGF.H.22;P777752 3 5648(7) 10-Oct-87 19:37:31 BEEBE
+ 00MAIL.13.1;P777752 10 23794(7) 1-Oct-87 14:08:50 BEEBE
+ READPK.H.14;P777752 3 6178(7) 30-Sep-87 14:53:40 BEEBE
+ READPXL.H.11;P777752 2 2927(7) 30-Sep-87 14:46:31 BEEBE
+ RELDFONT.H.5;P777752 2 2895(7) 30-Sep-87 14:30:17 BEEBE
+ 00MAIL.12.1;P777752 14 34981(7) 28-Sep-87 20:59:15 BEEBE
+ DVIALW.PS.17;P777752 4 9351(7) 18-Sep-87 17:48:10 BEEBE
+ XREF3.AWK.2;P777752 1 2386(7) 9-Sep-87 09:53:19 BEEBE
+ XREF2.AWK.2;P777752 1 2081(7) 9-Sep-87 09:52:31 BEEBE
+ CVT.C.1;P777752 1 1568(7) 22-Aug-87 10:56:12 BEEBE
+ 00MAIL.11.1;P777752 2 4806(7) 20-Aug-87 17:15:20 BEEBE
+ 00MAIL.10.2;P777752 8 18741(7) 20-Aug-87 09:09:32 BEEBE
+ DVIFILE.H.10;P777752 3 5259(7) 15-Aug-87 15:45:22 BEEBE
+ WSLTEX.C.5;P777752 10 24229(7) 15-Aug-87 12:34:53 BEEBE
+ PRXBMAP.H.3;P777752 2 4323(7) 15-Aug-87 10:44:24 BEEBE
+ UNHD.C.7;P777752 1 1208(7) 15-Aug-87 10:04:04 BEEBE
+ HD.C.12;P777752 1 2116(7) 15-Aug-87 09:59:07 BEEBE
+ FONTFILE.H.21;P777752 3 7179(7) 15-Aug-87 09:58:41 BEEBE
+ FATAL.H.10;P777752 1 2349(7) 15-Aug-87 09:58:03 BEEBE
+ GETLOG.C.11;P777752 1 766(7) 15-Aug-87 08:05:38 BEEBE
+ BITMAP.H.4;P777752 1 2490(7) 15-Aug-87 08:04:10 BEEBE
+ SIGNEX.H.4;P777752 1 1870(7) 14-Aug-87 14:02:18 BEEBE
+ 00MAIL.9.1;P777752 4 9284(7) 22-Jul-87 13:28:31 BEEBE
+ XREF1.AWK.2;P777752 1 1501(7) 20-Jul-87 14:01:22 BEEBE
+ CLRBMAP.H.3;P777752 1 1358(7) 22-Jun-87 10:59:42 BEEBE
+ 00MAIL.8.4;P777752 4 9311(7) 29-Apr-87 18:56:00 BEEBE
+ 00MAIL.7.1;P777752 2 3592(7) 20-Apr-87 18:10:06 BEEBE
+ READFONT.H.10;P777752 1 1298(7) 10-Apr-87 12:26:38 BEEBE
+ XPORT.ARC.1;P777752 7 13895(8) 27-Mar-87 22:00:32 BEEBE
+ 00MAIL.6.1;P777752 3 5339(7) 4-Mar-87 18:30:14 BEEBE
+ ABORTRUN.H.4;P777752 1 1219(7) 4-Mar-87 17:21:50 BEEBE
+ 00MAIL.5.1;P777752 1 1674(7) 26-Feb-87 14:00:42 BEEBE
+ 00MAIL.4.1;P777752 2 3124(7) 25-Feb-87 11:42:47 BEEBE
+ 00MAIL.3.1;P777752 5 10513(7) 25-Feb-87 11:42:20 BEEBE
+ 00MAIL.2.1;P777752 4 8696(7) 25-Feb-87 11:42:13 BEEBE
+ 00MAIL.1.1;P777752 2 4309(7) 25-Feb-87 11:42:07 BEEBE
+ WARNING.H.7;P777752 1 2244(7) 21-Feb-87 16:29:58 BEEBE
+ ZRMKCC.C.1;P777752 1 345(7) 21-Feb-87 15:43:01 BEEBE
+ 00README.TXT.13;P777752 3 5126(7) 28-Jan-87 18:06:59 BEEBE
+ STORY.DVI.1;P777752 1 672(8) 28-Jan-87 16:46:39 BEEBE
+ STORY.LST.1;P777752 1 192(7) 28-Jan-87 16:46:34 BEEBE
+ CCOM.COM.1;P777752 1 2419(7) 22-Jan-87 14:52:00 BEEBE
+ 00MAKE.COM.1;P777752 2 2735(7) 22-Jan-87 14:51:22 BEEBE
+ MOVEOVER.H.6;P777752 1 1384(7) 6-Jan-87 22:55:31 BEEBE
+ MOVEDOWN.H.4;P777752 1 1223(7) 6-Jan-87 22:55:19 BEEBE
+ SETFNTNM.H.5;P777752 1 943(7) 31-Dec-86 14:13:09 BEEBE
+ ALLDONE.H.3;P777752 1 732(7) 21-Dec-86 16:17:37 BEEBE
+ FONTSUB.H.6;P777752 3 5185(7) 21-Dec-86 16:15:54 BEEBE
+ STRID2.H.6;P777752 1 1175(7) 19-Dec-86 22:13:43 BEEBE
+ TYPEDEFS.H.2;P777752 1 1441(7) 18-Dec-86 15:35:30 BEEBE
+ INCH.H.4;P777752 2 3095(7) 18-Dec-86 11:29:06 BEEBE
+ SKPKSPEC.H.3;P777752 1 1197(7) 15-Dec-86 17:25:31 BEEBE
+ STRCM2.H.2;P777752 1 882(7) 15-Dec-86 17:24:45 BEEBE
+ SKGFSPEC.H.3;P777752 1 1197(7) 15-Dec-86 17:24:39 BEEBE
+ GETPGTAB.H.4;P777752 1 1169(7) 15-Dec-86 17:23:56 BEEBE
+ FINDPOST.H.4;P777752 1 849(7) 15-Dec-86 17:23:46 BEEBE
+ LOADCHAR.H.8;P777752 2 2735(7) 13-Nov-86 09:00:30 BEEBE
+ FILLRECT.H.3;P777752 1 1695(7) 9-Sep-86 12:43:32 BEEBE
+ GETFNTDF.H.3;P777752 1 844(7) 28-Apr-86 17:54:23 BEEBE
+ SPECIAL.H.3;P777752 1 479(7) 28-Apr-86 17:49:58 BEEBE
+ CLRROW.H.2;P777752 1 511(7) 27-Apr-86 23:50:07 BEEBE
+ OUTROW.H.1;P777752 1 1050(7) 26-Apr-86 15:56:27 BEEBE
+ COMMANDS.H.1;P777752 2 3161(7) 26-Apr-86 15:42:05 BEEBE
+ FIXPOS.H.1;P777752 1 1202(7) 29-Mar-86 19:09:52 BEEBE
+ SETRULE.H.1;P777752 1 826(7) 29-Mar-86 19:06:47 BEEBE
+ GETBYTES.H.1;P777752 1 504(7) 29-Mar-86 10:46:41 BEEBE
+ STORY.TEX.1;P777752 1 393(7) 28-Mar-86 21:41:50 BEEBE
+ ZEROM.MAC.1;P777752 1 641(7) 28-Mar-86 11:45:39 BEEBE
+ SKIPFONT.H.1;P777752 1 594(7) 24-Mar-86 21:35:59 BEEBE
+ RULEPXL.H.1;P777752 1 627(7) 24-Mar-86 21:34:51 BEEBE
+ NOSIGNEX.H.1;P777752 1 614(7) 24-Mar-86 21:33:05 BEEBE
+ MOVETO.H.1;P777752 1 339(7) 24-Mar-86 21:32:47 BEEBE
+ DUMPCHAR.H.1;P777752 1 1100(7) 24-Mar-86 21:11:16 BEEBE
+ DERUN.C.1;P777752 2 3068(7) 24-Mar-86 21:09:51 BEEBE
+ ACTFACT.H.1;P777752 1 1482(7) 24-Mar-86 21:07:21 BEEBE
+ WSLTEX.LET.2;P777752 2 3066(7) 5-Jan-86 17:22:46 BEEBE
+ WSLTEX.PAS.2;P777752 6 12885(7) 5-Jan-86 17:15:57 BEEBE
+ WS87.PAS.1;P777752 1 1101(7) 10-Oct-85 16:48:16 BEEBE
+
+ Total of 1609 pages in 185 files
diff --git a/dviware/beebe/src/00tdir.lst b/dviware/beebe/src/00tdir.lst
new file mode 100644
index 0000000000..86627ba1dc
--- /dev/null
+++ b/dviware/beebe/src/00tdir.lst
@@ -0,0 +1,189 @@
+
+ APS:<TEX.DVI>
+ 00DIR.CMD.1;P777752 2 2789(7) 7-Jun-88 20:58:36 BEEBE
+ 00DIR.LST.1;P777752 6 13377(7) 7-Jun-88 20:58:25 BEEBE
+ INITGLOB.H.19;P777752 2 4129(7) 7-Jun-88 20:57:30 BEEBE
+ 00REVHST.TXT.219;P777752 40 100955(7) 7-Jun-88 20:56:58 BEEBE
+ FOO.DVI-ALW.3;P777752 7 17360(7) 7-Jun-88 17:22:58 BEEBE
+ FOO.DVI.3;P777752 1 824(8) 7-Jun-88 17:22:52 BEEBE
+ FOO.AUX.3;P777752 1 145(7) 7-Jun-88 17:22:49 BEEBE
+ FOO.LST.3;P777752 1 1676(7) 7-Jun-88 17:22:38 BEEBE
+ DVIALW.DIF.1;P777752 1 30(7) 7-Jun-88 16:38:59 BEEBE
+ DVIJEP.DIF.1;P777752 1 443(7) 7-Jun-88 16:38:47 BEEBE
+ 00MAIL.17.1;P777752 3 5140(7) 31-May-88 18:42:20 BEEBE
+ DVIEXE.ARC.1;P777752 169 344232(8) 30-May-88 23:57:40 BEEBE
+ 00MAIL.16.1;P777752 11 26288(7) 30-May-88 19:44:56 BEEBE
+ DVIJEP.C.74;P777752 15 38306(7) 30-May-88 19:18:54 BEEBE
+ LPTOPS.1L.3;P777752 4 8330(7) 5-May-88 12:05:58 BEEBE
+ LPTOPS.C.25;P777752 20 50215(7) 4-May-88 10:51:00 BEEBE
+ LPTOPS.HLP.2;P777752 3 6734(7) 3-May-88 19:04:53 BEEBE
+ VAXVMS.C.14;P777752 12 28521(7) 14-Apr-88 10:13:00 BEEBE
+ DOC.DIRECTORY.1;P20202 0 0(0) 26-Mar-88 03:35:51 OPERATOR
+ LPT.PS.2;P777752 2 4901(7) 6-Feb-88 12:08:31 BEEBE
+ DVIALW.C.79;P777752 24 58917(7) 3-Feb-88 16:38:28 BEEBE
+ PCMAKE.UUE.1;P777752 38 96868(7) 20-Jan-88 17:36:55 BEEBE
+ TEXIDX.C.14;P777752 18 44413(7) 13-Jan-88 11:51:49 BEEBE
+ TEXIDX.HLP.2;P777752 3 6947(7) 7-Jan-88 13:50:44 BEEBE
+ 00MAIL.15.1;P777752 4 8683(7) 9-Dec-87 18:14:03 BEEBE
+ PCMAKE.ARC.2;P777752 34 69166(8) 18-Nov-87 11:34:23 BEEBE
+ DVI.TARZ.1;P777752 505 1040384(8) 17-Nov-87 21:56:22 BEEBE
+ DVI.XRF.6;P777752 97 247105(7) 17-Nov-87 21:08:06 BEEBE
+ GBLPROCS.H.37;P777752 5 10630(7) 17-Nov-87 20:18:36 BEEBE
+ MAKEFILE.UNX.29;P777752 8 19064(7) 17-Nov-87 20:15:12 BEEBE
+ MACHDEFS.H.90;P777752 11 25658(7) 17-Nov-87 19:53:52 BEEBE
+ 01README.TXT.1;P777752 3 5780(7) 17-Nov-87 14:06:42 BEEBE
+ MAKEFILE.MSC.13;P777752 8 18188(7) 16-Nov-87 15:53:58 BEEBE
+ KEYBRD.C.6;P777752 11 26298(7) 16-Nov-87 11:04:24 BEEBE
+ KEYDEF.H.3;P777752 1 1187(7) 16-Nov-87 11:03:28 BEEBE
+ KEYTST.C.5;P777752 1 2338(7) 16-Nov-87 10:48:40 BEEBE
+ QSORT.C.1;P777752 1 2115(7) 14-Nov-87 23:19:24 BEEBE
+ TOSPRX.C.14;P777752 5 10302(7) 14-Nov-87 22:21:34 BEEBE
+ DVIHEAD.H.14;P777752 7 16934(7) 14-Nov-87 19:58:04 BEEBE
+ MAIN.H.26;P777752 2 4987(7) 14-Nov-87 19:58:00 BEEBE
+ OPTION.H.45;P777752 4 8149(7) 14-Nov-87 18:10:56 BEEBE
+ DVIEPS.C.13;P777752 8 20093(7) 14-Nov-87 08:41:54 BEEBE
+ DVIE72.C.10;P777752 8 20093(7) 14-Nov-87 08:41:30 BEEBE
+ 00MAIL.14.12;P777752 13 30795(7) 2-Nov-87 11:29:33 BEEBE
+ DVIBIT.C.51;P777752 12 29914(7) 1-Nov-87 12:08:14 BEEBE
+ DVICAN.C.68;P777752 10 25361(7) 1-Nov-87 11:56:32 BEEBE
+ DVIL3P.C.9;P777752 4 9842(7) 1-Nov-87 11:27:08 BEEBE
+ DVIL75.C.11;P777752 4 9356(7) 1-Nov-87 11:26:37 BEEBE
+ F20OPEN.H.6;P777752 1 2135(7) 1-Nov-87 11:25:25 BEEBE
+ LW78.C.30;P777752 9 22709(7) 1-Nov-87 11:24:01 BEEBE
+ STRRCHR.H.3;P777752 1 817(7) 1-Nov-87 11:23:50 BEEBE
+ STRCHR.H.5;P777752 1 782(7) 1-Nov-87 11:23:37 BEEBE
+ OPENFONT.H.53;P777752 5 11433(7) 1-Nov-87 11:23:27 BEEBE
+ DVIPRX.C.22;P777752 4 9713(7) 1-Nov-87 11:15:21 BEEBE
+ DVIMAC.C.19;P777752 6 14253(7) 1-Nov-87 11:09:49 BEEBE
+ DVIM72.C.19;P777752 6 14252(7) 1-Nov-87 11:09:47 BEEBE
+ DVIOKI.C.21;P777752 4 10026(7) 1-Nov-87 11:05:22 BEEBE
+ DVIO72.C.21;P777752 4 10025(7) 1-Nov-87 11:04:11 BEEBE
+ DVIMPI.C.19;P777752 5 12309(7) 1-Nov-87 11:01:57 BEEBE
+ DVIJET.C.19;P777752 4 9713(7) 1-Nov-87 10:58:13 BEEBE
+ DVIGD.C.21;P777752 5 11034(7) 1-Nov-87 10:57:29 BEEBE
+ DVITOS.C.20;P777752 7 15964(7) 1-Nov-87 10:51:32 BEEBE
+ DVIIMP.C.27;P777752 9 22707(7) 1-Nov-87 10:33:41 BEEBE
+ DVICA2.C.33;P777752 13 31705(7) 1-Nov-87 10:20:50 BEEBE
+ GENDEFS.H.24;P777752 2 3811(7) 1-Nov-87 10:15:09 BEEBE
+ MAKEFILE.VMS.17;P777752 8 18435(7) 31-Oct-87 11:52:50 BEEBE
+ MAKEFILE.PCC.23;P777752 7 17107(7) 31-Oct-87 11:52:17 BEEBE
+ MAKEFILE.KCC.48;P777752 7 16307(7) 31-Oct-87 11:52:01 BEEBE
+ MAKEFILE.AST.14;P777752 8 18372(7) 31-Oct-87 11:51:48 BEEBE
+ USAGE.H.11;P777752 1 2429(7) 31-Oct-87 11:18:54 BEEBE
+ PRTPAGE.H.42;P777752 4 7685(7) 30-Oct-87 17:12:54 BEEBE
+ MAKEFILE..26;P777752 7 17116(7) 30-Oct-87 14:05:27 BEEBE
+ GETBMAP.H.9;P777752 1 975(7) 29-Oct-87 08:07:19 BEEBE
+ CUSERI.C.4;P777752 1 1261(7) 28-Oct-87 17:39:55 BEEBE
+ STORY.DVI-ERR.6;P777752 1 1955(7) 28-Oct-87 17:01:19 BEEBE
+ STORY.DVI-TOS.2;P777752 17 42895(7) 28-Oct-87 17:01:13 BEEBE
+ STORY.DVI-PRX.2;P777752 5 11365(7) 28-Oct-87 17:00:56 BEEBE
+ STORY.DVI-OKI.2;P777752 6 14055(7) 28-Oct-87 16:59:32 BEEBE
+ STORY.DVI-O72.2;P777752 5 10310(7) 28-Oct-87 16:59:14 BEEBE
+ STORY.DVI-MPI.2;P777752 8 19085(7) 28-Oct-87 16:58:44 BEEBE
+ STORY.DVI-MAC.2;P777752 9 17184(8) 28-Oct-87 16:57:51 BEEBE
+ STORY.DVI-M72.2;P777752 5 10120(8) 28-Oct-87 16:57:24 BEEBE
+ STORY.DVI-L75.1;P777752 8 18855(7) 28-Oct-87 16:56:14 BEEBE
+ STORY.DVI-JET.2;P777752 5 8536(8) 28-Oct-87 16:55:41 BEEBE
+ STORY.DVI-JEP.2;P777752 4 6164(8) 28-Oct-87 16:55:24 BEEBE
+ STORY.DVI-IMP.2;P777752 3 4876(8) 28-Oct-87 16:55:12 BEEBE
+ STORY.DVI-EPS.1;P777752 23 46708(8) 28-Oct-87 16:52:41 BEEBE
+ STORY.DVI-E72.1;P777752 4 6400(8) 28-Oct-87 16:52:28 BEEBE
+ STORY.DVI-CAN.2;P777752 8 15992(8) 28-Oct-87 16:52:11 BEEBE
+ STORY.DVI-ALW.3;P777752 6 12950(7) 28-Oct-87 16:51:51 BEEBE
+ XREF..5;P777752 1 643(7) 27-Oct-87 20:04:13 BEEBE
+ SETCHAR.H.8;P777752 1 1405(7) 26-Oct-87 10:23:06 BEEBE
+ XXU.C.5;P777752 3 5480(7) 24-Oct-87 17:08:45 BEEBE
+ BINTNX.C.2;P777752 1 1125(7) 24-Oct-87 17:06:56 BEEBE
+ BINTNXVMS.C.2;P777752 5 10823(7) 24-Oct-87 17:05:57 BEEBE
+ ERRSHOW.C.3;P777752 1 2149(7) 24-Oct-87 17:03:41 BEEBE
+ 00ARIT.C.7;P777752 1 2050(7) 24-Oct-87 17:03:01 BEEBE
+ TCTOS.H.8;P777752 1 777(7) 24-Oct-87 16:57:20 BEEBE
+ DVIINIT.H.41;P777752 5 10863(7) 24-Oct-87 16:55:24 BEEBE
+ GBLVARS.H.44;P777752 6 14168(7) 23-Oct-87 13:35:38 BEEBE
+ CHARPXL.H.8;P777752 1 1600(7) 21-Oct-87 15:31:15 BEEBE
+ CHARPK.H.13;P777752 5 10896(7) 21-Oct-87 15:31:04 BEEBE
+ CHARGF.H.14;P777752 5 10691(7) 21-Oct-87 15:30:34 BEEBE
+ READPOST.H.5;P777752 1 1835(7) 21-Oct-87 15:20:22 BEEBE
+ DVITERM.H.15;P777752 1 2434(7) 21-Oct-87 15:04:45 BEEBE
+ DISPCHAR.H.6;P777752 3 6000(7) 21-Oct-87 10:14:31 BEEBE
+ DBGOPEN.H.5;P777752 1 831(7) 21-Oct-87 10:14:03 BEEBE
+ READGF.H.22;P777752 3 5648(7) 10-Oct-87 19:37:31 BEEBE
+ 00MAIL.13.1;P777752 10 23794(7) 1-Oct-87 14:08:50 BEEBE
+ READPK.H.14;P777752 3 6178(7) 30-Sep-87 14:53:40 BEEBE
+ READPXL.H.11;P777752 2 2927(7) 30-Sep-87 14:46:31 BEEBE
+ RELDFONT.H.5;P777752 2 2895(7) 30-Sep-87 14:30:17 BEEBE
+ 00MAIL.12.1;P777752 14 34981(7) 28-Sep-87 20:59:15 BEEBE
+ DVIALW.PS.17;P777752 4 9351(7) 18-Sep-87 17:48:10 BEEBE
+ XREF3.AWK.2;P777752 1 2386(7) 9-Sep-87 09:53:19 BEEBE
+ XREF2.AWK.2;P777752 1 2081(7) 9-Sep-87 09:52:31 BEEBE
+ CVT.C.1;P777752 1 1568(7) 22-Aug-87 10:56:12 BEEBE
+ 00MAIL.11.1;P777752 2 4806(7) 20-Aug-87 17:15:20 BEEBE
+ 00MAIL.10.2;P777752 8 18741(7) 20-Aug-87 09:09:32 BEEBE
+ DVIFILE.H.10;P777752 3 5259(7) 15-Aug-87 15:45:22 BEEBE
+ WSLTEX.C.5;P777752 10 24229(7) 15-Aug-87 12:34:53 BEEBE
+ PRXBMAP.H.3;P777752 2 4323(7) 15-Aug-87 10:44:24 BEEBE
+ UNHD.C.7;P777752 1 1208(7) 15-Aug-87 10:04:04 BEEBE
+ HD.C.12;P777752 1 2116(7) 15-Aug-87 09:59:07 BEEBE
+ FONTFILE.H.21;P777752 3 7179(7) 15-Aug-87 09:58:41 BEEBE
+ FATAL.H.10;P777752 1 2349(7) 15-Aug-87 09:58:03 BEEBE
+ GETLOG.C.11;P777752 1 766(7) 15-Aug-87 08:05:38 BEEBE
+ BITMAP.H.4;P777752 1 2490(7) 15-Aug-87 08:04:10 BEEBE
+ SIGNEX.H.4;P777752 1 1870(7) 14-Aug-87 14:02:18 BEEBE
+ 00MAIL.9.1;P777752 4 9284(7) 22-Jul-87 13:28:31 BEEBE
+ XREF1.AWK.2;P777752 1 1501(7) 20-Jul-87 14:01:22 BEEBE
+ CLRBMAP.H.3;P777752 1 1358(7) 22-Jun-87 10:59:42 BEEBE
+ 00MAIL.8.4;P777752 4 9311(7) 29-Apr-87 18:56:00 BEEBE
+ 00MAIL.7.1;P777752 2 3592(7) 20-Apr-87 18:10:06 BEEBE
+ READFONT.H.10;P777752 1 1298(7) 10-Apr-87 12:26:38 BEEBE
+ XPORT.ARC.1;P777752 7 13895(8) 27-Mar-87 22:00:32 BEEBE
+ 00MAIL.6.1;P777752 3 5339(7) 4-Mar-87 18:30:14 BEEBE
+ ABORTRUN.H.4;P777752 1 1219(7) 4-Mar-87 17:21:50 BEEBE
+ 00MAIL.5.1;P777752 1 1674(7) 26-Feb-87 14:00:42 BEEBE
+ 00MAIL.4.1;P777752 2 3124(7) 25-Feb-87 11:42:47 BEEBE
+ 00MAIL.3.1;P777752 5 10513(7) 25-Feb-87 11:42:20 BEEBE
+ 00MAIL.2.1;P777752 4 8696(7) 25-Feb-87 11:42:13 BEEBE
+ 00MAIL.1.1;P777752 2 4309(7) 25-Feb-87 11:42:07 BEEBE
+ WARNING.H.7;P777752 1 2244(7) 21-Feb-87 16:29:58 BEEBE
+ ZRMKCC.C.1;P777752 1 345(7) 21-Feb-87 15:43:01 BEEBE
+ 00README.TXT.13;P777752 3 5126(7) 28-Jan-87 18:06:59 BEEBE
+ STORY.DVI.1;P777752 1 672(8) 28-Jan-87 16:46:39 BEEBE
+ STORY.LST.1;P777752 1 192(7) 28-Jan-87 16:46:34 BEEBE
+ CCOM.COM.1;P777752 1 2419(7) 22-Jan-87 14:52:00 BEEBE
+ 00MAKE.COM.1;P777752 2 2735(7) 22-Jan-87 14:51:22 BEEBE
+ MOVEOVER.H.6;P777752 1 1384(7) 6-Jan-87 22:55:31 BEEBE
+ MOVEDOWN.H.4;P777752 1 1223(7) 6-Jan-87 22:55:19 BEEBE
+ SETFNTNM.H.5;P777752 1 943(7) 31-Dec-86 14:13:09 BEEBE
+ ALLDONE.H.3;P777752 1 732(7) 21-Dec-86 16:17:37 BEEBE
+ FONTSUB.H.6;P777752 3 5185(7) 21-Dec-86 16:15:54 BEEBE
+ STRID2.H.6;P777752 1 1175(7) 19-Dec-86 22:13:43 BEEBE
+ TYPEDEFS.H.2;P777752 1 1441(7) 18-Dec-86 15:35:30 BEEBE
+ INCH.H.4;P777752 2 3095(7) 18-Dec-86 11:29:06 BEEBE
+ SKPKSPEC.H.3;P777752 1 1197(7) 15-Dec-86 17:25:31 BEEBE
+ STRCM2.H.2;P777752 1 882(7) 15-Dec-86 17:24:45 BEEBE
+ SKGFSPEC.H.3;P777752 1 1197(7) 15-Dec-86 17:24:39 BEEBE
+ GETPGTAB.H.4;P777752 1 1169(7) 15-Dec-86 17:23:56 BEEBE
+ FINDPOST.H.4;P777752 1 849(7) 15-Dec-86 17:23:46 BEEBE
+ LOADCHAR.H.8;P777752 2 2735(7) 13-Nov-86 09:00:30 BEEBE
+ FILLRECT.H.3;P777752 1 1695(7) 9-Sep-86 12:43:32 BEEBE
+ GETFNTDF.H.3;P777752 1 844(7) 28-Apr-86 17:54:23 BEEBE
+ SPECIAL.H.3;P777752 1 479(7) 28-Apr-86 17:49:58 BEEBE
+ CLRROW.H.2;P777752 1 511(7) 27-Apr-86 23:50:07 BEEBE
+ OUTROW.H.1;P777752 1 1050(7) 26-Apr-86 15:56:27 BEEBE
+ COMMANDS.H.1;P777752 2 3161(7) 26-Apr-86 15:42:05 BEEBE
+ FIXPOS.H.1;P777752 1 1202(7) 29-Mar-86 19:09:52 BEEBE
+ SETRULE.H.1;P777752 1 826(7) 29-Mar-86 19:06:47 BEEBE
+ GETBYTES.H.1;P777752 1 504(7) 29-Mar-86 10:46:41 BEEBE
+ STORY.TEX.1;P777752 1 393(7) 28-Mar-86 21:41:50 BEEBE
+ ZEROM.MAC.1;P777752 1 641(7) 28-Mar-86 11:45:39 BEEBE
+ SKIPFONT.H.1;P777752 1 594(7) 24-Mar-86 21:35:59 BEEBE
+ RULEPXL.H.1;P777752 1 627(7) 24-Mar-86 21:34:51 BEEBE
+ NOSIGNEX.H.1;P777752 1 614(7) 24-Mar-86 21:33:05 BEEBE
+ MOVETO.H.1;P777752 1 339(7) 24-Mar-86 21:32:47 BEEBE
+ DUMPCHAR.H.1;P777752 1 1100(7) 24-Mar-86 21:11:16 BEEBE
+ DERUN.C.1;P777752 2 3068(7) 24-Mar-86 21:09:51 BEEBE
+ ACTFACT.H.1;P777752 1 1482(7) 24-Mar-86 21:07:21 BEEBE
+ WSLTEX.LET.2;P777752 2 3066(7) 5-Jan-86 17:22:46 BEEBE
+ WSLTEX.PAS.2;P777752 6 12885(7) 5-Jan-86 17:15:57 BEEBE
+ WS87.PAS.1;P777752 1 1101(7) 10-Oct-85 16:48:16 BEEBE
+
+ Total of 1609 pages in 185 files
diff --git a/dviware/beebe/src/abortrun.h b/dviware/beebe/src/abortrun.h
new file mode 100644
index 0000000000..a7dba6cde1
--- /dev/null
+++ b/dviware/beebe/src/abortrun.h
@@ -0,0 +1,43 @@
+/* -*-C-*- abortrun.h */
+/*-->abortrun*/
+/**********************************************************************/
+/*************************** abortrun *******************************/
+/**********************************************************************/
+
+void
+abortrun(code)
+int code;
+
+{
+ /*******************************************************************
+ This routine is called on both success and failure to terminate
+ execution. All open files (except stdin, stdout, stderr) are closed
+ before calling EXIT() to quit.
+ *******************************************************************/
+
+ UNSIGN16 k;
+
+ for (k = 0; k < (UNSIGN16)nopen; ++k)
+ if (font_files[k].font_id != (FILE*)NULL)
+ (void)fclose(font_files[k].font_id);
+
+ if (dvifp != (FILE*)NULL)
+ (void)fclose(dvifp);
+ if (plotfp != (FILE*)NULL)
+ (void)fclose(plotfp);
+ if (g_dolog && (g_logfp != (FILE *)NULL))
+ (void)fclose(g_logfp);
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ if (code)
+ {
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"?Aborted with error code %d",code);
+ NEWLINE(stderr);
+ (void)perror("?perror() says");
+ }
+#endif
+
+ (void)EXIT(code);
+}
+
diff --git a/dviware/beebe/src/actfact.h b/dviware/beebe/src/actfact.h
new file mode 100644
index 0000000000..02ed66dc0d
--- /dev/null
+++ b/dviware/beebe/src/actfact.h
@@ -0,0 +1,42 @@
+/* -*-C-*- actfact.h */
+/*-->actfact*/
+/**********************************************************************/
+/****************************** actfact *******************************/
+/**********************************************************************/
+
+float
+actfact(unmodsize)
+register UNSIGN32 unmodsize;
+
+/***********************************************************************
+Compute the actual size factor given the integer approximation unmodsize
+= (magnification factor)*1000. Values not found in the table are
+rounded to the nearest table entry; this ensures that rounding errors,
+or user magnification parameter input errors result in something
+reasonable. mag_table[] has a wider range of magnifications available
+than most sites will have, and can be used to find a nearest match font
+when one is missing.
+***********************************************************************/
+
+{
+ register INT16 k;
+ register UNSIGN32 tab_entry;
+
+ for (k = 1; k < MAGTABSIZE; ++k)
+ {
+ tab_entry = MAGSIZE(mag_table[k]); /* round entry */
+ if (unmodsize < tab_entry) /* choose nearer of k-1,k entries */
+ {
+ if (unmodsize < MAGSIZE((mag_table[k-1] + mag_table[k])/2.0))
+ k--; /* choose smaller one */
+ break;
+ }
+ else if (unmodsize == tab_entry)
+ break;
+ }
+ mag_index = ((k < MAGTABSIZE) ? k : (MAGTABSIZE-1));/* set global index */
+ return((float)mag_table[mag_index]);
+}
+
+
+
diff --git a/dviware/beebe/src/alldone.h b/dviware/beebe/src/alldone.h
new file mode 100644
index 0000000000..4fc694cf36
--- /dev/null
+++ b/dviware/beebe/src/alldone.h
@@ -0,0 +1,23 @@
+/* -*-C-*- alldone.h */
+/*-->alldone*/
+/**********************************************************************/
+/****************************** alldone ******************************/
+/**********************************************************************/
+
+void
+alldone()
+
+{
+ register int t;
+
+ if ((g_errenc != 0) && g_dolog && (g_logfp != (FILE *)NULL))
+ { /* errors occurred - copy log file to stderr */
+ (void)fflush(g_logfp); /* make sure file is up-to-date */
+ (void)REWIND(g_logfp); /* rewind it */
+ while ((t=(int)getc(g_logfp)) != EOF) /* copy to stderr */
+ (void)putc((char)t,stderr);
+ (void)fclose(g_logfp); /* close it */
+ g_logfp = (FILE *)NULL;
+ }
+ abortrun(g_errenc);
+}
diff --git a/dviware/beebe/src/atari/makefile.ast b/dviware/beebe/src/atari/makefile.ast
new file mode 100644
index 0000000000..960f9945a9
--- /dev/null
+++ b/dviware/beebe/src/atari/makefile.ast
@@ -0,0 +1,504 @@
+# Makefile for files in /tex/dvi on ATARI 520ST+ using Mark Williams C
+# (adapted from makefile.unx)
+#
+# Current target list:
+# all clean countlines lint
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops lw78 texidx
+# tosprx xxu
+#
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo dvifoo" to
+# build dvifoo); add XCFLAGS to allow extra compile-time
+# options without having to respecify the long path variables
+# [15-Apr-87] -- rebuilt dependency lists using "awk -f include.awk *.c"
+# [08-Jul-87] -- added dvil3p
+# [20-Jul-87] -- added xxu and dvi.xrf
+# [14-Aug-87] -- updated for Atari support
+
+SHELL=/bin/sh
+
+# Default C compiler
+CC = cc
+
+# Extra compiler options
+XCFLAGS =
+
+# The -f means "allow printing of floating-point numbers in printf() family"
+CFLAGS = -f -DOS_ATARI $(XCFLAGS)
+
+# Need math library to load
+LFLAGS = -lm
+
+MV = mv
+
+RM = rm
+
+# Source file extension
+C = .c
+
+# Object file extension
+
+O = .o
+
+# dvixxx.c files
+
+DVIXXX = dvialw.c dvibit.c dvican.c dvie72.c dvieps.c dvigd.c \
+ dviimp.c dvijep.c dvijet.c dvil3p.c dvil75.c dvim72.c \
+ dvimac.c dvimpi.c dvio72.c dvioki.c dviprx.c dvitos.c
+
+OTHERS = 00arit.c keytst.c lptops.c lw78.c texidx.c tosprx.c xxu.c
+
+HFILES = abortrun.h actfact.h alldone.h bitmap.h \
+ chargf.h charpk.h charpxl.h \
+ clrbmap.h clrrow.h commands.h dbgopen.h \
+ dispchar.h dumpchar.h dvifile.h dvihead.h \
+ dviinit.h dviterm.h f20open.h \
+ fatal.h fillrect.h findpost.h fixpos.h \
+ fontfile.h fontsub.h gblprocs.h gblvars.h \
+ gendefs.h getbmap.h getbytes.h getfntdf.h \
+ getpgtab.h inch.h initglob.h keydef.h \
+ loadchar.h machdefs.h main.h movedown.h \
+ moveover.h moveto.h nosignex.h openfont.h \
+ option.h outrow.h prtpage.h prxbmap.h \
+ readfont.h readgf.h readpk.h readpost.h \
+ readpxl.h reldfont.h rulepxl.h setchar.h \
+ setfntnm.h setrule.h signex.h skgfspec.h \
+ skipfont.h skpkspec.h special.h strchr.h \
+ strcm2.h strid2.h strrchr.h tctos.h \
+ typedefs.h usage.h warning.h
+
+# Include files that include others
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets (lw78 is excluded--most Unix sites have Transcript or devps
+# which offer similar features)
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops texidx tosprx
+
+clean:
+ $(RM) -f *.o
+ $(RM) -f 00arit \
+ dvialw dvibit dvican dvie72 dvieps dvigd \
+ dviimp dvijep dvijet dvil75 dvil3p dvim72\
+ dvimac dvimpi dvio72 dvioki dviprx dvitos\
+ keytst lptops texidx tosprx
+ $(RM) -f .~* .#*
+
+countlines:
+ for f in $(DVIXXX) $(OTHERS) ;\
+ do \
+ echo $$f; \
+ $(CC) $(CFLAGS) -C -E $$f | wc; \
+ done
+
+lint:
+ lint $(LINTFLAGS) dvialw.c
+ lint $(LINTFLAGS) dvibit.c
+ lint $(LINTFLAGS) dvican.c
+ lint $(LINTFLAGS) dvie72.c
+ lint $(LINTFLAGS) dvieps.c
+ lint $(LINTFLAGS) dvigd.c
+ lint $(LINTFLAGS) dviimp.c
+ lint $(LINTFLAGS) dvijep.c
+ lint $(LINTFLAGS) dvijet.c
+ lint $(LINTFLAGS) dvil3p.c
+ lint $(LINTFLAGS) dvil75.c
+ lint $(LINTFLAGS) dvim72.c
+ lint $(LINTFLAGS) dvimac.c
+ lint $(LINTFLAGS) dvimpi.c
+ lint $(LINTFLAGS) dvio72.c
+ lint $(LINTFLAGS) dvioki.c
+ lint $(LINTFLAGS) dviprx.c
+ lint $(LINTFLAGS) dvitos.c
+ lint $(LINTFLAGS) lptops.c
+ lint $(LINTFLAGS) texidx.c
+ lint $(LINTFLAGS) tosprx.c
+
+# ======================================================================
+# Dependency lists and rules
+
+00arit:
+# Atari ST command processor doesn't handle command names beginning with
+# integers. Make a temporary copy for these tests.
+ cp 00arit.c foo.c
+ $(RM) foo$(O)
+ $(RM) foo
+ $(CC) -DSIZE=short $(CFLAGS) foo$(C) -o foo $(LFLAGS)
+ foo
+ $(RM) foo$(O)
+ $(RM) foo
+ $(CC) -DSIZE=int $(CFLAGS) foo$(C) -o foo $(LFLAGS)
+ foo
+ $(RM) foo$(O)
+ $(RM) foo
+ $(CC) -DSIZE=long $(CFLAGS) foo$(C) -o foo $(LFLAGS)
+ foo
+ $(RM) foo$(O)
+ $(RM) foo
+ $(RM) foo.c
+
+dvialw: dvialw$(O) cuserid$(O)
+ $(CC) $(CFLAGS) dvialw$(O) cuserid$(O) -o dvialw $(LFLAGS)
+
+dvibit: dvibit$(O) keybrd$(O)
+ $(CC) $(CFLAGS) dvibit$(O) keybrd$(O) -o dvibit $(LFLAGS)
+
+dvican: dvican$(O)
+ $(CC) $(CFLAGS) dvican$(O) -o dvican $(LFLAGS)
+
+dvie72: dvie72$(O)
+ $(CC) $(CFLAGS) dvie72$(O) -o dvie72 $(LFLAGS)
+
+dvieps: dvieps$(O)
+ $(CC) $(CFLAGS) dvieps$(O) -o dvieps $(LFLAGS)
+
+dvigd: dvigd$(O)
+ $(CC) $(CFLAGS) dvigd$(O) -o dvigd $(LFLAGS)
+
+dviimp: dviimp$(O)
+ $(CC) $(CFLAGS) dviimp$(O) -o dviimp $(LFLAGS)
+
+dvijep: dvijep$(O)
+ $(CC) $(CFLAGS) dvijep$(O) -o dvijep $(LFLAGS)
+
+dvijet: dvijet$(O)
+ $(CC) $(CFLAGS) dvijet$(O) -o dvijet $(LFLAGS)
+
+dvil3p: dvil3p$(O)
+ $(CC) $(CFLAGS) dvil3p$(O) -o dvil3p $(LFLAGS)
+
+dvil75: dvil75$(O)
+ $(CC) $(CFLAGS) dvil75$(O) -o dvil75 $(LFLAGS)
+
+dvim72: dvim72$(O)
+ $(CC) $(CFLAGS) dvim72$(O) -o dvim72 $(LFLAGS)
+
+dvimac: dvimac$(O)
+ $(CC) $(CFLAGS) dvimac$(O) -o dvimac $(LFLAGS)
+
+dvimpi: dvimpi$(O)
+ $(CC) $(CFLAGS) dvimpi$(O) -o dvimpi $(LFLAGS)
+
+dvio72: dvio72$(O)
+ $(CC) $(CFLAGS) dvio72$(O) -o dvio72 $(LFLAGS)
+
+dvioki: dvioki$(O)
+ $(CC) $(CFLAGS) dvioki$(O) -o dvioki $(LFLAGS)
+
+dvi$(PGM): dvi$(PGM)$(O) keybrd$(O)
+ $(CC) $(CFLAGS) dvi$(PGM)$(O) keybrd$(O) -o dvi$(PGM) $(LFLAGS)
+
+dviprx: dviprx$(O)
+ $(CC) $(CFLAGS) dviprx$(O) -o dviprx $(LFLAGS)
+
+dvitos: dvitos$(O)
+ $(CC) $(CFLAGS) dvitos$(O) -o dvitos $(LFLAGS)
+
+keytst: keytst$(O) keybrd$(O)
+ $(CC) $(CFLAGS) keytst$(O) keybrd$(O) -o keytst $(LFLAGS)
+
+lptops: lptops$(O)
+ $(CC) $(CFLAGS) lptops$(O) -o lptops $(LFLAGS)
+
+lw78: lw78$(O)
+ $(CC) $(CFLAGS) lw78$(O) -o lw78 $(LFLAGS)
+
+texidx: texidx$(O)
+ $(CC) $(CFLAGS) texidx$(O) -o texidx $(LFLAGS)
+
+tosprx: tosprx$(O)
+ $(CC) $(CFLAGS) tosprx$(O) -o tosprx $(LFLAGS)
+
+xxu: xxu$(O)
+ $(CC) $(CFLAGS) xxu$(O) -o xxu $(LFLAGS)
+
+dvi.xrf: $(DVIXXX) $(HFILES)
+ xref $(DVIXXX) >dvi.xrf
+
+# Object file dependencies
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) keydef.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h reldfont.h rulepxl.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvican$(O): dvican.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h dispchar.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvim72$(O): dvim72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+# Generic target (useful for debugging test versions)
+dvi$(PGM)$(O): dvi$(PGM).c $(HFILES)
+
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvitos$(O): dvitos.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+keybrd$(O): keybrd.c\
+ keydef.h
+
+
+keytst$(O): keytst.c\
+ keydef.h
+
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+
+
+tosprx$(O): tosprx.c\
+ machdefs.h typedefs.h gendefs.h gblprocs.h clrbmap.h
diff --git a/dviware/beebe/src/bintnx.c b/dviware/beebe/src/bintnx.c
new file mode 100644
index 0000000000..169e8f4117
--- /dev/null
+++ b/dviware/beebe/src/bintnx.c
@@ -0,0 +1,51 @@
+/***********************************************************************
+Convert a TOPS-20 file transferred in FTP "binary" mode to "tenex" mode.
+In "binary" mode, we have 2 36-bit words in 9 8-bit bytes. In "tenex"
+mode, we want the top 32 bits of each 36-bit group, giving 8 8-bit bytes.
+
+Who knows what FTP did if the file had an odd number of 36-bit words.
+
+[08-Oct-87]
+
+***********************************************************************/
+
+#include <stdio.h>
+
+main()
+{
+ int c,d;
+
+ for (;;)
+ {
+ c = getchar();
+ if (c == EOF)
+ break;
+ putchar(c); /* 0..7 */
+ c = getchar(); putchar(c); /* 8..15 */
+ c = getchar(); putchar(c); /* 16..23 */
+ c = getchar(); putchar(c); /* 24..31 */
+
+ d = getchar();
+
+ c = (d << 4);
+ d = getchar();
+ c |= 0xFF & (d >> 4);
+ putchar(c); /* 4..11 */
+
+ c = (d << 4);
+ d = getchar();
+ c |= 0xFF & (d >> 4);
+ putchar(c); /* 12..19 */
+
+ c = (d << 4);
+ d = getchar();
+ c |= 0xFF & (d >> 4);
+ putchar(c); /* 20..27 */
+
+ c = (d << 4);
+ d = getchar();
+ c |= 0xFF & (d >> 4);
+ putchar(c); /* 28..36 */
+
+ }
+}
diff --git a/dviware/beebe/src/bintnxvm.c b/dviware/beebe/src/bintnxvm.c
new file mode 100644
index 0000000000..ff71700f68
--- /dev/null
+++ b/dviware/beebe/src/bintnxvm.c
@@ -0,0 +1,390 @@
+/***********************************************************************
+Convert a TOPS-20 file transferred in FTP "binary" mode to "tenex" mode.
+In "binary" mode, we have 2 36-bit words in 9 8-bit bytes. In "tenex"
+mode, we want the top 32 bits of each 36-bit group, giving 8 8-bit
+bytes.
+
+Who knows what FTP did if the file had an odd number of 36-bit words.
+
+[08-Oct-87]
+
+This version is intended for VAX VMS only. Modified by Jerry Leichter
+(LEICHTER@VENUS.YCC.YALE.ARPA).
+
+Usage:
+ bintnxvms [-f[xx]] [filespec]
+
+Filespec may be wild-carded; if it is missing, *.* is assumed. Each
+matching file is read, and a new version the same specification is
+created. (Note that you can only specify one filespec, however.) If
+-fxx is specified, the last block of the file is filled with bytes of
+the given value (xx), which must be a hex number. If -f is given with
+no value, 0 is assumed. Appropriate values seem to be:
+
+ * DVI DF
+ * GF DF
+ PK F6 (File spec defines no filler, F6 may be an artifact)
+ PXL ?? (Unknown, probably not significant)
+ TFM 00 (File spec defines no filler)
+
+"Fill" is definitely significant, at least in some applications, for the
+file types marked, with a "*"; it probably doesn't matter for others.
+Note, how- ever, that there is no certainty that files filled this way
+will actually be readable to all programs, since the transfer process
+may insert other random junk at the end of the file.
+
+The filler is used by programs that wish to read the files from end to
+beginning - for example, by DVI file translators that need to reverse
+page order. The author has observed that "fixed up" files often follow
+the pattern:
+
+ <data> <fill-bytes> <FFFFFFFF> <fill-bytes> end-of-block
+
+The first set of fill bytes were probably inserted by the program that
+wrote the file to being with. (There should be from 1 to 4 of them,
+bringing the file to an even number of 4-byte longwords.) The
+<FFFFFFFF> filler is four bytes of hex FF characters, and probably
+were inserted by VMS FTP to mark the end of the file on the TOPS-20
+system. The rest of the <fill-bytes> were inserted by fixfile. If
+you run into a program that is unable to read a file produced by
+fixfile, DUMP the last block of the file and see if this pattern
+occurs. If so, it should be straightforward to over-write the FF's
+with more <fill-byte>'s.
+***********************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+#include <rms.h>
+
+FILE *fwild();
+FILE *fnext();
+
+main(argc, argv)
+int argc;
+char *argv[];
+{
+ FILE *infile;
+ FILE *outfile;
+ int fill = FALSE;
+ int fillchar = 0;
+ char *fspec;
+ char thefile[NAM$C_MAXRSS + 1];
+ char *c;
+ int d;
+
+ if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'f')
+ {
+ fill = TRUE;
+ c = &argv[1][2];
+ while (isxdigit(*c))
+ {
+ if (isdigit(*c))
+ d = *c - '0';
+ else
+ d = 10 + toupper(*c) - 'A';
+ fillchar = (fillchar << 4) | d;
+ c++;
+ }
+ argc--;
+ argv++;
+ }
+ if (argc > 1)
+ fspec = argv[1];
+ else
+ fspec = "*.*";
+
+ if ((infile = fwild(fspec, "r")) == NULL)
+ {
+ perror("Bad file spec");
+ exit(0);
+ }
+
+ while (fnext(infile) != NULL)
+ {
+ fgetname(infile, thefile);
+ /* Remove version number */
+ d = strlen(thefile) - 1;
+ while (thefile[d] != ';')
+ d--;
+ thefile[d] = '\0';
+ (void)printf("[%s", thefile);
+ if ((outfile = fopen(thefile, "wb", "rfm=fix", "mrs=512"))
+ == NULL)
+ {
+ perror("] Can't open output file");
+ continue;
+ }
+ dofile(infile, outfile, fill, fillchar);
+ fclose(outfile);
+ (void)printf("]\n");
+ }
+
+}
+
+dofile(infile, outfile, fill, fillchar)
+FILE *infile;
+FILE *outfile;
+int fill;
+int fillchar;
+{
+ int c;
+ int d;
+ unsigned int bytecount = 0;
+
+#define GET() fgetc(infile)
+#define PUT(c) (fputc((c),outfile),bytecount++)
+#define ECHO() PUT(GET())
+
+ for (;;)
+ {
+ c = GET();
+ if (c == EOF)
+ break;
+
+ PUT(c); /* 0..7 */
+ ECHO(); /* 8..15 */
+ ECHO(); /* 16..23 */
+ ECHO(); /* 24..31 */
+
+ d = GET();
+ c = (d << 4);
+ d = GET();
+ c |= 0xFF & (d >> 4);
+ PUT(c); /* 4..11 */
+
+ c = (d << 4);
+ d = GET();
+ c |= 0xFF & (d >> 4);
+ PUT(c); /* 12..19 */
+
+ c = (d << 4);
+ d = GET();
+ c |= 0xFF & (d >> 4);
+ PUT(c); /* 20..27 */
+
+ c = (d << 4);
+ d = GET();
+ c |= 0xFF & (d >> 4);
+ PUT(c); /* 28..36 */
+ }
+
+ if (fill)
+ {
+ while (bytecount & 511)
+ PUT(fillchar);
+ }
+}
+
+/*
+ * Fwild and fnext for vms. Written by Martin Minow; taken from the
+ * DECUS C VMS compatibility collection.
+ */
+
+/* #include <stdio.h> */
+/* #include <rms.h> */
+#include <ssdef.h>
+#include <descrip.h>
+#include <ctype.h>
+
+#define TRUE 1
+#define FALSE 0
+#define EOS 0
+
+typedef struct rmsstuff
+{
+ int flag; /* Flag for nonwildcard calls */
+ char *wildmode;
+ struct FAB fab;
+ struct NAM nam;
+ char starname[NAM$C_MAXRSS + 1];
+ char filename[NAM$C_MAXRSS + 1];
+} RMSSTUFF;
+
+static RMSSTUFF *wilddata[_NFILE]; /* RMS struct for each file */
+
+/*
+ * rms->flag can take on the following values:
+ * ISWILD A file with wild-card bytes.
+ * UNWILD A file without wild-cards, unopened.
+ * UNWILD_OPENED A file without wild-cards, opened.
+ */
+#define ISWILD 0
+#define UNWILD 1
+#define UNWILD_OPENED 2
+
+extern FILE *cleanup();
+FILE *
+fwild(filename, mode)
+char *filename;
+char *mode;
+/*
+ * Do wildcard setup
+ */
+{
+ register FILE *fd;
+ register RMSSTUFF *r;
+ register int index;
+
+ /* First get a file to work with. In the process, make sure the
+ mode we got passed is valid. Note that every file we will open
+ from here on already exists, so an open for write will fail
+ (since the open will include the fully-expanded file name,
+ including the version number). Unfortunately, opening a file on
+ the null device always succeeds. So, to simplify matters, we
+ just reject a "w" mode request right here. (We could as well let
+ it go and then find "no matching files" when all later open
+ requests fail. But this makes more sense.) */
+ if (*mode == 'w' || (fd = fopen("_nl:", mode)) == NULL)
+ {
+ return (NULL);
+ }
+ /* Warning: the package depends on fileno(fd) remaining
+ unchanged after calls to freopen(). */
+ index = fileno(fd);
+ /* If we've been here before, make sure buffers are released. */
+ cleanup(index);
+ if ((r = malloc(sizeof(RMSSTUFF))) == NULL
+ || (r->wildmode = malloc(strlen(mode) + 1)) == NULL)
+ return (cleanup(index));
+ strcpy(r->wildmode, mode);
+ wilddata[index] = r;
+ /* Setup the fab and nam blocks. */
+ r->fab = cc$rms_fab; /* Initialize fab */
+ r->nam = cc$rms_nam; /* and nam blocks */
+ r->fab.fab$l_nam = &r->nam; /* fab -> nam */
+ r->fab.fab$l_fna = filename; /* Argument filename */
+ r->fab.fab$b_fns = strlen(filename); /* filename size */
+ r->nam.nam$l_esa = r->starname; /* Expanded file name */
+ r->nam.nam$b_ess = NAM$C_MAXRSS; /* ... size */
+ r->nam.nam$l_rsa = r->filename; /* Result filename */
+ r->nam.nam$b_rss = NAM$C_MAXRSS; /* ... size */
+ /* Parse the file name */
+ if (sys$parse(&r->fab) != RMS$_NORMAL)
+ return (cleanup(index));
+ /* Success. Null-terminate expanded file name and set flag to
+ distinguish between "wild" and "non-wild" filenames. */
+ ((char *) r->nam.nam$l_esa)[r->nam.nam$b_esl] = EOS;
+ r->flag = ((r->nam.nam$l_fnb & NAM$M_WILDCARD) == 0) ?
+ UNWILD : ISWILD;
+ return (fd);
+}
+
+
+FILE *
+fnext(fd)
+FILE *fd;
+/*
+ * Open the next valid file. return fd if successful, NULL if finished.
+ */
+{
+ register int index;
+ register RMSSTUFF *r;
+ register int errorcode;
+ FILE *test;
+
+ index = fileno(fd);
+ if ((r = wilddata[index]) == NULL || r->flag == UNWILD_OPENED)
+ {
+ /* It wasn't ours, or wasn't a wildcard and has already been
+ processed. */
+ fclose(fd);
+ fd = NULL;
+ }
+ else
+ if (r->flag == UNWILD)
+ {
+ /* Not a wildcard file, first time through */
+ fd = freopen(r->starname, r->wildmode, fd);
+ r->flag = UNWILD_OPENED;
+ }
+ else
+ {
+ /* Look for the next match -- who says you can't write obscure
+ structured code? */
+ for (;;)
+ {
+ /* Look 'em up but skip any with protection violation
+ errors. */
+ r->fab.fab$w_ifi = 0; /* Internal file index */
+ if ((errorcode = sys$search(&r->fab)) == RMS$_NORMAL)
+ {
+ /* We have a file. Open it if we have access rights.
+ Determining this isn't as simple as it might be
+ because the access() function checks the wrong thing:
+ It ignores ACL's and any special privileges. So we
+ just open the file twice. (We have to check first
+ since if we fail, freopen will free up our file
+ pointer and we can't be sure of getting it back.)
+ Opening the file twice has one unfortunate side
+ effect - it bumps the file revision by 2. That's
+ life. */
+ ((char *) r->nam.nam$l_rsa)[r->nam.nam$b_rsl] = EOS;
+ if ((test = fopen(r->filename, r->wildmode)) == NULL)
+ {
+ /* Couldn't open it; try for another. */
+ continue;
+ }
+ else
+ {
+ /* Close up the test channel first (to avoid
+ problems with sharing; then open the file. We
+ should normally be able to open the file. It
+ this fails, something is wrong inside the C
+ library. (More likely, a timing problem occured
+ - between our test and our actual open, someone
+ deleted the file, or between our close and
+ re-open, someone else opened it in an
+ incompatible mode.) In any case, we've lost our
+ file descriptor, and there is no good way to
+ recover; so we just return NULL and let the
+ caller think that's all there is. */
+ fclose(test);
+ fd = freopen(r->filename, r->wildmode, fd);
+ break;
+ }
+ }
+ else
+ if (errorcode == RMS$_PRV)
+ {
+ /* sys$search() found something, but we don't have
+ privileges to open it. Look for another. */
+ continue;
+ }
+ else
+ {
+ /* Can't find a file. This should be RMS$_NMF. */
+ fclose(fd);
+ fd = NULL;
+ break;
+ }
+ }
+ }
+ /* Cleanup if any errors */
+ if (fd == NULL)
+ {
+ cleanup(index);
+ }
+ return (fd);
+}
+
+static FILE *
+cleanup(index)
+register int index;
+/*
+ * Empty out any stored information
+ */
+{
+ register RMSSTUFF *r;
+
+ r = wilddata[index];
+ if (r != NULL)
+ {
+ if (r->wildmode != NULL)
+ {
+ free(r->wildmode);
+ }
+ free(r);
+ wilddata[index] = NULL;
+ }
+ return (NULL);
+}
diff --git a/dviware/beebe/src/bitmap.h b/dviware/beebe/src/bitmap.h
new file mode 100644
index 0000000000..ff237b09d7
--- /dev/null
+++ b/dviware/beebe/src/bitmap.h
@@ -0,0 +1,64 @@
+/***********************************************************************
+With non-segmented memory, we just allocate the bitmap as a large 2-D
+array. Access to elements is concealed in the macro BITMAP(y,x) which
+returns the address of the word at the (y,x) position. On segmented
+memory machines (Intel iAPX) this can still be done if the bitmap fits
+in one segment, and SEGMEM will have been defined accordingly in
+dvixxx.c.
+
+For segmented memories, not all compilers support pointer addressing of
+objects larger than a segment, so we implement the bitmap as a vector of
+pointers to raster lines, each of which is allocated dynamically.
+Element access is again concealed in BITMAP(y,x), but the code has to
+ensure that no pointer is ever advanced outside of a raster line. This
+affects functions makechar() and prtbmap(). Bitmap access in
+dispchar(), fillrect(), and prxbmap() is already restricted to single
+raster lines, so no changes are necessary there.
+
+getbmap() handles the necessary allocation for either of these, so
+devinit() in each dvixxx remains ignorant of the details.
+***********************************************************************/
+
+#if SEGMEM
+
+UNSIGN32* bitmap[YBIT] =
+{
+ (UNSIGN32*)NULL /* only first entry need be initialized */
+};
+#if IBM_PC_MICROSOFT
+#define BITMAP(y,x) ((UNSIGN32*)normaddr(bitmap[y],(x)<<2))
+#define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
+#define FP_OFF(fp) (*((unsigned *)&(fp)))
+
+char*
+normaddr(p,byte_offset) /* return address p+byte_offset */
+char *p;
+int byte_offset; /* byte_offset may be positive or negative */
+{
+ long address;
+ char *q;
+
+ /* Reconstruct 32-bit address from SEGMENT*16 + OFFSET + byte_offset */
+
+ address = (long)FP_SEG(p); /* long <- unsigned by zero extend */
+ address <<= 4; /* segment real memory address */
+ address += (long)FP_OFF(p); /* *p real memory address */
+ address += (long)byte_offset;/* *(p+byte_offset) real memory address */
+
+ /* Renormalize address to OFFSET in 0..15 */
+
+ FP_OFF(q) = (unsigned)(address & 0x0f);
+ FP_SEG(q) = (unsigned)(address >> 4);
+
+ return (q);
+}
+#else /* NOT IBM_PC_MICROSOFT */
+#define BITMAP(y,x) (bitmap[y] + (UNSIGN16)(x))
+#endif /* IBM_PC_MICROSOFT */
+
+#else /* NOT SEGMEM */
+
+UNSIGN32* bitmap = (UNSIGN32*)NULL;
+#define BITMAP(y,x) (bitmap + ((UNSIGN32)XBIT*(UNSIGN32)(y)) + (UNSIGN32)(x))
+
+#endif /* SEGMEM */
diff --git a/dviware/beebe/src/chargf.h b/dviware/beebe/src/chargf.h
new file mode 100644
index 0000000000..dae9f894f5
--- /dev/null
+++ b/dviware/beebe/src/chargf.h
@@ -0,0 +1,344 @@
+/* -*-C-*- chargf.h */
+/*-->chargf*/
+/**********************************************************************/
+/******************************* chargf *******************************/
+/**********************************************************************/
+
+int
+chargf(c,outfcn) /* return 0 on success, and EOF on failure */
+BYTE c; /* current character value */
+void (*outfcn)(); /* (possibly NULL) function to output current row */
+{
+ UNSIGN16 d; /* step in m index */
+ BOOLEAN do_output; /* FALSE if outfcn is NULL */
+ register UNSIGN16 k; /* loop step */
+ register INT16 m,n; /* column,row indices in image[n][m] */
+ long p; /* pointer into font file */
+ BYTE paint_switch; /* alternates between BLACK and WHITE */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte; /* current command byte */
+ UNSIGN32 the_word; /* temporary result holder */
+
+/* NB: We only test for equality with BLACK. WHITE is any non-zero
+bit pattern, so we cannot test for equality with it */
+#define BLACK ((BYTE)0)
+#define WHITE ((BYTE)(!BLACK))
+
+ /*******************************************************************
+ This function is called to process a single character description in
+ the GF font file, and to set the character metrics hp, wp, xoffp,
+ and yoffp for it. The character description may start either at a
+ special (XXX) command, or at a beginning-of-character (BOC or BOC1)
+ command. It processes the character description up to, and
+ including, the end-of-character (EOC) command which terminates it.
+
+ The GF raster description is encoded in a complex form, but is
+ guaranteed to step across raster rows from left to right, and down
+ from the top row to bottom row, such that in references to
+ image[n][m], m never decreases in a row, and n never increases in a
+ character. This means that we only require enough memory space to
+ hold one row, provided that outfcn(c,yoff) is called each time a row
+ is completed. This is an important economization for
+ high-resolution output devices -- e.g. a 10pt character at 2400
+ dots/inch would require about 8Kb for the entire image, but fewer
+ than 25 bytes for a single row. A 72pt character (such as in the
+ aminch font) would need about 430Kb for the image, but only about
+ 200 bytes for a row.
+
+ Access to bit m in the current row is controlled through the macros
+ SETBIT(m) and TESTBIT(m) so we need not be concerned about the
+ details of bit masking. Too bad C does not have a bit data type!
+
+ The row image is recorded in such a way that bits min_m .. max_m are
+ mapped onto bits 0 .. (max_m - min_m) in img_row[], so that
+ outfcn(c,yoff) should be relieved of any shifting operations.
+
+ outfcn(c,yoff) is NEVER called if either of hp or wp is <= 0, or if
+ if it is NULL.
+ *******************************************************************/
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c))
+ {
+ (void)warning(
+ "chargf(): Character value out of range for GF font file");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[c]);
+
+ p = (long)tcharptr->fontrp; /* font file raster pointer */
+ if (p < 0L)
+ {
+ (void)warning(
+ "chargf(): Requested character not found in GF font file");
+ return(EOF);
+ }
+ if (FSEEK(fontfp,p,0))
+ {
+ (void)warning(
+ "chargf(): FSEEK() failure for GF font file character raster");
+ return(EOF);
+ }
+
+ do_output = (BOOLEAN)(outfcn != (void(*)())NULL);
+
+ (void)skgfspec(); /* skip any GF special commands */
+
+ the_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ if ((the_byte != GFBOC) && (the_byte != GFBOC1))
+ {
+ (void)warning(
+ "chargf(): GF font file not positioned at BOC or BOC1 command");
+ return(EOF);
+ }
+
+ for (;;) /* loop with exit at EOC, or at BOC or BOC1 if no rasters */
+ {
+ switch (the_byte)
+ {
+ case GFPAINT0:
+ paint_switch = (BYTE)(!paint_switch);
+ break;
+
+ case GFPAINT1:
+ d = (UNSIGN16)nosignex(fontfp,(BYTE)1);
+ if (do_output && (paint_switch == BLACK))
+ {
+ for (k = 0; k < d; (++m, ++k))
+ SETBIT(m);
+ }
+ else
+ m += (INT16)d;
+ paint_switch = (BYTE)(!paint_switch);
+ break;
+
+ case GFPAINT2:
+ d = (UNSIGN16)nosignex(fontfp,(BYTE)2);
+ if (do_output && (paint_switch == BLACK))
+ {
+ for (k = 0; k < d; (++m, ++k))
+ SETBIT(m);
+ }
+ else
+ m += (INT16)d;
+ paint_switch = (BYTE)(!paint_switch);
+ break;
+
+ case GFPAINT3: /* METAFONT never needs this */
+ d = (UNSIGN16)nosignex(fontfp,(BYTE)3); /* NOTE: truncation */
+ if (do_output && (paint_switch == BLACK))
+ {
+ for (k = 0; k < d; (++m, ++k))
+ SETBIT(m);
+ }
+ else
+ m += (INT16)d;
+ paint_switch = (BYTE)(!paint_switch);
+ break;
+
+ case GFBOC: /* beginning-of-character -- long form */
+ the_word = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ p = (long)signex(fontfp,(BYTE)4);
+ if ((UNSIGN32)c != the_word)
+ {
+ if (p < 0L)
+ {
+ (void)warning(
+ "chargf(): Requested character not found in back chain in GF font file");
+ return(EOF);
+ }
+ else
+ (void)FSEEK(fontfp,p,0); /* must follow back chain */
+ break;
+ }
+ else
+ {
+ min_m = (INT16)signex(fontfp,(BYTE)4);
+ max_m = (INT16)signex(fontfp,(BYTE)4);
+ min_n = (INT16)signex(fontfp,(BYTE)4);
+ max_n = (INT16)signex(fontfp,(BYTE)4);
+ }
+ if ((min_m < MIN_M) || (MAX_M < max_m) ||
+ (min_n < MIN_N) || (MAX_N < max_n))
+ {
+ (void)warning(
+ "chargf(): GF font file character box too large for me");
+ return(EOF);
+ }
+ m = min_m;
+ n = max_n;
+ paint_switch = WHITE;
+ img_words = (UNSIGN16)((max_m - min_m + 1 + 31) >> 5);
+ if (do_output)
+ (void)clrrow();
+ tcharptr->hp = (COORDINATE)(max_n - min_n + 1);
+ tcharptr->wp = (COORDINATE)(max_m - min_m + 1);
+ tcharptr->xoffp = -(COORDINATE)(min_m);
+ tcharptr->yoffp = (COORDINATE)(max_n);
+ if (!VISIBLE(tcharptr))
+ return(0); /* empty character raster -- nothing to output */
+ break;
+
+ case GFBOC1: /* beginning-of-character -- short form */
+ if (c != (BYTE)nosignex(fontfp,(BYTE)1))
+ {
+ (void)warning(
+ "chargf(): Requested character not found in GF font file");
+ return(EOF);
+ }
+ else
+ {
+ min_m = (INT16)nosignex(fontfp,(BYTE)1);
+ max_m = (INT16)nosignex(fontfp,(BYTE)1);
+ min_m = max_m - min_m;
+ min_n = (INT16)nosignex(fontfp,(BYTE)1);
+ max_n = (INT16)nosignex(fontfp,(BYTE)1);
+ min_n = max_n - min_n;
+ }
+ if ((min_m < MIN_M) || (MAX_M < max_m) ||
+ (min_n < MIN_N) || (MAX_N < max_n))
+ {
+ (void)warning(
+ "chargf(): GF font file character box too large for me");
+ return(EOF);
+ }
+ m = min_m;
+ n = max_n;
+ paint_switch = WHITE;
+ img_words = (UNSIGN16)((max_m - min_m + 1 + 31) >> 5);
+ if (do_output)
+ (void)clrrow();
+ tcharptr->hp = (COORDINATE)(max_n - min_n + 1);
+ tcharptr->wp = (COORDINATE)(max_m - min_m + 1);
+ tcharptr->xoffp = -(COORDINATE)(min_m);
+ tcharptr->yoffp = (COORDINATE)(max_n);
+ if (!VISIBLE(tcharptr))
+ return(0);/* empty character raster -- nothing to output */
+ break;
+
+ case GFEOC: /* end-of-character */
+ if (do_output)
+ {
+ (void)(*outfcn)(c,max_n-n); /* output current row */
+ (void)clrrow(); /* clear next one */
+ --n; /* advance to next row below */
+ for ( ; n >= min_n ; --n) /* output any remaining rows */
+ (void)(*outfcn)(c,max_n-n);
+ }
+ return(0); /* exit outer loop */
+
+ case GFSKIP0:
+ if (do_output)
+ {
+ (void)(*outfcn)(c,max_n-n); /* output current row */
+ (void)clrrow(); /* clear next one */
+ }
+ --n; /* advance to next row below */
+ m = min_m;
+ paint_switch = WHITE;
+ break;
+
+ case GFSKIP1:
+ if (do_output)
+ {
+ (void)(*outfcn)(c,max_n-n); /* output current row */
+ (void)clrrow(); /* clear next one */
+ }
+ --n; /* advance to next row below */
+ d = (UNSIGN16)nosignex(fontfp,(BYTE)1);
+ if (do_output)
+ {
+ for (k = 0; k < d; (--n,++k)) /* output d white rows */
+ (void)(*outfcn)(c,max_n-n);
+ }
+ else
+ n -= (INT16)d;
+ m = min_m;
+ paint_switch = WHITE;
+ break;
+
+ case GFSKIP2:
+ if (do_output)
+ {
+ (void)(*outfcn)(c,max_n-n); /* output current row */
+ (void)clrrow(); /* clear next one */
+ }
+ --n; /* advance to next row below */
+ d = (UNSIGN16)nosignex(fontfp,(BYTE)2);
+ if (do_output)
+ {
+ for (k = 0; k < d; (--n,++k)) /* output d white rows */
+ (void)(*outfcn)(c,max_n-n);
+ }
+ else
+ n -= (INT16)d;
+ m = min_m;
+ paint_switch = WHITE;
+ break;
+
+ case GFSKIP3: /* METAFONT never needs this */
+ if (do_output)
+ {
+ (void)(*outfcn)(c,max_n-n); /* output current row */
+ (void)clrrow(); /* clear next one */
+ }
+ --n; /* advance to next row below */
+ d = (UNSIGN16)nosignex(fontfp,(BYTE)3); /* NOTE truncation */
+ if (do_output)
+ {
+ for (k = 0; k < d; (++k, --n)) /* output d white rows */
+ (void)(*outfcn)(c,max_n-n);
+ }
+ else
+ n -= (INT16)d;
+ m = min_m;
+ paint_switch = WHITE;
+ break;
+
+ case GFXXX1:
+ case GFXXX2:
+ case GFXXX3:
+ case GFXXX4:
+ case GFYYY:
+ case GFNOOP:
+ (void)UNGETC((char)the_byte,fontfp);
+ (void)skgfspec();
+ break;
+
+ default:
+ if (((BYTE)GFPAINT0 < the_byte) && (the_byte < GFPAINT1))
+ {
+ d = (UNSIGN16)(the_byte - GFPAINT0);
+ if (do_output && (paint_switch == BLACK))
+ {
+ for (k = 0; k < d; (++m, ++k))
+ SETBIT(m);
+ }
+ else
+ m += (INT16)d;
+ paint_switch = (BYTE)(!paint_switch);
+ }
+ else if (((BYTE)GFNROW0 <= the_byte) && (the_byte <= GFNROWMAX))
+ {
+ if (do_output)
+ {
+ (void)(*outfcn)(c,max_n-n); /* output current row */
+ (void)clrrow(); /* clear next one */
+ }
+ n--; /* advance to next row below */
+ paint_switch = BLACK;
+ m = min_m + (UNSIGN16)(the_byte - GFNROW0);
+ }
+ else
+ {
+ (void)sprintf(message,
+ "chargf(): Unexpected byte %d (0x%02x) in GF font file \
+at position %ld",
+ the_byte,the_byte,(long)FTELL(fontfp));
+ (void)warning(message);
+ return(EOF);
+ }
+ break;
+ } /* end switch */
+ the_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ } /* end for() */
+}
diff --git a/dviware/beebe/src/charpk.h b/dviware/beebe/src/charpk.h
new file mode 100644
index 0000000000..21a35f5aed
--- /dev/null
+++ b/dviware/beebe/src/charpk.h
@@ -0,0 +1,344 @@
+/* -*-C-*- charpk.h */
+/*-->charpk*/
+/**********************************************************************/
+/******************************* charpk *******************************/
+/**********************************************************************/
+
+/* This file departs from all others in the DVIxxx family in that it
+declares some private functions and globals which are required nowhere
+else. Only charpk() is called from outside. */
+
+BYTE get_bit(); /* return next bit from file */
+BYTE get_nybble(); /* return next 4-bit nybble from file */
+UNSIGN16 pk_packed_num(); /* get packed number from file */
+
+BYTE bit_weight; /* weight of current bit in next_byte */
+BYTE dyn_f; /* dynamic packing flag */
+UNSIGN16 repeat_count; /* how many times to repeat next row */
+BYTE next_byte; /* current input byte */
+BYTE word_weight; /* weight of current bit in *pword */
+
+/**********************************************************************/
+
+int
+charpk(c,outfcn) /* return 0 on success, and EOF on failure */
+BYTE c; /* current character value */
+void (*outfcn)(); /* (possibly NULL) function to output current row */
+{
+ INT16 count; /* how many bits of current color left */
+ UNSIGN16 c_width; /* character width in dots */
+ UNSIGN16 c_height; /* character height in dots */
+ BOOLEAN do_output; /* FALSE if outfcn is NULL */
+ register BYTE flag_byte; /* current file flag byte */
+ UNSIGN16 h_bit; /* horizontal position in row */
+ register UNSIGN16 i; /* loop index */
+ register UNSIGN16 k; /* loop index */
+ long offset; /* offset into font file */
+ long p; /* pointer into font file */
+ UNSIGN32 packet_length; /* packet length */
+ UNSIGN32* pword; /* pointer into img_row[] */
+ INT16 rows_left; /* how many rows left */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ BYTE turn_on; /* initial black/white flag */
+
+ /*******************************************************************
+ This function is called to process a single character description in
+ the PK font file. The character packet is pointed to by
+ fontptr->ch[c].fontrp, and was set by readpk(), which moved past any
+ special commands that precede the packet.
+
+ The PK raster description is encoded in a complex form, but is
+ guaranteed to step across raster rows from left to right, and down
+ from the top row to bottom row, such that in references to
+ image[n][m], m never decreases in a row, and n never increases in a
+ character. This means that we only require enough memory space to
+ hold one row, provided that outfcn(c,yoff) is called each time a row
+ is completed. This is an important economization for
+ high-resolution output devices -- e.g. a 10pt character at 2400
+ dots/inch would require about 8Kb for the entire image, but fewer
+ than 25 bytes for a single row. A 72pt character (such as in the
+ aminch font) would need about 430Kb for the image, but only about
+ 200 bytes for a row.
+
+ The code follows PKtoPX quite closely, particular the latter's
+ sections 37-43 for preamble processing, and sections 44-51 for
+ raster decoding.
+
+ Access to bit m in the current row is controlled through the macros
+ SETBIT(m) and TESTBIT(m) so we need not be concerned about the
+ details of bit masking. Too bad C does not have a bit data type!
+
+ The row image is recorded in such a way that bits min_m .. max_m are
+ mapped onto bits 0 .. (max_m - min_m) in img_row[], so that
+ outfcn(c,yoff) should be relieved of any shifting operations.
+
+ outfcn(c,yoff) is NEVER called if either of hp or wp is <= 0, or if
+ it is NULL.
+ *******************************************************************/
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c))
+ {
+ (void)warning(
+ "charpk(): Character value out of range for PK font file");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr))
+ return(0); /* empty character raster -- nothing to output */
+
+ c_width = (UNSIGN16)tcharptr->wp; /* local copies of these to save */
+ c_height = (UNSIGN16)tcharptr->hp; /* pointer dereferencing in loops */
+
+ p = (long)tcharptr->fontrp; /* font file raster pointer */
+ if (p < 0L)
+ {
+ (void)warning(
+ "charpk(): Requested character not found in PK font file");
+ return(EOF);
+ }
+ if (FSEEK(fontfp,p,0))
+ {
+ (void)warning(
+ "charpk(): FSEEK() failure for PK font file character raster");
+ return(EOF);
+ }
+
+ /* Since readpk() has already done error checking on the file, and
+ recorded the character metrics, we need not repeat that work, and
+ concentrate instead on getting to the encoded raster description
+ which follows the character packet. */
+
+ img_words = (UNSIGN16)(c_width + 31) >> 5;
+ flag_byte = (BYTE)nosignex(fontfp,(BYTE)1); /* get packet flag byte */
+ dyn_f = flag_byte >> 4; /* dyn_f is high 4 bits from flag_byte */
+ turn_on = (BYTE)(flag_byte & 0x08); /* turn_on is 8-bit from flag_byte */
+ flag_byte &= 0x07; /* final flag_byte is low 3 bits */
+ do_output = (BOOLEAN)(outfcn != (void(*)())NULL);
+
+ switch(flag_byte) /* flag_byte is in 0..7 */
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3: /* short character preamble */
+ packet_length = (UNSIGN32)flag_byte;
+ packet_length <<= 8;
+ packet_length += (UNSIGN32)nosignex(fontfp,(BYTE)1);
+ packet_length -= 8L;
+ offset = 9L;
+ break;
+
+ case 4:
+ case 5:
+ case 6: /* extended short character preamble */
+ packet_length = (UNSIGN32)(flag_byte & 0x03);
+ packet_length <<= 16;
+ packet_length += (UNSIGN32)nosignex(fontfp,(BYTE)2);
+ packet_length -= 13L;
+ offset = 14L;
+ break;
+
+ case 7: /* long character preamble */
+ packet_length = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ packet_length -= 28L;
+ offset = 32L;
+ break;
+
+ } /* end switch */
+
+ if (FSEEK(fontfp,offset,1)) /* position to start of raster data */
+ {
+ (void)warning(
+ "charpk(): FSEEK() failure for PK font file character raster");
+ return(EOF);
+ }
+
+ bit_weight = 0;
+
+ if (dyn_f == (BYTE)14) /* <PKtoPX: Get raster by bits> */
+ { /* uncompressed character image */
+ for (i = 0; i < c_height; ++i)
+ {
+ pword = img_row;
+ if (do_output)
+ (void)clrrow();
+ word_weight = (BYTE)31;
+ for (k = 0; k < c_width; ++k)
+ {
+ if (get_bit())
+ *pword |= power[word_weight];
+ if (word_weight)
+ --word_weight;
+ else
+ {
+ ++pword;
+ word_weight = (BYTE)31;
+ }
+ } /* end for (k) */
+ if (do_output)
+ (void)(*outfcn)(c,i);
+ } /* end for (i) */
+ }
+ else /* <PKtoPX: Create normally packed raster> */
+ { /* run-length encoded character image */
+ rows_left = (INT16)c_height;
+ h_bit = c_width;
+ repeat_count = 0;
+ word_weight = (BYTE)32;
+ pword = img_row;
+ if (do_output)
+ (void)clrrow(); /* clear img_row[] */
+ while (rows_left > 0)
+ {
+ count = (INT16)pk_packed_num();
+ while (count > 0)
+ {
+ if ( (count < (INT16)word_weight) && (count < (INT16)h_bit) )
+ {
+ if (turn_on)
+ {
+ *pword |= gpower[word_weight];
+ *pword &= ~gpower[word_weight - count];
+ }
+ h_bit -= (UNSIGN16)count;
+ word_weight -= (BYTE)count;
+ count = 0;
+ }
+ else if ( (count >= (INT16)h_bit) &&
+ (h_bit <= (UNSIGN16)word_weight) )
+ {
+ if (turn_on)
+ {
+ *pword |= gpower[word_weight];
+ *pword &= ~gpower[word_weight - h_bit];
+ }
+ if (do_output)
+ {
+ for (i = 0; i <= repeat_count; (--rows_left, ++i))
+ (void)(*outfcn)(c,(UNSIGN16)(c_height-rows_left));
+ }
+ else
+ rows_left -= (INT16)(repeat_count + 1);
+ repeat_count = 0;
+ pword = img_row;
+ if (do_output)
+ (void)clrrow();
+ word_weight = (BYTE)32;
+ count -= (INT16)h_bit;
+ h_bit = c_width;
+ }
+ else
+ {
+ if (turn_on)
+ *pword |= gpower[word_weight];
+ pword++;
+ count -= (INT16)word_weight;
+ h_bit -= (UNSIGN16)word_weight;
+ word_weight = (BYTE)32;
+ }
+ } /* end while (count > 0) */
+ turn_on = (BYTE)(!turn_on);
+ } /* end while (rows_left > 0) */
+ if ((rows_left > 0) || (h_bit != c_width))
+ {
+ (void)warning(
+ "charpk(): Bad PK font file--more bits than required");
+ return(EOF);
+ }
+ } /* end if (run-length encoded image) */
+
+ return(0);
+}
+
+/*-->get_bit*/
+/**********************************************************************/
+/****************************** get_bit *******************************/
+/**********************************************************************/
+
+BYTE
+get_bit() /* return 0, or non-zero (not necessarily 1) */
+{
+ register BYTE temp;
+
+ bit_weight >>= 1;
+ if (bit_weight == 0) /* then must get new byte from font file */
+ {
+ next_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ bit_weight = (BYTE)128;
+ }
+ temp = next_byte & bit_weight;
+ next_byte &= ~bit_weight; /* clear the just-read bit */
+
+ return (temp);
+}
+
+
+/*-->get_nybble*/
+/**********************************************************************/
+/***************************** get_nybble *****************************/
+/**********************************************************************/
+
+BYTE
+get_nybble()
+{
+ register BYTE temp;
+
+ if (bit_weight == 0) /* get high nybble */
+ {
+ next_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ temp = next_byte >> 4;
+ next_byte &= 0x0f;
+ bit_weight = (BYTE)1;
+ }
+ else /* get low nybble */
+ {
+ temp = next_byte; /* this has only 4 bits in it */
+ bit_weight = (BYTE)0;
+ }
+ return(temp);
+}
+
+/*-->pk_packed_num*/
+/**********************************************************************/
+/*************************** pk_packed_num ****************************/
+/**********************************************************************/
+
+UNSIGN16
+pk_packed_num() /* return a (non-negative) packed number from the font file */
+{ /* this function is recursive to one level only */
+ INT16 i,j;
+
+ i = (INT16)get_nybble();
+ if (i == 0)
+ {
+ do
+ {
+ j = (INT16)get_nybble();
+ ++i;
+ } while (j == 0);
+ while (i > 0)
+ {
+ j <<= 4;
+ j += (INT16)get_nybble();
+ --i;
+ }
+ return((UNSIGN16)(j - 15 + ((13 - dyn_f) << 4) + dyn_f));
+ }
+ else if (i <= (INT16)dyn_f)
+ return((UNSIGN16)i);
+ else if (i < 14)
+ return((UNSIGN16)(((i - dyn_f - 1) << 4) + get_nybble() + dyn_f + 1));
+ else if (i == 14)
+ {
+ repeat_count = pk_packed_num();
+ return(pk_packed_num());
+ }
+ else
+ {
+ repeat_count = 1;
+ return(pk_packed_num());
+ }
+}
+
+
diff --git a/dviware/beebe/src/charpxl.h b/dviware/beebe/src/charpxl.h
new file mode 100644
index 0000000000..49b6eb1852
--- /dev/null
+++ b/dviware/beebe/src/charpxl.h
@@ -0,0 +1,55 @@
+/* -*-C-*- charpxl.h */
+/*-->charpxl*/
+/**********************************************************************/
+/******************************* charpxl ******************************/
+/**********************************************************************/
+
+int
+charpxl(c,outfcn) /* return 0 on success, and EOF on failure */
+BYTE c; /* current character value */
+void (*outfcn)(); /* (possibly NULL) function to output current row */
+{
+ UNSIGN16 i,j; /* loop index */
+ long p; /* offset into font file */
+ register UNSIGN32 *q; /* pointer into rasters area */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c))
+ {
+ (void)warning(
+ "charpxl(): Character value out of range for PXL font file");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr))
+ return(0); /* do nothing for empty characters */
+
+ p = (long)tcharptr->fontrp; /* font file raster pointer */
+ if (p < 0L)
+ {
+ (void)warning(
+ "charpxl(): Requested character not found in PXL font file");
+ return(EOF);
+ }
+
+ if (FSEEK(fontfp,p,0))
+ {
+ (void)warning(
+ "charpxl(): FSEEK() failure for PXL font file character raster");
+ return(EOF);
+ }
+
+ if (outfcn != (void(*)())NULL)
+ {
+ img_words = ((UNSIGN16)(tcharptr->wp) + 31) >> 5;
+ for (i = 0; i < (UNSIGN16)(tcharptr->hp); ++i)
+ {
+ q = img_row;
+ for (j = 0; j < img_words; ++j)
+ *q++ = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ (void)(*outfcn)(c,i);
+ }
+ }
+ return(0);
+}
diff --git a/dviware/beebe/src/clrbmap.h b/dviware/beebe/src/clrbmap.h
new file mode 100644
index 0000000000..33033fc186
--- /dev/null
+++ b/dviware/beebe/src/clrbmap.h
@@ -0,0 +1,53 @@
+/* -*-C-*- clrbmap.h */
+/*-->clrbmap*/
+/**********************************************************************/
+/****************************** clrbmap *******************************/
+/**********************************************************************/
+
+void
+clrbmap()
+
+{
+#if SEGMEM
+ register INT16 x,y; /* loop indices */
+ register UNSIGN32 *p; /* bitmap pointer */
+
+ for (y = 0; y < YBIT; ++y)
+ {
+ p = (UNSIGN32*)BITMAP(y,0);
+
+#if FASTZERO
+ (void)zerom(p,(UNSIGN32)(XBIT));
+#else
+ for (x = 0; x < XBIT; (++p,++x))
+ *p = (UNSIGN32)0;
+#endif
+
+ }
+
+#else /* NOT SEGMEM */
+#if FASTZERO
+
+/***********************************************************************
+Fast assembly language clear -- runtime histogramming showed 24% of
+total time was spent in this routine for the large bitmap required by
+the Toshiba P1315 180 dpi dvi driver!
+***********************************************************************/
+ (void)zerom(bitmap,(UNSIGN32)(XBIT*YBIT));
+
+#else /* NOT FASTZERO */
+
+
+ register INT32 nword; /* loop index */
+ register UNSIGN32 *p; /* bitmap pointer */
+
+ p = (UNSIGN32*)BITMAP(YBIT-1,XBIT-1); /* the last element */
+
+ for (nword = (XBIT*YBIT); nword; (--nword,--p))
+ *p = (UNSIGN32)0;
+
+#endif /* FASTZERO */
+
+#endif /* SEGMEM */
+}
+
diff --git a/dviware/beebe/src/clrrow.h b/dviware/beebe/src/clrrow.h
new file mode 100644
index 0000000000..e3f65bcdf6
--- /dev/null
+++ b/dviware/beebe/src/clrrow.h
@@ -0,0 +1,16 @@
+/* -*-C-*- clrrow.h */
+/*-->clrrow*/
+/**********************************************************************/
+/****************************** clrrow ********************************/
+/**********************************************************************/
+
+void
+clrrow() /* clear the current character image row, img_row[] */
+{
+ register UNSIGN32 *p;
+ register UNSIGN16 nwords;
+
+ nwords = img_words;
+ for (p = &img_row[nwords-1]; nwords; (--p,--nwords))
+ *p = (UNSIGN32)0L;
+}
diff --git a/dviware/beebe/src/commands.h b/dviware/beebe/src/commands.h
new file mode 100644
index 0000000000..04886169df
--- /dev/null
+++ b/dviware/beebe/src/commands.h
@@ -0,0 +1,114 @@
+/* -*-C-*- commands.h */
+/*-->commands*/
+/**********************************************************************/
+/****************************** commands ******************************/
+/**********************************************************************/
+
+#define SETC_000 0
+/* SETC_001 .. SETC_126 not required */
+#define SETC_127 127
+#define SET1 128
+#define SET2 129
+#define SET3 130
+#define SET4 131
+#define SET_RULE 132
+#define PUT1 133
+#define PUT2 134
+#define PUT3 135
+#define PUT4 136
+#define PUT_RULE 137
+#define NOP 138
+#define BOP 139
+#define EOP 140
+#define PUSH 141
+#define POP 142
+#define RIGHT1 143
+#define RIGHT2 144
+#define RIGHT3 145
+#define RIGHT4 146
+#define W0 147
+#define W1 148
+#define W2 149
+#define W3 150
+#define W4 151
+#define X0 152
+#define X1 153
+#define X2 154
+#define X3 155
+#define X4 156
+#define DOWN1 157
+#define DOWN2 158
+#define DOWN3 159
+#define DOWN4 160
+#define Y0 161
+#define Y1 162
+#define Y2 163
+#define Y3 164
+#define Y4 165
+#define Z0 166
+#define Z1 167
+#define Z2 168
+#define Z3 169
+#define Z4 170
+#define FONT_00 171
+/* FONT_01 .. FONT_62 not required */
+#define FONT_63 234
+#define FNT1 235
+#define FNT2 236
+#define FNT3 237
+#define FNT4 238
+#define XXX1 239
+#define XXX2 240
+#define XXX3 241
+#define XXX4 242
+#define FNT_DEF1 243
+#define FNT_DEF2 244
+#define FNT_DEF3 245
+#define FNT_DEF4 246
+#define PRE 247
+#define POST 248
+#define POST_POST 249
+
+/* Command codes for METAFONT .GF font files */
+
+#define GFPAINT0 0
+#define GFPAINT1 64
+#define GFPAINT2 65
+#define GFPAINT3 66
+#define GFBOC 67
+#define GFBOC1 68
+#define GFEOC 69
+#define GFSKIP0 70
+#define GFSKIP1 71
+#define GFSKIP2 72
+#define GFSKIP3 73
+#define GFNROW0 74
+#define GFEOF 223
+#define GFNROWMAX 238
+#define GFXXX1 239
+#define GFXXX2 240
+#define GFXXX3 241
+#define GFXXX4 242
+#define GFYYY 243
+#define GFNOOP 244
+#define GFCHLOC 245
+#define GFCHLOC0 246
+#define GFPRE 247
+#define GFPOST 248
+#define GFPOSTPOST 249
+
+#define GFID 131
+
+/* Command codes for packed (.PK) font files */
+
+
+#define PKXXX1 240
+#define PKXXX2 241
+#define PKXXX3 242
+#define PKXXX4 243
+#define PKYYY 244
+#define PKPOST 245
+#define PKNOOP 246
+#define PKPRE 247
+
+#define PKID 89
diff --git a/dviware/beebe/src/cuseri.c b/dviware/beebe/src/cuseri.c
new file mode 100644
index 0000000000..df52cc968b
--- /dev/null
+++ b/dviware/beebe/src/cuseri.c
@@ -0,0 +1,58 @@
+/* -*-C-*- cuseri.c */
+/*-->cuserid*/
+/**********************************************************************/
+/****************************** cuserid ******************************/
+/**********************************************************************/
+
+#include <stdio.h>
+
+#ifdef PCC_20
+#define KCC_20 0
+#else
+#define PCC_20 0
+#endif
+
+#if PCC_20
+#undef tops20 /* to avoid macro substitution */
+#include <tops20.h> /* gets jsys.h and byteptr.h; */
+#define tops20 1
+#endif
+
+#if KCC_20
+#include <jsys.h>
+#ifndef ac1
+static int acs[5];
+#define ac1 acs[1]
+#define ac2 acs[2]
+#define ac3 acs[3]
+#define ac4 acs[4]
+#endif /* ac1 */
+#endif /* KCC_20 */
+
+char*
+cuserid(s)
+char* s;
+{
+ static char username[40];
+
+ username[0] = '\0';
+
+#if KCC_20
+ (void)jsys(GJINF,acs);
+ ac2 = ac1; /* user number */
+ ac1 = (int)(username-1); /* Monitor wants ILDB */
+ /* pointer, not LDB pointer*/
+ (void)jsys(DIRST,acs);
+#endif /* KCC_20 */
+
+#if PCC_20
+ (void)jsys(JSgjinf,acs);
+ ac2 = ac1; /* user number */
+ ac1 = POINT(username);
+ (void)jsys(JSdirst,acs);
+#endif /* PCC_20 */
+
+ if (s != (char*)NULL)
+ strcpy(s,username);
+ return ((char*) username);
+}
diff --git a/dviware/beebe/src/cvt.c b/dviware/beebe/src/cvt.c
new file mode 100644
index 0000000000..f1ab02c742
--- /dev/null
+++ b/dviware/beebe/src/cvt.c
@@ -0,0 +1,70 @@
+/***********************************************************************
+Convert a stream format file to fixed binary, supplying trailing NUL's
+for padding if necessary.
+
+Usage:
+ cvt infile outfile
+[22-Aug-87]
+***********************************************************************/
+
+#define PAD '\0'
+#define FAILURE ((1 << 28) + 2)
+#define SUCCESS 1
+
+#include <stdio.h>
+
+main(argc,argv)
+int argc;
+char* argv[];
+{
+ FILE* in;
+ FILE* out;
+ int c;
+ long count;
+
+ if (argc != 3)
+ {
+ fprintf(stderr,"Usage: cvf infile outfile\n");
+ exit(FAILURE);
+ }
+
+ in = fopen(argv[1],"rb","rfm=stm","ctx=stm");
+ if (in == (FILE*)NULL)
+ {
+ fprintf(stderr,"?Cannot open [%s] for input\n",argv[1]);
+ exit(FAILURE);
+ }
+
+ out = fopen(argv[2],"wb","rfm=fix","bls=512","mrs=512");
+ if (out == (FILE*)NULL)
+ {
+ fprintf(stderr,"?Cannot open [%s] for output\n",argv[1]);
+ exit(FAILURE);
+ }
+
+ count = 0;
+ while ((c = getc(in)) != EOF)
+ {
+ putc(c,out);
+ count++;
+ }
+ fprintf(stderr,"File size = %ld\n",count);
+ /* Now supply trailing padding to ensure output is a multiple of
+ 512 characters; otherwise, RMS will not close the output file
+ correctly. */
+ count %= 512;
+ if (count > 0)
+ for (; count < 512; ++count)
+ putc(PAD,out);
+ if (fclose(in) == EOF)
+ {
+ fprintf(stderr,"?Close failure on [%s]\n",argv[1]);
+ exit(FAILURE);
+ }
+ if (fclose(out) == EOF)
+ {
+ fprintf(stderr,"?Close failure on [%s]\n",argv[2]);
+ exit(FAILURE);
+ }
+ exit(SUCCESS);
+}
diff --git a/dviware/beebe/src/dbgopen.h b/dviware/beebe/src/dbgopen.h
new file mode 100644
index 0000000000..af4b403d7b
--- /dev/null
+++ b/dviware/beebe/src/dbgopen.h
@@ -0,0 +1,26 @@
+/* -*-C-*- dbgopen.h */
+/*-->dbgopen*/
+/**********************************************************************/
+/****************************** dbgopen *******************************/
+/**********************************************************************/
+
+/* This used to be a long in-line macro, but some compilers could not */
+/* handle it. */
+
+void
+dbgopen(fp, fname, openmode)
+FILE* fp; /* file pointer */
+char* fname; /* file name */
+char* openmode; /* open mode flags */
+{
+ if (DBGOPT(DBG_OKAY_OPEN) && (fp != (FILE *)NULL))
+ {
+ (void)fprintf(stderr,"%%Open [%s] mode [%s]--[OK]",fname,openmode);
+ NEWLINE(stderr);
+ }
+ if (DBGOPT(DBG_FAIL_OPEN) && (fp == (FILE *)NULL))
+ {
+ (void)fprintf(stderr,"%%Open [%s] mode [%s]--[FAILED]",fname,openmode);
+ NEWLINE(stderr);
+ }
+}
diff --git a/dviware/beebe/src/derun.c b/dviware/beebe/src/derun.c
new file mode 100644
index 0000000000..8e99fb3d63
--- /dev/null
+++ b/dviware/beebe/src/derun.c
@@ -0,0 +1,137 @@
+/* -*-C-*- derun.c */
+/*-->derun*/
+/**********************************************************************/
+/******************************* derun ********************************/
+/**********************************************************************/
+
+/***********************************************************************
+Expand run-length encoded Toshiba P1351 plot file to unexpanded form for
+checking of run-length coding algorithm.
+
+Usage:
+ derun <infile >outfile
+***********************************************************************/
+
+#include <stdio.h>
+
+#define ESC '\033'
+#define FF '\f'
+#define CTLZ '\032'
+#define MAXBUF 14*180*4
+#define NL '\n'
+#define TRUE 1
+#define FALSE 0
+int buf[MAXBUF+5],kbuf; /* leave extra space at end of buf[] */
+#if ANSI
+void OutBuf(int);
+#else
+void OutBuf();
+#endif
+
+void
+main(argc,argv)
+int argc;
+char* argv[];
+{
+ int c,n,isgraph;
+
+
+ kbuf = 0;
+ isgraph = FALSE;
+ while (((c = getchar()) != EOF) && (kbuf < MAXBUF))
+ {
+ if (c == FF) /* <CTL-L> */
+ {
+ buf[kbuf++] = c;
+ OutBuf(FALSE);
+ }
+ else if (c == ESC) /* <ESC> ... */
+ {
+ c = getchar();
+ if (c == 'G') /* <ESC> G */
+ {
+ buf[kbuf++] = ESC;
+ buf[kbuf++] = c;
+ OutBuf(FALSE);
+ }
+ else if (c == CTLZ) /* <ESC> <CTL-Z> I */
+ {
+ buf[kbuf++] = ESC;
+ buf[kbuf++] = c;
+ buf[kbuf++] = getchar();
+ OutBuf(FALSE);
+ }
+ else if (c == 'L') /* <ESC> L n n */
+ {
+ buf[kbuf++] = ESC;
+ buf[kbuf++] = c;
+ buf[kbuf++] = getchar();
+ buf[kbuf++] = getchar();
+ OutBuf(FALSE);
+ }
+ else if (c == 'H')
+ {
+ isgraph = TRUE;
+ n = (getchar() - '@')*256;
+ n += (getchar() - '@')*16;
+ n += (getchar() - '@');
+ n *= 6;
+ for ( ; (n > 0) && (kbuf < MAXBUF); --n)
+ buf[kbuf++] = '@';
+ }
+ else if (c == ';')
+ {
+ isgraph = TRUE;
+ n = (getchar() - '0')*1000;
+ n += (getchar() - '0')*100;
+ n += (getchar() - '0')*10;
+ n += (getchar() - '0');
+ n *= 4;
+ for ( ; (n > 0) && (kbuf < MAXBUF); --n)
+ buf[kbuf++] = getchar();
+ }
+ else
+ {
+ buf[kbuf++] = ESC;
+ buf[kbuf++] = c;
+ }
+ }
+ else if (c == NL)
+ {
+ if ((kbuf & 03) && isgraph)
+ {
+ (void)fprintf(stderr,"%Byte count %d not multiple of 4!\n",
+ kbuf);
+ (void)printf("%Byte count %d not multiple of 4!\n",kbuf);
+ }
+ if (isgraph)
+ (void)printf("\033;%04d",kbuf>>2);
+ OutBuf(TRUE);
+ isgraph = FALSE;
+ }
+ else
+ buf[kbuf++] = c;
+ }
+ if (kbuf >= MAXBUF)
+ (void)fprintf(stderr,
+ "?Buffer overflow -- buf[%d] needs %d\n",MAXBUF,kbuf);
+ if (kbuf > 0)
+ {
+ (void)fprintf(stderr,"%Last line not terminated by NL\n");
+ OutBuf(FALSE);
+ }
+}
+
+void
+OutBuf(putnl)
+int putnl;
+{
+ register int n;
+
+ for (n = 0 ; n < kbuf; ++n)
+ putchar((char)buf[n]);
+
+ if (putnl)
+ putchar(NL);
+ kbuf = 0;
+}
diff --git a/dviware/beebe/src/dispchar.h b/dviware/beebe/src/dispchar.h
new file mode 100644
index 0000000000..aa7c26a009
--- /dev/null
+++ b/dviware/beebe/src/dispchar.h
@@ -0,0 +1,166 @@
+/* -*-C-*- dispchar.h */
+/*-->dispchar*/
+/**********************************************************************/
+/****************************** dispchar ******************************/
+/**********************************************************************/
+
+void
+dispchar(c)
+BYTE c; /* character number in current font */
+
+/***********************************************************************
+
+ This procedure has the delicate job of OR'ing the current character
+ raster description into the bitmap, where the character box extends
+ horizontally from (xcorner .. xcorner+wp-1) and vertically from
+ (ycorner .. ycorner+hp-1). The lower left corner coordinates
+ (xcorner, ycorner) are related to the current point (xcp, ycp) as
+ follows:
+
+ <------wp------>
+ ^ ................
+ | ................
+ | ................
+ | ................
+ | ................
+ | ................
+ | ................
+ hp ................
+ | ................
+ | ................
+ | ................
+ | .....o.......... <-- (xcp,ycp) at "o"
+ | ................ ^
+ | ................ |
+ | ................ |--- (hp - yoffp - 1)
+ | ................ |
+ v +............... v <-- (xcorner,ycorner) at "+"
+ <--->
+ |
+ |
+ xoffp
+
+ The current PXL file format stores character rasters in 32-bit words,
+ with the rightmost portion of the last word in each line beyond the
+ edge of the character being all 0 bits. For efficiency, the OR
+ operation is done a word at a time, and in general, each such word
+ contributes to two words in the bitmap line.
+
+ line line line
+ |.........word.........|.........word.........|.........word.........|
+
+ 32-bit chunks--> |.....chrast.....|.....chrast.....|.....chrast.....|
+
+ |<---->|<------->|
+ | |
+ bits_to_current---^ ^--- bits_to_next
+
+ Thus, each 32-bit chunk will be right-shifted (filling vacated
+ positions at the left with 0 bits) leaving "bits_to_current" bits at
+ the low end and then OR'd into the current word of the bitmap line.
+
+ Since the C language right-shift operator may or may not propagate
+ the sign bit (which is usually at the left), a compile-time flag,
+ ARITHRSHIFT, is necessary to include an extra AND operation to remove
+ them when the right-shift is implemented by an arithmetic
+ (sign-propagating), rather than a logical, shift.
+
+ The 32-bit chunk will then be left-shifted (with 0 bits filling
+ vacated positions on the right) leaving "bits_to_next" bits at the
+ high end and OR'd into the next word of the bitmap line.
+
+ When the host word size exceeds 32 bits (e.g. DEC-10 or -20 36-bit
+ word), the first step may in fact require a left shift, and the
+ second step is then not needed. This is detected in the code below
+ by "bits_to_next" being negative.
+
+***********************************************************************/
+{
+ register struct char_entry *tcharptr;
+ COORDINATE x,xcorner,ycorner;
+ UNSIGN16 ilimit;
+ register INT16 bits_to_next;
+ register UNSIGN16 i;
+ UNSIGN32 word32;
+ register UNSIGN32 *p;
+ register UNSIGN32 *raster_word;
+ register COORDINATE j;
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c)) /* check character range */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ if (tcharptr->rasters == (UNSIGN32*)NULL)/* if rasters still on file */
+ loadchar(c); /* go get them */
+
+ if (tcharptr->rasters == (UNSIGN32*)NULL)
+ return; /* character image must be empty */
+
+ tcharptr->refcount++; /* update reference count */
+ raster_word = tcharptr->rasters; /* pointer to first raster word */
+
+ xcorner = xcp - tcharptr->xoffp;
+ ycorner = ycp - (tcharptr->hp - tcharptr->yoffp - 1);
+
+ if (DBGOPT(DBG_CHAR_DUMP))
+ {
+ NEWLINE(stdout);
+ (void)printf(
+ "dispchar(): (xcp,ycp) = (%d,%d) (xcorner,ycorner) = (%d,%d)",
+ xcp,ycp,xcorner,ycorner);
+ NEWLINE(stdout);
+ (void)printf(" (wp,hp) = (%d,%d) (xoffp,yoffp) = (%d,%d)",
+ tcharptr->wp,tcharptr->hp,tcharptr->xoffp,tcharptr->yoffp);
+ NEWLINE(stdout);
+ ilimit = (UNSIGN16)((tcharptr->wp + 31) >> 5);
+ for (j = tcharptr->hp; j > 0; --j)
+ {
+ for (i = 0; i < ilimit; ++i)
+ (void)printf(" %08lx",*raster_word++);
+ NEWLINE(stdout);
+ }
+ raster_word = tcharptr->rasters;
+ }
+
+ for (j = tcharptr->hp; j > 0; --j) /* loop over hp rasters from */
+ { /* top to bottom */
+ x = xcorner; /* select horizontal position */
+ p = BITMAP(ycorner+j-1,x/HOST_WORD_SIZE); /* and find word on line */
+ ilimit = (UNSIGN16)((tcharptr->wp + 31) >> 5);
+ for (i = 0; i < ilimit; ++i)
+ { /* loop over current line */
+ word32 = *raster_word++; /* get 32-bit portion of raster */
+ bits_to_next = (INT16)((x % HOST_WORD_SIZE) - HOST_WORD_SIZE + 32);
+
+#if (HOST_WORD_SIZE > 32)
+ if (bits_to_next < 0) /* then must left shift character raster */
+ *p |= (word32 << (-bits_to_next)); /* and OR into line */
+ else
+#endif
+
+ {
+ *p |=
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+/* these compilers correctly use a logical right shift for */
+/* unsigned values */
+#else
+#if ARITHRSHIFT /* arithmetic right shift propagates a sign */
+ /* bit which must be cleared by this AND */
+ rightones[bits_to_next] &
+#endif /* ARITHRSHIFT */
+#endif /* (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD) */
+
+ (word32 >> bits_to_next); /* OR into line */
+
+ if (bits_to_next > 0)
+ *++p |= (word32 << (HOST_WORD_SIZE - bits_to_next));
+ /* OR in any spill into next word */
+ else if (bits_to_next == 0)
+ ++p; /* ended at word boundary, so start new one */
+ }
+ x += 32; /* and update horizontal position */
+ }
+ }
+}
+
diff --git a/dviware/beebe/src/dumpchar.h b/dviware/beebe/src/dumpchar.h
new file mode 100644
index 0000000000..994b04795e
--- /dev/null
+++ b/dviware/beebe/src/dumpchar.h
@@ -0,0 +1,34 @@
+/* -*-C-*- dumpchar.h */
+/*-->dumpchar*/
+/**********************************************************************/
+/****************************** dumpchar ******************************/
+/**********************************************************************/
+
+void
+dumpchar(tcharptr,s) /* DEBUGGING routine */
+register struct char_entry *tcharptr;
+char s[];
+{
+ UNSIGN16 ilimit;
+ register UNSIGN16 i;
+ register COORDINATE j;
+ register *raster_word;
+
+ raster_word = tcharptr->rasters; /* pointer to first raster word */
+ (void)fprintf(stderr,
+ "DumpChar(%s): pfrp = %d\trasters at %06o",
+ s,tcharptr->pfrp,raster_word);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"\t(xcp,ycp) = %d %d",xcp,ycp);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"\t(wp,hp) = %d %d",tcharptr->wp,tcharptr->hp);
+ NEWLINE(stderr);
+ ilimit = (tcharptr->wp + 31)/32;
+ for (j = tcharptr->hp; j > 0; --j)
+ {
+ for (i = 0; i < ilimit; ++i)
+ (void)fprintf(stderr,"%9x ",*raster_word++);
+ (void)fprintf(stderr,"| ");
+ }
+ NEWLINE(stderr);
+}
diff --git a/dviware/beebe/src/dvi.xrf b/dviware/beebe/src/dvi.xrf
new file mode 100644
index 0000000000..c75d179ff5
--- /dev/null
+++ b/dviware/beebe/src/dvi.xrf
@@ -0,0 +1,3478 @@
+Created Tue Nov 17 21:07:23 MST 1987 on csc-sun.utah.edu
+xref dvialw.c dvibit.c dvican.c dvie72.c dvieps.c dvigd.c dviimp.c dvijep.c dvijet.c dvil3p.c dvil75.c dvim72.c dvimac.c dvimpi.c dvio72.c dvioki.c dviprx.c dvitos.c
+*********************************************************************
+* ..Name.. * ...Referenced in File... *
+*********************************************************************
+* * *
+* ABS() <- dvibit.c dvican.c dvijep.c fixpos.h *
+* * gendefs.h movedown.h moveover.h option.h *
+* * *
+* ADD_MEMBER() <- dvijep.c *
+* * *
+* ALLOW_INTERRUPT <- dvibit.c machdefs.h *
+* * *
+* ANSI_LIBRARY <- keydef.h machdefs.h *
+* * *
+* ANSI_PROTOTYPES <- gblprocs.h keydef.h machdefs.h *
+* * *
+* APPLEIMAGEWRITER <- dvimac.c gblprocs.h gblvars.h machdefs.h*
+* * option.h usage.h *
+* * *
+* ARITHRSHIFT <- dispchar.h machdefs.h *
+* * *
+* ATT <- machdefs.h *
+* * *
+* BBNBITGRAPH <- dvibit.c dviinit.h fatal.h gblprocs.h*
+* * gblvars.h machdefs.h main.h prtpage.h *
+* * readgf.h readpk.h readpxl.h setrule.h *
+* * warning.h *
+* * *
+* BEGINSTRING <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* BEGIN_RASTER_GRAPHIC<- dvijep.c *
+* * *
+* BELLS <- dvibit.c *
+* * *
+* BIGBGCHAR <- dvibit.c *
+* * *
+* BIGCHAR() <- dvialw.c dvican.c dvijep.c *
+* * *
+* BITMAP() <- bitmap.h clrbmap.h dispchar.h dvieps.c *
+* * dvigd.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c fillrect.h*
+* * *
+* BLACK <- chargf.h *
+* * *
+* BOOLEAN <- chargf.h charpk.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dviimp.c dvijep.c *
+* * fontsub.h gblprocs.h gblvars.h inch.h *
+* * prtpage.h setchar.h setrule.h typedefs.h*
+* * *
+* BOP <- commands.h getpgtab.h prtpage.h *
+* * *
+* BSD41 <- dvihead.h machdefs.h *
+* * *
+* BSD42 <- dvihead.h dviterm.h gblvars.h machdefs.h*
+* * main.h option.h *
+* * *
+* BYTE <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dviimp.c dviinit.h dvijep.c *
+* * dvijet.c dvimac.c findpost.h gblvars.h *
+* * getbytes.h getfntdf.h getpgtab.h loadchar.h*
+* * nosignex.h option.h outrow.h prtpage.h *
+* * readfont.h readgf.h readpk.h readpost.h*
+* * readpxl.h reldfont.h setchar.h signex.h *
+* * skgfspec.h skipfont.h skpkspec.h typedefs.h*
+* * *
+* BYTE_SIZE <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c *
+* * *
+* CANON_A2 <- dvican.c dvifile.h dviinit.h gblprocs.h*
+* * gblvars.h gendefs.h initglob.h machdefs.h*
+* * main.h option.h prtpage.h readgf.h *
+* * readpk.h readpxl.h setfntnm.h *
+* * *
+* CANON_TEST <- dviinit.h gendefs.h initglob.h option.h *
+* * *
+* COORDINATE <- chargf.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dvigd.c dviimp.c dviinit.h *
+* * dvijep.c fillrect.h fixpos.h gblprocs.h*
+* * gblvars.h movedown.h moveover.h moveto.h *
+* * prtpage.h readgf.h readpk.h readpxl.h *
+* * reldfont.h rulepxl.h setchar.h typedefs.h*
+* * *
+* CREATE_FONT <- dvijep.c *
+* * *
+* CSI <- dvican.c *
+* * *
+* DBGOPT() <- dbgopen.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dviimp.c dvijep.c dvijet.c *
+* * dviprx.c gendefs.h setchar.h *
+* * *
+* DBG_CHAR_DUMP <- dispchar.h gendefs.h *
+* * *
+* DBG_FAIL_OPEN <- dbgopen.h gendefs.h *
+* * *
+* DBG_FONT_CACHE <- gendefs.h *
+* * *
+* DBG_OFF_PAGE <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gendefs.h setchar.h *
+* * *
+* DBG_OKAY_OPEN <- dbgopen.h gendefs.h *
+* * *
+* DBG_PAGE_DUMP <- dvijet.c dviprx.c gendefs.h *
+* * *
+* DBG_POS_CHAR <- dvican.c dviimp.c dvijep.c gendefs.h *
+* * *
+* DBG_SET_TEXT <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gendefs.h setchar.h *
+* * *
+* DEBUG <- dvihead.h *
+* * *
+* DEBUG_OPEN() <- dvialw.c dviinit.h fatal.h fontsub.h *
+* * gendefs.h openfont.h warning.h *
+* * *
+* DECLA75 <- gblvars.h machdefs.h main.h *
+* * *
+* DECLN03PLUS <- gblvars.h machdefs.h main.h *
+* * *
+* DEFAULT_RESOLUTION <- dvijet.c initglob.h option.h *
+* * *
+* DELETE_ALL_FONTS <- dvijep.c *
+* * *
+* DEVICE_ID <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c main.h usage.h *
+* * *
+* DIGVAL() <- dvibit.c *
+* * *
+* DISKFULL() <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * machdefs.h *
+* * *
+* DOT_MODE <- dvican.c *
+* * *
+* DOWN1 <- commands.h prtpage.h *
+* * *
+* DOWN2 <- commands.h prtpage.h *
+* * *
+* DOWN3 <- commands.h prtpage.h *
+* * *
+* DOWN4 <- commands.h prtpage.h *
+* * *
+* DOWNLOAD_CHARACTER()<- dvijep.c *
+* * *
+* DVIEXT <- dviinit.h machdefs.h *
+* * *
+* DVIFORMAT <- dviinit.h findpost.h gendefs.h *
+* * *
+* DVIHELP <- initglob.h machdefs.h *
+* * *
+* DVIPREFIX <- dviinit.h machdefs.h *
+* * *
+* EMPTY_SET() <- dvijep.c *
+* * *
+* ENDJOB <- dviimp.c *
+* * *
+* ENDSTRING <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* END_RASTER_GRAPHICS <- dvijep.c *
+* * *
+* ENOSPC <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* EOF <- alldone.h chargf.h charpk.h charpxl.h *
+* * dvialw.c dviterm.h fontsub.h readgf.h *
+* * readpk.h readpxl.h reldfont.h *
+* * *
+* EOP <- commands.h prtpage.h *
+* * *
+* EPSON <- dvieps.c gblprocs.h gblvars.h machdefs.h*
+* * main.h option.h usage.h *
+* * *
+* EPSON_ADV_PAPER <- dvieps.c *
+* * *
+* EPSON_BIT_IMAGE <- dvieps.c *
+* * *
+* EPSON_MICRO_STEP <- dvieps.c *
+* * *
+* ESC <- dvioki.c *
+* * *
+* ETX <- dvioki.c *
+* * *
+* EXIT <- abortrun.h dviinit.h gblprocs.h machdefs.h*
+* * *
+* FALSE <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dviimp.c dvijep.c fontsub.h gblvars.h *
+* * inch.h initglob.h option.h prtpage.h *
+* * typedefs.h *
+* * *
+* FASTZERO <- clrbmap.h gblprocs.h machdefs.h *
+* * *
+* FILE <- abortrun.h alldone.h dbgopen.h dvialw.c *
+* * dvibit.c dvican.c dviimp.c dviinit.h *
+* * dvijep.c dviterm.h fatal.h fontsub.h *
+* * gblprocs.h gblvars.h getbytes.h keydef.h *
+* * loadchar.h nosignex.h openfont.h reldfont.h*
+* * signex.h usage.h warning.h *
+* * *
+* FILE_BASE() <- machdefs.h *
+* * *
+* FILE_CNT() <- machdefs.h *
+* * *
+* FILE_PTR() <- machdefs.h *
+* * *
+* FIRSTBGCHAR <- dvibit.c gblvars.h *
+* * *
+* FIRSTPXLCHAR <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gendefs.h loadchar.h readgf.h *
+* * readpxl.h reldfont.h *
+* * *
+* FNT1 <- commands.h prtpage.h *
+* * *
+* FNT2 <- commands.h prtpage.h *
+* * *
+* FNT3 <- commands.h prtpage.h *
+* * *
+* FNT4 <- commands.h prtpage.h *
+* * *
+* FNT_DEF1 <- commands.h getfntdf.h prtpage.h *
+* * *
+* FNT_DEF2 <- commands.h prtpage.h *
+* * *
+* FNT_DEF3 <- commands.h prtpage.h *
+* * *
+* FNT_DEF4 <- commands.h getfntdf.h prtpage.h *
+* * *
+* FONTLIST <- initglob.h machdefs.h *
+* * *
+* FONTNUMBER() <- dvican.c *
+* * *
+* FONTPATH <- initglob.h machdefs.h *
+* * *
+* FONT_00 <- commands.h prtpage.h *
+* * *
+* FONT_63 <- commands.h prtpage.h *
+* * *
+* FOPEN <- dviinit.h gblprocs.h machdefs.h openfont.h*
+* * *
+* FSEEK <- alldone.h chargf.h charpk.h charpxl.h *
+* * dvialw.c dvifile.h findpost.h fontsub.h *
+* * gblprocs.h getpgtab.h machdefs.h prtpage.h *
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * skgfspec.h skpkspec.h *
+* * *
+* FTELL <- chargf.h dvialw.c dvibit.c findpost.h*
+* * gblprocs.h machdefs.h readpk.h *
+* * *
+* FT_GF <- gendefs.h reldfont.h *
+* * *
+* FT_PK <- gendefs.h reldfont.h *
+* * *
+* FT_PXL <- gendefs.h reldfont.h *
+* * *
+* GETENV <- dvibit.c gblprocs.h initglob.h machdefs.h*
+* * *
+* GFBOC <- chargf.h commands.h *
+* * *
+* GFBOC1 <- chargf.h commands.h *
+* * *
+* GFCHLOC <- commands.h readgf.h *
+* * *
+* GFCHLOC0 <- commands.h readgf.h *
+* * *
+* GFEOC <- chargf.h commands.h *
+* * *
+* GFEOF <- commands.h readgf.h *
+* * *
+* GFID <- commands.h readgf.h reldfont.h *
+* * *
+* GFNOOP <- chargf.h commands.h readgf.h skgfspec.h*
+* * *
+* GFNROW0 <- chargf.h commands.h *
+* * *
+* GFNROWMAX <- chargf.h commands.h *
+* * *
+* GFPAINT0 <- chargf.h commands.h *
+* * *
+* GFPAINT1 <- chargf.h commands.h *
+* * *
+* GFPAINT2 <- chargf.h commands.h *
+* * *
+* GFPAINT3 <- chargf.h commands.h *
+* * *
+* GFPOST <- commands.h readgf.h skgfspec.h *
+* * *
+* GFPOSTPOST <- commands.h readgf.h *
+* * *
+* GFPRE <- commands.h reldfont.h *
+* * *
+* GFSKIP0 <- chargf.h commands.h *
+* * *
+* GFSKIP1 <- chargf.h commands.h *
+* * *
+* GFSKIP2 <- chargf.h commands.h *
+* * *
+* GFSKIP3 <- chargf.h commands.h *
+* * *
+* GFXXX1 <- chargf.h commands.h skgfspec.h *
+* * *
+* GFXXX2 <- chargf.h commands.h skgfspec.h *
+* * *
+* GFXXX3 <- chargf.h commands.h skgfspec.h *
+* * *
+* GFXXX4 <- chargf.h commands.h skgfspec.h *
+* * *
+* GFYYY <- chargf.h commands.h skgfspec.h *
+* * *
+* GOLDENDAWNGL100 <- dvifile.h dvigd.c gblvars.h machdefs.h*
+* * option.h usage.h *
+* * *
+* GS_NUMBER() <- dvican.c *
+* * *
+* HARD_RESET <- dvican.c *
+* * *
+* HIRES <- dvieps.c dvimac.c dvimpi.c dvioki.c *
+* * gblprocs.h machdefs.h option.h *
+* * *
+* HOST_WORD_SIZE <- clrbmap.h dispchar.h dvialw.c dvican.c *
+* * dvieps.c dvigd.c dviimp.c dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c fillrect.h gblvars.h *
+* * getbmap.h initglob.h machdefs.h setchar.h *
+* * *
+* HPJETPLUS <- dvifile.h dviinit.h dvijep.c gblprocs.h*
+* * gblvars.h initglob.h machdefs.h main.h *
+* * option.h prtpage.h readgf.h readpk.h *
+* * readpxl.h setfntnm.h *
+* * *
+* HPLASERJET <- dvifile.h dvijet.c gblvars.h initglob.h*
+* * machdefs.h option.h usage.h *
+* * *
+* HPUX <- machdefs.h *
+* * *
+* HRULE() <- dvican.c *
+* * *
+* IBM_PC_LATTICE <- dispchar.h dvieps.c dvigd.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c machdefs.h main.h typedefs.h*
+* * *
+* IBM_PC_MICROSOFT <- dispchar.h dvieps.c dvigd.c dvihead.h *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c machdefs.h main.h *
+* * openfont.h strchr.h strrchr.h *
+* * *
+* IBM_PC_WIZARD <- dispchar.h dvieps.c dvigd.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c gblprocs.h machdefs.h main.h *
+* * *
+* IMPRESS <- dvifile.h dviimp.c dviinit.h gblprocs.h*
+* * gblvars.h machdefs.h main.h option.h *
+* * prtpage.h readgf.h readpk.h readpxl.h *
+* * setfntnm.h *
+* * *
+* IM_BGLY <- dviimp.c *
+* * *
+* IM_BRULE <- dviimp.c *
+* * *
+* IM_ENDPAGE <- dviimp.c *
+* * *
+* IM_EOF <- dviimp.c *
+* * *
+* IM_PAGE <- dviimp.c *
+* * *
+* IM_SABSH <- dviimp.c *
+* * *
+* IM_SABSV <- dviimp.c *
+* * *
+* IM_SET_FAMILY <- dviimp.c *
+* * *
+* IM_SRELH <- dviimp.c *
+* * *
+* IM_SRELV <- dviimp.c *
+* * *
+* IN() <- dvifile.h dvijep.c fillrect.h gendefs.h *
+* * openfont.h *
+* * *
+* INT16 <- actfact.h chargf.h charpk.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dvigd.c dviimp.c dviinit.h *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dviterm.h dvitos.c *
+* * fontfile.h gblvars.h getpgtab.h initglob.h*
+* * openfont.h option.h prtpage.h tctos.h *
+* * typedefs.h *
+* * *
+* INT32 <- clrbmap.h dvialw.c dvibit.c dvican.c *
+* * dviimp.c dviinit.h dvijep.c fixpos.h *
+* * gblprocs.h gblvars.h getfntdf.h loadchar.h*
+* * movedown.h moveover.h prtpage.h readfont.h*
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * setchar.h setfntnm.h setrule.h signex.h *
+* * skipfont.h typedefs.h *
+* * *
+* INT8 <- typedefs.h *
+* * *
+* IOCPARM_MASK <- dviterm.h *
+* * *
+* IOC_IN <- dviterm.h *
+* * *
+* ISO_MODE <- dvican.c *
+* * *
+* IS_MEMBER() <- dvijep.c *
+* * *
+* KB_CBREAK <- dvibit.c keydef.h *
+* * *
+* KB_ECHO <- keydef.h *
+* * *
+* KB_INQUIRE <- keydef.h *
+* * *
+* KB_NORMAL <- keydef.h *
+* * *
+* KB_RAW <- keydef.h *
+* * *
+* KB_RESTORE <- keydef.h *
+* * *
+* KB_SAVE <- keydef.h *
+* * *
+* KCC_20 <- dvihead.h gblprocs.h machdefs.h main.h *
+* * strchr.h strrchr.h *
+* * *
+* KEYMODE <- keydef.h *
+* * *
+* LASTBGCHAR <- dvibit.c *
+* * *
+* LASTPXLCHAR <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gendefs.h loadchar.h readgf.h *
+* * readpxl.h reldfont.h *
+* * *
+* MAGSIZE() <- actfact.h dvibit.c gendefs.h openfont.h*
+* * option.h reldfont.h *
+* * *
+* MAGTABSIZE <- actfact.h gblvars.h openfont.h option.h *
+* * *
+* MALLOC() <- dvialw.c getbmap.h loadchar.h machdefs.h*
+* * readfont.h *
+* * *
+* MAPCHAR() <- dvican.c *
+* * *
+* MAP_CHAR() <- dvijep.c *
+* * *
+* MAX() <- dvican.c dvijep.c dvijet.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c gendefs.h *
+* * openfont.h option.h *
+* * *
+* MAXDRIFT <- fixpos.h machdefs.h *
+* * *
+* MAXFNAME <- dvialw.c fontsub.h gblvars.h machdefs.h*
+* * openfont.h *
+* * *
+* MAXFONTS <- dvijep.c gblvars.h gendefs.h *
+* * *
+* MAXFORMATS <- fontfile.h gendefs.h openfont.h *
+* * *
+* MAXFRAC <- dvibit.c *
+* * *
+* MAXLINE <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* MAXMSG <- gblvars.h gendefs.h *
+* * *
+* MAXOPEN <- dvialw.c dvigd.c dvimac.c dvioki.c *
+* * dvitos.c gblvars.h machdefs.h openfont.h*
+* * *
+* MAXPAGE <- dvialw.c gblvars.h gendefs.h getpgtab.h*
+* * *
+* MAXPAGEFONTS <- dvijep.c *
+* * *
+* MAXPSLINE <- dvialw.c *
+* * *
+* MAXREQUEST <- gblvars.h gendefs.h *
+* * *
+* MAXSPECIAL <- gendefs.h prtpage.h *
+* * *
+* MAXSTR <- dvialw.c dvican.c dvifile.h dviimp.c *
+* * dvijep.c fontsub.h gblvars.h gendefs.h *
+* * readfont.h skipfont.h *
+* * *
+* MAXTEXT <- dvialw.c *
+* * *
+* MAX_M <- chargf.h gblvars.h gendefs.h *
+* * *
+* MAX_N <- chargf.h gendefs.h *
+* * *
+* MIN() <- dvialw.c dvibit.c dvican.c dvijep.c *
+* * dvijet.c gendefs.h option.h *
+* * *
+* MINFRAC <- dvibit.c *
+* * *
+* MIN_M <- chargf.h gblvars.h gendefs.h *
+* * *
+* MIN_N <- chargf.h gendefs.h *
+* * *
+* MOVETO() <- dvican.c dviimp.c dvijep.c *
+* * *
+* MOVEX() <- dvican.c dviimp.c dvijep.c *
+* * *
+* MOVEY() <- dvican.c dviimp.c dvijep.c *
+* * *
+* MPISPRINTER <- dvimpi.c machdefs.h *
+* * *
+* NBGFONTS <- dvibit.c gblvars.h *
+* * *
+* NEWLINE() <- dbgopen.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dvigd.c dviimp.c *
+* * dviinit.h dvijep.c dvijet.c dvimac.c *
+* * dviprx.c dviterm.h dvitos.c fatal.h *
+* * gendefs.h main.h readpost.h setchar.h *
+* * usage.h warning.h *
+* * *
+* NIBBLE() <- dvialw.c *
+* * *
+* NOFILE <- main.h *
+* * *
+* NOP <- commands.h prtpage.h *
+* * *
+* NO_FILENAME <- dviinit.h *
+* * *
+* NPXLCHARS <- dvialw.c dvibit.c dviterm.h gblvars.h *
+* * gendefs.h readgf.h readpk.h *
+* * *
+* NULL <- abortrun.h alldone.h bitmap.h chargf.h *
+* * charpk.h charpxl.h dbgopen.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dviinit.h dvijep.c dviterm.h fatal.h *
+* * fontsub.h gblvars.h getbmap.h initglob.h*
+* * loadchar.h movedown.h moveover.h openfont.h*
+* * option.h outrow.h prtpage.h readfont.h*
+* * readgf.h readpxl.h reldfont.h setfntnm.h*
+* * strchr.h strrchr.h warning.h *
+* * *
+* OCTAL() <- dvialw.c *
+* * *
+* OFF_PAGE <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* OKIDATA2410 <- dvioki.c gblprocs.h machdefs.h *
+* * *
+* ONES <- fillrect.h gendefs.h *
+* * *
+* ONPAGE() <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* OS_ATARI <- dvican.c dvihead.h dviinit.h fontfile.h*
+* * gendefs.h initglob.h machdefs.h main.h *
+* * signex.h *
+* * *
+* OS_PCDOS <- dviinit.h fontfile.h gendefs.h initglob.h*
+* * machdefs.h *
+* * *
+* OS_TOPS20 <- abortrun.h dvibit.c dviinit.h dviterm.h *
+* * fatal.h fontfile.h gblvars.h gendefs.h *
+* * machdefs.h option.h warning.h *
+* * *
+* OS_UNIX <- dviinit.h fontfile.h initglob.h machdefs.h*
+* * main.h signex.h *
+* * *
+* OS_VAXVMS <- abortrun.h dvibit.c dvihead.h dviinit.h *
+* * dviterm.h fatal.h fontfile.h gblprocs.h*
+* * machdefs.h main.h openfont.h readgf.h *
+* * readpxl.h strchr.h strrchr.h warning.h *
+* * *
+* OUT16() <- dviimp.c dvijep.c *
+* * *
+* OUTBITMAP() <- dvican.c *
+* * *
+* OUTC() <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c gendefs.h *
+* * *
+* OUTCHAR() <- dvican.c *
+* * *
+* OUTCSI <- dvican.c *
+* * *
+* OUTF() <- dvibit.c dvican.c dvieps.c dviimp.c *
+* * dvijep.c dvijet.c dvimac.c dvitos.c *
+* * gendefs.h *
+* * *
+* OUTF2() <- dvibit.c dvican.c dvieps.c dvigd.c *
+* * dvijep.c dvimac.c dvitos.c gendefs.h *
+* * *
+* OUTF3() <- dvibit.c dvieps.c gendefs.h *
+* * *
+* OUTFILE_EXT <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dviinit.h dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c *
+* * *
+* OUTIV() <- dvibit.c *
+* * *
+* OUTLINE() <- dvieps.c *
+* * *
+* OUTNUM() <- dvican.c *
+* * *
+* OUTS() <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dvitos.c *
+* * gendefs.h *
+* * *
+* OUT_CHAR() <- dvijep.c *
+* * *
+* OUT_CHR() <- dvialw.c *
+* * *
+* OUT_DEFERRED <- dvialw.c *
+* * *
+* OUT_FLT() <- dvialw.c *
+* * *
+* OUT_FONTNAME <- dvialw.c *
+* * *
+* OUT_IMMEDIATE <- dvialw.c *
+* * *
+* OUT_NL <- dvialw.c *
+* * *
+* OUT_NUM() <- dvialw.c *
+* * *
+* OUT_STR() <- dvialw.c *
+* * *
+* OUT_XCHR() <- dvialw.c *
+* * *
+* PAGEEJECT <- dvican.c dviimp.c dvijep.c *
+* * *
+* PAGENUMBER() <- dvifile.h *
+* * *
+* PCC_20 <- machdefs.h main.h signex.h typedefs.h*
+* * *
+* PIXROUND() <- fixpos.h gendefs.h movedown.h moveover.h*
+* * readgf.h readpk.h readpxl.h *
+* * *
+* PKID <- commands.h readpk.h reldfont.h *
+* * *
+* PKNOOP <- commands.h skpkspec.h *
+* * *
+* PKPOST <- commands.h readpk.h skpkspec.h *
+* * *
+* PKPRE <- commands.h readpk.h reldfont.h *
+* * *
+* PKXXX1 <- commands.h skpkspec.h *
+* * *
+* PKXXX2 <- commands.h skpkspec.h *
+* * *
+* PKXXX3 <- commands.h skpkspec.h *
+* * *
+* PKXXX4 <- commands.h skpkspec.h *
+* * *
+* PKYYY <- commands.h skpkspec.h *
+* * *
+* POP <- commands.h prtpage.h *
+* * *
+* POST <- commands.h prtpage.h readpost.h *
+* * *
+* POSTSCRIPT <- dvialw.c dvifile.h gblprocs.h gblvars.h *
+* * initglob.h machdefs.h main.h option.h *
+* * prtpage.h readgf.h readpk.h readpxl.h *
+* * setfntnm.h usage.h *
+* * *
+* POST_POST <- commands.h getfntdf.h prtpage.h *
+* * *
+* PRE <- commands.h dviinit.h prtpage.h *
+* * *
+* PRINTRONIX <- dviprx.c machdefs.h *
+* * *
+* PSDEF_FILE <- dvialw.c *
+* * *
+* PSDEF_PATH <- dvialw.c *
+* * *
+* PS_MAXWIDTH <- dvialw.c machdefs.h *
+* * *
+* PS_SHORTLINES <- dvialw.c machdefs.h *
+* * *
+* PS_SIZELIMIT <- dvialw.c initglob.h *
+* * *
+* PS_XONXOFFBUG <- dvialw.c machdefs.h *
+* * *
+* PUSH <- commands.h prtpage.h *
+* * *
+* PUT1 <- commands.h prtpage.h *
+* * *
+* PUT2 <- commands.h prtpage.h *
+* * *
+* PUT3 <- commands.h prtpage.h *
+* * *
+* PUT4 <- commands.h prtpage.h *
+* * *
+* PUT_RULE <- commands.h prtpage.h *
+* * *
+* PXLID <- gendefs.h inch.h machdefs.h reldfont.h*
+* * *
+* Q() <- dvieps.c dvimac.c dvimpi.c dvioki.c *
+* * dvitos.c *
+* * *
+* RB_OPEN <- dviinit.h machdefs.h openfont.h *
+* * *
+* READ <- machdefs.h *
+* * *
+* RESET_MODE <- dvican.c *
+* * *
+* RESET_PRINTER <- dvijep.c *
+* * *
+* RESOLUTION <- dvibit.c gendefs.h readpost.h reldfont.h*
+* * *
+* REWIND() <- alldone.h dvialw.c fontsub.h machdefs.h*
+* * readpk.h reldfont.h *
+* * *
+* RIGHT1 <- commands.h prtpage.h *
+* * *
+* RIGHT2 <- commands.h prtpage.h *
+* * *
+* RIGHT3 <- commands.h prtpage.h *
+* * *
+* RIGHT4 <- commands.h prtpage.h *
+* * *
+* RMOVETO() <- dviimp.c dvijep.c *
+* * *
+* RMOVEX() <- dvican.c dviimp.c dvijep.c *
+* * *
+* RMOVEY() <- dvican.c dviimp.c dvijep.c *
+* * *
+* ROUND() <- dviimp.c dvijep.c *
+* * *
+* RULE() <- dvijep.c *
+* * *
+* RULE2() <- dvijep.c *
+* * *
+* SEGMEM <- bitmap.h clrbmap.h dvieps.c dvimac.c *
+* * dvimpi.c dvioki.c dvitos.c getbmap.h *
+* * machdefs.h *
+* * *
+* SEL_PAINT <- dvican.c *
+* * *
+* SET1 <- commands.h prtpage.h *
+* * *
+* SET2 <- commands.h prtpage.h *
+* * *
+* SET3 <- commands.h prtpage.h *
+* * *
+* SET4 <- commands.h prtpage.h *
+* * *
+* SETBIT() <- chargf.h gendefs.h *
+* * *
+* SETCOPIES() <- dvican.c dvijep.c *
+* * *
+* SETCURRENTFONT() <- dvican.c dviimp.c *
+* * *
+* SETC_000 <- commands.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c prtpage.h *
+* * *
+* SETC_127 <- commands.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c prtpage.h *
+* * *
+* SET_CHAR_CODE() <- dvijep.c *
+* * *
+* SET_FONT_ID() <- dvijep.c *
+* * *
+* SET_MODE <- dvican.c *
+* * *
+* SET_RULE <- commands.h prtpage.h *
+* * *
+* SIZE_UNIT <- dvican.c *
+* * *
+* SO <- dvioki.c *
+* * *
+* SPACING_INCREMENT <- dvican.c *
+* * *
+* STACKSIZE <- gendefs.h prtpage.h readpost.h *
+* * *
+* STDMAG <- dvibit.c gendefs.h initglob.h main.h *
+* * option.h readpost.h reldfont.h *
+* * *
+* STDRES <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c gendefs.h machdefs.h main.h *
+* * *
+* STX <- dvioki.c *
+* * *
+* SUBEXT <- initglob.h machdefs.h *
+* * *
+* SUBNAME <- initglob.h machdefs.h *
+* * *
+* SUBPATH <- initglob.h machdefs.h *
+* * *
+* TESTBIT() <- gendefs.h *
+* * *
+* TEXFONTS <- initglob.h machdefs.h *
+* * *
+* TEXINPUTS <- initglob.h machdefs.h *
+* * *
+* TIOCSTI <- dviterm.h *
+* * *
+* TOSHIBAP1351 <- dvitos.c gblvars.h machdefs.h main.h *
+* * option.h usage.h *
+* * *
+* TRANSFER_RASTER_GRAP<- dvijep.c *
+* * *
+* TRUE <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dviimp.c dvijep.c findpost.h fontsub.h *
+* * gblvars.h inch.h main.h option.h *
+* * prtpage.h setfntnm.h typedefs.h *
+* * *
+* TeXfont <- fontsub.h *
+* * *
+* TeXmag <- fontsub.h *
+* * *
+* UNDEFINED_FONT <- dvijep.c *
+* * *
+* UNGETC <- chargf.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c machdefs.h skgfspec.h skpkspec.h*
+* * *
+* UNSIGN16 <- abortrun.h chargf.h charpk.h charpxl.h *
+* * clrrow.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dviimp.c dvijep.c gblvars.h *
+* * option.h outrow.h readgf.h readpk.h *
+* * readpxl.h reldfont.h typedefs.h *
+* * *
+* UNSIGN32 <- actfact.h bitmap.h chargf.h charpk.h *
+* * charpxl.h clrbmap.h clrrow.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dviterm.h dvitos.c fillrect.h gblprocs.h*
+* * gblvars.h getbmap.h loadchar.h nosignex.h*
+* * openfont.h option.h outrow.h prtpage.h *
+* * readfont.h readgf.h readpk.h readpxl.h *
+* * reldfont.h rulepxl.h setrule.h typedefs.h*
+* * *
+* USEGLOBALMAG <- dvibit.c gendefs.h machdefs.h readpost.h*
+* * reldfont.h *
+* * *
+* V24SIZE <- dvigd.c dvitos.c *
+* * *
+* V6SIZE <- dvimpi.c *
+* * *
+* VERSION_NO <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c main.h usage.h *
+* * *
+* VIRTUAL_FONTS <- dviterm.h gblprocs.h gblvars.h initglob.h*
+* * machdefs.h openfont.h option.h *
+* * *
+* VISIBLE() <- chargf.h charpk.h charpxl.h dvialw.c *
+* * dvican.c dviimp.c dvijep.c gendefs.h *
+* * loadchar.h *
+* * *
+* VRULE() <- dvican.c *
+* * *
+* W0 <- commands.h prtpage.h *
+* * *
+* W1 <- commands.h prtpage.h *
+* * *
+* W2 <- commands.h prtpage.h *
+* * *
+* W3 <- commands.h prtpage.h *
+* * *
+* W4 <- commands.h prtpage.h *
+* * *
+* WB_OPEN <- dviinit.h machdefs.h *
+* * *
+* WHITE <- chargf.h *
+* * *
+* X0 <- commands.h prtpage.h *
+* * *
+* X1 <- commands.h prtpage.h *
+* * *
+* X2 <- commands.h prtpage.h *
+* * *
+* X3 <- commands.h prtpage.h *
+* * *
+* X4 <- commands.h prtpage.h *
+* * *
+* XBIT <- clrbmap.h dispchar.h dvieps.c dvigd.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c fillrect.h getbmap.h *
+* * *
+* XDIFFMAX <- dvibit.c *
+* * *
+* XDIFFORG <- dvibit.c *
+* * *
+* XDPI <- clrbmap.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dvigd.c dviimp.c *
+* * dviinit.h dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * fillrect.h getbmap.h setchar.h setrule.h *
+* * *
+* XORIGIN <- dvican.c dviimp.c dviinit.h dvijep.c *
+* * *
+* XPSIZE <- clrbmap.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dvigd.c dviimp.c *
+* * dviinit.h dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * fillrect.h getbmap.h setchar.h *
+* * *
+* XSIZE <- clrbmap.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dvigd.c dviimp.c *
+* * dviinit.h dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * fillrect.h getbmap.h setchar.h *
+* * *
+* XWORDS <- clrbmap.h dispchar.h dvieps.c dvigd.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c fillrect.h getbmap.h *
+* * *
+* XXX1 <- commands.h prtpage.h *
+* * *
+* XXX2 <- commands.h prtpage.h *
+* * *
+* XXX3 <- commands.h prtpage.h *
+* * *
+* XXX4 <- commands.h prtpage.h *
+* * *
+* Y0 <- commands.h prtpage.h *
+* * *
+* Y1 <- commands.h prtpage.h *
+* * *
+* Y2 <- commands.h prtpage.h *
+* * *
+* Y3 <- commands.h prtpage.h *
+* * *
+* Y4 <- commands.h prtpage.h *
+* * *
+* YBIT <- clrbmap.h dvieps.c dvigd.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c fillrect.h getbmap.h *
+* * *
+* YDIFFMAX <- dvibit.c *
+* * *
+* YDIFFORG <- dvibit.c *
+* * *
+* YDPI <- clrbmap.h dvialw.c dvibit.c dvican.c *
+* * dvieps.c dvigd.c dviimp.c dviinit.h *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c fillrect.h*
+* * getbmap.h setchar.h setrule.h *
+* * *
+* YORIGIN <- dvican.c dviimp.c dviinit.h dvijep.c *
+* * *
+* YPSIZE <- clrbmap.h dvialw.c dvibit.c dvican.c *
+* * dvieps.c dvigd.c dviimp.c dviinit.h *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c fillrect.h*
+* * getbmap.h setchar.h setrule.h *
+* * *
+* YSIZE <- clrbmap.h dvialw.c dvibit.c dvican.c *
+* * dvieps.c dvigd.c dviimp.c dviinit.h *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c fillrect.h*
+* * getbmap.h setchar.h setrule.h *
+* * *
+* Z0 <- commands.h prtpage.h *
+* * *
+* Z1 <- commands.h prtpage.h *
+* * *
+* Z2 <- commands.h prtpage.h *
+* * *
+* Z3 <- commands.h prtpage.h *
+* * *
+* Z4 <- commands.h prtpage.h *
+* * *
+* ZAPTHISOUT <- dvijet.c machdefs.h *
+* * *
+* _B <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c setchar.h *
+* * *
+* _IOEOF <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* _IOERR <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* _IOW() <- dviterm.h *
+* * *
+* _L <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c setchar.h *
+* * *
+* _N <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c inch.h option.h setchar.h *
+* * *
+* _NFILE <- main.h *
+* * *
+* _P <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c setchar.h *
+* * *
+* _U <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c setchar.h *
+* * *
+* _cnt <- alldone.h dbgopen.h dispchar.h dvialw.c *
+* * dvibit.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dviinit.h dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dviterm.h dvitos.c fatal.h getbytes.h*
+* * main.h nosignex.h readpost.h setchar.h *
+* * signex.h usage.h warning.h *
+* * *
+* _ctype_ <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c inch.h option.h setchar.h *
+* * *
+* _filbuf <- alldone.h dvialw.c getbytes.h nosignex.h*
+* * signex.h *
+* * *
+* _file <- dvialw.c dviterm.h *
+* * *
+* _flag <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* _flsbuf <- alldone.h dbgopen.h dispchar.h dvialw.c *
+* * dvibit.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dviinit.h dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dviterm.h dvitos.c fatal.h main.h *
+* * readpost.h setchar.h usage.h warning.h *
+* * *
+* _iob <- alldone.h dbgopen.h dispchar.h dvialw.c *
+* * dvibit.c dvican.c dvieps.c dvifile.h *
+* * dvigd.c dviimp.c dviinit.h dvijep.c *
+* * dvijet.c dvimac.c dviprx.c dviterm.h *
+* * dvitos.c fatal.h main.h option.h *
+* * prtpage.h readpost.h setchar.h warning.h *
+* * *
+* _iobuf <- abortrun.h alldone.h dbgopen.h dvialw.c *
+* * dvibit.c dvican.c dviimp.c dviinit.h *
+* * dvijep.c dviterm.h fatal.h fontsub.h *
+* * gblprocs.h gblvars.h getbytes.h keydef.h *
+* * loadchar.h nosignex.h openfont.h reldfont.h*
+* * signex.h usage.h warning.h *
+* * *
+* _ptr <- alldone.h dbgopen.h dispchar.h dvialw.c *
+* * dvibit.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dviinit.h dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dviterm.h dvitos.c fatal.h getbytes.h*
+* * main.h nosignex.h readpost.h setchar.h *
+* * signex.h usage.h warning.h *
+* * *
+* a <- dvieps.c dvigd.c dvimac.c dvitos.c *
+* * gblvars.h gendefs.h movedown.h openfont.h*
+* * readfont.h skipfont.h *
+* * *
+* abortrun() <- abortrun.h alldone.h gblprocs.h *
+* * *
+* abspos <- dvialw.c *
+* * *
+* actfact() <- actfact.h dvibit.c gblprocs.h openfont.h*
+* * option.h readpost.h reldfont.h *
+* * *
+* alldone() <- alldone.h dvibit.c fatal.h gblprocs.h*
+* * main.h prtpage.h *
+* * *
+* argc <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dvigd.c dviimp.c dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c main.h *
+* * *
+* argv <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dvigd.c dviimp.c dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c main.h *
+* * *
+* atof() <- gblprocs.h option.h *
+* * *
+* atoi() <- gblprocs.h option.h *
+* * *
+* b <- dvialw.c dvieps.c dvigd.c dvimac.c *
+* * dvitos.c gendefs.h moveover.h *
+* * *
+* backwards <- dvifile.h gblvars.h option.h *
+* * *
+* baseline <- dvican.c *
+* * *
+* bgchar <- dvibit.c gblvars.h *
+* * *
+* bgcp <- dvibit.c gblvars.h *
+* * *
+* bgfont <- dvibit.c gblvars.h *
+* * *
+* bit_weight <- charpk.h *
+* * *
+* bitmap <- bitmap.h clrbmap.h dispchar.h dvieps.c *
+* * dvigd.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c fillrect.h*
+* * getbmap.h *
+* * *
+* bits_to_next <- dispchar.h *
+* * *
+* bopact() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h prtpage.h *
+* * *
+* buf <- dvijet.c *
+* * *
+* byte <- getfntdf.h *
+* * *
+* bytecount <- dvican.c *
+* * *
+* bytepos <- prtpage.h *
+* * *
+* bytes_per_row <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* bytewidth <- dvican.c *
+* * *
+* c <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvimac.c *
+* * dvimpi.c dvioki.c dvitos.c fixpos.h *
+* * gblvars.h gendefs.h loadchar.h outrow.h *
+* * readfont.h readgf.h readpk.h readpxl.h *
+* * setchar.h strchr.h strrchr.h *
+* * *
+* c_height <- charpk.h *
+* * *
+* c_width <- charpk.h *
+* * *
+* cache_size <- dviinit.h gblvars.h loadchar.h *
+* * *
+* cc <- fixpos.h *
+* * *
+* ccc <- fixpos.h *
+* * *
+* cell_above <- dvijep.c *
+* * *
+* cell_baseline <- dvijep.c *
+* * *
+* cell_below <- dvijep.c *
+* * *
+* cell_d <- gblvars.h *
+* * *
+* cell_h <- gblvars.h *
+* * *
+* cell_height <- dvijep.c *
+* * *
+* cell_left <- dvijep.c *
+* * *
+* cell_w <- gblvars.h *
+* * *
+* cell_width <- dvijep.c *
+* * *
+* ch <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c dviterm.h gblvars.h loadchar.h*
+* * outrow.h readgf.h readpk.h readpxl.h *
+* * reldfont.h setchar.h *
+* * *
+* char_below <- dvijep.c *
+* * *
+* char_entry <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h loadchar.h outrow.h *
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * setchar.h *
+* * *
+* chargf() <- chargf.h gblprocs.h readgf.h reldfont.h*
+* * *
+* charpk() <- charpk.h gblprocs.h reldfont.h *
+* * *
+* charpxl() <- charpxl.h gblprocs.h reldfont.h *
+* * *
+* charxx <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h loadchar.h reldfont.h*
+* * *
+* charyy <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c loadchar.h *
+* * *
+* checksum <- readgf.h readpk.h readpxl.h *
+* * *
+* clearerr() <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* clrbmap() <- clrbmap.h gblprocs.h prtpage.h *
+* * *
+* clrrow() <- chargf.h charpk.h clrrow.h gblprocs.h*
+* * *
+* cnvfac <- fixpos.h rulepxl.h *
+* * *
+* code <- abortrun.h *
+* * *
+* command <- prtpage.h *
+* * *
+* conv <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h movedown.h moveover.h*
+* * readpost.h readpxl.h setchar.h setrule.h *
+* * *
+* copies <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * dvijet.c gblvars.h initglob.h option.h *
+* * *
+* count <- charpk.h dvieps.c *
+* * *
+* cp <- getbytes.h *
+* * *
+* cpagep <- dvibit.c gblvars.h *
+* * *
+* cppsfile() <- dvialw.c gblprocs.h *
+* * *
+* ctime() <- dvialw.c gblprocs.h *
+* * *
+* cur_index <- dvibit.c dvifile.h gblvars.h *
+* * *
+* cur_page_number <- dvialw.c dvifile.h gblvars.h *
+* * *
+* curext <- dviinit.h gblvars.h *
+* * *
+* curname <- dviinit.h gblvars.h *
+* * *
+* curpath <- dviinit.h gblvars.h *
+* * *
+* current <- openfont.h *
+* * *
+* cuserid() <- dvialw.c gblprocs.h *
+* * *
+* d <- chargf.h gblvars.h readfont.h reldfont.h*
+* * *
+* dbgopen() <- dbgopen.h dvialw.c dviinit.h fatal.h *
+* * fontsub.h gblprocs.h openfont.h warning.h *
+* * *
+* debug_code <- dbgopen.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dviimp.c dvijep.c dvijet.c *
+* * dviprx.c gblvars.h initglob.h option.h *
+* * setchar.h *
+* * *
+* deferred <- dvialw.c *
+* * *
+* delx <- dviimp.c dvijep.c *
+* * *
+* dely <- dviimp.c dvijep.c *
+* * *
+* den <- dvibit.c gblvars.h readpost.h *
+* * *
+* designsize <- gblvars.h readgf.h readpk.h readpxl.h *
+* * reldfont.h *
+* * *
+* devinit() <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dvigd.c dviimp.c dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c gblprocs.h *
+* * *
+* devterm() <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dvigd.c dviimp.c dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c gblprocs.h prtpage.h *
+* * *
+* digits <- dvialw.c *
+* * *
+* dispchar() <- dispchar.h gblprocs.h setchar.h *
+* * *
+* do_output <- chargf.h charpk.h *
+* * *
+* dpi <- fontfile.h *
+* * *
+* dvifile() <- dvifile.h gblprocs.h main.h *
+* * *
+* dvifp <- abortrun.h dvialw.c dvibit.c dvican.c *
+* * dvifile.h dviimp.c dviinit.h dvijep.c *
+* * dviterm.h findpost.h gblvars.h getfntdf.h*
+* * getpgtab.h prtpage.h readfont.h readpost.h*
+* * skipfont.h *
+* * *
+* dviinit() <- dvifile.h dviinit.h gblprocs.h *
+* * *
+* dviname <- dviinit.h gblvars.h *
+* * *
+* dviterm() <- dvibit.c dvifile.h dviterm.h gblprocs.h*
+* * prtpage.h *
+* * *
+* dvoname <- dviinit.h dviterm.h gblvars.h *
+* * *
+* dx <- dvican.c gblvars.h readgf.h readpk.h *
+* * reldfont.h *
+* * *
+* dy <- dvican.c gblvars.h readgf.h readpk.h *
+* * reldfont.h *
+* * *
+* dyn_f <- charpk.h *
+* * *
+* emitchar() <- dvialw.c gblprocs.h *
+* * *
+* end_of_packet <- readpk.h *
+* * *
+* envlist <- option.h *
+* * *
+* envname <- option.h *
+* * *
+* envstruct <- option.h *
+* * *
+* envvar <- option.h *
+* * *
+* eopact() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h prtpage.h *
+* * *
+* err_code <- reldfont.h *
+* * *
+* errno <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dvihead.h dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dvitos.c *
+* * *
+* exit() <- abortrun.h dviinit.h gblprocs.h *
+* * *
+* f <- gendefs.h *
+* * *
+* fatal() <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dvigd.c dviimp.c dviinit.h *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dviterm.h dvitos.c *
+* * fatal.h findpost.h gblprocs.h getbmap.h *
+* * getfntdf.h getpgtab.h inch.h loadchar.h*
+* * option.h prtpage.h readfont.h readpost.h*
+* * reldfont.h setfntnm.h skgfspec.h skpkspec.h*
+* * warning.h *
+* * *
+* fclose <- abortrun.h alldone.h dvialw.c dvibit.c *
+* * dviterm.h openfont.h *
+* * *
+* ferror() <- dvialw.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* fflush <- alldone.h dvialw.c dvibit.c dvieps.c *
+* * dvigd.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dviterm.h dvitos.c *
+* * *
+* fgets() <- dvialw.c fontsub.h *
+* * *
+* file_args <- main.h *
+* * *
+* filelist <- fontfile.h openfont.h *
+* * *
+* fileno() <- dvialw.c dviterm.h *
+* * *
+* filestr <- dvifile.h dviinit.h *
+* * *
+* fillrect() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c fillrect.h gblprocs.h setrule.h *
+* * *
+* findpost() <- findpost.h gblprocs.h readpost.h *
+* * *
+* fixpos() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c fixpos.h gblprocs.h movedown.h*
+* * moveover.h setchar.h setrule.h *
+* * *
+* flag <- dvieps.c gendefs.h *
+* * *
+* flag_byte <- charpk.h readpk.h *
+* * *
+* flnum <- inch.h *
+* * *
+* flt <- dvialw.c *
+* * *
+* fltdpi <- fontfile.h *
+* * *
+* fltmag <- option.h *
+* * *
+* fmt <- dvialw.c gendefs.h *
+* * *
+* fname <- dbgopen.h dvialw.c fontsub.h gendefs.h *
+* * *
+* font_count <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gblvars.h *
+* * *
+* font_entry <- dvialw.c dvibit.c dviinit.h dviterm.h *
+* * gblvars.h movedown.h moveover.h openfont.h*
+* * prtpage.h readfont.h reldfont.h setfntnm.h*
+* * *
+* font_file_id <- dvibit.c gblvars.h openfont.h *
+* * *
+* font_files <- abortrun.h dvibit.c dviterm.h gblvars.h *
+* * openfont.h *
+* * *
+* font_id <- abortrun.h dvibit.c dviterm.h gblvars.h *
+* * openfont.h *
+* * *
+* font_k <- readfont.h *
+* * *
+* font_list <- gblvars.h *
+* * *
+* font_mag <- gblvars.h openfont.h reldfont.h *
+* * *
+* font_name <- fontfile.h *
+* * *
+* font_number <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gblvars.h *
+* * *
+* font_path <- fontfile.h *
+* * *
+* font_ptr <- dvialw.c *
+* * *
+* font_space <- gblvars.h movedown.h moveover.h readfont.h*
+* * *
+* font_switched <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gblvars.h setfntnm.h *
+* * *
+* font_table <- dvican.c dviimp.c dvijep.c gblvars.h *
+* * *
+* font_type <- gblvars.h reldfont.h *
+* * *
+* fontfile() <- fontfile.h gblprocs.h openfont.h *
+* * *
+* fontfp <- chargf.h charpk.h charpxl.h dvialw.c *
+* * dvibit.c dvican.c dviimp.c dviinit.h *
+* * dvijep.c gblvars.h loadchar.h openfont.h*
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * skgfspec.h skpkspec.h *
+* * *
+* fontlist <- dvifile.h gblvars.h initglob.h option.h *
+* * *
+* fontname <- openfont.h *
+* * *
+* fontnumber <- dviimp.c dvijep.c *
+* * *
+* fontpath <- gblvars.h initglob.h openfont.h option.h *
+* * *
+* fontptr <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dviinit.h dvijep.c dviterm.h gblvars.h *
+* * loadchar.h movedown.h moveover.h openfont.h*
+* * outrow.h prtpage.h readfont.h readgf.h *
+* * readpk.h readpxl.h setchar.h setfntnm.h*
+* * skgfspec.h skpkspec.h *
+* * *
+* fontrp <- chargf.h charpk.h charpxl.h gblvars.h *
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * *
+* fontsub() <- fontsub.h gblprocs.h openfont.h *
+* * *
+* fopen() <- dvialw.c dviinit.h fatal.h fontsub.h *
+* * gblprocs.h openfont.h warning.h *
+* * *
+* fp <- dbgopen.h gendefs.h getbytes.h machdefs.h*
+* * nosignex.h signex.h usage.h *
+* * *
+* fprintf <- dbgopen.h dvialw.c dvibit.c dvican.c *
+* * dvieps.c dvifile.h dvigd.c dviimp.c *
+* * dviinit.h dvijep.c dvijet.c dvimac.c *
+* * dviprx.c dviterm.h dvitos.c fatal.h *
+* * main.h prtpage.h readpost.h setchar.h *
+* * usage.h warning.h *
+* * *
+* fputs <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dvitos.c *
+* * fatal.h warning.h *
+* * *
+* free() <- dviterm.h gblprocs.h *
+* * *
+* fseek() <- alldone.h chargf.h charpk.h charpxl.h *
+* * dvialw.c dvifile.h dviinit.h findpost.h*
+* * fontsub.h gblprocs.h getpgtab.h prtpage.h *
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * skgfspec.h skpkspec.h *
+* * *
+* fstat <- dvialw.c *
+* * *
+* ftell() <- chargf.h dvialw.c dvibit.c findpost.h*
+* * gblprocs.h readpk.h *
+* * *
+* fullfont <- dvibit.c gblvars.h *
+* * *
+* g_dolog <- abortrun.h alldone.h fatal.h gblvars.h *
+* * option.h warning.h *
+* * *
+* g_errenc <- alldone.h fatal.h gblvars.h *
+* * *
+* g_interactive <- dvibit.c gblvars.h *
+* * *
+* g_logfp <- abortrun.h alldone.h fatal.h gblvars.h *
+* * warning.h *
+* * *
+* g_logname <- dviinit.h fatal.h gblvars.h warning.h *
+* * *
+* g_progname <- dvibit.c dviinit.h fatal.h gblvars.h *
+* * main.h usage.h *
+* * *
+* get_bit() <- charpk.h *
+* * *
+* get_nybble() <- charpk.h *
+* * *
+* getbmap() <- dvieps.c dvigd.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * gblprocs.h getbmap.h *
+* * *
+* getbytes() <- dvifile.h gblprocs.h getbytes.h readfont.h*
+* * skipfont.h *
+* * *
+* getc() <- alldone.h dvialw.c getbytes.h nosignex.h*
+* * signex.h *
+* * *
+* getenv() <- dvibit.c gblprocs.h initglob.h *
+* * *
+* getfntdf() <- gblprocs.h getfntdf.h readpost.h *
+* * *
+* getlogin() <- gblprocs.h *
+* * *
+* getpgtab() <- gblprocs.h getpgtab.h readpost.h *
+* * *
+* gf_index <- dvifile.h fontfile.h gblvars.h *
+* * *
+* gotint() <- gblprocs.h *
+* * *
+* gpower <- charpk.h gblvars.h initglob.h *
+* * *
+* h <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h moveover.h prtpage.h *
+* * setchar.h setrule.h *
+* * *
+* h0 <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* h_bit <- charpk.h *
+* * *
+* half_words_per_row <- dvibit.c *
+* * *
+* have_file <- fontsub.h *
+* * *
+* height <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c fillrect.h setrule.h *
+* * *
+* helpcmd <- gblvars.h initglob.h option.h usage.h *
+* * *
+* hexchars <- dvialw.c *
+* * *
+* hfontptr <- dvialw.c dvibit.c dviinit.h dviterm.h *
+* * gblvars.h openfont.h readfont.h setfntnm.h*
+* * *
+* hh <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h moveover.h prtpage.h *
+* * setchar.h setrule.h *
+* * *
+* hh0 <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* hh_last <- dvican.c dviimp.c dvijep.c *
+* * *
+* hp <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h loadchar.h readpk.h *
+* * readpxl.h reldfont.h *
+* * *
+* hppp <- gblvars.h readgf.h readpk.h reldfont.h*
+* * *
+* hpres <- dvijet.c gblvars.h initglob.h option.h *
+* * *
+* ht_rule <- prtpage.h *
+* * *
+* i <- charpk.h charpxl.h dispchar.h dvibit.c *
+* * dvieps.c dvifile.h dvigd.c dviinit.h *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dvitos.c fillrect.h findpost.h*
+* * getpgtab.h initglob.h openfont.h prtpage.h *
+* * *
+* ilimit <- dispchar.h *
+* * *
+* img_mask <- chargf.h gblvars.h initglob.h *
+* * *
+* img_row <- chargf.h charpk.h charpxl.h clrrow.h *
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h outrow.h *
+* * *
+* img_words <- chargf.h charpk.h charpxl.h clrrow.h *
+* * gblvars.h *
+* * *
+* inch() <- gblprocs.h inch.h option.h *
+* * *
+* initglob() <- gblprocs.h initglob.h main.h *
+* * *
+* initterm() <- dvibit.c gblprocs.h *
+* * *
+* inside <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* ioctl <- dviterm.h *
+* * *
+* is_comment <- dvialw.c *
+* * *
+* is_string <- dvialw.c *
+* * *
+* is_text <- dvialw.c *
+* * *
+* isalnum() <- dvialw.c *
+* * *
+* isdigit() <- dvibit.c inch.h option.h *
+* * *
+* isknown <- gblvars.h *
+* * *
+* isloaded <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h *
+* * *
+* isprint() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c setchar.h *
+* * *
+* istoobig <- dvibit.c dvijep.c gblvars.h *
+* * *
+* j <- charpk.h charpxl.h dispchar.h dvican.c *
+* * dvieps.c dvifile.h dvigd.c dviimp.c *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dvitos.c fillrect.h*
+* * openfont.h *
+* * *
+* k <- abortrun.h actfact.h chargf.h charpk.h *
+* * dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvigd.c dviimp.c dviinit.h dvijep.c *
+* * dvijet.c dvimac.c dvimpi.c dvioki.c *
+* * dviprx.c dviterm.h dvitos.c fontfile.h*
+* * fontsub.h gblvars.h getpgtab.h main.h *
+* * openfont.h option.h outrow.h prtpage.h *
+* * readfont.h setfntnm.h skipfont.h tctos.h *
+* * *
+* k1 <- dvijet.c *
+* * *
+* k2 <- dvijet.c *
+* * *
+* k3 <- dvijet.c *
+* * *
+* kbclose() <- dvibit.c keydef.h *
+* * *
+* kbfile() <- keydef.h *
+* * *
+* kbflush() <- dvibit.c keydef.h *
+* * *
+* kbget() <- dvibit.c keydef.h *
+* * *
+* kbinput() <- dvibit.c keydef.h prtpage.h *
+* * *
+* kbmode() <- keydef.h *
+* * *
+* kbopen() <- dvibit.c keydef.h *
+* * *
+* kbreak <- dvialw.c *
+* * *
+* kbunget() <- keydef.h *
+* * *
+* l <- gblvars.h readfont.h skipfont.h *
+* * *
+* last_font_number <- dvialw.c *
+* * *
+* last_word <- dvijet.c *
+* * *
+* lastpageptr <- getpgtab.h readpost.h *
+* * *
+* least_used <- openfont.h *
+* * *
+* left <- dvieps.c dvigd.c dvimac.c dvimpi.c *
+* * dvioki.c *
+* * *
+* leftmargin <- dviinit.h gblvars.h initglob.h option.h *
+* * *
+* len <- dvieps.c dvigd.c dvimac.c dvitos.c *
+* * *
+* line <- dvialw.c fontsub.h *
+* * *
+* line_number <- fontsub.h *
+* * *
+* linebuf <- dvialw.c *
+* * *
+* linelength <- dvieps.c *
+* * *
+* list <- dvifile.h *
+* * *
+* llx <- dvialw.c *
+* * *
+* lly <- dvialw.c *
+* * *
+* lmargin <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dviinit.h dvijep.c gblvars.h moveover.h*
+* * prtpage.h setchar.h setrule.h *
+* * *
+* loadbmap() <- dvican.c dvijep.c gblprocs.h *
+* * *
+* loadchar() <- dispchar.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h loadchar.h *
+* * *
+* loadrast() <- gblprocs.h *
+* * *
+* loop_count <- dvibit.c *
+* * *
+* m <- chargf.h dvifile.h fontfile.h gendefs.h *
+* * option.h prtpage.h *
+* * *
+* m_begin <- dvifile.h *
+* * *
+* m_end <- dvifile.h *
+* * *
+* m_step <- dvifile.h *
+* * *
+* mag <- dvibit.c gblvars.h readpost.h reldfont.h*
+* * *
+* mag_index <- actfact.h gblvars.h openfont.h option.h *
+* * *
+* mag_table <- actfact.h gblvars.h openfont.h option.h *
+* * *
+* magnification <- dvialw.c fontfile.h gblvars.h readgf.h *
+* * readpk.h readpxl.h *
+* * *
+* main() <- gblprocs.h main.h *
+* * *
+* makechar() <- dvieps.c dvimac.c dvimpi.c dvioki.c *
+* * gblprocs.h *
+* * *
+* makefont() <- dvijep.c gblprocs.h *
+* * *
+* malloc() <- dvialw.c gblprocs.h getbmap.h loadchar.h*
+* * readfont.h *
+* * *
+* mask <- dvieps.c dvimac.c dvimpi.c dvioki.c *
+* * dvitos.c *
+* * *
+* max_m <- chargf.h gblvars.h readgf.h readpk.h *
+* * reldfont.h *
+* * *
+* max_n <- chargf.h gblvars.h readgf.h readpk.h *
+* * reldfont.h *
+* * *
+* maxopen <- openfont.h *
+* * *
+* maxstr <- dvialw.c *
+* * *
+* member <- dvijep.c *
+* * *
+* message <- chargf.h dvialw.c dvibit.c dviinit.h *
+* * dviterm.h fontsub.h gblvars.h inch.h *
+* * loadchar.h openfont.h option.h prtpage.h *
+* * readgf.h readpk.h readpxl.h reldfont.h*
+* * setfntnm.h skgfspec.h skpkspec.h special.h *
+* * usage.h warning.h *
+* * *
+* micro_step <- dvieps.c *
+* * *
+* min_m <- chargf.h gblvars.h readgf.h readpk.h *
+* * reldfont.h *
+* * *
+* min_n <- chargf.h gblvars.h readgf.h readpk.h *
+* * reldfont.h *
+* * *
+* movedown() <- gblprocs.h movedown.h prtpage.h *
+* * *
+* moveover() <- gblprocs.h moveover.h prtpage.h *
+* * *
+* moveto() <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gblprocs.h moveto.h setchar.h *
+* * *
+* msg <- fatal.h warning.h *
+* * *
+* n <- chargf.h dvialw.c dvibit.c dvican.c *
+* * dvieps.c dviimp.c dvijep.c dvimac.c *
+* * dvimpi.c dvioki.c dvitos.c gblvars.h *
+* * gendefs.h getbytes.h loadchar.h machdefs.h*
+* * nosignex.h readfont.h reldfont.h rulepxl.h *
+* * setchar.h signex.h skipfont.h tctos.h *
+* * *
+* n1 <- signex.h *
+* * *
+* name <- dvialw.c gblvars.h openfont.h readgf.h *
+* * readpk.h readpxl.h reldfont.h skgfspec.h*
+* * skpkspec.h *
+* * *
+* namebuf <- dvialw.c *
+* * *
+* nameptr <- dvialw.c *
+* * *
+* nbytes <- dvijep.c *
+* * *
+* neg <- inch.h *
+* * *
+* negative <- dvibit.c *
+* * *
+* newfont() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h readgf.h readpk.h *
+* * readpxl.h *
+* * *
+* next <- dvialw.c dvibit.c dviterm.h gblvars.h *
+* * openfont.h readfont.h setfntnm.h *
+* * *
+* next_byte <- charpk.h *
+* * *
+* nloaded <- gblvars.h *
+* * *
+* nopen <- abortrun.h dvibit.c dviinit.h dviterm.h *
+* * gblvars.h openfont.h *
+* * *
+* nosignex() <- chargf.h charpk.h charpxl.h dvialw.c *
+* * dvibit.c dvican.c dvifile.h dviimp.c *
+* * dviinit.h dvijep.c findpost.h gblprocs.h*
+* * getfntdf.h getpgtab.h nosignex.h prtpage.h *
+* * readfont.h readgf.h readpk.h readpost.h*
+* * readpxl.h reldfont.h skgfspec.h skipfont.h*
+* * skpkspec.h *
+* * *
+* np <- dvibit.c *
+* * *
+* npage <- dvifile.h gblvars.h initglob.h main.h *
+* * option.h *
+* * *
+* nstr <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* ntemp <- dvijep.c *
+* * *
+* num <- dvibit.c gblvars.h readpost.h *
+* * *
+* number <- nosignex.h rulepxl.h signex.h *
+* * *
+* nword <- clrbmap.h *
+* * *
+* nwords <- clrrow.h loadchar.h *
+* * *
+* octalchars <- dvialw.c *
+* * *
+* offset <- charpk.h *
+* * *
+* oldfont <- fontsub.h *
+* * *
+* oldmag <- fontsub.h *
+* * *
+* openfont() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h loadchar.h openfont.h*
+* * reldfont.h *
+* * *
+* openmode <- dbgopen.h gendefs.h *
+* * *
+* option() <- gblprocs.h main.h option.h *
+* * *
+* optstr <- option.h *
+* * *
+* out_width <- dvialw.c *
+* * *
+* outfcn <- chargf.h charpk.h charpxl.h *
+* * *
+* outline() <- dvieps.c dvigd.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dvitos.c gblprocs.h*
+* * *
+* outpaperfeed() <- dvieps.c gblprocs.h *
+* * *
+* outraster() <- dvijep.c gblprocs.h *
+* * *
+* outrow() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h loadchar.h outrow.h *
+* * *
+* p <- chargf.h charpk.h charpxl.h clrbmap.h *
+* * clrrow.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dvifile.h dvigd.c *
+* * dviimp.c dvijep.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dviterm.h *
+* * dvitos.c fillrect.h getpgtab.h option.h *
+* * outrow.h setfntnm.h *
+* * *
+* p1 <- option.h *
+* * *
+* p2 <- option.h *
+* * *
+* p3 <- option.h *
+* * *
+* packet_length <- charpk.h readpk.h *
+* * *
+* page_begin <- dvifile.h gblvars.h main.h option.h *
+* * *
+* page_count <- dvialw.c dvibit.c dvifile.h gblvars.h *
+* * getpgtab.h *
+* * *
+* page_end <- dvifile.h gblvars.h main.h option.h *
+* * *
+* page_fonts <- dvijep.c gblvars.h *
+* * *
+* page_loc <- dvialw.c gblvars.h *
+* * *
+* page_members <- dvijep.c *
+* * *
+* page_number <- dvialw.c *
+* * *
+* page_ptr <- dvibit.c dvifile.h gblvars.h getpgtab.h*
+* * *
+* page_step <- dvifile.h gblvars.h main.h option.h *
+* * *
+* page_tex <- dvialw.c gblvars.h *
+* * *
+* paint_switch <- chargf.h *
+* * *
+* paperfeeding <- dvieps.c *
+* * *
+* part1 <- dvibit.c *
+* * *
+* part2 <- dvibit.c *
+* * *
+* part3 <- dvibit.c *
+* * *
+* partchar <- dvibit.c gblvars.h *
+* * *
+* partfont <- dvibit.c gblvars.h *
+* * *
+* pbgf <- dvibit.c gblvars.h *
+* * *
+* pbghpos <- dvibit.c gblvars.h *
+* * *
+* pbgvpos <- dvibit.c gblvars.h *
+* * *
+* pbit <- dvijet.c *
+* * *
+* pbreak <- dvialw.c *
+* * *
+* pbuf <- dvijet.c *
+* * *
+* pfontptr <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dviinit.h dvijep.c dviterm.h gblvars.h *
+* * loadchar.h openfont.h reldfont.h *
+* * *
+* pk_index <- dvifile.h fontfile.h gblvars.h *
+* * *
+* pk_packed_num() <- charpk.h *
+* * *
+* pline <- dvieps.c dvigd.c dvimac.c dvimpi.c *
+* * dvioki.c dvitos.c fontsub.h *
+* * *
+* plotfp <- abortrun.h dvialw.c dvibit.c dvican.c *
+* * dvieps.c dvigd.c dviimp.c dviinit.h *
+* * dvijep.c dvijet.c dvimac.c dvimpi.c *
+* * dvioki.c dviprx.c dviterm.h dvitos.c *
+* * gblvars.h *
+* * *
+* postambleptr <- findpost.h *
+* * *
+* pow() <- option.h *
+* * *
+* power <- charpk.h gblvars.h initglob.h *
+* * *
+* ppagep <- dvibit.c gblvars.h *
+* * *
+* preload <- gblvars.h main.h option.h prtpage.h *
+* * readpost.h *
+* * *
+* printf <- dispchar.h dvijet.c *
+* * *
+* prtbmap() <- dvieps.c dvigd.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * gblprocs.h prtpage.h *
+* * *
+* prtpage() <- dvibit.c dvifile.h gblprocs.h prtpage.h *
+* * *
+* ps_vmbug <- dvialw.c gblvars.h initglob.h option.h *
+* * *
+* psave <- dvialw.c *
+* * *
+* psfp <- dvialw.c *
+* * *
+* pten <- inch.h *
+* * *
+* ptext <- dvialw.c *
+* * *
+* ptmp <- dvieps.c dvimac.c dvimpi.c *
+* * *
+* putc() <- alldone.h dbgopen.h dispchar.h dvialw.c *
+* * dvibit.c dvican.c dvieps.c dvigd.c *
+* * dviimp.c dviinit.h dvijep.c dvijet.c *
+* * dvimac.c dvimpi.c dvioki.c dviprx.c *
+* * dviterm.h dvitos.c fatal.h main.h *
+* * readpost.h setchar.h usage.h warning.h *
+* * *
+* putfontname() <- dvialw.c gblprocs.h *
+* * *
+* putname() <- gblprocs.h *
+* * *
+* putout() <- dvibit.c gblprocs.h *
+* * *
+* pword <- charpk.h *
+* * *
+* pxl_index <- dvifile.h fontfile.h gblvars.h *
+* * *
+* pxlw <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h readgf.h readpk.h *
+* * readpxl.h reldfont.h setchar.h *
+* * *
+* q <- charpxl.h outrow.h *
+* * *
+* quiet <- dvialw.c dvibit.c dvican.c dvieps.c *
+* * dvifile.h dviimp.c dviinit.h dvijep.c *
+* * dvimac.c dviterm.h dvitos.c gblvars.h *
+* * main.h option.h prtpage.h readpost.h*
+* * setchar.h warning.h *
+* * *
+* raster <- dvigd.c *
+* * *
+* raster_word <- dispchar.h *
+* * *
+* rasters <- dispchar.h dviterm.h gblvars.h loadchar.h*
+* * outrow.h readpxl.h reldfont.h *
+* * *
+* readfont() <- gblprocs.h getfntdf.h prtpage.h readfont.h*
+* * *
+* readgf() <- gblprocs.h readgf.h reldfont.h *
+* * *
+* readpk() <- gblprocs.h readpk.h reldfont.h *
+* * *
+* readpost() <- dvifile.h gblprocs.h readpost.h *
+* * *
+* readpxl() <- gblprocs.h readpxl.h reldfont.h *
+* * *
+* refcount <- dispchar.h gblvars.h loadchar.h readpxl.h *
+* * reldfont.h *
+* * *
+* reldfont() <- dvibit.c gblprocs.h readfont.h reldfont.h*
+* * *
+* rem <- dvitos.c *
+* * *
+* remap <- dviprx.c *
+* * *
+* repeat_count <- charpk.h *
+* * *
+* resolution <- dvieps.c *
+* * *
+* rightones <- dispchar.h fillrect.h gblvars.h initglob.h*
+* * *
+* rows_left <- charpk.h *
+* * *
+* rsetterm() <- dvibit.c fatal.h gblprocs.h *
+* * *
+* rule_height <- dvialw.c dvijep.c gblvars.h *
+* * *
+* rule_width <- dvialw.c dvijep.c gblvars.h *
+* * *
+* rulepxl() <- gblprocs.h rulepxl.h setrule.h *
+* * *
+* runlengthcode <- dvieps.c dvigd.c dvimac.c dvitos.c *
+* * gblvars.h option.h *
+* * *
+* runmag <- dvibit.c gblvars.h initglob.h option.h *
+* * readpost.h reldfont.h *
+* * *
+* s <- dvialw.c gblvars.h gendefs.h inch.h *
+* * readfont.h readgf.h readpk.h readpxl.h *
+* * reldfont.h special.h strchr.h strrchr.h *
+* * tctos.h *
+* * *
+* save_font_switched <- dvialw.c *
+* * *
+* second <- dvieps.c *
+* * *
+* seen_bop <- prtpage.h *
+* * *
+* set <- dvijep.c *
+* * *
+* setchar() <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblprocs.h prtpage.h setchar.h *
+* * *
+* setfntnm() <- gblprocs.h prtpage.h setfntnm.h *
+* * *
+* setfont() <- dvijep.c gblprocs.h *
+* * *
+* setrule() <- gblprocs.h prtpage.h setrule.h *
+* * *
+* setstr() <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gblprocs.h prtpage.h *
+* * *
+* show_page <- dvibit.c *
+* * *
+* signex() <- chargf.h dviinit.h gblprocs.h getpgtab.h*
+* * prtpage.h readgf.h readpk.h readpxl.h *
+* * signex.h *
+* * *
+* size_limit <- dvialw.c dvican.c dvijep.c gblvars.h *
+* * initglob.h option.h *
+* * *
+* skgfspec() <- chargf.h gblprocs.h skgfspec.h *
+* * *
+* skipfont() <- gblprocs.h prtpage.h skipfont.h *
+* * *
+* skpkspec() <- gblprocs.h readpk.h skpkspec.h *
+* * *
+* sp <- prtpage.h *
+* * *
+* space_width <- dvieps.c *
+* * *
+* spacing <- dvieps.c *
+* * *
+* specfile <- dvialw.c *
+* * *
+* special() <- dvialw.c gblprocs.h prtpage.h special.h *
+* * *
+* specstr <- prtpage.h *
+* * *
+* spool_output <- dviterm.h gblvars.h option.h *
+* * *
+* sprintf() <- chargf.h dvialw.c dvibit.c dviinit.h *
+* * dviterm.h fontfile.h fontsub.h gblprocs.h*
+* * inch.h loadchar.h openfont.h option.h *
+* * prtpage.h readgf.h readpk.h readpxl.h *
+* * reldfont.h setfntnm.h skgfspec.h skpkspec.h*
+* * special.h tctos.h usage.h warning.h *
+* * *
+* sqrt() <- option.h *
+* * *
+* sscanf <- dvialw.c fontsub.h option.h *
+* * *
+* st_size <- dvialw.c *
+* * *
+* stack <- prtpage.h *
+* * *
+* stack_entry <- prtpage.h *
+* * *
+* start_of_packet <- readpk.h *
+* * *
+* stat <- dvialw.c *
+* * *
+* statbuf <- dvialw.c *
+* * *
+* stderr <- alldone.h dbgopen.h dvialw.c dvibit.c *
+* * dvican.c dvieps.c dvifile.h dvigd.c *
+* * dviimp.c dviinit.h dvijep.c dvimac.c *
+* * dviprx.c dviterm.h dvitos.c fatal.h *
+* * main.h option.h prtpage.h readpost.h*
+* * setchar.h warning.h *
+* * *
+* stdin <- dviinit.h dviterm.h *
+* * *
+* stdout <- dispchar.h dviinit.h dvijet.c *
+* * *
+* storage <- gblvars.h *
+* * *
+* str <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c *
+* * *
+* str_ycp <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * gblvars.h *
+* * *
+* strcat() <- dvialw.c dviinit.h fontsub.h gblprocs.h*
+* * option.h *
+* * *
+* strchr() <- dvialw.c dviinit.h gblprocs.h option.h *
+* * strchr.h *
+* * *
+* strcm2() <- fontsub.h gblprocs.h inch.h option.h *
+* * *
+* strcmp() <- dvibit.c gblprocs.h *
+* * *
+* strcpy() <- dvialw.c dviinit.h fontsub.h gblprocs.h*
+* * initglob.h main.h openfont.h option.h *
+* * readfont.h *
+* * *
+* strid2() <- dvifile.h gblprocs.h *
+* * *
+* strlen <- dvialw.c dviinit.h *
+* * *
+* strncmp() <- dvialw.c dvibit.c dviinit.h gblprocs.h*
+* * *
+* strncpy() <- dviinit.h gblprocs.h *
+* * *
+* strrchr() <- dvialw.c dviinit.h gblprocs.h option.h *
+* * strrchr.h tctos.h *
+* * *
+* subext <- dviinit.h fontsub.h gblvars.h initglob.h*
+* * *
+* subfile <- dviinit.h fontsub.h gblvars.h initglob.h*
+* * option.h *
+* * *
+* subfont <- fontsub.h openfont.h *
+* * *
+* subfp <- fontsub.h *
+* * *
+* submag <- fontsub.h openfont.h *
+* * *
+* subname <- fontsub.h gblvars.h initglob.h *
+* * *
+* subpath <- dvialw.c fontsub.h gblvars.h initglob.h*
+* * option.h *
+* * *
+* swap <- dvifile.h *
+* * *
+* t <- alldone.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c gendefs.h strrchr.h *
+* * *
+* tab_entry <- actfact.h *
+* * *
+* tc <- dvibit.c inch.h prtpage.h *
+* * *
+* tcharptr <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c loadchar.h outrow.h readgf.h *
+* * readpk.h readpxl.h reldfont.h setchar.h *
+* * *
+* tcp <- dvibit.c dviinit.h initglob.h *
+* * *
+* tcp1 <- dviinit.h *
+* * *
+* tctos() <- dvialw.c dvibit.c fatal.h gblprocs.h*
+* * prtpage.h tctos.h warning.h *
+* * *
+* temp <- charpk.h dvijep.c *
+* * *
+* templist <- openfont.h *
+* * *
+* tempstr <- dvifile.h *
+* * *
+* tex_counter <- dvialw.c dviinit.h gblvars.h prtpage.h *
+* * tctos.h *
+* * *
+* textbuf <- dvialw.c *
+* * *
+* textchr() <- dvialw.c gblprocs.h *
+* * *
+* textflush() <- dvialw.c gblprocs.h *
+* * *
+* textnum() <- dvialw.c gblprocs.h *
+* * *
+* textstr() <- dvialw.c gblprocs.h *
+* * *
+* tfmw <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h readgf.h readpk.h *
+* * readpxl.h reldfont.h setchar.h *
+* * *
+* tfontptr <- openfont.h readfont.h reldfont.h *
+* * *
+* the_byte <- chargf.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c readgf.h skgfspec.h skpkspec.h*
+* * *
+* the_char <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c readgf.h readpk.h readpxl.h *
+* * reldfont.h *
+* * *
+* the_font <- dvibit.c *
+* * *
+* the_page_count <- readpost.h *
+* * *
+* the_word <- chargf.h *
+* * *
+* time() <- dvialw.c gblprocs.h *
+* * *
+* timestring <- dvialw.c *
+* * *
+* timeval <- dvialw.c *
+* * *
+* tmargin <- dviinit.h gblvars.h movedown.h prtpage.h *
+* * *
+* topmargin <- dviinit.h gblvars.h initglob.h option.h *
+* * *
+* truncated <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* turn_on <- charpk.h *
+* * *
+* twice_a_line <- dvieps.c option.h *
+* * *
+* u <- gendefs.h *
+* * *
+* ungetc <- chargf.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c skgfspec.h skpkspec.h *
+* * *
+* unloadfonts() <- dvibit.c gblprocs.h *
+* * *
+* unmodsize <- actfact.h *
+* * *
+* update_h <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c setchar.h setrule.h *
+* * *
+* urx <- dvialw.c *
+* * *
+* ury <- dvialw.c *
+* * *
+* usage() <- gblprocs.h option.h usage.h *
+* * *
+* use_count <- dvibit.c gblvars.h openfont.h *
+* * *
+* v <- dvialw.c dvican.c dvieps.c dviimp.c *
+* * dvijep.c gblvars.h gendefs.h movedown.h*
+* * prtpage.h *
+* * *
+* v0 <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* v24 <- dvitos.c *
+* * *
+* v6 <- dvimpi.c *
+* * *
+* v7 <- dvioki.c *
+* * *
+* v8 <- dvieps.c dvimac.c *
+* * *
+* v8t <- dvieps.c *
+* * *
+* value <- option.h *
+* * *
+* vppp <- gblvars.h readgf.h readpk.h reldfont.h*
+* * *
+* vv <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h movedown.h prtpage.h *
+* * setchar.h setrule.h *
+* * *
+* vv0 <- dvialw.c dvican.c dviimp.c dvijep.c *
+* * *
+* w <- dvican.c gendefs.h prtpage.h *
+* * *
+* w_even <- dvijet.c *
+* * *
+* w_odd <- dvijet.c *
+* * *
+* warning() <- chargf.h charpk.h charpxl.h fontsub.h *
+* * gblprocs.h getpgtab.h openfont.h option.h *
+* * prtpage.h readgf.h readpk.h readpxl.h *
+* * special.h warning.h *
+* * *
+* wd_rule <- prtpage.h *
+* * *
+* width <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c fillrect.h setrule.h *
+* * *
+* word <- dvigd.c dviprx.c *
+* * *
+* word32 <- dispchar.h *
+* * *
+* word_weight <- charpk.h *
+* * *
+* words_per_row <- outrow.h *
+* * *
+* wp <- chargf.h charpk.h charpxl.h dispchar.h*
+* * dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h loadchar.h outrow.h *
+* * readpk.h readpxl.h reldfont.h *
+* * *
+* x <- bitmap.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dviimp.c dvijep.c fillrect.h*
+* * gendefs.h moveto.h prtpage.h *
+* * *
+* xcorner <- dispchar.h *
+* * *
+* xcp <- dispchar.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h moveto.h *
+* * *
+* xcp_start <- dvialw.c *
+* * *
+* xdiff <- dvibit.c gblvars.h *
+* * *
+* xloffset <- fillrect.h *
+* * *
+* xlpart <- fillrect.h *
+* * *
+* xoffp <- chargf.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dviimp.c dvijep.c gblvars.h *
+* * readpk.h readpxl.h reldfont.h setchar.h *
+* * *
+* xroffset <- fillrect.h *
+* * *
+* xrpart <- fillrect.h *
+* * *
+* xscreen <- dvibit.c gblvars.h setrule.h *
+* * *
+* y <- bitmap.h dvialw.c dvibit.c dvican.c *
+* * dviimp.c dvijep.c fillrect.h moveto.h *
+* * prtpage.h *
+* * *
+* ybottom <- dvieps.c dvigd.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* ycorner <- dispchar.h *
+* * *
+* ycp <- dispchar.h dvialw.c dvican.c dviimp.c *
+* * dvijep.c gblvars.h moveto.h *
+* * *
+* ycp_start <- dvialw.c *
+* * *
+* ydiff <- dvibit.c gblvars.h *
+* * *
+* yoff <- dvialw.c dvibit.c dvican.c dviimp.c *
+* * dvijep.c outrow.h *
+* * *
+* yoffp <- chargf.h dispchar.h dvialw.c dvibit.c *
+* * dvican.c dviimp.c dvijep.c gblvars.h *
+* * readpk.h readpxl.h reldfont.h *
+* * *
+* yscreen <- dvibit.c gblvars.h setrule.h *
+* * *
+* ytop <- dvieps.c dvigd.c dvijet.c dvimac.c *
+* * dvimpi.c dvioki.c dviprx.c dvitos.c *
+* * *
+* z <- prtpage.h *
+* * *
+*********************************************************************
+ Created Tue Nov 17 21:07:44 MST 1987 on csc-sun.utah.edu
+xref dvialw.c dvibit.c dvican.c dvie72.c dvieps.c dvigd.c dviimp.c dvijep.c dvijet.c dvil3p.c dvil75.c dvim72.c dvimac.c dvimpi.c dvio72.c dvioki.c dviprx.c dvitos.c
+*********************************************************************
+* ..File.. * ...Global Symbol... *
+*********************************************************************
+* * *
+* abortrun.h -> EXIT FILE NULL OS_TOPS20 *
+* * OS_VAXVMS UNSIGN16 _iobuf abortrun()*
+* * code dvifp exit() fclose *
+* * font_files font_id g_dolog g_logfp *
+* * k nopen plotfp *
+* * *
+* actfact.h -> INT16 MAGSIZE() MAGTABSIZE UNSIGN32 *
+* * actfact() k mag_index mag_table *
+* * tab_entry unmodsize *
+* * *
+* alldone.h -> EOF FILE FSEEK NULL *
+* * REWIND() _cnt _filbuf _flsbuf *
+* * _iob _iobuf _ptr abortrun()*
+* * alldone() fclose fflush fseek() *
+* * g_dolog g_errenc g_logfp getc() *
+* * putc() stderr t *
+* * *
+* bitmap.h -> BITMAP() NULL SEGMEM UNSIGN32 *
+* * bitmap x y *
+* * *
+* chargf.h -> BLACK BOOLEAN BYTE COORDINATE*
+* * EOF FIRSTPXLCH FSEEK FTELL *
+* * GFBOC GFBOC1 GFEOC GFNOOP *
+* * GFNROW0 GFNROWMAX GFPAINT0 GFPAINT1 *
+* * GFPAINT2 GFPAINT3 GFSKIP0 GFSKIP1 *
+* * GFSKIP2 GFSKIP3 GFXXX1 GFXXX2 *
+* * GFXXX3 GFXXX4 GFYYY INT16 *
+* * LASTPXLCHA MAX_M MAX_N MIN_M *
+* * MIN_N NULL SETBIT() UNGETC *
+* * UNSIGN16 UNSIGN32 VISIBLE() WHITE *
+* * c ch char_entry chargf() *
+* * clrrow() d do_output fontfp *
+* * fontptr fontrp fseek() ftell() *
+* * hp img_mask img_row img_words *
+* * k m max_m max_n *
+* * message min_m min_n n *
+* * nosignex() outfcn p paint_swit*
+* * signex() skgfspec() sprintf() tcharptr *
+* * the_byte the_word ungetc warning() *
+* * wp xoffp yoffp *
+* * *
+* charpk.h -> BOOLEAN BYTE EOF FIRSTPXLCH*
+* * FSEEK INT16 LASTPXLCHA NULL *
+* * UNSIGN16 UNSIGN32 VISIBLE() bit_weight*
+* * c c_height c_width ch *
+* * char_entry charpk() clrrow() count *
+* * do_output dyn_f flag_byte fontfp *
+* * fontptr fontrp fseek() get_bit() *
+* * get_nybble gpower h_bit hp *
+* * i img_row img_words j *
+* * k next_byte nosignex() offset *
+* * outfcn p packet_len pk_packed_*
+* * power pword repeat_cou rows_left *
+* * tcharptr temp turn_on warning() *
+* * word_weigh wp *
+* * *
+* charpxl.h -> BYTE EOF FIRSTPXLCH FSEEK *
+* * LASTPXLCHA NULL UNSIGN16 UNSIGN32 *
+* * VISIBLE() c ch char_entry*
+* * charpxl() fontfp fontptr fontrp *
+* * fseek() hp i img_row *
+* * img_words j nosignex() outfcn *
+* * p q tcharptr warning() *
+* * wp *
+* * *
+* clrbmap.h -> BITMAP() FASTZERO HOST_WORD_ INT32 *
+* * SEGMEM UNSIGN32 XBIT XDPI *
+* * XPSIZE XSIZE XWORDS YBIT *
+* * YDPI YPSIZE YSIZE bitmap *
+* * clrbmap() nword p *
+* * *
+* clrrow.h -> UNSIGN16 UNSIGN32 clrrow() img_row *
+* * img_words nwords p *
+* * *
+* commands.h -> BOP DOWN1 DOWN2 DOWN3 *
+* * DOWN4 EOP FNT1 FNT2 *
+* * FNT3 FNT4 FNT_DEF1 FNT_DEF2 *
+* * FNT_DEF3 FNT_DEF4 FONT_00 FONT_63 *
+* * GFBOC GFBOC1 GFCHLOC GFCHLOC0 *
+* * GFEOC GFEOF GFID GFNOOP *
+* * GFNROW0 GFNROWMAX GFPAINT0 GFPAINT1 *
+* * GFPAINT2 GFPAINT3 GFPOST GFPOSTPOST*
+* * GFPRE GFSKIP0 GFSKIP1 GFSKIP2 *
+* * GFSKIP3 GFXXX1 GFXXX2 GFXXX3 *
+* * GFXXX4 GFYYY NOP PKID *
+* * PKNOOP PKPOST PKPRE PKXXX1 *
+* * PKXXX2 PKXXX3 PKXXX4 PKYYY *
+* * POP POST POST_POST PRE *
+* * PUSH PUT1 PUT2 PUT3 *
+* * PUT4 PUT_RULE RIGHT1 RIGHT2 *
+* * RIGHT3 RIGHT4 SET1 SET2 *
+* * SET3 SET4 SETC_000 SETC_127 *
+* * SET_RULE W0 W1 W2 *
+* * W3 W4 X0 X1 *
+* * X2 X3 X4 XXX1 *
+* * XXX2 XXX3 XXX4 Y0 *
+* * Y1 Y2 Y3 Y4 *
+* * Z0 Z1 Z2 Z3 *
+* * Z4 *
+* * *
+* dbgopen.h -> DBGOPT() DBG_FAIL_O DBG_OKAY_O FILE *
+* * NEWLINE() NULL _cnt _flsbuf *
+* * _iob _iobuf _ptr dbgopen() *
+* * debug_code fname fp fprintf *
+* * openmode putc() stderr *
+* * *
+* dispchar.h -> ARITHRSHIF BITMAP() BYTE COORDINATE*
+* * DBGOPT() DBG_CHAR_D FIRSTPXLCH HOST_WORD_*
+* * IBM_PC_LAT IBM_PC_MIC IBM_PC_WIZ INT16 *
+* * LASTPXLCHA NEWLINE() NULL UNSIGN16 *
+* * UNSIGN32 XBIT XDPI XPSIZE *
+* * XSIZE XWORDS _cnt _flsbuf *
+* * _iob _ptr bitmap bits_to_ne*
+* * c ch char_entry debug_code*
+* * dispchar() fontptr hp i *
+* * ilimit j loadchar() p *
+* * printf putc() raster_wor rasters *
+* * refcount rightones stdout tcharptr *
+* * word32 wp x xcorner *
+* * xcp xoffp ycorner ycp *
+* * yoffp *
+* * *
+* dvialw.c -> BEGINSTRIN BIGCHAR() BOOLEAN BYTE *
+* * BYTE_SIZE COORDINATE DBGOPT() DBG_OFF_PA*
+* * DBG_SET_TE DEBUG_OPEN DEVICE_ID DISKFULL()*
+* * ENDSTRING ENOSPC EOF FALSE *
+* * FILE FIRSTPXLCH FSEEK FTELL *
+* * HOST_WORD_ INT16 INT32 LASTPXLCHA*
+* * MALLOC() MAXFNAME MAXLINE MAXOPEN *
+* * MAXPAGE MAXPSLINE MAXSTR MAXTEXT *
+* * MIN() NEWLINE() NIBBLE() NPXLCHARS *
+* * NULL OCTAL() OFF_PAGE ONPAGE() *
+* * OUTC() OUTFILE_EX OUTS() OUT_CHR() *
+* * OUT_DEFERR OUT_FLT() OUT_FONTNA OUT_IMMEDI*
+* * OUT_NL OUT_NUM() OUT_STR() OUT_XCHR()*
+* * POSTSCRIPT PSDEF_FILE PSDEF_PATH PS_MAXWIDT*
+* * PS_SHORTLI PS_SIZELIM PS_XONXOFF REWIND() *
+* * SETC_000 SETC_127 STDRES TRUE *
+* * UNGETC UNSIGN16 UNSIGN32 VERSION_NO*
+* * VISIBLE() XDPI XPSIZE XSIZE *
+* * YDPI YPSIZE YSIZE _B *
+* * _IOEOF _IOERR _L _N *
+* * _P _U _cnt _ctype_ *
+* * _filbuf _file _flag _flsbuf *
+* * _iob _iobuf _ptr abspos *
+* * argc argv b bopact() *
+* * bytes_per_ c ch char_entry*
+* * charxx charyy clearerr() conv *
+* * copies cppsfile() ctime() cur_page_n*
+* * cuserid() dbgopen() debug_code deferred *
+* * devinit() devterm() digits dvifp *
+* * emitchar() eopact() errno fatal() *
+* * fclose ferror() fflush fgets() *
+* * fileno() fillrect() fixpos() flt *
+* * fmt fname font_count font_entry*
+* * font_numbe font_ptr font_switc fontfp *
+* * fontptr fopen() fprintf fputs *
+* * fseek() fstat ftell() getc() *
+* * h h0 height hexchars *
+* * hfontptr hh hh0 hp *
+* * img_row inside is_comment is_string *
+* * is_text isalnum() isloaded isprint() *
+* * k kbreak last_font_ line *
+* * linebuf llx lly lmargin *
+* * loadchar() magnificat malloc() maxstr *
+* * message moveto() n name *
+* * namebuf nameptr newfont() next *
+* * nosignex() nstr octalchars openfont()*
+* * out_width outrow() p page_count*
+* * page_loc page_numbe page_tex pbreak *
+* * pfontptr plotfp ps_vmbug psave *
+* * psfp ptext putc() putfontnam*
+* * pxlw quiet rule_heigh rule_width*
+* * s save_font_ setchar() setstr() *
+* * size_limit specfile special() sprintf() *
+* * sscanf st_size stat statbuf *
+* * stderr str str_ycp strcat() *
+* * strchr() strcpy() strlen strncmp() *
+* * strrchr() subpath t tcharptr *
+* * tctos() tex_counte textbuf textchr() *
+* * textflush( textnum() textstr() tfmw *
+* * the_byte the_char time() timestring*
+* * timeval truncated ungetc update_h *
+* * urx ury v v0 *
+* * vv vv0 width wp *
+* * x xcp xcp_start xoffp *
+* * y ycp ycp_start yoff *
+* * yoffp *
+* * *
+* dvibit.c -> ABS() ALLOW_INTE BBNBITGRAP BELLS *
+* * BIGBGCHAR BOOLEAN BYTE BYTE_SIZE *
+* * COORDINATE DBGOPT() DBG_SET_TE DEVICE_ID *
+* * DIGVAL() FALSE FILE FIRSTBGCHA*
+* * FIRSTPXLCH FTELL GETENV INT16 *
+* * INT32 KB_CBREAK LASTBGCHAR LASTPXLCHA*
+* * MAGSIZE() MAXFRAC MIN() MINFRAC *
+* * NBGFONTS NEWLINE() NPXLCHARS NULL *
+* * OS_TOPS20 OS_VAXVMS OUTC() OUTF() *
+* * OUTF2() OUTF3() OUTFILE_EX OUTIV() *
+* * OUTS() RESOLUTION STDMAG STDRES *
+* * TRUE UNSIGN16 UNSIGN32 USEGLOBALM*
+* * VERSION_NO XDIFFMAX XDIFFORG XDPI *
+* * XPSIZE XSIZE YDIFFMAX YDIFFORG *
+* * YDPI YPSIZE YSIZE _B *
+* * _L _N _P _U *
+* * _cnt _ctype_ _flsbuf _iob *
+* * _iobuf _ptr actfact() alldone() *
+* * argc argv bgchar bgcp *
+* * bgfont bopact() c ch *
+* * char_entry charxx charyy conv *
+* * cpagep cur_index debug_code den *
+* * devinit() devterm() dvifp dviterm() *
+* * eopact() fatal() fclose fflush *
+* * fillrect() fixpos() font_entry font_file_*
+* * font_files font_id fontfp fontptr *
+* * fprintf fputs ftell() fullfont *
+* * g_interact g_progname getenv() h *
+* * half_words height hfontptr hh *
+* * hp i img_row initterm()*
+* * isdigit() isloaded isprint() istoobig *
+* * k kbclose() kbflush() kbget() *
+* * kbinput() kbopen() lmargin loop_count*
+* * mag message n negative *
+* * newfont() next nopen nosignex()*
+* * np num openfont() outrow() *
+* * p page_count page_ptr part1 *
+* * part2 part3 partchar partfont *
+* * pbgf pbghpos pbgvpos pfontptr *
+* * plotfp ppagep prtpage() putc() *
+* * putout() pxlw quiet reldfont()*
+* * rsetterm() runmag setchar() show_page *
+* * sprintf() stderr str strcmp() *
+* * strncmp() tc tcharptr tcp *
+* * tctos() tfmw the_char the_font *
+* * unloadfont update_h use_count vv *
+* * width wp x xdiff *
+* * xoffp xscreen y ydiff *
+* * yoff yoffp yscreen *
+* * *
+* dvican.c -> ABS() BEGINSTRIN BIGCHAR() BOOLEAN *
+* * BYTE BYTE_SIZE CANON_A2 COORDINATE*
+* * CSI DBGOPT() DBG_OFF_PA DBG_POS_CH*
+* * DBG_SET_TE DEVICE_ID DISKFULL() DOT_MODE *
+* * ENDSTRING ENOSPC FALSE FILE *
+* * FIRSTPXLCH FONTNUMBER GS_NUMBER( HARD_RESET*
+* * HOST_WORD_ HRULE() INT16 INT32 *
+* * ISO_MODE LASTPXLCHA MAPCHAR() MAX() *
+* * MAXLINE MAXSTR MIN() MOVETO() *
+* * MOVEX() MOVEY() NEWLINE() NULL *
+* * OFF_PAGE ONPAGE() OS_ATARI OUTBITMAP(*
+* * OUTC() OUTCHAR() OUTCSI OUTF() *
+* * OUTF2() OUTFILE_EX OUTNUM() OUTS() *
+* * PAGEEJECT RESET_MODE RMOVEX() RMOVEY() *
+* * SEL_PAINT SETCOPIES( SETCURRENT SETC_000 *
+* * SETC_127 SET_MODE SIZE_UNIT SPACING_IN*
+* * STDRES TRUE UNGETC UNSIGN16 *
+* * UNSIGN32 VERSION_NO VISIBLE() VRULE() *
+* * XDPI XORIGIN XPSIZE XSIZE *
+* * YDPI YORIGIN YPSIZE YSIZE *
+* * _B _IOEOF _IOERR _L *
+* * _N _P _U _cnt *
+* * _ctype_ _flag _flsbuf _iob *
+* * _iobuf _ptr argc argv *
+* * baseline bopact() bytecount bytes_per_*
+* * bytewidth c ch char_entry*
+* * charxx charyy clearerr() conv *
+* * copies debug_code devinit() devterm() *
+* * dvifp dx dy eopact() *
+* * errno fatal() ferror() fillrect()*
+* * fixpos() font_count font_numbe font_switc*
+* * font_table fontfp fontptr fprintf *
+* * fputs h h0 height *
+* * hh hh0 hh_last hp *
+* * img_row inside isloaded isprint() *
+* * j k lmargin loadbmap()*
+* * loadchar() moveto() n newfont() *
+* * nosignex() nstr openfont() outrow() *
+* * p pfontptr plotfp putc() *
+* * pxlw quiet setchar() setstr() *
+* * size_limit stderr str str_ycp *
+* * t tcharptr tfmw the_byte *
+* * the_char truncated ungetc update_h *
+* * v v0 vv vv0 *
+* * w width wp x *
+* * xcp xoffp y ycp *
+* * yoff yoffp *
+* * *
+* dvieps.c -> BITMAP() BOOLEAN BYTE BYTE_SIZE *
+* * DEVICE_ID DISKFULL() ENOSPC EPSON *
+* * EPSON_ADV_ EPSON_BIT_ EPSON_MICR FALSE *
+* * HIRES HOST_WORD_ IBM_PC_LAT IBM_PC_MIC*
+* * IBM_PC_WIZ INT16 NEWLINE() OUTC() *
+* * OUTF() OUTF2() OUTF3() OUTFILE_EX*
+* * OUTLINE() OUTS() Q() SEGMEM *
+* * STDRES TRUE UNSIGN32 VERSION_NO*
+* * XBIT XDPI XPSIZE XSIZE *
+* * XWORDS YBIT YDPI YPSIZE *
+* * YSIZE _IOEOF _IOERR _cnt *
+* * _flag _flsbuf _iob _ptr *
+* * a argc argv b *
+* * bitmap c clearerr() count *
+* * devinit() devterm() errno fatal() *
+* * ferror() fflush flag fprintf *
+* * fputs getbmap() i j *
+* * k left len linelength*
+* * makechar() mask micro_step n *
+* * outline() outpaperfe p paperfeedi*
+* * pline plotfp prtbmap() ptmp *
+* * putc() quiet resolution runlengthc*
+* * second space_widt spacing stderr *
+* * twice_a_li v v8 v8t *
+* * ybottom ytop *
+* * *
+* dvifile.h -> BYTE CANON_A2 FSEEK GOLDENDAWN*
+* * HPJETPLUS HPLASERJET IMPRESS IN() *
+* * INT16 MAXSTR PAGENUMBER POSTSCRIPT*
+* * _iob argc argv backwards *
+* * cur_index cur_page_n devinit() devterm() *
+* * dvifile() dvifp dviinit() dviterm() *
+* * fatal() filestr fontlist fprintf *
+* * fseek() getbytes() gf_index i *
+* * j list m m_begin *
+* * m_end m_step nosignex() npage *
+* * p page_begin page_count page_end *
+* * page_ptr page_step pk_index prtpage() *
+* * pxl_index quiet readpost() stderr *
+* * strid2() swap tempstr *
+* * *
+* dvigd.c -> BITMAP() BYTE_SIZE COORDINATE DEVICE_ID *
+* * DISKFULL() ENOSPC GOLDENDAWN HOST_WORD_*
+* * IBM_PC_LAT IBM_PC_MIC IBM_PC_WIZ INT16 *
+* * MAXOPEN NEWLINE() OUTC() OUTF2() *
+* * OUTFILE_EX OUTS() STDRES UNSIGN32 *
+* * V24SIZE VERSION_NO XBIT XDPI *
+* * XPSIZE XSIZE XWORDS YBIT *
+* * YDPI YPSIZE YSIZE _IOEOF *
+* * _IOERR _cnt _flag _flsbuf *
+* * _iob _ptr a argc *
+* * argv b bitmap c *
+* * clearerr() devinit() devterm() errno *
+* * fatal() ferror() fflush fprintf *
+* * fputs getbmap() i j *
+* * k left len outline() *
+* * p pline plotfp prtbmap() *
+* * putc() raster runlengthc stderr *
+* * word ybottom ytop *
+* * *
+* dvihead.h -> BSD41 BSD42 DEBUG IBM_PC_MIC*
+* * KCC_20 OS_ATARI OS_VAXVMS errno *
+* * *
+* dviimp.c -> BEGINSTRIN BOOLEAN BYTE BYTE_SIZE *
+* * COORDINATE DBGOPT() DBG_OFF_PA DBG_POS_CH*
+* * DBG_SET_TE DEVICE_ID DISKFULL() ENDJOB *
+* * ENDSTRING ENOSPC FALSE FILE *
+* * FIRSTPXLCH HOST_WORD_ IMPRESS IM_BGLY *
+* * IM_BRULE IM_ENDPAGE IM_EOF IM_PAGE *
+* * IM_SABSH IM_SABSV IM_SET_FAM IM_SRELH *
+* * IM_SRELV INT16 INT32 LASTPXLCHA*
+* * MAXLINE MAXSTR MOVETO() MOVEX() *
+* * MOVEY() NEWLINE() NULL OFF_PAGE *
+* * ONPAGE() OUT16() OUTC() OUTF() *
+* * OUTFILE_EX OUTS() PAGEEJECT RMOVETO() *
+* * RMOVEX() RMOVEY() ROUND() SETCURRENT*
+* * SETC_000 SETC_127 STDRES TRUE *
+* * UNGETC UNSIGN16 UNSIGN32 VERSION_NO*
+* * VISIBLE() XDPI XORIGIN XPSIZE *
+* * XSIZE YDPI YORIGIN YPSIZE *
+* * YSIZE _B _IOEOF _IOERR *
+* * _L _N _P _U *
+* * _cnt _ctype_ _flag _flsbuf *
+* * _iob _iobuf _ptr argc *
+* * argv bopact() bytes_per_ c *
+* * ch char_entry charxx charyy *
+* * clearerr() conv copies debug_code*
+* * delx dely devinit() devterm() *
+* * dvifp eopact() errno fatal() *
+* * ferror() fillrect() fixpos() font_count*
+* * font_numbe font_switc font_table fontfp *
+* * fontnumber fontptr fprintf fputs *
+* * h h0 height hh *
+* * hh0 hh_last hp img_row *
+* * inside isloaded isprint() j *
+* * k lmargin loadchar() moveto() *
+* * n newfont() nosignex() nstr *
+* * openfont() outrow() p pfontptr *
+* * plotfp putc() pxlw quiet *
+* * setchar() setstr() stderr str *
+* * str_ycp t tcharptr tfmw *
+* * the_byte the_char truncated ungetc *
+* * update_h v v0 vv *
+* * vv0 width wp x *
+* * xcp xoffp y ycp *
+* * yoff yoffp *
+* * *
+* dviinit.h -> BBNBITGRAP BYTE CANON_A2 CANON_TEST*
+* * COORDINATE DEBUG_OPEN DVIEXT DVIFORMAT *
+* * DVIPREFIX EXIT FILE FOPEN *
+* * HPJETPLUS IMPRESS INT16 INT32 *
+* * NEWLINE() NO_FILENAM NULL OS_ATARI *
+* * OS_PCDOS OS_TOPS20 OS_UNIX OS_VAXVMS *
+* * OUTFILE_EX PRE RB_OPEN WB_OPEN *
+* * XDPI XORIGIN XPSIZE XSIZE *
+* * YDPI YORIGIN YPSIZE YSIZE *
+* * _cnt _flsbuf _iob _iobuf *
+* * _ptr cache_size curext curname *
+* * curpath dbgopen() dvifp dviinit() *
+* * dviname dvoname exit() fatal() *
+* * filestr font_entry fontfp fontptr *
+* * fopen() fprintf fseek() g_logname *
+* * g_progname hfontptr i k *
+* * leftmargin lmargin message nopen *
+* * nosignex() pfontptr plotfp putc() *
+* * quiet signex() sprintf() stderr *
+* * stdin stdout strcat() strchr() *
+* * strcpy() strlen strncmp() strncpy() *
+* * strrchr() subext subfile tcp *
+* * tcp1 tex_counte tmargin topmargin *
+* * *
+* dvijep.c -> ABS() ADD_MEMBER BEGINSTRIN BEGIN_RAST*
+* * BIGCHAR() BOOLEAN BYTE BYTE_SIZE *
+* * COORDINATE CREATE_FON DBGOPT() DBG_OFF_PA*
+* * DBG_POS_CH DBG_SET_TE DELETE_ALL DEVICE_ID *
+* * DISKFULL() DOWNLOAD_C EMPTY_SET( ENDSTRING *
+* * END_RASTER ENOSPC FALSE FILE *
+* * FIRSTPXLCH HOST_WORD_ HPJETPLUS IN() *
+* * INT16 INT32 IS_MEMBER( LASTPXLCHA*
+* * MAP_CHAR() MAX() MAXFONTS MAXLINE *
+* * MAXPAGEFON MAXSTR MIN() MOVETO() *
+* * MOVEX() MOVEY() NEWLINE() NULL *
+* * OFF_PAGE ONPAGE() OUT16() OUTC() *
+* * OUTF() OUTF2() OUTFILE_EX OUTS() *
+* * OUT_CHAR() PAGEEJECT RESET_PRIN RMOVETO() *
+* * RMOVEX() RMOVEY() ROUND() RULE() *
+* * RULE2() SETCOPIES( SETC_000 SETC_127 *
+* * SET_CHAR_C SET_FONT_I STDRES TRANSFER_R*
+* * TRUE UNDEFINED_ UNGETC UNSIGN16 *
+* * UNSIGN32 VERSION_NO VISIBLE() XDPI *
+* * XORIGIN XPSIZE XSIZE YDPI *
+* * YORIGIN YPSIZE YSIZE _B *
+* * _IOEOF _IOERR _L _N *
+* * _P _U _cnt _ctype_ *
+* * _flag _flsbuf _iob _iobuf *
+* * _ptr argc argv bopact() *
+* * bytes_per_ c cell_above cell_basel*
+* * cell_below cell_heigh cell_left cell_width*
+* * ch char_below char_entry charxx *
+* * charyy clearerr() conv copies *
+* * debug_code delx dely devinit() *
+* * devterm() dvifp eopact() errno *
+* * fatal() ferror() fillrect() fixpos() *
+* * font_count font_numbe font_switc font_table*
+* * fontfp fontnumber fontptr fprintf *
+* * fputs h h0 height *
+* * hh hh0 hh_last hp *
+* * img_row inside isloaded isprint() *
+* * istoobig j k lmargin *
+* * loadbmap() loadchar() makefont() member *
+* * moveto() n nbytes newfont() *
+* * nosignex() nstr ntemp openfont()*
+* * outraster( outrow() p page_fonts*
+* * page_membe pfontptr plotfp putc() *
+* * pxlw quiet rule_heigh rule_width*
+* * set setchar() setfont() setstr() *
+* * size_limit stderr str str_ycp *
+* * t tcharptr temp tfmw *
+* * the_byte the_char truncated ungetc *
+* * update_h v v0 vv *
+* * vv0 width wp x *
+* * xcp xoffp y ycp *
+* * yoff yoffp *
+* * *
+* dvijet.c -> BITMAP() BYTE BYTE_SIZE DBGOPT() *
+* * DBG_PAGE_D DEFAULT_RE DEVICE_ID DISKFULL()*
+* * ENOSPC HOST_WORD_ HPLASERJET IBM_PC_LAT*
+* * IBM_PC_MIC IBM_PC_WIZ INT16 MAX() *
+* * MIN() NEWLINE() OUTC() OUTF() *
+* * OUTFILE_EX OUTS() STDRES UNSIGN32 *
+* * VERSION_NO XBIT XDPI XPSIZE *
+* * XSIZE XWORDS YBIT YDPI *
+* * YPSIZE YSIZE ZAPTHISOUT _IOEOF *
+* * _IOERR _cnt _flag _flsbuf *
+* * _iob _ptr argc argv *
+* * bitmap buf clearerr() copies *
+* * debug_code devinit() devterm() errno *
+* * fatal() ferror() fflush fprintf *
+* * fputs getbmap() hpres i *
+* * j k k1 k2 *
+* * k3 last_word outline() p *
+* * pbit pbuf plotfp printf *
+* * prtbmap() putc() stdout w_even *
+* * w_odd ybottom ytop *
+* * *
+* dvimac.c -> APPLEIMAGE BITMAP() BYTE BYTE_SIZE *
+* * DEVICE_ID DISKFULL() ENOSPC HIRES *
+* * HOST_WORD_ IBM_PC_LAT IBM_PC_MIC IBM_PC_WIZ*
+* * INT16 MAXOPEN NEWLINE() OUTC() *
+* * OUTF() OUTF2() OUTFILE_EX OUTS() *
+* * Q() SEGMEM STDRES UNSIGN32 *
+* * VERSION_NO XBIT XDPI XPSIZE *
+* * XSIZE XWORDS YBIT YDPI *
+* * YPSIZE YSIZE _IOEOF _IOERR *
+* * _cnt _flag _flsbuf _iob *
+* * _ptr a argc argv *
+* * b bitmap c clearerr()*
+* * devinit() devterm() errno fatal() *
+* * ferror() fflush fprintf fputs *
+* * getbmap() i j k *
+* * left len makechar() mask *
+* * n outline() p pline *
+* * plotfp prtbmap() ptmp putc() *
+* * quiet runlengthc stderr v8 *
+* * ybottom ytop *
+* * *
+* dvimpi.c -> BITMAP() BYTE_SIZE DEVICE_ID DISKFULL()*
+* * ENOSPC HIRES HOST_WORD_ IBM_PC_LAT*
+* * IBM_PC_MIC IBM_PC_WIZ INT16 MAX() *
+* * MPISPRINTE OUTC() OUTFILE_EX OUTS() *
+* * Q() SEGMEM STDRES UNSIGN32 *
+* * V6SIZE VERSION_NO XBIT XDPI *
+* * XPSIZE XSIZE XWORDS YBIT *
+* * YDPI YPSIZE YSIZE _IOEOF *
+* * _IOERR _cnt _flag _flsbuf *
+* * _ptr argc argv bitmap *
+* * c clearerr() devinit() devterm() *
+* * errno fatal() ferror() fflush *
+* * fputs getbmap() i j *
+* * k left makechar() mask *
+* * n outline() p pline *
+* * plotfp prtbmap() ptmp putc() *
+* * v6 ybottom ytop *
+* * *
+* dvioki.c -> BITMAP() BYTE_SIZE DEVICE_ID DISKFULL()*
+* * ENOSPC ESC ETX HIRES *
+* * HOST_WORD_ IBM_PC_LAT IBM_PC_MIC IBM_PC_WIZ*
+* * INT16 MAX() MAXOPEN OKIDATA241*
+* * OUTC() OUTFILE_EX OUTS() Q() *
+* * SEGMEM SO STDRES STX *
+* * UNSIGN32 VERSION_NO XBIT XDPI *
+* * XPSIZE XSIZE XWORDS YBIT *
+* * YDPI YPSIZE YSIZE _IOEOF *
+* * _IOERR _cnt _flag _flsbuf *
+* * _ptr argc argv bitmap *
+* * c clearerr() devinit() devterm() *
+* * errno fatal() ferror() fflush *
+* * fputs getbmap() i j *
+* * k left makechar() mask *
+* * n outline() p pline *
+* * plotfp prtbmap() putc() v7 *
+* * ybottom ytop *
+* * *
+* dviprx.c -> BITMAP() BYTE_SIZE DBGOPT() DBG_PAGE_D*
+* * DEVICE_ID DISKFULL() ENOSPC HOST_WORD_*
+* * IBM_PC_LAT IBM_PC_MIC IBM_PC_WIZ INT16 *
+* * MAX() NEWLINE() OUTC() OUTFILE_EX*
+* * PRINTRONIX STDRES UNSIGN32 VERSION_NO*
+* * XBIT XDPI XPSIZE XSIZE *
+* * XWORDS YBIT YDPI YPSIZE *
+* * YSIZE _IOEOF _IOERR _cnt *
+* * _flag _flsbuf _iob _ptr *
+* * argc argv bitmap clearerr()*
+* * debug_code devinit() devterm() errno *
+* * fatal() ferror() fflush fprintf *
+* * getbmap() i j k *
+* * p plotfp prtbmap() putc() *
+* * remap stderr word ybottom *
+* * ytop *
+* * *
+* dviterm.h -> BSD42 EOF FILE INT16 *
+* * IOCPARM_MA IOC_IN NEWLINE() NPXLCHARS *
+* * NULL OS_TOPS20 OS_VAXVMS TIOCSTI *
+* * UNSIGN32 VIRTUAL_FO _IOW() _cnt *
+* * _file _flsbuf _iob _iobuf *
+* * _ptr ch dvifp dviterm() *
+* * dvoname fatal() fclose fflush *
+* * fileno() font_entry font_files font_id *
+* * fontptr fprintf free() hfontptr *
+* * ioctl k message next *
+* * nopen p pfontptr plotfp *
+* * putc() quiet rasters spool_outp*
+* * sprintf() stderr stdin *
+* * *
+* dvitos.c -> BITMAP() BYTE_SIZE DEVICE_ID DISKFULL()*
+* * ENOSPC HOST_WORD_ IBM_PC_LAT IBM_PC_MIC*
+* * IBM_PC_WIZ INT16 MAX() MAXOPEN *
+* * NEWLINE() OUTC() OUTF() OUTF2() *
+* * OUTFILE_EX OUTS() Q() SEGMEM *
+* * STDRES TOSHIBAP13 UNSIGN32 V24SIZE *
+* * VERSION_NO XBIT XDPI XPSIZE *
+* * XSIZE XWORDS YBIT YDPI *
+* * YPSIZE YSIZE _IOEOF _IOERR *
+* * _cnt _flag _flsbuf _iob *
+* * _ptr a argc argv *
+* * b bitmap c clearerr()*
+* * devinit() devterm() errno fatal() *
+* * ferror() fflush fprintf fputs *
+* * getbmap() i j k *
+* * len mask n outline() *
+* * p pline plotfp prtbmap() *
+* * putc() quiet rem runlengthc*
+* * stderr v24 ybottom ytop *
+* * *
+* fatal.h -> BBNBITGRAP DEBUG_OPEN FILE NEWLINE() *
+* * NULL OS_TOPS20 OS_VAXVMS _cnt *
+* * _flsbuf _iob _iobuf _ptr *
+* * alldone() dbgopen() fatal() fopen() *
+* * fprintf fputs g_dolog g_errenc *
+* * g_logfp g_logname g_progname msg *
+* * putc() rsetterm() stderr tctos() *
+* * *
+* fillrect.h -> BITMAP() COORDINATE HOST_WORD_ IN() *
+* * ONES UNSIGN32 XBIT XDPI *
+* * XPSIZE XSIZE XWORDS YBIT *
+* * YDPI YPSIZE YSIZE bitmap *
+* * fillrect() height i j *
+* * p rightones width x *
+* * xloffset xlpart xroffset xrpart *
+* * y *
+* * *
+* findpost.h -> BYTE DVIFORMAT FSEEK FTELL *
+* * TRUE dvifp fatal() findpost()*
+* * fseek() ftell() i nosignex()*
+* * postamblep *
+* * *
+* fixpos.h -> ABS() COORDINATE INT32 MAXDRIFT *
+* * PIXROUND() c cc ccc *
+* * cnvfac fixpos() *
+* * *
+* fontfile.h -> INT16 MAXFORMATS OS_ATARI OS_PCDOS *
+* * OS_TOPS20 OS_UNIX OS_VAXVMS dpi *
+* * filelist fltdpi font_name font_path *
+* * fontfile() gf_index k m *
+* * magnificat pk_index pxl_index sprintf() *
+* * *
+* fontsub.h -> BOOLEAN DEBUG_OPEN EOF FALSE *
+* * FILE FSEEK MAXFNAME MAXSTR *
+* * NULL REWIND() TRUE TeXfont *
+* * TeXmag _iobuf dbgopen() fgets() *
+* * fname fontsub() fopen() fseek() *
+* * have_file k line line_numbe*
+* * message oldfont oldmag pline *
+* * sprintf() sscanf strcat() strcm2() *
+* * strcpy() subext subfile subfont *
+* * subfp submag subname subpath *
+* * warning() *
+* * *
+* gblprocs.h -> ANSI_PROTO APPLEIMAGE BBNBITGRAP BOOLEAN *
+* * CANON_A2 COORDINATE EPSON EXIT *
+* * FASTZERO FILE FOPEN FSEEK *
+* * FTELL GETENV HIRES HPJETPLUS *
+* * IBM_PC_WIZ IMPRESS INT32 KCC_20 *
+* * OKIDATA241 OS_VAXVMS POSTSCRIPT UNSIGN32 *
+* * VIRTUAL_FO _iobuf abortrun() actfact() *
+* * alldone() atof() atoi() bopact() *
+* * chargf() charpk() charpxl() clrbmap() *
+* * clrrow() cppsfile() ctime() cuserid() *
+* * dbgopen() devinit() devterm() dispchar()*
+* * dvifile() dviinit() dviterm() emitchar()*
+* * eopact() exit() fatal() fillrect()*
+* * findpost() fixpos() fontfile() fontsub() *
+* * fopen() free() fseek() ftell() *
+* * getbmap() getbytes() getenv() getfntdf()*
+* * getlogin() getpgtab() gotint() inch() *
+* * initglob() initterm() loadbmap() loadchar()*
+* * loadrast() main() makechar() makefont()*
+* * malloc() movedown() moveover() moveto() *
+* * newfont() nosignex() openfont() option() *
+* * outline() outpaperfe outraster( outrow() *
+* * prtbmap() prtpage() putfontnam putname() *
+* * putout() readfont() readgf() readpk() *
+* * readpost() readpxl() reldfont() rsetterm()*
+* * rulepxl() setchar() setfntnm() setfont() *
+* * setrule() setstr() signex() skgfspec()*
+* * skipfont() skpkspec() special() sprintf() *
+* * strcat() strchr() strcm2() strcmp() *
+* * strcpy() strid2() strncmp() strncpy() *
+* * strrchr() tctos() textchr() textflush(*
+* * textnum() textstr() time() unloadfont*
+* * usage() warning() *
+* * *
+* gblvars.h -> APPLEIMAGE BBNBITGRAP BOOLEAN BSD42 *
+* * BYTE CANON_A2 COORDINATE DECLA75 *
+* * DECLN03PLU EPSON FALSE FILE *
+* * FIRSTBGCHA GOLDENDAWN HOST_WORD_ HPJETPLUS *
+* * HPLASERJET IMPRESS INT16 INT32 *
+* * MAGTABSIZE MAXFNAME MAXFONTS MAXMSG *
+* * MAXOPEN MAXPAGE MAXREQUEST MAXSTR *
+* * MAX_M MIN_M NBGFONTS NPXLCHARS *
+* * NULL OS_TOPS20 POSTSCRIPT TOSHIBAP13*
+* * TRUE UNSIGN16 UNSIGN32 VIRTUAL_FO*
+* * _iobuf a backwards bgchar *
+* * bgcp bgfont c cache_size*
+* * cell_d cell_h cell_w ch *
+* * char_entry charxx conv copies *
+* * cpagep cur_index cur_page_n curext *
+* * curname curpath d debug_code*
+* * den designsize dvifp dviname *
+* * dvoname dx dy font_count*
+* * font_entry font_file_ font_files font_id *
+* * font_list font_mag font_numbe font_space*
+* * font_switc font_table font_type fontfp *
+* * fontlist fontpath fontptr fontrp *
+* * fullfont g_dolog g_errenc g_interact*
+* * g_logfp g_logname g_progname gf_index *
+* * gpower h helpcmd hfontptr *
+* * hh hp hppp hpres *
+* * img_mask img_row img_words isknown *
+* * isloaded istoobig k l *
+* * leftmargin lmargin mag mag_index *
+* * mag_table magnificat max_m max_n *
+* * message min_m min_n n *
+* * name next nloaded nopen *
+* * npage num page_begin page_count*
+* * page_end page_fonts page_loc page_ptr *
+* * page_step page_tex partchar partfont *
+* * pbgf pbghpos pbgvpos pfontptr *
+* * pk_index plotfp power ppagep *
+* * preload ps_vmbug pxl_index pxlw *
+* * quiet rasters refcount rightones *
+* * rule_heigh rule_width runlengthc runmag *
+* * s size_limit spool_outp storage *
+* * str_ycp subext subfile subname *
+* * subpath tex_counte tfmw tmargin *
+* * topmargin use_count v vppp *
+* * vv wp xcp xdiff *
+* * xoffp xscreen ycp ydiff *
+* * yoffp yscreen *
+* * *
+* gendefs.h -> ABS() CANON_A2 CANON_TEST DBGOPT() *
+* * DBG_CHAR_D DBG_FAIL_O DBG_FONT_C DBG_OFF_PA*
+* * DBG_OKAY_O DBG_PAGE_D DBG_POS_CH DBG_SET_TE*
+* * DEBUG_OPEN DVIFORMAT FIRSTPXLCH FT_GF *
+* * FT_PK FT_PXL IN() LASTPXLCHA*
+* * MAGSIZE() MAX() MAXFONTS MAXFORMATS*
+* * MAXMSG MAXPAGE MAXREQUEST MAXSPECIAL*
+* * MAXSTR MAX_M MAX_N MIN() *
+* * MIN_M MIN_N NEWLINE() NPXLCHARS *
+* * ONES OS_ATARI OS_PCDOS OS_TOPS20 *
+* * OUTC() OUTF() OUTF2() OUTF3() *
+* * OUTS() PIXROUND() PXLID RESOLUTION*
+* * SETBIT() STACKSIZE STDMAG STDRES *
+* * TESTBIT() USEGLOBALM VISIBLE() a *
+* * b c f flag *
+* * fmt fname fp m *
+* * n openmode s t *
+* * u v w x *
+* * *
+* getbmap.h -> HOST_WORD_ MALLOC() NULL SEGMEM *
+* * UNSIGN32 XBIT XDPI XPSIZE *
+* * XSIZE XWORDS YBIT YDPI *
+* * YPSIZE YSIZE bitmap fatal() *
+* * getbmap() malloc() *
+* * *
+* getbytes.h -> BYTE FILE _cnt _filbuf *
+* * _iobuf _ptr cp fp *
+* * getbytes() getc() n *
+* * *
+* getfntdf.h -> BYTE FNT_DEF1 FNT_DEF4 INT32 *
+* * POST_POST byte dvifp fatal() *
+* * getfntdf() nosignex() readfont() *
+* * *
+* getpgtab.h -> BOP BYTE FSEEK INT16 *
+* * MAXPAGE dvifp fatal() fseek() *
+* * getpgtab() i k lastpagept*
+* * nosignex() p page_count page_ptr *
+* * signex() warning() *
+* * *
+* inch.h -> BOOLEAN FALSE PXLID TRUE *
+* * _N _ctype_ fatal() flnum *
+* * inch() isdigit() message neg *
+* * pten s sprintf() strcm2() *
+* * tc *
+* * *
+* initglob.h -> CANON_A2 CANON_TEST DEFAULT_RE DVIHELP *
+* * FALSE FONTLIST FONTPATH GETENV *
+* * HOST_WORD_ HPJETPLUS HPLASERJET INT16 *
+* * NULL OS_ATARI OS_PCDOS OS_UNIX *
+* * POSTSCRIPT PS_SIZELIM STDMAG SUBEXT *
+* * SUBNAME SUBPATH TEXFONTS TEXINPUTS *
+* * VIRTUAL_FO copies debug_code fontlist *
+* * fontpath getenv() gpower helpcmd *
+* * hpres i img_mask initglob()*
+* * leftmargin npage power ps_vmbug *
+* * rightones runmag size_limit strcpy() *
+* * subext subfile subname subpath *
+* * tcp topmargin *
+* * *
+* keydef.h -> ANSI_LIBRA ANSI_PROTO FILE KB_CBREAK *
+* * KB_ECHO KB_INQUIRE KB_NORMAL KB_RAW *
+* * KB_RESTORE KB_SAVE KEYMODE _iobuf *
+* * kbclose() kbfile() kbflush() kbget() *
+* * kbinput() kbmode() kbopen() kbunget() *
+* * *
+* loadchar.h -> BYTE FILE FIRSTPXLCH INT32 *
+* * LASTPXLCHA MALLOC() NULL UNSIGN32 *
+* * VISIBLE() _iobuf c cache_size*
+* * ch char_entry charxx charyy *
+* * fatal() fontfp fontptr hp *
+* * loadchar() malloc() message n *
+* * nwords openfont() outrow() pfontptr *
+* * rasters refcount sprintf() tcharptr *
+* * wp *
+* * *
+* machdefs.h -> ALLOW_INTE ANSI_LIBRA ANSI_PROTO APPLEIMAGE*
+* * ARITHRSHIF ATT BBNBITGRAP BSD41 *
+* * BSD42 CANON_A2 DECLA75 DECLN03PLU*
+* * DISKFULL() DVIEXT DVIHELP DVIPREFIX *
+* * EPSON EXIT FASTZERO FILE_BASE(*
+* * FILE_CNT() FILE_PTR() FONTLIST FONTPATH *
+* * FOPEN FSEEK FTELL GETENV *
+* * GOLDENDAWN HIRES HOST_WORD_ HPJETPLUS *
+* * HPLASERJET HPUX IBM_PC_LAT IBM_PC_MIC*
+* * IBM_PC_WIZ IMPRESS KCC_20 MALLOC() *
+* * MAXDRIFT MAXFNAME MAXOPEN MPISPRINTE*
+* * OKIDATA241 OS_ATARI OS_PCDOS OS_TOPS20 *
+* * OS_UNIX OS_VAXVMS PCC_20 POSTSCRIPT*
+* * PRINTRONIX PS_MAXWIDT PS_SHORTLI PS_XONXOFF*
+* * PXLID RB_OPEN READ REWIND() *
+* * SEGMEM STDRES SUBEXT SUBNAME *
+* * SUBPATH TEXFONTS TEXINPUTS TOSHIBAP13*
+* * UNGETC USEGLOBALM VIRTUAL_FO WB_OPEN *
+* * ZAPTHISOUT fp n *
+* * *
+* main.h -> BBNBITGRAP BSD42 CANON_A2 DECLA75 *
+* * DECLN03PLU DEVICE_ID EPSON HPJETPLUS *
+* * IBM_PC_LAT IBM_PC_MIC IBM_PC_WIZ IMPRESS *
+* * KCC_20 NEWLINE() NOFILE OS_ATARI *
+* * OS_UNIX OS_VAXVMS PCC_20 POSTSCRIPT*
+* * STDMAG STDRES TOSHIBAP13 TRUE *
+* * VERSION_NO _NFILE _cnt _flsbuf *
+* * _iob _ptr alldone() argc *
+* * argv dvifile() file_args fprintf *
+* * g_progname initglob() k main() *
+* * npage option() page_begin page_end *
+* * page_step preload putc() quiet *
+* * stderr strcpy() *
+* * *
+* movedown.h -> ABS() COORDINATE INT32 NULL *
+* * PIXROUND() a conv fixpos() *
+* * font_entry font_space fontptr movedown()*
+* * tmargin v vv *
+* * *
+* moveover.h -> ABS() COORDINATE INT32 NULL *
+* * PIXROUND() b conv fixpos() *
+* * font_entry font_space fontptr h *
+* * hh lmargin moveover() *
+* * *
+* moveto.h -> COORDINATE moveto() x xcp *
+* * y ycp *
+* * *
+* nosignex.h -> BYTE FILE UNSIGN32 _cnt *
+* * _filbuf _iobuf _ptr fp *
+* * getc() n nosignex() number *
+* * *
+* openfont.h -> DEBUG_OPEN FILE FOPEN IBM_PC_MIC*
+* * IN() INT16 MAGSIZE() MAGTABSIZE*
+* * MAX() MAXFNAME MAXFORMATS MAXOPEN *
+* * NULL OS_VAXVMS RB_OPEN UNSIGN32 *
+* * VIRTUAL_FO _iobuf a actfact() *
+* * current dbgopen() fclose filelist *
+* * font_entry font_file_ font_files font_id *
+* * font_mag fontfile() fontfp fontname *
+* * fontpath fontptr fontsub() fopen() *
+* * hfontptr i j k *
+* * least_used mag_index mag_table maxopen *
+* * message name next nopen *
+* * openfont() pfontptr sprintf() strcpy() *
+* * subfont submag templist tfontptr *
+* * use_count warning() *
+* * *
+* option.h -> ABS() APPLEIMAGE BSD42 BYTE *
+* * CANON_A2 CANON_TEST DEFAULT_RE EPSON *
+* * FALSE GOLDENDAWN HIRES HPJETPLUS *
+* * HPLASERJET IMPRESS INT16 MAGSIZE() *
+* * MAGTABSIZE MAX() MIN() NULL *
+* * OS_TOPS20 POSTSCRIPT STDMAG TOSHIBAP13*
+* * TRUE UNSIGN16 UNSIGN32 VIRTUAL_FO*
+* * _N _ctype_ _iob actfact() *
+* * atof() atoi() backwards copies *
+* * debug_code envlist envname envstruct *
+* * envvar fatal() fltmag fontlist *
+* * fontpath g_dolog helpcmd hpres *
+* * inch() isdigit() k leftmargin*
+* * m mag_index mag_table message *
+* * npage option() optstr p *
+* * p1 p2 p3 page_begin*
+* * page_end page_step pow() preload *
+* * ps_vmbug quiet runlengthc runmag *
+* * size_limit spool_outp sprintf() sqrt() *
+* * sscanf stderr strcat() strchr() *
+* * strcm2() strcpy() strrchr() subfile *
+* * subpath topmargin twice_a_li usage() *
+* * value warning() *
+* * *
+* outrow.h -> BYTE NULL UNSIGN16 UNSIGN32 *
+* * c ch char_entry fontptr *
+* * img_row k outrow() p *
+* * q rasters tcharptr words_per_*
+* * wp yoff *
+* * *
+* prtpage.h -> BBNBITGRAP BOOLEAN BOP BYTE *
+* * CANON_A2 COORDINATE DOWN1 DOWN2 *
+* * DOWN3 DOWN4 EOP FALSE *
+* * FNT1 FNT2 FNT3 FNT4 *
+* * FNT_DEF1 FNT_DEF2 FNT_DEF3 FNT_DEF4 *
+* * FONT_00 FONT_63 FSEEK HPJETPLUS *
+* * IMPRESS INT16 INT32 MAXSPECIAL*
+* * NOP NULL POP POST *
+* * POSTSCRIPT POST_POST PRE PUSH *
+* * PUT1 PUT2 PUT3 PUT4 *
+* * PUT_RULE RIGHT1 RIGHT2 RIGHT3 *
+* * RIGHT4 SET1 SET2 SET3 *
+* * SET4 SETC_000 SETC_127 SET_RULE *
+* * STACKSIZE TRUE UNSIGN32 W0 *
+* * W1 W2 W3 W4 *
+* * X0 X1 X2 X3 *
+* * X4 XXX1 XXX2 XXX3 *
+* * XXX4 Y0 Y1 Y2 *
+* * Y3 Y4 Z0 Z1 *
+* * Z2 Z3 Z4 _iob *
+* * alldone() bopact() bytepos clrbmap() *
+* * command devterm() dvifp dviterm() *
+* * eopact() fatal() font_entry fontptr *
+* * fprintf fseek() h hh *
+* * ht_rule i k kbinput() *
+* * lmargin m message movedown()*
+* * moveover() nosignex() preload prtbmap() *
+* * prtpage() quiet readfont() seen_bop *
+* * setchar() setfntnm() setrule() setstr() *
+* * signex() skipfont() sp special() *
+* * specstr sprintf() stack stack_entr*
+* * stderr tc tctos() tex_counte*
+* * tmargin v vv w *
+* * warning() wd_rule x y *
+* * z *
+* * *
+* readfont.h -> BYTE INT32 MALLOC() MAXSTR *
+* * NULL UNSIGN32 a c *
+* * d dvifp fatal() font_entry*
+* * font_k font_space fontptr getbytes()*
+* * hfontptr k l malloc() *
+* * n next nosignex() readfont()*
+* * reldfont() s strcpy() tfontptr *
+* * *
+* readgf.h -> BBNBITGRAP BYTE CANON_A2 COORDINATE*
+* * EOF FIRSTPXLCH FSEEK GFCHLOC *
+* * GFCHLOC0 GFEOF GFID GFNOOP *
+* * GFPOST GFPOSTPOST HPJETPLUS IMPRESS *
+* * INT32 LASTPXLCHA NPXLCHARS NULL *
+* * OS_VAXVMS PIXROUND() POSTSCRIPT UNSIGN16 *
+* * UNSIGN32 c ch char_entry*
+* * chargf() checksum designsize dx *
+* * dy fontfp fontptr fontrp *
+* * fseek() hppp magnificat max_m *
+* * max_n message min_m min_n *
+* * name newfont() nosignex() pxlw *
+* * readgf() s signex() sprintf() *
+* * tcharptr tfmw the_byte the_char *
+* * vppp warning() *
+* * *
+* readpk.h -> BBNBITGRAP BYTE CANON_A2 COORDINATE*
+* * EOF FSEEK FTELL HPJETPLUS *
+* * IMPRESS INT32 NPXLCHARS PIXROUND()*
+* * PKID PKPOST PKPRE POSTSCRIPT*
+* * REWIND() UNSIGN16 UNSIGN32 c *
+* * ch char_entry checksum designsize*
+* * dx dy end_of_pac flag_byte *
+* * fontfp fontptr fontrp fseek() *
+* * ftell() hp hppp magnificat*
+* * max_m max_n message min_m *
+* * min_n name newfont() nosignex()*
+* * packet_len pxlw readpk() s *
+* * signex() skpkspec() sprintf() start_of_p*
+* * tcharptr tfmw the_char vppp *
+* * warning() wp xoffp yoffp *
+* * *
+* readpost.h -> BYTE NEWLINE() POST RESOLUTION*
+* * STACKSIZE STDMAG USEGLOBALM _cnt *
+* * _flsbuf _iob _ptr actfact() *
+* * conv den dvifp fatal() *
+* * findpost() fprintf getfntdf() getpgtab()*
+* * lastpagept mag nosignex() num *
+* * preload putc() quiet readpost()*
+* * runmag stderr the_page_c *
+* * *
+* readpxl.h -> BBNBITGRAP BYTE CANON_A2 COORDINATE*
+* * EOF FIRSTPXLCH FSEEK HPJETPLUS *
+* * IMPRESS INT32 LASTPXLCHA NULL *
+* * OS_VAXVMS PIXROUND() POSTSCRIPT UNSIGN16 *
+* * UNSIGN32 c ch char_entry*
+* * checksum conv designsize fontfp *
+* * fontptr fontrp fseek() hp *
+* * magnificat message name newfont() *
+* * nosignex() pxlw rasters readpxl() *
+* * refcount s signex() sprintf() *
+* * tcharptr tfmw the_char warning() *
+* * wp xoffp yoffp *
+* * *
+* reldfont.h -> BYTE COORDINATE EOF FILE *
+* * FIRSTPXLCH FSEEK FT_GF FT_PK *
+* * FT_PXL GFID GFPRE INT32 *
+* * LASTPXLCHA MAGSIZE() NULL PKID *
+* * PKPRE PXLID RESOLUTION REWIND() *
+* * STDMAG UNSIGN16 UNSIGN32 USEGLOBALM*
+* * _iobuf actfact() ch char_entry*
+* * chargf() charpk() charpxl() charxx *
+* * d designsize dx dy *
+* * err_code fatal() font_entry font_mag *
+* * font_type fontfp fontrp fseek() *
+* * hp hppp mag max_m *
+* * max_n message min_m min_n *
+* * n name nosignex() openfont()*
+* * pfontptr pxlw rasters readgf() *
+* * readpk() readpxl() refcount reldfont()*
+* * runmag s sprintf() tcharptr *
+* * tfmw tfontptr the_char vppp *
+* * wp xoffp yoffp *
+* * *
+* rulepxl.h -> COORDINATE UNSIGN32 cnvfac n *
+* * number rulepxl() *
+* * *
+* setchar.h -> BOOLEAN BYTE COORDINATE DBGOPT() *
+* * DBG_OFF_PA DBG_SET_TE HOST_WORD_ INT32 *
+* * NEWLINE() XDPI XPSIZE XSIZE *
+* * YDPI YPSIZE YSIZE _B *
+* * _L _N _P _U *
+* * _cnt _ctype_ _flsbuf _iob *
+* * _ptr c ch char_entry*
+* * conv debug_code dispchar() fixpos() *
+* * fontptr fprintf h hh *
+* * isprint() lmargin moveto() n *
+* * putc() pxlw quiet setchar() *
+* * stderr tcharptr tfmw update_h *
+* * vv xoffp *
+* * *
+* setfntnm.h -> CANON_A2 HPJETPLUS IMPRESS INT32 *
+* * NULL POSTSCRIPT TRUE fatal() *
+* * font_entry font_switc fontptr hfontptr *
+* * k message next p *
+* * setfntnm() sprintf() *
+* * *
+* setrule.h -> BBNBITGRAP BOOLEAN INT32 UNSIGN32 *
+* * XDPI YDPI YPSIZE YSIZE *
+* * conv fillrect() fixpos() h *
+* * height hh lmargin rulepxl() *
+* * setrule() update_h vv width *
+* * xscreen yscreen *
+* * *
+* signex.h -> BYTE FILE INT32 OS_ATARI *
+* * OS_UNIX PCC_20 _cnt _filbuf *
+* * _iobuf _ptr fp getc() *
+* * n n1 number signex() *
+* * *
+* skgfspec.h -> BYTE FSEEK GFNOOP GFPOST *
+* * GFXXX1 GFXXX2 GFXXX3 GFXXX4 *
+* * GFYYY UNGETC fatal() fontfp *
+* * fontptr fseek() message name *
+* * nosignex() skgfspec() sprintf() the_byte *
+* * ungetc *
+* * *
+* skipfont.h -> BYTE INT32 MAXSTR a *
+* * dvifp getbytes() k l *
+* * n nosignex() skipfont() *
+* * *
+* skpkspec.h -> BYTE FSEEK PKNOOP PKPOST *
+* * PKXXX1 PKXXX2 PKXXX3 PKXXX4 *
+* * PKYYY UNGETC fatal() fontfp *
+* * fontptr fseek() message name *
+* * nosignex() skpkspec() sprintf() the_byte *
+* * ungetc *
+* * *
+* special.h -> message s special() sprintf() *
+* * warning() *
+* * *
+* strchr.h -> IBM_PC_MIC KCC_20 NULL OS_VAXVMS *
+* * c s strchr() *
+* * *
+* strrchr.h -> IBM_PC_MIC KCC_20 NULL OS_VAXVMS *
+* * c s strrchr() t *
+* * *
+* tctos.h -> INT16 k n s *
+* * sprintf() strrchr() tctos() tex_counte*
+* * *
+* typedefs.h -> BOOLEAN BYTE COORDINATE FALSE *
+* * IBM_PC_LAT INT16 INT32 INT8 *
+* * PCC_20 TRUE UNSIGN16 UNSIGN32 *
+* * *
+* usage.h -> APPLEIMAGE DEVICE_ID EPSON FILE *
+* * GOLDENDAWN HPLASERJET NEWLINE() POSTSCRIPT*
+* * TOSHIBAP13 VERSION_NO _cnt _flsbuf *
+* * _iobuf _ptr fp fprintf *
+* * g_progname helpcmd message putc() *
+* * sprintf() usage() *
+* * *
+* warning.h -> BBNBITGRAP DEBUG_OPEN FILE NEWLINE() *
+* * NULL OS_TOPS20 OS_VAXVMS _cnt *
+* * _flsbuf _iob _iobuf _ptr *
+* * dbgopen() fatal() fopen() fprintf *
+* * fputs g_dolog g_logfp g_logname *
+* * message msg putc() quiet *
+* * sprintf() stderr tctos() warning() *
+* * *
+*********************************************************************
diff --git a/dviware/beebe/src/dvialw.c b/dviware/beebe/src/dvialw.c
new file mode 100644
index 0000000000..729a94da5f
--- /dev/null
+++ b/dviware/beebe/src/dvialw.c
@@ -0,0 +1,1935 @@
+/* -*-C-*- dvialw.c */
+/*-->dvialw*/
+/**********************************************************************/
+/******************************* dvialw *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/***********************************************************************
+[23-Oct-87] Modify output so that on each page, fonts appear first,
+ followed by "save ...text... restore" sequences.
+ Current PostScript implementations on commercial
+ printers lack garbage collection, and strings consume
+ memory even after printing. The Apple LaserWriter and
+ LaserWriter Plus have only about 100Kb free for each
+ job, which at current memory prices is grossly
+ inadequate. Other PostScript printer vendors are
+ offering substantially more memory.
+
+ This feature is implemented not by time-consuming double
+ passes through the DVI file, but rather by having
+ setchar() and setstr() buffer their output, which is
+ dumped (with bracketing save/restore commands) either
+ when the buffer fills up, or when end-of-page is
+ reached. A buffer of 8Kb is adequate for this purpose
+ (based on a 100-page document (dvidriver.ltx) producing
+ a .dvi-alw file of 830Kb, of which 163Kb was font
+ definitions, giving an average text requirement of
+ 6.7Kb/page). These statistics were determined on Unix
+ by
+
+ awk '/^\[/,/^>/' foo.dvi-alw >foo.tmp
+ ls -l foo.*
+
+ Awk extracts the font definitions into the file foo.tmp,
+ and ls tells how big the files are. A similar test on
+ pages from the TeXBook found some pages needing up to
+ 11Kb of text.
+
+ Several new routines (putfontname(), text*()) and macros
+ (OUT_*) are introduced to support these changes. Some
+ care is needed when introducing new output sections to
+ call OUT_IMMEDIATE or OUT_DEFERRED, as appropropriate.
+ If this is not done, output will be in an incorrect
+ order.
+
+ Now that almost all output flows through a single
+ routine, textchr(), it is possible to monitor the output
+ to ensure that lines do not exceed PS_WIDTH. Text
+ output for the \special{} command is an exception to
+ this rule; it is transmitted exactly as found. Long
+ comments are continued with a trailing "-" followed by
+ "%-" on the next line. When textflush() empties the
+ text buffer, newlines preceding "(" (the commonest case)
+ are squeezed out, as long as this does not exceed the
+ line width limit. Font changes are shortened to F#
+ sequences, where # is the sequential number of the font
+ (1,2,...) in the dvi file. F0 is reserved for a
+ temporary font created inside a save/restore pair for a
+ large character.
+
+ Perhaps at some later date, we could sort the buffered
+ text by font type, and minimize font changing.
+
+[10-Dec-86] Fix off-by-one error in value of y-offset output in
+ character definition in loadchar(); this affects only
+ the combination of rules with characters, such as LaTeX
+ arrowheads. No other DVI drivers are affected by this.
+
+ Fix off-by-one error in size of rule; this involves no
+ code change here, only a change in dvialw.ps.
+ Examination of output rules under high power magnifier
+ shows that to draw a rule of width N dots, the bounding
+ box should have a width of N-1 dots; the boundary counts
+ toward the fill; this is not clear from the PostScript
+ manual.
+
+[13-Jun-86] Fix special()--a short plot file could result in
+ infinite loop in search for %%BoundingBox. Fixed
+ openfont() to output requested magnification as well as
+ substituted magnification.
+
+[19-Apr-86] Fix infinite loop in setstr(); BIGCHAR() forced exit
+ from character collection loop on first iteration, and
+ the current input character was stuffed back into the
+ input buffer. A big character should just suppress
+ downloading in the first loop.
+
+[12-Mar-86] Version 2.03 -- Major overhaul of PostScript output.
+ Removed most explicit PostScript commands to header file
+ dvialw.ps (in current directory), or if unavailable, the
+ system file texinputs:dvialw.ps (defined by symbols
+ PSDEF_PATH and PSDEF_FILE) which is copied to the output
+ file by new procedure cppsfile(), stripped of comments
+ and excess whitespace. References to these macros are
+ output instead. This makes parameter twiddling and
+ local customization much easier, and will allow users to
+ obtain a variety of page formats and orientations by
+ simple changes to personal copies of the header file.
+ The header file is heavily commented and should be
+ referred to for macro descriptions and an outline of the
+ general PostScript document format produced by DVIALW.
+
+ Removed variable-length argument lists to fatal() and
+ warning() for portability. Changed all preprocessor
+ #ifdef's and #ifndef's to #if's for portability; all
+ symbols for devices, operating systems, and
+ implementations are now explicitly defined to be 0 or 1.
+
+ Added procedures fontfile() and fontsub() to encapsulate
+ construction of system-dependent font file names and
+ provide for user-specifiable font substitutions for
+ unavailable font files.
+
+ Fonts and character definitions are now encapsulated in
+ compact macros. With help of Neal Holtz's DVI2PS and
+ TEX.PS, figured out how to define fonts with origin
+ along baseline, allowing output of several characters in
+ a single command (except where roundoff would make TeX
+ and PostScript positions disagree). New procedure
+ setstr() handles this. Font scaling is now 1 for normal
+ output, but can be changed to any other value if
+ PostScript is to rescale the bitmaps (slow). Tests show
+ a reduction of about 20% in total output file size.
+ When PS_SHORTLINES is defined, character bitmaps are
+ output one scan line per line, making them somewhat
+ readable, and avoiding long lines. Leaving them as one
+ long line could reduce the file size even further.
+ Added support for LaTeX invisible fonts; if you send a
+ bitmap of size 0 by 0 to the LaserWriter, all further
+ fonts are printed as blanks until you cycle the power.
+ No character definitions are loaded for such fonts.
+
+ Made reloading of fonts for each page an option "-v"; it
+ should now rarely be necessary. With large manuscripts,
+ avoiding reloading cuts the space by 60% or more, and
+ seems to be more successful at printing, averaging 30
+ sec/page and 700-780 char/sec (close to limit of 960
+ char/sec from 9600 baud serial line).
+
+ Removed old #ifdef FOOBAR ... #endif code sections in
+ several procedures which were completely obsolete.
+ Added header comment line to every file; it contains the
+ EMACS "-*-C-*-" mode string and the exact (case-sensive)
+ filename, since many functions have been defined with
+ names in mixed case for readability (probably should
+ have used underscore instead, but none do), and on Unix,
+ the letter case matters.
+
+ Replaced index() and rindex(), which have different
+ definitions in different C implementations, by 4.2BSD
+ (and coming ANSI C standard) functions strchr() and
+ strrchr(), for which .h files are provided.
+
+ To further reduce the PostScript output size, PostScript
+ interactive mode experiments determined that spaces are
+ not required around parentheses, brackets, or braces,
+ but ARE necessary between numbers and names. Thus the
+ sequences
+
+ [ <hexstring> # # # # # ] # D
+ (string) # # S
+
+ can be reduced to
+
+ [<hexstring># # # # #]# D
+ (string)# # S
+
+ saving 4 and 1 characters respectively for each use of
+ these commands. The PostScript file copy utility, LW78,
+ already reduces CR LF pairs to LF, so in the interests
+ of editability, we retain the former. Heavily-used
+ macros have also been redefined with single letter
+ names.
+
+[18-Jan-86] Version 2.02 -- Added macros to define new fonts (NF),
+ set fonts (SF), and define characters (CH) in main.h,
+ and use them in readfont.h and setchar(). Changed
+ setchar() to skip character loading when character is
+ not on page. Added setstr() to output several
+ characters at a time, instead of using setchar() for
+ each of them. These reduce the output file size
+ considerably. Moved character bitmap output code into
+ loadchar() where it should have been in the first place.
+ Added test for output errors (usually because disk
+ storage is exhausted) in main.h and prtpage.h.
+
+[20-Dec-85] Following recommendation of Allan Hetzel on LASER-LOVERS
+ ARPA BBOARD, added "() pop" at top of every page. This
+ selected by the switch PS_XONXOFFBUG:
+
+ --------------------------------------------------------
+ From: Allan Hetzel <SYSAL%UKCC.BITNET@WISCVM.ARPA>
+ Subject: Re: Apple Laserwriter XON/XOFF problem
+ To: <LASER-LOVERS@WASHINGTON.ARPA>
+
+ The note posted to Laser-Lovers on Oct 28 by Joseph
+ Goldstone of Symbolics Cambridge Research Center was
+ helpful but I didn't try his suggested fix correctly and
+ so I called Adobe. They were very helpful (much more so
+ than Apple) and explained the problem and how to bypass
+ it.
+
+ My apologies to Adobe if this not an accurate
+ description of the problem. The problem apparently is
+ due to the PostScript interpreter getting confused by
+ what it thinks is an excess of white space characters.
+
+ The bypass is to place a special character (parenthesis,
+ bracket, brace, slash, etc.) to the right of some token,
+ but without an intervening white space character. As the
+ PostScript scanner reads the token it also reads the
+ special character which acts as a delimiter. The scanner
+ then has to back up one character so that it can
+ reprocess the special character after it has processed
+ the preceding token. During this backing up process a
+ number of internal values are recalculated, including
+ some pointer into the input buffer. This causes the
+ XON/XOFF protocol to work properly. Doing this once per
+ page seems to keep everybody happy.
+
+ Each page in the PostScript file built by our word
+ processing program is surrounded by a "save restore"
+ sequence. We changed the beginning save sequence
+ "/saveobj save def" to read "/saveobj save def() pop".
+ The "() pop" is effectively a no-op and we are assured
+ that the necessary recalculations are done on each page.
+ This seems to have corrected the problem completely.
+
+ Allan Hetzel (sysal@ukcc.bitnet)
+ --------------------------------------------------------
+***********************************************************************/
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef POSTSCRIPT
+#define POSTSCRIPT 1 /* conditional compilation flag */
+
+#define PS_SIZELIMIT 150 /* characters larger than this */
+ /* many dots high get loaded with */
+ /* surrounding save/restore to */
+ /* get around PostScript bugs */
+
+#undef PS_XONXOFFBUG
+#define PS_XONXOFFBUG 1 /* Allen Hetzel's XON/XOFF bug fix */
+
+#ifndef PS_SHORTLINES
+#define PS_SHORTLINES 0 /* run with long output lines */
+#endif
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if PS_XONXOFFBUG
+#undef VERSION_NO
+#define VERSION_NO "2.10b" /* DVI driver version number */
+#endif
+
+
+#define DEVICE_ID "PostScript [Apple LaserWriter laser printer]"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "alw"
+
+#define MAXPSLINE 80 /* longest line in PSDEF_FILE */
+
+#define PSDEF_PATH subpath /* pathname of system header file */
+#define PSDEF_FILE "dvialw.ps" /* name of header file */
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* to get standard font resolution */
+
+#undef MAXOPEN
+#define MAXOPEN 12 /* limit on number of open files */
+
+#define MAXLINE 4096 /* maximum input file line size */
+ /* it is needed only in special() */
+
+#define XDPI 300 /* horizontal dots/inch */
+#define XPSIZE 14 /* horizontal paper size in inches */
+ /* (allow for landscape paper) */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+
+#define YDPI 300 /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+
+#if PS_SHORTLINES
+
+#ifndef PS_MAXWIDTH
+#define PS_MAXWIDTH 72 /* output never exceeds this width */
+#endif
+
+INT16 out_width; /* current line width */
+
+#endif /* PS_SHORTLINES */
+
+/***********************************************************************
+The following variables and macros implement the buffering of PostScript
+output so that output size can be reduced by removing unneeded
+separators, and so that a maximum line width can be enforced, except for
+code from special{}, which must be output verbatim.
+
+All PostScript output filters through textchr() at the lowest level, and
+on the basis of the `deferred' flag setting, it either defers output of
+its argument character by buffering it in textbuf[], or it outputs it
+immediately with putc().
+
+Because PostScript line breaking conventions are context sensitive,
+textchr() maintains static variables to keep track of the output state
+(comment, text, or string). It also handles all end-of-line
+translations, so \n can be used for end-of-line everywhere else.
+
+All output calls outside the text*() routines are done through macros
+OUT_*, and to shorten coding, OUT_NUM provides a trailing delimiting
+space.
+
+textbuf[] is allocated dynamically on the first call to devinit() so as
+not to consume space in the executable program disk file.
+
+textflush() is called by textchr() when textbuf[] fills up, and by
+eopact() at end-of-page.
+
+***********************************************************************/
+
+#define MAXTEXT 16384 /* size of textbuf[] buffer */
+
+static char* textbuf = (char*)NULL; /* buffer for setchar() and setstr() */
+static char* ptext; /* next position in textbuf[] */
+static BOOLEAN deferred; /* deferred output status flag */
+static UNSIGN16 last_font_number; /* set by loadchar() */
+
+#if PS_SHORTLINES
+static BOOLEAN is_comment = FALSE;
+static BOOLEAN is_text = FALSE;
+static BOOLEAN is_string = FALSE;
+#endif /* PS_SHORTLINES */
+
+#define OUT_CHR(c) textchr((char)c)
+
+#define OUT_DEFERRED {deferred = TRUE;}
+
+#define OUT_FLT(fmt,flt) {\
+ char s[25];\
+ (void)sprintf(s,fmt,flt);\
+ OUT_STR(s);}
+
+#define OUT_FONTNAME {\
+ char s[11];\
+ (void)sprintf(s,"F%d",fontptr->font_number);\
+ OUT_STR(s);}
+
+#define OUT_IMMEDIATE {deferred = FALSE;}
+
+#define OUT_NL OUT_CHR('\n')
+
+#define OUT_NUM(n) textnum((long)(n))
+
+#define OUT_STR(s) textstr(s)
+
+#define OUT_XCHR(c) emitchar(c)
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->bopact*/
+/**********************************************************************/
+/******************************* bopact *******************************/
+/**********************************************************************/
+
+void
+bopact() /* beginning of page action */
+{
+ INT16 page_number; /* TeX's \count0 parameter */
+
+ page_number = (INT16)tex_counter[0];
+
+ if (cur_page_number <= MAXPAGE)
+ {
+ (void)fflush(plotfp);
+ page_loc[cur_page_number] = (long)FTELL(plotfp);
+ page_tex[cur_page_number] = (INT32)page_number;
+ }
+ OUT_IMMEDIATE;
+ OUT_STR("%%Page: ");
+ OUT_NUM(page_number);
+ OUT_NUM(cur_page_number);
+ OUT_NL;
+ if (ps_vmbug)
+ OUT_STR("/SaveImage save def() pop\n");
+ OUT_STR("BOP\n");
+
+ rule_height = -1; /* reset last rule parameters */
+ rule_width = -1;
+ str_ycp = -1; /* last string ycp */
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrrow.h"
+
+/*-->cppsfile*/
+/**********************************************************************/
+/****************************** cppsfile ******************************/
+/**********************************************************************/
+
+void
+cppsfile() /* Copy PostScript header file to output */
+{ /* discarding comments and collapsing whitespace */
+ register int c; /* input character */
+ register int k; /* index in line[] */
+ FILE *psfp; /* PostScript macro definition file */
+ char fname[MAXFNAME];
+ char line[MAXPSLINE+1]; /* extra space for NUL */
+
+ /* Try private version of header file first, and if that fails, use */
+ /* system version. Tell the user when a private version is selected. */
+
+ OUT_IMMEDIATE;
+ (void)strcpy(fname,PSDEF_FILE);
+ psfp = fopen(fname,"r");
+ DEBUG_OPEN(psfp,fname,"r");
+ if (psfp == (FILE *)NULL)
+ {
+ (void)strcpy(fname,PSDEF_PATH);
+ (void)strcat(fname,PSDEF_FILE);
+ psfp = fopen(fname,"r");
+ DEBUG_OPEN(psfp,fname,"r");
+ if (psfp == (FILE *)NULL)
+ {
+ (void)sprintf(message,
+ "cppsfile(): Cannot open PostScript definition file [%s]",
+ fname);
+ (void)fatal(message);
+ }
+ }
+ else if (!quiet)
+ {
+ (void)fprintf(stderr,"[Using private PostScript definition file [%s]]",
+ fname);
+ NEWLINE(stderr);
+ }
+
+ k = 0;
+ while ((c = getc(psfp)) != EOF)
+ {
+ if (c == '%') /* flush comments to (but not including) end-of-line */
+ {
+ while (((c = getc(psfp)) != EOF) && (c != '\n'))
+ ; /* flush to end-of-line or end-of-file */
+ c = '\n'; /* to force line output */
+ line[k++] = '\n';
+ }
+ else if ((c == ' ') || (c == '\t') || (c == '\f'))
+ { /* have whitespace */
+ if (k) /* then not at beginning of line */
+ line[k++] = ' '; /* so save only one blank */
+ while (((c == ' ') || (c == '\t') || (c == '\f')) && (c != EOF))
+ c = getc(psfp); /* discard following whitespace */
+ ungetc(c,psfp); /* put back lookahead */
+ }
+ else if (c != '\r') /* save all but CR */
+ line[k++] = (char)c;
+
+ if ((c == '\n') || (c == EOF) || (k >= MAXPSLINE))
+ {
+ if (c == '\n') /* discard LF */
+ k--;
+ while ((k > 0) && (line[k-1] == ' ')) /* and trailing blanks */
+ k--;
+ line[k] = '\0';
+ if (k > 0) /* non-empty line */
+ {
+ OUT_STR(line);
+ OUT_NL;
+ }
+ k = 0;
+ }
+ }
+
+ while ((k > 0) && (line[k-1] == ' ')) /* discard trailing blanks */
+ k--;
+ line[k] = '\0';
+ if (k > 0) /* non-empty line */
+ {
+ OUT_STR(line);
+ OUT_NL;
+ }
+
+ (void)fclose(psfp);
+}
+
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ register INT16 k; /* loop index */
+ char timestring[26]; /* "wkd mon dd hh:mm:ss 19yy\n" */
+ long timeval; /* clock value from time() for ctime() */
+
+ if (textbuf == (char*)NULL)
+ { /* allocate textbuf[] only once */
+ textbuf = (char*)MALLOC((unsigned)(MAXTEXT+1));
+ if (textbuf == (char*)NULL)
+ (void)fatal("Cannot allocate memory for textbuf[]");
+ }
+
+ ptext = textbuf;
+
+ OUT_IMMEDIATE; /* need immediate output here */
+ OUT_STR("%!\n"); /* magical file header */
+ OUT_STR("%%Dimensions: 0 0 612 792\n"); /* 8.5 x 11 inch page size */
+
+ OUT_STR("%%Title: ");
+ OUT_STR(argv[0]); /* start of our command line */
+ for (k = 1; k < (INT16)argc; ++k)
+ {
+ OUT_CHR(' ');
+ OUT_STR(argv[k]);
+ }
+ OUT_NL; /* end of %%Title line */
+
+ timeval = time((long*)NULL);
+ (void)strcpy(timestring,ctime(&timeval));
+ timestring[24] = '\0'; /* kill stupid \n from ctime() */
+
+ OUT_STR("%%CreationDate: ");
+ OUT_STR(timestring);
+ OUT_NL;
+ OUT_STR("%%Creator: ");
+ OUT_STR((cuserid((char*)NULL) == (char*)NULL) ? "" : cuserid((char*)NULL));
+ OUT_STR(" and [TeX82 DVI Translator Version ");
+ OUT_STR(VERSION_NO);
+ OUT_STR(" for ");
+ OUT_STR(DEVICE_ID);
+ OUT_NL;
+
+ OUT_STR("%%Pages: (atend)\n");
+
+ if (ps_vmbug)
+ {
+ OUT_STR("%%BugHistory: Incorporates save/restore and font");
+ OUT_STR(" reloading for each page as PS Version 23.0");
+ OUT_STR(" \"VM error\" bug workaround\n");
+ }
+
+#if PS_XONXOFFBUG
+ OUT_STR("%%BugHistory: Incorporates Allan Hetzel\'s 31-Oct-85");
+ OUT_STR(" DARPA LASER-LOVERS PS Version 23.0 X-on/X-off");
+ OUT_STR(" bug workaround\n");
+#endif /* PS_XONXOFFBUG */
+
+ OUT_STR("%%EndComments\n");
+ OUT_STR("%%EndProlog\n");
+ font_switched = TRUE;
+
+ (void)cppsfile(); /* copy standard PostScript definitions */
+
+ OUT_STR("TeXdict begin\n");
+ OUT_STR("BOJ\n");
+
+ /* TB and TE (Text Begin and Text End) are save/restore sequences;
+ they are used when textflush() has to empty its current buffer. */
+
+ OUT_STR("/TB {save} bdf\n");
+ OUT_STR("/TE {restore} bdf\n");
+
+#if 0
+ OUT_STR("/TE {currentpoint 3 -1 roll restore moveto} bdf\n");
+#endif
+
+ /* BB and BE (Big character Begin and End) are save/restore
+ sequences that create a temporary font and set a character
+ inside a save/restore pair. */
+ OUT_STR("/BB {save /F0 NF 1 /F0 SF} bdf\n");
+ OUT_STR("/BE {restore} bdf\n");
+
+ font_count = 0; /* no font numbers are assigned yet */
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ register INT16 k; /* loop index */
+
+ OUT_IMMEDIATE;
+ OUT_STR("EOJ\n");
+ OUT_STR("%%Trailer\n");
+ OUT_STR("%%Pages: ");
+ OUT_NUM(page_count);
+ OUT_NL;
+ OUT_STR("%%PageTable: ");
+
+ for (k = 1; k <= MIN(MAXPAGE,cur_page_number); ++k)
+ {
+ OUT_NUM(page_tex[k]);
+ OUT_NUM(k);
+ OUT_NUM(page_loc[k]);
+ }
+
+ OUT_NL;
+ OUT_CHR('\004'); /* PostScript end-of-job signal */
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+
+/*-->emitchar*/
+/**********************************************************************/
+/****************************** emitchar ******************************/
+/**********************************************************************/
+
+void
+emitchar(c) /* output string character with */
+register BYTE c; /* escapes and octal as necessary */
+{
+
+ /* we do our own octal formatting for speed */
+ static char octalchars[] = "01234567";
+
+#define OCTAL(b) octalchars[((b) & 07)]
+
+#if PS_SHORTLINES
+ if (!deferred && ((out_width + 4) >= (PS_MAXWIDTH-1)))
+ {
+ OUT_CHR('\\'); /* PostScript ignores */
+ OUT_NL; /* backslash-newline sequences */
+ }
+#endif /* PS_SHORTLINES */
+
+ if (isprint(c) &&
+ /* [textchr() requires the following restrictions] */
+ !((c == ' ' ) || (c == '%') || (c == '(') || (c == ')') ||
+ (c == '<') || (c == '>'))) /* character is printable */
+ {
+ if (c == '\\') /* double backslashes */
+ OUT_CHR('\\');
+ OUT_CHR(c);
+ }
+ else /* use octal form */
+ {
+ OUT_CHR('\\');
+ OUT_CHR(OCTAL(c >> 6));
+ OUT_CHR(OCTAL(c >> 3));
+ OUT_CHR(OCTAL(c));
+ }
+}
+
+/*-->eopact*/
+/**********************************************************************/
+/******************************* eopact *******************************/
+/**********************************************************************/
+
+void
+eopact() /* end of page action */
+{
+ register INT32 k; /* loop index */
+
+ textflush(); /* output accumulated text */
+ OUT_IMMEDIATE;
+ OUT_NUM(copies);
+ OUT_STR("EOP\n");
+
+ if (ps_vmbug)
+ {
+ OUT_STR("SaveImage restore() pop\n");
+ font_switched = TRUE;
+ fontptr = hfontptr;
+ while (fontptr != (struct font_entry *)NULL)
+ {
+ for (k = 0; k < NPXLCHARS; ++k)
+ fontptr->ch[k].isloaded = FALSE;
+ fontptr = fontptr->next;
+ }
+ }
+
+ for (k = (INT32)copies; k; --k)
+ OUTC('\f'); /* FF's for simple page accounting */
+}
+
+#include "f20open.h"
+#include "fatal.h"
+
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner, draw a filled
+rectangle at (x,y).
+
+For most TeX uses, rules are uncommon, and little optimization is
+possible. However, for the LaTeX Bezier option, curves are simulated by
+many small rules (typically 2 x 2) separated by positioning commands.
+By remembering the size of the last rule set, we can test for the
+occurrence of repeated rules of the same size, and reduce the output by
+omitting the rule sizes. The last rule parameters are reset by the
+begin-page action in prtpage(), so they do not carry across pages.
+
+It is not possible to use relative, instead of absolute, moves in these
+sequences, without stacking rules for the whole page, because each rule
+is separated in the DVI file by push, pop, and positioning commands,
+making for an uncertain correspondence between internal (xcp,ycp)
+pixel page coordinates and external device coordinates.
+***********************************************************************/
+
+{
+ str_ycp = -1; /* invalidate string y coordinate */
+
+ OUT_IMMEDIATE; /* because Q uses width and height saved */
+ OUT_NUM(x); /* by B, we cannot use deferred output; */
+ OUT_NUM(y); /* otherwise a TB B TE TB Q TE would fail */
+ if ((height != rule_height) || (width != rule_width))
+ {
+ OUT_CHR('M');
+ OUT_CHR(' ');
+ OUT_NUM(width);
+ OUT_NUM(height);
+ OUT_CHR('B');
+ OUT_CHR(' ');
+ rule_width = width; /* save current rule parameters */
+ rule_height = height;
+ }
+ else
+ {
+ OUT_CHR('Q');
+ OUT_CHR(' ');
+ }
+}
+
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+
+/*-->loadchar*/
+/**********************************************************************/
+/****************************** loadchar ******************************/
+/**********************************************************************/
+
+void
+loadchar(c)
+register BYTE c;
+{
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c)) /* check character range */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr))
+ return; /* do nothing for invisible fonts */
+
+ if (fontptr != pfontptr)
+ openfont(fontptr->n);
+
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ tcharptr->isloaded = TRUE;
+
+ clearerr(plotfp); /* VMS sets the error flag unexpectedly */
+
+ OUT_IMMEDIATE;
+ OUT_STR("[<");
+
+ /* Bug workaround: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* output rasters */
+
+ OUT_CHR('>');
+ OUT_NUM(tcharptr->xoffp);
+ OUT_NUM((tcharptr->yoffp)+1);
+ OUT_NUM(tcharptr->wp);
+ OUT_NUM(tcharptr->hp);
+ OUT_FLT("%.7f]",(float)(tcharptr->tfmw)*conv)
+ OUT_NUM(c);
+ OUT_CHR('D');
+
+#if PS_SHORTLINES
+ OUT_CHR(' ');
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ /* Because of the deferred output feature, we now need to remember
+ the last font used, so on the next call, we know whether to
+ issue another OUT_FONTNAME or not. font_switched is no longer
+ sufficient.
+ */
+ last_font_number = fontptr->font_number;
+
+ if (DISKFULL(plotfp))
+ (void)fatal("loadchar(): Output error -- disk storage probably full");
+}
+
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+
+/*-->newfont*/
+/**********************************************************************/
+/****************************** newfont *******************************/
+/**********************************************************************/
+
+void
+newfont()
+{
+ register UNSIGN16 the_char; /* loop index */
+ char s[MAXSTR];
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ fontptr->ch[the_char].isloaded = FALSE;
+
+ font_count++;
+ fontptr->font_number = font_count;
+
+ OUT_IMMEDIATE;
+
+ (void)sprintf(s,"/%s NF %% %s\n",putfontname(fontptr),
+ fontptr->name);
+ OUT_STR(s); /* declare new font for PostScript */
+
+ (void)sprintf(s,"/F%d {1 /%s SF} bdf\n",
+ fontptr->font_number,putfontname(fontptr));
+ OUT_STR(s); /* compact shorthand for font changes */
+}
+
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outrow*/
+/**********************************************************************/
+/******************************* outrow *******************************/
+/**********************************************************************/
+
+void
+outrow(c,yoff) /* output img_row[] to device */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) (UNUSED here) */
+{
+ UNSIGN16 bytes_per_row; /* number of raster bytes to copy */
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte; /* unpacked raster byte */
+
+ /* we do our own hexadecimal formatting for speed */
+ static char hexchars[] = "0123456789ABCDEF";
+
+#define NIBBLE(b) hexchars[(b) & 0x0f]
+
+ tcharptr = &(fontptr->ch[c]); /* assume check for valid c has been done */
+ bytes_per_row = (UNSIGN16)((tcharptr->wp) + 7) >> 3; /* wp div 8 */
+ p = img_row; /* we step pointer p along img_row[] */
+
+ for (k = bytes_per_row; k > 0; ++p)
+ {
+
+ the_byte = (BYTE)((*p) >> 24);
+ OUT_CHR(NIBBLE(the_byte>>4));
+ OUT_CHR(NIBBLE(the_byte));
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 16);
+ OUT_CHR(NIBBLE(the_byte>>4));
+ OUT_CHR(NIBBLE(the_byte));
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 8);
+ OUT_CHR(NIBBLE(the_byte>>4));
+ OUT_CHR(NIBBLE(the_byte));
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)(*p);
+ OUT_CHR(NIBBLE(the_byte>>4));
+ OUT_CHR(NIBBLE(the_byte));
+ if ((--k) <= 0)
+ break;
+ }
+
+#if PS_SHORTLINES
+ /* line breaking handled by textchr() */
+#else
+ k = 40 / MAX(1,bytes_per_row); /* rows per 80-character line */
+ /* break after last row, or whenever an 80-character line has
+ been filled up */
+ if (((yoff+1) == tcharptr->hp) || (((yoff+1) % k) == 0))
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+}
+
+#include "prtpage.h"
+
+/*-->putfontname*/
+/**********************************************************************/
+/**************************** putfontname *****************************/
+/**********************************************************************/
+
+char*
+putfontname(font_ptr)
+register struct font_entry *font_ptr;
+/* Output TeX font name and magnification in form "cmr10_1500" as a
+unique PostScript font identifier */
+{
+ register char* nameptr;
+ register char* p;
+ static char namebuf[MAXSTR];
+
+ nameptr = &(font_ptr->n[0]);
+ p = namebuf;
+
+ while (*nameptr) /* make name with non-alphanumerics */
+ { /* changed to underscore for PostScript */
+ *p++ = isalnum(*nameptr) ? *nameptr : '_';
+ nameptr++;
+ }
+
+ (void)sprintf(p,"_%d",(int)font_ptr->magnification);
+
+ return (&namebuf[0]);
+}
+
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ /* BIGCHAR() and ONPAGE() are used here and in setstr() */
+
+#define BIGCHAR(t) ((t->wp > (COORDINATE)size_limit) ||\
+ (t->hp > (COORDINATE)size_limit))
+
+#define ONPAGE(t) (((hh - t->xoffp + t->pxlw) <= XSIZE) \
+ && (hh >= 0)\
+ && (vv <= YSIZE)\
+ && (vv >= 0))
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+ if (ONPAGE(tcharptr))
+ { /* character fits entirely on page */
+ if (VISIBLE(tcharptr))
+ {
+ if (BIGCHAR(tcharptr))
+ {
+ /* always need absolute coordinates (save/restore causes */
+ /* loss of updated position) */
+ OUT_IMMEDIATE;
+
+#if PS_SHORTLINES
+ /* line breaking handled by textchar() */
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ OUT_STR("BB");
+
+#if PS_SHORTLINES
+ OUT_CHR(' ');
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ loadchar(c);
+ OUT_CHR('(');
+ OUT_XCHR(c);
+ OUT_CHR(')');
+ OUT_NUM(xcp);
+ OUT_NUM(ycp);
+ OUT_CHR('S');
+
+#if PS_SHORTLINES
+ OUT_CHR(' ');
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ OUT_STR("BE");
+
+#if PS_SHORTLINES
+ /* line breaking handled by textchar() */
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ tcharptr->isloaded = FALSE; /* 'unload' character */
+ }
+ else
+ {
+ if (!tcharptr->isloaded)
+ {
+ if ((font_switched) ||
+ (fontptr->font_number != last_font_number))
+ {
+ OUT_IMMEDIATE;
+ OUT_FONTNAME;
+ }
+ loadchar(c);
+ }
+ OUT_DEFERRED;
+ if (font_switched)
+ {
+ OUT_FONTNAME;
+ font_switched = FALSE;
+ }
+ OUT_CHR('(');
+ OUT_XCHR(c);
+ OUT_CHR(')');
+ if (ycp != str_ycp)
+ {
+ OUT_NUM(xcp);
+ OUT_NUM(ycp);
+ OUT_STR("S\n");
+ str_ycp = ycp;
+ }
+ else
+ {
+ OUT_NUM(xcp);
+ OUT_STR("T\n");
+ }
+ }
+
+ }
+ }
+ else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
+ { /* character is off page -- discard it */
+ (void)fprintf(stderr,
+ "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
+ isprint(c) ? c : '?',c,c,c);
+ NEWLINE(stderr);
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
+
+#include "setfntnm.h"
+#include "setrule.h"
+
+/*-->setstr*/
+/**********************************************************************/
+/******************************* setstr *******************************/
+/**********************************************************************/
+
+void
+setstr(c)
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register BOOLEAN inside;
+ COORDINATE xcp_start,ycp_start; /* starting coordinates of string */
+ INT32 h0,v0; /* (h,v) at entry */
+ COORDINATE hh0,vv0; /* (hh,vv) at entry */
+ register UNSIGN16 k; /* loop index */
+ UNSIGN16 maxstr; /* loop limit */
+ UNSIGN16 nstr; /* number of characters in str[] */
+ BOOLEAN save_font_switched; /* for saving font_switched value */
+ BYTE str[MAXSTR+1]; /* string accumulator */
+ BOOLEAN truncated; /* off-page string truncation flag */
+
+ /*******************************************************************
+ Set a sequence of characters in SETC_000 .. SETC_127 with a minimal
+ number of PostScript print-string commands. These sequences tend to
+ occur in long clumps in a DVI file, and setting them together
+ whenever possible substantially decreases the PostScript overhead
+ and the size of the output file. A sequence can be set as a single
+ string if
+
+ * TeX and PostScript coordinates of each character agree (always
+ true since PostScript has high-precision character widths
+ available; for non-PostScript devices, violation of this
+ requirement can be detected if fixpos() changes hh, or if ycp
+ != ycp_start), AND
+
+ * each character is in the same font (this will always be true
+ in a sequence from a DVI file), AND
+
+ * each character fits within the page boundaries, AND
+
+ * each character definition is already loaded, AND
+
+ * each character is from a visible font, AND
+
+ * each character bitmap extent is smaller than the size_limit
+ (which is used to enable discarding large characters after
+ each use in order to conserve virtual memory storage on the
+ output device).
+
+ Whenever any of these conditions does not hold, any string already
+ output is terminated, and a new one begun. In order to avoid output
+ of empty string requests, a flag "inside" is set when a string
+ opener "(" is output, and unset when the string terminator ") x y S"
+ or ") P" is output.
+
+ Two output optimizations are implemented here. First, up to MAXSTR
+ (in practice more than enough) characters are collected in str[],
+ and any that require downloading are handled. Then the entire
+ string is set at once, subject to the above limitations. Second, by
+ recording the vertical page coordinate, ycp, in the global variable
+ str_ycp (reset in prtpage() at begin-page processing), it is
+ possible to avoid outputting y coordinates unnecessarily, since a
+ single line of text will generally result in many calls to this
+ function.
+ *******************************************************************/
+
+#define BEGINSTRING {inside = TRUE;\
+ xcp_start = xcp;\
+ ycp_start = ycp;\
+ OUT_CHR('(');}
+
+#define ENDSTRING {inside = FALSE;\
+ OUT_CHR(')');\
+ if (ycp == str_ycp)\
+ {\
+ OUT_NUM(xcp_start);\
+ OUT_STR("T\n");\
+ }\
+ else\
+ {\
+ OUT_NUM(xcp_start);\
+ OUT_NUM(ycp_start);\
+ OUT_STR("S\n");\
+ str_ycp = ycp;\
+ }}
+
+#define OFF_PAGE (-32767) /* off-page coordinate value */
+
+ inside = FALSE;
+ truncated = FALSE;
+ OUT_IMMEDIATE;
+
+ hh0 = hh;
+ vv0 = vv;
+ h0 = h;
+ v0 = v;
+ save_font_switched = font_switched;
+ nstr = 0;
+
+#if PS_SHORTLINES
+ /* With deferred output, textflush() cannot do any output parsing,
+ so to avoid long lines, we allow at most a string
+ "(...)nnnnn nnnnn S" on one line. */
+ maxstr = MIN(PS_MAXWIDTH-15,MAXSTR);
+#else
+ maxstr = MAXSTR;
+#endif /* PS_SHORTLINES */
+
+ while ((SETC_000 <= c) && (c <= SETC_127) && (nstr < maxstr))
+ { /* collect character sequence and download needed fonts */
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if ((!tcharptr->isloaded) && (!BIGCHAR(tcharptr)))
+ {
+ if (font_switched ||
+ (fontptr->font_number != last_font_number))
+ {
+ OUT_FONTNAME;
+ font_switched = FALSE;
+ }
+ loadchar(c);
+ }
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+
+ str[nstr++] = c; /* save string character */
+
+ c = (BYTE)nosignex(dvifp,(BYTE)1);
+ }
+
+ /* put back character which terminated the loop */
+ (void)UNGETC((int)(c),dvifp);
+
+ hh = hh0; /* restore coordinates at entry */
+ vv = vv0;
+ h = h0;
+ v = v0;
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setstr(\"");
+ for (k = 0; k < nstr; ++k)
+ {
+ c = str[k];
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ }
+ (void)fprintf(stderr,"\") (hh,vv) = (%ld,%ld) font name <%s>",
+ (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ OUT_DEFERRED;
+ font_switched = save_font_switched;
+ if (font_switched)
+ {
+ OUT_FONTNAME;
+ OUT_NL; /* string might not be visible */
+ font_switched = FALSE;
+ }
+
+ for (k = 0; k < nstr; ++k)
+ { /* now set the collected characters */
+ c = str[k];
+ tcharptr = &(fontptr->ch[c]);
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if (tcharptr->isloaded) /* character already downloaded */
+ {
+ if (!inside)
+ BEGINSTRING;
+ OUT_XCHR(c);
+ }
+ else /* must be big character (others are already downloaded) */
+ {
+ if (inside)
+ ENDSTRING; /* finish any open string */
+ if (BIGCHAR(tcharptr))
+ { /* Large character to be discarded. */
+ /* Inside save/restore, updated current point */
+ /* is lost, so we must force absolute positioning */
+ /* by resetting str_ycp before and after setting */
+ /* the character. */
+ str_ycp = OFF_PAGE;
+ OUT_IMMEDIATE;
+
+#if PS_SHORTLINES
+ /* line breaking handled by textchar() */
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ OUT_STR("BB");
+
+#if PS_SHORTLINES
+ OUT_CHR(' ');
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ loadchar(c);
+ BEGINSTRING;
+ OUT_XCHR(c);
+ ENDSTRING;
+ OUT_STR("BE");
+
+#if PS_SHORTLINES
+ OUT_CHR(' ');
+#else
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ OUT_CHR(' ');
+ OUT_DEFERRED;
+ tcharptr->isloaded = FALSE; /* 'unload' character */
+ str_ycp = OFF_PAGE;
+ }
+ }
+ }
+ else /* character does not fit on page -- output */
+ { /* current string and discard the character */
+ truncated = TRUE;
+ if (inside)
+ ENDSTRING;
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+ if (truncated && DBGOPT(DBG_OFF_PAGE) && !quiet)
+ {
+ (void)fprintf(stderr,"setstr(): Text [");
+ for (k = 0; k < nstr; ++k)
+ (void)fprintf(stderr,isprint(str[k]) ? "%c" : "\\%03o",str[k]);
+ (void)fprintf(stderr,"] truncated at page boundaries.");
+ NEWLINE(stderr);
+ }
+
+ if (inside) /* finish last string */
+ ENDSTRING;
+}
+
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+
+/*-->special*/
+/**********************************************************************/
+/****************************** special *******************************/
+/**********************************************************************/
+
+void
+special(s) /* process TeX \special{} string in s[] */
+register char *s;
+{
+ char line[MAXLINE+2];
+ FILE *specfile;
+ BOOLEAN abspos;
+ INT16 k;
+ int llx,lly,urx,ury; /* must be int for sscanf() */
+ struct stat statbuf; /* so fstat() can get file size */
+
+/***********************************************************************
+The TeX \special{} command is expected to look like
+
+ \special{overlay filename} % absolute positioning
+ or
+ \special{include filename} % relative positioning
+ or
+ \special{insert filename} % relative positioning
+
+In the first case, the PostScript file to be included will be mapped
+onto the page at precisely the coordinates it specifies. In the other
+two cases, the upper-left corner of the bounding box will be placed at
+the current point. The PostScript file must then contain (usually near
+the start) a comment of the form
+
+%%BoundingBox: llx lly urx ury
+
+specifying the bounding box lower-left and upper-right coordinates in
+standard PostScript units (1/72 inch). Alternatively, if the comment
+
+%%BoundingBox: (atend)
+
+is found in the file, the last 1000 characters of the file will be
+searched to find a comment of the form:
+
+%%BoundingBox: llx lly urx ury
+
+If the PostScript file cannot be opened, or the \special{} command
+string cannot be recognized, or for relative positioning, the bounding
+box cannot be determined, a warning message is issued and the \special
+command is ignored.
+
+Otherwise, the section of the PostScript file between the comment lines
+
+%begin(plot)
+%end(plot)
+
+is copied to the output file surrounded by
+
+save
+300 72 div 300 72 div scale % revert to standard 1/72 inch units
+(xcp(in 1/72in)-llx) (ycp(in 1/72in)-ury) translate % if relative positioning
+...PostScript file contents...
+restore
+
+***********************************************************************/
+
+ clearerr(plotfp); /* VMS sets the error flag unexpectedly */
+
+ if (strncmp("overlay ",s,8) == 0)
+ {
+ k = 8;
+ abspos = TRUE;
+ }
+ else if (strncmp("include ",s,8) == 0)
+ {
+ k = 8;
+ abspos = FALSE;
+ }
+ else if (strncmp("insert ",s,7) == 0)
+ {
+ k = 7;
+ abspos = FALSE;
+ }
+ else
+ {
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "[TeX \\special{%s} command not understood]",s);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"Expected one of:");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "\t\\special{overlay filename} [relative to page origin in ");
+ (void)fprintf(stderr,
+ "lower-left corner]");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"or");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "\t\\special{insert filename} [relative to current position]");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"or");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "\t\\special{include filename} [relative to current position]");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"\\special{%s} request ignored",s);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(stderr);
+ return;
+ }
+ specfile = fopen(&s[k],"r");
+ DEBUG_OPEN(specfile,&s[k],"r");
+ if (specfile == (FILE *)NULL)
+ {
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "Open failure on \\special file [%s]",&s[k]);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"\\special{%s} request ignored",s);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(stderr);
+ return;
+ }
+ if (abspos)
+ {
+ llx = lly = 0;
+ urx = (72*17)/2;
+ ury = 72*11;
+ }
+ else
+ {
+ llx = lly = urx = ury = -1;
+ while (fgets(line,MAXLINE,specfile) != (char *)NULL)
+ {
+ llx = lly = urx = ury = -1;
+ if (strncmp(line,"%%BoundingBox: (atend)",22) == 0)
+ { /* reposition to up to 1000 chars from end of file */
+ (void)fstat(fileno(specfile),&statbuf);
+ k = MIN(1000,(INT16)((long)statbuf.st_size-ftell(specfile)));
+ if (k > 0)
+ (void)fseek(specfile,(long)(-k),2);
+ }
+ else if (strncmp(line,"%%BoundingBox:",14) == 0)
+ {
+ k = (INT16)sscanf(line,
+ "%%%%BoundingBox: %d %d %d %d",&llx,&lly,&urx,&ury);
+ if (k == 4)
+ break; /* got %%BoundingBox */
+ }
+ }
+ }
+ if (ury == (-1))
+ {
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "Could not find PostScript %%%%BoundingBox command ");
+ (void)fprintf(stderr,"needed to position plot on page");
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"\\special{%s} request ignored",s);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(stderr);
+ return;
+ }
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"\t[\\special{%s}] ",s);
+ NEWLINE(stderr);
+
+ OUT_IMMEDIATE;
+ OUT_STR("save\n"); /* save current state */
+
+ OUT_STR("300 72 div 300 72 div scale\n"); /* revert to standard units */
+
+ if (!abspos) /* move origin for include/insert */
+ {
+ moveto(hh,YSIZE-vv); /* update current point */
+ OUT_NUM((72*xcp)/300-llx);
+ OUT_NUM((72*ycp)/300-ury);
+ OUT_STR("translate\n");
+ }
+ (void)REWIND(specfile); /* rewind file */
+
+ while (fgets(line,MAXLINE,specfile) != (char *)NULL)
+ { /* search for %begin(plot) ... %end(plot) */
+ if (strncmp(line,"%begin(plot)",12) == 0)
+ { /* copy until %end(plot) */
+ while (fgets(line,MAXLINE,specfile) != (char *)NULL)
+ {
+ if (strncmp(line,"%end(plot)",10) == 0)
+ break;
+ OUTS(line);
+ }
+ break;
+ }
+ }
+ OUT_STR("restore\n");
+ (void)fclose(specfile);
+ if (!quiet)
+ {
+ (void)fprintf(stderr," [OK]");
+ NEWLINE(stderr);
+ }
+ if (DISKFULL(plotfp))
+ (void)fatal("special(): Output error -- disk storage probably full");
+}
+
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+
+/*-->textchr*/
+/**********************************************************************/
+/****************************** textchr *******************************/
+/**********************************************************************/
+
+void
+textchr(c) /* output character c */
+register char c;
+{
+ char* psave;
+
+ if (deferred) /* deferred output */
+ {
+ *ptext++ = c;
+ if (ptext >= (textbuf + MAXTEXT))
+ {
+ /* textbuf[] is full. Backup to the last newline, output
+ textbuf[] to that point, move the remainder to the
+ start of textbf[], and resume character collection. */
+ *ptext = '\0'; /* mark the end */
+ psave = strrchr(textbuf,'\n'); /* find last line break */
+ ptext = psave; /* shorten buffer */
+ *ptext = '\0'; /* mark the new end */
+ textflush(); /* output the buffer */
+ ++psave; /* where we want to pick up remainder */
+ OUT_FONTNAME; /* make sure current font starts buffer */
+ OUT_NL;
+ OUT_NUM(xcp); /* make sure current point is set too */
+ OUT_NUM(ycp);
+ OUT_STR("M\n");
+
+ /* Since the above initial sequence requires at most 25
+ characters, we should be safe here, since psave should
+ be pointing near the end of textbuf[]. Nevertheless, we
+ should watch for this time bomb, because someday someone
+ might make MAXTEXT ridiculously small. */
+ if (ptext > psave)
+ fatal("textchr(): internal error--textbuf[] too small");
+
+ (void)strcpy(ptext,psave); /* move remainder to start */
+ ptext = strchr(textbuf,'\0'); /* find the new end again */
+ }
+ }
+ else /* immediate output */
+ {
+
+#if PS_SHORTLINES
+ /***************************************************************
+ Unfortunately, PostScript does allows only text bracketed by ()
+ to be broken across lines by a \newline sequence. We must
+ therefore continue comments manually and break <...> strings by
+ a newline. emitchar() ensures that % in () and non-bracketing
+ () <> are encoded in octal, so as not to confuse us here.
+ ***************************************************************/
+
+ switch (c) /* set flags for exiting environments */
+ {
+ case '\n':
+ is_comment = FALSE;
+ break;
+
+ /* '<' editor balance */
+ case '>':
+ if (!is_comment)
+ is_string = FALSE;
+ break;
+
+ /* '(' editor balance */
+ case ')':
+ if (!is_comment)
+ is_text = FALSE;
+ break;
+ }
+
+ if (out_width < (PS_MAXWIDTH-2)) /* 3 or more slots left on line */
+ {
+ switch (c)
+ {
+ case '\n':
+ NEWLINE(plotfp);
+ out_width = 0;
+ break;
+
+ default:
+ OUTC(c);
+ out_width++;
+ break;
+ }
+ }
+ else if (out_width == (PS_MAXWIDTH-2)) /* 2 slots left on line */
+ {
+ if (is_comment)
+ {
+ OUTC(c);
+ out_width++;
+ }
+ else /* not comment */
+ {
+ switch (c)
+ {
+ case '(': /* special \newline inside (...text...) */
+ OUTC(c);
+ OUTC('\\');
+ NEWLINE(plotfp);
+ out_width = 0;
+ break;
+
+ case '\n': /* ordinary newline */
+ NEWLINE(plotfp);
+ out_width = 0;
+ break;
+
+ default: /* else just output the character */
+ OUTC(c);
+ out_width++;
+ break;
+ } /* end switch */
+ } /* end if (is_comment) */
+ }
+ else /* at most 1 slot left */
+ {
+ if (is_comment)
+ { /* make special continued comment */
+ OUTC('-');
+ NEWLINE(plotfp);
+ OUTS("%-");
+ OUTC(c);
+ out_width = 3;
+ }
+ else /* not comment */
+ {
+ switch (c)
+ {
+ case '%': /* start newline for comment or (...text...) */
+ case '(':
+ NEWLINE(plotfp);
+ OUTC(c);
+ out_width = 1;
+ break;
+
+ case ')': /* follow (...text...) with newline */
+ case '<': /* newline inside <...text...> okay */
+ case '>': /* follow <...text...> with newline */
+ OUTC(c);
+ NEWLINE(plotfp);
+ out_width = 0;
+ break;
+
+ case ' ': /* change trailing space to newline */
+ case '\n': /* newline */
+ NEWLINE(plotfp);
+ out_width = 0;
+ break;
+
+ default:
+ if (is_text) /* \newline continuation in (...text...) */
+ {
+ OUTC('\\');
+ NEWLINE(plotfp);
+ OUTC(c);
+ out_width = 1;
+ }
+ else if (is_string) /* newline inside <...text...> okay */
+ {
+ OUTC(c);
+ NEWLINE(plotfp);
+ out_width = 0;
+ }
+ else /* cannot break at this point, sigh... */
+ {
+ OUTC(c);
+ out_width++;
+ }
+ break;
+ } /* end switch */
+ } /* end if (is_comment) */
+ }
+
+ switch (c) /* set flags for entering environments */
+ {
+ case '%':
+ is_comment = TRUE;
+ break;
+
+ case '<':
+ if (!is_comment)
+ is_string = TRUE;
+ break;
+
+ case '(':
+ if (!is_comment)
+ is_text = TRUE;
+ break;
+ }
+#else /* NOT PS_SHORTLINES */
+ OUTC(c);
+#endif /* PS_SHORTLINES */
+
+ } /* endif deferred/immediate */
+}
+
+/*-->textflush*/
+/**********************************************************************/
+/***************************** textflush ******************************/
+/**********************************************************************/
+
+void
+textflush() /* flush current textbuf[] to output */
+{
+
+#if PS_SHORTLINES
+ register char* pbreak; /* point to character before */
+ /* which we can insert a line break */
+ char linebuf[PS_MAXWIDTH+1]; /* buffer for output line */
+ register INT16 k; /* index in linebuf[] */
+ register INT16 kbreak; /* break index in linebuf[] */
+ /* corresponding to pbreak */
+#endif /* PS_SHORTLINES */
+
+ /* Wrap the current textbuf[] contents with save/restore, but
+ preserve the current point and font. */
+ if (ptext > textbuf) /* make sure textbuf[] is not empty */
+ {
+
+#if PS_SHORTLINES
+ if (out_width > 0) /* want TB ... TE on separate lines */
+ NEWLINE(plotfp);
+#endif /* PS_SHORTLINES */
+
+ OUTS("TB");
+ NEWLINE(plotfp);
+
+ *ptext = '\0'; /* terminate current textbuf[] */
+
+#if PS_SHORTLINES
+ ptext = textbuf;
+ pbreak = ptext;
+ k = 0;
+ kbreak = 0;
+ while (*ptext)
+ {
+ if (k >= PS_MAXWIDTH)
+ {
+ if (kbreak > 0)
+ {
+ k = kbreak;
+ ptext = pbreak;
+ }
+ while ((k > 0) && (linebuf[k-1] == ' '))
+ k--; /* trim trailing space */
+ linebuf[k] = '\0';
+ OUTS(linebuf);
+ k = 0;
+ if ((kbreak > 0) || (*(ptext+1) == '\0'))
+ NEWLINE(plotfp);
+ }
+ if ((*ptext == '\n') && (*(ptext+1) == '('))
+ ptext++; /* squeeze out useless newline */
+ if (*ptext == '\n')
+ *ptext = ' '; /* change newline to blank */
+ if ((k == 0) && (*ptext == ' '))
+ /* NO-OP */; /* don't save leading space */
+ else
+ linebuf[k++] = *ptext;
+ if ((*ptext == ' ') || (*ptext == '('))
+ {
+ kbreak = k - 1;
+ pbreak = ptext;
+ }
+ else if (*ptext == ')')
+ {
+ kbreak = k;
+ pbreak = ptext + 1;
+ }
+ ptext++;
+ }
+ if (k > 0)
+ {
+ while ((k > 0) && (linebuf[k-1] == ' '))
+ k--; /* trim trailing space */
+ linebuf[k] = '\0';
+ OUTS(linebuf);
+ NEWLINE(plotfp);
+ }
+ out_width = 0;
+#else /* NOT PS_SHORTLINES */
+ OUTS(textbuf);
+ NEWLINE(plotfp);
+#endif /* PS_SHORTLINES */
+
+ OUTS("TE");
+ NEWLINE(plotfp);
+
+ ptext = textbuf;
+ }
+}
+
+/*-->textnum*/
+/**********************************************************************/
+/****************************** textnum *******************************/
+/**********************************************************************/
+
+void
+textnum(n) /* output number with one trailing space */
+long n; /* the number */
+{
+ char digits[11];
+
+ (void)sprintf(digits,"%ld",n);
+ textstr(digits);
+
+#if PS_SHORTLINES
+ if (!deferred && !is_comment && (out_width == 0))
+ /* NO-OP */; /* omit space at beginning of line */
+ else
+ textchr(' ');
+
+#else /* NOT PS_SHORTLINES */
+ textchr(' ');
+#endif /* PS_SHORTLINES */
+
+}
+
+
+
+/*-->textstr*/
+/**********************************************************************/
+/****************************** textstr *******************************/
+/**********************************************************************/
+
+void
+textstr(s) /* output string s[] */
+register char* s;
+{
+
+#if PS_SHORTLINES
+ if (!deferred && !is_comment && ((out_width + strlen(s)) > PS_MAXWIDTH))
+ OUT_NL;
+#endif /* PS_SHORTLINES */
+
+ for (; *s; ++s)
+ textchr(*s);
+}
+
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvialw.ps b/dviware/beebe/src/dvialw.ps
new file mode 100644
index 0000000000..b37cdaef25
--- /dev/null
+++ b/dviware/beebe/src/dvialw.ps
@@ -0,0 +1,296 @@
+% <BEEBE.TEX.DVI>DVIALW.PS.17, 18-Sep-87 17:48:04, Edit by BEEBE
+% Add test for note paper and if unknown, use letter paper instead.
+% Non-Apple PostScript implementations do not know about note paper
+% but its use on the Apple LaserWriter gains 92K of virtual memory
+% <BEEBE.TEX.DVI>DVIALW.PS.16, 18-Sep-87 15:50:52, Edit by BEEBE
+% Modify coordinate computations to remove round-off errors
+% in landscape mode, and correct landscape page origin
+% <BEEBE.TEX.DVI>DVIALW.PS.14, 22-Jun-87 09:55:05, Edit by BEEBE
+% Add missing "0 900 translate Mtrx currentmatrix pop" to /LEGAL
+% <BEEBE.TEX.DVI>DVIALW.PS.13, 7-Jan-87 17:38:51, Edit by BEEBE
+% Add translate command to BOP so that (0,0) really corresponds to
+% the top left physical page corner. The standard LaTeX file
+% TESTPAGE.TEX can be used for this calibration; it might be sensitive
+% to the particular printer used.
+% <BEEBE.TEX.DVI.NEW>DVIALW.PS.12, 10-Dec-86 17:24:50, Edit by BEEBE
+% Fix off-by-one error in definition of /B; to draw a box N pixels
+% wide, microscopic examination of output shows that the box width
+% must be N-1, not N, pixels; the boundary counts in the filling.
+% <BEEBE.TEX.DVI.NEW>DVIALW.PS.9, 28-Nov-86 19:00:52, Edit by BEEBE
+% Change definition of EOP to use #copies and showpage
+% instead of {copypage} repeat erasepage
+% <BEEBE.TEX.DVI.NEW>DVIALW.PS.7, 16-Oct-86 13:09:36, Edit by BEEBE
+% Following Macintosh LaserWriter md dictionary, change most
+% def's to bdf's (bind def); this is claimed to speed up
+% operator access
+% <BEEBE.TEX.DVI.NEW>DVIALW.PS.5, 16-Oct-86 12:01:12, Edit by BEEBE
+% Change CTL-L to caret-L in comment
+% <BEEBE.TEX.DVI.NEW>DVIALW.PS.3, 13-Jun-86 10:48:39, Edit by BEEBE
+% Fix definition of NOTE, make it default in BOJ macro to try to reduce
+% incidence of VM errors
+% ----------------------------------------------------------------------
+% DVIALW PostScript macro definitions (keep in alphabetical order). For
+% readability, these are heavily commented, but we adhere to the
+% convention that percent is used ONLY to mark the beginning of a
+% comment (NEVER occurs inside a PostScript string), and lines are
+% limited to 80 characters. That way, DVIALW can read these definitions
+% from a file and discard comments and trailing white space before
+% transmission to the PostScript output file. In the interests of
+% compactness, macros which receive any significant degree of use are
+% given single letter names -- PostScript is already much too verbose.
+%
+% Coordinates are assumed to be in pixels (Resolution per inch). The
+% page origin follows the PostScript convention of being in the lower
+% left corner, y positive upwards along the longer side of the page, x
+% positive to the right. Letter and legal sizes are therefore
+% equivalent as far as PostScript is concerned, but y coordinates can be
+% bigger in legal size. In landscape mode, the page is rotated to place
+% the origin in the upper left corner, x positive downward along the
+% longer side of the page, y positive to the right. That way, pages
+% eject from the printer upright when viewed from the front of the
+% printer.
+%
+% Document format is something like this:
+%
+% %!PS-Adobe-1.0
+% %%Dimensions: 0 0 612 792
+% %%Title: DVIALW -o1 -s300 foo12
+% %%CreationDate: Sat Mar 8 10:52:52 1986
+% %%Creator: BEEBE and [TeX82 DVI Translator Version 2.03b...]
+% %%Pages: (atend)
+% %%BugHistory: Incorporates save/restore and font reloading...
+% %%BugHistory: Incorporates Allan Hetzel's 31-Oct-85 DARPA...
+% %%EndComments
+% %%EndProlog
+% %%Page: 0 1
+% TeXdict begin
+% BOJ
+% BOP
+% ...
+% 1 EOP
+% ^LBOP
+% ...
+% 1 EOP
+% ^LBOP
+% ...
+% 1 EOP
+% ^LEOJ
+% %%Trailer
+% %%Pages: 7
+% %%PageTable: 0 1 3434
+% ^D
+%
+% One formfeed is output for each printed page copy, in order to make
+% spooler page accounting simple. The additional comments wrapping the
+% BOJ .. EOJ sequence conform to Adobe PostScript file structuring
+% conventions, and the first line can be used by the spooler to identify
+% the file as containing PostScript.
+% ----------------------------------------------------------------------
+
+
+/TeXdict 200 dict def % dictionary for these definitions
+TeXdict begin
+
+% bdf -- bind def (for efficiency)
+% Usage -- just like def, but not on constant objects
+/bdf {bind def} def
+
+% B -- draw bar (TeX rule) of size w by h at currentpoint
+% Usage -- w h B
+/B
+{
+ /h exch def
+ /w exch def
+ gsave
+ currentpoint
+ newpath
+ moveto
+ w 1 sub 0 rlineto
+ 0 h 1 sub rlineto
+ w 1 sub neg 0 rlineto
+ closepath fill
+ grestore
+} bdf
+
+% BOJ -- beginning of job (EOF ends it and closes TeXdict)
+% Usage -- BOJ
+/BOJ
+{
+ 72 Resolution div 72 Resolution div scale
+ userdict /note known
+ {NOTE} % default page format for ALW
+ {LETTER} % default page format for others
+ ifelse
+} bdf
+
+% BOP -- beginning of page
+% Usage -- BOP
+/BOP
+{
+ clear
+ Mtrx setmatrix
+ 25 0 translate % Physical page origin is at (-25,0) from the top left corner
+} bdf
+
+% ch-fieldname -- extract field from ch-data array (order defined by positions
+% in first array argument to macro D)
+% Usage -- ch-fieldname
+/ch-image {ch-data 0 get} bdf % the bitmap hex string image
+/ch-xoff {ch-data 1 get} bdf % pixels from left edge of bitmap to char origin
+/ch-yoff {ch-data 2 get} bdf % pixels from top edge of bitmap to char origin
+/ch-width {ch-data 3 get} bdf % bitmap width in pixels
+/ch-height {ch-data 4 get} bdf % bitmap height in pixels
+/ch-tfmw {ch-data 5 get} bdf % pixels to next character (precise flt value)
+
+% CharBuilder -- image one character
+% Usage -- fontdict ch CharBuilder
+/CharBuilder
+{
+ /ch-code exch def % save the char code
+ /font-dict exch def % and the font dict.
+ /ch-data font-dict /BitMaps get
+ ch-code get def % get the bitmap descriptor for char
+ ch-data null eq not % show character if entry is not empty
+ {
+ ch-tfmw 0
+ ch-xoff neg ch-yoff ch-height sub
+ ch-width ch-xoff sub ch-yoff
+ setcachedevice
+ 0 0 SNAP translate
+ ch-width ch-height true [ 1 0 0 -1 ch-xoff ch-yoff ]
+ {ch-image} imagemask
+ } if
+} bdf
+
+
+% D -- define new character in current font
+% Usage -- [<bitmap> xoff yoff pixwid pixht tfmpixwid] charnum D
+/D
+{
+ /ch-code exch def
+ /ch-data exch def
+ currentfont /BitMaps get ch-code ch-data put
+ currentfont /Encoding get ch-code dup 3 string cvs cvn put
+} bdf
+
+% EOJ -- end of job
+% Usage -- EOJ
+/EOJ
+{
+ end % matches begin issued before BOJ
+} bdf
+
+% EOP -- end of page
+% Usage -- ncopies EOP
+/EOP
+{
+/#copies exch def
+showpage
+} bdf
+
+% LANDSCAPE -- landscape format page (11inH x 8.5inV)
+% Usage -- LANDSCAPE
+/LANDSCAPE
+{
+ letter initmatrix
+ 72 Resolution div dup scale
+ 0 3300 translate
+ -90 rotate
+ 0 -750 translate
+ Mtrx currentmatrix pop
+} bdf
+
+% LEGAL -- legal format page (8.5inH x 13inV)
+% Usage -- LEGAL
+/LEGAL
+{
+ legal initmatrix
+ 72 Resolution div dup scale
+ 0 900 translate
+ Mtrx currentmatrix pop
+} bdf
+
+% LETTER -- letter format page
+% Usage -- LETTER
+/LETTER
+{
+ letter initmatrix
+ 72 Resolution div dup scale
+ Mtrx currentmatrix pop
+} bdf
+
+% M -- moveto
+% Usage -- x y M
+/M
+{
+ moveto
+} bdf
+
+% Mtrx -- permanent storage for page transformation matrix
+% Usage -- Mtrx
+/Mtrx 6 array def
+
+% NF -- define new font
+% Usage -- /fontname NF
+/NF
+{
+ /newname exch def
+ newname 7 dict def
+ newname load
+ begin
+ /BitMaps 128 array def
+ /BuildChar { CharBuilder } def
+ /Encoding 128 array def
+ 0 1 127 { Encoding exch /.notdef put } for
+ /FontBBox [ 0 0 1 1 ] def
+ /FontMatrix [ 1 0 0 1 0 0 ] def
+ /FontType 3 def
+ end
+ newname newname load definefont pop
+} bdf() pop
+
+% NOTE -- note format page (increases available virtual memory from 240K
+% to 340K on Apple LaserWriter)
+% Usage -- NOTE
+/NOTE
+{
+ note initmatrix
+ 72 Resolution div dup scale % set scaling to 1.
+ Mtrx currentmatrix pop
+} bdf
+
+% P -- show string at current point, updating horizontal position to new endpt
+% Usage -- (string) P
+/P {show} bdf() pop
+
+% Q -- draw bar of last size set by B command at specified point
+% Usage -- x y Q
+/Q {moveto w h B} bdf() pop
+
+% R -- move relative right and show string, updating horizontal position to
+% new endpoint
+% Usage -- (string) xxx R
+/R {0 rmoveto show} bdf() pop
+
+% Resolution -- device resolution in dots/inch
+% Usage -- Resolution
+/Resolution 300 def
+
+% S -- move absolute and show string, updating horizontal position to new endpt
+% Usage -- (string) xxx yyy S
+/S {moveto show} bdf() pop
+
+% SF -- set new font at scale nnn (nnn = 1 normally; 2 gives double size chars)
+% Usage -- nnn /fontname SF
+/SF {findfont exch scalefont setfont} bdf() pop
+
+% SNAP -- convert coordinates to integer device coordinates and back again
+% Usage -- xxx yyy SNAP (leave xxx' yyy' on stack)
+/SNAP {transform 2 {floor 0.5 add exch} repeat itransform} bdf
+
+% T -- move absolute horizontally and show string, updating horizontal position
+% to new endpt
+% Usage -- (string) xxx T
+/T {currentpoint exch pop moveto show} bdf() pop
+
+end % TeXdict
diff --git a/dviware/beebe/src/dvibit.c b/dviware/beebe/src/dvibit.c
new file mode 100644
index 0000000000..f86fbf6b91
--- /dev/null
+++ b/dviware/beebe/src/dvibit.c
@@ -0,0 +1,1027 @@
+/* -*-C-*- dvibit.c */
+/*-->dvibit*/
+/**********************************************************************/
+/******************************* dvibit *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef BBNBITGRAPH
+#define BBNBITGRAPH 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Version 3.10 BBN BitGraph terminal"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "bit"
+
+#undef ALLOW_INTERRUPT
+#define ALLOW_INTERRUPT 1 /* to allow ^C for debugging */
+ /* undefine for normal catch-^C mode */
+
+#define BELLS "\007\007\007\007\007" /* bells at end-of-page */
+
+
+/* Number of 16-bit words permitted in a big character before we switch
+to sending raster bitmaps. The BitGraph does not impose any real limit
+(since 16-bit font metrics are provided for), but we could conceivably
+exhaust font storage if we allow too many big characters. The screen
+has a resolution of about 72 dpi, so we allow roughly characters up to
+72pt in size to be downloaded as fonts. The old value here was 32,
+which made display rather slow for large characters; this new version is
+MUCH peppier. */
+
+#define BIGBGCHAR ((72 * 72)/16)
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#define FIRSTBGCHAR 32
+#define LASTBGCHAR 127
+#define NBGFONTS 3 /* number of PXL fonts that can be */
+ /* downloaded into the BitGraph */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XDIFFMAX 20
+#define XDIFFORG (FIRSTBGCHAR+XDIFFMAX)
+
+
+/* NB: XSIZE is really 768, but BitGraph Version 3.10 seems to have a bug.
+Anything past 724 is overwritten on previous character. We reduce it to
+720 in order to preserve a multiple of 16 (needed for correct positioning
+in eopact() */
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE 720 /* number of horizontal dots */
+#define XDPI (XSIZE/XPSIZE) /* horizontal dots/inch */
+#define YDIFFMAX 20
+#define YDIFFORG (FIRSTBGCHAR+XDIFFMAX+1+XDIFFMAX+YDIFFMAX)
+
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (1024-5*16) /* number of vertical dots, less */
+ /* menu bars */
+#define YDPI (YSIZE/YPSIZE) /* vertical dots/inch */
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->bopact*/
+/**********************************************************************/
+/******************************* bopact *******************************/
+/**********************************************************************/
+
+void
+bopact() /* beginning-of-page action */
+{
+ int y;
+/* Define a shorthand for inverse-video strings */
+#define OUTIV(str) OUTF("\033[7m%s\033[m",str)
+
+ pbghpos = pbgvpos = -99;
+ cpagep = (long)FTELL(dvifp) - 1L;
+ ppagep = (long)nosignex(dvifp,(BYTE)4);
+ if (!g_interactive)
+ return; /* no action if not a terminal */
+ OUTS("\033:["); /* BBNPSH push context */
+ OUTS("\033:2e"); /* BBNSEM Select Emulation Mode VT100 */
+ OUTS("\033(B"); /* revert to ASCII character set */
+
+ OUTS("\033[H\033[K"); /* cursor to line 1 and clear */
+ OUTIV("SPACE"); /* Output help message in top line */
+ OUTS(":next-page ");
+ OUTIV("P");
+ OUTS(":previous-page ");
+ OUTIV("^L");
+ OUTS(":current-page ");
+ OUTIV("L");
+ OUTS(":Left ");
+ OUTIV("R");
+ OUTS(":right ");
+ OUTIV("D");
+ OUTS(":Down ");
+ OUTIV("U");
+ OUTS(":up");
+
+ OUTS("\033[2H\033[K"); /* cursor to line 2 and clear */
+ OUTIV("@");
+ OUTS(":initial position ");
+ OUTIV("EMACS keys, arrow keys, l, r, d, u");
+ OUTS(":move in small steps ");
+
+ OUTS("\033[3H\033[K"); /* cursor to line 3 and clear */
+ OUTIV("Z");
+ OUTS(": zoom up ");
+ OUTIV("z");
+ OUTS(": zoom down ");
+ OUTIV("###<RET>");
+ OUTS(":goto page ### ");
+
+ OUTS("\033[4H\033[K"); /* cursor to line 4 and clear */
+ OUTF3("Document page: %d/%d TeX pages: %s",
+ (int)(cur_index+1),(int)page_count,tctos());
+ OUTF3(" Xscreen = %d, Yscreen = %d, Mag = %ld",
+ (int)xscreen, (int)yscreen, (long)runmag);
+
+ OUTS("\033[5H\033[J"); /* clear from line 5 to end of screen */
+
+ OUTS("\033[H"); /* home cursor */
+ OUTS("\033:]"); /* BBNPOP pop context */
+
+ /* Draw menu bars across screen */
+ OUTS("\033:15v"); /* BBNSDO - set drawing operation to foreground color */
+ for (y = YSIZE; y < YSIZE + 8; y += 2)
+ OUTF3("\033:0;%dm\033:%d;%dd",y,XSIZE-1,y);
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ register UNSIGN16 the_font; /* loop index */
+ register UNSIGN16 the_char; /* loop index */
+
+ char *tcp;
+
+ g_interactive = (kbopen(KB_CBREAK) == 0);
+
+ if (g_interactive)
+ {
+ if ((tcp=GETENV("TERM")) == (char*)NULL)
+ {
+ (void)sprintf(message,
+ "devinit(): [%s] cannot find environment variable [TERM]",
+ g_progname);
+ (void)fatal(message);
+ }
+ else
+ {
+
+#if OS_VAXVMS
+ /* VMS C overrides user's value of TERM, so skip check */
+#else
+#if OS_TOPS20
+ if (strcmp(tcp,"BITGRAPH") && strncmp(tcp,"BG",2))
+#else
+ if (strcmp(tcp,"bitgraph") && strncmp(tcp,"bg",2))
+#endif
+
+ {
+ (void)sprintf(message,"devinit(): [%s] cannot run \
+interactively on non-BitGraph terminal",
+ g_progname);
+ (void)fatal(message);
+ }
+#endif
+ }
+ }
+
+#if ALLOW_INTERRUPT
+#else /* NOT ALLOW_INTERRUPT */
+ signal(SIGINT, SIG_IGN); /* ignore interrupts */
+#endif /* ALLOW_INTERRUPT */
+
+ initterm();
+
+#if ALLOW_INTERRUPT
+#else /* NOT ALLOW_INTERRUPT */
+ signal(SIGINT, gotint); /* catch interrupts */
+#endif /* ALLOW_INTERRUPT */
+
+ /* Clear all BitGraph font char_entry pointers */
+ for (the_font = 0; the_font < (NBGFONTS+(NBGFONTS+2)/3); ++the_font)
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; ++the_char)
+ bgcp[the_font][the_char] = (struct char_entry *)NULL;
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ rsetterm();
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+
+/* -*-C-*- eopact.h */
+/*-->eopact*/
+/**********************************************************************/
+/******************************* eopact *******************************/
+/**********************************************************************/
+
+#define MAXFRAC 8 /* maximum fractional step divisor */
+#define MINFRAC 64 /* minimum fractional step divisor */
+#define DIGVAL(c) (INT16)(c - '0')
+
+void
+eopact() /* end-of-page action */
+{
+ int loop_count; /* loop count */
+ INT16 np; /* input page number */
+ BOOLEAN show_page; /* page redisplay flag */
+ char tc; /* temporary character */
+
+ /*
+ Screen positioning control is done by obvious mnemonics given in the
+ menu bar displayed by bopact(), but cursor keys and EMACS-like
+ control keys are also recognized. Keyboard input causes an instant
+ end-of-page action, to facilitate rapid page repositioning, and
+ skimming through a document. All available commands are acted upon
+ before screen display is reattempted. This makes repeated
+ positioning commands cumulative.
+ */
+
+ if (!quiet)
+ OUTS(BELLS); /* wake up the user */
+ (void)fflush(plotfp); /* make sure display is up-to-date */
+
+ loop_count = 1;
+ show_page = FALSE;
+ while ((loop_count-- > 0) || kbinput())
+ {
+ tc = (char)kbget();
+ if (tc == '\033') /* ESC sequence--function key */
+ {
+ /* Expect ESC x, ESC O x or ESC [ x (x = A,B,C,D) */
+ tc = (char)kbget();
+ if ((tc == '[') || (tc == 'O'))
+ tc = (char)kbget();
+ switch(tc)
+ {
+ case 'A': /* cursor up */
+ tc = 'u';
+ break;
+ case 'B': /* cursor down */
+ tc = 'd';
+ break;
+ case 'C': /* cursor right */
+ tc = 'r';
+ break;
+ case 'D': /* cursor left */
+ tc = 'l';
+ break;
+ case 'V': /* META-V -- previous page */
+ case 'v':
+ tc = 'P';
+ break;
+ default: /* none of these--accept it anyway */
+ break;
+ }
+ }
+ switch (tc)
+ {
+ case '0': /* goto n-th page (recursively) */
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ np = DIGVAL(tc);
+ for (tc = (char)kbget(); ;tc = (char)kbget())
+ {
+ if (isdigit(tc))
+ np = 10*np + DIGVAL(tc);
+ else if ((tc == '\177') || (tc == '\b'))
+ np /= 10; /* rubout last digit */
+ else
+ break;
+ }
+ np = MIN(np,page_count); /* big numbers go to last page */
+ if (np > 0) /* got a page number */
+ {
+ cur_index = np - 1;
+ show_page = TRUE; /* out-of-sequence page */
+ }
+ else
+ show_page = FALSE;
+ continue;
+
+ case ' ': /* normal case - start next page */
+ case '\026': /* CTL-V */
+ case '\r':
+ case '\n':
+ case '\0':
+ show_page = FALSE;
+ continue;
+
+ case '\f': /* redisplay current page */
+ case '.':
+ show_page = TRUE;
+ continue;
+
+ case '@': /* reset to initial state */
+ xscreen = 0; /* 'i' is mnemonic, but too close to 'u' */
+ yscreen = 0; /* on keyboard */
+ show_page = TRUE;
+ continue;
+
+ case 'd': /* move down and redisplay */
+ case '\016': /* CTL-N */
+ yscreen -= (YSIZE/MINFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'D':
+ yscreen -= (YSIZE/MAXFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'l': /* move left and redisplay */
+ case '\002': /* CTL-B */
+ xscreen -= (XSIZE/MINFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'L':
+ xscreen -= (XSIZE/MAXFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'p': /* redisplay from previous page */
+ case 'P':
+ case '\b':
+ case '^':
+ if (cur_index > 0)
+ {
+ cur_index--;
+ show_page = TRUE;
+ }
+ else /* no previous page--ignore */
+ {
+ OUTS(BELLS);
+ loop_count = 1;
+ show_page = FALSE;
+ }
+ continue;
+
+ case 'q': /* quit */
+ case 'Q':
+ case 'x': /* exit */
+ case 'X':
+ case '\003': /* CTL-C */
+ case '\031': /* CTL-Y */
+ (void)devterm(); /* terminate device output */
+ (void)dviterm(); /* terminate DVI file processing */
+ (void)alldone(); /* this does not return */
+ continue;
+
+ case 'r': /* move right and redisplay */
+ case '\006': /* CTL-F */
+ xscreen += (XSIZE/MINFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'R':
+ xscreen += (XSIZE/MAXFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'u': /* move up and redisplay */
+ case '\020': /* CTL-P */
+ yscreen += (YSIZE/MINFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'U':
+ yscreen += (YSIZE/MAXFRAC);
+ show_page = TRUE;
+ continue;
+
+ case 'z': /* zoom down one magstep (1.2) */
+ runmag = MAGSIZE(actfact((UNSIGN32)((5*runmag)/6)));
+ conv = ((float)num/(float)den) *
+ ((float)runmag/(float)STDMAG) *
+
+#if USEGLOBALMAG
+ actfact(mag) *
+#endif
+
+ ((float)RESOLUTION/254000.0);
+ (void)unloadfonts();
+ show_page = TRUE;
+ continue;
+
+ case 'Z': /* zoom up one magstep (1.2) */
+ runmag = MAGSIZE(actfact((UNSIGN32)((runmag*6)/5)));
+ conv = ((float)num/(float)den) *
+ ((float)runmag/(float)STDMAG) *
+
+#if USEGLOBALMAG
+ actfact(mag) *
+#endif
+
+ ((float)RESOLUTION/254000.0);
+ (void)unloadfonts();
+ show_page = TRUE;
+ continue;
+
+ default: /* unimplemented command */
+ OUTS(BELLS); /* beep to flag ignored input */
+ (void)kbflush(); /* clear any typeahead */
+ show_page = FALSE;
+ loop_count = 1;
+ continue; /* stay in read-loop */}
+ }
+ if (show_page)
+ (void)prtpage(page_ptr[cur_index]);
+}
+
+#include "f20open.h"
+#include "fatal.h"
+
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner of the bitmap, draw
+a filled rectangle at (x,y).
+***********************************************************************/
+
+{
+ if ( ((x+width) <= 0) || (XSIZE <= x) || ((y+height) <= 0) ||
+ (YSIZE <= y) )
+ /*NO-OP*/; /* Trivial reject -- rectangle completely offpage */
+ else
+ {
+ OUTS("\033:15;"); /* BBNRAST Rastop */
+ OUTF2("%d;%d;",x,y);
+ OUTF2("%d;%d;",x,y);
+ OUTF2("%d;%dr",width,height);
+ }
+}
+
+
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+
+/*-->initterm*/
+/**********************************************************************/
+/****************************** initterm ******************************/
+/**********************************************************************/
+
+void
+initterm() /* initialize terminal */
+
+{
+ register INT16 i; /* loop index */
+
+#if OS_TOPS20
+
+ /* TOPS-20 regrettably does not have a "raw" terminal mode (except for */
+ /* binary I/O (bytesize other than 7)), so several JSYS's are needed to */
+ /* suppress the fiddling it does with the output. */
+
+ /* First, save the current terminal state */
+
+ ac1 = jfn_plotfp;
+ if (jsys(JSrfmod,acs) != JSok) /* get jfn mode word */
+ ; /* ignore errors */
+ bg_modeword = ac2;
+
+ ac1 = jfn_plotfp;
+ if (jsys(JSrfcoc,acs) != JSok) /* get terminal control codes */
+ ; /* ignore errors */
+ bg_1ccoc = ac2;
+ bg_2ccoc = ac3;
+
+ ac1 = jfn_plotfp;
+ ac2 = MOrlw;
+ if (jsys(JSmtopr,acs) != JSok) /* get terminal width */
+ ; /* ignore errors */
+ bg_width = ac3;
+
+ ac1 = jfn_plotfp;
+ ac2 = MOrll;
+ if (jsys(JSmtopr,acs) != JSok) /* get terminal page length */
+ ; /* ignore errors */
+ bg_length = ac3;
+
+ ac1 = jfn_plotfp;
+ ac2 = MOrnt;
+ if (jsys(JSmtopr,acs) != JSok) /* get terminal refuse/accept */
+ /* system message status */
+ ; /* ignore errors */
+ bg_sysmsg = ac3;
+
+ /* Now reset the terminal state so no one else can bother us and */
+ /* the terminal can operate in "raw" mode */
+
+ ac1 = jfn_plotfp;
+ ac2 = MOsnt;
+ ac3 = MOsmn;
+ if (jsys(JSmtopr,acs) != JSok) /* suppress system messages */
+ ; /* ignore errors */
+
+ ac1 = Value(TL_cro) | Value(TL_cor) | Value(TL_sab) | Value(TL_sta) |
+ Value(TL_obj);
+ ac2 = -1;
+ if (jsys(JStlink,acs) != JSok) /* refuse links and advice */
+ ; /* ignore errors */
+
+
+ ac1 = jfn_plotfp;
+ ac2 = Value(TT_mff) | Value(TT_tab) | Value(TT_lca) | Value(TT_pgm);
+ if (jsys(JSstpar,acs) != JSok) /* formfeed, tab, lowercase */
+ /* capability, plus X-on/X-off */
+ /* control */
+ ; /* ignore errors */
+
+ ac1 = jfn_plotfp;
+ ac2 = 0525252525252;
+ ac3 = 0525252525252;
+ if (jsys(JSsfcoc,acs) != JSok) /* untranslated output of all 32 */
+ ; /* control characters */
+
+ ac1 = jfn_plotfp;
+ ac2 = MOslw;
+ if (jsys(JSmtopr,acs) != JSok) /* line width to 0 to suppress */
+ ; /* CR LF insertion at EOL */
+
+ ac1 = jfn_plotfp;
+ ac2 = MOsll;
+ if (jsys(JSmtopr,acs) != JSok) /* page length to 0 to suppress */
+ ; /* pause at end-of-page */
+#endif /* OS_TOPS20 */
+
+ OUTS("\033:2e"); /* BBNSEM Select Emulation Mode VT100 */
+ OUTS("\033(B"); /* revert to ASCII character set */
+ OUTS("\033[H\033[J"); /* home cursor and clear screen */
+ OUTS("\033:["); /* BBNPSH Push Context */
+ OUTS("\033:0e"); /* BBNSEM Select Emulation Mode */
+ OUTS("\033[?7l"); /* RM DECAWM no right margin */
+ /* wrap wanted. */
+ OUTS("\033:2L"); /* BBNSFP Set Font Parameters */
+ /* to reset all fonts */
+ OUTS("\033:7o"); /* BBNSTO Set Text Operation */
+
+ for (i=(-XDIFFMAX); i<=XDIFFMAX; i++) /* load horizontal skips */
+ {
+ OUTS("\033P:0;"); /* BBNLFC Load Font Character */
+ OUTF("%d;",XDIFFORG+i);
+ OUTC('0'+NBGFONTS+(NBGFONTS+2)/3);
+ OUTS(";0;0;0;0;");
+ OUTF("%dL",i);
+ }
+
+ for (i=(-YDIFFMAX); i<=YDIFFMAX; i++)/* load vertical skips */
+ {
+ OUTS("\033P:0;"); /* BBNLFC Load Font Character */
+ OUTF("%d;",YDIFFORG+i);
+ OUTC('0'+NBGFONTS+(NBGFONTS+2)/3);
+ OUTS(";0;0;0;0;");
+ OUTF("%dL",i);
+ }
+ OUTF("\033)%c",(char)('0'+NBGFONTS+(NBGFONTS+2)/3));
+ /* SCS Select G1 to be a */
+ /* loadable font */
+}
+
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+
+/*-->newfont*/
+/**********************************************************************/
+/****************************** newfont *******************************/
+/**********************************************************************/
+
+void
+newfont()
+{
+ register UNSIGN16 the_char; /* loop index */
+ register struct char_entry *tcharptr;
+
+ fullfont = (fullfont+1) % NBGFONTS;
+ if (fullfont == 0)
+ {
+ partfont = NBGFONTS;
+ partchar = FIRSTBGCHAR;
+ }
+ else
+ {
+ partchar += FIRSTBGCHAR;
+ if (partchar > LASTBGCHAR)
+ {
+ partfont++;
+ partchar = FIRSTBGCHAR;
+ }
+ }
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ {
+ tcharptr = &(fontptr->ch[the_char]);
+ tcharptr->isloaded = FALSE;
+ tcharptr->istoobig = ((int)(tcharptr->hp*((tcharptr->wp+15) >> 4))
+ >= BIGBGCHAR);
+ if (the_char < FIRSTBGCHAR)
+ {
+ tcharptr->bgfont = partfont;
+ tcharptr->bgchar = partchar+the_char;
+ }
+ else
+ {
+ tcharptr->bgfont = fullfont;
+ tcharptr->bgchar = the_char;
+ }
+ }
+}
+
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outrow*/
+/**********************************************************************/
+/******************************* outrow *******************************/
+/**********************************************************************/
+
+void
+outrow(c,yoff) /* send img_row[] to output device */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) (UNUSED here) */
+{
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ UNSIGN16 half_words_per_row;/* number of raster half-words to copy */
+
+ tcharptr = &(fontptr->ch[c]);
+ half_words_per_row = (UNSIGN16)((tcharptr->wp + 15) >> 4);
+ p = img_row; /* we step along img_row[] */
+
+ for (k = half_words_per_row; k > 0; (++p,--k))
+ {
+ putout((INT16)((*p) >> 16)); /* first half-word */
+ if (--k == 0)
+ break;
+ putout((INT16)((*p) & 0xffff)); /* second half-word */
+ }
+}
+
+#include "prtpage.h"
+
+/*-->putout*/
+/**********************************************************************/
+/******************************* putout *******************************/
+/**********************************************************************/
+
+void
+putout(x) /* put a 16-bit raster pattern */
+ /* to the BitGraph */
+register INT16 x; /* number to put out */
+
+{
+ BOOLEAN negative; /* was x negative? */
+ register INT16 part1, part2, part3; /* parts of number */
+
+ negative = FALSE;
+ if (x < 0)
+ {
+ negative = TRUE;
+ x = -x;
+ }
+ part1 = (x & 0xfc00) >> 10;
+ part2 = (x & 0x03f0) >> 4;
+ part3 = (x & 0x000f);
+ if (part1)
+ {
+ OUTC(0100+part1);
+ OUTC(0100+part2);
+ }
+ else
+ if (part2)
+ OUTC(0100+part2);
+ if (negative)
+ OUTC(040+part3);
+ else
+ OUTC(060+part3);
+}
+
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+
+/*-->rsetterm*/
+/**********************************************************************/
+/****************************** rsetterm ******************************/
+/**********************************************************************/
+
+void
+rsetterm() /* Reset Terminal */
+{
+ if (plotfp == (FILE *)NULL)
+ return;
+ OUTS("\033\\"); /* ST String Terminator (in case of */
+ /* earlier errors resulting in */
+ /* incomplete output */
+ OUTS("\033:2L"); /* BBNSFP - Set Font Parameters */
+ /* to reset all fonts */
+ OUTS("\033:]"); /* BBNPOP - Pop Context */
+ OUTS("\033:2e"); /* BBNSEM Select Emulation Mode VT100 */
+
+ /* The Pop Context does not restore the state of the world; the terminal */
+ /* comes back overwriting text and believing it has only 24 lines instead */
+ /* of 64. The following commands fix that. The order is important, and */
+ /* DECSTBM must come last, or it will revert to 24 line scrolling. */
+
+ OUTS("\033");
+ OUTS("7"); /* DECSC - save cursor */
+ OUTS("\033:3o"); /* BBNSTO - set text operation */
+ /* to replace */
+ OUTS("\033");
+ OUTS("8"); /* DECRC - restore cursor */
+ OUTS("\033[2J"); /* clear screen */
+ OUTS("\033(B"); /* SCS - select character set */
+ OUTS("\033[1;64;1;80r"); /* DECSTBM - set top and bottom */
+ /* margins to full screen */
+ (void)fflush(plotfp);
+
+#if OS_TOPS20
+
+ /* restore the terminal settings saved at entry */
+
+ ac1 = jfn_plotfp;
+ ac2 = bg_modeword;
+ if (jsys(JSsfmod,acs) != JSok) /* set jfn mode word */
+ ; /* ignore errors */
+
+ ac1 = jfn_plotfp;
+ ac2 = bg_modeword;
+ if (jsys(JSstpar,acs) != JSok) /* set more of jfn mode word */
+ ; /* ignore errors */
+
+ ac1 = Value(TL_sab) | Value(TL_sta) | Value(TL_obj);
+ if ((bg_modeword & Value(TT_alk)) != 0)
+ ac1 |= Value(TL_abs); /* terminal was receiving links */
+ if ((bg_modeword & Value(TT_aad)) != 0)
+ ac1 |= Value(TL_aad); /* terminal was receiving advice */
+ ac2 = -1;
+ if (jsys(JStlink,acs) != JSok) /* set links and advice action */
+ ; /* ignore errors */
+
+ ac1 = jfn_plotfp;
+ ac2 = bg_1ccoc;
+ ac3 = bg_2ccoc;
+ if (jsys(JSsfcoc,acs) != JSok) /* set terminal control codes */
+ ; /* ignore errors */
+
+ ac1 = jfn_plotfp;
+ ac2 = MOslw;
+ ac3 = bg_width;
+ if (jsys(JSmtopr,acs) != JSok) /* set terminal line width */
+ ; /* ignore errors */
+
+
+ ac1 = jfn_plotfp;
+ ac2 = MOsll;
+ ac3 = bg_length;
+ if (jsys(JSmtopr,acs) != JSok) /* set terminal page length */
+ ; /* ignore errors */
+
+
+ ac1 = jfn_plotfp;
+ ac2 = MOsnt;
+ ac3 = bg_sysmsg;
+ if (jsys(JSmtopr,acs) != JSok) /* set terminal refuse/accept */
+ /* system message status */
+ ; /* ignore errors */
+
+#endif /* OS_TOPS20 */
+
+ if (g_interactive)
+ (void)kbclose();
+}
+
+#include "rulepxl.h"
+
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ tcharptr = &(fontptr->ch[c]);
+
+ /*
+ Any character which is off screen is completed ignored; there is no
+ point sending bitmaps or chardefs for invisible characters.
+ Partially visible characters could perhaps be supported, but for
+ now, we ignore them too.
+ */
+
+ if (((hh - tcharptr->xoffp + tcharptr->pxlw) < (XSIZE - xscreen))
+ && (hh >= -xscreen)
+ && (vv < (YSIZE + yscreen))
+ && ((vv - tcharptr->yoffp) >= yscreen))
+ { /* character fits entirely on screen */
+ if (tcharptr->istoobig)
+ { /* big character must be displayed in raster graphics mode */
+ (void)fflush(plotfp);
+ if (fontptr != pfontptr)
+ (void)openfont(fontptr->n);
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+ OUTF2("\033:%d;%dm", /* BBNMOV Move Graphically */
+ (pbghpos=(INT16)((hh-tcharptr->xoffp))+xscreen),
+ (pbgvpos=(INT16)((YSIZE-vv+tcharptr->yoffp))+yscreen));
+ OUTF2("\033P:3;%d;%ds",tcharptr->wp, tcharptr->hp);
+ /* BBNDPD Display Pixel Data */
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* load rasters into device */
+ OUTS("\033\\"); /* ST String Terminator */
+ }
+ else /* small character to be downloaded */
+ {
+ if (!tcharptr->isloaded)
+ {
+ (void)fflush(plotfp);
+ if (fontptr != pfontptr)
+ (void)openfont(fontptr->n);
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+ if ((bgcp[tcharptr->bgfont][tcharptr->bgchar] != NULL) &&
+ (bgcp[tcharptr->bgfont][tcharptr->bgchar]->isloaded))
+ {
+ bgcp[tcharptr->bgfont][tcharptr->bgchar]->isloaded = FALSE;
+ OUTF2("\033:2;%d;%cL",tcharptr->bgchar,
+ '0'+tcharptr->bgfont);
+ /* BBNSFP Set Font Parameters */
+ /* to reset character */
+ }
+
+ OUTS("\033P:0;"); /* BBNLFC Load Font Character */
+ OUTF("%d;",tcharptr->bgchar);
+ OUTC('0'+tcharptr->bgfont);
+ OUTC(';');
+ OUTF("%d;",tcharptr->wp);
+ OUTF("%d;",tcharptr->hp);
+ OUTF("%d;",tcharptr->xoffp);
+ OUTF("%d;",tcharptr->hp-tcharptr->yoffp-1);
+ OUTF("%dL",tcharptr->pxlw-tcharptr->xoffp);
+
+ /* Bug fix: PCC-20 jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* load rasters into device */
+ OUTS("\033\\"); /* ST String Terminator */
+
+ tcharptr->isloaded = TRUE;
+ bgcp[tcharptr->bgfont][tcharptr->bgchar] = tcharptr;
+ }
+ xdiff = hh-pbghpos;
+ ydiff = YSIZE-vv-pbgvpos;
+ if ((xdiff) || (ydiff))
+ if ((ABS(xdiff) <= XDIFFMAX) && (ABS(ydiff) <= YDIFFMAX))
+ {
+ OUTC('\016');/* SO Switches to the G1 character set */
+ if (xdiff)
+ OUTC(XDIFFORG+xdiff);
+ if (ydiff)
+ OUTC(YDIFFORG+ydiff);
+ OUTC('\017');/* SI Switches to the G0 character set */
+ }
+ else
+ OUTF2("\033:%d;%dm",hh+xscreen, YSIZE-vv+yscreen);
+ /* BBNMOV Move Graphically */
+
+ if (tcharptr->bgfont != pbgf)
+ { /* SCS Select G0 to be a loadable font */
+ OUTF("\033(%c",(char)('0'+tcharptr->bgfont));
+ pbgf = tcharptr->bgfont;
+ }
+ OUTC(tcharptr->bgchar);
+ pbghpos = (INT16)(hh + tcharptr->pxlw - tcharptr->xoffp);
+ pbgvpos = (INT16)(YSIZE - vv);
+ }
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = (COORDINATE)(fixpos(hh-lmargin,h,conv) + lmargin);
+ }
+}
+
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+
+/*-->unloadfonts*/
+/**********************************************************************/
+/***************************** unloadfonts ****************************/
+/**********************************************************************/
+
+void
+unloadfonts() /* mark all fonts as not loaded */
+{ /* and set no current fonts */
+ INT16 k;
+
+ for (fontptr = hfontptr; fontptr != (struct font_entry *)NULL;
+ fontptr = fontptr->next)
+ {
+ for (k = 0; k < NPXLCHARS; ++k)
+ fontptr->ch[k].isloaded = FALSE;
+
+ if (fontptr->font_file_id != (FILE*)NULL)
+ {
+ (void)fclose(fontptr->font_file_id);
+ fontptr->font_file_id = (FILE*)NULL;
+ }
+ }
+
+ fontfp = (FILE*)NULL; /* no current font file */
+ for ( ; nopen > 0; --nopen) /* clear font file cache */
+ {
+ font_files[nopen].font_id = (FILE*)NULL;
+ font_files[nopen].use_count = (INT16)0;
+ }
+
+ /* NB: It is important here that the loop index be global; the relation
+ of fontptr to pfontptr is used by openfont() to decide whether the font
+ file is already open. */
+ for (fontptr = hfontptr; fontptr != (struct font_entry *)NULL;
+ fontptr = fontptr->next)
+ {
+ pfontptr = (struct font_entry *)(NULL); /* so reldfont() calls openfont() */
+ (void)reldfont(fontptr); /* get new font metrics */
+ }
+}
+
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvica2.c b/dviware/beebe/src/dvica2.c
new file mode 100644
index 0000000000..6d996b4b70
--- /dev/null
+++ b/dviware/beebe/src/dvica2.c
@@ -0,0 +1,1048 @@
+/* -*-C-*- dvica2.c */
+/* Developed for Canon LBP-8 A2 from DVIIMP.C and DVIJEP.C [03-Jan-87]
+ Page references in comments refer to
+ Canon LBP-8 A1/A2 Laser Beam Printer User's Manual
+ edition PUB.R-IE-034-V1C.0186B2.5 (1985)
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ NB: This is a preliminary release. Serious problems with the Canon
+ A2 downloaded font mechanism force loading of characters as bitmaps
+ at every reference, making it very slow....
+
+ This new experimental version, DVICA2.C, has been extended by Pekka
+ Pietilainen <TFYS-PP@FINOU.BITNET> at Oulu University, Oulu, Finland
+ during June-August 1987. It permits downloading of characters as
+ fonts, rather than as bitmaps, with control over the character size
+ adjustable by run-time options -g<stor_fonts>, -s<size limit>,
+ -u<merit factor>, and -v<stor_limit>. These options will likely be
+ removed as more experience with this driver is obtained. It has not
+ been possible to test it at Utah, since we no longer have a Canon A2
+ available to us.
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*/
+
+/*-->DVICAN*/
+/**********************************************************************/
+/******************************* dvican *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef CANON_A2
+#define CANON_A2 1 /* conditional compilation flag */
+
+#define CANON_TEST 1 /* this may be used ONLY inside */
+ /* #if CANON_A2 ... #endif code */
+
+#define VERSION_NO "2.10b [experimental]" /* DVI driver version number */
+
+#define DEVICE_ID "Canon LBP-8 A2 laser printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "ca2"
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* to get standard font resolution */
+
+#define CONCBUFFSIZE 512 /* file copy buffer size */
+
+#define MAXLINE 4096 /* maximum input file line size */
+ /* it is needed only in special() */
+#define LOADSEQSIZE 10 /* Bytes in bitmap command */
+#define STOR_LIMIT 40000 /* Memory size */
+#define STOR_FONTS 32000 /* Memory for one font */
+#define MERIT_FACT 20 /* Merit to down load character */
+
+#define XDPI 300 /* horizontal dots/inch */
+#define XPSIZE 9 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+
+#define YDPI 300 /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The following values may be printer model dependent, or even printer
+serial number dependent. These values were obtained with the LaTeX
+TESTPAGE.TEX file for a Canon LBP-8 A2 printer; they express that fact
+that the real (0,0) is 30 dots to the left of, and 111 dots above, the
+top left corner of an 8.5in x 11in page. This disagrees with p. 53 of
+the User's Manual which gives values of 48 and 60. */
+
+#define XORIGIN 30 /* measured pixel coordinates of */
+#define YORIGIN 111 /* page origin (should be at (0,0)) */
+
+/* All Canon A2 command sequences are defined symbolically here, so that no
+magic byte strings appear in the text. */
+
+#define CSI "\033[" /* control sequence introducer */
+
+#define DOT_MODE "\033[11h" /* coordinates in dots */
+
+#define FONTNUMBER(n) (int)(200 + (n)) /* user font number in 200..255 */
+
+#define GS_NUMBER(n) (int)(3840 + (n)) /* graphics set number in 3840..4095 */
+
+#define HARD_RESET "\033c" /* hard reset to power-on defaults */
+#define SOFT_RESET "\033<"
+
+#define ISO_MODE "\033;" /* ISO text mode */
+
+#define RESET_MODE "\033[?1;3;4;5;6;7l" /* set no auto CR/LF, no LF with CR, */
+ /* no CR with LF, no CR with FF, no CR */
+ /* with VT */
+
+#define SEL_PAINT "\033[2&z" /* select paint memory mode - full */
+
+#define INIT_PARAMS "\033=" /* initialize parameters */
+
+#define SET_MODE "\033[?2h" /* set no auto FF, no auto position feed */
+
+#define SIZE_UNIT "\033[7\040I" /* units of 1/300 inch (i.e. dots) */
+
+#define SPACING_INCREMENT "\033[0;0\040G" /* set HMI and VMI to zero; */
+ /* all character spacing is done explicitly */
+
+#define PROPORT_PITCH "\033[?0\040K" /* select proportional pitch */
+
+#define STORE_POS "\033[1x" /* store current position */
+
+#define RESTORE_POS "\033[x" /* restore position */
+
+#define STOREPOS OUTS(STORE_POS)
+
+#define RESTOREPOS OUTS(RESTORE_POS)
+
+#define PAGE_EJECT "\033[z" /* eject page */
+/* Horizontal rule with lower-left corner at (x,y). NB: h in 1..9 */
+#define HRULE(x,y,w,h) {MOVETO(x,y-(h>>1)); OUTCSI; OUTNUM(h); OUTC('{');\
+ RMOVEX(w); OUTCSI; OUTC('}');}
+
+/* Map characters (0..32,33..127) to (160..192,33..127) */
+#define MAPCHAR(c) (((c) > 32) ? (c) : ((c) + 160))
+
+/* Move absolute to (x,y), page origin in lower left corner */
+#define MOVETO(x,y) {MOVEX(x); MOVEY(y);}
+
+/* Move absolute to (x,current y), page origin in lower left corner */
+#define MOVEX(x) {OUTCSI; OUTNUM(x); OUTC('\140');}
+
+/* Move absolute to (current x,y), page origin in lower left corner */
+#define MOVEY(y) {OUTCSI; OUTNUM(YSIZE-y); OUTC('d');}
+
+/* Output bitmap prefix to be followed by <bytecount> bytes of the bitmap */
+#define OUTBITMAP(bytecount,bytewidth) {\
+ OUTCSI;\
+ OUTNUM(bytecount);\
+ OUTC(';');\
+ OUTNUM(bytewidth);\
+ OUTS(".r");}
+
+/* Output TeX character number with mapping to Canon number */
+#define OUTCHAR(c) OUTC(MAPCHAR(c))
+#define FOUTCHAR(c) FOUTC(MAPCHAR(c))
+
+/* Output control sequence prefix */
+#define OUTCSI {OUTC('\033'); OUTC('[');}
+#define FOUTCSI {FOUTC('\033');FOUTC('[');}
+
+/* Output a number as a minimal decimal digit string */
+#define OUTNUM(n) OUTF("%d",n)
+
+/* Eject a page from the printer--this is the last command on each page */
+#define PAGEEJECT OUTC('\f')
+
+/* Move relative by (dx,0) from current point */
+#define RMOVEX(dx) if ((dx) > 0) \
+ {OUTCSI; OUTNUM(dx); OUTC('a');} \
+ else if ((dx) < 0) \
+ {OUTCSI; OUTNUM(-(dx)); OUTC('j');}
+
+/* Move relative by (0,dy) from current point */
+#define RMOVEY(dy) if ((dy) > 0) \
+ {OUTCSI; OUTNUM(dy); OUTC('k');} \
+ else if ((dy) < 0) \
+ {OUTCSI; OUTNUM(-(dy)); OUTC('e');}
+
+/* Set the number of copies of the current page (issue just before
+PAGEEJECT) */
+#define SETCOPIES(n) {OUTCSI; OUTNUM(n); OUTC('v');}
+
+/* Set the current font number. Canon A2 seems to need both a font
+number and an encoded graphics set number, sigh... */
+#if OS_ATARI
+#define SETCURRENTFONT(n) setcurrentfont(n)
+void
+setcurrentfont(n)
+UNSIGN16 n;
+{
+ OUTS("\033\050");
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>8)));
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>4)));
+ OUTC(0x30 | (0x0f & (GS_NUMBER(n))));
+ OUTF2("%s%dy",CSI,FONTNUMBER(n));
+}
+#else
+#define SETCURRENTFONT(n) {OUTS("\033\050");\
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>8)));\
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>4)));\
+ OUTC(0x30 | (0x0f & (GS_NUMBER(n))));\
+ OUTF2("%s%dy",CSI,FONTNUMBER(n));}
+#endif
+
+/* Vertical rule with lower-left corner at (x,y). NB: w in 1..9 */
+#define VRULE(x,y,w,h) {MOVETO(x+((w+1)>>1),y); OUTCSI; OUTNUM(w); OUTC('{');\
+ RMOVEY(h); OUTCSI; OUTC('}');}
+
+FILE* savefp = (FILE*)NULL;/* font output file */
+UNSIGN16 merit_fact; /* merit factor to download a character */
+struct new_sizes {
+ UNSIGN32 stor_inc;
+ COORDINATE new_w;
+ COORDINATE new_h;
+ COORDINATE new_d;
+};
+UNSIGN32 stor_limit; /* storage for down loaded fonts */
+UNSIGN32 stor_total; /* total used storage */
+UNSIGN32 stor_fonts; /* storage for single font */
+char tmoname[MAXFNAME]; /* temporary output file */
+
+#if ANSI
+BOOLEAN bigchar(struct font_entry *,BYTE);
+void concatenate(FILE*,FILE*);
+void dumpfnts(struct font_entry *);
+BOOLEAN isnewbig(struct font_entry *,struct char_entry *,struct new_sizes*);
+void loadcmap(struct font_entry *,BYTE);
+void outcrow(BYTE,UNSIGN16);
+#else
+BOOLEAN bigchar();
+void concatenate();
+void dumpfnts();
+BOOLEAN isnewbig();
+void loadcmap();
+void outcrow();
+#endif
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->bopact*/
+/**********************************************************************/
+/******************************* bopact *******************************/
+/**********************************************************************/
+
+void
+bopact() /* beginning of page action */
+{
+ str_ycp = -1; /* last string ycp */
+}
+
+/*-->bigchar*/
+/**********************************************************************/
+/****************************** bigchar *******************************/
+/**********************************************************************/
+
+/* Check if the character is too big to be down loaded */
+
+BOOLEAN
+bigchar(tfptr, c)
+struct font_entry *tfptr;
+BYTE c;
+{
+ struct char_entry *tcptr;
+ struct new_sizes increm;
+
+ tcptr = &(tfptr->ch[c]);
+ if(tcptr->isloaded)
+ return(FALSE);
+ if(tcptr->isknown)
+ return(tcptr->istoobig);
+ tcptr->isknown = TRUE;
+
+ return(tcptr->istoobig = isnewbig(tfptr, tcptr, &increm));
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrrow.h"
+
+/*-->concatenate*/
+/**********************************************************************/
+/**************************** concatenate *****************************/
+/**********************************************************************/
+void
+concatenate(f1, f2)
+FILE *f1, *f2;
+{
+ char buffer[CONCBUFFSIZE];
+ UNSIGN16 n;
+
+ rewind(f2);
+ while((n = fread(buffer, 1, CONCBUFFSIZE, f2)) > 0)
+ fwrite(buffer, 1, n, f1);
+}
+
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ FOUTS(HARD_RESET); /* Reset the printer */
+ /*FOUTS(HARD_RESET);*/
+ FOUTS(SEL_PAINT); /* Full paint mode */
+ FOUTS(DOT_MODE); /* spacing in units of dots */
+ FOUTS(SIZE_UNIT); /* ditto, sigh... */
+ FOUTS(SPACING_INCREMENT); /* HMI and VMI to 0 to prevent auto spacing */
+ FOUTS(SET_MODE); /* these two prevent page ejects when objects */
+ FOUTS(RESET_MODE); /* extend into margins */
+ FOUTS(PROPORT_PITCH); /* proportional pitch */
+ font_count = 0; /* no font numbers are assigned yet */
+ font_switched = TRUE;
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ struct font_entry *fentr;
+ int i;
+
+ if(!quiet)
+ (void)fprintf(stderr,"\nFont sizes and storages\n");
+ for(i = 0; i < font_count; i++) {
+ fentr = font_table[ i ];
+ dumpfnts(fentr);
+ }
+ if(!quiet)
+ (void)fprintf(stderr,"Total storage: %d\n",stor_total);
+ concatenate(savefp, plotfp); /* Concatenate fonts and TeX output */
+ fclose(plotfp);
+ unlink(tmoname);
+ plotfp = savefp;
+
+ OUTS(HARD_RESET); /* reset to power-up status */
+ OUTS(HARD_RESET); /* reset to power-up status */
+ OUTF("\n\n\n %s\n",dvoname);
+}
+
+/*-->dumpchar*/
+/**********************************************************************/
+/****************************** dumpchar ******************************/
+/**********************************************************************/
+/* Dump character pixmap to output */
+
+void
+dumpchar(c, chptr, baseline, width, height)
+UNSIGN16 c;
+struct char_entry *chptr;
+COORDINATE baseline, width, height;
+{
+ UNSIGN16 rowlen; /* Bytes/row */
+ UNSIGN16 sigbytes; /* Bytes/char cell row */
+ UNSIGN16 uprows, dwrows; /* Zero fill rows */
+ UNSIGN16 lfbytes; /* Zero fill columns */
+ UNSIGN32 *p; /* Pointer to raster image */
+ UNSIGN16 i, j; /* Loop variables */
+ BYTE byteout; /* Output byte */
+
+ uprows = height - baseline - chptr->yoffp;
+ dwrows = height - uprows - chptr->hp;
+ rowlen = (width + 7) >> 3;
+ sigbytes = (chptr->wp + 7) >> 3;
+ lfbytes = rowlen - sigbytes;
+ p = chptr->rasters;
+
+ FOUTCHAR(c);
+ FOUTC(chptr->pxlw);
+ /*FOUTC((BYTE)(chptr->pxlw - chptr->xoffp));*/
+ FOUTC((BYTE) chptr->wp);
+ /*FOUTC((BYTE)chptr->pxlw);*/
+ FOUTC((BYTE)((-chptr->xoffp) & 0x00ff));
+
+ for(i = 0; i < uprows; i++) /* Zero fill top rows */
+ for(j = 0; j < rowlen; j++)
+ FOUTC('\0');
+ for(i = 0; i < chptr->hp; i++) { /* Significant rows */
+ for(j = sigbytes; ; p++) {
+ byteout = (BYTE)((*p) >> 24);
+ FOUTC(byteout);
+ if((--j) <= 0)
+ break;
+ byteout = (BYTE)((*p) >> 16);
+ FOUTC(byteout);
+ if((--j) <= 0)
+ break;
+ byteout = (BYTE)((*p) >> 8);
+ FOUTC(byteout);
+ if((--j) <= 0)
+ break;
+ byteout = (BYTE)(*p);
+ FOUTC(byteout);
+ if((--j) <= 0)
+ break;
+ }
+ p++;
+ for(j = 0; j < lfbytes; j++) /* Zero bytes at left */
+ FOUTC('\0');
+ }
+ for(i = 0; i < dwrows; i++) /* Zero rows at bottom */
+ for(j = 0; j < rowlen; j++)
+ FOUTC('\0');
+}
+
+/*-->dumpfnts*/
+/**********************************************************************/
+/****************************** dumpfnts ******************************/
+/**********************************************************************/
+
+/* Dump entire font to output */
+
+void
+dumpfnts(tfptr)
+struct font_entry *tfptr;
+{
+ struct char_entry *cfptr; /* Character to be dumped */
+ UNSIGN16 nloaded; /* Number of loaded chars */
+ UNSIGN16 c; /* Ascii code */
+ COORDINATE baseline, width, height;
+
+ nloaded = tfptr->nloaded;
+ /* Count loaded chars */
+ if(!quiet)
+ (void)fprintf(stderr, "Font (%d x %d + %d) x %d : %d \n",
+ tfptr->cell_w, tfptr->cell_h, tfptr->cell_d, nloaded,
+ tfptr->storage);
+
+ if(!nloaded)
+ return;
+ baseline = tfptr->cell_d;
+ width = tfptr->cell_w;
+ height = tfptr->cell_h + baseline;
+ FOUTCSI;
+ (void)fprintf(savefp,
+ "%d;%d;0;0;%d;2;%d;%d;0;0;%d;%d;%d;%d;1;1;0;%d.p",
+ tfptr->storage,
+ nloaded,
+ GS_NUMBER(tfptr->font_number),
+ (int)30000/width,
+ (int)24*height,
+ FONTNUMBER(tfptr->font_number),
+ width,
+ height,
+ (baseline >= 0) ? MIN(baseline + 1, height) : -baseline,
+ /*MAX(1,MIN(abs(baseline),height)),*/
+ (baseline >= 0) ? 0 : 1);
+
+ for(c = FIRSTPXLCHAR; c <= LASTPXLCHAR; c++)
+ {
+ cfptr = &(tfptr->ch[c]);
+ if(cfptr->isloaded)
+ dumpchar(c, cfptr, baseline, width, height);
+ }
+ return;
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+
+/*-->eopact*/
+/**********************************************************************/
+/******************************* eopact *******************************/
+/**********************************************************************/
+
+void
+eopact() /* end of page action */
+{
+ if (copies > 1)
+ SETCOPIES(copies);
+ PAGEEJECT;
+}
+
+#include "f20open.h"
+#include "fatal.h"
+
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner, draw a filled
+rectangle at (x,y).
+
+For most TeX uses, rules are uncommon, and little optimization is
+possible. However, for the LaTeX Bezier option, curves are simulated by
+many small rules (typically 2 x 2) separated by positioning commands.
+
+It is not possible to use relative, instead of absolute, moves in these
+sequences, without stacking rules for the whole page, because each rule
+is separated in the DVI file by push, pop, and positioning commands,
+making for an uncertain correspondence between internal (xcp,ycp)
+pixel page coordinates and external device coordinates.
+
+The last string y coordinate, str_ycp, must be reset here to force any
+later setstr() to reissue new absolute positioning commands.
+***********************************************************************/
+
+{
+ str_ycp = -1; /* invalidate string y coordinate */
+
+ /*
+ Output a new rule at TeX position (x,y). The device coordinates
+ will be changed on completion. The rule origin is the TeX
+ convention of the lower-left corner. The Canon A2 limits vertical
+ rule widths, and horizontal rule heights, to 9 dots, so we may need
+ to generate more than one rule request.
+ */
+
+
+ if (width > height) /* horizontal rule */
+ {
+ for (; height > 0; (y += 9, height -= 9))
+ HRULE(x,y,width,(height > 9 ? 9 : height));
+ }
+ else /* vertical rule */
+ {
+ for (; width > 0; (x += 9, width -= 9))
+ VRULE(x,y,(width > 9 ? 9 : width),height);
+
+ }
+}
+
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+
+/*-->isnewbig*/
+/**********************************************************************/
+/****************************** isnewbig *******************************/
+/**********************************************************************/
+
+/* Is previously unknown character too big */
+
+BOOLEAN
+isnewbig(tfptr, tcptr, tsptr)
+struct font_entry *tfptr;
+struct char_entry *tcptr;
+struct new_sizes *tsptr;
+{
+ COORDINATE width, height, ch, cd, chd;
+ UNSIGN32 bmapsize, storage, storinc;
+
+ if(((width = tcptr->wp) > size_limit) ||
+ ((height = tcptr->hp) > size_limit))
+ return(TRUE);
+ bmapsize = ((width + 7) >> 3) * height + LOADSEQSIZE;
+ ch = tcptr->yoffp;
+ cd = height - ch;
+ if(ch < tfptr->cell_h)
+ ch = tfptr->cell_h;
+ ch = MAX(0, ch);
+ if(cd < tfptr->cell_d)
+ cd = tfptr->cell_d;
+ if(cd < 0)
+ cd = -MIN(cd + ch, -cd);
+ if(width < tfptr->cell_w)
+ width = tfptr->cell_w;
+ if((chd = ch + cd) > size_limit)
+ return(TRUE);
+
+ /* Calculate new storage */
+
+ storage = (width + 7) >> 3;
+ storage *= chd;
+ storage += 4;
+ storage *= (tfptr->nloaded + 1);
+ storinc = storage - tfptr->storage;
+ if(storage > stor_fonts)
+ return(TRUE);
+
+ if(storinc > merit_fact * bmapsize)
+ return(TRUE);
+
+ if(storinc + stor_total > stor_limit)
+ return(TRUE);
+
+
+ tsptr->new_w = width;
+ tsptr->new_h = ch;
+ tsptr->new_d = cd;
+ tsptr->stor_inc = storinc;
+ return(FALSE);
+}
+
+/*-->loadbmap*/
+/**********************************************************************/
+/****************************** loadbmap ******************************/
+/**********************************************************************/
+
+void
+loadbmap(c) /* load big character as raster bitmap */
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register INT16 bytewidth;
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+
+ if (fontptr != pfontptr)
+ (void)openfont(fontptr->n);
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh - tcharptr->xoffp,YSIZE-vv+tcharptr->yoffp);
+
+ STOREPOS;
+ MOVETO(xcp,ycp);
+ bytewidth = ((tcharptr->wp)+7)>>3;
+ OUTBITMAP(bytewidth*(tcharptr->hp), bytewidth);
+
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outcrow); /* load rasters into device */
+ RESTOREPOS;
+}
+
+#include "loadchar.h"
+
+/*-->loadcmap*/
+/**********************************************************************/
+/****************************** loadcmap ******************************/
+/**********************************************************************/
+
+/* Load character pixmap */
+
+void
+loadcmap(tfptr, c)
+struct font_entry * tfptr;
+BYTE c;
+{
+ struct new_sizes increm;
+
+ (void)isnewbig(tfptr, &(tfptr->ch[c]), &increm);
+
+ stor_total += increm.stor_inc;
+ tfptr->nloaded++;
+ tfptr->storage += increm.stor_inc;
+ tfptr->cell_h = increm.new_h;
+ tfptr->cell_d = increm.new_d;
+ tfptr->cell_w = increm.new_w;
+
+ loadchar(c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+
+/*-->newfont*/
+/**********************************************************************/
+/****************************** newfont *******************************/
+/**********************************************************************/
+
+void
+newfont()
+{
+ struct char_entry *tchptr;
+ register UNSIGN16 the_char; /* loop index */
+ INT16 j; /* loop index */
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++) {
+ tchptr = &(fontptr->ch[the_char]);
+ tchptr->isloaded = FALSE;
+ tchptr->isknown = FALSE;
+ tchptr->istoobig = TRUE;
+ }
+ fontptr->cell_d = fontptr->cell_h = -10000;
+ fontptr->cell_w = 0;
+ fontptr->nloaded = 0;
+ fontptr->storage = 0;
+
+ for (j = 0; j < (INT16)font_count; ++j)
+ if (font_table[j] == fontptr) /* then font already known */
+ break;
+
+ if (j >= (INT16)font_count) /* new font */
+ {
+ fontptr->font_number = font_count;
+ font_table[font_count++] = fontptr;
+ }
+}
+
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outcrow*/
+/**********************************************************************/
+/****************************** outcrow *******************************/
+/**********************************************************************/
+
+void
+outcrow(c, yoff)
+BYTE c;
+UNSIGN16 yoff;
+{
+ UNSIGN16 bytes_per_row;
+ register UNSIGN16 k;
+ register UNSIGN32 *p;
+ struct char_entry *tcharptr;
+ register BYTE the_byte;
+
+ tcharptr = &(fontptr->ch[c]);
+ bytes_per_row = ((tcharptr->wp) + 7) >> 3;
+ p = img_row;
+
+ for(k = bytes_per_row; ; ++p) {
+ the_byte = (BYTE)((*p) >> 24);
+ OUTC(the_byte);
+ if((--k) <= 0)
+ break;
+ the_byte = (BYTE)((*p) >> 16);
+ OUTC(the_byte);
+ if((--k) <= 0)
+ break;
+ the_byte = (BYTE)((*p) >> 8);
+ OUTC(the_byte);
+ if((--k) <= 0)
+ break;
+ the_byte = (BYTE)(*p);
+ OUTC(the_byte);
+ if((--k) <= 0)
+ break;
+ }
+}
+
+#include "outrow.h"
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ /* BIGCHAR() and ONPAGE() are used here and in setstr() */
+
+/*#define BIGCHAR(t) ((t->cell_w > (COORDINATE)size_limit) ||\
+ (t->cell_h > (COORDINATE)size_limit)) */
+
+#define ONPAGE(t) (((hh + t->pxlw) <= XSIZE) \
+ && (hh >= 0)\
+ && (vv <= YSIZE)\
+ && (vv >= 0))
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh - tcharptr->xoffp,YSIZE-vv);
+ if (ONPAGE(tcharptr))
+ { /* character fits entirely on page */
+ /*if (font_switched && !bigchar(fontptr, c))
+ {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+ */
+
+ if (VISIBLE(tcharptr))
+ {
+ if (bigchar(fontptr, c))
+ loadbmap(c);
+ else
+ {
+ if (!tcharptr->isloaded)
+ loadcmap(fontptr, c);
+
+ if (ycp != str_ycp)
+ {
+ MOVETO(xcp,ycp);
+ str_ycp = ycp;
+ }
+ else
+ MOVEX(xcp);
+
+ if(font_switched) {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+ OUTCHAR(c);
+ }
+ }
+ }
+ else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
+ { /* character is off page -- discard it */
+ (void)fprintf(stderr,
+ "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
+ isprint(c) ? c : '?',c,c,c);
+ NEWLINE(stderr);
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
+
+#include "setfntnm.h"
+#include "setrule.h"
+
+/*-->setstr*/
+/**********************************************************************/
+/******************************* setstr *******************************/
+/**********************************************************************/
+
+void
+setstr(c)
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register BOOLEAN inside;
+ INT32 h0,v0; /* (h,v) at entry */
+ COORDINATE hh0,vv0; /* (hh,vv) at entry */
+ COORDINATE hh_last; /* hh before call to fixpos() */
+ register UNSIGN16 k; /* loop index */
+ UNSIGN16 nstr; /* number of characters in str[] */
+ BYTE str[MAXSTR+1]; /* string accumulator */
+ BOOLEAN truncated; /* off-page string truncation flag */
+
+ /*******************************************************************
+ Set a sequence of characters in SETC_000 .. SETC_127 with a minimal
+ number of commands. These sequences tend to occur in long clumps in
+ a DVI file, and setting them together whenever possible
+ substantially decreases the overhead and the size of the output
+ file. A sequence can be set as a single string if
+
+ * TeX and device coordinates of each character agree, AND
+
+ * each character is in the same font (this will always be true
+ in a sequence from a DVI file), AND
+
+ * each character fits within the page boundaries, AND
+
+ * each character definition is already loaded, AND
+
+ * each character is from a visible font
+
+ Whenever any of these conditions does not hold, any string already
+ output is terminated, and a new one begun.
+
+ Two output optimizations are implemented here. First, up to MAXSTR
+ (in practice more than enough) characters are collected in str[],
+ and any that require downloading are handled. Then the entire
+ string is set at once, subject to the above limitations. Second, by
+ recording the vertical page coordinate, ycp, in the global variable
+ str_ycp (reset in prtpage() at begin-page processing), it is
+ possible to avoid outputting y coordinates unnecessarily, since a
+ single line of text will generally result in many calls to this
+ function.
+ *******************************************************************/
+
+#define BEGINSTRING {inside = TRUE;\
+ if (ycp != str_ycp)\
+ {\
+ MOVETO(xcp,ycp);\
+ str_ycp = ycp;\
+ }\
+ else\
+ MOVEX(xcp);}
+
+#define ENDSTRING {inside = FALSE;}
+
+#define OFF_PAGE (-1) /* off-page coordinate value */
+
+/* if (font_switched)
+ {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ } */
+
+ inside = FALSE;
+ truncated = FALSE;
+
+ hh0 = hh;
+ vv0 = vv;
+ h0 = h;
+ v0 = v;
+ nstr = 0;
+ while ((SETC_000 <= c) && (c <= SETC_127) && (nstr < MAXSTR))
+ { /* loop over character sequence */
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh ,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if ((!tcharptr->isloaded) && (!bigchar(fontptr, c)))
+ loadcmap(fontptr, c);
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+
+ str[nstr++] = c; /* save string character */
+
+ c = (BYTE)nosignex(dvifp,(BYTE)1);
+ }
+
+ /* put back character which terminated the loop */
+ (void)UNGETC((int)(c),dvifp);
+
+ hh = hh0; /* restore coordinates at entry */
+ vv = vv0;
+ h = h0;
+ v = v0;
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setstr(\"");
+ for (k = 0; k < nstr; ++k)
+ {
+ c = str[k];
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ }
+ (void)fprintf(stderr,"\") (hh,vv) = (%ld,%ld) font name <%s>",
+ (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ for (k = 0; k < nstr; ++k)
+ { /* loop over character sequence */
+ c = str[k];
+ tcharptr = &(fontptr->ch[c]);
+ moveto(hh ,YSIZE-vv);
+ /*(void)fprintf(stderr, "%c:dx %d, dy %d, dw %d\n", c, tcharptr->xoffp,
+ tcharptr->yoffp, tcharptr->pxlw);*/
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if (tcharptr->isloaded) /* character already downloaded */
+ {
+ if (!inside)
+ BEGINSTRING;
+ if(font_switched){
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+ OUTCHAR(c);
+ }
+ else /* character must be downloaded first */
+ {
+ if (inside)
+ ENDSTRING; /* finish any open string */
+ if (bigchar(fontptr, c))
+ loadbmap(c);
+ }
+ }
+ else /* character does not fit on page -- output */
+ { /* current string and discard the character */
+ truncated = TRUE;
+ if (inside)
+ ENDSTRING;
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh_last = hh;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ if (DBGOPT(DBG_POS_CHAR))
+ {
+ (void)fprintf(stderr,
+ "[%03o] xcp = %d\tycp = %d\thh = %d\thh_last = %d\n",
+ c,xcp,ycp,hh,hh_last);
+ }
+
+ /* If fixpos() changed position, we need new string next time */
+ if ((hh != hh_last) && inside)
+ ENDSTRING;
+ }
+ if (truncated && DBGOPT(DBG_OFF_PAGE) && !quiet)
+ {
+ (void)fprintf(stderr,"setstr(): Text [");
+ for (k = 0; k < nstr; ++k)
+ (void)fprintf(stderr,isprint(str[k]) ? "%c" : "\\%03o",str[k]);
+ (void)fprintf(stderr,"] truncated at page boundaries.");
+ NEWLINE(stderr);
+ }
+ if (inside) /* finish last string */
+ ENDSTRING;
+}
+
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvican.c b/dviware/beebe/src/dvican.c
new file mode 100644
index 0000000000..cf9f36444f
--- /dev/null
+++ b/dviware/beebe/src/dvican.c
@@ -0,0 +1,809 @@
+/* -*-C-*- dvican.c */
+/* Developed for Canon LBP-8 A2 from DVIIMP.C and DVIJEP.C [03-Jan-87]
+ Page references in comments refer to
+ Canon LBP-8 A1/A2 Laser Beam Printer User's Manual
+ edition PUB.R-IE-034-V1C.0186B2.5 (1985)
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ NB: This is a preliminary release. Serious problems with the Canon
+ A2 downloaded font mechanism force loading of characters as bitmaps
+ at every reference, making it very slow....
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*/
+
+/*-->DVICAN*/
+/**********************************************************************/
+/******************************* dvican *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef CANON_A2
+#define CANON_A2 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Canon LBP-8 A2 laser printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "can"
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* to get standard font resolution */
+
+#define MAXLINE 4096 /* maximum input file line size */
+ /* it is needed only in special() */
+
+#define XDPI 300 /* horizontal dots/inch */
+#define XPSIZE 9 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+
+#define YDPI 300 /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The following values may be printer model dependent, or even printer
+serial number dependent. These values were obtained with the LaTeX
+TESTPAGE.TEX file for a Canon LBP-8 A2 printer; they express that fact
+that the real (0,0) is 30 dots to the left of, and 111 dots above, the
+top left corner of an 8.5in x 11in page. This disagrees with p. 53 of
+the User's Manual which gives values of 48 and 60. */
+
+#define XORIGIN 30 /* measured pixel coordinates of */
+#define YORIGIN 111 /* page origin (should be at (0,0)) */
+
+/* All Canon A2 command sequences are defined symbolically here, so that no
+magic byte strings appear in the text. */
+
+#define CSI "\033[" /* control sequence introducer */
+
+#define DOT_MODE "\033[11h" /* coordinates in dots */
+
+#define FONTNUMBER(n) (int)(200 + (n)) /* user font number in 200..255 */
+
+#define GS_NUMBER(n) (int)(3840 + (n)) /* graphics set number in 3840..4095 */
+
+#define HARD_RESET "\033c" /* hard reset to power-on defaults */
+
+#define ISO_MODE "\033;" /* ISO text mode */
+
+#define RESET_MODE "\033[?1;4;5;6;7l" /* set no auto CR/LF, no LF with CR, */
+ /* no CR with LF, no CR with FF, no CR */
+ /* with VT */
+
+#define SEL_PAINT "\033[2&z" /* select paint memory mode - full */
+
+#define SET_MODE "\033[?2;3h" /* set no auto FF, no auto position feed */
+
+#define SIZE_UNIT "\033[7\040I" /* units of 1/300 inch (i.e. dots) */
+
+#define SPACING_INCREMENT "\033[0;0\040G" /* set HMI and VMI to zero; */
+ /* all character spacing is done explicitly */
+
+/* Horizontal rule with lower-left corner at (x,y). NB: h in 1..9 */
+#define HRULE(x,y,w,h) {MOVETO(x,y); OUTCSI; OUTNUM(h); OUTC('{');\
+ RMOVEX(w); OUTCSI; OUTC('}');}
+
+/* Map characters (0..32,33..127) to (160..192,33..127) */
+#define MAPCHAR(c) (((c) > 32) ? (c) : ((c) + 160))
+
+/* Move absolute to (x,y), page origin in lower left corner */
+#define MOVETO(x,y) {MOVEX(x); MOVEY(y);}
+
+/* Move absolute to (x,current y), page origin in lower left corner */
+#define MOVEX(x) {OUTCSI; OUTNUM(x); OUTC('\140');}
+
+/* Move absolute to (current x,y), page origin in lower left corner */
+#define MOVEY(y) {OUTCSI; OUTNUM(YSIZE-y); OUTC('d');}
+
+/* Output bitmap prefix to be followed by <bytecount> bytes of the bitmap */
+#define OUTBITMAP(bytecount,bytewidth) {\
+ OUTCSI;\
+ OUTNUM(bytecount);\
+ OUTC(';');\
+ OUTNUM(bytewidth);\
+ OUTS(".r");}
+
+/* Output TeX character number with mapping to Canon number */
+#define OUTCHAR(c) OUTC(MAPCHAR(c))
+
+/* Output control sequence prefix */
+#define OUTCSI {OUTC('\033'); OUTC('[');}
+
+/* Output a number as a minimal decimal digit string */
+#define OUTNUM(n) OUTF("%d",n)
+
+/* Eject a page from the printer--this is the last command on each page */
+#define PAGEEJECT OUTC('\f')
+
+/* Move relative by (dx,0) from current point */
+#define RMOVEX(dx) if ((dx) > 0) \
+ {OUTCSI; OUTNUM(dx); OUTC('a');} \
+ else if ((dx) < 0) \
+ {OUTCSI; OUTNUM(-(dx)); OUTC('j');}
+
+/* Move relative by (0,dy) from current point */
+#define RMOVEY(dy) if ((dy) > 0) \
+ {OUTCSI; OUTNUM(dy); OUTC('k');} \
+ else if ((dy) < 0) \
+ {OUTCSI; OUTNUM(-(dy)); OUTC('e');}
+
+/* Set the number of copies of the current page (issue just before
+PAGEEJECT) */
+#define SETCOPIES(n) {OUTCSI; OUTNUM(n); OUTC('v');}
+
+/* Set the current font number. Canon A2 seems to need both a font
+number and an encoded graphics set number, sigh... */
+#if OS_ATARI
+#define SETCURRENTFONT(n) setcurrentfont(n)
+void
+setcurrentfont(n)
+UNSIGN16 n;
+{
+ OUTS("\033\050");
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>8)));
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>4)));
+ OUTC(0x30 | (0x0f & (GS_NUMBER(n))));
+ OUTF2("%s%dy",CSI,FONTNUMBER(n));
+}
+#else
+#define SETCURRENTFONT(n) {OUTS("\033\050");\
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>8)));\
+ OUTC(0x20 | (0x0f & (GS_NUMBER(n)>>4)));\
+ OUTC(0x30 | (0x0f & (GS_NUMBER(n))));\
+ OUTF2("%s%dy",CSI,FONTNUMBER(n));}
+#endif
+
+/* Vertical rule with lower-left corner at (x,y). NB: w in 1..9 */
+#define VRULE(x,y,w,h) {MOVETO(x,y); OUTCSI; OUTNUM(w); OUTC('{');\
+ RMOVEY(h); OUTCSI; OUTC('}');}
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->bopact*/
+/**********************************************************************/
+/******************************* bopact *******************************/
+/**********************************************************************/
+
+void
+bopact() /* beginning of page action */
+{
+ str_ycp = -1; /* last string ycp */
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ OUTS(HARD_RESET); /* reset to power-up status */
+ OUTS(ISO_MODE); /* we do everything in ISO mode */
+ OUTS(SEL_PAINT); /* paint memory full needed for downloaded */
+ /* character support */
+ OUTS(DOT_MODE); /* spacing in units of dots */
+ OUTS(SIZE_UNIT); /* ditto, sigh... */
+ OUTS(SPACING_INCREMENT); /* HMI and VMI to 0 to prevent auto spacing */
+ OUTS(SET_MODE); /* these two prevent page ejects when objects */
+ OUTS(RESET_MODE); /* extend into margins */
+
+ font_count = 0; /* no font numbers are assigned yet */
+ font_switched = TRUE;
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ OUTS(HARD_RESET); /* reset to power-up status */
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+
+/*-->eopact*/
+/**********************************************************************/
+/******************************* eopact *******************************/
+/**********************************************************************/
+
+void
+eopact() /* end of page action */
+{
+ if (copies > 1)
+ SETCOPIES(copies);
+ PAGEEJECT;
+}
+
+#include "f20open.h"
+#include "fatal.h"
+
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner, draw a filled
+rectangle at (x,y).
+
+For most TeX uses, rules are uncommon, and little optimization is
+possible. However, for the LaTeX Bezier option, curves are simulated by
+many small rules (typically 2 x 2) separated by positioning commands.
+
+It is not possible to use relative, instead of absolute, moves in these
+sequences, without stacking rules for the whole page, because each rule
+is separated in the DVI file by push, pop, and positioning commands,
+making for an uncertain correspondence between internal (xcp,ycp)
+pixel page coordinates and external device coordinates.
+
+The last string y coordinate, str_ycp, must be reset here to force any
+later setstr() to reissue new absolute positioning commands.
+***********************************************************************/
+
+{
+ str_ycp = -1; /* invalidate string y coordinate */
+
+ /*
+ Output a new rule at TeX position (x,y). The device coordinates
+ will be changed on completion. The rule origin is the TeX
+ convention of the lower-left corner. The Canon A2 limits vertical
+ rule widths, and horizontal rule heights, to 9 dots, so we may need
+ to generate more than one rule request.
+ */
+
+
+ if (width > height) /* horizontal rule */
+ {
+ for (; height > 0; (y += 9, height -= 9))
+ HRULE(x,y,width,height);
+ }
+ else /* vertical rule */
+ {
+ for (; width > 0; (x += 9, width -= 9))
+ VRULE(x,y,width,height);
+
+ }
+}
+
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+
+/*-->loadbmap*/
+/**********************************************************************/
+/****************************** loadbmap ******************************/
+/**********************************************************************/
+
+void
+loadbmap(c) /* load big character as raster bitmap */
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register INT16 bytewidth;
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+
+ if (fontptr != pfontptr)
+ (void)openfont(fontptr->n);
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh - tcharptr->xoffp,YSIZE-vv+tcharptr->yoffp);
+
+ MOVETO(xcp,ycp);
+ bytewidth = ((tcharptr->wp)+7)>>3;
+ OUTBITMAP(bytewidth*(tcharptr->hp), bytewidth);
+
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* load rasters into device */
+}
+
+/*-->loadchar*/
+/**********************************************************************/
+/****************************** loadchar ******************************/
+/**********************************************************************/
+
+ /*******************************************************************
+
+ <------wp------>
+ ^ ................ ^
+ | ................ |
+ | ................ |
+ | ................ |
+ | ................ |
+ | ................ |--- yoffp (negative if (xcp,ycp) above bitmap)
+ | ................ |
+ hp ................ |
+ | ................ |
+ | ................ |
+ | ................ |
+ | .....o.......... v <-- character reference point (xcp,ycp) at "o"
+ | ................
+ | ................
+ | ................
+ | ................
+ v +............... <-- (xcorner,ycorner) at "+"
+ <--->
+ |
+ |
+ xoffp (negative if (xcp,ycp) left of bitmap)
+ when char set: (xcp',ycp') := (xcp+tfmw,ycp)
+
+ ----- --------
+ TeX Canon A2
+ ----- --------
+ xoffp left offset
+ yoffp top offset
+ wp width
+ hp height
+ tfmw advance width
+
+ *******************************************************************/
+
+void
+loadchar(c)
+register BYTE c;
+{
+ int baseline;
+
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c)) /* check character range */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr))
+ return; /* do nothing for invisible fonts */
+
+ if (fontptr != pfontptr)
+ openfont(fontptr->n);
+
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ (void)clearerr(plotfp);
+
+ tcharptr->isloaded = TRUE;
+
+ baseline = tcharptr->hp - tcharptr->yoffp;
+ if (baseline >= 0)
+ baseline = MAX(1,MIN(baseline,tcharptr->hp));
+ else
+ baseline = -MAX(1,MIN(-baseline,tcharptr->hp));
+
+ OUTCSI;
+ OUTF("%d;",
+ 2+(int)(((tcharptr->wp)+7)>>3)*(tcharptr->hp)); /* byte count */
+ OUTS("1;0;0;");
+ OUTF("%d;",GS_NUMBER(fontptr->font_number)); /* graphics set number */
+ OUTS("1;");
+ OUTF("%d;",(int)(tcharptr->hp)*24); /* hp*7200/300 == ht in centipoints */
+ OUTF("%d;",
+ (int)(30000/MAX(1,tcharptr->pxlw)));/* pitch as 100*chars/inch */
+ OUTS("0;0;");
+ OUTF("%d;",FONTNUMBER(fontptr->font_number));/* font number */
+ OUTF("%d;",(int)(tcharptr->wp)); /* cell width in 1..64 */
+ OUTF("%d;",(int)(tcharptr->hp)); /* cell height in 1..64 */
+ OUTF("%d;",(int)ABS(baseline)); /* cell baseline */
+ OUTS("1;1;0;");
+ OUTF("%d.p",(baseline >= 0 ? 0 : 1)); /* cell baseline sign flag */
+ OUTC(c); /* character code */
+ OUTC(tcharptr->pxlw); /* character width */
+ /* Now comes binary raster data */
+
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* output rasters */
+
+ SETCURRENTFONT(fontptr->font_number); /* Canon seems to need this */
+ font_switched = FALSE; /* again--most other devices do not */
+
+ if (DISKFULL(plotfp))
+ (void)fatal("loadchar(): Output error -- disk storage probably full");
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+
+/*-->newfont*/
+/**********************************************************************/
+/****************************** newfont *******************************/
+/**********************************************************************/
+
+void
+newfont()
+{
+ register UNSIGN16 the_char; /* loop index */
+ INT16 j; /* loop index */
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ fontptr->ch[the_char].isloaded = FALSE;
+
+ for (j = 0; j < (INT16)font_count; ++j)
+ if (font_table[j] == fontptr) /* then font already known */
+ break;
+
+ if (j >= (INT16)font_count) /* new font */
+ {
+ fontptr->font_number = font_count;
+ font_table[font_count++] = fontptr;
+ }
+}
+
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outrow*/
+/**********************************************************************/
+/******************************* outrow *******************************/
+/**********************************************************************/
+
+void
+outrow(c,yoff) /* copy img_row[] into rasters[] if allocated, else no-op */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) */
+{
+ UNSIGN16 bytes_per_row; /* number of raster bytes to copy */
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte; /* unpacked raster byte */
+
+ tcharptr = &(fontptr->ch[c]);/* assume check for valid c has been done */
+ bytes_per_row = ((tcharptr->wp) + 7) >> 3; /* wp div 8 */
+ p = img_row; /* we step pointer p along img_row[] */
+
+ for (k = bytes_per_row; ; ++p)
+ {
+ the_byte = (BYTE)((*p) >> 24);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 16);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 8);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)(*p);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+ }
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ /* BIGCHAR() and ONPAGE() are used here and in setstr() */
+
+#define BIGCHAR(t) ((t->wp > (COORDINATE)size_limit) ||\
+ (t->hp > (COORDINATE)size_limit))
+
+#define ONPAGE(t) (((hh - t->xoffp + t->pxlw) <= XSIZE) \
+ && (hh >= 0)\
+ && (vv <= YSIZE)\
+ && (vv >= 0))
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+ if (ONPAGE(tcharptr))
+ { /* character fits entirely on page */
+ if (font_switched)
+ {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+
+ if (VISIBLE(tcharptr))
+ {
+ if (BIGCHAR(tcharptr))
+ loadbmap(c);
+ else
+ {
+ if (!tcharptr->isloaded)
+ loadchar(c);
+
+ if (ycp != str_ycp)
+ {
+ MOVETO(xcp,ycp);
+ str_ycp = ycp;
+ }
+ else
+ MOVEX(xcp);
+
+ OUTCHAR(c);
+ }
+ }
+ }
+ else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
+ { /* character is off page -- discard it */
+ (void)fprintf(stderr,
+ "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
+ isprint(c) ? c : '?',c,c,c);
+ NEWLINE(stderr);
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
+
+#include "setfntnm.h"
+#include "setrule.h"
+
+/*-->setstr*/
+/**********************************************************************/
+/******************************* setstr *******************************/
+/**********************************************************************/
+
+void
+setstr(c)
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register BOOLEAN inside;
+ INT32 h0,v0; /* (h,v) at entry */
+ COORDINATE hh0,vv0; /* (hh,vv) at entry */
+ COORDINATE hh_last; /* hh before call to fixpos() */
+ register UNSIGN16 k; /* loop index */
+ UNSIGN16 nstr; /* number of characters in str[] */
+ BYTE str[MAXSTR+1]; /* string accumulator */
+ BOOLEAN truncated; /* off-page string truncation flag */
+
+ /*******************************************************************
+ Set a sequence of characters in SETC_000 .. SETC_127 with a minimal
+ number of commands. These sequences tend to occur in long clumps in
+ a DVI file, and setting them together whenever possible
+ substantially decreases the overhead and the size of the output
+ file. A sequence can be set as a single string if
+
+ * TeX and device coordinates of each character agree, AND
+
+ * each character is in the same font (this will always be true
+ in a sequence from a DVI file), AND
+
+ * each character fits within the page boundaries, AND
+
+ * each character definition is already loaded, AND
+
+ * each character is from a visible font
+
+ Whenever any of these conditions does not hold, any string already
+ output is terminated, and a new one begun.
+
+ Two output optimizations are implemented here. First, up to MAXSTR
+ (in practice more than enough) characters are collected in str[],
+ and any that require downloading are handled. Then the entire
+ string is set at once, subject to the above limitations. Second, by
+ recording the vertical page coordinate, ycp, in the global variable
+ str_ycp (reset in prtpage() at begin-page processing), it is
+ possible to avoid outputting y coordinates unnecessarily, since a
+ single line of text will generally result in many calls to this
+ function.
+ *******************************************************************/
+
+#define BEGINSTRING {inside = TRUE;\
+ if (ycp != str_ycp)\
+ {\
+ MOVETO(xcp,ycp);\
+ str_ycp = ycp;\
+ }\
+ else\
+ MOVEX(xcp);}
+
+#define ENDSTRING {inside = FALSE;}
+
+#define OFF_PAGE (-1) /* off-page coordinate value */
+
+ if (font_switched) /* output new font selection */
+ {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+
+ inside = FALSE;
+ truncated = FALSE;
+
+ hh0 = hh;
+ vv0 = vv;
+ h0 = h;
+ v0 = v;
+ nstr = 0;
+ while ((SETC_000 <= c) && (c <= SETC_127) && (nstr < MAXSTR))
+ { /* loop over character sequence */
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if ((!tcharptr->isloaded) && (!BIGCHAR(tcharptr)))
+ loadchar(c);
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+
+ str[nstr++] = c; /* save string character */
+
+ c = (BYTE)nosignex(dvifp,(BYTE)1);
+ }
+
+ /* put back character which terminated the loop */
+ (void)UNGETC((int)(c),dvifp);
+
+ hh = hh0; /* restore coordinates at entry */
+ vv = vv0;
+ h = h0;
+ v = v0;
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setstr(\"");
+ for (k = 0; k < nstr; ++k)
+ {
+ c = str[k];
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ }
+ (void)fprintf(stderr,"\") (hh,vv) = (%ld,%ld) font name <%s>",
+ (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ for (k = 0; k < nstr; ++k)
+ { /* loop over character sequence */
+ c = str[k];
+ tcharptr = &(fontptr->ch[c]);
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if (tcharptr->isloaded) /* character already downloaded */
+ {
+ if (!inside)
+ BEGINSTRING;
+ OUTCHAR(c);
+ }
+ else /* character must be downloaded first */
+ {
+ if (inside)
+ ENDSTRING; /* finish any open string */
+ if (BIGCHAR(tcharptr))
+ loadbmap(c);
+ }
+ }
+ else /* character does not fit on page -- output */
+ { /* current string and discard the character */
+ truncated = TRUE;
+ if (inside)
+ ENDSTRING;
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh_last = hh;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ if (DBGOPT(DBG_POS_CHAR))
+ {
+ (void)fprintf(stderr,
+ "[%03o] xcp = %d\tycp = %d\thh = %d\thh_last = %d\n",
+ c,xcp,ycp,hh,hh_last);
+ }
+
+ /* If fixpos() changed position, we need new string next time */
+ if ((hh != hh_last) && inside)
+ ENDSTRING;
+ }
+ if (truncated && DBGOPT(DBG_OFF_PAGE) && !quiet)
+ {
+ (void)fprintf(stderr,"setstr(): Text [");
+ for (k = 0; k < nstr; ++k)
+ (void)fprintf(stderr,isprint(str[k]) ? "%c" : "\\%03o",str[k]);
+ (void)fprintf(stderr,"] truncated at page boundaries.");
+ NEWLINE(stderr);
+ }
+ if (inside) /* finish last string */
+ ENDSTRING;
+}
+
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvidjp.c b/dviware/beebe/src/dvidjp.c
new file mode 100644
index 0000000000..c9e79cad96
--- /dev/null
+++ b/dviware/beebe/src/dvidjp.c
@@ -0,0 +1,579 @@
+
+/*
+I just got myself a brand new HP Desk Jet Plus printer to use with TeX.
+I and a number of other people asked the net for sources to one of the many
+DeskJet drivers which must be out there, but there was no response. I
+searched all the archives I could find, with similarly unsuccessful
+results.
+
+So I took the dvijet driver from the Beebe release and modified it for
+the desk jet plus. It might be called (as by some) a "vanilla" driver
+because it doesn't use downloadable fonts, but downloadable fonts
+requires an extra memory cartridge -- for that I would have just
+as soon bought the IIp. I did include some memory compaction, though,
+which reduces file size and transfer time by 50 - 70 % So it's not
+quite vanilla. The various compaction schemes can be switched off
+at compile time if the old Desk Jet doesn't support them (I have no
+idea) or if any of them prove buggy (possible).
+
+I include the modified source below, as I am guessing there are
+others out there on the net who would find it useful. Perhaps some
+kind soul will even archive it. It requires the rest of the
+Beebe driver code, which is commonly available -- eg,
+at ymir.claremont.edu & utah ... whatever.
+
+Hope this is helpful. Sorry if this isn't the place I'm supposed to post
+source, but it's the best way I know to reach people who might find
+this useful.
+
+Paul Kirkaas
+kirkaas@cs.ucla.edu
+
+----------------------------------------------------------
+/* -*-C-*- dvidjp.c */
+/*-->dvidjp*/
+/**********************************************************************/
+/******************************* dvidjp *******************************/
+/**********************************************************************/
+
+/* Driver for HP DeskJet Plus printer -- modified from
+ * Beebe Laser Jet driver
+ * by Paul Kirkaas (kirkaas@cs.ucla.edu) 22 May 1990
+ * patch 1 -- bugs in YOFF & COMPACTION fixed 23 May 1990
+ *
+ * Employs 3 types of data compaction for greater efficiency --
+ * up to 60 - 70% reduction in output file size. Each compaction
+ * scheme can be switched on or off independently by defining any
+ * or all of:
+ *
+ * XOFF -- X offset -- instead of a string of leading zeros, offset
+ * by appropriate amount. Minimal savings when used with
+ * COMPACTION mode set.
+ *
+ * YOFF -- Y offset -- compress multiple blank lines into a single
+ * y skip command.
+ *
+ * COMPACTION -- Uses mode 2 compaction on Desk Jet Plus -- this is
+ * the trickiest but most effective compression modification.
+ * This is the likliest part to have a bug.
+ * Lots of cleaning up can be done here.
+ *
+ * If you have an old Desk Jet (not a Plus) it may not have
+ * all these abilities -- try undfining some of these switches.
+ *
+ * It should run straight with the Beebe driver set; you might
+ * have to make some adjustments.
+ *
+ * Please let me know if you make any improvements or repairs.
+ * Thanks
+ *
+ * Good Luck.
+ */
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef HPLASERJET
+#define HPLASERJET 1 /* conditional compilation flag */
+#define HPDESKJET 1 /* conditional compilation flag */
+ /* Include the following line for Y offsets*/
+#define YOFF 1
+ /* Include the following line for using temporary X offsets*/
+#define XOFF 1
+ /* Include the following line for Mode 2 Compaction */
+#define COMPACTION 1
+/*
+#define COMPACTION 0
+*/
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID (comp ? \
+ "Hewlett-Packard Desk Jet plus (from LaserJet)\n\
+ WITH Data Compaction for faster I/O" : \
+ "Hewlett-Packard Desk Jet plus (from LaserJet)\n\
+ with-OUT Data Compaction I/O" )
+ /* this string is printed at runtime */
+#define OUTFILE_EXT (comp ? "djc" : "dj")
+
+#define DEFAULT_RESOLUTION 300 /* default dots/inch on HP Desk Jet */
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* 0 for low-resolution devices */
+
+#define XDPI 300 /* HP Laser Jet horizontal dots/inch */
+#define XPSIZE 8 /* horizontal paper size in inches */
+
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI 300 /* HP Laser Jet vertical dots/inch */
+
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map (must have an even number of columns). */
+
+#define XBIT ((1+2*XWORDS)/2)
+#define YBIT YSIZE
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+int comp = COMPACTION; /* compaction flag -- reset in option.h */
+
+#include "bitmap.h"
+
+#include "main.h"
+#undef STDMAG
+#undef RESOLUTION
+#define STDMAG 1500
+#define RESOLUTION (((float)STDMAG)/5.0) /* dots per inch */
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ OUTS("\033E"); /* printer reset */
+ OUTS("\033&l0L"); /* Disable perforation skip */
+/* OUTS("\033*rB"); /* End graphics */
+ OUTS("\033*t300R"); /* printer resolution */
+if (comp)
+ OUTS("\033*b2M"); /* Select Compacted Graphics Mode Two */
+else
+ OUTS("\033*b0M"); /* Select Full Graphics Mode */
+
+ OUTS("\033*r0A"); /* Start graphics, at leftmost position */
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ OUTS("\033E"); /* printer reset*/
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "dispchar.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "initglob.h"
+#include "inch.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pbit)
+UNSIGN32 *pbit; /* pointer to raster line */
+
+/*************************************************************************
+Use machine-specific coding here for efficiency. For TOPS-20, we encode
+9 bytes from every pair of 36-bit words.
+
+For each raster line on the paper, the Laser Jet expects a binary 8-bit
+byte stream of the form
+
+ <ESC>*bnnnWxxxxxxx ... xxxxxxx
+ <--- nnn bytes --->
+
+where each byte contains, in order from high to low bit, a left-to-right
+bit pattern. No end-of-line marker is required; the escape sequence
+automatically causes a new raster line to be started.
+*************************************************************************/
+
+{
+ register UNSIGN32 w_even,w_odd;
+ register UNSIGN32 *p;
+ register BYTE *pbuf;
+ BYTE buf[1+(XSIZE+7)/8]; /* space for EOS + n 8-bit bytes */
+ register INT16 i,last_word;
+ int ic,jc; /* just counters */
+ unsigned char * endb; /* pointer to end of buf */
+ unsigned char greystr[129]; /* Max length of 127 in compacted mode 2 */
+ unsigned char * greyp; /* Pointer to greystr[] */
+ unsigned char outstr[999]; /* Compacted mode 2 output string */
+ unsigned char * outp; /* Pointer to outstr[] */
+ unsigned char * endob; /* pointer to end of outstr */
+ unsigned char cmp; /* Comparison variable */
+ int outsz; /* Size of outstr -- since includes NULLs */
+ int count;
+ int gcnt; /* Length of grey runs */
+
+
+#if IBM_PC_MICROSOFT
+ for (last_word = XBIT - 1;
+ (last_word >= 1) && (*(UNSIGN32*)normaddr(pbit,last_word) == 0);
+ --last_word)
+ ; /* trim white space a word at a time */
+#else
+ p = pbit + XBIT - 1; /* point to last word on line */
+ for (last_word = XBIT - 1; (last_word >= 1) && (*p == 0); --last_word)
+ --p; /* trim white space a word at a time */
+#endif
+
+ p = pbit;
+ pbuf = &buf[0];
+ for (i = 0; i <= last_word; i += 2) /* loop over trimmed raster */
+ {
+ w_even = (*p++);
+ w_odd = (*p++);
+
+#if (HOST_WORD_SIZE == 36)
+ *pbuf++ = (BYTE)( (w_even >> 28) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 20) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 12) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 4) & 0xff);
+ *pbuf++ = (BYTE)( ((w_even << 4) | (w_odd >> 32)) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 24) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 16) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 8) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd ) & 0xff);
+#else /* HOST_WORD_SIZE == 32 */
+ /* encode 8 bytes at a time on 32-bit machines */
+ *pbuf++ = (BYTE)( (w_even >> 24) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 16) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 8) & 0xff);
+ *pbuf++ = (BYTE)( (w_even ) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 24) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 16) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 8) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd ) & 0xff);
+#endif
+
+ }
+
+ *pbuf = '\0'; /* trailing EOS marker */
+
+ last_word |= 1; /* make last_word ODD */
+ for (i = ((last_word+1)*HOST_WORD_SIZE)/8;
+ (*(--pbuf) == '\0') && (i > 1); --i)
+ ; /* trim trailing zero bytes, leaving at least one */
+ last_word = i;
+#ifdef XOFF
+ /* Trim leading zero bytes & do appropriate Temporary X offset */
+ OUTS("\033*b"); /* Set up for raster transfer */
+ pbuf=buf;
+ for (ic=0; !buf[ic] && ic<last_word ; ic++, pbuf++)
+ ;
+ if (ic>10) /* Do an X-shift */
+ {
+ OUTF("%dx",8*ic); /* Shift by 8*ic # of blank pixels */
+ }
+ else /* don't bother */
+ { pbuf = buf; ic = 0; }
+
+ endb = &buf[last_word];
+
+if (comp)
+ {
+ greyp = greystr;
+ outp = outstr;
+ outsz = gcnt = 0;
+ endb = &buf[last_word];
+ while (pbuf <= endb)
+ {
+ cmp = *pbuf;
+ for (count = 0; count<127 && pbuf<=endb && cmp==*pbuf; count ++, pbuf++)
+ ;
+ if (count==0){printf("DANGER DANGER ***COUNT IS ZERO***!!!\n");exit(0);}
+ if (count <= 3) /* No run yet -- just put them in greystr */
+ {
+ gcnt += count;
+ for (jc = 0; jc < count ; jc ++)
+ {
+ *greyp = cmp;
+ greyp++;
+ }
+ if (gcnt >= 124) /* Can't have more than 127, so ... */
+ {
+ outstr[outsz] = gcnt-1;
+ outsz++;
+ for (jc = 0; jc < gcnt; jc ++)
+ {
+ outstr[outsz + jc] = greystr[jc];
+ }
+ outsz += gcnt;
+ gcnt = 0;
+ greyp = greystr;
+ continue;
+ }
+ }
+ else /* We have a run of 4 or more */
+ {
+ if (gcnt) /* Flush our accumilated grey */
+ {
+ outstr[outsz] = gcnt-1;
+ outsz++;
+ for (jc = 0; jc < gcnt; jc ++)
+ {
+ outstr[outsz + jc] = greystr[jc];
+ }
+ outsz += gcnt;
+ gcnt = 0;
+ greyp = greystr;
+ }
+ outstr[outsz] = (unsigned char) (1-count); /* Is this cast right? */
+ outsz ++;
+ outstr[outsz] = cmp;
+ outsz++;
+ }
+ }
+ if (gcnt) /* Flush our accumilated grey */
+ {
+ outstr[outsz] = gcnt-1;
+ outsz++;
+ for (jc = 0; jc < gcnt; jc ++)
+ {
+ outstr[outsz + jc] = greystr[jc];
+ }
+ outsz += gcnt;
+ gcnt = 0;
+ greyp = greystr;
+ }
+ OUTF("%dW",outsz); /* How much is coming ... */
+ endob = outstr + outsz -1; /* End of the outstr */
+ for (outp = outstr; outp <= endob; outp++ )
+ OUTC(*outp);
+
+ }
+ else
+ {
+ OUTF("%dW",(int)last_word-ic); /* How much is coming ... */
+ /* cannot use fprintf with %s format because of
+ NUL's in string, and it is slow anyway */
+ for (i = ic; i < last_word; ++pbuf,++i)
+ OUTC(*pbuf);
+ }
+#else
+ OUTF("\033*b%dW",(int)last_word);
+ pbuf = &buf[0]; /* cannot use fprintf with %s format because of
+ NUL's in string, and it is slow anyway */
+ for (i = 0; i < last_word; ++pbuf,++i)
+ OUTC(*pbuf);
+#endif XOFF
+}
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+
+{
+ register UNSIGN32 *p;
+ register INT16 j,k,ybottom,ytop;
+#ifdef YOFF
+ int ycnt = 0;
+#endif YOFF
+/* OUTS("\033E"); /* printer reset */
+/* OUTS("\033&l0L"); /* Disable perforation skip */
+/* OUTS("\033*rB"); /* End graphics */
+/* OUTS("\033*t300R"); /* printer resolution */
+if (comp)
+ OUTS("\033*b2M"); /* Select Compacted Graphics Mode Two */
+else
+ OUTS("\033*b0M"); /* Select Full Graphics Mode */
+
+ OUTS("\033*r0A"); /* Start graphics, at leftmost position */
+
+ if (DBGOPT(DBG_PAGE_DUMP))
+ {
+ INT16 k1,k2,k3;
+
+ for (k3 = 0; k3 < XBIT; (k3 += 7, ++p))
+ { /* print bitmap 7 words at a pass */
+ k1 = k3;
+ k2 = MIN(XBIT,k1+7);
+ (void)printf("prtbmap()...bitmap words %d..%d",k1,k2-1);
+ NEWLINE(stdout);
+ (void)printf(" ");
+ for (k = k1; k < k2; ++k)
+ (void)printf("%10d",k*HOST_WORD_SIZE);
+ NEWLINE(stdout);
+ for (j = YBIT-1; j >= 0; --j)
+ {
+ p = BITMAP(j,0);
+ for (k = 0; k < XBIT; (++k,++p))
+ {
+ if (*p) /* print non-blank raster line */
+ {
+ p = BITMAP(j,k1);
+ (void)printf("%5d:",j);
+ for (k = k1; k < k2; (++k,++p))
+ (void)printf(" %09lx",*p);
+ NEWLINE(stdout);
+ break; /* exit loop over k */
+ }
+ }
+ }
+ }
+ }
+
+ (void)clearerr(plotfp);
+
+#if ZAPTHISOUT
+ k = -1; /* find top non-zero raster */
+ for (j = YBIT-1; (j > 0) && (k < 0); --j) /* loop over raster lines */
+ {
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+ }
+ ytop = j;
+#else
+ ytop = YBIT-1;
+#endif
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1;((k >= 0) && (*BITMAP(j,k) == 0));--k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,j-1);
+
+#if ZAPTHISOUT
+ for (j = ytop; (j >= ybottom); --j)
+ {
+ OUTF("%5d:",(int)j);
+ for (k = 0; k < XBIT; ++k)
+ OUTF(" %9x",*BITMAP(j,k));
+ NEWLINE(plotfp);
+ }
+#endif
+
+
+#ifdef YOFF
+ ycnt = 0;
+ for (j = ytop; (j >= ybottom) ; --j) /* loop over raster lines */
+ {
+ if (isNul (BITMAP(j,0)))
+ ycnt ++;
+ else
+ {
+ if (ycnt) OUTF("\033*p+%dY",ycnt);
+ outline(BITMAP(j,0));
+ ycnt = 0;
+ }
+ }
+#else
+ for (j = ytop; (j >= ybottom) ; --j) /* loop over raster lines */
+ outline(BITMAP(j,0));
+#endif YOFF
+
+ OUTS("\033*rB\f"); /* end raster graphics, eject page */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("Output error -- disk storage probably full");
+}
+#ifdef YOFF
+isNul (pbit) UNSIGN32 *pbit;
+{
+ UNSIGN32 * p;
+#if IBM_PC_MICROSOFT
+ int last_word;
+ for (last_word = XBIT - 1;
+ (last_word >= 1) && (*(UNSIGN32*)normaddr(pbit,last_word) == 0);
+ --last_word)
+ ; /* trim white space a word at a time */
+ if (last_word <=1) return 1;
+ return 0;
+#else
+ p = pbit + XBIT - 1; /* point to last word on line */
+ while ( !*p && p>pbit ) p--;
+ if (p==pbit && !*p) return 1;
+ return 0;
+#endif IBM_PC_MICROSOFT
+}
+#endif YOFF
+
+#include "outrow.h"
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvie72.c b/dviware/beebe/src/dvie72.c
new file mode 100644
index 0000000000..5a2c24188a
--- /dev/null
+++ b/dviware/beebe/src/dvie72.c
@@ -0,0 +1,712 @@
+/* -*-C-*- dvie72.c */
+/*-->dvie72*/
+/**********************************************************************/
+/******************************* dvie72 *******************************/
+/**********************************************************************/
+
+/***********************************************************************
+DVIE72 was developed from one of the dot-matrix printer drivers by
+Marcus Moehrmann (EMAIL: marcus%fkihh@unido.uucp). The following
+remarks are his.
+
+This is an implementation for Epson and compatible printers. Printers
+with 9 needles are supported; those with 24 are not. I hope that I have
+only used the ESC/P-Standard. The only documentation I have had was a
+description for the NEC Pinwriter P6/P7, but our printer is a Logitec,
+which I used for testing.
+
+There is a difference in paper feeding, because the P6/P7-handbook says
+that
+
+ <ESC> J (n)
+
+performs n/180 inch paper feeding, but our printer performs n/216 inch
+paper feeding, which I think is the standard, so I have used this in the
+driver.
+
+For horizontal resolution I have used the Esc-sequences
+
+ <ESC> * (m) (n1) (n2) [m = 0, 1, 2, 3]
+
+instead of
+
+ <ESC> (x) (n1) (n2) [x = 'K', 'L', 'Y', 'Z']
+
+If this will not work on your printer, change the definitions of
+'EPSON_BIT_IMAGE' and 'EPSON_MICRO_STEP' and the variable 'resolution'
+in procedure 'outline'.
+
+Be careful with the reset command
+
+ <ESC> @
+
+I have done this before any printing, and then after about 1.5 pages the
+printer stopped. The same works quite well on a second printer.
+
+Specialities: There is a switch '-t' for twice-a-line printing, that is,
+print one line in 1/120 inch horizontal spacing, return print head
+without paper feeding, perform a 1/240 inch step and then print the
+second line with 1/120 inch spacing.
+
+***********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef EPSON
+#define EPSON 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10 [experimental]" /* DVI driver version number */
+
+#undef HIRES
+#define HIRES 0 /* 0 for 72-dpi version */
+
+#if HIRES
+#define DEVICE_ID "Epson 9-pin family 240/216-dpi matrix printer"
+ /* this string is printed at runtime */
+#define OUTFILE_EXT "eps"
+
+#define XDPI 240 /* horizontal dots/inch */
+#define YDPI 216 /* vertical dots/inch */
+
+#else /* NOT HIRES */
+#define DEVICE_ID "Epson 9-pin family 60/72-dpi matrix printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "e72"
+
+#define XDPI 60 /* horizontal dots/inch */
+#define YDPI 72 /* vertical dots/inch */
+#endif /* HIRES */
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#if HIRES
+#define STDRES 1 /* 0 for low-resolution devices */
+#else /* NOT HIRES */
+#define STDRES 0 /* 0 for low-resolution devices */
+#endif /* HIRES */
+
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+#if HIRES
+INT16 paperfeeding; /* outstanding 1/216 inch */
+ /* form-feedings */
+
+BOOLEAN twice_a_line = FALSE; /* this is runtime option '-t' */
+ /* print in 1/120-inch-mode, */
+ /* 2nd line shifted 1/240 inch */
+
+ /* need single-arg outline() */
+BOOLEAN micro_step; /* used in outline() */
+#define OUTLINE(v,flag) {micro_step = flag; outline(v);}
+#endif /* HIRES */
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif /* (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD) */
+
+#define EPSON_ADV_PAPER "\033J%c" /* advance paper n/216 inch */
+#define EPSON_BIT_IMAGE "\033*%c%c%c"
+#define EPSON_MICRO_STEP OUTF2("\033*\003\001%c%c",'\000','\000')
+
+#include "bitmap.h"
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc, argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr, "[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+
+#if HIRES
+ if (twice_a_line && !quiet)
+ {
+ (void)fprintf(stderr, "[Twice-a-line-printing for high resolution]");
+ NEWLINE(stderr);
+ }
+#endif /* HIRES */
+
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+
+char
+makechar(p, mask)
+register UNSIGN32 *p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000'; /* MSB controls top needle */
+
+#if HIRES
+ if (*Q(0) & mask)
+ c |= '\200';
+ if (*Q(3) & mask)
+ c |= '\100';
+ if (*Q(6) & mask)
+ c |= '\040';
+ if (*Q(9) & mask)
+ c |= '\020';
+ if (*Q(12) & mask)
+ c |= '\010';
+ if (*Q(15) & mask)
+ c |= '\004';
+ if (*Q(18) & mask)
+ c |= '\002';
+ if (*Q(21) & mask)
+ c |= '\001';
+#else /* NOT HIRES */
+ if (*Q(0) & mask)
+ c |= '\200';
+ if (*Q(1) & mask)
+ c |= '\100';
+ if (*Q(2) & mask)
+ c |= '\040';
+ if (*Q(3) & mask)
+ c |= '\020';
+ if (*Q(4) & mask)
+ c |= '\010';
+ if (*Q(5) & mask)
+ c |= '\004';
+ if (*Q(6) & mask)
+ c |= '\002';
+ if (*Q(7) & mask)
+ c |= '\001';
+#endif /* HIRES */
+
+ return (c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+#if HIRES
+/*-->outpaperfeed*/
+/**********************************************************************/
+/*************************** outpaperfeed *****************************/
+/**********************************************************************/
+
+void
+outpaperfeed(count) /* accumulate 1/216 inch paperfeedings */
+INT16 count; /* and write them out if count == 0 */
+{
+
+ register INT16 k;
+
+ if (count)
+ paperfeeding += count;
+ else
+ {
+ for (k = paperfeeding / 255; k; --k)
+ OUTF(EPSON_ADV_PAPER, 255);
+ if ((k = paperfeeding % 255) > 0)
+ OUTF(EPSON_ADV_PAPER, k);
+ paperfeeding = 0;
+ }
+}
+#endif /* HIRES */
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline;
+{
+ register char* a;
+ register char* b;
+ register char* c;
+ register INT16 left;
+ INT16 len;
+ INT16 linelength;
+ char resolution;
+ BYTE spacing;
+ BYTE space_width;
+
+#if HIRES
+ if (twice_a_line) /* step 1/240 inch forward */
+ {
+ resolution = '\001'; /* 1/120 */
+ space_width = 12; /* 12/120 */
+ linelength = XSIZE / 2;
+ }
+ else
+ {
+ resolution = '\003'; /* 1/240 */
+ space_width = 24; /* 24/240 */
+ linelength = XSIZE;
+ }
+#else /* NOT HIRES */
+ resolution = '\000'; /* 1/60 */
+ space_width = 6; /* 6/60 */
+ linelength = XSIZE;
+#endif /* HIRES */
+
+ for ((left = linelength, c = pline + linelength - 1);
+ (*c == '\000') && (left > 0);
+ (--left, --c)) /* trim white space */
+ ;
+
+ if (left == 0)
+ return; /* NEWLINE() is not needed for any paperfeeding */
+
+#if HIRES
+ (void)outpaperfeed(0); /* print accumulated paperfeedings */
+#endif /* HIRES */
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Only runs longer than
+ "space_width" are taken, because we print spaces in text mode. This
+ implies that the run only consists of '\000' characters.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ Since the character strings take on all values on 0 .. 255, we
+ cannot store a termination marker, but must instead keep a counter,
+ "left", which is decremented to 0 when the end of the string is
+ reached.
+
+ ?????????????0000000000000000????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+
+
+ We cannot use fprintf %s because 0 bytes terminate string, so we are
+ using putc for writing the line.
+ *******************************************************************/
+
+ if (runlengthcode && (left >= space_width))
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && (*a == '\000') && left; --left)
+ ; /* advance over run */
+ len = (INT16) (c - a); /* "c" points past run */
+
+ if (len >= space_width) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+#if HIRES
+ if (micro_step)
+ {
+ EPSON_MICRO_STEP;
+ micro_step = FALSE;
+ }
+#endif /* HIRES */
+ OUTF3(EPSON_BIT_IMAGE, resolution, ((int) (a - b)) % 256,
+ ((int) (a - b)) / 256);
+ for (; b < a; b++)
+ OUTC(*b);
+ }
+
+ c -= len % space_width; /* shorten run */
+ left += len % space_width;
+
+ for (spacing = (BYTE)(len / space_width); spacing; --spacing)
+ OUTC(' '); /* output run */
+
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ } /* end for() loop */
+
+ if (a > b) /* output remaining string */
+ {
+#if HIRES
+ if (micro_step)
+ {
+ EPSON_MICRO_STEP;
+ micro_step = FALSE;
+ }
+#endif /* HIRES */
+ OUTF3(EPSON_BIT_IMAGE,resolution,((int) (a - b)) % 256,
+ ((int) (a - b)) / 256);
+ for (; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ else /* no runlength coding */
+ if (left > 0)
+ {
+#if HIRES
+ if (micro_step)
+ {
+ EPSON_MICRO_STEP;
+ micro_step = FALSE;
+ }
+#endif /* HIRES */
+ OUTF3(EPSON_BIT_IMAGE,resolution,left % 256,left / 256);
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+ }
+ NEWLINE(plotfp);
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register BYTE *c; /* pointer into v8[][] and v8t[][][] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+
+#if SEGMEM
+#else /* NOT SEGMEM */
+ UNSIGN32 *ptmp; /* pointer into bitmap[][] */
+#endif /* SEGMEM */
+
+ register UNSIGN32 mask; /* mask for single bit selection */
+ register INT16 k;
+ INT16 i;
+ INT16 j;
+ INT16 ybottom;
+ INT16 ytop;
+
+#if HIRES
+ BYTE v8[3][XSIZE]; /* vertical 8-bit raster encodings */
+ BYTE v8t[3][2][XSIZE / 2]; /* vertical 8-bit raster encodings */
+ /* (twice-a-line) */
+ INT16 second = 0; /* address second byte if not zero */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32 *q[24]; /* pointers to 24 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT - 1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j, k) == 0)); --k)
+ ; /* trim white space */
+
+#else /* NOT IBM_PC_MICROSOFT */
+ p = BITMAP(j, XBIT - 1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif /* IBM_PC_MICROSOFT */
+
+ }
+ ybottom = (j / 24) * 24 + 23;
+
+ paperfeeding = 0; /* for outpaperfeed() */
+ OUTF("\0333%c", 0); /* no paperfeeding */
+
+ for (j = ytop; (j >= ybottom); j -= 24) /* loop over raster lines */
+ { /* in groups of 24 */
+
+#if SEGMEM
+#else /* NOT SEGMEM */
+ p = BITMAP(j, 0); /* the j-th raster line */
+#endif /* SEGMEM */
+
+ if (twice_a_line)
+ c = &v8t[0][0][0]; /* vertical 8-bit encodings */
+ else
+ c = &v8[0][0]; /* vertical 8-bit encodings */
+
+ for (i = 0; i < XBIT; (++p, ++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE - 1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 24; ++k) /* compute pointers to 24 rasters */
+ q[k] = BITMAP(j - k, i);
+#endif /* SEGMEM */
+
+ for (k = 0; k < HOST_WORD_SIZE; (++k)) /* loop over word bits */
+ {
+ /* examine bits in 24 adjacent rows and build two 8-bit */
+ /* character values, the first with rows n,n+3,...,n+21, */
+ /* the second with rows n+1,n+4,...,n+22, the third with */
+ /* rows n+2,n+5,...,n+23. The 2nd and 3rd characters are */
+ /* then printed with 1 dot vertical spacing. */
+
+ /* if twice_a_line is TRUE, the bytes will be written */
+ /* alternating in v8t[x][0][y] and v8t[x][1][y] */
+
+ if (twice_a_line)
+ second = (k % 2) * XSIZE / 2;
+
+#if SEGMEM
+ *(c + second) = (BYTE) makechar(&q[0], mask);
+ *(c + XSIZE + second) = (BYTE) makechar(&q[1], mask);
+ *(c + 2 * XSIZE + second) = (BYTE) makechar(&q[2], mask);
+#else /* NOT SEGMEM */
+ *(c + second) = (BYTE) makechar(&p, mask);
+ ptmp = p - XBIT;
+ *(c + XSIZE + second) = (BYTE) makechar(&ptmp, mask);
+ ptmp = p - 2 * XBIT;
+ *(c + 2 * XSIZE + second) = (BYTE) makechar(&ptmp, mask);
+#endif /* SEGMEM */
+
+ if (twice_a_line)
+ {
+ if (second)
+ c++; /* increment after second byte */
+ }
+ else
+ c++;
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+
+ if (twice_a_line)
+ {
+ OUTLINE((char *) &v8t[0][0][0], FALSE);
+ OUTLINE((char *) &v8t[0][1][0], TRUE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8t[1][0][0], FALSE);
+ OUTLINE((char *) &v8t[1][1][0], TRUE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8t[2][0][0], FALSE);
+ OUTLINE((char *) &v8t[2][1][0], TRUE);
+ (void)outpaperfeed(22);
+ }
+ else
+ {
+ OUTLINE((char *) &v8[0][0], FALSE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8[1][0], FALSE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8[2][0], FALSE);
+ (void)outpaperfeed(22);
+ }
+
+ } /* end loop over j */
+
+ OUTS("\0332"); /* ESC 2 = normal paperfeeding */
+ OUTC('\f'); /* eject page with FF */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+
+#else /* NOT HIRES */
+ BYTE v8[XSIZE + 2]; /* vertical 8-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32 *q[8]; /* pointers to 8 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YBIT - 1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j, k) == 0)); --k)
+ ; /* trim white space */
+#else /* NOT IBM_PC_MICROSOFT */
+ p = BITMAP(j, XBIT - 1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif /* IBM_PC_MICROSOFT */
+
+ } /* end loop over j */
+ ybottom = (j / 8) * 8 + 7;
+
+ OUTF("\0333%c", 24); /* 24/216 inch paperfeeding */
+
+ for (j = ytop; (j >= ybottom); j -= 8) /* loop over raster lines */
+ { /* in groups of 8 */
+
+#if SEGMEM
+#else /* NOT SEGMEM */
+ p = BITMAP(j, 0); /* the j-th raster line */
+#endif /* SEGMEM */
+
+ c = &v8[0]; /* vertical 8-bit encodings */
+ for (i = 0; i < XBIT; (++p, ++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE - 1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 8; ++k) /* compute pointers to 8 rasters */
+ q[k] = BITMAP(j - k, i);
+#endif /* SEGMEM */
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c, ++k))/* loop over word bits */
+ {
+ /* examine bits in 8 adjacent rows and build 8-bit */
+ /* character value */
+
+#if SEGMEM
+ *c = (BYTE) makechar(q, mask);
+#else /* NOT SEGMEM */
+ *c = (BYTE) makechar(&p, mask);
+#endif /* SEGMEM */
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+ --c; /* last character encoded */
+
+ (void)outline((char *) &v8[0]);
+ } /* end loop over j */
+
+ OUTS("\0332"); /* ESC 2 = normal paperfeeding */
+ OUTC('\f'); /* eject page with FF */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#endif /* HIRES */
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvieps.c b/dviware/beebe/src/dvieps.c
new file mode 100644
index 0000000000..9eed0ca52e
--- /dev/null
+++ b/dviware/beebe/src/dvieps.c
@@ -0,0 +1,722 @@
+/* -*-C-*- dvieps.c */
+/*-->dvieps*/
+/**********************************************************************/
+/******************************* dvieps *******************************/
+/**********************************************************************/
+
+/***********************************************************************
+DVIEPS was developed from one of the dot-matrix printer drivers by
+Marcus Moehrmann (EMAIL: marcus%fkihh@unido.uucp). The following
+remarks are his.
+
+This is an implementation for Epson and compatible printers. Printers
+with 9 needles are supported; those with 24 are not. I hope that I have
+only used the ESC/P-Standard. The only documentation I have had was a
+description for the NEC Pinwriter P6/P7, but our printer is a Logitec,
+which I used for testing.
+
+There is a difference in paper feeding, because the P6/P7-handbook says
+that
+
+ <ESC> J (n)
+
+performs n/180 inch paper feeding, but our printer performs n/216 inch
+paper feeding, which I think is the standard, so I have used this in the
+driver.
+
+For horizontal resolution I have used the Esc-sequences
+
+ <ESC> * (m) (n1) (n2) [m = 0, 1, 2, 3]
+
+instead of
+
+ <ESC> (x) (n1) (n2) [x = 'K', 'L', 'Y', 'Z']
+
+If this will not work on your printer, change the definitions of
+'EPSON_BIT_IMAGE' and 'EPSON_MICRO_STEP' and the variable 'resolution'
+in procedure 'outline'.
+
+Be careful with the reset command
+
+ <ESC> @
+
+I have done this before any printing, and then after about 1.5 pages the
+printer stopped. The same works quite well on a second printer.
+
+Specialities: There is a switch '-t' for twice-a-line printing, that is,
+print one line in 1/120 inch horizontal spacing, return print head
+without paper feeding, perform a 1/240 inch step and then print the
+second line with 1/120 inch spacing.
+
+***********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef EPSON
+#define EPSON 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10 [experimental]" /* DVI driver version number */
+
+#undef HIRES
+#define HIRES 1 /* 0 for 72-dpi version */
+
+#if HIRES
+#define DEVICE_ID "Epson 9-pin family 240/216-dpi matrix printer"
+ /* this string is printed at runtime */
+#define OUTFILE_EXT "eps"
+
+#define XDPI 240 /* horizontal dots/inch */
+#define YDPI 216 /* vertical dots/inch */
+
+#else /* NOT HIRES */
+#define DEVICE_ID "Epson 9-pin family 60/72-dpi matrix printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "e72"
+
+#define XDPI 60 /* horizontal dots/inch */
+#define YDPI 72 /* vertical dots/inch */
+#endif /* HIRES */
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#if HIRES
+#define STDRES 1 /* 0 for low-resolution devices */
+#else /* NOT HIRES */
+#define STDRES 0 /* 0 for low-resolution devices */
+#endif /* HIRES */
+
+#if OS_PCDOS
+#define XPSIZE 6 /* horizontal paper size in inches */
+#else /* NOT OS_PCDOS */
+#define XPSIZE 8 /* horizontal paper size in inches */
+#endif /* OS_PCDOS */
+
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#if OS_PCDOS
+#define YPSIZE 8 /* vertical paper size in inches */
+#else /* NOT OS_PCDOS */
+#define YPSIZE 11 /* vertical paper size in inches */
+#endif /* OS_PCDOS */
+
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+#if HIRES
+INT16 paperfeeding; /* outstanding 1/216 inch */
+ /* form-feedings */
+
+BOOLEAN twice_a_line = FALSE; /* this is runtime option '-t' */
+ /* print in 1/120-inch-mode, */
+ /* 2nd line shifted 1/240 inch */
+
+ /* need single-arg outline() */
+BOOLEAN micro_step; /* used in outline() */
+#define OUTLINE(v,flag) {micro_step = flag; outline(v);}
+#endif /* HIRES */
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif /* (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD) */
+
+#define EPSON_ADV_PAPER "\033J%c" /* advance paper n/216 inch */
+#define EPSON_BIT_IMAGE "\033*%c%c%c"
+#define EPSON_MICRO_STEP OUTF2("\033*\003\001%c%c",'\000','\000')
+
+#include "bitmap.h"
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc, argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr, "[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+
+#if HIRES
+ if (twice_a_line && !quiet)
+ {
+ (void)fprintf(stderr, "[Twice-a-line-printing for high resolution]");
+ NEWLINE(stderr);
+ }
+#endif /* HIRES */
+
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+
+char
+makechar(p, mask)
+register UNSIGN32 *p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000'; /* MSB controls top needle */
+
+#if HIRES
+ if (*Q(0) & mask)
+ c |= '\200';
+ if (*Q(3) & mask)
+ c |= '\100';
+ if (*Q(6) & mask)
+ c |= '\040';
+ if (*Q(9) & mask)
+ c |= '\020';
+ if (*Q(12) & mask)
+ c |= '\010';
+ if (*Q(15) & mask)
+ c |= '\004';
+ if (*Q(18) & mask)
+ c |= '\002';
+ if (*Q(21) & mask)
+ c |= '\001';
+#else /* NOT HIRES */
+ if (*Q(0) & mask)
+ c |= '\200';
+ if (*Q(1) & mask)
+ c |= '\100';
+ if (*Q(2) & mask)
+ c |= '\040';
+ if (*Q(3) & mask)
+ c |= '\020';
+ if (*Q(4) & mask)
+ c |= '\010';
+ if (*Q(5) & mask)
+ c |= '\004';
+ if (*Q(6) & mask)
+ c |= '\002';
+ if (*Q(7) & mask)
+ c |= '\001';
+#endif /* HIRES */
+
+ return (c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+#if HIRES
+/*-->outpaperfeed*/
+/**********************************************************************/
+/*************************** outpaperfeed *****************************/
+/**********************************************************************/
+
+void
+outpaperfeed(count) /* accumulate 1/216 inch paperfeedings */
+INT16 count; /* and write them out if count == 0 */
+{
+
+ register INT16 k;
+
+ if (count)
+ paperfeeding += count;
+ else
+ {
+ for (k = paperfeeding / 255; k; --k)
+ OUTF(EPSON_ADV_PAPER, 255);
+ if ((k = paperfeeding % 255) > 0)
+ OUTF(EPSON_ADV_PAPER, k);
+ paperfeeding = 0;
+ }
+}
+#endif /* HIRES */
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline;
+{
+ register char* a;
+ register char* b;
+ register char* c;
+ register INT16 left;
+ INT16 len;
+ INT16 linelength;
+ char resolution;
+ BYTE spacing;
+ BYTE space_width;
+
+#if HIRES
+ if (twice_a_line) /* step 1/240 inch forward */
+ {
+ resolution = '\001'; /* 1/120 */
+ space_width = 12; /* 12/120 */
+ linelength = XSIZE / 2;
+ }
+ else
+ {
+ resolution = '\003'; /* 1/240 */
+ space_width = 24; /* 24/240 */
+ linelength = XSIZE;
+ }
+#else /* NOT HIRES */
+ resolution = '\000'; /* 1/60 */
+ space_width = 6; /* 6/60 */
+ linelength = XSIZE;
+#endif /* HIRES */
+
+ for ((left = linelength, c = pline + linelength - 1);
+ (*c == '\000') && (left > 0);
+ (--left, --c)) /* trim white space */
+ ;
+
+ if (left == 0)
+ return; /* NEWLINE() is not needed for any paperfeeding */
+
+#if HIRES
+ (void)outpaperfeed(0); /* print accumulated paperfeedings */
+#endif /* HIRES */
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Only runs longer than
+ "space_width" are taken, because we print spaces in text mode. This
+ implies that the run only consists of '\000' characters.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ Since the character strings take on all values on 0 .. 255, we
+ cannot store a termination marker, but must instead keep a counter,
+ "left", which is decremented to 0 when the end of the string is
+ reached.
+
+ ?????????????0000000000000000????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+
+
+ We cannot use fprintf %s because 0 bytes terminate string, so we are
+ using putc for writing the line.
+ *******************************************************************/
+
+ if (runlengthcode && (left >= space_width))
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && (*a == '\000') && left; --left)
+ ; /* advance over run */
+ len = (INT16) (c - a); /* "c" points past run */
+
+ if (len >= space_width) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+#if HIRES
+ if (micro_step)
+ {
+ EPSON_MICRO_STEP;
+ micro_step = FALSE;
+ }
+#endif /* HIRES */
+ OUTF3(EPSON_BIT_IMAGE, resolution, ((int) (a - b)) % 256,
+ ((int) (a - b)) / 256);
+ for (; b < a; b++)
+ OUTC(*b);
+ }
+
+ c -= len % space_width; /* shorten run */
+ left += len % space_width;
+
+ for (spacing = (BYTE)(len / space_width); spacing; --spacing)
+ OUTC(' '); /* output run */
+
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ } /* end for() loop */
+
+ if (a > b) /* output remaining string */
+ {
+#if HIRES
+ if (micro_step)
+ {
+ EPSON_MICRO_STEP;
+ micro_step = FALSE;
+ }
+#endif /* HIRES */
+ OUTF3(EPSON_BIT_IMAGE,resolution,((int) (a - b)) % 256,
+ ((int) (a - b)) / 256);
+ for (; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ else /* no runlength coding */
+ if (left > 0)
+ {
+#if HIRES
+ if (micro_step)
+ {
+ EPSON_MICRO_STEP;
+ micro_step = FALSE;
+ }
+#endif /* HIRES */
+ OUTF3(EPSON_BIT_IMAGE,resolution,left % 256,left / 256);
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+ }
+ NEWLINE(plotfp);
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register BYTE *c; /* pointer into v8[][] and v8t[][][] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+
+#if SEGMEM
+#else /* NOT SEGMEM */
+ UNSIGN32 *ptmp; /* pointer into bitmap[][] */
+#endif /* SEGMEM */
+
+ register UNSIGN32 mask; /* mask for single bit selection */
+ register INT16 k;
+ INT16 i;
+ INT16 j;
+ INT16 ybottom;
+ INT16 ytop;
+
+#if HIRES
+ BYTE v8[3][XSIZE]; /* vertical 8-bit raster encodings */
+ BYTE v8t[3][2][XSIZE / 2]; /* vertical 8-bit raster encodings */
+ /* (twice-a-line) */
+ INT16 second = 0; /* address second byte if not zero */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32 *q[24]; /* pointers to 24 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT - 1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j, k) == 0)); --k)
+ ; /* trim white space */
+
+#else /* NOT IBM_PC_MICROSOFT */
+ p = BITMAP(j, XBIT - 1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif /* IBM_PC_MICROSOFT */
+
+ }
+ ybottom = (j / 24) * 24 + 23;
+
+ paperfeeding = 0; /* for outpaperfeed() */
+ OUTF("\0333%c", 0); /* no paperfeeding */
+
+ for (j = ytop; (j >= ybottom); j -= 24) /* loop over raster lines */
+ { /* in groups of 24 */
+
+#if SEGMEM
+#else /* NOT SEGMEM */
+ p = BITMAP(j, 0); /* the j-th raster line */
+#endif /* SEGMEM */
+
+ if (twice_a_line)
+ c = &v8t[0][0][0]; /* vertical 8-bit encodings */
+ else
+ c = &v8[0][0]; /* vertical 8-bit encodings */
+
+ for (i = 0; i < XBIT; (++p, ++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE - 1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 24; ++k) /* compute pointers to 24 rasters */
+ q[k] = BITMAP(j - k, i);
+#endif /* SEGMEM */
+
+ for (k = 0; k < HOST_WORD_SIZE; (++k)) /* loop over word bits */
+ {
+ /* examine bits in 24 adjacent rows and build two 8-bit */
+ /* character values, the first with rows n,n+3,...,n+21, */
+ /* the second with rows n+1,n+4,...,n+22, the third with */
+ /* rows n+2,n+5,...,n+23. The 2nd and 3rd characters are */
+ /* then printed with 1 dot vertical spacing. */
+
+ /* if twice_a_line is TRUE, the bytes will be written */
+ /* alternating in v8t[x][0][y] and v8t[x][1][y] */
+
+ if (twice_a_line)
+ second = (k % 2) * XSIZE / 2;
+
+#if SEGMEM
+ *(c + second) = (BYTE) makechar(&q[0], mask);
+ *(c + XSIZE + second) = (BYTE) makechar(&q[1], mask);
+ *(c + 2 * XSIZE + second) = (BYTE) makechar(&q[2], mask);
+#else /* NOT SEGMEM */
+ *(c + second) = (BYTE) makechar(&p, mask);
+ ptmp = p - XBIT;
+ *(c + XSIZE + second) = (BYTE) makechar(&ptmp, mask);
+ ptmp = p - 2 * XBIT;
+ *(c + 2 * XSIZE + second) = (BYTE) makechar(&ptmp, mask);
+#endif /* SEGMEM */
+
+ if (twice_a_line)
+ {
+ if (second)
+ c++; /* increment after second byte */
+ }
+ else
+ c++;
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+
+ if (twice_a_line)
+ {
+ OUTLINE((char *) &v8t[0][0][0], FALSE);
+ OUTLINE((char *) &v8t[0][1][0], TRUE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8t[1][0][0], FALSE);
+ OUTLINE((char *) &v8t[1][1][0], TRUE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8t[2][0][0], FALSE);
+ OUTLINE((char *) &v8t[2][1][0], TRUE);
+ (void)outpaperfeed(22);
+ }
+ else
+ {
+ OUTLINE((char *) &v8[0][0], FALSE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8[1][0], FALSE);
+ (void)outpaperfeed(1);
+ OUTLINE((char *) &v8[2][0], FALSE);
+ (void)outpaperfeed(22);
+ }
+
+ } /* end loop over j */
+
+ OUTS("\0332"); /* ESC 2 = normal paperfeeding */
+ OUTC('\f'); /* eject page with FF */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+
+#else /* NOT HIRES */
+ BYTE v8[XSIZE + 2]; /* vertical 8-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32 *q[8]; /* pointers to 8 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YBIT - 1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j, k) == 0)); --k)
+ ; /* trim white space */
+#else /* NOT IBM_PC_MICROSOFT */
+ p = BITMAP(j, XBIT - 1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif /* IBM_PC_MICROSOFT */
+
+ } /* end loop over j */
+ ybottom = (j / 8) * 8 + 7;
+
+ OUTF("\0333%c", 24); /* 24/216 inch paperfeeding */
+
+ for (j = ytop; (j >= ybottom); j -= 8) /* loop over raster lines */
+ { /* in groups of 8 */
+
+#if SEGMEM
+#else /* NOT SEGMEM */
+ p = BITMAP(j, 0); /* the j-th raster line */
+#endif /* SEGMEM */
+
+ c = &v8[0]; /* vertical 8-bit encodings */
+ for (i = 0; i < XBIT; (++p, ++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE - 1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 8; ++k) /* compute pointers to 8 rasters */
+ q[k] = BITMAP(j - k, i);
+#endif /* SEGMEM */
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c, ++k))/* loop over word bits */
+ {
+ /* examine bits in 8 adjacent rows and build 8-bit */
+ /* character value */
+
+#if SEGMEM
+ *c = (BYTE) makechar(q, mask);
+#else /* NOT SEGMEM */
+ *c = (BYTE) makechar(&p, mask);
+#endif /* SEGMEM */
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+ --c; /* last character encoded */
+
+ (void)outline((char *) &v8[0]);
+ } /* end loop over j */
+
+ OUTS("\0332"); /* ESC 2 = normal paperfeeding */
+ OUTC('\f'); /* eject page with FF */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#endif /* HIRES */
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvifile.h b/dviware/beebe/src/dvifile.h
new file mode 100644
index 0000000000..77cd135c7c
--- /dev/null
+++ b/dviware/beebe/src/dvifile.h
@@ -0,0 +1,158 @@
+/* -*-C-*- dvifile.h */
+/*-->dvifile*/
+/**********************************************************************/
+/****************************** dvifile *******************************/
+/**********************************************************************/
+
+void
+dvifile(argc,argv,filestr)
+int argc; /* argument count */
+char* argv[]; /* argument strings */
+char* filestr; /* DVI filename to process */
+{
+
+#define PAGENUMBER(p) ((p) < 0 ? (page_count + 1 + (p)) : (p))
+
+ register INT16 i,j,m; /* loop indices */
+ register INT16 swap; /* swap storage */
+
+ INT16 m_begin,m_end,m_step; /* loop limits and increment */
+ INT16 list[3]; /* index list for sort */
+ char tempstr[MAXSTR]; /* temporary string storage */
+
+
+ /*
+ Establish the default font file search order. This is done here
+ instead of in initglob() or option(), because both could set
+ fontlist[].
+
+ By default, the search list contains names for the PK, GF, and PXL
+ font files; that order corresponds to increasing size (and
+ therefore, presumably, increasing processing cost) of font raster
+ information. This search order may be overridden at run time by
+ defining an alternate one in the environment variable FONTLIST; the
+ order of the strings "PK", "GF", and "PXL" in that variable
+ determines the search order, and letter case is NOT significant.
+ The substrings may be separated by zero or more arbitrary
+ characters, so the values "PK-GF-PXL", "PK GF PXL", "PKGFPXL",
+ "PK;GF;PXL", "PK/GF/PXL" are all acceptable, and all choose the
+ default search order. This flexibility in separator character
+ choice is occasioned by the requirement on some systems that the
+ environment variable have the syntax of a file name, or be a single
+ "word". If any substring is omitted, then that font will be
+ excluded from consideration. Thus, "GF" permits the use only of GF
+ font files.
+
+ The indexes gf_index, pk_index, and pxl_index are in -1 .. 2, and at
+ least one must be non-negative. A negative index excludes that font
+ file type from the search.
+ */
+
+ /* Note that non-negative entries in list[] are UNIQUE. */
+ list[0] = gf_index = (INT16)strid2(fontlist,"GF");
+ list[1] = pk_index = (INT16)strid2(fontlist,"PK");
+ list[2] = pxl_index = (INT16)strid2(fontlist,"PXL");
+
+ for (i = 0; i < 3; ++i) /* put list in non-decreasing order */
+ for (j = i+1; j < 3; ++j)
+ if (list[i] > list[j])
+ {
+ swap = list[i];
+ list[i] = list[j];
+ list[j] = swap;
+ }
+ for (i = 0; i < 3; ++i) /* assign indexes 0,1,2 */
+ if (list[i] >= 0)
+ {
+ if (list[i] == gf_index)
+ gf_index = i;
+ else if (list[i] == pk_index)
+ pk_index = i;
+ else if (list[i] == pxl_index)
+ pxl_index = i;
+ }
+
+ if ((gf_index < 0) && (pk_index < 0) && (pxl_index < 0))
+ (void)fatal("dvifile(): FONTLIST does not define at least one of \
+GF, PK, or PXL fonts");
+
+ (void)dviinit(filestr); /* initialize DVI file processing */
+
+ (void)devinit(argc,argv); /* initialize device output */
+
+ (void)readpost();
+ (void)FSEEK(dvifp, 14L, 0); /* position past preamble */
+ (void)getbytes(dvifp, tempstr,
+ (BYTE)nosignex(dvifp,(BYTE)1)); /* flush DVI comment */
+
+ cur_page_number = 0;
+
+
+#if (HPLASERJET|HPJETPLUS|GOLDENDAWNGL100|POSTSCRIPT|IMPRESS|CANON_A2)
+ /* print pages in reverse order because of laser printer */
+ /* page stacking */
+ if (backwards)
+ {
+ m_begin = 1;
+ m_end = page_count;
+ m_step = 1;
+ }
+ else /* normal device order */
+ {
+ m_begin = page_count;
+ m_end = 1;
+ m_step = -1;
+ }
+
+#else
+ /* NOT (HPLASERJET|HPJETPLUS|GOLDENDAWNGL100|POSTSCRIPT|IMPRESS|CANON_A2) */
+ /* print pages in forward order for most devices */
+ if (backwards)
+ {
+ m_begin = page_count;
+ m_end = 1;
+ m_step = -1;
+ }
+ else
+ {
+ m_begin = 1;
+ m_end = page_count;
+ m_step = 1;
+ }
+#endif /* (HPLASERJET|HPJETPLUS|GOLDENDAWNGL100|POSTSCRIPT|IMPRESS|CANON_A2) */
+
+ for (i = 0; i < npage; ++i) /* make page numbers positive */
+ { /* and order pairs non-decreasing */
+ page_begin[i] = PAGENUMBER(page_begin[i]);
+ page_end[i] = PAGENUMBER(page_end[i]);
+ if (page_begin[i] > page_end[i])
+ {
+ swap = page_begin[i];
+ page_begin[i] = page_end[i];
+ page_end[i] = swap;
+ }
+ }
+
+ for (m = m_begin; ; m += m_step)
+ {
+ for (i = 0; i < npage; ++i) /* search page list */
+ if ( IN(page_begin[i],m,page_end[i]) &&
+ (((m - page_begin[i]) % page_step[i]) == 0) )
+ {
+ if (!quiet) /* start progress report */
+ (void)fprintf(stderr,"[%d", m);
+ cur_page_number++;/* sequential page number 1..N */
+ cur_index = m-1; /* remember index globally */
+ prtpage(page_ptr[cur_index]);
+ if (!quiet) /* finish progress report */
+ (void)fprintf(stderr,"] ");
+ break;
+ }
+ if (m == m_end) /* exit loop after last page */
+ break;
+ }
+
+ (void)devterm(); /* terminate device output */
+
+ (void)dviterm(); /* terminate DVI file processing */
+}
diff --git a/dviware/beebe/src/dvigd.c b/dviware/beebe/src/dvigd.c
new file mode 100644
index 0000000000..9ad820c3d1
--- /dev/null
+++ b/dviware/beebe/src/dvigd.c
@@ -0,0 +1,344 @@
+/* -*-C-*- dvigd.c */
+/*-->dvigd*/
+/**********************************************************************/
+/******************************* dvigd ********************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef GOLDENDAWNGL100
+#define GOLDENDAWNGL100 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Golden Dawn Golden Laser 100 laser printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "gd"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* to get standard font resolution */
+
+#define XDPI 200 /* horizontal dots/inch */
+#define XPSIZE 7 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI XDPI /* HP Laser Jet vertical dots/inch */
+#define YPSIZE 9 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+#define V24SIZE (4*XWORDS*HOST_WORD_SIZE)
+ /* 4 chars encode 24 bits in each */
+ /* bit position of each word */
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#undef MAXOPEN /* default too big with large bitmap */
+#define MAXOPEN 3 /* reduce number of open PXL files */
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode)
+ {
+ (void)fprintf(stderr,"[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "initglob.h"
+#include "inch.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline;
+{
+ register INT16 left;
+ register char *a,*b,*c;
+ INT16 len;
+
+
+#if IBM_PC_MICROSOFT
+ for ((left = (XSIZE + 5) / 6,
+ c = (char *)normaddr(pline,(XSIZE + 5) / 6 - 1));
+ (*c == '\100') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+#else
+ for ((left = (XSIZE + 5) / 6, c = pline + (XSIZE + 5) / 6 - 1);
+ (*c == '\100') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+#endif
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Since the run length
+ encoding carries a penalty of additional output equal to the length
+ of the run length prefix (<ESC>nnnn), short runs are not so encoded.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ We keep a counter, "left", which is decremented to 0 when the end of
+ the string is reached.
+
+ ?????????????xxxxxxxxxxxxxxxx????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+
+ A run is encoded as <ESC>nnnnc, implying that the character c is to
+ be repeated nnnn times, when nnnn is four ASCII digits. All
+ characters, except this <ESC>nnnn prefix and the terminal newline
+ character, are biased by 64 to move them into the printable range
+ 64..127 ('@'..DEL).
+
+ *******************************************************************/
+ if (runlengthcode)
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && left; --left)
+ ; /* advance over run */
+ len = (INT16)(c-a); /* "c" points past run */
+ if (len > 6) /* output long run */
+ {
+ for ( ; b < a; b++) /* output previous string */
+ OUTC(*b);
+ OUTF2("\033%04d%c",len,*a);
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ }
+ for ( ; b < a; b++) /* output remaining string */
+ OUTC(*b);
+ }
+ else /* no run-length encoding */
+ OUTS(pline);
+
+ NEWLINE(plotfp);
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+
+ /***********************************************************************
+ Each raster line is broken into 6-bit groups from left to right and
+ encoded as ASCII characters in the range 64..127 ('@'..DEL) (by
+ OR'ing with 64) and these are then sent to procedure outline for
+ run-length encoding and output. The latter is necessary because a
+ full page needs 8.5 * 11 * 300 * 300 / 6 = 1,402,500 characters.
+ ***********************************************************************/
+
+ register char *c; /* pointer into raster[] */
+ register UNSIGN32 *p; /* pointer into bitmap[][] */
+ register INT16 i,k; /* inner loop indices */
+ COORDINATE j,ybottom,ytop;
+ char raster[XBIT*6+1]; /* 6-bit raster encodings */
+
+#if (HOST_WORD_SIZE == 32)
+ UNSIGN32 word;
+#endif
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+ }
+ ybottom = j;
+
+ for (j = ytop; (j >= ybottom) ; j--) /* loop over raster lines */
+ {
+ p = BITMAP(j,0); /* the j-th raster line */
+ c = &raster[0]; /* 6-bit encodings */
+#if (HOST_WORD_SIZE == 36)
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ *c++ = 0100 | (((*p) >> 30) & 077);
+ *c++ = 0100 | (((*p) >> 24) & 077);
+ *c++ = 0100 | (((*p) >> 18) & 077);
+ *c++ = 0100 | (((*p) >> 12) & 077);
+ *c++ = 0100 | (((*p) >> 6) & 077);
+ *c++ = 0100 | (((*p) ) & 077);
+ }
+#else /* HOST_WORD_SIZE == 32 */
+ for (i = 0; i <= k; i += 3)/* loop over trimmed raster */
+ { /* use machine-specific coding here for efficiency */
+ *c++ = 0100 | (((*p) >> 26) & 077);
+ *c++ = 0100 | (((*p) >> 20) & 077);
+ *c++ = 0100 | (((*p) >> 14) & 077);
+ *c++ = 0100 | (((*p) >> 8) & 077);
+ *c++ = 0100 | (((*p) >> 2) & 077);
+ word = (*p) << 4;
+ ++p;
+ word |= (*p) >> 28;
+ *c++ = (char)(word & 077);
+ *c++ = 0100 | (((*p) >> 22) & 077);
+ *c++ = 0100 | (((*p) >> 16) & 077);
+ *c++ = 0100 | (((*p) >> 10) & 077);
+ *c++ = 0100 | (((*p) >> 4) & 077);
+ word = (*p) << 2;
+ ++p;
+ word |= (*p) >> 30;
+ *c++ = (char)(word & 077);
+ *c++ = 0100 | (((*p) >> 24) & 077);
+ *c++ = 0100 | (((*p) >> 18) & 077);
+ *c++ = 0100 | (((*p) >> 12) & 077);
+ *c++ = 0100 | (((*p) >> 6) & 077);
+ *c++ = 0100 | (((*p) ) & 077);
+ ++p;
+ }
+#endif
+
+ for (i = (XSIZE + 5) / 6; i <= XBIT*6; i++)
+ raster[i] = '\0'; /* string terminator */
+ outline(&raster[0]);
+ }
+
+ OUTC('\f'); /* eject page with FF */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("Output error -- disk storage probably full");
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvihead.h b/dviware/beebe/src/dvihead.h
new file mode 100644
index 0000000000..90e9e6fa0f
--- /dev/null
+++ b/dviware/beebe/src/dvihead.h
@@ -0,0 +1,359 @@
+/* -*-C-*- dvihead.h */
+/*-->dvihead*/
+/**********************************************************************/
+/****************************** dvihead *******************************/
+/**********************************************************************/
+
+/**********************************************************************/
+/************************* Revision History *************************/
+/**********************************************************************/
+
+/***********************************************************************
+[Begin Revision History]
+
+<BEEBE.TEX.DVI.NEW>DVIHEAD.H.2, 24-Jun-86 18:11:55, Edit by BEEBE
+Added saving of all ten TeX page counters in prtpage() in global array
+tex_counter[], and function tctos() to convert them to a string for
+printing. All warning and error messages are now accompanied by a list
+of the non-zero page counters to help relate errors to output document
+pages.
+
+<BEEBE.TEX.DVI>DVIHEADER.H.21, 13-Mar-86 10:43:33, Edit by BEEBE
+Added use of getenv() for Unix and PC-DOS to pick up definitions of
+texinputs and texfonts at runtime; if these are available, they override
+built-in choices. This makes it possible to move compiled code to
+similar machines with different directory structures without having to
+recompile. For TOPS-20, this is unnecessary, since the defaults already
+point to these, and a name of the form /texinputs/foo.bar is translated
+by PCC-20 to texinputs:foo.bar, from which the current definition of the
+logical name "texinputs:" is used to find the desired directory. It can
+even be a chain of directories; in Unix and PC-DOS, we will need to
+introduce a special version of fopen() to handle filenames with
+environment variable prefixes which might represent directory chains.
+
+Removed variable-length argument lists to fatal() and warning() for
+portability. Changed all preprocessor #ifdef's and #ifndef's to #if's
+for portability; all symbols for devices, operating systems, and
+implementations are now explicitly defined to be 0 or 1. IBM PC Lattice
+C will not accept the operators "!", "||", or "&&" in #if expressions,
+although they should be perfectly legal; rearranged several expressions
+to avoid these (introduce #else, use "|" and "&").
+
+Added procedures fontfile() and fontsub() to encapsulate construction of
+system-dependent font file names and provide for user-specifiable font
+substitutions for unavailable font files (new runtime option
+-ffontfile).
+
+Removed old #ifdef FOOBAR ... #endif code sections in several procedures
+which were completely obsolete. Added header comment line to every
+file; it contains the EMACS "-*-C-*-" mode string and the exact
+(case-sensive) filename, since many functions have been defined with
+names in mixed case for readability (probably should have used
+underscore instead, but none do), and on Unix, the letter case matters.
+
+Replaced index() and rindex(), which have different definitions in
+different C implementations, by 4.2BSD (and coming ANSI C standard)
+functions strchr() and strrchr(), for which .h files are provided.
+
+
+<BEEBE.TEX.DVI>DVIHEADER.H.11, 8-Jan-86 16:55:59, Edit by BEEBE
+Added DVITYPE Version 2.6 MAXDRIFT correction to pixel coordinates.
+This adds function fixpos() called from movedown(), moveover(),
+setchar(), and setrule(), and #include'd in DVI*.c with definitions in
+gblprocs.h and machdefs.h. Revision level incremented by 0.01 (most are
+now at 2.01)
+
+
+<BEEBE.TEX.DVI>DVIHEADER.H.7, 22-Jul-85 12:51:02, Edit by BEEBE
+Added PostScript driver for Apple LaserWriter.
+
+Added support for multiple input DVI files to each of which all switch
+options apply.
+
+
+<BEEBE.TEX>DVIJET.C.70, 30-May-85 00:33:51, Edit by BEEBE
+Revised "int" type declarations to signed types (INT8, INT16, INT32),
+unsigned types (BYTE, UNSIGN16, UNSIGN32), and coordinate type
+(COORDINATE) as a prelude to moving to microprocessors where long
+integers impose a serious runtime penalty.
+
+Type casts added to many assignments and arguments.
+
+"double" changed to "float".
+
+Added a few more "register" declarations and deleted unused variables.
+
+Device-dependent code sections identified as prelude to code sharing
+between device drivers via "#include" statements for each shareable
+procedure.
+
+Added -c, -o, -r, -x, -y options and inch() procedure.
+
+Several passes with "lint" under VAX Unix to detect further problems
+
+
+<BEEBE.TEX>DVIJET.C.18, 27-May-85 23:44:34, Edit by BEEBE
+Revise copy of Printronix driver for output on Hewlett-Packard Laser Jet
+
+
+<BEEBE.TEX>DVIPRX.C.125, 20-Oct-84 14:02:27, Edit by BEEBE
+Add mag_table[] and rewrite actfact() to use it. Add code to readfont()
+and openfont() to choose nearest available font magnification when
+required one is unavailable. Enable USEGLOBALMAG since code now can
+handle it properly. Allow upper-case option letters as equivalents of
+lower-case ones -- non-Unix folks abhor such distinctions.
+
+
+<BEEBE.TEX>DVIPRX.C.118, 30-Sep-84 14:42:10, Edit by BEEBE
+Change = to == in "if (...)" in procedure warning, change g_dolog to
+BOOLEAN.
+
+
+[End Revision History]
+***********************************************************************/
+
+/**********************************************************************/
+/************************ Development History ***********************/
+/**********************************************************************/
+
+/***********************************************************************
+**
+** The code is arranged to allow easy modification of the output for
+** display on other dot matrix printers, and for porting to a new host
+** computing environment. The sections labelled "Device Definitions"
+** and "Global Definitions" below definitely need to be modified in
+** such a case. A couple of the 40 or so procedures in the '#include
+** "xxx.h"' section may need to be adjusted as well, but almost all the
+** rest should be both host- and output-device-independent.
+**
+** The runtime switches will be similar for most devices, but some will
+** require additional ones. Device-name conditionals should be used to
+** bracket these, so that code can be lifted without modification for
+** use in a new dvi driver.
+**
+** Instead of building up a bit map corresponding to the final printer
+** file, we keep a large array which has a one-to-one correspondence
+** with the printed page; dots in a horizontal raster on the page are
+** consecutive in memory. This allows us to OR in character raster
+** patterns without having to unpack every single bit. At end-of-page
+** time, each raster row is trimmed of trailing white space and
+** formatted into a line of data to be sent to the printer file. For
+** those devices which pack dots for 6, 7, or 8 rows into a single
+** character, some merging of raster lines will be necessary.
+**
+** To use the program, type:
+**
+** dvixxx {-b} {-c#} {-d#} {-ffontsubfile} {-l} {-m#} {-o#:#} {-o#} {-p}
+** {-r#} {-v} {-x#units} {-y#units} dvifile(s)
+**
+** The order of command options and DVI file names is not significant;
+** all switch values apply to all DVI files. DVI files are processed
+** in order from left to right. The command options are (letter case
+** is IGNORED):
+**
+** b Backwards order printing from the default. For example,
+** laser printers using the Canon engine print normally
+** receive pages in reverse order because they stack printed
+** side up. Some have page handling mechanisms that stack
+** them face down, and in such a case -b will ensure that
+** they come out in order 1,2,... instead of n,n-1,n-2,...
+**
+** c# Print # copies of each output page.
+**
+** d# Debug output to stderr if non-zero value given.
+**
+** ffontsubfile Define an alternate font substitution file which
+** is to be used instead of the default ones (see below).
+**
+** l Inhibit logging.
+**
+** m# Reset magnification to #. The default is "-m603",
+** corresponding to (1/1.2**5) magnification of 300dpi
+** fonts. Legal values are int(1000*(1.2)**(k/2)) (k =
+** -16,16); other values will be set to the nearest in this
+** family. Not all fonts will be available in this wide
+** range, and most installations will probably have only a
+** half dozen or so magnifications.
+**
+** o# and
+** o#:# Specify a page number, or range of page numbers, to be
+** selected for output. This option may be specified any
+** number of times. If it is not specified, then all pages
+** will be printed. Pages are numbered in order 1,2,3,...
+** in the file, but any page number recorded by TeX on the
+** printed page will in general be different. As pages are
+** selected for printing, "[#{#}" will be printed on
+** stderr, where the first is the page number in the file,
+** and the second is the value of the TeX counter, \count0,
+** which usually records the printed page number. When the
+** page is completely output, a closing "]" will be printed
+** on stderr. Any error messages from processing of that
+** page will therefore occur between the square brackets.
+** For example, "-o1:3 -o12 -o17:23" would select pages 1,
+** 2, 3, 12, 17, 18, 19, 20, 21, 22, and 23 for printing.
+** Pages will always be printed in an order appropriate for
+** the device so that the first document page occurs first
+** face up in the document stack.
+**
+** p Inhibit font preloading. This may produce output a few
+** seconds earlier when all pages are output, but should
+** have negligible effect on the execution time, and
+** consequently, should normally not be specified. When
+** individual pages are being printed with the -o# option,
+** preloading is necessary (and will be forced) to ensure
+** that all fonts are defined before they are referenced.
+**
+** q Quiet mode. Status displays to stderr are suppressed,
+** unless warning or error messages are issued.
+**
+** r# (Device = HP Laser Jet only). Specify the Laser Jet
+** output resolution in dots per inch. "#" must be one of
+** 75, 100, 150, or 300. The actual plot file is identical
+** in each case; only the size on the output page is
+** changed, because the resolution change is effected by
+** printing 1 x 1, 2 x 2, 3 x 3, or 4 x 4 pixel blocks.
+**
+** r (Device = Golden Laser 100 only). Select run-length
+** encoding of the output file. This reduces disk space
+** typically by 10% to 40%, but increases host CPU time for
+** the preparation of the output file.
+**
+** r (Device = Apple ImageWriter only). Select run-length
+** encoding of the output file.
+**
+** r (Device = Toshiba P-1351 only). Select run-length
+** encoding of the output file. This reduces disk space
+** typically by 10% to 40%, but increases host CPU time for
+** the preparation of the output file, and because of poor
+** logic in the printer, may double the print time! The
+** print quality is also substantially worse, so this
+** option is generally NOT recommended.
+**
+** s# (Device = Apple LaserWriter only). Force characters
+** larger than # pixels wide or high to be reloaded each
+** time they are required. The Version 23.0 PostScript
+** interpreter has a bug which manifests itself in fatal
+** 'VM error' messages when large characters are sent. A
+** reasonable default value has been set for this which
+** should normally avoid the problem. Specifying -s0 will
+** cause reloading of every character each time it is used.
+**
+** v (Device = Apple LaserWriter only). Force reloading of
+** all required fonts at start of each page.
+**
+** x#bp big point (1in = 72bp)
+** x#cc cicero (1cc = 12dd)
+** x#cm centimeter
+** x#dd didot point (1157dd = 1238pt)
+** x#in inch
+** x#mm millimeter (10mm = 1cm)
+** x#pc pica (1pc = 12pt)
+** x#pt point (72.27pt = 1in)
+** x#sp scaled point (65536sp = 1pt)
+** Specify the left margin of the TeX page on the output
+** page in any of the indicated units. Letter case is not
+** significant in the unit field, which must not be
+** separated from the number by any space. # may be
+** fractional. For example, "-x1.0in", "-x2.54cm",
+** "-x72.27pt", and "-x6.0225pc" all specify a one inch
+** left margin. Negative values are permissible, and may
+** be used to shift the output page left (possibly
+** truncating it on the left) in order to display a wide
+** TeX page.
+**
+** y# inch
+** y#bp big point (1in = 72bp)
+** y#cc cicero (1cc = 12dd)
+** y#cm centimeter
+** y#dd didot point (1157dd = 1238pt)
+** y#in inch
+** y#mm millimeter (10mm = 1cm)
+** y#pc pica (1pc = 12pt)
+** y#pt point (72.27pt = 1in)
+** y#sp scaled point (65536sp = 1pt)
+** Specify the top margin of the TeX page on the output
+** page in any of the indicated units. Letter case is not
+** significant in the unit field, which must not be
+** separated from the number by any space. # may be
+** fractional. For example, "-y1.0in", "-y2.54cm",
+** "-y72.27pt", and "-y6.0225pc" all specify a one inch top
+** margin. Negative values are permissible, and may be
+** used to shift the output page up (possibly truncating it
+** on the top) in order to display a long TeX page.
+**
+**
+** If no -ffontsubfile option is given, and font substitution is
+** required, the files "dvifile.sub" (minus any extension),
+** "texfonts.sub", and "texinputs:texfonts.sub" will be tried in order.
+** The first two will be found on the current directory, and the last
+** is the system default. This gives the option of document-specific,
+** user-specific, and system-specific substitutions, and the -f option
+** allows all of these to be overridden.
+**
+** This program can only process DVI format 2 files.
+**
+** Mark Senn at Purdue University wrote the first BitGraph driver,
+** dvibit. This was further worked on at the University of Washington
+** by Stephen Bechtolsheim, Bob Brown, Richard Furuta, and Robert
+** Wells. The transformation to about ten other device drivers, plus
+** the massive code rearrangement for many new features as well as easy
+** identification of host- and device-dependent sections, was carried
+** out at the University of Utah by Nelson H.F. Beebe.
+**
+** Support for pixel file caching and character raster caching was
+** added by NHFB; this should give a decided performance improvement
+** provided the cache sizes, MAXCACHE and MAXOPEN, defined below are
+** sufficiently large.
+**
+** MAXOPEN can be set as low as 1, but should ideally be about 15,
+** since this may be more typical of the number of different font files
+** required in mathematical manuscripts.
+**
+** In the current version, MAXCACHE is not actually used, because it
+** appears sufficient raster storage will always be available even for
+** relatively complex manuscripts. However, a record is kept which
+** will permit dynamic freeing and reallocation of raster storage; see
+** procedure loadchar for details.
+**
+***********************************************************************/
+
+
+/**********************************************************************/
+/************************ Global Definitions ************************/
+/**********************************************************************/
+
+/* All host-specific material resides in machdefs.h and typedefs.h;
+they must be revised when this dvi driver is rehosted to a new machine */
+
+#define DEBUG 1 /* for optional massive trace printing */
+#undef DEBUG /* do not want this now */
+
+#include "machdefs.h" /* all host-specific defines */
+
+#include "typedefs.h" /* typedefs (also host-specific) */
+
+#include <stdio.h> /* must come after the others to */
+ /* enable type checking */
+#include <errno.h> /* needed only for DISKFULL() definition */
+#if (BSD41 | BSD42)
+extern int errno; /* not in all errno.h files, sigh... */
+#endif
+
+#if IBM_PC_MICROSOFT
+#include <io.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#endif
+
+/* types.h and stat.h are needed for fstat(), which is used by special()
+and the virtual font mechanism in openfont.h to get the input file size. */
+
+#if (OS_ATARI | OS_VAXVMS | KCC_20)
+#include <types.h>
+#include <stat.h>
+#else /* NOT (OS_ATARI | OS_VAXVMS | KCC_20) */
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif /* (OS_ATARI | OS_VAXVMS | KCC_20) */
+
diff --git a/dviware/beebe/src/dviimp.c b/dviware/beebe/src/dviimp.c
new file mode 100644
index 0000000000..453e981e9e
--- /dev/null
+++ b/dviware/beebe/src/dviimp.c
@@ -0,0 +1,711 @@
+/* -*-C-*- dviimp.c */
+/*-->dviimp*/
+/**********************************************************************/
+/******************************* dviimp *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/***********************************************************************
+***********************************************************************/
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef IMPRESS
+#define IMPRESS 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "imPRESS [Imagen laser printer family]"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "imp"
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* to get standard font resolution */
+
+#define MAXLINE 4096 /* maximum input file line size */
+ /* it is needed only in special() */
+
+#define XDPI 300 /* horizontal dots/inch */
+#define XPSIZE 9 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+
+#define YDPI 300 /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The following values may be printer model dependent, or even printer
+serial number dependent. These values were obtained with the LaTeX
+TESTPAGE.TEX file for an Imagen 3320 printer; they express that fact
+that the real (0,0) is 15 dots above and 3 dots to the left of the top
+left corner of an 8.5in x 11in page. */
+
+#define XORIGIN -3 /* measured pixel coordinates of */
+#define YORIGIN -15 /* page origin (should be at (0,0)) */
+
+/***********************************************************************
+Define macros for imPRESS commands.
+
+With the exception of the function "loadchar", which requires extra
+data, and the function fillrect, for which the macro definition was too
+complicated for the compiler, NO escape sequences appear anywhere else
+in the text.
+***********************************************************************/
+
+#define IM_SABSH (BYTE)135 /* IM_SET_ABS_H */
+#define IM_SRELH (BYTE)136 /* IM_SET_REL_H */
+#define IM_SABSV (BYTE)137 /* IM_SET_ABS_V */
+#define IM_SRELV (BYTE)138 /* IM_SET_REL_V */
+#define IM_BRULE (BYTE)193
+#define IM_BGLY (BYTE)199
+#define IM_SET_FAMILY (BYTE)207
+#define IM_PAGE (BYTE)213
+#define IM_ENDPAGE (BYTE)219
+#define IM_EOF (BYTE)255
+
+#define ROUND(x) ((int)(x + 0.5))
+
+/* Output a 16-bit binary number in two bytes */
+#define OUT16(n) {OUTC((n)>>8); OUTC(n);}
+
+ /*******************************************************************
+ The imPRESS XY coordinate system has X increasing to the right, Y
+ increasing down, and the origin at the upper left corner.
+
+ The DVI XY coordinate system has X increasing to the right, Y
+ increasing up, and the origin at the lower left corner.
+
+ Rather than redefine the imPRESS HV coordinates (and advance
+ directions) to correspond to DVI XY coordinates, I have chosen to
+ let MOVETO/MOVEY/RMOVEY convert from DVI-Y to imPRESS-Y coordinates.
+ *******************************************************************/
+/* Absolute movement */
+#define MOVETO(x,y) if (x||(y-YSIZE)) {MOVEX(x); MOVEY(y);} else OUTC(IM_PAGE)
+#define MOVEX(x) {OUTC(IM_SABSH); OUT16(x);}
+#define MOVEY(y) {OUTC(IM_SABSV); OUT16(YSIZE-y);}
+
+/* Relative movement */
+#define RMOVETO(delx,dely) {RMOVEX(delx); RMOVEY(dely);}
+#define RMOVEX(delx) if (delx) {OUTC(IM_SRELH); OUT16(delx);}
+#define RMOVEY(dely) if (dely) {OUTC(IM_SRELV); OUT16(-dely);}
+
+/* Eject a page from the printer--this is the last command on each page */
+#define PAGEEJECT OUTC(IM_ENDPAGE)
+
+ /*******************************************************************
+ State variable defaults are:
+ coordinate system:
+ Origin is at top left corner of page (top and left defined
+ by HV)
+ Positive V axis is 90 degrees clockwise from positive H axis
+ Positive H axis is physically "down" the page
+ OUTC(IM_SET_HV_SYSTEM), OUTC( (2<<5) | (2<<3) | 4)
+ current position:
+ MOVETO(0,0)
+ text print direction:
+ Main advance direction is along H-axis
+ Secondary advance direction is clockwise from Main adv. dir.
+ OUTC(IM_SET_ADV_DIRS), OUTC( (0<<1) | 0 )
+ spacing (not used: done by TeX):
+ OUTC(IM_SET_SP), OUT16(0?)
+ OUTC(IM_SET_BOL), OUT16(0) * default left margin is 0 *
+ OUTC(IM_SET_IL), OUT16(0) * no default interline spacing *
+ selected font:
+ OUTC(IM_SET_FAMILY), OUTC(0?)
+ graphics (TEXTURE is used for rules, others not used by TeX):
+ OUTC(IM_SET_TEXTURE), OUT16(0) * Texture is solid black *
+ OUTC(IM_SET_PEN), OUTC(1?)
+ OUTC(IM_SET_MAGNIFICATION), OUTC(0)
+ OUTC(IM_SET_PUM), OUTC(0)
+ push mask:
+ OUTC(IM_SET_PUSH_MASK), OUTC(0x01FF)
+ *******************************************************************/
+
+#define ENDJOB OUTC(IM_EOF)
+
+ /*******************************************************************
+ Note: if predefined fonts are used, the definitions to access them
+ can't be redefined (i.e. the member maps and family tables). And
+ once a glyph has been explicitly defined, there is no way to
+ redefine it as a reference to a predefined glyph. This would be
+ troublesome if TeX used the predefined fonts.
+ *******************************************************************/
+
+/* Set the current font number */
+#define SETCURRENTFONT(fontnumber) {OUTC(IM_SET_FAMILY);OUTC(fontnumber);}
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->bopact*/
+/**********************************************************************/
+/******************************* bopact *******************************/
+/**********************************************************************/
+
+void
+bopact() /* beginning of page action */
+{
+ str_ycp = -1; /* last string ycp */
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ /* Provide a minimal document header which prevents the printer from
+ rearranging the page order. */
+ OUTS("@document(language impress, pagecollation off, pagereversal off, \
+prerasterization off, jamresistance on");
+ if ((int)copies > 1) /* avoid unnecessary output to allow */
+ OUTF(", copies %d",(int)copies); /* later override */
+ OUTC(')');
+ OUTC(IM_SET_FAMILY);
+ OUTC(0);
+ font_count = 0; /* no font numbers are assigned yet */
+ font_switched = TRUE;
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ ENDJOB;
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+
+/*-->eopact*/
+/**********************************************************************/
+/******************************* eopact *******************************/
+/**********************************************************************/
+
+void
+eopact() /* end of page action */
+{
+ PAGEEJECT;
+}
+
+#include "f20open.h"
+#include "fatal.h"
+
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner, draw a filled
+rectangle at (x,y).
+
+For most TeX uses, rules are uncommon, and little optimization is
+possible. However, for the LaTeX Bezier option, curves are simulated by
+many small rules (typically 2 x 2) separated by positioning commands.
+
+It is not possible to use relative, instead of absolute, moves in these
+sequences, without stacking rules for the whole page, because each rule
+is separated in the DVI file by push, pop, and positioning commands,
+making for an uncertain correspondence between internal (xcp,ycp)
+pixel page coordinates and external device coordinates.
+
+The last string y coordinate, str_ycp, must be reset here to force any
+later setstring() to reissue new absolute positioning commands.
+***********************************************************************/
+
+{
+ str_ycp = -1; /* invalidate string y coordinate */
+
+ /*
+ Output a new rule at TeX position (x,y). The device coordinates
+ will be changed on completion. The rule origin is the TeX
+ convention of the lower-left corner, while imPRESS uses the
+ upper-left corner, but allows an offset to be provided. Note that
+ the offset must be negated because imPRESS and TeX differ on the
+ direction of the Y-axis.
+ */
+ MOVETO(x,y);
+ OUTC(IM_BRULE);
+ OUT16(width);
+ OUT16(height);
+ OUT16(-height);
+}
+
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+
+/*-->loadchar*/
+/**********************************************************************/
+/****************************** loadchar ******************************/
+/**********************************************************************/
+ /*******************************************************************
+
+ <------wp------>
+ ^ ................ ^
+ | ................ |
+ | ................ |
+ | ................ |
+ | ................ |
+ | ................ |--- yoffp (negative if (xcp,ycp) above bitmap)
+ | ................ |
+ hp ................ |
+ | ................ |
+ | ................ |
+ | ................ |
+ | .....o.......... v <-- character reference point (xcp,ycp) at "o"
+ | ................
+ | ................
+ | ................
+ | ................
+ v +............... <-- (xcorner,ycorner) at "+"
+ <--->
+ |
+ |
+ xoffp (negative if (xcp,ycp) left of bitmap)
+ when char set: (xcp',ycp') := (xcp+tfmw,ycp)
+
+ ----- -------
+ TeX imPRESS
+ ----- -------
+ xoffp left offset
+ yoffp top offset
+ wp width
+ hp height
+ tfmw advance width
+
+ *******************************************************************/
+
+void
+loadchar(c)
+register BYTE c;
+{
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c)) /* check character range */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr))
+ return; /* do nothing for invisible fonts */
+
+ if (fontptr != pfontptr)
+ openfont(fontptr->n);
+
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ (void)clearerr(plotfp);
+
+ tcharptr->isloaded = TRUE;
+
+ OUTC(IM_BGLY);
+ OUT16( (0<<14) + ((fontptr->font_number)<<7) + c);
+ OUT16(tcharptr->pxlw); /* advance width */
+ OUT16(tcharptr->wp); /* width */
+ OUT16(tcharptr->xoffp); /* left offset */
+ OUT16(tcharptr->hp); /* height */
+ OUT16(tcharptr->yoffp+1); /* top offset */
+
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* output rasters */
+
+ if (DISKFULL(plotfp))
+ (void)fatal("loadchar(): Output error -- disk storage probably full");
+}
+
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+
+/*-->newfont*/
+/**********************************************************************/
+/****************************** newfont *******************************/
+/**********************************************************************/
+
+void
+newfont()
+{
+ register UNSIGN16 the_char; /* loop index */
+ INT16 j; /* loop index */
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ fontptr->ch[the_char].isloaded = FALSE;
+
+ for (j = 0; j < (INT16)font_count; ++j)
+ if (font_table[j] == fontptr) /* then font already known */
+ break;
+
+ if (j >= (INT16)font_count) /* new font */
+ {
+ fontptr->font_number = font_count;
+ font_table[font_count++] = fontptr;
+ }
+}
+
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outrow*/
+/**********************************************************************/
+/******************************* outrow *******************************/
+/**********************************************************************/
+
+void
+outrow(c,yoff) /* copy img_row[] into rasters[] if allocated, else no-op */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) */
+{
+ UNSIGN16 bytes_per_row; /* number of raster bytes to copy */
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte; /* unpacked raster byte */
+
+ tcharptr = &(fontptr->ch[c]);/* assume check for valid c has been done */
+ bytes_per_row = ((tcharptr->wp) + 7) >> 3; /* wp div 8 */
+ p = img_row; /* we step pointer p along img_row[] */
+
+ for (k = bytes_per_row; ; ++p)
+ {
+ the_byte = (BYTE)((*p) >> 24);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 16);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 8);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)(*p);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+ }
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ /* ONPAGE() is used here and in setstr() */
+
+#define ONPAGE(t) (((hh - t->xoffp + t->pxlw) <= XSIZE) \
+ && (hh >= 0)\
+ && (vv <= YSIZE)\
+ && (vv >= 0))
+
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+ if (ONPAGE(tcharptr))
+ { /* character fits entirely on page */
+ if (font_switched)
+ {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+
+ if (VISIBLE(tcharptr))
+ {
+ if (!tcharptr->isloaded)
+ loadchar(c);
+
+ if (ycp != str_ycp)
+ {
+ MOVETO(xcp,ycp);
+ str_ycp = ycp;
+ }
+ else
+ MOVEX(xcp);
+
+ OUTC(c);
+ }
+ }
+ else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
+ { /* character is off page -- discard it */
+ (void)fprintf(stderr,
+ "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
+ isprint(c) ? c : '?',c,c,c);
+ NEWLINE(stderr);
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
+
+#include "setfntnm.h"
+#include "setrule.h"
+
+/*-->setstr*/
+/**********************************************************************/
+/******************************* setstr *******************************/
+/**********************************************************************/
+
+void
+setstr(c)
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register BOOLEAN inside;
+ INT32 h0,v0; /* (h,v) at entry */
+ COORDINATE hh0,vv0; /* (hh,vv) at entry */
+ COORDINATE hh_last; /* hh before call to fixpos() */
+ register UNSIGN16 k; /* loop index */
+ UNSIGN16 nstr; /* number of characters in str[] */
+ BYTE str[MAXSTR+1]; /* string accumulator */
+ BOOLEAN truncated; /* off-page string truncation flag */
+
+ /*******************************************************************
+ Set a sequence of characters in SETC_000 .. SETC_127 with a minimal
+ number of imPRESS commands. These sequences tend to occur in long
+ clumps in a DVI file, and setting them together whenever possible
+ substantially decreases the overhead and the size of the output
+ file. A sequence can be set as a single string if
+
+ * TeX and imPRESS coordinates of each character agree, AND
+
+ * each character is in the same font (this will always be true
+ in a sequence from a DVI file), AND
+
+ * each character fits within the page boundaries, AND
+
+ * each character definition is already loaded, AND
+
+ * each character is from a visible font
+
+ Whenever any of these conditions does not hold, any string already
+ output is terminated, and a new one begun.
+
+ Two output optimizations are implemented here. First, up to MAXSTR
+ (in practice more than enough) characters are collected in str[],
+ and any that require downloading are handled. Then the entire
+ string is set at once, subject to the above limitations. Second, by
+ recording the vertical page coordinate, ycp, in the global variable
+ str_ycp (reset in prtpage() at begin-page processing), it is
+ possible to avoid outputting y coordinates unnecessarily, since a
+ single line of text will generally result in many calls to this
+ function.
+ *******************************************************************/
+
+#define BEGINSTRING {inside = TRUE;\
+ if (ycp != str_ycp)\
+ {\
+ MOVETO(xcp,ycp);\
+ str_ycp = ycp;\
+ }\
+ else\
+ MOVEX(xcp);}
+
+#define ENDSTRING {inside = FALSE;}
+
+#define OFF_PAGE (-1) /* off-page coordinate value */
+
+ if (font_switched) /* output new font selection */
+ {
+ SETCURRENTFONT(fontptr->font_number);
+ font_switched = FALSE;
+ }
+
+ inside = FALSE;
+ truncated = FALSE;
+
+ hh0 = hh;
+ vv0 = vv;
+ h0 = h;
+ v0 = v;
+ nstr = 0;
+ while ((SETC_000 <= c) && (c <= SETC_127) && (nstr < MAXSTR))
+ { /* loop over character sequence */
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if (!tcharptr->isloaded) loadchar(c);
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+
+ str[nstr++] = c; /* save string character */
+
+ c = (BYTE)nosignex(dvifp,(BYTE)1);
+ }
+
+ /* put back character which terminated the loop */
+ (void)UNGETC((int)(c),dvifp);
+
+ hh = hh0; /* restore coordinates at entry */
+ vv = vv0;
+ h = h0;
+ v = v0;
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setstr(\"");
+ for (k = 0; k < nstr; ++k)
+ {
+ c = str[k];
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ }
+ (void)fprintf(stderr,"\") (hh,vv) = (%ld,%ld) font name <%s>",
+ (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ for (k = 0; k < nstr; ++k)
+ { /* loop over character sequence */
+ c = str[k];
+ tcharptr = &(fontptr->ch[c]);
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if (tcharptr->isloaded) /* character already downloaded */
+ {
+ if (!inside)
+ BEGINSTRING;
+ OUTC(c);
+ }
+ else /* character must be downloaded first */
+ {
+ if (inside)
+ ENDSTRING; /* finish any open string */
+ }
+ }
+ else /* character does not fit on page -- output */
+ { /* current string and discard the character */
+ truncated = TRUE;
+ if (inside)
+ ENDSTRING;
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh_last = hh;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ if (DBGOPT(DBG_POS_CHAR))
+ {
+ (void)fprintf(stderr,
+ "[%03o] xcp = %d\tycp = %d\thh = %d\thh_last = %d\n",
+ c,xcp,ycp,hh,hh_last);
+ }
+
+ /* If fixpos() changed position, we need new string next time */
+ if ((hh != hh_last) && inside)
+ ENDSTRING;
+ }
+ if (truncated && DBGOPT(DBG_OFF_PAGE) && !quiet)
+ {
+ (void)fprintf(stderr,"setstr(): Text [");
+ for (k = 0; k < nstr; ++k)
+ (void)fprintf(stderr,isprint(str[k]) ? "%c" : "\\%03o",str[k]);
+ (void)fprintf(stderr,"] truncated at page boundaries.");
+ NEWLINE(stderr);
+ }
+ if (inside) /* finish last string */
+ ENDSTRING;
+}
+
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dviinit.h b/dviware/beebe/src/dviinit.h
new file mode 100644
index 0000000000..4cbdefcef7
--- /dev/null
+++ b/dviware/beebe/src/dviinit.h
@@ -0,0 +1,374 @@
+/* -*-C-*- dviinit.h */
+/*-->dviinit*/
+/**********************************************************************/
+/****************************** dviinit *******************************/
+/**********************************************************************/
+
+void
+dviinit(filestr) /* initialize DVI file processing */
+char *filestr; /* command line filename string */
+{
+ int i; /* temporary */
+ INT16 k; /* index in curpath[] and curname[] */
+ char* tcp; /* temporary string pointers */
+ char* tcp1; /* temporary string pointers */
+
+#if OS_UNIX
+/***********************************************************************
+Unix allows binary I/O on stdin and stdout; most other operating systems
+do not. In order to support this, we use the convention that a null
+filestr (NOT a (char*)NULL) means the dvifile is on stdin, and the
+translated output is on stdout. Error logging will be to dvixxx.err or
+dvixxx.dvi-err. Because random access is required of the dvifile, stdin
+may NOT be a pipe; it must be a disk file.
+***********************************************************************/
+#define NO_FILENAME (filestr[0] == '\0')
+#endif
+
+#if CANON_A2
+
+#ifdef CANON_TEST
+ char modestring[10]; /* for dynamic fopen() mode string */
+#endif /* CANON_TEST */
+
+#endif
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ char* tcp2; /* temporary string pointers */
+#endif
+
+ for (k = 0; k < 10; ++k)
+ tex_counter[k] = (INT32)0L;
+
+ fontptr = (struct font_entry *)NULL;
+ hfontptr = (struct font_entry *)NULL;
+ pfontptr = (struct font_entry *)NULL;
+ fontfp = (FILE *)NULL;
+ cache_size = 0;
+ nopen = 0;
+
+ /***********************************************************
+ Set up file names and open dvi and plot files. Simple
+ filename parsing assumes forms like:
+
+ Unix: name
+ name.ext
+ /dir/subdir/.../subdir/name
+ /dir/subdir/.../subdir/name.ext
+ TOPS-20: any Unix style (supported by PCC-20)
+ <directory>name
+ <directory>name.ext
+ <directory>name.ext.gen
+ device:<directory>name
+ device:<directory>name.ext
+ device:<directory>name.ext.gen
+ [directory]name
+ [directory]name.ext
+ [directory]name.ext.gen
+ device:[directory]name
+ device:[directory]name.ext
+ device:[directory]name.ext.gen
+ logname:name
+ logname:name.ext
+ logname:name.ext.gen
+
+ The Unix style should work under IBM PC DOS (backslash can
+ usually be replaced for forward slash), and the TOPS-20
+ style contains VAX VMS as a subset. Fancier TOPS-20 names
+ are possible (control-V quoting of arbitrary characters, and
+ attributes), but they are rare enough that we do not support
+ them. For TOPS-20 and VAX VMS, generation numbers are
+ recognized as a digit following the last dot, and they are
+ preserved for the DVI file only. For the output files, the
+ highest generation will always be assumed. This is for
+ convenience with the TOPS-20 TeX implementation, which on
+ completion types in a command "TeXspool: foo.dvi.13" and
+ waits for the user to type a carriage return.
+
+ We only need to extract the directory path, name, and
+ extension, so the parsing is simple-minded.
+
+ ***********************************************************/
+
+ tcp = strrchr(filestr,'/'); /* find end of Unix file path */
+
+#if (OS_ATARI | OS_PCDOS)
+ if (tcp == (char*)NULL) /* no Unix-style file path */
+ tcp = strrchr(filestr, '\\'); /* try \dos\path\ */
+#endif
+
+#if OS_TOPS20
+ if (tcp == (char*)NULL) /* no Unix-style file path */
+ {
+ tcp = strrchr(filestr, '>'); /* try <dir> */
+ if (tcp == (char*)NULL) /* no <dir> */
+ tcp = strrchr(filestr, ']'); /* try [dir] */
+ if (tcp == (char*)NULL) /* no [dir] */
+ tcp = strrchr(filestr, ':'); /* try logname: */
+ }
+#endif
+
+#if OS_VAXVMS
+ if (tcp == (char*)NULL) /* no Unix-style file path */
+ {
+ tcp = strrchr(filestr, ']'); /* try [dir] */
+ if (tcp == (char*)NULL) /* no [dir] */
+ tcp = strrchr(filestr, ':'); /* try logname: */
+ }
+#endif
+
+ if (tcp == (char*)NULL) /* no file path */
+ {
+ curpath[0] = '\0'; /* empty path */
+ tcp = filestr; /* point to start of name */
+ }
+ else /* save path for later use */
+ {
+ k = (INT16)(tcp-filestr+1);
+ (void)strncpy(curpath, filestr, (int)k);
+ curpath[k] = '\0';
+ tcp++; /* point to start of name */
+ }
+
+ tcp1 = strrchr(tcp, '.'); /* find last dot in filename */
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ if ((tcp1 != (char*)NULL) && isdigit(*(tcp1+1)))
+ { /* then assume generation number */
+ tcp2 = tcp1; /* remember dot position */
+ *tcp1 = '\0'; /* discard generation number */
+ tcp1 = strrchr(tcp,'.');/* find last dot in filename */
+ *tcp2 = '.'; /* restore dot */
+ }
+#endif
+
+ if (tcp1 == (char*)NULL)
+ { /* no dot, so name has no extension */
+ (void)strcpy(curname, tcp); /* save name */
+ tcp1 = strchr(tcp, '\0'); /* set empty extension */
+ }
+ else /* save name part */
+ {
+ k = (INT16)(tcp1-tcp);
+ (void)strncpy(curname, tcp, (int)k);
+ curname[k] = '\0';
+ }
+
+ (void)strcpy(curext, tcp1); /* save extension */
+
+
+ /* DVI file must always have extension DVIEXT; supply one if
+ necessary (e.g /u/jones/foo.dvi) */
+
+ (void)strcpy(dviname, curpath);
+ (void)strcat(dviname, curname);
+ if (curext[0] == '\0')
+ (void)strcat(dviname, DVIEXT);
+ else
+ (void)strcat(dviname, curext);
+
+ /* Device output file is PATH NAME . DVIPREFIX OUTFILE_EXT (e.g.
+ /u/jones/foo.dvi-alw) */
+
+ (void)strcpy(dvoname, curpath);
+ (void)strcat(dvoname, curname);
+ (void)strcat(dvoname, ".");
+ (void)strcat(dvoname, DVIPREFIX);
+ (void)strcat(dvoname, OUTFILE_EXT);
+
+ /* Font substitution file is PATH NAME SUBEXT (e.g.
+ /u/jones/foo.sub). We do not tell user (via stderr)
+ about it until it is needed. */
+
+ if (subfile[0] == '\0') /* no -fsubfile; make default */
+ {
+ (void)strcpy(subfile, curpath);
+ (void)strcat(subfile, curname);
+ (void)strcat(subfile, subext);
+ }
+
+
+#if OS_UNIX
+ if (NO_FILENAME)
+ {
+ dvifp = stdin; /* already open, so no DEBUG_OPEN call */
+ if (fseek(dvifp,0L,0))
+ {
+ (void)fprintf(stderr,
+ "%s: Unable to fseek() on stdin--was it a pipe?\n",
+ g_progname);
+ (void)EXIT(1);
+ }
+ }
+ else
+ {
+ dvifp = FOPEN(dviname,RB_OPEN);
+ DEBUG_OPEN(dvifp,dviname,RB_OPEN);
+ }
+#else
+
+ dvifp = FOPEN(dviname,RB_OPEN);
+ DEBUG_OPEN(dvifp,dviname,RB_OPEN);
+#endif
+
+ if (dvifp == (FILE*)NULL)
+ {
+ (void)sprintf(message,"dviinit(): %s: can't open [%s]",
+ g_progname, dviname);
+ (void)fatal(message);
+ }
+
+ /* We try both
+ PATH NAME . DVIPREFIX OUTFILE_EXT and
+ NAME . DVIPREFIX OUTFILE_EXT,
+ in case the user does not have write access to the directory PATH */
+ for (i = 1; i <= 2; ++i) /* two tries here */
+ {
+
+#if BBNBITGRAPH
+ strcpy(dvoname,"stdout"); /* BitGraph always goes to stdout */
+ plotfp = stdout;
+#else /* NOT BBNBITGRAPH */
+
+#if OS_VAXVMS
+
+#if POSTSCRIPT
+ plotfp = FOPEN(dvoname,WB_OPEN);
+#else
+ /* Create binary files for other devices; they cause less trouble
+ with VMS spooler programs. */
+ plotfp = FOPEN(dvoname,WB_OPEN,"rfm=fix","bls=512","mrs=512");
+#endif /* POSTSCRIPT */
+
+#else /* NOT OS_VAXVMS */
+
+#if OS_UNIX
+ plotfp = NO_FILENAME ? stdout : FOPEN(dvoname,WB_OPEN);
+#else
+ plotfp = FOPEN(dvoname,WB_OPEN);
+#endif /* OS_UNIX */
+
+#endif /* OS_VAXVMS */
+
+#endif /* BBNBITGRAPH */
+
+#if OS_UNIX
+ if (!NO_FILENAME)
+#endif
+
+ DEBUG_OPEN(plotfp,dvoname,WB_OPEN);
+ if (plotfp != (FILE*)NULL)
+ break; /* open okay */
+ if (i == 2)
+ {
+ (void)strcpy(dvoname, curname);
+ (void)strcat(dvoname, ".");
+ (void)strcat(dvoname, DVIPREFIX);
+ (void)strcat(dvoname, OUTFILE_EXT);
+ }
+ }
+
+ if (plotfp == (FILE*)NULL)
+ {
+ (void)sprintf(message,"dviinit(): %s: can't open [%s]",
+ g_progname, dvoname);
+ (void)fatal(message);
+ }
+
+#if OS_TOPS20
+ /* Because of the PCC-20 arithmetic (instead of logical)
+ shift bug wherein a constant expression (1<<35) evaluates
+ to 0 instead of 400000,,000000, we must set CF_nud using a
+ variable, instead of just using a constant */
+ /* "ac1 = makefield(CF_nud,1);" */
+ ac1 = 1;
+ ac1 = makefield(CF_nud,ac1);
+ setfield(ac1,CF_jfn,jfnof(fileno(plotfp))); /* jfn */
+ setfield(ac1,CF_dsp,FBbyv); /* generation number index in fdb */
+ ac2 = makefield(FB_ret,-1);
+ ac3 = makefield(FB_ret,0); /* set generation count to 0 (infinite) */
+ (void)jsys(JSchfdb,acs); /* ignore any errors */
+#endif /* OS_TOPS20 */
+
+#if CANON_A2
+
+#ifdef CANON_TEST
+
+#if OS_ATARI
+ strcpy(tmoname,"\\ca2XXX\.");
+#else
+ strcpy(tmoname,"ca2XXXXXX");
+#endif
+
+ mktemp(tmoname);
+ savefp = plotfp;
+ (void)sprintf(modestring,"%s+",WB_OPEN);
+ plotfp = FOPEN(tmoname, modestring);
+ stor_total = 0;
+#endif /* CANON_TEST */
+
+#endif /* CANON_A2 */
+
+ if (!quiet
+
+#if OS_UNIX
+ && !NO_FILENAME
+#endif
+
+ )
+ {
+ (void)fprintf(stderr,"[Input from DVI file %s]",dviname);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"[Output on file %s]",dvoname);
+ NEWLINE(stderr);
+ }
+
+ if (strncmp(curpath,dvoname,strlen(curpath)) == 0)
+ (void)strcpy(g_logname, curpath); /* used PATH on output file */
+ else
+ g_logname[0] = '\0'; /* no PATH on output file */
+
+#if OS_UNIX
+ if (NO_FILENAME) /* use dvixxx as file prefix */
+ {
+ (void)strcpy(g_logname, "dvi");
+ (void)strcat(g_logname, OUTFILE_EXT);
+ }
+#endif
+
+ (void)strcat(g_logname, curname);
+ (void)strcat(g_logname, ".");
+ (void)strcat(g_logname, DVIPREFIX);
+
+#if (OS_ATARI | OS_PCDOS | OS_UNIX)
+ (void)strcat(g_logname, "err");
+#endif
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ /* Force new generation; otherwise fopen(,"w+") reuses existing file */
+ (void)strcat(g_logname, "err.-1");
+#endif
+
+ lmargin = (COORDINATE)(leftmargin*((float)XDPI));
+ tmargin = (COORDINATE)(topmargin*((float)YDPI));
+
+#if (CANON_A2 | IMPRESS | HPJETPLUS)
+ /* Printer has (0,0) origin at (XORIGIN,YORIGIN) near, but not at,
+ upper left corner */
+ lmargin -= XORIGIN;
+ tmargin -= YORIGIN;
+#endif /* (CANON_A2 | IMPRESS | HPJETPLUS) */
+
+ if ((BYTE)nosignex(dvifp,(BYTE)1) != PRE)
+ (void)fatal("dviinit(): PRE doesn't occur first--are you sure \
+this is a DVI file?");
+
+ i = (int)signex(dvifp,(BYTE)1);
+ if (i != DVIFORMAT)
+ {
+ (void)sprintf(message,
+ "dviinit(): DVI format = %d, can only process DVI format %d files.",
+ i, (int)DVIFORMAT);
+ (void)fatal(message);
+ }
+}
diff --git a/dviware/beebe/src/dvijep.c b/dviware/beebe/src/dvijep.c
new file mode 100644
index 0000000000..4dce3c55b8
--- /dev/null
+++ b/dviware/beebe/src/dvijep.c
@@ -0,0 +1,1120 @@
+/* -*-C-*- dvijep.c */
+/*-->dvijep*/
+/**********************************************************************/
+/******************************* dvijep *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/***********************************************************************
+***********************************************************************/
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef HPJETPLUS
+#define HPJETPLUS 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Hewlett-Packard LaserJet Plus laser printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "jep"
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* to get standard font resolution */
+
+#define MAXLINE 4096 /* maximum input file line size */
+ /* it is needed only in special() */
+
+#define MAXPAGEFONTS 16 /* silly limit on fonts/page */
+
+#define XDPI 300 /* horizontal dots/inch */
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+
+#define YDPI 300 /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+#define XORIGIN 30 /* measured pixel coordinates of */
+#define YORIGIN -15 /* page origin (should be at (0,0) */
+
+/***********************************************************************
+Define some useful shorthand macros for all required LaserJet Plus
+commands. With the exception of the CREATEFONT and DOWNLOADCHAR macros,
+which require extra data, NO escape sequences appear anywhere else in
+the text.
+
+The LaserJet Plus allows coordinates in dots as well as the decipoints
+supported by the regular LaserJet. Dot coordinates are more convenient,
+so we use them exclusively. The Plus puts the page origin in the upper-
+left corner, while we have it in the lower-left corner, so MOVEY adjusts
+the coordinate accordingly.
+
+With 7-bit fonts, only characters 33..127 are printable, and with 8-bit
+fonts, 33..127 and 160..255 are printable. Since TeX assumes characters
+0..127 are available, we remap character numbers in 0..32 to 160..192
+and use 8-bit fonts. The macros conceal the remapping.
+
+Whenever possible, escape sequences are combined and 0 parameters
+omitted, in order to compress the output.
+***********************************************************************/
+
+/* Begin raster graphics .. {transfer raster graphics} .. end raster graphics */
+#define BEGIN_RASTER_GRAPHICS OUTS("\033*t300R\033*r1A")
+
+/* CREATE_FONT must be followed by a 26-byte font header (see readfont) */
+#define CREATE_FONT OUTS("\033\051s26W")
+
+#define DELETE_ALL_FONTS OUTS("\033*cF")
+
+/* DOWNLOAD_CHARACTER is not a complete specification---it must be followed by
+two-byte values of xoff, yoff, width, height, deltax */
+#define DOWNLOAD_CHARACTER(nbytes) OUTF("\033\050s%dW",(nbytes)+16)
+
+/* End raster graphics */
+#define END_RASTER_GRAPHICS OUTS("\033*rB")
+
+/* Map characters (0..32,33..127) to (160..192,33..127) */
+#define MAP_CHAR(c) (((c) > 32) ? (c) : ((c) + 160))
+
+/* Move absolute to (x,y), page origin in lower left corner */
+#define MOVETO(x,y) OUTF2("\033*p%dx%dY",(x),YSIZE-(y))
+
+/* Move absolute to (x,current y), page origin in lower left corner */
+#define MOVEX(x) OUTF("\033*p%dX",(x))
+
+/* Move absolute to (current x,y), page origin in lower left corner */
+#define MOVEY(y) OUTF("\033*p%dY",YSIZE-(y))
+
+/* Output TeX character number with mapping to HP LaserJet Plus number */
+#define OUT_CHAR(c) OUTC(MAP_CHAR(c))
+
+/* Output a 16-bit binary number in two bytes */
+#define OUT16(n) {OUTC((n)>>8); OUTC((n));}
+
+/* Eject a page from the printer--this is the last command on each page */
+#define PAGEEJECT OUTC('\f')
+
+/* Reset printer at job start. <ESC>E is global reset which clears
+everything but permanent fonts, which we do not use. <ESC>&l0E resets
+left margin to 0. <ESC>&a0L resets top margin to 0. Without these,
+default margins are supplied which lie inside page. Unfortunately,
+these do not permit negative values, so we have to further correct the
+origin with (XORIGIN, YORIGIN) defined above; these bias (lmargin,
+tmargin) set in dviinit(). */
+#define RESET_PRINTER OUTS("\033E\033&lE\033&aL")
+
+/* Move relative by (delx,dely) from current point */
+#define RMOVETO(delx,dely) {\
+if ((delx) == 0)\
+ RMOVEY(dely)\
+else if ((dely) == 0)\
+ RMOVEX(delx)\
+else\
+ OUTF2("\033*p%c%dx%c%dY",\
+ ((delx) > 0 ? '+' : '-'),ABS(delx),\
+ ((dely) < 0 ? '+' : '-'),ABS(dely));\
+}
+
+/* Move relative to (delx+currentx,currenty), page origin in lower left
+corner */
+#define RMOVEX(delx) {\
+if ((delx) > 0)\
+ OUTF("\033*p+%dX",(delx));\
+else if ((delx) < 0)\
+ OUTF("\033*p%dX",(delx));\
+}
+
+/* Move relative to (currentx,dely+currenty), page origin in lower left
+corner */
+#define RMOVEY(dely) {\
+if ((dely) > 0)\
+ OUTF("\033*p%dY",-(dely));\
+else if ((dely) < 0)\
+ OUTF("\033*p+%dY",-(dely));\
+}
+
+/* Round a POSITIVE floating-point value to the nearest integer */
+#define ROUND(x) ((int)(x + 0.5))
+
+/* Output a new rule at TeX position (x,y). The device coordinates will
+be changed on completion. The rule origin is the TeX convention of the
+lower-left corner, while the LaserJet Plus uses the upper-left corner.
+*/
+#define RULE(x,y,width,height) {\
+ MOVETO(x,(y)+height-1);\
+ OUTF2("\033*c%da%dbP",width,height);\
+}
+
+/* Set rule of same size as previous one at TeX position (x,y). The
+device coordinates will be changed on completion. */
+#define RULE2(x,y) {\
+ MOVETO(x,(y)+rule_height-1);\
+ OUTS("\033*cP");\
+}
+
+/* Set the current font and character in preparation for a DOWNLOAD_CHARACTER */
+#define SET_CHAR_CODE(fontnumber,ch) {\
+if (fontnumber)\
+ OUTF2("\033*c%dd%dE",fontnumber,MAP_CHAR(ch));\
+else\
+ OUTF("\033*cd%dE",MAP_CHAR(ch));\
+}
+
+/* Set the number of copies of the current page (issue just before
+PAGEEJECT) */
+#define SETCOPIES(n) OUTF("\033&l%dX",MAX(1,MIN(n,99)))
+
+/* Set the font number in preparation for a CREATE_FONT */
+#define SET_FONT_ID(fontnumber) OUTF("\033*c%dd4F",(fontnumber));
+
+#define TRANSFER_RASTER_GRAPHICS(nbytes) OUTF("\033*b%dW",(nbytes));
+
+#define UNDEFINED_FONT 65535 /* fonts are numbered 0,1,2,... */
+
+/* In order to handle the MAXPAGEFONTS restriction, we keep a set of the
+fonts in use, accessing them with these two functions. If a later
+printer model increases MAXFONTS beyond 32, we can transparently change
+to another representation, but for now, we use an efficient bit
+set implementation. */
+
+UNSIGN32 page_members; /* the bit set for current page */
+#define ADD_MEMBER(set,member) {set |= (1 << (member));}
+#define IS_MEMBER(set,member) (set & (1 << (member)))
+#define EMPTY_SET(set) {set = 0L;}
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->bopact*/
+/**********************************************************************/
+/******************************* bopact *******************************/
+/**********************************************************************/
+
+void
+bopact() /* beginning of page action */
+{
+ page_fonts = 0; /* no fonts used on this page yet */
+ EMPTY_SET(page_members);
+
+ rule_height = -1; /* reset last rule parameters */
+ rule_width = -1;
+
+ str_ycp = -1; /* reset string y coordinate */
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ RESET_PRINTER; /* printer reset */
+ DELETE_ALL_FONTS; /* delete all downloaded fonts */
+ font_count = 0; /* no font numbers are assigned yet */
+ font_switched = TRUE;
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+ DELETE_ALL_FONTS; /* delete all downloaded fonts */
+ RESET_PRINTER; /* printer reset */
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+
+/*-->eopact*/
+/**********************************************************************/
+/******************************* eopact *******************************/
+/**********************************************************************/
+
+void
+eopact() /* end of page action */
+{
+ if (copies > 1)
+ SETCOPIES(copies);
+ PAGEEJECT;
+}
+
+#include "f20open.h"
+#include "fatal.h"
+
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner, draw a filled
+rectangle at (x,y).
+
+For most TeX uses, rules are uncommon, and little optimization is
+possible. However, for the LaTeX Bezier option, curves are simulated by
+many small rules (typically 2 x 2) separated by positioning commands.
+By remembering the size of the last rule set, we can test for the
+occurrence of repeated rules of the same size, and reduce the output by
+omitting the rule sizes. The last rule parameters are reset by the
+begin-page action in prtpage(), so they do not carry across pages.
+
+It is not possible to use relative, instead of absolute, moves in these
+sequences, without stacking rules for the whole page, because each rule
+is separated in the DVI file by push, pop, and positioning commands,
+making for an uncertain correspondence between internal (xcp,ycp)
+pixel page coordinates and external device coordinates.
+
+The last string y coordinate, str_ycp, must be reset here to force any
+later setstring() to reissue new absolute positioning commands.
+***********************************************************************/
+
+{
+ str_ycp = -1; /* invalidate string y coordinate */
+
+ if ((height != rule_height) || (width != rule_width))
+ {
+ RULE(x,y,width,height);
+ rule_width = width; /* save current rule parameters */
+ rule_height = height;
+ }
+ else /* same size rule again */
+ RULE2(x,y);
+}
+
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+
+/*-->loadbmap*/
+/**********************************************************************/
+/****************************** loadbmap ******************************/
+/**********************************************************************/
+
+void
+loadbmap(c) /* load big character as raster bitmap */
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+
+ if (fontptr != pfontptr)
+ (void)openfont(fontptr->n);
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh - tcharptr->xoffp,YSIZE-vv+tcharptr->yoffp);
+
+ MOVETO(xcp,ycp);
+ BEGIN_RASTER_GRAPHICS;
+
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outraster); /* load rasters into device */
+
+ END_RASTER_GRAPHICS;
+ str_ycp = -1; /* invalidate string y coordinate */
+}
+
+/*-->loadchar*/
+/**********************************************************************/
+/****************************** loadchar ******************************/
+/**********************************************************************/
+
+void
+loadchar(c)
+register BYTE c;
+{
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ COORDINATE nbytes; /* number of bytes per row */
+ float temp;
+ INT16 ntemp;
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c)) /* check character range */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr))
+ return; /* do nothing for invisible fonts */
+
+ if (fontptr != pfontptr)
+ openfont(fontptr->n);
+
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ (void)clearerr(plotfp);
+
+ tcharptr->isloaded = TRUE;
+
+ SET_CHAR_CODE(fontptr->font_number,c);
+
+ /* Number of bytes in bitmap, possibly reduced because of LaserJet Plus */
+ /* limits. Large characters really need to be handled as bitmaps */
+ /* instead of as downloaded characters. */
+
+ nbytes = ((tcharptr->wp) + 7) >> 3; /* wp div 8 */
+ DOWNLOAD_CHARACTER(MIN(16,nbytes)*MIN(255,(tcharptr->hp)));
+
+ OUTC(4); /* 4 0 14 1 is fixed sequence */
+ OUTC(0);
+
+ OUTC(14);
+ OUTC(1);
+
+ OUTC(0); /* orientation = 0 ==> portrait */
+ OUTC(0);
+
+ /* Apologies for the temporary variables; the Sun OS 3.2 cc could
+ not compile the original expressions. */
+ ntemp = MIN(-(tcharptr->xoffp),127);
+ ntemp = MAX(-128,ntemp);
+ OUT16(ntemp);
+ ntemp = MIN(tcharptr->yoffp,127);
+ ntemp = MAX(-128,ntemp);
+ OUT16(ntemp);
+ ntemp = MIN(128,tcharptr->wp);
+ OUT16(ntemp);
+ ntemp = MIN(255,tcharptr->hp);
+ OUT16(ntemp);
+ temp = (float)(tcharptr->tfmw);
+ temp = 4.0*temp*conv;
+ ntemp = ROUND(temp);
+ OUT16(ntemp); /* delta x to nearest 1/4 dot */
+
+ /* Bug fix: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* output rasters */
+
+ if (DISKFULL(plotfp))
+ (void)fatal("loadchar(): Output error -- disk storage probably full");
+}
+
+/*-->makefont*/
+/**********************************************************************/
+/***************************** makefont *******************************/
+/**********************************************************************/
+
+void
+makefont()
+{
+ register UNSIGN16 the_char; /* loop index */
+ INT16 j; /* loop index */
+ /* parameters of largest cell */
+ COORDINATE cell_above; /* dots above baseline */
+ COORDINATE cell_below; /* dots below baseline */
+ COORDINATE char_below; /* dots below baseline */
+ COORDINATE cell_height; /* total height */
+ COORDINATE cell_left; /* dots left of character cell */
+ COORDINATE cell_width; /* total width */
+ COORDINATE cell_baseline; /* in 0..(cell_height-1) */
+
+ /*******************************************************************
+ Each LaserJet Plus font must be assigned a unique number in
+ 0..32767, and only 32 fonts can be active at one time. We keep a
+ table of font pointers for this purpose and store the corresponding
+ table index in font_number. Each time a new font is encountered, we
+ increment font_count and store it in that font's font_number. TeX
+ produces a unique font number as well, and TeX82 only uses values in
+ the range 0..255. The DVI file supports 32-bit font numbers, so it
+ is better to generate our own, because someday other programs may
+ produce DVI files too.
+
+ If fonts are freed dynamically, the table entry must be invalidated
+ and a command sent to the printer to delete that font. At present,
+ font freeing happens only in dviterm() at the close of processing of
+ a single DVI file. A subsequent DVI file processed will result in
+ the invocation of devinit() which resets font_count to 0. It is not
+ possible to avoid downloading some fonts for subsequent files,
+ because we have no control over what order they are printed in, and
+ each output file must therefore be regarded as independent.
+
+ In order to deal with the limit of MAXFONTS active fonts in the
+ LaserJet Plus, we have two choices. The first and best and most
+ difficult, is to entirely discard the matching of TeX fonts with
+ LaserJet Plus fonts---new characters would simply be assigned to the
+ next available entry in the current open font. The second choice is
+ less satisfactory---when MAXFONTS fonts have been downloaded, we
+ delete the last of them and reset the isloaded flags for all the
+ characters in that font. The Plus also allows deletion of
+ individual characters, so in the first case, we could delete
+ little-used characters to make room in the font tables on the
+ device; we do not use that approach here. One problem is that font
+ metrics must be assigned which match the largest character in the
+ font, so individual character deletion and later re-use of the
+ vacated slot is not in general possible. A second problem is the
+ bizarre behavior of the LaserJet Plus in response to a font
+ deletion--the current page is printed, and the all text following
+ the delete font command will appear on the next page.
+
+ There is a silly restriction that only MAXPAGEFONTS fonts can be
+ used on a single page, where MAXPAGEFONTS < MAXFONTS. We handle
+ this by keeping a count, page_fonts, of the number of fonts in use
+ on the current page, and whenever a font is requested whose
+ font_number (0,1,...) reaches or exceeds MAXPAGEFONTS, then
+ setchar() and setstr() will not download the character as a font
+ character, but instead will set it as a raster bitmap, in the same
+ fashion that large characters are handled.
+
+ We handle the font deletion misfeature by just not using it. If a
+ document requires more than MAXFONTS fonts, then the characters for
+ those additional fonts are sent as raster bitmaps, instead of
+ downloaded characters.
+
+ These two actions completely remove any limitation on the size or
+ number of fonts in the LaserJet Plus.
+
+ As an optimization to reduce the effort of font table searching,
+ each time a font is requested which has already been loaded, we move
+ that font to the front of font_table[]; the least popular fonts will
+ therefore be the ones that get deleted. The least recently used
+ priority mechanism is widely used in operating systems for buffer
+ management; the overhead of list rearrangement here is acceptable,
+ because font changing occurs relatively infrequently, compared to
+ character setting.
+
+ <------wp------>
+ ^ ................
+ | ................
+ | ................
+ | ................
+ | ................
+ | ................
+ | ................
+ hp ................
+ | ................
+ | ................
+ | ................
+ | .....o.......... <-- character reference point (xcp,ycp) at "o"
+ | ................ ^
+ | ................ |
+ | ................ |--- (hp - yoffp - 1)
+ | ................ |
+ v +............... v <-- (xcorner,ycorner) at "+"
+ <--->
+ |
+ |
+ xoffp (negative if (xcp,ycp) left of bitmap)
+
+
+ The LaserJet Plus font mechanism requires the declaration of cell
+ height, width, and baseline in the CreateFont command. Experiments
+ show that these must be large enough to incorporate the maximum
+ extent above and below the baseline of any characters in the font.
+ The metric correspondences are as follows:
+
+ ----- -------------
+ TeX LaserJet Plus
+ ----- -------------
+ xoffp -(left offset)
+ yoffp top offset
+ max(yoffp) + 1 cell baseline
+ max(wp) cell width
+ max(yoffp) +
+ max(hp-yoff,yoff-hp) + 1 cell height
+
+ *******************************************************************/
+
+ if (font_count >= MAXFONTS) /* then no more fonts can be downloaded */
+ {
+ /* set up so BIGCHAR() recognizes the font as not downloadable
+ and sends bitmaps instead */
+ fontptr->font_number = font_count;
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; ++the_char)
+ {
+ fontptr->ch[the_char].isloaded = FALSE;
+ fontptr->ch[the_char].istoobig = TRUE;
+ }
+ return;
+ }
+ for (j = 0; j < (INT16)font_count; ++j)
+ if (font_table[j] == fontptr) /* then font already known */
+ {
+ for (; j > 0; --j) /* LRU: move find to front */
+ font_table[j] = font_table[j-1];
+ font_table[0] = fontptr;
+ return; /* nothing more to do */
+ }
+
+ if (j >= (INT16)font_count) /* new font */
+ {
+ fontptr->font_number = font_count;
+ font_table[font_count] = fontptr;
+ font_count++; /* count the next font */
+
+ cell_above = 0;
+ cell_below = 0;
+ cell_left = 0;
+ cell_width = 0;
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; ++the_char)
+ {
+ char_below = fontptr->ch[the_char].yoffp -
+ fontptr->ch[the_char].hp;
+ char_below = ABS(char_below);
+ cell_height = 1 + fontptr->ch[the_char].yoffp + char_below;
+ fontptr->ch[the_char].isloaded = FALSE;
+ fontptr->ch[the_char].istoobig = (BOOLEAN)(
+ !IN(-128,-fontptr->ch[the_char].xoffp,127) ||
+ !IN(-128, fontptr->ch[the_char].yoffp,127) ||
+ !IN(1,fontptr->ch[the_char].wp,255) ||
+ !IN(1,cell_height,255));
+ cell_above = MAX(cell_above,fontptr->ch[the_char].yoffp);
+ cell_below = MAX(cell_below,char_below);
+ cell_left = MAX(cell_left,-fontptr->ch[the_char].xoffp);
+ cell_width = MAX(cell_width,fontptr->ch[the_char].wp);
+ }
+ cell_baseline = cell_above + 1;
+ cell_height = cell_above + cell_below + 1;
+
+ if ((cell_width > 255) || (cell_height > 255))
+ { /* don't worry, big characters are handled specially later */
+ cell_height = MIN(cell_height,255);
+ cell_width = MIN(cell_width,255);
+ }
+ cell_width = MAX(1,cell_width);
+
+ SET_FONT_ID(fontptr->font_number);
+
+ CREATE_FONT;
+
+ OUTC(0);
+ OUTC(26); /* descriptor length */
+
+ OUTC(0); /* always 0 */
+ OUTC(1); /* 8-bit font (for more than 95 characters) */
+
+ OUT16(0); /* always 0 */
+
+ OUT16(cell_baseline); /* baseline position (in 0..cell_height-1)*/
+
+ OUT16(cell_width); /* cell width */
+
+ OUT16(cell_height); /* cell height */
+
+ OUTC(0); /* orientation = 0 ==> portrait */
+ OUTC(1); /* spacing = 1 ==> proportional */
+
+ OUT16(0); /* symbol set (arbitrary) */
+
+ OUT16(2); /* pitch (arbitrary in 2..1260) */
+
+ OUT16(cell_height); /* font height (arbitrary in 0..10922) */
+
+ OUT16(0); /* always 0 */
+
+ OUTC(0); /* always 0 */
+ OUTC(0); /* style = 0 ==> upright */
+
+ OUTC(0); /* stroke weight = 0 ==> normal */
+ OUTC(0); /* typeface = 0 (arbitrary) */
+ }
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+
+/*-->newfont*/
+/**********************************************************************/
+/****************************** newfont *******************************/
+/**********************************************************************/
+
+void
+newfont()
+{
+ /*******************************************************************
+ Creating fonts immediately (usually at postamble read time, before
+ any pages have been printed), would exhaust the LaserJet Plus font
+ supply in a document with more than 32 fonts, requiring many fonts
+ to be sent as bitmaps, instead of as downloaded characters. If only
+ a few pages were selected for printing, it is unlikely that more
+ than 32 would actually be needed. With character bitmaps, the
+ output file is much larger than when downloaded characters are used,
+ and there is a likelihood of raising printer error code 21 (page too
+ complex to process), at least on the LaserJet Plus, which has rather
+ limited internal memory (about 512Kb). The HPLJ Series II can have
+ up to 4.5Mb of memory, and possibly would eliminate this error
+ condition.
+
+ Instead, we simply mark the font as currently undefined. When it is
+ first referenced, setfont() will call makefont() to actually create
+ it in the printer.
+ *******************************************************************/
+
+ fontptr->font_number = UNDEFINED_FONT;
+}
+
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outraster*/
+/**********************************************************************/
+/***************************** outraster ******************************/
+/**********************************************************************/
+
+void
+outraster(c,yoff)/* print single raster line in bitmap graphics mode */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) */
+{
+ UNSIGN16 bytes_per_row; /* number of raster bytes to copy */
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte; /* unpacked raster byte */
+
+ tcharptr = &(fontptr->ch[c]);/* assume check for valid c has been done */
+ bytes_per_row = (UNSIGN16)((tcharptr->wp) + 7) >> 3; /* wp div 8 */
+ p = img_row; /* we step pointer p along img_row[] */
+
+ TRANSFER_RASTER_GRAPHICS(bytes_per_row);
+
+ for (k = bytes_per_row; k > 0; ++p)
+ {
+ the_byte = (BYTE)((*p) >> 24);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 16);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 8);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)(*p);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+ }
+}
+
+/*-->outrow*/
+/**********************************************************************/
+/******************************* outrow *******************************/
+/**********************************************************************/
+
+void
+outrow(c,yoff) /* copy img_row[] into rasters[] if allocated, else no-op */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) */
+{
+ UNSIGN16 bytes_per_row; /* number of raster bytes to copy */
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte; /* unpacked raster byte */
+
+ if (yoff > 255) /* LaserJet Plus cannot handle big characters */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);/* assume check for valid c has been done */
+ bytes_per_row = (UNSIGN16)((tcharptr->wp) + 7) >> 3; /* wp div 8 */
+ bytes_per_row = MIN(16,bytes_per_row); /* limited to 128 bits/row */
+ p = img_row; /* we step pointer p along img_row[] */
+
+ for (k = bytes_per_row; k > 0; ++p)
+ {
+ the_byte = (BYTE)((*p) >> 24);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 16);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)((*p) >> 8);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+
+ the_byte = (BYTE)(*p);
+ OUTC(the_byte);
+ if ((--k) <= 0)
+ break;
+ }
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ /* BIGCHAR() and ONPAGE() are used here and in setstr(). BIGCHAR()
+ is TRUE if the character is too big to send as a downloaded font, or
+ if more than MAXPAGEFONTS have been used on this page, and the
+ required font's font_number is not in the page_members set, or if
+ more the font is not in the first MAXFONTS fonts. */
+
+#define BIGCHAR(t) (((t->wp > (COORDINATE)size_limit) ||\
+(t->hp > (COORDINATE)size_limit)) || (fontptr->font_number >= MAXFONTS) ||\
+(t->istoobig) ||\
+((page_fonts > MAXPAGEFONTS) && !IS_MEMBER(page_members,fontptr->font_number)))
+
+#define ONPAGE(t) (((hh - t->xoffp + t->pxlw) <= XSIZE) \
+ && (hh >= 0)\
+ && (vv <= YSIZE)\
+ && (vv >= 0))
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,(COORDINATE)(YSIZE-vv));
+ if (ONPAGE(tcharptr))
+ { /* character fits entirely on page */
+ if (font_switched)
+ {
+ (void)setfont();
+ font_switched = FALSE;
+ }
+
+ if (VISIBLE(tcharptr))
+ {
+ if (BIGCHAR(tcharptr))
+ loadbmap(c);
+ else
+ {
+ if (!tcharptr->isloaded)
+ loadchar(c);
+
+ if (ycp != str_ycp)
+ {
+ MOVETO(xcp,ycp);
+ str_ycp = ycp;
+ }
+ else
+ MOVEX(xcp);
+
+ OUT_CHAR(c);
+ }
+ }
+ }
+ else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
+ { /* character is off page -- discard it */
+ (void)fprintf(stderr,
+ "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
+ isprint(c) ? c : '?',c,c,c);
+ NEWLINE(stderr);
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
+
+#include "setfntnm.h"
+
+/*-->setfont*/
+/**********************************************************************/
+/****************************** setfont *******************************/
+/**********************************************************************/
+
+void
+setfont()
+{
+ if (fontptr->font_number == UNDEFINED_FONT)
+ (void)makefont();
+ if (!IS_MEMBER(page_members,fontptr->font_number))
+ page_fonts++;
+ if (page_fonts <= MAXPAGEFONTS)
+ ADD_MEMBER(page_members,fontptr->font_number);
+ if (!((fontptr->font_number >= MAXFONTS) || ((page_fonts > MAXPAGEFONTS) &&
+ !IS_MEMBER(page_members,fontptr->font_number))))
+ {
+ if (fontptr->font_number)
+ OUTF("\033\050%dX",fontptr->font_number);
+ else
+ OUTS("\033\050X");
+ }
+}
+
+#include "setrule.h"
+
+/*-->setstr*/
+/**********************************************************************/
+/******************************* setstr *******************************/
+/**********************************************************************/
+
+void
+setstr(c)
+register BYTE c;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ register BOOLEAN inside;
+ INT32 h0,v0; /* (h,v) at entry */
+ COORDINATE hh0,vv0; /* (hh,vv) at entry */
+ COORDINATE hh_last; /* hh before call to fixpos() */
+ register UNSIGN16 k; /* loop index */
+ UNSIGN16 nstr; /* number of characters in str[] */
+ BYTE str[MAXSTR+1]; /* string accumulator */
+ BOOLEAN truncated; /* off-page string truncation flag */
+
+ /*******************************************************************
+ Set a sequence of characters in SETC_000 .. SETC_127 with a minimal
+ number of LaserJet Plus commands. These sequences tend to occur in
+ long clumps in a DVI file, and setting them together whenever
+ possible substantially decreases the overhead and the size of the
+ output file. A sequence can be set as a single string if
+
+ * TeX and LaserJet Plus coordinates of each character agree (may
+ not be true, since device coordinates are in multiples of 1/4
+ pixel; violation of this requirement can be detected if
+ fixpos() changes hh, or if ycp != str_ycp), AND
+
+ * each character is in the same font (this will always be true
+ in a sequence from a DVI file), AND
+
+ * each character fits within the page boundaries, AND
+
+ * each character definition is already loaded, AND
+
+ * each character is from a visible font, AND
+
+ * each character bitmap extent is smaller than the size_limit
+ (which is used to enable discarding large characters after
+ each use in order to conserve virtual memory storage on the
+ output device).
+
+ Whenever any of these conditions does not hold, any string already
+ output is terminated, and a new one begun.
+
+ Two output optimizations are implemented here. First, up to MAXSTR
+ (in practice more than enough) characters are collected in str[],
+ and any that require downloading are handled. Then the entire
+ string is set at once, subject to the above limitations. Second, by
+ recording the vertical page coordinate, ycp, in the global variable
+ str_ycp (reset in prtpage() at begin-page processing), it is
+ possible to avoid outputting y coordinates unnecessarily, since a
+ single line of text will generally result in many calls to this
+ function.
+ *******************************************************************/
+
+#define BEGINSTRING {inside = TRUE;\
+ if (ycp != str_ycp)\
+ {\
+ MOVETO(xcp,ycp);\
+ str_ycp = ycp;\
+ }\
+ else\
+ MOVEX(xcp);}
+
+#define ENDSTRING {inside = FALSE;}
+
+#define OFF_PAGE (-1) /* off-page coordinate value */
+
+ if (font_switched) /* output new font selection */
+ {
+ (void)setfont();
+ font_switched = FALSE;
+ }
+
+ inside = FALSE;
+ truncated = FALSE;
+
+ hh0 = hh;
+ vv0 = vv;
+ h0 = h;
+ v0 = v;
+ nstr = 0;
+ while ((SETC_000 <= c) && (c <= SETC_127) && (nstr < MAXSTR))
+ { /* loop over character sequence */
+ tcharptr = &(fontptr->ch[c]);
+
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ if ((!tcharptr->isloaded) && (!BIGCHAR(tcharptr)))
+ loadchar(c);
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+
+ str[nstr++] = c; /* save string character */
+
+ c = (BYTE)nosignex(dvifp,(BYTE)1);
+ }
+
+ /* put back character which terminated the loop */
+ (void)UNGETC((int)(c),dvifp);
+
+ hh = hh0; /* restore coordinates at entry */
+ vv = vv0;
+ h = h0;
+ v = v0;
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setstr(\"");
+ for (k = 0; k < nstr; ++k)
+ {
+ c = str[k];
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ }
+ (void)fprintf(stderr,"\") (hh,vv) = (%ld,%ld) font name <%s>",
+ (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ for (k = 0; k < nstr; ++k)
+ { /* loop over character sequence */
+ c = str[k];
+ tcharptr = &(fontptr->ch[c]);
+ moveto(hh,YSIZE-vv);
+
+ if (ONPAGE(tcharptr) && VISIBLE(tcharptr))
+ { /* character fits entirely on page and is visible */
+ /* We must check first for a big character. The character */
+ /* may have been downloaded on a previous page, but if it is */
+ /* not in the page_members font set, we must send it again */
+ /* as a bitmap instead. */
+ if (BIGCHAR(tcharptr))
+ {
+ if (inside)
+ ENDSTRING; /* finish any open string */
+ loadbmap(c);
+ }
+ else /* character already downloaded */
+ {
+ if (!inside)
+ BEGINSTRING;
+ OUT_CHAR(c);
+ }
+ }
+ else /* character does not fit on page -- output */
+ { /* current string and discard the character */
+ truncated = TRUE;
+ if (inside)
+ ENDSTRING;
+ }
+ /* update horizontal positions in TFM and pixel units */
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh_last = hh;
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ if (DBGOPT(DBG_POS_CHAR))
+ {
+ (void)fprintf(stderr,
+ "[%03o] xcp = %d\tycp = %d\thh = %d\thh_last = %d\n",
+ c,xcp,ycp,hh,hh_last);
+ }
+
+ /* If fixpos() changed position, we need new string next time */
+ /* around. Actually, since the LaserJet Plus stores character */
+ /* widths in units of 1/4 dot, we could compute coordinates at */
+ /* four times the precision, but for now, we start a new string */
+ /* each time we have one or more dots of error. */
+
+ if ((hh != hh_last) && inside)
+ ENDSTRING;
+ }
+ if (truncated && DBGOPT(DBG_OFF_PAGE) && !quiet)
+ {
+ (void)fprintf(stderr,"setstr(): Text [");
+ for (k = 0; k < nstr; ++k)
+ (void)fprintf(stderr,isprint(str[k]) ? "%c" : "\\%03o",str[k]);
+ (void)fprintf(stderr,"] truncated at page boundaries.");
+ NEWLINE(stderr);
+ }
+ if (inside) /* finish last string */
+ ENDSTRING;
+}
+
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvijet.c b/dviware/beebe/src/dvijet.c
new file mode 100644
index 0000000000..8420e9dfdd
--- /dev/null
+++ b/dviware/beebe/src/dvijet.c
@@ -0,0 +1,333 @@
+/* -*-C-*- dvijet.c */
+/*-->dvijet*/
+/**********************************************************************/
+/******************************* dvijet *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef HPLASERJET
+#define HPLASERJET 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Hewlett-Packard 2686A Laser Jet laser printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "jet"
+
+#define DEFAULT_RESOLUTION 100 /* default dots/inch on HP Laser Jet */
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XDPI 100 /* HP Laser Jet horizontal dots/inch */
+#define XPSIZE 8 /* horizontal paper size in inches */
+
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI 100 /* HP Laser Jet vertical dots/inch */
+
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map (must have an even number of columns). */
+
+#define XBIT ((1+2*XWORDS)/2)
+#define YBIT YSIZE
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ OUTF("\033E\033*t%dR",(int)hpres); /* printer reset, resolution */
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "dispchar.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "initglob.h"
+#include "inch.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pbit)
+UNSIGN32 *pbit; /* pointer to raster line */
+
+/*************************************************************************
+Use machine-specific coding here for efficiency. For TOPS-20, we encode
+9 bytes from every pair of 36-bit words.
+
+For each raster line on the paper, the Laser Jet expects a binary 8-bit
+byte stream of the form
+
+ <ESC>*bnnnWxxxxxxx ... xxxxxxx
+ <--- nnn bytes --->
+
+where each byte contains, in order from high to low bit, a left-to-right
+bit pattern. No end-of-line marker is required; the escape sequence
+automatically causes a new raster line to be started.
+*************************************************************************/
+
+{
+ register UNSIGN32 w_even,w_odd;
+ register UNSIGN32 *p;
+ register BYTE *pbuf;
+ BYTE buf[1+(XSIZE+7)/8]; /* space for EOS + n 8-bit bytes */
+ register INT16 i,last_word;
+
+
+#if IBM_PC_MICROSOFT
+ for (last_word = XBIT - 1;
+ (last_word >= 1) && (*(UNSIGN32*)normaddr(pbit,last_word) == 0);
+ --last_word)
+ ; /* trim white space a word at a time */
+#else
+ p = pbit + XBIT - 1; /* point to last word on line */
+ for (last_word = XBIT - 1; (last_word >= 1) && (*p == 0); --last_word)
+ --p; /* trim white space a word at a time */
+#endif
+
+ p = pbit;
+ pbuf = &buf[0];
+ for (i = 0; i <= last_word; i += 2) /* loop over trimmed raster */
+ {
+ w_even = (*p++);
+ w_odd = (*p++);
+
+#if (HOST_WORD_SIZE == 36)
+ *pbuf++ = (BYTE)( (w_even >> 28) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 20) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 12) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 4) & 0xff);
+ *pbuf++ = (BYTE)( ((w_even << 4) | (w_odd >> 32)) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 24) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 16) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 8) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd ) & 0xff);
+#else /* HOST_WORD_SIZE == 32 */
+ /* encode 8 bytes at a time on 32-bit machines */
+ *pbuf++ = (BYTE)( (w_even >> 24) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 16) & 0xff);
+ *pbuf++ = (BYTE)( (w_even >> 8) & 0xff);
+ *pbuf++ = (BYTE)( (w_even ) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 24) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 16) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd >> 8) & 0xff);
+ *pbuf++ = (BYTE)( (w_odd ) & 0xff);
+#endif
+
+ }
+
+ *pbuf = '\0'; /* trailing EOS marker */
+
+ last_word |= 1; /* make last_word ODD */
+ for (i = ((last_word+1)*HOST_WORD_SIZE)/8;
+ (*(--pbuf) == '\0') && (i > 1); --i)
+ ; /* trim trailing zero bytes, leaving at least one */
+ last_word = i;
+
+ OUTF("\033*b%dW",(int)last_word);
+ pbuf = &buf[0]; /* cannot use fprintf with %s format because of
+ NUL's in string, and it is slow anyway */
+ for (i = 0; i < last_word; ++pbuf,++i)
+ OUTC(*pbuf);
+}
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+
+{
+ register UNSIGN32 *p;
+ register INT16 j,k,ybottom,ytop;
+
+ if (DBGOPT(DBG_PAGE_DUMP))
+ {
+ INT16 k1,k2,k3;
+
+ for (k3 = 0; k3 < XBIT; (k3 += 7, ++p))
+ { /* print bitmap 7 words at a pass */
+ k1 = k3;
+ k2 = MIN(XBIT,k1+7);
+ (void)printf("prtbmap()...bitmap words %d..%d",k1,k2-1);
+ NEWLINE(stdout);
+ (void)printf(" ");
+ for (k = k1; k < k2; ++k)
+ (void)printf("%10d",k*HOST_WORD_SIZE);
+ NEWLINE(stdout);
+ for (j = YBIT-1; j >= 0; --j)
+ {
+ p = BITMAP(j,0);
+ for (k = 0; k < XBIT; (++k,++p))
+ {
+ if (*p) /* print non-blank raster line */
+ {
+ p = BITMAP(j,k1);
+ (void)printf("%5d:",j);
+ for (k = k1; k < k2; (++k,++p))
+ (void)printf(" %09lx",*p);
+ NEWLINE(stdout);
+ break; /* exit loop over k */
+ }
+ }
+ }
+ }
+ }
+
+ (void)clearerr(plotfp);
+
+#if ZAPTHISOUT
+ k = -1; /* find top non-zero raster */
+ for (j = YBIT-1; (j > 0) && (k < 0); --j) /* loop over raster lines */
+ {
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+ }
+ ytop = j;
+#else
+ ytop = YBIT-1;
+#endif
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1;((k >= 0) && (*BITMAP(j,k) == 0));--k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,j-1);
+
+#if ZAPTHISOUT
+ for (j = ytop; (j >= ybottom); --j)
+ {
+ OUTF("%5d:",(int)j);
+ for (k = 0; k < XBIT; ++k)
+ OUTF(" %9x",*BITMAP(j,k));
+ NEWLINE(plotfp);
+ }
+#endif
+
+ OUTF("\033&l%dX",(int)copies); /* number of copies */
+
+ OUTS("\033*r1A"); /* start plot at current position */
+
+ for (j = ytop; (j >= ybottom) ; --j) /* loop over raster lines */
+ outline(BITMAP(j,0));
+
+ OUTS("\033*rB\f"); /* end raster graphics, eject page */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("Output error -- disk storage probably full");
+}
+
+#include "outrow.h"
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvil3p.c b/dviware/beebe/src/dvil3p.c
new file mode 100644
index 0000000000..988eaf5dea
--- /dev/null
+++ b/dviware/beebe/src/dvil3p.c
@@ -0,0 +1,340 @@
+/* -*-C-*- dvil3p.c */
+/*-->dvil3p*/
+/**********************************************************************/
+/******************************* dvil3p *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef DECLN03PLUS
+#define DECLN03PLUS 1 /* conditional compilation flag */
+
+#undef HIRES /* this is 150 dpi version */
+#define HIRES 1 /* define for 300 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "Digital LN03-PLUS 300 dpi laser printer"
+ /* this string is printed at runtime */
+#define XDPI 300 /* horizontal dots/inch */
+#define YDPI 300 /* vertical dots/inch */
+#else
+#define DEVICE_ID "Digital LN03-PLUS 150 dpi laser printer"
+ /* this string is printed at runtime */
+#define XDPI 150 /* horizontal dots/inch */
+#define YDPI 150 /* vertical dots/inch */
+#endif
+
+#define OUTFILE_EXT "l3p"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 1 /* 0 for low-resolution devices */
+
+#define V6SIZE XSIZE
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map (must have a multiple of 6 rows) */
+
+#define XBIT ((1+2*XWORDS)/2)
+#define YBIT (((YSIZE+5)/6)*6)
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr,"[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline; /* pointer to raster line */
+{
+ /* On return, the caller must output the character that selects the
+ spacing to the next line */
+
+ register INT16 left;
+ register char *a,*b,*c;
+ INT16 len;
+
+ for ((left = V6SIZE, c = pline + V6SIZE - 1);
+ (*c == '\077') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Since the run length
+ encoding carries a penalty of additional output equal to the length
+ of the run length prefix (!<number>), short runs are not encoded.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ We do not store a termination marker, but instead keep a counter,
+ "left", which is decremented to 0 when the end of the string is
+ reached.
+
+ ?????????????xxxxxxxxxxxxxxxx????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+ *******************************************************************/
+
+ if (runlengthcode && (left > 3))
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && left; --left)
+ ; /* advance over run */
+ len = (INT16)(c-a); /* "c" points past run */
+ if (len > 3) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ OUTF2("!%d%c",len,*a);
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ }
+ if (a > b) /* output remaining string */
+ {
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ else /* no runlength coding */
+ {
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+ }
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register char *c; /* pointer into v6[] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ INT16 i,j,k,ybottom,ytop;
+ char v6[V6SIZE]; /* vertical 6-bit raster encodings */
+
+#if SEGMEM
+ UNSIGN32* q[6]; /* pointers to 6 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YSIZE-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,6*((j-1)/6)); /* need 6n raster lines */
+
+#if HIRES
+ /* <CR><ESC>[7 I<ESC>P0;0;1q"1;1 for 300 dpi spacing */
+ OUTS("\015\033[7 I\033P0;0;1q\0421;1");
+#else
+ /* <CR><ESC>[7 I<ESC>P0;0;2q"1;1 for 150 dpi spacing */
+ OUTS("\015\033[7 I\033P0;0;2q\0421;1");
+#endif
+
+ for (j = ytop; (j >= ybottom) ; j -= 6) /* loop over raster lines */
+ /* in groups of 6 */
+ {
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v6[0]; /* vertical 6-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 6; ++k) /* compute pointers to 6 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 6 adjacent rows and build 6-bit */
+ /* character value */
+ *c = '\0'; /* clear character template */
+ if (*Q(0) & mask)
+ *c |= '\001';
+ if (*Q(1) & mask)
+ *c |= '\002';
+ if (*Q(2) & mask)
+ *c |= '\004';
+ if (*Q(3) & mask)
+ *c |= '\010';
+ if (*Q(4) & mask)
+ *c |= '\020';
+ if (*Q(5) & mask)
+ *c |= '\040';
+ mask >>= 1; /* move masking bit right 1 position */
+ *c += '\077'; /* bias 6-bit value by 63 */
+ }
+ };
+ outline(&v6[0]);
+ OUTS("-\n");
+ }
+ /* Terminate the graphics image */
+ /* <ESC>\<FF>
+ */
+ OUTS("\033\\\f");
+
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvil75.c b/dviware/beebe/src/dvil75.c
new file mode 100644
index 0000000000..18ce261b21
--- /dev/null
+++ b/dviware/beebe/src/dvil75.c
@@ -0,0 +1,325 @@
+/* -*-C-*- dvil75.c */
+/*-->dvil75*/
+/**********************************************************************/
+/******************************* dvil75 *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef DECLA75
+#define DECLA75 1 /* conditional compilation flag */
+
+#undef HIRES /* this is 72 dpi version */
+#define HIRES 1 /* define for 144 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "DEC LA75 144h x 144v dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 144 /* horizontal dots/inch */
+#define YDPI 144 /* vertical dots/inch */
+#else
+#define DEVICE_ID "DEC LA75 72h x 72v dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 72 /* horizontal dots/inch */
+#define YDPI 72 /* vertical dots/inch */
+#endif
+
+#define OUTFILE_EXT "l75"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define V6SIZE XSIZE
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map (must have a multiple of 6 rows) */
+
+#define XBIT ((1+2*XWORDS)/2)
+#define YBIT (((YSIZE+5)/6)*6)
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr,"[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline; /* pointer to raster line */
+{
+ /* On return, the caller must output the character that selects the
+ spacing to the next line */
+
+ register INT16 left;
+ register char *a,*b,*c;
+ INT16 len;
+
+ for ((left = V6SIZE, c = pline + V6SIZE - 1);
+ (*c == '\077') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Since the run length
+ encoding carries a penalty of additional output equal to the length
+ of the run length prefix (!<number>), short runs are not encoded.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ We do not store a termination marker, but instead keep a counter,
+ "left", which is decremented to 0 when the end of the string is
+ reached.
+
+ ?????????????xxxxxxxxxxxxxxxx????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+ *******************************************************************/
+
+ if (runlengthcode && (left > 3))
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && left; --left)
+ ; /* advance over run */
+ len = (INT16)(c-a); /* "c" points past run */
+ if (len > 3) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ OUTF2("!%d%c",len,*a);
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ }
+ if (a > b) /* output remaining string */
+ {
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ else /* no runlength coding */
+ {
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+ }
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register char *c; /* pointer into v6[] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ INT16 i,j,k,ybottom,ytop;
+ char v6[V6SIZE]; /* vertical 6-bit raster encodings */
+
+#if SEGMEM
+ UNSIGN32* q[6]; /* pointers to 6 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YSIZE-1;
+ ybottom = 0;
+
+#if HIRES
+ /* <CR><ESC>P0;0;5q"1;1 for 144 dpi spacing */
+ OUTS("\015\033P0;0;5q\0421;1");
+#else
+ /* <CR><ESC>P0;0;10q"1;1 for 72 dpi spacing */
+ OUTS("\015\033P0;0;10q\0421;1");
+#endif
+
+ for (j = ytop; (j >= ybottom) ; j -= 6) /* loop over raster lines */
+ /* in groups of 6 */
+ {
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v6[0]; /* vertical 6-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 6; ++k) /* compute pointers to 6 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 6 adjacent rows and build 6-bit */
+ /* character value */
+ *c = '\0'; /* clear character template */
+ if (*Q(0) & mask)
+ *c |= '\001';
+ if (*Q(1) & mask)
+ *c |= '\002';
+ if (*Q(2) & mask)
+ *c |= '\004';
+ if (*Q(3) & mask)
+ *c |= '\010';
+ if (*Q(4) & mask)
+ *c |= '\020';
+ if (*Q(5) & mask)
+ *c |= '\040';
+ mask >>= 1; /* move masking bit right 1 position */
+ *c += '\077'; /* bias 6-bit value by 63 */
+ }
+ };
+ outline(&v6[0]);
+ OUTS("-\n");
+ }
+ /* Terminate the graphics image */
+ /* <ESC>\
+ */
+ OUTS("\033\\");
+
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvim72.c b/dviware/beebe/src/dvim72.c
new file mode 100644
index 0000000000..e7bfc685df
--- /dev/null
+++ b/dviware/beebe/src/dvim72.c
@@ -0,0 +1,517 @@
+/* -*-C-*- dvim72.c */
+/*-->dvim72*/
+/**********************************************************************/
+/******************************* dvim72 *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef APPLEIMAGEWRITER
+#define APPLEIMAGEWRITER 1 /* conditional compilation flag */
+
+#undef HIRES
+#define HIRES 0 /* this is 72 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "Apple ImageWriter 144 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 144 /* horizontal dots/inch */
+#undef MAXOPEN /* need to redefine this */
+#define MAXOPEN 06 /* limit on number of open PXL files */
+#else
+#define DEVICE_ID "Apple ImageWriter 72 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 72 /* horizontal dots/inch */
+#endif
+
+#define OUTFILE_EXT "m72"
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI XDPI /* vertical dots/inch */
+#define YPSIZE 22 /* vertical paper size in inches */
+#define YSIZE (((YDPI*YPSIZE+15)/16)*16) /* number of vertical dots (16n)*/
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr,"[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+
+char
+makechar(p,mask)
+register UNSIGN32* p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000';
+
+#if HIRES
+ if (*Q(0) & mask)
+ c |= '\001';
+ if (*Q(2) & mask)
+ c |= '\002';
+ if (*Q(4) & mask)
+ c |= '\004';
+ if (*Q(6) & mask)
+ c |= '\010';
+ if (*Q(8) & mask)
+ c |= '\020';
+ if (*Q(10) & mask)
+ c |= '\040';
+ if (*Q(12) & mask)
+ c |= '\100';
+ if (*Q(14) & mask)
+ c |= '\200';
+#else
+ if (*Q(0) & mask)
+ c |= '\001';
+ if (*Q(1) & mask)
+ c |= '\002';
+ if (*Q(2) & mask)
+ c |= '\004';
+ if (*Q(3) & mask)
+ c |= '\010';
+ if (*Q(4) & mask)
+ c |= '\020';
+ if (*Q(5) & mask)
+ c |= '\040';
+ if (*Q(6) & mask)
+ c |= '\100';
+ if (*Q(7) & mask)
+ c |= '\200';
+#endif
+
+ return(c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline;
+
+{
+ register INT16 left;
+ register char *a,*b,*c;
+ INT16 len;
+
+ for ((left = XSIZE, c = pline + XSIZE - 1);
+ (*c == '\000') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Since the run length
+ encoding carries a penalty of additional output equal to the length
+ of the run length prefix (<ESC>Vnnnn), short runs are not so
+ encoded.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ Since the character strings take on all values on 0 .. 255, we
+ cannot store a termination marker, but must instead keep a counter,
+ "left", which is decremented to 0 when the end of the string is
+ reached.
+
+ ?????????????xxxxxxxxxxxxxxxx????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+ *******************************************************************/
+
+ if (runlengthcode && (left > 7))
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && left; --left)
+ ; /* advance over run */
+ len = (INT16)(c-a); /* "c" points past run */
+ if (len > 7) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+ if ((int)(a-b) & 07)
+ OUTF("\033G%04d",(int)(a - b));
+ else
+ OUTF("\033g%03d",((int)(a - b)) >> 3);
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ OUTF2("\033V%04d%c",len,*a);
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ }
+ if (a > b) /* output remaining string */
+ {
+ if ((int)(a-b) & 07)
+ OUTF("\033G%04d",(int)(a - b));
+ else
+ OUTF("\033g%03d",((int)(a - b)) >> 3);
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ else /* no runlength coding */
+ {
+ if (left & 07)
+ OUTF("\033G%04d",left);
+ else
+ OUTF("\033g%03d",left >> 3);
+
+ /* cannot use fprintf %s because 0 bytes terminate string */
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+ }
+ NEWLINE(plotfp);
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register BYTE *c; /* pointer into v8[][] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+
+#if SEGMEM
+#else
+ UNSIGN32 *ptmp; /* pointer into bitmap[][] */
+#endif
+
+ register UNSIGN32 mask; /* mask for single bit selection */
+ register INT16 k;
+ INT16 i,j,ybottom,ytop;
+
+#if HIRES
+ BYTE v8[2][XSIZE]; /* vertical 8-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[16]; /* pointers to 16 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = (j/16)*16 + 15;
+
+ OUTS("\033c"); /* reset printer */
+
+ for (j = ytop; (j >= ybottom) ; j -= 16) /* loop over raster lines */
+ /* in groups of 16 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v8[0][0]; /* vertical 8-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 16; ++k) /* compute pointers to 16 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 16 adjacent rows and build two 8-bit */
+ /* character values, the first with rows n,n+2,...,n+14, */
+ /* the second with rows n+1,n+3,...,n+15. The two */
+ /* characters are then printed with 1 dot vertical spacing */
+
+#if SEGMEM
+ *c = (BYTE)makechar(&q[0],mask);
+ *(c+XSIZE) = (BYTE)makechar(&q[1],mask);
+#else
+ *c = (BYTE)makechar(&p,mask);
+ ptmp = p - XBIT;
+ *(c+XSIZE) = (BYTE)makechar(&ptmp,mask);
+#endif
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+
+ /* ESC p for 144 dots/inch horizontally */
+ /* ESC T01 for 1/144 inch spacing */
+ /* ESC g nnn for length/8 count */
+ OUTS("\033p\033T01");
+ (void)outline((char *)&v8[0][0]);
+
+ /* ESC p for 144 dots/inch horizontally */
+ /* ESC T15 for 15/144 inch spacing */
+ /* ESC g nnn for length/8 count */
+ OUTS("\033p\033T15");
+ (void)outline((char *)&v8[1][0]);
+ } /* end loop over j */
+
+ OUTC('\f'); /* eject page with FF */
+ OUTS("\033c"); /* reset printer */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#else /* NOT HIRES */
+ BYTE v8[XSIZE+2]; /* vertical 8-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[8]; /* pointers to 8 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ } /* end loop over j */
+ ybottom = (j/8)*8 + 7;
+
+ OUTS("\033c"); /* reset printer */
+
+ for (j = ytop; (j >= ybottom) ; j -= 8) /* loop over raster lines */
+ /* in groups of 8 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v8[0]; /* vertical 8-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 8; ++k) /* compute pointers to 8 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 8 adjacent rows and build 8-bit */
+ /* character value */
+
+#if SEGMEM
+ *c = (BYTE)makechar(q,mask);
+#else
+ *c = (BYTE)makechar(&p,mask);
+#endif
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+ --c; /* last character encoded */
+
+ /* ESC n for 72 dots/inch horizontally */
+ /* ESC T16 for 16/144 inch spacing */
+ /* ESC G nnnn for length count */
+ OUTS("\033n\033T16");
+ (void)outline((char *)&v8[0]);
+ } /* end loop over j */
+ OUTC('\f'); /* eject page with FF */
+ OUTS("\033c"); /* reset printer */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#endif
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvimac.c b/dviware/beebe/src/dvimac.c
new file mode 100644
index 0000000000..a7518b49ef
--- /dev/null
+++ b/dviware/beebe/src/dvimac.c
@@ -0,0 +1,517 @@
+/* -*-C-*- dvimac.c */
+/*-->dvimac*/
+/**********************************************************************/
+/******************************* dvimac *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef APPLEIMAGEWRITER
+#define APPLEIMAGEWRITER 1 /* conditional compilation flag */
+
+#undef HIRES
+#define HIRES 1 /* this is 144 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "Apple ImageWriter 144 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 144 /* horizontal dots/inch */
+#undef MAXOPEN /* need to redefine this */
+#define MAXOPEN 06 /* limit on number of open PXL files */
+#else
+#define DEVICE_ID "Apple ImageWriter 72 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 72 /* horizontal dots/inch */
+#endif
+
+#define OUTFILE_EXT "mac"
+
+#define BYTE_SIZE 8 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI XDPI /* vertical dots/inch */
+#define YPSIZE 22 /* vertical paper size in inches */
+#define YSIZE (((YDPI*YPSIZE+15)/16)*16) /* number of vertical dots (16n)*/
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr,"[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+
+char
+makechar(p,mask)
+register UNSIGN32* p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000';
+
+#if HIRES
+ if (*Q(0) & mask)
+ c |= '\001';
+ if (*Q(2) & mask)
+ c |= '\002';
+ if (*Q(4) & mask)
+ c |= '\004';
+ if (*Q(6) & mask)
+ c |= '\010';
+ if (*Q(8) & mask)
+ c |= '\020';
+ if (*Q(10) & mask)
+ c |= '\040';
+ if (*Q(12) & mask)
+ c |= '\100';
+ if (*Q(14) & mask)
+ c |= '\200';
+#else
+ if (*Q(0) & mask)
+ c |= '\001';
+ if (*Q(1) & mask)
+ c |= '\002';
+ if (*Q(2) & mask)
+ c |= '\004';
+ if (*Q(3) & mask)
+ c |= '\010';
+ if (*Q(4) & mask)
+ c |= '\020';
+ if (*Q(5) & mask)
+ c |= '\040';
+ if (*Q(6) & mask)
+ c |= '\100';
+ if (*Q(7) & mask)
+ c |= '\200';
+#endif
+
+ return(c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline;
+
+{
+ register INT16 left;
+ register char *a,*b,*c;
+ INT16 len;
+
+ for ((left = XSIZE, c = pline + XSIZE - 1);
+ (*c == '\000') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Since the run length
+ encoding carries a penalty of additional output equal to the length
+ of the run length prefix (<ESC>Vnnnn), short runs are not so
+ encoded.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced.
+
+ Since the character strings take on all values on 0 .. 255, we
+ cannot store a termination marker, but must instead keep a counter,
+ "left", which is decremented to 0 when the end of the string is
+ reached.
+
+ ?????????????xxxxxxxxxxxxxxxx????????????????????
+ ^ ^ ^
+ | | |
+ b a c
+
+ <-----run------>
+ *******************************************************************/
+
+ if (runlengthcode && (left > 7))
+ {
+ for (a = b = pline; (left > 0); --left)
+ {
+ for (c = a; (*a == *++c) && left; --left)
+ ; /* advance over run */
+ len = (INT16)(c-a); /* "c" points past run */
+ if (len > 7) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+ if ((int)(a-b) & 07)
+ OUTF("\033G%04d",(int)(a - b));
+ else
+ OUTF("\033g%03d",((int)(a - b)) >> 3);
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ OUTF2("\033V%04d%c",len,*a);
+ a = b = c;
+ }
+ else /* ignore short run */
+ {
+ ++a;
+ left += len - 1;
+ }
+ }
+ if (a > b) /* output remaining string */
+ {
+ if ((int)(a-b) & 07)
+ OUTF("\033G%04d",(int)(a - b));
+ else
+ OUTF("\033g%03d",((int)(a - b)) >> 3);
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ else /* no runlength coding */
+ {
+ if (left & 07)
+ OUTF("\033G%04d",left);
+ else
+ OUTF("\033g%03d",left >> 3);
+
+ /* cannot use fprintf %s because 0 bytes terminate string */
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+ }
+ NEWLINE(plotfp);
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register BYTE *c; /* pointer into v8[][] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+
+#if SEGMEM
+#else
+ UNSIGN32 *ptmp; /* pointer into bitmap[][] */
+#endif
+
+ register UNSIGN32 mask; /* mask for single bit selection */
+ register INT16 k;
+ INT16 i,j,ybottom,ytop;
+
+#if HIRES
+ BYTE v8[2][XSIZE]; /* vertical 8-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[16]; /* pointers to 16 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = (j/16)*16 + 15;
+
+ OUTS("\033c"); /* reset printer */
+
+ for (j = ytop; (j >= ybottom) ; j -= 16) /* loop over raster lines */
+ /* in groups of 16 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v8[0][0]; /* vertical 8-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 16; ++k) /* compute pointers to 16 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 16 adjacent rows and build two 8-bit */
+ /* character values, the first with rows n,n+2,...,n+14, */
+ /* the second with rows n+1,n+3,...,n+15. The two */
+ /* characters are then printed with 1 dot vertical spacing */
+
+#if SEGMEM
+ *c = (BYTE)makechar(&q[0],mask);
+ *(c+XSIZE) = (BYTE)makechar(&q[1],mask);
+#else
+ *c = (BYTE)makechar(&p,mask);
+ ptmp = p - XBIT;
+ *(c+XSIZE) = (BYTE)makechar(&ptmp,mask);
+#endif
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+
+ /* ESC p for 144 dots/inch horizontally */
+ /* ESC T01 for 1/144 inch spacing */
+ /* ESC g nnn for length/8 count */
+ OUTS("\033p\033T01");
+ (void)outline((char *)&v8[0][0]);
+
+ /* ESC p for 144 dots/inch horizontally */
+ /* ESC T15 for 15/144 inch spacing */
+ /* ESC g nnn for length/8 count */
+ OUTS("\033p\033T15");
+ (void)outline((char *)&v8[1][0]);
+ } /* end loop over j */
+
+ OUTC('\f'); /* eject page with FF */
+ OUTS("\033c"); /* reset printer */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#else /* NOT HIRES */
+ BYTE v8[XSIZE+2]; /* vertical 8-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[8]; /* pointers to 8 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ } /* end loop over j */
+ ybottom = (j/8)*8 + 7;
+
+ OUTS("\033c"); /* reset printer */
+
+ for (j = ytop; (j >= ybottom) ; j -= 8) /* loop over raster lines */
+ /* in groups of 8 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v8[0]; /* vertical 8-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 8; ++k) /* compute pointers to 8 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 8 adjacent rows and build 8-bit */
+ /* character value */
+
+#if SEGMEM
+ *c = (BYTE)makechar(q,mask);
+#else
+ *c = (BYTE)makechar(&p,mask);
+#endif
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+ } /* end loop over i */
+ --c; /* last character encoded */
+
+ /* ESC n for 72 dots/inch horizontally */
+ /* ESC T16 for 16/144 inch spacing */
+ /* ESC G nnnn for length count */
+ OUTS("\033n\033T16");
+ (void)outline((char *)&v8[0]);
+ } /* end loop over j */
+ OUTC('\f'); /* eject page with FF */
+ OUTS("\033c"); /* reset printer */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#endif
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvimpi.c b/dviware/beebe/src/dvimpi.c
new file mode 100644
index 0000000000..720443af07
--- /dev/null
+++ b/dviware/beebe/src/dvimpi.c
@@ -0,0 +1,430 @@
+/* -*-C-*- dvimpi.c */
+/*-->dvimpi*/
+/**********************************************************************/
+/******************************* dvimpi *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef MPISPRINTER
+#define MPISPRINTER 1 /* conditional compilation flag */
+
+#undef HIRES /* this is 72 dpi version */
+#define HIRES 1 /* define for 144 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "MPI Sprinter 144h x 144v dot matrix printer"
+ /* this string is printed at runtime */
+#define V6SIZE (XSIZE+1)/2
+#define XDPI 144 /* horizontal dots/inch */
+#define YDPI 144 /* vertical dots/inch */
+#else
+#define DEVICE_ID "MPI Sprinter 72h x 72v dot matrix printer"
+ /* this string is printed at runtime */
+#define V6SIZE XSIZE
+#define XDPI 72 /* horizontal dots/inch */
+#define YDPI 72 /* vertical dots/inch */
+#endif
+
+#define OUTFILE_EXT "mpi"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XPSIZE 8 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+#define YPSIZE 16 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map (must have an even number of columns). */
+
+#define XBIT ((1+2*XWORDS)/2)
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+#if HIRES
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+char
+makechar(p,mask)
+register UNSIGN32* p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000'; /* clear character template */
+ if (*Q(0) & mask)
+ c |= '\040';
+ if (*Q(2) & mask)
+ c |= '\020';
+ if (*Q(4) & mask)
+ c |= '\010';
+ if (*Q(6) & mask)
+ c |= '\004';
+ if (*Q(8) & mask)
+ c |= '\002';
+ if (*Q(10) & mask)
+ c |= '\001';
+ return('\100' | c); /* bias into range 64 .. 127 */
+}
+#endif
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline; /* pointer to raster line */
+{
+ /* On return, the caller must output the character that selects the
+ spacing to the next line */
+
+ register INT16 left;
+ register char *c;
+
+ for ((left = V6SIZE, c = pline + V6SIZE - 1);
+ (*c == '\100') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+ OUTC('\033'); /* <ESC> */
+ OUTC('\027'); /* <CTL-W> */
+
+ for (c = pline; left; --left, c++)
+ OUTC(*c);
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+
+#if HIRES
+{
+ register char *c; /* pointer into v6[][] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ UNSIGN32 *ptmp; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ INT16 i,j,k,ybottom,ytop;
+ char v6[4][V6SIZE]; /* vertical 6-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[12]; /* pointers to 12 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YSIZE-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,6*((j-1)/6)); /* need 6n raster lines */
+
+ /* <ESC><CTL-Z> for 72 dots/inch spacing
+ <ESC><CTL-V> to disable paper perforation skip
+ */
+ OUTS("\033\032\033\026");
+
+ for (j = ytop; (j >= ybottom) ; j -= 12) /* loop over raster lines */
+ /* in groups of 12 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v6[0][0]; /* vertical 6-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 12; ++k) /* compute pointers to 12 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,k+=2))
+ { /* loop over word bits 2 at a time */
+#if SEGMEM
+ *c = makechar(&q[0],mask);
+ *(c+ V6SIZE) = makechar(&q[0],mask >> 1);
+ *(c+2*V6SIZE) = makechar(&q[1],mask);
+ *(c+3*V6SIZE) = makechar(&q[1],mask >> 1);
+#else /* NOT SEGMEM */
+ *c = makechar(&p,mask);
+ *(c+ V6SIZE) = makechar(&p,mask >> 1);
+ ptmp = p - XBIT;
+ *(c+2*V6SIZE) = makechar(&ptmp,mask);
+ *(c+3*V6SIZE) = makechar(&ptmp,mask >> 1);
+#endif /* SEGMEM */
+
+ mask >>= 2; /* move mask bit right 2 positions */
+ }
+ };
+
+ outline(&v6[0][0]);
+ OUTS("0\033P1."); /* carriage return and move */
+ /* right 1/2 dot. */
+ outline(&v6[1][0]);
+ OUTS("0\033Q1."); /* carriage return and move */
+ /* down 1/2 dot. */
+ outline(&v6[2][0]);
+ OUTS("0\033P1."); /* carriage return and move */
+ /* right 1/2 dot. */
+ outline(&v6[3][0]);
+ OUTS("6"); /* new line down 6/72 inch */
+ }
+ OUTC('\f'); /* FF to eject page */
+ /* The MPI has no reset command, so put parameters back to something
+ reasonable.
+ <ESC><CTL-T> for 6 lpi spacing
+ <ESC><CTL-U> to enable paper perforation skip
+ */
+ OUTS("\033\024\033\025");
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#else /* NOT HIRES */
+{
+ register char *c; /* pointer into v6[] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ INT16 i,j,k,ybottom,ytop;
+ char v6[V6SIZE]; /* vertical 6-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[6]; /* pointers to 6 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ ytop = YSIZE-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,6*((j-1+5)/6)); /* need 6n raster lines */
+
+ /* <ESC><CTL-Z> for 72 dots/inch spacing
+ <ESC><CTL-V> to disable paper perforation skip
+ */
+ OUTS("\033\032\033\026");
+
+ for (j = ytop; (j >= ybottom) ; j -= 6) /* loop over raster lines */
+ /* in groups of 6 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v6[0]; /* vertical 6-bit encodings */
+ *c++ = '\0'; /* first slot is NUL for bit adjacency test */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 6; ++k) /* compute pointers to 6 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 6 adjacent rows and build 6-bit */
+ /* character value */
+ *c = '\0'; /* clear character template */
+ if (*Q(0) & mask)
+ *c |= '\040';
+ if (*Q(1) & mask)
+ *c |= '\020';
+ if (*Q(2) & mask)
+ *c |= '\010';
+ if (*Q(3) & mask)
+ *c |= '\004';
+ if (*Q(4) & mask)
+ *c |= '\002';
+ if (*Q(5) & mask)
+ *c |= '\001';
+ mask >>= 1; /* move masking bit right 1 position */
+ *c |= '\100'; /* bias 6-bit value by 64 */
+ }
+ };
+ outline(&v6[0]);
+ OUTS("6"); /* new line 6/72 inch down */
+ }
+ OUTC('\f'); /* FF to eject page */
+ /* The MPI has no reset command, so put parameters back to something
+ reasonable.
+ <ESC><CTL-T> for 6 lpi spacing
+ <ESC><CTL-U> to enable paper perforation skip
+ */
+ OUTS("\033\024\033\025");
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+#endif /* HIRES */
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvio72.c b/dviware/beebe/src/dvio72.c
new file mode 100644
index 0000000000..701c142616
--- /dev/null
+++ b/dviware/beebe/src/dvio72.c
@@ -0,0 +1,354 @@
+/* -*-C-*- dvio72.c */
+/*-->dvio72*/
+/**********************************************************************/
+/******************************* dvio72 *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef OKIDATA2410
+#define OKIDATA2410 1 /* conditional compilation flag */
+
+#undef HIRES
+#define HIRES 0 /* this is 72 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "OKIDATA Pacemark 2410 144 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 144 /* horizontal dots/inch */
+#undef MAXOPEN
+#define MAXOPEN 06 /* limit on number of open PXL files */
+#else
+#define DEVICE_ID "OKIDATA Pacemark 2410 72 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 72 /* horizontal dots/inch */
+#endif
+
+#define OUTFILE_EXT "o72"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XPSIZE 14 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI XDPI /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+
+char
+makechar(p,mask)
+UNSIGN32* p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000';
+ if (*Q(0) & mask)
+ c |= '\001';
+ if (*Q(1) & mask)
+ c |= '\002';
+ if (*Q(2) & mask)
+ c |= '\004';
+ if (*Q(3) & mask)
+ c |= '\010';
+ if (*Q(4) & mask)
+ c |= '\020';
+ if (*Q(5) & mask)
+ c |= '\040';
+ if (*Q(6) & mask)
+ c |= '\100';
+ return(c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+/*
+************************************************************************
+The OKIDATA Pacemark 2410 has a serious design flaw in that it lacks a
+command to reset to power-on state. This is serious, because it uses
+ETX to enter graphics mode, ETX STX to exit graphics mode, and ETX ETX
+to mean ETX as graphics data. This means that a single ETX sent from
+the host may cause it to enter graphics mode, or generate an error if it
+is already in graphics mode. Similarly, an ETX STX will enter graphics
+mode if it is not already in it, instead of exiting graphics mode. We
+therefore turn on graphics mode for each line, then turn it off again.
+That way, there may be some remote hope of resynchronizing if we lose an
+ETX due to line errors along the way.
+
+From an efficiency standout, it is regrettable that it has no run-length
+encoding of graphics data. The output quality and speed are otherwise
+quite reasonable as low-cost dot matrix printers go.
+************************************************************************
+*/
+
+void
+outline(pline)
+char *pline;
+{
+
+/* A few ASCII control character definitions */
+
+#define STX '\002'
+#define ETX '\003'
+#define SO '\016'
+#define ESC '\033'
+
+ register INT16 left;
+ register char *c;
+
+ for ((left = XSIZE, c = pline + XSIZE - 1);
+ (*c == '\000') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+ OUTC(ESC); /* ESC A - 12 cpi for square */
+ OUTC('A'); /* aspect ratio*/
+
+#if HIRES
+ OUTC(ESC);
+ OUTC('R'); /* ESC R - 144 dpi plot mode */
+#else
+ OUTC(ESC);
+ OUTC('P'); /* ESC P - 72 dpi plot mode */
+#endif
+
+ OUTC(ETX); /* ETX - begin graphics mode */
+
+ for (c = pline; left; --left)
+ {
+ if (*c == ETX)
+ OUTC(ETX); /* ETX's must be doubled */
+ OUTC(*c);
+ ++c;
+ }
+ OUTC(ETX);
+ OUTC(SO); /* ETX SO - graphics carriage return */
+ OUTC(ETX);
+ OUTC(STX); /* ETX STX - end graphics mode */
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+
+ register char *c; /* pointer into v7[] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ INT16 i,j,k,ybottom,ytop;
+ char v7[XSIZE+2]; /* vertical 7-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[14]; /* pointers to 14 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,7*((j-1+6)/7)); /* need 7n raster lines */
+
+ for (j = ytop; (j >= ybottom) ; j -= 7) /* loop over raster lines */
+ /* in groups of 7 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v7[0]; /* vertical 7-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 16; ++k) /* compute pointers to 16 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+#if SEGMEM
+ *c = makechar(&q[0],mask); /* examine bits in 7 adjacent */
+ /* rows and build 7-bit */
+ /* character value */
+#else
+ *c = makechar(&p,mask); /* examine bits in 7 adjacent */
+ /* rows and build 7-bit */
+ /* character value */
+#endif
+ mask >>= 1; /* move masking bit right 1 position */
+ }
+ }
+ --c; /* last character encoded */
+
+ outline(&v7[0]);
+ }
+ OUTS("\r\r\r\r\r\n"); /* force a carriage return since it
+ does not always correctly return the
+ head to the left margin */
+ OUTC('\f'); /* FF to eject page */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dvioki.c b/dviware/beebe/src/dvioki.c
new file mode 100644
index 0000000000..bdf627766c
--- /dev/null
+++ b/dviware/beebe/src/dvioki.c
@@ -0,0 +1,354 @@
+/* -*-C-*- dvioki.c */
+/*-->dvioki*/
+/**********************************************************************/
+/******************************* dvioki *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef OKIDATA2410
+#define OKIDATA2410 1 /* conditional compilation flag */
+
+#undef HIRES
+#define HIRES 1 /* this is 144 dpi version */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#if HIRES
+#define DEVICE_ID "OKIDATA Pacemark 2410 144 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 144 /* horizontal dots/inch */
+#undef MAXOPEN
+#define MAXOPEN 06 /* limit on number of open PXL files */
+#else
+#define DEVICE_ID "OKIDATA Pacemark 2410 72 dpi dot matrix printer"
+ /* this string is printed at runtime */
+#define XDPI 72 /* horizontal dots/inch */
+#endif
+
+#define OUTFILE_EXT "oki"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XPSIZE 14 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI XDPI /* vertical dots/inch */
+#define YPSIZE 11 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map. */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+
+/*-->makechar*/
+/**********************************************************************/
+/****************************** makechar ******************************/
+/**********************************************************************/
+
+char
+makechar(p,mask)
+UNSIGN32* p[];
+register UNSIGN32 mask;
+{
+ register char c;
+
+
+#if SEGMEM
+#define Q(n) p[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p[0] - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ c = '\000';
+ if (*Q(0) & mask)
+ c |= '\001';
+ if (*Q(1) & mask)
+ c |= '\002';
+ if (*Q(2) & mask)
+ c |= '\004';
+ if (*Q(3) & mask)
+ c |= '\010';
+ if (*Q(4) & mask)
+ c |= '\020';
+ if (*Q(5) & mask)
+ c |= '\040';
+ if (*Q(6) & mask)
+ c |= '\100';
+ return(c);
+}
+
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+/*
+************************************************************************
+The OKIDATA Pacemark 2410 has a serious design flaw in that it lacks a
+command to reset to power-on state. This is serious, because it uses
+ETX to enter graphics mode, ETX STX to exit graphics mode, and ETX ETX
+to mean ETX as graphics data. This means that a single ETX sent from
+the host may cause it to enter graphics mode, or generate an error if it
+is already in graphics mode. Similarly, an ETX STX will enter graphics
+mode if it is not already in it, instead of exiting graphics mode. We
+therefore turn on graphics mode for each line, then turn it off again.
+That way, there may be some remote hope of resynchronizing if we lose an
+ETX due to line errors along the way.
+
+From an efficiency standout, it is regrettable that it has no run-length
+encoding of graphics data. The output quality and speed are otherwise
+quite reasonable as low-cost dot matrix printers go.
+************************************************************************
+*/
+
+void
+outline(pline)
+char *pline;
+{
+
+/* A few ASCII control character definitions */
+
+#define STX '\002'
+#define ETX '\003'
+#define SO '\016'
+#define ESC '\033'
+
+ register INT16 left;
+ register char *c;
+
+ for ((left = XSIZE, c = pline + XSIZE - 1);
+ (*c == '\000') && (left > 1);
+ (--left,--c)) /* trim white space but leave */
+ ; /* at least 1 character in line */
+
+ OUTC(ESC); /* ESC A - 12 cpi for square */
+ OUTC('A'); /* aspect ratio*/
+
+#if HIRES
+ OUTC(ESC);
+ OUTC('R'); /* ESC R - 144 dpi plot mode */
+#else
+ OUTC(ESC);
+ OUTC('P'); /* ESC P - 72 dpi plot mode */
+#endif
+
+ OUTC(ETX); /* ETX - begin graphics mode */
+
+ for (c = pline; left; --left)
+ {
+ if (*c == ETX)
+ OUTC(ETX); /* ETX's must be doubled */
+ OUTC(*c);
+ ++c;
+ }
+ OUTC(ETX);
+ OUTC(SO); /* ETX SO - graphics carriage return */
+ OUTC(ETX);
+ OUTC(STX); /* ETX STX - end graphics mode */
+}
+
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+
+ register char *c; /* pointer into v7[] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ INT16 i,j,k,ybottom,ytop;
+ char v7[XSIZE+2]; /* vertical 7-bit raster encodings */
+
+#undef Q
+#if SEGMEM
+ UNSIGN32* q[14]; /* pointers to 14 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,7*((j-1+6)/7)); /* need 7n raster lines */
+
+ for (j = ytop; (j >= ybottom) ; j -= 7) /* loop over raster lines */
+ /* in groups of 7 */
+ {
+
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+
+ c = &v7[0]; /* vertical 7-bit encodings */
+ for (i = 0; i < XBIT; (++p,++i)) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1)) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 16; ++k) /* compute pointers to 16 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+#if SEGMEM
+ *c = makechar(&q[0],mask); /* examine bits in 7 adjacent */
+ /* rows and build 7-bit */
+ /* character value */
+#else
+ *c = makechar(&p,mask); /* examine bits in 7 adjacent */
+ /* rows and build 7-bit */
+ /* character value */
+#endif
+ mask >>= 1; /* move masking bit right 1 position */
+ }
+ }
+ --c; /* last character encoded */
+
+ outline(&v7[0]);
+ }
+ OUTS("\r\r\r\r\r\n"); /* force a carriage return since it
+ does not always correctly return the
+ head to the left margin */
+ OUTC('\f'); /* FF to eject page */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dviprx.c b/dviware/beebe/src/dviprx.c
new file mode 100644
index 0000000000..94ba5b93df
--- /dev/null
+++ b/dviware/beebe/src/dviprx.c
@@ -0,0 +1,335 @@
+/* -*-C-*- dviprx.c */
+/*-->dviprx*/
+/**********************************************************************/
+/******************************* dviprx *******************************/
+/**********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef PRINTRONIX
+#define PRINTRONIX 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Printronix 300/600 60h x 72v dpi dot matrix printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "prx"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* 0 for low-resolution devices */
+
+#define XDPI 60 /* horizontal dots/inch */
+#define XPSIZE 13 /* horizontal paper size in inches */
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI 72 /* vertical dots/inch */
+#define YPSIZE 22 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+/* The printer bit map */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+#include "outrow.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+
+{
+ register UNSIGN32 *p;
+ register INT16 i,j,k,ybottom,ytop;
+
+#if (HOST_WORD_SIZE == 32)
+ UNSIGN32 word;
+#endif
+
+ /* The Printronix encodes 6 horizontal bits in a single ASCII */
+ /* character biased by 64 to make it printable, but requires that */
+ /* the bits be reversed. The following table is indexed by a */
+ /* 6-bit pattern (0..63) and was produced automatically by an */
+ /* EMACS TECO macro */
+ /* raster code as */
+ /* 123456 --> 654321 */
+ static char remap[] =
+ { /* 1000000 --> 1000000 */
+ 64,
+ /* 1000001 --> 1100000 */ 96,
+ /* 1000010 --> 1010000 */ 80,
+ /* 1000011 --> 1110000 */ 112,
+ /* 1000100 --> 1001000 */ 72,
+ /* 1000101 --> 1101000 */ 104,
+ /* 1000110 --> 1011000 */ 88,
+ /* 1000111 --> 1111000 */ 120,
+ /* 1001000 --> 1000100 */ 68,
+ /* 1001001 --> 1100100 */ 100,
+ /* 1001010 --> 1010100 */ 84,
+ /* 1001011 --> 1110100 */ 116,
+ /* 1001100 --> 1001100 */ 76,
+ /* 1001101 --> 1101100 */ 108,
+ /* 1001110 --> 1011100 */ 92,
+ /* 1001111 --> 1111100 */ 124,
+ /* 1010000 --> 1000010 */ 66,
+ /* 1010001 --> 1100010 */ 98,
+ /* 1010010 --> 1010010 */ 82,
+ /* 1010011 --> 1110010 */ 114,
+ /* 1010100 --> 1001010 */ 74,
+ /* 1010101 --> 1101010 */ 106,
+ /* 1010110 --> 1011010 */ 90,
+ /* 1010111 --> 1111010 */ 122,
+ /* 1011000 --> 1000110 */ 70,
+ /* 1011001 --> 1100110 */ 102,
+ /* 1011010 --> 1010110 */ 86,
+ /* 1011011 --> 1110110 */ 118,
+ /* 1011100 --> 1001110 */ 78,
+ /* 1011101 --> 1101110 */ 110,
+ /* 1011110 --> 1011110 */ 94,
+ /* 1011111 --> 1111110 */ 126,
+ /* 1100000 --> 1000001 */ 65,
+ /* 1100001 --> 1100001 */ 97,
+ /* 1100010 --> 1010001 */ 81,
+ /* 1100011 --> 1110001 */ 113,
+ /* 1100100 --> 1001001 */ 73,
+ /* 1100101 --> 1101001 */ 105,
+ /* 1100110 --> 1011001 */ 89,
+ /* 1100111 --> 1111001 */ 121,
+ /* 1101000 --> 1000101 */ 69,
+ /* 1101001 --> 1100101 */ 101,
+ /* 1101010 --> 1010101 */ 85,
+ /* 1101011 --> 1110101 */ 117,
+ /* 1101100 --> 1001101 */ 77,
+ /* 1101101 --> 1101101 */ 109,
+ /* 1101110 --> 1011101 */ 93,
+ /* 1101111 --> 1111101 */ 125,
+ /* 1110000 --> 1000011 */ 67,
+ /* 1110001 --> 1100011 */ 99,
+ /* 1110010 --> 1010011 */ 83,
+ /* 1110011 --> 1110011 */ 115,
+ /* 1110100 --> 1001011 */ 75,
+ /* 1110101 --> 1101011 */ 107,
+ /* 1110110 --> 1011011 */ 91,
+ /* 1110111 --> 1111011 */ 123,
+ /* 1111000 --> 1000111 */ 71,
+ /* 1111001 --> 1100111 */ 103,
+ /* 1111010 --> 1010111 */ 87,
+ /* 1111011 --> 1110111 */ 119,
+ /* 1111100 --> 1001111 */ 79,
+ /* 1111101 --> 1101111 */ 111,
+ /* 1111110 --> 1011111 */ 95,
+ /* 1111111 --> 1111111 */ 127
+ };
+
+ (void)clearerr(plotfp);
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+
+ }
+ ybottom = MAX(0,j-1);
+
+ for (j = ytop; (j >= ybottom) ; --j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+ OUTC('\005'); /* Printronix graphics prefix */
+
+ p = BITMAP(j,0); /* the j-th raster line */
+
+#if (HOST_WORD_SIZE == 36)
+ if (DBGOPT(DBG_PAGE_DUMP))
+ {
+ (void)fprintf(stderr,"%6d:\t",j);
+ for (i = 0; i <= k; ++i)
+ (void)fprintf(stderr,"%09x",*p++);
+ NEWLINE(stderr);
+ p = BITMAP(j,0); /* the j-th raster line */
+ }
+ for (i = 0; i <= k; ++i)/* loop over trimmed raster */
+ { /* use machine-specific coding here for efficiency */
+ OUTC(remap[((*p) >> 30) & 077]);
+ OUTC(remap[((*p) >> 24) & 077]);
+ OUTC(remap[((*p) >> 18) & 077]);
+ OUTC(remap[((*p) >> 12) & 077]);
+ OUTC(remap[((*p) >> 6) & 077]);
+ OUTC(remap[((*p) ) & 077]);
+ ++p;
+ }
+#else /* HOST_WORD_SIZE == 32 */
+ if (DBGOPT(DBG_PAGE_DUMP))
+ {
+ (void)fprintf(stderr,"%6d:\t",j);
+ for (i = 0; i <= k; ++i)
+ (void)fprintf(stderr,"%08x",*p++);
+ NEWLINE(stderr);
+ p = BITMAP(j,0); /* the j-th raster line */
+ }
+ for (i = 0; i <= k; i += 3)/* loop over trimmed raster */
+ { /* use machine-specific coding here for efficiency */
+ OUTC(remap[((*p) >> 26) & 077]);
+ OUTC(remap[((*p) >> 20) & 077]);
+ OUTC(remap[((*p) >> 14) & 077]);
+ OUTC(remap[((*p) >> 8) & 077]);
+ OUTC(remap[((*p) >> 2) & 077]);
+ word = (*p) << 4;
+ ++p;
+ word |= (*p) >> 28;
+ OUTC(remap[word & 077]);
+ OUTC(remap[((*p) >> 22) & 077]);
+ OUTC(remap[((*p) >> 16) & 077]);
+ OUTC(remap[((*p) >> 10) & 077]);
+ OUTC(remap[((*p) >> 4) & 077]);
+ word = (*p) << 2;
+ ++p;
+ word |= (*p) >> 30;
+ OUTC(remap[word & 077]);
+ OUTC(remap[((*p) >> 24) & 077]);
+ OUTC(remap[((*p) >> 18) & 077]);
+ OUTC(remap[((*p) >> 12) & 077]);
+ OUTC(remap[((*p) >> 6) & 077]);
+ OUTC(remap[((*p) ) & 077]);
+ ++p;
+ }
+#endif
+ NEWLINE(plotfp);
+ }
+
+ if (DBGOPT(DBG_PAGE_DUMP))
+ putc('\f',stderr);
+
+ OUTC('\f'); /* FF to eject page */
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/dviterm.h b/dviware/beebe/src/dviterm.h
new file mode 100644
index 0000000000..aa0959753e
--- /dev/null
+++ b/dviware/beebe/src/dviterm.h
@@ -0,0 +1,96 @@
+/* -*-C-*- dviterm.h */
+/*-->dviterm*/
+/**********************************************************************/
+/****************************** dviterm *******************************/
+/**********************************************************************/
+
+void
+dviterm() /* terminate DVI file processing */
+{
+ register INT16 k; /* loop index */
+
+#if OS_VAXVMS
+ /* Stupid VMS fflush() raises error and loses last data block
+ unless it is full for a fixed-length record binary file.
+ Pad it here with IM_EOF characters, sigh... */
+ for (k = (INT16)((*plotfp)->_cnt); k > 0; --k)
+#if IMPRESS
+ OUTC(IM_EOF);
+#else
+ OUTC('\0');
+#endif
+#endif /* OS_VAXVMS */
+
+ if (fflush(plotfp) == EOF)
+ (void)fatal("dviterm(): Output error -- disk storage probably full");
+
+ /* Close all files and free dynamically-allocated font space. Stdin
+ is never closed, however, because it might be needed later for
+ ioctl(). */
+
+ if ((dvifp != (FILE*)NULL) && (dvifp != stdin))
+ (void)fclose(dvifp);
+ if (plotfp != (FILE*)NULL)
+ (void)fclose(plotfp);
+
+ for (k = 1; k <= (INT16)nopen; ++k)
+ {
+ if (font_files[k].font_id != (FILE *)NULL)
+ {
+
+#if VIRTUAL_FONTS
+ if (virt_font)
+ (void)virtfree(font_files[k].font_id);
+#endif /* VIRTUAL_FONTS */
+
+ (void)fclose(font_files[k].font_id);
+ font_files[k].font_id = (FILE *)NULL;
+ }
+ }
+
+ fontptr = hfontptr;
+ while (fontptr != (struct font_entry *)NULL)
+ {
+ for (k = 0; k < NPXLCHARS; ++k)
+ if ((fontptr->ch[k].rasters) != (UNSIGN32 *)NULL)
+ (void)free((char *)fontptr->ch[k].rasters);
+ pfontptr = fontptr;
+ fontptr = fontptr->next;
+ (void)free((char *)pfontptr);
+ }
+ if (!quiet)
+ {
+ (void)fprintf(stderr," [OK]");
+ NEWLINE(stderr);
+ }
+
+#if (BSD42 | OS_TOPS20)
+ if (spool_output)
+ {
+ register char *p;
+
+#if BSD42
+ (void)sprintf(message,"DVISPOOL %s\n",dvoname);
+#endif
+
+#if OS_TOPS20
+ (void)sprintf(message,"DVISPOOL: %s\n",dvoname);
+#endif
+
+ for (p = message; *p; ++p)
+ {
+#if OS_TOPS20
+ ac1 = 0100; /* .priin (primary input) */
+ ac2 = *p; /* next character from string */
+ jsys(JSsti, acs); /* stuff it into terminal input buffer */
+#endif
+
+#if BSD42
+ (void)ioctl(fileno(stdin),TIOCSTI,p);
+#endif
+
+ }
+ }
+#endif /* (BSD42 | OS_TOPS20) */
+
+}
diff --git a/dviware/beebe/src/dvitos.c b/dviware/beebe/src/dvitos.c
new file mode 100644
index 0000000000..e39b7f2aab
--- /dev/null
+++ b/dviware/beebe/src/dvitos.c
@@ -0,0 +1,513 @@
+/* -*-C-*- dvitos.c */
+/*-->dvitos*/
+/**********************************************************************/
+/******************************* dvitos *******************************/
+/**********************************************************************/
+/* <BEEBE.TEX.DVI>DVITOS.C.37, 5-Jun-85 00:34:50, Edit by BEEBE */
+/* (1) output FF at end-of-page before printer reset, and then output */
+/* tab stop settings (because the printer has no default ones!) */
+/* (2) make run-length encoding a run-time option '-r' */
+/* (3) Preloading of fonts always enabled when selected page lists specified */
+/* (4) Add code to remove adjacent bits on graphics lines */
+/* <BEEBE.TEX.DVI>DVITOS.C.30, 4-Jun-85 17:17:21, Edit by BEEBE */
+/* Adapted from DVIJET */
+
+/***********************************************************************
+
+ Performance remarks on the Toshiba P1351
+ [04-Jun-85]
+
+Statistics were collected on tests run from a dedicated IBM PC with a
+9600-baud serial interface to the printer, using a stand-alone printer
+driver program supporting XON/XOFF flow control.
+
+------------------------------------------------------------------------
+Test File File Size Time Char/sec
+ (bytes) (sec) (limit is 960)
+------------------------------------------------------------------------
+TeX page (-m1000) 122983 485 253
+run-length coded
+
+TeX page (-m1000) 187362 212 883
+full bitmap
+
+TeX page (-m579) 50476 152 327
+run-length coded
+
+TeX page (-m579) 64933 78 832
+full bitmap
+
+80 50-char lines of 4174 35 119
+X's
+
+C program 3949 100 39
+(12 cpi draft mode)
+
+C program 3949 117 33
+(12 cpi Elite mode)
+
+------------------------------------------------------------------------
+
+The Toshiba P-1351 manual claims a 12 cpi draft mode speed of 192 cps
+and a 12 cpi Elite speed of 93 cps. The 9600-baud serial port
+limitation of 960 cps is far above these, but the figures above indicate
+that the performance on actual manuscripts is highly overrated. The
+printer driver program was designed to echo a character to the screen
+every time an XOFF was received from the printer, and from several dozen
+to several hundred (for the run-length coded data) were received. This
+indicates that (1) the input buffer is probably a bottleneck, except for
+full bitmap graphics, and (2) horizontal spacing and carriage returns
+(the C programs) drastically reduce the throughput. It would be
+interesting to see how the printer performs with a parallel interface.
+
+The TeX output quality was marginal with full bitmap graphics, due to
+bad alignment of successive 24-bit-column strips of the bitmap. The
+output with run-length encoding was terrible due to bad positioning of
+horizontal skips. The correctness of the run-length encoding was
+verified by an independent program which unpacks the output bitmap into
+another file which compared identical to the full bitmap output. In
+addition, the bitmap itself was verified by calling PRXBitMap() inside
+prtbmap() to format it for the Printronix dot matrix printer.
+
+***********************************************************************/
+
+#include "dvihead.h"
+
+/**********************************************************************/
+/************************ Device Definitions ************************/
+/**********************************************************************/
+
+/* All output-device-specific definitions go here. This section must
+be changed when modifying a dvi driver for use on a new device */
+
+#undef TOSHIBAP1351
+#define TOSHIBAP1351 1 /* conditional compilation flag */
+
+#define VERSION_NO "2.10" /* DVI driver version number */
+
+#define DEVICE_ID "Toshiba P-1351 180h x 180v dpi dot matrix printer"
+ /* this string is printed at runtime */
+
+#define OUTFILE_EXT "tos"
+
+#define BYTE_SIZE 7 /* output file byte size */
+
+#undef STDRES
+#define STDRES 0 /* for low-resolution devices */
+
+#define XDPI 180 /* horizontal dots/inch */
+#if OS_PCDOS
+#define XPSIZE 7 /* horizontal paper size in inches */
+#else /* NOT OS_PCDOS */
+#define XPSIZE 11 /* horizontal paper size in inches */
+#endif /* OS_PCDOS */
+
+#define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\
+ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))
+ /* number of horizontal dots; */
+ /* MUST BE multiple of */
+ /* 2*HOST_WORD_SIZE */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI 180 /* vertical dots/inch */
+
+#if OS_PCDOS
+#define YPSIZE 9 /* vertical paper size in inches */
+#else /* NOT OS_PCDOS */
+#define YPSIZE 11 /* vertical paper size in inches */
+#endif /* OS_PCDOS */
+
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+#define V24SIZE (4*XWORDS*HOST_WORD_SIZE)
+ /* 4 chars encode 24 bits in each */
+ /* bit position of each word */
+
+/* The printer bit map (must have an even number of columns). */
+
+#define XBIT ((1+2*XWORDS)/2)
+#define YBIT YSIZE
+
+#if (IBM_PC_LATTICE | IBM_PC_MICROSOFT | IBM_PC_WIZARD)
+#undef SEGMEM
+#define SEGMEM 1 /* ( ((long)XBIT * (long)YBIT) > 65536L ) */
+#endif
+
+#include "bitmap.h"
+
+#undef MAXOPEN /* default too big with large bitmap */
+#define MAXOPEN 3 /* reduce number of open PXL files */
+
+
+#include "main.h"
+#include "abortrun.h"
+#include "actfact.h"
+#include "alldone.h"
+
+/*-->devinit*/
+/**********************************************************************/
+/****************************** devinit *******************************/
+/**********************************************************************/
+
+void
+devinit(argc,argv) /* initialize device */
+int argc;
+char *argv[];
+{
+ (void)getbmap();
+ if (runlengthcode && !quiet)
+ {
+ (void)fprintf(stderr,"[Run-length encoding of output file]");
+ NEWLINE(stderr);
+ }
+}
+
+/*-->devterm*/
+/**********************************************************************/
+/****************************** devterm *******************************/
+/**********************************************************************/
+
+void
+devterm() /* terminate device */
+{
+}
+
+#include "chargf.h"
+#include "charpk.h"
+#include "charpxl.h"
+#include "clrbmap.h"
+#include "clrrow.h"
+#include "dbgopen.h"
+#include "dispchar.h"
+#include "dvifile.h"
+#include "dviinit.h"
+#include "dviterm.h"
+#include "f20open.h"
+#include "fatal.h"
+#include "fillrect.h"
+#include "findpost.h"
+#include "fixpos.h"
+#include "fontfile.h"
+#include "fontsub.h"
+#include "getbmap.h"
+#include "getbytes.h"
+#include "getfntdf.h"
+#include "getpgtab.h"
+#include "inch.h"
+#include "initglob.h"
+#include "loadchar.h"
+#include "movedown.h"
+#include "moveover.h"
+#include "moveto.h"
+#include "nosignex.h"
+#include "openfont.h"
+#include "option.h"
+
+/*-->outline*/
+/**********************************************************************/
+/****************************** outline *******************************/
+/**********************************************************************/
+
+void
+outline(pline)
+char *pline; /* pointer to raster line */
+
+{
+ register INT16 len;
+ register char *a,*b,*c;
+ INT16 k,rem;
+
+ for ((len = V24SIZE, c = pline + V24SIZE - 1);
+ (*c == '\100') && (len > 1);
+ (--len,--c)) /* trim white space to 1 or more */
+ ;
+ len = (len + 3) & ~03; /* but round up to multiple of 4 */
+ pline[len] = '\0'; /* store string terminator */
+
+ /*******************************************************************
+ The Toshiba P-1351 has the requirement in raster graphics mode that
+ no two horizontally adjacent dots can be on. We must therefore scan
+ the character quadruples in the line and turn off matching bits.
+ *******************************************************************/
+ for ((a = pline, k = 4); k < len; k += 4)
+ {
+ *(a+4) = (*(a+4) & ~(*a)) | '\100';
+ ++a;
+ *(a+4) = (*(a+4) & ~(*a)) | '\100';
+ ++a;
+ *(a+4) = (*(a+4) & ~(*a)) | '\100';
+ ++a;
+ *(a+4) = (*(a+4) & ~(*a)) | '\100';
+ ++a;
+ }
+
+ /*******************************************************************
+ We search for runs as follows. "b" marks the beginning of unwritten
+ data, and "a" anchors the beginning of a run which continues to just
+ before "c". The run length is "c"-"a". Since the run length
+ encoding carries a penalty of additional output equal to the length
+ of the run length prefix (<ESC>Hnnn) plus a new graphics prefix
+ (<ESC>;nnnn), short runs are not so encoded.
+
+ If a long enough run is found, then the string "b" .. "a"-1 is
+ output since its length is now known, followed by the run encoding
+ for the character at "a". Then "a" and "b" are advanced to "c", and
+ the scan continues.
+
+ If the run beginning at "a" is too short, then "a" is simply
+ advanced. The scan terminates at the NUL end-of-string marker.
+
+ ?????????????xxxxxxxxxxxxxxxx????????????????????'\0'
+ ^ ^ ^ ^
+ | | | |
+ b a c EOS
+
+ <-----run------>
+
+ The Toshiba P-1351 makes no provision for runs of black space, only
+ horizontal relative moves (in units if 1/180 inch) over white space,
+ so we search only for quadruples (24-bit columns in 6 low-order bits
+ of 4 characters) of the latter, which appear as strings "@@@@".
+ *******************************************************************/
+
+ if (runlengthcode)
+ {
+ if (len <= 12) /* too short to run-length scan */
+ OUTF2("\033;%04d%s",len >> 2,pline); /* quadruple count ESC;nnnn */
+ else
+ {
+ for (a = b = c = pline; *a; )
+ {
+ if (*a == '\100') /* allowable run character */
+ for (c = a; (*a == *++c); )
+ ; /* advance over run */
+ if (((INT16)(c-a)) > 11) /* long enough run */
+ {
+ if (rem = ((INT16)(a - b)) & 03)
+ a += 4 - rem; /* must keep (a-b) = 4n */
+ c -= ((INT16)(c - a)) % 12; /* and (c-a) = 12n */
+ }
+ if (((INT16)(c-a)) > 11) /* output long run */
+ {
+ if (a > b) /* output previous string */
+ {
+ OUTF("\033;%04d",((INT16)(a - b)) >> 2);
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ len = (INT16)(c-a) / 4;
+
+ /* NB: manual says in one place the count is of
+ 1/120 inch, and in another, 1/180 inch. Experiment
+ shows it to be 1/180 inch. */
+
+ OUTC('\033');
+ OUTC('H');
+ OUTC(0100|(len >> 8));
+ OUTC(0100|((len >> 4) & 017));
+ OUTC(0100|(len & 017));
+ a = b = c;
+ }
+ else /* ignore short run */
+ ++a;
+ }
+
+ if (rem = ((INT16)(a - b)) % 4) /* should never be necessary */
+ a += 4 - rem; /* but must keep (a-b) = 4n */
+
+ if (a > b) /* output remaining string */
+ {
+ OUTF("\033;%04d",((INT16)(a - b)) >> 2);
+ for ( ; b < a; b++)
+ OUTC(*b);
+ }
+ }
+ }
+ else /* no runlength coding */
+ {
+ OUTF("\033;%04d",len >> 2); /* quadruple count ESC;nnnn */
+ OUTS(pline);
+ }
+ OUTC('\n'); /* end-of-graphics line */
+}
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+{
+ register char *c; /* pointer into v24[] */
+ UNSIGN32 *p; /* pointer into bitmap[][] */
+ register UNSIGN32 mask; /* mask for single bit selection */
+ register INT16 k; /* innermost loop index */
+ INT16 i,j,ybottom,ytop;
+ char v24[V24SIZE+1]; /* vertical 24-bit raster encodings */
+ /* with space for string terminator */
+
+#if SEGMEM
+ UNSIGN32* q[24]; /* pointers to 24 raster lines */
+#define Q(n) q[n] /* use precomputed pointers */
+#else /* NOT SEGMEM */
+#define Q(n) (p - (n)*XBIT) /* compute pointers on the fly */
+#endif /* SEGMEM */
+
+
+ (void)clearerr(plotfp);
+
+ v24[V24SIZE] = '\0'; /* NUL for EOS marker */
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+
+#if IBM_PC_MICROSOFT
+ for (k = XBIT - 1; ((k >= 0) && (*BITMAP(j,k) == 0)); --k)
+ ; /* trim white space */
+#else
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+#endif
+ }
+ ybottom = MAX(0,24*((j-1)/24)); /* need 24n raster lines */
+
+ OUTS("\033\032I\033G\033L07");
+ /* ESC CTL-Z I to reinitialize printer */
+ /* ESC L 0 7 to select correct interline spacing */
+ /* ESC G for 180 dots/inch spacing and graphics mode */
+
+ for (j = ytop; (j >= ybottom) ; j -= 24) /* loop over raster lines */
+ /* in groups of 24 */
+ {
+#if SEGMEM
+#else
+ p = BITMAP(j,0); /* the j-th raster line */
+#endif
+ c = &v24[0]; /* vertical 24-bit encodings */
+ for (i = 0; i < XBIT; ++i) /* loop over raster words */
+ {
+ /* PCC-20 compiled (1 << (HOST_WORD_SIZE-1) to 0, so do it the
+ hard way, arghh... */
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* to select leftmost bit */
+
+#if SEGMEM
+ for (k = 0; k < 24; ++k) /* compute pointers to 24 rasters */
+ q[k] = BITMAP(j-k,i);
+#endif
+
+ for (k = 0; k < HOST_WORD_SIZE; (++c,++k))/* loop over word bits */
+ {
+ /* examine bits in 24 adjacent rows and build 4 6-bit */
+ /* character values */
+
+ *c = '\100'; /* initial character template */
+ if (*Q(0) & mask)
+ *c |= '\040';
+ if (*Q(1) & mask)
+ *c |= '\020';
+ if (*Q(2) & mask)
+ *c |= '\010';
+ if (*Q(3) & mask)
+ *c |= '\004';
+ if (*Q(4) & mask)
+ *c |= '\002';
+ if (*Q(5) & mask)
+ *c |= '\001';
+
+
+ *(++c) = '\100'; /* initial character template */
+ if (*Q( 6) & mask)
+ *c |= '\040';
+ if (*Q( 7) & mask)
+ *c |= '\020';
+ if (*Q( 8) & mask)
+ *c |= '\010';
+ if (*Q( 9) & mask)
+ *c |= '\004';
+ if (*Q(10) & mask)
+ *c |= '\002';
+ if (*Q(11) & mask)
+ *c |= '\001';
+
+
+ *(++c) = '\100'; /* initial character template */
+ if (*Q(12) & mask)
+ *c |= '\040';
+ if (*Q(13) & mask)
+ *c |= '\020';
+ if (*Q(14) & mask)
+ *c |= '\010';
+ if (*Q(15) & mask)
+ *c |= '\004';
+ if (*Q(16) & mask)
+ *c |= '\002';
+ if (*Q(17) & mask)
+ *c |= '\001';
+
+
+ *(++c) = '\100'; /* initial character template */
+ if (*Q(18) & mask)
+ *c |= '\040';
+ if (*Q(19) & mask)
+ *c |= '\020';
+ if (*Q(20) & mask)
+ *c |= '\010';
+ if (*Q(21) & mask)
+ *c |= '\004';
+ if (*Q(22) & mask)
+ *c |= '\002';
+ if (*Q(23) & mask)
+ *c |= '\001';
+
+ mask >>= 1; /* move masking bit right 1 position */
+ } /* end loop over k */
+#if SEGMEM
+#else
+ ++p; /* point to next word on raster */
+#endif
+ } /* end loop over i */
+ outline(&v24[0]);
+ } /* end loop over j */
+ OUTS("\033\064"); /* ESC 4 to end graphics mode */
+ OUTC('\f'); /* page eject */
+ OUTS("\033\032I\n");/* reset printer to initial state */
+ OUTS( /* reset tab stops -- dumb printer has no defaults */
+ "\033\062\033(09,17,25,33,41,49,57,65,73,81,89,97,A5,B3,C1,C9,D7,E5,F3.");
+
+ (void)fflush(plotfp);
+ if (DISKFULL(plotfp))
+ (void)fatal("prtbmap(): Output error -- disk storage probably full");
+}
+
+#include "outrow.h"
+#include "prtpage.h"
+#include "readfont.h"
+#include "readgf.h"
+#include "readpk.h"
+#include "readpost.h"
+#include "readpxl.h"
+#include "reldfont.h"
+#include "rulepxl.h"
+#include "setchar.h"
+#include "setfntnm.h"
+#include "setrule.h"
+#include "signex.h"
+#include "skgfspec.h"
+#include "skipfont.h"
+#include "skpkspec.h"
+#include "special.h"
+#include "strchr.h"
+#include "strcm2.h"
+#include "strid2.h"
+#include "strrchr.h"
+#include "tctos.h"
+#include "usage.h"
+#include "warning.h"
diff --git a/dviware/beebe/src/errshow.c b/dviware/beebe/src/errshow.c
new file mode 100644
index 0000000000..556ca9b3dd
--- /dev/null
+++ b/dviware/beebe/src/errshow.c
@@ -0,0 +1,105 @@
+/*
+Take an error message log on stdin with lines of the form
+
+file(linenumber) : error message
+
+and display on stdout the error message followed by the offending
+source lines.
+
+Microsoft C uses this format for its messages.
+
+Usage:
+ errshow <error_log_file >merged_source_and_error_file
+
+[28-Aug-86]
+*/
+
+/* This version works with Microsoft C Version 3.0 or later */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAXLINE 255
+#define MAXFNAME 63 /* PC DOS has short names */
+
+#define SUCCESS 0
+#define FAILURE 1
+
+char errmsg[MAXLINE];
+char line[MAXLINE];
+char fname[MAXFNAME] = "";
+FILE *fp = (FILE *)NULL;
+int lno = 0;
+int errlno = 0;
+
+void cleanup();
+void display();
+int getfile();
+
+void
+main()
+{
+ while (fgets(errmsg,MAXLINE,stdin) != (char *)NULL)
+ (void)display();
+ (void)cleanup();
+}
+
+void
+cleanup() /* clean up and exit */
+{
+ if (fp != (FILE *)NULL)
+ (void)fclose(fp);
+ exit(0);
+}
+
+void
+display() /* display source line matching errmsg[] */
+{
+ char *p;
+
+ if ((p = strchr(errmsg,'(')) == (char *)NULL)
+ return; /* not an error message line */
+ *p++ = '\0'; /* clobber '('; p points now to line number */
+ if ((errlno = atoi(p)) <= 0) /* error line number in source file */
+ return; /* not an error message line */
+ if (getfile() != SUCCESS)
+ return;
+ if (lno > errlno) /* cannot happen */
+ {
+ (void)printf("\n?Line number backed up: %s(%s\n",errmsg,p);
+ rewind(fp);
+ lno = 0;
+ }
+ while (lno < errlno)
+ {
+ if (fgets(line,MAXLINE,fp) == (char *)NULL)
+ {
+ (void)printf(
+ "\n?Unexpected EOF before finding line: %s(%s\n",
+ errmsg,p);
+ return;
+ }
+ lno++;
+ }
+ (void)printf("\n%s(%s%7d:%s",errmsg,p,lno,line);
+}
+
+int
+getfile() /* return SUCCESS on success, FAILURE on error */
+{
+ if (strcmp(fname,errmsg) != 0)
+ {
+ if (fp != (FILE *)NULL)
+ (void)fclose(fp);
+ (void)strncpy(fname,errmsg,MAXFNAME);
+ fname[MAXFNAME-1] = '\0';
+ if ((fp = fopen(fname,"r")) == (FILE *)NULL)
+ {
+ (void)printf("\n?Cannot open file [%s]\n",fname);
+ return(FAILURE);
+ }
+ lno = 0;
+ }
+ return(SUCCESS);
+}
diff --git a/dviware/beebe/src/f20open.h b/dviware/beebe/src/f20open.h
new file mode 100644
index 0000000000..660bb5fa22
--- /dev/null
+++ b/dviware/beebe/src/f20open.h
@@ -0,0 +1,77 @@
+/* -*-C-*- f20open.h */
+/*-->f20open*/
+/**********************************************************************/
+/****************************** f20open *******************************/
+/**********************************************************************/
+
+#if OS_TOPS20
+FILE*
+f20open(filename,mode)
+char *filename;
+char *mode;
+
+/***********************************************************************
+Input files are opened in bytesize 8, since this is what is expected for
+dvi files. Output files are opened in bytesize BYTE_SIZE, which will be
+7 or 8, depending on the output device.
+***********************************************************************/
+{
+ int fp;
+
+ if (g_dolog && (g_logfp != (FILE *)NULL))
+ {
+ (void)fprintf(g_logfp,"%%Opening %d-bit file %s for mode %s",
+ ((mode[0] == 'r') ? 8 : BYTE_SIZE),filename,mode);
+ NEWLINE(g_logfp);
+ }
+
+ /* Copy file in bytesize BYTE_SIZE with binary flag set to prevent
+ CRLF <--> LF mapping; the "rb" or "wb" flag is not sufficient for
+ this because PCC-20 maintains two places internally
+ where the binary flag is set, and both are used! */
+
+ if (mode[0] == 'r')
+
+#if KCC_20
+ return(fopen(filename,RB_OPEN));
+#endif /* KCC_20 */
+
+#if PCC_20
+ if ((fp = open(filename,FATT_RDONLY | FATT_SETSIZE | FATT_BINARY,
+ 8)) >= 0)
+ return(fdopen(fp,RB_OPEN));
+ else
+ return((FILE*)NULL);
+#endif /* PCC_20 */
+
+ else if (mode[0] == 'w')
+
+#if KCC_20
+#if BYTE_SIZE == 7
+ return (fopen(filename,"wb7"));
+#else
+#if BYTE_SIZE == 8
+ return (fopen(filename,"wb8"));
+#else
+ fatal("Illegal bytesize set for KCC-20 implementation");
+#endif
+#endif
+#endif /* KCC_20 */
+
+#if PCC_20
+ if ((fp = open(filename, FATT_WRONLY | FATT_SETSIZE | FATT_BINARY,
+ BYTE_SIZE)) >= 0)
+ return(fdopen(fp,WB_OPEN));
+ else
+ return((FILE*)NULL);
+#endif /* PCC_20 */
+
+ else
+ {
+ (void)sprintf(message,
+ "f20open does not understand open mode %s for file %s",
+ mode,filename);
+ fatal(message);
+ }
+}
+#endif /* OS_TOPS20 */
diff --git a/dviware/beebe/src/fatal.h b/dviware/beebe/src/fatal.h
new file mode 100644
index 0000000000..2c31a80e41
--- /dev/null
+++ b/dviware/beebe/src/fatal.h
@@ -0,0 +1,81 @@
+/* -*-C-*- fatal.h */
+/*-->fatal*/
+/**********************************************************************/
+/******************************* fatal ********************************/
+/**********************************************************************/
+
+void
+fatal(msg) /* issue a fatal error message */
+char *msg; /* message string */
+{
+ if (g_dolog && (g_logfp == (FILE *)NULL) && g_logname[0])
+ {
+ g_logfp = fopen(g_logname,"w+");
+ DEBUG_OPEN(g_logfp,g_logname,"w+");
+ if (g_logfp == (FILE *)NULL)
+ {
+ (void)fprintf(stderr,"Cannot open log file [%s]",g_logname);
+ NEWLINE(stderr);
+ }
+ else
+ {
+ (void)fprintf(stderr,"[Log file [%s] created]",g_logname);
+ NEWLINE(stderr);
+
+#if OS_TOPS20
+#if PCC_20
+ /* Because of the PCC-20 arithmetic (instead of */
+ /* logical) shift bug wherein a constant expression */
+ /* (1<<35) evaluates to 0 instead of 400000,,000000, */
+ /* we must set CF_nud using a variable, instead of */
+ /* just using a constant "ac1 = makefield(CF_nud,1);" */
+ ac1 = 1;
+ ac1 = makefield(CF_nud,ac1);
+ setfield(ac1,CF_jfn,jfnof(fileno(g_logfp))); /* jfn */
+ setfield(ac1,CF_dsp,FBbyv); /* generation number index in fdb */
+ ac2 = makefield(FB_ret,-1);
+ ac3 = makefield(FB_ret,0);/* set generation count to 0 (infinite) */
+ (void)jsys(JSchfdb,acs); /* ignore any errors */
+#endif /* PCC_20 */
+#endif
+
+ }
+ }
+ if (g_dolog && (g_logfp != (FILE *)NULL) && g_logname[0])
+ {
+ NEWLINE(g_logfp);
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ (void)putc('?',g_logfp); /* query at start of line */
+#endif
+
+ (void)fputs(g_progname,g_logfp);
+ (void)fputs(": FATAL--",g_logfp);
+ (void)fputs(msg,g_logfp);
+ NEWLINE(g_logfp);
+ (void)fprintf(g_logfp,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(g_logfp);
+ }
+
+#if BBNBITGRAPH
+ rsetterm();
+#endif
+
+ NEWLINE(stderr);
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ (void)putc('?',stderr); /* query at start of line */
+#endif
+
+ (void)fputs(g_progname,stderr);
+ (void)fputs(": FATAL--",stderr);
+ (void)fputs(msg,stderr);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(stderr);
+ NEWLINE(stderr);
+
+ g_errenc = 1; /* set global fatal exit code */
+ alldone();
+}
+
diff --git a/dviware/beebe/src/fillrect.h b/dviware/beebe/src/fillrect.h
new file mode 100644
index 0000000000..89a768bf69
--- /dev/null
+++ b/dviware/beebe/src/fillrect.h
@@ -0,0 +1,52 @@
+/* -*-C-*- fillrect.h */
+/*-->fillrect*/
+/**********************************************************************/
+/****************************** fillrect ******************************/
+/**********************************************************************/
+
+void
+fillrect(x,y,width,height)
+COORDINATE x,y,width,height; /* lower left corner, size */
+
+/***********************************************************************
+With the page origin (0,0) at the lower-left corner of the bitmap, draw
+a filled rectangle at (x,y).
+***********************************************************************/
+
+{
+ register UNSIGN32 *p;
+ register COORDINATE i,j,xloffset,xroffset,xlpart,xrpart;
+
+ if ( ((x+width) <= 0) || (XSIZE <= x) || ((y+height) <= 0) ||
+ (YSIZE <= y) )
+ return; /* Trivial reject -- rectangle outside page */
+ else
+ {
+ xlpart = x/HOST_WORD_SIZE;
+ xrpart = (x + width)/HOST_WORD_SIZE;
+ xloffset = x % HOST_WORD_SIZE;
+ xroffset = (x + width) % HOST_WORD_SIZE;
+ for (j = 0; j < height; ++j) /* loop over raster lines */
+ {
+ if (IN(0,y+j,YBIT-1))
+ {
+ p = BITMAP(y+j,xlpart);
+ if (IN(0,xlpart,XBIT-1))
+ if (xlpart < xrpart) /* set bits in left partial word */
+ *p |= rightones[xloffset];
+ else /* set bits in middle of left partial word */
+ *p |= (rightones[xloffset] & ~rightones[xroffset]);
+
+ ++p;
+ for (i = xlpart+1; i < xrpart; (++p,++i))
+ if (IN(0,i,XBIT-1))
+ *p = (UNSIGN32)ONES; /* set complete words */
+
+ /* finally, set bits in right partial word */
+ if ((xlpart < xrpart) && IN(0,xrpart,XBIT-1))
+ *BITMAP(y+j,xrpart) |= ~rightones[xroffset];
+ }
+ }
+ }
+}
+
diff --git a/dviware/beebe/src/findpost.h b/dviware/beebe/src/findpost.h
new file mode 100644
index 0000000000..253e2b196e
--- /dev/null
+++ b/dviware/beebe/src/findpost.h
@@ -0,0 +1,31 @@
+/* -*-C-*- findpost.h */
+/*-->findpost*/
+/**********************************************************************/
+/****************************** findpost ******************************/
+/**********************************************************************/
+
+void
+findpost()
+
+{
+ register long postambleptr;
+ register BYTE i;
+
+ (void) FSEEK (dvifp, 0L, 2); /* goto end of file */
+ postambleptr = FTELL(dvifp) - 4;
+ (void) FSEEK (dvifp, postambleptr, 0);
+
+ while (TRUE)
+ {
+ (void) FSEEK (dvifp, --(postambleptr), 0);
+ if (((i = (BYTE)nosignex(dvifp,(BYTE)1)) != 223) &&
+ (i != DVIFORMAT))
+ (void)fatal("findpost(): Bad end of DVI file");
+ if (i == DVIFORMAT)
+ break;
+ }
+ (void) FSEEK (dvifp, postambleptr - 4, 0);
+ (void) FSEEK (dvifp, (long)nosignex(dvifp,(BYTE)4), 0);
+}
+
+
diff --git a/dviware/beebe/src/fixpos.h b/dviware/beebe/src/fixpos.h
new file mode 100644
index 0000000000..a4bbb80678
--- /dev/null
+++ b/dviware/beebe/src/fixpos.h
@@ -0,0 +1,36 @@
+/* -*-C-*- fixpos.h */
+/*-->fixpos*/
+/**********************************************************************/
+/******************************* fixpos *******************************/
+/**********************************************************************/
+COORDINATE
+fixpos(cc,c,cnvfac)
+register COORDINATE cc; /* coordinates in device pixels */
+register INT32 c; /* coordinates in DVI units */
+register float cnvfac; /* converts DVI units to pixels */
+{
+ register COORDINATE ccc;
+
+ /*
+ A sequence of consecutive rules, or consecutive characters in a
+ fixed-width font whose width is not an integer number of pixels, can
+ cause |cc| to drift far away from a correctly rounded value. We
+ follow DVITYPE Version 2.6 to ensure that the amount of drift will
+ never exceed MAXDRIFT pixels. DVITYPE Version 2.0 did not do this,
+ and the results could be visibly AWFUL!!
+ */
+
+ ccc = PIXROUND(c,cnvfac);
+ if (ABS(ccc-cc) > MAXDRIFT)
+ { /* drag cc toward the correctly rounded value ccc */
+ if (ccc > cc)
+ {
+ cc = ccc - MAXDRIFT;
+ }
+ else
+ {
+ cc = ccc + MAXDRIFT;
+ }
+ }
+ return (cc);
+}
diff --git a/dviware/beebe/src/fontfile.h b/dviware/beebe/src/fontfile.h
new file mode 100644
index 0000000000..4378e12f8a
--- /dev/null
+++ b/dviware/beebe/src/fontfile.h
@@ -0,0 +1,242 @@
+/* -*-C-*- fontfile.h */
+/*-->fontfile*/
+/**********************************************************************/
+/****************************** fontfile ******************************/
+/**********************************************************************/
+
+void
+fontfile(filelist,font_path,font_name,magnification)
+char *filelist[MAXFORMATS]; /* output filename list */
+char *font_path; /* host font file pathname */
+char *font_name; /* TeX font_name */
+int magnification; /* magnification value */
+{
+
+ /*
+ Given a TeX font_name and a magnification value, construct a list of
+ system-dependent host filenames, returning them in the first
+ argument. The files are not guaranteed to exist. The font names by
+ default contains names for the PK, GF, and PXL font files, but the
+ selection, and search order, may be changed at run time by defining
+ a value for the environment variable FONTLIST. See initglob() for
+ details.
+ */
+
+ register int m; /* index into filelist[] */
+ register INT16 k; /* loop index */
+ float fltdpi; /* dots/inch */
+ int dpi; /* dots/inch for filename */
+
+#if OS_VAXVMS
+ char *tcp; /* temporary character pointer */
+ char *tcp2; /* temporary character pointer */
+ char temp_name[MAXFNAME]; /* temporary filename */
+#endif
+
+ /*
+ We need to convert an old-style ROUNDED integer magnification based
+ on 1000 units = 200 dpi to an actual rounded dpi value.
+
+ We have
+ magnification = round(real_mag) = trunc(real_mag + 0.5)
+ which implies
+ float(magnification) - 0.5 <= real_mag < float(magnification) + 0.5
+
+ We want
+ dpi = round(real_mag/5.0)
+ which implies
+ float(dpi) - 0.5 <= real_mag/5.0 < float(dpi) + 0.5
+ or
+ 5.0*float(dpi) - 2.5 <= real_mag < 5.0*float(dpi) + 2.5
+
+ We can combine the two to conclude that
+ 5.0*float(dpi) - 2.5 < float(magnification) + 0.5
+ or
+ 5.0*float(dpi) - 3 < float(magnification)
+ which gives the STRICT inequality
+ float(dpi) < (float(magnification) + 3.0)/5.0
+ */
+
+ fltdpi = (((float)magnification) + 3.0)/5.0;
+ dpi = (int)fltdpi;
+ if (fltdpi == (float)dpi)
+ dpi--; /* enforce inequality */
+
+ for (k = 0; k < MAXFORMATS; ++k) /* loop over possible file types */
+ *filelist[k] = '\0'; /* Initially, all filenames are empty */
+
+ m = 0; /* index in filelist[] */
+ for (k = 0; k < MAXFORMATS; ++k) /* loop over possible file types */
+ {
+
+#if OS_TOPS20
+
+ /* Typical results:
+ texfonts:amr10.300gf
+ texfonts:amr10.300pk
+ texfonts:amr10.1500pxl
+ */
+
+ if (k == gf_index)
+ (void)sprintf(filelist[m++], "%s%s.%dgf",
+ font_path, font_name, dpi);
+ else if (k == pk_index)
+ (void)sprintf(filelist[m++], "%s%s.%dpk",
+ font_path, font_name, dpi);
+ else if (k == pxl_index)
+ (void)sprintf(filelist[m++], "%s%s.%dpxl",
+ font_path, font_name, magnification);
+
+#endif /* OS_TOPS20 */
+
+#if (OS_ATARI | OS_PCDOS)
+
+ /* Typical results:
+ d:\tex\fonts\300\amr10.gf
+ d:\tex\fonts\300\amr10.pk
+ d:\tex\fonts\1500\amr10.pxl
+ */
+
+ if (k == gf_index)
+ (void)sprintf(filelist[m++], "%s%d\\%s.gf",
+ font_path, dpi, font_name);
+ else if (k == pk_index)
+ (void)sprintf(filelist[m++], "%s%d\\%s.pk",
+ font_path, dpi, font_name);
+ else if (k == pxl_index)
+ (void)sprintf(filelist[m++], "%s%d\\%s.pxl",
+ font_path, magnification, font_name);
+
+#endif /* OS_PCDOS */
+
+#if OS_UNIX
+
+ /* Typical results (both naming styles are tried):
+ /usr/lib/tex/fonts/300/amr10.gf
+ /usr/lib/tex/fonts/amr10.300gf
+ /usr/lib/tex/fonts/300/amr10.pk
+ /usr/lib/tex/fonts/1500/amr10.pxl
+ /usr/lib/tex/fonts/amr10.1500pxl
+ /usr/lib/tex/fonts/amr10.300pk
+ */
+
+ if (k == gf_index)
+ {
+ (void)sprintf(filelist[m++], "%s%d/%s.gf",
+ font_path, dpi, font_name);
+ (void)sprintf(filelist[m++], "%s%s.%dgf",
+ font_path, font_name, dpi);
+ }
+ else if (k == pk_index)
+ {
+ (void)sprintf(filelist[m++], "%s%d/%s.pk",
+ font_path, dpi, font_name);
+ (void)sprintf(filelist[m++], "%s%s.%dpk",
+ font_path, font_name, dpi);
+ }
+ else if (k == pxl_index)
+ {
+ (void)sprintf(filelist[m++], "%s%d/%s.pxl",
+ font_path, magnification, font_name);
+ (void)sprintf(filelist[m++], "%s%s.%dpxl",
+ font_path, font_name, magnification);
+ }
+ /*(void)fprintf(stderr,"In fontfile: Path = %s\n",filelist[m - 1]);*/
+
+#endif /* OS_UNIX */
+
+
+#if OS_VAXVMS
+
+ /* Typical results (both naming styles are tried):
+ [tex.fonts.300]amr10.gf
+ [tex.fonts]amr10.300gf
+ [tex.fonts.300]amr10.pk
+ [tex.fonts]amr10.300pk
+ [tex.fonts.1500]amr10.pxl
+ [tex.fonts]amr10.1500pxl
+
+
+ We try a translation of a logical name here if what we have in
+ fontpath[] is not a directory specification like
+ "device:[tex.fonts]" or a rooted logical name like "tex_fonts:"
+ translating to something like "device:[tex.fonts.]"
+ */
+
+
+ /* Use a straightforward expansion first, in case fontpath is
+ a search list. */
+ if (k == gf_index)
+ {
+ (void)sprintf(filelist[m++], "%s[%d]%s.gf", fontpath,
+ dpi, font_name);
+ (void)sprintf(filelist[m++], "%s%s.%dgf", fontpath,
+ font_name, dpi);
+ }
+ else if (k == pk_index)
+ {
+ (void)sprintf(filelist[m++], "%s[%d]%s.pk", fontpath,
+ dpi, font_name);
+ (void)sprintf(filelist[m++], "%s%s.%dpk", fontpath,
+ font_name, dpi);
+ }
+ else if (k == pxl_index)
+ {
+ (void)sprintf(filelist[m++], "%s[%d]%s.pxl", fontpath,
+ magnification, font_name);
+ (void)sprintf(filelist[m++], "%s%s.%dpxl", fontpath,
+ font_name, magnification);
+ }
+
+ (void)strcpy(temp_name,fontpath);
+ tcp = strrchr(temp_name,']'); /* search for last right bracket */
+ if (tcp == (char *)NULL) /* then try logical name translation */
+ {
+ tcp = GETENV(fontpath);
+ if (tcp != (char *)NULL)
+ {
+ tcp2 = strrchr(tcp,']');
+ if (tcp2 == (char *)NULL)
+ tcp = (char *)NULL; /* translates to another logical name */
+ else
+ {
+ if (*(tcp2-1) == '.')
+ tcp = (char *)NULL; /* looks like rooted logical name */
+ else /* looks like directory name */
+ {
+ (void)strcpy(temp_name,tcp);
+ tcp = strrchr(temp_name,']');
+ }
+ }
+ }
+ }
+ if (tcp != (char *)NULL)
+ { /* fontpath is something like [tex.fonts] */
+ *tcp = '\0'; /* clobber right bracket */
+ if (k == gf_index)
+ {
+ (void)sprintf(filelist[m++], "%s.%d]%s.gf", temp_name,
+ dpi, font_name);
+ (void)sprintf(filelist[m++], "%s]%s.%dgf", temp_name,
+ font_name, dpi);
+ }
+ else if (k == pk_index)
+ {
+ (void)sprintf(filelist[m++], "%s.%d]%s.pk", temp_name,
+ dpi, font_name);
+ (void)sprintf(filelist[m++], "%s]%s.%dpk", temp_name,
+ font_name, dpi);
+ }
+ else if (k == pxl_index)
+ {
+ (void)sprintf(filelist[m++], "%s.%d]%s.pxl", temp_name,
+ magnification, font_name);
+ (void)sprintf(filelist[m++], "%s]%s.%dpxl", temp_name,
+ font_name, magnification);
+ }
+ }
+#endif /* OS_VAXVMS */
+ }
+
+}
+
diff --git a/dviware/beebe/src/fontsub.h b/dviware/beebe/src/fontsub.h
new file mode 100644
index 0000000000..e454bcad21
--- /dev/null
+++ b/dviware/beebe/src/fontsub.h
@@ -0,0 +1,150 @@
+/* -*-C-*- fontsub.c */
+/*-->fontsub*/
+/**********************************************************************/
+/****************************** fontsub *******************************/
+/**********************************************************************/
+BOOLEAN
+fontsub(subfont,submag,TeXfont,TeXmag)
+char *subfont; /* new fontname returned */
+int *submag; /* new magnification returned (0 if entire family) */
+char *TeXfont; /* TeX requested fontname */
+int TeXmag; /* TeX requested magnification value */
+
+/***********************************************************************
+
+Given a TeX fontname and a magnification value, search the font
+substitution file (if any) for the first pattern defining a possible
+replacement, and return their values in subfont[] and submag, with a
+function value of TRUE. If no substitution is possible, subfont[] is
+set to a null string, submag to 0, and the function value to FALSE.
+
+The substitution file is searched for under the names
+
+ (1) subfile (by default, or from command line)
+ (2) subname subext
+ (3) subpath subname subext
+
+allowing the user to have document-file specific substitutions, TeX-wide
+private substitutions, and system TeX-wide substitutions. For example,
+these files might be "sample.sub", "texfonts.sub", and
+"texinputs:texfonts.sub" for a document "sample.tex".
+
+Font substitution lines have the form:
+
+% comment
+oldname.oldmag -> subname.submag % comment
+oldname oldmag -> subname submag % comment
+oldname -> subname % comment
+
+Examples are:
+
+% These provide replacements for some LaTeX invisible fonts:
+iamr10 1500 -> amr10 1500 % comment
+iamr10.1500 -> amr10.1500 % comment
+iamssb8 -> amssb8 % comment
+
+These are easily readable by sscanf(). The first two forms request
+substitution of a particular font and magnification. The third form
+substitutes an entire font family; the closest available magnification
+to the required one will be used. Any dots in the non-comment portion
+will be converted to spaces, and therefore, cannot be part of a name
+field.
+
+The first matching substitution will be selected, so magnification-
+specific substitutions should be given first, before family
+substitutions.
+
+Comments are introduced by percent and continue to end-of-line, just as
+for TeX. One whitespace character is equivalent to any amount of
+whitespace. Whitespace and comments are optional.
+***********************************************************************/
+
+{
+ static FILE* subfp = (FILE *)NULL; /* file pointer for sub file */
+ static BOOLEAN have_file = TRUE; /* memory of open success */
+ char line[MAXSTR]; /* for sub file lines */
+ char *pline; /* pointer to line[] */
+ static char fname[MAXFNAME]; /* sub file name */
+ char oldfont[MAXFNAME]; /* working storage for font names */
+ int oldmag; /* font magnification */
+ int k; /* sscanf() result */
+ int line_number; /* for error messages */
+
+ if (!have_file) /* no file available */
+ {
+ *subfont = '\0';
+ *submag = 0;
+ return (FALSE);
+ }
+ else if (subfp == (FILE *)NULL) /* happens only first time */
+ {
+ (void)strcpy(fname,subfile); /* try document specific: */
+ subfp = fopen(fname,"r"); /* e.g. foo.sub (from foo.dvi) */
+ DEBUG_OPEN(subfp,fname,"r");
+ if (subfp == (FILE *)NULL)
+ {
+ (void)strcpy(fname,subname);/* try path specific: */
+ (void)strcat(fname,subext); /* e.g. texfonts.sub */
+ subfp = fopen(fname,"r");
+ DEBUG_OPEN(subfp,fname,"r");
+ }
+
+ if (subfp == (FILE *)NULL)
+ {
+ (void)strcpy(fname,subpath);/* try system specific: */
+ (void)strcat(fname,subname);/* e.g. texinputs:texfonts.sub */
+ (void)strcat(fname,subext);
+ subfp = fopen(fname,"r");
+ DEBUG_OPEN(subfp,fname,"r");
+ }
+
+ if (subfp == (FILE *)NULL) /* could not open any substitution file */
+ {
+ have_file = FALSE;
+ *subfont = '\0';
+ *submag = 0;
+ return (FALSE);
+ }
+ }
+
+ line_number = 0;
+ (void)REWIND(subfp);
+ while (fgets(line,MAXSTR,subfp) != (char *)NULL)
+ {
+ line_number++; /* count lines */
+
+ pline = &line[0]; /* truncate at comment start or end-of-line */
+ while ((*pline) && (*pline != '%') &&
+ (*pline != '\r') && (*pline != '\n'))
+ {
+ if (*pline == '.') /* convert dots to whitespace for sscanf() */
+ *pline = ' ';
+ ++pline;
+ }
+ *pline = '\0'; /* replace terminator by NUL */
+
+ if ((k = (int)sscanf(line," %s %d -> %s %d",oldfont,&oldmag,
+ subfont,submag)) == 4)
+ {
+ if ((TeXmag == oldmag) && (strcm2(oldfont,TeXfont) == 0))
+ return (TRUE);
+ }
+ else if ((k = (int)sscanf(line," %s -> %s",oldfont,subfont)) == 2)
+ {
+ *submag = 0;
+ if (strcm2(oldfont,TeXfont) == 0)
+ return (TRUE);
+ }
+ else if (k != EOF) /* EOF means no fields, so have empty line */
+ {
+ (void)sprintf(message,
+ "fontsub(): Bad font substitution at line %d in file \
+[%s]: [%s]",
+ line_number,fname,line);
+ (void)warning(message);
+ }
+ }
+ *subfont = '\0';
+ *submag = 0;
+ return (FALSE);
+}
diff --git a/dviware/beebe/src/gblprocs.h b/dviware/beebe/src/gblprocs.h
new file mode 100644
index 0000000000..6064441c49
--- /dev/null
+++ b/dviware/beebe/src/gblprocs.h
@@ -0,0 +1,494 @@
+/* -*-C-*- gblprocs.h */
+/*-->gblprocs*/
+/**********************************************************************/
+/****************************** gblprocs ******************************/
+/**********************************************************************/
+
+/**********************************************************************/
+/************************* Global Procedures ************************/
+/**********************************************************************/
+
+#if ANSI_PROTOTYPES
+void abortrun(int);
+float actfact(UNSIGN32);
+void alldone(void);
+
+#if ANSI_LIBRARY
+double atof(const char *);
+int atoi(const char *);
+#else
+double atof(char *);
+int atoi(char *);
+#endif /* ANSI_LIBRARY */
+
+#if (BBNBITGRAPH | CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+void bopact();
+#endif /* (BBNBITGRAPH | CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+int chargf(BYTE,void(*)());
+int charpk(BYTE,void(*)());
+int charpxl(BYTE,void(*)());
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+#else
+void clrbmap(void);
+#endif /* (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+void clrrow(void);
+
+#if POSTSCRIPT
+void cppsfile(void);
+#endif /* POSTSCRIPT */
+
+#if ANSI_LIBRARY
+char* ctime(const time_t *);
+#else
+char* ctime(long *);
+#endif /* ANSI_LIBRARY */
+
+char* cuserid(char *);
+void dbgopen(FILE*, char*, char*);
+void devinit(int, char *[]);
+void devterm(void);
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+#else
+void dispchar(BYTE);
+#endif /* (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+void dvifile(int, char *[], char *);
+void dviinit(char *);
+void dviterm(void);
+
+#if POSTSCRIPT
+void emitchar(BYTE);
+#endif /* POSTSCRIPT */
+
+#if (BBNBITGRAPH | CANON_A2 | HPJETPLUS | POSTSCRIPT)
+void eopact();
+#endif /* (BBNBITGRAPH | CANON_A2 | HPJETPLUS | POSTSCRIPT) */
+
+void EXIT(int);
+void fatal(char *);
+void fillrect(COORDINATE, COORDINATE, COORDINATE, COORDINATE);
+void findpost(void);
+COORDINATE fixpos(COORDINATE, INT32, float);
+void fontfile(char *[MAXFORMATS],char *,char *,int);
+BOOLEAN fontsub(char *,int *,char *,int);
+
+#if ANSI_LIBRARY
+void free(void *);
+#else
+void free(char *);
+#endif /* ANSI_LIBRARY */
+
+int FSEEK(FILE *,long,int);
+void getbmap(void);
+void getbytes(FILE *, char *, BYTE);
+
+#if ANSI_LIBRARY
+char* GETENV(const char *);
+#else
+char* GETENV(char *);
+#endif /* ANSI_LIBRARY */
+
+void getfntdf(void);
+
+#if OS_VAXVMS
+char* getjpi(int);
+#endif
+
+char* getlogin(void);
+void getpgtab(long);
+void initglob(void);
+float inch(char *);
+
+#if BBNBITGRAPH
+void initterm();
+#endif /* BBNBITGRAPH */
+
+#if (CANON_A2 | HPJETPLUS)
+void loadbmap(BYTE);
+#endif /* (CANON_A2 | HPJETPLUS) */
+
+void loadchar(BYTE);
+
+#if BBNBITGRAPH
+void loadrast(FILE *, COORDINATE, COORDINATE);
+#endif /* BBNBITGRAPH */
+
+int main(int ,char *[]);
+
+#if ANSI_LIBRARY
+void* malloc(size_t);
+#else
+char* malloc(unsigned);
+#endif /* ANSI_LIBRARY */
+
+#if (APPLEIMAGEWRITER | OKIDATA2410)
+char makechar(UNSIGN32 *[],UNSIGN32);
+#endif /* (APPLEIMAGEWRITER | OKIDATA2410) */
+
+#if HPJETPLUS
+void makefont(void);
+#endif
+
+void movedown(INT32);
+void moveover(INT32);
+void moveto(COORDINATE, COORDINATE);
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+void newfont(void);
+#endif
+
+UNSIGN32 nosignex(FILE *,BYTE);
+void openfont(char *);
+void option(char *);
+
+#if HPLASERJET
+void outline(UNSIGN32 *);
+#else
+void outline(char *);
+#endif /* HPLASERJET */
+
+#if EPSON
+#if HIRES
+void outpaperfeed(INT16);
+#endif /* HIRES */
+#endif /* EPSON */
+
+#if HPJETPLUS
+void outraster(BYTE,UNSIGN16);
+#endif /* HPJETPLUS */
+
+void outrow(BYTE,UNSIGN16);
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+#else
+void prtbmap(void);
+#endif /* (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+void prtpage(long);
+
+#if POSTSCRIPT
+char* putfontname(struct font_entry *);
+void putname(FILE *,struct font_entry *);
+#endif /* POSTSCRIPT */
+
+#if BBNBITGRAPH
+void putout(INT16);
+#endif /* BBNBITGRAPH */
+
+void readfont(INT32);
+int readgf(void);
+int readpk(void);
+void readpost(void);
+int readpxl(void);
+void reldfont(struct font_entry *);
+
+#if BBNBITGRAPH
+void rsetterm();
+#endif /* BBNBITGRAPH */
+
+COORDINATE rulepxl(UNSIGN32,float);
+void setchar(BYTE,BOOLEAN);
+
+#if HPJETPLUS
+void setfont(void);
+#endif
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+void setstr(BYTE);
+#endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+void setfntnm(INT32);
+void setrule(UNSIGN32, UNSIGN32, BOOLEAN);
+INT32 signex(FILE *,BYTE);
+void skipfont(INT32);
+void skgfspec(void);
+void skpkspec(void);
+void special(char *);
+
+#if ANSI_LIBRARY
+char* strcat(char *,const char *);
+char* strchr(const char *,int);
+char* strcpy(char *,const char *);
+size_t strlen(const char *);
+int strncmp(const char *,const char *,size_t);
+char* strncpy(char *,const char *,size_t);
+char* strrchr(const char *,int);
+#else /* NOT ANSI_LIBRARY conformant */
+char* strcat(char *,char *);
+char* strchr(char *,char);
+char* strcpy(char *,char *);
+int strlen(char *);
+int strncmp(char *,char *,int);
+char* strncpy(char *,char *,int);
+char* strrchr(char *,char);
+#endif /* ANSI_LIBRARY */
+
+int strcm2(char *,char *);
+int strid2(char[],char[]);
+
+char* tctos(void);
+
+#if POSTSCRIPT
+void textchr(char);
+void textflush();
+void textnum(long);
+void textstr(char *);
+#endif /* POSTSCRIPT */
+
+#if ANSI_LIBRARY
+time_t time(time_t *);
+#else
+long time(long *);
+#endif /* ANSI_LIBRARY */
+
+#if BBNBITGRAPH
+void unloadfonts();
+#endif
+
+void usage(FILE *);
+
+#if VIRTUAL_FONTS
+void virtfree(FILE *);
+#endif
+
+void warning(char *);
+
+#if FASTZERO
+void zerom(UNSIGN32 *,UNSIGN32);
+#endif /* FASTZERO */
+
+#else /* NOT ANSI_PROTOTYPES */
+double atof();
+int atoi();
+
+#if (BBNBITGRAPH | CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+void bopact();
+#endif /* (BBNBITGRAPH | CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+char* cuserid();
+char* ctime();
+void EXIT();
+void free();
+int FSEEK();
+long FTELL();
+char* GETENV();
+
+#if OS_VAXVMS
+char* getjpi();
+#endif
+
+char* getlogin();
+char* malloc();
+
+#if (IBM_PC_WIZARD | KCC_20 | OS_VAXVMS)
+/* stdio.h declares sprintf(); */
+#else
+char* sprintf(); /* Berkeley 4.1 BSD style */
+#endif /* (IBM_PC_WIZARD | KCC_20 | OS_VAXVMS) */
+
+char* strcpy();
+char* strcat();
+char* strchr(); /* private version of this 4.2BSD function */
+int strcm2(); /* local addition (used by inch()) */
+int strcmp();
+int strid2(); /* local addition (used by initglob()) */
+int strncmp();
+char* strncpy();
+char* strrchr(); /* private version of this 4.2BSD function */
+long time();
+
+/***********************************************************************
+Note: Global procedures are declared here in alphabetical order, with
+those which do not return values typed "void". Their bodies occur in
+alphabetical order following the main() procedure, usually in the form
+of "#include" statements. The names are kept unique in the first 6
+characters for portability.
+***********************************************************************/
+
+void abortrun();
+float actfact();
+void alldone();
+FILE* FOPEN();
+
+int chargf();
+int charpk();
+int charpxl();
+void clrrow();
+
+#if POSTSCRIPT
+void cppsfile();
+#endif /* POSTSCRIPT */
+
+void dbgopen();
+void devinit();
+void devterm();
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+#else /* NOT (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+void clrbmap();
+void dispchar();
+#endif /* (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+void dvifile();
+void dviinit();
+void dviterm();
+
+#if POSTSCRIPT
+void emitchar();
+#endif /* POSTSCRIPT */
+
+#if (BBNBITGRAPH | CANON_A2 | HPJETPLUS | POSTSCRIPT)
+void eopact();
+#endif /* (BBNBITGRAPH | CANON_A2 | HPJETPLUS | POSTSCRIPT) */
+
+void fatal();
+void fillrect();
+void findpost();
+void fontfile();
+BOOLEAN fontsub();
+COORDINATE fixpos();
+void getbmap();
+void getbytes();
+void getfntdf();
+void getpgtab();
+
+#if BBNBITGRAPH
+void gotint();
+#endif /* BBNBITGRAPH */
+
+float inch();
+void initglob();
+
+#if BBNBITGRAPH
+void initterm();
+#endif /* BBNBITGRAPH */
+
+#if (CANON_A2 | HPJETPLUS)
+void loadbmap();
+#endif /* (CANON_A2 | HPJETPLUS) */
+
+void loadchar();
+
+#if BBNBITGRAPH
+void loadrast();
+#endif /* BBNBITGRAPH */
+
+int main();
+
+#if APPLEIMAGEWRITER
+char makechar();
+#endif /* APPLEIMAGEWRITER */
+
+#if OKIDATA2410
+char makechar();
+#endif /* OKIDATA2410 */
+
+#if HPJETPLUS
+void makefont();
+#endif
+
+void movedown();
+void moveover();
+void moveto();
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+void newfont();
+#endif
+
+UNSIGN32 nosignex();
+
+#if BBNBITGRAPH
+#else /* NOT BBNBITGRAPH */
+void outline();
+#endif /* BBNBITGRAPH */
+
+#if EPSON
+#if HIRES
+void outpaperfeed();
+#endif /* HIRES */
+#endif /* EPSON */
+
+#if HPJETPLUS
+void outraster();
+#endif /* HPJETPLUS */
+
+void outrow();
+void openfont();
+void option();
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+#else /* NOT (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+void prtbmap();
+#endif /* (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+void prtpage();
+
+#if POSTSCRIPT
+char* putfontname();
+void putname();
+#endif /* POSTSCRIPT */
+
+#if BBNBITGRAPH
+void putout();
+#endif /* BBNBITGRAPH */
+
+void readfont();
+int readgf();
+int readpk();
+void readpost();
+int readpxl();
+void reldfont();
+
+#if BBNBITGRAPH
+void rsetterm();
+#endif /* BBNBITGRAPH */
+
+COORDINATE rulepxl();
+void setchar();
+void setfntnm();
+
+#if HPJETPLUS
+void setfont();
+#endif
+
+void setrule();
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+void setstr();
+#endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+INT32 signex();
+void skipfont();
+void skgfspec();
+void skpkspec();
+void special();
+char* tctos();
+
+#if POSTSCRIPT
+void textchr();
+void textflush();
+void textnum();
+void textstr();
+#endif /* POSTSCRIPT */
+
+#if BBNBITGRAPH
+void unloadfonts();
+#endif
+
+void usage();
+
+#if VIRTUAL_FONTS
+void virtfree();
+#endif
+
+void warning();
+
+#if FASTZERO
+void zerom();
+#endif /* FASTZERO */
+
+#endif /* ANSI_PROTOTYPES */
diff --git a/dviware/beebe/src/gblvars.h b/dviware/beebe/src/gblvars.h
new file mode 100644
index 0000000000..91bc25027e
--- /dev/null
+++ b/dviware/beebe/src/gblvars.h
@@ -0,0 +1,324 @@
+/* -*-C-*- gblvars.h */
+/*-->gblvars*/
+/**********************************************************************/
+/****************************** gblvars *******************************/
+/**********************************************************************/
+
+/**********************************************************************/
+/********************* General Global Variables *********************/
+/**********************************************************************/
+
+char curpath[MAXFNAME]; /* current file area */
+char curext[MAXFNAME]; /* current file extension */
+char curname[MAXFNAME]; /* current file name */
+
+UNSIGN16 debug_code; /* 0 for no debug output */
+
+char dviname[MAXFNAME]; /* DVI filespec */
+char dvoname[MAXFNAME]; /* device output filespec */
+
+char fontlist[MAXSTR]; /* FONTLIST environment string */
+char fontpath[MAXFNAME]; /* font directory path */
+
+char helpcmd[MAXSTR]; /* where to look for help */
+
+char message[MAXMSG]; /* for formatting error messages */
+
+/***********************************************************************
+Magnification table for 144dpi, 200dpi, and 300dpi devices, computed
+to 20 figures and sorted by magnitude.
+
+ Column 1 Column 2 Column 3
+0.72*sqrt(1.2)**i sqrt(1.2)**I 1.5*sqrt(1.2)**I (I = -16,16)
+
+***********************************************************************/
+
+static float mag_table[] =
+ {
+ 0.16744898601451165028, 0.18343117374303022733, 0.20093878321741398034,
+ 0.22011740849163627280, 0.23256803936137783874, 0.24112653986089677641,
+ 0.25476552262595201888, 0.26414089018996352736, 0.27908164723365340649,
+ 0.28935184783307613169, 0.30571862715114242265, 0.31696906822795623283,
+ 0.33489797668038408779, 0.34722221739969135802, 0.34885205904206675812,
+ 0.36686235258137090718, 0.38036288187354747940, 0.38214828393892802832,
+ 0.40187757201646090535, 0.41666666087962962963, 0.41862247085048010974,
+ 0.44023482309764508862, 0.45643545824825697527, 0.45857794072671363398,
+ 0.48225308641975308642, 0.49999999305555555556, 0.50234696502057613169,
+ 0.52828178771717410634, 0.54772254989790837033, 0.55029352887205636077,
+ 0.57870370370370370370, 0.59999999166666666667, 0.60281635802469135802,
+ 0.63393814526060892761, 0.65726705987749004440, 0.66035223464646763293,
+ 0.69444444444444444444, 0.71999999000000000000, 0.72337962962962962963,
+ 0.76072577431273071313, 0.78872047185298805327, 0.79242268157576115952,
+ 0.83333333333333333333, 0.86399998800000000000, 0.86805555555555555556,
+ 0.91287092917527685576, 0.94646456622358566393, 0.95090721789091339142,
+ 1.00000000000000000000, 1.03679998560000000000, 1.04166666666666666670,
+ 1.09544511501033222690, 1.13575747946830279670, 1.14108866146909606970,
+ 1.20000000000000000000, 1.24415998272000000000, 1.25000000000000000000,
+ 1.31453413801239867230, 1.36290897536196335610, 1.36930639376291528360,
+ 1.44000000000000000000, 1.49299197926400000000, 1.50000000000000000000,
+ 1.57744096561487840680, 1.63549077043435602730, 1.64316767251549834040,
+ 1.72800000000000000000, 1.79159037511680000000, 1.80000000000000000000,
+ 1.89292915873785408810, 1.96258892452122723270, 1.97180120701859800840,
+ 2.07360000000000000000, 2.14990845014016000000, 2.16000000000000000000,
+ 2.27151499048542490570, 2.35510670942547267930, 2.36616144842231761010,
+ 2.48832000000000000000, 2.57989014016819200000, 2.59200000000000000000,
+ 2.72581798858250988690, 2.82612805131056721510, 2.83939373810678113220,
+ 2.98598400000000000000, 3.09586816820183040000, 3.11040000000000000000,
+ 3.27098158629901186430, 3.40727248572813735860, 3.58318080000000000000,
+ 3.73248000000000000000, 3.92517790355881423710, 4.08872698287376483030,
+ 4.29981696000000000000, 4.47897600000000000000, 4.90647237944851779640,
+ 5.37477120000000000000, 5.88776685533822135560, 6.44972544000000000000
+ };
+
+INT16 mag_index; /* set by actfact */
+
+#define MAGTABSIZE (sizeof(mag_table) / sizeof(float))
+
+int g_errenc = 0; /* has an error been encountered? */
+char g_logname[MAXSTR]; /* name of log file, if created */
+BOOLEAN g_dolog = TRUE; /* allow log file creation */
+FILE *g_logfp = (FILE*)NULL; /* log file pointer (for errors) */
+char g_progname[MAXSTR]; /* program name */
+
+FILE *plotfp = (FILE*)NULL; /* plot file pointer */
+
+struct char_entry
+{ /* character entry */
+ COORDINATE wp, hp; /* width and height in pixels */
+ COORDINATE xoffp, yoffp; /* x offset and y offset in pixels */
+ long fontrp; /* font file raster pointer */
+ UNSIGN32 tfmw; /* TFM width */
+ INT32 dx, dy; /* character escapements */
+ UNSIGN16 pxlw; /* pixel width == round(TFM width in */
+ /* pixels for .PXL files, or */
+ /* float(char_dx)/65536.0 for .GF and .PK */
+ /* files) */
+ INT16 refcount; /* reference count for memory management */
+ UNSIGN32 *rasters; /* raster description (dynamically loaded) */
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+ BOOLEAN isloaded; /* is the character already downloaded? */
+#endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+#if HPJETPLUS
+ BOOLEAN istoobig; /* Too big (or too odd) to be loaded */
+#endif
+
+#if CANON_A2
+ BOOLEAN isknown; /* Character is known */
+ BOOLEAN istoobig; /* Too big to be loaded */
+#endif
+
+#if BBNBITGRAPH
+ BOOLEAN istoobig; /* is the character too big for BitGraph? */
+ BOOLEAN isloaded; /* is the character loaded in the BitGraph?*/
+ INT16 bgfont, bgchar; /* BitGraph font and character */
+#endif /* BBNBITGRAPH */
+
+};
+
+struct font_entry
+{
+ struct font_entry *next; /* pointer to next font entry */
+ void (*charxx)(); /* pointer to chargf(), charpk(), charpxl()*/
+ FILE *font_file_id; /* file identifier (NULL if none) */
+ INT32 k; /* font number */
+ UNSIGN32 c; /* checksum */
+ UNSIGN32 d; /* design size */
+ UNSIGN32 s; /* scale factor */
+ INT32 font_space; /* computed from FNT_DEF s parameter */
+ UNSIGN32 font_mag; /* computed from FNT_DEF s and d parameters*/
+ UNSIGN32 magnification; /* magnification read from PXL file */
+ UNSIGN32 designsize; /* design size read from PXL file */
+ UNSIGN32 hppp; /* horizontal pixels/point * 2**16 */
+ UNSIGN32 vppp; /* vertical pixels/point * 2**16 */
+ INT32 min_m; /* GF bounding box values */
+ INT32 max_m;
+ INT32 min_n;
+ INT32 max_n;
+
+#if (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+ UNSIGN16 font_number; /* font number (0..32767) */
+#endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+#if CANON_A2
+ COORDINATE cell_w;
+ COORDINATE cell_h;
+ COORDINATE cell_d;
+ UNSIGN16 nloaded;
+ UNSIGN32 storage;
+#endif /* CANON_A2 */
+
+ BYTE font_type; /* GF, PK, or PXL font file */
+ BYTE a; /* length of font area in n[] */
+ BYTE l; /* length of font name in n[] */
+ char n[MAXSTR]; /* font area and name */
+ char name[MAXSTR]; /* full name of PXL file */
+ struct char_entry ch[NPXLCHARS];/* character information */
+};
+
+struct font_list
+{
+ FILE *font_id; /* file identifier */
+ INT16 use_count; /* count of "opens" */
+};
+
+INT32 cache_size; /* record of how much character raster */
+ /* is actually used */
+float conv; /* converts DVI units to pixels */
+UNSIGN16 copies; /* number of copies to print of each page */
+INT16 cur_page_number; /* sequential output page number in 1..N */
+INT16 cur_index; /* current index in page_ptr[] */
+
+COORDINATE xcp,ycp; /* current position */
+UNSIGN32 den; /* denominator specified in preamble */
+FILE *dvifp = (FILE*)NULL; /* DVI file pointer */
+struct font_entry *fontptr; /* font_entry pointer */
+struct font_entry *hfontptr = (struct font_entry *)NULL;
+ /* head font_entry pointer */
+
+#if (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+UNSIGN16 font_count; /* used to assign unique font numbers */
+struct font_entry *font_table[MAXFONTS];
+#endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+BOOLEAN font_switched; /* current font has changed */
+#endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+INT16 gf_index, pk_index, pxl_index;
+ /* indexes into filelist[] in fontfile(); */
+ /* they define the search order, and are */
+ /* in initglob(). */
+UNSIGN32 gpower[33]; /* gpower[k] = 2**k-1 (k = 0..32) */
+INT32 h; /* current horizontal position */
+COORDINATE hh; /* current horizontal position in pixels */
+
+#if HPLASERJET
+INT16 hpres; /* output resolution (75, 100, 150, 300 dpi) */
+#endif /* HPLASERJET */
+
+UNSIGN32 img_mask[32]; /* initialized at run-time so that bit k */
+ /* (counting from high end) is one */
+UNSIGN32 img_row[(MAX_M - MIN_M + 1 + 31) >> 5];
+ /* current character image row of bits */
+INT16 max_m, min_m, max_n, min_n;
+ /* current character matrix extents */
+UNSIGN16 img_words; /* number of words in use in img_row[] */
+float leftmargin; /* left margin in inches */
+COORDINATE lmargin; /* left margin offset in pixels */
+INT16 nopen; /* number of open PXL files */
+INT16 page_count; /* number of entries in page_ptr[] */
+
+#if HPJETPLUS
+INT16 page_fonts; /* count of fonts used on current page */
+#endif /* HPJETPLUS */
+
+long page_ptr[MAXPAGE+1]; /* byte pointers to pages (reverse order) */
+
+#if POSTSCRIPT
+long page_loc[MAXPAGE+1]; /* byte pointers to output pages */
+INT32 page_tex[MAXPAGE+1]; /* TeX's \count0 page numbers */
+#endif /* POSTSCRIPT */
+
+INT16 page_begin[MAXREQUEST+1],
+ page_end[MAXREQUEST+1],
+ page_step[MAXREQUEST+1]; /* explicit page range requests */
+INT16 npage; /* number of explicit page range requests */
+struct font_list font_files[MAXOPEN+1];
+ /* list of open PXL file identifiers */
+
+UNSIGN32 power[32]; /* power[k] = 1 << k */
+
+#if POSTSCRIPT
+BOOLEAN ps_vmbug; /* reload fonts on each page when TRUE */
+#endif /* POSTSCRIPT */
+
+UNSIGN32 rightones[HOST_WORD_SIZE];/* bit masks */
+
+#if (APPLEIMAGEWRITER | EPSON | DECLA75 | DECLN03PLUS)
+BOOLEAN runlengthcode = FALSE; /* this is runtime option '-r' */
+#endif /* (APPLEIMAGEWRITER | EPSON | DECLA75 | DECLN03PLUS) */
+
+#if (GOLDENDAWNGL100 | TOSHIBAP1351)
+BOOLEAN runlengthcode = FALSE; /* this is runtime option '-r' */
+#endif /* (GOLDENDAWNGL100 | TOSHIBAP1351) */
+
+UNSIGN32 runmag; /* runtime magnification */
+UNSIGN32 mag; /* magnification specified in preamble */
+UNSIGN32 num; /* numerator specified in preamble */
+struct font_entry *pfontptr = (struct font_entry *)NULL;
+ /* previous font_entry pointer */
+BOOLEAN preload = TRUE; /* preload the font descriptions? */
+FILE *fontfp = (FILE*)NULL; /* font file pointer */
+
+BOOLEAN quiet = FALSE; /* suppress status display when TRUE */
+
+BOOLEAN backwards = FALSE; /* print in backwards order */
+
+#if (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+COORDINATE rule_height; /* parameters of last rule set */
+COORDINATE rule_width;
+COORDINATE str_ycp; /* last string ycp value */
+UNSIGN16 size_limit; /* character size limit in pixels -- larger */
+ /* characters are downloaded each time they */
+ /* are required to avoid PostScript ROM bugs */
+#endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+#if (BSD42 | OS_TOPS20)
+BOOLEAN spool_output = FALSE; /* offer to send output to spooler */
+#endif /* (BSD42 | OS_TOPS20) */
+
+char subpath[MAXFNAME]; /* font substitution file path */
+char subname[MAXFNAME]; /* font substitution file name field */
+char subext[MAXFNAME]; /* font substitution file extension field */
+char subfile[MAXFNAME]; /* font substitution filename */
+
+INT32 tex_counter[10]; /* TeX c0..c9 counters on current page */
+float topmargin; /* top margin in inches */
+COORDINATE tmargin; /* top margin offset in pixels */
+
+INT32 v; /* current vertical position */
+
+#if VIRTUAL_FONTS
+BOOLEAN virt_font; /* virtual font cache flag */
+struct virt_data
+ {
+ int cnt;
+ char *ptr;
+ char *base;
+ };
+struct virt_data virt_save[_NFILE];/* space for saving old FILE values */
+#endif /* VIRTUAL_FONTS */
+
+COORDINATE vv; /* current vertical position in pixels */
+
+#if BBNBITGRAPH
+struct char_entry *bgcp[NBGFONTS+(NBGFONTS+2)/3][NPXLCHARS];
+ /* Pointer to corresponding char_entry for this BitGraph font */
+ /* and character. These are used to set the char_entry's */
+ /* status to "not loaded" when we have to reuse the BitGraph */
+ /* character. The array is cleared initially in devinit(). */
+
+INT16 fullfont = 0; /* full font to load in BitGraph */
+BOOLEAN g_interactive=TRUE; /* is the program running interactively */
+ /* (i.e., standard output not redirected)? */
+INT16 partchar = FIRSTBGCHAR; /* partial font character to load in BitGraph*/
+INT16 partfont = NBGFONTS; /* partial font to load in BitGraph */
+INT16 pbghpos; /* previous BitGraph horizontal position */
+INT16 pbgvpos; /* previous BitGraph vertical position */
+INT16 pbgf = -1; /* previous BitGraph font */
+COORDINATE xdiff; /* x difference */
+COORDINATE xscreen; /* x screen adjustment */
+COORDINATE ydiff; /* y difference */
+COORDINATE yscreen; /* y screen adjustment */
+long cpagep; /* pointer to current page in DVI file */
+long ppagep; /* pointer to previous page in DVI file */
+
+#if OS_TOPS20
+#define jfn_plotfp (jfnof(fileno(plotfp)))
+
+int bg_length,bg_width,bg_1ccoc,bg_2ccoc,bg_modeword,bg_sysmsg;
+#endif /* OS_TOPS20 */
+
+#endif /* BBNBITGRAPH */
diff --git a/dviware/beebe/src/gendefs.h b/dviware/beebe/src/gendefs.h
new file mode 100644
index 0000000000..511a7ea09c
--- /dev/null
+++ b/dviware/beebe/src/gendefs.h
@@ -0,0 +1,113 @@
+/* -*-C-*- gendefs.h */
+/*-->gendefs*/
+/**********************************************************************/
+/****************************** gendefs *******************************/
+/**********************************************************************/
+
+/**********************************************************************/
+/************************ General Definitions ***********************/
+/**********************************************************************/
+
+/***********************************************************************
+This section should not require modification for either new hosts or new
+output devices.
+***********************************************************************/
+
+#define ABS(x) ((x) < 0 ? -(x) : (x))
+#define DBGOPT(flag) (debug_code & (flag))
+#define DBG_PAGE_DUMP 0x0001
+#define DBG_CHAR_DUMP 0x0002
+#define DBG_POS_CHAR 0x0004
+#define DBG_OKAY_OPEN 0x0008
+#define DBG_FAIL_OPEN 0x0010
+#define DBG_OFF_PAGE 0x0020
+#define DBG_FONT_CACHE 0x0040
+#define DBG_SET_TEXT 0x0080
+#define DEBUG_OPEN(fp,fname,openmode) dbgopen(fp,fname,openmode)
+#define DVIFORMAT 2
+#define FIRSTPXLCHAR 0
+#define FT_GF 0
+#define FT_PK 1
+#define FT_PXL 2
+#define IN(a,b,c) (((a) <= (b)) && ((b) <= (c)))
+
+/* Computer Modern has 128 characters (0..127), but Japanese fonts and
+extended European Computer Moderns may have up to 256 (0..255)
+characters */
+#define LASTPXLCHAR 255
+
+#define MAGSIZE(f) ((UNSIGN32)(1000.0*(f) + 0.5))
+
+#ifdef MAX
+#undef MAX
+#endif
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MAXFONTS 32 /* number of fonts per job (HPLJ, Canon A2) */
+#define MAXMSG 1024 /* message[] size--big enough for 2 file names*/
+#define MAXPAGE 999 /* limit on number of pages in a DVI file */
+#define MAXREQUEST 256 /* limit on number of explicit page print
+ requests */
+#define MAXSPECIAL 500 /* limit on \special{} string size; it need not
+ be larger than TeX's compile-time parameter
+ buf_siz, which is 500 in Standard TeX-82 */
+#define MAXSTR 257 /* DVI file text string size */
+
+#define MAXFORMATS 12 /* number of font file naming formats */
+#define MIN_M -500 /* GF character image extents */
+#define MAX_M 1500
+#define MIN_N -500
+#define MAX_N 1500
+
+#ifdef MIN
+#undef MIN
+#endif
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+#if (OS_ATARI | OS_PCDOS | OS_TOPS20)
+#define NEWLINE(fp) {(void)putc((char)'\r',fp);(void)putc((char)'\n',fp);}
+ /* want <CR><LF> for these systems */
+#else
+#define NEWLINE(fp) (void)putc((char)'\n',fp) /* want bare <LF> */
+#endif
+
+#define NPXLCHARS 256
+#define ONES ~0 /* a word of all one bits */
+#define OUTC(c) (void)putc((char)(c),plotfp)
+#define OUTF(fmt,v) (void)fprintf(plotfp,fmt,v)
+#define OUTF2(fmt,u,v) (void)fprintf(plotfp,fmt,u,v)
+#define OUTF3(fmt,u,v,w) (void)fprintf(plotfp,fmt,u,v,w)
+#define OUTS(s) (void)fputs(s,plotfp)
+
+#if CANON_A2
+
+#ifdef CANON_TEST
+#define FOUTC(c) (void)putc((char)(c),savefp);
+#define FOUTS(s) (void)fputs(s,savefp)
+#endif /* CANON_TEST */
+
+#endif
+
+#define PIXROUND(n,c) ((COORDINATE)(((float)(n))*(c) + 0.5))
+
+#undef PXLID
+#define PXLID 1001
+
+#define SETBIT(m) img_row[(m-min_m) >> 5] |= img_mask[(m-min_m) & 0x1f]
+#define TESTBIT(m) img_row[(m-min_m) >> 5] & img_mask[(m-min_m) & 0x1f]
+
+#if STDRES
+#define STDMAG 1000
+#else
+#define STDMAG 603 /* 1500/(1.2**5) to stay in magstep family */
+#endif
+
+#define RESOLUTION (((float)STDMAG)/5.0) /* dots per inch */
+#define STACKSIZE 100
+
+#undef USEGLOBALMAG
+#define USEGLOBALMAG 1 /* allow dvi global magnification */
+
+#define VISIBLE(t) ((t->wp > 0) && (t->hp > 0))
+ /* true if both pixel height and width are non-zero */
diff --git a/dviware/beebe/src/getbmap.h b/dviware/beebe/src/getbmap.h
new file mode 100644
index 0000000000..ac1b85c3e0
--- /dev/null
+++ b/dviware/beebe/src/getbmap.h
@@ -0,0 +1,35 @@
+/* -*-C-*- getbmap.h */
+/*-->getbmap*/
+/**********************************************************************/
+/****************************** getbmap *******************************/
+/**********************************************************************/
+
+void
+getbmap() /* allocate bitmap array */
+{
+#if SEGMEM
+ register UNSIGN16 y;
+
+ if (bitmap[0] == (UNSIGN32*)NULL)
+ {
+ for (y = 0; y < (UNSIGN16)YBIT; ++y)
+ {
+ bitmap[y] = (UNSIGN32*)MALLOC( (unsigned)((XBIT) * \
+ sizeof(UNSIGN32)) );
+ if (bitmap[y] == (UNSIGN32*)NULL)
+ (void)fatal(
+ "getbmap(): Cannot allocate space for page image bitmap");
+ }
+ }
+#else /* NOT SEGMEM */
+ if (bitmap == (UNSIGN32*)NULL)
+ {
+ bitmap =
+ (UNSIGN32*)MALLOC(((UNSIGN32)(XBIT))*((UNSIGN32)(YBIT))*sizeof(UNSIGN32));
+ if (bitmap == (UNSIGN32*)NULL)
+ (void)fatal(
+ "getbmap(): Cannot allocate space for page image bitmap");
+ }
+#endif /* SEGMEM */
+}
+
diff --git a/dviware/beebe/src/getbytes.h b/dviware/beebe/src/getbytes.h
new file mode 100644
index 0000000000..0e21fb09a2
--- /dev/null
+++ b/dviware/beebe/src/getbytes.h
@@ -0,0 +1,18 @@
+/* -*-C-*- getbytes.h */
+/*-->getbytes*/
+/**********************************************************************/
+/****************************** getbytes ******************************/
+/**********************************************************************/
+
+void
+getbytes(fp, cp, n) /* get n bytes from file fp */
+register FILE *fp; /* file pointer */
+register char *cp; /* character pointer */
+register BYTE n; /* number of bytes */
+
+{
+ while (n--)
+ *cp++ = (char)getc(fp);
+}
+
+
diff --git a/dviware/beebe/src/getfntdf.h b/dviware/beebe/src/getfntdf.h
new file mode 100644
index 0000000000..8dc9e9809d
--- /dev/null
+++ b/dviware/beebe/src/getfntdf.h
@@ -0,0 +1,25 @@
+/* -*-C-*- getfntdf.h */
+/*-->getfntdf*/
+/**********************************************************************/
+/****************************** getfntdf ******************************/
+/**********************************************************************/
+
+void
+getfntdf()
+
+/***********************************************************************
+Read the font definitions as they are in the postamble of the DVI file.
+Note that the font directory is not yet loaded.
+***********************************************************************/
+
+{
+ register BYTE byte;
+
+ while (((byte = (BYTE)nosignex(dvifp,(BYTE)1)) >= FNT_DEF1)
+ && (byte <= FNT_DEF4))
+ readfont ((INT32)nosignex(dvifp,(BYTE)(byte-FNT_DEF1+1)));
+ if (byte != POST_POST)
+ (void)fatal ("getfntdf(): POST_POST missing after fontdefs");
+}
+
+
diff --git a/dviware/beebe/src/getlog.c b/dviware/beebe/src/getlog.c
new file mode 100644
index 0000000000..f767e12b8b
--- /dev/null
+++ b/dviware/beebe/src/getlog.c
@@ -0,0 +1,33 @@
+/* -*-C-*- getlogin.c */
+/*-->getlogin*/
+/**********************************************************************/
+/****************************** getlogin ******************************/
+/**********************************************************************/
+
+#if KCC_20
+#include <jsys.h>
+static int acs[5];
+#define ac1 acs[1]
+#define ac2 acs[2]
+#define ac3 acs[3]
+#define ac4 acs[4]
+#endif /* KCC_20 */
+
+
+char*
+getlogin()
+{
+ static char username[40];
+
+ username[0] = '\0';
+
+#if KCC_20
+ (void)jsys(GJINF,acs);
+ ac2 = ac1; /* user number */
+ ac1 = (int)(username-1); /* Monitor wants ILDB */
+ /* pointer, not LDB pointer*/
+ (void)jsys(DIRST,acs);
+#endif /* KCC_20 */
+
+ return ((char*) username);
+}
diff --git a/dviware/beebe/src/getpgtab.h b/dviware/beebe/src/getpgtab.h
new file mode 100644
index 0000000000..84a6372fbb
--- /dev/null
+++ b/dviware/beebe/src/getpgtab.h
@@ -0,0 +1,40 @@
+/* -*-C-*- getpgtab.h */
+/*-->getpgtab*/
+/**********************************************************************/
+/****************************** getpgtab ******************************/
+/**********************************************************************/
+
+void
+getpgtab(lastpageptr)
+long lastpageptr;
+
+{
+ register long p;
+ register INT16 i,k;
+
+ (void) FSEEK (dvifp,lastpageptr,0);
+ p = lastpageptr;
+
+ for (k = 0; (p != (-1)) && (k < MAXPAGE); ++k)
+ {
+ page_ptr[MAXPAGE-1-k] = p;
+ (void) FSEEK (dvifp,(long) p, 0);
+
+ if ((BYTE)nosignex(dvifp,(BYTE)1) != BOP)
+ (void)fatal(
+ "getpgtab(): Invalid BOP (beginning-of-page) back chain");
+
+ for (i = 0; i <= 9; ++i)
+ (void) nosignex(dvifp,(BYTE)4); /* discard count0..count9 */
+ p = (long)signex(dvifp,(BYTE)4);
+ }
+ page_count = k;
+ if (k >= MAXPAGE)
+ (void)warning("getpgtab(): Page table full...rebuild driver with \
+larger MAXPAGE");
+ else /* move pointer table to front of array */
+ for (k = 0; k < page_count; ++k)
+ page_ptr[k] = page_ptr[MAXPAGE-page_count+k];
+}
+
+
diff --git a/dviware/beebe/src/inch.h b/dviware/beebe/src/inch.h
new file mode 100644
index 0000000000..d99a7ece10
--- /dev/null
+++ b/dviware/beebe/src/inch.h
@@ -0,0 +1,104 @@
+/* -*-C-*- inch.h */
+/*-->inch*/
+/**********************************************************************/
+/******************************** inch ********************************/
+/**********************************************************************/
+
+float
+inch(s)
+char *s;
+
+/***********************************************************************
+Convert a value field in s[] of the form
+
+ ------ ------------------------------
+ value units implied
+ ------ ------------------------------
+ #.##bp big point (1in = 72bp)
+ #.##cc cicero (1cc = 12dd)
+ #.##cm centimeter
+ #.##dd didot point (1157dd = 1238pt)
+ #.##in inch
+ #.##mm millimeter (10mm = 1cm)
+ #.##pc pica (1pc = 12pt)
+ #.##pt point (72.27pt = 1in)
+ #.##sp scaled point (65536sp = 1pt)
+ ------ ------------------------------
+
+to inches, returning it as the function value. A leading plus or minus
+sign is optional. The letter case of the dimension name is ignored. No
+space is permitted between the number and the dimension.
+***********************************************************************/
+
+{
+ BOOLEAN neg;
+ register char *tc;
+ register double flnum, pten;
+
+ flnum = 0.0;
+ tc = s;
+ neg = FALSE;
+
+ if (*tc == '-')
+ {
+ ++tc;
+ neg = TRUE;
+ }
+ else if (*tc == '+')
+ {
+ ++tc;
+ neg = FALSE;
+ }
+
+ /* we do not use sprintf() here because we want to be able to easily
+ find the dimension string */
+
+ for (; isdigit(*tc); ++tc) /* collect integer part */
+ flnum = flnum*10.0 + (double)((*tc) - '0');
+
+ if (*tc == '.') /* collect fractional part */
+ for ((pten = 10.0, ++tc); isdigit(*tc); (pten *= 10.0,++tc))
+ flnum += ((double)((*tc) - '0'))/pten;
+
+ if (strcm2(tc,"in") == 0) /* inches */
+ ;
+ else if (strcm2(tc,"cm") == 0) /* centimeters */
+ flnum /= 2.54;
+ else if (strcm2(tc,"pt") == 0) /* points */
+ flnum /= 72.27;
+ else if (strcm2(tc,"bp") == 0) /* big points */
+ flnum /= 72.0;
+ else if (strcm2(tc,"cc") == 0) /* cicero */
+ flnum *= 12.0 * (1238.0 / 1157.0) / 72.27;
+ else if (strcm2(tc,"dd") == 0) /* didot points */
+ flnum *= (1238.0 / 1157.0) / 72.27;
+ else if (strcm2(tc,"mm") == 0) /* millimeters */
+ flnum /= 25.4;
+ else if (strcm2(tc,"pc") == 0) /* pica */
+ flnum *= 12.0 / 72.27;
+ else if (strcm2(tc,"sp") == 0) /* scaled points */
+ flnum /= (65536.0 * 72.27);
+ else /* unknown units -- error */
+
+#if PXLID /* must be in DVI driver */
+ {
+ (void)sprintf(message,
+ "inch(): Unrecognized dimension string [%s];\nexpected one of \
+bp, cc, cm, dd, in, mm, pc, pt or sp\n",s);
+ (void)fatal(message);
+ }
+#else /* some other program then */
+ {
+ (void)fprintf(stderr,"inch(): Unrecognized dimension string [%s];",s);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,
+ "expected one of bp, cc, cm, dd, in, mm, pc, pt or sp");
+ NEWLINE(stderr);
+ EXIT(1);
+ }
+#endif
+
+ if (neg)
+ flnum = -flnum;
+ return((float)flnum);
+}
diff --git a/dviware/beebe/src/initglob.h b/dviware/beebe/src/initglob.h
new file mode 100644
index 0000000000..65fb1d3b75
--- /dev/null
+++ b/dviware/beebe/src/initglob.h
@@ -0,0 +1,122 @@
+/* -*-C-*- initglob.h */
+/*-->initglob*/
+/**********************************************************************/
+/****************************** initglob ******************************/
+/**********************************************************************/
+
+void
+initglob() /* initialize global variables */
+{
+ register INT16 i; /* loop index */
+ register char* tcp; /* temporary character pointer */
+
+/***********************************************************************
+ Set up masks such that rightones[k] has 1-bits at the right end of
+ the word from k .. HOST_WORD_SIZE-1, where bits are numbered from
+ left (high-order) to right (lower-order), 0 .. HOST_WORD_SIZE-1.
+
+ img_mask[k] has a 1-bit in position k, bits numbered as above.
+ power[k] is 1 << k, and gpower[k] is 2**k-1 (i.e. 1-bits in
+ low-order k positions). These 3 require only 32 entries each since
+ they deal with 32-bit words from the PK and GF font files.
+
+ These are set at run-time, rather than compile time to avoid (a)
+ problems with C preprocessors which sometimes do not handle large
+ constants correctly, and (b) host byte-order dependence.
+***********************************************************************/
+
+ rightones[HOST_WORD_SIZE-1] = 1;
+ for (i = HOST_WORD_SIZE-2; (i >= 0); --i)
+ rightones[i] = (rightones[i+1] << 1) | 1;
+
+ img_mask[31] = 1;
+ for (i = 30; i >= 0; --i)
+ img_mask[i] = img_mask[i+1] << 1;
+
+ power[0] = 1;
+ for (i = 1; i <= 31; ++i)
+ power[i] = power[i-1] << 1;
+
+ gpower[0] = 0; /* NB: we have gpower[0..32], not [0..31] */
+ for (i = 1; i <= 32; ++i)
+ gpower[i] = power[i-1] | gpower[i-1];
+
+ debug_code = 0;
+ runmag = STDMAG; /* default runtime magnification */
+
+#if HPLASERJET
+ hpres = DEFAULT_RESOLUTION; /* default output resolution */
+#endif /* HPLASERJET */
+
+#if HPJETPLUS
+ size_limit = 128; /* largest character size */
+#endif
+
+
+#if CANON_A2
+ /*
+ This should really be 64, but there are serious problems with the
+ Canon A2 downloaded font mechanism--characters are randomly dropped
+ from the output. Setting the size limit to 0 forces each character
+ to be loaded as a raster bitmap, which blows the output file size up
+ by more than a factor of 10, sigh....
+ */
+ size_limit = 0;
+
+#ifdef CANON_TEST
+ size_limit = 64; /* largest character size */
+ stor_limit = STOR_LIMIT;
+ merit_fact = MERIT_FACT;
+ stor_fonts = STOR_FONTS;
+#endif /* CANON_TEST */
+
+#endif
+
+
+#if POSTSCRIPT
+ size_limit = PS_SIZELIMIT; /* characters larger than this */
+ /* get loaded each time with */
+ /* surrounding save/restore to */
+ /* get around PostScript bugs */
+ ps_vmbug = FALSE; /* do not reload fonts on each page */
+#endif /* POSTSCRIPT */
+
+ npage = 0;
+ copies = 1; /* number of copies of each page */
+ topmargin = 1.0; /* DVI driver standard default */
+ leftmargin = 1.0; /* DVI driver standard default */
+
+ subfile[0] = '\0';
+
+#if VIRTUAL_FONTS
+ virt_font = FALSE;
+#endif
+
+ /*
+ Copy default file fields into global variables, then replace by any
+ runtime environment variable definitions. We need not do this for
+ TOPS-20 and VAX VMS, since SUBPATH and FONTPATH are already
+ initialized to logical names which the operating system will
+ translate at file open time.
+ */
+
+ (void)strcpy(helpcmd,DVIHELP);
+ (void)strcpy(subpath,SUBPATH);
+ (void)strcpy(subname,SUBNAME);
+ (void)strcpy(subext,SUBEXT);
+ (void)strcpy(fontpath,FONTPATH);
+ (void)strcpy(fontlist,FONTLIST);
+
+ if ((tcp = GETENV("DVIHELP")) != (char *)NULL)
+ (void)strcpy(helpcmd,tcp);
+
+#if (OS_ATARI | OS_PCDOS | OS_UNIX)
+ if ((tcp = GETENV(TEXINPUTS)) != (char *)NULL)
+ (void)strcpy(subpath,tcp);
+ if ((tcp = GETENV(TEXFONTS)) != (char *)NULL)
+ (void)strcpy(fontpath,tcp);
+#endif
+
+ if ((tcp = GETENV("FONTLIST")) != (char *)NULL)
+ (void)strcpy(fontlist,tcp);
+}
diff --git a/dviware/beebe/src/keybrd.c b/dviware/beebe/src/keybrd.c
new file mode 100644
index 0000000000..346515102e
--- /dev/null
+++ b/dviware/beebe/src/keybrd.c
@@ -0,0 +1,920 @@
+/***********************************************************************
+
+This package implements a simple keyboard input interface to permit
+character-at-a-time input, plus optional suppression of character
+translation.
+
+This is one of the areas where operating systems (even variants of Unix)
+are horribly non-standard, and the problem is not really addressed
+satisfactorily by either the emerging draft ANSI C Standard (01-Oct-86),
+or the IEEE Trial Use Standard: Portable Operating System for Computer
+Environments (POSIX), IEEE Std 1003.1, (14-Apr-86).
+
+This package is intentionally simple--only one keyboard input device is
+supported (NOT Unix stdin!), and where possible, it is implemented with
+rather ordinary Unix library calls. The functionality provided is open,
+close, flush, get, unget, set-mode, and inquire-mode. All functions
+(except kbfile()) use the stdio.h EOF value to signal an error, and none
+set the global errno flag (that is not the prerogative of non-system
+software).
+
+User programs need only use a '#include "key.h"' statement to get
+definitions of all visible flags, functions, and types in this package.
+Global data which is private to this package is declared static to
+ensure just that.
+
+The mode parameter set in calls to kbopen() and kbmode(), and returned
+by them, is simply a collection of bit flags, but for future
+expandability, it has a special type KEYMODE, instead of being an int.
+The mode flags require some explanation. They are based on the terminal
+I/O model in Berkeley Unix. Essentially three terminal modes are
+supported: normal, cbreak, and raw.
+
+In normal mode, keyboard input is handled like fopen() / getchar() /
+fclose(), so that input editing characters are supported (and handled by
+the terminal driver, not this package!). Input may be available before
+a <CR> is typed (e.g. 4.3BSD, TOPS-20, MS-DOS), or may not (System V,
+VMS).
+
+In cbreak mode, input editing characters should still work, but input is
+guaranteed to be available before a <CR> is typed, provided that the
+operating system supports that (CDC and IBM do not). Interrupt
+characters (CTL-C, CTL-Z, et al) are not readable--they still cause
+interrupts which are not handled here. Other control characters (HT,
+ESC, et al) must be readable.
+
+In raw mode, all characters in the host character set may be input, and
+no character-initiated interrupts are possible.
+
+These three modes are selected by OR'ing into the mode value one of
+KB_CBREAK, KB_NORMAL, or KB_RAW; they are mutually exclusive, and an
+error is raised if more than one is specified.
+
+The current mode may be saved (internally) with KB_SAVE, restored with
+KB_RESTORE, or inquired with KB_INQUIRE; any other KB_xxxx flags set
+with these are ignored, and the current mode is not changed. Only one
+level of save/restore is provided; successive restore requests without
+an intervening save are permissible, and simply restore the saved mode.
+The intent is that save/restore normally only be done once at job start
+and end.
+
+Normally, input characters are not echoed to the terminal; if the
+side-effect of echoing is wanted, it must be requested by KB_ECHO.
+
+The effect of these modes on input (and output) via other file
+descriptors is operating-system dependent. On Unix, the terminal modes
+are job-wide, and persist after a program terminates. On MS-DOS and VAX
+VMS, they affect terminal I/O, but only for the duration of the job, and
+only for that file descriptor. On TOPS-20, some of the modes can
+persist after the job (e.g. terminal width and pause-on-end-of-page).
+
+All functions return the EOF error indicator if the keyboard file is not
+open. This can be done with an initial call to kbopen(mode); on
+success, it returns the argument mode value.
+
+When processing is complete, kbclose() should be called. Further calls
+of the kbxxxx() functions will return error codes until kbopen() is
+called again. kbclose() must restore the terminal to the state it was
+in when kbopen() was called; kbmode() does not necessarily do that
+(since the default mode for kbopen() is no echo).
+
+kbget() and kbunget(c) provide for single-character input, and
+single-character push-back. kbget() returns a non-negative ordinal
+value on success, and EOF on error. The pushed-back character given to
+kbunget(c) need not be one obtained from the last call to kbget().
+Attempts to push back more than one character are ignored, and result in
+an EOF error return. Depending on the mode (raw, cbreak, normal),
+kbget() may not be able to return an end-of-file indicator; it cannot in
+raw mode, but for portability, EOF returns from kbget() should not be
+expected.
+
+kbflush() simply flushes typeahead. It returns EOF only if the keyboard
+file is not open; otherwise it returns 0.
+
+In many applications, it is often important to have the capability of
+determining whether or nor input is available. For example, a screen
+display algorithm probably should suspend display if input is awaiting
+that is likely to change the state of the screen. The kbinput()
+function is therefore an important one; it returns 0 if no input is
+available to be read by kbget(), returns EOF on error, and otherwise
+returns a positive number which in some implementations may be the
+number of unread input characters, and in others may be arbitrary. This
+function is one which is difficult to implement on some operating
+systems, with Unix System III and V being the worst. The implementation
+below for the latter is borrowed from Marc Rochkind's excellent book,
+"Advanced Unix Programming", Prentice-Hall (1985).
+
+There is one other function provided, kbfile(); it returns the FILE*
+pointer for the keyboard file, or (FILE*)NULL is none is open, or if
+this package is not implemented with standard C I/O routines. Its use
+is strongly discouraged, but the author's long programming experience
+has shown that on rare occasions, it may be useful. Character push-back
+with direct calls to ungetc(c,kbfile()) will probably not work as
+expected, but other stdio functions should. fopen() and fclose() should
+not be called with the kbfile() value; that would corrupt internal data
+structures here.
+
+Most functions are necessarily internally system-dependent, and
+preprocessor conditionals encapsulate the gory details. Preprocessor
+flags are as follows; at least one implementation flag, and one
+compatible operating system flag, must be chosen:
+
+C Implementations:
+ ATT -- AT&T Unix (System III, V)
+ BSD -- Berkeley 4.xBSD
+ HPUX -- HP 9000 series Unix (System V based)
+ IBM_PC_MICROSOFT-- IBM PC Microsoft Version 3.x or later C compiler
+ KCC_20 -- SRI's KCC Compiler on TOPS-20
+ PCC_20 -- Portable C Compiler on TOPS-20
+
+Operating systems:
+ OS_PCDOS -- IBM (and clones) PC DOS and MS DOS
+ OS_TOPS20 -- DEC-20 TOPS-20
+ OS_UNIX -- Unix (almost any variant)
+ OS_VAXVMS -- VAX VMS
+
+Testing of this package has been carried on TOPS-20 (KCC-20 and PCC-20)
+on DEC-20/60, , VAX VMS (CC) on VAX 8600, 4.3BSD Unix on VAX 8600, HPUX
+on HP 9000, and PC DOS (IBM PC XT). It appears to work satisfactorily
+on all of these, with the single exception that CTL-C handling on PC DOS
+is not restored after a switch from raw mode; under all modes, CTL-C
+still echoes as ^C<CR><LF>. Using DOS interrupt 0x33 instead of
+signal() to save and restore the ctl-break status does not provide an
+acceptable alternative; CTL-C always terminates execution. Further work
+is necessary to resolve this.
+
+[08-Apr-87]
+***********************************************************************/
+
+#include <stdio.h>
+#include "keydef.h"
+
+#ifndef OS_PCDOS
+#define OS_PCDOS 0
+#endif
+
+#ifndef IBM_PC_MICROSOFT
+#define IBM_PC_MICROSOFT 0
+#endif
+
+#ifndef OS_TOPS20
+#define OS_TOPS20 0
+#endif
+
+#ifndef KCC_20
+#define KCC_20 0
+#endif
+
+#ifndef PCC_20
+#define PCC_20 0
+#endif
+
+#ifndef OS_UNIX
+#define OS_UNIX 0
+#endif
+
+#ifndef ATT
+#define ATT 0
+#endif
+
+#ifndef BSD
+#define BSD 0
+#endif
+
+#ifndef HPUX
+#define HPUX 0
+#endif
+
+#ifndef OS_VAXVMS
+#define OS_VAXVMS 0
+#endif
+
+#if OS_TOPS20
+#if (KCC_20 | PCC_20)
+#else
+#undef PCC_20
+#define PCC_20 1 /* PCC-20 is default for Tops-20 */
+#endif
+#endif
+
+#if (OS_PCDOS | OS_TOPS20 | OS_UNIX | OS_VAXVMS)
+#else
+#undef OS_UNIX
+#define OS_UNIX 1 /* Unix is default operating system */
+#endif
+
+#if (ATT | BSD | HPUX)
+#else
+#undef BSD
+#define BSD 1 /* BSD is default Unix variant */
+#endif
+
+#if OS_PCDOS
+#include <conio.h>
+#include <signal.h>
+
+#define TTYOPENFLAGS "rb"
+#define TTYNAME "con"
+
+#define interrupt catch_int /* MSC Version 5.0 raises syntax error otherwise */
+static int (*signal_status)();
+static void interrupt();
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+#define TTYNAME "TTY:"
+static int w_rfmod; /* terminal mode word */
+static int w_rpcap; /* process capability word */
+static int w_rtiw; /* terminal interrupt word */
+static int w_morxo; /* end-of-page mode */
+static int kbrestore(); /* restore terminal settings */
+/*
+** KCC-20 and PCC-20 have similar enough JSYS interfaces that we just
+** use KCC symbolic names, and then redefine them for PCC-20. PCC-20
+** has a working ioctl() that could be used for Unix-style processing
+** too, although it has a bug in that it resets the terminal width to 0,
+** and disables pause at end of page. It therefore seems easier to use
+** direct Monitor calls both both KCC-20 and PCC-20.
+*/
+
+#if KCC_20
+#include <jsys.h>
+#include <monsym.h>
+#define jfnof(x) _CTTRM /* we use direct JSYS'es for now */
+#define TTYASCMOD FLD(_TTASC,TT_DAM)
+#define TTYBINMOD FLD(_TTBIN,TT_DAM)
+#define TTYDAM FLD(-1,TT_DAM)
+#define TTYECHO FLD(-1,TT_ECO)
+#define TTYOPENFLAGS "rb8"
+#define TTYPGM FLD(-1,TT_PGM)
+#endif /* KCC_20 */
+
+#if PCC_20
+#include <file.h>
+#include <monsym.h>
+#undef jfnof
+#define jfnof(x) _CTTRM /* we use direct JSYS'es for now */
+/* Convert names in better KCC-20 style to PCC-20 style */
+#define BIN JSbin
+#define DOBE JSdobe
+#define MTOPR JSmtopr
+#define RFMOD JSrfmod
+#define RPCAP JSrpcap
+#define RTIW JSrtiw
+#define SC_CTC makefield(SC_ctc,-1) /* WARNING: PCC bug--see below */
+#define SFMOD JSsfmod
+#define SIBE JSsibe
+#define STIW JSstiw
+#define STPAR JSstpar
+#define TTYASCMOD makefield(TT_dam,TTasc)
+#define TTYBINMOD makefield(TT_dam,TTbin)
+#define TTYDAM makefield(TT_dam,-1)
+#define TTYPGM makefield(TT_pgm,-1)
+#define TTYECHO makefield(TT_eco,-1)
+#define TTYOPENFLAGS "rb"
+#define _CTTRM CTtrm
+#define _FHJOB 0777773
+#define _FHSLF FHslf
+#define _MOXOF MOxof
+#define _MOOFF MOoff
+#define _MORXO MOrxo
+#endif /* PCC_20 */
+
+#endif /* OS_TOPS20 */
+
+#if OS_UNIX
+
+#if (ATT | HPUX)
+typedef int BOOLEAN;
+#define FALSE 0
+#define TRUE 1
+
+#include <fcntl.h>
+#include <termio.h>
+
+static struct termio tty;
+static struct termio ttysave;
+static int setblock();
+#endif
+
+#if BSD
+#include <sgtty.h>
+#include <sys/ioctl.h>
+
+static struct sgttyb tty;
+static struct sgttyb ttysave;
+#endif
+
+#define TTYOPENFLAGS "r"
+#define TTYNAME "/dev/tty"
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+#include <ssdef.h>
+#include <descrip.h>
+#include <iodef.h>
+#include <ttdef.h>
+#include <tt2def.h>
+
+#define TTYOPENFLAGS "rb"
+#define TTYNAME ctermid((char*)NULL)
+static int status; /* system service status */
+static int tt_channel = -1; /* terminal channel for image QIO's */
+static int iomask; /* QIO flag mask */
+static $DESCRIPTOR(sys_in,"TT:"); /* terminal descriptor */
+
+static struct
+{
+ unsigned char class;
+ unsigned char type;
+ unsigned short buffer_size;
+ unsigned long tt;
+ unsigned long tt2;
+} mode_buf,mode_save;
+
+static struct
+{
+ unsigned short typeahead_count;
+ unsigned char first_char;
+ unsigned char reserved[5];
+} typeahead_buf;
+
+#define FAILED(status) (~(status) & 1) /* failure if LSB is 0 */
+
+#endif /* OS_VAXVMS */
+
+/*====================================================================*/
+
+#define BADMODE ((KEYMODE)(EOF)) /* unset mode value */
+#define EMPTY 32767 /* flag for empty pushback buffer */
+
+static KEYMODE kbcurrmode = BADMODE; /* current mode */
+static KEYMODE kbsavedmode = BADMODE; /* saved mode */
+static int kbpushback = EMPTY; /* character pushback buffer */
+static FILE* kbfp = (FILE*)NULL; /* keyboard file pointer */
+static int kbinit = 0; /* initialization flag */
+
+#if OS_PCDOS
+/*====================================================================*/
+
+static void
+interrupt()
+{
+ if (kbpushback == EMPTY)
+ kbpushback = 3; /* CTL-C */
+}
+#endif /* OS_PCDOS */
+
+/*====================================================================*/
+
+int
+kbclose() /* close the keyboard file */
+{ /* return EOF on error, 0 on success */
+ if (!kbinit)
+ return (EOF);
+ kbinit = 0;
+
+#if OS_PCDOS
+ (void)signal(SIGINT,signal_status);
+ return (0);
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+ return (kbrestore());
+#endif /* OS_TOPS20 */
+
+
+#if OS_UNIX
+#if (ATT | HPUX)
+ if (ioctl(fileno(kbfp),TCSETAF,&ttysave) == -1)
+ return (EOF);
+#endif /* (ATT | HPUX) */
+#if BSD
+ if (ioctl(fileno(kbfp),TIOCSETP,&ttysave) == -1)
+ return (EOF);
+#endif /* BSD */
+
+ return (kbfp == (FILE *)NULL ? EOF : fclose(kbfp));
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+ status = sys$qiow(0,tt_channel,IO$_SETMODE,0,0,0, &mode_save,12,0,0,0,0);
+ if (FAILED(status))
+ return (EOF);
+ return (0);
+#endif /* OS_VAXVMS */
+}
+
+/*====================================================================*/
+
+FILE*
+kbfile() /* return keyboard file pointer */
+{
+ return (kbinit ? kbfp : (FILE*)NULL);
+}
+
+/*====================================================================*/
+
+int
+kbflush() /* flush current input buffer */
+{
+ if (!kbinit)
+ return (EOF);
+ while (kbinput() > 0)
+ (void)kbget();
+ return (0);
+}
+
+
+/*====================================================================*/
+
+int
+kbget() /* blocking read of character */
+{ /* return character, or EOF on end-of-file or error */
+ int c;
+
+ if (!kbinit)
+ return (EOF);
+ else if (kbpushback == EMPTY)
+ {
+
+#if OS_PCDOS
+ c = (kbcurrmode & KB_ECHO) ? getche() : getch();
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+ ac1 = _CTTRM;
+ c = ((jsys(BIN,acs) == JSok) ? ac2 : EOF);
+#endif /* OS_TOPS20 */
+
+
+#if OS_UNIX
+#if (ATT | HPUX)
+ if (setblock(fileno(kbfp),TRUE) == EOF)
+ return (EOF);
+ if (read(fileno(kbfp),&c,1) <= 0)
+ c = EOF;
+#endif /* (ATT | HPUX) */
+#if BSD
+ c = getc(kbfp);
+#endif /* BSD */
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+ status = sys$qiow(0,tt_channel,iomask,0,0,0,&c,1,0,0,0,0);
+ if (FAILED(status))
+ c = EOF;
+#endif /* OS_VAXVMS */
+
+ }
+ else
+ {
+ c = kbpushback;
+ kbpushback = EMPTY;
+ }
+ return (c == EOF ? c : (int)(0377 & c)); /* make sure it is 8-bit value */
+}
+
+/*====================================================================*/
+
+int
+kbinput() /* input available? */
+{ /* return count of available input characters, 0 if none, or EOF on error */
+
+ if (!kbinit)
+ return (EOF);
+ else if (kbpushback != EMPTY)
+ return (1);
+ else
+ {
+#if OS_PCDOS
+ return (kbhit() ? 1 : 0); /* otherwise returns 255 */
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+ ac1 = jfnof(fileno(kbfp));
+ if (jsys(SIBE,acs) == JSok)
+ return (0); /* input buffer empty */
+ else
+ return (ac2); /* input character count */
+#endif /* OS_TOPS20 */
+
+#if OS_UNIX
+#if (ATT | HPUX)
+ {
+ char c;
+
+ if (setblock(fileno(kbfp),FALSE) == EOF)
+ return (EOF);
+ switch (read(fileno(kbfp),&c,1))
+ {
+ case -1:
+ return (EOF);
+
+ case 0:
+ return (0);
+
+ default:
+ kbpushback = (int)c;
+ return (1);
+ }
+ }
+#endif /* (ATT | HPUX) */
+#if BSD
+ {
+ int count;
+
+ return ((ioctl(fileno(kbfp), FIONREAD, &count) == -1) ? EOF : count);
+ }
+#endif /* BSD */
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+ status = sys$qiow(0,tt_channel,IO$_SENSEMODE | IO$M_TYPEAHDCNT,
+ 0,0,0,&typeahead_buf,8,0,0,0,0);
+ return (FAILED(status) ? EOF : typeahead_buf.typeahead_count);
+#endif /* OS_VAXVMS */
+ }
+}
+
+/*====================================================================*/
+
+KEYMODE
+kbmode(mode) /* keyboard mode */
+KEYMODE mode; /* return new mode on success, EOF on error */
+{
+ if (!kbinit)
+ return (EOF);
+
+ switch (mode & (KB_INQUIRE | KB_RESTORE | KB_SAVE))
+ {
+ case 0:
+ break; /* must be a set-mode operation */
+
+ case KB_INQUIRE:
+ return (kbcurrmode);
+
+ case KB_RESTORE:
+ if (kbsavedmode = BADMODE)
+ return (BADMODE);
+ else
+ {
+ kbcurrmode = kbsavedmode;
+ kbcurrmode &= ~(KB_INQUIRE | KB_RESTORE | KB_SAVE);
+ return (kbmode(kbcurrmode));
+ }
+
+ case KB_SAVE:
+ kbsavedmode = kbcurrmode;
+ return (kbcurrmode);
+
+ default: /* do not allow mixed mode flags */
+ return (BADMODE);
+ }
+
+#if OS_TOPS20
+ if (kbrestore() == EOF) /* restore terminal settings */
+ return (BADMODE);
+#endif /* OS_TOPS20 */
+
+ switch (mode & (KB_CBREAK | KB_NORMAL | KB_RAW)) /* set-mode request */
+ {
+#if OS_PCDOS
+ case KB_CBREAK:
+ case KB_NORMAL:
+ (void)signal(SIGINT,signal_status);
+ break;
+
+ case KB_RAW:
+ (void)signal(SIGINT,interrupt);
+ break;
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+ case KB_CBREAK:
+ case KB_NORMAL:
+ ac1 = jfnof(fileno(kbfp));
+ ac2 = w_rfmod & ~TTYECHO; /* clear TT%ECO field (want no echo) */
+ if (jsys(SFMOD,acs) != JSok)
+ return (BADMODE);
+ if (jsys(STPAR,acs) != JSok)
+ return (BADMODE);
+ break;
+
+ case KB_RAW:
+ /* Wait for output to flush; if the screen is at end-of-page, we
+ are waiting for the user to type CTL-Q, which will have no
+ effect once we enter raw mode, and the terminal will be hung! */
+ ac1 = _CTTRM;
+ if (jsys(DOBE,acs) != JSok) /* dismiss until output buffer empty */
+ return (BADMODE);
+
+ ac1 = jfnof(fileno(kbfp));
+ ac2 = w_rfmod;
+ ac2 &= ~(TTYECHO | TTYDAM | TTYPGM); /* clear fields */
+ ac2 |= TTYBINMOD; /* set binary mode */
+ if (jsys(SFMOD,acs) != JSok)
+ return (BADMODE);
+ if (jsys(STPAR,acs) != JSok)
+ return (BADMODE);
+
+ ac1 = _FHJOB;
+
+#if KCC_20
+ if (w_rpcap & SC_CTC) /* then have CTL-C capability */
+#endif /* KCC_20 */
+#if PCC_20
+ ac3 = 0600000000000; /* PCC BUG: 0400000000000 becomes 0! */
+ ac3 &=0200000000000; /* so make it on-the-fly */
+ if (w_rpcap & ac3)
+#endif /* PCC_20 */
+ ac2 &= 077; /* read all ctl-chars */
+ else
+ ac2 &= 0040000000077; /* read all ctl-chars but CTL-C */
+ if (jsys(STIW,acs) != JSok) /* reset terminal interrupt word */
+ return (BADMODE);
+
+ ac1 = _CTTRM;
+ ac2 = _MOXOF;
+ ac3 = _MOOFF; /* disable pause at end-of-page */
+ if (jsys(MTOPR,acs) != JSok) /* otherwise we can hang waiting for */
+ return (BADMODE); /* a CTL-Q which is eaten as input! */
+
+ break;
+#endif /* OS_TOPS20 */
+
+#if OS_UNIX
+#if (ATT | HPUX)
+ case KB_CBREAK:
+ tty = ttysave;
+ tty.c_iflag &= ~(INLCR | ICRNL | IUCLC | ISTRIP | IXON | BRKINT);
+ tty.c_lflag &= ~(ECHO | ICANON);
+ tty.c_cc[4] = 5; /* MIN */
+ tty.c_cc[5] = 2; /* TIME */
+ if (ioctl(fileno(kbfp),TCSETAF,&tty) == -1)
+ return (BADMODE);
+ break;
+
+ case KB_NORMAL:
+ tty = ttysave;
+ tty.c_lflag &= ~ECHO;
+ tty.c_cc[4] = 5; /* MIN */
+ tty.c_cc[5] = 2; /* TIME */
+ if (ioctl(fileno(kbfp),TCSETAF,&tty) == -1)
+ return (BADMODE);
+ break;
+
+ case KB_RAW:
+ tty = ttysave;
+ tty.c_iflag &= ~(INLCR | ICRNL | IUCLC | ISTRIP | IXON | BRKINT);
+ tty.c_lflag &= ~(ICANON | ISIG | ECHO);
+ tty.c_cc[4] = 5; /* MIN */
+ tty.c_cc[5] = 2; /* TIME */
+ if (ioctl(fileno(kbfp),TCSETAF,&tty) == -1)
+ return (BADMODE);
+ break;
+#endif /* (ATT | HPUX) */
+
+#if BSD
+ case KB_CBREAK:
+ tty = ttysave;
+ tty.sg_flags &= ~(CRMOD | ECHO | LCASE);
+ tty.sg_flags |= CBREAK;
+ if (ioctl(fileno(kbfp),TIOCSETP,&tty) == -1)
+ return (BADMODE);
+ break;
+
+ case KB_NORMAL:
+ tty = ttysave;
+ tty.sg_flags &= ~(CBREAK | CRMOD | ECHO | LCASE | RAW);
+ if (ioctl(fileno(kbfp),TIOCSETP,&tty) == -1)
+ return (BADMODE);
+ break;
+
+ case KB_RAW:
+ tty = ttysave;
+ tty.sg_flags &= ~(CRMOD | ECHO | LCASE | TANDEM);
+ tty.sg_flags |= (CBREAK | RAW);
+ if (ioctl(fileno(kbfp),TIOCSETP,&tty) == -1)
+ return (BADMODE);
+
+ break;
+#endif /* BSD */
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+ case KB_CBREAK:
+ case KB_NORMAL:
+ mode_buf = mode_save;
+ mode_buf.tt &= ~TT$M_WRAP;
+ status = sys$qiow(0,tt_channel,IO$_SETMODE,0,0,0,&mode_buf,12,0,0,0,0);
+ if (FAILED(status))
+ return (EOF);
+ iomask = IO$_TTYREADALL | IO$M_NOECHO;
+ break;
+
+ case KB_RAW:
+ mode_buf = mode_save;
+ mode_buf.tt &= ~(TT$M_TTSYNC | TT$M_WRAP);
+ mode_buf.tt2 |= TT2$M_PASTHRU;
+ mode_buf.tt2 &= ~TT2$M_XON;
+ status = sys$qiow(0,tt_channel,IO$_SETMODE,0,0,0,&mode_buf,12,0,0,0,0);
+ if (FAILED(status))
+ return (EOF);
+ iomask = IO$_TTYREADALL | IO$M_NOECHO;
+ break;
+#endif /* OS_VAXVMS */
+
+ default: /* do not allow mixed mode flags */
+ return (BADMODE);
+ }
+ kbcurrmode = mode;
+ kbcurrmode &= ~(KB_INQUIRE | KB_RESTORE | KB_SAVE);
+
+ if (mode & KB_ECHO)
+ {
+#if OS_PCDOS
+ /* NO-OP */ ;
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+ ac1 = jfnof(fileno(kbfp));
+ ac2 = w_rfmod | TTYECHO; /* set echo mode */
+ if (jsys(SFMOD,acs) != JSok)
+ return (BADMODE);
+#endif /* OS_TOPS20 */
+
+
+#if OS_UNIX
+#if (ATT | HPUX)
+ /* ??? do not yet know how to handle this ??? */
+#endif /* (ATT | HPUX) */
+#if BSD
+ if (ioctl(fileno(kbfp),TIOCGETP,&tty) == -1)
+ return (BADMODE);
+ tty.sg_flags |= ECHO;
+ if (ioctl(fileno(kbfp),TIOCSETP,&tty) == -1)
+ return (BADMODE);
+#endif /* BSD */
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+ iomask &= ~IO$M_NOECHO; /* turn off no-echo flag */
+#endif /* OS_VAXVMS */
+ }
+ return (kbcurrmode);
+}
+
+/*====================================================================*/
+
+int
+kbopen(mode) /* open keyboard with mode (KB_xxxx flags) */
+int mode; /* return 0 on success, EOF on error */
+{
+ if (kbinit) /* ignore if already open */
+ return (EOF);
+
+#if OS_PCDOS
+ kbfp = (FILE*)NULL; /* we use direct console input */
+ signal_status = signal(SIGINT,SIG_IGN);
+ (void)signal(SIGINT,signal_status);
+#endif /* OS_PCDOS */
+
+#if OS_TOPS20
+ kbfp = (FILE*)NULL; /* we use direct JSYS'es */
+
+ /* save terminal characteristics for later modification and restoration */
+ ac1 = _CTTRM;
+ if (jsys(RFMOD,acs) != JSok) /* request terminal mode word */
+ return (EOF);
+ w_rfmod = ac2;
+
+ ac1 = _FHSLF;
+ if (jsys(RPCAP,acs) != JSok) /* request process capabilities */
+ return (EOF);
+ w_rpcap = ac2;
+
+ ac1 = _FHJOB;
+ if (jsys(RTIW,acs) != JSok) /* request terminal interrupt word */
+ return (EOF);
+ w_rtiw = ac2;
+
+ ac1 = _CTTRM;
+ ac2 = _MORXO;
+ if (jsys(MTOPR,acs) != JSok) /* request end-of-page mode */
+ return (EOF);
+ w_morxo = ac3;
+#endif /* OS_TOPS20 */
+
+#if OS_UNIX
+ if ((kbfp = fopen(TTYNAME,TTYOPENFLAGS)) == (FILE*)NULL)
+ return (EOF);
+
+#if (ATT | HPUX)
+ if (ioctl(fileno(kbfp),TCGETA,&ttysave) == -1)
+ return (EOF);
+#endif
+
+#if BSD
+ if (ioctl(fileno(kbfp),TIOCGETP,&ttysave) == -1)
+ return (EOF);
+#endif /* BSD */
+#endif /* OS_UNIX */
+
+#if OS_VAXVMS
+ kbfp = (FILE*)NULL; /* we use direct system calls */
+
+ status = sys$assign(&sys_in,&tt_channel,0,0);
+ if (FAILED(status))
+ return (EOF);
+ status = sys$qiow(0,tt_channel,IO$_SENSEMODE,0,0,0, &mode_save,12,0,0,0,0);
+ if (FAILED(status))
+ return (EOF);
+#endif /* OS_VAXVMS */
+
+ kbinit = 1;
+ if (kbmode(mode) == (KEYMODE)EOF)
+ {
+ if (kbfp != (FILE*)NULL)
+ (void)fclose(kbfp);
+ kbinit = 0;
+ kbfp = (FILE*)NULL;
+ return (EOF);
+ }
+
+ return (0);
+}
+
+#if OS_TOPS20
+/*====================================================================*/
+static int
+kbrestore() /* restore terminal settings */
+{ /* return 0 on success, EOF on error */
+ ac1 = jfnof(fileno(kbfp));
+ ac2 = w_rfmod;
+ if (jsys(SFMOD,acs) != JSok) /* set program-related modes */
+ return (EOF);
+ if (jsys(STPAR,acs) != JSok) /* set device-related modes */
+ return (EOF);
+
+ ac1 = _FHJOB;
+ ac2 = w_rtiw;
+ if (jsys(STIW,acs) != JSok) /* set terminal interrupt word */
+ return (EOF);
+
+ ac1 = _CTTRM;
+ ac2 = _MOXOF;
+ ac3 = w_morxo;
+ if (jsys(MTOPR,acs) != JSok) /* restore end-of-page mode */
+ return (EOF);
+
+ return (0);
+}
+
+#endif /* OS_TOPS20 */
+
+/*====================================================================*/
+
+int
+kbunget(c) /* unget keyboard character (1-level pushback) */
+char c; /* return c, or EOF on error (already pushed back character) */
+{
+ if (!kbinit)
+ return (EOF);
+ else if (kbpushback != EMPTY)
+ return (EOF);
+ else
+ {
+ kbpushback = (int)c;
+ return (kbpushback);
+ }
+}
+
+
+#if OS_UNIX
+#if (ATT | HPUX)
+static int
+setblock(fd,on) /* turn blocking on or off */
+ /* return EOF on error, 0 on success */
+int fd; /* file descriptor */
+BOOLEAN on; /* FALSE == turn off, TRUE == turn on */
+{
+ static int blockf;
+ static int nonblockf;
+ static BOOLEAN first = TRUE;
+ int flags;
+
+ if (first)
+ {
+ first = FALSE;
+ if ((flags = fcntl(fd,F_GETFL,0)) == -1)
+ return (EOF);
+ blockf = flags & ~O_NDELAY; /* turn off O_NDELAY */
+ nonblockf = flags | O_NDELAY; /* turn on O_NDELAY */
+ }
+ if (fcntl(fd,F_SETFL,on ? blockf : nonblockf) == -1)
+ return (EOF);
+ return (0);
+}
+#endif /* (ATT | HPUX) */
+#endif /* OS_UNIX */
diff --git a/dviware/beebe/src/keydef.h b/dviware/beebe/src/keydef.h
new file mode 100644
index 0000000000..82a90444aa
--- /dev/null
+++ b/dviware/beebe/src/keydef.h
@@ -0,0 +1,50 @@
+#ifndef ANSI_LIBRARY
+#define ANSI_LIBRARY 0
+#endif
+
+#if ANSI_LIBRARY
+#define ANSI_PROTOTYPES 1
+#include <stdlib.h>
+#endif
+
+#ifndef ANSI_PROTOTYPES
+#define ANSI_PROTOTYPES 0
+#endif
+
+typedef int KEYMODE; /* mode flag value */
+
+#if ANSI_PROTOTYPES /* ANSI style declarations */
+int kbclose(void);
+FILE* kbfile(void);
+int kbflush(void);
+int kbget(void);
+int kbinput(void);
+KEYMODE kbmode(KEYMODE);
+int kbopen(int);
+int kbunget(char);
+#else /* K&R style declarations */
+int kbclose();
+FILE* kbfile();
+int kbflush();
+int kbget();
+int kbinput();
+KEYMODE kbmode();
+int kbopen();
+int kbunget();
+#endif /* ANSI_PROTOTYPES */
+
+/* major function request codes */
+
+#define KB_INQUIRE 0x0001 /* return current keyboard mode */
+#define KB_RESTORE 0x0002 /* restore saved keyboard state */
+#define KB_SAVE 0x0004 /* save keyboard state (internally) */
+
+/* major mode codes */
+
+#define KB_CBREAK 0x0010 /* 'cbreak' (rare) mode */
+#define KB_NORMAL 0x0020 /* 'normal' terminal mode */
+#define KB_RAW 0x0040 /* 'raw' mode--all characters input */
+
+/* minor mode modifier codes */
+
+#define KB_ECHO 0x0100 /* echo input characters */
diff --git a/dviware/beebe/src/keytst.c b/dviware/beebe/src/keytst.c
new file mode 100644
index 0000000000..fe150854ab
--- /dev/null
+++ b/dviware/beebe/src/keytst.c
@@ -0,0 +1,116 @@
+/***********************************************************************
+This is a simple test program for the keyboard I/O package. It tests
+each of the input modes by looping waiting for input, displaying the
+counts and input bytes found, and exiting when 5 successive input
+checks find nothing.
+[15-Nov-87]
+***********************************************************************/
+#include <stdio.h>
+#include <ctype.h>
+#include "keydef.h"
+
+#ifdef OS_PCDOS
+#include <time.h>
+
+#if ANSI_PROTOTYPES
+void sleep(int seconds);
+#else
+void sleep();
+#endif
+
+#endif
+
+void abortjob();
+void keytst();
+
+void
+main()
+{
+ if (kbopen(KB_NORMAL) == EOF)
+ abortjob("kbopen");
+
+ (void)printf("\fNormal mode test\r\n");
+ keytst();
+
+ (void)printf("\fCbreak mode test\r\n");
+ if (kbmode(KB_CBREAK) == EOF)
+ abortjob("kbmode");
+ keytst();
+
+ (void)printf("\fRaw mode test\r\n");
+ if (kbmode(KB_RAW) == EOF)
+ abortjob("kbmode");
+ keytst();
+
+ (void)printf("\fNormal mode test\r\n");
+ if (kbmode(KB_NORMAL) == EOF)
+ abortjob("kbmode");
+ keytst();
+
+ if (kbclose() == EOF)
+ abortjob("kbclose");
+ exit(0);
+}
+
+void
+abortjob(msg)
+{
+ (void)fprintf(stderr,"?%s error return\r\n",msg);
+ exit(1);
+}
+
+void
+keytst()
+{
+ register int c;
+ register int count;
+ register int no_input;
+
+ no_input = 0;
+ (void)printf("Test will complete when no input is found after 5 tries\n");
+
+ for (;;) /* "infinite" loop */
+ {
+ (void)sleep(1); /* wait 1 sec */
+ count = kbinput();
+ if (count == EOF)
+ abortjob("kbinput");
+ if (count == 0)
+ no_input++;
+ else
+ no_input = 0;
+
+ (void)printf("kbinput() = %d [",count);
+
+ for ( ; count > 0; count--)
+ {
+ if ((c = kbget()) == EOF)
+ abortjob("kbget");
+ if (isprint(c))
+ (void)putchar(c);
+ else
+ (void)printf("\\%03o",c);
+ fflush(stdout);
+ }
+
+ (void)printf("]\r\n");
+ fflush(stdout);
+ if (no_input >= 5)
+ return;
+ }
+}
+
+#ifdef OS_PCDOS
+void
+sleep(seconds)
+int seconds;
+{
+ long start_time;
+ start_time = time((time_t*)NULL);
+ if (seconds < 2) /* must wait 2 ticks to ensure passage of 1 second */
+ seconds = 2;
+ while ((time((time_t*)NULL) - start_time) < (long)seconds)
+ /* waste time */ ;
+}
+#endif
+
diff --git a/dviware/beebe/src/loadchar.h b/dviware/beebe/src/loadchar.h
new file mode 100644
index 0000000000..bce62933a5
--- /dev/null
+++ b/dviware/beebe/src/loadchar.h
@@ -0,0 +1,66 @@
+/* -*-C-*- loadchar.h */
+/*-->loadchar*/
+/**********************************************************************/
+/****************************** loadchar ******************************/
+/**********************************************************************/
+
+void
+loadchar(c)
+BYTE c; /* character number in current font */
+
+/***********************************************************************
+ This simple version will do for now. Even in a book DVI file, there
+ are unlikely to be more than about 25 fonts used and with an average
+ of 50 characters each, this is about 1250 character definitions.
+ With typical character sizes of 10 point type on a 300 dots/inch
+ device, each would take a block of (10/72)*300 = 42 dots square, or
+ about 84 words each, for a total storage requirement of 84*1250 =
+ 105000 words. This is quite reasonable for the DEC-20/60 and VAX
+ Unix implementations, and may be acceptable on large memory
+ microprocessors like the MC68000 and NS16000.
+
+ However, for future expansion, a reference count of each character
+ is maintained, and the total storage allocated for character
+ descriptions is recorded. Then, when malloc fails, or MAXCACHE is
+ reached, the font entries can be scanned to find the least used
+ characters whose raster storage can then be freed and malloc
+ retried.
+***********************************************************************/
+
+{
+ void (*charyy)(); /* subterfuge to get around PCC-20 bug */
+ register UNSIGN32 nwords; /* how many 32-bit words we need */
+ register struct char_entry *tcharptr;
+
+ if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c)) /* check character range */
+ return;
+
+ tcharptr = &(fontptr->ch[c]);
+
+ if (!VISIBLE(tcharptr)) /* check for empty character rasters */
+ return;
+
+ nwords = (UNSIGN32)(((tcharptr->wp+31) >> 5) * (tcharptr->hp));
+
+ tcharptr->rasters = (UNSIGN32*)MALLOC((unsigned)(nwords*sizeof(UNSIGN32)));
+ if (tcharptr->rasters == (UNSIGN32*)NULL)
+ {
+ (void)sprintf(message,"loadchar(): Could not allocate %ld words of \
+raster space--used %ld words so far",
+ (long)nwords,(long)cache_size);
+ (void)fatal(message);
+ }
+ tcharptr->refcount = 0; /* clear reference count */
+ cache_size += (INT32)nwords; /* update cache size record */
+
+ if (fontptr != pfontptr)
+ openfont(fontptr->n);
+
+ if (fontfp == (FILE *)NULL) /* do nothing if no font file */
+ return;
+
+ /* Bug workaround: PCC-20 otherwise jumps to charxx instead of *charxx */
+ charyy = fontptr->charxx;
+ (void)(*charyy)(c,outrow); /* load character from font file */
+}
+
diff --git a/dviware/beebe/src/machdefs.h b/dviware/beebe/src/machdefs.h
new file mode 100644
index 0000000000..8dfc345a31
--- /dev/null
+++ b/dviware/beebe/src/machdefs.h
@@ -0,0 +1,834 @@
+/* -*-C-*- machdefs.h */
+/*-->machdefs*/
+/**********************************************************************/
+/****************************** machdefs ******************************/
+/**********************************************************************/
+
+/***********************************************************************
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+This file should contain definitions for symbols used for all operating
+system / implementation dependencies, and if the driver family has
+already been implemented on you machine, this should be the only file
+requiring changes.
+
+How to change this file:
+ * locate the operating system and implementation definitions;
+ they are surrounded by "=====" comment strings.
+ * comment out the definitions you do not want, and select the
+ ones for your system
+ * if adding a new operating system, create a new symbol OS_xxx
+ for it and add a new #if OS_xxx ... #endif section for its
+ changes.
+ * if adding a new implementation for an existing operating
+ system, create a new symbol for it and add appropriate
+ conditionals inside its #if OS_xxx ... #end section.
+ * if you must replace a standard C library function, replace
+ instances of its use in the source code with an upper-case
+ equivalent (e.g. ungetc --> UNGETC), then define the
+ upper-case name below in the generic section, plus the
+ operating-system section.
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+List of symbols actually used for #if's [14-Aug-87]
+
+Flags and strings:
+ ALLOW_INTERRUPT -- allow interactive interrupt
+ ANSI_PROTOTYPES -- draft ANSI C function prototype declarations are
+ supported
+ ANSI_LIBRARY -- draft ANSI C library functions conformance
+ ARITHRSHIFT -- implementation uses arithmetic (not logical) right
+ shift
+ DVIHELP -- how to find documentation (for usage())
+ DVIPREFIX -- prefix to standard 3-character extension of output
+ and log files
+ FASTZERO -- fast bitmap zeroing by external assembly language
+ routine
+ FONTLIST -- font type search list (PK, GF, PXL)
+ FONTPATH -- font directory path
+ HIRES -- high resolution variant of bitmap output
+ HOST_WORD_SIZE -- host integer word size in bits
+ PS_MAXWIDTH -- approximate line width limit for PostScript output
+ PS_SHORTLINES -- shorter output lines in PostScript
+ PS_XONXOFFBUG -- PostScript version 23.0 Xon/Xoff bug workaround
+ PXLID -- TeX PXL file ID
+ RB_OPEN -- fopen() mode flags for binary read
+ SEGMEM -- segmented memory (Intel); bitmap is raster vector
+ STDRES -- standard resolution (200 dpi)
+ SUBPATH -- substitution font file path
+ TEXFONTS -- TeX font file path environment variable
+ TEXINPUTS -- TeX input file path environment variable
+ USEGLOBALMAG -- allow runtime global magnification scaling
+ VIRTUAL_FONTS -- implement virtual font caching
+ WB_OPEN -- fopen() mode flags for binary write
+ ZAPTHISOUT -- remove some obsolete code
+
+Alternate library routines for misfeature workarounds (these have the
+same names as standard library routines, but upper-cased):
+ EXIT
+ FOPEN
+ FSEEK
+ FTELL
+ GETENV
+ MALLOC(n)
+ READ
+ REWIND(fp)
+ UNGETC
+
+C Implementations:
+ ATT -- AT&T Unix (System III, V)
+ BSD41 -- Berkeley 4.1BSD
+ BSD42 -- Berkeley 4.2BSD
+ HPUX -- HP 9000 series Unix (System V based)
+ IBM_PC_LATTICE -- IBM PC Lattice C compiler
+ IBM_PC_MICROSOFT-- IBM PC Microsoft Version 3.x or later C compiler
+ IBM_PC_WIZARD -- IBM PC Wizard C compiler
+ KCC_20 -- SRI's KCC Compiler on TOPS-20
+ PCC_20 -- Portable C Compiler on TOPS-20
+
+Operating systems:
+ OS_ATARI -- Atari 520ST+ TOS (similar to MS DOS)
+ OS_PCDOS -- IBM (and clones) PC DOS and MS DOS
+ OS_TOPS20 -- DEC-20 TOPS-20
+ OS_UNIX -- Unix (almost any variant)
+ OS_VAXVMS -- VAX VMS
+
+Device names (defined in each DVIxxx.C file):
+ APPLEIMAGEWRITER -- Apple ImageWriter printer
+ BBNBITGRAPH -- BBN BitGraph terminal
+ CANON_A2 -- Canon LBP-8 A2 laser printer
+ DECLA75 -- DEC LA75 printer
+ DECLN03PLUS -- DEC LN03-PLUS laser printer
+ EPSON -- Epson 9-pin family dot-matrix printer
+ GOLDENDAWNGL100 -- Golden Dawn GL100 laser printer
+ HPJETPLUS -- Hewlett-Packard Laser Jet Plus (downloaded fonts)
+ HPLASERJET -- Hewlett-Packard Laser Jet (bitmap display)
+ IMPRESS -- imPRESS (IMAGEN laser printer)
+ MPISPRINTER -- MPI Sprinter printer
+ OKIDATA2410 -- OKIData 2410 printer
+ POSTSCRIPT -- Adobe PostScript (Apple LaserWriter laser printer)
+ PRINTRONIX -- Printronix (DEC LXY-11, C-Itoh) printer
+ TOSHIBAP1351 -- Toshiba P-1351 dot matrix printer
+
+***********************************************************************/
+
+/**********************************************************************
+Define all symbols for devices, operating systems, and implementations
+to be explicitly 0, unless it is expected that they might be set at
+compile time.
+***********************************************************************/
+
+#define ALLOW_INTERRUPT 0
+#define ANSI_PROTOTYPES 0
+
+#ifndef ANSI_LIBRARY /* may be specified at compile time */
+#define ANSI_LIBRARY 0
+#endif
+
+#if ANSI_LIBRARY
+#undef ANSI_PROTOTYPES
+#define ANSI_PROTOTYPES 1 /* If library conforms, declarations do too */
+#endif
+
+#define ARITHRSHIFT 1 /* most C compilers use arithmetic right shift */
+#define DISKFULL(fp) (ferror(fp) && (errno == ENOSPC))
+#define DVIEXT ".dvi"
+#define DVIPREFIX "dvi-"
+#define EXIT exit
+#define FASTZERO 0
+
+/* The following definitions work for at least PCC-20, BSD 4.2 and 4.3,
+and HPUX; VAX VMS has an extra level of indirection. Check the
+definition of fileno(fp) in stdio.h; on PCC-20, it is
+ #define fileno(p) ((p)->_file)
+*/
+#define FILE_CNT(fp) (fp)->_cnt
+#define FILE_BASE(fp) (fp)->_base
+#define FILE_PTR(fp) (fp)->_ptr
+
+/* #define FONTLIST 0 -- can be set at compile time */
+/* #define FONTPATH 0 -- can be set at compile time */
+
+#define FOPEN fopen
+#define FSEEK fseek
+#define FTELL ftell
+#define GETENV getenv
+#define HIRES 0
+#define MALLOC(n) malloc(n)
+#define MAXDRIFT 2 /* we insist that
+ abs|(hh-pixel_round(h))<=MAXDRIFT| */
+
+/* MAXOPEN should be 6 less than the system limit on open files,
+allowing for files open on stdin, stdout, stderr, .dvi, .dvi-log,
+.dvi-xxx, plus MAXOPEN font files. It may be additionally limited by
+the amount of memory available for buffers (e.g. IBM PC). */
+#define MAXOPEN 14
+
+/* #define PS_MAXWIDTH 72 -- can be set at compile time */
+
+/* #define PS_SHORTLINES 0 -- can be set at compile time */
+
+#define PS_XONXOFFBUG 0
+#define PXLID 0
+#define RB_OPEN "r"
+
+/* For virtual font caching to succeed, read() must return the requested
+number of bytes, and preferably do this with one system call and no
+double buffering. */
+
+#define READ read
+
+/* In many implementations, rewind(fp) is defined as equivalent to
+fseek(fp,0L,0). In some, however (e.g. PCC-20, and probably others
+based on PCC), it additionally discards input buffer contents, which may
+cause unnecessary I/O, and in the case of virtual font caching, clears
+the cache. Defining it in terms of fseek() should be okay, but the
+implementation of fseek() should be checked. */
+
+#define REWIND(fp) FSEEK(fp,0L,0)
+
+#define SEGMEM 0 /* may be reset by dvixxx for big bitmaps */
+#define STDRES 0
+
+/* #define SUBPATH 0 -- can be set at compile time */
+
+#define SUBEXT ".sub"
+#define SUBNAME "texfonts"
+
+/* #define TEXFONTS 0 -- can be set at compile time */
+/* #define TEXINPUTS 0 -- can be set at compile time */
+
+#define UNGETC ungetc
+#define USEGLOBALMAG 0
+#define WB_OPEN "w"
+#define ZAPTHISOUT 0
+
+
+/**********************************************************************/
+/* Clear all implementation/operating-system flags--reset later */
+
+#define ATT 0 /* define zero or one of these */
+#define BSD41 0
+#define BSD42 0
+#define HPUX 0
+#define IBM_PC_LATTICE 0
+#define IBM_PC_MICROSOFT 0
+#define IBM_PC_WIZARD 0
+#define KCC_20 0
+#define PCC_20 0
+
+#define OS_ATARI 0 /* define one of these */
+#define OS_PCDOS 0
+#define OS_TOPS20 0
+#define OS_UNIX 0
+#define OS_VAXVMS 0
+
+#define APPLEIMAGEWRITER 0 /* one will be defined by DVIxxx */
+#define BBNBITGRAPH 0
+#define CANON_A2 0
+#define DECLA75 0
+#define DECLN03PLUS 0
+#define EPSON 0
+#define GOLDENDAWNGL100 0
+#define HPJETPLUS 0
+#define HPLASERJET 0
+#define IMPRESS 0
+#define MPISPRINTER 0
+#define OKIDATA2410 0
+#define POSTSCRIPT 0
+#define PRINTRONIX 0
+#define TOSHIBAP1351 0
+#define VIRTUAL_FONTS 0
+
+
+/***********************************************************************
+Define operating system and implementation here. Since these have all
+been explicitly set to 0 above, we issue #undef's to avoid compiler
+macro redefinition warning messages.
+***********************************************************************/
+
+/*====================
+#undef PCC_20
+#undef OS_TOPS20
+#define PCC_20 1
+#define OS_TOPS20 1
+====================*/
+
+/*====================
+#undef KCC_20
+#undef OS_TOPS20
+#define KCC_20 1
+#define OS_TOPS20 1
+====================*/
+
+/*====================
+#undef OS_ATARI
+#define OS_ATARI 1
+====================*/
+
+/*====================
+#undef IBM_PC_LATTICE
+#undef OS_PCDOS
+#define IBM_PC_LATTICE 1
+#define OS_PCDOS 1
+====================*/
+
+
+#undef IBM_PC_MICROSOFT
+#undef OS_PCDOS
+#define IBM_PC_MICROSOFT 1
+#define OS_PCDOS 1
+
+
+/*====================
+#undef IBM_PC_WIZARD
+#undef OS_PCDOS
+#define IBM_PC_WIZARD 1
+#define OS_PCDOS 1
+====================*/
+
+/*====================
+#undef OS_VAXVMS
+#define OS_VAXVMS 1
+====================*/
+
+#if (OS_ATARI | OS_PCDOS | OS_TOPS20 | OS_UNIX | OS_VAXVMS)
+#else
+#undef OS_UNIX
+#define OS_UNIX 1 /* provide default operating system */
+#endif
+
+
+/**********************************************************************/
+
+#if OS_ATARI
+
+#undef BSD42
+#define BSD42 1
+
+#undef DISKFULL
+#define DISKFULL(fp) ferror(fp)
+
+#define DVIHELP "type e:\\tex\\dvi.hlp"
+
+#ifdef FONTLIST /* can be set at compile time */
+#else
+#define FONTLIST "PK-GF-PXL" /* preferred search order */
+#endif /* FONTLIST */
+
+#ifdef FONTPATH /* can be set at compile time */
+#else
+#define FONTPATH "e:\\tex\\fonts\\"
+#endif
+
+#define HOST_WORD_SIZE 32 /* must be 32 or larger -- used in */
+ /* signex to pack 8-bit bytes back */
+ /* into integer values, and in dispchar */
+ /* and fillrect for managing character */
+ /* raster storage. */
+#define MAXFNAME 64 /* longest host complete filename */
+
+#ifndef PS_MAXWIDTH
+#define PS_MAXWIDTH 72
+#endif
+
+#ifndef PS_SHORTLINES
+#define PS_SHORTLINES 1
+#endif
+
+#ifdef SUBPATH /* can be set at compile time */
+#else
+#define SUBPATH "e:\\tex\\inputs\\"
+#endif
+
+#ifdef TEXINPUTS /* can be set at compile time */
+#else
+#define TEXINPUTS "TEXINPUTS"
+#endif
+
+#define TEXFONTS "TEXFONTS"
+
+#endif /* OS_ATARI */
+
+
+/**********************************************************************/
+
+#if OS_PCDOS
+
+#if IBM_PC_MICROSOFT
+#undef ANSI_PROTOTYPES
+#define ANSI_PROTOTYPES 1
+
+/*
+Argument type checking in MSC Version 4.0 is selected by LINT_ARGS.
+MSC Version 5.0 has it selected by default. For Version 5.0,
+ANSI_LIBRARY should be defined at compile time so as to get
+ANSI-conformant library function declarations.
+Treating float as double eliminates lots of data conversion warnings with
+both Versions 4.0 and 5.0.
+*/
+#define float double
+#define LINT_ARGS 1
+
+#undef MALLOC
+#define MALLOC(n) calloc(n,1)
+#endif /* IBM_PC_MICROSOFT */
+
+#define DVIHELP "type d:\\tex\\dvi.hlp"
+
+#undef DVIPREFIX
+#define DVIPREFIX ""
+
+#ifdef FONTLIST /* can be set at compile time */
+#else
+#define FONTLIST "PK-GF-PXL" /* preferred search order */
+#endif /* FONTLIST */
+
+#ifdef FONTPATH /* can be set at compile time */
+#else
+#define FONTPATH "d:\\tex\\fonts\\"
+#endif /* FONTPATH */
+
+#define HOST_WORD_SIZE 32 /* must be 32 or larger -- used in */
+ /* signex to pack 8-bit bytes back */
+ /* into integer values, and in dispchar */
+ /* and fillrect for managing character */
+ /* raster storage. */
+#define MAXFNAME 64 /* longest host complete filename */
+
+#undef MAXOPEN
+#define MAXOPEN 5 /* limit on number of open font files */
+
+#ifndef PS_MAXWIDTH
+#define PS_MAXWIDTH 72
+#endif
+
+#ifndef PS_SHORTLINES
+#define PS_SHORTLINES 1
+#endif
+
+#undef RB_OPEN
+#define RB_OPEN "rb"
+
+#ifdef SUBPATH /* can be set at compile time */
+#else
+#define SUBPATH "d:\\tex\\inputs\\"
+#endif
+
+#if TEXINPUTS /* can be set at compile time */
+#else
+#define TEXINPUTS "TEXINPUTS"
+#endif
+
+#define TEXFONTS "TEXFONTS"
+
+#if IBM_PC_MICROSOFT
+#undef VIRTUAL_FONTS
+#define VIRTUAL_FONTS 1
+#endif
+
+#undef WB_OPEN
+#define WB_OPEN "wb"
+
+#endif /* OS_PCDOS */
+
+
+/***********************************************************************/
+#if OS_TOPS20
+
+/************************************************************************
+**
+** Adapted for the DEC-20 TOPS-20 operating system with Jay Lepreau's
+** PCC-20 by Nelson H.F. Beebe, College of Science Computer,
+** University of Utah, Salt Lake City, UT 84112, Tel: (801) 581-5254.
+**
+** The PCC_20 switch is used to get around variations on the DEC-20.
+** The major one is that text files have 7-bit bytes, while the .DVI
+** file and the font files have 8-bit bytes. For the latter, we use a
+** routine f20open which provides the necessary interface for opening
+** with a ddifferent byte size. PCC-20 follows many other C compilers
+** in that only the first 8 characters of identifiers are looked at, so
+** massive substitutions were necessary in the file commands.h to
+** shorten the long names there.
+**
+** The PCC_20 switch is also used to get variant font directory names
+** and to select TOPS-20 jsys code. TOPS-20 is a wonderous operating
+** system with capabilities far beyond most of its contemporaries.
+** Like Topsy, it just grew, and consequently, its many capabilities
+** are not well integrated. The terminal control jsys'es (MTOPR,
+** RFMOD, SFMOD, STPAR, RFCOC, SFCOC and TLINK) are particularly poorly
+** done -- RFMOD returns the JFN mode word, particular bits of which
+** must be set by SFMOD, STPAR, and TLINK. Why could there not be a
+** "return the terminal state" and "restore the terminal state"
+** jsys'es? Some of this may in fact be already integrated into the
+** PCC-20 C run-time library, but since it is totally undocumented (an
+** all-too common problem with C), it is essentially unusable in that
+** form.
+**
+** The OS_TOPS20 switch is used in one place to get ioctl.h included at
+** the right point, and in several places to get error messages output
+** with Tops-20 conventions in column 1: query (?) causes batch job
+** abort, percent (%) flags a warning.
+**
+***********************************************************************/
+
+#if KCC_20
+/* KCC wants all #if symbols defined before use. */
+#ifndef FONTLIST
+#define FONTLIST "PK-GF-PXL"
+#endif
+
+#ifndef FONTPATH
+#define FONTPATH "TEXFONTS:"
+#endif
+
+#ifndef SUBPATH
+#define SUBPATH "TEXINPUTS:"
+#endif
+
+#ifndef TEXFONTS
+#define TEXFONTS "TEXFONTS:"
+#endif
+
+#ifndef TEXINPUTS
+#define TEXINPUTS "TEXINPUTS:"
+#endif
+
+#undef VIRTUAL_FONTS
+#define VIRTUAL_FONTS 0 /* cannot support this yet */
+
+#endif
+
+#if KCC_20
+#include <jsys.h>
+/* KCC-20 and PCC-20 have similar enough JSYS interfaces that we just
+define values for KCC-20 using PCC-20 names. */
+#define JSchfdb CHFDB
+#define JSmtopr MTOPR
+#define JSrfcoc RFCOC
+#define JSrfmod RFMOD
+#define JSsfcoc SFCOC
+#define JSsfmod SFMOD
+#define JSsti STI
+#define JSstpar STPAR
+#define JStlink TLINK
+#define Getmask(name) ( 1?name )
+#define Getshift(name) ( 0?name )
+#define Absmask(name) ( (1?name) << (0?name) ) /* maybe use this one */
+#define Value(name) ( (1?name) << (0?name) ) /* maybe use this one */
+#define makefield(name, value) ( ((value) & Getmask(name)) << Getshift(name) )
+#define getfield(var, name) ( (var) >> Getshift(name) & Getmask(name) )
+#define setfield(var, name, value) ( (var) = ((var) & ~Absmask(name)) |\
+ makefield(name, value) )
+#endif
+
+#if PCC_20
+#undef ARITHRSHIFT
+#define ARITHRSHIFT 0 /* PCC-20 uses logical right shift */
+#undef DISKFULL
+#define DISKFULL(fp) ferror(fp) /* PCC-20 does not always set errno */
+#endif
+
+#define DVIHELP "help dvi\nor\ntype hlp:dvi.hlp\nor\nxinfo local clsc dvi"
+
+#if PCC_20
+#undef FASTZERO
+#define FASTZERO 1 /* for fast assembly language memory zeroing */
+#endif
+
+#ifdef FONTLIST /* can be set at compile time */
+#else
+#define FONTLIST "PK-GF-PXL" /* preferred search order */
+#endif /* FONTLIST */
+
+#ifdef FONTPATH /* can be set at compile time */
+#else
+#define FONTPATH "/texfonts/"
+#endif
+
+#undef FOPEN
+#define FOPEN f20open /* private version for 8-bit binary */
+
+#define HOST_WORD_SIZE 36
+
+#undef MAXFNAME
+#define MAXFNAME 256 /* longest host complete filename */
+
+#ifdef KCC_20
+#undef MAXOPEN
+#define MAXOPEN 26
+#endif
+
+#ifdef PCC_20
+#undef MAXOPEN
+#define MAXOPEN 14
+#endif
+
+#ifndef PS_MAXWIDTH
+#define PS_MAXWIDTH 72
+#endif
+
+#ifndef PS_SHORTLINES
+#define PS_SHORTLINES 1
+#endif
+
+#undef RB_OPEN
+#define RB_OPEN "rb"
+
+#ifdef PCC_20
+#undef READ
+#define READ _read /* fast version with one system call */
+#endif
+ /* and single buffering */
+#ifdef SUBPATH
+#else
+#define SUBPATH "/texinputs/"
+#endif
+
+#ifdef TEXFONTS /* can be set at compile time */
+#else
+#define TEXFONTS "TEXFONTS"
+#endif
+
+#ifdef TEXINPUTS /* can be set at compile time */
+#else
+#define TEXINPUTS "TEXINPUTS"
+#endif
+
+#if PCC_20
+#undef VIRTUAL_FONTS
+#define VIRTUAL_FONTS 1
+#endif
+
+#undef WB_OPEN
+#define WB_OPEN "wb"
+
+/**********************************************************************/
+/* The following definitions (down to the endif) are taken from */
+/* monsym.h. It is too big for CPP to handle, so this kludge is */
+/* necessary until CPP's tables can be enlarged. */
+
+/* selected fields for CHFDB% */
+#define CF_nud 01:35-0 /* no update directory */
+#define CF_dsp 0777:35-17 /* fdb displacement */
+#define CF_jfn 0777777:35-35 /* jfn */
+
+#define FBbyv 011 /* retention+bytesize+mode,,# of pages*/
+#define FB_ret 077:35-5 /* retention count */
+
+
+/* tty mode definitions */
+
+#define MOrlw 030 /* read width */
+#define MOslw 031 /* set width */
+#define MOrll 032 /* read length */
+#define MOsll 033 /* set length */
+
+#define MOsnt 034 /* set tty non-terminal status */
+#define MOsmn 01 /* no system messages(i.e. suppress) */
+#define MOsmy 00 /* yes system messages(default) */
+#define MOrnt 035 /* read tty non-terminal status */
+
+/* fields of jfn mode word */
+
+#define TT_osp 01:35-0 /* output suppress */
+#define TT_mff 01:35-1 /* mechanical formfeed present */
+#define TT_tab 01:35-2 /* mechanical tab present */
+#define TT_lca 01:35-3 /* lower case capabilities present */
+#define TT_len 0177:35-10 /* page length */
+#define TT_wid 0177:35-17 /* page width */
+#define TT_wak 017:35-23 /* wakeup field */
+#define TT_wk0 01:35-18 /* wakeup class 0 (unused) */
+#define TT_ign 01:35-19 /* ignore tt_wak on sfmod */
+#define TT_wkf 01:35-20 /* wakeup on formating control chars */
+#define TT_wkn 01:35-21 /* wakeup on non-formatting controls */
+#define TT_wkp 01:35-22 /* wakeup on punctuation */
+#define TT_wka 01:35-23 /* wakeup on alphanumerics */
+#define TT_eco 01:35-24 /* echos on */
+#define TT_ecm 01:35-25 /* echo mode */
+#define TT_alk 01:35-26 /* allow links */
+#define TT_aad 01:35-27 /* allow advice (not implemented) */
+#define TT_dam 03:35-29 /* data mode */
+#define TTbin 00 /* binary */
+#define TTasc 01 /* ascii */
+#define TTato 02 /* ascii and translate output only */
+#define TTate 03 /* ascii and translate echos only */
+#define TT_uoc 01:35-30 /* upper case output control */
+#define TT_lic 01:35-31 /* lower case input control */
+#define TT_dum 03:35-33 /* duplex mode */
+#define TTfdx 00 /* full duplex */
+#define TT0dx 01 /* not used, reserved */
+#define TThdx 02 /* half duplex (character) */
+#define TTldx 03 /* line half duplex */
+#define TT_pgm 01:35-34 /* page mode */
+#define TT_car 01:35-35 /* carrier state */
+
+/* tlink */
+
+#define TL_cro 01:35-0 /* clear remote to object link */
+#define TL_cor 01:35-1 /* clear object to remote link */
+#define TL_eor 01:35-2 /* establist object to remote link */
+#define TL_ero 01:35-3 /* establish remote to object link */
+#define TL_sab 01:35-4 /* set accept bit for object */
+#define TL_abs 01:35-5 /* accept bit state */
+#define TL_sta 01:35-6 /* set or clear advice */
+#define TL_aad 01:35-7 /* accept advice */
+#define TL_obj 0777777:35-35 /* object designator */
+
+#endif /* OS_TOPS20 */
+
+/**********************************************************************/
+
+#if OS_UNIX
+
+#undef BSD42
+#define BSD42 1 /* want DVISPOOL code in dviterm.h */
+
+#define DVIHELP "man dvi\nor\napropos dvi"
+
+#ifdef FONTLIST /* can be set at compile time */
+#else
+#define FONTLIST "PK-GF-PXL" /* preferred search order */
+#endif /* FONTLIST */
+
+#ifdef FONTPATH /* can be set at compile time */
+#else
+#define FONTPATH "/usr/lib/tex/fonts/"
+#endif
+
+#undef MAXOPEN
+
+#if HPUX
+#define MAXFNAME 1024 /* longest host complete filename */
+#define MAXOPEN 50
+#else /* NOT HPUX */
+#define MAXFNAME 256 /* longest host complete filename */
+#define MAXOPEN 14
+#endif /* HPUX */
+
+#ifndef PS_MAXWIDTH
+#define PS_MAXWIDTH 72
+#endif
+
+#ifndef PS_SHORTLINES
+#define PS_SHORTLINES 1 /* some Unix utilities fail with long lines */
+#endif
+
+#ifdef SUBPATH /* can be set at compile time */
+#else
+#define SUBPATH "/usr/lib/tex/macros/"
+#endif
+
+#if TEXINPUTS /* can be set at compile time */
+#else
+#define TEXINPUTS "TEXINPUTS"
+#endif
+
+#if TEXFONTS /* can be set at compile time */
+#else
+#define TEXFONTS "TEXFONTS"
+#endif
+
+#define HOST_WORD_SIZE 32 /* must be 32 or larger -- used in */
+ /* signex to pack 8-bit bytes back */
+ /* into integer values, and in dispchar */
+ /* and fillrect for managing character */
+ /* raster storage. */
+#endif /* OS_UNIX */
+
+
+/**********************************************************************/
+
+#if OS_VAXVMS
+
+/***********************************************************************
+** Several standard Unix library functions do not work properly with VMS
+** C, or are not implemented:
+**
+** exit() -- wrong conventions for return code
+** fseek() -- fails on record-oriented files
+** ftell() -- fails on record-oriented files
+** getchar() -- waits for <CR> to be typed
+** getenv() -- colon- and case-sensitive
+** getlogin() -- not implemented
+** qsort() -- not implemented
+** tell() -- not implemented
+** ungetc() -- fails for any character with high-order bit set
+** unlink() -- not implemented (equivalent available)
+**
+** The file VAXVMS.C contains workarounds; it must be compiled
+** separately and loaded with each of the DVI drivers.
+***********************************************************************/
+
+#include <jpidef.h> /* need for getjpi() in openfont() */
+
+#define DVIHELP "help dvi\nor\ntype tex_inputs:dvi.hlp"
+#define EXIT vms_exit
+
+#define FILE_CNT(fp) (*fp)->_cnt
+#define FILE_BASE(fp) (*fp)->_base
+#define FILE_PTR(fp) (*fp)->_ptr
+
+#ifndef FONTLIST /* can be set at compile time */
+#define FONTLIST "PK-GF-PXL" /* preferred search order */
+#endif /* FONTLIST */
+
+#ifndef FONTPATH /* can be set at compile time */
+#define FONTPATH "TEX_FONTS:" /* Kellerman & Smith VMS TeX */
+#endif /* FONTPATH */
+
+#define FSEEK vms_fseek
+#define FTELL vms_ftell
+#define GETENV vms_getenv
+#define HOST_WORD_SIZE 32 /* must be 32 or larger -- used in */
+ /* signex to pack 8-bit bytes back */
+ /* into integer values, and in dispchar */
+ /* and fillrect for managing character */
+ /* raster storage. */
+
+#define MAXFNAME 256 /* longest host complete filename */
+
+#undef MAXOPEN
+#define MAXOPEN 14
+
+#undef RB_OPEN
+#define RB_OPEN "rb"
+
+#ifndef PS_MAXWIDTH
+#define PS_MAXWIDTH 72
+#endif
+
+#ifndef PS_SHORTLINES
+#define PS_SHORTLINES 1 /* VMS has trouble with long lines */
+#endif
+
+#define READ vms_read /* ordinary read() returns only one disk */
+ /* at each call */
+
+#ifndef SUBPATH /* can be set at compile time */
+#define SUBPATH "TEX_INPUTS:" /* Kellerman & Smith VMS TeX */
+#endif
+
+#ifndef TEXINPUTS /* can be set at compile time */
+#define TEXINPUTS "TEX_INPUTS:"
+#endif
+
+#ifndef TEXFONTS /* can be set at compile time */
+#define TEXFONTS "TEX_FONTS:"
+#endif
+
+#define UNGETC vms_ungetc
+
+/* VIRTUAL_FONTS cannot be implemented yet. The code works, but the
+calls to FSEEK() (vms_seek) result in _filbuf() being called to refill
+the buffer, obviating the pre-buffering. Additional code in case 0 of
+vms_seek() can probably be developed to avoid this, but I have run out
+of time for now. */
+
+#undef WB_OPEN
+#define WB_OPEN "wb"
+
+#endif /* OS_VAXVMS */
+
+/**********************************************************************/
diff --git a/dviware/beebe/src/main.h b/dviware/beebe/src/main.h
new file mode 100644
index 0000000000..e99781e0b0
--- /dev/null
+++ b/dviware/beebe/src/main.h
@@ -0,0 +1,199 @@
+/* -*-C-*- main.h */
+/*-->main*/
+/**********************************************************************/
+/******************************** main ********************************/
+/**********************************************************************/
+
+/**********************************************************************/
+/*********************** External Definitions ***********************/
+/**********************************************************************/
+
+#if KCC_20
+#include <file.h>
+#endif /* KCC_20 */
+
+#if PCC_20 /* this stuff MUST be first */
+
+#undef tops20 /* to keep definitions alive */
+#include <ioctl.h> /* PCC-20 does not have this in */
+ /* the others */
+#include <file.h> /* need for f20open flags and */
+ /* JSYS stuff */
+#define tops20 1 /* define for tops-20 */
+#endif /* PCC_20 */
+
+#include "commands.h"
+#include <ctype.h>
+#include <math.h>
+
+#if BBNBITGRAPH
+#if (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT)
+ /* not available */
+#else /* NOT (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT) */
+#include <signal.h>
+#endif /* (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT) */
+#endif /* BBNBITGRAPH */
+
+#if OS_UNIX
+#if BSD42
+
+#include <sys/ioctl.h> /* need for DVISPOOL in dviterm.h */
+
+#ifndef _NFILE
+/* VAX VMS, NMTCC, PCC-20, and HPUX have _NFILE in stdio.h. V7 called
+it NFILE, and Posix calls it OPEN_MAX. KCC-20 calls it SYS_OPEN. VAX
+4.3BSD and Gould UTX/32 don't define _NFILE in stdio.h; they use
+NOFILE from sys/param.h. Sigh.... */
+#include <sys/param.h>
+#ifdef NOFILE
+#define _NFILE NOFILE /* need for gblvars.h */
+#else
+#define _NFILE MAXOPEN /* use our font limit value */
+#endif
+#endif
+
+#endif /* BSD42 */
+#endif /* OS_UNIX */
+
+
+
+#include "gendefs.h"
+
+#if DECLA75
+#undef STDMAG
+
+#if STDRES
+#define STDMAG 720
+#else /* NOT STDRES */
+#define STDMAG 720
+#endif /* STDRES */
+
+#endif /* DECLA75 */
+
+#if DECLN03PLUS
+#undef STDMAG
+
+#if STDRES
+#define STDMAG 1500
+#else /* NOT STDRES */
+#define STDMAG 750
+#endif /* STDRES */
+
+#endif /* DECLN03PLUS */
+
+#if EPSON
+#undef STDMAG
+
+#if STDRES
+#define STDMAG 1200 /* use 240dpi fonts */
+#else /* NOT STDRES */
+#define STDMAG 603 /* 1500 * 1.2**(-5) */
+#endif /* STDRES */
+
+#endif /* EPSON */
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+#undef STDMAG
+
+#if STDRES
+#define STDMAG 1500 /* 300 dpi Canon LBP-CX print engine */
+#else /* NOT STDRES */
+#define STDMAG 1440 /* near value in 1000*1.2**n family */
+#endif /* STDRES */
+
+#endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+#if TOSHIBAP1351 /* want to override STDMAG */
+#undef STDMAG
+
+#if STDRES
+#define STDMAG 868 /* 1500 * 1.2**(-3) */
+#else /* NOT STDRES */
+#define STDMAG 833 /* 1000 * 1.2**(-1) */
+#endif /* STDRES */
+
+#endif /* TOSHIBAP1351 */
+
+#include "gblprocs.h"
+
+#include "gblvars.h"
+
+#if BBNBITGRAPH
+#include "keydef.h"
+#endif /* BBNBITGRAPH */
+
+#if OS_ATARI
+long _stksize = 20000L; /* make the stack a bit larger than 2KB */
+ /* number must be even */
+#endif /* OS_ATARI */
+
+
+/**********************************************************************/
+/******************************* main *******************************/
+/**********************************************************************/
+
+int
+main(argc, argv)
+int argc;
+char *argv[];
+{
+ register int k; /* loop index */
+ register int file_args; /* count of file arguments */
+
+
+ (void)strcpy(g_progname, argv[0]); /* save program name */
+
+ (void)initglob(); /* do this before argc check! */
+
+#if OS_UNIX
+ /* On Unix, we allow filtering of stdin to stdout */
+#else /* NOT OS_UNIX */
+ if (argc < 2)
+ {
+ (void)usage(stderr);
+ (void)EXIT(1);
+ }
+#endif /* OS_UNIX */
+
+ for (k = 1; k < argc; ++k)
+ {
+ if (*argv[k] == '-') /* -switch */
+ (void)option(argv[k]);
+ }
+
+ if (!quiet)
+ {
+ (void)fprintf(stderr,"[TeX82 DVI Translator Version %s]",VERSION_NO);
+ NEWLINE(stderr);
+ (void)fprintf(stderr,"[%s]",DEVICE_ID);
+ NEWLINE(stderr);
+ }
+
+ if (npage == 0) /* no page ranges given, make a large one */
+ {
+ page_begin[0] = 1;
+ page_end[0] = 32767; /* arbitrary large integer */
+ page_step[0] = 1;
+ npage = 1;
+ }
+ else /* need font defs from postamble if only some pages to be output */
+ preload = TRUE;
+
+ file_args = 0;
+ for (k = 1; k < argc; ++k)
+ {
+ if (*argv[k] != '-') /* must be file argument */
+ {
+ file_args++;
+ (void)dvifile(argc,argv,argv[k]);
+ }
+ }
+
+#if OS_UNIX
+ if (file_args == 0) /* use stdin/stdout instead */
+ (void)dvifile(argc,argv,"");
+#endif
+
+ (void)alldone(); /* this will never return */
+ return (0); /* never executed; avoid compiler warnings */
+}
diff --git a/dviware/beebe/src/makefile b/dviware/beebe/src/makefile
new file mode 100644
index 0000000000..a04deee093
--- /dev/null
+++ b/dviware/beebe/src/makefile
@@ -0,0 +1,524 @@
+# Makefile for MicroSoft C version 4.0 and 5.0 for DVI driver family
+#
+# Targets:
+# all (build dvi*.exe)
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops texidx
+# clean (all but .exe files)
+# clean_all (including .exe files)
+# clean_exe
+# clean_dvi
+# clean_cer
+# clean_sym
+# clean_obj
+#
+# [15-Nov-87] -- merged separate makefiles for MicroSoft C into one, now
+# that MAKE has been rebuilt with MSC instead of Wizard C
+# and is finally big enough to handle a large makefile.
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo" to build
+# dvifoo); add XCFLAGS to allow extra compile-time options
+# without having to respecify the long path variables
+# Targets for command-line requests...
+
+CC = cl
+
+XCFLAGS=
+
+PCFLAGS = -DOS_PCDOS -DIBM_PC_MICROSOFT
+
+# MSC Version 3.0
+# CFLAGS=/AL/Zd/Od/W2
+# MSC Version 4.0 -- add CodeView debugging option /Zi
+# CFLAGS=/AL/Zd/Od/W2/Zi/DLINT_ARGS$(XCFLAGS)
+# MSC Version 5.0 (needs spaces between options); MSC5 needed in gblprocs.h
+#CFLAGS= -AL -Zd -Oailt -W3 -Zi -DANSI_LIBRARY $(XCFLAGS)
+CFLAGS= -AL -Zd -Od -W3 -Zi -DANSI_LIBRARY $(XCFLAGS)
+
+# Loading this first will give wildcard expansion
+# where the MSC library is found
+DRIVE = C:
+MSCWILD=$(DRIVE)\SYS\MSC\LIB\LSETARGV.OBJ
+
+# Default stack is too small--increase
+STACKSIZE=0xb000
+
+LINKFLAGS=/MAP/LINENUMBERS/ST:$(STACKSIZE)
+
+# Rules...
+
+.c.obj:; $(CC) -c $(CFLAGS) $*.c >$*.clg
+ errshow <$*.clg >$*.cer
+ del $*.clg
+
+.map.sym:; mapsym $*
+ del $*.map
+
+RM = del
+
+# Source, object and executable file extensions
+
+C = .c
+
+O = .obj
+
+X = .exe
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+HFILES = abortrun.h actfact.h alldone.h bitmap.h \
+ chargf.h charpk.h charpxl.h \
+ clrbmap.h clrrow.h commands.h dbgopen.h \
+ dispchar.h dumpchar.h dvifile.h dvihead.h \
+ dviinit.h dviterm.h f20open.h \
+ fatal.h fillrect.h findpost.h fixpos.h \
+ fontfile.h fontsub.h gblprocs.h gblvars.h \
+ gendefs.h getbmap.h getbytes.h getfntdf.h \
+ getpgtab.h inch.h initglob.h keydef.h \
+ loadchar.h machdefs.h main.h movedown.h \
+ moveover.h moveto.h nosignex.h openfont.h \
+ option.h outrow.h prtpage.h prxbmap.h \
+ readfont.h readgf.h readpk.h readpost.h \
+ readpxl.h reldfont.h rulepxl.h setchar.h \
+ setfntnm.h setrule.h signex.h skgfspec.h \
+ skipfont.h skpkspec.h special.h strchr.h \
+ strcm2.h strid2.h strrchr.h tctos.h \
+ typedefs.h usage.h warning.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets for command-line requests...
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops texidx
+
+clean: clean_obj clean_sym clean_cer clean_dvi clean_map
+
+clean_all: clean clean_exe
+
+clean_exe:
+ del dvi*.exe
+ del texidx.exe
+
+clean_dvi:
+ del *.dvi
+
+clean_obj:
+ del dvi*.obj
+ del texidx.obj
+
+clean_map:
+ del dvi*.map
+ del texidx.map
+
+clean_sym:
+ del dvi*.sym
+ del texidx.sym
+
+clean_cer:
+ del dvi*.cer
+ del texidx.cer
+
+# Shorthands for executable targets
+
+00arit: 00arit$(X) 00arit.sym
+
+dvialw: dvialw$(X) dvialw.sym
+
+dvibit: dvibit$(X) dvibit.sym
+
+dvican: dvican$(X) dvican.sym
+
+dvie72: dvie72$(X) dvie72.sym
+
+dvieps: dvieps$(X) dvieps.sym
+
+dvigd: dvigd$(X) dvigd.sym
+
+dviimp: dviimp$(X) dviimp.sym
+
+dvijep: dvijep$(X) dvijep.sym
+
+dvijet: dvijet$(X) dvijet.sym
+
+dvil3p: dvil3p$(X) dvil3p.sym
+
+dvil75: dvil75$(X) dvil75.sym
+
+dvim72: dvim72$(X) dvim72.sym
+
+dvimac: dvimac$(X) dvimac.sym
+
+dvimpi: dvimpi$(X) dvimpi.sym
+
+dvio72: dvio72$(X) dvio72.sym
+
+dvioki: dvioki$(X) dvioki.sym
+
+dvi$(PGM): dvi$(PGM)$(X) dvi$(PGM).sym
+
+dviprx: dviprx$(X) dviprx.sym
+
+dvitos: dvitos$(X) dvitos.sym
+
+keytst: keytst$(X) keytst.sym
+
+lptops: lptops$(X) lptops.sym
+
+texidx: texidx$(X) texidx.sym
+
+# Details for executable targets
+
+00arit$(X):
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=short $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=int $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=long $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+
+dvialw$(X): dvialw$(O) cuseri$(O)
+ link $(MSCWILD) $* cuseri,$*,$(LINKFLAGS);
+
+dvibit$(X): dvibit$(O) keybrd$(O)
+ link $(MSCWILD) $* keybrd,$*,$(LINKFLAGS);
+
+dvican$(X): dvican$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvie72$(X): dvie72$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvieps$(X): dvieps$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvigd$(X): dvigd$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvijep$(X): dvijep$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvijet$(X): dvijet$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dviimp$(X): dviimp$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvil3p$(X): dvil3p$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvil75$(X): dvil75$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvim72$(X): dvim72$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvimac$(X): dvimac$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvimpi$(X): dvimpi$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvio72$(X): dvio72$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvioki$(X): dvioki$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dviprx$(X): dviprx$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+# Generic target (useful for debugging test versions)
+dvi$(PGM)$(X): dvi$(PGM)$(O) cuseri$(O) keybrd$(O)
+ link $(MSCWILD) $* cuseri keybrd,$*,$(LINKFLAGS);
+
+dvitos$(X): dvitos$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+keytst$(X): keytst$(O) keybrd$(O)
+ link $(MSCWILD) $* keybrd,$*,$(LINKFLAGS);
+
+lptops$(X): lptops$(O) cuseri$(O)
+ link $(MSCWILD) $* cuseri,$*,$(LINKFLAGS);
+
+texidx$(X): texidx$(O) qsort$(O)
+ link $(MSCWILD) $* qsort,$*,$(LINKFLAGS);
+
+# File dependencies... NB: A source file NEVER depends on another
+# source file, but an object file depends on a
+# source file and all the #include'd files in
+# that source file.
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h rulepxl.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ strchr.h strcm2.h strid2.h strrchr.h tctos.h\
+ usage.h warning.h
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h rulepxl.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ special.h strchr.h strcm2.h strid2.h strrchr.h\
+ tctos.h usage.h warning.h
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h rulepxl.h setchar.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ special.h strchr.h strcm2.h strid2.h strrchr.h\
+ tctos.h usage.h warning.h
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h rulepxl.h setfntnm.h setrule.h\
+ signex.h skgfspec.h skipfont.h skpkspec.h special.h\
+ strchr.h strcm2.h strid2.h strrchr.h tctos.h\
+ usage.h warning.h
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ prtpage.h readfont.h readgf.h readpk.h readpost.h\
+ readpxl.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dbgopen.h dispchar.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h rulepxl.h setchar.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ special.h strchr.h strcm2.h strid2.h strrchr.h\
+ tctos.h usage.h warning.h
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvim72$(O): dvim72.c \
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h\
+ actfact.h alldone.h chargf.h charpk.h charpxl.h\
+ clrbmap.h clrrow.h dispchar.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h fillrect.h\
+ findpost.h fixpos.h fontfile.h fontsub.h getbmap.h\
+ getbytes.h getfntdf.h getpgtab.h inch.h initglob.h\
+ loadchar.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h outrow.h prtpage.h readfont.h\
+ readgf.h readpk.h readpost.h readpxl.h rulepxl.h\
+ setchar.h setfntnm.h setrule.h signex.h skgfspec.h\
+ skipfont.h skpkspec.h special.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvi$(PGM)$(O): dvi$(PGM).c $(HFILES)
+
+dvitos$(O): dvitos.c $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+# These object files need PCFLAGS, since they do not use machdefs.h to
+# select the operating system and compiler
+
+keybrd$(O): keybrd.c keydef.h
+ $(CC) $(CFLAGS) $(PCFLAGS) keybrd.c >keybrd.clg
+ errshow <keybrd.clg >keybrd.cer
+ del keybrd.clg
+
+keytst$(O): keytst.c keydef.h
+ $(CC) $(CFLAGS) $(PCFLAGS) keytst.c >keytst.clg
+ errshow <keytst.clg >keytst.cer
+ del keytst.clg
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+ $(CC) $(CFLAGS) $(PCFLAGS) lptops.c >lptops.clg
+ errshow <lptops.clg >lptops.cer
+ del lptops.clg
+
+texidx$(O): texidx.c
+ $(CC) $(CFLAGS) $(PCFLAGS) texidx.c >texidx.clg
+ errshow <texidx.clg >texidx.cer
+ del texidx.clg
diff --git a/dviware/beebe/src/movedown.h b/dviware/beebe/src/movedown.h
new file mode 100644
index 0000000000..fbf290ed12
--- /dev/null
+++ b/dviware/beebe/src/movedown.h
@@ -0,0 +1,35 @@
+/* -*-C-*- movedown.h */
+/*-->movedown*/
+/**********************************************************************/
+/****************************** movedown ******************************/
+/**********************************************************************/
+
+void
+movedown(a)
+register INT32 a;
+
+{
+ /* From DVITYPE Version 2.6:
+ "Vertical motion is done similarly [to horizontal motion handled
+ in moveover()], but with the threshold between ``small'' and
+ ``large'' increased by a factor of five. The idea is to make
+ fractions like ``1/2'' round consistently, but to absorb
+ accumulated rounding errors in the baseline-skip moves."
+
+ The one precaution we need to take here is that fontptr can be
+ NULL, which we treat like a large movement. This NULL pointer
+ was used without error on many different machines for 2 years
+ before it was caught on the VAX VMS implementation, which makes
+ memory page 0 inaccessible.
+ */
+ v += a;
+ if ((fontptr == (struct font_entry *)NULL) ||
+ (ABS(a) >= 5*fontptr->font_space))
+ vv = PIXROUND(v, conv) + tmargin;
+ else
+ {
+ vv += PIXROUND(a, conv);
+ vv = fixpos(vv-tmargin,v,conv) + tmargin;
+ }
+}
+
diff --git a/dviware/beebe/src/moveover.h b/dviware/beebe/src/moveover.h
new file mode 100644
index 0000000000..5526e54256
--- /dev/null
+++ b/dviware/beebe/src/moveover.h
@@ -0,0 +1,38 @@
+/* -*-C-*- moveover.h */
+/*-->moveover*/
+/**********************************************************************/
+/****************************** moveover ******************************/
+/**********************************************************************/
+
+void
+moveover(b)
+register INT32 b;
+
+{
+ /* From DVITYPE Version 2.6:
+ "Rounding to the nearest pixel is best done in the manner shown
+ here, so as to be inoffensive to the eye: When the horizontal
+ motion is small, like a kern, |hh| changes by rounding the kern;
+ but when the motion is large, |hh| changes by rounding the true
+ position |h| so that accumulated rounding errors disappear. We
+ allow a larger space in the negative direction than in the
+ positive one, because TeX makes comparatively large backspaces
+ when it positions accents."
+
+ The one precaution we need to take here is that fontptr can be
+ NULL, which we treat like a large movement. This NULL pointer
+ was used without error on many different machines for 2 years
+ before it was caught on the VAX VMS implementation, which makes
+ memory page 0 inaccessible.
+ */
+ h += b;
+ if ((fontptr == (struct font_entry *)NULL) ||
+ ABS(b) >= fontptr->font_space)
+ hh = PIXROUND(h, conv) + lmargin;
+ else
+ {
+ hh += PIXROUND(b, conv);
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
+
diff --git a/dviware/beebe/src/moveto.h b/dviware/beebe/src/moveto.h
new file mode 100644
index 0000000000..42290f6a1a
--- /dev/null
+++ b/dviware/beebe/src/moveto.h
@@ -0,0 +1,16 @@
+/* -*-C-*- moveto.h */
+/*-->moveto*/
+/**********************************************************************/
+/******************************* moveto *******************************/
+/**********************************************************************/
+
+void
+moveto(x,y)
+COORDINATE x,y;
+
+{
+ xcp = x;
+ ycp = y;
+}
+
+
diff --git a/dviware/beebe/src/nosignex.h b/dviware/beebe/src/nosignex.h
new file mode 100644
index 0000000000..2f87b47f1e
--- /dev/null
+++ b/dviware/beebe/src/nosignex.h
@@ -0,0 +1,22 @@
+/* -*-C-*- nosignex.h */
+/*-->nosignex*/
+/**********************************************************************/
+/****************************** nosignex ******************************/
+/**********************************************************************/
+
+UNSIGN32
+nosignex(fp, n) /* return n byte quantity from file fd */
+register FILE *fp; /* file pointer */
+register BYTE n; /* number of bytes (1..4) */
+
+{
+ register UNSIGN32 number; /* number being constructed */
+
+ number = 0;
+ while (n--)
+ {
+ number <<= 8;
+ number |= getc(fp);
+ }
+ return((UNSIGN32)number);
+}
diff --git a/dviware/beebe/src/openfont.h b/dviware/beebe/src/openfont.h
new file mode 100644
index 0000000000..ff785609dd
--- /dev/null
+++ b/dviware/beebe/src/openfont.h
@@ -0,0 +1,324 @@
+/* -*-C-*- openfont.h */
+/*-->openfont*/
+/**********************************************************************/
+/****************************** openfont ******************************/
+/**********************************************************************/
+
+void
+openfont(fontname)
+char *fontname;
+
+/***********************************************************************
+ The original version of this DVI driver reopened the font file each
+ time the font changed, resulting in an enormous number of relatively
+ expensive file openings. This version keeps a cache of up to
+ MAXOPEN open files, so that when a font change is made, the file
+ pointer, fontfp, can usually be updated from the cache. When the
+ file is not found in the cache, it must be opened. In this case,
+ the next empty slot in the cache is assigned, or if the cache is
+ full, the least used font file is closed and its slot reassigned for
+ the new file. Identification of the least used file is based on the
+ counts of the number of times each file has been "opened" by this
+ routine. On return, the file pointer is always repositioned to the
+ beginning of the file.
+
+ If the first open attempt fails, an attempt will be made to use a
+ substitute font, then neighboring magnifications (with the same font
+ name), or substitutes for them.
+***********************************************************************/
+
+{
+ register INT16 i,j,k; /* loop indices */
+ INT16 current;
+ INT16 least_used;
+ INT16 maxopen = MAXOPEN;
+
+#if OS_VAXVMS
+ long *jpi;
+#endif
+
+ struct font_entry *tfontptr;
+ char subfont[MAXFNAME];
+ int submag;
+ char* filelist[MAXFORMATS]; /* pointers to templist[][] */
+ char templist[MAXFORMATS][MAXFNAME];
+
+#if VIRTUAL_FONTS
+ struct stat statbuf; /* so fstat() can get file size */
+ char *p;
+#endif
+
+ if ((pfontptr != (struct font_entry *)NULL) && (pfontptr == fontptr))
+ return; /* we need not have been called */
+
+ for (j = 0; j < MAXFORMATS; ++j) /* initialize fontlist pointers */
+ filelist[j] = &templist[j][0];
+
+#if IBM_PC_MICROSOFT
+ /* This code required rewriting to get around a fatal compiler
+ assertion error occasioned by the code in the #else part */
+ for (current = 1; current <= nopen; ++current)
+ {
+ FILE* pfp;
+
+ pfp = font_files[current].font_id;
+ if (pfp == fontptr->font_file_id)
+ break;
+ }
+#else
+ for (current = 1;
+ (current <= nopen) &&
+ (font_files[current].font_id != fontptr->font_file_id);
+ ++current)
+ ; /* try to find file in open list */
+#endif
+
+ if (current <= nopen) /* file already open, lookup its id */
+ fontfp = font_files[current].font_id;
+ else
+ {
+ /***************************************************************
+ The file was not in list of open files. If the list is not
+ full, add it to the list; otherwise close the least-used file
+ and remove it from the font_entry containing it. Finally, open
+ the file, or its closest neighbor in the magnification family.
+ A warning is issued if no file can be opened. The caller can
+ then proceed with zero font metrics if desired.
+ ***************************************************************/
+
+#if OS_VAXVMS
+ /***************************************************************
+ VAX VMS has many user quotas, one of which is the maximum number
+ of files that can be open, which need have no relation to the
+ number that C permits. If we do not determine the limit at
+ run-time, the drivers may attempt to open too many files, and in
+ such a case, will fail. There are two relevant quotas, FILLM
+ (open file limit), and FILCNT (remaining open file quota). We
+ use the latter, and leave one available file for a possible
+ error log.
+ ***************************************************************/
+
+ jpi = (long*)getjpi(JPI$_FILCNT);
+ if (jpi == (long*)NULL)
+ maxopen = MAXOPEN; /* should never happen */
+ else
+ maxopen = nopen - 1 + *jpi;
+ maxopen = MIN(maxopen,MAXOPEN); /* we have arrays of size MAXFONT */
+ /* so do not exceed that limit */
+#endif /* OS_VAXVMS */
+
+ if (nopen < maxopen) /* just add it to list */
+ current = ++nopen;
+ else /* list full -- find least used file, */
+ { /* close it, and reuse slot for new file */
+ least_used = 1;
+ for (i = 2; i <= maxopen; ++i)
+ if (font_files[least_used].use_count >
+ font_files[i].use_count)
+ least_used = i;
+
+ fontfp = font_files[least_used].font_id;
+ tfontptr = hfontptr;
+ while (tfontptr != (struct font_entry*)NULL)
+ { /* remove file pointer from its font_entry */
+ if (tfontptr->font_file_id == fontfp)
+ {
+ tfontptr->font_file_id = (FILE*)NULL;
+ break;
+ }
+ tfontptr = tfontptr->next;
+ }
+
+#if VIRTUAL_FONTS
+ if (virt_font && (fontfp != (FILE*)NULL))
+ (void)virtfree(fontfp);
+#endif
+
+ (void)fclose(fontfp);
+ fontfp = (FILE*)NULL;
+ current = least_used;
+ }
+ (void)actfact(fontptr->font_mag); /* Get global mag_index */
+
+ fontfp = (FILE*)NULL;
+
+ /***************************************************************
+ Try the requested font, then any substitute font, then for each
+ neighboring magnification from nearest to furthest, try the
+ requested font, and then any substitute font.
+ ***************************************************************/
+
+ for (k = 0; (fontfp == (FILE*)NULL) && (k < MAGTABSIZE); ++k)
+ { /* loop over mag family */
+ for (i = -k; (fontfp == (FILE*)NULL) && (i <= k); i += MAX(1,k+k))
+ { /* try smaller, then larger */
+ if (IN(0,mag_index+i,MAGTABSIZE-1))
+ {
+ (void)fontfile(filelist, ((fontptr->a==0)?fontpath:""),
+ fontname, (int)MAGSIZE(mag_table[mag_index+i]));
+ for (j = 0; (j < MAXFORMATS) && *filelist[j]; ++j)
+ {
+ fontfp = FOPEN(filelist[j],RB_OPEN);
+ DEBUG_OPEN(fontfp,filelist[j],RB_OPEN);
+ if (fontfp != (FILE *)NULL)
+ {
+ strcpy(fontptr->name,filelist[j]);
+ break;
+ }
+ }
+ if ((k > 0) && (fontfp != (FILE*)NULL))
+ {
+ (void)sprintf(message,
+ "Font file [%s [mag %d]] could not be opened.\n\
+---using nearest neighbor [%s [mag %d]] instead.",
+ fontname,(int)MAGSIZE(mag_table[mag_index]),
+ fontptr->name,
+ (int)MAGSIZE(mag_table[mag_index+i]));
+ (void)warning(message);
+ }
+
+ if ((fontfp == (FILE*)NULL) && fontsub(subfont,&submag,
+ fontname,(int)MAGSIZE(mag_table[mag_index+i])))
+ {
+ (void)fontfile(filelist,((fontptr->a==0)?fontpath:""),
+ subfont,(submag ? submag :
+ (int)MAGSIZE(mag_table[mag_index+i])));
+ for (j = 0; (j < MAXFORMATS) && *filelist[j]; ++j)
+ {
+ fontfp = FOPEN(filelist[j],RB_OPEN);
+ DEBUG_OPEN(fontfp,filelist[j],RB_OPEN);
+ if (fontfp != (FILE *)NULL)
+ {
+ strcpy(fontptr->name,filelist[j]);
+ break;
+ }
+ }
+
+ if (fontfp != (FILE*)NULL)
+ {
+ (void)sprintf(message,
+ "Substituting font file [%s [mag %d]] \
+by [%s [mag %d]]",
+ fontname,(int)MAGSIZE(mag_table[mag_index]),
+ fontptr->name,
+ (int)MAGSIZE(mag_table[mag_index+i]));
+ (void)warning(message);
+ }
+ }
+ }
+ } /* end for (i) -- loop over smaller and larger neighbors */
+ } /* end for (k) -- loop over mag family */
+
+ if (fontfp == (FILE*)NULL)
+ {
+ --nopen; /* don't count this failed open */
+ (void)sprintf(message,"Font file [%s [mag %d]] could not be \
+opened; %d font files are open\n\
+Proceeding with zero size characters for this font",
+ fontname,(int)MAGSIZE(mag_table[mag_index]),nopen);
+ (void)warning(message);
+ }
+
+ font_files[current].font_id = fontfp;
+ font_files[current].use_count = 0;
+
+#if VIRTUAL_FONTS
+ /*
+ ****************************************************************
+ This code is implementation-dependent. On many C compilers,
+ FILE points to a struct of the form
+
+ struct _iobuf {
+ char *_ptr; // pointer to next available char
+ int _cnt; // number of chars left in buffer
+ char *_base; // pointer to start of buffer
+ int _flag; // assorted flags
+ int _file; // file number handle
+ }
+
+ To implement virtual fonts, we save the pointers in a private
+ global array, get the file size from fstat(), malloc() a buffer
+ for it, read the entire file in, and replace the pointers in the
+ FILE variable with ones for the new buffer. Just before the
+ file is closed, the space is freed and the old pointers are
+ restored. Although many C implementations use malloc() to get
+ the buffer space in the first place, which would make this
+ saving unnecessary, not all do; see the implementation given in
+ Kernighan and Ritchie "The C Programming Language", p. 168.
+
+ In implementing this code on any new machine, the
+ implementations of fread(), read(), fseek(), and rewind() should
+ be checked to choose the most efficient one (e.g. one system
+ call for entire file read, and no double buffering), and make
+ sure that fseek() and rewind() do not unnecessarily discard
+ input buffer contents. fseek() and rewind() are defined in
+ terms of macros FSEEK() and REWIND() in machdefs.h to facilitate
+ replacement.
+ ****************************************************************
+ */
+ if (virt_font)
+ {
+ virt_save[fileno(fontfp)].base = (char *)NULL;
+ (void)fstat(fileno(fontfp),&statbuf); /* get file size */
+ p = (char *)MALLOC((int)statbuf.st_size); /* get file buffer */
+ if (p != (char *)NULL)
+ {
+ if (READ(fileno(fontfp),p,(int)statbuf.st_size)
+ == (int)statbuf.st_size)
+ { /* read successful */
+ virt_save[fileno(fontfp)].ptr = FILE_PTR(fontfp);
+ virt_save[fileno(fontfp)].cnt = FILE_CNT(fontfp);
+ virt_save[fileno(fontfp)].base = FILE_BASE(fontfp);
+ FILE_PTR(fontfp) = p;
+ FILE_BASE(fontfp) = p;
+ FILE_CNT(fontfp) = (int)statbuf.st_size;
+ }
+ else /* failure */
+ {
+ (void)REWIND(fontfp);
+ (void)free(p); /* free dynamic buffer */
+ }
+ }
+ if (DBGOPT(DBG_FONT_CACHE))
+ {
+ (void)fprintf(stderr,"\nopenfont(): Font file %d [%s] ",
+ (int)fileno(fontfp),fontptr->name);
+ if (p == (char *)NULL)
+ (void)fprintf(stderr,
+ "cannot callocate buffer for entire file\n");
+ else
+ (void)fprintf(stderr,
+ "buffer length 0x%x\told buffer at 0x%lx\t\
+new buffer at 0x%lx\n",
+ (int)statbuf.st_size,
+ (long)virt_save[fileno(fontfp)].base,
+ (long)FILE_BASE(fontfp));
+ }
+ }
+#endif
+
+ } /* end if (file is in open list) */
+
+ pfontptr = fontptr; /* make previous = current font */
+ fontptr->font_file_id = fontfp; /* set file identifier */
+ font_files[current].use_count++; /* update reference count */
+}
+
+#if VIRTUAL_FONTS
+void
+virtfree(fp) /* free buffer space before close */
+FILE *fp;
+{
+ if (virt_font && (fp != (FILE*)NULL) &&
+ (virt_save[fileno(fp)].base != (char *)NULL))
+ {
+ (void)fflush(fp);
+ (void)free(FILE_BASE(fp));
+ FILE_PTR(fp) = virt_save[fileno(fp)].ptr;
+ FILE_CNT(fp) = virt_save[fileno(fp)].cnt;
+ FILE_BASE(fp) = virt_save[fileno(fp)].base;
+ virt_save[fileno(fp)].base = (char *)NULL;
+ }
+}
+#endif
+
diff --git a/dviware/beebe/src/option.h b/dviware/beebe/src/option.h
new file mode 100644
index 0000000000..ae5c160b4b
--- /dev/null
+++ b/dviware/beebe/src/option.h
@@ -0,0 +1,337 @@
+/* -*-C-*- option.h */
+/*-->option*/
+/**********************************************************************/
+/******************************* option *******************************/
+/**********************************************************************/
+
+void
+option(optstr) /* process command-line option */
+char *optstr; /* option string (e.g. "-m1500") */
+{
+ register UNSIGN32 k; /* magnification */
+ register int value; /* converted digit string value */
+ register int m; /* loop index */
+ char *p; /* pointer into optstr */
+ int p1,p2,p3; /* temp values for sscanf() */
+ double fltmag; /* floating-point mag value */
+
+ typedef struct
+ {
+ char* envname;
+ char* envvar;
+ } envstruct;
+
+ static envstruct envlist[] =
+ { /* names and addresses of environment vars (alphabetical order) */
+ "DVIHELP", helpcmd,
+ "FONTLIST", fontlist,
+ "TEXFONTS", fontpath,
+ "TEXINPUTS", subpath,
+ };
+
+ if (*optstr != '-')
+ return; /* return if this is not an option */
+
+ switch (*(optstr+1))
+ {
+
+ case 'a': /* A selects virtual font caching */
+ case 'A':
+
+#if VIRTUAL_FONTS
+ virt_font = TRUE;
+#endif
+ break;
+
+ case 'b': /* b selects backwards printing order */
+ case 'B':
+ backwards = TRUE;
+ break;
+
+
+ case 'c': /* c selects number of copies */
+ case 'C':
+ copies = (UNSIGN16) atoi(optstr+2);
+ copies = MAX(1,MIN(copies,256)); /* enforce reasonable limits */
+ break;
+
+
+ case 'd': /* d selects debug output */
+ case 'D':
+ debug_code |= (BYTE)atoi(optstr+2);
+ break;
+
+
+ case 'e': /* e specifies ``environment'' variable definition */
+ case 'E': /* We ignore letter case since these come from */
+ /* the command line */
+ if (!(p = strrchr(optstr,'=')))
+ {
+ (void)usage(stderr);
+ (void)sprintf(message,
+ "option(): Bad switch [%s]--expected -eENVNAME=value",
+ optstr);
+ (void)fatal(message);
+ }
+ *p = '\0'; /* clobber "=" by string terminator */
+ for (m = 0; m < sizeof(envlist)/sizeof(envlist[0]); ++m)
+ {
+ if (strcm2(optstr+2,envlist[m].envname) == 0)
+ {
+ (void)strcpy(envlist[m].envvar,p+1);
+ return;
+ }
+ }
+ (void)usage(stderr);
+
+ (void)sprintf(message,"option(): Bad switch [%s]--expected one of:",
+ optstr);
+ for (m = 0; m < sizeof(envlist)/sizeof(envlist[0]); ++m)
+ {
+ (void)strcat(message," ");
+ (void)strcat(message,envlist[m].envname);
+ }
+ (void)fatal(message);
+ break;
+
+
+ case 'f': /* f specifies font substitution file */
+ case 'F':
+ (void)strcpy(subfile,optstr+2);
+ break;
+
+
+#if CANON_A2
+
+#ifdef CANON_TEST
+ case 'g':
+ case 'G':
+ stor_fonts = (UNSIGN32)atoi(optstr + 2 );
+ break;
+#endif /* CANON_TEST */
+
+#endif
+
+ case 'l': /* l prohibits logging of errors */
+ case 'L':
+ g_dolog = FALSE;
+ break;
+
+
+ case 'm': /* m selects alternate magnification */
+ case 'M':
+ /* Collect 2*value initially. Then if value is small, assume
+ user specified magstep value; magstep k means 1.2**k, where k
+ is integral, or half-integral. Otherwise, assume user has
+ specified pxl file magnification (1000 == 200dpi, 1500 ==
+ 300dpi, etc.). */
+
+
+ if (strchr(optstr+2,'.') != (char *)NULL)
+ fltmag = (double)(2.0 * atof(optstr+2));
+ else
+ fltmag = (double)(2 * atoi(optstr+2));
+ if ((0.0 != fltmag) &&
+ (-30.0 <= fltmag) && (fltmag <= 30.0)) /* magstep 15 is limit */
+ {
+ if (fltmag < 0.0)
+ runmag = (UNSIGN32)(0.5 +
+ (1.0/pow((double)sqrt(1.2),-fltmag))*(double)STDMAG);
+ else
+ runmag = (UNSIGN32)(0.5 + pow((double)sqrt(1.2),fltmag)*
+ (double)STDMAG);
+ }
+ else
+ runmag = (UNSIGN32)(0.5 + fltmag/2.0);
+
+ k = MAGSIZE(actfact(runmag)); /* rounded magnification */
+ if (k != runmag)
+ {
+ (void)sprintf(message,
+ "option(): Requested magnification %d not available.",
+ (int)runmag);
+ (void)warning(message);
+ runmag = k;
+ k = (UNSIGN32) MAX(1,MIN(mag_index,(MAGTABSIZE-1)));
+ (void)sprintf(message,
+ " Magnification reset to nearest legal value %d in \
+family ..%d..%d..%d..",
+ (int)runmag,(int)MAGSIZE(mag_table[k-1]),
+ (int)MAGSIZE(mag_table[k]),
+ (int)MAGSIZE(mag_table[k+1]));
+ (void)warning(message);
+ }
+ break;
+
+
+ case 'o':
+ case 'O': /* o selects output page range (-o# or -o#:# or -o#:#:#) */
+ p1 = p2 = p3 = 0;
+ value = (int)sscanf(optstr+2,"%d:%d:%d",&p1,&p2,&p3);
+ page_begin[npage] = p1;
+ page_end[npage] = p2;
+ page_step[npage] = p3;
+ switch (value)
+ {
+ case 1:
+ optstr++; /* point past "-" */
+
+ do /* skip over digit string */
+ {
+ optstr++;
+ }
+ while (isdigit(*optstr) || (*optstr == '-') || (*optstr == '+'));
+
+ if (*optstr) /* trash follows number */
+ {
+ (void)usage(stderr);
+ (void)sprintf(message,
+ "option(): %s is not a legal page number switch",optstr);
+ (void)fatal(message);
+ }
+ else /* had expected end-of-string */
+ page_end[npage] = (INT16)page_begin[npage];
+ page_step[npage] = 1;
+ break;
+
+ case 2: /* supply default step */
+ page_step[npage] = 1;
+ /* FALL THROUGH to case 3 for order check */
+
+ case 3: /* check for positive step */
+ page_step[npage] = ABS(page_step[npage]);
+ if (page_step[npage] == 0)
+ page_step[npage] = 1;
+ break;
+
+ default: /* illegal value */
+ (void)usage(stderr);
+ (void)sprintf(message,
+ "option(): %s is not a legal page number switch",optstr);
+ (void)fatal(message);
+ }
+ npage++;
+ break;
+
+
+ case 'p': /* p prohibits pre-font loading */
+ case 'P':
+#if (HPLASERJET|HPJETPLUS|GOLDENDAWNGL100|POSTSCRIPT|IMPRESS|CANON_A2)
+ preload = TRUE; /* preloading required for Canon engines */
+ /* because of reverse printing order */
+#else
+ preload = FALSE;
+#endif /*NOT(HPLASERJET|HPJETPLUS|GOLDENDAWNGL100|POSTSCRIPT|IMPRESS|CANON_A2)*/
+ break;
+
+
+ case 'q': /* q inhibits status display */
+ case 'Q':
+ quiet = TRUE;
+ break;
+
+
+#if HPLASERJET
+ case 'r': /* r selects output resolution */
+ case 'R':
+ hpres = (INT16)atoi(optstr+2);
+ if ((hpres != 75) && (hpres != 100) && (hpres != 150) &&
+ (hpres != 300))
+ {
+ (void)sprintf(message,
+ "option(): Output resolution not in [75,100,150,300] dpi; \
+reset to %d",
+ DEFAULT_RESOLUTION);
+ (void)warning(message);
+ hpres = DEFAULT_RESOLUTION;
+ }
+ break;
+#endif /* HPLASERJET */
+
+
+#if (APPLEIMAGEWRITER | EPSON | GOLDENDAWNGL100 | TOSHIBAP1351)
+ case 'r': /* r selects run-length coding of output */
+ case 'R':
+ runlengthcode = TRUE;
+ break;
+#endif /* (APPLEIMAGEWRITER | EPSON | GOLDENDAWNGL100 | TOSHIBAP1351) */
+
+
+#if CANON_A2
+
+#ifdef CANON_TEST
+ case 's': /* pixel size limit to force character reloading */
+ case 'S':
+ size_limit = (UNSIGN16)atoi(optstr+2);
+ break;
+#endif /* CANON_TEST */
+
+#endif /* CANON_A2 */
+
+#if POSTSCRIPT
+ case 's': /* pixel size limit to force character reloading */
+ case 'S':
+ size_limit = (UNSIGN16)atoi(optstr+2);
+ break;
+#endif
+
+#if EPSON
+ case 't':
+ case 'T':
+
+#if HIRES
+ twice_a_line = TRUE;
+#endif /* HIRES */
+
+ break;
+#endif /* EPSON */
+
+
+#if CANON_A2
+
+#ifdef CANON_TEST
+ case 'u':
+ case 'U':
+ merit_fact = (UNSIGN16)atoi(optstr+2);
+ break;
+
+ case 'v':
+ case 'V':
+ stor_limit = (UNSIGN32)atoi(optstr+2);
+ break;
+#endif /* CANON_TEST */
+
+#endif /* CANON_A2 */
+
+#if POSTSCRIPT
+ case 'v': /* vmbug -- reload fonts on each page */
+ case 'V':
+ ps_vmbug = TRUE;
+ break;
+#endif /* POSTSCRIPT */
+
+
+ case 'x':
+ case 'X':
+ leftmargin = inch(optstr+2);
+ break;
+
+
+ case 'y':
+ case 'Y':
+ topmargin = inch(optstr+2);
+ break;
+
+#if (OS_TOPS20 | BSD42)
+ case 'z':
+ case 'Z':
+ spool_output = TRUE; /* offer to send output to spooler */
+ break;
+#endif /* (OS_TOPS20 | BSD42) */
+
+ default:
+ (void)usage(stderr);
+ (void)sprintf(message,"option(): %s is not a legal switch", optstr);
+ (void)fatal(message);
+ }
+}
diff --git a/dviware/beebe/src/outrow.h b/dviware/beebe/src/outrow.h
new file mode 100644
index 0000000000..8c12c3914a
--- /dev/null
+++ b/dviware/beebe/src/outrow.h
@@ -0,0 +1,27 @@
+/* -*-C-*- outrow.h */
+/*-->outrow*/
+/**********************************************************************/
+/******************************* outrow *******************************/
+/**********************************************************************/
+
+void
+outrow(c,yoff) /* copy img_row[] into rasters[] if allocated, else no-op */
+BYTE c; /* current character value */
+UNSIGN16 yoff; /* offset from top row (0,1,...,hp-1) */
+{
+ register UNSIGN16 k; /* loop index */
+ register UNSIGN32 *p; /* pointer into img_row[] */
+ register UNSIGN32 *q; /* pointer into rasters[] */
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+ UNSIGN16 words_per_row; /* number of raster words to copy */
+
+ tcharptr = &(fontptr->ch[c]);
+ if (tcharptr->rasters != (UNSIGN32*)NULL)
+ {
+ words_per_row = (UNSIGN16)(tcharptr->wp + 31) >> 5;
+ p = tcharptr->rasters + yoff*words_per_row;
+ q = img_row;
+ for (k = words_per_row; k; --k) /* copy img_row[] into rasters[] */
+ *p++ = *q++;
+ }
+}
diff --git a/dviware/beebe/src/pc/makefile.msc b/dviware/beebe/src/pc/makefile.msc
new file mode 100644
index 0000000000..a04deee093
--- /dev/null
+++ b/dviware/beebe/src/pc/makefile.msc
@@ -0,0 +1,524 @@
+# Makefile for MicroSoft C version 4.0 and 5.0 for DVI driver family
+#
+# Targets:
+# all (build dvi*.exe)
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops texidx
+# clean (all but .exe files)
+# clean_all (including .exe files)
+# clean_exe
+# clean_dvi
+# clean_cer
+# clean_sym
+# clean_obj
+#
+# [15-Nov-87] -- merged separate makefiles for MicroSoft C into one, now
+# that MAKE has been rebuilt with MSC instead of Wizard C
+# and is finally big enough to handle a large makefile.
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo" to build
+# dvifoo); add XCFLAGS to allow extra compile-time options
+# without having to respecify the long path variables
+# Targets for command-line requests...
+
+CC = cl
+
+XCFLAGS=
+
+PCFLAGS = -DOS_PCDOS -DIBM_PC_MICROSOFT
+
+# MSC Version 3.0
+# CFLAGS=/AL/Zd/Od/W2
+# MSC Version 4.0 -- add CodeView debugging option /Zi
+# CFLAGS=/AL/Zd/Od/W2/Zi/DLINT_ARGS$(XCFLAGS)
+# MSC Version 5.0 (needs spaces between options); MSC5 needed in gblprocs.h
+#CFLAGS= -AL -Zd -Oailt -W3 -Zi -DANSI_LIBRARY $(XCFLAGS)
+CFLAGS= -AL -Zd -Od -W3 -Zi -DANSI_LIBRARY $(XCFLAGS)
+
+# Loading this first will give wildcard expansion
+# where the MSC library is found
+DRIVE = C:
+MSCWILD=$(DRIVE)\SYS\MSC\LIB\LSETARGV.OBJ
+
+# Default stack is too small--increase
+STACKSIZE=0xb000
+
+LINKFLAGS=/MAP/LINENUMBERS/ST:$(STACKSIZE)
+
+# Rules...
+
+.c.obj:; $(CC) -c $(CFLAGS) $*.c >$*.clg
+ errshow <$*.clg >$*.cer
+ del $*.clg
+
+.map.sym:; mapsym $*
+ del $*.map
+
+RM = del
+
+# Source, object and executable file extensions
+
+C = .c
+
+O = .obj
+
+X = .exe
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+HFILES = abortrun.h actfact.h alldone.h bitmap.h \
+ chargf.h charpk.h charpxl.h \
+ clrbmap.h clrrow.h commands.h dbgopen.h \
+ dispchar.h dumpchar.h dvifile.h dvihead.h \
+ dviinit.h dviterm.h f20open.h \
+ fatal.h fillrect.h findpost.h fixpos.h \
+ fontfile.h fontsub.h gblprocs.h gblvars.h \
+ gendefs.h getbmap.h getbytes.h getfntdf.h \
+ getpgtab.h inch.h initglob.h keydef.h \
+ loadchar.h machdefs.h main.h movedown.h \
+ moveover.h moveto.h nosignex.h openfont.h \
+ option.h outrow.h prtpage.h prxbmap.h \
+ readfont.h readgf.h readpk.h readpost.h \
+ readpxl.h reldfont.h rulepxl.h setchar.h \
+ setfntnm.h setrule.h signex.h skgfspec.h \
+ skipfont.h skpkspec.h special.h strchr.h \
+ strcm2.h strid2.h strrchr.h tctos.h \
+ typedefs.h usage.h warning.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets for command-line requests...
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops texidx
+
+clean: clean_obj clean_sym clean_cer clean_dvi clean_map
+
+clean_all: clean clean_exe
+
+clean_exe:
+ del dvi*.exe
+ del texidx.exe
+
+clean_dvi:
+ del *.dvi
+
+clean_obj:
+ del dvi*.obj
+ del texidx.obj
+
+clean_map:
+ del dvi*.map
+ del texidx.map
+
+clean_sym:
+ del dvi*.sym
+ del texidx.sym
+
+clean_cer:
+ del dvi*.cer
+ del texidx.cer
+
+# Shorthands for executable targets
+
+00arit: 00arit$(X) 00arit.sym
+
+dvialw: dvialw$(X) dvialw.sym
+
+dvibit: dvibit$(X) dvibit.sym
+
+dvican: dvican$(X) dvican.sym
+
+dvie72: dvie72$(X) dvie72.sym
+
+dvieps: dvieps$(X) dvieps.sym
+
+dvigd: dvigd$(X) dvigd.sym
+
+dviimp: dviimp$(X) dviimp.sym
+
+dvijep: dvijep$(X) dvijep.sym
+
+dvijet: dvijet$(X) dvijet.sym
+
+dvil3p: dvil3p$(X) dvil3p.sym
+
+dvil75: dvil75$(X) dvil75.sym
+
+dvim72: dvim72$(X) dvim72.sym
+
+dvimac: dvimac$(X) dvimac.sym
+
+dvimpi: dvimpi$(X) dvimpi.sym
+
+dvio72: dvio72$(X) dvio72.sym
+
+dvioki: dvioki$(X) dvioki.sym
+
+dvi$(PGM): dvi$(PGM)$(X) dvi$(PGM).sym
+
+dviprx: dviprx$(X) dviprx.sym
+
+dvitos: dvitos$(X) dvitos.sym
+
+keytst: keytst$(X) keytst.sym
+
+lptops: lptops$(X) lptops.sym
+
+texidx: texidx$(X) texidx.sym
+
+# Details for executable targets
+
+00arit$(X):
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=short $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=int $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=long $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+
+dvialw$(X): dvialw$(O) cuseri$(O)
+ link $(MSCWILD) $* cuseri,$*,$(LINKFLAGS);
+
+dvibit$(X): dvibit$(O) keybrd$(O)
+ link $(MSCWILD) $* keybrd,$*,$(LINKFLAGS);
+
+dvican$(X): dvican$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvie72$(X): dvie72$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvieps$(X): dvieps$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvigd$(X): dvigd$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvijep$(X): dvijep$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvijet$(X): dvijet$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dviimp$(X): dviimp$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvil3p$(X): dvil3p$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvil75$(X): dvil75$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvim72$(X): dvim72$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvimac$(X): dvimac$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvimpi$(X): dvimpi$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvio72$(X): dvio72$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dvioki$(X): dvioki$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+dviprx$(X): dviprx$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+# Generic target (useful for debugging test versions)
+dvi$(PGM)$(X): dvi$(PGM)$(O) cuseri$(O) keybrd$(O)
+ link $(MSCWILD) $* cuseri keybrd,$*,$(LINKFLAGS);
+
+dvitos$(X): dvitos$(O)
+ link $(MSCWILD) $*,$*,$(LINKFLAGS);
+
+keytst$(X): keytst$(O) keybrd$(O)
+ link $(MSCWILD) $* keybrd,$*,$(LINKFLAGS);
+
+lptops$(X): lptops$(O) cuseri$(O)
+ link $(MSCWILD) $* cuseri,$*,$(LINKFLAGS);
+
+texidx$(X): texidx$(O) qsort$(O)
+ link $(MSCWILD) $* qsort,$*,$(LINKFLAGS);
+
+# File dependencies... NB: A source file NEVER depends on another
+# source file, but an object file depends on a
+# source file and all the #include'd files in
+# that source file.
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h rulepxl.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ strchr.h strcm2.h strid2.h strrchr.h tctos.h\
+ usage.h warning.h
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h rulepxl.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ special.h strchr.h strcm2.h strid2.h strrchr.h\
+ tctos.h usage.h warning.h
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h rulepxl.h setchar.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ special.h strchr.h strcm2.h strid2.h strrchr.h\
+ tctos.h usage.h warning.h
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h rulepxl.h setfntnm.h setrule.h\
+ signex.h skgfspec.h skipfont.h skpkspec.h special.h\
+ strchr.h strcm2.h strid2.h strrchr.h tctos.h\
+ usage.h warning.h
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ prtpage.h readfont.h readgf.h readpk.h readpost.h\
+ readpxl.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dbgopen.h dispchar.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h rulepxl.h setchar.h setfntnm.h\
+ setrule.h signex.h skgfspec.h skipfont.h skpkspec.h\
+ special.h strchr.h strcm2.h strid2.h strrchr.h\
+ tctos.h usage.h warning.h
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvim72$(O): dvim72.c \
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h\
+ actfact.h alldone.h chargf.h charpk.h charpxl.h\
+ clrbmap.h clrrow.h dispchar.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h fillrect.h\
+ findpost.h fixpos.h fontfile.h fontsub.h getbmap.h\
+ getbytes.h getfntdf.h getpgtab.h inch.h initglob.h\
+ loadchar.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h outrow.h prtpage.h readfont.h\
+ readgf.h readpk.h readpost.h readpxl.h rulepxl.h\
+ setchar.h setfntnm.h setrule.h signex.h skgfspec.h\
+ skipfont.h skpkspec.h special.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvi$(PGM)$(O): dvi$(PGM).c $(HFILES)
+
+dvitos$(O): dvitos.c $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+# These object files need PCFLAGS, since they do not use machdefs.h to
+# select the operating system and compiler
+
+keybrd$(O): keybrd.c keydef.h
+ $(CC) $(CFLAGS) $(PCFLAGS) keybrd.c >keybrd.clg
+ errshow <keybrd.clg >keybrd.cer
+ del keybrd.clg
+
+keytst$(O): keytst.c keydef.h
+ $(CC) $(CFLAGS) $(PCFLAGS) keytst.c >keytst.clg
+ errshow <keytst.clg >keytst.cer
+ del keytst.clg
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+ $(CC) $(CFLAGS) $(PCFLAGS) lptops.c >lptops.clg
+ errshow <lptops.clg >lptops.cer
+ del lptops.clg
+
+texidx$(O): texidx.c
+ $(CC) $(CFLAGS) $(PCFLAGS) texidx.c >texidx.clg
+ errshow <texidx.clg >texidx.cer
+ del texidx.clg
diff --git a/dviware/beebe/src/prtpage.h b/dviware/beebe/src/prtpage.h
new file mode 100644
index 0000000000..3be15061d5
--- /dev/null
+++ b/dviware/beebe/src/prtpage.h
@@ -0,0 +1,299 @@
+/* -*-C-*- prtpage.h */
+/*-->prtpage*/
+/**********************************************************************/
+/****************************** prtpage *******************************/
+/**********************************************************************/
+
+void
+prtpage(bytepos) /* print page whose BOP is at bytepos */
+long bytepos;
+
+{
+ struct stack_entry
+ {
+ INT32 h;
+ COORDINATE hh;
+ INT32 v;
+ COORDINATE vv;
+ INT32 w, x, y, z; /* what's on stack */
+ };
+ register BYTE command; /* current command */
+ register INT16 i; /* command parameter; loop index */
+ char tc; /* temporary character */
+ UNSIGN32 ht_rule; /* rule height */
+ UNSIGN32 wd_rule; /* rule width */
+ INT32 k,m; /* temporary parameter */
+ BOOLEAN seen_bop; /* flag for noting processing of BOP */
+ register INT16 sp; /* stack pointer */
+ struct stack_entry stack[STACKSIZE]; /* stack */
+ char specstr[MAXSPECIAL+1]; /* \special{} string */
+ INT32 w; /* current horizontal spacing */
+ INT32 x; /* current horizontal spacing */
+ INT32 y; /* current vertical spacing */
+ INT32 z; /* current vertical spacing */
+
+/***********************************************************************
+Process all commands between the BOP at bytepos and the next BOP or
+POST. The page is printed when the EOP is met, but font changes can
+also happen between EOP and BOP, so we have to keep going after EOP.
+***********************************************************************/
+
+ seen_bop = FALSE; /* this is first time through */
+ (void) FSEEK(dvifp,bytepos,0); /* start at the desired position */
+
+ for (;;) /* "infinite" loop - exits when POST or second BOP met */
+ {
+#if BBNBITGRAPH
+ /* If the test here on every byte proves to carry objectionable
+ overhead, it can be moved into the default, PUTx, and SETx
+ command sections. The goal is to give the user instant
+ response in page screen positioning, without having to wait
+ for the entire screen to be painted when it is just going
+ to be moved anyway. This is the sort of display algorithm
+ that EMACS uses. */
+ if (kbinput() > 0) /* user has typed something */
+ command = EOP; /* so set for end-of-page action */
+ else
+#endif
+ command = (BYTE)nosignex(dvifp,(BYTE)1);
+ switch (command)
+ {
+
+ case SET1:
+ case SET2:
+ case SET3:
+ case SET4:
+ (void)setchar((BYTE)nosignex(dvifp,(BYTE)(command-SET1+1)),TRUE);
+ break;
+
+ case SET_RULE:
+ ht_rule = nosignex(dvifp,(BYTE)4);
+ wd_rule = nosignex(dvifp,(BYTE)4);
+ (void)setrule(ht_rule,wd_rule,TRUE);
+ break;
+
+ case PUT1:
+ case PUT2:
+ case PUT3:
+ case PUT4:
+ (void)setchar((BYTE)nosignex(dvifp,(BYTE)(command-PUT1+1)),FALSE);
+ break;
+
+ case PUT_RULE:
+ ht_rule = nosignex(dvifp,(BYTE)4);
+ wd_rule = nosignex(dvifp,(BYTE)4);
+ (void)setrule(ht_rule,wd_rule,FALSE);
+ break;
+
+ case NOP:
+ break;
+
+ case BOP:
+ if (seen_bop)
+ return; /* we have been here already */
+ seen_bop = TRUE;
+
+ for (i=0; i<=9; i++)
+ tex_counter[i] = (INT32)signex(dvifp,(BYTE)4);
+
+#if BBNBITGRAPH
+ (void)bopact(); /* display menu at top of page */
+#else /* not BBNBITGRAPH */
+
+#if (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+ (void)bopact();
+#else /* NOT (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+ (void)clrbmap();
+#endif /* (CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+ if (!quiet)
+ (void)fprintf(stderr,"{%s}",tctos()); /* TeX page counters */
+ (void) nosignex(dvifp,(BYTE)4); /* skip prev. page ptr */
+#endif /* BBNBITGRAPH */
+
+ h = v = w = x = y = z = 0;
+ hh = lmargin;
+ vv = tmargin;
+ sp = 0;
+ fontptr = (struct font_entry*)NULL;
+ break;
+
+ case EOP:
+
+#if (BBNBITGRAPH | CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT)
+ (void)eopact();
+#else
+ (void)prtbmap();
+#endif /* (BBNBITGRAPH | CANON_A2 | HPJETPLUS | IMPRESS | POSTSCRIPT) */
+
+ return;
+
+ case PUSH:
+ if (sp >= STACKSIZE)
+ (void)fatal("prtpage(): stack overflow");
+ stack[sp].h = h;
+ stack[sp].hh = hh;
+ stack[sp].v = v;
+ stack[sp].vv = vv;
+ stack[sp].w = w;
+ stack[sp].x = x;
+ stack[sp].y = y;
+ stack[sp].z = z;
+ sp++;
+ break;
+
+ case POP:
+ --sp;
+ if (sp < 0)
+ (void)fatal("prtpage(): stack underflow");
+ h = stack[sp].h;
+ hh = stack[sp].hh;
+ v = stack[sp].v;
+ vv = stack[sp].vv;
+ w = stack[sp].w;
+ x = stack[sp].x;
+ y = stack[sp].y;
+ z = stack[sp].z;
+ break;
+
+ case RIGHT1:
+ case RIGHT2:
+ case RIGHT3:
+ case RIGHT4:
+ (void)moveover(signex(dvifp,(BYTE)(command-RIGHT1+1)));
+ break;
+
+ case W0:
+ (void)moveover(w);
+ break;
+
+ case W1:
+ case W2:
+ case W3:
+ case W4:
+ w = (INT32)signex(dvifp,(BYTE)(command-W1+1));
+ (void)moveover(w);
+ break;
+
+ case X0:
+ (void)moveover(x);
+ break;
+
+ case X1:
+ case X2:
+ case X3:
+ case X4:
+ x = (INT32)signex(dvifp,(BYTE)(command-X1+1));
+ (void)moveover(x);
+ break;
+
+ case DOWN1:
+ case DOWN2:
+ case DOWN3:
+ case DOWN4:
+ (void)movedown(signex(dvifp,(BYTE)(command-DOWN1+1)));
+ break;
+
+ case Y0:
+ (void)movedown(y);
+ break;
+
+ case Y1:
+ case Y2:
+ case Y3:
+ case Y4:
+ y = signex(dvifp,(BYTE)(command-Y1+1));
+ (void)movedown(y);
+ break;
+
+ case Z0:
+ (void)movedown(z);
+ break;
+
+ case Z1:
+ case Z2:
+ case Z3:
+ case Z4:
+ z = signex(dvifp,(BYTE)(command-Z1+1));
+ (void)movedown(z);
+ break;
+
+ case FNT1:
+ case FNT2:
+ case FNT3:
+ case FNT4:
+ (void)setfntnm((INT32)nosignex(dvifp,
+ (BYTE)(command-FNT1+1)));
+ break;
+
+ case XXX1:
+ case XXX2:
+ case XXX3:
+ case XXX4:
+ k = (INT32)nosignex(dvifp,(BYTE)(command-XXX1+1));
+ if (k > MAXSPECIAL)
+ {
+ (void)sprintf(message,
+ "prtpage(): \\special{} string of %d characters longer \
+than DVI driver limit of %d -- truncated.",
+ k,MAXSPECIAL);
+ (void)warning(message);
+ }
+ m = 0;
+ while (k--)
+ {
+ tc = (char)nosignex(dvifp,(BYTE)1);
+ if (m < MAXSPECIAL)
+ specstr[m++] = tc;
+ }
+ specstr[m] = '\0';
+ (void) special(specstr);
+ break;
+
+ case FNT_DEF1:
+ case FNT_DEF2:
+ case FNT_DEF3:
+ case FNT_DEF4:
+ if (preload)
+ (void)skipfont ((INT32) nosignex(dvifp,
+ (BYTE)(command-FNT_DEF1+1)));
+ else
+ (void)readfont ((INT32) nosignex(dvifp,
+ (BYTE)(command-FNT_DEF1+1)));
+ break;
+
+ case PRE:
+ (void)fatal("prtpage(): PRE occurs within file");
+ break;
+
+ case POST:
+ (void)devterm(); /* terminate device output */
+ (void)dviterm(); /* terminate DVI file processing */
+ (void)alldone(); /* this will never return */
+ break;
+
+ case POST_POST:
+ (void)fatal("prtpage(): POST_POST with no preceding POST");
+ break;
+
+ default:
+ if (command >= FONT_00 && command <= FONT_63)
+ (void)setfntnm((INT32)(command - FONT_00));
+ else if (command >= SETC_000 && command <= SETC_127)
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+ (void)setstr((BYTE)command); /* this sets several chars */
+#else
+ (void)setchar((BYTE)(command-SETC_000), TRUE);
+#endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
+
+ else
+ {
+ (void)sprintf(message,"prtpage(): %d is an undefined command",
+ command);
+ (void)fatal(message);
+ }
+ break;
+ }
+ }
+}
diff --git a/dviware/beebe/src/prxbmap.h b/dviware/beebe/src/prxbmap.h
new file mode 100644
index 0000000000..1293ed5a36
--- /dev/null
+++ b/dviware/beebe/src/prxbmap.h
@@ -0,0 +1,132 @@
+/* -*-C-*- prxbmap.h */
+/*-->prxbmap*/
+/**********************************************************************/
+/****************************** prxbmap *******************************/
+/**********************************************************************/
+
+void
+prxbmap()
+
+{
+ register UNSIGN32 *p;
+ register INT16 i,j,k,ybottom,ytop;
+
+ /* The Printronix encodes 6 horizontal bits in a single ASCII */
+ /* character biased by 64 to make it printable, but requires that */
+ /* the bits be reversed. The following table is indexed by a */
+ /* 6-bit pattern (0..63) and was produced automatically by an */
+ /* EMACS TECO macro */
+ /* raster code as */
+ /* 123456 --> 654321 */
+ static int remap[] =
+ { /* 1000000 --> 1000000 */
+ 64,
+ /* 1000001 --> 1100000 */ 96,
+ /* 1000010 --> 1010000 */ 80,
+ /* 1000011 --> 1110000 */ 112,
+ /* 1000100 --> 1001000 */ 72,
+ /* 1000101 --> 1101000 */ 104,
+ /* 1000110 --> 1011000 */ 88,
+ /* 1000111 --> 1111000 */ 120,
+ /* 1001000 --> 1000100 */ 68,
+ /* 1001001 --> 1100100 */ 100,
+ /* 1001010 --> 1010100 */ 84,
+ /* 1001011 --> 1110100 */ 116,
+ /* 1001100 --> 1001100 */ 76,
+ /* 1001101 --> 1101100 */ 108,
+ /* 1001110 --> 1011100 */ 92,
+ /* 1001111 --> 1111100 */ 124,
+ /* 1010000 --> 1000010 */ 66,
+ /* 1010001 --> 1100010 */ 98,
+ /* 1010010 --> 1010010 */ 82,
+ /* 1010011 --> 1110010 */ 114,
+ /* 1010100 --> 1001010 */ 74,
+ /* 1010101 --> 1101010 */ 106,
+ /* 1010110 --> 1011010 */ 90,
+ /* 1010111 --> 1111010 */ 122,
+ /* 1011000 --> 1000110 */ 70,
+ /* 1011001 --> 1100110 */ 102,
+ /* 1011010 --> 1010110 */ 86,
+ /* 1011011 --> 1110110 */ 118,
+ /* 1011100 --> 1001110 */ 78,
+ /* 1011101 --> 1101110 */ 110,
+ /* 1011110 --> 1011110 */ 94,
+ /* 1011111 --> 1111110 */ 126,
+ /* 1100000 --> 1000001 */ 65,
+ /* 1100001 --> 1100001 */ 97,
+ /* 1100010 --> 1010001 */ 81,
+ /* 1100011 --> 1110001 */ 113,
+ /* 1100100 --> 1001001 */ 73,
+ /* 1100101 --> 1101001 */ 105,
+ /* 1100110 --> 1011001 */ 89,
+ /* 1100111 --> 1111001 */ 121,
+ /* 1101000 --> 1000101 */ 69,
+ /* 1101001 --> 1100101 */ 101,
+ /* 1101010 --> 1010101 */ 85,
+ /* 1101011 --> 1110101 */ 117,
+ /* 1101100 --> 1001101 */ 77,
+ /* 1101101 --> 1101101 */ 109,
+ /* 1101110 --> 1011101 */ 93,
+ /* 1101111 --> 1111101 */ 125,
+ /* 1110000 --> 1000011 */ 67,
+ /* 1110001 --> 1100011 */ 99,
+ /* 1110010 --> 1010011 */ 83,
+ /* 1110011 --> 1110011 */ 115,
+ /* 1110100 --> 1001011 */ 75,
+ /* 1110101 --> 1101011 */ 107,
+ /* 1110110 --> 1011011 */ 91,
+ /* 1110111 --> 1111011 */ 123,
+ /* 1111000 --> 1000111 */ 71,
+ /* 1111001 --> 1100111 */ 103,
+ /* 1111010 --> 1010111 */ 87,
+ /* 1111011 --> 1110111 */ 119,
+ /* 1111100 --> 1001111 */ 79,
+ /* 1111101 --> 1101111 */ 111,
+ /* 1111110 --> 1011111 */ 95,
+ /* 1111111 --> 1111111 */ 127
+ };
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+ }
+ ybottom = MAX(0,j-1);
+
+ putchar('\f'); /* start new page with FF */
+ for (j = (INT16)(topmargin*((float)YDPI)); j > 0; --j)
+ { /* supply top margin spacing */
+ putchar('\005'); /* Printronix graphics prefix */
+ NEWLINE(stdout);
+ }
+ for (j = ytop; (j >= ybottom) ; --j) /* loop over raster lines */
+ {
+ p = BITMAP(j,XBIT-1);
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+ putchar('\005'); /* Printronix graphics prefix */
+
+ for (i = (5 + (INT16)(leftmargin*((float)XDPI)))/6;
+ (i > 0) && (k >= 0); --i)
+ putchar('\100');/* left margin spacing if line not empty */
+
+ p = BITMAP(j,0); /* the j-th raster line */
+
+ for (i = 0; i <= k; ++i)/* loop over trimmed raster */
+ { /* use machine-specific coding here for efficiency */
+ putchar(remap[((*p) >> 30) & 077]);
+ putchar(remap[((*p) >> 24) & 077]);
+ putchar(remap[((*p) >> 18) & 077]);
+ putchar(remap[((*p) >> 12) & 077]);
+ putchar(remap[((*p) >> 6) & 077]);
+ putchar(remap[((*p) ) & 077]);
+ ++p;
+ }
+ NEWLINE(stdout);
+ }
+ (void)fflush(stdout);
+}
diff --git a/dviware/beebe/src/qsort.c b/dviware/beebe/src/qsort.c
new file mode 100644
index 0000000000..47f5dd98a0
--- /dev/null
+++ b/dviware/beebe/src/qsort.c
@@ -0,0 +1,80 @@
+#include <stdio.h> /* for typedef of void only */
+
+/***********************************************************************
+TeXindex uses the standard Unix library function qsort() for
+record sorting. Unfortunately, qsort() is not a stable sorting
+algorithm, so input order is not necessarily preserved for equal
+sort keys. This is important, because the sorting is
+case-independent, while the actual entries may not be. For
+example, the input
+
+\entry{i}{22}{{\CODE{i}}}
+\entry{i}{42}{{\CODE{i}}}
+\entry{I}{41}{{\CODE{I}}}
+\entry{I}{42}{{\CODE{I}}}
+
+produces
+
+\initial {I}
+\entry {{\CODE{i}}}{22}
+\entry {{\CODE{I}}}{41--42}
+\entry {{\CODE{i}}}{42}
+
+instead of the correct
+
+\initial {I}
+\entry {{\CODE{i}}}{22, 42}
+\entry {{\CODE{I}}}{41--42}
+
+We therefore provide this stable shellsort replacement for
+qsort() based on the code given on p. 116 of Kernighan and
+Ritchie, ``The C Programming Language'', Prentice-Hall (1978).
+This has order N**1.5 average performance, which is usually
+slower than qsort(). In the interests of simplicity, we make no
+attempt to handle short sequences by alternative methods.
+
+[07-Nov-86]
+***********************************************************************/
+
+
+#define BASE(i) &base[(i)*width]
+
+void
+qsort(base, nel, width, compar)
+ char base[]; /* start of data in memory */
+ int nel; /* number of elements to be sorted */
+ int width; /* size (in bytes) of each element */
+ int (*compar)(); /* comparison function */
+{
+ int gap;
+ int i;
+ int j;
+
+ register int k; /* inner exchange loop parameters */
+ register char* p;
+ register char* q;
+ register char c;
+
+ for (gap = nel/2; gap > 0; gap /= 2)
+ {
+ for (i = gap; i < nel; i++)
+ {
+ for (j = i-gap; j >= 0; j -= gap)
+ {
+ p = BASE(j);
+ q = BASE(j+gap);
+ if ((*compar)(p,q) <= 0)
+ break; /* exit j loop */
+ else
+ {
+ for (k = 0; k < width; (++p, ++q, ++k))
+ {
+ c = *q;
+ *q = *p;
+ *p = c;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/dviware/beebe/src/readfont.h b/dviware/beebe/src/readfont.h
new file mode 100644
index 0000000000..29f018d046
--- /dev/null
+++ b/dviware/beebe/src/readfont.h
@@ -0,0 +1,41 @@
+/* -*-C-*- readfont.h */
+/*-->readfont*/
+/**********************************************************************/
+/****************************** readfont ******************************/
+/**********************************************************************/
+
+void
+readfont(font_k)
+INT32 font_k;
+{
+ BYTE a, l;
+ UNSIGN32 c; /* checksum */
+ UNSIGN32 d; /* design size */
+ char n[MAXSTR];
+ UNSIGN32 s; /* scale factor */
+ struct font_entry *tfontptr; /* temporary font_entry pointer */
+
+ c = nosignex(dvifp,(BYTE)4);
+ s = nosignex(dvifp,(BYTE)4);
+ d = nosignex(dvifp,(BYTE)4);
+ a = (BYTE)nosignex(dvifp,(BYTE)1);
+ l = (BYTE)nosignex(dvifp,(BYTE)1);
+ (void)getbytes(dvifp, n, (BYTE)(a+l));
+ n[a+l] = '\0';
+ tfontptr = (struct font_entry*)MALLOC((unsigned)sizeof(struct font_entry));
+ if (tfontptr == (struct font_entry *)NULL)
+ (void)fatal(
+ "readfont(): No allocable memory space left for font_entry");
+ tfontptr->next = hfontptr;
+
+ fontptr = hfontptr = tfontptr;
+ fontptr->k = font_k;
+ fontptr->c = c;
+ fontptr->s = s;
+ fontptr->d = d;
+ fontptr->a = a;
+ fontptr->l = l;
+ (void)strcpy(fontptr->n, n);
+ fontptr->font_space = (INT32)(s/6);
+ (void)reldfont(fontptr);
+}
diff --git a/dviware/beebe/src/readgf.h b/dviware/beebe/src/readgf.h
new file mode 100644
index 0000000000..5df2586034
--- /dev/null
+++ b/dviware/beebe/src/readgf.h
@@ -0,0 +1,178 @@
+/* -*-C-*- readgf.h */
+/*-->readgf*/
+/**********************************************************************/
+/******************************* readgf *******************************/
+/**********************************************************************/
+
+int
+readgf() /* return 0 on success, EOF on failure */
+{
+ UNSIGN32 checksum;
+ register struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register BYTE the_byte;
+ register UNSIGN16 the_char; /* loop index */
+
+ /*
+ Read a GF file postamble, extracting character metrics and raster
+ locations. The character xoffp, yoffp, wp, and hp values will not
+ be filled in until a character raster description is actually called
+ for.
+ */
+
+ /******************************************************************/
+
+ /* Process the post-postamble */
+
+#if OS_VAXVMS
+ /* VMS binary files are stored with NUL padding to the next 512 byte
+ multiple. We therefore search backwards to the last non-NULL byte
+ to the find real end-of-file, then move back 4 bytes from that. */
+ FSEEK(fontfp,0L,2); /* seek to end-of-file */
+ while (FSEEK(fontfp,-1L,1) == 0)
+ {
+ the_char = (UNSIGN16)fgetc(fontfp);
+ if (the_char)
+ break; /* exit leaving pointer PAST last non-NUL */
+ UNGETC((char)the_char,fontfp);
+ }
+ if (FSEEK(fontfp,-4L,1)) /* start 4 bytes before last non-NUL */
+#else
+ if (FSEEK(fontfp,-4L,2)) /* start 4 bytes from end-of-file */
+#endif
+ {
+ (void)warning("readgf(): FSEEK() failed--GF font file may be empty");
+ return(EOF);
+ }
+
+ while ((the_byte = (BYTE)nosignex(fontfp,(BYTE)1)) == GFEOF)
+ {
+ if (FSEEK(fontfp,-2L,1))/* backup 2 bytes to read previous one */
+ {
+ (void)warning(
+ "readgf(): FSEEK() failed to find GF font file EOF trailer bytes");
+ return(EOF);
+ }
+ }
+
+ if (the_byte != (BYTE)GFID)
+ {
+ (void)warning("readgf(): GF font file ID byte not found");
+ return(EOF);
+ }
+
+ if (FSEEK(fontfp,-6L,1)) /* backup to read post_post */
+ {
+ (void)warning(
+ "readgf(): FSEEK() failed to find GF font file POSTPOST byte");
+ return(EOF);
+ }
+
+ if ((BYTE)nosignex(fontfp,(BYTE)1) != (BYTE)GFPOSTPOST)
+ {
+ (void)warning("readgf(): GF font file POSTPOST byte not found");
+ return(EOF);
+ }
+
+ if (FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)4),0))
+ { /* position to start of postamble */
+ (void)warning(
+ "readgf(): FSEEK() failed to find postamble in GF font file");
+ return(EOF);
+ }
+
+ /******************************************************************/
+
+ /* Process the postamble */
+
+ if ((BYTE)nosignex(fontfp,(BYTE)1) != (BYTE)GFPOST)
+ {
+ (void)warning("readgf(): GF font file POST byte not found");
+ return(EOF);
+ }
+
+ (void)nosignex(fontfp,(BYTE)4); /* discard special pointer p[4] */
+
+ fontptr->designsize = nosignex(fontfp,(BYTE)4);
+
+ checksum = nosignex(fontfp,(BYTE)4);
+ if ((fontptr->c != 0L) && (checksum != 0L) && (fontptr->c != checksum))
+ {
+ (void)sprintf(message,
+ "readgf(): font [%s] has checksum = 10#%010lu [16#%08lx] [8#%011lo] \
+different from DVI checksum = 10#%010lu [16#%08lx] [8#%011lo]. \
+TeX preloaded .fmt file is probably out-of-date with respect to new fonts.",
+ fontptr->name, fontptr->c, fontptr->c, fontptr->c,
+ checksum, checksum, checksum);
+ (void)warning(message);
+ }
+
+ fontptr->hppp = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ fontptr->vppp = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ fontptr->min_m = (INT32)signex(fontfp,(BYTE)4);
+ fontptr->max_m = (INT32)signex(fontfp,(BYTE)4);
+ fontptr->min_n = (INT32)signex(fontfp,(BYTE)4);
+ fontptr->max_n = (INT32)signex(fontfp,(BYTE)4);
+
+ fontptr->magnification = (UNSIGN32)( 0.5 + 5.0 * 72.27 *
+ (float)(fontptr->hppp) / 65536.0 ); /* from GFtoPXL Section 53 */
+
+ /******************************************************************/
+
+ /* Process the character locators */
+
+ the_byte = (BYTE)GFNOOP;
+ while (the_byte == (BYTE)GFNOOP)
+ {
+ switch(the_byte = (BYTE)nosignex(fontfp,(BYTE)1))
+ {
+ case GFCHLOC:
+ case GFCHLOC0:
+ the_char = (UNSIGN16)nosignex(fontfp,(BYTE)1);
+ /* character number MOD 256 */
+ if (the_char >= NPXLCHARS)
+ {
+ (void)warning(
+ "readgf(): GF font file character number is too big for me");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[the_char]);
+ if (the_byte == (BYTE)GFCHLOC) /* long form */
+ {
+ tcharptr->dx = (INT32)signex(fontfp,(BYTE)4);
+ tcharptr->dy = (INT32)signex(fontfp,(BYTE)4);
+ }
+ else /* short form */
+ {
+ tcharptr->dx = (INT32)(((UNSIGN32)nosignex(fontfp,(BYTE)1)) <<
+ 16);
+ tcharptr->dy = 0L;
+ }
+ tcharptr->tfmw = (UNSIGN32)(((float)nosignex(fontfp,(BYTE)4) *
+ (float)fontptr->s) / (float)(1L << 20));
+ tcharptr->pxlw = (UNSIGN16)PIXROUND(tcharptr->dx, 1.0/65536.0);
+ tcharptr->fontrp = (long)signex(fontfp,(BYTE)4);
+
+ the_byte = (BYTE)GFNOOP; /* to force loop continuation */
+ break;
+
+ case GFNOOP:
+ break;
+
+ default: /* this causes loop exit */
+ break;
+ } /* end switch */
+ } /* end while */
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ { /* Get remaining character metrics, and ignore error returns for now. */
+ tcharptr = &(fontptr->ch[the_char]);
+ if (tcharptr->fontrp >= 0L)
+ (void)chargf((BYTE)the_char,(void(*)())NULL);
+ }
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+ (void)newfont();
+#endif
+
+ return(0);
+}
diff --git a/dviware/beebe/src/readpk.h b/dviware/beebe/src/readpk.h
new file mode 100644
index 0000000000..1cf71e5147
--- /dev/null
+++ b/dviware/beebe/src/readpk.h
@@ -0,0 +1,166 @@
+/* -*-C-*- readpk.h */
+/*-->readpk*/
+/**********************************************************************/
+/******************************* readpk *******************************/
+/**********************************************************************/
+
+int
+readpk() /* return 0 on success, EOF on failure */
+{
+ UNSIGN32 checksum;
+ long end_of_packet; /* pointer to byte following character packet */
+ register BYTE flag_byte;
+ UNSIGN32 packet_length;
+ long start_of_packet; /* pointer to start of character packet */
+ register struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register UNSIGN32 the_char;
+
+ /* Read a PK file, extracting character metrics and raster
+ locations. */
+
+ /******************************************************************/
+
+ /* Process the preamble parameters */
+
+ (void)REWIND(fontfp); /* start at beginning of file */
+ if ((BYTE)nosignex(fontfp,(BYTE)1) != PKPRE)
+ {
+ (void)warning("readpk(): PK font file does not start with PRE byte");
+ return(EOF);
+ }
+ if ((BYTE)nosignex(fontfp,(BYTE)1) != PKID)
+ {
+ (void)warning(
+ "readpk(): PK font file PRE byte not followed by ID byte");
+ return(EOF);
+ }
+
+ if (FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)1),1))
+ {
+ (void)warning("readpk(): PK font file has garbled comment string");
+ return(EOF); /* skip comment string */
+ }
+
+ fontptr->designsize = nosignex(fontfp,(BYTE)4);
+
+ checksum = nosignex(fontfp,(BYTE)4); /* checksum */
+ if ((fontptr->c != 0L) && (checksum != 0L) && (fontptr->c != checksum))
+ {
+ (void)sprintf(message,
+ "readpk(): font [%s] has checksum = 10#%010lu [16#%08lx] [8#%011lo] \
+different from DVI checksum = 10#%010lu [16#%08lx] [8#%011lo]. \
+TeX preloaded .fmt file is probably out-of-date with respect to new fonts.",
+ fontptr->name, fontptr->c, fontptr->c, fontptr->c,
+ checksum, checksum, checksum);
+ (void)warning(message);
+ }
+
+ fontptr->hppp = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ fontptr->vppp = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+
+ fontptr->min_m = 0L; /* these are unused in PK format */
+ fontptr->max_m = 0L;
+ fontptr->min_n = 0L;
+ fontptr->max_n = 0L;
+
+ fontptr->magnification = (UNSIGN32)( 0.5 + 5.0 * 72.27 *
+ (float)(fontptr->hppp) / 65536.0 ); /* from GFtoPXL Section 53 */
+
+ /******************************************************************/
+ /* Process the characters until the POST byte is reached */
+
+ (void)skpkspec(); /* skip any PK specials */
+
+ start_of_packet = (long)FTELL(fontfp);
+ while ((flag_byte = (BYTE)nosignex(fontfp,(BYTE)1)) != PKPOST)
+ {
+ flag_byte &= 0x07;
+ switch(flag_byte) /* flag_byte is in 0..7 */
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3: /* short character preamble */
+ packet_length = (UNSIGN32)flag_byte;
+ packet_length <<= 8;
+ packet_length += (UNSIGN32)nosignex(fontfp,(BYTE)1);
+ the_char = (UNSIGN32)nosignex(fontfp,(BYTE)1);
+ if (the_char >= NPXLCHARS)
+ {
+ (void)warning(
+ "readpk(): PK font file character number is too big for me");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[the_char]);
+ end_of_packet = (long)FTELL(fontfp) + (long)packet_length;
+ tcharptr->tfmw = (UNSIGN32)(((float)nosignex(fontfp,(BYTE)3) *
+ (float)fontptr->s) / (float)(1L << 20));
+ tcharptr->dx = (INT32)nosignex(fontfp,(BYTE)1) << 16;
+ tcharptr->dy = 0L;
+ tcharptr->pxlw = (UNSIGN16)PIXROUND(tcharptr->dx, 1.0/65536.0);
+ tcharptr->wp = (COORDINATE)nosignex(fontfp,(BYTE)1);
+ tcharptr->hp = (COORDINATE)nosignex(fontfp,(BYTE)1);
+ tcharptr->xoffp = (COORDINATE)signex(fontfp,(BYTE)1);
+ tcharptr->yoffp = (COORDINATE)signex(fontfp,(BYTE)1);
+ break;
+
+ case 4:
+ case 5:
+ case 6: /* extended short character preamble */
+ packet_length = (UNSIGN32)(flag_byte & 0x03);
+ packet_length <<= 16;
+ packet_length += (UNSIGN32)nosignex(fontfp,(BYTE)2);
+ the_char = (UNSIGN32)nosignex(fontfp,(BYTE)1);
+ if (the_char >= NPXLCHARS)
+ {
+ (void)warning(
+ "readpk(): PK font file character number is too big for me");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[the_char]);
+ end_of_packet = (long)FTELL(fontfp) + (long)packet_length;
+ tcharptr->tfmw = (UNSIGN32)(((float)nosignex(fontfp,(BYTE)3) *
+ (float)fontptr->s) / (float)(1L << 20));
+ tcharptr->dx = (INT32)nosignex(fontfp,(BYTE)2) << 16;
+ tcharptr->dy = 0L;
+ tcharptr->pxlw = (UNSIGN16)PIXROUND(tcharptr->dx, 1.0/65536.0);
+ tcharptr->wp = (COORDINATE)nosignex(fontfp,(BYTE)2);
+ tcharptr->hp = (COORDINATE)nosignex(fontfp,(BYTE)2);
+ tcharptr->xoffp = (COORDINATE)signex(fontfp,(BYTE)2);
+ tcharptr->yoffp = (COORDINATE)signex(fontfp,(BYTE)2);
+ break;
+
+ case 7: /* long character preamble */
+ packet_length = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ the_char = (UNSIGN32)nosignex(fontfp,(BYTE)4);
+ if (the_char >= NPXLCHARS)
+ {
+ (void)warning(
+ "readpk(): PK font file character number is too big for me");
+ return(EOF);
+ }
+ tcharptr = &(fontptr->ch[the_char]);
+ end_of_packet = (long)FTELL(fontfp) + (long)packet_length;
+ tcharptr->tfmw = (UNSIGN32)(((float)nosignex(fontfp,(BYTE)4) *
+ (float)fontptr->s) / (float)(1L << 20));
+ tcharptr->dx = (INT32)signex(fontfp,(BYTE)4);
+ tcharptr->dy = (INT32)signex(fontfp,(BYTE)4);
+ tcharptr->pxlw = (UNSIGN16)PIXROUND(tcharptr->dx, 1.0/65536.0);
+ tcharptr->wp = (COORDINATE)nosignex(fontfp,(BYTE)4);
+ tcharptr->hp = (COORDINATE)nosignex(fontfp,(BYTE)4);
+ tcharptr->xoffp = (COORDINATE)signex(fontfp,(BYTE)4);
+ tcharptr->yoffp = (COORDINATE)signex(fontfp,(BYTE)4);
+ break;
+ } /* end switch */
+ tcharptr->fontrp = start_of_packet;
+ (void)FSEEK(fontfp,end_of_packet,0); /* position to end of packet */
+ (void)skpkspec(); /* skip any PK specials */
+ start_of_packet = (long)FTELL(fontfp);
+ } /* end while */
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+ (void)newfont();
+#endif
+
+ return(0);
+}
diff --git a/dviware/beebe/src/readpost.h b/dviware/beebe/src/readpost.h
new file mode 100644
index 0000000000..89849c2eaf
--- /dev/null
+++ b/dviware/beebe/src/readpost.h
@@ -0,0 +1,59 @@
+/* -*-C-*- readpost.h */
+/*-->readpost*/
+/**********************************************************************/
+/****************************** readpost ******************************/
+/**********************************************************************/
+
+void
+readpost()
+
+/***********************************************************************
+This routine is used to read in the postamble values. It initializes
+the magnification and checks the stack height prior to starting printing
+the document.
+***********************************************************************/
+
+{
+ long lastpageptr; /* byte pointer to last physical page */
+ int the_page_count; /* page count from DVI file */
+
+ findpost();
+ if ((BYTE)nosignex(dvifp,(BYTE)1) != POST)
+ (void)fatal("readpost(): POST missing at head of postamble");
+
+ lastpageptr = (long)nosignex(dvifp,(BYTE)4);
+ num = nosignex(dvifp,(BYTE)4);
+ den = nosignex(dvifp,(BYTE)4);
+ mag = nosignex(dvifp,(BYTE)4);
+ conv = ((float)num/(float)den) *
+ ((float)runmag/(float)STDMAG) *
+
+#if USEGLOBALMAG
+ actfact(mag) *
+#endif
+
+ ((float)RESOLUTION/254000.0);
+ /* denominator/numerator here since will be dividing by the conversion
+ factor */
+ (void) nosignex(dvifp,(BYTE)4); /* height-plus-depth of tallest page */
+ (void) nosignex(dvifp,(BYTE)4); /* width of widest page */
+ if ((int)nosignex(dvifp,(BYTE)2) >= STACKSIZE)
+ (void)fatal("readpost(): Stack size is too small");
+
+ the_page_count = (int)nosignex(dvifp,(BYTE)2);
+
+ if (!quiet)
+ {
+ (void)fprintf(stderr,"[%d pages]",the_page_count);
+ NEWLINE(stderr);
+
+ (void)fprintf(stderr,"[%d magnification]",(int)runmag);
+ NEWLINE(stderr);
+ }
+
+ if (preload)
+ getfntdf();
+ getpgtab(lastpageptr);
+}
+
+
diff --git a/dviware/beebe/src/readpxl.h b/dviware/beebe/src/readpxl.h
new file mode 100644
index 0000000000..3b94e1cf1a
--- /dev/null
+++ b/dviware/beebe/src/readpxl.h
@@ -0,0 +1,78 @@
+/* -*-C-*- readpxl.h */
+/*-->readpxl*/
+/**********************************************************************/
+/****************************** readpxl *******************************/
+/**********************************************************************/
+
+int
+readpxl() /* return 0 on success, EOF on failure */
+{
+ UNSIGN32 checksum;
+ register struct char_entry *tcharptr;/* temporary char_entry pointer */
+ register UNSIGN16 the_char; /* loop index */
+
+#if OS_VAXVMS
+ /* VMS binary files are stored with NUL padding to the next 512 byte
+ multiple. We therefore search backwards to the last non-NULL byte
+ to the find real end-of-file, then move back 20 bytes from that. */
+ FSEEK(fontfp,0L,2); /* seek to end-of-file */
+ while (FSEEK(fontfp,-1L,1) == 0)
+ {
+ the_char = (UNSIGN16)fgetc(fontfp);
+ if (the_char)
+ break; /* exit leaving pointer PAST last non-NUL */
+ UNGETC((char)the_char,fontfp);
+ }
+ if (FSEEK(fontfp,-20L,1)) /* 20 bytes before last non-NUL for checksum */
+#else
+ if (FSEEK(fontfp,-20L,2)) /* 20 bytes before end-of-file for checksum */
+#endif
+ {
+ (void)warning("readpxl(): FSEEK() failed--PXL font file may be empty");
+ return(EOF);
+ }
+
+ checksum = nosignex(fontfp,(BYTE)4);
+ if ((fontptr->c != 0L) && (checksum != 0L) && (fontptr->c != checksum))
+ {
+ (void)sprintf(message,
+ "readpxl(): font [%s] has checksum = 10#%010lu [16#%08lx] [8#%011lo] \
+different from DVI checksum = 10#%010lu [16#%08lx] [8#%011lo]. \
+TeX preloaded .fmt file is probably out-of-date with respect to new fonts.",
+ fontptr->name, fontptr->c, fontptr->c, fontptr->c,
+ checksum, checksum, checksum);
+ (void)warning(message);
+ }
+ fontptr->magnification = nosignex(fontfp,(BYTE)4);
+ fontptr->designsize = nosignex(fontfp,(BYTE)4);
+ if (FSEEK(fontfp, (long)(nosignex(fontfp,(BYTE)4) << 2), 0))
+ {
+ (void)warning(
+ "readpxl(): FSEEK() did not find PXL font file character directory");
+ return(EOF);
+ }
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ {
+ tcharptr = &(fontptr->ch[the_char]);
+ tcharptr->wp = (COORDINATE)nosignex(fontfp,(BYTE)2);
+ tcharptr->hp = (COORDINATE)nosignex(fontfp,(BYTE)2);
+ tcharptr->xoffp = (COORDINATE)signex(fontfp,(BYTE)2);
+ tcharptr->yoffp = (COORDINATE)signex(fontfp,(BYTE)2);
+
+ /* convert (32-bit) word pointer to byte pointer */
+ tcharptr->fontrp = (long)(nosignex(fontfp,(BYTE)4) << 2);
+
+ tcharptr->tfmw = (UNSIGN32)(((float)nosignex(fontfp,(BYTE)4) *
+ (float)fontptr->s) / (float)(1L<<20));
+ tcharptr->pxlw = (UNSIGN16)PIXROUND((INT32)(tcharptr->tfmw), conv);
+ tcharptr->refcount = 0; /* character unused */
+ tcharptr->rasters = (UNSIGN32*)NULL; /* no raster description */
+ }
+
+#if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+ (void)newfont();
+#endif
+
+ return(0);
+}
diff --git a/dviware/beebe/src/reldfont.h b/dviware/beebe/src/reldfont.h
new file mode 100644
index 0000000000..7fdcad8580
--- /dev/null
+++ b/dviware/beebe/src/reldfont.h
@@ -0,0 +1,97 @@
+/* -*-C-*- reldfont.h */
+/*-->reldfont*/
+/**********************************************************************/
+/****************************** reldfont ******************************/
+/**********************************************************************/
+
+void
+reldfont(tfontptr) /* load (or reload) font parameters */
+struct font_entry *tfontptr;
+{
+ register UNSIGN16 the_char; /* loop index */
+ int err_code;
+ register struct char_entry *tcharptr;/* temporary char_entry pointer */
+
+ tfontptr->font_mag = (UNSIGN32)((actfact(
+ MAGSIZE((float)tfontptr->s/(float)tfontptr->d)) *
+ ((float)runmag/(float)STDMAG) *
+
+#if USEGLOBALMAG
+ actfact(mag) *
+#endif
+
+ (float)RESOLUTION * 5.0) + 0.5);
+
+ tfontptr->designsize = (UNSIGN32)0L;
+ tfontptr->hppp = (UNSIGN32)0L;
+ tfontptr->vppp = (UNSIGN32)0L;
+ tfontptr->min_m = (INT32)0L;
+ tfontptr->max_m = (INT32)0L;
+ tfontptr->min_n = (INT32)0L;
+ tfontptr->max_n = (INT32)0L;
+
+ for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
+ {
+ tcharptr = &(tfontptr->ch[the_char]);
+ tcharptr->dx = (INT32)0L;
+ tcharptr->dy = (INT32)0L;
+ tcharptr->hp = (COORDINATE)0;
+ tcharptr->fontrp = -1L;
+ tcharptr->pxlw = (UNSIGN16)0;
+ tcharptr->rasters = (UNSIGN32*)NULL;
+ tcharptr->refcount = 0;
+ tcharptr->tfmw = 0L;
+ tcharptr->wp = (COORDINATE)0;
+ tcharptr->xoffp = (COORDINATE)0;
+ tcharptr->yoffp = (COORDINATE)0;
+ }
+
+ if (tfontptr != pfontptr)
+ (void)openfont(tfontptr->n);
+
+ if (fontfp == (FILE *)NULL) /* have empty font with zero metrics */
+ return;
+
+ for (;;) /* fake one-trip loop */
+ { /* test for font types PK, GF, and PXL in order of preference */
+ (void)REWIND(fontfp); /* position to beginning-of-file */
+ if ( ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)PKPRE) &&
+ ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)PKID) )
+ {
+ tfontptr->font_type = (BYTE)FT_PK;
+ tfontptr->charxx = (void(*)())charpk;
+ err_code = readpk();
+ break;
+ }
+
+ (void)REWIND(fontfp); /* position to beginning-of-file */
+ if ( ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)GFPRE) &&
+ ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)GFID) )
+ {
+ tfontptr->font_type = (BYTE)FT_GF;
+ tfontptr->charxx = (void(*)())chargf;
+ err_code = readgf();
+ break;
+ }
+
+ (void)REWIND(fontfp); /* position to beginning-of-file */
+ if (nosignex(fontfp,(BYTE)4) == (UNSIGN32)PXLID)
+ {
+ tfontptr->font_type = (BYTE)FT_PXL;
+ tfontptr->charxx = (void(*)())charpxl;
+ err_code = readpxl();
+ break;
+ }
+
+ err_code = (int)EOF;
+ break;
+ } /* end one-trip loop */
+
+ if (err_code)
+ {
+ (void)sprintf(message,
+ "reldfont(): Font file [%s] is not a valid GF, PK, or PXL file",
+ tfontptr->name);
+ (void)fatal(message);
+ }
+}
diff --git a/dviware/beebe/src/rulepxl.h b/dviware/beebe/src/rulepxl.h
new file mode 100644
index 0000000000..626679c333
--- /dev/null
+++ b/dviware/beebe/src/rulepxl.h
@@ -0,0 +1,22 @@
+/* -*-C-*- rulepxl.h */
+/*-->rulepxl*/
+/**********************************************************************/
+/****************************** rulepxl *******************************/
+/**********************************************************************/
+
+COORDINATE
+rulepxl(number, cnvfac)/* return number of pixels in a rule */
+register UNSIGN32 number;/* in DVI units */
+register float cnvfac; /* conversion factor */
+
+{
+ register COORDINATE n;
+
+ n = (COORDINATE)(number*cnvfac);
+ if ((float)n < ((float)(number))*cnvfac)
+ return((COORDINATE)(n+1));
+ else
+ return((COORDINATE)n);
+}
+
+
diff --git a/dviware/beebe/src/setchar.h b/dviware/beebe/src/setchar.h
new file mode 100644
index 0000000000..b6b0fc14e6
--- /dev/null
+++ b/dviware/beebe/src/setchar.h
@@ -0,0 +1,50 @@
+/* -*-C-*- setchar.h */
+/*-->setchar*/
+/**********************************************************************/
+/****************************** setchar *******************************/
+/**********************************************************************/
+
+void
+setchar(c, update_h)
+register BYTE c;
+register BOOLEAN update_h;
+{
+ register struct char_entry *tcharptr; /* temporary char_entry pointer */
+
+ if (DBGOPT(DBG_SET_TEXT))
+ {
+ (void)fprintf(stderr,"setchar('");
+ if (isprint(c))
+ (void)putc(c,stderr);
+ else
+ (void)fprintf(stderr,"\\%03o",(int)c);
+ (void)fprintf(stderr,"'<%d>) (hh,vv) = (%ld,%ld) font name <%s>",
+ (int)c, (long)hh, (long)vv, fontptr->n);
+ NEWLINE(stderr);
+ }
+
+ tcharptr = &(fontptr->ch[c]);
+ if (((hh - tcharptr->xoffp + tcharptr->pxlw) <= XSIZE)
+ && (hh >= 0)
+ && (vv <= YSIZE)
+ && (vv >= 0))
+ { /* character fits entirely on page */
+ moveto( hh, (COORDINATE)(YSIZE-vv));
+ dispchar(c);
+ }
+ else if (DBGOPT(DBG_OFF_PAGE) && !quiet)
+ { /* character is off page -- discard it */
+ (void)fprintf(stderr,
+ "setchar(): Char %c [10#%3d 8#%03o 16#%02x] off page.",
+ isprint(c) ? c : '?',c,c,c);
+ NEWLINE(stderr);
+ }
+
+ if (update_h)
+ {
+ h += (INT32)tcharptr->tfmw;
+ hh += (COORDINATE)tcharptr->pxlw;
+ hh = (COORDINATE)(fixpos(hh-lmargin,h,conv) + lmargin);
+ }
+}
+
diff --git a/dviware/beebe/src/setfntnm.h b/dviware/beebe/src/setfntnm.h
new file mode 100644
index 0000000000..74c02b091a
--- /dev/null
+++ b/dviware/beebe/src/setfntnm.h
@@ -0,0 +1,34 @@
+/* -*-C-*- setfntnm.h */
+/*-->setfntnm*/
+/**********************************************************************/
+/****************************** setfntnm ******************************/
+/**********************************************************************/
+
+void
+setfntnm(k)
+register INT32 k;
+
+/***********************************************************************
+This routine is used to specify the font to be used in printing future
+characters.
+***********************************************************************/
+
+{
+ register struct font_entry *p;
+
+ p = hfontptr;
+ while ((p != (struct font_entry *)NULL) && (p->k != k))
+ p = p->next;
+ if (p == (struct font_entry *)NULL)
+ {
+ (void)sprintf(message,"setfntnm(): font %ld undefined", k);
+ (void)fatal(message);
+ }
+ else
+ fontptr = p;
+
+#if (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
+ font_switched = TRUE;
+#endif
+
+}
diff --git a/dviware/beebe/src/setrule.h b/dviware/beebe/src/setrule.h
new file mode 100644
index 0000000000..ac54111f2a
--- /dev/null
+++ b/dviware/beebe/src/setrule.h
@@ -0,0 +1,30 @@
+/* -*-C-*- setrule.h */
+/*-->setrule*/
+/**********************************************************************/
+/****************************** setrule *******************************/
+/**********************************************************************/
+
+void
+setrule(height, width, update_h)
+register UNSIGN32 height, width;
+register BOOLEAN update_h;
+
+{ /* draw a rule with bottom left corner at (h,v) */
+
+ if ((height > 0) && (width > 0)) /* non-empty rule */
+
+#if BBNBITGRAPH
+ fillrect(hh+xscreen, YSIZE-vv+yscreen,
+ rulepxl(width,conv) , rulepxl(height,conv));
+#else
+ fillrect(hh, YSIZE-vv,
+ rulepxl(width,conv), rulepxl(height,conv));
+#endif
+
+ if (update_h)
+ {
+ h += (INT32)width;
+ hh += rulepxl(width, conv);
+ hh = fixpos(hh-lmargin,h,conv) + lmargin;
+ }
+}
diff --git a/dviware/beebe/src/signex.h b/dviware/beebe/src/signex.h
new file mode 100644
index 0000000000..14d44fcbc1
--- /dev/null
+++ b/dviware/beebe/src/signex.h
@@ -0,0 +1,57 @@
+/* -*-C-*- signex.h */
+/*-->signex*/
+/**********************************************************************/
+/******************************* signex *******************************/
+/**********************************************************************/
+
+INT32
+signex(fp, n) /* return n byte quantity from file fd */
+register FILE *fp; /* file pointer */
+register BYTE n; /* number of bytes */
+
+{
+ register BYTE n1; /* number of bytes */
+ register INT32 number; /* number being constructed */
+
+ number = (INT32)getc(fp);/* get first (high-order) byte */
+
+#if PCC_20
+ if (number > 127) /* sign bit is set, pad top of word with sign bit */
+ number |= 0xfffffff00;
+ /* this constant could be written for any */
+ /* 2's-complement machine as -1 & ~0xff, but */
+ /* PCC-20 does not collapse constant expressions */
+ /* at compile time, sigh... */
+#endif /* PCC_20 */
+
+#if (OS_ATARI | OS_UNIX) /* 4.1BSD C compiler uses logical shift too */
+ if (number > 127) /* sign bit is set, pad top of word with sign bit */
+ number |= 0xffffff00;
+#endif /* OS_UNIX */
+
+ n1 = n--;
+ while (n--)
+ {
+ number <<= 8;
+ number |= (INT32)getc(fp);
+ }
+
+#if (OS_ATARI | PCC_20 | OS_UNIX)
+#else /* NOT (OS_ATARI | PCC_20 | OS_UNIX) */
+
+ /* NOTE: This code assumes that the right-shift is an arithmetic, rather
+ than logical, shift which will propagate the sign bit right. According
+ to Kernighan and Ritchie, this is compiler dependent! */
+
+ number<<=HOST_WORD_SIZE-8*n1;
+
+#if ARITHRSHIFT
+ number>>=HOST_WORD_SIZE-8*n1; /* sign extend */
+#else /* NOT ARITHRSHIFT */
+ (void)fatal("signex(): no code implemented for logical right shift");
+#endif /* ARITHRSHIFT */
+
+#endif /* (OS_ATARI | PCC_20 | OS_UNIX) */
+
+ return((INT32)number);
+}
diff --git a/dviware/beebe/src/skgfspec.h b/dviware/beebe/src/skgfspec.h
new file mode 100644
index 0000000000..0275c8f444
--- /dev/null
+++ b/dviware/beebe/src/skgfspec.h
@@ -0,0 +1,48 @@
+/* -*-C-*- skgfspec.h */
+/*-->skgfspec*/
+/**********************************************************************/
+/****************************** skgfspec ******************************/
+/**********************************************************************/
+
+void
+skgfspec() /* Skip GF font file specials */
+{
+ BYTE the_byte;
+
+ the_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ while ((the_byte >= (BYTE)GFXXX1) && (the_byte != GFPOST))
+ {
+ switch(the_byte)
+ {
+ case GFXXX1:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)1),1);
+ break;
+
+ case GFXXX2:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)2),1);
+ break;
+
+ case GFXXX3:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)3),1);
+ break;
+
+ case GFXXX4:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)4),1);
+ break;
+
+ case GFYYY:
+ (void)nosignex(fontfp,(BYTE)4);
+ break;
+
+ case GFNOOP:
+ break;
+
+ default:
+ (void)sprintf(message,"skgfspec(): Bad GF font file [%s]",
+ fontptr->name);
+ (void)fatal(message);
+ }
+ the_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ }
+ (void)UNGETC((char)the_byte,fontfp); /* put back lookahead byte */
+}
diff --git a/dviware/beebe/src/skipfont.h b/dviware/beebe/src/skipfont.h
new file mode 100644
index 0000000000..e899947163
--- /dev/null
+++ b/dviware/beebe/src/skipfont.h
@@ -0,0 +1,23 @@
+/* -*-C-*- skipfont.h */
+/*-->skipfont*/
+/**********************************************************************/
+/****************************** skipfont ******************************/
+/**********************************************************************/
+
+void
+skipfont(k)
+INT32 k; /* UNUSED */
+
+{
+ BYTE a, l;
+ char n[MAXSTR];
+
+ (void) nosignex(dvifp,(BYTE)4);
+ (void) nosignex(dvifp,(BYTE)4);
+ (void) nosignex(dvifp,(BYTE)4);
+ a = (BYTE) nosignex(dvifp,(BYTE)1);
+ l = (BYTE) nosignex(dvifp,(BYTE)1);
+ getbytes(dvifp, n, (BYTE)(a+l));
+}
+
+
diff --git a/dviware/beebe/src/skpkspec.h b/dviware/beebe/src/skpkspec.h
new file mode 100644
index 0000000000..992b127bc6
--- /dev/null
+++ b/dviware/beebe/src/skpkspec.h
@@ -0,0 +1,48 @@
+/* -*-C-*- skpkspec.h */
+/*-->skpkspec*/
+/**********************************************************************/
+/****************************** skpkspec ******************************/
+/**********************************************************************/
+
+void
+skpkspec() /* Skip PK font file specials */
+{
+ BYTE the_byte;
+
+ the_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ while ((the_byte >= (BYTE)PKXXX1) && (the_byte != PKPOST))
+ {
+ switch(the_byte)
+ {
+ case PKXXX1:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)1),1);
+ break;
+
+ case PKXXX2:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)2),1);
+ break;
+
+ case PKXXX3:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)3),1);
+ break;
+
+ case PKXXX4:
+ (void)FSEEK(fontfp,(long)nosignex(fontfp,(BYTE)4),1);
+ break;
+
+ case PKYYY:
+ (void)nosignex(fontfp,(BYTE)4);
+ break;
+
+ case PKNOOP:
+ break;
+
+ default:
+ (void)sprintf(message,"skpkspec(): Bad PK font file [%s]",
+ fontptr->name);
+ (void)fatal(message);
+ }
+ the_byte = (BYTE)nosignex(fontfp,(BYTE)1);
+ }
+ (void)UNGETC((char)the_byte,fontfp); /* put back lookahead byte */
+}
diff --git a/dviware/beebe/src/special.h b/dviware/beebe/src/special.h
new file mode 100644
index 0000000000..3eb796e817
--- /dev/null
+++ b/dviware/beebe/src/special.h
@@ -0,0 +1,14 @@
+/* -*-C-*- special.h */
+/*-->special*/
+/**********************************************************************/
+/****************************** special *******************************/
+/**********************************************************************/
+
+void
+special(s) /* process TeX \special{} string in s[] */
+register char *s;
+{
+ (void)sprintf(message,
+ "special(): TeX \\special{%s} not implemented in this driver",s);
+ (void)warning(message);
+}
diff --git a/dviware/beebe/src/strchr.h b/dviware/beebe/src/strchr.h
new file mode 100644
index 0000000000..f340e3aaea
--- /dev/null
+++ b/dviware/beebe/src/strchr.h
@@ -0,0 +1,35 @@
+/* -*-C-*- strchr.h */
+/*-->strchr*/
+/**********************************************************************/
+/******************************* strchr *******************************/
+/**********************************************************************/
+
+#ifndef KCC_20
+#define KCC_20 0
+#endif
+
+#ifndef IBM_PC_MICROSOFT
+#define IBM_PC_MICROSOFT 0
+#endif
+
+#ifndef OS_VAXVMS
+#define OS_VAXVMS 0
+#endif
+
+
+#if (KCC_20 | IBM_PC_MICROSOFT | OS_VAXVMS)
+#else
+char*
+strchr(s,c) /* return address of c in s[], or (char*)NULL if not found. */
+register char *s;/* c may be NUL; terminator of s[] is included in search. */
+register char c;
+{
+ while ((*s) && ((*s) != c))
+ ++s;
+
+ if ((*s) == c)
+ return (s);
+ else
+ return ((char*)NULL);
+}
+#endif
diff --git a/dviware/beebe/src/strcm2.h b/dviware/beebe/src/strcm2.h
new file mode 100644
index 0000000000..38c2fb65a6
--- /dev/null
+++ b/dviware/beebe/src/strcm2.h
@@ -0,0 +1,33 @@
+/* -*-C-*- strcm2.h */
+/*-->strcm2*/
+/**********************************************************************/
+/******************************* strcm2 *******************************/
+/**********************************************************************/
+
+
+/***********************************************************************
+ Compare strings (ignoring case), and return:
+ s1>s2: >0
+ s1==s2: 0
+ s1<s2: <0
+***********************************************************************/
+
+/* toupper() is supposed to work for all letters, but PCC-20 does it
+incorrectly if the argument is not already lowercase; this definition
+fixes that. */
+
+#define UC(c) (islower(c) ? toupper(c) : c)
+
+int
+strcm2(s1, s2)
+register char *s1, *s2;
+
+{
+ while ((*s1) && (UC(*s1) == UC(*s2)))
+ {
+ s1++;
+ s2++;
+ }
+ return((int)(UC(*s1) - UC(*s2)));
+}
+#undef UC
diff --git a/dviware/beebe/src/strid2.h b/dviware/beebe/src/strid2.h
new file mode 100644
index 0000000000..43754a1c32
--- /dev/null
+++ b/dviware/beebe/src/strid2.h
@@ -0,0 +1,37 @@
+/* -*-C-*- strid2.h */
+/*-->strid2*/
+/**********************************************************************/
+/******************************* strid2 *******************************/
+/**********************************************************************/
+
+/* toupper() is supposed to work for all letters, but PCC-20 does it
+incorrectly if the argument is not already lowercase; this definition
+fixes that. */
+
+#define UC(c) (islower(c) ? toupper(c) : c)
+
+int
+strid2(string,substring)/* Return index (0,1,...) of substring in string */
+char string[]; /* or -1 if not found. Letter case is IGNORED. */
+char substring[];
+{
+ register int k; /* loop index */
+ register int limit; /* loop limit */
+ register char *s;
+ register char *sub;
+
+ limit = (int)strlen(string) - (int)strlen(substring);
+
+ for (k = 0; k <= limit; ++k)/* simple (and slow) linear search */
+ {
+ s = &string[k];
+
+ for (sub = &substring[0]; (UC(*s) == UC(*sub)) && (*sub); (++s, ++sub))
+ /* NO-OP */ ;
+
+ if (*sub == '\0') /* then all characters match */
+ return(k); /* success -- match at index k */
+ }
+
+ return(-1); /* failure */
+}
diff --git a/dviware/beebe/src/strrchr.h b/dviware/beebe/src/strrchr.h
new file mode 100644
index 0000000000..560c8595bd
--- /dev/null
+++ b/dviware/beebe/src/strrchr.h
@@ -0,0 +1,29 @@
+/* -*-C-*- strrchr.h */
+/*-->strrchr*/
+/**********************************************************************/
+/****************************** strrchr *******************************/
+/**********************************************************************/
+
+#if (KCC_20 | IBM_PC_MICROSOFT | OS_VAXVMS)
+#else
+char*
+strrchr(s,c) /* return address of last occurrence of c in s[], */
+ /* or (char*)NULL if not found. c may be NUL; */
+ /* terminator of s[] is included in search. */
+register char *s;
+register char c;
+{
+ register char *t;
+
+ t = (char *)NULL;
+ for (;;) /* loop forever */
+ {
+ if (*s == c)
+ t = s; /* remember last match position */
+ if (!*s)
+ break; /* exit when NULL reached */
+ ++s; /* advance to next character */
+ }
+ return (t);
+}
+#endif
diff --git a/dviware/beebe/src/tctos.h b/dviware/beebe/src/tctos.h
new file mode 100644
index 0000000000..2febd42c69
--- /dev/null
+++ b/dviware/beebe/src/tctos.h
@@ -0,0 +1,21 @@
+/* -*-C-*- tctos.h */
+/*-->tctos*/
+/**********************************************************************/
+/**************************** tctos *********************************/
+/**********************************************************************/
+
+char *
+tctos() /* return pointer to (static) TeX page counter string */
+{ /* (trailing zero counters are not printed) */
+ register INT16 k; /* loop index */
+ register INT16 n; /* number of counters to print */
+ static char s[111]; /* 10 32-bit counters n.n.n... */
+
+ for (n = 9; (n > 0) && (tex_counter[n] == 0); --n)
+ /* NO-OP */;
+ s[0] = '\0';
+ for (k = 0; k <= n; ++k)
+ (void)sprintf(strrchr(s,'\0'),"%ld%s",
+ tex_counter[k],(k < n) ? "." : "");
+ return ((char *)&s[0]);
+}
diff --git a/dviware/beebe/src/tops20/makefile.d20 b/dviware/beebe/src/tops20/makefile.d20
new file mode 100644
index 0000000000..c33909e69d
--- /dev/null
+++ b/dviware/beebe/src/tops20/makefile.d20
@@ -0,0 +1,41 @@
+#-----------------------------------------------------------------------
+# Usage:
+#
+# make dviman
+# or
+# make dvidriver
+# or
+# make clean
+#
+# [17-Apr-87]
+#-----------------------------------------------------------------------
+
+LATEX = LaTeX-Big \batchmode \input
+
+CP = copy
+
+.SUFFIXES:
+
+.SUFFIXES: .dvi .ltx .ids .idx
+
+.idx.ids:
+ $(CP) $*.idx $*.id
+ texidx $*.id
+ $(RM) $*.id.*
+
+dviman: dviman.ltx
+ $(LATEX) dviman.ltx
+
+dvidriver: dvidriver.ltx dvidriver.sty
+ $(LATEX) dvidriver.ltx
+ $(RM) dvidriver.dvi.*
+ make dvidriver.ids
+ $(LATEX) dvidriver.ltx
+ make dvidriver.ids
+
+dvidriver.ids: dvidriver.idx
+
+clean:
+ $(RM) *.dvi*.*
+ $(RM) *.lst.*
+ $(RM) *.aux.*
diff --git a/dviware/beebe/src/tops20/makefile.kcc b/dviware/beebe/src/tops20/makefile.kcc
new file mode 100644
index 0000000000..48fcecf6c9
--- /dev/null
+++ b/dviware/beebe/src/tops20/makefile.kcc
@@ -0,0 +1,470 @@
+# Makefile for files in <.TEX.DVI> using TOPS-20 MAKE and KCC compiler
+#
+# Current target list:
+# all clean
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops lw78 texidx
+# tosprx xxu
+#
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo" to build
+# dvifoo); add XCFLAGS to allow extra compile-time options
+# without having to respecify the long path variables
+# [15-Apr-87] -- rebuilt dependency lists using "awk -f include.awk *.c"
+# [08-Jul-87]
+
+# Want large version of the compiler
+CC = KCCX
+
+# extra CFLAGS
+XCFLAGS =
+
+CFLAGS = -DKCC_20 -DOS_TOPS20 $(XCFLAGS)
+
+# Need liblcl to get jfnof() for dvibit
+LFLAGS = -llcl
+
+# Object and executable file extensions
+
+O = .rel
+
+X = .exe
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops lw78 texidx tosprx
+
+clean:
+ delete *$(O)
+ delete *$(X)
+
+00arit: 00arit$(X)
+
+dvialw: dvialw$(X)
+
+dvibit: dvibit$(X)
+
+dvican: dvican$(X)
+
+dvie72: dvie72$(X)
+
+dvieps: dvieps$(X)
+
+dvigd: dvigd$(X)
+
+dviimp: dviimp$(X)
+
+dvijep: dvijep$(X)
+
+dvijet: dvijet$(X)
+
+dvil3p: dvil3p$(X)
+
+dvil75: dvil75$(X)
+
+dvim72: dvim72$(X)
+
+dvimac: dvimac$(X)
+
+dvimpi: dvimpi$(X)
+
+dvio72: dvio72$(X)
+
+dvioki: dvioki$(X)
+
+dvi$(PGM): dvi$(PGM)$(X)
+
+dviprx: dviprx$(X)
+
+dvitos: dvitos$(X)
+
+keytst: keytst$(X)
+
+lptops: lptops$(X)
+
+lw78: lw78$(X)
+
+texidx: texidx$(X)
+
+tosprx: tosprx$(X)
+
+# ======================================================================
+# Dependency lists and rules
+
+00arit$(X):
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=short $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=int $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=long $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+
+dvialw$(X): dvialw$(O) cuseri$(O)
+ $(CC) $(CFLAGS) dvialw$(O) cuseri$(O) -o dvialw$(X) $(LFLAGS)
+
+dvibit$(X): dvibit$(O) keybrd$(O)
+ $(CC) $(CFLAGS) dvibit$(O) keybrd$(O) -o dvibit$(X) $(LFLAGS)
+
+dvican$(X): dvican$(O)
+ $(CC) $(CFLAGS) dvican$(O) -o dvican$(X) $(LFLAGS)
+
+dvie72$(X): dvie72$(O)
+ $(CC) $(CFLAGS) dvie72$(O) -o dvie72$(X) $(LFLAGS)
+
+dvieps$(X): dvieps$(O)
+ $(CC) $(CFLAGS) dvieps$(O) -o dvieps$(X) $(LFLAGS)
+
+dvigd$(X): dvigd$(O)
+ $(CC) $(CFLAGS) dvigd$(O) -o dvigd$(X) $(LFLAGS)
+
+dviimp$(X): dviimp$(O)
+ $(CC) $(CFLAGS) dviimp$(O) -o dviimp$(X) $(LFLAGS)
+
+dvijep$(X): dvijep$(O)
+ $(CC) $(CFLAGS) dvijep$(O) -o dvijep$(X) $(LFLAGS)
+
+dvijet$(X): dvijet$(O)
+ $(CC) $(CFLAGS) dvijet$(O) -o dvijet$(X) $(LFLAGS)
+
+dvil3p$(X): dvil3p$(O)
+ $(CC) $(CFLAGS) dvil3p$(O) -o dvil3p$(X) $(LFLAGS)
+
+dvil75$(X): dvil75$(O)
+ $(CC) $(CFLAGS) dvil75$(O) -o dvil75$(X) $(LFLAGS)
+
+dvim72$(X): dvim72$(O)
+ $(CC) $(CFLAGS) dvim72$(O) -o dvim72$(X) $(LFLAGS)
+
+dvimac$(X): dvimac$(O)
+ $(CC) $(CFLAGS) dvimac$(O) -o dvimac$(X) $(LFLAGS)
+
+dvimpi$(X): dvimpi$(O)
+ $(CC) $(CFLAGS) dvimpi$(O) -o dvimpi$(X) $(LFLAGS)
+
+dvio72$(X): dvio72$(O)
+ $(CC) $(CFLAGS) dvio72$(O) -o dvio72$(X) $(LFLAGS)
+
+dvioki$(X): dvioki$(O)
+ $(CC) $(CFLAGS) dvioki$(O) -o dvioki$(X) $(LFLAGS)
+
+dvi$(PGM)$(X): dvi$(PGM)$(O) cuseri$(O)
+ $(CC) $(CFLAGS) dvi$(PGM)$(O) cuseri$(O) \
+ -o dvi$(PGM)$(X) $(LFLAGS)
+
+dviprx$(X): dviprx$(O)
+ $(CC) $(CFLAGS) dviprx$(O) -o dviprx$(X) $(LFLAGS)
+
+dvitos$(X): dvitos$(O)
+ $(CC) $(CFLAGS) dvitos$(O) -o dvitos$(X) $(LFLAGS)
+
+keytst$(X): keytst$(O) keybrd$(O)
+ $(CC) $(CFLAGS) keytst$(O) keybrd$(O) -o keytst$(X) $(LFLAGS)
+
+lptops$(X): lptops$(O) cuseri$(O)
+ $(CC) $(CFLAGS) lptops$(O) cuseri$(O) -o lptops$(X) $(LFLAGS)
+
+lw78$(X): lw78$(O)
+ $(CC) $(CFLAGS) lw78$(O) -o lw78$(X) $(LFLAGS)
+
+texidx$(X): texidx$(O)
+ $(CC) $(CFLAGS) texidx$(O) -o texidx$(X) $(LFLAGS)
+
+tosprx$(X): tosprx$(O) zrmkcc$(O)
+ $(CC) $(CFLAGS) tosprx$(O) zrmkcc$(O) -o tosprx$(X) $(LFLAGS)
+
+# Object file dependencies
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) keydef.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h reldfont.h rulepxl.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvican$(O): dvican.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h dispchar.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvim72$(O): dvim72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+# Generic target (useful for debugging test versions)
+dvi$(PGM)$(O): dvi$(PGM).c $(HFILES)
+
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvitos$(O): dvitos.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+keybrd$(O): keybrd.c\
+ keydef.h
+
+
+keytst$(O): keytst.c\
+ keydef.h
+
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+
+
+tosprx$(O): tosprx.c\
+ machdefs.h typedefs.h gendefs.h gblprocs.h clrbmap.h
diff --git a/dviware/beebe/src/tops20/makefile.pcc b/dviware/beebe/src/tops20/makefile.pcc
new file mode 100644
index 0000000000..33bc7f5fc9
--- /dev/null
+++ b/dviware/beebe/src/tops20/makefile.pcc
@@ -0,0 +1,502 @@
+# Makefile for files in <.TEX.DVI> using TOPS-20 MAKE and PCC compiler
+#
+# Current target list:
+# all clean
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops lw78 texidx
+# tosprx xxu
+#
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo" to build
+# dvifoo); add XCFLAGS to allow extra compile-time options
+# without having to respecify the long path variables
+# [15-Apr-87] -- rebuilt dependency lists using "awk -f include.awk *.c"
+# [08-Jul-87]
+
+# Default C compiler
+CC = cc
+
+# Extra compiler options
+XCFLAGS =
+
+# -f needed to force recompilation when MAKE wants it; CC
+# otherwise will not recompile if source is older than object
+
+CFLAGS = -DPCC_20 -DOS_TOPS20 -f $(XCFLAGS)
+
+LFLAGS =
+
+EXTRA = pcc:bigc.rel zerom.rel
+
+EXTRA2 = pcc:bigc.rel
+
+LIBS =
+
+# Object and executable file extensions
+
+O = .rel
+
+X = .exe
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops lw78 texidx tosprx
+
+clean:
+ delete *$(O)
+ delete *$(X)
+
+00arit: 00arit$(X)
+
+dvialw: dvialw$(X)
+
+dvibit: dvibit$(X)
+
+dvican: dvican$(X)
+
+dvie72: dvie72$(X)
+
+dvieps: dvieps$(X)
+
+dvigd: dvigd$(X)
+
+dviimp: dviimp$(X)
+
+dvijep: dvijep$(X)
+
+dvijet: dvijet$(X)
+
+dvil3p: dvil3p$(X)
+
+dvil75: dvil75$(X)
+
+dvim72: dvim72$(X)
+
+dvimac: dvimac$(X)
+
+dvimpi: dvimpi$(X)
+
+dvio72: dvio72$(X)
+
+dvioki: dvioki$(X)
+
+dvi$(PGM): dvi$(PGM)$(X)
+
+dviprx: dviprx$(X)
+
+dvitos: dvitos$(X)
+
+keytst: keytst$(X)
+
+lptops: lptops$(X)
+
+lw78: lw78$(X)
+
+texidx: texidx$(X)
+
+tosprx: tosprx$(X)
+
+# ======================================================================
+# Dependency lists and rules
+
+# For PCC, we need this extra dependency to ensure zerom.mac gets compiled
+
+CLRBMAP = clrbmap.h zerom.rel
+
+00arit$(X):
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=short $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LIBS) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=int $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LIBS) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+ $(CC) -DSIZE=long $(CFLAGS) 00arit$(C) -o 00arit$(X) $(LIBS) $(LFLAGS)
+ 00arit$(X)
+ $(RM) 00arit$(O)
+ $(RM) 00arit$(X)
+
+dvialw$(X): dvialw$(O) cuseri$(O)
+ $(CC) $(EXTRA2) $(CFLAGS) dvialw$(O) cuseri$(O) \
+ -o dvialw$(X) $(LIBS) $(LFLAGS)
+
+dvibit$(X): dvibit$(O) keybrd$(O)
+ $(CC) $(EXTRA2) $(CFLAGS) dvibit$(O) keybrd$(O) -o dvibit$(X) \
+ $(LIBS) $(LFLAGS)
+
+dvican$(X): dvican$(O)
+ $(CC) $(EXTRA2) $(CFLAGS) dvican$(O) -o dvican$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvigd$(X): dvigd$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvigd$(O) -o dvigd$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvie72$(X): dvie72$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvie72$(O) -o dvie72$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvieps$(X): dvieps$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvieps$(O) -o dvieps$(X) $(LIBS) \
+ $(LFLAGS)
+
+dviimp$(X): dviimp$(O)
+ $(CC) $(EXTRA2) $(CFLAGS) dviimp$(O) -o dviimp$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvijep$(X): dvijep$(O)
+ $(CC) $(EXTRA2) $(CFLAGS) dvijep$(O) -o dvijep$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvijet$(X): dvijet$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvijet$(O) -o dvijet$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvil3p$(X): dvil3p$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvil3p$(O) -o dvil3p$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvil75$(X): dvil75$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvil75$(O) -o dvil75$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvim72$(X): dvim72$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvim72$(O) -o dvim72$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvimac$(X): dvimac$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvimac$(O) -o dvimac$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvimpi$(X): dvimpi$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvimpi$(O) -o dvimpi$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvio72$(X): dvio72$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvio72$(O) -o dvio72$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvioki$(X): dvioki$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvioki$(O) -o dvioki$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvi$(PGM)$(X): dvi$(PGM)$(O) cuseri$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvi$(PGM)$(O) cuseri$(O) \
+ -o dvi$(PGM)$(X) $(LIBS) $(LFLAGS)
+
+dviprx$(X): dviprx$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dviprx$(O) -o dviprx$(X) $(LIBS) \
+ $(LFLAGS)
+
+dvitos$(X): dvitos$(O)
+ $(CC) $(EXTRA) $(CFLAGS) dvitos$(O) -o dvitos$(X) $(LIBS) \
+ $(LFLAGS)
+
+keytst$(X): keytst$(O) keybrd$(O)
+ $(CC) $(CFLAGS) keytst$(O) keybrd$(O) -o keytst$(X) $(LIBS) \
+ $(LFLAGS)
+
+# NB: Need iocr to allow I/O of <CR>
+lptops$(X): lptops$(O) cuseri$(O)
+ $(CC) $(CFLAGS) lptops$(O) cuseri$(O) pcc:iocr$(O) pcc:bigc$(O) \
+ -o lptops$(X) $(LIBS) $(LFLAGS)
+
+# NB: Need init to get big command-line buffer
+lw78$(X): lw78$(O)
+ $(CC) $(CFLAGS) pcc:init$(O) lw78$(O) -o lw78$(X) $(LIBS) \
+ $(LFLAGS)
+
+texidx$(X): texidx$(O)
+ $(CC) $(CFLAGS) texidx$(O) -o texidx$(X) $(LIBS) $(LFLAGS)
+
+tosprx$(X): tosprx$(O) zerom$(O)
+ $(CC) $(CFLAGS) tosprx$(O) zerom$(O) -o tosprx$(X) $(LIBS) \
+ $(LFLAGS)
+
+# Object file dependencies
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) keydef.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h reldfont.h rulepxl.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvican$(O): dvican.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h dispchar.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvim72$(O): dvim72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvitos$(O): dvitos.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h $(CLRBMAP)\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+keybrd$(O): keybrd.c\
+ keydef.h
+
+
+keytst$(O): keytst.c\
+ keydef.h
+
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+
+
+tosprx$(O): tosprx.c\
+ machdefs.h typedefs.h gendefs.h gblprocs.h $(CLRBMAP)
diff --git a/dviware/beebe/src/tops20/zrmkcc.c b/dviware/beebe/src/tops20/zrmkcc.c
new file mode 100644
index 0000000000..ead3001ac0
--- /dev/null
+++ b/dviware/beebe/src/tops20/zrmkcc.c
@@ -0,0 +1,13 @@
+/* -*-C-*- zerom.c */
+/*-->zerom*/
+/**********************************************************************/
+/******************************* zerom *******************************/
+/**********************************************************************/
+
+void
+zerom(to, count)
+int *to, count;
+{
+ while (count-- > 0)
+ *to++ = 0;
+}
diff --git a/dviware/beebe/src/tosprx.c b/dviware/beebe/src/tosprx.c
new file mode 100644
index 0000000000..7c236ae932
--- /dev/null
+++ b/dviware/beebe/src/tosprx.c
@@ -0,0 +1,388 @@
+/* -*-C-*- tosprx.c */
+/*-->tosprx*/
+/**********************************************************************/
+/******************************* tosprx *******************************/
+/**********************************************************************/
+
+#include "machdefs.h"
+#include "typedefs.h"
+
+/* Toshiba P1351 to Printronix 300/600 plot file translator */
+
+#ifndef ANSI_PROTOTYPES
+#define ANSI_PROTOTYPES 0
+#endif
+
+#ifndef OS_TOPS20
+#define OS_TOPS20 0
+#endif
+
+#define NL '\n'
+#define FF '\f'
+#define ESC '\033'
+#if OS_TOPS20
+#undef FASTZERO
+#define FASTZERO 1
+#endif
+
+#define XDPI 60 /* horizontal dots/inch */
+#define XPSIZE 13 /* horizontal paper size in inches */
+#define XSIZE (XDPI*XPSIZE) /* number of horizontal dots */
+#define XWORDS ((XSIZE + HOST_WORD_SIZE - 1)/HOST_WORD_SIZE)
+ /* number of words in rows */
+ /* of bitmap array */
+
+#define YDPI 72 /* vertical dots/inch */
+#define YPSIZE 22 /* vertical paper size in inches */
+#define YSIZE (YDPI*YPSIZE) /* number of vertical dots */
+
+#define XBIT XWORDS
+#define YBIT YSIZE
+
+int nplot,xrast,yrast;
+float topmargin = 0.0;
+float leftmargin = 0.0;
+
+/* The printer bit map */
+
+UNSIGN32 bitmap[YBIT] [XBIT];
+
+#include <stdio.h>
+#include <time.h>
+#include "gendefs.h"
+#include "gblprocs.h"
+#define BITMAP(y,x) (bitmap + ((UNSIGN32)XBIT*(UNSIGN32)(y)) + (UNSIGN32)(x))
+
+#if ANSI_PROTOTYPES
+int getdigit(void);
+void plotline(void);
+void relhormv(void);
+#else /* NOT ANSI_PROTOTYPES */
+int getdigit();
+void plotline();
+void relhormv();
+#endif /* ANSI_PROTOTYPES */
+
+int
+main()
+{
+ register int c;
+
+ nplot = 0; /* plot page number */
+ xrast = 0;
+ yrast = YBIT-1; /* current raster line */
+ clrbmap();
+ while ((c = getchar()) != EOF)
+ {
+ switch (c)
+ {
+ case ESC:
+ if ((c = getchar()) == ';')
+ plotline();
+ else if (c == 'H')
+ {
+ ungetc(c,stdin);
+ relhormv();
+ }
+ break;
+
+ case NL:
+ xrast = 0;
+ break;
+
+ case FF:
+ nplot++;
+ prtbmap();
+ (void)fprintf(stderr," [%d",nplot);
+ clrbmap();
+ (void)fprintf(stderr,"]");
+ break;
+
+ default: /* discard other characters */
+ break;
+ }
+ }
+ prtbmap();
+}
+
+int
+getdigit()
+{
+ register int c;
+
+ c = getchar();
+ if ((c < '0') | ('9' < c))
+ {
+ (void)fprintf(stderr,
+ "?Expected digit, but found char %03o\n on page %d in line %d\n",
+ c,nplot,YBIT-yrast);
+ exit(1);
+ }
+ else
+ return (c - '0');
+}
+
+void
+plotline()
+{
+ register int c,mask,nword,y;
+ int nchar,count,org_count;
+
+ if (yrast < 24) /* bit map is full, print it */
+ {
+ prtbmap();
+ clrbmap();
+ yrast = YBIT-1;
+ }
+ count = getdigit();
+ count = 10*count + getdigit();
+ count = 10*count + getdigit();
+ count = 10*count + getdigit(); /* count = number of columns */
+ count *= 4; /* count = number of char quadruples */
+ org_count = count;
+
+ nchar = 0; /* cyclic counter 0 1 2 3 */
+ while (((c = getchar()) != EOF) && (c != NL) && count)
+ {
+ count--;
+ if (c < '\100')
+ {
+ (void)fprintf(stderr,
+ "?Illegal character %03o on page %d line %d -- flushed line\n",
+ c,nplot,YBIT-yrast);
+ while (((c = getchar()) != EOF) && (c != NL))
+ count--;
+ }
+ else if (xrast < XSIZE) /*still inside bitmap */
+ {
+ if (c > '\100') /* have dots to set */
+ {
+ nword = xrast/HOST_WORD_SIZE;
+ mask = 1;
+ mask <<= (HOST_WORD_SIZE-1); /* bit at left end of word */
+ mask >>= (xrast % HOST_WORD_SIZE);
+ y = yrast - 6*nchar;
+ if (c & '\040')
+ bitmap[y ][nword] |= mask;
+ if (c & '\020')
+ bitmap[y-1][nword] |= mask;
+ if (c & '\010')
+ bitmap[y-2][nword] |= mask;
+ if (c & '\004')
+ bitmap[y-3][nword] |= mask;
+ if (c & '\002')
+ bitmap[y-4][nword] |= mask;
+ if (c & '\001')
+ bitmap[y-5][nword] |= mask;
+ }
+ nchar = (++nchar) & 03;
+ if (!nchar)
+ ++xrast; /* new column every four characters */
+ }
+ }
+ if (count)
+ (void)fprintf(stderr,"?Input count = %d, but %d left at EOL\n",
+ org_count,count);
+ if (c == NL)
+ {
+ xrast = 0;
+ yrast -= 24; /* one printline has 24 rasters */
+ }
+ else if (c == ESC) /* expect <ESC>Hnnnc hor. motion */
+ relhormv();
+ else
+ (void)fprintf(stderr,
+ "?Expected NL, but found %03o -- flushing line\n",c);
+}
+
+#include "clrbmap.h"
+
+/*-->prtbmap*/
+/**********************************************************************/
+/****************************** prtbmap *******************************/
+/**********************************************************************/
+
+void
+prtbmap()
+
+{
+ register UNSIGN32 *p;
+ register INT16 i,j,k,ybottom,ytop;
+
+ /* The Printronix encodes 6 horizontal bits in a single ASCII */
+ /* character biased by 64 to make it printable, but requires that */
+ /* the bits be reversed. The following table is indexed by a */
+ /* 6-bit pattern (0..63) and was produced automatically by an */
+ /* EMACS TECO macro */
+ /* raster code as */
+ /* 123456 --> 654321 */
+ static char remap[] =
+ { /* 1000000 --> 1000000 */
+ 64,
+ /* 1000001 --> 1100000 */ 96,
+ /* 1000010 --> 1010000 */ 80,
+ /* 1000011 --> 1110000 */ 112,
+ /* 1000100 --> 1001000 */ 72,
+ /* 1000101 --> 1101000 */ 104,
+ /* 1000110 --> 1011000 */ 88,
+ /* 1000111 --> 1111000 */ 120,
+ /* 1001000 --> 1000100 */ 68,
+ /* 1001001 --> 1100100 */ 100,
+ /* 1001010 --> 1010100 */ 84,
+ /* 1001011 --> 1110100 */ 116,
+ /* 1001100 --> 1001100 */ 76,
+ /* 1001101 --> 1101100 */ 108,
+ /* 1001110 --> 1011100 */ 92,
+ /* 1001111 --> 1111100 */ 124,
+ /* 1010000 --> 1000010 */ 66,
+ /* 1010001 --> 1100010 */ 98,
+ /* 1010010 --> 1010010 */ 82,
+ /* 1010011 --> 1110010 */ 114,
+ /* 1010100 --> 1001010 */ 74,
+ /* 1010101 --> 1101010 */ 106,
+ /* 1010110 --> 1011010 */ 90,
+ /* 1010111 --> 1111010 */ 122,
+ /* 1011000 --> 1000110 */ 70,
+ /* 1011001 --> 1100110 */ 102,
+ /* 1011010 --> 1010110 */ 86,
+ /* 1011011 --> 1110110 */ 118,
+ /* 1011100 --> 1001110 */ 78,
+ /* 1011101 --> 1101110 */ 110,
+ /* 1011110 --> 1011110 */ 94,
+ /* 1011111 --> 1111110 */ 126,
+ /* 1100000 --> 1000001 */ 65,
+ /* 1100001 --> 1100001 */ 97,
+ /* 1100010 --> 1010001 */ 81,
+ /* 1100011 --> 1110001 */ 113,
+ /* 1100100 --> 1001001 */ 73,
+ /* 1100101 --> 1101001 */ 105,
+ /* 1100110 --> 1011001 */ 89,
+ /* 1100111 --> 1111001 */ 121,
+ /* 1101000 --> 1000101 */ 69,
+ /* 1101001 --> 1100101 */ 101,
+ /* 1101010 --> 1010101 */ 85,
+ /* 1101011 --> 1110101 */ 117,
+ /* 1101100 --> 1001101 */ 77,
+ /* 1101101 --> 1101101 */ 109,
+ /* 1101110 --> 1011101 */ 93,
+ /* 1101111 --> 1111101 */ 125,
+ /* 1110000 --> 1000011 */ 67,
+ /* 1110001 --> 1100011 */ 99,
+ /* 1110010 --> 1010011 */ 83,
+ /* 1110011 --> 1110011 */ 115,
+ /* 1110100 --> 1001011 */ 75,
+ /* 1110101 --> 1101011 */ 107,
+ /* 1110110 --> 1011011 */ 91,
+ /* 1110111 --> 1111011 */ 123,
+ /* 1111000 --> 1000111 */ 71,
+ /* 1111001 --> 1100111 */ 103,
+ /* 1111010 --> 1010111 */ 87,
+ /* 1111011 --> 1110111 */ 119,
+ /* 1111100 --> 1001111 */ 79,
+ /* 1111101 --> 1101111 */ 111,
+ /* 1111110 --> 1011111 */ 95,
+ /* 1111111 --> 1111111 */ 127
+ };
+
+ ytop = YBIT-1;
+
+ k = -1; /* find bottom non-zero raster */
+ for (j = 0; (j < ytop) && (k < 0); ++j) /* loop over raster lines */
+ {
+ p = &bitmap[j][XBIT-1];
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+ }
+ ybottom = MAX(0,j-1);
+
+ putchar('\f'); /* start new page with FF */
+ for (j = (INT16)(topmargin*((float)YDPI)); j > 0; --j)
+ { /* supply top margin spacing */
+ putchar('\005'); /* Printronix graphics prefix */
+ putchar('\n');
+ }
+ for (j = ytop; (j >= ybottom) ; --j) /* loop over raster lines */
+ {
+ p = &bitmap[j][XBIT-1];
+ for (k = XBIT - 1; ((k >= 0) && (*p == 0)); --k)
+ --p; /* trim white space */
+ putchar('\005'); /* Printronix graphics prefix */
+
+ for (i = (5 + (INT16)(leftmargin*((float)XDPI)))/6;
+ (i > 0) && (k >= 0); --i)
+ putchar('\100');/* left margin spacing if line not empty */
+
+ p = &bitmap[j][0]; /* the j-th raster line */
+
+ for (i = 0; i <= k; ++i)/* loop over trimmed raster */
+ { /* use machine-specific coding here for efficiency */
+ putchar(remap[((*p) >> 30) & 077]);
+ putchar(remap[((*p) >> 24) & 077]);
+ putchar(remap[((*p) >> 18) & 077]);
+ putchar(remap[((*p) >> 12) & 077]);
+ putchar(remap[((*p) >> 6) & 077]);
+ putchar(remap[((*p) ) & 077]);
+ ++p;
+ }
+ putchar('\n');
+ }
+ (void)fflush(stdout);
+}
+
+/*-->relhormv*/
+/**********************************************************************/
+/****************************** relhormv ******************************/
+/**********************************************************************/
+
+void
+relhormv()
+{
+ register int c,n;
+
+ if ((c = getchar()) != 'H')
+ {
+ (void)fprintf(stderr,
+ "?Expected <ESC>Hnnn Relative Horizontal Motion command \
+- flushing line\n");
+ while (((c = getchar()) != EOF) && (c != NL))
+ ;
+ return;
+ }
+ c = getchar();
+ if (IN('@',c,'F'))
+ n = (c - '@')*256;
+ else
+ {
+ (void)fprintf(stderr,
+ "?Illegal <ESC>Hnnn Relative Horizontal Motion command \
+- flushing line\n");
+ while (((c = getchar()) != EOF) && (c != NL))
+ ;
+ return;
+ }
+ c = getchar();
+ if (IN('@',c,'O'))
+ n += (c - '@')*16;
+ else
+ {
+ (void)fprintf(stderr,
+ "?Illegal <ESC>Hnnn Relative Horizontal Motion command \
+- flushing line\n");
+ while (((c = getchar()) != EOF) && (c != NL))
+ ;
+ return;
+ }
+ c = getchar();
+ if (IN('@',c,'O'))
+ n += (c - '@');
+ else
+ {
+ (void)fprintf(stderr,
+ "?Illegal <ESC>Hnnn Relative Horizontal Motion command \
+- flushing line\n");
+ while (((c = getchar()) != EOF) && (c != NL))
+ ;
+ return;
+ }
+ xrast += n;
+}
diff --git a/dviware/beebe/src/typedefs.h b/dviware/beebe/src/typedefs.h
new file mode 100644
index 0000000000..99f8b90e93
--- /dev/null
+++ b/dviware/beebe/src/typedefs.h
@@ -0,0 +1,48 @@
+/* -*-C-*- typedefs.h */
+/*-->typedefs*/
+/**********************************************************************/
+/****************************** typedefs ******************************/
+/**********************************************************************/
+
+#if IBM_PC_LATTICE
+typedef char BOOLEAN; /* value in (FALSE,TRUE) */
+#else
+typedef unsigned char BOOLEAN; /* value in (FALSE,TRUE) */
+#endif
+
+#define FALSE 0
+#define TRUE 1
+
+#if IBM_PC_LATTICE
+typedef unsigned BYTE; /* unsigned 8-bit integers */
+#else
+typedef unsigned char BYTE; /* unsigned 8-bit integers */
+#endif
+
+typedef short int INT8; /* signed 8-bit integers (C has no
+ "signed char" type) yet */
+typedef short int INT16; /* signed 16-bit integers */
+typedef long INT32; /* signed 32-bit integers */
+
+#if IBM_PC_LATTICE
+typedef unsigned UNSIGN16; /* unsigned 16-bit integers */
+#else
+typedef unsigned short UNSIGN16; /* unsigned 16-bit integers */
+#endif
+
+#if IBM_PC_LATTICE
+typedef long UNSIGN32; /* unsigned 32-bit integers */
+#else
+typedef unsigned long UNSIGN32; /* unsigned 32-bit integers */
+#endif
+
+typedef short int COORDINATE; /* signed integer (x,y) coordinate */
+ /* variable in bit map */
+
+#if PCC_20
+/* typedef int void; */ /* void added locally to stdio.h */
+#endif
+
+#if IBM_PC_LATTICE
+/* typedef int void; */ /* not needed with version 3 */
+#endif
diff --git a/dviware/beebe/src/unix/makefile.unx b/dviware/beebe/src/unix/makefile.unx
new file mode 100644
index 0000000000..b6bf2ea73b
--- /dev/null
+++ b/dviware/beebe/src/unix/makefile.unx
@@ -0,0 +1,529 @@
+# Makefile for files in /tex/dvi using generic Unix cc
+#
+# Current target list:
+# all clean countlines lint
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops lw78 texidx
+# tosprx uuencode xxu
+#
+# [28-Oct-87] -- added uuencode target
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo dvifoo" to
+# build dvifoo); add XCFLAGS to allow extra compile-time
+# options without having to respecify the long path variables
+# [15-Apr-87] -- rebuilt dependency lists using "awk -f include.awk *.c"
+# [08-Jul-87] -- added dvil3p
+# [20-Jul-87] -- added xxu and dvi.xrf
+
+# Default C compiler
+CC = cc
+
+# Extra compiler options
+XCFLAGS =
+
+# Set paths according to your local conventions
+CFLAGS = -DFONTPATH="\"/usr/local/lib/tex/fonts/\"" \
+ -DSUBPATH="\"/usr/local/lib/tex/macros/\"" \
+ $(XCFLAGS)
+
+LINTFLAGS = -bchx
+
+# Need math library to load
+LFLAGS = -lm
+
+MV = mv
+
+RM = /bin/rm
+
+# Source file extension
+C = .c
+
+# Object file extension
+O = .o
+
+# dvixxx.c files
+
+DVIXXX = dvialw.c dvibit.c dvican.c dvie72.c dvieps.c dvigd.c \
+ dviimp.c dvijep.c dvijet.c dvil3p.c dvil75.c dvim72.c \
+ dvimac.c dvimpi.c dvio72.c dvioki.c dviprx.c dvitos.c
+
+OTHERS = 00arit.c keytst.c lptops.c lw78.c texidx.c tosprx.c xxu.c
+
+HFILES = abortrun.h actfact.h alldone.h bitmap.h \
+ chargf.h charpk.h charpxl.h \
+ clrbmap.h clrrow.h commands.h dbgopen.h \
+ dispchar.h dumpchar.h dvifile.h dvihead.h \
+ dviinit.h dviterm.h f20open.h \
+ fatal.h fillrect.h findpost.h fixpos.h \
+ fontfile.h fontsub.h gblprocs.h gblvars.h \
+ gendefs.h getbmap.h getbytes.h getfntdf.h \
+ getpgtab.h inch.h initglob.h keydef.h \
+ loadchar.h machdefs.h main.h movedown.h \
+ moveover.h moveto.h nosignex.h openfont.h \
+ option.h outrow.h prtpage.h prxbmap.h \
+ readfont.h readgf.h readpk.h readpost.h \
+ readpxl.h reldfont.h rulepxl.h setchar.h \
+ setfntnm.h setrule.h signex.h skgfspec.h \
+ skipfont.h skpkspec.h special.h strchr.h \
+ strcm2.h strid2.h strrchr.h tctos.h \
+ typedefs.h usage.h warning.h
+
+# Include files that include others
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets (lw78 is excluded--most Unix sites have Transcript or devps
+# which offer similar features)
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops texidx tosprx
+
+clean:
+ $(RM) -f *.o
+ $(RM) -f 00arit \
+ dvialw dvibit dvican dvie72 dvieps dvigd \
+ dviimp dvijep dvijet dvil75 dvil3p dvim72\
+ dvimac dvimpi dvio72 dvioki dviprx dvitos\
+ keytst lptops texidx tosprx
+ $(RM) -f .~* .#*
+
+# Prestrip counts are for code with comments retained, and #include files
+# inserted. Poststrip counts have blank lines, # lines, and comments
+# deleted.
+countlines:
+ for f in $(DVIXXX) $(OTHERS) ;\
+ do \
+ echo -n $$f [prestrip] `$(CC) $(CFLAGS) -C -E $$f | tee foo1.$$f | wc`;\
+ echo " [poststrip]" `$(CC) $(CFLAGS) -E $$f |\
+ egrep -v '^[ ]*$$|^\#' | tee foo2.$$f | wc`;\
+ done
+
+lint:
+ lint $(LINTFLAGS) dvialw.c
+ lint $(LINTFLAGS) dvibit.c
+ lint $(LINTFLAGS) dvican.c
+ lint $(LINTFLAGS) dvie72.c
+ lint $(LINTFLAGS) dvieps.c
+ lint $(LINTFLAGS) dvigd.c
+ lint $(LINTFLAGS) dviimp.c
+ lint $(LINTFLAGS) dvijep.c
+ lint $(LINTFLAGS) dvijet.c
+ lint $(LINTFLAGS) dvil3p.c
+ lint $(LINTFLAGS) dvil75.c
+ lint $(LINTFLAGS) dvim72.c
+ lint $(LINTFLAGS) dvimac.c
+ lint $(LINTFLAGS) dvimpi.c
+ lint $(LINTFLAGS) dvio72.c
+ lint $(LINTFLAGS) dvioki.c
+ lint $(LINTFLAGS) dviprx.c
+ lint $(LINTFLAGS) dvitos.c
+ lint $(LINTFLAGS) lptops.c
+ lint $(LINTFLAGS) texidx.c
+ lint $(LINTFLAGS) tosprx.c
+
+# ======================================================================
+# Dependency lists and rules
+
+00arit:
+ $(RM) -f 00arit$(O)
+ $(RM) -f 00arit
+ $(CC) -DSIZE=short $(CFLAGS) 00arit$(C) -o 00arit $(LFLAGS)
+ 00arit
+ $(RM) -f 00arit$(O)
+ $(RM) -f 00arit
+ $(CC) -DSIZE=int $(CFLAGS) 00arit$(C) -o 00arit $(LFLAGS)
+ 00arit
+ $(RM) -f 00arit$(O)
+ $(RM) -f 00arit
+ $(CC) -DSIZE=long $(CFLAGS) 00arit$(C) -o 00arit $(LFLAGS)
+ 00arit
+ $(RM) -f 00arit$(O)
+ $(RM) -f 00arit
+
+
+dvialw: dvialw$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvialw$(O) fndfil$(O) -o dvialw $(LFLAGS)
+
+dvibit: dvibit$(O) keybrd$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvibit$(O) keybrd$(O) fndfil$(O) -o dvibit $(LFLAGS)
+
+dvican: dvican$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvican$(O) fndfil$(O) -o dvican $(LFLAGS)
+
+dvie72: dvie72$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvie72$(O) fndfil$(O) -o dvie72 $(LFLAGS)
+
+dvieps: dvieps$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvieps$(O) fndfil$(O) -o dvieps $(LFLAGS)
+
+dvigd: dvigd$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvigd$(O) fndfil$(O) -o dvigd $(LFLAGS)
+
+dviimp: dviimp$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dviimp$(O) fndfil$(O) -o dviimp $(LFLAGS)
+
+dvijep: dvijep$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvijep$(O) fndfil$(O) -o dvijep $(LFLAGS)
+
+dvijet: dvijet$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvijet$(O) fndfil$(O) -o dvijet $(LFLAGS)
+
+dvil3p: dvil3p$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvil3p$(O) fndfil$(O) -o dvil3p $(LFLAGS)
+
+dvil75: dvil75$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvil75$(O) fndfil$(O) -o dvil75 $(LFLAGS)
+
+dvim72: dvim72$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvim72$(O) fndfil$(O) -o dvim72 $(LFLAGS)
+
+dvimac: dvimac$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvimac$(O) fndfil$(O) -o dvimac $(LFLAGS)
+
+dvimpi: dvimpi$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvimpi$(O) fndfil$(O) -o dvimpi $(LFLAGS)
+
+dvio72: dvio72$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvio72$(O) fndfil$(O) -o dvio72 $(LFLAGS)
+
+dvioki: dvioki$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvioki$(O) fndfil$(O) -o dvioki $(LFLAGS)
+
+dvi$(PGM): dvi$(PGM)$(O) keybrd$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvi$(PGM)$(O) keybrd$(O) fndfil$(O) \
+ -o dvi$(PGM) $(LFLAGS)
+
+dviprx: dviprx$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dviprx$(O) fndfil$(O) -o dviprx $(LFLAGS)
+
+dvitos: dvitos$(O) fndfil$(O)
+ $(CC) $(CFLAGS) dvitos$(O) fndfil$(O) -o dvitos $(LFLAGS)
+
+keytst: keytst$(O) keybrd$(O)
+ $(CC) $(CFLAGS) keytst$(O) keybrd$(O) -o keytst $(LFLAGS)
+
+lptops: lptops$(O)
+ $(CC) $(CFLAGS) lptops$(O) -o lptops $(LFLAGS)
+
+lw78: lw78$(O)
+ $(CC) $(CFLAGS) lw78$(O) -o lw78 $(LFLAGS)
+
+texidx: texidx$(O)
+ $(CC) $(CFLAGS) texidx$(O) -o texidx $(LFLAGS)
+
+tosprx: tosprx$(O)
+ $(CC) $(CFLAGS) tosprx$(O) -o tosprx $(LFLAGS)
+
+uuencode:
+ if [ ! -s story.dvi ] ;\
+ then \
+ tex story;\
+ fi
+ for f in alw can e72 eps gd imp jep jet l3p l75 m72 mac mpi o72 \
+ oki prx tos ;\
+ do \
+ echo dvi$$f;\
+ ./dvi$$f -q <story.dvi >story.$$f 2>story.err-$$f;\
+ if [ -s story.dvi-err ];\
+ then \
+ cat story.dvi-err >>story.err-$$f; \
+ fi;\
+ rm -f story.dvi-err;\
+ if [ ! -s story.err-$$f ];\
+ then \
+ rm -f story.err-$$f;\
+ fi;\
+ uuencode story.$$f story.dvi-$$f >story.uue-$$f;\
+ rm -f story.$$f;\
+ done
+
+xxu: xxu$(O)
+ $(CC) $(CFLAGS) xxu$(O) -o xxu $(LFLAGS)
+
+dvi.xrf: $(DVIXXX) $(HFILES)
+ xref $(DVIXXX) >dvi.xrf
+
+# Object file dependencies
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) keydef.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h reldfont.h rulepxl.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvican$(O): dvican.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h dispchar.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvim72$(O): dvim72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+# Generic target (useful for debugging test versions)
+dvi$(PGM)$(O): dvi$(PGM).c $(HFILES)
+
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvitos$(O): dvitos.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+keybrd$(O): keybrd.c\
+ keydef.h
+
+
+keytst$(O): keytst.c\
+ keydef.h
+
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+
+
+tosprx$(O): tosprx.c\
+ machdefs.h typedefs.h gendefs.h gblprocs.h clrbmap.h
diff --git a/dviware/beebe/src/usage.h b/dviware/beebe/src/usage.h
new file mode 100644
index 0000000000..6a7a2341e5
--- /dev/null
+++ b/dviware/beebe/src/usage.h
@@ -0,0 +1,80 @@
+/* -*-C-*- usage.h */
+/*-->usage*/
+/**********************************************************************/
+/******************************* usage ********************************/
+/**********************************************************************/
+
+void
+usage(fp) /* print usage message to fp and return */
+FILE *fp;
+{
+ (void)fprintf(fp,"[TeX82 DVI Translator Version %s]",VERSION_NO);
+ NEWLINE(fp);
+ (void)fprintf(fp,"[%s]",DEVICE_ID);
+ NEWLINE(fp);
+
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-x#{units}} {-y#{units}} dvifile(s)",
+g_progname);
+
+#if APPLEIMAGEWRITER
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-r} {-x#{units}} {-y#{units}} \
+dvifile(s)",
+g_progname);
+#endif
+
+#if EPSON
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-r} {-t} {-x#{units}} {-y#{units}} \
+{-z} dvifile(s)",
+g_progname);
+#endif /* EPSON */
+
+#if GOLDENDAWNGL100
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-r} {-x#{units}} {-y#{units}} \
+dvifile(s)",
+g_progname);
+#endif
+
+#if HPLASERJET
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-r#} {-x#{units}} {-y#{units}} \
+{-z} dvifile(s)",
+g_progname);
+#endif /* HPLASERJET */
+
+#if POSTSCRIPT
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-r} {-v} {-x#{units}} {-y#{units}} \
+{-z} dvifile(s)",
+g_progname);
+#endif /* POSTSCRIPT */
+
+#if TOSHIBAP1351
+ (void)sprintf(message,
+ "Usage: %s {-a} {-b} {-c#} {-d#} {-eENVNAME=value} {-ffontsubfile} \
+{-l} {-m#} {-o#:#:#} {-o#:#} {-o#} {-p} {-r} {-x#{units}} {-y#{units}} \
+dvifile(s)",
+g_progname);
+#endif
+
+ (void)fprintf(fp,message);
+ NEWLINE(fp);
+
+
+ (void)fprintf(fp,
+ "For documentation on this program, try the operating command(s):");
+ NEWLINE(fp);
+
+ (void)fprintf(fp,helpcmd);
+ NEWLINE(fp);
+ NEWLINE(fp);
+}
diff --git a/dviware/beebe/src/vms/00make.com b/dviware/beebe/src/vms/00make.com
new file mode 100644
index 0000000000..a6db68b1b6
--- /dev/null
+++ b/dviware/beebe/src/vms/00make.com
@@ -0,0 +1,71 @@
+$ !=====================================================================
+$ ! Makefile for files in directory [.TEX.DVI]
+$ !
+$ ! Since VMS C is a separately licensed (and expensive) product, many
+$ ! PLOT79 sites will not have it. In order to make it possible to use
+$ ! the software in this directory, we try to link using the
+$ ! NON-shareable C run-time library, VAXCRTL.OLB, instead of the
+$ ! shareable version (which might be VMS release-dependent). Also, we
+$ ! set the default file protection for .OBJ and .EXE files created by
+$ ! this command procedure to values which EXCLUDE delete permission.
+$ ! That way, clean-up by [--]00CLEAN.COM will never remove these files.
+$ !
+$ ! [24-Nov-86]
+$ !=====================================================================
+$ save_prot = f$environment("PROTECTION")
+$ on control_y then -
+ goto done
+$ if f$search("sys$share:vaxcrtl.olb") .nes. "" then -
+ CLIB :== [--]unixclib.olb/library,sys$share:vaxcrtl.olb/library
+$ if f$search("sys$share:vaxcrtl.olb") .eqs. "" then -
+ CLIB :== [--]unixclib.olb/library,[]cc.opt/option
+$ set protection=(s:re,o:re,g:re,w:re)/default
+$ if f$search("sys$system:vaxc.exe") .nes. "" then goto HAVEC
+$ write sys$output "No C compiler available"
+$ goto more
+$ HAVEC:
+$ ccom cp
+$ ccom dvi*
+$ ccom echoall
+$ ccom lptops
+$ ccom macjet
+$ ccom macprx
+$ ccom texidx
+$ ccom tosprx
+$ ccom vaxvms
+$ ccom wsltex
+$ MORE:
+$ !
+$ ! PLT:UNIXCLIB contains replacements for standard Unix
+$ ! routines which VMS C does not have.
+$ if f$search("[--]unixclib.olb") .eqs. "" then -
+ library /create [--]unixclib.olb
+$ set file /protection=(w:rwe) [--]unixclib.olb
+$ library [--]unixclib.olb vaxvms.obj.0
+$ set file /protection=(w:re) [--]unixclib.olb
+$ !
+$ link /nomap/exec=[--] CP,'CLIB'
+$ link /nomap/exec=[--] DVIALW,'CLIB'
+$ link /nomap/exec=[--] DVIBIT,'CLIB'
+$ link /nomap/exec=[--] DVICAN,'CLIB'
+$ ! DVIGD not of interest outside Utah
+$ ! link /nomap/exec=[--] DVIGD,'CLIB'
+$ link /nomap/exec=[--] DVIIMP,'CLIB'
+$ link /nomap/exec=[--] DVIJEP,'CLIB'
+$ link /nomap/exec=[--] DVIJET,'CLIB'
+$ link /nomap/exec=[--] DVIM72,'CLIB'
+$ link /nomap/exec=[--] DVIMAC,'CLIB'
+$ link /nomap/exec=[--] DVIMPI,'CLIB'
+$ link /nomap/exec=[--] DVIO72,'CLIB'
+$ link /nomap/exec=[--] DVIOKI,'CLIB'
+$ link /nomap/exec=[--] DVIPRX,'CLIB'
+$ link /nomap/exec=[--] DVITOS,'CLIB'
+$ link /nomap/exec=[--] ECHOALL,'CLIB'
+$ link /nomap/exec=[--] LPTOPS,'CLIB'
+$ link /nomap/exec=[--] MACJET,'CLIB'
+$ link /nomap/exec=[--] MACPRX,'CLIB'
+$ link /nomap/exec=[--] TEXIDX,'CLIB'
+$ link /nomap/exec=[--] TOSPRX,'CLIB'
+$ link /nomap/exec=[--] WSLTEX,'CLIB'
+$ done:
+$ set protection=('save_prot') /default
diff --git a/dviware/beebe/src/vms/ccom.com b/dviware/beebe/src/vms/ccom.com
new file mode 100644
index 0000000000..fc3e1950a4
--- /dev/null
+++ b/dviware/beebe/src/vms/ccom.com
@@ -0,0 +1,79 @@
+$ SAVE_VERIFY = F$VERIFY()
+$ SET NOVERIFY
+$ !-----------------------------------------------------------------------
+$ ! Compile C files in connected directory:
+$ !
+$ ! Usage: @CCOM prefix compileoptions
+$ !
+$ ! where prefix is a wild-card specification of the names of .C files
+$ ! to be compiled.
+$ !
+$ ! Examples:
+$ ! Compile everything:
+$ ! @CCOM *
+$ !
+$ ! Compile today's efforts:
+$ ! @CCOM * "" /SINCE
+$ !
+$ ! Compile certain routines changed since yesterday:
+$ ! @CCOM F%%%.C,G*.C,*UPD* /LIST/MACHINE_CODE /SINCE=YESTERDAY
+$ !
+$ ! Note in the last example that the extension .C must be supplied
+$ ! for all but the last file, which gets one automatically. In the
+$ ! second example, the switch /SINCE means the same as /SINCE:TODAY.
+$ ! [27-NOV-86]
+$ !-----------------------------------------------------------------------
+$ !
+$ ON CONTROL_Y THEN $ GOTO DONE
+$ !
+$ IF P1 .EQS. "" THEN INQUIRE P1 "Wild-card name of C files to compile"
+$ !
+$ DIRECTORY /VER=1/COL=1/NODATE/NOSIZE/NOHEAD/NOTRAIL/OUT=DIR.TMP'P3' 'P1'.C
+$ !
+$ IF .NOT. $STATUS THEN GOTO DIRECTORY_ERROR
+$ !
+$ OPEN /READ DIRFILE DIR.TMP
+$ !
+$ NEWLINE:
+$ READ /END=DONE DIRFILE NAME
+$ DEV := 'F$PARSE(NAME,,,"DEVICE")'
+$ DIR := 'F$PARSE(NAME,,,"DIRECTORY")'
+$ NAM := 'F$PARSE(NAME,,,"NAME")'
+$ EXT := 'F$PARSE(NAME,,,"TYPE")'
+$ LEADER := 'DEV''DIR''NAM'
+$ C_STAMP = F$FILE_ATTRIBUTES("''LEADER'.C","RDT")
+$ C_STAMP = F$CVTIME(C_STAMP)
+$ OBJ_STAMP = F$SEARCH("''LEADER'.OBJ")
+$ IF OBJ_STAMP .NES. "" THEN -
+ OBJ_STAMP = F$FILE_ATTRIBUTES("''LEADER'.OBJ","RDT")
+$ IF OBJ_STAMP .NES. "" THEN -
+ OBJ_STAMP = F$CVTIME(OBJ_STAMP)
+$ IF C_STAMP .LES. OBJ_STAMP THEN -
+ IF F$MODE() .EQS. "INTERACTIVE" THEN -
+ WRITE SYS$OUTPUT "''LEADER'.OBJ is up-to-date"
+$ IF C_STAMP .LES. OBJ_STAMP THEN -
+ GOTO NEWLINE
+$ WRITE SYS$OUTPUT "{",NAME,"}"
+$ SET NOON ! Ignore errors
+$ DEFINE/USER SYS SYS$LIBRARY ! so #include <sys/foo.h> works
+$ CC /NOLIST/DEBUG=(SYMBOLS,TRACEBACK) 'P2' 'NAME' /OBJECT='LEADER'.OBJ
+$ SET ON ! Restore error checking
+$ GOTO NEWLINE
+$ !
+$ DONE:
+$ CLOSE DIRFILE/ERROR=NOTOPEN
+$ !
+$ NOTOPEN:
+$ SET FILE /PROTECTION=(W:REWD) DIR.TMP;*
+$ DELETE DIR.TMP;*
+$ !
+$ GOTO EXIT
+$ !
+$ DIRECTORY_ERROR:
+$ WRITE SYS$OUTPUT "Error: ''F$MESSAGE()'"
+$ SET FILE /PROTECTION=(W:REWD) DIR.TMP;*
+$ DELETE DIR.TMP;*
+$ !
+$ EXIT:
+$ IF SAVE_VERIFY THEN SET VERIFY
+$ EXIT
diff --git a/dviware/beebe/src/vms/makefile.vms b/dviware/beebe/src/vms/makefile.vms
new file mode 100644
index 0000000000..d16fea0091
--- /dev/null
+++ b/dviware/beebe/src/vms/makefile.vms
@@ -0,0 +1,520 @@
+# Makefile for files in [.TEX.DVI] using VMS MAKE and CC
+#
+# Current target list:
+# all clean
+# 00arit dvialw dvibit dvican dvie72 dvieps dvigd dviimp
+# dvijep dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72
+# dvioki dviPGM dviprx dvitos keytst lptops lw78 texidx
+# tosprx xxu
+#
+# [21-Oct-87] -- added dvie72 and dvieps
+# [22-Sep-87] -- added generic target dviPGM (say "make PGM=foo dvifoo" to
+# build dvifoo); add XCFLAGS to allow extra compile-time
+# options without having to respecify the long path variables
+# [15-Apr-87] -- rebuilt dependency lists using "awk -f include.awk *.c"
+# [08-Jul-87]
+
+XCFLAGS=
+
+CFLAGS = /DEFINE=("OS_VAXVMS"=1)/DEBUG=ALL/NOOPTIMIZE$(XCFLAGS)
+
+LIBS = [--]unixclib.olb/lib, sys$$library:vaxcrtl.olb/lib
+
+LFLAGS =
+
+LINK = link
+
+RUN = run
+
+# Where the executable files reside
+
+B = [--]
+
+# Object and executable file extensions
+
+O = .obj
+
+X = .exe
+
+# Rules
+
+.c.obj:
+ $(CC) $(CFLAGS) $<
+
+HFILES = abortrun.h actfact.h alldone.h bitmap.h \
+ chargf.h charpk.h charpxl.h \
+ clrbmap.h clrrow.h commands.h dbgopen.h \
+ dispchar.h dumpchar.h dvifile.h dvihead.h \
+ dviinit.h dviterm.h f20open.h \
+ fatal.h fillrect.h findpost.h fixpos.h \
+ fontfile.h fontsub.h gblprocs.h gblvars.h \
+ gendefs.h getbmap.h getbytes.h getfntdf.h \
+ getpgtab.h inch.h initglob.h keydef.h \
+ loadchar.h machdefs.h main.h movedown.h \
+ moveover.h moveto.h nosignex.h openfont.h \
+ option.h outrow.h prtpage.h prxbmap.h \
+ readfont.h readgf.h readpk.h readpost.h \
+ readpxl.h reldfont.h rulepxl.h setchar.h \
+ setfntnm.h setrule.h signex.h skgfspec.h \
+ skipfont.h skpkspec.h special.h strchr.h \
+ strcm2.h strid2.h strrchr.h tctos.h \
+ typedefs.h usage.h warning.h
+
+DVIHEAD = dvihead.h machdefs.h typedefs.h
+
+MAIN = main.h commands.h gendefs.h gblprocs.h gblvars.h
+
+# Targets (lw78 is excluded--most Unix sites have Transcript or devps
+# which offer similar features, and lw78 has not been adapted to VMS)
+
+all: dvialw dvibit dvican dvie72 dvieps dvigd dviimp dvijep\
+ dvijet dvil3p dvil75 dvim72 dvimac dvimpi dvio72 dvioki\
+ dviprx dvitos keytst lptops texidx tosprx
+
+clean:
+ delete *$(O).*
+ delete *$(X).*
+
+00arit: 00arit$(X)
+
+dvialw: $(B)dvialw$(X)
+
+dvibit: $(B)dvibit$(X)
+
+dvican: $(B)dvican$(X)
+
+dvie72: $(B)dvie72$(X)
+
+dvieps: $(B)dvieps$(X)
+
+dvigd: $(B)dvigd$(X)
+
+dviimp: $(B)dviimp$(X)
+
+dvijep: $(B)dvijep$(X)
+
+dvijet: $(B)dvijet$(X)
+
+dvil3p: $(B)dvil3p$(X)
+
+dvil75: $(B)dvil75$(X)
+
+dvim72: $(B)dvim72$(X)
+
+dvimac: $(B)dvimac$(X)
+
+dvimpi: $(B)dvimpi$(X)
+
+dvio72: $(B)dvio72$(X)
+
+dvioki: $(B)dvioki$(X)
+
+dvi$(PGM): $(B)dvi$(PGM)$(X)
+
+dviprx: $(B)dviprx$(X)
+
+dvitos: $(B)dvitos$(X)
+
+keytst: keytst$(X)
+
+lptops: $(B)lptops$(X)
+
+lw78: lw78$(X)
+
+texidx: $(B)texidx$(X)
+
+tosprx: tosprx$(X)
+
+# ======================================================================
+# Dependency lists and rules
+
+00arit$(X):
+ $(RM) 00arit$(O).*
+ $(RM) 00arit$(X).*
+ $(CC) /DEFINE=("SIZE=short") 00arit$(C)
+ $(LINK) $(LFLAGS) 00arit$(C),$(LIBS)
+ $(RUN) 00arit$(X)
+ $(RM) 00arit$(O).*
+ $(RM) 00arit$(X).*
+ $(CC) /DEFINE=("SIZE=int") 00arit$(C)
+ $(LINK) $(LFLAGS) 00arit$(C),$(LIBS)
+ $(RUN) 00arit$(X)
+ $(RM) 00arit$(O).*
+ $(RM) 00arit$(X).*
+ $(CC) /DEFINE=("SIZE=long") 00arit$(C)
+ $(LINK) $(LFLAGS) 00arit$(C),$(LIBS)
+ $(RUN) 00arit$(X)
+ $(RM) 00arit$(O).*
+ $(RM) 00arit$(X).*
+
+$(B)dvialw$(X): dvialw$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvialw$(O), fndfil$(O), $(LIBS)
+
+$(B)dvibit$(X): dvibit$(O) keybrd$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvibit$(O), keybrd$(O), \
+ fndfil$(O), $(LIBS)
+
+$(B)dvican$(X): dvican$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvican$(O), fndfil$(O), $(LIBS)
+
+$(B)dvie72$(X): dvie72$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvie72$(O), fndfil$(O), $(LIBS)
+
+$(B)dvieps$(X): dvieps$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvieps$(O), fndfil$(O), $(LIBS)
+
+$(B)dvigd$(X): dvigd$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvigd$(O), fndfil$(O), $(LIBS)
+
+$(B)dviimp$(X): dviimp$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dviimp$(O), fndfil$(O), $(LIBS)
+
+$(B)dvijep$(X): dvijep$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvijep$(O), fndfil$(O), $(LIBS)
+
+$(B)dvijet$(X): dvijet$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvijet$(O), fndfil$(O), $(LIBS)
+
+$(B)dvil3p$(X): dvil3p$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvil3p$(O), fndfil$(O), $(LIBS)
+
+$(B)dvil75$(X): dvil75$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvil75$(O), fndfil$(O), $(LIBS)
+
+$(B)dvim72$(X): dvim72$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvim72$(O), fndfil$(O), $(LIBS)
+
+$(B)dvimac$(X): dvimac$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvimac$(O), fndfil$(O), $(LIBS)
+
+$(B)dvimpi$(X): dvimpi$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvimpi$(O), fndfil$(O), $(LIBS)
+
+$(B)dvio72$(X): dvio72$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvio72$(O), fndfil$(O), $(LIBS)
+
+$(B)dvioki$(X): dvioki$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvioki$(O), fndfil$(O), $(LIBS)
+
+$(B)dviprx$(X): dviprx$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dviprx$(O), fndfil$(O), $(LIBS)
+
+$(B)dvi$(PGM)$(X): dvi$(PGM)$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvi$(PGM)$(O), fndfil$(O), $(LIBS)
+
+$(B)dvitos$(X): dvitos$(O) fndfil$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) dvitos$(O), fndfil$(O), $(LIBS)
+
+keytst$(X): keytst$(O) keybrd$(O)
+ $(LINK) $(LFLAGS) keytst$(O), keybrd$(O), $(LIBS)
+
+$(B)lptops$(X): lptops$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) lptops$(O), $(LIBS)
+
+# Warning: lw78 has not been adapted for VAX VMS
+
+lw78$(X): lw78$(O)
+ $(LINK) $(LFLAGS) lw78$(O), $(LIBS)
+
+$(B)texidx$(X): texidx$(O)
+ $(LINK) $(LFLAGS) /EXEC=$(B) texidx$(O), $(LIBS)
+
+tosprx$(X): tosprx$(O)
+ $(LINK) $(LFLAGS) tosprx$(O), $(LIBS)
+
+# Object file dependencies
+
+dvialw$(O): dvialw.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h strchr.h strcm2.h\
+ strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvibit$(O): dvibit.c\
+ $(DVIHEAD) keydef.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h findpost.h fixpos.h fontfile.h\
+ fontsub.h getbytes.h getfntdf.h getpgtab.h inch.h\
+ initglob.h movedown.h moveover.h moveto.h nosignex.h\
+ openfont.h option.h prtpage.h readfont.h readgf.h\
+ readpk.h readpost.h readpxl.h reldfont.h rulepxl.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvican$(O): dvican.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+
+dvie72$(O): dvie72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvieps$(O): dvieps.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvigd$(O): dvigd.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dviimp$(O): dviimp.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijep$(O): dvijep.c\
+ $(DVIHEAD) $(MAIN) abortrun.h actfact.h alldone.h\
+ chargf.h charpk.h charpxl.h clrrow.h dbgopen.h dvifile.h\
+ dviinit.h dviterm.h f20open.h fatal.h findpost.h\
+ fixpos.h fontfile.h fontsub.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h movedown.h moveover.h\
+ moveto.h nosignex.h openfont.h option.h prtpage.h\
+ readfont.h readgf.h readpk.h readpost.h readpxl.h\
+ reldfont.h rulepxl.h setfntnm.h setrule.h signex.h\
+ skgfspec.h skipfont.h skpkspec.h special.h strchr.h\
+ strcm2.h strid2.h strrchr.h tctos.h usage.h warning.h
+
+
+dvijet$(O): dvijet.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dbgopen.h dvifile.h dviinit.h dviterm.h dispchar.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h initglob.h inch.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil3p$(O): dvil3p.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvil75$(O): dvil75.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvim72$(O): dvim72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimac$(O): dvimac.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvimpi$(O): dvimpi.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvio72$(O): dvio72.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvioki$(O): dvioki.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvi$(PGM): dvi$(PGM)$(O) keybrd$(O)
+ $(CC) $(CFLAGS) dvi$(PGM)$(O) keybrd$(O) -o dvi$(PGM) $(LFLAGS)
+
+dviprx$(O): dviprx.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+dvitos$(O): dvitos.c\
+ $(DVIHEAD) bitmap.h $(MAIN) abortrun.h actfact.h\
+ alldone.h chargf.h charpk.h charpxl.h clrbmap.h\
+ clrrow.h dispchar.h dbgopen.h dvifile.h dviinit.h dviterm.h\
+ f20open.h fatal.h fillrect.h findpost.h fixpos.h\
+ fontfile.h fontsub.h getbmap.h getbytes.h getfntdf.h\
+ getpgtab.h inch.h initglob.h loadchar.h movedown.h\
+ moveover.h moveto.h nosignex.h openfont.h option.h\
+ outrow.h prtpage.h readfont.h readgf.h readpk.h\
+ readpost.h readpxl.h reldfont.h rulepxl.h setchar.h\
+ setfntnm.h setrule.h signex.h skgfspec.h skipfont.h\
+ skpkspec.h special.h strchr.h strcm2.h strid2.h\
+ strrchr.h tctos.h usage.h warning.h
+
+
+keybrd$(O): keybrd.c\
+ keydef.h
+
+
+keytst$(O): keytst.c\
+ keydef.h
+
+
+lptops$(O): lptops.c\
+ inch.h strcm2.h
+
+
+tosprx$(O): tosprx.c\
+ machdefs.h typedefs.h gendefs.h gblprocs.h clrbmap.h
diff --git a/dviware/beebe/src/vms/vaxvms.c b/dviware/beebe/src/vms/vaxvms.c
new file mode 100644
index 0000000000..18db372271
--- /dev/null
+++ b/dviware/beebe/src/vms/vaxvms.c
@@ -0,0 +1,1023 @@
+/***********************************************************************
+This file provides alternative functions for several VMS VMS C library
+routines which either unacceptable, or incorrect, implementations. They
+have been developed and tested under VMS Version 4.4, but indications
+are that they apply to earlier versions, back to 3.2 at least. They
+should be retested with each new release of VMS C.
+
+Some of these (memxxx(), strxxx(), and system()) are available with VMS
+C 2.3 or later, but these versions should still work.
+
+Contents:
+ EXIT
+ FSEEK
+ FTELL
+ GETCHAR
+ GETENV
+ READ
+ UNGETC
+ getjpi -- system-service access
+ getlogin
+ memchr
+ memcmp
+ memcpy
+ memmove
+ memset
+ qsort
+ stricmp
+ strtok
+ strtol
+ system
+ tell
+ unlink
+ utime
+
+The VAX VMS file system record structure has unfortunate consequences
+for random access files.
+
+By default, text files written by most system utilities, and languages
+other than C, have a variable length record format, in which a 16-bit
+character count is aligned on an even-byte boundary in the disk block
+b(always 512 bytes in VMS, independent of record and file formats),
+followed by <count> bytes of data. Binary files, such as .EXE, .OBJ,
+and TeX .DVI and font files, all use a 512-byte fixed record format
+which has no explicit length field. No file byte count is stored;
+instead, the block count, and the offset of the last data byte in the
+last block are recorded in the file header (do ``DUMP/HEADER filespec''
+to see it). For binary files with fixed-length records, the last block
+is normally assumed to be full, and consequently, file transfer of
+binary data from other machines via Kermit, FTP, or DCL COPY from ANSI
+tapes, generally fails because the input file length is not a multiple
+of 512.
+
+This record organization may be contrasted with the STREAM, STREAM_LF,
+and STREAM_CR organizations supported from Version 4.0; in these, disk
+blocks contain a continuous byte stream in which nothing, or LF, or CR,
+is recognized as a record terminator. These formats are similar to the
+Unix and TOPS-20 file system formats which also use continuous byte
+streams.
+
+For C, this means that a program operating on a file in record format
+cannot count input characters and expect that count to be the same value
+as the offset parameter passed to fseek(), which numerous C programs
+assume to be the case. The draft ANSI C standard, and Harbison and
+Steele's ``C Reference Manual'', emphasize that only values returned by
+ftell() should be used as arguments to fseek(), allowing the program to
+return to a position previously read or written. UNFORTUNATELY, VMS C
+ftell() DOES NOT RETURN A CORRECT OFFSET VALUE FOR RECORD FILES.
+Instead, for record files, it returns the byte offset of the start of
+the current record, no matter where in that record the current position
+may be. This misbehavior is completely unnecessary, since the
+replacements below perform correctly, and are written entirely in C.
+
+Another problem is that ungetc(char c, FILE* fp) is unreliable. VMS C
+implements characters as signed 8-bit integers (so do many other C
+implementations). fgetc(FILE* fp) returns an int, not a char, whose
+value is EOF (-1) in the event of end-of-file; however, this value will
+also be returned for a character 0xFF, so it is essential to use
+feof(FILE *fp) to test for a true end-of-file condition when EOF is
+returned. ungetc() checks the sign of its argument c, and if it is
+negative (which it will be for 128 of the 256 signed bytes), REFUSES TO
+PUT IT BACK IN THE INPUT STREAM, on the assumption that c is really EOF.
+This too can be fixed; ungetc() should only do nothing if feof()
+indicates a true end-of-file condition. The overhead of this is
+trivial, since feof() is actually implemented as a macro which does
+nothing more than a logical AND and compare-with-zero.
+
+getchar() waits for a <CR> to be typed when stdin is a terminal; the
+replacement vms_getchar() remedies this.
+
+Undoubtedly other deficiencies in VMS C will reveal themselves.
+
+VMS read() returns only a single disk block on each call. Its
+replacment, vms_read(), will return the requested number of bytes, if
+possible.
+
+[29-Apr-87] Brendan Mackay (munnari!anucsd.oz!bdm@seismo.CSS.GOV)
+This fix has been incorporated in vms_read() below. Here are Brendan's
+comments:
+>> The code for vms_read() has problems. One is that you don't test for
+>> end of file. The other is that there is a bug in the C library which
+>> prevents you asking for more than 65535 bytes at a time. It is
+>> documented that no more than 65535 bytes will be returned, but not
+>> that you can't ask for more. If you do, it reduces your request mod
+>> 65536!
+
+There are also a few Unix standard functions which are unimplemented.
+qsort() is not provided. getlogin() and unlink() have VMS equivalents
+provided below. tell() is considered obsolete, since its functionality
+is available from lseek(), but it is still seen in a few programs, so is
+provided below. getenv() fails if the name contains a colon; its
+replacement allows the colon.
+
+In the interest of minimal source perturbation, replacements for VMS
+functions are given the same names, but prefixed "vms_". For
+readability, the original names are preserved, but are converted to
+upper-case:
+
+ #define FTELL vms_ftell
+ #define FSEEK vms_fseek
+ #define GETCHAR vms_getchar
+ #define GETENV vms_getenv
+ #define UNGETC vms_ungetc
+
+These are only defined to work correctly for fixed length 512-byte
+records, and no check is made that the file has that organization (it is
+possible, but not without expensive calls to fstat(), or access to
+internal library structures).
+
+[02-Apr-87] -- Nelson H.F. Beebe, University of Utah Center for
+ Scientific Computing
+[13-Apr-88] -- added memxxx(), strxxx(), fixed return code in system()
+***********************************************************************/
+
+#if 1 /* prior to VMS C 2.3 */
+#define VOIDP char* /* char* prior to ANSI C */
+#define const /* const is a type modifier in ANSI C */
+#else /* VMS C 2.3 or later */
+#define VOIDP void* /* char* prior to ANSI C */
+#endif
+
+#define EXIT vms_exit
+#define FTELL vms_ftell
+#define FSEEK vms_fseek
+#define GETENV vms_getenv
+#define GETCHAR vms_getchar
+#define READ vms_read
+#define UNGETC vms_ungetc
+
+#include <stdio.h>
+
+#if 0
+#include <string.h> /* stupid VMS gets type of memchr() wrong! */
+#else
+char* strchr();
+#endif
+
+#include <types.h>
+#include <ctype.h>
+#include <errno.h> /* need for utime() */
+#include <stat.h>
+#include <rms.h> /* need for utime() */
+#include <descrip.h>
+#include <iodef.h> /* need for vms_getchar() */
+#include <ssdef.h>
+#include <time.h> /* need for utime() */
+
+/**********************************************************************/
+/*-->EXIT*/
+
+void
+vms_exit(code)
+int code;
+{
+ switch (code)
+ {
+ case 0:
+ exit(1); /* success */
+ break;
+
+ default:
+ exit((1 << 28) + 2); /* error */
+ break; /* (suppresses %NONAME-E-NOMSG) */
+ }
+}
+
+
+/**********************************************************************/
+/*-->FSEEK*/
+
+/* VMS fseek() and ftell() on fixed-length record files work correctly
+only at block boundaries. This replacement code patches in the offset
+within the block. Directions from current position and from
+end-of-file are converted to absolute positions, and then the code for
+that case is invoked. */
+
+long
+FSEEK(fp,n,dir)
+FILE *fp;
+long n;
+long dir;
+{
+ long k,m,pos,val,oldpos;
+ struct stat buffer;
+
+ for (;;) /* loops only once or twice */
+ {
+ switch (dir)
+ {
+ case 0: /* from BOF */
+ oldpos = FTELL(fp); /* get current byte offset in file */
+ k = n & 511; /* offset in 512-byte block */
+ m = n >> 9; /* relative block number in file */
+ if (((*fp)->_cnt) && ((oldpos >> 9) == m)) /* still in same block */
+ {
+ val = 0; /* success */
+ (*fp)->_ptr = ((*fp)->_base) + k; /* reset pointers to requested byte */
+ (*fp)->_cnt = 512 - k;
+ }
+ else
+ {
+ val = fseek(fp,m << 9,0); /* move to start of requested 512-byte block */
+ if (val == 0) /* success */
+ {
+ (*fp)->_cnt = 0; /* indicate empty buffer */
+ (void)fgetc(fp); /* force refill of buffer */
+ (*fp)->_ptr = ((*fp)->_base) + k; /* reset pointers to requested byte */
+ (*fp)->_cnt = 512 - k;
+ }
+ }
+ return(val);
+
+ case 1: /* from current pos */
+ pos = FTELL(fp);
+ if (pos == EOF) /* then error */
+ return (EOF);
+ n += pos;
+ dir = 0;
+ break; /* go do case 0 */
+
+ case 2: /* from EOF */
+ val = fstat(fileno(fp),&buffer);
+ if (val == EOF) /* then error */
+ return (EOF);
+ n += buffer.st_size - 1; /* convert filesize to offset and */
+ /* add to requested offset */
+ dir = 0;
+ break; /* go do case 0 */
+
+ default: /* illegal direction parameter */
+ return (EOF);
+ }
+ }
+}
+
+/**********************************************************************/
+/*-->FTELL*/
+
+/* With fixed-length record files, ftell() returns the offset of the
+start of block. To get the true position, this must be biased by
+the offset within the block. */
+
+long
+FTELL(fp)
+FILE *fp;
+{
+ char c;
+ long pos;
+ long val;
+ if ((*fp)->_cnt == 0) /* buffer empty--force refill */
+ {
+ c = fgetc(fp);
+ val = UNGETC(c,fp);
+ if (val != c)
+ return (EOF); /* should never happen */
+ }
+ pos = ftell(fp); /* this returns multiple of 512 (start of block) */
+ if (pos >= 0) /* then success--patch in offset in block */
+ pos += ((*fp)->_ptr) - ((*fp)->_base);
+ return (pos);
+}
+
+/**********************************************************************/
+/*-->GETCHAR*/
+
+static int tt_channel = -1; /* terminal channel for image QIO's */
+
+#define FAILED(status) (~(status) & 1) /* failure if LSB is 0 */
+
+int
+GETCHAR()
+{
+ int ret_char; /* character returned */
+ int status; /* system service status */
+ static $DESCRIPTOR(sys_in,"TT:");
+
+ if (tt_channel == -1) /* then first call--assign channel */
+ {
+ status = sys$assign(&sys_in,&tt_channel,0,0);
+ if (FAILED(status))
+ lib$stop(status);
+ }
+ ret_char = 0;
+ status = sys$qiow(0,tt_channel,IO$_TTYREADALL | IO$M_NOECHO,0,0,0,
+ &ret_char,1,0,0,0,0);
+ if (FAILED(status))
+ lib$stop(status);
+
+ return (ret_char);
+}
+
+
+/**********************************************************************/
+/*-->memchr*/
+
+/* This is a simple implementation of memchr(), which searches for the
+first occurrence of a byte in the first n bytes of a byte string. A
+library version should use hardware moves, or unrolled loops, or other
+tricks for greater efficiency. */
+
+VOIDP
+memchr(s,c,n)
+const VOIDP s;
+int c;
+size_t n;
+{
+ for (; n > 0; s++,--n)
+ if ((unsigned char)(*s) == (unsigned char)c)
+ return ((VOIDP)s);
+ return ((VOIDP)NULL);
+}
+
+
+/**********************************************************************/
+/*-->memcmp*/
+
+/* This is a simple implementation of memcmp(), which compares two
+objects byte by byte, stopping after n bytes. A library version
+should use hardware moves, or unrolled loops, or other tricks for
+greater efficiency. */
+
+int
+memcmp(s1,s2,n)
+const VOIDP s1;
+const VOIDP s2;
+size_t n;
+{
+ VOIDP org_s1 = s1;
+ VOIDP org_s2 = s2;
+
+ for (; n > 0; --n, s1++, s2++)
+ {
+ if (*s1 < *s2)
+ return (-(int)(s2 - org_s2));
+ else if (*s1 > *s2)
+ return ((int)(s2 - org_s2));
+ }
+ return (0);
+}
+
+
+
+
+/**********************************************************************/
+/*-->memcpy*/
+
+/* This is a simple implementation of memcpy(), which copies source
+to target with undefined behavior in the event of overlap. This
+particular implementation copies from first to last byte, in order. */
+
+VOIDP
+memcpy(t,s,n)
+VOIDP t; /* target */
+const VOIDP s; /* source */
+size_t n;
+{
+ for (; n > 0; --n)
+ *t++ = *s++; /* copy in forward order */
+}
+
+/**********************************************************************/
+/*-->memmove*/
+
+/* This is a simple implementation of memmove(), which copies as if the
+source were first completely copied to a temporary area, then that
+area were copied to the target. A library version should
+use hardware moves, or unrolled loops, or other tricks for greater
+efficiency. */
+
+VOIDP
+memmove(t,s,n)
+VOIDP t; /* target */
+const VOIDP s; /* source */
+size_t n;
+{
+ if ((s < t) && ((s + n) > t)) /* source overlaps target from below */
+ for (s += n, t += n; n > 0; --n)
+ *t-- = *s--; /* copy in reverse order */
+ else
+ for (; n > 0; --n)
+ *t++ = *s++; /* copy in forward order */
+}
+
+/**********************************************************************/
+/*-->memset*/
+
+/* This is a simple implementation of memset(). A library version should
+use hardware moves, or unrolled loops, or other tricks for greater
+efficiency. */
+
+
+VOIDP
+memset(s,ch,n)
+VOIDP s; /* target */
+int ch; /* fill character (treated as unsigned char) */
+size_t n; /* fill count */
+{
+ for (; n > 0; --n)
+ *s++ = (unsigned char)ch;
+}
+
+/**********************************************************************/
+/*-->READ*/
+int
+READ(file_desc,buffer,nbytes)
+register int file_desc;
+register char *buffer;
+register int nbytes;
+{
+ register int ngot;
+ register int left;
+
+ for (left = nbytes; left > 0; /* NOOP */)
+ {
+ ngot = read(file_desc,buffer,(left > 65024 ? 65024 : left));
+ if (ngot < 0)
+ return (-1); /* error occurred */
+ if (ngot == 0) /* eof occurred */
+ return(nbytes-left);
+ buffer += ngot;
+ left -= ngot;
+ }
+ return(nbytes-left);
+}
+
+
+/**********************************************************************/
+/*-->UNGETC*/
+long
+UNGETC(c,fp) /* VMS ungetc() is a no-op if c < 0 (which is half the time!) */
+char c;
+FILE *fp;
+{
+
+ if ((c == EOF) && feof(fp))
+ return (EOF); /* do nothing at true end-of-file */
+ else if ((*fp)->_cnt >= 512)/* buffer full--no fgetc() done in this block!*/
+ return (EOF); /* must be user error if this happens */
+ else /* put the character back in the buffer */
+ {
+ (*fp)->_cnt++; /* increase count of characters left */
+ (*fp)->_ptr--; /* backup pointer to next available char */
+ *((*fp)->_ptr) = c; /* save the character */
+ return (c); /* and return it */
+ }
+}
+
+/**********************************************************************/
+/*-->getenv*/
+char*
+GETENV(name)
+char* name;
+{
+ char* p;
+ char* result;
+ char ucname[256];
+
+ p = ucname;
+ while (*name) /* VMS logical names must be upper-case */
+ {
+ *p++ = islower(*name) ? toupper(*name) : *name;
+ ++name;
+ }
+ *p = '\0';
+
+ p = strchr(ucname,':'); /* colon in name? */
+ if (p == (char *)NULL) /* no colon in name */
+ result = getenv(ucname);
+ else /* try with and without colon */
+ {
+ result = getenv(ucname);
+ if (result == (char *)NULL)
+ {
+ *p = '\0';
+ result = getenv(ucname);
+ *p = ':';
+ }
+ }
+ return (result);
+}
+
+/**********************************************************************/
+/*-->getjpi*/
+
+/***********************************************************************
+Return a system job/process value obtained from the VMS system call
+LIB$GETJPI. This call can return either 32-bit integer values, or
+strings. The obtained value is stored in an internal static buffer
+which is overwritten on subsequent calls.
+
+The function return is a (char*) pointer to that buffer, which must be
+coerced to (long*) if an integer value is obtained. String values are
+guaranteed to be NUL terminated, with no trailing blanks.
+
+The argument, jpi_code, is one of the values defined in <jpidef.h>.
+
+In the event of an error return from LIB$GETJPI, (char*)NULL is returned
+instead.
+
+[30-Oct-87]
+***********************************************************************/
+
+#define LIB$_INVARG 0x158234 /* not defined in standard .h files */
+
+int lib$getjpi();
+
+char*
+getjpi(jpi_code)
+int jpi_code; /* values defined in <jpidef.h> */
+{
+ short retlen = 0;
+ long retval;
+ static char buffer[256]; /* space for up to 255-char results */
+ static $DESCRIPTOR(strdes,buffer);
+
+ strdes.dsc$w_length = sizeof(buffer)-1; /* $DESCRIPTOR doesn't set this */
+
+ /* lib$getjpi() will normally return a string representation.
+ Try first to get the integer representation, then if an invalid
+ argument is signalled, get the string representation. */
+
+ retval = lib$getjpi(&jpi_code,0L,0L,&buffer);
+ if (retval == LIB$_INVARG)
+ {
+ retval = lib$getjpi(&jpi_code,0L,0L,&buffer,&strdes,&retlen);
+ buffer[retlen] = '\0'; /* terminate any string value */
+ while ((retlen > 0) && (buffer[--retlen] == ' '))
+ buffer[retlen] = '\0';
+ }
+
+ return ((retval == SS$_NORMAL) ? (char*)(&buffer) : (char*)NULL);
+}
+
+/**********************************************************************/
+/*-->getlogin*/
+char*
+getlogin()
+{
+ return ((char *)getenv("USER")); /* use equivalent VMS routine */
+}
+
+/**********************************************************************/
+/*-->qsort*/
+
+/***********************************************************************
+TeXindex uses the standard Unix library function qsort() for
+record sorting. Unfortunately, qsort() is not a stable sorting
+algorithm, so input order is not necessarily preserved for equal
+sort keys. This is important, because the sorting is
+case-independent, while the actual entries may not be. For
+example, the input
+
+\entry{i}{22}{{\CODE{i}}}
+\entry{i}{42}{{\CODE{i}}}
+\entry{I}{41}{{\CODE{I}}}
+\entry{I}{42}{{\CODE{I}}}
+
+produces
+
+\initial {I}
+\entry {{\CODE{i}}}{22}
+\entry {{\CODE{I}}}{41--42}
+\entry {{\CODE{i}}}{42}
+
+instead of the correct
+
+\initial {I}
+\entry {{\CODE{i}}}{22, 42}
+\entry {{\CODE{I}}}{41--42}
+
+We therefore provide this stable shellsort replacement for
+qsort() based on the code given on p. 116 of Kernighan and
+Ritchie, ``The C Programming Language'', Prentice-Hall (1978).
+This has order N**1.5 average performance, which is usually
+slower than qsort(). In the interests of simplicity, we make no
+attempt to handle short sequences by alternative methods.
+
+[07-Nov-86]
+***********************************************************************/
+
+
+#define BASE(i) &base[(i)*width]
+
+void
+qsort(base, nel, width, compar)
+ char base[]; /* start of data in memory */
+ int nel; /* number of elements to be sorted */
+ int width; /* size (in bytes) of each element */
+ int (*compar)(); /* comparison function */
+{
+ int gap;
+ int i;
+ int j;
+
+ register int k; /* inner exchange loop parameters */
+ register char* p;
+ register char* q;
+ register char c;
+
+ for (gap = nel/2; gap > 0; gap /= 2)
+ {
+ for (i = gap; i < nel; i++)
+ {
+ for (j = i-gap; j >= 0; j -= gap)
+ {
+ p = BASE(j);
+ q = BASE(j+gap);
+ if ((*compar)(p,q) <= 0)
+ break; /* exit j loop */
+ else
+ {
+ for (k = 0; k < width; (++p, ++q, ++k))
+ {
+ c = *q;
+ *q = *p;
+ *p = c;
+ }
+ }
+ }
+ }
+ }
+}
+
+/**********************************************************************/
+/*-->stricmp*/
+
+/* This is a simple implementation of stricmp(). A library version
+should use hardware support, or unrolled loops, to improve
+performance. */
+
+int
+stricmp(s1,s2) /* compare strings ignoring case */
+const char* s1;
+const char* s2;
+{
+ int c1;
+ int c2;
+ char* org_s1 = s1;
+
+ for (; *s1 && *s2; ++s1, ++s2)
+ {
+ c1 = 0xff & (int)(islower(*s1) ? *s1 : tolower(*s1));
+ c2 = 0xff & (int)(islower(*s2) ? *s2 : tolower(*s2));
+ if (c1 < c2)
+ return (-(int)(s1 - org_s1));
+ else if (c1 > c2)
+ return ((int)(s1 - org_s1));
+ }
+ if (*s1 == '\0')
+ return ((*s2 == '\0') ? 0 : -(int)(s1 - org_s1));
+ else /* (*s2 == '\0') */
+ return ((int)(s1 - org_s1));
+}
+
+/**********************************************************************/
+/*-->strtok*/
+
+/* This is a simple implementation of strtok(). A library version
+should use hardware support, or unrolled loops, to improve
+performance. */
+
+char*
+strtok(s,sepchars)
+char* s; /* non-NULL on first call, NULL on subsequent ones */
+const char* sepchars; /* separator characters */
+{
+ static char* s_init = (char*)NULL;
+ char* start;
+ char* end;
+
+ if (s != (char*)NULL) /* initial call for this s[] */
+ s_init = s;
+ else if ((s_init == (char*)NULL) || (*s_init == '\0'))
+ return ((char*)NULL);
+
+ /* resume scan from saved token start */
+
+ for (start = s_init; *start && strchr(sepchars,*start) != (char*)NULL;
+ start++)
+ /* skip over leading separators */;
+ if (*start == '\0')
+ return ((char*)NULL);
+ for (end = start; *end && strchr(sepchars,*end) == (char*)NULL; end++)
+ /* skip over token */;
+ s_init = *end ? end+1 : end; /* next token starts past this */
+ /* but not beyond end of string */
+ *end = '\0'; /* terminate current token */
+ return (start); /* and return pointer to it */
+}
+
+/**********************************************************************/
+/*-->strtol*/
+
+#define IN(l,a,r) (((l) <= (a)) && ((a) <= (r)))
+
+
+/* This is a simple implementation of ANSI strtol(). A library version
+should be programmed with more care. */
+
+long
+strtol(nptr,endptr,base)
+const char* nptr;
+char** endptr;
+int base;
+{
+ char* q; /* pointer past end of digits */
+ int c; /* current character value */
+ char* pos; /* pointer into digit list */
+ int negative; /* 0 for positive, non-0 for negative */
+ int digit; /* digit value */
+ long number; /* the accumulating number */
+ static char* digits = "0123456789abcdefghijklmnopqrstuvxwyz";
+
+
+ if (!(IN(2,base,36) || (base == 0)))
+ {
+ if (endptr != (char**)NULL)
+ *endptr = (char*)nptr;
+ return (0L);
+ }
+
+
+ while (isspace(*nptr))
+ nptr++; /* ignore leading whitespace */
+
+ switch (*nptr) /* set number sign */
+ {
+ case '-':
+ negative = -1;
+ nptr++;
+ break;
+
+ case '+':
+ negative = 0;
+ nptr++;
+ break;
+
+ default:
+ negative = 0;
+ break;
+ }
+
+ q = (char*)nptr;
+ if (base == 0) /* variable base; set by lookahead */
+ {
+ if (*q == '0')
+ base = ((*(q+1) == 'x') || (*(q+1) == 'X')) ? 16 : 8;
+ else
+ base = 10;
+ }
+
+ /* eliminate optional "0x" or "0X" prefix */
+
+ if ( (base == 16) &&
+ (*q == '0') &&
+ ((*(q+1) == 'x') || (*(q+1) == 'X')) )
+ q += 2;
+
+ number = 0L;
+
+ /* Number conversion is done by shifting rather than multiplication
+ when the base is a power of 2, in order that the results not be
+ impacted by integer overflow. */
+ switch (base)
+ {
+ case 2:
+ while (IN('0',*q,'1'))
+ {
+ number <<= 1;
+ number |= *q - '0';
+ q++;
+ }
+ break;
+
+ case 4:
+ while (IN('0',*q,'3'))
+ {
+ number <<= 2;
+ number |= *q - '0';
+ q++;
+ }
+ break;
+
+
+ case 8:
+ while (IN('0',*q,'7'))
+ {
+ number <<= 3;
+ number |= *q - '0';
+ q++;
+ }
+ break;
+
+
+ case 16:
+ for (;;)
+ {
+ if (!*q)
+ break;
+ c = (unsigned)*q;
+ if (isupper(c))
+ c = tolower(c);
+ pos = strchr(digits,c);
+ if (pos == (char*)NULL)
+ break;
+ digit = pos - digits;
+ if (!IN(0,digit,15))
+ break;
+ number <<= 4;
+ number |= digit;
+ q++;
+ }
+ break;
+
+
+ case 32:
+ for (;;)
+ {
+ if (!*q)
+ break;
+ c = (unsigned)*q;
+ if (isupper(c))
+ c = tolower(c);
+ pos = strchr(digits,c);
+ if (pos == (char*)NULL)
+ break;
+ digit = pos - digits;
+ if (!IN(0,digit,31))
+ break;
+ number <<= 5;
+ number |= digit;
+ q++;
+ }
+ break;
+
+ default: /* all other bases done by multiplication */
+ for (;;) /* accumulate negative so most negative */
+ { /* number on two's-complement is handled */
+ if (!*q)
+ break;
+ c = (unsigned)*q;
+ if (isupper(c))
+ c = tolower(c);
+ pos = strchr(digits,c);
+ if (pos == (char*)NULL)
+ break;
+ digit = pos - digits;
+ if (!IN(0,digit,base-1))
+ break;
+ number *= base;
+ number -= digit;
+ q++;
+ }
+ if (endptr != (char**)NULL)
+ *endptr = q;
+ if (negative)
+ return(number);
+ number = -number;
+ break;
+ }
+ if (negative)
+ number = -number;
+ if (endptr != (char**)NULL)
+ *endptr = q;
+ return (number);
+}
+/**********************************************************************/
+/*-->system*/
+int
+system(s)
+char *s;
+{
+ struct dsc$descriptor t;
+ int stat;
+
+ t.dsc$w_length = strlen(s);
+ t.dsc$a_pointer = s;
+ t.dsc$b_class = DSC$K_CLASS_S;
+ t.dsc$b_dtype = DSC$K_DTYPE_T;
+
+ /* The 3 low-order bits of stat are
+ 0 (warning),
+ 1 (success),
+ 2 (error),
+ 3 (information), or
+ 4 (severe or fatal error)
+ Consider values of 0, 1, or 3 to be success. LIB$SPAWN
+ will usually return SS$_NORMAL, independent of the value
+ of stat.
+ */
+
+ if (LIB$SPAWN(&t,0,0,0,0,0,&stat) != SS$_NORMAL)
+ return (127);
+ switch (stat & 7)
+ {
+ case 0:
+ case 1:
+ case 3:
+ return (0);
+ default:
+ return (127);
+ }
+}
+
+
+/**********************************************************************/
+/*-->tell*/
+long
+tell(handle)
+int handle;
+{
+ return (lseek(handle,0L,1));
+}
+
+/**********************************************************************/
+/*-->unlink*/
+int
+unlink(filename)
+char *filename;
+{
+ return (delete(filename)); /* use equivalent VMS routine */
+}
+
+/**********************************************************************/
+/*-->utime*/
+
+/* utime(path,times) sets the access and modification times of the
+ file 'path' to the Unix binary time values, 'times'. Return 0
+ on success, and -1 on error (setting errno as well). */
+
+utime(path,times) /* VAX VMS C version */
+char* path;
+time_t times[2];
+{
+ int status;
+ struct dsc$descriptor_s time_desc;
+ char *ftime = "23-OCT-1907 12:34:56";
+ struct tm *timeval;
+ static char* months[] = {"JAN","FEB","MAR","APR","MAY","JUN",
+ "JUL","AUG","SEP","OCT","NOV","DEC"};
+ struct FAB fab1;
+ struct XABRDT xab1;
+
+ /* Zero FAB and XAB structures */
+ (void)memset(&fab1,'\0',sizeof(fab1));
+ (void)memset(&xab1,'\0',sizeof(xab1));
+
+ /* Convert Unix binary time to ASCII string for
+ sys$bintime(). We use localtime() instead of ctime(),
+ because although ctime() is simpler, it drops the seconds
+ field, which we would rather preserve. */
+
+ timeval = (struct tm*)localtime(&times[0]);
+ sprintf(ftime,"%02d-%3s-19%02d %02d:%02d:%02d",
+ timeval->tm_mday,
+ months[timeval->tm_mon],
+ timeval->tm_year,
+ timeval->tm_hour,
+ timeval->tm_min,
+ timeval->tm_sec);
+
+ /* Setup fab1 and rab fields. */
+ fab1.fab$b_bid = FAB$C_BID;
+ fab1.fab$b_bln = FAB$C_BLN;
+ fab1.fab$l_fop = FAB$V_UFO;
+ fab1.fab$b_fac = FAB$V_GET;
+ fab1.fab$l_fna = path;
+ fab1.fab$b_fns = strlen(path);
+ fab1.fab$l_xab = &xab1;
+
+ xab1.xab$b_bln = XAB$C_RDTLEN;
+ xab1.xab$b_cod = XAB$C_RDT;
+ xab1.xab$l_nxt = (char*)NULL;
+
+ /* Open the file */
+ status = sys$open(&fab1);
+ if (status != RMS$_NORMAL)
+ {
+ errno = ENOENT;
+ return (-1);
+ }
+
+ /* Convert the time string to a VMS binary time value in the XAB */
+ time_desc.dsc$w_length = strlen(ftime);
+ time_desc.dsc$a_pointer = ftime;
+ time_desc.dsc$b_class = DSC$K_CLASS_S;
+ time_desc.dsc$b_dtype = DSC$K_DTYPE_T;
+ status = sys$bintim(&time_desc,&xab1.xab$q_rdt);
+ if (status != SS$_NORMAL)
+ {
+ status = sys$close(&fab1);
+ errno = EFAULT;
+ return (-1);
+ }
+
+ /* Close the file, updating the revision date/time value */
+ status = sys$close(&fab1);
+ if (status != RMS$_NORMAL)
+ {
+ errno = EACCES;
+ return (-1);
+ }
+ return (0);
+}
diff --git a/dviware/beebe/src/warning.h b/dviware/beebe/src/warning.h
new file mode 100644
index 0000000000..3a18916281
--- /dev/null
+++ b/dviware/beebe/src/warning.h
@@ -0,0 +1,78 @@
+/* -*-C-*- warning.h */
+/*-->warning*/
+/**********************************************************************/
+/****************************** warning *******************************/
+/**********************************************************************/
+
+void
+warning(msg) /* issue a warning */
+char *msg; /* message string */
+{
+
+#if BBNBITGRAPH
+ if (quiet) /* no warnings in quiet mode */
+ return;
+#endif
+
+ if (g_dolog && (g_logfp == (FILE *)NULL) && g_logname[0])
+ {
+ g_logfp = fopen(g_logname,"w+");
+ DEBUG_OPEN(g_logfp,g_logname,"w+");
+ if (g_logfp != (FILE *)NULL)
+ {
+ (void)fprintf(stderr,"[Log file [%s] created]",g_logname);
+ NEWLINE(stderr);
+
+#if OS_TOPS20
+#if PCC_20
+ /* Because of the PCC-20 arithmetic (instead of */
+ /* logical) shift bug wherein a constant expression */
+ /* (1<<35) evaluates to 0 instead of 400000,,000000, */
+ /* we must set CF_nud using a variable, instead of */
+ /* just using a constant "ac1 = makefield(CF_nud,1);" */
+ ac1 = 1;
+ ac1 = makefield(CF_nud,ac1);
+ setfield(ac1,CF_jfn,jfnof(fileno(g_logfp))); /* jfn */
+ setfield(ac1,CF_dsp,FBbyv); /* generation number index in fdb */
+ ac2 = makefield(FB_ret,-1);
+ ac3 = makefield(FB_ret,0);/* set generation count to 0 (infinite) */
+ (void)jsys(JSchfdb,acs); /* ignore any errors */
+#endif /* PCC_20 */
+#endif
+
+ }
+ }
+
+ if (g_dolog && (g_logfp != (FILE *)NULL) && g_logname[0])
+ {
+ NEWLINE(g_logfp);
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ (void)putc('%',g_logfp); /* percent at start of line */
+#endif
+
+ (void)fputs(msg,g_logfp);
+ NEWLINE(g_logfp);
+ (void)fprintf(g_logfp,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(g_logfp);
+ }
+
+ if (g_dolog && (g_logfp == (FILE *)NULL) && g_logname[0])
+ {
+ (void)sprintf(message,"Cannot open log file [%s]",g_logname);
+ fatal(message);
+ }
+ NEWLINE(stderr);
+
+#if (OS_TOPS20 | OS_VAXVMS)
+ (void)putc('%',stderr); /* percent at start of line */
+#endif
+
+ (void)fputs(msg,stderr);
+ NEWLINE(stderr);
+ if (g_logname[0])
+ {
+ (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
+ NEWLINE(stderr);
+ }
+}
diff --git a/dviware/beebe/src/zerom.mac b/dviware/beebe/src/zerom.mac
new file mode 100644
index 0000000000..f61715c049
--- /dev/null
+++ b/dviware/beebe/src/zerom.mac
@@ -0,0 +1,25 @@
+ title ZEROM - C function to zero memory
+COMMENT #
+Zero a block of memory with a fast BLT instruction.
+
+Usage: (void)zerom(array,length);
+#
+ search $mdefs
+ twoseg $text
+ entry zerom
+
+define array <-1(p)> ;n-th arg always at -n(fp)
+define length <-2(p)> ;and here we have fp=p for speed
+
+zerom: skipg length
+ jrst done ;exit if length <= 0
+ hrl 1,array ;[array,,]
+ hlr 1,1 ;[array,,array]
+ hrrz 2,1 ;[0,,array]
+ setzm 0(2) ;array[0] = 0
+ add 2,length ;[0,,array+length]
+ addi 1,1 ;[array,,array+1] = BLT control word
+ blt 1,-1(2) ;clear the array up to array+length-1
+done:
+ popj p, ;return to caller
+ end