summaryrefslogtreecommitdiff
path: root/systems/os2/dviware
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 /systems/os2/dviware
Initial commit
Diffstat (limited to 'systems/os2/dviware')
-rw-r--r--systems/os2/dviware/hp-deskjet/bitmap.h65
-rw-r--r--systems/os2/dviware/hp-deskjet/dog.dvibin0 -> 5888 bytes
-rw-r--r--systems/os2/dviware/hp-deskjet/doga.dvibin0 -> 768 bytes
-rw-r--r--systems/os2/dviware/hp-deskjet/dvihpdj.c335
-rw-r--r--systems/os2/dviware/hp-deskjet/dviinit.h375
-rw-r--r--systems/os2/dviware/hp-deskjet/dvios2.doc22
-rw-r--r--systems/os2/dviware/hp-deskjet/fontfile.h242
-rw-r--r--systems/os2/dviware/hp-deskjet/gendefs.h113
-rw-r--r--systems/os2/dviware/hp-deskjet/hpdj.cmd1
-rw-r--r--systems/os2/dviware/hp-deskjet/initglob.h122
-rw-r--r--systems/os2/dviware/hp-deskjet/m.cmd1
-rw-r--r--systems/os2/dviware/hp-deskjet/machdefs.h842
-rw-r--r--systems/os2/dviware/hp-deskjet/texhelp.ovlbin0 -> 59286 bytes
13 files changed, 2118 insertions, 0 deletions
diff --git a/systems/os2/dviware/hp-deskjet/bitmap.h b/systems/os2/dviware/hp-deskjet/bitmap.h
new file mode 100644
index 0000000000..be0d1bd7fc
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/bitmap.h
@@ -0,0 +1,65 @@
+/***********************************************************************
+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 & !OS_IBMOS2)
+#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 OR OS_IBMOS2 */
+#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/systems/os2/dviware/hp-deskjet/dog.dvi b/systems/os2/dviware/hp-deskjet/dog.dvi
new file mode 100644
index 0000000000..18e168fb45
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/dog.dvi
Binary files differ
diff --git a/systems/os2/dviware/hp-deskjet/doga.dvi b/systems/os2/dviware/hp-deskjet/doga.dvi
new file mode 100644
index 0000000000..aeca50e449
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/doga.dvi
Binary files differ
diff --git a/systems/os2/dviware/hp-deskjet/dvihpdj.c b/systems/os2/dviware/hp-deskjet/dvihpdj.c
new file mode 100644
index 0000000000..cbb2bb88fd
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/dvihpdj.c
@@ -0,0 +1,335 @@
+/* -*-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 300 /* 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 300 /* HP DeskJet 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 DeskJet 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 & !OS_IBMOS2)
+ 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;
+
+ /* Raster header for DeskJet ????? */
+ 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/systems/os2/dviware/hp-deskjet/dviinit.h b/systems/os2/dviware/hp-deskjet/dviinit.h
new file mode 100644
index 0000000000..58423e7fff
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/dviinit.h
@@ -0,0 +1,375 @@
+/* -*-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 | OS_IBMOS2)
+ 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_IBMOS2 | 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/systems/os2/dviware/hp-deskjet/dvios2.doc b/systems/os2/dviware/hp-deskjet/dvios2.doc
new file mode 100644
index 0000000000..ea948866ae
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/dvios2.doc
@@ -0,0 +1,22 @@
+File D:\DVI\BITMAP.H:
+28 #if (IBM_PC_MICROSOFT & !OS_IBMOS2)
+55 #else /* NOT IBM_PC_MICROSOFT OR OS_IBMOS2 */
+File D:\DVI\DVIINIT.H:
+95 #if (OS_ATARI | OS_PCDOS | OS_IBMOS2)
+343 #if (OS_ATARI | OS_PCDOS | OS_IBMOS2 | OS_UNIX)
+File D:\DVI\FONTFILE.H:
+92 #if (OS_ATARI | OS_PCDOS | OS_IBMOS2)
+File D:\DVI\GENDEFS.H:
+68 #if (OS_ATARI | OS_PCDOS | OS_IBMOS2 | OS_TOPS20)
+File D:\DVI\INITGLOB.H:
+113 #if (OS_ATARI | OS_PCDOS | OS_IBMOS2 | OS_UNIX)
+File D:\DVI\MACHDEFS.H:
+93 OS_IBMOS2 -- IBM (and clones) IBM OS/2 and MS OS/2
+223 #define OS_IBMOS2 0
+287 #undef OS_IBMOS2
+289 #define OS_IBMOS2 1
+303 #if (OS_ATARI | OS_PCDOS | OS_IBMOS2 | OS_TOPS20 | OS_UNIX | OS_VAXVMS)
+364 #if (OS_PCDOS | OS_IBMOS2)
+441 #endif /* OS_PCDOS | OS_IBMOS2*/
+File D:\DVI\DVIHPDJ.C:
+153 #if (IBM_PC_MICROSOFT & !OS_IBMOS2)
diff --git a/systems/os2/dviware/hp-deskjet/fontfile.h b/systems/os2/dviware/hp-deskjet/fontfile.h
new file mode 100644
index 0000000000..f86a2219c5
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/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 | OS_IBMOS2)
+
+ /* 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/systems/os2/dviware/hp-deskjet/gendefs.h b/systems/os2/dviware/hp-deskjet/gendefs.h
new file mode 100644
index 0000000000..fd08579aa4
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/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_IBMOS2 | 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/systems/os2/dviware/hp-deskjet/hpdj.cmd b/systems/os2/dviware/hp-deskjet/hpdj.cmd
new file mode 100644
index 0000000000..bbdc5d4fed
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/hpdj.cmd
@@ -0,0 +1 @@
+dvihpdj -eTEXFONTS=d:\pctex\pixel\pxl -m1500 -d8 %1.dvi
diff --git a/systems/os2/dviware/hp-deskjet/initglob.h b/systems/os2/dviware/hp-deskjet/initglob.h
new file mode 100644
index 0000000000..f80df4bb89
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/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 = 255; /* 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_IBMOS2 | 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/systems/os2/dviware/hp-deskjet/m.cmd b/systems/os2/dviware/hp-deskjet/m.cmd
new file mode 100644
index 0000000000..06ef19bddf
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/m.cmd
@@ -0,0 +1 @@
+cl -Lp -AL -Ot -DANSI_LIBRARY -l/ST:8000 %1.c
diff --git a/systems/os2/dviware/hp-deskjet/machdefs.h b/systems/os2/dviware/hp-deskjet/machdefs.h
new file mode 100644
index 0000000000..3a0a1bbeb2
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/machdefs.h
@@ -0,0 +1,842 @@
+ /* -*-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_IBMOS2 -- IBM (and clones) IBM OS/2 and MS OS/2
+ 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_IBMOS2 0
+#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_MICROSOFT
+#undef OS_IBMOS2
+#define IBM_PC_MICROSOFT 1
+#define OS_IBMOS2 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_IBMOS2 | 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 | OS_IBMOS2)
+
+#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 | OS_IBMOS2*/
+
+
+/***********************************************************************/
+#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/systems/os2/dviware/hp-deskjet/texhelp.ovl b/systems/os2/dviware/hp-deskjet/texhelp.ovl
new file mode 100644
index 0000000000..0e4d3a4eb3
--- /dev/null
+++ b/systems/os2/dviware/hp-deskjet/texhelp.ovl
Binary files differ