summaryrefslogtreecommitdiff
path: root/Build/source/texk/dviljk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/dviljk
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dviljk')
-rw-r--r--Build/source/texk/dviljk/.gdbinit19
-rw-r--r--Build/source/texk/dviljk/AUTHORS2
-rw-r--r--Build/source/texk/dviljk/ChangeLog406
-rw-r--r--Build/source/texk/dviljk/INSTALL26
-rw-r--r--Build/source/texk/dviljk/Makefile.in105
-rw-r--r--Build/source/texk/dviljk/NEWS53
-rw-r--r--Build/source/texk/dviljk/README30
-rw-r--r--Build/source/texk/dviljk/acconfig.h7
-rw-r--r--Build/source/texk/dviljk/c-auto.in9
-rw-r--r--Build/source/texk/dviljk/commands.h65
-rw-r--r--Build/source/texk/dviljk/config.h446
-rwxr-xr-xBuild/source/texk/dviljk/configure1793
-rw-r--r--Build/source/texk/dviljk/configure.in18
-rw-r--r--Build/source/texk/dviljk/depend.mak50
-rw-r--r--Build/source/texk/dviljk/depend.mk22
-rw-r--r--Build/source/texk/dviljk/dvi2xx.c5606
-rw-r--r--Build/source/texk/dviljk/dvi2xx.h739
-rwxr-xr-xBuild/source/texk/dviljk/dvihp130
-rw-r--r--Build/source/texk/dviljk/dvihp.man49
-rw-r--r--Build/source/texk/dviljk/dvilj.man275
-rw-r--r--Build/source/texk/dviljk/dvilj.rc32
-rw-r--r--Build/source/texk/dviljk/stamp-auto.in1
-rw-r--r--Build/source/texk/dviljk/tfm.c288
-rw-r--r--Build/source/texk/dviljk/win32.mak95
24 files changed, 10266 insertions, 0 deletions
diff --git a/Build/source/texk/dviljk/.gdbinit b/Build/source/texk/dviljk/.gdbinit
new file mode 100644
index 00000000000..fbf86691fe2
--- /dev/null
+++ b/Build/source/texk/dviljk/.gdbinit
@@ -0,0 +1,19 @@
+directory /w/kpathsea:/w/dviljk
+
+define redo
+file dvilj4
+end
+
+#set env TFMFONTS /w/dvitest/fonts//tfm
+#set env PKFONTS /w/dvitest/fonts//pk
+#set args --D255 /w/dvitest/story
+#set args --D24 /w/dvitest/story
+#set args -M0 /w/dvitest/maketex
+#set args table
+#set args hwir >hwir.lj
+#set env TEXFONTS $cm/tfm
+#set args -M1 /w/dvitest/magstep -e/dev/null
+
+# Stack underflow. Ruediger Deppe <deppe@Venn.ime.rwth-aachen.de>, 10 Jul 1995.
+set args -D1 -M1 me-chap-6.dvi
+#set args -D1 -M1 try
diff --git a/Build/source/texk/dviljk/AUTHORS b/Build/source/texk/dviljk/AUTHORS
new file mode 100644
index 00000000000..41036a2b4d4
--- /dev/null
+++ b/Build/source/texk/dviljk/AUTHORS
@@ -0,0 +1,2 @@
+This program was modified by kb@mail.tug.org from Gustaf Neumann's dvi2xx
+distribution. Send bug reports to tex-k@mail.tug.org, not to Gustaf.
diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog
new file mode 100644
index 00000000000..225589e41a0
--- /dev/null
+++ b/Build/source/texk/dviljk/ChangeLog
@@ -0,0 +1,406 @@
+Tue Mar 3 10:17:03 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * config.h: Markus Gyger <mgyger@osf1.gmu.edu> fix of config
+
+Mon Feb 16 12:36:23 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * Makefile.in: fixes from Thomas Esser relating to prototypes
+
+Tue Jan 27 14:32:25 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * configure etc: new configure.in, c-auto.in, Makefile.in from
+ Olaf Weber
+Sat Jan 17 15:09:59 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * assorted patches from Peter Breitenlohner, Olaf Weber,
+ Eli Zaretskii, Fabrice Popineau etc. Hope it all still works.
+
+
+Thu Jan 1 10:58:34 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * tfm.c: KPATHSEA redefined (peb)
+
+ * Removed src.fonts, fonts and tex to a separate `ljfonts'
+ distribution on CTAN. They dont really belong here
+
+Wed Aug 27 20:18:20 1997 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * stamp-auto: Remove this file, should be in build tree, not in
+ source tree.
+
+ * configure.in: Make `configure' rebuild the `stamp-auto' file.
+
+Fri Mar 07 12:07:43 1997 Fabrice POPINEAU <popineau@ese-metz.fr>
+
+ * tfm.c: reflect use of varargs for Fatal().
+ * dvi2xx.h: DVIELI() use varargs.
+ * dvi2xx.c: Fatal() and Warning() use varargs.
+
+ * config.h: added varargs prototypes and vfprintf/_doprnt.
+
+Thu Feb 6 17:33:30 1997 Karl Berry <karl@cs.umb.edu>
+
+ * Version 2.6.
+
+Sun Jan 5 16:12:06 1997 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c: It's 1997 now.
+
+Mon Dec 9 00:53:30 1996 Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * dvihp: Use `basename $0` in usage and version messages for
+ consistency with other programs and scripts.
+ Also accept -help, -version in addition to --help, --version.
+
+Sat Dec 7 17:15:54 1996 Karl Berry <karl@cs.umb.edu>
+
+ * config.h (unistd.h) [HAVE_UNISTD_H]: Change condition for #include.
+ Various WIN32 changes, also in dvi2xx.c and dvi2xx.h. From Fabrice.
+
+Tue Dec 3 22:12:58 1996 Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * Makefile.in (mostlyclean): No need to remove the $(programs).
+ This is left to `make clean' elsewhere in dvipsk/xdvik/web2c.
+
+Tue Dec 3 01:28:12 1996 Ulirk Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * dvihp: Missing ` in --version.
+
+Wed Nov 27 09:48:43 1996 Karl Berry <karl@cs.umb.edu>
+
+ * config.h [!labs] (labs): Change condition again; cc on SunOS 4
+ still fails to resolve references.
+
+Sat Nov 23 13:52:26 1996 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.h (ManualFeed): New variable.
+ * dvi2xx.c (DecodeArgs): Recognize -A to enable it.
+ (main): Write the appropriate code in this case.
+ From: "John Fontanilla" <john@trda3430.tdi.com>.
+
+ * dvihp: Recognize -m.
+
+Fri Nov 15 16:22:08 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (install-exec): Use INSTALL_LIBTOOL_PROG for
+ binaries, INSTALL_SCRIPT for scripts.
+
+Sun Oct 20 11:28:09 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (install-data): mkdirchain dvilj_latex2e_macrodir.
+
+Fri Jul 26 15:50:00 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: Remove co.make.
+ (*.o): Use $(compile) instead of writing it out again.
+
+Sat Jun 8 13:02:20 1996 K. Berry <kb@cs.umb.edu>
+
+ * Makefile.in (program*): Use kpathsea_link instead of link_command.
+
+Mon May 27 16:26:14 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Update for dvi2xx 0.51-13 (prerelease).
+
+Fri Apr 26 17:38:29 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (install-fonts): Make this a separate target, and
+ use find | cpio instead of cp -r, for sake of CVS or RCS.
+
+Tue Apr 23 08:55:34 1996 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c: Call kpse_set_program_enabled.
+
+Fri Mar 8 14:32:59 1996 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c: Omit special warnings if TEX_HUSH includes special.
+
+Thu Mar 7 12:00:23 1996 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c (check_checksum): New routine to check TEX_HUSH. Change
+ calls.
+
+Thu Feb 15 13:57:19 1996 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c (main): Set kpse_make_tex_discard_errors = G_quiet.
+
+Sat Feb 3 15:44:29 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (DEFS): Moved to common.make.
+
+Fri Dec 29 17:17:20 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: misc.make is now clean.make.
+
+Sun Dec 10 16:24:05 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c (LoadAChar): Raster character 0.
+ From: Peter_Lock@premium.com.au.
+
+Thu Nov 16 13:30:33 1995 Karl Berry <karl@cs.umb.edu>
+
+ * config.h [_AMIGA]: Correction to FONTAREA for _AMIGA.
+
+Wed Sep 20 17:39:44 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (program_files): Add dvihp.
+
+Thu Sep 7 11:16:18 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvihp: Don't redirect from /dev/null, so -f can work.
+
+ * dvi2xx.c (DecodeArgs): Make - work again.
+ From: Christoph Baumhof <Christoph.Baumhof@math.uni-karlsruhe.de>.
+
+Fri Sep 1 17:55:06 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvihp (-P): Accept separate arg. From Thomas, of course.
+
+Wed Aug 30 15:53:43 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvihp (-o): Fix case where -o is last option. From Thomas.
+
+Sun Aug 27 15:15:33 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c: Use xfopen instead of sys_errlist, etc.
+
+Tue Aug 8 13:43:43 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (install-exec): Install dvihp.
+ * dvihp: Write usage message, finish translating all the dvips
+ options we can. Idea from Thomas.
+
+Mon Aug 7 14:54:42 1995 Karl Berry <karl@cs.umb.edu>
+
+ * config.h (MAX_FONTS_PER_PAGE) [LJ4]: Use 255 in this case, too.
+
+ * dvi2xx.c (main): In FNT? case, always read the parameter bytes,
+ even if in SkipMode.
+
+Sun Aug 6 17:56:53 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c (main): Add more debugging output to BOP commands, etc.
+ (DEBUG_PRINT, DEBUG_PRINT1): New macros a la kpathsea/debug.h.
+
+Thu Aug 3 15:56:17 1995 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c (ReadFontDef) [DEBUG]: Omit ``mallocating'' message if
+ debug is on.
+
+Mon Apr 17 10:03:20 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (program*): Use link_command.
+
+Fri Feb 10 14:46:07 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (post-dist): Rename contrib to src.fonts again.
+ (dvilj*.o): Depend on dvi2xx.c, and use $(srcdir) in compilation
+ line. From Andreas.
+
+Sun Jan 8 12:16:04 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Version 2.5.
+
+Wed Jan 4 12:39:15 1995 Karl Berry <karl@cs.umb.edu>
+
+ * config.h (UNKNOWN): Don't need to define this here.
+
+Sat Dec 31 17:30:58 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: Don't include tmptk.make any more.
+ (install-exec): Don't depend on install-MakeTeXPK, either.
+
+Fri Dec 30 15:25:54 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (install-exec): Don't depend on default, so dvilj4
+ doesn't get made if the user didn't want it.
+ (install-data): mkdirchain on texinputdir and fontdir.
+ From Joachim.
+
+ * dvi2xx.c (MFMODE): Use MFMODE[36]00, not cx/ljfour. From Joachim.
+
+Wed Dec 14 15:16:29 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Version 2.4.
+
+Sun Dec 11 12:31:11 1994 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c: Avoid printing character 32 if we're doing sevenbit
+ fonts, for the Kyocera. Reported by
+ gierling@phoenix.tp1.ruhr-uni-bochum.de, fix from Gustaf.
+
+Thu Nov 24 13:54:51 1994 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c (ReadFontDef): Cast arg to kpse_magstep_fix to
+ unsigned. From RZ32@IBM3090.RZ.UNI-KARLSRUHE.DE (Klaus Braune).
+
+Tue Nov 15 16:21:40 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (targets.make): This is split up now.
+
+Sun Nov 6 16:10:50 1994 Karl Berry <karl@cs.umb.edu>
+
+ * configure.in: Run autoupdate.
+
+Tue Oct 25 17:53:59 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Version 2.3.
+
+Fri Oct 14 10:32:50 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Version 2.2.
+
+Sat Oct 1 20:12:55 1994 Karl Berry <karl@cs.umb.edu>
+
+ * dvi2xx.c: Use perror and exit instead of fatal when given a
+ nonexistent file.
+
+Mon Sep 12 11:06:45 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 2.1.
+
+Sun Sep 11 17:23:25 1994 Karl Berry (karl@cs.umb.edu)
+
+ * config.h (labs) [!STDC_HEADERS && !labs]: Change condition.
+
+Wed Sep 7 16:28:58 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 2.0.
+
+Mon Sep 5 10:55:41 1994 Karl Berry (karl@cs.umb.edu)
+
+ * config.h (unix) [_AIX]: Define unix in this case.
+
+Sat Sep 3 14:08:54 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (install-data): Use texinputdir for *.tex, not fontdir.
+
+Fri Sep 2 13:09:30 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (objects): Correct to dvilj.o.
+ (makeargs, install_args): No need for these.
+
+Tue Aug 30 14:21:25 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (mostlyclean): Remove all the $(programs).
+ (distclean): Don't need this.
+
+Mon Aug 29 13:26:26 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Update for dvi2xx 051a11.
+
+Sun Aug 28 17:05:33 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvihp: Make some attempt to make this usable as a printcap
+ filter. From andyp@jfbi.CV.COM.
+
+ * Makefile.in (install-data): Install the fonts by running cp -r,
+ not using a Makefile. Also install the LaTeX files.
+
+ * configure.in (AC_OUTPUT): No more fonts/Makefile.
+
+Sun Aug 21 12:21:23 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in: Include programs.make.
+
+Sat Aug 13 17:14:38 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in: Use $@ where possible.
+
+Tue Aug 9 14:40:50 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c: (ReadFontDef): Call kpse_magstep_fix on the dpi.
+ Fix debugging printf warnings.
+
+Fri Jul 29 13:26:49 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (PRINTER) [LJ4]: Use Arabic numeral for name.
+
+ * Makefile.in (objects, etc.): Support for new binary dvilj4l.
+ * config.h (RESOLUTION, MFMODE) [LJ4L]: Set to 300/cx for this new
+ symbol.
+
+ * dvi2xx.c (DecodeArgs): Always scale pgsiz_dots.
+ (main) [LJ4]: Don't hardwire 600dpi.
+ These fixes from ajp@eng.cam.ac.uk.
+
+Mon Jun 20 15:10:44 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (main): Call kpse_init_prog instead of all the inline
+ initializations.
+
+Sun Jun 19 11:06:31 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (main): Call kpse_set_progname.
+
+Sat Jun 18 17:38:23 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (MAKETEXPK_BY_DEFAULT): Enable it by default.
+
+Mon Jun 13 10:13:18 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (ReadFontDef): Don't call kpse_set_maketex_mag here,
+ let kpathsea do it.
+
+Sun Jun 12 14:12:47 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (ReadFontDef): Avoid checksum warning if we made a font
+ substitution.
+
+Sat Jun 11 19:00:33 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (DecodeArgs): Allow a number after the -- to set
+ kpathsea_debug.
+
+Sun May 22 15:34:20 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c, tfm.c: Change most long's to long4, for the sake of
+ the Alpha. From bruno@alpha1.csd.uwm.edu.
+
+ * config.h (unix) [!unix && __unix__]: Define this, to work around
+ ANSI.
+
+Sun Apr 17 16:15:56 1994 Karl Berry (karl@ra.cs.umb.edu)
+
+ * config.h (signed_char): Use the web2c code for this.
+
+ * Makefile.in (top_srcdir): Define this for configure to substitute.
+
+Tue Apr 12 10:32:38 1994 Karl Berry (karl@ra.cs.umb.edu)
+
+ * dvi2xx.c (DecodeArgs): Allow foo and foo.bar.dvi for input names.
+ From jules@jps.co.uk.
+
+Sun Apr 3 10:20:58 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 1.1.
+
+Sat Apr 2 06:09:20 1994 Karl Berry (karl@cs.umb.edu)
+
+ (Today's changes from Bruno.)
+ * configure.in: Include AC_LONG_64_BITS.
+ * config.h: Use LONG_64_BITS instead of `alpha'.
+
+ * dvi2xx.c (ReadFontDef): Call kpse_set_maketex_mag before finding
+ the PK file.
+
+Fri Apr 1 11:44:31 1994 Karl Berry (karl@cs.umb.edu)
+
+ * contrib/dvihp: New (simple-minded) script.
+
+Thu Mar 31 07:21:21 1994 Karl Berry (karl@cs.umb.edu)
+
+ * fonts/Makefile.in (install): norm=gr for Garamond, not gm.
+ norm=an for Antique Olive, mr for Marigold.
+
+Wed Mar 23 10:23:56 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (install-data): dvilj.1 is in $(srcdir).
+
+Thu Mar 10 08:04:45 1994 Karl Berry (karl@cs.umb.edu)
+
+ * dvi2xx.c (getenv, malloc, atoi): Do not declare here.
+
+Thu Mar 3 08:51:17 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 1.0.
diff --git a/Build/source/texk/dviljk/INSTALL b/Build/source/texk/dviljk/INSTALL
new file mode 100644
index 00000000000..2c5450ad4ad
--- /dev/null
+++ b/Build/source/texk/dviljk/INSTALL
@@ -0,0 +1,26 @@
+Installing dviljk is essentially the same as installing any other
+Kpathsea-using program. Therefore, for the basic steps involved, the
+file `kpathsea/INSTALL'.
+
+For common problems and information on how to report a bug, see
+`kpathsea/BUGS'.
+
+The only dvilj-specific items are:
+
+1) You might want to add the following to DEFS or CFLAGS:
+-DMFMODE300=\"mode\" to change the mode of the 300dpi programs from cx.
+-DMFMODE600=\"mode\" to change the mode of dvilj4 from ljfour.
+-DTIMING to enable timing flags. Must have various library functions.
+
+2) The sources support many different LaserJet printers; generally, each
+requires its own binary. `make all' makes everything available, and
+just `make' makes dvilj4 for the LaserJet 4M, 4MP, etc. (600dpi).
+Other possibilities:
+`make dvilj' for the plain LaserJet (300dpi).
+`make dvilj2p' for the LaserJet 2P (300dpi).
+`make dvilj4l' for the LaserJet 4L (300dpi).
+
+3) If you are using a LaserJet 4, and wish to use the builtin fonts, run
+`make install-fonts' after the normal `make install'. This merely copies
+the contents of the fonts/ directory to $(texmf)/fonts. See README.fonts
+for more information.
diff --git a/Build/source/texk/dviljk/Makefile.in b/Build/source/texk/dviljk/Makefile.in
new file mode 100644
index 00000000000..00126b0eaeb
--- /dev/null
+++ b/Build/source/texk/dviljk/Makefile.in
@@ -0,0 +1,105 @@
+# Makefile for dviljk -- kb@mail.tug.org. Public domain.
+version = 2.6
+
+.NOTPARALLEL:
+
+kpse_include ../make/paths.mk
+kpse_include ../make/common.mk
+kpse_include ../make/programs.mk
+
+prog_cflags = -DKPATHSEA
+
+common_objects = tfm.o
+
+program = dvilj
+objects = dvilj.o $(common_objects)
+objects2p = dvilj2p.o $(common_objects)
+program2p = dvilj2p
+objects4 = dvilj4.o $(common_objects)
+program4 = dvilj4
+objects4l = dvilj4l.o $(common_objects)
+program4l = dvilj4l
+program6 = dvilj6
+
+programs = $(program) $(program2p) $(program4) $(program4l)
+
+default: $(program4)
+all: $(programs)
+
+$(program): $(objects) $(kpathsea)
+ $(kpathsea_link) $(objects) $(LOADLIBES)
+$(program2p): $(objects2p) $(kpathsea)
+ $(kpathsea_link) $(objects2p) $(LOADLIBES)
+$(program4): $(objects4) $(kpathsea)
+ $(kpathsea_link) $(objects4) $(LOADLIBES)
+$(program4l): $(objects4l) $(kpathsea)
+ $(kpathsea_link) $(objects4l) $(LOADLIBES)
+
+dvilj.o:
+ $(compile) -c -DLJ $(srcdir)/dvi2xx.c -o $@
+dvilj2p.o:
+ $(compile) -c -DLJ2P $(srcdir)/dvi2xx.c -o $@
+dvilj4.o:
+ $(compile) -c -DLJ4 $(srcdir)/dvi2xx.c -o $@
+dvilj4l.o:
+ $(compile) -c -DLJ4 -DLJ4L $(srcdir)/dvi2xx.c -o $@
+
+dvilj.o dvilj2p.o dvilj4.o dvilj4l.o: dvi2xx.c
+
+kpse_include ../make/tkpathsea.mk
+
+install: install-exec install-data
+uninstall: uninstall-exec uninstall-data
+
+install-exec:
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
+ test ! -f $(program) \
+ || $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
+ test ! -f $(program2p) \
+ || $(INSTALL_LIBTOOL_PROG) $(program2p) $(bindir)
+ test ! -f $(program4) \
+ || $(INSTALL_LIBTOOL_PROG) $(program4) $(bindir)
+ test ! -f $(program4l) \
+ || $(INSTALL_LIBTOOL_PROG) $(program4l) $(bindir)
+ $(INSTALL_SCRIPT) $(srcdir)/dvihp $(scriptdir)/dvihp
+ rm -f $(bindir)/$(program6); $(LN) $(program4) $(bindir)/$(program6)
+uninstall-exec:
+ cd $(bindir); rm -f $(programs)
+
+install-data:
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir)
+ $(INSTALL_DATA) $(srcdir)/dvilj.man $(man1dir)/dvilj.$(manext)
+ for p in dvilj2p dvilj4 dvilj4l dvilj6; do \
+ rm -f $(man1dir)/$$p.$(manext); \
+ ln -s dvilj.$(manext) $(man1dir)/$$p.$(manext); \
+ done
+ $(INSTALL_DATA) $(srcdir)/dvihp.man $(man1dir)/dvihp.$(manext)
+
+# It seems simplest to keep this separate. Use find and cpio instead of
+# just cp -r in case the source hierarchy is cvs- or rcs-ified.
+# Use "" to quote wildcards because backslash is a directory separator
+# on MS-DOS and MS-Windows.
+install-fonts:
+ find fonts -name \( "*.tfm" -o -name "*.vf" \) -print | cpio -pld $(texmf)
+
+uninstall-data:
+ rm -f $(man1dir)/dvilj.$(manext)
+
+
+distname = dviljk
+program_files = dvihp dvilj.man README.fonts
+version_files = dvi2xx.c dvihp
+
+pre-dist-$(distname):
+post-dist-$(distname):
+ ln -s `pwd`/fonts `pwd`/tex `pwd`/src.fonts $(distdir)
+
+kpse_include ../make/dist.mk
+kpse_include ../make/config.mk
+
+info dvi check:
+
+kpse_include ../make/clean.mk
+
+kpse_include ../make/rdepend.mk
+kpse_include depend.mk
diff --git a/Build/source/texk/dviljk/NEWS b/Build/source/texk/dviljk/NEWS
new file mode 100644
index 00000000000..5f4d27a2782
--- /dev/null
+++ b/Build/source/texk/dviljk/NEWS
@@ -0,0 +1,53 @@
+This file records noteworthy changes.
+
+2.7 (6 January 1998)
+* Update for dvi2xx 0.51-14.
+2.6 (6 February 1997)
+* Update for kpathsea 3.0.
+* Update for dvi2xx 0.51-13.
+* dvihp script handles options a la dvips, and is installed by default.
+* Raster characters and fonts can be downloaded compressed.
+* - option (operate as pipe) works again.
+* More useful debugging output.
+* Bug in page-skipping fixed.
+* But in printing character 0 fixed.
+* Fonts rearranged per TDS, and `q' changed to `8t'.
+
+2.5 (9 January 1995)
+* Redefining MFMODE[36]00 actually works, and is documented.
+
+2.4 (15 December 1994)
+* Character 32 not downloaded on old printers, to work around an
+ apparent bug in the emulation on a Kyocera.
+
+2.3 (26 October 1994)
+* Just keeping up with the changes.
+
+2.2 (14 October 1994)
+* Use perror for nonexistent input files.
+
+2.1 (12 September 1994)
+* Just keeping up with the library changes.
+
+2.0 (8 September 1994)
+* fonts/ and tex/ subdirectories installed via cp -r.
+* You can build all or any of dvilj, dvilj2p, dvilj4l, dvilj4 (only the
+ last is still the default). Also better Alpha support.
+* Update for dvi2xx051a11.
+* Allow foo and foo.bar.dvi for input filenames.
+* NFSS style files (for either LaTeX 2e or LaTeX 2.09 + NFSS)
+ included. From Andy Piper.
+* A better dvihp wrapper script included, suitable for lpr.
+* The debug option (--) accepts a numeric arg to set kpathsea debugging bits.
+* MakeTeXPK is enabled by default.
+* Use Autoconf to determine character signedness, instead of cc predefs.
+* Fix for line graphics bugs on non-300dpi devices.
+
+1.1 (2 April 1994)
+* MakeTeXPK magstep set properly.
+* Better test for the Alpha.
+* Garamond, Antique Olive, and Marigold base fonts installed properly.
+* Script to run dvicopy then dvilj included (contrib/dvihp).
+
+1.0 (3 March 1994)
+* Use Kpathsea and Autoconf.
diff --git a/Build/source/texk/dviljk/README b/Build/source/texk/dviljk/README
new file mode 100644
index 00000000000..5c52e7436e9
--- /dev/null
+++ b/Build/source/texk/dviljk/README
@@ -0,0 +1,30 @@
+This directory contains Dviljk, my (kb@mail.tug.org) modified version of
+Gustaf Neumann's dvi2xx, a DVI-to-PCL translator.
+
+This program does not work with DeskJet printers; instead, try
+CTAN:/dviware/dvidjc or Nelson Beebe's drivers in CTAN:/dviware/beebe.
+(See ../MIRROR for a list of CTAN hosts.)
+
+See `INSTALL' for installation instructions.
+See `NEWS' for major changes by release, `ChangeLog` for all changes.
+See `README.fonts' for information on using the LaserJet 4 builtin fonts.
+See `../kpathsea/BUGS' for details on reporting bugs and common problems.
+
+Aside from configuration, this differs from the original primarily in
+that it uses the same code for path searching as TeX and my other
+distributions. I haven't tested the non-Unix support present in the
+original, or support for any device but the LJ4. However, I'm told that
+dviljk does work on MS-DOS/MS-Windows when compiled with either DJGPP
+port of GNU C or with Microsoft Visual C compilers. At least in the
+DJGPP port, the LJ and LJ2P devices were reported to work.
+
+dviljk is free software; Gustaf's original files are (I believe) public
+domain. The files I wrote are covered by the GNU General Public License
+-- see the files COPYING*.
+
+You can get the original dvi2xx from
+ftp://ftp.wu-wien.ac.at/pub/src/Typeset/dvi2xx.
+
+
+kb@mail.tug.org
+Member of the League for Programming Freedom -- write lpf@uunet.uu.net.
diff --git a/Build/source/texk/dviljk/acconfig.h b/Build/source/texk/dviljk/acconfig.h
new file mode 100644
index 00000000000..f37dab098ee
--- /dev/null
+++ b/Build/source/texk/dviljk/acconfig.h
@@ -0,0 +1,7 @@
+/* acconfig.h -- used by autoheader when generating c-auto.in.
+
+ If you're thinking of editing acconfig.h to fix a configuration
+ problem, don't. Edit the c-auto.h file created by configure,
+ instead. Even better, fix configure to give the right answer. */
+
+/* all: Define to enable running scripts when missing input files. */
diff --git a/Build/source/texk/dviljk/c-auto.in b/Build/source/texk/dviljk/c-auto.in
new file mode 100644
index 00000000000..7dc1a3403c2
--- /dev/null
+++ b/Build/source/texk/dviljk/c-auto.in
@@ -0,0 +1,9 @@
+/* c-auto.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if type char is unsigned and you are not using gcc. */
+#ifndef __CHAR_UNSIGNED__
+#undef __CHAR_UNSIGNED__
+#endif
+
+/* The number of bytes in a long. */
+#undef SIZEOF_LONG
diff --git a/Build/source/texk/dviljk/commands.h b/Build/source/texk/dviljk/commands.h
new file mode 100644
index 00000000000..3de8eeeebea
--- /dev/null
+++ b/Build/source/texk/dviljk/commands.h
@@ -0,0 +1,65 @@
+/* DVI COMMANDS */
+#define SETC_000 0 /* typeset character 0 and move right */
+#define SETC_127 127 /* typeset character 127 and move right */
+#define SET1 128 /* typeset a character and move right */
+#define SET2 129 /* ??? */
+#define SET3 130 /* ??? */
+#define SET4 131 /* ??? */
+#define SET_RULE 132 /* typeset a rule and move right */
+#define PUT1 133 /* typeset a character */
+#define PUT2 134 /* ??? */
+#define PUT3 135 /* ??? */
+#define PUT4 136 /* ??? */
+#define PUT_RULE 137 /* typeset a rule */
+#define NOP 138 /* no operation */
+#define BOP 139 /* beginning of page */
+#define EOP 140 /* ending of page */
+#define PUSH 141 /* save the current positions */
+#define POP 142 /* restore previous positions */
+#define RIGHT1 143 /* move right */
+#define RIGHT2 144 /* ??? */
+#define RIGHT3 145 /* ??? */
+#define RIGHT4 146 /* ??? */
+#define W0 147 /* move right by |w| */
+#define W1 148 /* move right and set |w| */
+#define W2 149 /* ??? */
+#define W3 150 /* ??? */
+#define W4 151 /* ??? */
+#define X0 152 /* move right by |x| */
+#define X1 153 /* move right and set |x| */
+#define X2 154 /* ??? */
+#define X3 155 /* ??? */
+#define X4 156 /* ??? */
+#define DOWN1 157 /* move down */
+#define DOWN2 158 /* ??? */
+#define DOWN3 159 /* ??? */
+#define DOWN4 160 /* ??? */
+#define Y0 161 /* move down by |y| */
+#define Y1 162 /* move down and set |y| */
+#define Y2 163 /* ??? */
+#define Y3 164 /* ??? */
+#define Y4 165 /* ??? */
+#define Z0 166 /* move down by |z| */
+#define Z1 167 /* move down and set |z| */
+#define Z2 168 /* ??? */
+#define Z3 169 /* ??? */
+#define Z4 170 /* ??? */
+#define FONT_00 171 /* set current font to 0 */
+#define FONT_63 234 /* set current font to 0 */
+#define FNT1 235 /* set current font */
+#define FNT2 236 /* Same as FNT1, except that arg is 2 bytes */
+#define FNT3 237 /* Same as FNT1, except that arg is 3 bytes */
+#define FNT4 238 /* Same as FNT1, except that arg is 4 bytes */
+#define XXX1 239 /* extension to \.DVI primitives */
+#define XXX2 240 /* Like XXX1, but 0<=k<65536 */
+#define XXX3 241 /* Like XXX1, but 0<=k<@t$2^{24}$@> */
+#define XXX4 242 /* potentially long extension to \.DVI
+ primitives */
+#define FNT_DEF1 243 /* define the meaning of a font number */
+#define FNT_DEF2 244 /* ??? */
+#define FNT_DEF3 245 /* ??? */
+#define FNT_DEF4 246 /* ??? */
+#define PRE 247 /* preamble */
+#define POST 248 /* postamble beginning */
+#define POST_POST 249 /* postamble ending */
+ /* undefined_commands 250,251,252,253,254,255 */
diff --git a/Build/source/texk/dviljk/config.h b/Build/source/texk/dviljk/config.h
new file mode 100644
index 00000000000..3b60b73bca4
--- /dev/null
+++ b/Build/source/texk/dviljk/config.h
@@ -0,0 +1,446 @@
+/* $Id: config.h,v 2.1 1996/05/20 11:05:07 neumann Exp $ */
+
+/* gcc -ansi doesn't predefine `unix', since ANSI forbids it. And AIX
+ generally doesn't predefine unix, who knows why. HP-UX is, of course,
+ also different. Apple's MacOsX is also unix-like. */
+#ifndef unix
+#if defined (__unix__) || defined (_AIX) || defined (_HPUX_SOURCE)
+#define unix
+#elif defined (__APPLE__) && defined (__MACH__)
+#define unix
+#elif defined (__NetBSD__)
+#define unix
+#endif
+#endif
+
+#define USEPXL
+
+#ifdef __riscos
+/* #define RISC_USE_OSL */ /* use file functions of OSlib */
+/* #define RISC_BUFFER */ /* buffer output */
+#endif
+
+/*
+ * default font path
+ * can be overridden by environment variable TEXPXL
+ * or -a command line option
+ * popular choice:
+ * #define FONTAREA "/usr/local/lib/tex/fonts/pk"
+ */
+#ifndef FONTAREA
+# ifdef __riscos
+# define FONTAREA "TeXFonts:"
+# else
+# ifdef vms
+# define FONTAREA "tex$pkdir:"
+# else
+# ifdef _AMIGA
+# define FONTAREA "TeXMF:pk"
+# else
+# define FONTAREA "/usr/local/lib/tex/fonts/pk"
+# endif
+# endif
+# endif
+#endif
+
+/* if DO_SUBDIRECTORIES is specified, search to this depth */
+#ifndef MAX_SUBDIR_SEARCH_DEPTH
+#define MAX_SUBDIR_SEARCH_DEPTH 10
+#endif
+
+/*
+ * if your LaserJet II P or LaserJet III or LaserJet 2000
+ * complains about not enough memory, you might try to reduce
+ * the value below or uncomment to use the default settings
+ */
+#if defined (LJ2P) || defined (LJ4)
+#define MAX_FONTS_PER_PAGE 255 /* maximum number of fonts per page */
+#endif
+
+
+/* Timing is not very portable.... if you have troubles, use
+ * -DNO_TIMING in the Makefile
+ */
+
+#ifdef u3b2
+#define NO_TIMING
+#endif
+#ifdef _AMIGA
+#define NO_TIMING
+#endif
+#ifdef KPATHSEA
+#define NO_TIMING
+#define MAKETEXPK
+#endif
+#ifdef __riscos
+#define NO_TIMING
+#endif
+
+#ifndef NO_TIMING
+#define TIMING
+#endif
+
+/*
+ * per default use mktexpk in unix environments unless it is not wanted
+ */
+#ifdef unix
+#ifndef MAKETEXPK
+/* name of the program which is called to generate missing pk files
+ */
+#define MAKETEXPK "mktexpk"
+#endif
+#endif
+
+#ifdef _AMIGA
+#ifndef MAKETEXPK
+/* name of the program which is called to generate missing pk files
+ */
+#define MAKETEXPK "mktexpk"
+#endif
+#endif
+
+#ifdef __riscos
+#ifndef MAKETEXPK
+#define MAKETEXPK "mktexpk"
+#endif
+#endif
+
+#ifdef NO_MAKETEXPK
+#undef MAKETEXPK
+#endif
+
+/*
+ * assure that LJ2P is defined when LJ4 is defined;
+ * compile with support for LJ4's resident fonts
+ */
+#ifdef LJ4
+#define LJ2P
+#define LJ_RESIDENT_FONTS
+#endif
+
+/*
+ * assure that LJ2 is defined when LJ2P is defined
+ */
+#ifdef LJ2P
+#ifndef LJ2
+#define LJ2
+#endif
+#endif
+
+/*
+ * assure that LJ is defined when LJ2 of LJ4 is defined
+ */
+#if defined(LJ2)
+#ifndef LJ
+#define LJ
+#endif
+#endif
+
+/*
+ * assure that IBM3812 is not defined when LJ is defined
+ */
+#ifdef LJ
+#ifdef IBM3812
+#undef IBM3812
+#endif
+#endif
+
+#ifdef LJ_RESIDENT_FONTS
+# ifndef DEFAULT_TFM_PATH
+# ifdef __riscos
+# define FONTAREA "TeXFonts:"
+# else
+# define DEFAULT_TFM_PATH "/usr/local/lib/tex/fonts"
+# endif
+# endif
+#endif
+
+
+#define _TRUE (bool) 1
+#define _FALSE (bool) 0
+#define UNKNOWN -1
+
+#define STRSIZE 255 /* stringsize for file specifications */
+
+
+#ifdef __riscos
+# ifndef types_H /* for compatibility with OSLib */
+typedef int bool;
+# endif
+#else
+typedef char bool;
+#endif
+
+
+/* The smallest signed type: use `signed char' if ANSI C, `short' if
+ char is unsigned, otherwise `char'. */
+#ifndef SCHAR_TYPE
+#if __STDC__
+#define SCHAR_TYPE signed char
+#else /* not __STDC */
+#ifdef __CHAR_UNSIGNED__
+#define SCHAR_TYPE short
+#else
+#define SCHAR_TYPE char
+#endif
+#endif /* not __STDC__ */
+#endif /* not SCHAR_TYPE */
+typedef SCHAR_TYPE signed_char;
+
+#if !defined(u3b2) && !defined(LONG_64_BITS)
+#define ARITHMETIC_RIGHT_SHIFT
+#endif
+
+#ifndef SIZEOF_LONG
+# ifdef __riscos
+# define SIZEOF_LONG 8
+# endif
+#endif
+
+#if SIZEOF_LONG > 4
+# define long4 int
+#else
+# define long4 long
+#endif
+
+#ifdef __STDC__
+#define NeedFunctionPrototypes 1
+#include <stdarg.h>
+#else
+#define NeedFunctionPrototypes 0
+#include <varargs.h>
+#endif
+
+#if NeedFunctionPrototypes
+#define NeedVarargsPrototypes 1
+#endif
+
+#ifndef KPATHSEA
+extern bool findfile(
+#if NeedFunctionPrototypes
+char path[], char n[], long4 fontmag, char name[],
+ bool tfm, int level
+#endif
+ );
+#endif
+
+
+/*
+ * maximal number of characters in font file
+ * #define LASTFNTCHAR 127 7-bit classic version
+ * #define LASTFNTCHAR 255 8-bit fonts
+ */
+#ifdef SEVENBIT
+# define LASTFNTCHAR 127
+#else
+# define LASTFNTCHAR 255
+#endif
+
+
+
+/* this information is needed in findfile.c and dvi2xx.c, NO CUSTOMIZATION */
+#ifdef LJ
+# ifndef MFMODE300
+# define MFMODE300 "cx" /* mode definition for metafont 300dpi */
+# endif
+# ifdef LJ4
+# ifndef MFMODE600
+# define MFMODE600 "ljfour" /* mode definition for metafont 600dpi */
+# endif
+# else
+# define MFMODE MFMODE300 /* default mode */
+# endif
+#endif
+
+#ifdef IBM3812
+#define RESOLUTION 240
+#ifndef MFMODE
+#define MFMODE "IBMThreeEightOneTwo" /* mode definition for metafont */
+#endif
+#endif
+
+#if defined (unix) && !defined (__DJGPP__)
+#define OS "Unix"
+#define READ_BINARY "r"
+#define WRITE_BINARY "w"
+#ifndef labs
+#define labs(x) abs(x)
+#endif
+#endif
+
+#ifdef MSDOS
+# define OS "MS-DOS"
+# define READ_BINARY "rb"
+# define WRITE_BINARY "wb"
+# ifdef __DJGPP__
+# include <io.h> /* for prototype of `setmode' */
+# define AssureBinary(f) setmode((f), O_BINARY)
+# else
+# define MSC5 /* assume Microsoft C */
+# endif
+#endif
+#ifdef OS2
+#define OS "OS/2"
+#define READ_BINARY "rb"
+#define WRITE_BINARY "wb"
+#define MSC5
+#endif
+#ifdef WIN32
+#define OS "Win32"
+#define READ_BINARY "rb"
+#define WRITE_BINARY "wb"
+# include <io.h> /* for prototype of `_setmode' */
+# define AssureBinary(f) _setmode((f), _O_BINARY)
+#define MSC10
+#endif
+
+#ifdef vms
+#define OS "VMS"
+#include <ssdef.h>
+#include <stsdef.h>
+#define ftell vms_ftell /* use some external routines, because */
+#define fseek vms_fseek /* of some bugs in the VMS run time */
+#define getchar vms_getchar /* library */
+#define getenv vms_getenv
+#define ungetc vms_ungetc
+#define getname vms_getname
+#define READ_BINARY "rb"
+#define WRITE_BINARY "wb","rfm=fix","bls=512","mrs=512" /* fixed records */
+#define labs(x) abs(x)
+#endif
+
+#ifdef _AMIGA
+#define OS "Amiga"
+#define READ_BINARY "r"
+#define WRITE_BINARY "w"
+#ifdef __SASC
+#define sys_errlist __sys_errlist
+#include <stdlib.h>
+#endif
+#endif
+
+#ifdef unix
+# include <stdio.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef __riscos
+# define OS "RISC OS"
+# ifdef RISC_USE_OSL
+# define READ_BINARY 0x43 /* if using fopen stuff reset to "rb", "wb" */
+# define WRITE_BINARY 0x83
+# else
+# define READ_BINARY "rb"
+# define WRITE_BINARY "wb"
+# endif
+# define ERR_STREAM stdout /* ???? */
+# else
+# define ERR_STREAM stderr
+#endif
+
+/*
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+*/
+
+
+/* Information returned by tfm_read_info. */
+typedef struct {
+ /* These string lengths are imposed by the TFM format. Either of these
+ values may be the empty string. */
+ unsigned char coding_scheme[40];
+ unsigned char family[20];
+
+ /* The second fontdimen. */
+ unsigned interword;
+
+ /* These values are what will work to select the font in PCL. If this
+ TFM file doesn't have the `KN' extensions (distinguishable by the
+ family == "HPAUTOTFM"). */
+#define SPACING_FIXED 0
+#define SPACING_PROPORTIONAL 1
+ unsigned spacing;
+ int weight;
+ unsigned style;
+ unsigned typeface_id;
+
+ /* TFM files can always have 256 characters, even if we're using the
+ old pixel format that only supports 128. The values are fix-words
+ scaled by the design size; i.e., straight from the TFM file. */
+ long4 widths[256];
+} tfm_info_type;
+
+#ifdef KPATHSEA
+#define BOPENCMD xfopen
+#else
+#define BOPENCMD fopen /* ???? */
+#endif
+
+/* Set up file stuff */
+#ifdef RISC_USE_OSL
+#include "fromosl.h"
+typedef os_f FILEPTR;
+#define read_byte(fp,char) os_bget(fp,&char)
+#define write_byte(fp,char) os_bput(char,fp)
+#define read_multi(buf,n,s,fp) osgbpb_read(fp,(byte*)buf,(s)*(n))
+#define write_multi(buf,n,s,fp) osgbpb_write(fp,(byte*)buf,(s)*(n))
+#define BINOPEN(f) osfind_openin(READ_BINARY,f,NULL)
+#define BOUTOPEN(f) osfind_openout(WRITE_BINARY,f,NULL)
+#define BCLOSE(f) osfind_close(f)
+#define FEOF(f) osargs_read_eof_status(f)
+#define FSEEK(f,pos,whence) os_seek(f,pos,whence)
+#define FTELL(f) osargs_read_ptr(f)
+#define FPNULL 0
+#else
+typedef FILE *FILEPTR;
+#define read_byte(fp,char) char = fgetc(fp)
+#define write_byte(fp,char) fputc(char,fp)
+#define read_multi(buf,n,s,fp) fread(buf,n,s,fp)
+#define write_multi(buf,n,s,fp) fwrite(buf,n,s,fp)
+#define BINOPEN(f) BOPENCMD(f,READ_BINARY)
+#define BOUTOPEN(f) BOPENCMD(f,WRITE_BINARY)
+#define BCLOSE(f) fclose(f)
+#define FEOF(f) feof(f)
+#define FSEEK(f,pos,whence) fseek(f,pos,whence)
+#define FTELL(f) ftell(f)
+#define FPNULL NULL
+#endif
+
+
+#define BUFFSIZE 8192 /* ???? */
+
+#ifndef SEEK_SET
+# define SEEK_SET 0
+#endif
+#ifndef SEEK_CUR
+# define SEEK_CUR 1
+#endif
+#ifndef SEEK_END
+# define SEEK_END 2
+#endif
+
+#ifndef O_BINARY
+# ifdef _O_BINARY
+# define O_BINARY _O_BINARY
+# else
+# define O_BINARY 0
+#endif
+#endif
+
+#if !defined (AssureBinary) && !defined (MSC5)
+# define AssureBinary(f) 0
+#endif
+
+#ifndef HAVE_VPRINTF
+#ifdef HAVE_DOPRNT
+#define vfprintf(stream, message, args) _doprnt(message, args, stream)
+/* If we have neither, should fall back to fprintf with fixed args. */
+#endif
+#endif
diff --git a/Build/source/texk/dviljk/configure b/Build/source/texk/dviljk/configure
new file mode 100755
index 00000000000..c80782a4bc9
--- /dev/null
+++ b/Build/source/texk/dviljk/configure
@@ -0,0 +1,1793 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --without-mktexmf-default do not run mktexmf if MF source missing"
+ac_help="$ac_help
+ --without-mktexpk-default do not run mktexpk if PK font missing"
+ac_help="$ac_help
+ --without-mktextfm-default do not run mktextfm if TFM file missing"
+ac_help="$ac_help
+ --without-mkocp-default do not run mkocp if OCP file missing"
+ac_help="$ac_help
+ --without-mkofm-default do not run mkofm if OFM file missing"
+ac_help="$ac_help
+ --with-mktexfmt-default run mktexfmt if format file missing"
+ac_help="$ac_help
+ --with-mktextex-default run mktextex if TeX source missing"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+ac_config_files=
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; }
+ fi
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=dvi2xx.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:559: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:590: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:642: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:675: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 686 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:722: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:750: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:818: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ # Hack for MSDOS and descendants.
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test $ac_x $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:873: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:900: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+# MS-DOS is a special case, because it sort of pretends that ln -s
+# works for executables.
+if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:925: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+ if test "x$USE_MAINTAINER_MODE" = xyes; then
+ MAINT=
+ else
+ MAINT='#M#'
+ fi
+
+
+
+echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6
+echo "configure:944: checking for loader (symbol LD)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$LD" && LD=ld
+cf_cv_subst_LD=$LD
+fi
+
+LD=${cf_cv_subst_LD}
+echo "$ac_t""$LD" 1>&6
+
+
+echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6
+echo "configure:958: checking for archiver (symbol AR)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$AR" && AR=ar
+cf_cv_subst_AR=$AR
+fi
+
+AR=${cf_cv_subst_AR}
+echo "$ac_t""$AR" 1>&6
+
+
+echo $ac_n "checking for archiver options (symbol ARFLAGS)""... $ac_c" 1>&6
+echo "configure:972: checking for archiver options (symbol ARFLAGS)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_ARFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$ARFLAGS" && ARFLAGS=rc
+cf_cv_subst_ARFLAGS=$ARFLAGS
+fi
+
+ARFLAGS=${cf_cv_subst_ARFLAGS}
+echo "$ac_t""$ARFLAGS" 1>&6
+
+
+
+# Check whether --with-mktexmf-default or --without-mktexmf-default was given.
+if test "${with_mktexmf_default+set}" = set; then
+ withval="$with_mktexmf_default"
+ :
+else
+ with_mktexmf_default=yes
+fi
+
+# Check whether --with-mktexpk-default or --without-mktexpk-default was given.
+if test "${with_mktexpk_default+set}" = set; then
+ withval="$with_mktexpk_default"
+ :
+else
+ with_mktexpk_default=yes
+fi
+
+# Check whether --with-mktextfm-default or --without-mktextfm-default was given.
+if test "${with_mktextfm_default+set}" = set; then
+ withval="$with_mktextfm_default"
+ :
+else
+ with_mktextfm_default=yes
+fi
+
+# Check whether --with-mkocp-default or --without-mkocp-default was given.
+if test "${with_mkocp_default+set}" = set; then
+ withval="$with_mkocp_default"
+ :
+else
+ with_mkocp_default=yes
+fi
+
+# Check whether --with-mkofm-default or --without-mkofm-default was given.
+if test "${with_mkofm_default+set}" = set; then
+ withval="$with_mkofm_default"
+ :
+else
+ with_mkofm_default=yes
+fi
+
+# Check whether --with-mktexfmt-default or --without-mktexfmt-default was given.
+if test "${with_mktexfmt_default+set}" = set; then
+ withval="$with_mktexfmt_default"
+ :
+fi
+
+# Check whether --with-mktextex-default or --without-mktextex-default was given.
+if test "${with_mktextex_default+set}" = set; then
+ withval="$with_mktextex_default"
+ with_mktextex_default=yes
+else
+ with_mktextex_default=no
+fi
+
+
+echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6
+echo "configure:1042: checking where the main texmf tree is located" >&5
+texmfmain=
+if test "x$datadir" != 'x${prefix}/share'; then
+ # First case, datadir is defined...
+ eval p=\"$datadir\"
+ # Unconditionally set the directory, but...
+ texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'`
+ # ... do complain if it wasn't found.
+ if test -d "$texmfmain"; then
+ echo "$ac_t"""$texmfmain"" 1>&6
+ else
+ echo "$ac_t""not found" 1>&6
+ echo "configure: warning: No texmf tree found at $texmfmain.
+ *****************************************************************
+ * Error: The main texmf tree was not found. *
+ * If you do not have the files, you should be able to them from *
+ * the same place you got these sources from, or from one of the *
+ * CTAN hosts. *
+ *****************************************************************
+ Winging it." 1>&2
+ fi
+else
+ # Second case, datadir is default...
+ if test "x$prefix" = "xNONE"; then
+ p="$ac_default_prefix"
+ else
+ eval p=\"$prefix\"
+ fi
+ for e in share/texmf lib/texmf texmf; do
+ if test -d "$p/$e"; then
+ texmfmain='${prefix}'/"$e"
+ break
+ fi
+ done
+ if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then
+ # Still no texmfmain found, no prefix set, perhaps kpsewhich is
+ # installed and can help us out.
+ texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null
+ fi
+ texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'`
+ if test -n "$texmfmain"; then
+ echo "$ac_t"""$texmfmain"" 1>&6
+ else
+ eval texmfmain="$datadir/texmf"
+ echo "$ac_t""not found" 1>&6
+ echo "configure: warning: The main texmf tree was not found at $texmfmain.
+ *****************************************************************
+ * Error: The main texmf tree was not found. *
+ * Use the --datadir option to specify its parent directory. *
+ * If you do not have the files, you should be able to them from *
+ * the same place you got these sources from, or from one of the *
+ * CTAN hosts. *
+ *****************************************************************
+ Winging it by pretending $texmfmain is correct." 1>&2
+ fi
+fi
+
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1102: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1117 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1134 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1151 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
+echo "configure:1182: checking whether char is unsigned" >&5
+if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$GCC" = yes; then
+ # GCC predefines this symbol on systems where it applies.
+cat > conftest.$ac_ext <<EOF
+#line 1189 "configure"
+#include "confdefs.h"
+#ifdef __CHAR_UNSIGNED__
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_c_char_unsigned=yes
+else
+ rm -rf conftest*
+ ac_cv_c_char_unsigned=no
+fi
+rm -f conftest*
+
+else
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1211 "configure"
+#include "confdefs.h"
+/* volatile prevents gcc2 from optimizing the test away on sparcs. */
+#if !defined(__STDC__) || __STDC__ != 1
+#define volatile
+#endif
+main() {
+ volatile char c = 255; exit(c < 0);
+}
+EOF
+if { (eval echo configure:1221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_char_unsigned=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_char_unsigned=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6
+if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
+ cat >> confdefs.h <<\EOF
+#define __CHAR_UNSIGNED__ 1
+EOF
+
+fi
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:1245: checking size of long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1253 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+
+ac_config_files="$ac_config_files Makefile"
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+
+trap 'rm -fr `echo "$ac_config_files c-auto.h:c-auto.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@LN_S@%$LN_S%g
+s%@MAINT@%$MAINT%g
+s%@LD@%$LD%g
+s%@AR@%$AR%g
+s%@ARFLAGS@%$ARFLAGS%g
+s%@texmfmain@%$texmfmain%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*|[A-z]:/*) # Absolute path.
+ srcdir="$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ rm -f conftest.in
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+ #
+ # Replace lines of the form ac_include foo with the contents of foo:
+ # first, from the ac_include lines construct a list of file names.
+ # From that list, we construct a second list of those files that exist.
+ # Then we construct lists of sed commands for including those files,
+ # and a sed command that removes the ac_include lines. We don't attempt
+ # to read non-existent files because some (buggy) versions of sed choke
+ # on this. Have to use sed because old (Ultrix, SunOS) awk does not support
+ # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+ # Can't use only one -e and commands {dr foo} because foo has to be last.
+ # Be careful, because the filename may contain /. Be careful with
+ # whitespace; we need to use echo.
+ #
+ file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in`
+ # Create the sed command line ...
+ if test -n "$file_substs"; then
+ echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2
+ file_subst_cmd="sed -e 's/^ac_include/kpse_include/'"
+ else
+ file_subst_cmd='sed'
+ fi
+ kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in`
+ for ac_inc in $file_substs $kpse_substs; do
+ if test -f "$ac_given_srcdir/$ac_inc"; then
+ ac_mung=`echo $ac_inc | sed 's,/,%,g'`
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'"
+ fi
+ done
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'"
+ # ... and fix the whitespace and escaped slashes.
+ file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \
+-e 's/kpse_include /kpse_include[ ]*/g'`
+ # I can't find any way to do variable substitution in the sed commands
+ # (so the user could have, e.g., $top_srcdir in their ac_include line).
+ (eval $file_subst_cmd conftest.in) \
+ | sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s* conftest.in
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS=" c-auto.h:c-auto.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+date >stamp-auto
+
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file and --srcdir arguments so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $ac_configure_args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case "$ac_arg" in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ for ac_config_dir in : $subdirs; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ if test ! -d $srcdir/$ac_config_dir; then
+ continue
+ fi
+
+ echo configuring in $ac_config_dir
+
+ case "$srcdir" in
+ .) ;;
+ *)
+ if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+ else
+ { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+ fi
+ ;;
+ esac
+
+ ac_popdir=`pwd`
+ cd $ac_config_dir
+
+ # A "../" for each directory in /$ac_config_dir.
+ ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+
+ case "$srcdir" in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ /*|[A-z]:/*) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f ./configure; then
+ ac_sub_configure=./configure
+ elif test -f $ac_sub_srcdir/configure; then
+ ac_sub_configure=$ac_sub_srcdir/configure
+ elif test -f $ac_sub_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ then :
+ else
+ { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+ fi
+ fi
+
+ cd $ac_popdir
+ done
+fi
+
diff --git a/Build/source/texk/dviljk/configure.in b/Build/source/texk/dviljk/configure.in
new file mode 100644
index 00000000000..4b85965c154
--- /dev/null
+++ b/Build/source/texk/dviljk/configure.in
@@ -0,0 +1,18 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(dvi2xx.c)
+
+AC_CONFIG_HEADERS([c-auto.h:c-auto.in], [date >stamp-auto])
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_LN_S
+
+sinclude(../kpathsea/withenable.ac)
+
+dnl These tests prevent reliable cross-compilation. Sigh.
+AC_C_CHAR_UNSIGNED
+AC_CHECK_SIZEOF(long)
+
+KPSE_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/Build/source/texk/dviljk/depend.mak b/Build/source/texk/dviljk/depend.mak
new file mode 100644
index 00000000000..3515a6340e2
--- /dev/null
+++ b/Build/source/texk/dviljk/depend.mak
@@ -0,0 +1,50 @@
+$(objdir)/dvi2xx.obj: \
+ dvi2xx.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ c-auto.h \
+ config.h \
+ commands.h
+
+$(objdir)/tfm.obj: \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/c-vararg.h \
+ c-auto.h \
+ config.h
+
diff --git a/Build/source/texk/dviljk/depend.mk b/Build/source/texk/dviljk/depend.mk
new file mode 100644
index 00000000000..a099bd5e390
--- /dev/null
+++ b/Build/source/texk/dviljk/depend.mk
@@ -0,0 +1,22 @@
+dvilj.o dvilj2p.o dvilj4.o dvilj4l.o: dvi2xx.c dvi2xx.h $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \
+ $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h c-auto.h \
+ config.h commands.h
+tfm.o: tfm.c $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \
+ $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h c-auto.h config.h
diff --git a/Build/source/texk/dviljk/dvi2xx.c b/Build/source/texk/dviljk/dvi2xx.c
new file mode 100644
index 00000000000..42b6801e05a
--- /dev/null
+++ b/Build/source/texk/dviljk/dvi2xx.c
@@ -0,0 +1,5606 @@
+/* $Id: dvi2xx.c,v 2.5 1997/12/08 20:52:20 neumann Exp $ */
+#define VERSION "2.6p2 (dviljk)"
+/*
+#define DEBUGGS 1
+*/
+/**********************************************************************
+ **************************** Intro *********************************
+ **********************************************************************
+ * This program translates TeX's DVI-Code into device dependent
+ * code of either the
+ *
+ * - HP-LASERJET+ and compatibles (PCL), or the
+ * - IBM 3812 pageprinter
+ *
+ * depending on the preprocessor switches specified before compilation.
+ * The program is written to run on a PC XT/AT/PS2 under MS-DOS. It can
+ * be compiled nicely with MSC Rel. 3.0-5.1 with option -AL (large memory
+ * model). Take care that in the CONFIG.SYS file the FILES parameter
+ * is set to 20; otherwise reduce MAXOPEN. 640K are recommended.
+ * I use link option /stack:9000 to increase runtime stack.
+ * It also works without modifications under Unix System V.
+ **********************************************************************
+ * Adapted for the PC: Gustaf Neumann
+ * +1002 stuff University of Economics
+ * +3812 support Augasse 2-6
+ * +Output buffering A-1090 Vienna, AUSTRIA
+ * +lpt binary support Tel. *43-222-340525/533
+ * +pk-89 stuff 773
+ * +pixelpaths
+ * +alternative directory structure
+ * +code compiles also under Unix V (HP/UX)
+ * (thx Michael Haberler)
+ * +huge characters (a character bigger than 32K)
+ * formats PXL1001 and PXL 1002
+ * (use: raster graphics)
+ * +reduction of the produced code
+ * +new options -X -Y -c -g
+ * +changed options -r (LJ now default from first to last)
+ * -x,-y (accept floats)
+ * +new option -z for LJ: print testpage containing
+ * pagecounter after printjob
+ * +try to overcome font limit on LJ (max 16 fonts/page) and
+ * (max 32 fonts/document):
+ * additional fonts are drawn as bitmap-
+ * graphics.
+ * +allows to set character close to the paperedge on LJ
+ * +gf-supprt (by Joe Kelsey joe@Pacer.com)
+ * gf.c and gf.h from mitdevices/dvi2ps
+ * +clipping of rules
+ * +OS/2 defines from Rutger Berns, apprmb@hheouh50.bitnet
+ *
+ * BITNET/EARN: NEUMANN at AWIWUW11
+ **********************************************************************
+ * fixes in LJ-mode: rule-drawing,
+ * characters with 127<=height<=200
+ * reset printer at beginning and end of each job
+ * better positioning of rules
+ * 30.1.89 (0.48) bug fixed for files containing >32 fonts (thanks A. Brosig),
+ * different font assignment heuristic
+ * fixes in 3812-mode: 14.juli 87 positioning of rastered characters
+ * better positioning of rules
+ * general fixes
+ * 1.1.88 page origin set to 1in/1in (hopefully everywhere)
+ * 22.7.88 reset y-position for each page-eject
+ * 15.1.89 fixing bug is space allocation for EmitFileName
+ * (thanks to Bernhard Simon)
+ * 15.3.91 (0.49) landscape support for lj ii p, lj iii and lj 2000
+ * fixing rule drawing problems for IBM3812 in landcape mode,
+ * 256 character clean (lj family and IBM3812)
+ * 5.5.91 (0.50) -DSEVENBIT added for older LJ-emulations
+ * -D1, -D2, -D-, -D1-, -D2- options added due to suggestions
+ * from Tomasz Wolniewicz
+ **********************************************************************
+ * Preprocessor switches:
+ * #define DEBUG for massive printing of trace information
+ * when -d cmdline option specified
+ * #define IBM3812 produce output for the IBM3812 pageprinter
+ * #define LJ produce output for the HP Laserjet+ or LJ II
+ * #define LJ2P produce output for the HP Laserjet LJ IIP, LJ III
+ * or LaserJet 2000
+ * #define LJ_LARGE_FONT_MEMORY large FONT Memory for LJ printer family
+ * #define DRAWGLYPH draws PK-Glyphs on stderr
+ * #define USEPXL use PXL and PK fonts rather than gf fonts
+ **********************************************************************
+ * Adapted for Acorn RISC OS computers: Andreas Dehmel
+ * Address: Andreas Dehmel
+ * Am Schorn 18
+ * 82327 Tutzing
+ * Germany
+ * dehmel@informatik.tu-muenchen.de
+ *
+ * Changes:
+ * - Split the whole thing up into smaller files
+ * - Rearranged certain parts of the output
+ * - If fonts are missing a taskobey file is created that
+ * contains MF commands to build the fonts.
+ * - SUPPORT FOR DIAGRAMS AS USED IN DVIVIEW!!!
+ * - Fixed problem of raster chars being scrambled when diagram
+ * printouts were on the same page.
+ * - Raster chars and fonts can now also be downloaded in
+ * compressed format; many thanks to Karl Berry!
+ */
+
+#include "dvi2xx.h"
+
+#ifdef SEVENBIT
+#define VIS 33
+#define VIS2 (VIS+32)
+unsigned char
+VisChar(c)
+unsigned char c;
+{
+ c &= 0xff;
+ if (c < VIS)
+ return ((unsigned char)(160 + c));
+ if (c < 128)
+ return (c);
+ if (c < (255 - VIS2))
+ return ((unsigned char)(VIS2 + c));
+ return (255);
+}
+#endif
+
+
+/**********************************************************************/
+/******************************* main *******************************/
+/**********************************************************************/
+int
+#if NeedFunctionPrototypes
+main(int argc, char *argv[])
+#else
+main(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+ struct stack_entry { /* stack entry */
+ long4 h, v, w, x, y, z; /* what's on stack */
+ };
+ short command; /* current command */
+ long4 count[10]; /* the 10 counters at begining of each page*/
+ long4 cpagep = 0; /* current page pointer */
+ bool Emitting = _FALSE; /* outputting typsetting instructions? */
+ int i; /* command parameter; loop index */
+ int k; /* temporary parameter */
+ char n[STRSIZE]; /* command parameter */
+ int PassNo = 0; /* which pass over the DVI page are we on? */
+ bool SkipMode = _FALSE; /* in skip mode flag */
+ int sp = 0; /* stack pointer */
+ struct stack_entry stack[STACK_SIZE]; /* stack */
+ char SpecialStr[STRSIZE]; /* "\special" strings */
+ long4 val, val2; /* temporarys to hold command information */
+ long4 w = 0; /* current horizontal spacing */
+ long4 x = 0; /* current horizontal spacing */
+ long4 y = 0; /* current vertical spacing */
+ long4 z = 0; /* current vertical spacing */
+
+#ifdef vms
+ extern noshare int errno;
+ extern noshare char *sys_errlist[];
+#else
+# if !defined (__riscos) && !defined (KPATHSEA)
+ extern char *sys_errlist[];
+ extern int errno;
+# endif
+#endif
+
+ /* Initialize pixel_files */
+ for (i = 0; i <= MAXOPEN; i++)
+ pixel_files[i].pixel_file_id = FPNULL;
+
+ x_origin = XDEFAULTOFF; /* x-origin in dots */
+ y_origin = YDEFAULTOFF; /* y-origin in dots */
+
+ setbuf(ERR_STREAM, NULL);
+ (void) strcpy(G_progname, argv[0]);
+#ifdef KPATHSEA
+ kpse_set_progname(argv[0]);
+ kpse_set_program_enabled (kpse_pk_format, MAKE_TEX_PK_BY_DEFAULT, kpse_src_compile);
+#endif
+ DecodeArgs(argc, argv);
+
+#ifdef LJ4
+ if (CompressCharWidth < 0) {
+ switch(UseCompression) {
+ case 0: CompressCharWidth = COMPRESS_WIDTH0; break;
+ case 2: CompressCharWidth = COMPRESS_WIDTH2; break;
+ case 3: CompressCharWidth = COMPRESS_WIDTH3; break;
+ }
+ }
+#endif
+
+#ifdef KPATHSEA
+ kpse_init_prog("DVILJ", RESOLUTION, MFMODE, "cmr10");
+#endif
+
+ power[0] = 1;
+ for (i = 1; i <= 31; i ++)
+ power[i] = power[i - 1] << 1;
+ gpower[0] = 0l;
+ for ( i = 1; i <= 32; i ++)
+ gpower[i] = gpower[i - 1] + power[i - 1];
+
+ if ((i = (int)NoSignExtend(dvifp, 1)) != PRE) {
+ Fatal("%s: PRE doesn't occur first--are you sure this is a DVI file?\n\n",
+ G_progname);
+ }
+ i = (int)SignExtend(dvifp, 1);
+ if (i != DVIFORMAT) {
+ Fatal( "%s: DVI format = %d, can only process DVI format %d files\n\n",
+ G_progname, i, DVIFORMAT);
+ }
+
+ if (*EmitFileName == '-') {
+#ifdef RISC_USE_OSL
+ EMTO = BOUTOPEN("Vdu:");
+#else
+ EMTO = stdout;
+#endif
+ }
+ else
+ if ((EMTO = BOUTOPEN(EmitFileName)) == FPNULL)
+#ifndef KPATHSEA
+ Fatal("opening output file: fopen(%s) : %s", EmitFileName,
+#ifdef __riscos
+ "Cannot open"
+#else
+ sys_errlist[errno]
+#endif
+ )
+#endif /* not KPATHSEA */
+ ;
+#ifdef __riscos
+ xosfile_set_type(EmitFileName,0xff4);
+#endif
+
+ /* If EmitFileName is "-", we use stdout. But it is by default open
+ in TEXT mode, and we need to switch it to binary, unless they are
+ writing to the screen (in which case they get what they deserve). */
+ if (O_BINARY && !isatty(fileno(outfp)))
+ AssureBinary(fileno(outfp));
+
+#ifdef TIMING
+#ifdef BSD_TIME_CALLS
+ ftime(&timebuffer);
+ start_time = timebuffer.time + (float)(timebuffer.millitm) / 1000.0;
+#else
+ gettimeofday(&Tp, NULL);
+ start_time = Tp.tv_sec + ((float)(Tp.tv_usec))/ 1000000.0;
+#endif
+#endif
+
+ /* it is important that these be the very first things output !!! */
+ if ( G_header )
+ CopyFile( HeaderFileName );
+
+ /*****************************/
+ /*for( i0=0; i0<nif; i0++ ) */ /* copy all included files */
+ /* CopyFile( Ifile[i0] ); */
+ /*****************************/
+
+#ifdef IBM3812
+ PMPout(3, "\307\310\366"); /* unload all fonts and macros */
+ EMITWORD(MAX_PAGE_WIDTH);
+ EMITWORD(MAX_PAGE_HEIGHT);
+ if (Landscape)
+ PMPout(2, "\322\1");
+#endif
+
+#ifdef LJ
+ if (ResetPrinter)
+ EMIT1("\033E");
+# ifdef LJ4
+ EMIT2("\033%%-12345X@PJL SET RESOLUTION=%d\012",RESOLUTION);
+ EMIT1("@PJL SET PAGEPROTECT=OFF\012");
+ EMIT1("@PJL ENTER LANGUAGE=PCL\012");
+ if (econoMode && LJ6)
+ EMIT1("@PJL SET ECONOMODE=ON\012");
+ EMIT3("\033&u%dD\033*t%dR",RESOLUTION,RESOLUTION);
+ if (econoMode && !LJ6)
+ EMIT1("\033*v1T");
+# endif
+# ifdef LJ2P
+ if (DuplexMode)
+ EMIT2("\033&l%dS", DuplexMode);
+# endif
+ if (Landscape)
+ EMIT1("\033&l1O\033*rF");
+ if (pagesize>0) {
+# ifndef vms
+ EMIT2("\033&l%hdaE\033&aL", pagesize);
+# else
+ EMIT2("\033&l%daE\033&aL", pagesize);
+# endif
+ } else
+ EMIT1("\033&lE\033&aL");
+
+ if (ncopies>1) {
+# ifndef vms
+ EMIT2("\033&l%hdX", ncopies);
+# else
+ EMIT2("\033&l%dX", ncopies);
+# endif
+ }
+#endif /* LJ */
+
+ if (DoublePage) {
+ StartPrintPages = PrintPages;
+#ifdef IBM3812
+ Reverse = (bool)!Reverse; /* perverse and strange */
+#endif
+ }
+
+ if (ManualFeed)
+ EMIT(outfp, "\033&l2H"); /* Manual Feed */
+
+ if (Reverse) {
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "reverse\n");
+#endif
+ ReadPostAmble(_TRUE);
+ FSEEK(dvifp, ppagep, SEEK_SET);
+ } else {
+ ReadPostAmble(_TRUE);
+ FSEEK(dvifp, 14l, SEEK_SET);
+ k = (int)NoSignExtend(dvifp, 1);
+ GetBytes(dvifp, n, k);
+ }
+ PassNo = 0;
+
+ while (_TRUE) {
+ command = (short) NoSignExtend(dvifp, 1);
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"CMD@%ld:\t%d\n", (long) ftell(dvifp) - 1, command);
+#endif
+ switch (command) {
+ case SET1:
+ case SET2:
+ case SET3:
+ case SET4:
+ val = NoSignExtend(dvifp, (int)command - SET1 + 1);
+ if (!SkipMode)
+ SetChar(val, command, PassNo, _TRUE,_FALSE);
+ break;
+ case SET_RULE:
+ val = NoSignExtend(dvifp, 4);
+ val2 = NoSignExtend(dvifp, 4);
+ if (Emitting)
+ SetRule(val, val2, 1);
+ break;
+ case PUT1:
+ case PUT2:
+ case PUT3:
+ case PUT4:
+ val = NoSignExtend(dvifp, (int)command - PUT1 + 1);
+ if (!SkipMode)
+ SetChar(val, command, PassNo, _TRUE,_FALSE);
+ break;
+ case PUT_RULE:
+ val = NoSignExtend(dvifp, 4);
+ val2 = NoSignExtend(dvifp, 4);
+ if (Emitting)
+ SetRule(val, val2, 0);
+ break;
+ case NOP:
+ break;
+ case BOP:
+ cpagep = FTELL(dvifp) - 1;
+ DEBUG_PRINT ("BOP for [");
+ for (i = 0; i <= 9; i++) {
+ count[i] = NoSignExtend(dvifp, 4);
+ DEBUG_PRINT1 ("%d.", (int) count[i]);
+ }
+ DEBUG_PRINT1 ("] at %ld.\n", cpagep);
+ ppagep = (long)NoSignExtend(dvifp, 4);
+ h = v = w = x = y = z = 0;
+ hh = vv = 0;
+ last_rx = last_ry = UNKNOWN;
+ sp = 0;
+ fontptr = NULL;
+ prevfont = NULL;
+ DoBop();
+ /*
+ fprintf(ERR_STREAM,"skimode %d, count %d, F %d, L %d\n",
+ (int)SkipMode,(int)count[0],(int)FirstPageSpecified,(int)LastPageSpecified);
+ */
+ SkipMode = (bool)((FirstPageSpecified && count[0] < FirstPage) ||
+ (LastPageSpecified && count[0] > LastPage ));
+ /*
+ fprintf(ERR_STREAM,"skimode %d, count %d, F %d, L %d\n",
+ (int)SkipMode,(int)count[0],(int)FirstPageSpecified,(int)LastPageSpecified);
+ */
+
+ if (DoublePage && !SkipMode) {
+ if (PassNo == 0) {
+ LastPtobePrinted = count[0];
+ if (!Reverse && (WouldPrint == 0)) {
+ if (count[0] == 0l) {
+ ZeroPage = _TRUE;
+ EvenPage = _FALSE;
+ }
+ else {
+ EvenPage = (bool)( (count[0]<0? labs(count[0])+1: count[0]) %2 == 0);
+
+ if (PrintEmptyPages && EvenPage && PageParity==1) {
+ WouldPrint ++;
+ if (PrintFirstPart) {
+ qfprintf(ERR_STREAM,"[EvenPage] ");
+ FormFeed();
+ }
+ }
+ }
+ }
+ WouldPrint ++;
+ /*
+ fprintf(ERR_STREAM, "doublepage %d, page parity = %d, 1=%d 2=%d, Reverse %d, WouldPrint %d, fpZ %d\n",
+ (int)DoublePage, (int)PageParity,(int)PrintFirstPart,(int)PrintSecondPart,
+ (int)Reverse, (int)WouldPrint, (int)ZeroPage);
+ */
+ }
+ if (!PrintFirstPart && PageParity==1) {
+ if (count[0] == 0) {
+ ZeroPage = _TRUE;
+ EvenPage = _FALSE;
+ }
+ SkipMode = _TRUE;
+ }
+ else {
+ /*
+ fprintf(ERR_STREAM,"FirstPart\n count %d, mod %d, pp %d\n",(int)count[0],(int)count[0]%2,PageParity);
+ */
+ SkipMode =
+ (bool)(PageParity != (short)((count[0]<0 ?
+ labs(count[0])+1 : count[0])%2));
+ if (count[0] == 0) SkipMode = (bool)!SkipMode;
+ }
+
+ }
+ Emitting = (bool)((PassNo != 0) && !SkipMode);
+ /*
+ fprintf(ERR_STREAM,"Emitting= %d, PassNo=%d, SkipMode = %d\n",(int)Emitting,(int)PassNo,(int)SkipMode);
+ */
+ if ( !SkipMode ) {
+ if (PassNo == 0)
+ qfprintf(ERR_STREAM,"[%ld", (long)count[0]);
+ }
+ break;
+ case EOP:
+ if ( !SkipMode ) {
+ if (PassNo == 0) {
+ /* start second pass on current page */
+ FSEEK(dvifp, cpagep, SEEK_SET);
+ PassNo = 1;
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"\nStarting second pass\n");
+#endif
+
+ } else {
+ /* end of second pass, and of page processing */
+
+ last_rx = last_ry = UNKNOWN;
+ FormFeed();
+ ++ndone;
+
+ qfprintf(ERR_STREAM,"] ");
+ if ( (ndone % 10) == 0 )
+ qfprintf(ERR_STREAM,"\n");
+
+ if (DoublePage) --PrintPages;
+ if (--PrintPages < 1) AllDone(_TRUE);
+ PassNo = 0;
+ }
+ } else
+ PassNo = 0;
+
+ if ( PassNo == 0 && Reverse ) {
+ if ( ppagep > 0 )
+ FSEEK(dvifp, ppagep, SEEK_SET);
+ else {
+ if (DoublePage && !SkipMode)
+ ZeroPage = (bool)(count[0] == 0);
+
+ if (ZeroPage)
+ EvenPage = _FALSE;
+ else
+ EvenPage = (bool)((int)LastPtobePrinted%2 == 0);
+
+ AllDone(_FALSE);
+ }
+ }
+ break;
+ case PUSH:
+ if (sp >= STACK_SIZE)
+ Fatal("stack overflow");
+ stack[sp].h = h;
+ stack[sp].v = v;
+ stack[sp].w = w;
+ stack[sp].x = x;
+ stack[sp].y = y;
+ stack[sp].z = z;
+ sp++;
+ break;
+ case POP:
+ --sp;
+ if (sp < 0)
+ Fatal("stack underflow");
+ h = stack[sp].h;
+ v = stack[sp].v;
+ w = stack[sp].w;
+ x = stack[sp].x;
+ y = stack[sp].y;
+ z = stack[sp].z;
+ last_rx = last_ry = UNKNOWN;
+ break;
+ case RIGHT1:
+ case RIGHT2:
+ case RIGHT3:
+ case RIGHT4:
+ val = SignExtend(dvifp, (int)command - RIGHT1 + 1);
+ if (Emitting)
+ MoveOver(val);
+ break;
+ case W0:
+ if (Emitting)
+ MoveOver(w);
+ break;
+ case W1:
+ case W2:
+ case W3:
+ case W4:
+ w = SignExtend(dvifp, (int)command - W1 + 1);
+ if (Emitting)
+ MoveOver(w);
+ break;
+ case X0:
+ if (Emitting)
+ MoveOver(x);
+ break;
+ case X1:
+ case X2:
+ case X3:
+ case X4:
+ x = SignExtend(dvifp, (int)command - X1 + 1);
+ if (Emitting)
+ MoveOver(x);
+ break;
+ case DOWN1:
+ case DOWN2:
+ case DOWN3:
+ case DOWN4:
+ val = SignExtend(dvifp, (int)command - DOWN1 + 1);
+ if (Emitting)
+ MoveDown(val);
+ break;
+ case Y0:
+ if (Emitting)
+ MoveDown(y);
+ break;
+ case Y1:
+ case Y2:
+ case Y3:
+ case Y4:
+ y = SignExtend(dvifp, (int)command - Y1 + 1);
+ if (Emitting)
+ MoveDown(y);
+ break;
+ case Z0:
+ if (Emitting)
+ MoveDown(z);
+ break;
+ case Z1:
+ case Z2:
+ case Z3:
+ case Z4:
+ z = SignExtend(dvifp, (int)command - Z1 + 1);
+ if (Emitting)
+ MoveDown(z);
+ break;
+ case FNT1:
+ case FNT2:
+ case FNT3:
+ case FNT4:
+ k = NoSignExtend(dvifp, (int) command - FNT1 + 1);
+ if (!SkipMode) {
+ SetFntNum(k, Emitting);
+ }
+ break;
+ case XXX1:
+ case XXX2:
+ case XXX3:
+ case XXX4:
+ k = (int)NoSignExtend(dvifp, (int)command - XXX1 + 1);
+ GetBytes(dvifp, SpecialStr, k);
+ if (Emitting)
+ DoSpecial(SpecialStr, k);
+ break;
+ case FNT_DEF1:
+ case FNT_DEF2:
+ case FNT_DEF3:
+ case FNT_DEF4:
+ k = (int)NoSignExtend(dvifp, (int)command - FNT_DEF1 + 1);
+ SkipFontDef(); /* SkipFontDef(k); */
+ break;
+ case PRE:
+ Fatal("PRE occurs within file");
+ break;
+ case POST:
+ AllDone(_FALSE);
+ PassNo = 0;
+ break;
+ case POST_POST:
+ Fatal("POST_POST with no preceding POST");
+ break;
+ default:
+ if (command >= FONT_00 && command <= FONT_63) {
+ if (!SkipMode)
+ SetFntNum((long4)command - FONT_00, Emitting);
+ } else if (command >= SETC_000 && command <= SETC_127) {
+ if (!SkipMode) {
+ SetString(command, PassNo);
+ }
+ } else
+ Fatal("%d is an undefined command", command);
+ break;
+ }
+ } /* while _TRUE */
+}
+
+
+
+
+
+
+/*------------------------ begin dviIO.c ----------------------------------*/
+
+/* The following functions buffer input/output during CopyFile / CopyHPFile
+ Write functions are only needed if RISC_BUFFER is defined; otherwise output
+ is not buffered. */
+
+/* read a buffered byte */
+char
+#if NeedFunctionPrototypes
+b_read(FILEPTR spfp)
+#else
+b_read(spfp)
+FILEPTR spfp;
+#endif
+{
+ if (biact >= binumber) {
+#ifdef RISC_USE_OSL
+ binumber = BUFFSIZE - read_multi(buffin,1,BUFFSIZE,spfp);
+#else
+ binumber = read_multi(buffin,1,BUFFSIZE,spfp);
+#endif
+ biact = 0;
+ }
+ return binumber == 0 ? 0 : buffin[biact++];
+}
+
+#ifdef RISC_BUFFER
+void
+#if NeedFunctionPrototypes
+b_write(FILEPTR spfp, char c) /* write a buffered byte */
+#else
+b_write(spfp, c)
+FILEPTR spfp;
+char c;
+#endif
+{
+ if (boact >= BUFFSIZE) {
+ write_multi(buffout,1,BUFFSIZE,spfp);
+ boact = 0;
+ }
+ buffout[boact++] = c;
+}
+
+void
+#if NeedFunctionPrototypes
+b_wrtmult(FILEPTR spfp, char *buf, int len) /* write a sequence of bytes to the output buffer */
+#else
+b_wrtmult(spfp, buf, len)
+FILEPTR spfp;
+char *buf;
+int len;
+#endif
+{
+ register int i;
+
+ if ((len > (BUFFSIZE - boact)) || (len >= (BUFFSIZE/4))) {
+ write_multi(buffout,1,boact,spfp);
+ /* Copy only small blocks; large ones are written directly */
+ if (len < (BUFFSIZE/4)) {
+ for (i = 0; i<len; i++)
+ buffout[i] = buf[i];
+ boact = len;
+ } else {
+ write_multi(buf,1,len,spfp);
+ boact = 0;
+ }
+ }
+ else {
+ for (i = 0; i<len; i++)
+ buffout[boact++] = buf[i];
+ }
+}
+
+/* flush the output buffer */
+void
+#if NeedFunctionPrototypes
+b_oflush(FILEPTR spfp)
+#else
+b_oflush(spfp)
+FILEPTR spfp;
+#endif
+{
+ write_multi(buffout,1,boact,spfp);
+ boact = 0;
+}
+#endif
+/* end of buffer handling functions */
+
+
+/*-->CopyFile*/ /* copy a file straight through to output */
+/*********************************************************************/
+/***************************** CopyFile ******************************/
+/*********************************************************************/
+void
+#if NeedFunctionPrototypes
+CopyFile(char *str )
+#else
+CopyFile( str )
+char *str;
+#endif
+{
+ FILEPTR spfp;
+ int todo;
+
+ if ( (spfp = BINOPEN(str)) == FPNULL ) {
+ Warning("Unable to open file %s", str );
+ return;
+ }
+ qfprintf(ERR_STREAM," [%s", str);
+#ifdef RISC_BUFFER
+ b_oflush(outfp);
+#endif
+ do {
+ todo = read_multi(buffin,1,BUFFSIZE,spfp);
+ write_multi(buffin,1,todo,outfp);
+ }
+ while (todo == BUFFSIZE);
+
+ BCLOSE(spfp);
+ qfprintf(ERR_STREAM,"]");
+}
+
+
+/*-->CopyHPFile*/ /* copy a HP file to output removing unwanted control codes*/
+/*********************************************************************/
+/***************************** CopyHPFile ******************************/
+/*********************************************************************/
+#if NeedFunctionPrototypes
+int getnum(FILEPTR spfp, char *t, char *numstr)
+#else
+int getnum(spfp, t, numstr)
+FILEPTR spfp;
+char *t, *numstr;
+#endif
+{
+ int count=0;
+ for (*t = (char)b_read(spfp); *t<0x40; *t = (char)b_read(spfp))
+ numstr[count++] = *t;
+ numstr[count] = 0;
+ return atoi(numstr);
+}
+
+#if NeedFunctionPrototypes
+void setOffset(char dir, char sign, int pos)
+#else
+void setOffset(dir, sign, pos, first)
+char dir, sign;
+int pos;
+#endif
+{
+ if ((sign == '+' || sign == '-') && pos > 0 ) {
+ EMIT4("\033*p%c%d%c",sign,pos,dir);
+#ifdef DEBUGGS
+ fprintf(stderr, "relative: *p%c%d%c\n", sign, pos, dir);
+#endif
+ } else if (pos>0) {
+ EMIT3("\033*p%d%c",pos,dir);
+#ifdef DEBUGGS
+ fprintf(stderr, "absolute: *p%d%c\n", pos, dir);
+#endif
+ if (dir == 'X')
+ last_rx = pos;
+ else
+ last_ry = pos;
+ } else {
+ /*EMIT3("\033*p%d%c",pos,dir);*/
+#ifdef DEBUGGS
+ fprintf(stderr, "Relative: *p%d%c\n", pos, dir);
+#endif
+ }
+}
+
+
+void
+#if NeedFunctionPrototypes
+CopyHPFile(char *str )
+#else
+CopyHPFile( str )
+char *str;
+#endif
+{
+ FILEPTR spfp;
+ char t,numstr[20];
+ int count,miny,minx,num;
+
+ if ( (spfp = BINOPEN(str)) == FPNULL ) {
+ Warning("Unable to open file %s", str);
+ return;
+ }
+ minx = 32767; /* Set to a high value initially */
+ miny = 32767;
+
+ /* Pass through the input PCL file twice. The first time find the
+ smallest x- and y-offsets so that they can be subtracted out when
+ sending positioning commands later. The second pass strips the
+ unwanted commands from the input file and outputs the rest */
+
+ /* reset the input buffer */
+ binumber = 0;
+ biact = 0;
+
+ qfprintf(ERR_STREAM," [%s", str);
+ /* Test for !EOF now ((binumber == BUFFSIZE) || (biact < binumber)) */
+ do {
+ t = (char)b_read(spfp);
+ if (t==0x1B) { /* Find the escape character */
+ t = (char)b_read(spfp);
+ if (t==0x2A) { /* This indiactes the start of a graphics command */
+ t = (char)b_read(spfp);
+ switch(t) {
+ case('p'):
+ /* These are the graphics positioning commands */
+ /* Find the smallest x and y offsets */
+ num = getnum(spfp, &t, numstr);
+
+ /* Take into account the possible different ordering */
+ /* of the commands (x first, y first) */
+
+ if (t=='Y' || t=='y') {
+ if (numstr[0]!='+' && numstr[0]!='-' && num<miny)
+ miny = num;
+ if (t=='y') {
+ num = getnum(spfp, &t, numstr);
+ if (numstr[0]!='+' && numstr[0]!='-' && num<minx)
+ minx = num;
+ }
+ }
+ if (t=='X' || t=='x') {
+ if (numstr[0]!='+' && numstr[0]!='-' && num<minx)
+ minx = num;
+
+ if (t=='x') {
+ num = getnum(spfp, &t,numstr);
+ if (numstr[0]!='+' && numstr[0]!='-' && num<miny)
+ miny = num;
+ }
+ }
+ break;
+ /* Ignore all other commands for the moment - just read them */
+ case(0x74):
+ for (t = (char)b_read(spfp); t != 0x52; t = (char)b_read(spfp));
+ break;
+
+ case(0x72):
+ for (t = (char)b_read(spfp); ((t< 0x40)||(t>0x60)); t = (char)b_read(spfp));
+ break;
+
+ case(0x62):
+ num = 0;
+ count = 0;
+ /* Read in the correct number of bytes of raster graphics */
+ /* so that we don't get commands and raster graphics confused */
+
+ for (t = (char)b_read(spfp); ((t<0x40)||(t>=0x60)); t = (char)b_read(spfp))
+ numstr[count++]=t;
+ numstr[count]=0;
+ if (t==0x4D)
+ for(t = numstr[count = 0]; t!=0; t = numstr[++count]);
+ if (t==0x57) {
+ for(t = numstr[count = 0]; t!=0; t = numstr[++count]);
+ for(count = atoi(numstr); count>0; count--)
+ t = (char)b_read(spfp);
+ }
+ break;
+
+ case(0x63):
+ for (t = (char)b_read(spfp); t< 0x40 || t>0x60; t = (char)b_read(spfp));
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ while ((binumber == BUFFSIZE) || (biact < binumber));
+
+ BCLOSE(spfp);
+ qfprintf(ERR_STREAM,"]");
+
+ if ( (spfp = BINOPEN(str)) == FPNULL ) {
+ Warning("Unable to open file %s", str );
+ return;
+ }
+ qfprintf(ERR_STREAM," [%s", str);
+ /* reset input buffer again */
+ binumber = 0;
+ biact = 0;
+
+
+ /* Pass through the input file again but this time output the */
+ /* retained PCL commands */
+#ifdef DEBUGGS
+ fprintf(stderr,"\nminx=%d, miny=%d, xg=%d, yg=%d\n",
+ minx, miny, x_goffset, y_goffset);
+#endif
+ do {
+ t = (char)b_read(spfp);
+ if (t==0x1B) {
+ t = (char)b_read(spfp);
+ if (t==0x2A) {
+ t = (char)b_read(spfp);
+ switch(t) {
+ case('p'):
+ num = getnum(spfp, &t,numstr);
+ if (t == 'Y' || t == 'y') {
+ if (numstr[0]!='+' && numstr[0]!='-') {
+ /* Subtract the minimum offset found in first pass */
+ /* and add in the current vertical offset */
+ setOffset('Y',numstr[0],
+ num-miny + (int)PIXROUND(v,vconv) + y_goffset);
+ } else {
+ setOffset('Y',numstr[0], num);
+ }
+
+ if (t == 'y') {
+ num = getnum(spfp, &t,numstr);
+ if (numstr[0]!='+' && numstr[0]!='-') {
+ /*Add in correct horizontal offset */
+ setOffset('X',numstr[0],
+ num - minx + (int)PIXROUND(h,hconv) + x_goffset);
+ } else if (num>=0) {
+ setOffset('X',numstr[0], num);
+ }
+ }
+ }
+
+ if (t=='X' || t=='x') {
+ if (numstr[0]!='+' && numstr[0]!='-') {
+ /*Add in the correct horizontal offset*/
+ setOffset('X',numstr[0],
+ num - minx + (int)PIXROUND(h,hconv) + x_goffset);
+ } else {
+ setOffset('X',numstr[0], num);
+ }
+
+ if (t=='x') {
+ num = getnum(spfp, &t,numstr);
+ if (numstr[0]!='+' && numstr[0]!='-') {
+ /* Subtract the minimum offset found in first pass */
+ /* and add in the current vertical offset */
+ setOffset('Y',numstr[0],
+ num-miny + (int)PIXROUND(v,vconv) + y_goffset);
+ } else {
+ setOffset('Y',numstr[0], num);
+ }
+ }
+ }
+ break;
+
+ case(0x74):
+ /* Set the Raster resolution */
+ EMIT1("\033*t");
+ for (t = (char)b_read(spfp); t != 0x52; t = (char)b_read(spfp))
+ EMITC(t);
+ EMITC(t);
+ break;
+
+ case(0x72):
+ /* Raster Graphics commands such as start */
+ EMIT1("\033*r");
+ for (t = (char)b_read(spfp); t< 0x40 || t>0x60; t = (char)b_read(spfp))
+ EMITC(t);
+ EMITC(t);
+ break;
+
+ case(0x62):
+ /* Transfer the correct number of bytes of raster graphics */
+ EMIT1("\033*b");
+ num = 0;
+ count = 0;
+ for (t = (char)b_read(spfp); t<0x40 || t>=0x60; t = (char)b_read(spfp))
+ numstr[count++] = t;
+ numstr[count] = 0;
+ if (t==0x4D) {
+ for (t = numstr[count = 0]; t!=0; t = numstr[++count])
+ EMITC(t);
+ EMIT1("M");
+ }
+ if (t==0x57) {
+ for(t = numstr[count = 0]; t!=0; t = numstr[++count])
+ EMITC(t);
+ EMIT1("W");
+ for (count = atoi(numstr); count>0; count--) {
+ t = (char)b_read(spfp);
+ EMITC(t);
+ }
+ }
+ break;
+
+ case(0x63):
+ /* Rectangular draw commands */
+ EMIT1("\033*c");
+ for (t = (char)b_read(spfp); t<0x40 || t>0x60;
+ t = (char)b_read(spfp))
+ EMITC(t);
+ EMITC(t);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ while ((binumber == BUFFSIZE) || (biact < binumber));
+
+ BCLOSE(spfp);
+ qfprintf(ERR_STREAM,"]");
+}
+
+/* This function closes all open files */
+void
+#if NeedFunctionPrototypes
+CloseFiles(void)
+#else
+CloseFiles()
+#endif
+{
+ struct font_entry *fe;
+ FILEPTR f;
+
+ /* First input/output files */
+ if (outfp != FPNULL) {
+#ifdef RISC_BUFFER
+ b_oflush(outfp);
+#endif
+ BCLOSE(outfp);
+ }
+ if (dvifp != FPNULL) {
+ BCLOSE(dvifp);
+ }
+#ifdef __riscos
+ if (metafile != FPNULL) {
+ BCLOSE(metafile);
+ }
+#endif
+ /* Now all open font files */
+ fe = hfontptr;
+ while (fe != NULL) {
+ f = fe->font_file_id;
+ if ((f != FPNULL) && (f != NO_FILE)) {
+ BCLOSE(f);
+ }
+ fe = fe->next;
+ }
+}
+
+/*-->GetBytes*/
+/**********************************************************************/
+/***************************** GetBytes *****************************/
+/**********************************************************************/
+/* get n bytes from file fp; now a macro, so we don't need it any more
+void
+GetBytes(FILEPTR fp, char *cp, int n)
+{
+ read_multi(cp,n,1,fp);
+}
+*/
+
+/*-->NoSignExtend*/
+/**********************************************************************/
+/*************************** NoSignExtend ***************************/
+/**********************************************************************/
+long4
+#if NeedFunctionPrototypes
+NoSignExtend(FILEPTR fp, register int n)
+#else
+NoSignExtend(fp, n) /* return n byte quantity from file fd */
+register FILEPTR fp; /* file pointer */
+register int n; /* number of bytes */
+#endif
+{
+ long4 x = 0; /* number being constructed */
+ unsigned char h;
+ while (n--) {
+ x <<= 8;
+ read_byte(fp,h);
+ x |= h;
+ }
+ /* fprintf(stderr,"[%ld] ",(long)x);*/
+ return(x);
+}
+
+
+#ifndef ARITHMETIC_RIGHT_SHIFT
+long4 signTab[5] = {0,0x00000080,0x00008000,0x00800000,0x00000000};
+long4 extendTab[5] = {0,~0^0xff,~0^0xffff,~0^0xffffff,~0^0xffffffff};
+#endif
+
+/*-->SignExtend*/
+/**********************************************************************/
+/**************************** SignExtend ****************************/
+/**********************************************************************/
+long4
+#if NeedFunctionPrototypes
+SignExtend(FILEPTR fp, register int n)
+#else
+SignExtend(fp, n) /* return n byte quantity from file fd */
+register FILEPTR fp; /* file pointer */
+register int n; /* number of bytes */
+#endif
+{
+ int n1; /* number of bytes */
+ long4 x; /* number being constructed */
+ unsigned char h;
+#ifdef SIGN_DEBUG
+ long4 x0; /* copy of x */
+#endif
+ read_byte(fp,h);
+ x = h; /* get first (high-order) byte */
+ n1 = n--;
+ while (n--) {
+ x <<= 8;
+ read_byte(fp,h);
+ x |= h;
+ }
+ /*
+ * 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!
+ */
+
+#ifdef SIGN_DEBUG
+ x0 = x;
+#endif
+
+#ifdef ARITHMETIC_RIGHT_SHIFT
+ x <<= 32 - 8 * n1;
+ x >>= 32 - 8 * n1; /* sign extend */
+#else
+ if (x & signTab[n1]) x |= extendTab[n1];
+#endif
+
+#ifdef SIGN_DEBUG
+ fprintf(ERR_STREAM,"\tSignExtend(fp,%d)=%lX, was=%lX,%d\n",
+ n1,x,x0,x0&signTab[n1]);
+#endif
+
+#ifdef DEBUG
+ if (Debug > 1)
+ fprintf(ERR_STREAM,"\tSignExtend(fp,%d)=%lX\n", n1, x);
+#endif
+ return(x);
+}
+
+
+#ifdef IBM3812
+/*-->PMPout*/
+/*****************************************************************************/
+/* This routine produces the PMP-envelopes for the 3812. Its semantics are:
+
+ first arg == 0 ... flush buffer
+ first arg == -1 ... number of bytes specified in the second argument
+ have to be continuous, that is they must not
+ be disrupted by ENTER PMP etc.
+ first arg > 0 output first arg bytes
+
+ If arg2 > OUTBUFSIZE ... flush buffer,
+ switch to unbuffered mode
+ (dont't collect PMP commands)
+ If arg2+bufferpointer > OUTBUFSIZE ... flush buffer,
+ block will fit into buffer
+ otherwise ..... block will fit into buffer
+
+ Buffering is done to reduce the ENTER PMP-commands. Initially
+ the 3812 is in PC-ASCII mode. In order to issue a PMP-command it is
+ necessary to enter PMP mode. The ENTER-PMP-command contains the
+ number of bytes that will be interpreted as PMP-commands. In the
+ most naive approach for each primitive command (eg. set cursor) you
+ have to produce a seperate ENTER-PMP-envelope (5 bytes). It is
+ favourable to collect as many PMP commands as possible in one envelope. */
+/*****************************************************************************/
+void
+#if NeedFunctionPrototypes
+PMPout(int l, char *s)
+#else
+PMPout(l, s)
+int l;
+char *s;
+#endif
+{
+ static char buffer[OUTBUFSIZE];
+ static unsigned short bp = 0; /* range 0..OUTBUFSIZE */
+ static long4 continuous = 0l;
+ static bool buffered = _TRUE;
+
+ if (l == 0) {
+ if (bp == 0)
+ return;
+ EMIT3("\033[C%c%c", (unsigned char)(bp & 0xFF), (unsigned char)(bp >> 8));
+ EMITB((int)bp, buffer);
+ bp = 0;
+ return;
+ }
+ if (l == -1) {
+ continuous = (long4)s;
+ if (continuous + (long4)bp + 5l > (long4)OUTBUFSIZE)
+ PMPflush;
+ buffered = (bool)((continuous + 5l <= (long4)OUTBUFSIZE));
+ if (!buffered) {
+ EMIT3("\033[C%c%c", (unsigned char)(continuous & 0xFF),
+ (unsigned char)((continuous >> 8) & 0xFF));
+ }
+ return;
+ }
+ if (buffered) {
+ register int i;
+ if ( ((long4)l + bp) > OUTBUFSIZE)
+ PMPflush;
+ for (i = 0; i < l; i++)
+ buffer[bp+i] = s[i];
+ bp += (unsigned short)l;
+ } else {
+ EMITB((int)l, s);
+ buffered = (bool)((continuous -= (long4)l) <= 0);
+ }
+}
+
+
+void
+#if NeedFunctionPrototypes
+PMPoutC(char c)
+#else
+PMPoutC(c)
+char c;
+#endif
+{
+ PMPout(1, &c);
+}
+#endif /* IBM3812 */
+
+
+#ifdef MSC5
+/*-->AssureBinary*/
+/**********************************************************************/
+/*************************** AssureBinary *****************************/
+/**********************************************************************/
+/* This procedure is both DOS AND MSC dependent. The MSC file open on */
+/* a device ignores the 'binary' of the "wb" parameter and opens the */
+/* file in ascii mode. This procedure sets the file f to binary mode */
+/* if it is connected to a device that is not console input or output */
+/* or the null device. For other operating systems this routine is */
+/* useless. (Background: MSDOS 3.2 Technical Reference upd 1 pg 6-137 */
+/**********************************************************************/
+void
+#if NeedFunctionPrototypes
+AssureBinary(FILEPTR f)
+#else
+AssureBinary(f)
+FILEPTR f;
+#endif
+{
+ union REGS regs; /* registers for bios call */
+
+ regs.h.ah = (unsigned char) 0x44; /* IOCTL */
+ regs.h.al = (unsigned char) 0x00; /* get device information */
+ regs.x.bx = (unsigned int) fileno(f); /* handle from MSC */
+ intdos(&regs, &regs); /* call DOS interrupt */
+ /* ---> result in DX */
+
+ if ( (regs.h.dl & 0x80) /* file handle points to a device */
+ && !(regs.h.dl & 0x07) ) { /* neither console i/o or null */
+
+ regs.h.dl |= 0x20; /* set BINARY bit in device info */
+ regs.h.ah = (unsigned char) 0x44; /* IOCTL */
+ regs.h.al = (unsigned char) 0x01; /* set device information */
+ regs.x.bx = (unsigned int) fileno(f); /* handle from MSC */
+ regs.h.dh = (unsigned char) 0x00; /* clear DH */
+ intdos(&regs, &regs); /* call DOS interrupt */
+ }
+}
+#endif /* MSC5 */
+
+/*------------------------ end dviIO.c ----------------------------------*/
+
+/*------------------------ begin dvichars.c -----------------------------*/
+/*-->EmitChar*/
+/**********************************************************************/
+/**************************** EmitChar ******************************/
+/**********************************************************************/
+void /* output a character bitmap */
+#if NeedFunctionPrototypes
+EmitChar(long4 c, struct char_entry *ce)
+#else
+EmitChar(c, ce)
+long4 c;
+struct char_entry *ce;
+#endif
+{
+ register int i;
+ register unsigned char *sl;
+ unsigned short nbpl, nwpl;
+ long total;
+#ifdef LJ
+ unsigned char cnv_buffer[10];
+#endif
+
+
+#ifdef LJ
+/*
+printf("Emit character %c(%d) id=%d, yoff=%d[%d], w=%d[%d], h=%d[%d]\n",
+ (char)c,(int)c,
+ fontptr->plusid,
+ ce->yOffset, fontptr->max_yoff,
+ ce->width, fontptr->max_width,
+ ce->height, fontptr->max_height
+);
+*/
+#endif
+
+
+
+ if ( fontptr->ncdl == 0 ) {
+#ifdef IBM3812
+ used_fontstorage += 1028;
+#endif
+#ifdef LJ
+ if (fontptr->max_width == 0) { /* we have no realistic values */
+ fontptr->max_yoff = CHAR_HEIGTH_LARGE;
+ fontptr->max_width = CHAR_WIDTH_LARGE;
+ fontptr->max_height = CHAR_HEIGTH_LARGE*2;
+ }
+
+ /* open font dict before first char, set active font */
+ INT_ASCII(cnv_buffer,fontptr->plusid);
+# ifdef LJ4
+ EMIT2("\033*c%sD\033)s68W", cnv_buffer);
+ EMITB(6, "\0\104\024\2\0\0");
+# else
+ EMIT2("\033*c%sD\033)s64W", cnv_buffer); /* changed 26 to 64 (khk) */
+ EMITWORD( 64 ); /* Font descriptor size */
+ EMITC((char) 0 ); /* res0 (byte) */
+# ifdef SEVENBIT
+ EMITC((char) 1); /* Font Type */
+# else
+ EMITC((char) 2); /* Font Type */
+# endif /* SEVENBIT */
+ EMITWORD( 0 ); /* res1 */
+# endif /* LJ 4 */
+ EMITWORD( fontptr->max_yoff); /* Baseline Distance */
+ EMITWORD( fontptr->max_width); /* Cell Width */
+ EMITWORD( fontptr->max_height); /* Cell Height */
+ EMITC((char) 0); /* Orientation */
+ EMITC((char) 1); /* Spacing */
+ EMITWORD( 277 ); /* Symbol Set */
+ EMITWORD( 1024 ); /* Pitch */
+ EMITWORD( 1024 ); /* Height */
+ EMITWORD( 0 ); /* xHeight */
+ EMITC((char) 0); /* Width Type */
+ EMITC((char) 0); /* Style */
+ EMITC((char) 0); /* Stroke Weight */
+ EMITC((char) 0); /* Typeface */
+ EMITC((char) 0); /* res2 (byte) */
+ EMITC((char) 0); /* Serif Style */
+ EMITWORD( 0 ); /* res 3 */
+ EMITC((char) 0); /* Underline Distance */
+ EMITC((char) 0); /* Underline Height */
+ EMITWORD( 0 ); /* Text Height */
+ EMITWORD( 0 ); /* Text Width */
+ EMITWORD( 0 ); /* res4 */
+ EMITWORD( 0 ); /* res5 */
+ EMITC((char) 0); /* Pitch Extended */
+ EMITC((char) 0); /* Height Extended */
+ EMITWORD( 0 ); /* res6 */
+ EMITWORD( 0 ); /* res7 */
+ EMITWORD( 0 ); /* res8 */
+ EMITB(16," ");
+# ifdef LJ4
+ EMITB(4 ,"\2\130\2\130");
+# endif
+ EMIT1("\033*c4F");
+#endif /* LJ */
+ }
+ if ( fontptr != prevfont ) { /* because this isn't done on pass 0 */
+#ifdef LJ
+ INT_ASCII(cnv_buffer,fontptr->plusid);
+ EMIT2("\033(%sX", cnv_buffer);
+#endif
+ prevfont = fontptr;
+ }
+
+#ifdef USEPXL
+ if (fontptr->id == pk89) {
+ nwpl = 0; /* initialize variable */
+ nbpl = ((int)(ce->width) + 7) >> 3;
+ total = (long)ce->height * nbpl;
+ } else if (fontptr->id == id1002) {
+ nwpl = 0; /* initialize variable */
+ nbpl = ((int)(ce->width) + 7) >> 3;
+ total = (long)ce->height * nbpl;
+ } else if (fontptr->id == id1001) {
+ nwpl = ((int)(ce->width) + 31) >> 5;
+ nbpl = ((int)(ce->width) + 7) >> 3;
+ total = (long)ce->height * nbpl;
+ } else {
+ /* should never be necessary */
+ nwpl = 0;
+ nbpl = 0;
+ total = 0;
+ }
+#else
+ nbpl = (num_cols + 7) >> 3;
+ total = num_rows * nbpl;
+#endif
+/***************************************************************
+ if ( ((char) c == 'i') && (fontptr->plusid == 0)) {
+ long j;
+ fprintf(ERR_STREAM, "cols=%ld, ncols=%ld\n",(long)nwpl,(long)nbpl);
+
+ fprintf(ERR_STREAM, "%ld Bytes:->",(long)total);
+ for (j=0; j<total; j++) {
+ char *ch; char ic;
+ ch = (char *)(ce->where.address.pixptr);
+ ic = *(ch+j);
+ fprintf(ERR_STREAM,"%X.",ic);
+ }
+ fprintf(ERR_STREAM,"<- Now Emitting\n");
+ }
+***************************************************************/
+#ifdef USEPXL
+#ifdef IBM3812
+ if ((short)(ce->height) - ce->yOffset > 55) {
+ ce->yyOffset = (short) ce->height - ce->yOffset;
+ ce->yOffset = (short) ce->height;
+ } else {
+ ce->yyOffset = (short) 0;
+ }
+#endif
+#ifdef LJ
+ ce->yyOffset = (short) 0;
+#endif
+#endif
+
+ /* ce->cw = (long4)(((double)ce->tfmw / (double)hconv) +0.5); */
+ /* set active font to nn, load font pattern xx ... */
+#ifdef IBM3812
+ PMPcont(total + 9);
+# ifdef USEPXL
+ sprintf(PMPformat, "\323%c\360%c%c%c",
+ (unsigned char)fontptr->plusid,
+ (unsigned char)VisChar((char)c),
+ (unsigned char)ce->height,
+ (unsigned char)ce->width);
+ PMPout(6, PMPformat);
+ PMPoutC((char)(-(ce->xOffset)));
+ PMPoutC((char)(ce->cw - (-ce->xOffset + ce->width)));
+ PMPoutC((char)(ce->yOffset));
+# else
+ sprintf(PMPformat, "\323%c\360%c%c%c",
+ (unsigned char)fontptr->plusid,
+ (unsigned char)VisChar((char)c),
+ (unsigned char)num_rows,
+ (unsigned char)num_cols);
+ PMPout(6, PMPformat);
+ PMPoutC((char)(-x_offset));
+ PMPoutC((char)(ce->cw - (-x_offset + num_cols)));
+ PMPoutC((char)num_rows-y_offset);
+# endif
+#endif
+
+#ifdef LJ
+# ifdef LJ4
+ if (CompressFontMode) { /* Should we use compressed font downloading? */
+ /* For COMPRESSED CHARS */
+ if (PrevSize < nbpl) {
+ PrevSize = nbpl;
+ if (PrevLine != NULL)
+ free(PrevLine);
+ if ((PrevLine = (unsigned char*)malloc(PrevSize*sizeof(char)))
+ == NULL) {
+ PrevSize = 0;
+ Fatal("EmitChar: Out of memory error!\n");
+ }
+ }
+ /* Clear seed line */
+ for (i = 0; i<nbpl; i++)
+ PrevLine[i] = 0;
+ CChar_Off = 0;
+ CChar_Last = -1;
+
+ /* This bit copied from below... */
+# ifdef USEPXL
+ if (fontptr->id == pk89)
+ PkRaster(ce,2);
+ else if (fontptr->id == id1002)
+ for (i = 0; i < (int)ce->height; i++) {
+ sl = ((unsigned char *)(ce->where.address.pixptr) + i * nbpl);
+ CompressedCharLine(ce,nbpl,sl);
+ }
+ else if (fontptr->id == id1001)
+ for (i = 0; i < (int)ce->height; i++) {
+ sl = (unsigned char *)(ce->where.address.pixptr + i * nwpl);
+ CompressedCharLine(ce,nbpl,sl);
+ }
+# else
+ for (i = num_rows; i > 0; i--)
+ CompressedCharLine(ce,nbpl,(bits + (i-1)*nbpl));
+# endif /* USEPXL */
+ }
+ else
+ CChar_Off = -1;
+# endif /* LJ4 */
+
+ INT_ASCII(cnv_buffer,fontptr->plusid);
+ /* Depending on whether character could be packed or not the header looks
+ different! */
+# ifdef LJ4
+ /* printf("raw: %d (%d * %d), comp: %d\n",
+ total,ce->width,ce->height,CChar_Off); */
+ /* Characters that don't compress well are usually rather small so
+ reading them again and writing them uncompressed won't take
+ much time anyway. */
+ if (CChar_Off > total)
+ CChar_Off = -1;
+ if (CChar_Off >= 0) {
+ EMIT4("\033*c%sd%dE\033(s%ldW", cnv_buffer,
+ (unsigned int)VisChar((char)c), (long)(CChar_Off + 16));
+ EMITB(4, "\4\0\016\2");
+ }
+ else
+# endif
+ {
+ EMIT4("\033*c%sd%dE\033(s%ldW", cnv_buffer,
+ (unsigned int)VisChar((char)c), total + 16);
+ EMITB(4, "\4\0\016\1");
+ }
+ /* EMITC((char)(Landscape==_TRUE)); */
+ EMITC((char)0);
+ EMITC((char)0);
+#ifdef USEPXL
+ EMITWORD(-ce->xOffset);
+ EMITWORD(ce->yOffset);
+ EMITWORD(ce->width);
+ EMITWORD(ce->height);
+#else
+ EMITWORD(-x_offset);
+ EMITWORD(num_rows-y_offset);
+ EMITWORD(num_cols);
+ EMITWORD(num_rows);
+#endif
+ EMITWORD((int)ce->cw * 4);
+#endif
+
+#ifdef LJ4
+ /* Now output compressed or uncompressed */
+ if (CChar_Off >= 0) {
+ EMITL(CChar_Off,buffin); /* Could compress character into buffer */
+ }
+ else /* Couldn't compress character - output literally */
+#endif
+
+ {
+#ifdef USEPXL
+ if (fontptr->id == pk89)
+ PkRaster(ce, 0);
+ else if (fontptr->id == id1002)
+ for (i = 0; i < (int)ce->height; i++) {
+ sl = ((unsigned char *)(ce->where.address.pixptr) + i * nbpl);
+ EMITL(nbpl, (char *)sl);
+ }
+ else if (fontptr->id == id1001)
+ for (i = 0; i < (int)ce->height; i++) {
+ sl = (unsigned char *)(ce->where.address.pixptr + i * nwpl);
+ EMITL(nbpl, (char *)sl);
+ }
+#else
+ for (i = num_rows; i > 0; i--) {
+ EMITL (nbpl, bits + (i-1) * nbpl);
+ }
+#endif
+ }
+
+#ifdef IBM3812
+#ifdef USEPXL
+ used_fontstorage += (long4)ce->height * ((ce->width + 15) >> 4) * 2 + 14;
+#else
+ used_fontstorage += (long4)num_rows * ((num_cols + 15) >> 4) * 2 + 14;
+#endif
+#endif
+#ifdef LJ
+#ifdef USEPXL
+ used_fontstorage += 64 * (((int)((ce->height * ce->width) - 1) / 64) + 1);
+#else
+ used_fontstorage += 64 * ((((num_rows * num_cols) - 1) / 64) + 1);
+#endif
+#endif
+ fontptr->ncdl += 1;
+ G_ncdl += 1;
+}
+
+/*-->PkRaster*/
+/*********************************************************************/
+/**************************** PkRaster *******************************/
+/*********************************************************************/
+
+#ifdef USEPXL
+unsigned char getnyb (
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+long4 pk_packed_num (
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+#define PKBYTE *pkloc; pkloc ++
+#define OUTCHAR(c) raster_line_buf[bp]= (unsigned char)c; bp++
+
+unsigned char bitweight, inputbyte;
+unsigned char dyn_f;
+unsigned char *pkloc;
+int repeatcount;
+
+void /* <Read and translate raster description@>*/
+#if NeedFunctionPrototypes
+PkRaster(struct char_entry *ce, int raster)
+#else
+PkRaster(ce, raster)
+struct char_entry *ce;
+int raster;
+#endif
+{
+ int rp;
+ int current_line;
+ int wordwidth;
+ bool turnon;
+ unsigned short nbpl;
+ long4 rowsleft, word, wordweight, hbit, count, i, j, tl;
+ long4 row[101];
+ unsigned char raster_line_buf[BYTES_PER_PIXEL_LINE];
+ unsigned short bp;
+
+
+ if (ce->charsize == HUGE_SIZE)
+ Fatal( "cannot process currently PK font patterns of that size!\n");
+
+
+ current_line = 0;
+ pkloc = (unsigned char *)ce->where.address.pixptr;
+ dyn_f = (unsigned char)(ce->flag_byte >> 4);
+ turnon = (bool)((ce->flag_byte & 8) == 8);
+ wordwidth = (int)(ce->width + 31) >> 5;
+ nbpl = ((int)(ce->width) + 7) >> 3;
+
+ bitweight = 0;
+ if (dyn_f == 14) {
+ /*printf("<Get raster by bits@>\n");*/
+ for (i = 1; i <= (long4)ce->height; i++) {
+ word = 0;
+ wordweight = 31;
+ bp = 0; /* Sowa */
+
+#ifdef DRAWGLYPH
+ printf(" |");
+#endif
+ for (j = 1; j <= (long4)ce->width; j++) {
+ bool getbit;
+ /* bp = 0; SOWA */
+ /*******************************************begin Getbit *********/
+ bitweight /= 2;
+ if ( bitweight == 0 ) {
+ inputbyte = PKBYTE;
+ bitweight = 128;
+ }
+ getbit = (bool)
+ ( inputbyte >= bitweight );
+ if ( getbit )
+ inputbyte -= bitweight;
+ /*********************************************end Getbit *********/
+
+ if (getbit)
+ word += power[wordweight];
+
+ wordweight --;
+ if (wordweight == -1) {
+
+#ifdef DRAWGLYPH
+ { int k;
+ for (k = 31; k>=0; k--) {
+ if ((power[k] & word)!=0) printf("M");
+ else printf(".");
+ }
+ }
+#endif
+
+ OUTCHAR((word >> 24 & 0xFF));
+ OUTCHAR((word >> 16 & 0xFF));
+ OUTCHAR((word >> 8 & 0xFF));
+ OUTCHAR((word & 0xFF));
+
+ word = 0;
+ wordweight = 31;
+ }
+ }
+ if (wordweight < 31) {
+#ifdef COMMENT
+# ifdef DRAWGLYPH
+ {
+ int k;
+ for (k = 15; k>=0; k--) {
+ if ((power[k] & word)!=0) printf("Z");
+ else printf(":");
+ }
+ }
+ printf("|\n ----|");
+# endif
+#endif
+
+ for (j = 3; j >= (wordwidth * 4 - (long4)nbpl); j--) {
+ OUTCHAR(((word >> (j << 3)) & 0xff));
+#ifdef DRAWGLYPH
+ {
+ int k;
+ for (k = 7; k>=0; k--) {
+ if ((power[k] & ((word >> (j << 3)) & 0xff))!=0) printf("M");
+ else printf(".");
+ }
+ }
+#endif
+ }
+
+ }
+
+ switch (raster) {
+ case 1:
+ RasterLine(ce, nbpl, current_line, raster_line_buf);
+ current_line++;
+ break;
+#ifdef LJ4
+ case 2:
+ CompressedCharLine(ce,(unsigned int)nbpl,raster_line_buf);
+ break;
+#endif
+ default:
+ EMITL(bp, (char *)raster_line_buf);
+ }
+
+#ifdef DRAWGLYPH
+ printf("|\n");
+#endif
+ }
+ } else {
+ /* fprintf(ERR_STREAM, "@<Create normally packed raster@>\n"); */
+ rowsleft = (long4)ce->height;
+ hbit = (long4)ce->width;
+ repeatcount = 0;
+ wordweight = 32;
+ word = 0;
+ rp = 1;
+ while ( rowsleft > 0 ) {
+ count = pk_packed_num();
+ bp = 0;
+
+ while (count > 0) {
+ if ((count < wordweight) && (count < hbit)) {
+ if (turnon)
+ word +=
+ gpower[wordweight] -
+ gpower[wordweight - count];
+
+ hbit -= count;
+ wordweight -= count;
+ count = 0;
+ } else if ((count >= hbit) && (hbit <=
+ wordweight)) {
+
+ if (turnon)
+ word +=
+ gpower[wordweight] -
+ gpower[wordweight - hbit];
+
+ row[rp] = word;
+
+ /*fprintf(ERR_STREAM, " @<Send row@> \n");*/
+ for (i = 0; i <= (long4)repeatcount; i++) { int ii;
+
+#ifdef DRAWGLYPH
+ printf("*** |");
+#endif
+ for (ii = 1; ii < wordwidth; ii++) {
+ tl = row[ii];
+
+ OUTCHAR((tl >> 24 & 0xFF));
+ OUTCHAR((tl >> 16 & 0xFF));
+ OUTCHAR((tl >> 8 & 0xFF));
+ OUTCHAR((tl & 0xFF));
+
+#ifdef DRAWGLYPH
+ {
+ int k;
+ for (k = 31; k>=0; k--) {
+ if ((power[k] & row[ii])!=0) printf("M");
+ else printf(".");
+ }
+ }
+#endif
+ }
+ tl = row[wordwidth];
+ for (j = 3; j >= (wordwidth *4 - (long4)nbpl); j--) {
+ OUTCHAR(((tl >> (j << 3)) & 0xff));
+#ifdef DRAWGLYPH
+ {
+ int k;
+ for (k = 7; k>=0; k--) {
+ if ((power[k] & ((tl >> (j << 3)) & 0xff))!=0) printf("M");
+ else printf(".");
+ }
+ }
+#endif
+ }
+
+ switch (raster) {
+ case 1:
+ RasterLine(ce, (unsigned int)nbpl, current_line, raster_line_buf);
+ current_line++;
+ break;
+#ifdef LJ4
+ case 2:
+ CompressedCharLine(ce,(unsigned int)nbpl,raster_line_buf);
+ break;
+#endif
+ default:
+ EMITL(bp, (char *)raster_line_buf);
+ }
+
+ bp = 0;
+
+#ifdef DRAWGLYPH
+ printf("| ");
+ for (j = 1; j <= (long4)wordwidth; j++) printf("%02lX/",row[j]);
+ printf(" raster=%d\n",raster);
+#endif
+ }
+
+ rowsleft -= (long4)repeatcount + 1;
+ repeatcount = 0;
+ rp = 1;
+ word = 0;
+ wordweight = 32;
+ count -= hbit;
+ hbit = (long4)ce->width;
+ } else {
+ if (turnon) word += gpower[wordweight];
+ row[rp] = word;
+ rp = rp + 1;
+ word = 0;
+ count -= wordweight;
+ hbit -= wordweight;
+ wordweight = 32;
+ }
+ } /* .....while count > 0 */
+ if (turnon)
+ turnon = _FALSE;
+ else
+ turnon = _TRUE;
+ } /* ...... rowsleft > 0 */
+ if ((rowsleft != 0) || (hbit != (long4)ce->width))
+ Fatal("Bad pk file----more bits than required!\n");
+ } /* .... create normally packed raster */
+}
+
+unsigned char getnyb(
+#if NeedFunctionPrototypes
+ void
+#endif
+ )
+{
+ register unsigned char temp;
+ if ( bitweight == 0 ) {
+ inputbyte = PKBYTE;
+ bitweight = 16;
+ }
+ temp = inputbyte / bitweight;
+ inputbyte -= temp * bitweight;
+ bitweight /= 16;
+ return ( temp );
+}
+
+
+long4 pk_packed_num(
+#if NeedFunctionPrototypes
+ void
+#endif
+ )
+{ /*@<Packed number procedure@>= */
+ register int i;
+ long4 j;
+
+ i = (int)getnyb();
+ if (i == 0) {
+ do {
+ j = (long4)getnyb();
+ i++;
+ } while (j == 0);
+ while (i > 0) {
+ j = j * 16 + (long4)getnyb();
+ i--;
+ };
+ return (j - 15 + (13 - dyn_f) * 16 + dyn_f);
+ } else if (i <= (int)dyn_f) {
+ return ((long4)i);
+ } else if (i < 14) {
+ return ((i-(long4)dyn_f - 1) * 16 + (long4)getnyb() + dyn_f + 1);
+ } else {
+ if (i == 14) {
+ repeatcount = (int)pk_packed_num();
+ } else {
+ repeatcount = 1;
+ }
+ /* fprintf(ERR_STREAM,"repeatcount = [%d]\n",repeatcount); */
+ return (pk_packed_num()); /* tail end recursion !! */
+ }
+}
+#endif
+
+#ifndef USEPXL
+void
+#if NeedFunctionPrototypes
+bad_gf(int n)
+#else
+bad_gf(int n)
+int n;
+#endif
+{
+ Fatal("Bad gf file, case %d\n",n); /* See gf.c */
+}
+#endif
+
+
+#ifdef LJ4
+/* Compress a raster line in compression mode 2 */
+int
+#if NeedFunctionPrototypes
+CompressLine2(unsigned char *buffer, unsigned char *buffout, int emitbytes)
+#else
+CompressLine2(buffer, buffout, emitbytes)
+unsigned char *buffer;
+unsigned char *buffout;
+int emitbytes;
+#endif
+{
+ unsigned char *pos,*ppos,*litpos,*upper;
+ int lit,i,pack;
+ char last,c;
+
+ /* trap empty lines (otherwise problems with Packbits) */
+ if (emitbytes == 0)
+ return(0);
+ /* Use Packbits compression (mode 2) on raster line */
+ pos = buffer;
+ litpos = buffer;
+ pack = 1;
+ ppos = buffout;
+ last = *pos++;
+ upper = buffer + emitbytes;
+ while (pos < upper) {
+ c = *pos++;
+ if (c == last) {
+ pack++;
+ /* At least three equal bytes ==> write out preceding literal sequence */
+ if ((pack == 3) && ((lit = (int)(pos - litpos - 3)) != 0)) {
+ while (lit >= 128) {
+ *ppos++ = 127;
+ for (i = 1; i<=128; i++)
+ *ppos++ = *litpos++;
+ lit -= 128;
+ }
+ if (lit != 0) {
+ *ppos++ = lit-1;
+ while ((lit--) > 0)
+ *ppos++ = *litpos++;
+ /* litpos is now pos-3 (i.e. first of the sequence) */
+ }
+ }
+ }
+ else {
+ while (pack >= 128) {
+ *ppos++ = 129;
+ *ppos++ = last;
+ litpos += 128;
+ pack -= 128;
+ }
+ /* At least 3 equal bytes or 2 that don't break a literal sequence
+ ==> write out packed sequence */
+ if ((pack >= 3) || ((pack == 2) && (litpos == pos-3))) {
+ *ppos++ = 257 - pack;
+ *ppos++ = last;
+ litpos += pack;
+ }
+ pack = 1;
+ last = c;
+ }
+ if (ppos > (buffout + BUFFSIZE/2 - 129)) {
+ fprintf(ERR_STREAM,
+ "Can't compact raster character; rerun without compression!\n");
+ return(0);
+ }
+ }
+
+ while (pack >= 128) {
+ *ppos++ = 129;
+ *ppos++ = last;
+ litpos += 128;
+ pack -= 128;
+ }
+ if ((pack >= 3) || ((pack == 2) && (litpos == pos-3))) {
+ *ppos++ = 257 - pack;
+ *ppos++ = last;
+ litpos += pack;
+ }
+ else if ((lit = (int)(pos - litpos)) != 0) {
+ while (lit >= 128) {
+ *ppos++ = 127;
+ for (i = 1; i<=128; i++)
+ *ppos++ = *litpos++;
+ lit -= 128;
+ }
+ if (lit != 0) {
+ *ppos++ = lit-1;
+ while ((lit--) > 0)
+ *ppos++ = *litpos++;
+ }
+ }
+ return((int)(ppos - buffout));
+}
+
+
+/* Compress a raster line in compression mode 3 */
+#if NeedFunctionPrototypes
+int CompressLine3(unsigned char *buffer, unsigned char *buffout, int emitbytes)
+#else
+int CompressLine3(buffer, buffout, emitbytes)
+unsigned char *buffer;
+unsigned char *buffout;
+int emitbytes;
+#endif
+{
+ unsigned char *pos,*ppos,*litpos,*upper,*prev;
+ int lit,i,pack;
+
+ /* Use compression mode 3 */
+ pos = buffer;
+ ppos = buffout;
+ upper = buffer + emitbytes;
+ prev = PrevLine;
+ while(pos < upper) {
+ litpos = pos;
+ while ((*prev == *pos) && (pos < upper)) {
+ prev++;
+ pos++;
+ }
+ if (pos < upper) {
+ pack = (int)(pos - litpos);
+ litpos = pos;
+ i = upper - pos;
+ if (i > 8)
+ i = 8;
+ while ((*pos != *prev) && (i > 0)) {
+ *prev++ = *pos++;
+ i--;
+ }
+ i = (int)(pos - litpos - 1);
+ lit = i<<5;
+ if (pack < 31) {
+ *ppos++ = lit + pack;
+ }
+ else {
+ *ppos++ = lit + 31;
+ pack -= 31;
+ while (pack >= 255) {
+ *ppos++ = 255;
+ pack -= 255;
+ }
+ *ppos++ = pack;
+ }
+ while (i >= 0) {
+ *ppos++ = *litpos++;
+ i--;
+ }
+ }
+ if (ppos > (buffout + BUFFSIZE/2 - 16)) {
+ fprintf(ERR_STREAM,
+ "Can't compact raster character; rerun without compression!\n");
+ return(0);
+ }
+ }
+ return((int)(ppos - buffout));
+}
+#endif
+
+/*-->RasterLine*/
+/**********************************************************************/
+/**************************** RasterLine ****************************/
+/**********************************************************************/
+void
+#if NeedFunctionPrototypes
+RasterLine(struct char_entry *ce, unsigned int nbpl,
+ unsigned int current_line, unsigned char *buffer)
+#else
+RasterLine(ce, nbpl, current_line, buffer)
+struct char_entry *ce;
+unsigned short nbpl, current_line;
+char *buffer;
+#endif
+{
+#ifdef IBM3812
+ long total;
+ static unsigned short maxlines;
+
+ if (current_line == 0) {
+# ifdef USEPXL
+ maxlines = ce->height;
+
+ MoveVert(-ce->yOffset); /* move cursor up */
+ MoveHor(-ce->xOffset); /* move cursor right */
+# else
+ maxlines = num_rows;
+
+ MoveVert(- (num_rows-y_offset) ); /* move cursor up */
+ MoveHor(-x_offset); /* move cursor right */
+# endif
+ last_rx = last_ry = UNKNOWN; /* next time full positioning */
+ }
+
+ if (current_line % maxlines == 0) {
+ if (current_line > 0) { /* maxlines lines have been printed*/
+ MoveVert(maxlines); /* move cursor down */
+ last_rx = last_ry = UNKNOWN; /* next time full positioning */
+ }
+# ifdef USEPXL
+ total = (long)(ce->height - current_line) * (long4)nbpl;
+# else
+ total = (long)(num_rows - current_line) * (long4)nbpl;
+# endif
+ if ((total + 9) > 65535) {
+ maxlines = (unsigned short)((65535 - 9) / nbpl);
+ total = (long)maxlines * (long)nbpl;
+ }
+
+ PMPcont(total + 9);
+ PMPout(2, "\365\0");
+ EMITWORD(maxlines);
+# ifdef USEPXL
+ EMITWORD(ce->width);
+# else
+ EMITWORD(num_cols);
+# endif
+ PMPoutC((unsigned char) (total >> 16) & 0xFF);
+ PMPoutC((unsigned char) (total >> 8 ) & 0xFF);
+ PMPoutC((unsigned char) total & 0xFF);
+ }
+ EMITL((int)nbpl, (char *)buffer);
+#endif /* IBM3812 */
+
+
+#ifdef LJ
+ register int emitbytes;
+#ifdef LJ4
+ int i;
+#endif
+
+ for (emitbytes = (int)nbpl;
+ (*(buffer + emitbytes - 1) == '\0') && (emitbytes > 0);
+ emitbytes--);
+# ifdef LJ4
+ switch (CompressCharMode) {
+ case 0:
+ EMIT2("\033*b%dW", emitbytes);
+ EMITL(emitbytes, buffer);
+ break;
+
+ case 2:
+ i = CompressLine2(buffer,buffin,emitbytes);
+ EMIT2("\033*b%dW", i);
+ EMITL(i,buffin);
+ break;
+
+ case 3:
+ i = CompressLine3(buffer,buffin + BUFFSIZE/2,(int)nbpl);
+ EMIT2("\033*b%dW", i);
+ EMITL(i,buffin + BUFFSIZE/2);
+ break;
+
+ default:
+ fprintf(ERR_STREAM,"Unsupported compression mode!\n");
+ }
+# else
+ EMIT2("\033*b%dW", emitbytes);
+ EMITL(emitbytes, buffer);
+# endif /* LJ4 */
+#endif /* LJ */
+}
+
+
+/*-->RasterChar*/
+/**********************************************************************/
+/**************************** RasterChar ****************************/
+/**********************************************************************/
+void /* raster a character bitmap */
+#if NeedFunctionPrototypes
+RasterChar(struct char_entry *ce)
+#else
+RasterChar(ce)
+struct char_entry *ce;
+#endif
+{
+ int i;
+ register unsigned char *sl;
+ unsigned short nbpl, nwpl;
+ unsigned char raster_line_buf[BYTES_PER_PIXEL_LINE];
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"Raster character ...size=%d \n", (int)ce->charsize);
+#endif
+
+#ifdef USEPXL
+ if (fontptr->id == pk89) {
+ nwpl = 0; /* initialize variable */
+ nbpl = ((int)(ce->width) + 7) >> 3;
+ } else if (fontptr->id == id1002) {
+ nwpl = 0; /* initialize variable */
+ nbpl = ((int)ce->width + 7) >> 3;
+ } else if (fontptr->id == id1001) {
+ nwpl = ((int)ce->width + 31) >> 5;
+ nbpl = ((int)ce->width + 7) >> 3;
+ } else {
+ /* should never be necessary */
+ nwpl = 0;
+ nbpl = 0;
+ }
+#else
+ nbpl = (num_cols + 7) >> 3;
+#endif
+
+#ifdef LJ
+# ifdef LJ4
+ CompressCharMode = (ce->width < CompressCharWidth) ? 0 : UseCompression;
+ EMIT3("\033*t%dR\033*r1A\033*b%dM",RESOLUTION,CompressCharMode);
+ if (CompressCharMode == 3) {
+ /* Check if PrevLine big enough; claim more space if not */
+ if (((int)nbpl) > PrevSize) {
+ if (PrevLine != NULL)
+ free(PrevLine);
+ if ((PrevLine = (unsigned char *)malloc(nbpl*sizeof(char))) == NULL) {
+ PrevSize = 0;
+ Fatal("RasterChar: out of memory!\n");
+ }
+ PrevSize = (int)nbpl;
+ }
+ /* Clear previous line */
+ sl = PrevLine;
+ for (i = 0; i<nbpl; i++)
+ *sl++ = 0;
+ }
+# else
+ EMIT2("\033*t%dR\033*r1A\033*b0M",RESOLUTION);
+# endif /* LJ4 */
+#endif
+ { /* read pixel from file */
+ if ((ce->charsize == HUGE_SIZE) && (fontptr->id != pk89))
+ OpenFontFile();
+#ifdef USEPXL
+ FSEEK(pxlfp, ce->where.address.fileOffset, SEEK_SET);
+#else
+ FSEEK(gfin, ce->where.address.fileOffset, SEEK_SET);
+ gettochar();
+ readbits();
+#endif /* USEPXL */
+ }
+
+#ifdef USEPXL
+ if (fontptr->id == pk89)
+ PkRaster(ce, 1);
+ else if (fontptr->id == id1002) {
+ for (i = 0; i < (int)ce->height; i++) {
+ if (ce->charsize == HUGE_SIZE) {
+ fread(raster_line_buf, 1, (int)nbpl, pxlfp);
+ sl = raster_line_buf;
+ } else
+ sl = ((unsigned char *)(ce->where.address.pixptr)
+ + i * nbpl);
+ RasterLine(ce, (unsigned int)nbpl, i, sl);
+ }
+ } else if (fontptr->id == id1001) {
+ long filediff;
+ filediff = (long)nwpl * 4 - nbpl;
+ for (i = 0; i < (int)ce->height; i++) {
+ if (ce->charsize == HUGE_SIZE) {
+ read_multi(raster_line_buf, 1, (int)nbpl, pxlfp);
+ /* skip fill bytes */
+ FSEEK(pxlfp, filediff, SEEK_CUR);
+ sl = raster_line_buf;
+ } else
+ sl = (unsigned char *)(ce->where.address.pixptr + i * nwpl);
+ RasterLine(ce, (unsigned int)nbpl, i, sl);
+ }
+ }
+#else
+ for (i = num_rows; i > 0; i--)
+ RasterLine(ce, (unsigned int)nbpl, i, bits + (i-1) * nbpl);
+#endif
+#ifdef LJ
+ EMIT1("\033*rB");
+#endif
+ last_rx = last_ry = UNKNOWN;
+}
+
+/*-->LoadAChar*/
+/**********************************************************************/
+/***************************** LoadAChar ******************************/
+/**********************************************************************/
+void
+#if NeedFunctionPrototypes
+LoadAChar(long4 c, register struct char_entry *ptr)
+#else
+LoadAChar(c, ptr)
+long4 c;
+register struct char_entry *ptr;
+#endif
+{
+ long4 *pr;
+ long bytes;
+
+ if (ptr->where.address.fileOffset == NONEXISTANT
+#ifdef LJ_RESIDENT_FONTS
+ || fontptr->resident_p
+#endif
+ ) {
+ ptr->where.isloaded = _FALSE;
+ return;
+ }
+
+ OpenFontFile();
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "LoadAChar: <%c>(%ld) from file at pos %ld\n",
+ (char)c,(long)c,(long)ptr->where.address.fileOffset);
+#endif
+
+#ifdef USEPXL
+
+ FSEEK(pxlfp, ptr->where.address.fileOffset, SEEK_SET);
+
+ if (fontptr->id == pk89) {
+#ifdef PARANOIA
+ unsigned char temp;
+ temp = (unsigned char) NoSignExtend(pxlfp, 1);
+
+ if ((int)(ptr->flag_byte) != (int)temp) {
+ fprintf(ERR_STREAM,"font=%lx, ptr=%lx\n",fontptr,ptr);
+ Fatal("%d: oh boy! old flag %d, new flag %d, ptr=%lx\n",
+ (int)c,(int)(ptr->flag_byte),(int)temp,ptr);
+ }
+#endif
+
+ if ((ptr->flag_byte & 7) == 7) {
+ bytes = NoSignExtend(pxlfp, 4) - 28;
+ FSEEK(pxlfp, ptr->where.address.fileOffset + 36, SEEK_SET);
+ /*
+ fprintf(ERR_STREAM,"bytes=%d, seeking at %ld\n",
+ bytes, ptr->where.address.fileOffset + 36);
+ */
+ } else if ((ptr->flag_byte & 4) == 4) {
+ bytes = ((long4)ptr->flag_byte & 3) * 65536l + NoSignExtend(pxlfp, 2) - 13;
+ FSEEK(pxlfp, ptr->where.address.fileOffset + 16, SEEK_SET);
+ } else {
+ bytes = ((long4)ptr->flag_byte & 3) * 256 + NoSignExtend(pxlfp, 1) - 8;
+ FSEEK(pxlfp, ptr->where.address.fileOffset + 10, SEEK_SET);
+ }
+ } else if (fontptr->id == id1002)
+ bytes = ((( (long4)ptr->width + 7) >> 3) * (long4)ptr->height);
+ else if (fontptr->id == id1001)
+ bytes = 4 * (((long4)ptr->width + 31) >> 5) * (long4)ptr->height;
+ else
+ bytes = 0;
+
+ if (bytes > 0) {
+ /* do NOT load Huge characters */
+ if ((bytes > HUGE_CHAR_PATTERN) && (fontptr->id != pk89)) {
+ qfprintf(ERR_STREAM,"Huge Character <%c> (%ld Bytes)\n",
+ (char)c, bytes);
+ ptr->charsize = HUGE_SIZE;
+ ptr->where.isloaded = _FALSE;
+ } else {
+ if ( (pr = (long4 *)malloc( bytes )) == NULL )
+ Fatal("Unable to allocate %ld bytes for char <%c>\n", bytes, (char)c);
+ /*
+ * else fprintf(ERR_STREAM,"allocating %ld bytes char <%c>(%d)\t at 0x%lx\n",
+ * bytes, (char)c,(int)c,pr);
+ */
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,
+ "Allocating Char <%c>, FileOffset=%lX, Bytes=%ld (%d) <%d>\n",
+ (char)c, ptr->where.address.fileOffset, bytes,
+ (int)bytes, (unsigned int)bytes);
+#endif
+ allocated_storage += bytes;
+ read_multi(pr, 1, (int)bytes , pxlfp);
+ ptr->where.address.pixptr = pr;
+ }
+ }
+#else
+ FSEEK(gfin, ptr->where.address.fileOffset, SEEK_SET);
+ gettochar();
+ readbits();
+ if (num_bytes > HUGE_CHAR_PATTERN)
+ ptr->charsize = HUGE_SIZE;
+#endif
+ ptr->where.isloaded = _TRUE;
+ if (ptr->charsize != SMALL_SIZE
+#ifdef LJ
+ /* we might have problems at the edge of the paper with diff. sized characters
+ * the correct treatment would be to check whether the bounding box of
+ * tfontptr is within the paper relative to the current position
+ */
+ || fontptr->max_height > CHAR_HEIGTH_LARGE
+ || (rasterfont[fontptr->plusid])
+#endif
+ )
+ return;
+
+ EmitChar(c, ptr);
+#ifdef USEPXL
+ /* we should really free the space used by the PXL data after this
+ point, but it is not large, and besides, we may want to be
+ more clever in the future, about sending bitmaps. So keep
+ the data around */
+#endif
+}
+
+/*-->SetChar*/
+/**********************************************************************/
+/***************************** SetChar ******************************/
+/**********************************************************************/
+void
+#if NeedFunctionPrototypes
+SetChar(long4 c, short command, int PassNo, bool do_posn, bool in_string)
+#else
+SetChar(c, command, PassNo, do_posn,in_string)
+long4 c;
+short command;
+int PassNo;
+bool do_posn,in_string;
+#endif
+{
+ register struct char_entry *ptr; /* temporary char_entry pointer */
+ bool pos_after = _FALSE;
+
+ ptr = &(fontptr->ch[c]);
+ if (!((ptr->where.isloaded) || (ptr->charsize == HUGE_SIZE)))
+ LoadAChar(c, ptr);
+ if (PassNo == 0)
+ return;
+
+ if (do_posn) {
+#ifdef IBM3812
+ if (CharStringPos>0) {
+ fprintf(ERR_STREAM,"!!!! That should never happen!!!\n");
+ CharStringOut;
+ }
+#endif
+ SetPosn(h, v);
+ }
+
+ /*
+ fprintf(ERR_STREAM,
+ "(%d) hh=%ld (+%ld/+%ld), h=%ld, xh=%ld,xhh=%ld, [%ld|%ld] ->%d\n",
+ (int)do_posn,hh,(long4)ptr->cw,(long4)ptr->cw*(long4)hconv,h,
+ (long)PIXROUND(h, hconv),
+ (long)PIXROUND(hh, hconv),
+ (long)labs((hh-h)),(long)hconv,
+ (labs((hh-h))>hconv)
+ );
+ */
+
+ if (in_string && (labs((hh-h))>hconv)) {
+#ifdef IBM3812
+ CharStringOut;
+#endif
+ SetPosn(h, v);
+ }
+
+ /*
+ fprintf(ERR_STREAM,"raster?=%d - last_ry=%d, last_rx=%d,mmax-height=%d\n",
+ (int)last_ry < fontptr->max_height, (int)last_ry,(int)last_rx,
+ (int)fontptr->max_height);
+ */
+
+ if (fontptr->font_file_id != NO_FILE) { /* ignore missing fonts */
+ if (
+#ifdef LJ_RESIDENT_FONTS
+ !fontptr->resident_p &&
+#endif
+ (ptr->charsize != SMALL_SIZE
+#ifdef LJ
+ /* the LaserJet cannot print characters
+ * where the bounding box lies outside the
+ * paper edge. Missing: right paper edge
+ */
+ || last_ry < (int)fontptr->max_height
+ || fontptr->max_height > CHAR_HEIGTH_LARGE
+ || (rasterfont[fontptr->plusid])
+ || (brother_mode && c == 0)
+#ifdef SEVENBIT
+ || (kyocera_mode && c == 32)
+#endif
+#endif
+ )) {
+#ifdef LJ
+ int tmp;
+ char sign;
+
+ if (!do_posn)
+ SetPosn(h, v);
+
+#ifdef USEPXL
+ tmp = (int)-ptr->yOffset;
+#else
+ tmp = (int)num_rows-y_offset;
+#endif
+ if (tmp != 0) {
+ if (tmp < 0) {
+ sign = '-';
+ tmp = -tmp;
+ } else
+ sign = '+';
+ EMIT3("\033*p%c%dY", sign, tmp);
+ }
+#ifdef USEPXL
+ tmp = (int)-ptr->xOffset;
+#else
+ tmp = (int)-x_offset;
+#endif
+ if (tmp != 0) {
+ if (tmp < 0) {
+ sign = '-';
+ tmp = -tmp;
+ } else
+ sign = '+';
+ EMIT3("\033*p%c%dX", sign, tmp);
+ }
+#endif
+#ifdef IBM3812
+ CharStringOut;
+#endif
+#ifdef DEBUG
+ if (Debug)
+#ifndef vms
+ fprintf(ERR_STREAM,"Raster character <%c> %hd\n", (char) c,(short)c);
+#else
+ fprintf(ERR_STREAM,"Raster character <%c> %d\n", (char) c,(short)c);
+#endif
+#endif
+ RasterChar(ptr);
+ pos_after = _TRUE;
+ } else {
+ unsigned char cc;
+ cc = VisChar((char)c);
+#ifdef IBM3812
+#ifdef USEPXL
+ if ( ptr->yyOffset || (!in_string) ) {
+ CharStringOut;
+ MoveVert(ptr->yyOffset);
+ sprintf(PMPformat, "\01%c", cc);
+ PMPout(2, PMPformat);
+ MoveVert((int)-(ptr->yyOffset));
+ } else {
+#endif
+ if (CharStringPos==CHARSTRINGMAX)
+ CharStringOut;
+
+ CharString[CharStringPos] = cc;
+ CharStringPos++;
+#ifdef USEPXL
+ }
+#endif
+#endif
+#ifdef LJ
+#define TRANSPARENTCHAR(ch) \
+ if ((ch == 0l) || (ch >= 7l && ch <= 15l) || (ch == 27l)) \
+ EMIT2("\033&p1X%c", (unsigned char)ch); \
+ else { EMITC((unsigned char)ch); }
+#ifdef USEPXL
+ if (ptr->yyOffset) {
+#ifndef vms
+ EMIT2("\033*p+%hdY", ptr->yyOffset);
+ TRANSPARENTCHAR(cc);
+ EMIT2("\033*p-%hdY", ptr->yyOffset); /* GUGUGU 255 */
+#else
+ EMIT2("\033*p+%dY", ptr->yyOffset);
+ TRANSPARENTCHAR(cc);
+ EMIT2("\033*p-%dY", ptr->yyOffset); /* GUGUGU 255 */
+#endif
+ } else
+#endif
+ /* EMITC( (unsigned char)c);*/
+ { TRANSPARENTCHAR(cc);}
+#endif
+ }
+ /*
+ fprintf(stderr,"--> hh(%ld) += cw(%ld) * hconv(%ld)",
+ (long)hh, (long)ptr->cw, (long) hconv);
+ */
+#ifdef LJ
+ /* the guessed position must be a multiple of pixels */
+ if (RESOLUTION == 300)
+ hh += (long4) ((ptr->cw)/4)*4*hconv;
+ else /* RESOLUTION == 600 */
+ hh += (long4) ((ptr->cw)/2)*2*hconv;
+#else
+ hh += (long4)(ptr->cw * hconv);
+#endif
+ /*
+ fprintf(stderr," = hh(%ld)\n",(long)hh);
+ */
+ }
+
+ if (command <= SET4)
+ h += ptr->tfmw;
+
+ if (pos_after)
+ SetPosn(h, v);
+ else
+ last_rx = (int)PIXROUND(h, hconv) + x_goffset;
+}
+
+#if NeedFunctionPrototypes
+void DoBop(void)
+#else
+void DoBop()
+#endif
+{
+ struct font_entry *p;
+#ifdef LJ
+ register short i;
+ if (fonts_used_on_this_page > MAX_FONTS_PER_PAGE) {
+ for (i = 0; i < HANDLE_MAX_FONTS; i++)
+ rasterfont[i] = _FALSE;
+ }
+ fonts_used_on_this_page = 0;
+#endif
+ for (p = hfontptr; p; p = p->next)
+ p->used_on_this_page = _FALSE;
+}
+
+/*-->SetString*/
+/**********************************************************************/
+/***************************** SetString ****************************/
+/**********************************************************************/
+void
+#if NeedFunctionPrototypes
+SetString(short firstch, int PassNo)
+#else
+SetString(firstch, PassNo) /* read and set a consecutive string of chars */
+short firstch;
+int PassNo;
+#endif
+{
+ short c;
+ register unsigned short i;
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "SetString ");
+#endif
+ for (i = 0, c = firstch; c >= SETC_000 && c <= SETC_127; i++) {
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "%d(%c) ", c, c);
+#endif
+ SetChar((long4)c, c, PassNo, (bool)(i==0), _TRUE);
+ c = (short)NoSignExtend(dvifp, 1);
+ }
+ FSEEK(dvifp, -1l, SEEK_CUR); /* backup one character */
+#ifdef IBM3812
+ CharStringOut;
+#endif
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "...SetString\n");
+#endif
+}
+
+/*-->SetPosn*/
+/**********************************************************************/
+/***************************** SetPosn ******************************/
+/**********************************************************************/
+void /* output a positioning command */
+#if NeedFunctionPrototypes
+SetPosn(long4 x, long4 y)
+#else
+SetPosn(x, y)
+long4 x, y;
+#endif
+{
+ int rx, ry;
+ rx = (int)PIXROUND(x, hconv) + x_goffset;
+ ry = (int)PIXROUND(y, vconv) + y_goffset;
+
+ /*
+ fprintf(ERR_STREAM,
+ "setposn to %ld/%ld, %d/%d, last: %d/%d\n",
+ (long)x,(long)y,
+ rx,ry,
+ last_rx,last_ry
+ );
+ */
+
+#ifdef IBM3812
+ PMPcont(3);
+ PMPoutC('\340');
+ EMITWORD(LARGER(rx,0));
+
+ if (last_ry != ry) { /* necessary to set new y-position */
+ PMPcont(3);
+ PMPoutC('\341');
+ EMITWORD(LARGER(ry,0));
+ }
+#endif
+#ifdef LJ
+#if 0
+/* this optimization doesn't work, as last_XX is set to the
+ starting(!) position of the last string not to the end position! */
+
+ if (last_rx != rx || last_ry != ry) {
+ if (last_ry == ry) /* not necessary to set new y-position */
+ EMIT2("\033*p%dX", LARGER(rx,0));
+ else if (last_rx == rx)
+ EMIT2("\033*p%dY", LARGER(ry,0));
+ else
+ EMIT3("\033*p%dx%dY", LARGER(rx,0), LARGER(ry,0));
+ }
+#endif
+ if (last_ry == ry) /* not necessary to set new y-position */
+ EMIT2("\033*p%dX", LARGER(rx,0));
+ else
+ EMIT3("\033*p%dx%dY", LARGER(rx,0), LARGER(ry,0));
+#endif
+
+ last_ry = ry; /* last y-position on output device */
+ last_rx = rx; /* last x-position on output device */
+ /*
+ * must know where device "really" is horizontally, for rel. posning.
+ * (maybe in the future), but we always use direct positioning for
+ * vertical movement.
+ */
+ /* hh = rx * hconv; */
+ hh = x;
+ vv = y;
+ /*
+ * fprintf(ERR_STREAM,"DoPosn: x=%ld, y=%ld, rx=%d, ry=%d, hh=%ld, vv=%ld\n",
+ * (long)x,(long)y,rx,ry,(long)hh,(long)vv);
+ */
+}
+
+
+
+#ifdef LJ4
+/* Compresses a rasterline of font data and appends it to buffin (used
+ for storage of the compressed character). CChar_Off is the current
+ offset in the buffer, CChar_Last is the first byte of the last
+ compacted row (line repeat count). Updates the previous line
+ (PrevLine) if necessary. */
+void
+#if NeedFunctionPrototypes
+CompressedCharLine(struct char_entry *ce, int nbpl, unsigned char *buffer)
+#else
+CompressedCharLine(ce, nbpl, buffer)
+struct char_entry *ce;
+int nbpl;
+unsigned char *buffer;
+#endif
+{
+ if (CChar_Off >= 0) {
+ register unsigned char *obuf,*buff;
+ unsigned char *prev,*end;
+#undef max /* cc thinks any max macro overrides a variable */
+ int t,mode,max;
+ register int x,y,i;
+
+ prev = PrevLine;
+ obuf = buffer;
+ end = buffer + nbpl;
+ x = 0;
+ while (obuf < end) {
+ if (*obuf != *prev) {
+ *prev = *obuf;
+ x = 1;
+ }
+ obuf++;
+ prev++;
+ }
+ if (x == 0 && CChar_Last >= 0) {
+ (buffin[CChar_Last])++;
+ return; /* line repeat count +1 */
+ }
+
+ end = buffin + BUFFSIZE - 16;
+ obuf = buffin + CChar_Off;
+ buff = buffer;
+ *obuf++ = 0; /* Line repeat count = 0 */
+ t = 0;
+ CChar_Last = CChar_Off; /* Next line */
+ mode = 0;
+ y = *buff++;
+ i = 7; /* i = current bit */
+ while ((t < ce->width) && (obuf < end)) {
+ max = ce->width - t; /* maximum pixels left to do */
+ x = 0;
+ if (mode == 0) {
+ /* white run */
+ while ((y & (1<<i)) == 0 && x < max) {
+ x++;
+ i--;
+ if (i < 0) {
+ i = 7;
+ y = *buff++;
+ while (y == 0 && x < max) {
+ x += 8;
+ y = *buff++;
+ }
+ }
+ }
+ mode = 1;
+ }
+ else {
+ /* black run */
+ while ((y & (1<<i)) != 0 && x < max) {
+ x++;
+ i--;
+ if (i < 0) {
+ i = 7;
+ y = *buff++;
+ while (y == 0xff && x < max) {
+ x += 8;
+ y = *buff++;
+ }
+ }
+ }
+ mode = 0;
+ }
+ if (x > max)
+ x = max;
+ t += x;
+ /* make precautions for very long runs */
+ while (x > 0xff) {
+ *obuf++ = 0xff;
+ *obuf++ = 0;
+ x -= 0xff;
+ }
+ *obuf++ = x;
+ }
+ CChar_Off = obuf >= end ? -1 : obuf - buffin;
+ }
+}
+#endif
+
+/*------------------------ end dvichars.c ------------------------------*/
+
+
+/* Report a warning if both checksums are nonzero, they don't match, and
+ the user hasn't turned it off. */
+
+static void
+check_checksum (c1, c2, name)
+ unsigned c1, c2;
+ const char *name;
+{
+ if (c1 && c2 && c1 != c2
+#ifdef KPATHSEA
+ && !kpse_tex_hush ("checksum")
+#endif
+ ) {
+ Warning ("Checksum mismatch in %s", name) ;
+ }
+}
+
+
+/*------------------------ begin dviconv.c -----------------------------*/
+/*-->ActualFactor*/
+/**********************************************************************/
+/************************** ActualFactor ****************************/
+/**********************************************************************/
+double /* compute the actual size factor given the approximation */
+#if NeedFunctionPrototypes
+ActualFactor(long4 unmodsize)
+#else
+ActualFactor(unmodsize)
+long4 unmodsize; /* actually factor * 1000 */
+#endif
+{
+ double realsize; /* the actual magnification factor */
+ realsize = (double)unmodsize / 1000.0;
+ if (abs((int)(unmodsize - 1095l))<2)
+ realsize = 1.095445115; /*stephalf*/
+ else if (abs((int)(unmodsize - 1315l))<2)
+ realsize = 1.31453414; /*stepihalf*/
+ else if (abs((int)(unmodsize - 1577l))<2)
+ realsize = 1.57744097; /*stepiihalf*/
+ else if (abs((int)(unmodsize - 1893l))<2)
+ realsize = 1.89292916; /*stepiiihalf*/
+ else if (abs((int)(unmodsize - 2074l))<2)
+ realsize = 2.0736; /*stepiv*/
+ else if (abs((int)(unmodsize - 2488l))<2)
+ realsize = 2.48832; /*stepv*/
+ else if (abs((int)(unmodsize - 2986l))<2)
+ realsize = 2.985984; /*stepvi*/
+ /* the remaining magnification steps are represented with sufficient
+ accuracy already */
+ return(realsize);
+}
+
+
+/*-->DecodeArgs*/
+/*********************************************************************/
+/***************************** DecodeArgs ****************************/
+/*********************************************************************/
+void
+#if NeedFunctionPrototypes
+DecodeArgs(int argc, char *argv[])
+#else
+DecodeArgs(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+ int argind; /* argument index for flags */
+ char curarea[STRSIZE]; /* current file area */
+ char curname[STRSIZE]; /* current file name */
+ char *tcp, *tcp1; /* temporary character pointers */
+ char *this_arg;
+ double x_offset = 0.0, y_offset = 0.0;
+#ifdef __riscos
+ int ddi;
+#endif
+
+
+#ifndef KPATHSEA
+ if ((tcp = getenv("TEXPXL")) != NULL) PXLpath = tcp;
+#ifdef LJ_RESIDENT_FONTS
+ if ((tcp = getenv("TFMFONTS")) != NULL)
+ TFMpath = tcp;
+ else if ((tcp = getenv("TEXFONTS")) != NULL)
+ TFMpath = tcp;
+#endif
+#endif
+
+ if (argc == 2 && (strcmp (argv[1], "--version") == 0)) {
+ extern KPSEDLL char *kpathsea_version_string;
+ puts ("dvilj(k) 2.6");
+ puts (kpathsea_version_string);
+ puts ("Copyright (C) 1997 Gustaf Neumann.\n\
+There is NO warranty. You may redistribute this software\n\
+under the terms of the GNU General Public License.\n\
+For more information about these matters, see the files\n\
+named COPYING and dvi2xx.c.\n\
+Primary author of Dvi2xx: Gustaf Neumann; -k maintainer: K. Berry.");
+ exit (0);
+ }
+
+#ifdef LJ4
+ /* check if last character is a 6 */
+ LJ6 = ('6' == argv[0][strlen(argv[0])-1]);
+#endif
+
+ argind = 1;
+ while (argind < argc) {
+ tcp = argv[argind];
+ if (tcp[0] == '-' && tcp[1] != '\0') {
+ ++tcp;
+ switch (*tcp) {
+#ifndef KPATHSEA
+ case 'a': /* a selects different pxl font area */
+ PXLpath = ++tcp;
+ break;
+#endif
+ case 'A':
+ ManualFeed = _TRUE;
+ break;
+#ifdef IBM3812
+ case 'b': /* first page from alternate casette */
+ FirstAlternate = _TRUE;
+ break;
+#endif
+ case 'c': /* number of copies to print */
+ if ( sscanf(tcp + 1, "%hd", &ncopies) != 1 )
+ Fatal("Argument of -c is not a valid integer\n");
+ if (ncopies<1) {
+ Warning("argument of -c < 1; set to 1!");
+ ncopies = 1;
+ }
+ break;
+#ifdef DEBUG
+ case '-': /* --D selects Debug output */
+ tcp++;
+ if (*tcp == 'D') {
+ Debug = _TRUE;
+#ifdef KPATHSEA
+ sscanf(tcp + 1, "%u", &kpathsea_debug);
+#endif
+ qfprintf(ERR_STREAM,"Debug output enabled\n");
+ }
+ break;
+#endif
+#ifdef LJ2P
+ case 'd': /* d selects DUPLEX mode */
+ tcp++;
+ if (*tcp == '1' )
+ DuplexMode = 1;
+ else if (*tcp == '2')
+ DuplexMode = 2;
+ else {
+ Warning("Invalid DUPLEX mode, assuming DUPLEX=1, Long-Edge Binding");
+ DuplexMode = 1;
+ }
+ break;
+#endif
+ case 'D': /* D selects DoublePage */
+ DoublePage = _TRUE;
+ tcp++;
+ if (*tcp == '1' || *tcp == '2') {
+ if (*tcp == '2')
+ PrintFirstPart = _FALSE;
+ else
+ PrintSecondPart = _FALSE;
+ tcp++;
+ }
+ if (*tcp == '-')
+ PrintEmptyPages = _FALSE;
+ break;
+#ifdef LJ4
+ case 'E': /* do not reset printer (go) */
+ econoMode = _TRUE;
+ break;
+#endif
+ case 'e': /* emit file is specified */
+ EmitFileName = ++tcp;
+#ifdef MSDOS
+ /* delete trailing ':' (causing hangup) */
+ if (EmitFileName[strlen(EmitFileName)-1] == ':')
+ EmitFileName[strlen(EmitFileName)-1] = '\0';
+#endif
+#ifdef OS2 /* repeated to avoid problems with stupid c preprocessors */
+ /* delete trailing ':' (causing hangup) */
+ if (EmitFileName[strlen(EmitFileName)-1] == ':')
+ EmitFileName[strlen(EmitFileName)-1] = '\0';
+#endif
+ break;
+ case 'f': /* next arg is starting pagenumber */
+ if ( sscanf(tcp + 1, "%ld", &FirstPage) != 1 )
+ Fatal("Argument is not a valid integer\n");
+ FirstPageSpecified = _TRUE;
+ break;
+#ifdef LJ
+ case 'g': /* do not reset printer (go) */
+ ResetPrinter = _FALSE;
+ break;
+#endif
+ case 'h': /* copy header file through to output */
+ HeaderFileName = ++tcp;
+ G_header = _TRUE;
+ break;
+#if defined(LJ2P) || defined(IBM3812)
+ case 'l': /* landscape */
+ Landscape = _TRUE;
+ break;
+#endif
+#ifdef MAKETEXPK
+ case 'M':
+ /* -M, -M1 => don't make font; -M0 => do. */
+ makeTexPK = *(tcp + 1) == '0';
+#ifdef KPATHSEA
+ kpse_set_program_enabled (kpse_pk_format, MAKE_TEX_PK_BY_DEFAULT, kpse_src_cmdline);
+#endif /* KPATHSEA */
+ break;
+#endif /* MAKETEXPK */
+ case 'x': /* specify x-offset */
+ this_arg = 0;
+ if (!(*++tcp)) {
+ this_arg = (++argind >= argc ? 0 : argv[argind]);
+ } else {
+ this_arg = tcp;
+ }
+ if (!this_arg
+ || sscanf(this_arg,"%lf", &x_offset) != 1)
+ Fatal("Argument of -x is not a valid floating point number\n");
+ break;
+ case 'y': /* specify y-offset */
+ this_arg = 0;
+ if (!(*++tcp)) {
+ this_arg = (++argind >= argc ? 0 : argv[argind]);
+ } else {
+ this_arg = tcp;
+ }
+ if (!this_arg || sscanf(this_arg, "%lf", &y_offset) != 1)
+ Fatal("Argument of -y is not a valid floating point number\n");
+ break;
+ case 'X': /* specify X-origin in dots */
+ this_arg = 0;
+ if (!(*++tcp)) {
+ this_arg = (++argind >= argc ? 0 : argv[argind]);
+ } else {
+ this_arg = tcp;
+ }
+ if (!this_arg || sscanf(this_arg,"%hd", &x_origin) != 1)
+ Fatal("Argument of -X is not a valid integer\n");
+ break;
+ case 'Y': /* specify Y-origin in dots */
+ this_arg = 0;
+ if (!(*++tcp)) {
+ this_arg = (++argind >= argc ? 0 : argv[argind]);
+ } else {
+ this_arg = tcp;
+ }
+ if (!this_arg ||
+ sscanf(this_arg, "%hd", &y_origin) != 1)
+ Fatal("Argument of -Y is not a valid integer\n");
+ break;
+ case 'm': /* specify magnification to use */
+ switch ( (*++tcp) ) {
+ case '#':
+ /* next arg is a magnification to use */
+ if ( sscanf(tcp + 1, "%ld", &usermag) != 1 )
+ Fatal("Argument of mag is not a valid integer\n");
+ break;
+ case '0':
+ usermag = 1000;
+ break;
+ case 'h':
+ case 'H':
+ usermag = 1095;
+ break;
+ case '1':
+ usermag = 1200;
+ break;
+ case 'q':
+ usermag = 1250;
+ break;
+ case '2':
+ usermag = 1440;
+ break;
+ case '3':
+ usermag = 1728;
+ break;
+ case '4':
+ usermag = 2074;
+ break;
+ case '5':
+ usermag = 2488;
+ break;
+ default:
+ Fatal("%c is a bad mag step\n", *tcp);
+ }
+ break;
+#ifdef SUPERCOMMENT
+ case 'o': /* PostScript command to send */
+ if ( ++argind >= argc )
+ Fatal("No argument following -o\n", 0);
+ PScmd[nps++] = argv[argind];
+ break;
+#endif
+ case 'p': /* print n pages */
+ if ( sscanf(tcp + 1, "%ld", &PrintPages) != 1 )
+ Fatal("Argument is not a valid integer\n");
+ if (PrintPages < 1)
+ Fatal("Argument of -p must be greater than 0\n");
+ break;
+ case 'q': /* quiet operation */
+ G_quiet = _TRUE;
+ break;
+ case 'r': /* switch order to process pages */
+ Reverse = (bool)(!Reverse);
+ break;
+#ifdef LJ
+ case 's': /* specify X-origin in dots */
+ this_arg = 0;
+ if (!(*++tcp)) this_arg = (++argind >= argc ? 0 : argv[argind]);
+ else this_arg = tcp;
+ if (!this_arg || sscanf(this_arg,"%hd", &pagesize) != 1)
+ Fatal("Argument of -s is not a valid integer\n");
+ /*
+ * The original pgsiz_dots assumed a resolution of 300dpi. This loses
+ * at 600dpi so we must scale all.
+ */
+ switch (pagesize) {
+ case 1: pgsiz_dots = 3150; break; /* executive */
+ case 2: pgsiz_dots = 3300; break; /* letter */
+ case 3: pgsiz_dots = 4200; break; /* legal */
+ case 26: pgsiz_dots = 3507; break; /* a4 */
+ case 80: pgsiz_dots = 2250; break; /* monarc */
+ case 81: pgsiz_dots = 2850; break; /* com10 */
+ case 90: pgsiz_dots = 2598; break; /* int dl */
+ case 91: pgsiz_dots = 2704; break; /* int c5 */
+ default: Fatal(
+#ifndef vms
+ "%hd is a bad value for pagesize (1,2,3,26,80,81,90,91)",
+#else
+ "%d is a bad value for pagesize (1,2,3,26,80,81,90,91)",
+#endif
+ pagesize);
+ }
+ break;
+#endif
+ case 't': /* ending pagenumber */
+ if ( sscanf(tcp + 1, "%ld", &LastPage) != 1 )
+ Fatal("Argument is not a valid integer\n");
+ LastPageSpecified = _TRUE;
+ break;
+ case 'v': /* verbatim mode (print pxl-file names) */
+ G_verbose = _TRUE;
+ break;
+
+#ifdef LJ
+ case 'V': /* bugfixes for various vendor's PCL emulations */
+ tcp++;
+ if (*tcp == 'K' || *tcp == 'k')
+ kyocera_mode = _TRUE;
+ else
+ if (*tcp == 'B' || *tcp == 'b')
+ brother_mode = _TRUE;
+# ifdef LJ4
+ else
+ if (*tcp == '6' || *tcp == '6')
+ LJ6 = _TRUE;
+# endif
+ break;
+#endif
+
+ case 'w': /* don't print out warnings */
+ G_nowarn = _TRUE;
+ break;
+#ifdef LJ
+ case 'z':
+ PrintTestPage = (bool)(!PrintTestPage);
+ break;
+#endif
+#ifdef LJ4
+ case 'R': /* number of copies to print */
+ if ( sscanf(tcp + 1, "%d", &RESOLUTION) != 1 )
+ Fatal("Argument of -R is not a valid integer\n");
+ if (RESOLUTION != 300 && RESOLUTION != 600 ) {
+ Warning("Resolution must be 300 or 600! Assuming 300.dpi.");
+ RESOLUTION = 300;
+ } else {
+ if (RESOLUTION == 600) {
+ MFMODE = MFMODE600;
+ x_origin = 600;
+ y_origin = 600;
+ }
+ }
+ break;
+ case 'W': /* Set minimum width of compressed raster characters */
+ CompressCharWidth = atoi(tcp+1);
+ break;
+ case 'C': /* Set compression mode to use for raster characters */
+ UseCompression = atoi(tcp+1);
+ if ((UseCompression != 0) && (UseCompression != 2) && (UseCompression != 3))
+ Fatal("Unsupported compression mode %d\n",UseCompression);
+ break;
+ case 'n': /* Download fonts raw */
+ CompressFontMode = _FALSE;
+ break;
+#endif
+#ifdef __riscos
+ case 'i': /* name of directory to store diagrams in */
+ tcp++;
+ ddi = 0;
+ while (*tcp != ' ' && *tcp != '\0' && ddi < DIAGDIRSIZE-1) {
+ diagdir[ddi++] = *tcp++;
+ }
+ diagdir[ddi] = '\0';
+ break;
+ case 'j': /* don't print digrams */
+ printdiag = _FALSE;
+ break;
+ case 'k': /* cache diagram bitmap in document folder */
+ cachediag = _TRUE;
+ break;
+ case 'P':
+ RasterMultipass = 1;
+ break;
+#endif
+ default:
+ fprintf(ERR_STREAM, "%c is not a valid flag\n", *tcp);
+ }
+ } else {
+
+ (void) strcpy(filename, tcp);
+ if (!strcmp(filename, "-")) {
+ EmitFileName = "-";
+#ifdef RISC_USE_OSL
+ dvifp = BINOPEN("Kbd:");
+#else
+ dvifp = stdin;
+ if (O_BINARY && !isatty(fileno(dvifp)))
+ AssureBinary(fileno(dvifp));
+#endif
+ } else {
+#ifdef KPATHSEA
+ /* split into directory + file name */
+ int tcplen, argvlen;
+ tcp = (char *)xbasename(argv[argind]);/* this knows about any kind of slashes */
+ tcplen = strlen(tcp);
+ argvlen = strlen(argv[argind]);
+ if (tcplen == argvlen)
+ curarea[0] = '\0';
+ else {
+ (void) strcpy(curarea, argv[argind]);
+ curarea[argvlen-tcplen] = '\0';
+ }
+#else
+ tcp = strrchr(argv[argind], '/');
+ /* split into directory + file name */
+ if (tcp == NULL) {
+ curarea[0] = '\0';
+ tcp = argv[argind];
+ } else {
+ (void) strcpy(curarea, argv[argind]);
+ curarea[tcp-argv[argind]+1] = '\0';
+ tcp += 1;
+ }
+#endif
+
+ (void) strcpy(curname, tcp);
+ /* split into file name + extension */
+ tcp1 = strrchr(tcp, '.');
+ if (tcp1 == NULL) {
+ (void) strcpy(rootname, curname);
+ strcat(curname, ".dvi");
+ } else {
+ *tcp1 = '\0';
+ (void) strcpy(rootname, curname);
+ *tcp1 = '.';
+ }
+
+ (void) strcpy(filename, curarea);
+ (void) strcat(filename, curname);
+
+ if ((dvifp = BINOPEN(filename)) == FPNULL) {
+ /* do not insist on .dvi */
+ if (tcp1 == NULL) {
+ int l = strlen(curname);
+ if (l > 4)
+ curname[l - 4] = '\0';
+ l = strlen(filename);
+ if (l > 4)
+ filename[l - 4] = '\0';
+ }
+ if (tcp1 != NULL || (dvifp = BINOPEN(filename)) == FPNULL) {
+#ifdef MSC5
+ Fatal("%s: can't find DVI file \"%s\"\n\n",
+ G_progname, filename);
+#else
+ perror(filename);
+ exit (EXIT_FAILURE);
+#endif
+ }
+ }
+ } /* dvi filename != '-" */
+ }
+ argind++;
+ }
+
+#ifdef LJ4
+ pgsiz_dots *= (int)(RESOLUTION/300); /* rescale dots to page */
+#endif
+ x_goffset = (short) MM_TO_PXL(x_offset) + x_origin;
+ y_goffset = (short) MM_TO_PXL(y_offset) + y_origin;
+
+ if (dvifp == FPNULL) {
+ fprintf(ERR_STREAM,"\nThis is the DVI to %s converter version %s",
+ PRINTER, VERSION);
+#ifdef SEVENBIT
+ fprintf(ERR_STREAM,", 7bit");
+#endif
+ fprintf(ERR_STREAM," (%s)\n", OS);
+ fprintf(ERR_STREAM,"usage: %s [OPTION]... DVIFILE\n", G_progname);
+
+ fprintf(ERR_STREAM,"OPTIONS are:\n");
+#ifdef DEBUG
+ fprintf(ERR_STREAM,"\t--D ..... turns debug output on\n");
+#endif
+#ifndef KPATHSEA
+ fprintf(ERR_STREAM,
+ "\t-aX ..... X= searchpath leading to pixel-files (.pk or .pxl)\n");
+#endif
+#ifdef IBM3812
+ fprintf(ERR_STREAM,
+ "\t-b ..... take paper for first page from alternate casette\n");
+#endif
+ fprintf(ERR_STREAM,"\t-cX ..... X= number of copies\n");
+#ifdef LJ4
+ fprintf(ERR_STREAM,"\t-CX ..... X= compression mode for raster chars; can be 0,2,3 (default=%d)\n", DEFAULT_COMPRESS_MODE);
+#endif
+#ifdef LJ2P
+ fprintf(ERR_STREAM,"\t-dX ..... duplex, X=1: long-edge, 2: short-edge binding\n");
+#endif
+ fprintf(ERR_STREAM,"\t-D ..... turns doublepage output on; ");
+ fprintf(ERR_STREAM,"-D1 odd pages only, -D2 even\n");
+#ifdef LJ4
+ fprintf(ERR_STREAM,"\t-E ..... print in econo-mode\n");
+#endif
+ fprintf(ERR_STREAM,"\t-eX ..... X= output file\n");
+ fprintf(ERR_STREAM,"\t-fX ..... print from begin of page number X\n");
+#ifdef LJ
+ fprintf(ERR_STREAM,
+ "\t-g ..... do not reset printer at begin of job (go)\n");
+#endif
+#ifdef __riscos
+ fprintf(ERR_STREAM,"\t-iX ..... X= name of dir to cache diagrams in\n");
+ fprintf(ERR_STREAM,"\t-j ..... don't print diagrams\n");
+ fprintf(ERR_STREAM,"\t-k ..... cache diagram bitmaps\n");
+#endif
+ fprintf(ERR_STREAM,"\t-hX ..... X= name of headerfile\n");
+#ifdef LJ2P
+ fprintf(ERR_STREAM,"\t-l ..... landscape mode\n");
+#endif
+#ifdef MAKETEXPK
+ fprintf(ERR_STREAM,"\t-MX ..... Don't generate missing PK files\n");
+#endif
+ fprintf(ERR_STREAM,"\t-mX ..... magnification X=0;h;1;2;3;4;5;#xxxx\n");
+#ifdef LJ4
+ fprintf(ERR_STREAM,"\t-n ..... download fonts raw (default: compressed)\n");
+#endif
+ fprintf(ERR_STREAM,"\t-pX ..... print X pages\n");
+#ifdef __riscos
+ fprintf(ERR_STREAM,"\t-P ..... Process printouts in 2 passes\n");
+#endif
+ fprintf(ERR_STREAM,"\t-q ..... quiet operation\n");
+ fprintf(ERR_STREAM,"\t-r ..... process pages in reverse order\n");
+#ifdef LJ4
+ fprintf(ERR_STREAM,"\t-RX ..... set resolution to 300 or 600 dpi\n");
+#endif
+#ifdef LJ
+ fprintf(ERR_STREAM,"\t-sX ..... set paper size to X (see documentation)\n");
+#endif
+ fprintf(ERR_STREAM,"\t-tX ..... print to end of page number X\n");
+ fprintf(ERR_STREAM,"\t-w ..... don't print out warnings\n");
+#ifdef LJ4
+ fprintf(ERR_STREAM,"\t-WX ..... X= minimum width of compressed chars (default=%d)\n",
+ DEFAULT_COMPRESS_WIDTH);
+#endif
+ fprintf(ERR_STREAM,"\t-v ..... tell user which pixel-files are used\n");
+#ifdef LJ
+ fprintf(ERR_STREAM,"\t-VX .... Vendor options (kyocara or brother)\n");
+#endif
+ fprintf(ERR_STREAM,"\t-xX ..... X= x-offset on printout in mm\n");
+ fprintf(ERR_STREAM,"\t-yX ..... X= y-offset on printout in mm\n");
+ fprintf(ERR_STREAM,"\t-XO ..... O= x page origin in dots (default=%d)\n",
+ XDEFAULTOFF );
+ fprintf(ERR_STREAM,"\t-YO ..... O= y page origin in dots (default=%d)\n",
+ YDEFAULTOFF );
+#ifdef LJ
+ fprintf(ERR_STREAM,"\t-z ..... print test page with pagecounter after job\n");
+#endif
+ fprintf(ERR_STREAM,"\t- ..... dvifile is stdin (must be seekable); implies -e-\n");
+#ifdef KPATHSEA
+ {
+ extern KPSEDLL char *kpse_bug_address;
+ putc ('\n', ERR_STREAM);
+ fputs (kpse_bug_address, ERR_STREAM);
+ }
+#endif
+ exit(1);
+ }
+ if (EQ(EmitFileName, "")) {
+ if ((EmitFileName = (char *)malloc( STRSIZE )) != NULL)
+ allocated_storage += STRSIZE;
+ else
+ Fatal("Can't allocate storage of %d bytes\n",STRSIZE);
+ (void) strcpy(EmitFileName, curname);
+ if ((tcp1 = strrchr(EmitFileName, '.')))
+ *tcp1 = '\0';
+ strcat(EmitFileName, EMITFILE_EXTENSION);
+ }
+ if (G_quiet)
+ G_verbose = _FALSE;
+}
+
+/*-->DoConv*/
+/*********************************************************************/
+/******************************** DoConv ***************************/
+/*********************************************************************/
+long4
+#if NeedFunctionPrototypes
+DoConv(long4 num, long4 den, int convResolution)
+#else
+DoConv(num, den, convResolution)
+long4 num, den;
+int convResolution;
+#endif
+{
+ /*register*/ double conv;
+ conv = ((double)num / (double)den) *
+ ((double)mag / 1000.0) *
+ ((double)convResolution/254000.0);
+
+ return((long4)((1.0/conv)+0.5));
+}
+/*------------------------ end dviconv.c -------------------------------*/
+
+
+/*------------------------ begin dvimisc.c -----------------------------*/
+/*-->AllDone*/
+/**********************************************************************/
+/****************************** AllDone ******************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+void AllDone(bool PFlag)
+#else
+void AllDone(PFlag)
+bool PFlag;
+#endif
+{
+#ifdef TIMING
+ double time;
+#endif
+
+ if (DoublePage && (PageParity==1)) { /* Shall we go around again?*/
+ int k;
+ char n[STRSIZE];
+
+ if (PrintEmptyPages && EvenPage && Reverse && PrintFirstPart) {
+ WouldPrint ++;
+ qfprintf(ERR_STREAM,"[EvenPage] ");
+ FormFeed();
+ }
+#ifdef LJ
+ Reverse = (bool)!Reverse;
+#endif
+ if (Reverse) {
+ if (!PFlag) {
+ FSEEK(dvifp, postambleptr, SEEK_SET);
+ (void) NoSignExtend(dvifp, 1);
+ ppagep = (long) NoSignExtend(dvifp, 4);
+ }
+ FSEEK(dvifp, ppagep, SEEK_SET);
+ } else {
+ FSEEK(dvifp, 14l, SEEK_SET);
+ k = (int)NoSignExtend(dvifp, 1);
+ GetBytes(dvifp, n, k);
+ }
+
+ if (PrintSecondPart) {
+ if (PrintFirstPart) {
+ qfprintf(ERR_STREAM,"\n----------------------starting second pass\n");
+#ifdef LJ
+ EMIT1("\033&l2H"); /* Manual Feed */
+#endif
+#ifdef IBM3812
+ PMPout(6,"\326\001\305\300\326\252");
+ /* set display; ring bell; stop; clear display */
+ PMPflush;
+#endif
+ }
+
+ if (PrintEmptyPages && Reverse) {
+ if (ZeroPage) WouldPrint++;
+ if ((WouldPrint%2) == 1) {
+ qfprintf(ERR_STREAM,"[Padding] ");
+ FormFeed();
+ }
+ }
+ WouldPrint = 0;
+ if (PrintEmptyPages && !Reverse && ZeroPage) {
+ WouldPrint++;
+ qfprintf(ERR_STREAM,"[ZeroPage] ");
+ FormFeed();
+ }
+ PageParity = 0;
+ PrintPages = StartPrintPages;
+ return;
+ }
+ }
+
+ if (EvenPage && DoublePage && !Reverse) WouldPrint++;
+
+ if (PrintEmptyPages && DoublePage && PrintSecondPart) {
+ if (Reverse) {
+ if (ZeroPage) {
+ WouldPrint ++;
+ qfprintf(ERR_STREAM,"[ZeroPage] ");
+ FormFeed();
+ }
+ }
+ else if ((WouldPrint%2) != 0) {
+ qfprintf(ERR_STREAM,"[Padding] ");
+ FormFeed();
+ }
+ }
+
+#ifdef IBM3812
+ PMPout(10, "\373\010PMP.init"); /* re-init printer */
+ PMPflush;
+
+ if (used_fontstorage > MAXFONTSTORAGE) {
+ Warning("\n\7used font_storage of %s: %ld Bytes (of %ld)\7",
+ PRINTER, (long)used_fontstorage, MAXFONTSTORAGE);
+ Warning("Try to format file in separate runs!");
+ } else
+ qfprintf(ERR_STREAM,"\nAll done, used font_storage of %s: %ld Bytes (of %ld)",
+ PRINTER, (long)used_fontstorage, MAXFONTSTORAGE);
+#endif
+#ifdef LJ
+# ifdef SHARP_JX_9500
+ if (used_fontstorage > MAXFONTSTORAGE) {
+ Warning("\n\7used font_storage of %s: %ld Bytes (of %ld)\7",
+ PRINTER, (long)used_fontstorage, MAXFONTSTORAGE);
+ Warning("Try to format file in separate runs!");
+ } else
+ qfprintf(ERR_STREAM,"\nAll done, used font_storage of %s: %ld Bytes (of %ld)",
+ PRINTER, (long)used_fontstorage, MAXFONTSTORAGE);
+# else
+ qfprintf(ERR_STREAM,"\nAll done, used font_storage of %s: %ld Bytes",
+ PRINTER, (long)used_fontstorage);
+# endif
+#ifdef LJ_RESIDENT_FONTS
+ qfprintf(ERR_STREAM," + %d resident font%s", resident_count,
+ resident_count == 1 ? "" : "s");
+#endif
+ EMIT1("\033E");
+#ifdef LJ4
+ EMIT1("\033%%-12345X"); /* what does it? */
+#endif
+ if (PrintTestPage) EMIT1("\033z");
+#ifdef vms
+ /* last record is not flushed to file, unless it is completely filled */
+ for (kk = (int)((*outfp)->_cnt); kk > 0; --kk)
+ putc('\0',outfp);
+ fflush(outfp);
+#endif
+#endif
+
+ if (!G_quiet) {
+ fprintf(ERR_STREAM,"\nDynamically allocated storage: %ld Bytes \n",
+ (long)allocated_storage);
+ fprintf(ERR_STREAM,"%d characters downloaded as soft fonts\n", G_ncdl);
+
+#ifdef TIMING
+#ifdef BSD_TIME_CALLS
+ ftime(&timebuffer);
+ time = (timebuffer.time + (float)(timebuffer.millitm)/1000.0) - start_time;
+#else
+ gettimeofday(&Tp, NULL);
+ time = (Tp.tv_sec + (float)(Tp.tv_usec)/1000000.0) - start_time;
+#endif
+
+ if (ndone > 0) {
+ fprintf(ERR_STREAM,
+ "Time of complete run: %.2f seconds, %d page(s), %.2f seconds/page",
+ time, ndone, time / ndone);
+ fprintf(ERR_STREAM," (%.2f ppm)\n",(ndone * 60) / time);
+ }
+ fprintf(ERR_STREAM,"\n");
+#endif
+ }
+ CloseFiles();
+ exit(G_errenc);
+}
+
+/*-->DoSpecial*/
+/*********************************************************************/
+/***************************** DoSpecial ***************************/
+/*********************************************************************/
+
+#define PSFILE 0
+#define ORIENTATION 1
+#define RESETPOINTS 2
+#define DEFPOINT 3
+#define FILL 4
+#define GRAY 5
+#define PATTERN 6
+#define HPFILE 7
+#define LLX 8
+#define LLY 9
+#define URX 10
+#define URY 11
+#define RWI 12
+#define RHI 13
+
+
+KeyDesc KeyTab[] = {
+ { "psfile", String },
+ { "orientation", Integer},
+ { "resetpoints", String},
+ { "defpoint", String},
+ { "fill", String},
+ { "gray", Integer},
+ { "pattern", Integer},
+ { "hpfile", String},
+ { "llx", Integer},
+ { "lly", Integer},
+ { "urx", Integer},
+ { "ury", Integer},
+ { "rwi", Integer},
+ { "rhi", Integer}
+ /*,
+ {"hsize", Dimension},
+ {"vsize", Dimension},
+ {"hoffset", Dimension},
+ {"voffset", Dimension},
+ {"hscale", Number},
+ {"vscale", Number}*/
+};
+
+#define NKEYS (sizeof(KeyTab)/sizeof(KeyTab[0]))
+
+#ifdef __riscos
+# ifdef LJ
+
+/* Compare two strings, ignoring case;
+ s1 pointer to null-terminated keyword, s2 pointer to parseline;
+ returns (if successful) pointer to character following keyword in s2 */
+#if NeedFunctionPrototypes
+bool StrCompare(char *s1, char *s2, char **end)
+#else
+bool StrCompare(s1, s2, end)
+char *s1;
+char *s2;
+char **end;
+#endif
+{
+ char *a,*b;
+
+ a = s1;
+ b = s2;
+ while (*a != '\0') {
+ if (tolower(*a) != tolower(*b)) return(_FALSE);
+ a++;
+ b++;
+ }
+ *end = b;
+ return(_TRUE);
+}
+
+/* Read <number> integer values from string and store results in
+ <result>. Returns number + of arguments actually read, end =
+ pointer to char following last number */
+#if NeedFunctionPrototypes
+int ParseNumbers(char *str, int *result, int number, char **end)
+#else
+int ParseNumbers(str, result, number, end)
+char *str;
+int *result;
+int number;
+char **end;
+#endif
+{
+ char *s;
+ int count = 0;
+
+ s = str;
+ while ((*s != '\0') && (count < number)) {
+ while ((*s == ' ') || (*s == ',') || (*s == '='))
+ s++;
+ if (*s != '\0') {
+ result[count++] = strtod(s,&s);
+ }
+ }
+ while ((*s == ' ') || (*s == ',') || (*s == '='))
+ s++;
+ *end = s;
+ return(count);
+}
+
+
+/* Diagram commands are parsed separately since the format varies from the one
++ used by the other special commands */
+#if NeedFunctionPrototypes
+bool ParseDiagram(char *str)
+#else
+bool ParseDiagram(str)
+char *str;
+#endif
+{
+ diagtrafo dt;
+ char *s,*sh;
+ char diagname[STRSIZE];
+ int results[4],no;
+
+ s = str;
+ while (*s == ' ')
+ s++;
+ if ((StrCompare("drawfile",s,&s)) || (StrCompare("DVIview_diagram",s,&s))) {
+
+ if (printdiag == _FALSE)
+ return(_TRUE); /* it's a diagram, but don't print */
+
+ while ((*s == ' ') || (*s == '='))
+ s++; /* space or '=' separates keyword/keyval */
+
+ if (*s == '\0') {
+ fprintf(ERR_STREAM,"No filename given for \\special-diagram!\n");
+ return(_TRUE);
+ }
+ sh = diagname;
+ while ((*s != ' ') && (*s != ',') && (*s != '\0'))
+ *sh++ = *s++;
+ *sh = '\0';
+
+ /* Set up default values */
+ dt.scalex = dt.scaley = 100;
+ dt.cropl = dt.cropb = dt.cropr = dt.cropt = 0;
+ while (*s != '\0') {
+ while ((*s == ' ') || (*s == ','))
+ s++;
+ if (*s != '\0') {
+ if (StrCompare("scale",s,&s)) {
+ if ((no = ParseNumbers(s,results,2,&s)) != 2) {
+ fprintf(ERR_STREAM,
+ "Too few arguments (%d) given for <scale> - ignored.\n",no);
+ }
+ dt.scalex = results[0];
+ dt.scaley = results[1];
+ }
+ else if (StrCompare("crop",s,&s)) {
+ if ((no = ParseNumbers(s,results,4,&s)) != 4) {
+ fprintf(ERR_STREAM,
+ "Too few arguments (%d) given for <crop> - ignored.\n",no);
+ }
+ dt.cropl = results[0];
+ dt.cropr = results[1];
+ dt.cropt = results[2];
+ dt.cropb = results[3];
+ }
+ else {
+ fprintf(ERR_STREAM,"Bad \\special keyword - <%s> ignored\n",s);
+ /* skip over this word */
+ while ((*s != ' ') && (*s != ',') && (*s != '=') && (*s != '\0'))
+ s++;
+ }
+ }
+ }
+ /* fprintf(ERR_STREAM,"Diagram: %s, scale %d %d, crop %d %d %d %d\n",
+ diagname,dt.scalex,dt.scaley,dt.cropl,dt.cropb,dt.cropr,dt.cropt);*/
+ diagram(diagname,&dt);
+ return(_TRUE);
+ }
+ else
+ return(_FALSE);
+}
+# endif /* LJ */
+#endif /* __riscos */
+
+
+/* interpret a \special command, made up of keyword=value pairs */
+#if NeedFunctionPrototypes
+void DoSpecial(char *str, int n)
+#else
+void DoSpecial(str, n)
+char *str;
+int n;
+#endif
+{
+ char spbuf[STRSIZE], xs[STRSIZE], ys[STRSIZE];
+ char *sf = NULL, *psfile = NULL;
+ float x,y;
+ long4 x_pos, y_pos;
+ KeyWord k;
+ int i, j, j1;
+ static int GrayScale = 10, Pattern = 1;
+ static bool GrayFill = _TRUE;
+ static long4 p_x[80], p_y[80];
+ int llx=0, lly=0, urx=0, ury=0, rwi=0, rhi=0;
+#ifdef WIN32
+ char *gs_path;
+#endif
+
+ str[n] = '\0';
+ spbuf[0] = '\0';
+
+ SetPosn(h, v);
+#ifdef __riscos
+#ifdef LJ
+ if (ParseDiagram(str))
+ return;
+#endif
+#endif
+
+ while ( (str = GetKeyStr(str, &k)) != NULL ) {
+ /* get all keyword-value pairs */
+ /* for compatibility, single words are taken as file names */
+ if ( k.vt == None && access(k.Key, 0) == 0) {
+ if ( sf
+#ifdef KPATHSEA
+ && !kpse_tex_hush ("special")
+#endif
+ )
+ Warning("More than one \\special file name given. %s ignored", sf);
+ (void) strcpy(spbuf, k.Key);
+ sf = spbuf;
+ /*
+ for (j = 1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
+ */
+ } else if ( GetKeyVal( &k, KeyTab, NKEYS, &i ) && i != -1 )
+ switch (i) {
+ case PSFILE:
+ if (sf
+#ifdef KPATHSEA
+ && !kpse_tex_hush ("special")
+#endif
+ )
+ Warning("More than one \\special file name given. %s ignored", sf);
+ (void) strcpy(spbuf, k.Val);
+ psfile = spbuf;
+ /*
+ for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
+ */
+ break;
+
+ case HPFILE:
+ if (sf)
+ Warning("More than one \\special file name given. %s ignored", sf);
+ (void) strcpy(spbuf, k.Val);
+ sf = spbuf;
+ /*
+ for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
+ */
+ break;
+
+ case ORIENTATION:
+#ifdef IBM3812
+ if ((k.v.i >= 0) && (k.v.i < 4)) {
+ last_ry = UNKNOWN;
+ sprintf(PMPformat, "\322%c", (unsigned char)k.v.i);
+ PMPout(2, PMPformat);
+ if (k.v.i == 1) Landscape = _TRUE;
+ else if (k.v.i == 0) Landscape = _FALSE;
+ }
+#endif
+#ifdef LJ
+ if ((k.v.i >= 0) && (k.v.i < 2)) {
+ last_rx = last_ry = UNKNOWN;
+ EMIT2("\033&l%dO\033*rF", (unsigned char)k.v.i);
+ }
+#endif
+ else
+#ifdef KPATHSEA
+ if (!kpse_tex_hush ("special"))
+#endif
+ Warning( "Invalid orientation (%d)given; ignored.", k.v.i);
+ break;
+
+ case RESETPOINTS:
+ (void) strcpy(spbuf, k.Val);
+
+ sf = NULL;
+ break;
+
+ case DEFPOINT:
+ (void) strcpy(spbuf, k.Val);
+ i = sscanf(spbuf,"%d(%[^,],%s)",&j,xs,ys);
+ if (i>0) {
+ x_pos = h;
+ y_pos = v;
+ if (i>1) {
+ if (sscanf(xs,"%fpt",&x)>0) {
+ fprintf(ERR_STREAM,"x = %f\n",x);
+ x_pos = PT_TO_DVI(x);
+ }
+ }
+ if (i>2) {
+ if (sscanf(ys,"%fpt",&y)>0) {
+ fprintf(ERR_STREAM,"y = %f\n",y);
+ y_pos = PT_TO_DVI(y);
+ }
+ }
+ p_x[j]=x_pos;
+ p_y[j]=y_pos;
+ } else
+#ifdef KPATHSEA
+ if (!kpse_tex_hush ("special"))
+#endif
+ Warning("invalid point definition\n");
+
+ sf = NULL;
+ break;
+
+ case FILL:
+ (void) strcpy(spbuf, k.Val);
+ i = sscanf(spbuf,"%d/%d %s",&j,&j1,xs);
+ if (i>1) {
+#ifdef LJ
+ SetPosn(p_x[j], p_y[j]);
+ x_pos = (long4)PIXROUND(p_x[j1]-p_x[j], hconv);
+ y_pos = (long4)PIXROUND(p_y[j1]-p_y[j], vconv);
+ if (labs(x_pos)<labs(y_pos)) x_pos = x_pos+3;
+ else y_pos = y_pos+3;
+ if (GrayFill) {
+ EMIT4("\033*c%lda%ldb%dg2P", x_pos, y_pos, GrayScale);
+ } else {
+ EMIT4("\033*c%lda%ldb%dg3P", x_pos, y_pos, Pattern);
+ }
+ last_rx = last_ry = UNKNOWN;
+#endif
+ }
+ break;
+
+ case GRAY:
+ if ((k.v.i >= 0) && (k.v.i < 101)) {
+ GrayScale = k.v.i;
+ GrayFill = _TRUE;
+ } else
+#ifdef KPATHSEA
+ if (!kpse_tex_hush ("special"))
+#endif
+ Warning( "Invalid gray scale (%d) given; ignored.", k.v.i);
+ break;
+
+ case PATTERN:
+ if ((k.v.i >= 0) && (k.v.i < 7)) {
+ Pattern = k.v.i;
+ GrayFill = _FALSE;
+ } else
+#ifdef KPATHSEA
+ if (!kpse_tex_hush ("special"))
+#endif
+ Warning( "Invalid pattern (%d) given; ignored.", k.v.i);
+ break;
+
+ case LLX: llx = k.v.i; break;
+ case LLY: lly = k.v.i; break;
+ case URX: urx = k.v.i; break;
+ case URY: ury = k.v.i; break;
+ case RWI: rwi = k.v.i; break;
+ case RHI: rhi = k.v.i; break;
+
+ default:
+#ifdef KPATHSEA
+ if (!kpse_tex_hush ("special"))
+#endif
+ Warning("Can't handle %s=%s command; ignored.", k.Key, k.Val);
+ break;
+ }
+
+ else
+#ifdef KPATHSEA
+ if (!kpse_tex_hush ("special"))
+#endif
+ Warning("Invalid keyword or value in \\special - <%s> ignored", k.Key);
+ }
+
+ if ( sf || psfile ) {
+ last_rx = last_ry = UNKNOWN;
+#ifdef IBM3812
+ PMPflush;
+#endif
+ if (sf) {
+ if (i == HPFILE)
+ CopyHPFile( sf );
+ else
+ CopyFile( sf );
+ }
+ else
+#ifdef LJ
+ if (psfile) {
+ /* int height = rwi * (urx - llx) / (ury - lly);*/
+ int width = urx - llx;
+ int height = ury - lly;
+ char cmd[255];
+ int scale_factor = 3000 * width / rwi;
+ int adjusted_height = height * 300/scale_factor;
+ int adjusted_llx = llx * 300/scale_factor;
+ char *printer = "ljetplus"; /* use the most stupid one */
+
+
+ char scale_file_name[255];
+ char *scale_file = tmpnam(scale_file_name);
+ char *pcl_file = tmpnam(NULL);
+ FILEPTR scalef;
+
+ if ( (scalef = BOUTOPEN(scale_file)) == FPNULL ) {
+ Warning("Unable to open file %s for writing", scale_file );
+ return;
+ }
+ fprintf(scalef, "%.2f %.2f scale\n%d %d translate\n",
+ 300.0/scale_factor, 300.0/scale_factor,
+ 0, adjusted_height == height ? 0 : ury);
+ BCLOSE( scalef );
+
+#ifdef WIN32
+ gs_path = getenv("GS_PATH");
+ if (!gs_path)
+ gs_path = "gswin32c.exe";
+ sprintf(cmd,"%s -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s -sOutputFile=%s %s %s showpage.ps -c quit",
+ gs_path, printer, pcl_file, scale_file, psfile);
+#else
+ sprintf(cmd,"gs -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s -sOutputFile=%s %s %s showpage.ps -c quit",
+ printer, pcl_file, scale_file, psfile);
+#endif
+#ifdef DEBUGGS
+ fprintf(stderr,
+ "PS-file '%s' w=%d, h=%d, urx=%d, ury=%d, llx=%d, lly=%d, rwi=%d\n",
+ psfile, urx - llx, height, urx,ury,llx,lly, rwi);
+ fprintf(stderr,"%s\n",cmd);
+#endif
+ if (system(cmd)) {
+ Warning("execution of '%s' returned an error", cmd);
+ } else {
+#ifdef DEBUGGS
+ fprintf(stderr, "o=%d, h=%d, so=%d, sh=%d\n",
+ llx, height, adjusted_llx, adjusted_height);
+
+ fprintf(stderr, "OLD x=%d, y=%d\n",
+ (int)PIXROUND(h, hconv) + x_goffset,
+ (int)PIXROUND(v, vconv) + y_goffset);
+#endif
+ v -= 65536l*adjusted_height; /**300/scale_factor;*/
+ h -= 65536l*adjusted_llx; /* *300/scale_factor;*/
+ SetPosn(h, v);
+#ifdef DEBUGGS
+ fprintf(stderr, "NEW x=%d, y=%d\n",
+ (int)PIXROUND(h, hconv) + x_goffset,
+ (int)PIXROUND(v, vconv) + y_goffset);
+#endif
+
+ CopyHPFile( pcl_file );
+ /* unlink(pcl_file); */
+ /* unlink(scale_file); */
+ }
+ }
+#endif /* LJ */
+ }
+}
+
+
+
+
+/*-->GetKeyStr*/
+/**********************************************************************/
+/***************************** GetKeyStr ****************************/
+/**********************************************************************/
+/* extract first keyword-value pair from string (value part may be null)
+ * return pointer to remainder of string
+ * return NULL if none found
+ */
+char KeyStr[STRSIZE];
+char ValStr[STRSIZE];
+#if NeedFunctionPrototypes
+char *GetKeyStr(char *str, KeyWord *kw )
+#else
+char *GetKeyStr( str, kw )
+char *str;
+KeyWord *kw;
+#endif
+{
+ char *s, *k, *v, t;
+ if ( !str )
+ return( NULL );
+ for (s = str; *s == ' '; s++)
+ ; /* skip over blanks */
+ if (*s == '\0')
+ return( NULL );
+ for (k = KeyStr; /* extract keyword portion */
+ *s != ' ' && *s != '\0' && *s != '=';
+ *k++ = *s++)
+ ;
+ *k = '\0';
+ kw->Key = KeyStr;
+ kw->Val = v = NULL;
+ kw->vt = None;
+ for ( ; *s == ' '; s++)
+ ; /* skip over blanks */
+ if ( *s != '=' ) /* look for "=" */
+ return( s );
+ for (s++; *s == ' '; s++); /* skip over blanks */
+ if ( *s == '\'' || *s == '\"' ) /* get string delimiter */
+ t = *s++;
+ else
+ t = ' ';
+ for (v = ValStr; /* copy value portion up to delim */
+ *s != t && *s != '\0';
+ *v++ = *s++)
+ ;
+ if ( t != ' ' && *s == t )
+ s++;
+ *v = '\0';
+ kw->Val = ValStr;
+ kw->vt = String;
+ return( s );
+}
+
+
+/*-->GetKeyVal*/
+/**********************************************************************/
+/***************************** GetKeyVal ****************************/
+/**********************************************************************/
+/* get next keyword-value pair decode value according to table entry */
+#if NeedFunctionPrototypes
+bool GetKeyVal(KeyWord *kw, KeyDesc tab[], int nt, int *tno)
+#else
+bool GetKeyVal( kw, tab, nt, tno)
+KeyWord *kw;
+KeyDesc tab[];
+int nt;
+int *tno;
+#endif
+{
+ int i;
+ char c = '\0';
+ *tno = -1;
+ for (i = 0; i < nt; i++)
+ if ( IsSame(kw->Key, tab[i].Entry) ) {
+ *tno = i;
+ switch ( tab[i].Typ ) {
+ case None:
+ if ( kw->vt != None )
+ return( _FALSE );
+ break;
+ case String:
+ if ( kw->vt != String )
+ return( _FALSE );
+ break;
+ case Integer:
+ if ( kw->vt != String )
+ return( _FALSE );
+ if ( sscanf(kw->Val, "%d%c", &(kw->v.i), &c) != 1 || c != '\0' )
+ return( _FALSE );
+ break;
+ }
+ kw->vt = tab[i].Typ;
+ return( _TRUE );
+ }
+ return( _TRUE );
+}
+
+
+/*-->IsSame*/
+/**********************************************************************/
+/******************************* IsSame *****************************/
+/**********************************************************************/
+/* compare strings, ignore case */
+#if NeedFunctionPrototypes
+bool IsSame(char *a, char *b)
+#else
+bool IsSame(a, b)
+char *a, *b;
+#endif
+{
+ char *x, *y;
+
+ for (x = a, y = b; *a; a++, b++)
+ if ( tolower(*a) != tolower(*b) )
+ return( _FALSE );
+
+ return( *a == *b ? _TRUE : _FALSE );
+}
+
+
+/*-->FindPostAmblePtr*/
+/**********************************************************************/
+/************************ FindPostAmblePtr **************************/
+/**********************************************************************/
+/* this routine will move to the end of the file and find the start
+ of the postamble */
+#if NeedFunctionPrototypes
+void FindPostAmblePtr(long *postambleptr)
+#else
+void FindPostAmblePtr(postambleptr)
+long *postambleptr;
+#endif
+{
+ long4 i;
+ FSEEK(dvifp, 0l, SEEK_END); /* goto end of file */
+ *postambleptr = FTELL(dvifp) - 4;
+ FSEEK(dvifp, *postambleptr, SEEK_SET);
+ while (_TRUE) {
+ FSEEK(dvifp, --(*postambleptr), SEEK_SET);
+ if (((i = NoSignExtend(dvifp, 1)) != 223) &&
+ (i != DVIFORMAT))
+ Fatal("Bad end of DVI file");
+ if (i == DVIFORMAT)
+ break;
+ }
+ FSEEK(dvifp, (*postambleptr) - 4, SEEK_SET);
+ (*postambleptr) = NoSignExtend(dvifp, 4);
+ FSEEK(dvifp, *postambleptr, SEEK_SET);
+}
+
+
+/*-->ReadPostAmble*/
+/**********************************************************************/
+/************************** ReadPostAmble ***************************/
+/**********************************************************************/
+/***********************************************************************
+ 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.
+***********************************************************************/
+#if NeedFunctionPrototypes
+void ReadPostAmble(bool load)
+#else
+void ReadPostAmble(load)
+bool load;
+#endif
+{
+ FindPostAmblePtr(&postambleptr);
+ if (NoSignExtend(dvifp, 1) != POST)
+ Fatal("POST missing at head of postamble");
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"got POST command\n");
+#endif
+ ppagep = (long)NoSignExtend(dvifp, 4);
+ num = NoSignExtend(dvifp, 4);
+ den = NoSignExtend(dvifp, 4);
+ mag = NoSignExtend(dvifp, 4);
+ if ( usermag > 0 && usermag != mag )
+ Warning("DVI magnification of %ld over-ridden by user (%ld)",
+ (long)mag, usermag );
+ if ( usermag > 0 )
+ mag = usermag;
+ hconv = DoConv(num, den, hconvRESOLUTION);
+ vconv = DoConv(num, den, vconvRESOLUTION);
+ (void) NoSignExtend(dvifp, 4); /* height-plus-depth of tallest page */
+ (void) NoSignExtend(dvifp, 4); /* width of widest page */
+ if (NoSignExtend(dvifp, 2) >= STACK_SIZE)
+ Fatal("Stack size is too small");
+ (void) NoSignExtend(dvifp, 2); /* this reads the number of pages in */
+ /* the DVI file */
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"now reading font defs");
+#endif
+ if (load)
+ GetFontDef();
+}
+
+#ifdef IBM3812
+/*-->PMPLine*/
+/**********************************************************************/
+/***************************** PMPLine ******************************/
+/**********************************************************************/
+/* drawing lines on the 3812 using PMP vector commands */
+#if NeedFunctionPrototypes
+void PMPLine(int w, int y, int x)
+#else
+void PMPLine(w, y, x)
+int w, y, x;
+#endif
+{
+
+ if ((w == 0) || (x == 0 && y == 0))
+ return;
+
+ /*
+ fprintf(ERR_STREAM,"w=%d / %d - %d, y=%d / %d - %d, x=%d / %d - %d\n",
+ w,(char)(w & 0xff),(int)((signed_char)(w & 0xff)),
+ y,(char)(y & 0xff),(int)((signed_char)(y & 0xff)),
+ x,(char)(x & 0xff),(int)((signed_char)(x & 0xff)));
+ */
+
+ if ( (((signed_char)(x & 0xff)) == x ) &&
+ ( ((signed_char)(y & 0xff)) == y ) ) {
+ PMPcont(6);
+ PMPout(1, "\370");
+ EMITWORD(3); /* length of vector */
+ PMPoutC((unsigned char)(0x80 | 0x00 | (unsigned char) w));
+ PMPoutC((signed_char)(y & 0xff));
+ PMPoutC((signed_char)(x & 0xff));
+ /*
+ fprintf(ERR_STREAM,"F8 00 03: w=%d, x=%d(%d-%.2X), y=%d(%d-%.2X),\n",
+ w,x,(char)(x & 0xff),(signed_char)(x & 0xff),
+ y,(char)(y & 0xff),(signed_char)(y & 0xff));
+ */
+
+ } else {
+ PMPcont(8);
+ PMPout(1, "\370");
+ EMITWORD(4 + 1); /* length of vector */
+ PMPoutC((unsigned char)(0xC0 | 0x00 | (unsigned char) w));
+ EMITWORD(y);
+ EMITWORD(x);
+ /*
+ fprintf(ERR_STREAM,"F8 00 05: w=%d, x=%d, y=%d,\n", w,x,y);
+ */
+ }
+}
+
+
+#endif
+/*-->SetRule*/
+/**********************************************************************/
+/***************************** SetRule ******************************/
+/**********************************************************************/
+/* this routine will draw a rule */
+#if NeedFunctionPrototypes
+void SetRule(long4 a, long4 b, int Set)
+#else
+void SetRule(a, b, Set)
+long4 a, b;
+int Set;
+#endif
+{
+ long4 xx, yy;
+#ifdef IBM3812
+ short hor_offset, vert_offset, ll;
+#endif
+ if ( a > 0 && b > 0 ) {
+ SetPosn(h, v); /* lower left corner */
+ xx = (long4)PIXROUND(b, hconv); /* width */
+ yy = (long4)PIXROUND(a, vconv); /* height */
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"Rule xx=%ld, yy=%ld\n", (long)xx, (long)yy);
+#endif
+
+#ifdef IBM3812
+ hor_offset = (short)(last_ry - yy);
+ if (hor_offset < 0) yy += hor_offset;
+ if (last_rx < 0) xx += last_rx;
+
+ if (Landscape) {
+ if (last_ry > MAX_PAGE_WIDTH) yy += MAX_PAGE_WIDTH-last_ry;
+ hor_offset = (short)(MAX_PAGE_HEIGHT - (last_rx + xx));
+ } else {
+ if (last_ry > MAX_PAGE_HEIGHT) yy += MAX_PAGE_HEIGHT-last_ry;
+ hor_offset = (short)(MAX_PAGE_WIDTH - (last_rx + xx));
+ }
+ if (hor_offset < 0) xx += hor_offset;
+
+ if ((xx > 31) && (yy > 31)) {
+ /*
+ * fill area by multiple lines (kind of a mess)
+ * process for simplicity always horizontally
+ */
+
+ /*
+ fprintf(ERR_STREAM,"large box: w=%d,x=%d,y=%d\n",(int)yy,(int)xx,0);
+ */
+
+ hor_offset = HOR_HALF(30);
+ MoveHor(hor_offset);
+ vert_offset = VERT_HALF(30);
+ MoveVert(-vert_offset);
+ ll = (short)xx - 30;
+
+ for (; yy > 30; yy -= 30) {
+ PMPLine(30, 0, ll);
+ MoveHor(-ll);
+ MoveVert(-30);
+ }
+
+ hor_offset = -hor_offset + HOR_HALF(yy);
+ MoveHor(hor_offset);
+ vert_offset = (vert_offset - 30) + VERT_HALF(yy);
+ MoveVert(-vert_offset);
+
+ PMPLine((int)yy, 0, (int)(xx - yy));
+
+ } else if ( (yy < xx) && (xx > 0) ) {
+
+ /* fprintf(ERR_STREAM, "hori rule: w=%d, x=%d, y=%d\n",(int)yy,(int)(xx-yy),0);*/
+
+ hor_offset = HOR_HALF(yy);
+ vert_offset = VERT_HALF(yy);
+
+ MoveHor(hor_offset);
+ MoveVert(-vert_offset);
+
+ PMPLine((int)yy, 0, (int)(xx - yy));
+ } else if ( (xx < yy) && (yy > 0)) {
+
+ hor_offset = HOR_HALF(xx);
+ vert_offset = VERT_HALF(xx);
+ /*
+ fprintf(ERR_STREAM, "move: x=%d, y=%d\n",hor_offset,-vert_offset);
+ fprintf(ERR_STREAM, "vert rule: w=%d, x=%d, y=%d\n",(int)xx,0,(int)-(yy-xx));
+ */
+ MoveHor(hor_offset);
+ MoveVert(-vert_offset);
+
+ PMPLine((int)xx, (int)-(yy - xx), 0);
+ } else if (xx == yy) {
+ short y0; /* small square box!! */
+
+ y0 = (short)yy / 2;
+ hor_offset = HOR_HALF(y0);
+ MoveHor(hor_offset);
+ vert_offset = VERT_HALF(y0);
+ MoveVert(-vert_offset);
+ ll = (short)xx - y0;
+
+ PMPLine((int)y0, 0, ll);
+
+ hor_offset = - (ll + hor_offset);
+ vert_offset = (y0 - vert_offset);
+
+ yy -= (long4)y0;
+ hor_offset += HOR_HALF(yy);
+ MoveHor(hor_offset);
+ vert_offset += VERT_HALF(yy);
+ MoveVert(-vert_offset);
+
+ PMPLine((int)yy, 0, (int)xx - yy);
+ }
+#endif
+#ifdef LJ
+ if (last_ry + 1 < yy) yy = last_ry + 1;
+ if (last_rx < 0) xx += last_rx;
+
+ if ((int)pgsiz_dots > 0 && (int)last_ry > (int)pgsiz_dots)
+ yy += (long4)pgsiz_dots - (long4)last_ry;
+
+ if ((yy>0) && (xx>0))
+ EMIT4("\033*p-%ldY\033*c%lda%ldbP",
+ (long)yy - 1, (long)xx, (long)yy);
+#endif
+ last_rx = last_ry = UNKNOWN; /* next time full positioning */
+ }
+ if (Set)
+ h += b;
+}
+
+
+
+/*-->FormFeed*/
+/**********************************************************************/
+/***************************** FormFeed ******************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+void FormFeed(void)
+#else
+void FormFeed()
+#endif
+{
+
+#ifdef IBM3812
+ unsigned short pages;
+ if ( ndone == 0 && FirstAlternate ){
+ for (pages = 1; pages < ncopies; pages++) {
+ PMPout(2, "\321\300"); /* PMP-command xD1C0 */
+ }
+ PMPout(2, "\321\100"); /* PMP-command xD140 */
+ } else {
+ for (pages = 1; pages < ncopies; pages++){
+ PMPout(2, "\321\200"); /* PMP-command xD180 */
+ }
+ PMPout(2, "\321\0"); /* PMP-command xD100 */
+ }
+#endif
+#ifdef LJ
+ EMITC('\f');
+#endif
+}
+/*------------------------ end dvimisc.c -------------------------------*/
+
+
+
+
+/*------------------------ begin dvifont.c -----------------------------*/
+/*-->GetFontDef*/
+/**********************************************************************/
+/**************************** GetFontDef *****************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+void GetFontDef(void)
+#else
+void GetFontDef()
+#endif
+/***********************************************************************
+ Read the font definitions as they are in the postamble of the DVI
+ file.
+***********************************************************************/
+{
+ unsigned char byte;
+ while (((byte = (unsigned char) NoSignExtend(dvifp, 1)) >= FNT_DEF1) &&
+ (byte <= FNT_DEF4)) {
+ switch (byte) {
+ case FNT_DEF1:
+ ReadFontDef( NoSignExtend(dvifp, 1));
+ break;
+ case FNT_DEF2:
+ ReadFontDef( NoSignExtend(dvifp, 2));
+ break;
+ case FNT_DEF3:
+ ReadFontDef( NoSignExtend(dvifp, 3));
+ break;
+ case FNT_DEF4:
+ ReadFontDef( NoSignExtend(dvifp, 4));
+ break;
+ default:
+ Fatal("Bad byte value in font defs");
+ break;
+ }
+ }
+ if (byte != POST_POST)
+ Fatal("POST_POST missing after fontdefs");
+}
+
+
+
+
+/*-->OpenFontFile*/
+/**********************************************************************/
+/************************** OpenFontFile *****************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+void OpenFontFile(void)
+#else
+void OpenFontFile()
+#endif
+/***********************************************************************
+ 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, pxlfp, 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 MAXOPEN > 1
+
+{
+ int i, least_used, current;
+ struct pixel_list tmp;
+ FILEPTR fid;
+ struct font_entry *fp;
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"open font file %s\n", fontptr->name);
+#endif
+ /*
+ fprintf(ERR_STREAM,"? %lx == %lx\n", pfontptr,fontptr);
+ */
+ if ((pfontptr == fontptr) && (pxlfp != NO_FILE))
+ return; /* we need not have been called */
+
+ if (fontptr->font_file_id == NO_FILE)
+ return; /* we need not have been called */
+
+ tmp = pixel_files[1];
+ current = 1;
+ while (current <= nopen && tmp.pixel_file_id != fontptr->font_file_id) {
+ ++current;
+ tmp = pixel_files[current];
+ }
+ /* try to find file in open list */
+
+ if (current <= nopen) /* file already open */ {
+ if ( pixel_files[current].pixel_file_id != NO_FILE ) {
+ pxlfp = pixel_files[current].pixel_file_id;
+ /* reposition to start of file */
+ FSEEK(pxlfp, 0l, SEEK_SET);
+ }
+ } else {
+ /* file not in open list */
+ 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 (pixel_files[least_used].use_count > pixel_files[i].use_count)
+ least_used = i;
+ if ((fid = pixel_files[least_used].pixel_file_id) != NO_FILE) {
+ /* mark file as being closed in the entry */
+ fp = hfontptr;
+ while (fp != NULL && fp->font_file_id != fid)
+ fp = fp->next;
+ if (fp == NULL)
+ Fatal("Open file %x not found in font entry list.\n", fid);
+ else {
+ fp->font_file_id = FPNULL;
+ }
+ BCLOSE( fid );
+ }
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"\n__reuse slot %d\n", least_used);
+#endif
+ current = least_used;
+ }
+ if ((pxlfp = BINOPEN(fontptr->name)) == FPNULL) {
+ Warning("PXL-file %s could not be opened", fontptr->name);
+ pxlfp = NO_FILE;
+ } else {
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"Opening File <%s> /%p/, Size(font_entry)=%d\n",
+ fontptr->name, pxlfp, sizeof(struct font_entry ));
+#endif
+
+ }
+ pixel_files[current].pixel_file_id = pxlfp;
+ pixel_files[current].use_count = 0;
+ }
+ pfontptr = fontptr; /* make previous = current font */
+ fontptr->font_file_id = pxlfp; /* set file identifier */
+ pixel_files[current].use_count++; /* update reference count */
+#ifndef USEPXL
+ gfin = pxlfp;
+#endif
+}
+
+#else /* ! MAXOPEN > 1 */
+
+{
+ FILEPTR f;
+ struct font_entry *fp;
+
+ if (pfontptr == fontptr && pxlfp != NO_FILE)
+ return; /* we need not have been called */
+ if (fontptr->font_file_id == NO_FILE)
+ return; /* we need not have been called */
+
+ f = pfontptr->font_file_id;
+ if (f != FPNULL) {
+ if (pxlfp != FPNULL) {
+ fp = hfontptr;
+ while ((fp != NULL) && (fp->font_file_id != f))
+ fp = fp->next;
+
+ if (fp == NULL)
+ Fatal("Open file %x not found in font entry list.\n",f);
+ else
+ fp->font_file_id = FPNULL;
+ }
+ BCLOSE(f);
+ }
+ if ((pxlfp = BINOPEN(fontptr->name)) == FPNULL) {
+ Warning("PXL-file %s could not be opened", fontptr->name);
+ pxlfp = NO_FILE;
+ }
+ pfontptr = fontptr;
+ fontptr->font_file_id = pxlfp;
+}
+
+#endif
+
+
+/*-->PixRound*/
+/**********************************************************************/
+/***************************** PixRound *****************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+long4 PixRound(long4 x, long4 conv)
+#else
+long4 PixRound(x, conv) /* return rounded number of pixels */
+long4 x; /* in DVI units */
+long4 conv; /* conversion factor */
+#endif
+{
+ return((x + conv) / conv);
+}
+
+
+#ifdef LJ_RESIDENT_FONTS
+/*-->TryResident*/
+/**********************************************************************/
+/**************************** TryResident ***************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+bool TryResident(struct font_entry *fontptr)
+#else
+bool TryResident(fontptr)
+struct font_entry *fontptr;
+#endif
+{
+ extern bool tfm_read_info();
+ tfm_info_type tfm_info;
+
+ /* To determine if a font is resident, check for a special family
+ value (header bytes 12..16 in the TFM file). This seems cleaner,
+ and certainly more convenient, than somehow reading an external
+ ljfonts.map file in which we'd have to specify information for all
+ the resident fonts. */
+ if (tfm_read_info(fontptr->n, &tfm_info)
+ && tfm_info.family[0]
+ && strcmp((char *)tfm_info.family, "HPAUTOTFM") == 0) {
+ unsigned i;
+ double factor = fontptr->s / (double)0x100000;
+
+ resident_count++;
+ fontptr->resident_p = _TRUE;
+ strcpy(fontptr->symbol_set, (char *)tfm_info.coding_scheme);
+ fontptr->resid = tfm_info.typeface_id;
+ fontptr->spacing = tfm_info.spacing;
+ fontptr->style = tfm_info.style;
+ fontptr->weight = tfm_info.weight;
+
+ if (fontptr->spacing == SPACING_FIXED) {
+ /* Have to select the point in pitch (characters per inch) instead
+ of point size, and thus have to figure out the pitch that
+ corresponds to the point size at which the font is used.
+
+ To do this, take the width of the interword space, and see how
+ many of those characters will fit in the at size. Then convert
+ to how many characters will fit in one inch. That's our pitch.
+
+ All the builtin LJ4 fonts that are monospaced are Intellifont,
+ which have 72.307 points per inch. Not that it really makes any
+ difference. We don't worry about this elsewhere, since all
+ point sizes are rounded to .25pt anyway, which is more than the
+ difference between the various definitions of `point'. */
+ double ds_in_points = fontptr->s / 65536.0;
+ double w_in_points = tfm_info.interword / (double)0x100000;
+ if (ds_in_points == 0 || w_in_points == 0) {
+ /* Avoid division by zero if no interword space. */
+ Warning("%s: Can't determine pitch for this monospaced font.\n",
+ fontptr->n);
+ fontptr->pitch = 10; /* Result will look awful, which is good. */
+ } else {
+ fontptr->pitch = 72.307 / (ds_in_points * w_in_points);
+ }
+ }
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"%6s: typeface=%u\tspacing=%u\tstyle=%u\tweight=%d\n",
+ fontptr->n, fontptr->resid, fontptr->spacing,
+ fontptr->style, fontptr->weight);
+#endif
+ for (i = 0; i < NFNTCHARS; i++) {
+ struct char_entry *cptr = &(fontptr->ch[i]);
+ cptr->tfmw = (long4)(tfm_info.widths[i] * factor);
+ cptr->cw = ((fontptr->ch[i].tfmw) / (double)hconv) + .5;
+ cptr->width =
+ cptr->height =
+ cptr->xOffset =
+ cptr->yOffset =
+ cptr->yyOffset = 0;
+ }
+ return _TRUE;
+ } else {
+ fontptr->resident_p = _FALSE;
+
+ if (tfm_info.family[0]
+ && strcmp((char *)tfm_info.family, "UNSPECIFIED") == 0) {
+ Warning("font family for %s is UNSPECIFIED; need to run dvicopy?",
+ fontptr->n);
+ fontptr->font_file_id = NO_FILE;
+ return _TRUE;
+ } else {
+ return _FALSE;
+ }
+ }
+}
+#endif
+
+
+
+/*-->ReadFontDef*/
+/**********************************************************************/
+/**************************** ReadFontDef ***************************/
+/**********************************************************************/
+
+#if NeedFunctionPrototypes
+unsigned char skip_specials(long4 *pkloc)
+#else
+unsigned char skip_specials(pkloc)
+long4 *pkloc;
+#endif
+{
+ long4 i, j;
+ register unsigned char flag_byte;
+ do {
+ flag_byte = (unsigned char) NoSignExtend(pxlfp, 1);
+ /*
+ fprintf(ERR_STREAM,"flagbyte = %d, pkloc=%ld\n",(int)flag_byte,(long)*pkloc);
+ */
+
+ (*pkloc) ++;
+ if (flag_byte >= 240)
+ switch (flag_byte) {
+ case 240:
+ case 241:
+ case 242:
+ case 243 : {
+ i = 0;
+ for (j = 240; j <= (long4)flag_byte; j++) {
+ i = 256 * i + NoSignExtend(pxlfp, 1);
+ (*pkloc) ++;
+ }
+ for (j = 1; j <= i; j++) {
+ (void) NoSignExtend(pxlfp, 1);
+ (*pkloc) ++;
+ }
+ break;
+ }
+ case 244 : {
+ i = NoSignExtend(pxlfp, 4);
+ (*pkloc) += 4;
+ break;
+ }
+ case 245 :
+ break;
+ case 246 :
+ break;
+ case 247:
+ case 248:
+ case 249:
+ case 250:
+ case 251:
+ case 252:
+ case 253:
+ case 254:
+ case 255: {
+ Fatal("Unexpected flagbyte %d!\n", (int)flag_byte);
+ }
+ }
+ } while (!((flag_byte < 240) || (flag_byte == PK_POST)));
+ return(flag_byte);
+}
+
+
+#if NeedFunctionPrototypes
+void ReadFontDef(long4 k)
+#else
+void ReadFontDef(k)
+long4 k;
+#endif
+{
+ long4 t;
+ unsigned short i;
+ struct font_entry *tfontptr; /* temporary font_entry pointer */
+ struct char_entry *tcharptr; /* temporary char_entry pointer */
+ static int plusid = 0;
+ bool font_found = _FALSE;
+#ifdef LJ_RESIDENT_FONTS
+ bool resident_font_located = _FALSE;
+#endif
+#ifdef LJ
+ int depth, max_depth;
+#endif
+
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM,"Mallocating %d Bytes)...\n", sizeof(struct font_entry ));
+#endif
+
+ if ((tfontptr = NEW(struct font_entry )) == NULL)
+ Fatal("can't malloc space for font_entry");
+
+ allocated_storage += sizeof(struct font_entry );
+
+ tfontptr->next = hfontptr;
+ tfontptr->font_file_id = FPNULL;
+ fontptr = hfontptr = tfontptr;
+ tfontptr->ncdl = 0;
+ tfontptr->k = k;
+ tfontptr->c = NoSignExtend(dvifp, 4); /* checksum */
+ tfontptr->s = NoSignExtend(dvifp, 4); /* space size */
+ tfontptr->d = NoSignExtend(dvifp, 4); /* design size */
+ tfontptr->a = (int)NoSignExtend(dvifp, 1); /* length for font name */
+ tfontptr->l = (int)NoSignExtend(dvifp, 1); /* device length */
+
+#ifdef LJ
+ tfontptr->max_width = tfontptr->max_height = tfontptr->max_yoff =
+ max_depth = 0;
+#endif
+
+ GetBytes(dvifp, tfontptr->n, tfontptr->a + tfontptr->l);
+ tfontptr->n[tfontptr->a+tfontptr->l] = '\0';
+
+ tfontptr->font_mag =
+ (long4)((ActualFactor((long4)(1000.0*tfontptr->s/(double)tfontptr->d+0.5))
+ * ActualFactor(mag)
+#ifdef USEPXL
+ * RESOLUTION * 5.0
+#else
+ * RESOLUTION
+#endif
+ ) + 0.5);
+ /*
+printf("[%ld]=%lf * %lf * %lf + 0.5 = %ld\n",
+ ((long)(1000.0*tfontptr->s/(double)tfontptr->d+0.5)),
+ ActualFactor((long4)(1000.0*tfontptr->s/(double)tfontptr->d+0.5)),
+ ActualFactor(mag),
+ (double)RESOLUTION * 5,
+ (long)tfontptr->font_mag );
+*/
+
+#ifdef LJ_RESIDENT_FONTS
+ /* Pass in the name; fills in resident_p and resid (if resident). */
+
+ resident_font_located = (bool)TryResident(tfontptr);
+
+ if (tfontptr->resident_p)
+ return;
+
+ if (!(resident_font_located)) {
+#endif
+
+#ifdef KPATHSEA
+ {
+ kpse_glyph_file_type font_ret;
+ char *name;
+ unsigned dpi
+ = kpse_magstep_fix ((unsigned) (tfontptr->font_mag / 5.0 + .5),
+ RESOLUTION, NULL);
+ tfontptr->font_mag = dpi * 5; /* save correct dpi */
+
+ name = kpse_find_pk (tfontptr->n, dpi, &font_ret);
+ if (name)
+ {
+ font_found = _TRUE;
+ strcpy (tfontptr->name, name);
+ free (name);
+
+ if (!FILESTRCASEEQ (tfontptr->n, font_ret.name)) {
+ fprintf (stderr,
+ "dvilj: Font %s not found, using %s at %d instead.\n",
+ tfontptr->n, font_ret.name, font_ret.dpi);
+ tfontptr->c = 0; /* no checksum warning */
+ }
+ else if (!kpse_bitmap_tolerance ((double)font_ret.dpi, (double) dpi))
+ fprintf (stderr,
+ "dvilj: Font %s at %d not found, using %d instead.\n",
+ tfontptr->name, dpi, font_ret.dpi);
+ if (G_verbose)
+ fprintf(stderr,"%d: using font <%s>\n", plusid,tfontptr->name);
+ }
+ else
+ {
+ tfontptr->font_file_id = NO_FILE;
+ fprintf (stderr,
+ "dvilj: Font %s at %u not found, characters will be left blank.\n",
+ tfontptr->n, dpi);
+ }
+ }
+#else /* not KPATHSEA */
+ if (!(findfile(PXLpath,
+ tfontptr->n,
+ tfontptr->font_mag,
+ tfontptr->name,
+ _FALSE,
+ 0))) {
+ Warning(tfontptr->name); /* contains error messsage */
+ tfontptr->font_file_id = NO_FILE;
+#ifdef __riscos
+ MakeMetafontFile(PXLpath, tfontptr->n, tfontptr->font_mag);
+#endif
+ }
+ else {
+ font_found = _TRUE;
+ if (G_verbose)
+ fprintf(ERR_STREAM,"%d: using font <%s>\n", plusid, tfontptr->name);
+ }
+#endif /* not KPATHSEA */
+
+#ifdef LJ_RESIDENT_FONTS
+ }
+#endif
+
+ tfontptr->plusid = plusid;
+ plusid++;
+
+ /* sprintf(tfontptr->psname,"%s.%ld.%d",
+ tfontptr->n, (long)tfontptr->font_mag, (long)tfontptr->plusid);*/
+
+#ifdef LJ
+ if (plusid >= HANDLE_MAX_FONTS)
+ Fatal("can handle only %d fonts! ask a wizzard...\n",
+ HANDLE_MAX_FONTS);
+#endif
+ if (tfontptr != pfontptr) {
+ if (font_found)
+ OpenFontFile();
+ else
+ pxlfp = NO_FILE;
+ }
+#ifdef USEPXL
+ if ( pxlfp == NO_FILE ) { /* allow missing pxl files */
+ tfontptr->magnification = 0;
+ tfontptr->designsize = 0;
+#endif
+ for (i = FIRSTFNTCHAR; i <= LASTFNTCHAR; i++) {
+ tcharptr = &(tfontptr->ch[i]);
+#ifdef USEPXL
+ tcharptr->width = 0;
+ tcharptr->height = 0;
+ tcharptr->xOffset = 0;
+ tcharptr->yOffset = 0;
+#endif
+ tcharptr->where.isloaded = _FALSE;
+ tcharptr->where.address.fileOffset = NONEXISTANT;
+ tcharptr->tfmw = 0;
+ }
+#ifdef USEPXL
+ return;
+ }
+ t = NoSignExtend(pxlfp, 1);
+ if (t == 0) {
+ t = NoSignExtend(pxlfp, 1);
+ t = NoSignExtend(pxlfp, 2);
+ if (t == 1002)
+ tfontptr->id = id1002;
+ else if (t == 1001)
+ tfontptr->id = id1001;
+ else
+ Fatal("Unknown Version of PXL-format\n");
+ } else {
+ if (t == PK_PRE) {
+ unsigned char temp_byte;
+ temp_byte = (unsigned char) NoSignExtend(pxlfp, 1);
+ if (temp_byte != PK_ID)
+ Fatal( "Wrong Version of pk file! (%d should be 89)\n",
+ (int)temp_byte);
+ else
+ tfontptr->id = pk89;
+ } else
+ Fatal("unknown font format in file <%s> !\n",fontptr->name);
+ }
+
+ if ((tfontptr->id == id1002) || (tfontptr->id == id1001)) {
+ FSEEK(pxlfp, -20l, SEEK_END);
+
+ t = NoSignExtend(pxlfp, 4);
+ check_checksum (tfontptr->c, t, tfontptr->name);
+
+ tfontptr->magnification = NoSignExtend(pxlfp, 4);
+ tfontptr->designsize = NoSignExtend(pxlfp, 4);
+
+ if (tfontptr->id == id1001)
+ FSEEK(pxlfp, (long)(NoSignExtend(pxlfp, 4) * 4), SEEK_SET);
+ else
+ FSEEK(pxlfp, (long)NoSignExtend(pxlfp, 4), SEEK_SET);
+
+ for (i = FIRSTFNTCHAR; i <= 127; i++) { /* only defined for 7bit*/
+ tcharptr = &(tfontptr->ch[i]);
+ tcharptr->width = (unsigned short) NoSignExtend(pxlfp, 2);
+ tcharptr->height = (unsigned short) NoSignExtend(pxlfp, 2);
+ tcharptr->xOffset = (short) SignExtend(pxlfp, 2);
+ tcharptr->yOffset = (short) SignExtend(pxlfp, 2);
+ tcharptr->where.isloaded = _FALSE;
+ if (tfontptr->id == id1001)
+ tcharptr->where.address.fileOffset = NoSignExtend(pxlfp,4) * 4;
+ else
+ tcharptr->where.address.fileOffset = NoSignExtend(pxlfp,4);
+ tcharptr->tfmw = (long4)
+ ( (double)(NoSignExtend(pxlfp, 4))
+ * (double)tfontptr->s / (double)0x100000 );
+ tcharptr->cw = (long4)(((double)tcharptr->tfmw/(double)hconv) + 0.5);
+
+ if (tcharptr->width > CHAR_WIDTH_LARGE ||
+ tcharptr->height > CHAR_HEIGTH_LARGE )
+ tcharptr->charsize = LARGE_SIZE;
+ else
+ tcharptr->charsize = SMALL_SIZE;
+#ifdef LJ
+#undef max
+# define max(x,y) if ((y)>(x)) x = y
+
+ max(tfontptr->max_width,tcharptr->width);
+ max(tfontptr->max_height,tcharptr->height);
+ if (tcharptr->yOffset > 0 && (int)tfontptr->max_yoff < (int)tcharptr->yOffset)
+ tfontptr->max_yoff = tcharptr->yOffset;
+ if ((depth = tcharptr->height - tcharptr->yOffset)>max_depth)
+ max_depth = depth;
+#endif
+
+ }
+#ifdef LJ
+ tfontptr->max_height = max_depth ? tfontptr->max_yoff+max_depth :
+ tfontptr->max_yoff+1;
+#endif
+ } else { /* PK 89 format */
+ unsigned char temp_byte;
+ register unsigned char flag_byte;
+ long4 hppp, vppp, pkloc, packet_length;
+ int car, ii;
+
+ /* read comment */
+ for ( ii = temp_byte = (unsigned char)NoSignExtend(pxlfp, 1); ii>0; ii--) {
+ flag_byte = (unsigned char) NoSignExtend(pxlfp, 1);
+#ifdef DEBUG
+ if (Debug) fprintf(ERR_STREAM, "%c", flag_byte );
+#endif
+ }
+#ifdef DEBUG
+ if (Debug) fprintf(ERR_STREAM, "\n");
+#endif
+ pkloc = 3 + (int)temp_byte;
+ tfontptr->designsize = NoSignExtend(pxlfp, 4);
+
+ t = NoSignExtend(pxlfp, 4);
+ check_checksum (tfontptr->c, t, tfontptr->name);
+
+ hppp = NoSignExtend(pxlfp, 4);
+ vppp = NoSignExtend(pxlfp, 4);
+ if (hppp != vppp)
+ Warning("aspect ratio is %ld:%ld (should be 1:1)!",
+ (long)hppp, (long)vppp);
+ tfontptr->magnification = (long4)(hppp * 72.27 * 5 / 65536l + 0.5);
+
+ pkloc += 16;
+ flag_byte = skip_specials(&pkloc);
+
+ while (flag_byte != PK_POST) {
+ if ((flag_byte & 7) == 7) {
+ /* fprintf(ERR_STREAM,"\nRead long character preamble\n"); */
+
+ packet_length = (unsigned long4)NoSignExtend(pxlfp,4);
+ if ((car = (int)NoSignExtend(pxlfp, 4)) > (LASTFNTCHAR))
+ Fatal("Bad character (%d) in PK-File\n",(int)car);
+
+ tcharptr = &(tfontptr->ch[car]);
+ tcharptr->where.address.fileOffset = pkloc;
+ /* set pkloc to end_of_packet */
+ pkloc += packet_length + 8;
+
+ tcharptr->tfmw = NoSignExtend(pxlfp, 4);
+ (void) NoSignExtend(pxlfp, 4); /* horesc not used */
+ (void) NoSignExtend(pxlfp, 4); /* not used */
+
+ tcharptr->width = (unsigned short) NoSignExtend(pxlfp, 4);
+ tcharptr->height = (unsigned short) NoSignExtend(pxlfp, 4);
+ tcharptr->xOffset = (short) SignExtend(pxlfp, 4);
+ tcharptr->yOffset = (short) SignExtend(pxlfp, 4);
+ tcharptr->where.isloaded = _FALSE;
+ } else if (flag_byte & 4) {
+ /* fprintf(ERR_STREAM,"Read extended short character preamble\n"); */
+
+ packet_length = ((long4)flag_byte & 3) * 65536l +
+ (unsigned short) NoSignExtend(pxlfp, 2);
+ if ((car = (int)NoSignExtend(pxlfp, 1)) > (LASTFNTCHAR))
+ Fatal("Bad character (%d) in PK-File\n",(int)car);
+
+ tcharptr = &(tfontptr->ch[car]);
+ tcharptr->where.address.fileOffset = pkloc;
+ /* set pkloc to end_of_packet */
+ pkloc += packet_length + 3;
+
+ tcharptr->tfmw = NoSignExtend(pxlfp, 3);
+ /*
+ { register unsigned short t;
+ t = (unsigned short) NoSignExtend(pxlfp, 1);
+ tcharptr->tfmw = t * 65536l +
+ (unsigned short) NoSignExtend(pxlfp, 2);
+ }
+ */
+ /* horesc not used */
+ (void) NoSignExtend(pxlfp, 2);
+ tcharptr->width = (unsigned short) NoSignExtend(pxlfp,2);
+ tcharptr->height = (unsigned short) NoSignExtend(pxlfp,2);
+ tcharptr->xOffset = (short) SignExtend(pxlfp, 2);
+ tcharptr->yOffset = (short) SignExtend(pxlfp, 2);
+ tcharptr->where.isloaded = _FALSE;
+ } else {
+ /* fprintf(ERR_STREAM,"<Read short character preamble@>\n"); */
+
+ packet_length = ((long4)flag_byte & 3) * 256 +
+ NoSignExtend(pxlfp, 1);
+ if ((car = (int)NoSignExtend(pxlfp, 1)) > (LASTFNTCHAR))
+ Fatal("Bad character (%d) in PK-File\n",(int)car);
+
+ tcharptr = &(tfontptr->ch[car]);
+ tcharptr->where.address.fileOffset = pkloc;
+ /* set pkloc to end_of_packet */
+ pkloc += packet_length + 2;
+
+ tcharptr->tfmw = NoSignExtend(pxlfp, 3);
+ /*
+ { register unsigned short t;
+ t = (unsigned short) NoSignExtend(pxlfp, 1);
+ tcharptr->tfmw = t * 65536l +
+ (unsigned short) NoSignExtend(pxlfp, 2);
+ }
+ */
+ /* horesc not used */
+ (void) NoSignExtend(pxlfp, 1);
+ tcharptr->width = (unsigned short) NoSignExtend(pxlfp,1);
+ tcharptr->height = (unsigned short) NoSignExtend(pxlfp,1);
+ tcharptr->xOffset = (short) SignExtend(pxlfp, 1);
+ tcharptr->yOffset = (short) SignExtend(pxlfp, 1);
+ tcharptr->where.isloaded = _FALSE;
+ }
+
+ tcharptr->tfmw = (long4)
+ ( tcharptr->tfmw * (double)tfontptr->s / (double)0x100000 );
+
+ tcharptr->cw = (long4)(((double)tcharptr->tfmw / (double)hconv) + 0.5);
+
+ if (tcharptr->width > CHAR_WIDTH_LARGE ||
+ tcharptr->height > CHAR_HEIGTH_LARGE )
+ tcharptr->charsize = LARGE_SIZE;
+ else
+ tcharptr->charsize = SMALL_SIZE;
+
+#ifdef LJ
+ /*
+ printf("char=%d: this=%d, max_width=%d, this=%d,max_height=%d, this=%d,max_yoff=%d\n",
+ car, tcharptr->width, tfontptr->max_width,
+ tcharptr->height,tfontptr->max_height,
+ tcharptr->yOffset,tfontptr->max_yoff);
+ */
+ max(tfontptr->max_width, tcharptr->width);
+ max(tfontptr->max_height,tcharptr->height);
+ if (tcharptr->yOffset > 0 && (int)tfontptr->max_yoff < (int)tcharptr->yOffset)
+ tfontptr->max_yoff = tcharptr->yOffset;
+
+ if ((depth = tcharptr->height - tcharptr->yOffset) > max_depth)
+ max_depth = depth;
+#endif
+ /*
+ fprintf(ERR_STREAM,"char=%d, yotcharptr=%lx, flag_byte=%d, font=%lx\n",car, tcharptr,flag_byte,tfontptr);
+ */
+ tcharptr->flag_byte = flag_byte;
+ FSEEK(pxlfp, (long)pkloc, SEEK_SET);
+ flag_byte = skip_specials(&pkloc);
+
+ } /* end of while */
+#ifdef LJ
+ tfontptr->max_height = max_depth ? tfontptr->max_yoff+max_depth :
+ tfontptr->max_yoff+1;
+#endif
+
+ /*
+printf("fontid=%d: max_width=%u, max_height=%d, max_yoff=%u\n",
+ tfontptr->plusid, tfontptr->max_width,
+ tfontptr->max_height, tfontptr->max_yoff);
+ */
+
+#else /* USEPXL */
+ if ( pxlfp == NO_FILE ) /* allow missing pxl files */
+ return;
+
+ gfin = pxlfp;
+ seekpost();
+ readpost();
+ check_checksum (tfontptr->c, checksum, tfontptr->name);
+
+ for(i = FIRSTFNTCHAR; i<=LASTFNTCHAR; i++) {
+ if (char_exists[i]) {
+ tcharptr = &(tfontptr->ch[i]);
+ tcharptr->tfmw = (long4)(((float)tfm_wd[i]*(float)tfontptr->s) /
+ (float)((long4)1l<<20));
+ tcharptr->where.address.fileOffset = char_pointer[i];
+ }
+# ifdef LJ
+ /* GF USER PLEASE CHECK IF THIS CODE WORKS
+ tfontptr->max_width = gf_font_max_m;
+ tfontptr->max_height = gf_font_max_n;
+ tfontptr->max_yoff = gf_font_min_n;
+ */
+# endif /* LJ */
+#endif /* USEPXL */
+
+/*****************************************************************************/
+ /*if (tcharptr->charsize==LARGE_SIZE)
+ fprintf(ERR_STREAM,"%d:\t <%c> w=%d h=%d xO=%d yO=%d tfmw=%ld cw=%ld %d\n",
+ i,(char) i,
+ tcharptr->width,tcharptr->height,tcharptr->xOffset,tcharptr->yOffset,
+ (long)tcharptr->tfmw, (long)tcharptr->cw, (int)(tcharptr->charsize));
+ */
+/*****************************************************************************/
+ }
+}
+
+
+
+
+
+/*-->SetFntNum*/
+/**********************************************************************/
+/**************************** SetFntNum *****************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+void SetFntNum(long4 k, bool Emitting)
+#else
+void SetFntNum(k, Emitting)
+long4 k;
+bool Emitting;
+#endif
+/* this routine is used to specify the font to be used in printing future
+ characters */
+{
+#ifdef LJ
+ static unsigned short plusid = 0;
+#endif
+ fontptr = hfontptr;
+ while ((fontptr != NULL) && (fontptr->k != k))
+ fontptr = fontptr->next;
+ if (fontptr == NULL)
+ Fatal("font %ld undefined", (long)k);
+ if (Emitting && fontptr->font_file_id != NO_FILE) {
+ if (!fontptr->used_on_this_page
+#ifdef LJ_RESIDENT_FONTS
+ && !fontptr->resident_p
+#endif
+ ) {
+ fontptr->used_on_this_page = _TRUE;
+#ifdef LJ
+ if (++fonts_used_on_this_page > MAX_FONTS_PER_PAGE) {
+ qfprintf(ERR_STREAM,"%s is font #%d font on this page!",
+ fontptr->n, fonts_used_on_this_page);
+ qfprintf(ERR_STREAM," (max = %d) rastering characters!\n",
+ MAX_FONTS_PER_PAGE);
+ rasterfont[fontptr->plusid] = _TRUE;
+ }
+#endif
+ }
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "Switching to font #%ld (%s).\n", k, fontptr->n);
+#endif
+ /* activate font */
+#ifdef IBM3812
+ sprintf(PMPformat, "\323%c", (unsigned char)fontptr->plusid);
+ PMPout(2, PMPformat);
+#endif
+#ifdef LJ
+ if (!rasterfont[fontptr->plusid]) {
+#ifdef LJ_RESIDENT_FONTS
+ if (fontptr->resident_p) {
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "Resident font #%d.\n", fontptr->resid);
+#endif
+ EMIT2("\033(%s", fontptr->symbol_set);
+ EMIT4("\033(s%up%.2f%c",
+ fontptr->spacing,
+ /* height in points, or pitch */
+ fontptr->spacing ? fontptr->s / 65536.0 : fontptr->pitch,
+ fontptr->spacing ? 'v' : 'h' /* height or pitch? */
+ );
+ EMIT4("%us%db%uT",
+ fontptr->style, /* upright, italic, ... */
+ fontptr->weight, /* regular, bold, ... */
+ fontptr->resid
+ );
+ } else
+#endif /* LJ_RESIDENT_FONTS */
+ if (fontptr->plusid>0) EMIT2("\033(%dX", fontptr->plusid);
+ else EMIT1("\033(X");
+ }
+ /* else fprintf(ERR_STREAM,"I am doing rasterfont for plusid=%d instead\n",
+ fontptr->plusid);
+ */
+#endif
+ }
+#ifdef LJ /* reassignment of printer font id 0.48 */
+ else if (fontptr->font_file_id != NO_FILE
+#ifdef LJ_RESIDENT_FONTS
+ && !fontptr->resident_p
+#endif
+ ) {
+ if (fontptr->ncdl == 0) {
+#ifdef DEBUG
+ if (Debug)
+ fprintf(ERR_STREAM, "Changing plusid from %d to %d\n",
+ fontptr->plusid, (int)plusid);
+#endif
+ fontptr->plusid = plusid;
+ plusid ++;
+ }
+ }
+#endif
+}
+
+
+
+/*-->SkipFontDef*/
+/**********************************************************************/
+/**************************** SkipFontDef ***************************/
+/**********************************************************************/
+#if NeedFunctionPrototypes
+void SkipFontDef(void)
+#else
+void SkipFontDef()
+#endif
+{
+ int a, l;
+ char n[STRSIZE];
+
+ (void) NoSignExtend(dvifp, 4);
+ (void) NoSignExtend(dvifp, 4);
+ (void) NoSignExtend(dvifp, 4);
+ a = (int)NoSignExtend(dvifp, 1);
+ l = (int)NoSignExtend(dvifp, 1);
+ GetBytes(dvifp, n, a + l);
+}
+
+
+
+/*------------------------ end dvifont.c -------------------------------*/
+
+/*-->Fatal*/
+/**********************************************************************/
+/****************************** Fatal *******************************/
+/**********************************************************************/
+void
+#if NeedVarargsPrototypes
+Fatal (char *fmt, ...)
+#else
+Fatal(va_alist) /* issue a fatal error message */
+ va_dcl
+#endif
+{
+#if !NeedVarargsPrototypes
+ const char *fmt;
+#endif
+ va_list args;
+
+#if NeedVarargsPrototypes
+ va_start(args, fmt);
+#else
+ va_start(args);
+ fmt = va_arg(args, const char *);
+#endif
+ fprintf(ERR_STREAM, "\n");
+ fprintf(ERR_STREAM, "%s: FATAL--", G_progname);
+ vfprintf(ERR_STREAM, fmt, args);
+
+ fprintf(ERR_STREAM, "\n\n");
+ va_end(args);
+ CloseFiles();
+#ifndef vms
+ exit(2);
+#else
+ exit(SS$_ABORT);
+#endif
+}
+
+
+
+/*-->Warning*/
+/**********************************************************************/
+/***************************** Warning ******************************/
+/**********************************************************************/
+void /* issue a warning */
+#if NeedVarargsPrototypes
+Warning(char *fmt, ...)
+#else
+Warning(va_alist)
+ va_dcl
+#endif
+{
+#if !NeedVarargsPrototypes
+ const char *fmt;
+#endif
+ va_list args;
+
+#if NeedVarargsPrototypes
+ va_start(args, fmt);
+#else
+ va_start(args);
+ fmt = va_arg(args, const char *);
+#endif
+
+#ifndef vms
+ G_errenc = 1;
+#else
+ G_errenc = (SS$_ABORT | STS$M_INHIB_MSG); /* no message on screen */
+#endif
+ if ( G_nowarn || G_quiet )
+ return;
+
+ fprintf(ERR_STREAM, "%s: warning: ", G_progname);
+ vfprintf(ERR_STREAM, fmt, args);
+ fprintf(ERR_STREAM, "\n");
+ va_end(args);
+}
diff --git a/Build/source/texk/dviljk/dvi2xx.h b/Build/source/texk/dviljk/dvi2xx.h
new file mode 100644
index 00000000000..17ec1eecd30
--- /dev/null
+++ b/Build/source/texk/dviljk/dvi2xx.h
@@ -0,0 +1,739 @@
+/* $Id: dvi2xx.h,v 2.3 1996/05/20 11:05:57 neumann Exp $ */
+#ifndef DVI2XX_H
+#define DVI2XX_H
+/**********************************************************************
+ ************************ Global Definitions ************************
+ **********************************************************************/
+/* #define IBM3812 */
+/* #define LJ */
+/* #define DRAWGLYPH */
+
+#ifdef KPATHSEA
+#include <kpathsea/config.h>
+#include <kpathsea/c-limits.h>
+#include <kpathsea/c-memstr.h>
+#include <kpathsea/magstep.h>
+#include <kpathsea/proginit.h>
+#include <kpathsea/progname.h>
+#include <kpathsea/tex-glyph.h>
+#include <kpathsea/tex-hush.h>
+#include <kpathsea/tex-make.h>
+#include <kpathsea/c-vararg.h>
+#include <c-auto.h>
+#else
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef unix
+#include <limits.h>
+#endif
+#endif
+
+#include <signal.h>
+#include <ctype.h>
+#ifdef vms
+#include <file.h>
+#else
+# ifndef __riscos
+# include <fcntl.h>
+# endif
+#endif
+#ifdef MSC5
+#include <dos.h> /* only for binaryopen on device */
+#endif
+#if defined (unix) && !defined (KPATHSEA)
+#include <limits.h>
+#endif
+
+
+#include "config.h"
+#include "commands.h"
+
+#define DVIFORMAT 2
+#ifndef UNKNOWN
+#define UNKNOWN -1
+#endif
+#define FIRSTFNTCHAR 0
+
+#ifdef __riscos
+# ifdef RISC_USE_OSL
+# define MAXOPEN_OS 16
+# else
+# define MAXOPEN_OS 8 /* don't know if this IS the maximum */
+# endif
+#else
+# ifdef OPEN_MAX /* ... in a friendly unix system */
+# ifndef vms
+# define MAXOPEN_OS (OPEN_MAX - 8)
+# else
+# define MAXOPEN_OS 12 /* OPEN_MAX seems to be 8 on VMS systems */
+# endif
+# else
+# ifdef __DJGPP__
+# if __DJGPP_MINOR__ <= 1
+ /* DJGPP needs few handles free in the first 20, or else child programs
+ (called by MakeTeX... scripts) won't run, since the stub loader
+ cannot open the .exe program. This is because DOS only copies the
+ first 20 handles to the child program. */
+# define MAXOPEN_OS 5
+# else
+ /* DJGPP v2.02 and later works around this. Assume they have at least
+ FILES=30 in their CONFIG.SYS (everybody should). */
+# define MAXOPEN_OS 20
+# endif
+# else
+# define MAXOPEN_OS 12 /* limit on number of open font files */
+# endif
+# endif
+#endif
+
+#ifdef LJ_RESIDENT_FONTS
+/* we have to read tfm files as well */
+#define MAXOPEN (MAXOPEN_OS - 1)
+#else
+#define MAXOPEN MAXOPEN_OS
+#endif
+
+#define NFNTCHARS LASTFNTCHAR+1
+#define STACK_SIZE 100 /* DVI-stack size */
+#define NONEXISTANT -1 /* offset for PXL files not found */
+#ifdef RISC_USE_OSL
+# define NO_FILE (FPNULL-1)
+#else
+# define NO_FILE ((FILE *)-1)
+#endif
+#define NEW(A) ((A *) malloc(sizeof(A)))
+#define EQ(a,b) (strcmp(a,b)==0)
+#define MM_TO_PXL(x) (int)(((x)*RESOLUTION*10)/254)
+#define PT_TO_PXL(x) (int)((long4)((x)*RESOLUTION*100l)/7224)
+#define PT_TO_DVI(x) (long4)((x)*65536l)
+#define BINOPEN(f) BOPENCMD(f,READ_BINARY)
+/* SMALL_SIZE characters are loaded into font storage of the printer */
+/* LARGE_SIZE characters are rastered */
+/* HUGE_SIZE characters are not loaded into the memory of the host */
+#define SMALL_SIZE (unsigned char) 0
+#define LARGE_SIZE (unsigned char) 1
+#define HUGE_SIZE (unsigned char) 2
+#define HUGE_CHAR_PATTERN 32767l
+#define BYTES_PER_PIXEL_LINE 500 /* max number of bytes per pixel line */
+
+
+#define PK_POST 245
+#define PK_PRE 247
+#define PK_ID 89
+
+/* to speedup the program a little: redefinition of PixRound and PutWord */
+/*#define PIXROUND(x,c) ((((double)x+(double)(c>>1))/(double)c)+0.5)*/
+#define PIXROUND(x,c) (((x)+c)/c)
+#define PUTWORD(w) EMITC( ((unsigned char)(w>>8) & 0xff)), EMITC((unsigned char)(w & 0xff))
+/*************************************************************************/
+#ifdef RISC_BUFFER
+# define EMIT emsize = sprintf
+# define EMFLUSH b_wrtmult(outfp,embuf,emsize)
+# define EMTO embuf
+# define EMIT1(a) emsize = sprintf(embuf,a), EMFLUSH
+# define EMIT2(a,b) emsize = sprintf(embuf,a,b), EMFLUSH
+# define EMIT3(a,b,c) emsize = sprintf(embuf,a,b,c), EMFLUSH
+# define EMIT4(a,b,c,d) emsize = sprintf(embuf,a,b,c,d), EMFLUSH
+#else
+# ifdef RISC_USE_OSL
+# define EMIT emsize = sprintf
+# define EMFLUSH write_multi(embuf,1,emsize,outfp)
+# define EMTO embuf
+# define EMIT1(a) emsize = sprintf(embuf,a), EMFLUSH
+# define EMIT2(a,b) emsize = sprintf(embuf,a,b), EMFLUSH
+# define EMIT3(a,b,c) emsize = sprintf(embuf,a,b,c), EMFLUSH
+# define EMIT4(a,b,c,d) emsize = sprintf(embuf,a,b,c,d), EMFLUSH
+# else
+# define EMIT fprintf /* output a formatted string */
+# define EMTO outfp
+# define EMIT1(a) fprintf(outfp,a)
+# define EMIT2(a,b) fprintf(outfp,a,b)
+# define EMIT3(a,b,c) fprintf(outfp,a,b,c)
+# define EMIT4(a,b,c,d) fprintf(outfp,a,b,c,d)
+# endif
+#endif
+#ifndef vms
+# ifdef RISC_BUFFER
+# define EMITB(len,b) b_wrtmult(outfp,b,len) /* output binary data of len*/
+# else
+# define EMITB(len,b) write_multi(b,1,len,outfp)
+# endif
+#else
+ /* VMS doesn't like to use fwrite on a file with fixed record sizes,
+ so use number of putc calls */
+# define EMITB(len,b) for (kk = 0;kk < len; kk++) fputc(*(b+kk),outfp);
+#endif
+#define EMITWORD(w) PUTWORD((w)) /* output a 2 byte word of data */
+
+#define MoveOver(b) h += (long4) b
+#define MoveDown(a) v += (long4) a
+#define qfprintf if (!G_quiet) fprintf
+#define qprintf if (!G_quiet) printf
+#define LARGER(a,b) (((a)>(b)) ? (a) : (b))
+
+#ifdef IBM3812
+#define PRINTER "IBM 3812 pageprinter"
+#define EMITC(c) PMPoutC(c) /* output a single character */
+#define PMPcont(l) PMPout(-1,(char *)l) /* next l bytes continuous */
+#define PMPflush PMPout(0l,"") /* flush PMP-buffer */
+#define EMITL(l,d) PMPout((int)l,d) /* EMIT-logical: via PMP-buffer */
+#define hconvRESOLUTION 240
+#define vconvRESOLUTION 240
+#define CHAR_WIDTH_LARGE 100 /* limit for loading into printer font */
+#define CHAR_HEIGTH_LARGE 127 /* limit for loading into printer font */
+#define OUTBUFSIZE 20000 /* size of output buffer for PMP cmds */
+ /* has to be less max(signed int) */
+#define MAXFONTSTORAGE 130000l /* font storage in the 3812 pageprinter */
+#define EMITFILE_EXTENSION ".pmp" /* default extension of emit file */
+#define XDEFAULTOFF ((int)(0.72*RESOLUTION))/* default x and y offset */
+#define YDEFAULTOFF RESOLUTION
+#define CHARSTRINGMAX 80 /* bufferlength for SetString */
+#define MAX_PAGE_WIDTH 2040
+#define MAX_PAGE_HEIGHT 3360
+/**********************************************************************/
+/************** Positioning for the 3812 ****************************/
+/**********************************************************************/
+#define VERT_HALF(n) ((short)((n+1)>>1)-1)
+#define HOR_HALF(n) ((short)(n>>1))
+#define MoveHor(n) if ((n)!=0) { PMPcont(3); PMPout(1,"\342"); EMITWORD((n)); }
+#define MoveVert(n) if ((n)!=0) { PMPcont(3); PMPout(1,"\343"); EMITWORD((n)); }
+#endif /* IBM 3812 */
+
+#ifdef LJ
+# ifdef LJ4
+# ifdef LJ4L
+# define PRINTER "HP Laserjet 4L"
+# else
+# define PRINTER "HP Laserjet 4"
+# endif
+# else
+# ifdef LJ2P
+# define PRINTER "HP LaserJet IIP"
+# else
+# ifdef LJ2
+# define PRINTER "HP LaserJet 2"
+# else
+# define PRINTER "HP LaserJet"
+# endif
+# endif
+# endif
+
+# ifdef LJ4
+# ifdef LJ4L
+int RESOLUTION = 300;
+char *MFMODE = MFMODE300;
+# else
+int RESOLUTION = 600;
+char *MFMODE = MFMODE600;
+# endif
+# else
+# define RESOLUTION 300
+# endif
+# define hconvRESOLUTION RESOLUTION
+# define vconvRESOLUTION RESOLUTION
+# ifdef LJ2
+/* the printer limit of the LJ2P is actually 16384x16384,
+ * but to exploit it, one would need lots of memory in the printer
+ */
+# define CHAR_WIDTH_LARGE 200 /* limit for loading into printer font */
+# define CHAR_HEIGTH_LARGE 255 /* y_offset reaches the same size! */
+# else /* such as LaserJet+, Laserjet II */
+# define CHAR_WIDTH_LARGE 100 /* limit for loading into printer font */
+# define CHAR_HEIGTH_LARGE 127 /* y_offset reaches the same size! */
+# endif
+# define EMITFILE_EXTENSION ".lj" /* default extension of emit file */
+# ifndef MAX_FONTS_PER_PAGE
+# define MAX_FONTS_PER_PAGE 16 /* maximum number of fonts per page */
+# endif
+# define HANDLE_MAX_FONTS 255 /* max nr of fonts handled (rasterfont) */
+# define FONTS_DOWNLOADABLE 32 /* max nr of fonts that can be downloaded */
+# ifdef SHARP_JX_9500
+# define MAXFONTSTORAGE (200l*1024l) /* standard user memory */
+# else
+# define MAXFONTSTORAGE (395l*1024l) /* standard user memory */
+# endif
+# ifdef RISC_BUFFER
+# define EMITC(c) b_write(outfp,c) /* output a single character */
+# else
+# define EMITC(c) write_byte(outfp,c) /* output a single character */
+# endif
+# define EMITL(l,d) EMITB(l,d) /* EMIT-logical = EMITB */
+
+# define XDEFAULTOFF ((int)(0.72*RESOLUTION))
+# define YDEFAULTOFF RESOLUTION
+#ifdef NEVER
+# define XDEFAULTOFF RESOLUTION /*x default offset on page 1in (LJ2)*/
+# define YDEFAULTOFF RESOLUTION /* y default offset on page 1inch */
+#endif
+# define max(x,y) if ((y)>(x)) x = y
+# ifndef vms
+# define INT_ASCII(b,i) \
+ if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%hd",i)
+# else
+# define INT_ASCII(b,i) \
+ if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%d",i)
+# endif
+#endif
+
+
+#ifndef SEVENBIT
+#define VisChar(c) (unsigned char)(c)
+#endif
+
+#define GetBytes(fp,buf,n) read_multi(buf,1,n,fp) /* used to be a function */
+
+
+/**********************************************************************/
+/*********************** external definitions ***********************/
+/**********************************************************************/
+
+#ifndef WIN32
+#ifndef _AMIGA
+# ifndef unix
+# if NeedFunctionPrototypes
+long access(char *, int); /* all the other ones known under RISC OS */
+# else
+long access();
+# endif
+# ifndef __riscos
+FILEPTR BOPENCMD();
+void exit();
+int fclose();
+int fprintf();
+int fseek();
+/*char *index();*/
+int printf();
+int sscanf();
+int strcmp();
+char *strcpy();
+# ifdef MSC5
+unsigned int strlen();
+# endif
+void free();
+void setbuf();
+# endif
+
+# ifdef MSC5
+int intdos();
+# endif
+# endif
+#endif
+#else /* WIN32 */
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#undef CopyFile
+#define CopyFile LJCopyFile
+#define ResetPrinter LJResetPrinter
+#endif
+
+#ifndef USEPXL
+/* interface to gf.c */
+extern FILEPTR gfin;
+extern int checksum;
+extern long4 tfm_wd[], char_pointer[];
+extern char char_exists[];
+extern int num_cols, num_rows, num_bytes, x_offset, y_offset;
+extern unsigned char bits[];
+extern int gf_font_max_m, gf_font_max_n, gf_font_min_n;
+extern int gettochar();
+extern void readbits();
+extern void readpost();
+extern void seekpost();
+extern int seekchar();
+#endif
+
+/**********************************************************************/
+/********************** Special Data Structures ***********************/
+/**********************************************************************/
+
+typedef enum { None, String, Integer /*, Number, Dimension*/ }
+
+
+ValTyp;
+typedef struct {
+ char *Key; /* the keyword string */
+ char *Val; /* the value string */
+ ValTyp vt; /* the value type */
+ union { /* the decoded value */
+ int i;
+ float n;
+ } v;
+} KeyWord;
+typedef struct {
+ char *Entry;
+ ValTyp Typ;
+} KeyDesc;
+
+/**********************************************************************/
+/*********************** Font Data Structures ***********************/
+/**********************************************************************/
+
+struct char_entry { /* character entry */
+#ifdef USEPXL
+ unsigned short width, height; /* width and height in pixels */
+ short xOffset, yOffset, yyOffset; /* x offset and y offset in pixels*/
+#endif
+ struct {
+ bool isloaded;
+ union {
+ long4 fileOffset;
+ long4 *pixptr;
+ } address;
+ } where;
+ long4 tfmw; /* TFM width */
+ long4 cw; /* character width in pixels */
+ unsigned char flag_byte; /* for PK-files */
+ unsigned char charsize;
+};
+struct font_entry { /* font entry */
+ long4 k, c, s, d;
+ int a, l;
+ char n[STRSIZE]; /* FNT_DEF command parameters */
+ long4 font_mag; /* computed from FNT_DEF s and d parameters */
+ /*char psname[STRSIZE];*/ /* PostScript name of the font */
+ char name[STRSIZE]; /* full name of PXL file */
+ FILEPTR font_file_id; /* file identifier (NO_FILE if none) */
+#ifdef USEPXL
+ long4 magnification; /* magnification read from PXL file */
+ long4 designsize; /* design size read from PXL file */
+#endif
+ struct char_entry ch[NFNTCHARS]; /* character information */
+ struct font_entry *next;
+ unsigned short ncdl; /* #of different chars actually downloaded */
+ unsigned short plusid; /* Font id in Printer */
+ bool used_on_this_page;
+#ifdef LJ_RESIDENT_FONTS
+ bool resident_p; /* is font resident in printer? */
+ char symbol_set[40]; /* symbol set value (resident fonts) */
+ unsigned short resid; /* typeface id (resident fonts) */
+ unsigned spacing; /* 0=monospace, 1=variable (resident fonts) */
+ unsigned style; /* upright/italic/... (resident fonts) */
+ int weight; /* regular/bold/... (resident fonts) */
+ double pitch; /* chars per inch (monospaced resident fonts)*/
+#endif
+ enum PxlId {
+ id1001, id1002, pk89 } id;
+#ifdef LJ
+ unsigned short max_width, max_height, max_yoff;
+#endif
+};
+
+
+struct pixel_list {
+ FILEPTR pixel_file_id; /* file identifier */
+ int use_count; /* count of "opens" */
+};
+
+#ifdef __riscos
+typedef struct {
+ int scalex;
+ int scaley;
+ int cropl;
+ int cropb;
+ int cropr;
+ int cropt;
+} diagtrafo; /* to be passed to diagrams */
+#endif
+
+
+/**********************************************************************/
+/************************* Global Procedures ************************/
+/**********************************************************************/
+/* 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. The names are
+ kept unique in the first 6 characters for portability. */
+
+#if NeedFunctionPrototypes
+# define DVIPROTO(x) x
+#if NeedVarargsPrototypes
+# define DVIELI() (char *fmt, ...)
+#else
+# define DVIELI() ()
+#endif
+#else
+# define DVIPROTO(x) ()
+# define DVIELI() ()
+#endif
+
+double ActualFactor DVIPROTO((long4));
+void AllDone DVIPROTO((bool));
+#ifdef MSC5
+void AssureBinary DVIPROTO((FILEPTR)); /* DOS and Microsoft C dependent !!! */
+#endif
+void CloseFiles DVIPROTO((void));
+void CopyFile DVIPROTO((char *));
+void CopyHPFile DVIPROTO((char *));
+void DecodeArgs DVIPROTO((int, char *[]));
+#ifdef __riscos
+void diagram DVIPROTO((char *, diagtrafo *));
+void *xosfile_set_type DVIPROTO((char *, int));
+void MakeMetafontFile DVIPROTO((char *, char *, int));
+#endif
+void DoBop DVIPROTO((void));
+long4 DoConv DVIPROTO((long4, long4, int));
+void DoSpecial DVIPROTO((char *, int));
+void EmitChar DVIPROTO((long4, struct char_entry *));
+void Fatal DVIELI();
+void FindPostAmblePtr DVIPROTO((long *));
+void FormFeed DVIPROTO((void));
+void GetFontDef DVIPROTO((void));
+char *GetKeyStr DVIPROTO((char *, KeyWord *));
+bool GetKeyVal DVIPROTO((KeyWord *, KeyDesc[], int, int *));
+bool IsSame DVIPROTO((char *, char *));
+void LoadAChar DVIPROTO((long4, register struct char_entry *));
+long4 NoSignExtend DVIPROTO((FILEPTR, int));
+void OpenFontFile DVIPROTO((void));
+long4 PixRound DVIPROTO((long4, long4));
+void PkRaster DVIPROTO((struct char_entry *, int));
+void RasterLine DVIPROTO((struct char_entry *, unsigned int,
+ unsigned int, unsigned char *));
+void RasterChar DVIPROTO((struct char_entry *));
+void ReadFontDef DVIPROTO((long4));
+void ReadPostAmble DVIPROTO((bool));
+void SetChar DVIPROTO((long4, short, int, bool, bool));
+void SetFntNum DVIPROTO((long4, bool));
+void SetPosn DVIPROTO((long4, long4));
+void SetRule DVIPROTO((long4, long4, int));
+void SetString DVIPROTO((short, int));
+long4 SignExtend DVIPROTO((FILEPTR, int));
+void SkipFontDef DVIPROTO((void));
+bool tfm_read_info DVIPROTO((char *, tfm_info_type *));
+void Warning DVIELI();
+unsigned char skip_specials DVIPROTO((long4 *));
+#ifdef LJ4
+int CompressLine2 DVIPROTO((unsigned char *, unsigned char *, int));
+int CompressLine3 DVIPROTO((unsigned char *, unsigned char *, int));
+void CompressedCharLine DVIPROTO((struct char_entry *,int,unsigned char *));
+#endif
+#ifdef IBM3812
+void PMPout DVIPROTO((int, char *));
+void PMPoutC DVIPROTO((char));
+#endif
+
+/* buffer IO */
+char b_read DVIPROTO((FILEPTR));
+#ifdef RISC_BUFFER
+void b_write DVIPROTO((FILEPTR, char));
+void b_wrtmult DVIPROTO((FILEPTR, char *, int));
+void b_oflush DVIPROTO((FILEPTR));
+#endif
+
+
+/**********************************************************************/
+/************************* Global Variables *************************/
+/**********************************************************************/
+bool ManualFeed = _FALSE;
+long4 FirstPage = -1000000; /* first page to print (uses count0) */
+long4 LastPage = 1000000; /* last page to print */
+long4 PrintPages = 1000000; /* nr of pages to print */
+bool FirstPageSpecified = _FALSE;
+bool LastPageSpecified = _FALSE;
+#ifndef KPATHSEA
+char *PXLpath = FONTAREA;
+#endif
+char G_progname[STRSIZE]; /* program name */
+char filename[STRSIZE]; /* DVI file name */
+char rootname[STRSIZE]; /* DVI filename without extension */
+char *HeaderFileName = ""; /* file name & path of Headerfile */
+char *EmitFileName = ""; /* file name & path for output */
+#ifdef IBM3812
+bool FirstAlternate = _FALSE; /* first page from alternate casette ? */
+#endif
+bool Reverse = _FALSE; /* process DVI pages in reverse order? */
+bool Landscape = _FALSE; /* print document in ladscape mode */
+bool ResetPrinter = _TRUE; /* reset printer at the begin of the job */
+bool DoublePage = _FALSE; /* print on both sides of a paper */
+bool PrintSecondPart = _TRUE; /* print First Part when DoublePage */
+bool PrintFirstPart = _TRUE; /* print Second Part when DoublePage */
+bool PrintEmptyPages = _TRUE; /* print Empty pages in DoublePage mode */
+short PageParity = 1;
+#ifdef MAKETEXPK
+#ifdef KPATHSEA
+bool makeTexPK = MAKE_TEX_PK_BY_DEFAULT;
+#else
+bool makeTexPK = _TRUE;
+#endif
+#endif
+
+#ifdef LJ
+bool kyocera_mode = _FALSE; /* bug fixes for Kyocera F-1200 LJ-Emulation */
+bool brother_mode = _FALSE; /* bug fixes for Brother HL-8D LJ-Emulation */
+#ifdef LJ2P
+int DuplexMode = 0;
+#endif
+#ifdef LJ4
+bool econoMode = _FALSE;
+bool LJ6 = _FALSE;
+#endif
+bool PrintTestPage = _FALSE; /* print testpage with pagecounter after job */
+unsigned short pagesize = 0; /* page size value */
+unsigned short pgsiz_dots = 0; /* page size in dots (for rule-clipping)*/
+#endif
+
+
+#ifndef vms
+short G_errenc = 0; /* has an error been encountered? */
+#else
+long4 G_errenc = SS$_NORMAL; /* has an error been encountered? */
+#endif
+bool G_header = _FALSE; /* copy header file to output? */
+bool G_quiet = _FALSE; /* for quiet operation */
+bool G_verbose = _FALSE; /* inform user about pxl-files used */
+bool G_nowarn = _FALSE; /* don't print out warnings */
+short x_origin; /* x-origin in dots */
+short y_origin; /* y-origin in dots */
+short x_goffset; /* global x-offset in dots */
+short y_goffset; /* global y-offset in dots */
+unsigned short ncopies = 1; /* number of copies to print */
+long4 hconv, vconv; /* converts DVI units to pixels */
+long4 den; /* denominator specified in preamble */
+long4 num; /* numerator specified in preamble */
+long4 h; /* current horizontal position */
+long4 hh = 0; /* current h on device */
+long4 v; /* current vertical position */
+long4 vv = 0; /* current v on device */
+long4 mag; /* magnification specified in preamble */
+long usermag = 0; /* user specified magnification */
+int ndone = 0; /* number of pages converted */
+int nopen = 0; /* number of open PXL files */
+#ifdef vms
+int kk; /* loop variable for EMITB */
+#endif
+FILEPTR outfp = FPNULL; /* output file */
+FILEPTR pxlfp; /* PXL file pointer */
+FILEPTR dvifp = FPNULL; /* DVI file pointer */
+struct font_entry *prevfont = NULL; /* font_entry pointer previous font*/
+struct font_entry *fontptr; /* font_entry pointer */
+struct font_entry *hfontptr = NULL; /* font_entry pointer */
+struct font_entry *pfontptr = NULL; /* previous font_entry pointer */
+struct pixel_list pixel_files[MAXOPEN+1]; /* list of open PXL files */
+long postambleptr; /* Pointer to the postamble */
+long ppagep; /* previous page pointer */
+static int last_ry = UNKNOWN; /* last y-position on page */
+static int last_rx = UNKNOWN; /* last x-position on page */
+long4 StartPrintPages; /* notpad for double paged output */
+int WouldPrint = 0;
+bool ZeroPage = _FALSE; /* Document starts with a Zero Page */
+bool EvenPage = _FALSE; /* Document starts with an even Page */
+long4 LastPtobePrinted = 0;
+int G_ncdl = 0;
+
+long allocated_storage = 0; /* size of mallocated storage (statistics) */
+long4 power[32] ;
+long4 gpower[33] ;
+
+unsigned char buffin[BUFFSIZE]; /* Input buffer; always used for Copy[HP]File */
+int binumber=0; /* number of valid bytes in input buffer */
+int biact=0; /* number of next byte to read from input buffer */
+#ifdef RISC_BUFFER
+char buffout[BUFFSIZE]; /* Output buffer; used if RISC_BUFFER defined */
+int boact=0; /* number of next byte to write to output buffer */
+#endif
+
+#ifdef LJ4
+# define DEFAULT_COMPRESS_MODE 3
+# define DEFAULT_COMPRESS_WIDTH 0
+# define COMPRESS_WIDTH0 0
+# define COMPRESS_WIDTH2 72
+# define COMPRESS_WIDTH3 0
+/* Raster chars compression */
+int CompressCharWidth = -1; /* Value to be determined dependent at runtime */
+int CompressCharMode; /* Used only from within RasterChar/Line */
+int UseCompression = DEFAULT_COMPRESS_MODE; /* This performs very well with Characters */
+/* Shared by both compression types */
+unsigned char *PrevLine = NULL; /* Holds last raster line; set at runtime */
+int PrevSize = 0; /* Size of PrevLine */
+/* Downloaded chars compression */
+int CChar_Off, CChar_Last; /* For compressed character downloading */
+bool CompressFontMode = _TRUE; /* Download characters compressed */
+#endif /* LJ4 */
+
+#ifdef RISC_USE_OSL
+char embuf[STRSIZE]; /* Buffer for emitting stuff */
+int emsize; /* Number of bytes written in buffer */
+#else
+# ifdef RISC_BUFFER
+char embuf[STRSIZE];
+int emsize;
+# endif
+#endif
+
+#ifdef __riscos
+#define DIAGDIRSIZE 32
+char diagdir[DIAGDIRSIZE] = "LJdiag"; /* Prefix name of directory for
+ cached printouts */
+bool cachediag = _FALSE; /* cache PDriver's output in document folder */
+bool printdiag = _TRUE; /* printf diagrams */
+FILEPTR metafile = FPNULL; /* Filepointer of file containing
+ metafont directives*/
+
+char MFFileName[STRSIZE];
+int RasterMultipass = 0;
+#endif
+
+#ifdef DEBUG
+int Debug = 0;
+#define DEBUG_START() do { if (Debug) {
+#define DEBUG_END() fflush (stdout); } } while (0)
+#define DEBUG_PRINT(str) \
+ DEBUG_START (); fputs (str, stdout); DEBUG_END ()
+#define DEBUG_PRINT1(str, e1) \
+ DEBUG_START (); printf (str, e1); DEBUG_END ()
+#else
+#define DEBUG_PRINT(str)
+#define DEBUG_PRINT1(str, e1)
+#endif
+
+#ifdef LJ
+int fonts_used_on_this_page = MAX_FONTS_PER_PAGE+1;
+char rasterfont[HANDLE_MAX_FONTS];
+ /* raster if fonts/page>MAX_FONTS_PER_PAGE*/
+#ifdef LJ_RESIDENT_FONTS
+unsigned resident_count = 0;
+#ifndef KPATHSEA
+char *TFMpath = DEFAULT_TFM_PATH;
+#endif
+#endif
+#endif
+
+long used_fontstorage = 0;
+
+#ifdef IBM3812
+char PMPformat[20];
+char CharString[CHARSTRINGMAX];
+unsigned int CharStringPos = 0;
+#define CharStringOut \
+ if (CharStringPos>0) { \
+ PMPcont(CharStringPos+1);\
+ PMPoutC((unsigned char)CharStringPos);\
+ PMPout(CharStringPos, CharString); \
+ CharStringPos=0; }
+#endif
+
+
+/************************timing stuff*********************/
+#ifdef TIMING
+# ifdef BSD_TIME_CALLS
+# ifndef vms
+# include <sys/timeb.h>
+# else
+# include <timeb.h>
+# endif
+struct timeb timebuffer;
+double start_time;
+# else
+# ifdef __riscos
+# include <sys/times.h>
+# else
+# include <sys/time.h>
+struct timeval Tp;
+double start_time;
+# endif
+# endif
+#endif /* TIMING */
+
+
+#endif /* DVI2XX_H */
diff --git a/Build/source/texk/dviljk/dvihp b/Build/source/texk/dviljk/dvihp
new file mode 100755
index 00000000000..6b149517086
--- /dev/null
+++ b/Build/source/texk/dviljk/dvihp
@@ -0,0 +1,130 @@
+#!/bin/sh
+# $Id: dvihp,v 1.3 1996/12/03 19:53:56 karl Exp karl $
+# Run dvicopy, then dvilj[k]. kb@mail.tug.org, 1994. Public domain.
+# Try to accept arguments a la dvips, from Thomas Esser.
+
+: ${DVILJ=dvilj4} # the dvilj variant to run
+: ${SPOOL=lpr} # used to print an LJ file
+: ${TMPDIR=${TEMP-${TMP-/tmp}}} # for the dvicopy output
+
+tmpdir="${TMPDIR}"/dvihp$$
+(umask 077; mkdir "$tmpdir") \
+ || { echo "cannot create directory \`$tmpdir'."; exit 1; }
+
+trap '
+ cd "${TMPDIR}"
+ test -d "$tmpdir" && { rm -f "$tmpdir"/*; rmdir "$tmpdir"; }
+ exit 0
+' 0 1 2 3 6 7 13 15
+
+rcs_revision='$Revision: 1.3 $'
+version=`set - $rcs_revision; echo $2`
+
+usage="Usage: `basename $0` [OPTIONS] [DVIFILE[.dvi]].
+ Translate the given DVIFILE to Hewlett-Packard PCL by calling dvicopy
+ and then \$DVILJ (dvilj4 by default).
+ In the absence of other options, pipe the PCL to \$SPOOL (lpr by default).
+
+ Options are recognized from dvips where possible:
+-A print odd pages
+-B print even pages
+-d # set debug bits to # (see documentation)
+-D # set resolution to #
+-f run as filter
+-l # don't print pages after #
+-m manual feed
+-n # print # pages
+-O #,# set/change paper offset to #,# mm
+-o s output to s instead of spooling
+-p # don't print pages before #
+-Ps pass directly to lpr
+-v verbose operation
+-x # set magnification to #
+
+Other options are passed to the dvilj program.
+
+Email bug reports to tex-k@mail.tug.org."
+
+
+if test $# -eq 0; then
+ echo "`basename $0`: Missing argument(s)." >&2
+ echo "Try \``basename $0` --help' for more information." >&2
+ exit 0
+fi
+
+unset infile opt output
+output_opt=-e
+verbose=false
+
+while test $# -gt 0; do
+ case "$1" in
+ -help|--help) echo "$usage"; exit 0;;
+ -version|--version)
+ echo "`basename $0` (Dviljk 2.6) $version"
+ echo "There is NO warranty. This script is public domain."
+ exit 0;;
+ -A) opt="$opt -D1";; # -A => -D1 (odd pages)
+ -B) opt="$opt -D2";; # -B -> -D2 (even pages)
+ -d) shift; opt="$opt --D$1";; # -d => --D (debug)
+ -d*) opt="$opt `echo $1 | sed s/d/-D/`";;
+ -D) shift; opt="$opt -R$1";; # -D => -R (resolution)
+ -f) infile=; output=-;; # -f (run as filter)
+ -l) shift; opt="$opt -t$1";; # -l => -t (ending page)
+ -l*) opt="$opt `echo $1 | sed s/l/t/`";;
+ -m) opt="$opt -A";; # -m => -A (manual feed)
+ -n) shift; opt="$opt -p$1";; # -n => -p (page count)
+ -n*) opt="$opt `echo $1 | sed s/^-n/-p/`";;
+ -o) if test $# -eq 1; then # -o (output file)
+ # No remaining args, output to foo.lj.
+ output=`basename $infile .dvi`.lj
+ else shift; output="$1"; fi;;
+ -o*) output="`echo $1 | sed 's/^-o//'`";;
+ -O) shift; x=`echo $1 | sed 's/,.*//'` # -O => -x, -y (page offsets)
+ y=`echo $1 | sed 's/.*,//'`; opt="$opt -x$x -y$y";;
+ -O*) temp="`echo $1 | sed 's/^-O//'`"
+ x=`echo $temp | sed 's/,.*//'`
+ y=`echo $temp | sed 's/.*,//'`;
+ opt="$opt -x$x -y$y";;
+ -p) shift; opt="$opt -f$1";; # -p => -f (starting page)
+ -p*) opt="$opt `echo $1 | sed s/p/f/`";;
+ -P) shift; output=; spool_opt="-P$1";; # -Pprinter
+ -P*) output=; spool_opt="$1";;
+ -v) verbose=true; opt="$opt -v";;
+ -x) shift; opt="$opt -m$1";; # -x => -m (magnification)
+ -x*) opt="$opt `echo $1 | sed s/x/m/`";;
+ --) shift; infile="$1"; break;; # -- => end of options
+ -*) opt="$opt $1";; # pass other options through
+ *) infile="$1";;
+ esac
+ shift
+done
+
+# Make sure the filenames are unique on MS-DOS
+vfless_dvi="$tmpdir"/dvi$$.vf
+
+# Expand VF references.
+# If $infile is null, this will read standard input.
+# dvilj can't read from a pipe, so always write to a file.
+$verbose && echo "Running dvicopy $infile >$vfless_dvi" >&2
+if dvicopy $infile >"$vfless_dvi"; then :; else
+ echo "$0: dvicopy $infile failed." >&2
+ exit 1
+fi
+$verbose && ls -l "$vfless_dvi" >&2
+
+if test -z "$output"; then
+ output=- # output to stdout
+ # Doing this pipe means the true exit status might get lost, but it
+ # seems worth it to avoid the temporary file. (Bad enough to have one.)
+ maybe_spool_cmd="| $SPOOL $spool_opt"
+else
+ maybe_spool_cmd=
+fi
+
+# Translate DVI to LJ.
+cmd="$DVILJ $opt $output_opt$output \"$vfless_dvi\" $maybe_spool_cmd"
+$verbose && echo "Running $cmd" >&2
+if eval $cmd; then :; else
+ echo "$0: $DVILJ failed." >&2
+ exit 2
+fi
diff --git a/Build/source/texk/dviljk/dvihp.man b/Build/source/texk/dviljk/dvihp.man
new file mode 100644
index 00000000000..cd88772978a
--- /dev/null
+++ b/Build/source/texk/dviljk/dvihp.man
@@ -0,0 +1,49 @@
+.TH DVIHP 1 "October 30, 1999"
+.\" man page by Jim Van Zandt <jrv@vanzandt.mv.com> -*- nroff -*-
+.SH NAME
+dvihp \- convert a TeX DVI file to Hewlett-Packard PCL
+.SH SYNOPSIS
+\fBdvihp\fP [\fIoptions\fP] \fIdvifile\fP[.dvi]
+.SH DESCRIPTION
+\fBdvihp\fP translates the given \fIdvifile\fP to Hewlett-Packard PCL
+using \fBdvicopy\fP(1) then $DVILJ (dvilj4 by default).
+.P
+In the absence of other options, pipe the PCL to $SPOOL (lpr by default).
+.SH OPTIONS
+Options are recognized from dvips where possible:
+.IP \fB-A\fP
+print odd pages
+.IP \fB-B\fP
+print even pages
+.IP "\fB-d\fP \fIn\fP"
+set debug bits to \fIn\fP (see documentation)
+.IP "\fB-D\fP \fIn\fP"
+set resolution to \fIn\fP
+.IP \fB-f\fP
+run as filter
+.IP "\fB-l\fP \fIn\fP"
+don't print pages after \fIn\fP
+.IP \fB-m\fP
+manual feed
+.IP "\fB-n\fP \fIn\fP"
+print \fIn\fP pages
+.IP "\fB-O\fP \fIa\fP,\fIb\fP"
+set/change paper offset to \fIa\fP,\fIb\fP mm.
+.IP "\fB-o\fP \fIs\fP"
+output to \fIs\fP instead of spooling
+.IP "\fB-p\fP \fIn\fP"
+don't print pages before \fIn\fP.
+.IP \fB-Ps\fP
+pass directly to lpr.
+.IP \fB-v\fP
+verbose operation.
+.IP "\fB-x\fP \fIn\fP"
+set magnification to \fIn\fP.
+.IP \fB--help\fP
+write usage summary.
+.P
+Other options are passed to the dvilj program.
+.SH BUGS
+Email bug reports to tex-k@mail.tug.org.
+.SH SEE ALSO
+\fBdvicopy\fP(1), \fBdvilj4\fP(1).
diff --git a/Build/source/texk/dviljk/dvilj.man b/Build/source/texk/dviljk/dvilj.man
new file mode 100644
index 00000000000..40de4732e83
--- /dev/null
+++ b/Build/source/texk/dviljk/dvilj.man
@@ -0,0 +1,275 @@
+.TH DVILJK 1 "10 June 1996"
+.ad b
+.SH NAME
+dvilj4, dvilj4l, dvilj2p, dvilj \- convert a TeX DVI file to PCL, for HP LaserJet printers
+.SH SYNOPSIS
+\f3dvilj\f1
+[\f3\-\-D\f2number\f1]
+[\f3\-c\f2copies\f1]
+[\f3\-d\f2mode\f1]
+[\f3\-D\f1]
+[\f3\-E\f1]
+[\f3\-e\f2outputfile\f1]
+[\f3\-f\f2frompage\f1]
+[\f3\-g\f1]
+[\f3\-h\f2headerfile\f1]
+[\f3\-l\f1]
+[\f3\-M\f2flag\f1]
+[\f3\-m\f2mag\f1]
+[\f3\-p\f2pages\f1]
+[\f3\-q\f1]
+[\f3\-r\f1]
+[\f3\-t\f2topage\f1]
+[\f3\-s\f2pagesize\f1]
+[\f3\-v\f1]
+[\f3\-V\f2mode\f1]
+[\f3\-w\f1]
+[\f3\-x\f2xoff(mm)\f1]
+[\f3\-y\f2yoff(mm)\f1]
+[\f3\-X\f2xoff(dots)\f1]
+[\f3\-Y\f2yoff(dots)\f1]
+[\f3\-z\f1]
+[\f3\-\f1]
+[\f2filename\f1]
+.SH DESCRIPTION
+Dvilj and siblings convert TeX-output .dvi files into PCL (the
+Hewlett-Packard Printer Control Language) commands suitable for printing
+on a HP LaserJet+, HP LaserJet IIP (using dvilj2p), HP LaserJet 4 (using
+dvilj4), and fully compatible printers.
+.PP
+Dvilj4 also provides support for the builtin Intellifont and TrueType
+fonts; TFM and VF files are provided in the distribution.
+Virtual fonts are not supported directly by Dvilj, so you must run
+.BR dvicopy (1)
+first, or otherwise expand the virtual fonts
+.PP
+All programs are generated from one source file dvi2xx.c.
+They are usually called via a shell script or as a line printer
+filter. One such script, dvihp, is included in the distribution. It
+provides command-line options similar to those of dvips(1).
+.SH OPTIONS
+.TP \w'-Dnumber'u+2n
+\f3--D\f2number\f1
+Debug according to the bits of \f2number\f1; see the Kpathsea manual for
+values. Also turns on general verbosity.
+.TP
+\f3-c\f2number\f1
+print each page \f2number\f1 times (including original)
+.TP
+\f3-d\f2number\f1
+print in duplex mode. The option -d\f21\f1 means long edge binding,
+-d\f22\f1 stands for short edge binding. This option is only
+selectable from \fIdvilj2p\fP, and is known to work on the LaserJet IId,
+LaserJet IIId, and LaserJet 4.
+.TP
+\f3-D\f1[-]
+Double-sided printing - see below; -D\f21\f1 prints odd sides only,
+-D\f22\f1 is for even pages, a trailing \f2-\f1 suppresses printing of
+empty padding pages.
+.TP
+\f3-E\f1
+Switch printer into econo mode (dvilj4 only).
+.TP
+\f3-e\f2outfile\f1
+Send output to \f2outfile\f1 instead of the basename of dvi file
+extended with `.lj'.
+If \f2outfile\f1 is `-' (as in `-e-') the output is directed
+to standard output and can be directly piped into a spooler.
+.TP
+\f3-f\f2pagenum\f1
+Print pages with TeX page numbers greater than or equal to \f2pagenum\f1.
+.TP
+\f3-g\f1
+``go'' mode: do not reset printer at start of job.
+.TP
+\f3-h\f2headerfile\f1
+Copy \f2headerfile\f1 to output before translation of the DVI file.
+Used to send arbitrary commands to the laserprinter.
+.TP
+\f3-l\f1
+print output in landscape mode; supported
+only by dvilj2p and dvilj4.
+.TP
+\f3-M\f2flag\f1
+Do (not) call mktexpk to generate fonts on demand. \f3-M\f21\f1 and
+\f3-M\f1 are equivalent. \f3-M\f20\f1 enables invoking mktexpk. (This
+is the same as dvips.) The default behavior (i.e., if no
+\f3-M\f1 option is given) is chosen at compile-time; as distributed,
+mktexpk is enabled. \f3-M\f1 is only valid if
+dvi2xx was compiled with support for mktexpk.
+.TP
+\f3-m\f2magnification\f1
+Specify the magnification to use. The following are available:
+.br
+\f3-m#\f2usermag\f1 e.g., \f3#900\f1
+.br
+\f3-m0\f1 equivalent to \f3-m#1000\f1
+.br
+\f3-mh\f1 equivalent to \f3-m#1095\f1
+.br
+\f3-m1\f1 equivalent to \f3-m#1200\f1
+.br
+\f3-mq\f1 equivalent to \f3-m#1250\f1
+.br
+\f3-m2\f1 equivalent to \f3-m#1440\f1
+.br
+\f3-m3\f1 equivalent to \f3-m#1728\f1
+.br
+\f3-m4\f1 equivalent to \f3-m#2074\f1
+.br
+\f3-m5\f1 equivalent to \f3-m#2488\f1
+.TP
+\f3-p\f2pagecount\f1
+print \f2pagecount\f1 pages after the starting page.
+.TP
+\f3-q\f1
+Quiet operation: omit final statistics, etc.
+.TP
+\f3-r\f1
+toggle page reversal; by default, pages are reversed.
+.TP
+\f3-s\f2pagesize \f1
+Specify the page size:
+.br
+\f3-s1\f1: executive (7.25in x 10.5in)
+.br
+\f3-s2\f1: letter (8.5in x 11in)
+.br
+\f3-s3\f1: legal (8.5in x 14in)
+.br
+\f3-s26\f1: A4 (210mm x 297mm)
+.br
+\f3-s80\f1: monarch (3.875in x 7.5in)
+.br
+\f3-s81\f1: commercial-10 (4.125in x 9.5in)
+.br
+\f3-s90\f1: international DL (110mm x 220mm)
+.br
+\f3-s91\f1: international C5 (162mm x 229mm)
+.br
+All values are from the LJ II technical reference manual.
+If the -s commandline option is omitted, no clipping is performed
+at the bottom of the page.
+.TP
+\f3-t\f2pagenum\f1
+Print pages with TeX page numbers less than or equal to \f2pagenum\f1.
+.TP
+\f3-v\f1
+Verbose mode: list fonts used, etc.
+.TP
+\f3-V\f2mode\f1
+compatibility mode. Use \f2K\f1 for Kyocera, \f2B\f1 for Brother,
+\f26\f1 for LJ6 printers.
+.TP
+\f3-w\f1
+Omit warnings.
+.TP
+\f3-x\f2offset\f1
+global x-offset in mm on output page
+relative to 1 inch/1 inch origin
+.TP
+\f3-y\f2offset\f1
+global y-offset in mm on output page
+relative to 1 inch/1 inch origin
+.TP
+\f3-X\f2offset\f1
+global x-offset in dots on output page
+(overrides 1 inch/1 inch origin)
+.TP
+\f3-Y\f2offset\f1
+global y-offset in dots on output page
+(overrides 1 inch/1 inch origin)
+.TP
+\f3-z\f1
+print a test page with the page counter at end of job
+.TP
+\f3-\f1
+Take input from standard input (must be seekable), write to standard output.
+.PP
+If no arguments are specified a brief usage message is displayed.
+.SH \especial COMMANDS
+TeX `\especial' commands that are implemented:
+.TP \w'\f3\especial{hpfile=<filename>}\f1'u+2n
+\f3\especial{file=<filename>}\f1
+copy specified file to the printer; either vector- or bitmap-graphics PMP
+commands
+.TP
+\f3\especial{hpfile=<filename>}\f1
+Same as `file'.
+.TP 0
+others:
+There are a few other special commands implented for the LJ-series,
+which should only be used in connection with the distributed style
+files (e.g., graybox.sty). They may change in forthcoming versions.
+.PP
+You can include Encapsulated PostScript (EPS) files in the PCL files output
+by dvilj if you convert them to PCL first. The distribution includes a
+script `epspcl' to do this (using Ghostscript, so your Ghostscript must
+have the necessary LaserJet driver(s) compiled in).
+.SH DOUBLE PAGE PRINTING
+The command line option -D causes the printer to print
+in doublepage mode, that is, roughly speaking, printing first
+the even pages and then the odd pages of a document.
+If -D is used to print both even and odd pages (-D is used
+without the optional \f21\f1 or \f22\f1)
+the following will happen after
+half of the pages is printed:
+\f3LJ:\f1
+the printer stops, shows message "FEED" and switches
+on manual feed led. The printer continues when either
+the printed pages are fed into the manual page feeder,
+or the operator pushes the continue button (after placing first
+the printed pages into the paper tray).
+.PP
+If -D1 was specified only odd pages will be printed, -D2 can be used
+for even pages. A trailing `-' (as in -D-, -D1- or -D2-) supresses
+printing of empty pages which are generated for padding otherwise.
+.PP
+The driver allows the -D option for both print-directions (front-to-back
+or back-to-front printing). It tries to be clever in certain cases:
+when a document has an odd number of pages it inserts in the
+right place an empty page
+when a document starts with page 0 the driver inserts an empty
+page after the 0-page
+when a piece of a document is printed that starts with
+an even page-number it prints this page at the backside
+of the first page to ensure that the odd sides are always
+on the frontside. The 0-page is treated like an odd page.
+.PP
+The doubleside option works for all LJs, not only for the
+new D model with does doubleside-printing (actually, I don't
+know whether it makes much sense on the new LJ II D at all).
+.PP
+Caveat on the doubleside-option: When it is used frequently
+or on very large files, it might become necessary to clean
+the printer much more frequently.
+.PP
+The command line option -pX can be used to abort printing
+after the output of X pages (can lead to strange results together
+with -D). I personally dislike this option. The secure way of
+printing a part of a document is using -f (from) and -t (to).
+.SH ENVIRONMENT
+Dviljk uses the same environment variables and algorithms for finding
+font files as TeX and its friends do. See the documentation for the
+Kpathsea library for details. (Repeating it here is too cumbersome.)
+.PP
+DVILJFONTS, if set, overrides all other font paths.
+.PP
+DVILJMAKEPK, if set, overrides `mktexpk' as the name of the command to
+execute to create a PK file if one isn't found.
+.PP
+The DVILJSIZES variable may be set to indicate which sizes of fonts are
+available. It should consist of a list of numbers separated by colons. If
+the list begins with a colon, the system default sizes are used, as well.
+Sizes are expressed in dots per inch; decimals may be used for ``pxl'' files:
+for example, a 300 dots per inch file magnified by half a step comes out to
+1643 dots per five inches, which should be encoded as 328.6. \fIdvilj\fR
+tries the actual size of the font before trying any of the given sizes.
+.PP
+KPATHSEA_DEBUG: Trace Kpathsea lookups; set to -1 for complete tracing.
+.SH AUTHOR
+Gustaf Neumann, Wirtschaftsuniversitaet Wien
+.br
+neumann@wu-wien.ac.at
+.PP
+dviljk changes by kb@mail.tug.org; email bug reports to tex\-k@mail.tug.org.
diff --git a/Build/source/texk/dviljk/dvilj.rc b/Build/source/texk/dviljk/dvilj.rc
new file mode 100644
index 00000000000..20ef1c7fc4a
--- /dev/null
+++ b/Build/source/texk/dviljk/dvilj.rc
@@ -0,0 +1,32 @@
+/* dvilj.rc: dvilj resources -*- C++ -*-
+
+ Copyright (C) 1996-2003 Fabrice Popineau <fabrice.popineau@supelec.fr>
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; if not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include <texlive-version.h>
+
+#define VER_FILEVERSION TEXLIVE_MAJOR_VERSION,TEXLIVE_MINOR_VERSION,TEXLIVE_BETA_NUMBER,TEXLIVE_ALPHA_NUMBER
+#define VER_FILEVERSION_STR TEXLIVE_PRODUCTVERSION_STR " dvilj(k) 2.6p1"
+
+#define VER_INTERNALNAME_STR "dvi2xx"
+#define VER_ORIGINALFILENAME_STR "dvi2xx.exe"
+
+#define VER_FILEDESCRIPTION_STR "HP LaserJet Driver for DVI Files"
+
+#include <texlive.version>
+
+/* dvips.rc ends here */
diff --git a/Build/source/texk/dviljk/stamp-auto.in b/Build/source/texk/dviljk/stamp-auto.in
new file mode 100644
index 00000000000..da3cc51d518
--- /dev/null
+++ b/Build/source/texk/dviljk/stamp-auto.in
@@ -0,0 +1 @@
+Mo Aug 22 08:28:30 CEST 2005
diff --git a/Build/source/texk/dviljk/tfm.c b/Build/source/texk/dviljk/tfm.c
new file mode 100644
index 00000000000..489340271a3
--- /dev/null
+++ b/Build/source/texk/dviljk/tfm.c
@@ -0,0 +1,288 @@
+/* $Id: tfm.c,v 2.0 1996/05/12 22:25:04 neumann Exp $ */
+/* Read tfm widths resident font support in dvilj. Originally
+ written by kb@cs.umb.edu in early 1994. Public domain. */
+
+#ifdef KPATHSEA
+#include <kpathsea/config.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/lib.h>
+#include <kpathsea/tex-file.h>
+#include <c-auto.h>
+#else
+#include <stdio.h>
+#include <stdlib.h>
+extern char* TFMpath;
+#endif
+
+#include "config.h" /* for STRSIZE and tfm_info_type, at least */
+ /* and for IO-functions (since RISC OS) */
+
+#ifdef NeedVarargsPrototypes
+extern void Fatal(char *, ...);
+#else
+void Fatal();
+#endif
+
+#ifdef vms
+#include <ssdef.h>
+#include <stsdef.h>
+#define getenv vms_getenv
+#endif
+
+#if NeedFunctionPrototypes
+# define DVIPROTO(x) x
+#else
+# define DVIPROTO(x) ()
+#endif
+
+/* Defined in dvi2xx.c. */
+extern long4 NoSignExtend DVIPROTO((FILEPTR, int));
+
+#define TFM_GET_TWO() NoSignExtend (tfm_fp, 2)
+#define TFM_GET_FOUR() NoSignExtend (tfm_fp, 4)
+
+extern bool G_quiet;
+extern void Warning();
+
+/* Read N words (N * 4 bytes) from TFM_FP and return it in *OUTBUF, unless
+ OUTBUF==NULL, in which case throw them away. */
+
+static void
+#if NeedFunctionPrototypes
+tfm_get_n (FILEPTR tfm_fp, unsigned nwords, unsigned char **outbuf)
+#else
+tfm_get_n (tfm_fp, nwords, outbuf)
+ FILE *tfm_fp;
+ unsigned nwords;
+ void **outbuf;
+#endif
+{
+ unsigned n = nwords * 4;
+ void *buf = (void *) malloc (n);
+
+ if (buf == NULL) {BCLOSE(tfm_fp); Fatal("(tfm): out of memory error!\n");}
+ read_multi (buf, 1, n, tfm_fp);
+ if (FEOF(tfm_fp)) {
+ BCLOSE(tfm_fp); Fatal("dvilj(tfm): Could not read %u bytes from TFM file.\n", n);
+ exit (1);
+ }
+
+ /* If OUTBUF is null, free what we just read, else return it. */
+ if (outbuf) {
+ *outbuf = buf;
+ } else {
+ free (buf);
+ }
+}
+
+
+/* Read a string in BCPL format from DATA into STR, and terminate with a
+ null byte. First byte of DATA says how many characters follow.
+ Assume STR is long enough. */
+
+static void
+#if NeedFunctionPrototypes
+get_bcpl (unsigned char *data, unsigned char *str)
+#else
+get_bcpl (data, str)
+unsigned char *data;
+unsigned char *str;
+#endif
+{
+ unsigned length;
+
+ for (length = *(data ++); length; length --) {
+ *(str ++) = *(data ++);
+ }
+ *str = 0;
+}
+
+/* Header word 18:
+ 2 bytes: "KN" for Karl and Norm---this identifies our extensions
+ 1 byte : 1 if proportional, 0 otherwise
+ 1 byte : reserved (to extend the style, if necessary)
+ Header word 19:
+ 2 bytes: PCL style selection number
+ 1 byte : reserved (to extend weight, if necessary)
+ 1 byte : weight (signed, 2's complement, valid -7 to +7)
+ Header word 20:
+ 2 bytes: reserved (to extend typeface id, if necessary)
+ 2 bytes: PCL typeface selection number
+
+ The first (BigEndian) byte of header word #18 is DATA[0].
+ Assume DATA is long enough for everything we might try to read. */
+
+static bool
+#if NeedFunctionPrototypes
+get_pcl_info (unsigned char *data, unsigned *spacing, unsigned *style,
+ int *weight, unsigned *typeface_id)
+#else
+get_pcl_info (data, spacing, style, weight, typeface_id)
+ unsigned char *data;
+ unsigned *spacing;
+ unsigned *style;
+ int *weight;
+ unsigned *typeface_id;
+#endif
+{
+ /* No magic number for our extensions => forget it. */
+ if (data[0] != 'K' && data[1] != 'N')
+ return _FALSE;
+
+ *spacing = data[(0* 4) + 2]; /* Third byte of first word. */
+
+ /* First two bytes of second word. */
+ *style = (data[(1 * 4)] << 8) + data[(1 * 4) + 1];
+
+ /* Last byte of second word, signed two-complement. */
+ *weight = data[(1 * 4) + 3];
+ if (*weight >= 128) *weight -= 256;
+
+ /* Effectively all four bytes of third word. */
+ *typeface_id = (data[(2 * 4) + 0] << 24) + (data[(2 * 4) + 1] << 16)
+ + (data[(2 * 4) + 2] << 8) + (data[(2 * 4) + 3]);
+
+ return _TRUE;
+}
+
+/* If the TFM file NAME exists, set the elements of RET and return true.
+ Otherwise, return false. */
+
+bool
+#if NeedFunctionPrototypes
+tfm_read_info (char *name, tfm_info_type *ret)
+#else
+tfm_read_info (name, ret)
+ char *name;
+ tfm_info_type *ret;
+#endif
+{
+ /* Don't use a structure for this, since then it might occupy more
+ than the exactly four bytes that we need. */
+ unsigned char *char_info;
+ FILEPTR tfm_fp;
+ unsigned char *header_data;
+ unsigned char *width_raw; /* array of 1-byte data */
+ unsigned long4 *width_table; /* array of 4-byte fixes */
+ unsigned i;
+ unsigned lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np;
+#ifdef KPATHSEA
+ char *full_name = kpse_find_tfm (name);
+
+ if (full_name == NULL) {
+ return _FALSE;
+ }
+ tfm_fp = xfopen (full_name, FOPEN_RBIN_MODE);
+#else /* not KPATHSEA */
+ char full_name[STRSIZE];
+ if (findfile(TFMpath, name, 0, full_name, _TRUE, 0)) {
+
+ /* fprintf(ERR_STREAM,"full_name=<%s>\n", full_name);*/
+ tfm_fp = BINOPEN(full_name);
+ if (tfm_fp == FPNULL) {
+ /* this can happen, if the calculation for max number of open
+ * files has to be corrected
+ */
+ fprintf(ERR_STREAM,"Error: file <%s> could not be opened\n", full_name);
+ return _FALSE;
+ }
+ } else {
+ Warning("tfm file %s.tfm not found on path <%s>\n", name, TFMpath);
+ return _FALSE;
+ }
+#endif /* not KPATHSEA */
+
+ (void) TFM_GET_TWO (); /* word length of file */
+ lh = TFM_GET_TWO (); /* words of header data */
+ bc = TFM_GET_TWO (); /* smallest character code */
+ ec = TFM_GET_TWO (); /* largest character code */
+ nw = TFM_GET_TWO (); /* words in width table */
+ nh = TFM_GET_TWO (); /* words in height table */
+ nd = TFM_GET_TWO (); /* words in depth table */
+ ni = TFM_GET_TWO (); /* words in italic correction table */
+ nl = TFM_GET_TWO (); /* words in lig/kern table */
+ nk = TFM_GET_TWO (); /* words in kern table */
+ ne = TFM_GET_TWO (); /* words in extensible char table */
+ np = TFM_GET_TWO (); /* words of font parameter data */
+
+ tfm_get_n (tfm_fp, lh, &header_data);
+ /* Only two headerbyte words are required by the TFM format, so don't
+ insist on all this extra stuff. */
+ if (lh > 2) {
+ get_bcpl (header_data + (2 * 4), ret->coding_scheme);
+ } else {
+ ret->coding_scheme[0] = 0;
+ }
+
+ if (lh > 12) {
+ get_bcpl (header_data + (12 * 4), ret->family);
+ } else {
+ ret->family[0] = 0;
+ }
+
+ /* Sorry for the convoluted logic. The idea is that if the family
+ is HPAUTOTFM, we better have our extensions -- so if we don't
+ have enough header words, or if we don't find what we need in
+ the header words, something's seriously wrong, and we shouldn't
+ claim to have succeeded at reading a good TFM file. */
+
+ if (strcmp ((char *)ret->family, "HPAUTOTFM") == 0
+ && (lh < 20
+ || !get_pcl_info (&(header_data[18 * 4]),
+ &ret->spacing, &ret->style, &ret->weight,
+ &ret->typeface_id))) {
+ BCLOSE (tfm_fp);
+ return _FALSE;
+ }
+
+ /* Initialize our returned array of widths to zero, since the TFM file
+ need not contain info for all character codes. */
+ for (i = 0; i < bc; i++) {
+ ret->widths[i] = 0;
+ }
+ for (i = ec + 1; i < 256; i++) {
+ ret->widths[i] = 0;
+ }
+
+ /* The char_info is one word (four bytes) for each character in the font. */
+ tfm_get_n (tfm_fp, ec - bc + 1, &char_info);
+
+ /* The width table is just nw words. */
+ tfm_get_n (tfm_fp, nw, &width_raw);
+ width_table = (unsigned long4 *) malloc (nw * 4);
+ if (width_table == NULL) {BCLOSE(tfm_fp); Fatal("dvilj(tfm): out of memory!\n");}
+
+ /* But the width table contains four-byte numbers, so have to convert
+ from BigEndian to host order. */
+ for (i = 0; i < nw; i++) {
+ unsigned byte_offset = i * 4;
+ unsigned b1 = width_raw[byte_offset];
+ unsigned b2 = width_raw[byte_offset + 1];
+ unsigned b3 = width_raw[byte_offset + 2];
+ unsigned b4 = width_raw[byte_offset + 3];
+ width_table[i] = (b1 << 24) + (b2 << 16) + (b3 << 8) + b4;
+ }
+
+ /* For each character, retrieve and store the TFM width. */
+ for (i = bc; i <= ec; i++) {
+ unsigned char w_i = char_info[(i - bc) * 4];
+ ret->widths[i] = width_table[w_i];
+ }
+
+ /* Throw away everything up to the second font parameter. (Could just
+ seek, but I don't want to pull in the include files, etc.) */
+ if (np >= 2) {
+ tfm_get_n (tfm_fp, nh + nd + ni + nl + nk + ne + 1, NULL);
+ ret->interword = TFM_GET_FOUR ();
+ } else {
+ ret->interword = 0;
+ }
+
+ free (header_data);
+ free (char_info);
+ free (width_raw);
+ free (width_table);
+
+ BCLOSE (tfm_fp);
+ return _TRUE;
+}
diff --git a/Build/source/texk/dviljk/win32.mak b/Build/source/texk/dviljk/win32.mak
new file mode 100644
index 00000000000..f2db5213216
--- /dev/null
+++ b/Build/source/texk/dviljk/win32.mak
@@ -0,0 +1,95 @@
+################################################################################
+#
+# Makefile : Dviljk
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <02/01/20 23:47:12 popineau>
+#
+################################################################################
+root_srcdir = ..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+version = 2.6
+
+USE_KPATHSEA = 1
+USE_GNUW32 = 1
+
+!include <msvc/common.mak>
+
+DEFS = $(DEFS) -DHAVE_CONFIG_H
+
+common_objects = $(objdir)\tfm.obj
+
+program = dvilj.exe
+objects = $(objdir)\dvilj.obj $(common_objects)
+objects2p = $(objdir)\dvilj2p.obj $(common_objects)
+program2p = dvilj2p.exe
+objects4 = $(objdir)\dvilj4.obj $(common_objects)
+program4 = dvilj4.exe
+objects4l = $(objdir)\dvilj4l.obj $(common_objects)
+program4l = dvilj4l.exe
+program6 = dvilj6.exe
+
+programs = $(objdir)\$(program) $(objdir)\$(program2p) \
+ $(objdir)\$(program4) $(objdir)\$(program4l)
+
+manfiles = dvilj.1
+
+#default: $(program4)
+default: all
+
+all: $(objdir) $(programs)
+
+$(objdir)\$(program): $(objects) $(objdir)\dvilj.res $(kpathsealib)
+ $(link) $(**) $(conlibs)
+$(objdir)\$(program2p): $(objects2p) $(objdir)\dvilj.res $(kpathsealib)
+ $(link) $(**) $(conlibs)
+$(objdir)\$(program4): $(objects4) $(objdir)\dvilj.res $(kpathsealib)
+ $(link) $(**) $(conlibs)
+$(objdir)\$(program4l): $(objects4l) $(objdir)\dvilj.res $(kpathsealib)
+ $(link) $(**) $(conlibs)
+
+$(objdir)\dvilj.obj:
+ $(compile) -DLJ $(srcdir)/dvi2xx.c
+$(objdir)\dvilj2p.obj:
+ $(compile) -DLJ2P $(srcdir)/dvi2xx.c
+$(objdir)\dvilj4.obj:
+ $(compile) -DLJ4 $(srcdir)/dvi2xx.c
+$(objdir)\dvilj4l.obj:
+ $(compile) -DLJ4 -DLJ4L $(srcdir)/dvi2xx.c
+
+$(objdir)\dvilj.obj $(objdir)\dvilj2p.obj $(objdir)\dvilj4.obj $(objdir)\dvilj4l.obj: dvi2xx.c c-auto.h
+
+!include <msvc/config.mak>
+
+!include <msvc/install.mak>
+
+install:: install-exec install-data install-man
+
+install-exec:: $(programs)
+ -$(del) $(bindir)\$(program6) & pushd $(bindir) \
+ & $(lnexe) .\$(program4) $(bindir)\$(program6) & popd
+
+install-data::
+# $(INSTALL_DATA) $(srcdir)\dvilj.man $(mandir)\dvilj.$(manext)
+# cd $(srcdir)\tex && for %%m in (*.sty) do \
+# $(INSTALL_DATA) %%m $(dvilj_latex2e_macrodir)\%%m
+
+# It seems simplest to keep this separate. Use find and cpio instead of
+# just cp -r in case the source hierarchy is cvs- or rcs-ified.
+# install-fonts:
+# xcopy fonts $(texmf)\fonts /s
+# find fonts -name \*.tfm -o -name \*.vf -print | cpio -pld $(texmf)
+
+!include <msvc/clean.mak>
+
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+# Local Variables:
+# mode: Makefile
+# End: