summaryrefslogtreecommitdiff
path: root/Build/source/texk/ps2pkm
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/ps2pkm')
-rw-r--r--Build/source/texk/ps2pkm/CHANGES.type165
-rw-r--r--Build/source/texk/ps2pkm/ChangeLog55
-rw-r--r--Build/source/texk/ps2pkm/INSTALLATION208
-rw-r--r--Build/source/texk/ps2pkm/Makefile.in63
-rw-r--r--Build/source/texk/ps2pkm/README206
-rw-r--r--Build/source/texk/ps2pkm/README.14m35
-rw-r--r--Build/source/texk/ps2pkm/README.type125
-rw-r--r--Build/source/texk/ps2pkm/Xstuff.h42
-rw-r--r--Build/source/texk/ps2pkm/acconfig.h24
-rw-r--r--Build/source/texk/ps2pkm/arith.c419
-rw-r--r--Build/source/texk/ps2pkm/arith.h67
-rw-r--r--Build/source/texk/ps2pkm/basename.c23
-rw-r--r--Build/source/texk/ps2pkm/basics.c34
-rw-r--r--Build/source/texk/ps2pkm/basics.h90
-rw-r--r--Build/source/texk/ps2pkm/blues.h95
-rw-r--r--Build/source/texk/ps2pkm/bstring.c13
-rw-r--r--Build/source/texk/ps2pkm/c-auto.in19
-rw-r--r--Build/source/texk/ps2pkm/cluts.h35
-rwxr-xr-xBuild/source/texk/ps2pkm/configure2039
-rw-r--r--Build/source/texk/ps2pkm/configure.in23
-rw-r--r--Build/source/texk/ps2pkm/curves.c222
-rw-r--r--Build/source/texk/ps2pkm/curves.h40
-rw-r--r--Build/source/texk/ps2pkm/depend.mak1379
-rw-r--r--Build/source/texk/ps2pkm/depend.mk633
-rw-r--r--Build/source/texk/ps2pkm/digit.h64
-rw-r--r--Build/source/texk/ps2pkm/encoding.c356
-rw-r--r--Build/source/texk/ps2pkm/ffilest.h151
-rw-r--r--Build/source/texk/ps2pkm/filenames.c128
-rw-r--r--Build/source/texk/ps2pkm/filenames.h30
-rw-r--r--Build/source/texk/ps2pkm/flisearch.c42
-rw-r--r--Build/source/texk/ps2pkm/font.h107
-rw-r--r--Build/source/texk/ps2pkm/fontfcn.c310
-rw-r--r--Build/source/texk/ps2pkm/fontfcn.h98
-rw-r--r--Build/source/texk/ps2pkm/fontfile.h72
-rw-r--r--Build/source/texk/ps2pkm/fontmisc.h63
-rw-r--r--Build/source/texk/ps2pkm/fonts.h49
-rw-r--r--Build/source/texk/ps2pkm/fontstruct.h224
-rw-r--r--Build/source/texk/ps2pkm/fontxlfd.h48
-rw-r--r--Build/source/texk/ps2pkm/fsmasks.h72
-rw-r--r--Build/source/texk/ps2pkm/hdigit.h94
-rw-r--r--Build/source/texk/ps2pkm/hints.c923
-rw-r--r--Build/source/texk/ps2pkm/hints.h42
-rw-r--r--Build/source/texk/ps2pkm/lines.c187
-rw-r--r--Build/source/texk/ps2pkm/lines.h37
-rw-r--r--Build/source/texk/ps2pkm/mag.168
-rw-r--r--Build/source/texk/ps2pkm/mag.c143
-rw-r--r--Build/source/texk/ps2pkm/objects.c1149
-rw-r--r--Build/source/texk/ps2pkm/objects.h320
-rw-r--r--Build/source/texk/ps2pkm/paths.c1514
-rw-r--r--Build/source/texk/ps2pkm/paths.h199
-rw-r--r--Build/source/texk/ps2pkm/pfb2pfa.119
-rw-r--r--Build/source/texk/ps2pkm/pfb2pfa.c113
-rw-r--r--Build/source/texk/ps2pkm/pictures.h48
-rw-r--r--Build/source/texk/ps2pkm/pk2bm.139
-rw-r--r--Build/source/texk/ps2pkm/pk2bm.c206
-rw-r--r--Build/source/texk/ps2pkm/pkin.c454
-rw-r--r--Build/source/texk/ps2pkm/pkin.h61
-rw-r--r--Build/source/texk/ps2pkm/pkout.c579
-rw-r--r--Build/source/texk/ps2pkm/pkout.h58
-rw-r--r--Build/source/texk/ps2pkm/pktest.c110
-rw-r--r--Build/source/texk/ps2pkm/protos.h402
-rw-r--r--Build/source/texk/ps2pkm/ps2pk.1156
-rw-r--r--Build/source/texk/ps2pkm/ps2pk.c710
-rw-r--r--Build/source/texk/ps2pkm/ps2pk.rc36
-rw-r--r--Build/source/texk/ps2pkm/psearch.c557
-rw-r--r--Build/source/texk/ps2pkm/psearch.h115
-rw-r--r--Build/source/texk/ps2pkm/regions.c1765
-rw-r--r--Build/source/texk/ps2pkm/regions.h209
-rw-r--r--Build/source/texk/ps2pkm/scanfont.c1506
-rw-r--r--Build/source/texk/ps2pkm/sexpr.c25
-rw-r--r--Build/source/texk/ps2pkm/spaces.c1001
-rw-r--r--Build/source/texk/ps2pkm/spaces.h142
-rw-r--r--Build/source/texk/ps2pkm/stamp-auto.in1
-rw-r--r--Build/source/texk/ps2pkm/strexpr.c292
-rw-r--r--Build/source/texk/ps2pkm/strexpr.h13
-rw-r--r--Build/source/texk/ps2pkm/strokes.h38
-rw-r--r--Build/source/texk/ps2pkm/t1funcs.c560
-rw-r--r--Build/source/texk/ps2pkm/t1hdigit.h40
-rw-r--r--Build/source/texk/ps2pkm/t1imager.h152
-rw-r--r--Build/source/texk/ps2pkm/t1info.c414
-rw-r--r--Build/source/texk/ps2pkm/t1intf.h36
-rw-r--r--Build/source/texk/ps2pkm/t1io.c290
-rw-r--r--Build/source/texk/ps2pkm/t1snap.c79
-rw-r--r--Build/source/texk/ps2pkm/t1stdio.h108
-rw-r--r--Build/source/texk/ps2pkm/t1stub.c46
-rw-r--r--Build/source/texk/ps2pkm/t1test.c529
-rw-r--r--Build/source/texk/ps2pkm/texfiles.c26
-rw-r--r--Build/source/texk/ps2pkm/texfiles.h29
-rw-r--r--Build/source/texk/ps2pkm/token.c1208
-rw-r--r--Build/source/texk/ps2pkm/token.h77
-rw-r--r--Build/source/texk/ps2pkm/tokst.h508
-rw-r--r--Build/source/texk/ps2pkm/trig.h33
-rw-r--r--Build/source/texk/ps2pkm/type1.c1826
-rw-r--r--Build/source/texk/ps2pkm/types.h40
-rw-r--r--Build/source/texk/ps2pkm/usenet64
-rw-r--r--Build/source/texk/ps2pkm/util.c211
-rw-r--r--Build/source/texk/ps2pkm/util.h184
-rw-r--r--Build/source/texk/ps2pkm/win32.mak68
98 files changed, 27527 insertions, 0 deletions
diff --git a/Build/source/texk/ps2pkm/CHANGES.type1 b/Build/source/texk/ps2pkm/CHANGES.type1
new file mode 100644
index 00000000000..107a1e8100d
--- /dev/null
+++ b/Build/source/texk/ps2pkm/CHANGES.type1
@@ -0,0 +1,65 @@
+This are the sources as I have found them on the X11R5 distribution. In
+order to use them for my purpose (ps2pk: conversion tool for Type1 fonts to
+packed TeX fonts) a number of changes were needed (see Changelog).
+
+--Piet
+
+internet: rcpt@urc.tue.nl | Piet Tutelaers
+bitnet: rcpt@heitue5.BITNET | Computer Center Room RC 1.90
+phone: +31 (0)40 474541 | Eindhoven University of Technology
+fax: +31 (0)40 434438 | P.O. Box 513, 5600 MB Eindhoven, NL
+
+Changelog (the main-line):
+--------------------------
+92-02: Start of ps2pk project
+ - decoupling Type1 library from X11 (changes in t1intf.h + t1funcs.h;
+ added Xstuff.h to replace X header files)
+ - user definable encoding schemes (removed hardwired ISOLatin1 and
+ Symbol encodings from t1funcs.c and replaced by encoding paramater
+ in Type1OpenScalable)
+92-03: First release 1.0 (pre-release)
+92-04: - added expansion and slanting features as suggested by Lee
+ Hetherington (changes in spaces.c, t1funcs.c)
+ - changed t1test.c in order to test above features; added ISOLatin1
+ encoding vector.
+ - README2 replaced by CHANGES (this file)
+ - MSDOS concession (thanks to Sebastian Rahtz): renamed
+ fontfilest.h to ffilest.h so it does not clash with fontfile.h
+ (affects: fontfilest.h (->ffilest.h), t1funcs.c, t1info.c and
+ t1test.c).
+ - MSDOS concession: all file extensions .c.orig and .h.orig renamed
+ to .crg respectivally .hrg
+ - patch to handle /negationslash and /mapsto from LucidaMath-Symbol
+ correctly in t1funcs.c (ILH: Lee Hetherington).
+92-05: AMIGA/Aztec:
+ - added type1.ami (contains order of objects in library)
+ - added Makefile.ami
+ - added bstring.c (contains a bzero())
+92-05: - fixed a reference to a NULL pointer in t1info.c
+ - more verbose error messages in type1 library (NDW: Norman Walsh)
+ - changed memory heuristic in type1 library from static (one chunk)
+ into dynamic (up to a maximum of 10 chunks). This was needed for
+ big fonts like daysrib.pfa (reported by Norman Walsh).
+ (Changes in t1funcs.c and t1malloc.c)
+ - added Makefile.tcc for MSDOS/Turbo C, removed Makefile.dos
+92-06: - added Makefile.djg for MSDOS/GCC 386 (djgpp)
+ - fixed bug in t1io.c so MSDOS can read its own .pfb format
+92-08: - fixed alligment problem for machines with wordlength other than 32
+ bits (patch in util.c). Reported by J"urgen Marenda
+ <marenda@ford.uni-koblenz.de> for DataGeneral AViiON (Motorola
+ M88k machine)
+ - The type1 library did not render Oblique fonts correctly.
+ Erik Schenk <schenk@cpsc.ucalgary.ca> provided a patch for
+ this problem (patches in fontfcn.c and t1util.c).
+ - Official X11.5 patches (Stephen Gildea 920728) merged in the type1
+ library version of ps2pk. These patches were available on:
+ export.lcs.mit.edu:/pub/R5/contrib-fixes/Type1.patch
+ - portability: index() in t1info.c replaced by strchr()
+94-01: Version 1.4 (bug fix release)
+ - types.h: added basic type definitions for non 32-bit platforms
+ - fontfcn.c: made `virtual memory' management dynamically
+ (reported by Norman Walsh, needed for complicated fonts)
+ - Makefile.*: improved
+ - original X11R5 sources no longer included (see X11R5 sources if
+ you want to see them)
+ - t1malloc.c removed, not longer needed.
diff --git a/Build/source/texk/ps2pkm/ChangeLog b/Build/source/texk/ps2pkm/ChangeLog
new file mode 100644
index 00000000000..d16de84169c
--- /dev/null
+++ b/Build/source/texk/ps2pkm/ChangeLog
@@ -0,0 +1,55 @@
+Fri Mar 13 13:41:39 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * bstring.c: more fixes from Thomas Esser in this and configure
+ setup
+
+Mon Mar 9 10:33:30 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * fixes as suggested by Melissa O'Neill <oneill@cs.sfu.ca> (from
+ Thomas Esser), for memset in bstring.c (addition to configure)
+
+Tue Feb 24 11:55:33 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * objects.[ch]: extra #ifdef KPATHSEA inside WIN32
+
+Mon Feb 16 12:36:45 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * more fixes to regions.c (Thomas Esser)
+
+Tue Feb 3 13:40:36 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * regions.c: rationalized non STDC declarations
+
+Wed Jan 28 09:44:45 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * better undef of BITS in curves.c; change in objects.h (ifdef
+ KPATHSEA instead of just WIN32) from Fabrice Popineau
+
+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
+
+Tue Jan 27 13:48:14 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * patch to regions.h from Peter B
+
+Tue Jan 20 10:14:10 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * added check of function prototypes to c-auto.in
+
+Mon Jan 19 20:46:08 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * pkin.c: "remainder" clashed with some builtin, so
+ renamed to remainderPK throughout
+
+Thu Jan 1 11:08:37 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ Fixes by Peter Breitenlohner <peb@mppmu.mpg.de>
+ * curves.c: BITS redefined
+ * regions.h: incompatible pointer types
+ * types.h: AA redefined
+ * t1stub.c: struct declared inside parameter list
+
+
+
diff --git a/Build/source/texk/ps2pkm/INSTALLATION b/Build/source/texk/ps2pkm/INSTALLATION
new file mode 100644
index 00000000000..ebfbc1d5210
--- /dev/null
+++ b/Build/source/texk/ps2pkm/INSTALLATION
@@ -0,0 +1,208 @@
+
+ PS2PK installation summary
+ --------------------------
+ (March 1995)
+
+For the version which works with Karl Berry's path searching,
+run configure in this directory and use the Makefile which is
+generated. Otherwise follow the instructions below
+There needs to be a fully configured kpathsea directory
+at the same level as this.
+
+Special versions of MakeTeXPK and texmf.cnf are provided
+These are needed for the proper running of this version
+of ps2pk.
+
+ (January 1994)
+
+The ./src directory contains the sources to build the following programs:
+ - ps2pk a program to build PK fonts from PostScript type1 fonts
+ - pk2bm a program that allows to look at a PK character.
+
+To install and use these programs follow next steps:
+ 1) - Go to the ./src directory.
+
+ Select a Makefile.xxx
+ System xxx
+ ------------------------------------------------------------
+ UNIX unx A universal UNIX makefile using gcc.
+ This makefile is tailored to BSD like UNIX-es. On
+ SYS5 UNIX systems some small changes may be
+ necessary.
+
+ MSDOS bcc Borland C 3.1. The programs compile but ps2pk.exe
+ does not run (program does not fit in 640k!).
+
+ djg Delorie's port of gcc. The programs compile and run
+ on 386 compatible machines only. Ready compiled
+ versions are available that run on MSDOS or
+ MSWindows (386 with or without a coprocessor needed).
+
+ emx Eberhardt Mattes port of GCC with an extender that
+ can be used on MSDOS and OS2. Only 386.
+
+ wat For the Watcom/386 compiler.
+
+ Copy the selected Makefile.xxx to Makefile.
+
+ Edit the Makefile to adapt the T1INPUTS path and the bin and man
+ directories.
+
+ - Do a `make'. This will create the tools above.
+ The master Makefile calls the appropriate Makefile in the ./type1
+ directory to install a type1 library. If your compiler has problems
+ in compiling this library you possibly have to adapt that
+ makefile to your needs.
+
+ - Do a `make install'.
+ This will install the above programs.
+
+ - Do a `make install.man'.
+ This will install manual pages for the above programs.
+
+ 2) Testing ps2pk from ./src directory.
+ The directory ../Utopia contains the Utopia-Regular font donated by
+ Adobe. To make from this type1 font a PKfile next steps are needed:
+ setenv T1INPUTS ../Utopia (C-shell)
+ ps2pk -v -X300 Utopia-Regular.pfa (long)
+ or: ps2pk -v Utopia-Regular.pfa (short using defaults)
+
+ This will create the Utopia-Regular10.300pk font with the default
+ AdobeStandard characters derived from ../Utopia/Utopia-Regular.afm.
+ (The -v flag will show what the program is doing and which character
+ codes are generated.)
+
+ To see how for example the `Q' is rendered by ps2pk (using the IBM
+ type1 rendering software) you can use:
+ pk2bm -bcQ Utopia-Regular10.300pk
+
+ MSDOS has problems with such long names as Utopia-Regular10.300pk. That
+ is the reason that dvips uses abreviations for the PostScript names. The
+ short name for TeX's virtual font needed to use Utopia-Regular is `putr'.
+ The short name for its raw counterpart is `rputr'. To generate rputr.pk
+ the equivalent of Utopia-Regular10.300pk in directory 300dpi you have to
+ use (on MSDOS):
+ ps2pk -v Utopia-Regular 300dpi\rputr.pk
+
+ Ps2pk has some extra options. All options are explained in the manual page
+ (man/ps2pk.1). Here are the most important:
+ -X<xres> the desired X-resolution (ex: 300, 329, 360, 432, etc)
+ -E<expansion> the factor to expand a font
+ -S<slant> to get a slanted font.
+
+ 3) Using the ps2pk rendered fonts with xdvi.
+ The main reason why ps2pk is written is to use the PK fonts for
+ previewing a (La)TeX document that uses PostScript fonts. But some
+ people use the PKfonts instead of the original type1 fonts that are
+ available in the printer because they consume less virtual memory
+ or because the printing goes faster.
+
+ To use putr the TeX version of Utopia-Regular in xdvi you will need:
+ - the latest version of xdvi (supporting virtual fonts)
+ - putr.tfm and putr.vf (the virtual TeX-face of Utopia-Regular)
+ - rputr.tfm and rputr.300pk (the raw TeX-face of Utopia-Regular)
+ - testfont.tex (a plain TeX source to test the font).
+
+ We have explained how to make rputr.300pk from Utopia-Regular. How do
+ we generate rputr.tfm, putr.vf and putr.tfm? The first TFM file can be
+ generated with afm2tfm, coming with dvips, in the following way:
+ - afm2tfm Utopia/Utopia-Regular.afm -v putr.vpl rputr.tfm
+
+ The TFM/VF files for putr can be generated from the virtual property
+ list file (VPL) with vptovf:
+ - vptovf putr.vpl putr.vf putr.tfm
+
+ Now we have to verify that xdvi can find all these VF and PK fonts
+ by adding the current directory to the PATH's used for locating them:
+ - XDVIVFS (path for VF files)
+ - XDVIFONTS (path for PK files)
+
+ Now we are ready to test Utopia-Regular:
+ - tex testfont
+
+ If TeX asks for a font enter `putr' and when asked for a test
+ enter `\bigtest\bye' and you will get a testfont.dvi file.
+ (Testfont.tex is distributed with every TeX version.)
+
+ - xdvi testfont
+
+ If everything is OK you should see Utopia!
+
+ (You can try another testfont with `rputr' instead of `putr'. Explain
+ the differences!)
+
+ 4) Using Utopia-Regular with dvips.
+ Before you can run dvips to generate the PostScript output that can
+ be printed you have to make the font available to dvips by adding a
+ line to psfonts.map (normally located in /usr/local/lib/tex/ps).
+ This line tells dvips if a font is resident (available in the
+ printer) and if not how to download it. For rputr we need to add
+ next line in psfonts.map (the new version of afm2tfm will show this
+ line on the standard output):
+ rputr Utopia-Regular
+
+ and to copy or to move Utopia-Regular to /usr/local/lib/tex/ps so
+ that it will be downloaded (added to the PostScript output).
+ dvips testfont
+
+ If you have GhostScript, and your dvips is installed so that it does
+ not send the output immediately to the printer, you can check
+ testfont.ps behind your X-display with:
+ gs testfont.ps
+
+ 5) Using rputr.300pk with dvips.
+ You have to remove the line you have added to psfonts.map. Then
+ dvips will try to find a PK-font instead of the type1 font.
+
+ 6) Automatic font generation with MakeTeXPK.
+
+ If you are interested in automatically generating PK fonts from
+ either METAFONT and/or type1 sources you may want to install the
+ MTPK package. This package provides a perl script that allows
+ DVI drivers to generate missing PK sizes in a platform independant
+ way. See ftp.urc.tue.nl:pub/tex/MTPK??.gtz and the MTPK??.README
+ file for more information (under development).
+
+ 7) Although ps2pk is set up for AdobeStandardEncoding, the default used
+ by current versions of dvips, it will also accept other PostScript
+ and TeX encodings. An interesting alternative for TeX users is the new
+ TUG 8bits font standard (see: TUGboat #10 vol. 4 1990). This standard
+ is a superset of ISOLatin1 with many accented characters. The PostScript
+ encoding used by this new font is contained in etc/EC.enc. In order to
+ use it you will need afm2tfm version 7.0 (distributed with dvips5485++).
+
+ [Here you should read two danger bends!! Next in small letters . . .
+
+ As an example how an encoding scheme other than Adobe Standard can
+ be used we show how you can use the Utopia-Regular font as an
+ extended Computer Modern font. We use this encoding scheme both on
+ the TeX input side (let us call that internal encoding) and on the
+ TeX output side (we will call that external encoding). It is clear
+ that we can not use the plain macros that are still based on
+ oldstyle 7bits internal encodings. But we can use NFSS-DC a new
+ font selection scheme based on DC encodings. The DC encoding is a
+ preliminar version of the EC encoding.
+
+ How do we generate the appropriate TFM, VF and PK files?
+ rputr.300pk:
+ setenv T1INPUTS Utopia (C-shell)
+ ps2pk -e etc/EC.enc Utopia-Regular rputr.300pk
+ rputr.tfm and putr.vpl:
+ afm2tfm Utopia/Utopia-Regular.afm -p etc/EC.enc -v putr.vpl rputr.tfm
+ putr.vf putr.tfm:
+ vptovf putr.vpl putr.vf putr.tfm
+
+ How do we use it?
+ psfonts.map (add line):
+ rputr Utopia-Regular " ECEncoding ReEncodeFont " <EC.enc
+ $TEXCONFIG:
+ install here Utopia-Regular and EC.enc
+ testfont.tex (tex-nfss-dc is a special plain TeX version):
+ tex-nfss-dc testfont (choose `putr' and '\bigtest\bye')
+ xdvi testfont
+ dvips testfont.
+
+ . . .End of dangerous stuff and the small letters]
+
+--Piet
+
diff --git a/Build/source/texk/ps2pkm/Makefile.in b/Build/source/texk/ps2pkm/Makefile.in
new file mode 100644
index 00000000000..8b2af80fcd8
--- /dev/null
+++ b/Build/source/texk/ps2pkm/Makefile.in
@@ -0,0 +1,63 @@
+# Makefile for ps2pkm --te@dbs.uni-hannover.de. Public domain.
+version = 1.5m
+
+kpse_include ../make/paths.mk
+kpse_include ../make/common.mk
+kpse_include ../make/programs.mk
+prog_cflags = -DUNIX -DKPATHSEA
+
+libobj = arith.o curves.o fontfcn.o hints.o lines.o objects.o paths.o \
+ regions.o scanfont.o spaces.o t1funcs.o t1info.o t1io.o \
+ t1snap.o t1stub.o token.o type1.o util.o bstring.o basics.o
+common_objects = pkout.o filenames.o
+ps2pkobjs = $(libobj) ps2pk.o encoding.o pkout.o filenames.o
+pk2bmobjs = pk2bm.o pkin.o
+pfb2pfaobjs = pfb2pfa.o filenames.o basics.o
+magobjs = mag.o basics.o
+
+program = ps2pk
+programs = pfb2pfa mag pk2bm $(program)
+
+default all: $(programs)
+
+$(program): $(kpathsea) $(ps2pkobjs)
+ $(kpathsea_link) $(ps2pkobjs) $(LOADLIBES)
+pk2bm: $(kpathsea) $(pk2bmobjs)
+ $(kpathsea_link) $(pk2bmobjs) $(LOADLIBES)
+pfb2pfa: $(kpathsea) $(pfb2pfaobjs)
+ $(kpathsea_link) $(pfb2pfaobjs) $(LOADLIBES)
+mag: $(kpathsea) $(magobjs)
+ $(kpathsea_link) $(magobjs) $(LOADLIBES)
+
+kpse_include ../make/tkpathsea.mk
+
+install: install-exec install-data
+uninstall: uninstall-exec uninstall-data
+
+install-exec: $(programs)
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
+ for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done
+uninstall-exec:
+ for p in $(programs); do rm -f $(bindir)/$$p; done
+
+install-data: mag.1 pfb2pfa.1 pk2bm.1 ps2pk.1
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir)
+ $(INSTALL_DATA) $(srcdir)/mag.1 $(man1dir)/mag.$(manext)
+ $(INSTALL_DATA) $(srcdir)/pfb2pfa.1 $(man1dir)/pfb2pfa.$(manext)
+ $(INSTALL_DATA) $(srcdir)/pk2bm.1 $(man1dir)/pk2bm.$(manext)
+ $(INSTALL_DATA) $(srcdir)/ps2pk.1 $(man1dir)/ps2pk.$(manext)
+uninstall-data:
+ rm -f $(man1dir)/ps2pk.$(manext) $(man1dir)/pk2bm.$(manext) \
+ $(man1dir)/pfb2pfa.$(manext) $(man1dir)/mag.$(manext)
+
+pre-dist-$(distname):
+post-dist-$(distname):
+
+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/ps2pkm/README b/Build/source/texk/ps2pkm/README
new file mode 100644
index 00000000000..6fa82e5e194
--- /dev/null
+++ b/Build/source/texk/ps2pkm/README
@@ -0,0 +1,206 @@
+
+ Ps2pk-1.4 available
+ -------------------
+ (January 1994)
+
+Version 1.4 of ps2pk is now available on:
+ ftp.urc.tue.nl (address: 131.155.2.79)
+ directory: /pub/tex
+ files: ps2pk14.README ( 9k) This file
+ ps2pk14.tar.gz (237k) Sources
+
+ For MSDOS people having difficulties in handling UNIX `.tar.gz'
+ format I have made some UNIX tools (only executables) available
+ in directories:
+ /pub/unixtools/dos
+
+ See the system specific TARGZ file for some help.
+
+ Ftp.urc.tue.nl can not handle E-mail requests. But sites are free
+ to put the ps2pk14 stuff on any server that can.
+
+ I have made read-to-go 1.4 executables for MSDOS available in:
+ pub/tex/ps2pk14x/msdos/djgpp (created with DJGPP/gcc)
+ msdos/emx (created with EMX/gcc)
+
+When do you need ps2pk?
+----------------------
+Ps2pk is a tool that converts a PostScript type1 font into a corres-
+ponding TeX PK font. The tool is especially interesting if you want
+to use fully hinted type1 fonts in your DVI previewer (instead of the
+unhinted type1 fonts currently used in GhostScript) or on a printer
+that has no PostScript interpreter.
+
+In order to use the ps2pk generated fonts your driver and previewer need
+to support virtual fonts. The reason is that PostScript fonts and TeX
+fonts do have a different font encoding and handle ligatures in a
+different way. With virtual fonts the PostScript world (encoding +
+ligatures) can be mapped to the old style TeX world on which the current
+plain macro packages still are based (despite the fact that TeX3.0 can
+handle 8bits).
+
+It is also possible to use the ps2pk generated PK fonts directly
+(without virtual fonts) but in that case you need modified plain TeX
+macros in order to acces the new (changed) font features. To make TeX
+really 8bits (the reason TeX3.0 was released) TUG has proposed a new
+font standard supporting the full 8bit range (in stead of the 7bit).
+The 128 extra characters in this new TUG standard are filled up with
+characters for 17 different European languages (see: TUGboat #10 vol.
+4 1990). With ps2pk it is possible to generate PK fonts from
+PostScript fonts according to this new TUG font standard.
+
+Ps2pk and virtual fonts.
+------------------------
+In order to use ps2pk in combination with virtal fonts you need afm2tfm
+(the version belonging to dvips5.487 or newer), dvips and a previewer
+supporting virtual fonts (ex.: xdvi on UNIX).
+
+PS: the latest version of dvips can be retrieved from
+ labrea.stanford.edu:pub and xdvi from export.lcs.mit.edu:contrib
+
+Ps2pk without virtual fonts.
+----------------------------
+This road in not a paved one even for experienced TeX users! So be
+prepared that you need to build some bridges and other improvements to
+reach your goal. Or simply wait until the TeX community has switched to
+the new TUG font standard.
+
+Dvips (5.487 and higher) supports different TeX and PostScript
+encodings. If you choose for the new TUG fontstandard defined in the
+Cork meeting, as the TeX and PostScript encoding, you have to:
+ - generate a set of TFM/VF fonts for the `EC' (Extended Computer
+ Modern Font encoding) using afm2tfm and vptovf,
+ - install the new encoding vector EC.enc so it will also be used for
+ the resident/downloaded PostScript fonts
+ - install a modified version of NFSS (New Font Selection Scheme) using
+ this encoding scheme.
+
+Type1 PostScript text fonts.
+----------------------------
+Fully hinted type1 fonts are generally not PD. You have to buy them
+unless you are satisfied with the PD available GhostScript versions
+(which are currently not hinted). You don't need to be an expert to
+see the difference between hinted and unhinted fonts. If you are
+using MSDOS or MacIntosh computers you probably use Adobe Type Manager
+(ATM) a program that can render type1 fonts dynamically. With this
+program or with other programs using ATM (for example Lotus) you
+receive fully hinted type1 fonts. On MSDOS they have funny names like
+tmr______.pfb. To save space on MSDOS type1 fonts are binary encoded
+(.pfb). On UNIX you can use this .pfb format too or the .pfa format
+(which occupies about double the space of a .pfb format).
+
+If your UNIX workstation supports DPS (Display PostScript) than
+you already may have a number of fully hinted type1 fonts. Look in
+places like /usr/lib/dps.
+
+ If you are satisfied with PK fonts derived from unhinted type1
+ fonts just for previewing then you can ftp (thanks to Karl Berry):
+ ftp.cs.umb.edu (file: pub/tex/psfonts.tar).
+
+ This set contains PK files for the standard 35 PostScript fonts in
+ various sizes, generated by `gsrenderfont' in the GNU font utilities
+ (on prep.ai.mit.edu et al.).
+
+Adobe has donated their Utopia font family to the X-consortium and IBM
+their Courier font. Both families are available on ftp.urc.tue.nl. The
+Courier font from IBM does have a rich set of accented characters not
+found in other Adobe fonts. Both fonts are fully hinted.
+
+Lee Hetherington <ilh@goldilocks.LCS.MIT.EDU> has written a set of
+type1 conversion utilities. These allow to convert from binary (PFB)
+to ASCII (PFA) and back. Or to convert a type1 font into readable
+PostScript (disassemble) with the possibility to edit it and to
+convert it back (assemble) to some type1 encoded form. They are
+available in:
+ ftp.cs.umb.edu (192.12.26.23)
+ /pub/misc/t1utils-1.1.tar.Z
+
+Type1 PostScript math fonts.
+----------------------------
+The PostScript type1 symbol fonts do not have the same rich set of math
+symbols as the TeX fonts. There are two exceptions: the Lucida fonts
+and the MathTime package. I have no experience with the Lucida fonts.
+The MathTime package from Michael Spivak has the disadvantage that it is
+too much MacIntosh/AMSTeX oriented. There are people who are working on
+LaTeX support based upon NFSS. Another disadvantage of MathTime is that
+it is built on top of TimesRoman-Italic (not delivered with the package)
+and lacks bold-italic symbols.
+
+Acknowledgements.
+-----------------
+Ps2pk uses the type1 rendering software IBM has donated to the
+X-consortium. This rendering package is used by ps2pk as pure as
+possible. But in order to support user specified encoding schemes, to
+generate extended and/or slanted font variations, to uncouple it from the
+X protocol and to fix some bugs I needed to change some of the sources.
+
+I also want to thank the `ps2pk discussion forum' who helped me to make
+ps2pk as it is now. Especially Tom Rokicki for enhancing his dvips/afm2tfm.
+
+I wish you a lot of fun with type1 fonts,
+
+--Piet
+
+internet: rcpt@urc.tue.nl | Piet Tutelaers
+bitnet: rcpt@heitue5.BITNET | Computer Center Room RC 1.90
+phone: +31 (0)40 474541 | Eindhoven University of Technology
+fax: +31 (0)40 434438 | P.O. Box 513, 5600 MB Eindhoven, NL
+
+
+For those who have used earlier versions of ps2pk next differences may be
+of interest (only major differences are mentioned):
+
+Ps2pk 1.4 release (94-01)
+-------------------------
+1) Memory allocation made dynamically
+ 1.1 in computing runlengths (needed to build PK fonts)
+ 1.2 in scanning type1 fonts (to overcome `fixed' virtual memory)
+2) Problem with handling Lucida font (negative widths) solved
+3) Improved error handling in scanning AFM files
+4) Provided hooks to handle non 32-bit platforms
+5) Some cleanups
+6) Improved Makefiles.
+
+Ps2pk 1.3 release (92-09)
+-------------------------
+1) Official X11R5 patches included in type1 library.
+2) The -a<AFMfile> option added to ps2pk.
+3) Problem with rendering of Obique fonts solved.
+
+Ps2pk 1.2 release (92-06)
+-------------------------
+1) Ps2pk now computes the same checksum as afm2tfm (dvips5.487 or
+ higher). This means that you have to update your VF and TFM files
+ with the new dvips5487lib files.
+2) Bug fixes:
+ - the MSDOS version now correctly reads PFB font files
+ - a segmentation fault error removed (capri.pfa font)
+ - an out of memory problem fixed (davysrib.pfa font)
+3) Added Makefile for MSDOS/DJGPP (Delorie's GCC for 386 systems)
+
+Ps2pk 1.1 release (92-04)
+-------------------------
+1) Ps2pk uses now the same encoding scheme as introduced by afm2tfm 7.0
+ (dvips5485). But default (for all English/American writing TeX-friends)
+ the program uses the same encoding as is in the AFM-file belonging to
+ the type1 PostScript font (normally AdobeStandard). So the program does
+ not longer need re-encode to create a .cmi file containing the encoding
+ vector and the WX values. These are read directly from the AFM file.
+
+ Typical usage for standard encoding:
+ ps2pk -X329 Utopia-Regular rputr.329pk
+
+ or with EC.enc encoding:
+ ps2pk -eEC.enc -X329 Utopia-Regular rputr.329pk
+
+2) I have added a -E<expansion> and -S<slant> option to ps2pk thanks to
+ the patches I got from Lee Hetherington.
+
+3) I have added a MakeTeXPK script so that dvips and xdvi can use it.
+
+4) I have added manual pages and some documentation (README + INSTALLATION).
+
+5) Some inconveniences for MSDOS users are removed.
+
+Ps2pk 1.0 release (92-03)
+-------------------------
diff --git a/Build/source/texk/ps2pkm/README.14m b/Build/source/texk/ps2pkm/README.14m
new file mode 100644
index 00000000000..6a70ab18ce6
--- /dev/null
+++ b/Build/source/texk/ps2pkm/README.14m
@@ -0,0 +1,35 @@
+Fri May 9 13:23:31 MET DST 1997
+ Rearranged all the files into one directory. New Makefile.in and
+ configure.in.
+
+ Thomas Esser
+
+March 1995
+Configuration files supplied. Makefile for the
+manual pages.
+
+January 1995
+
+Kpathsea path searching added. Set up for use with
+MakeTeXPK
+
+December 1994
+
+This modification of ps2pk version 1.4
+is an attempt to provide for PK files
+that will be compatible with the recommendations
+of the TUG Working Group on a TeX Directory Structure
+for platform-independent support files.
+
+The sources in the src directory have been modified
+to provide for PK specials at the end of each
+PK file so that there will be an internal
+identification available if the files have
+to be stored under truncated DOS 8+3 names
+as xxxx.pk for all resolutions. For details
+see src/CHANGES and the manual page ps2pk.1
+The original files are retained in this package
+with the suffix [ch]orig (which DOS will truncate to
+"COR" and "HOR"
+
+P. A. Mackay---mackay@cs.washington.edu
diff --git a/Build/source/texk/ps2pkm/README.type1 b/Build/source/texk/ps2pkm/README.type1
new file mode 100644
index 00000000000..4ce796d75c4
--- /dev/null
+++ b/Build/source/texk/ps2pkm/README.type1
@@ -0,0 +1,25 @@
+This directory contains a rasterizer for "Type 1" (PostScript) format
+outline fonts. It was donated by IBM for the R5 contrib tape and has
+been maintained since then by the MIT X Consortium. This version is
+compatible with X11R5 public patch 13.
+
+To be used, this rasterizer must be bound into the X server and the font
+server. It is most convenient to do this if this directory is moved
+into the 'mit' directory tree (i.e., mit/font/lib/font/Type1, a peer of
+the 'Speedo' directory). Of course, mit/font/lib/font/Imakefile must be
+made aware of its new subdirectory and the objects in it. In any case,
+you must ensure that the library mit/font/lib/font/libfont.a contains
+this code.
+
+In addition, the rasterizer must be "registered" with X. The source in
+mit/fonts/lib/font/fontfile/renderers.c, specifically the routine
+FontFileRegisterFontFileFunctions(), must be modified to add the line:
+
+ Type1RegisterFontFileFunctions();
+
+after the call to "SpeedoRegisterFontFileFunctions".
+
+Some Type 1 fonts have been donated; see, for example, the directory
+contrib/fonts/scaled/Type1. In order to use them, they must be in the
+font path, either by combining them in some existing font object
+directory, or adding a new font directory to the path.
diff --git a/Build/source/texk/ps2pkm/Xstuff.h b/Build/source/texk/ps2pkm/Xstuff.h
new file mode 100644
index 00000000000..523767da378
--- /dev/null
+++ b/Build/source/texk/ps2pkm/Xstuff.h
@@ -0,0 +1,42 @@
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef XMD_H
+#define XMD_H 1
+
+#include "types.h"
+
+/*
+ * Bitfield suffixes for the protocol structure elements, if you
+ * need them. Note that bitfields are not guarranteed to be signed
+ * (or even unsigned) according to ANSI C.
+ */
+#ifdef WORD64
+#define B32 :32
+#define B16 :16
+#else
+#define B32
+#define B16
+#endif
+
+typedef struct {
+ SHORT leftSideBearing B16,
+ rightSideBearing B16,
+ characterWidth B16,
+ ascent B16,
+ descent B16;
+ USHORT attributes;
+} xCharInfo;
+#endif /* XMD_H */
+
+#ifndef _FS_PROTO_H_
+#define _FS_PROTO_H_
+
+typedef struct {
+ USHORT x_resolution B16;
+ USHORT y_resolution B16;
+ USHORT point_size B16;
+} fsResolution;
+
+#endif /* _FS_PROTO_H_ */
diff --git a/Build/source/texk/ps2pkm/acconfig.h b/Build/source/texk/ps2pkm/acconfig.h
new file mode 100644
index 00000000000..739210b5ae1
--- /dev/null
+++ b/Build/source/texk/ps2pkm/acconfig.h
@@ -0,0 +1,24 @@
+/* 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. */
+
+
+/* Define if your compiler understands prototypes. */
+#undef HAVE_PROTOTYPES
+
+/* Define if your putenv doesn't waste space when the same environment
+ variable is assigned more than once, with different (malloced)
+ values. This is true only on NetBSD/FreeBSD, as far as I know. See
+ xputenv.c. */
+#undef SMART_PUTENV
+
+/* Define if getcwd if implemented using fork or vfork. Let me know
+ if you have to add this by hand because configure failed to detect
+ it. */
+#undef GETCWD_FORKS
+
+/* Define if you are using GNU libc or otherwise have global variables
+ `program_invocation_name' and `program_invocation_short_name'. */
+#undef HAVE_PROGRAM_INVOCATION_NAME
diff --git a/Build/source/texk/ps2pkm/arith.c b/Build/source/texk/ps2pkm/arith.c
new file mode 100644
index 00000000000..ef74f42b770
--- /dev/null
+++ b/Build/source/texk/ps2pkm/arith.c
@@ -0,0 +1,419 @@
+/* $XConsortium: arith.c,v 1.2 91/10/10 11:14:06 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* ARITH CWEB V0006 ******** */
+/*
+:h1.ARITH Module - Portable Module for Multiple Precision Fixed Point Arithmetic
+
+This module provides division and multiplication of 64-bit fixed point
+numbers. (To be more precise, the module works on numbers that take
+two 'longs' to store. That is almost always equivalent to saying 64-bit
+numbers.)
+
+Note: it is frequently easy and desirable to recode these functions in
+assembly language for the particular processor being used, because
+assembly language, unlike C, will have 64-bit multiply products and
+64-bit dividends. This module is offered as a portable version.
+
+&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) and Sten F. Andler
+
+
+:h3.Include Files
+
+The included files are:
+*/
+
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "arith.h"
+
+/*
+:h3.
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+Reference for all algorithms: Donald E. Knuth, "The Art of Computer
+Programming, Volume 2, Semi-Numerical Algorithms," Addison-Wesley Co.,
+Massachusetts, 1969, pp. 229-279.
+
+Knuth talks about a 'digit' being an arbitrary sized unit and a number
+being a sequence of digits. We'll take a digit to be a 'short'.
+The following assumption must be valid for these algorithms to work:
+:ol.
+:li.A 'long' is two 'short's.
+:eol.
+The following code is INDEPENDENT of:
+:ol.
+:li.The actual size of a short.
+:li.Whether shorts and longs are stored most significant byte
+first or least significant byte first.
+:eol.
+
+SHORTSIZE is the number of bits in a short; LONGSIZE is the number of
+bits in a long; MAXSHORT is the maximum unsigned short:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+ASSEMBLE concatenates two shorts to form a long:
+*/
+#define ASSEMBLE(hi,lo) ((((ULONG)hi)<<SHORTSIZE)+(lo))
+/*
+HIGHDIGIT extracts the most significant short from a long; LOWDIGIT
+extracts the least significant short from a long:
+*/
+#define HIGHDIGIT(u) ((u)>>SHORTSIZE)
+#define LOWDIGIT(u) ((u)&MAXSHORT)
+
+/*
+SIGNBITON tests the high order bit of a long 'w':
+*/
+#define SIGNBITON(w) (((LONG)w)<0)
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h2.Double Long Arithmetic
+
+:h3.DLmult() - Multiply Two Longs to Yield a Double Long
+
+The two multiplicands must be positive.
+*/
+
+void DLmult(product, u, v)
+ register doublelong *product;
+ register ULONG u;
+ register ULONG v;
+{
+ register ULONG u1, u2; /* the digits of u */
+ register ULONG v1, v2; /* the digits of v */
+ register unsigned int w1, w2, w3, w4; /* the digits of w */
+ register ULONG t; /* temporary variable */
+/* printf("DLmult(? ?, %x, %x)\n", u, v); */
+ u1 = HIGHDIGIT(u);
+ u2 = LOWDIGIT(u);
+ v1 = HIGHDIGIT(v);
+ v2 = LOWDIGIT(v);
+
+ if (v2 == 0) w4 = w3 = w2 = 0;
+ else
+ {
+ t = u2 * v2;
+ w4 = LOWDIGIT(t);
+ t = u1 * v2 + HIGHDIGIT(t);
+ w3 = LOWDIGIT(t);
+ w2 = HIGHDIGIT(t);
+ }
+
+ if (v1 == 0) w1 = 0;
+ else
+ {
+ t = u2 * v1 + w3;
+ w3 = LOWDIGIT(t);
+ t = u1 * v1 + w2 + HIGHDIGIT(t);
+ w2 = LOWDIGIT(t);
+ w1 = HIGHDIGIT(t);
+ }
+
+ product->high = ASSEMBLE(w1, w2);
+ product->low = ASSEMBLE(w3, w4);
+}
+
+/*
+:h2.DLdiv() - Divide Two Longs by One Long, Yielding Two Longs
+
+Both the dividend and the divisor must be positive.
+*/
+
+void DLdiv(quotient, divisor)
+ doublelong *quotient; /* also where dividend is, originally */
+ ULONG divisor;
+{
+ register ULONG u1u2 = quotient->high;
+ register ULONG u3u4 = quotient->low;
+ register LONG u3; /* single digit of dividend */
+ register int v1,v2; /* divisor in registers */
+ register LONG t; /* signed copy of u1u2 */
+ register int qhat; /* guess at the quotient digit */
+ register ULONG q3q4; /* low two digits of quotient */
+ register int shift; /* holds the shift value for normalizing */
+ register int j; /* loop variable */
+
+/* printf("DLdiv(%x %x, %x)\n", quotient->high, quotient->low, divisor); */
+ /*
+ * Knuth's algorithm works if the dividend is smaller than the
+ * divisor. We can get to that state quickly:
+ */
+ if (u1u2 >= divisor) {
+ quotient->high = u1u2 / divisor;
+ u1u2 %= divisor;
+ }
+ else
+ quotient->high = 0;
+
+ if (divisor <= MAXSHORT) {
+
+ /*
+ * This is the case where the divisor is contained in one
+ * 'short'. It is worthwhile making this fast:
+ */
+ u1u2 = ASSEMBLE(u1u2, HIGHDIGIT(u3u4));
+ q3q4 = u1u2 / divisor;
+ u1u2 %= divisor;
+ u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3u4));
+ quotient->low = ASSEMBLE(q3q4, u1u2 / divisor);
+ return;
+ }
+
+
+ /*
+ * At this point the divisor is a true 'long' so we must use
+ * Knuth's algorithm.
+ *
+ * Step D1: Normalize divisor and dividend (this makes our 'qhat'
+ * guesses more accurate):
+ */
+ for (shift=0; !SIGNBITON(divisor); shift++, divisor <<= 1) { ; }
+ shift--;
+ divisor >>= 1;
+
+ if ((u1u2 >> (LONGSIZE - shift)) != 0 && shift != 0)
+ t1_abort("DLdiv: dividend too large");
+ u1u2 = (u1u2 << shift) + ((shift == 0) ? 0 : u3u4 >> (LONGSIZE - shift));
+ u3u4 <<= shift;
+
+ /*
+ * Step D2: Begin Loop through digits, dividing u1,u2,u3 by v1,v2,
+ * then shifting U left by 1 digit:
+ */
+ v1 = HIGHDIGIT(divisor);
+ v2 = LOWDIGIT(divisor);
+ q3q4 = 0;
+ u3 = HIGHDIGIT(u3u4);
+
+ for (j=0; j < 2; j++) {
+
+ /*
+ * Step D3: make a guess (qhat) at the next quotient denominator:
+ */
+ qhat = (HIGHDIGIT(u1u2) == v1) ? MAXSHORT : u1u2 / v1;
+ /*
+ * At this point Knuth would have us further refine our
+ * guess, since we know qhat is too big if
+ *
+ * v2 * qhat > ASSEMBLE(u1u2 % v, u3)
+ *
+ * That would make sense if u1u2 % v was easy to find, as it
+ * would be in assembly language. I ignore this step, and
+ * repeat step D6 if qhat is too big.
+ */
+
+ /*
+ * Step D4: Multiply v1,v2 times qhat and subtract it from
+ * u1,u2,u3:
+ */
+ u3 -= qhat * v2;
+ /*
+ * The high digit of u3 now contains the "borrow" for the
+ * rest of the substraction from u1,u2.
+ * Sometimes we can lose the sign bit with the above.
+ * If so, we have to force the high digit negative:
+ */
+ t = HIGHDIGIT(u3);
+ if (t > 0)
+ t |= -1 << SHORTSIZE;
+ t += u1u2 - qhat * v1;
+/* printf("..>divide step qhat=%x t=%x u3=%x u1u2=%x v1=%x v2=%x\n",
+ qhat, t, u3, u1u2, v1, v2); */
+ while (t < 0) { /* Test is Step D5. */
+
+ /*
+ * D6: Oops, qhat was too big. Add back in v1,v2 and
+ * decrease qhat by 1:
+ */
+ u3 = LOWDIGIT(u3) + v2;
+ t += HIGHDIGIT(u3) + v1;
+ qhat--;
+/* printf("..>>qhat correction t=%x u3=%x qhat=%x\n", t, u3, qhat); */
+ }
+ /*
+ * Step D7: shift U left one digit and loop:
+ */
+ u1u2 = t;
+ if (HIGHDIGIT(u1u2) != 0)
+ t1_abort("divide algorithm error");
+ u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3));
+ u3 = LOWDIGIT(u3u4);
+ q3q4 = ASSEMBLE(q3q4, qhat);
+ }
+ quotient->low = q3q4;
+/* printf("DLdiv returns %x %x\n", quotient->high, quotient->low); */
+ return;
+}
+
+/*
+:h3.DLadd() - Add Two Double Longs
+
+In this case, the doublelongs may be signed. The algorithm takes the
+piecewise sum of the high and low longs, with the possibility that the
+high should be incremented if there is a carry out of the low. How to
+tell if there is a carry? Alex Harbury suggested that if the sum of
+the lows is less than the max of the lows, there must have been a
+carry. Conversely, if there was a carry, the sum of the lows must be
+less than the max of the lows. So, the test is "if and only if".
+*/
+
+void DLadd(u, v)
+ doublelong *u; /* u = u + v */
+ doublelong *v;
+{
+ register ULONG lowmax = MAX(u->low, v->low);
+
+/* printf("DLadd(%x %x, %x %x)\n", u->high, u->low, v->high, v->low); */
+ u->high += v->high;
+ u->low += v->low;
+ if (lowmax > u->low)
+ u->high++;
+}
+/*
+:h3.DLsub() - Subtract Two Double Longs
+
+Testing for a borrow is even easier. If the v.low is greater than
+u.low, there must be a borrow.
+*/
+
+void DLsub(u, v)
+ doublelong *u; /* u = u - v */
+ doublelong *v;
+{
+/* printf("DLsub(%x %x, %x %x)\n", u->high, u->low, v->high, v->low);*/
+ u->high -= v->high;
+ if (v->low > u->low)
+ u->high--;
+ u->low -= v->low;
+}
+/*
+:h3.DLrightshift() - Macro to Shift Double Long Right by N
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h2.Fractional Pel Arithmetic
+*/
+/*
+:h3.FPmult() - Multiply Two Fractional Pel Values
+
+This funtion first calculates w = u * v to "doublelong" precision.
+It then shifts w right by FRACTBITS bits, and checks that no
+overflow will occur when the resulting value is passed back as
+a fractpel.
+*/
+
+fractpel FPmult(u, v)
+ register fractpel u,v;
+{
+ doublelong w;
+ register int negative = FALSE; /* sign flag */
+
+ if ((u == 0) || (v == 0)) return (0);
+
+
+ if (u < 0) {u = -u; negative = TRUE;}
+ if (v < 0) {v = -v; negative = !negative;}
+
+ if (u == TOFRACTPEL(1)) return ((negative) ? -v : v);
+ if (v == TOFRACTPEL(1)) return ((negative) ? -u : u);
+
+ DLmult(&w, u, v);
+ DLrightshift(w, FRACTBITS);
+ if (w.high != 0 || SIGNBITON(w.low)) {
+ IfTrace2(TRUE,"FPmult: overflow, %dlx%dl\n", u, v);
+ w.low = TOFRACTPEL(MAXSHORT);
+ }
+
+ return ((negative) ? -w.low : w.low);
+}
+
+/*
+:h3.FPdiv() - Divide Two Fractional Pel Values
+
+These values may be signed. The function returns the quotient.
+*/
+
+fractpel FPdiv(dividend, divisor)
+ register fractpel dividend;
+ register fractpel divisor;
+{
+ doublelong w; /* result will be built here */
+ int negative = FALSE; /* flag for sign bit */
+
+ if (dividend < 0) {
+ dividend = -dividend;
+ negative = TRUE;
+ }
+ if (divisor < 0) {
+ divisor = -divisor;
+ negative = !negative;
+ }
+ w.low = dividend << FRACTBITS;
+ w.high = dividend >> (LONGSIZE - FRACTBITS);
+ DLdiv(&w, divisor);
+ if (w.high != 0 || SIGNBITON(w.low)) {
+ IfTrace2(TRUE,"FPdiv: overflow, %dl/%dl\n", dividend, divisor);
+ w.low = TOFRACTPEL(MAXSHORT);
+ }
+ return( (negative) ? -w.low : w.low);
+}
+
+/*
+:h3.FPstarslash() - Multiply then Divide
+
+Borrowing a chapter from the language Forth, it is useful to define
+an operator that first multiplies by one constant then divides by
+another, keeping the intermediate result in extended precision.
+*/
+
+fractpel FPstarslash(a, b, c)
+ register fractpel a,b,c; /* result = a * b / c */
+{
+ doublelong w; /* result will be built here */
+ int negative = FALSE;
+
+ if (a < 0) { a = -a; negative = TRUE; }
+ if (b < 0) { b = -b; negative = !negative; }
+ if (c < 0) { c = -c; negative = !negative; }
+
+ DLmult(&w, a, b);
+ DLdiv(&w, c);
+ if (w.high != 0 || SIGNBITON(w.low)) {
+ IfTrace3(TRUE,"FPstarslash: overflow, %dl*%dl/%dl\n", a, b, c);
+ w.low = TOFRACTPEL(MAXSHORT);
+ }
+ return((negative) ? -w.low : w.low);
+}
diff --git a/Build/source/texk/ps2pkm/arith.h b/Build/source/texk/ps2pkm/arith.h
new file mode 100644
index 00000000000..3f2e4b8d038
--- /dev/null
+++ b/Build/source/texk/ps2pkm/arith.h
@@ -0,0 +1,67 @@
+/* $XConsortium: arith.h,v 1.2 91/10/10 11:17:49 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#include "types.h"
+
+void DLmult(),DLdiv(),DLadd(),DLsub();
+
+fractpel FPmult();
+fractpel FPdiv();
+fractpel FPstarslash();
+
+/*END SHARED*/
+/*SHARED*/
+
+/* MAXSHORT may be defined by <limits.h> */
+#ifdef MAXSHORT
+#undef MAXSHORT
+#endif
+
+#define SHORTSIZE (sizeof(SHORT)*8)
+#define LONGSIZE (SHORTSIZE*2)
+#define MAXSHORT ((1<<SHORTSIZE)-1)
+
+/*END SHARED*/
+/*SHARED*/
+
+typedef struct {
+ LONG high;
+ ULONG low;
+} doublelong;
+
+/*END SHARED*/
+/*SHARED*/
+
+#define DLrightshift(dl,N) { \
+ dl.low = (dl.low >> N) + (((ULONG) dl.high) << (LONGSIZE - N)); \
+ dl.high >>= N; \
+}
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/basename.c b/Build/source/texk/ps2pkm/basename.c
new file mode 100644
index 00000000000..624b7467785
--- /dev/null
+++ b/Build/source/texk/ps2pkm/basename.c
@@ -0,0 +1,23 @@
+/*
+ * FILE: basename.c
+ * PURPOSE: a reimplementation of BSD's basename so that it can also be
+ * used as a function in other programs (see filenames.c and
+ * filenames.h)
+ * AUTHOR: Piet Tutelaers
+ * VERSION: 1.0 (Sept. 1995)
+ */
+#include <stdio.h> /* printf() */
+#include "basics.h" /* fatal() */
+#include "filenames.h" /* basename() */
+
+main(int argc, char **argv)
+{
+ if (argc < 2 || argc > 3)
+ fatal("Usage: basename string [suffix]\n");
+
+ if (argc == 2)
+ printf("%s\n", basename(argv[1], NULL));
+ else
+ printf("%s\n", basename(argv[1], argv[2]));
+ exit(0);
+}
diff --git a/Build/source/texk/ps2pkm/basics.c b/Build/source/texk/ps2pkm/basics.c
new file mode 100644
index 00000000000..3191da4df28
--- /dev/null
+++ b/Build/source/texk/ps2pkm/basics.c
@@ -0,0 +1,34 @@
+/* FILE: basics.c
+ * PURPOSE: basic functions
+ * AUTHOR: Piet Tutelaers
+ * VERSION: 1.0 (September 1995)
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h> /* stat() */
+#ifdef WIN32
+#include <win32lib.h>
+#endif
+
+/* Give up ... */
+void fatal(char *fmt, ...)
+{ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ exit(1);
+}
+
+/* Give a message ... */
+void msg(char *fmt, ...)
+{ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fflush(stderr);
+ va_end(args);
+}
diff --git a/Build/source/texk/ps2pkm/basics.h b/Build/source/texk/ps2pkm/basics.h
new file mode 100644
index 00000000000..aba1db8b078
--- /dev/null
+++ b/Build/source/texk/ps2pkm/basics.h
@@ -0,0 +1,90 @@
+/* FILE: basics.h
+ * PURPOSE: basic definitions
+ * AUTHOR: Piet Tutelaers
+ * VERSION: 1.0 (September 1995)
+ */
+
+
+#ifndef NOBASICS
+
+#if defined(KPATHSEA)
+# include <kpathsea/config.h>
+# include <kpathsea/c-pathch.h>
+# include <kpathsea/c-fopen.h>
+# include <c-auto.h>
+# define PATHSEP ENV_SEP
+# define DIRSEP DIR_SEP
+# define RB FOPEN_RBIN_MODE
+# define WB FOPEN_WBIN_MODE
+# if defined(DOSISH)
+# define ESCAPECHAR '!'
+# define RECURSIVE "!!"
+# endif /* DOSISH */
+# define basename ps2pk_basename
+#elif defined(MSDOS) || defined(WIN32)
+# define PATHSEP ';'
+# define DIRSEP '\\'
+# define ESCAPECHAR '!'
+# define RECURSIVE "!!"
+# define PSRES_NAME "psres.dpr"
+# define RB "rb"
+# define WB "wb"
+#endif
+
+#ifndef PATHSEP
+#define PATHSEP ':'
+#endif
+
+#ifndef DIRSEP
+#define DIRSEP '/'
+#endif
+
+#ifndef ESCAPECHAR
+#define ESCAPECHAR '\\'
+#endif
+
+#ifndef RECURSIVE
+#define RECURSIVE "//"
+#endif
+
+/* TeX PS Resource database name */
+#ifndef PSRES_NAME
+#define PSRES_NAME "PSres.upr"
+#endif
+
+#ifndef RB
+#define RB "r"
+#endif
+
+#ifndef WB
+#define WB "w"
+#endif
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 256
+#endif
+
+#ifndef MAXSTRLEN
+#define MAXSTRLEN 256
+#endif
+
+#ifndef IS_DIR_SEP
+#define IS_DIR_SEP(c) ((c) == DIRSEP)
+#endif
+
+#define NOBASICS
+#endif
+
+#include <stdarg.h>
+
+void fatal(char *fmt, ...);
+void msg(char *fmt, ...);
+
+/* For debugging purposes it is handy to have a fopen() function that
+ * shows which files are opened.
+ */
+
+#include <stdio.h>
+
+#include <sys/types.h> /* struct stat */
+#include <sys/stat.h> /* stat() */
diff --git a/Build/source/texk/ps2pkm/blues.h b/Build/source/texk/ps2pkm/blues.h
new file mode 100644
index 00000000000..a5cdafb8b72
--- /dev/null
+++ b/Build/source/texk/ps2pkm/blues.h
@@ -0,0 +1,95 @@
+/* $XConsortium: blues.h,v 1.2 91/10/10 11:17:52 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ * Portions Copyright (c) 1990 Adobe Systems Incorporated.
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark or Adobe
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.
+ *
+ * IBM, LEXMARK, AND ADOBE PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY
+ * WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE
+ * ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING
+ * ANY DUTY TO SUPPORT OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY
+ * PORTION OF THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM,
+ * LEXMARK, OR ADOBE) ASSUMES THE ENTIRE COST OF ALL SERVICING, REPAIR AND
+ * CORRECTION. IN NO EVENT SHALL IBM, LEXMARK, OR ADOBE BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "types.h"
+
+extern psobj *GetType1CharString();
+
+#define TOPLEFT 1
+#define BOTTOMRIGHT 2
+
+#define NUMBLUEVALUES 14
+#define NUMOTHERBLUES 10
+#define NUMFAMILYBLUES 14
+#define NUMFAMILYOTHERBLUES 10
+#define NUMSTEMSNAPH 12
+#define NUMSTEMSNAPV 12
+#define NUMSTDHW 1
+#define NUMSTDVW 1
+
+#define DEFAULTBOLDSTEMWIDTH 2.0
+
+#define MAXALIGNMENTZONES ((NUMBLUEVALUES+NUMOTHERBLUES)/2)
+#define DEFAULTBLUESCALE 0.039625
+#define DEFAULTBLUESHIFT 7
+#define DEFAULTBLUEFUZZ 1
+#define DEFAULTSTDHW 0
+#define DEFAULTSTDVW 0
+#define DEFAULTFORCEBOLD FALSE
+#define DEFAULTLANGUAGEGROUP 0
+#define DEFAULTRNDSTEMUP FALSE
+#define DEFAULTLENIV 4
+#define DEFAULTEXPANSIONFACTOR 0.06
+
+/* see Type 1 Font Format book for explanations of these values */
+/* Note that we're currently doing nothing for minfeature and password. */
+struct blues_struct {
+ struct blues_struct *next; /* ptr to next Blues structure in list */
+ int numBlueValues; /* # of BlueValues in following array */
+ int BlueValues[NUMBLUEVALUES];
+ int numOtherBlues; /* # of OtherBlues values in following array */
+ int OtherBlues[NUMOTHERBLUES];
+ int numFamilyBlues; /* # of FamilyBlues values in following array */
+ int FamilyBlues[NUMFAMILYBLUES];
+ int numFamilyOtherBlues; /* # of FamilyOtherBlues values in */
+ int FamilyOtherBlues[NUMFAMILYOTHERBLUES]; /* this array */
+ DOUBLE BlueScale;
+ int BlueShift;
+ int BlueFuzz;
+ DOUBLE StdHW;
+ DOUBLE StdVW;
+ int numStemSnapH; /* # of StemSnapH values in following array */
+ DOUBLE StemSnapH[NUMSTEMSNAPH];
+ int numStemSnapV; /* # of StemSnapV values in following array */
+ DOUBLE StemSnapV[NUMSTEMSNAPV];
+ int ForceBold;
+ int LanguageGroup;
+ int RndStemUp;
+ int lenIV;
+ DOUBLE ExpansionFactor;
+};
+
+/* the alignment zone structure -- somewhat similar to the stem structure */
+/* see Adobe Type1 Font Format book about the terms used in this structure */
+struct alignmentzone {
+ int topzone; /* TRUE if a topzone, FALSE if a bottom zone */
+ DOUBLE bottomy, topy; /* interval of this alignment zone */
+};
diff --git a/Build/source/texk/ps2pkm/bstring.c b/Build/source/texk/ps2pkm/bstring.c
new file mode 100644
index 00000000000..250eece830e
--- /dev/null
+++ b/Build/source/texk/ps2pkm/bstring.c
@@ -0,0 +1,13 @@
+/*
+ * A simple memset() in case your ANSI C does not provide it
+ */
+
+#include "c-auto.h"
+
+#if !defined(HAVE_MEMSET) && !defined(memset)
+memset(void *s, int c, int length)
+{ char *p = s;
+
+ while (length--) *(p++) = c;
+}
+#endif
diff --git a/Build/source/texk/ps2pkm/c-auto.in b/Build/source/texk/ps2pkm/c-auto.in
new file mode 100644
index 00000000000..b787eb15767
--- /dev/null
+++ b/Build/source/texk/ps2pkm/c-auto.in
@@ -0,0 +1,19 @@
+/* c-auto.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if you don't have vprintf but do have _doprnt. */
+#undef HAVE_DOPRNT
+
+/* Define if you have the vprintf function. */
+#undef HAVE_VPRINTF
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you have the memset function. */
+#undef HAVE_MEMSET
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the m library (-lm). */
+#undef HAVE_LIBM
diff --git a/Build/source/texk/ps2pkm/cluts.h b/Build/source/texk/ps2pkm/cluts.h
new file mode 100644
index 00000000000..fe51e02f9aa
--- /dev/null
+++ b/Build/source/texk/ps2pkm/cluts.h
@@ -0,0 +1,35 @@
+/* $XConsortium: cluts.h,v 1.2 91/10/10 11:17:54 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* STUB */
+
+#define KillCLUT(T)
+#define CopyCLUT(T) T
+#define UniqueCLUT(T)
+
diff --git a/Build/source/texk/ps2pkm/configure b/Build/source/texk/ps2pkm/configure
new file mode 100755
index 00000000000..676e28e5ff8
--- /dev/null
+++ b/Build/source/texk/ps2pkm/configure
@@ -0,0 +1,2039 @@
+#! /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=arith.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 for main in -lm""... $ac_c" 1>&6
+echo "configure:1101: checking for main in -lm" >&5
+ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1109 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:1116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lm $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1145: 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 1160 "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:1166: \"$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 1177 "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:1183: \"$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 1194 "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:1200: \"$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 for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1225: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1230 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1238: \"$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
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1255 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1273 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1294 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+for ac_hdr in fcntl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1332: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1337 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1342: \"$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
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for vprintf""... $ac_c" 1>&6
+echo "configure:1370: checking for vprintf" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1375 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vprintf(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char vprintf();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_vprintf) || defined (__stub___vprintf)
+choke me
+#else
+vprintf();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vprintf=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_vprintf=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_VPRINTF 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test "$ac_cv_func_vprintf" != yes; then
+echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
+echo "configure:1422: checking for _doprnt" >&5
+if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1427 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+_doprnt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func__doprnt=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func__doprnt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_DOPRNT 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+for ac_func in memset
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1477: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1482 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+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/ps2pkm/configure.in b/Build/source/texk/ps2pkm/configure.in
new file mode 100644
index 00000000000..4f750585481
--- /dev/null
+++ b/Build/source/texk/ps2pkm/configure.in
@@ -0,0 +1,23 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(arith.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)
+AC_CHECK_LIB(m, main)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h)
+
+dnl Checks for library functions.
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS(memset)
+
+KPSE_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/Build/source/texk/ps2pkm/curves.c b/Build/source/texk/ps2pkm/curves.c
new file mode 100644
index 00000000000..5ad48995227
--- /dev/null
+++ b/Build/source/texk/ps2pkm/curves.c
@@ -0,0 +1,222 @@
+/* $XConsortium: curves.c,v 1.3 91/10/10 11:17:56 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991 */
+/* All Rights Reserved */
+
+/* License to use, copy, modify, and distribute this software */
+/* and its documentation for any purpose and without fee is */
+/* hereby granted, provided that licensee provides a license to */
+/* IBM, Corp. to use, copy, modify, and distribute derivative */
+/* works and their documentation for any purpose and without */
+/* fee, that the above copyright notice appear in all copies */
+/* and that both that copyright notice and this permission */
+/* notice appear in supporting documentation, and that the name */
+/* of IBM not be used in advertising or publicity pertaining to */
+/* distribution of the software without specific, written prior */
+/* permission. */
+
+/* IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES */
+/* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT */
+/* LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, */
+/* FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF */
+/* THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND */
+/* PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT */
+/* OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF */
+/* THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES */
+/* THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN */
+/* NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR */
+/* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING */
+/* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF */
+/* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT */
+/* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS */
+/* SOFTWARE. */
+/*
+:h1.CURVES Module - Stepping Beziers
+
+This module is responsible for "rasterizing"
+third order curves. That is, it changes the high level curve
+specification into a list of pels that that curve travels
+through.
+
+:h3.Include Files
+
+Include files needed:
+*/
+
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+#include "regions.h"
+#include "curves.h"
+#include "lines.h"
+#include "arith.h"
+
+
+/*
+:h3.Functions Provided to Other Modules
+
+External entry points:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+Note that "stepping" and "flattening" are so similiar that they use the
+same routine. When the "region" parameter is NULL, that is a flag that
+we are flattening instead of stepping.
+*/
+/*
+:h2.Bezier Third Order Curves
+*/
+/*
+:h3.The "bezierinfo" Structure
+
+This structure is used to store information used when we subdivide
+Bezier curves.
+*/
+
+struct bezierinfo {
+ struct region *region; /* the region being built or NULL */
+ struct fractpoint last; /* not used yet; maybe could save some work */
+ struct fractpoint origin; /* the origin of the bezier */
+} ;
+
+/*
+ Checking for termination of the subdivision process:
+ This is the stupidest test in the world, just check if the coordinatewise
+ distance from an end control point to the next control point is less than
+ one half pel. If so, we must be done.
+ This returns 1 if the subdivision is terminated and 0 if you still need
+ to subdivide.
+*/
+
+int BezierTerminationTest(xa,ya,xb,yb,xc,yc,xd,yd)
+fractpel xa,ya,xb,yb,xc,yc,xd,yd;
+{
+ fractpel dmax;
+ dmax = ABS(xa - xb);
+ dmax = MAX(dmax,ABS(ya - yb));
+ dmax = MAX(dmax,ABS(xd - xc));
+ dmax = MAX(dmax,ABS(yd - yc));
+ if(dmax > FPHALF)
+ return(0); /* not done yet */
+ else
+ return(1); /* done */
+}
+
+/*
+:h3.StepBezierRecurse() - The Recursive Logic in StepBezier()
+
+The recursion involves dividing the control polygon into two smaller
+control polygons by finding the midpoints of the lines. This idea is
+described in any graphics text book and its simplicity is what caused
+Bezier to define his curves as he did. If the input region 'R' is NULL,
+the result is a path that is the 'flattened' curve; otherwise StepBezier
+returns nothing special.
+*/
+static struct segment *StepBezierRecurse(I,xA,yA,xB,yB,xC,yC,xD,yD)
+ struct bezierinfo *I; /* Region under construction or NULL */
+ fractpel xA,yA; /* A control point */
+ fractpel xB,yB; /* B control point */
+ fractpel xC,yC; /* C control point */
+ fractpel xD,yD; /* D control point */
+
+{
+ if (BezierTerminationTest(xA,yA,xB,yB,xC,yC,xD,yD))
+ {
+ if (I->region == NULL)
+ return(PathSegment(LINETYPE, xD - xA, yD - yA));
+ else
+ StepLine(I->region, I->origin.x + xA, I->origin.y + yA,
+ I->origin.x + xD, I->origin.y + yD);
+ }
+ else
+ {
+ fractpel xAB,yAB;
+ fractpel xBC,yBC;
+ fractpel xCD,yCD;
+ fractpel xABC,yABC;
+ fractpel xBCD,yBCD;
+ fractpel xABCD,yABCD;
+
+ xAB = xA + xB; yAB = yA + yB;
+ xBC = xB + xC; yBC = yB + yC;
+ xCD = xC + xD; yCD = yC + yD;
+
+ xABC = xAB + xBC; yABC = yAB + yBC;
+ xBCD = xBC + xCD; yBCD = yBC + yCD;
+
+ xABCD = xABC + xBCD; yABCD = yABC + yBCD;
+
+ xAB >>= 1; yAB >>= 1;
+ xBC >>= 1; yBC >>= 1;
+ xCD >>= 1; yCD >>= 1;
+ xABC >>= 2; yABC >>= 2;
+ xBCD >>= 2; yBCD >>= 2;
+ xABCD >>= 3; yABCD >>= 3;
+
+ if (I->region == NULL)
+ {
+ return( Join(
+ StepBezierRecurse(I, xA, yA, xAB, yAB, xABC, yABC, xABCD, yABCD),
+ StepBezierRecurse(I, xABCD, yABCD, xBCD, yBCD, xCD, yCD, xD, yD)
+ )
+ );
+ }
+ else
+ {
+ StepBezierRecurse(I, xA, yA, xAB, yAB, xABC, yABC, xABCD, yABCD);
+ StepBezierRecurse(I, xABCD, yABCD, xBCD, yBCD, xCD, yCD, xD, yD);
+ }
+ }
+ /*NOTREACHED*/
+ return NULL;
+}
+
+/*
+:h3.TOOBIG() - Macro to Test if a Coordinate is Too Big to Bezier SubDivide Normally
+
+Intermediate values in the Bezier subdivision are 8 times bigger than
+the starting values. If this overflows, a 'long', we are in trouble:
+*/
+
+#if defined(BITS)
+#undef BITS
+#endif
+#define BITS (sizeof(LONG)*8)
+#define HIGHTEST(p) (((p)>>(BITS-4)) != 0) /* includes sign bit */
+#define TOOBIG(xy) ((xy < 0) ? HIGHTEST(-xy) : HIGHTEST(xy))
+
+/*
+:h3.StepBezier() - Produce Run Ends for a Bezier Curve
+
+This is the entry point called from outside the module.
+*/
+
+struct segment *StepBezier(R, xA, yA, xB, yB, xC, yC, xD, yD)
+ struct region *R; /* Region under construction or NULL */
+ fractpel xA,yA; /* A control point */
+ fractpel xB,yB; /* B control point */
+ fractpel xC,yC; /* C control point */
+ fractpel xD,yD; /* D control point */
+{
+ struct bezierinfo Info;
+
+ Info.region = R;
+ Info.origin.x = xA;
+ Info.origin.y = yA;
+
+ xB -= xA;
+ xC -= xA;
+ xD -= xA;
+ yB -= yA;
+ yC -= yA;
+ yD -= yA;
+
+ if ( TOOBIG(xB) || TOOBIG(yB) || TOOBIG(xC) || TOOBIG(yC)
+ || TOOBIG(xD) || TOOBIG(yD) )
+ t1_abort("Beziers this big not yet supported");
+
+ return(StepBezierRecurse(&Info,
+ (fractpel) 0, (fractpel) 0, xB, yB, xC, yC, xD, yD));
+}
+
diff --git a/Build/source/texk/ps2pkm/curves.h b/Build/source/texk/ps2pkm/curves.h
new file mode 100644
index 00000000000..80a73be2dd6
--- /dev/null
+++ b/Build/source/texk/ps2pkm/curves.h
@@ -0,0 +1,40 @@
+/* $XConsortium: curves.h,v 1.2 91/10/10 11:17:59 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#define StepConic(R,xA,yA,xB,yB,xC,yC,r) t1_StepConic(R,xA,yA,xB,yB,xC,yC,r)
+#define StepBezier(R,xA,yA,xB,yB,xC,yC,xD,yD) t1_StepBezier(R,xA,yA,xB,yB,xC,yC,xD,yD)
+
+#define FlattenConic(xM,yM,xC,yC,r) t1_StepConic(NULL,(fractpel)0,(fractpel)0,xM,yM,xC,yC,r)
+#define FlattenBezier(xB,yB,xC,yC,xD,yD) t1_StepBezier(NULL,(fractpel)0,(fractpel)0,xB,yB,xC,yC,xD,yD)
+
+struct segment *t1_StepConic();
+struct segment *t1_StepBezier();
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/depend.mak b/Build/source/texk/ps2pkm/depend.mak
new file mode 100644
index 00000000000..5d708e7e3a8
--- /dev/null
+++ b/Build/source/texk/ps2pkm/depend.mak
@@ -0,0 +1,1379 @@
+$(objdir)/t1stub.obj: \
+ objects.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ types.h
+
+$(objdir)/hints.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ paths.h \
+ regions.h \
+ hints.h
+
+$(objdir)/arith.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ arith.h
+
+$(objdir)/t1snap.obj: \
+ objects.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ types.h \
+ spaces.h \
+ paths.h
+
+$(objdir)/pktest.obj: \
+ basics.h \
+ pkout.h
+
+$(objdir)/token.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ t1stdio.h \
+ util.h \
+ digit.h \
+ token.h \
+ tokst.h \
+ hdigit.h
+
+$(objdir)/mag.obj: \
+ basics.h
+
+$(objdir)/pfb2pfa.obj: \
+ basics.h \
+ filenames.h
+
+$(objdir)/filenames.obj: \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ basics.h
+
+$(objdir)/strexpr.obj: \
+ basics.h
+
+$(objdir)/sexpr.obj: \
+ strexpr.h \
+ basics.h
+
+$(objdir)/psearch.obj: \
+ basics.h \
+ strexpr.h \
+ filenames.h \
+ texfiles.h
+
+$(objdir)/curves.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ paths.h \
+ regions.h \
+ curves.h \
+ lines.h \
+ arith.h
+
+$(objdir)/pk2bm.obj: \
+ pkin.h
+
+$(objdir)/t1io.obj: \
+ c-auto.h \
+ t1stdio.h \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ t1hdigit.h
+
+$(objdir)/fontfcn.obj: \
+ t1imager.h \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ fontmisc.h \
+ util.h \
+ fontfcn.h
+
+$(objdir)/objects.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ paths.h \
+ regions.h \
+ fonts.h \
+ pictures.h \
+ strokes.h \
+ cluts.h
+
+$(objdir)/ps2pk.obj: \
+ basics.h \
+ filenames.h \
+ psearch.h \
+ pkout.h \
+ ffilest.h \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ Xstuff.h \
+ fontmisc.h \
+ fontstruct.h \
+ font.h \
+ fsmasks.h \
+ fontfile.h \
+ fontxlfd.h
+
+$(objdir)/basename.obj: \
+ basics.h \
+ filenames.h
+
+$(objdir)/pkout.obj: \
+ basics.h \
+ pkout.h
+
+$(objdir)/regions.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ regions.h \
+ paths.h \
+ curves.h \
+ lines.h \
+ pictures.h \
+ fonts.h \
+ hints.h \
+ strokes.h
+
+$(objdir)/util.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ util.h \
+ fontmisc.h
+
+$(objdir)/flisearch.obj: \
+ basics.h \
+ filenames.h \
+ psearch.h
+
+$(objdir)/scanfont.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ t1stdio.h \
+ util.h \
+ token.h \
+ fontfcn.h \
+ blues.h
+
+$(objdir)/encoding.obj: \
+ basics.h
+
+$(objdir)/t1info.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ ffilest.h \
+ Xstuff.h \
+ fontmisc.h \
+ fontstruct.h \
+ font.h \
+ fsmasks.h \
+ fontfile.h \
+ fontxlfd.h \
+ t1intf.h
+
+$(objdir)/paths.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ paths.h \
+ regions.h \
+ fonts.h \
+ pictures.h \
+ strokes.h \
+ trig.h
+
+$(objdir)/texfiles.obj: \
+ texfiles.h
+
+$(objdir)/t1funcs.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ ffilest.h \
+ Xstuff.h \
+ fontmisc.h \
+ fontstruct.h \
+ font.h \
+ fsmasks.h \
+ fontfile.h \
+ fontxlfd.h \
+ t1intf.h \
+ objects.h \
+ spaces.h \
+ regions.h \
+ t1stdio.h \
+ util.h \
+ fontfcn.h
+
+$(objdir)/bstring.obj: \
+ c-auto.h
+
+$(objdir)/spaces.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ paths.h \
+ pictures.h \
+ fonts.h \
+ arith.h \
+ trig.h
+
+$(objdir)/t1test.obj: \
+ ffilest.h \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ Xstuff.h \
+ fontmisc.h \
+ fontstruct.h \
+ font.h \
+ fsmasks.h \
+ fontfile.h \
+ fontxlfd.h
+
+$(objdir)/lines.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ regions.h \
+ lines.h
+
+$(objdir)/type1.obj: \
+ types.h \
+ $(kpathseadir)/kpathsea.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)/absolute.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-dir.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-namemx.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-stat.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/cnf.h \
+ $(kpathseadir)/concatn.h \
+ $(kpathseadir)/db.h \
+ $(kpathseadir)/str-list.h \
+ $(kpathseadir)/default.h \
+ $(kpathseadir)/expand.h \
+ $(kpathseadir)/fn.h \
+ $(kpathseadir)/fontmap.h \
+ $(kpathseadir)/hash.h \
+ $(kpathseadir)/getopt.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/magstep.h \
+ $(kpathseadir)/paths.h \
+ $(kpathseadir)/pathsearch.h \
+ $(kpathseadir)/str-llist.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/remote.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/tex-glyph.h \
+ $(kpathseadir)/tex-hush.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/tilde.h \
+ $(kpathseadir)/truncate.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/xopendir.h \
+ $(kpathseadir)/xstat.h \
+ c-auto.h \
+ objects.h \
+ spaces.h \
+ paths.h \
+ fonts.h \
+ pictures.h \
+ util.h \
+ blues.h
+
+$(objdir)/basics.obj: \
+ $(gnuw32dir)/win32lib.h
+
+$(objdir)/pkin.obj: \
+ basics.h \
+ pkin.h
+
diff --git a/Build/source/texk/ps2pkm/depend.mk b/Build/source/texk/ps2pkm/depend.mk
new file mode 100644
index 00000000000..d7d68ed8af9
--- /dev/null
+++ b/Build/source/texk/ps2pkm/depend.mk
@@ -0,0 +1,633 @@
+arith.o: arith.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h arith.h
+basename.o: basename.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h filenames.h
+basics.o: basics.c
+bstring.o: bstring.c c-auto.h
+curves.o: curves.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h paths.h regions.h curves.h lines.h arith.h
+encoding.o: encoding.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h
+filenames.o: filenames.c \
+ $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h \
+ $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h \
+ $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h $(kpathsea_srcdir)/db.h \
+ $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h $(kpathsea_srcdir)/expand.h \
+ $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h $(kpathsea_srcdir)/hash.h \
+ $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h $(kpathsea_srcdir)/magstep.h \
+ $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h $(kpathsea_srcdir)/str-llist.h \
+ $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h $(kpathsea_srcdir)/tex-file.h \
+ $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h $(kpathsea_srcdir)/tex-make.h \
+ $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h $(kpathsea_srcdir)/variable.h \
+ $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h c-auto.h basics.h
+flisearch.o: flisearch.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h filenames.h \
+ psearch.h
+fontfcn.o: fontfcn.c \
+ t1imager.h types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h fontmisc.h util.h fontfcn.h
+hints.o: hints.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h paths.h regions.h hints.h
+lines.o: lines.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h regions.h lines.h
+mag.o: mag.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h
+objects.o: objects.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h paths.h regions.h fonts.h pictures.h \
+ strokes.h cluts.h
+paths.o: paths.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h paths.h regions.h fonts.h pictures.h \
+ strokes.h trig.h
+pfb2pfa.o: pfb2pfa.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h filenames.h
+pk2bm.o: pk2bm.c \
+ pkin.h
+pkin.o: pkin.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h pkin.h
+pkout.o: pkout.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h pkout.h
+pktest.o: pktest.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h pkout.h
+ps2pk.o: ps2pk.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h \
+ filenames.h psearch.h \
+ pkout.h ffilest.h types.h $(kpathsea_srcdir)/kpathsea.h $(kpathsea_srcdir)/absolute.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathmx.h $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ Xstuff.h fontmisc.h fontstruct.h font.h fsmasks.h fontfile.h fontxlfd.h
+psearch.o: psearch.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h strexpr.h \
+ filenames.h texfiles.h
+regions.o: regions.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h regions.h paths.h curves.h lines.h \
+ pictures.h fonts.h hints.h strokes.h
+scanfont.o: scanfont.c \
+ types.h \
+ $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h t1stdio.h util.h token.h fontfcn.h blues.h
+sexpr.o: sexpr.c \
+ strexpr.h \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h
+spaces.o: spaces.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h paths.h pictures.h fonts.h arith.h trig.h
+strexpr.o: strexpr.c \
+ basics.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)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h \
+ c-auto.h
+t1funcs.o: t1funcs.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h ffilest.h Xstuff.h fontmisc.h fontstruct.h font.h fsmasks.h \
+ fontfile.h fontxlfd.h t1intf.h objects.h spaces.h regions.h t1stdio.h \
+ util.h fontfcn.h
+t1info.o: t1info.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h ffilest.h Xstuff.h fontmisc.h fontstruct.h font.h fsmasks.h \
+ fontfile.h fontxlfd.h t1intf.h
+t1io.o: t1io.c c-auto.h \
+ t1stdio.h \
+ types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h \
+ $(kpathsea_srcdir)/c-pathmx.h $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h \
+ $(kpathsea_srcdir)/concatn.h $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h \
+ $(kpathsea_srcdir)/default.h $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h \
+ $(kpathsea_srcdir)/fontmap.h $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h \
+ $(kpathsea_srcdir)/line.h $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h \
+ $(kpathsea_srcdir)/pathsearch.h $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h \
+ $(kpathsea_srcdir)/readable.h $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-hush.h $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h \
+ $(kpathsea_srcdir)/truncate.h $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h \
+ $(kpathsea_srcdir)/xstat.h t1hdigit.h
+t1snap.o: t1snap.c objects.h types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h spaces.h paths.h
+t1stub.o: t1stub.c objects.h types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h
+t1test.o: t1test.c \
+ ffilest.h types.h \
+ $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h Xstuff.h fontmisc.h fontstruct.h font.h fsmasks.h fontfile.h \
+ fontxlfd.h
+texfiles.o: texfiles.c \
+ texfiles.h
+token.o: token.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h t1stdio.h util.h digit.h token.h tokst.h hdigit.h
+type1.o: type1.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h objects.h spaces.h paths.h fonts.h pictures.h util.h blues.h
+util.o: util.c types.h $(kpathsea_srcdir)/kpathsea.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)/absolute.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/c-dir.h \
+ $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-namemx.h $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/c-stat.h \
+ $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/cnf.h $(kpathsea_srcdir)/concatn.h \
+ $(kpathsea_srcdir)/db.h $(kpathsea_srcdir)/str-list.h $(kpathsea_srcdir)/default.h \
+ $(kpathsea_srcdir)/expand.h $(kpathsea_srcdir)/fn.h $(kpathsea_srcdir)/fontmap.h \
+ $(kpathsea_srcdir)/hash.h $(kpathsea_srcdir)/getopt.h $(kpathsea_srcdir)/line.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_dir)/paths.h $(kpathsea_srcdir)/pathsearch.h \
+ $(kpathsea_srcdir)/str-llist.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/readable.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-hush.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/tilde.h $(kpathsea_srcdir)/truncate.h \
+ $(kpathsea_srcdir)/variable.h $(kpathsea_srcdir)/xopendir.h $(kpathsea_srcdir)/xstat.h \
+ c-auto.h util.h fontmisc.h
diff --git a/Build/source/texk/ps2pkm/digit.h b/Build/source/texk/ps2pkm/digit.h
new file mode 100644
index 00000000000..4ed89c765c3
--- /dev/null
+++ b/Build/source/texk/ps2pkm/digit.h
@@ -0,0 +1,64 @@
+/* $XConsortium: digit.h,v 1.2 91/10/10 11:18:01 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* -------------------------------------- */
+/* --- MACHINE GENERATED, DO NOT EDIT --- */
+/* -------------------------------------- */
+
+#ifndef DIGIT
+#define DIGIT 1
+
+/*
+ * Digit Value Table --
+ *
+ * The entries in the Digit Value Table map character
+ * codes in the set {0-9,a-z,A-Z} to their numeric
+ * values as part of numbers of radix 2-36.
+ *
+ */
+unsigned char digit_value[256] = {
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
+ 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
+ 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
+};
+
+#endif
diff --git a/Build/source/texk/ps2pkm/encoding.c b/Build/source/texk/ps2pkm/encoding.c
new file mode 100644
index 00000000000..df03bac94ce
--- /dev/null
+++ b/Build/source/texk/ps2pkm/encoding.c
@@ -0,0 +1,356 @@
+/* MODULE encoding (encoding.c)
+ * interface: typedef char *encoding[256];
+ * void getenc(
+ * char **fontname, **encname,
+ * ( foundry name of font and name of this encoding )
+ * encoding ev, output encoding
+ * int width[256]); output widths
+ *
+ * depends on: MODULEs binary_table, strings
+ * <ctype.h>
+ * <stdio.h>
+ * <stdlib.h>
+ * <string.h>
+ *
+ * globals: void fatal();
+ *
+ * Author: Piet Tutelaers
+ * Version 1.3 (August 1992)
+ * Version 1.4 (December 1993)
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "basics.h"
+
+char *my_string(char *);
+void remove_string();
+void addcc(char *name, int charcode);
+int getcc(char *name);
+void initcc();
+
+extern char *encfile, *afmfile;
+
+/* return a pointer to first non space character after occurence of string t,
+ * the scan starts at pointer s
+ */
+static char *value_after(char *s, char *t)
+{ int l;
+ l = strlen(t);
+ for (;;) {
+ while (*s != *t && *s != '\n') s++;
+ if (*s == '\n') return NULL;
+ if (strncmp(s, t, l) == 0) break;
+ s++;
+ }
+ s += l;
+ while (isspace(*s)) s++;
+ return s;
+}
+
+int decimal(char *s)
+{ int sign = 1, d = 0;
+
+ while (isspace(*s)) s++;
+ if (*s == '-') { sign = -1; s++; }
+ while (isdigit(*s)) { d = d * 10 + (*s - '0'); s++; }
+ return sign*d;
+}
+
+/* Nextsymbol() reads lines from enc until a '[', '/' or a ']' is
+ * encountered. In that case pline points to the character following
+ * this symbol otherwise a fatal error is generated.
+ */
+
+FILE *enc;
+
+#define LINEBUF 1024
+char line[LINEBUF], *pline = NULL;
+
+char nextsymbol()
+{
+ for (;;) {
+ if (pline == NULL) {
+ if (fgets(line, LINEBUF-1, enc) == NULL)
+ fatal("unexpected EOF while reading %s\n", encfile);
+ pline = line;
+ }
+ if (*pline == '[' || *pline == ']' || *pline == '/') break;
+ if (*pline == '%' || *pline == '\n' || *pline == '\0')
+ { pline = NULL;
+ continue;
+ }
+ pline++;
+ }
+ pline++; return *(pline-1);
+}
+
+char *nextpsname()
+{ int i = 0;
+ char the_nextname[MAXSTRLEN], *name;
+
+ for (;;) {
+ if (pline == NULL) {
+ if (fgets(line, LINEBUF-1, enc) == NULL)
+ fatal("unexpected EOF while reading %s\n", encfile);
+ pline = line;
+ }
+ if (*pline == '%' || *pline == '\n' || *pline == '\0')
+ { pline = NULL;
+ continue;
+ }
+ if (isspace(*pline)) {
+ pline++;
+ continue;
+ }
+ if (!isalpha(*pline)) fatal("invalid name in %s\n", encfile);
+ /* pt981009: added '_' Staszek Wawrykiewicz <staw@gust.org.pl> */
+ while (isalnum(*pline) || *pline == '-' || *pline == '_') {
+ if (i > MAXSTRLEN-2)
+ fatal("name too long in %s (%s)\n", line, encfile);
+ the_nextname[i++] = *pline++;
+ }
+ the_nextname[i] = '\0';
+ name = malloc(i+1);
+ if (name == NULL) fatal("Out of memory\n");
+ strcpy(name, the_nextname);
+ break;
+ }
+ /* pt981009: removed pline++ Staszek Wawrykiewicz <staw@gust.org.pl> */
+ return name;
+}
+
+typedef char *encoding[256];
+
+void getenc(char **fontname, char **encname, encoding ev, int width[256])
+{ int i, len, SCMseen, Ccnt, wx, cc;
+ FILE *afm;
+ char *name, ns;
+
+ for (i=0; i < 256; i++) { ev[i] = NULL; width[i] = -1000; }
+ if (encfile) {
+ enc = fopen(encfile, "r");
+ if (enc == NULL) fatal("Can't open %s\n", encfile);
+ if (nextsymbol() != '/') fatal("missing '/encoding' in %s\n", encfile);
+ *encname = nextpsname();
+ if (nextsymbol() != '[') fatal("missing '[' in %s\n", encfile);
+ i = 0;
+ while (i < 256 && (ns = nextsymbol()) == '/') {
+ name = my_string(pline);
+ if (strcmp(name, ".notdef") == 0) {
+ i++; remove_string();
+ continue;
+ }
+ addcc(name, i++);
+ }
+ if (i != 256) fatal("missing %d symbols in %s\n", 256-i, encfile);
+ if (nextsymbol() != ']') fatal("missing ']' in %s\n", encfile);
+ fclose(enc);
+ }
+ afm = fopen(afmfile, "r");
+ if (afm == NULL) fatal("Can't open %s\n", afmfile);
+ /*
+ * Scan header of AFM file and take the FontName and EncodingScheme
+ * (used for identification purposes in the PK postamble)
+ * Stop after reading `StartCharMetrics'.
+ */
+ SCMseen = 0; Ccnt = 0;
+ while (fgets(line, LINEBUF-1, afm)) {
+ if (strncmp(line, "FontName", 8) == 0) {
+ pline = value_after(line, "FontName");
+ len = strlen(pline);
+ if (*(pline+len-1) == '\n') {
+ *(pline+len-1) = '\0'; len--;
+ }
+ *fontname = malloc(len + 1);
+ if (*fontname == NULL) fatal("Out of memory\n");
+ strcpy(*fontname, pline);
+ }
+ else if (encname == NULL && strncmp(line, "EncodingScheme", 8) == 0) {
+ pline = value_after(line, "EncodingScheme");
+ len = strlen(pline);
+ if (*(pline+len-1) == '\n') {
+ *(pline+len-1) = '\0'; len--;
+ }
+ *encname = malloc(len + 1);
+ if (*encname == NULL) fatal("Out of memory\n");
+ strcpy(*encname, pline);
+ }
+ else if (strncmp(line, "StartCharMetrics", 16) == 0) {
+ SCMseen = 1; break;
+ }
+ }
+ if (SCMseen == 0) fatal("%s: no metrics info\n", afmfile);
+ while (fgets(line, LINEBUF-1, afm)) {
+ if (strncmp(line, "EndCharMetrics", 14) == 0) break;
+ if (strncmp(line, "C ", 2) != 0)
+ fatal("%s: unexpected line\n", afmfile);
+
+ /* Gracefully terminate when the AFM file is not valid. Every line */
+ /* in the AFM file should specify a "C"haracter, a "WX"idth, and */
+ /* a "N"ame. (ndw)
+ */
+ pline = value_after(line, "C");
+ if (pline == NULL)
+ fatal("\nBad char metric in %s (no char):\n\t %s\n", afmfile, line);
+ cc = decimal(pline);
+ pline = value_after(pline, "WX");
+ if (pline == NULL)
+ fatal("\nBad char metric in %s (no width):\n\t %s\n", afmfile, line);
+ wx = decimal(pline);
+ pline = value_after(pline, "N");
+ if (pline == NULL)
+ fatal("\nBad char metric in %s (no name):\n\t %s\n", afmfile, line);
+ name = my_string(pline);
+
+ if (encfile) {
+ if ((i = getcc(name)) == -1) {
+ remove_string();
+ continue;
+ }
+ do { /* allow more occurences per name */
+ ev[i] = name; width[i] = wx;
+ i = getcc(name);
+ }
+ while (i >= 0);
+ }
+ else if (cc >= 0 && cc <= 255) { /* ndw: 10/13/92 */
+ ev[cc] = name; width[cc] = wx;
+ }
+ else if (cc > 255)
+ msg("Char code %d ignored (out of range).\n", cc);
+ Ccnt++;
+ }
+ if (Ccnt == 0) fatal("%s: no characters selected\n", afmfile);
+}
+
+/* END MODULE encoding */
+
+/* MODULE binary_table
+ * depends on: MODULE string
+ * <stdlib.h>
+ * <string.h>
+ */
+
+/*
+ * TUG has accepted an extended font layout (EC.enc) where the hyphen
+ * occupies two positions ('055 and '177) to handle exeptional hyphenation
+ * situations (see TUGboat#11 1990 (no. 4) pp. 514).
+ * To handle this special case we allow two charcodes per symbol.
+ */
+
+/*
+ * Two functions for a binary search table. One to add a name and one
+ * to lookup a name. This table is used to store all encoding names and
+ * its corresponding charcode.
+ */
+
+struct Node
+{ char *name; /* pointer to a PostScript string */
+ short cc[2]; /* its charcode's (maximum of two) */
+ short left, right;
+} node[256];
+
+static int freenode = 0;
+static short root = -1;
+
+void addcc(char *name, int charcode)
+{ short r, p, q;
+
+ q = root;
+ while (q != -1) {
+ p = q; r = strcmp(name, node[p].name);
+ if (r == 0) {
+ if (node[p].cc[1] == -1) {
+ node[p].cc[1] = charcode;
+ return;
+ }
+ else
+ fatal("%s: more than two codes for %s (%d,%d,%d)\n",
+ encfile, name, node[p].cc[0], node[p].cc[1], charcode);
+ }
+ else if (r < 0) q=node[p].left;
+ else q=node[p].right;
+ }
+ if (freenode == 256)
+ fatal("%s: too many PostScript names\n", encfile);
+ /* not found hence insert */
+ node[freenode].name = name;
+ node[freenode].cc[0] = charcode;
+ node[freenode].cc[1] = -1;
+ node[freenode].left = node[freenode].right = -1;
+ if (root == -1)
+ root = freenode;
+ else {
+ if (r < 0) node[p].left=freenode;
+ else node[p].right=freenode;
+ }
+ freenode++;
+}
+
+int getcc(char *name)
+{ short r, p, q, cc;
+
+ q = root;
+ while (q != -1) {
+ p = q; r = strcmp(name, node[p].name);
+ if (r == 0) {
+ cc = node[p].cc[0];
+ node[p].cc[0] = node[p].cc[1];
+ node[p].cc[1] = -1;
+ return cc;
+ }
+ else if (r < 0) q = node[p].left;
+ else q = node[p].right;
+ }
+ return -1;
+}
+
+/* END MODULE binary_table */
+
+/* MODULE string:
+ * depends on: <ctype.h>
+ * <string.h>
+ */
+
+/* String() reads a string starting at a given character pointer.
+ * After removing leading whitespace the resulting string (with possible
+ * `.' and '_' characters) is stored in a stringpool after which a pointer
+ * to it is returned.
+ */
+
+#define POOLSIZE 10000
+static char stringpool[POOLSIZE];
+static int poolsize, /* occupied space annex free index */
+ lastpoolsize; /* previous poolsize */
+
+char *my_string(char *s)
+{ int length; char *str;
+
+ while (isspace(*s)) s++;
+ str = s; length = 0;
+ while (isalnum(*s) || *s == '.' || *s == '_') { length++; s++; }
+ if (length == 0) return NULL;
+ else {
+ if (length + 1 > POOLSIZE - poolsize)
+ fatal("Out of memory %s\n", s);
+ strncpy(stringpool+poolsize, str, length);
+ str = stringpool + poolsize;
+ s = stringpool + poolsize + length;
+ *s = '\0';
+ lastpoolsize = poolsize;
+ poolsize += length+1;
+ return str;
+ }
+}
+
+/* remove last string from stringpool */
+void remove_string()
+{
+ poolsize = lastpoolsize;
+}
+
+/* END MODULE string */
+
diff --git a/Build/source/texk/ps2pkm/ffilest.h b/Build/source/texk/ps2pkm/ffilest.h
new file mode 100644
index 00000000000..6a13d034088
--- /dev/null
+++ b/Build/source/texk/ps2pkm/ffilest.h
@@ -0,0 +1,151 @@
+/*
+ * $XConsortium: fontfilest.h,v 1.3 91/07/16 20:15:16 keith Exp $
+ *
+ * Copyright 1991 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. M.I.T. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTFILEST_H_
+#define _FONTFILEST_H_
+
+#ifdef XSERVER
+#include <X11/Xos.h>
+#else
+#include "types.h"
+#include "Xstuff.h"
+#endif
+
+#include "fontmisc.h"
+#include "fontstruct.h"
+#include "fontfile.h"
+#include "fontxlfd.h"
+
+typedef struct _FontName {
+ char *name;
+ short length;
+ short ndashes;
+} FontNameRec;
+
+typedef struct _FontScaled {
+ FontScalableRec vals;
+ FontEntryPtr bitmap;
+ FontPtr pFont;
+} FontScaledRec;
+
+typedef struct _FontScalableExtra {
+ FontScalableRec defaults;
+ int numScaled;
+ int sizeScaled;
+ FontScaledPtr scaled;
+ pointer private;
+} FontScalableExtraRec;
+
+typedef struct _FontScalableEntry {
+ FontRendererPtr renderer;
+ char *fileName;
+ FontScalableExtraPtr extra;
+} FontScalableEntryRec;
+
+/*
+ * This "can't" work yet - the returned alias string must be permanent,
+ * but this layer would need to generate the appropriate name from the
+ * resolved scalable + the XLFD values passed in. XXX
+ */
+
+typedef struct _FontScaleAliasEntry {
+ char *resolved;
+} FontScaleAliasEntryRec;
+
+typedef struct _FontBitmapEntry {
+ FontRendererPtr renderer;
+ char *fileName;
+ FontPtr pFont;
+} FontBitmapEntryRec;
+
+typedef struct _FontAliasEntry {
+ char *resolved;
+} FontAliasEntryRec;
+
+typedef struct _FontBCEntry {
+ FontScalableRec vals;
+ FontEntryPtr entry;
+} FontBCEntryRec;
+
+typedef struct _FontEntry {
+ FontNameRec name;
+ int type;
+ union _FontEntryParts {
+ FontScalableEntryRec scalable;
+ FontBitmapEntryRec bitmap;
+ FontAliasEntryRec alias;
+ FontBCEntryRec bc;
+ } u;
+} FontEntryRec;
+
+typedef struct _FontTable {
+ int used;
+ int size;
+ FontEntryPtr entries;
+ Bool sorted;
+} FontTableRec;
+
+typedef struct _FontDirectory {
+ char *directory;
+ ULONG dir_mtime;
+ ULONG alias_mtime;
+ FontTableRec scalable;
+ FontTableRec nonScalable;
+} FontDirectoryRec;
+
+typedef struct _FontRenderer {
+ char *fileSuffix;
+ int fileSuffixLen;
+ int (*OpenBitmap)(/* fpe, pFont, flags, entry, fileName, format, fmask */);
+ int (*OpenScalable)(/* fpe, pFont, flags, entry, fileName, vals, format, fmask */);
+ int (*GetInfoBitmap)(/* fpe, pFontInfo, entry, fileName */);
+ int (*GetInfoScalable)(/* fpe, pFontInfo, entry, fileName, vals */);
+ int number;
+} FontRendererRec;
+
+typedef struct _FontRenders {
+ int number;
+ FontRendererPtr *renderers;
+} FontRenderersRec, *FontRenderersPtr;
+
+typedef struct _BitmapInstance {
+ FontScalableRec vals;
+ FontBitmapEntryPtr bitmap;
+} BitmapInstanceRec, *BitmapInstancePtr;
+
+typedef struct _BitmapScalablePrivate {
+ int numInstances;
+ BitmapInstancePtr instances;
+} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr;
+
+typedef struct _BitmapSources {
+ FontPathElementPtr *fpe;
+ int size;
+ int count;
+} BitmapSourcesRec, *BitmapSourcesPtr;
+
+extern BitmapSourcesRec FontFileBitmapSources;
+
+#endif /* _FONTFILEST_H_ */
diff --git a/Build/source/texk/ps2pkm/filenames.c b/Build/source/texk/ps2pkm/filenames.c
new file mode 100644
index 00000000000..bc4934d7150
--- /dev/null
+++ b/Build/source/texk/ps2pkm/filenames.c
@@ -0,0 +1,128 @@
+/* FILE: filenames.c
+ * PURPOSE: some handy functions for working with TeXfiles
+ * AUTHOR: Piet Tutelaers (internet: rcpt@urc.tue.nl)
+ * VERSION: 1.3 (August 1992)
+ * VERSION: 1.4 (January 1994)
+ * VERSION: 1.5 (September 1995)
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#ifdef KPATHSEA
+#include <kpathsea/kpathsea.h>
+#include <c-auto.h>
+#endif
+
+#include "basics.h" /* basic definitions and fatal() */
+
+/* for those systems that don't provide an ANSI strchr() */
+static char *charptr(char *name, char c)
+{
+ while (*name != c && *name != '\0') name++;
+ if (*name == '\0') return NULL;
+ else return name;
+}
+
+/* comparing names (system dependant) */
+int equal(char *s, char *t)
+{
+# ifndef UNIX
+ while (tolower(*s) == tolower(*t)) {
+ if (*s == '\0') break;
+ s++; t++;
+ }
+# else
+ while (*s == *t) {
+ if (*s == '\0' || *t == '\0') break;
+ s++; t++;
+ }
+# endif
+ if (*s == '\0' && *t == '\0') return 1;
+ else return 0;
+}
+
+/*
+ * Determine the extension
+ */
+char *extension(char *str) {
+ char *p, *base;
+ for (p = base = str; *p; ++p)
+ /* if (*p++ == DIRSEP) base = p; */
+ if (IS_DIR_SEP(*p)) base = p + 1;
+ for (p = base ; *p; p++)
+ if (*p == '.') break;
+ return p;
+}
+
+/*
+ * Construct filename by replacing the current extension (if available)
+ * with supplied one.
+ */
+char *newname(char *name, char *ext)
+{
+ char *e, *nn; int len1, len2;
+
+ e = extension(name);
+ if (equal(ext, e)) return name;
+ len1 = strlen(name) - strlen(e);
+ len2 = len1 + strlen(ext) + 1;
+ nn = (char *) malloc(len2);
+ if (nn == NULL) fatal("Out of memory\n");
+ strncpy(nn, name, len1);
+ strcpy(nn+len1, ext);
+ return nn;
+}
+
+/*
+ * Derived from BSD basename
+ */
+char *basename(char *str, char *suffix){
+ char *p, *t; int len = 0;
+ char *base;
+
+ printf("basename of %s = ", str);
+#ifdef KPATHSEA
+ for (p = base = (NAME_BEGINS_WITH_DEVICE(str) ? str+2 : str);
+ *p; p++) {
+#else
+ for (p = base = str; *p; p++) {
+#endif
+ /* if (*p++ == DIRSEP) { base = p; len = 0; } */
+ if (IS_DIR_SEP(*p)) { base = p+1; len = 0; }
+ else len++;
+ }
+ printf("%s\n", base);
+ if (suffix != NULL) {
+ for (t = suffix; *t; ++t);
+ do {
+ len--; t--; p--;
+ if (*t != *p) break;
+ if (t == suffix) { char *bn;
+ if (len == 0) return NULL;
+ bn = malloc(len+1);
+ if (bn == NULL) fatal("Out of memory\n");
+ strncpy(bn, base, len);
+ *(bn+len) = '\0'; /* RA */
+ return bn;
+ }
+ } while (p > base);
+ }
+ return base;
+}
+
+/*
+ * Return true if name can be the name of a PostScript resource
+ * (no extension and no absolute pathname).
+ */
+int ps_resource(char *name) {
+ if (charptr(name, '.')) return 0 ;
+#ifdef KPATHSEA
+ if (kpse_absolute_p(name, true)) return 0;
+#else
+ if (charptr(name, DIRSEP)) return 0 ;
+#endif
+ return 1;
+}
diff --git a/Build/source/texk/ps2pkm/filenames.h b/Build/source/texk/ps2pkm/filenames.h
new file mode 100644
index 00000000000..5d4b897a0a0
--- /dev/null
+++ b/Build/source/texk/ps2pkm/filenames.h
@@ -0,0 +1,30 @@
+/* FILE: filenames.h
+ * PURPOSE: functions for handling file names
+ * VERSION: 1.3 (August 1992)
+ * VERSION: 1.4 (January 1994)
+ * VERSION: 1.5 (September 1995)
+ */
+
+/*
+ * Determine extension of <str>.
+ */
+char *extension(char *str);
+
+/*
+ * Basename is the functional equivalent of BSD's basename utility.
+ * When the suffix is NULL no suffix removal is done. When needed
+ * a new string is allocated so that the original value of str is
+ * not changed.
+ */
+char *basename(char *str, char *suffix);
+
+/*
+ * Newname builds a new filename by adding or replacing the extension
+ * of the given <name> with the new supplied <ext>.
+ */
+char *newname(char *name, char *ext);
+
+/*
+ * ps_resource returns true if name can be treated as a PS resource
+ */
+int ps_resource(char *name);
diff --git a/Build/source/texk/ps2pkm/flisearch.c b/Build/source/texk/ps2pkm/flisearch.c
new file mode 100644
index 00000000000..e196f6f1e29
--- /dev/null
+++ b/Build/source/texk/ps2pkm/flisearch.c
@@ -0,0 +1,42 @@
+/*
+ * FILE: psearch.c
+ * PURPOSE: search files through possible recursive path
+ * VERSION: 1.0 (Oct. 1995)
+ * AUTHOR: Piet Tutelaers
+ */
+
+#include <stdio.h>
+#include <string.h> /* strcmp() */
+#include "basics.h" /* fatal(), msg() */
+#include "filenames.h" /* */
+#include "psearch.h" /* search_flipath() */
+
+char *fontname; int dpi, margin = 0;
+
+int main(int argc, char *argv[]) {
+ char *path, *file, *fn;
+ int matching(char *, int);
+
+ /* get path and file arguments */
+ if (argc != 4) fatal("Usage: psearch path fontname dpi\n");
+ path = argv[1]; fontname = argv[2]; dpi = atoi(argv[3]);
+
+ /* find <file> in <path> */
+ fn = search_flipath(path, matching);
+ if (fn == NULL) msg("%s at %d dpi not found\n", fontname, dpi);
+ else msg("%s: %s at %d dpi found\n", fn, fontname, dpi);
+ exit(0);
+}
+
+/*
+ * Function used to search for one single font in FLI path
+ */
+int matching(char *font, int size) {
+
+ if ((strcmp(font, fontname) == 0) && (size == dpi ||
+ (size >= dpi - margin && size <= dpi+margin)))
+ return 1;
+ else
+ return 0;
+}
+
diff --git a/Build/source/texk/ps2pkm/font.h b/Build/source/texk/ps2pkm/font.h
new file mode 100644
index 00000000000..8de6e908f31
--- /dev/null
+++ b/Build/source/texk/ps2pkm/font.h
@@ -0,0 +1,107 @@
+/* $XConsortium: font.h,v 1.8 91/07/19 21:03:49 rws Exp $ */
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* $NCDId: @(#)font.h,v 1.7 1991/06/24 17:00:23 lemke Exp $ */
+
+#ifndef FONT_H
+#define FONT_H
+
+#ifndef BitmapFormatByteOrderMask
+#include "fsmasks.h"
+#endif
+
+/* data structures */
+typedef struct _Font *FontPtr;
+typedef struct _FontInfo *FontInfoPtr;
+typedef struct _FontProp *FontPropPtr;
+typedef struct _ExtentInfo *ExtentInfoPtr;
+typedef struct _FontPathElement *FontPathElementPtr;
+typedef struct _CharInfo *CharInfoPtr;
+typedef struct _FontNames *FontNamesPtr;
+typedef struct _FontResolution *FontResolutionPtr;
+
+#define NullCharInfo ((CharInfoPtr) 0)
+#define NullFont ((FontPtr) 0)
+#define NullFontInfo ((FontInfoPtr) 0)
+
+ /* draw direction */
+#define LeftToRight 0
+#define RightToLeft 1
+#define BottomToTop 2
+#define TopToBottom 3
+typedef int DrawDirection;
+
+#define NO_SUCH_CHAR -1
+
+
+#define FontAliasType 0x1000
+
+#define AllocError 80
+#define StillWorking 81
+#define FontNameAlias 82
+#define BadFontName 83
+#define Suspended 84
+#define Successful 85
+#define BadFontPath 86
+#define BadCharRange 87
+#define BadFontFormat 88
+#define FPEResetFailed 89 /* for when an FPE reset won't work */
+
+/* OpenFont flags */
+#define FontLoadInfo 0x0001
+#define FontLoadProps 0x0002
+#define FontLoadMetrics 0x0004
+#define FontLoadBitmaps 0x0008
+#define FontLoadAll 0x000f
+#define FontOpenSync 0x0010
+
+/* Query flags */
+#define LoadAll 0x1
+#define FinishRamge 0x2
+#define EightBitFont 0x4
+#define SixteenBitFont 0x8
+
+typedef char *closure;
+
+extern int StartListFontsWithInfo( /* client, length, pattern, maxNames */ );
+extern int ListFonts( /* client, length, pattern, maxNames */ );
+
+extern FontNamesPtr MakeFontNamesRecord( /* size */ );
+extern void FreeFontNames();
+extern int AddFontNamesName();
+
+extern int FontToFSError();
+
+extern FontResolutionPtr GetClientResolution();
+
+typedef struct _FontPatternCache *FontPatternCachePtr;
+
+extern FontPatternCachePtr MakeFontPatternCache ();
+extern void FreeFontPatternCache ();
+extern void EmtpyFontPatternCache ();
+extern void CacheFontPattern ();
+extern FontPtr FindCachedFontPattern ();
+extern void RemoveCachedFontPattern ();
+
+#endif /* FONT_H */
diff --git a/Build/source/texk/ps2pkm/fontfcn.c b/Build/source/texk/ps2pkm/fontfcn.c
new file mode 100644
index 00000000000..17423b3745a
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fontfcn.c
@@ -0,0 +1,310 @@
+/* $XConsortium: fontfcn.c,v 1.8 92/03/27 18:15:45 eswu Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
+
+#include <stdio.h>
+#include <string.h>
+#include "t1imager.h"
+#include "util.h"
+#include "fontfcn.h"
+#include "fontmisc.h"
+
+#ifdef HAVE_PROTOTYPES
+extern void objFormatName(psobj *, int, char *);
+#endif
+
+extern xobject Type1Char();
+extern boolean Init_BuiltInEncoding();
+
+/***================================================================***/
+/* GLOBALS */
+/***================================================================***/
+char CurFontName[120];
+char *CurFontEnv;
+char *vm_base = NULL;
+psfont *FontP = NULL;
+psfont TheCurrentFont;
+
+
+/***================================================================***/
+/* SearchDict - look for name */
+/* - compare for match on len and string */
+/* return 0 - not found. */
+/* return n - nth element in dictionary. */
+/***================================================================***/
+int SearchDictName(dictP,keyP)
+ psdict *dictP;
+ psobj *keyP;
+{
+ int i,n;
+
+
+ n = dictP[0].key.len;
+ for (i=1;i<=n;i++) { /* scan the intire dictionary */
+ if (
+ (dictP[i].key.len == keyP->len )
+ &&
+ (strncmp(dictP[i].key.data.valueP,
+ keyP->data.valueP,
+ keyP->len) == 0
+ )
+ ) return(i);
+ }
+ return(0);
+}
+/***================================================================***/
+boolean initFont()
+{
+
+ if (!(vm_init())) return(FALSE);
+ vm_base = vm_next_byte();
+ if (!(Init_BuiltInEncoding())) return(FALSE);
+ strcpy(CurFontName, ""); /* iniitialize to none */
+ FontP = &TheCurrentFont;
+ FontP->vm_start = vm_next_byte();
+ FontP->FontFileName.len = 0;
+ FontP->FontFileName.data.valueP = CurFontName;
+ return(TRUE);
+}
+/***================================================================***/
+void resetFont(env)
+char *env;
+{
+
+ vm_next = FontP->vm_start;
+ vm_free = vm_size - ( vm_next - vm_base);
+ FontP->Subrs.len = 0;
+ FontP->Subrs.data.stringP = NULL;
+ FontP->CharStringsP = NULL;
+ FontP->Private = NULL;
+ FontP->fontInfoP = NULL;
+ FontP->BluesP = NULL;
+ /* This will load the font into the FontP */
+ strcpy(CurFontName,env);
+ FontP->FontFileName.len = strlen(CurFontName);
+ FontP->FontFileName.data.valueP = CurFontName;
+
+}
+/***================================================================***/
+/* Read font used to attempt to load the font and, upon failure,
+ try a second time with twice as much memory. Unfortunately, if
+ it's a really complex font, simply using 2*vm_size may be insufficient.
+ I've modified it so that the program will try progressively larger
+ amounts of memory until it really runs out or the font loads
+ successfully. (ndw)
+*/
+int readFont(env)
+char *env;
+{
+ int rcode;
+
+ /* restore the virtual memory and eliminate old font */
+ resetFont(env);
+ /* This will load the font into the FontP */
+ rcode = scan_font(FontP);
+ return(rcode);
+}
+/***================================================================***/
+xobject fontfcnB(S,code,lenP,mode)
+XYspace S;
+unsigned char *code;
+int *lenP;
+int *mode;
+{
+#if 0
+ path updateWidth();
+#endif
+ psobj *charnameP; /* points to psobj that is name of character*/
+ int N;
+ psdict *CharStringsDictP; /* dictionary with char strings */
+ psobj CodeName; /* used to store the translation of the name*/
+ psobj *SubrsArrayP;
+ psobj *theStringP;
+
+ path charpath; /* the path for this character */
+
+ charnameP = &CodeName;
+ charnameP->len = *lenP;
+ charnameP->data.stringP = code;
+
+ CharStringsDictP = FontP->CharStringsP;
+
+ /* search the chars string for this charname as key */
+ N = SearchDictName(CharStringsDictP,charnameP);
+ if (N<=0) {
+ *mode = FF_PARSE_ERROR;
+ return(NULL);
+ }
+ /* ok, the nth item is the psobj that is the string for this char */
+ theStringP = &(CharStringsDictP[N].value);
+
+ /* get the dictionary pointers to the Subrs */
+
+ SubrsArrayP = &(FontP->Subrs);
+ /* scale the Adobe fonts to 1 unit high */
+ S = Permanent(Scale(S, 1.0 , 1.0));
+ /* call the type 1 routine to rasterize the character */
+ charpath = Type1Char(FontP,S,theStringP,SubrsArrayP,NULL,
+ FontP->BluesP , mode);
+ Destroy(S);
+ /* if Type1Char reported an error, then return */
+ if ( *mode == FF_PARSE_ERROR) return(NULL);
+ /* fill with winding rule unless path was requested */
+ if (*mode != FF_PATH) {
+ charpath = Interior(charpath,WINDINGRULE+CONTINUITY);
+ }
+ return(charpath);
+}
+/***================================================================***/
+/* fontfcnA(env, mode) */
+/* */
+/* env is a pointer to a string that contains the fontname. */
+/* */
+/* 1) initialize the font - global indicates it has been done */
+/* 2) load the font */
+/***================================================================***/
+Bool fontfcnA(env,mode)
+char *env;
+int *mode;
+{
+ int rc;
+
+ /* Has the FontP initialized? If not, then */
+ /* Initialize */
+ if (FontP == NULL) {
+ InitImager();
+ if (!(initFont())) {
+ /* we are really out of memory */
+ *mode = SCAN_OUT_OF_MEMORY;
+ return(FALSE);
+ }
+ }
+
+ /* if the env is null, then use font already loaded */
+
+ /* if the not same font name */
+ if ( (env) && (strcmp(env,CurFontName) != 0 ) ) {
+ /* restore the virtual memory and eliminate old font, read new one */
+ rc = readFont(env);
+ if (rc != 0 ) {
+ strcpy(CurFontName, ""); /* no font loaded */
+ *mode = rc;
+ return(FALSE);
+ }
+ }
+ return(TRUE);
+
+}
+/***================================================================***/
+/* QueryFontLib(env, infoName,infoValue,rcodeP) */
+/* */
+/* env is a pointer to a string that contains the fontname. */
+/* */
+/* 1) initialize the font - global indicates it has been done */
+/* 2) load the font */
+/* 3) use the font to call getInfo for that value. */
+/***================================================================***/
+
+void QueryFontLib(env,infoName,infoValue,rcodeP)
+char *env;
+char *infoName;
+pointer infoValue; /* parameter returned here */
+int *rcodeP;
+{
+ int rc,N,i;
+ psdict *dictP;
+ psobj nameObj;
+ psobj *valueP;
+
+ /* Has the FontP initialized? If not, then */
+ /* Initialize */
+ if (FontP == NULL) {
+ InitImager();
+ if (!(initFont())) {
+ *rcodeP = 1;
+ return;
+ }
+ }
+ /* if the env is null, then use font already loaded */
+ /* if the not same font name, reset and load next font */
+ if ( (env) && (strcmp(env,CurFontName) != 0 ) ) {
+ /* restore the virtual memory and eliminate old font */
+ rc = readFont(env);
+ if (rc != 0 ) {
+ strcpy(CurFontName, ""); /* no font loaded */
+ *rcodeP = 1;
+ return;
+ }
+ }
+ dictP = FontP->fontInfoP;
+ objFormatName(&nameObj,strlen(infoName),infoName);
+ N = SearchDictName(dictP,&nameObj);
+ /* if found */
+ if ( N > 0 ) {
+ *rcodeP = 0;
+ switch (dictP[N].value.type) {
+ case OBJ_ARRAY:
+ valueP = dictP[N].value.data.arrayP;
+ if (strcmp(infoName,"FontMatrix") == 0) {
+ /* 6 elments, return them as floats */
+ for (i=0;i<6;i++) {
+ if (valueP->type == OBJ_INTEGER )
+ ((float *)infoValue)[i] = valueP->data.integer;
+ else
+ ((float *)infoValue)[i] = valueP->data.real;
+ valueP++;
+ }
+ }
+ if (strcmp(infoName,"FontBBox") == 0) {
+ /* 4 elments for Bounding Box. all integers */
+ for (i=0;i<4;i++) {
+ ((int *)infoValue)[i] = valueP->data.integer;
+ valueP++;
+ }
+ break;
+ case OBJ_INTEGER:
+ case OBJ_BOOLEAN:
+ *((int *)infoValue) = dictP[N].value.data.integer;
+ break;
+ case OBJ_REAL:
+ *((float *)infoValue) = dictP[N].value.data.real;
+ break;
+ case OBJ_NAME:
+ case OBJ_STRING:
+ *((char **)infoValue) = dictP[N].value.data.valueP;
+ break;
+ default:
+ *rcodeP = 1;
+ break;
+ }
+ }
+ }
+ else *rcodeP = 1;
+}
diff --git a/Build/source/texk/ps2pkm/fontfcn.h b/Build/source/texk/ps2pkm/fontfcn.h
new file mode 100644
index 00000000000..0c2fda1f7bf
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fontfcn.h
@@ -0,0 +1,98 @@
+/* $XConsortium: fontfcn.h,v 1.3 92/03/26 16:42:23 eswu Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* Definition of a PostScript FONT */
+typedef struct ps_font {
+ char *vm_start;
+ psobj FontFileName;
+ psobj Subrs;
+ psdict *CharStringsP;
+ psdict *Private;
+ psdict *fontInfoP;
+struct blues_struct *BluesP;
+} psfont;
+/***================================================================***/
+/* Routines in scan_font */
+/***================================================================***/
+
+extern boolean Init_StdEnc();
+extern int scan_font();
+extern int GetFontInfo();
+/***================================================================***/
+/* Return codes from scan_font */
+/***================================================================***/
+#define SCAN_OK 0
+#define SCAN_FILE_EOF -1
+#define SCAN_ERROR -2
+#define SCAN_OUT_OF_MEMORY -3
+#define SCAN_FILE_OPEN_ERROR -4
+#define SCAN_TRUE -5
+#define SCAN_FALSE -6
+#define SCAN_END -7
+
+/***================================================================***/
+/* Name of FontInfo fields */
+/***================================================================***/
+
+#define FONTNAME 1
+#define PAINTTYPE 2
+#define FONTTYPENUM 3
+#define FONTMATRIX 4
+#define FONTBBOX 5
+#define UNIQUEID 6
+#define STROKEWIDTH 7
+#define VERSION 8
+#define NOTICE 9
+#define FULLNAME 10
+#define FAMILYNAME 11
+#define WEIGHT 12
+#define ITALICANGLE 13
+#define ISFIXEDPITCH 14
+#define UNDERLINEPOSITION 15
+#define UNDERLINETHICKNESS 16
+#define ENCODING 17
+/***================================================================***/
+/* Name of Private values */
+/***================================================================***/
+#define BLUEVALUES 1
+#define OTHERBLUES 2
+#define FAMILYBLUES 3
+#define FAMILYOTHERBLUES 4
+#define BLUESCALE 5
+#define BLUESHIFT 6
+#define BLUEFUZZ 7
+#define STDHW 8
+#define STDVW 9
+#define STEMSNAPH 10
+#define STEMSNAPV 11
+#define FORCEBOLD 12
+#define LANGUAGEGROUP 13
+#define LENIV 14
+#define RNDSTEMUP 15
+#define EXPANSIONFACTOR 16
diff --git a/Build/source/texk/ps2pkm/fontfile.h b/Build/source/texk/ps2pkm/fontfile.h
new file mode 100644
index 00000000000..166aac3a01e
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fontfile.h
@@ -0,0 +1,72 @@
+/*
+ * $XConsortium: fontfile.h,v 1.1 91/05/11 09:11:58 rws Exp $
+ *
+ * Copyright 1991 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. M.I.T. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTFILE_H_
+#define _FONTFILE_H_
+typedef struct _FontEntry *FontEntryPtr;
+typedef struct _FontTable *FontTablePtr;
+typedef struct _FontName *FontNamePtr;
+typedef struct _FontScaled *FontScaledPtr;
+typedef struct _FontScalableExtra *FontScalableExtraPtr;
+typedef struct _FontScalableEntry *FontScalableEntryPtr;
+typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr;
+typedef struct _FontBitmapEntry *FontBitmapEntryPtr;
+typedef struct _FontAliasEntry *FontAliasEntryPtr;
+typedef struct _FontBCEntry *FontBCEntryPtr;
+typedef struct _FontDirectory *FontDirectoryPtr;
+typedef struct _FontRenderer *FontRendererPtr;
+
+#define NullFontEntry ((FontEntryPtr) 0)
+#define NullFontTable ((FontTablePtr) 0)
+#define NullFontName ((FontNamePtr) 0)
+#define NullFontScaled ((FontScaled) 0)
+#define NullFontScalableExtra ((FontScalableExtra) 0)
+#define NullFontscalableEntry ((FontScalableEntry) 0)
+#define NullFontScaleAliasEntry ((FontScaleAliasEntry) 0)
+#define NullFontBitmapEntry ((FontBitmapEntry) 0)
+#define NullFontAliasEntry ((FontAliasEntry) 0)
+#define NullFontBCEntry ((FontBCEntry) 0)
+#define NullFontDirectory ((FontDirectoryPtr) 0)
+#define NullFontRenderer ((FontRendererPtr) 0)
+
+#define FONT_ENTRY_SCALABLE 0
+#define FONT_ENTRY_SCALE_ALIAS 1
+#define FONT_ENTRY_BITMAP 2
+#define FONT_ENTRY_ALIAS 3
+#define FONT_ENTRY_BC 4
+
+#define MAXFONTNAMELEN 1024
+#define MAXFONTFILENAMELEN 1024
+
+#define FontDirFile "fonts.dir"
+#define FontAliasFile "fonts.alias"
+#define FontScalableFile "fonts.scale"
+
+extern FontEntryPtr FontFileFindNameInDir ();
+extern FontDirectoryPtr FontFileMakeDir ();
+extern FontRendererPtr FontFileMatchRenderer ();
+extern char *SaveString ();
+extern FontScaledPtr FontFileFindScaledInstance ();
+#endif /* _FONTFILE_H_ */
diff --git a/Build/source/texk/ps2pkm/fontmisc.h b/Build/source/texk/ps2pkm/fontmisc.h
new file mode 100644
index 00000000000..ffde14ff31d
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fontmisc.h
@@ -0,0 +1,63 @@
+/*
+ * $XConsortium: fontmisc.h,v 1.5 91/05/12 16:15:48 rws Exp $
+ *
+ * Copyright 1991 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. M.I.T. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTMISC_H_
+#define _FONTMISC_H_
+
+#ifdef XSERVER
+#include "Xfuncs.h"
+#endif
+
+typedef unsigned char *pointer;
+typedef int Bool;
+#ifndef X_PROTOCOL
+typedef unsigned long Atom;
+typedef unsigned long XID;
+#endif
+#ifndef LSBFirst
+#define LSBFirst 0
+#define MSBFirst 1
+#endif
+
+#ifndef None
+#define None 0l
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+extern char *NameForAtom ();
+
+#define lowbit(x) ((x) & (~(x) + 1))
+
+#if defined(assert)
+#undef assert
+#endif
+
+#define assert(x)
+
+#endif /* _FONTMISC_H_ */
diff --git a/Build/source/texk/ps2pkm/fonts.h b/Build/source/texk/ps2pkm/fonts.h
new file mode 100644
index 00000000000..cf29c3c8f25
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fonts.h
@@ -0,0 +1,49 @@
+/* $XConsortium: fonts.h,v 1.2 91/10/10 11:18:09 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/* STUB */
+
+#define CopyFont(f) f
+#define UniqueFont(f) f
+#define KillFont(f)
+#define KillText(t)
+#define CopyText(t) t
+#define I_DumpText(t)
+#define CoerceText(t) t
+#define TextDelta(t,pt)
+#define XformText(p,s)
+#define GimeSpace() FALSE
+
+#define LibInit()
+#define InitFonts()
+#define InitFiles()
+#define TraceClose()
+
+#define FF_PARSE_ERROR -1
diff --git a/Build/source/texk/ps2pkm/fontstruct.h b/Build/source/texk/ps2pkm/fontstruct.h
new file mode 100644
index 00000000000..39c40f477f4
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fontstruct.h
@@ -0,0 +1,224 @@
+/* $Header: fontstruct.h,v 1.10 91/07/22 15:37:41 keith Exp $ */
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or MIT not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+ @(#)fontstruct.h 3.2 91/04/15
+
+******************************************************************/
+
+#ifndef FONTSTR_H
+#define FONTSTR_H
+
+#ifdef XSERVER
+#include <X11/Xproto.h>
+#else
+#include "Xstuff.h"
+#endif
+
+#include "font.h"
+
+/*
+ * This version of the server font data strucutre is only for describing
+ * the in memory data structure. The file structure is not necessarily a
+ * copy of this. That is up to the compiler and the OS layer font loading
+ * machinery.
+ */
+
+#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */
+
+typedef enum {
+ Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
+} FontEncoding;
+
+typedef struct _FontProp {
+ long name;
+ long value; /* assumes ATOM is not larger than INT32 */
+} FontPropRec;
+
+typedef struct _FontResolution {
+ unsigned short x_resolution;
+ unsigned short y_resolution;
+ unsigned short point_size;
+} FontResolutionRec;
+
+typedef struct _ExtentInfo {
+ DrawDirection drawDirection;
+ int fontAscent;
+ int fontDescent;
+ int overallAscent;
+ int overallDescent;
+ int overallWidth;
+ int overallLeft;
+ int overallRight;
+} ExtentInfoRec;
+
+typedef struct _CharInfo {
+ xCharInfo metrics; /* info preformatted for Queries */
+ char *bits; /* pointer to glyph image */
+} CharInfoRec;
+
+/*
+ * Font is created at font load time. It is specific to a single encoding.
+ * e.g. not all of the glyphs in a font may be part of a single encoding.
+ */
+
+typedef struct _FontInfo {
+ unsigned short firstCol;
+ unsigned short lastCol;
+ unsigned short firstRow;
+ unsigned short lastRow;
+ unsigned short defaultCh;
+ unsigned int noOverlap:1;
+ unsigned int terminalFont:1;
+ unsigned int constantMetrics:1;
+ unsigned int constantWidth:1;
+ unsigned int inkInside:1;
+ unsigned int inkMetrics:1;
+ unsigned int allExist:1;
+ unsigned int drawDirection:2;
+ unsigned int cachable:1;
+ unsigned int anamorphic:1;
+ short maxOverlap;
+ short pad;
+ xCharInfo maxbounds;
+ xCharInfo minbounds;
+ xCharInfo ink_maxbounds;
+ xCharInfo ink_minbounds;
+ short fontAscent;
+ short fontDescent;
+ int nprops;
+ FontPropPtr props;
+ char *isStringProp;
+} FontInfoRec;
+
+typedef struct _Font {
+ int refcnt;
+ FontInfoRec info;
+ char bit;
+ char byte;
+ char glyph;
+ char scan;
+ fsBitmapFormat format;
+ int (*get_glyphs) ( /* font, count, chars, encoding, count, glyphs */ );
+ int (*get_metrics) ( /* font, count, chars, encoding, count, glyphs */ );
+ int (*get_bitmaps) (/* client, font, flags, ranges, nranges,
+ nextents, extents */ );
+ int (*get_extents) (/* client, font, format, flags, ranges,
+ nranges, nglyphs, offsets, glyphs */ );
+ void (*unload_font) ( /* font */ );
+ FontPathElementPtr fpe;
+ pointer svrPrivate;
+ pointer fontPrivate;
+ pointer fpePrivate;
+ int maxPrivate;
+ pointer *devPrivates;
+} FontRec;
+
+extern Bool _FontSetNewPrivate (/* pFont, n, ptr */);
+extern int AllocateFontPrivateIndex ();
+
+#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \
+ (pFont)->devPrivates[n])
+
+#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \
+ _FontSetNewPrivate (pFont, n, ptr) : \
+ ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE))
+
+typedef struct _FontNames {
+ int nnames;
+ int size;
+ int *length;
+ char **names;
+} FontNamesRec;
+
+/* External view of font paths */
+typedef struct _FontPathElement {
+ int name_length;
+ char *name;
+ int type;
+ int refcount;
+ pointer private;
+} FontPathElementRec;
+
+typedef struct _FPEFunctions {
+ int (*name_check) ( /* name */ );
+ int (*init_fpe) ( /* fpe */ );
+ int (*reset_fpe) ( /* fpe */ );
+ int (*free_fpe) ( /* fpe */ );
+ int (*open_font) ( /* client, fpe, flags, name, namelen, format,
+ fid, ppfont, alias */ );
+ int (*close_font) ( /* pfont */ );
+ int (*list_fonts) ( /* client, fpe, pattern, patlen, maxnames,
+ paths */ );
+ int (*start_list_fonts_with_info) ( /* client, fpe, name, namelen,
+ maxnames, data */ );
+ int (*list_next_font_with_info) ( /* client, fpe, name, namelen,
+ info, num, data */ );
+ int (*wakeup_fpe) ( /* fpe, mask */ );
+ int (*client_died) ( /* client, fpe */ );
+} FPEFunctionsRec, FPEFunctions;
+
+extern int InitFPETypes();
+
+/*
+ * Various macros for computing values based on contents of
+ * the above structures
+ */
+
+#define GLYPHWIDTHPIXELS(pci) \
+ ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
+
+#define GLYPHHEIGHTPIXELS(pci) \
+ ((pci)->metrics.ascent + (pci)->metrics.descent)
+
+#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
+
+#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7)
+
+#define BYTES_PER_ROW(bits, nbytes) \
+ ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
+ :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
+ :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
+ :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
+ : 0)
+
+#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \
+ BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad))
+/*
+ * Macros for computing different bounding boxes for fonts; from
+ * the font protocol
+ */
+
+#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \
+ (pi)->fontAscent : (pi)->ink_maxbounds.ascent)
+#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \
+ (pi)->fontDescent : (pi)->ink_maxbounds.descent)
+#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi))
+#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \
+ (pi)->ink_minbounds.leftSideBearing : 0)
+#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \
+ (pi)->ink_maxbounds.characterWidth ? \
+ (pi)->ink_maxbounds.rightSideBearing : \
+ (pi)->ink_maxbounds.characterWidth)
+#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi))
+
+#endif /* FONTSTR_H */
diff --git a/Build/source/texk/ps2pkm/fontxlfd.h b/Build/source/texk/ps2pkm/fontxlfd.h
new file mode 100644
index 00000000000..573b4617507
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fontxlfd.h
@@ -0,0 +1,48 @@
+/*
+ * $XConsortium: fontxlfd.h,v 1.1 91/05/11 09:12:07 rws Exp $
+ *
+ * Copyright 1990 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. M.I.T. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+#ifndef _FONTXLFD_H_
+#define _FONTXLFD_H_
+
+
+typedef struct _FontScalable {
+ int pixel,
+ point,
+ x,
+ y,
+ width;
+} FontScalableRec, *FontScalablePtr;
+
+#ifdef WIN32
+extern void
+FontParseXLFDName(char *scaledName, FontScalablePtr Vals, int foo );
+#endif
+
+#define FONT_XLFD_REPLACE_NONE 0
+#define FONT_XLFD_REPLACE_STAR 1
+#define FONT_XLFD_REPLACE_ZERO 2
+#define FONT_XLFD_REPLACE_VALUE 3
+
+#endif /* _FONTXLFD_H_ */
diff --git a/Build/source/texk/ps2pkm/fsmasks.h b/Build/source/texk/ps2pkm/fsmasks.h
new file mode 100644
index 00000000000..7904ab85922
--- /dev/null
+++ b/Build/source/texk/ps2pkm/fsmasks.h
@@ -0,0 +1,72 @@
+/* $XConsortium: fsmasks.h,v 1.2 91/05/13 16:46:16 gildea Exp $ */
+/*
+ * Copyright 1990, 1991 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation and the
+ * Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this protoype software
+ * and its documentation to Members and Affiliates of the MIT X Consortium
+ * any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Network Computing Devices, Digital or
+ * MIT not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * @(#)fsmasks.h 4.1 91/05/02
+ *
+ */
+
+/*
+ * masks & values used by the font lib and the font server
+ */
+
+#ifndef _FSMASKS_H_
+#define _FSMASKS_H_
+
+#include "types.h"
+
+/* font format macros */
+#define BitmapFormatByteOrderMask (1L << 0)
+#define BitmapFormatBitOrderMask (1L << 1)
+#define BitmapFormatImageRectMask (3L << 2)
+#define BitmapFormatScanlinePadMask (3L << 8)
+#define BitmapFormatScanlineUnitMask (3L << 12)
+
+#define BitmapFormatByteOrderLSB (0)
+#define BitmapFormatByteOrderMSB (1L << 0)
+#define BitmapFormatBitOrderLSB (0)
+#define BitmapFormatBitOrderMSB (1L << 1)
+
+#define BitmapFormatImageRectMin (0L << 2)
+#define BitmapFormatImageRectMaxWidth (1L << 2)
+#define BitmapFormatImageRectMax (2L << 2)
+
+#define BitmapFormatScanlinePad8 (0L << 8)
+#define BitmapFormatScanlinePad16 (1L << 8)
+#define BitmapFormatScanlinePad32 (2L << 8)
+#define BitmapFormatScanlinePad64 (3L << 8)
+
+#define BitmapFormatScanlineUnit8 (0L << 12)
+#define BitmapFormatScanlineUnit16 (1L << 12)
+#define BitmapFormatScanlineUnit32 (2L << 12)
+#define BitmapFormatScanlineUnit64 (3L << 12)
+
+#define BitmapFormatMaskByte (1L << 0)
+#define BitmapFormatMaskBit (1L << 1)
+#define BitmapFormatMaskImageRectangle (1L << 2)
+#define BitmapFormatMaskScanLinePad (1L << 3)
+#define BitmapFormatMaskScanLineUnit (1L << 4)
+
+typedef ULONG fsBitmapFormat;
+typedef ULONG fsBitmapFormatMask;
+
+#endif /* _FSMASKS_H_ */
diff --git a/Build/source/texk/ps2pkm/hdigit.h b/Build/source/texk/ps2pkm/hdigit.h
new file mode 100644
index 00000000000..adee64dd001
--- /dev/null
+++ b/Build/source/texk/ps2pkm/hdigit.h
@@ -0,0 +1,94 @@
+/* $XConsortium: hdigit.h,v 1.2 91/10/10 11:18:11 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* -------------------------------------- */
+/* --- MACHINE GENERATED, DO NOT EDIT --- */
+/* -------------------------------------- */
+
+#ifndef HDIGIT
+#define HDIGIT 1
+
+/*
+ * Hex Digit Value Table --
+ *
+ * The entries in the Digit Value Table map character codes in the set
+ * {0-9,a-f,A-F} to their numeric values for readhexstring
+ * (00 10...F0 for the high hex digit and 00 01...0F for the low).
+ * The white-space and hex string termination characters are.
+ * mapped to codes > 0xf0 to enable usage by several modules.
+ * 2 tables are build HighHex and LowHex.
+ *
+ */
+
+/* Indicators for special characters in these tables */
+#define HERROR (0xfe)
+#define HWHITE_SPACE (0xfd)
+#define HRIGHT_ANGLE (0xfc)
+#define LAST_HDIGIT (0xf0)
+
+#define HighHexP (HighHex+1)
+unsigned char HighHex[257] = { 0xFF,
+ 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xFE,0xFE,0xFE,0xFE,0xFC,0xFE,
+ 0xFE,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE
+};
+#define LowHexP (LowHex+1)
+unsigned char LowHex[257] = { 0xFF,
+ 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFE,0xFE,0xFE,0xFE,0xFC,0xFE,
+ 0xFE,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,
+ 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE
+};
+
+#endif
diff --git a/Build/source/texk/ps2pkm/hints.c b/Build/source/texk/ps2pkm/hints.c
new file mode 100644
index 00000000000..6e0444f4759
--- /dev/null
+++ b/Build/source/texk/ps2pkm/hints.c
@@ -0,0 +1,923 @@
+/* $XConsortium: hints.c,v 1.4 91/10/10 11:18:13 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* HINTS CWEB V0006 ******** */
+/*
+:h1.HINTS Module - Processing Rasterization Hints
+
+&author. Sten F. Andler; continuity by Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) and Duaine
+W. Pryor, Jr.
+
+
+:h3.Include Files
+
+The included files are:
+*/
+
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+#include "regions.h"
+#include "hints.h"
+
+/*
+:h3.Functions Provided to the TYPE1IMAGER User
+
+None.
+*/
+
+/*
+:h3.Functions Provided to Other Modules
+
+This module provides the following entry point to other modules:
+*/
+
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.Macros Provided to Other Modules
+
+None.
+*/
+
+/*
+:h2.InitHints() - Initialize hint data structure
+*/
+
+#define MAXLABEL 20
+static struct {
+ int inuse;
+ int computed;
+ struct fractpoint hint;
+} oldHint[MAXLABEL];
+
+#define ODD(x) (((int)(x)) & 01)
+#define FPFLOOR(fp) TOFRACTPEL((fp) >> FRACTBITS)
+#define FPROUND(fp) FPFLOOR((fp) + FPHALF)
+
+void InitHints()
+{
+ int i;
+
+ for (i = 0; i < MAXLABEL; i++)
+ {
+ oldHint[i].inuse = FALSE;
+ oldHint[i].computed = FALSE;
+ }
+}
+
+/*
+:h3.CloseHints(hintP) - Reverse hints that are still open
+*/
+
+void CloseHints(hintP)
+ struct fractpoint *hintP;
+{
+ int i;
+
+ for (i = 0; i < MAXLABEL; i++)
+ {
+ if (oldHint[i].inuse)
+ {
+ hintP->x -= oldHint[i].hint.x;
+ hintP->y -= oldHint[i].hint.y;
+
+ oldHint[i].inuse = FALSE;
+
+ IfTrace3((HintDebug > 1)," Hint %d was open, hint=(%dl,%dl)\n",
+ i, hintP->x, hintP->y);
+ }
+ }
+}
+
+/*
+:h3.ComputeHint(hP, currX, currY, hintP) - Compute the value of a hint
+*/
+
+static void ComputeHint(hP, currX, currY, hintP)
+ struct hintsegment *hP;
+ fractpel currX, currY;
+ struct fractpoint *hintP;
+{
+ fractpel currRef = 0, currWidth = 0;
+ int idealWidth;
+ fractpel hintValue = 0;
+ char orientation;
+
+/*
+By construction, width is never zero. Therefore we can use the
+width value to determine if the hint has been rotated by a
+multiple of 90 degrees.
+*/
+
+ if (hP->width.y == 0)
+ {
+ orientation = 'v'; /* vertical */
+ IfTrace0((HintDebug > 0)," vertical hint\n");
+ }
+ else if (hP->width.x == 0)
+ {
+ orientation = 'h'; /* horizontal */
+ IfTrace0((HintDebug > 0)," horizontal hint\n");
+ }
+ else
+ {
+ IfTrace0((HintDebug > 0)," hint not vertical or horizontal\n");
+ hintP->x = hintP->y = 0;
+ return;
+ }
+
+ /* Compute currRef and currWidth with a unit of 1 pel */
+ if (orientation == 'v') /* vertical */
+ {
+ currRef = hP->ref.x + currX;
+ currWidth = ABS(hP->width.x);
+ }
+ else if (orientation == 'h') /* horizontal */
+ {
+ currRef = hP->ref.y + currY;
+ currWidth = ABS(hP->width.y);
+ }
+ else /* error */
+ {
+ t1_abort("ComputeHint: invalid orientation");
+ }
+
+ IfTrace4((HintDebug > 1),
+ " currX=%dl, currY=%dl, currRef=%dl, currWidth=%dl\n",
+ currX, currY,
+ currRef, currWidth);
+
+ if ((hP->hinttype == 'b') /* Bar or stem */
+ || (hP->hinttype == 's')) /* Serif */
+ {
+ idealWidth = NEARESTPEL(currWidth);
+ if (idealWidth == 0) idealWidth = 1;
+ if (ODD(idealWidth)) /* Is ideal width odd? */
+ {
+ /* center "ref" over pel */
+ hintValue = FPFLOOR(currRef) + FPHALF - currRef;
+ }
+ else
+ {
+ /* align "ref" on pel boundary */
+ hintValue = FPROUND(currRef) - currRef;
+ }
+ if (HintDebug > 2) {
+ IfTrace1(TRUE," idealWidth=%d, ", idealWidth);
+ }
+ }
+ else if (hP->hinttype == 'c') /* Curve extrema */
+ {
+ /* align "ref" on pel boundary */
+ hintValue = FPROUND(currRef) - currRef;
+ }
+ else /* error */
+ {
+ t1_abort("ComputeHint: invalid hinttype");
+ }
+
+ IfTrace1((HintDebug > 1)," hintValue=%dl", hintValue);
+
+ if (orientation == 'v') /* vertical */
+ {
+ hintP->x = hintValue;
+ hintP->y = 0;
+ }
+ else if (orientation == 'h') /* horizontal */
+ {
+ hintP->x = 0;
+ hintP->y = hintValue;
+ }
+ else /* error */
+ {
+ t1_abort("ComputeHint: invalid orientation");
+ }
+}
+
+/*
+:h3.ProcessHint(hP, currX, currY, hintP) - Process a rasterization hint
+*/
+
+void ProcessHint(hP, currX, currY, hintP)
+ struct hintsegment *hP;
+ fractpel currX, currY;
+ struct fractpoint *hintP;
+{
+ struct fractpoint thisHint;
+
+ IfTrace4((HintDebug > 1)," ref=(%dl,%dl), width=(%dl,%dl)",
+ hP->ref.x, hP->ref.y,
+ hP->width.x, hP->width.y);
+ IfTrace4((HintDebug > 1),", %c %c %c %c",
+ hP->orientation, hP->hinttype,
+ hP->adjusttype, hP->direction);
+ IfTrace1((HintDebug > 1),", label=%d\n", hP->label);
+
+ if ((hP->adjusttype == 'm') /* Move */
+ || (hP->adjusttype == 'a')) /* Adjust */
+ {
+ /* Look up hint in oldHint table */
+ if ((hP->label >= 0) && (hP->label < MAXLABEL))
+ {
+ if (oldHint[hP->label].computed)
+ /* Use old hint value if already computed */
+ {
+ thisHint.x = oldHint[hP->label].hint.x;
+ thisHint.y = oldHint[hP->label].hint.y;
+ oldHint[hP->label].inuse = TRUE;
+ }
+ else
+ /* Compute new value for hint and store it for future use */
+ {
+ ComputeHint(hP, currX, currY, &thisHint);
+
+ oldHint[hP->label].hint.x = thisHint.x;
+ oldHint[hP->label].hint.y = thisHint.y;
+ oldHint[hP->label].inuse = TRUE;
+ oldHint[hP->label].computed = TRUE;
+ }
+ }
+ else /* error */
+ {
+ t1_abort("ProcessHint: invalid label");
+ }
+ }
+ else if (hP->adjusttype == 'r') /* Reverse */
+ {
+ /* Use the inverse of the existing hint value to reverse hint */
+ if ((hP->label >= 0) && (hP->label < MAXLABEL))
+ {
+ if (oldHint[hP->label].inuse)
+ {
+ thisHint.x = -oldHint[hP->label].hint.x;
+ thisHint.y = -oldHint[hP->label].hint.y;
+ oldHint[hP->label].inuse = FALSE;
+ }
+ else /* error */
+ {
+ t1_abort("ProcessHint: label is not in use");
+ }
+ }
+ else /* error */
+ {
+ t1_abort("ProcessHint: invalid label");
+ }
+
+ }
+ else /* error */
+ {
+ t1_abort("ProcessHint: invalid adjusttype");
+ }
+ IfTrace3((HintDebug > 1)," label=%d, thisHint=(%dl,%dl)\n",
+ hP->label, thisHint.x, thisHint.y);
+
+ hintP->x += thisHint.x;
+ hintP->y += thisHint.y;
+
+ IfTrace2((HintDebug > 1)," hint=(%dl,%dl)\n",
+ hintP->x, hintP->y);
+}
+
+/*
+:h2 id=subpath.Navigation Through Edge Lists
+
+For continuity checking purposes, we need to navigate through edge
+lists by the "subpath" chains and answer questions about edges. The
+subpath chain links together edges that were part of the same subpath
+(no intervening move segments) when the interior of the path was
+calculated. Here we use the term "edge" to mean every edge list
+that was created in between changes of direction.
+
+The subpath chains are singly-linked circular chains. For the convenience
+of building them, they direction of the list (from edge to edge) is the
+reverse of the order in which they were built. Within any single edge,
+the subpath chain goes from top-to-bottom. (There might be a violation
+of this because of the way the user started the first chain; see
+:hdref refid=fixsubp..).
+
+:h3.ISTOP() and ISBOTTOM() - Flag Bits for Edge Lists at the Top and
+Bottom of Their SubPaths
+*/
+
+#define ISTOP(flag) ((flag)&0x20)
+#define ISBOTTOM(flag) ((flag)&0x10)
+/*
+:h3.ISLEFT() - Flag Bit for Left Edges
+*/
+
+#define ISLEFT(flag) ((flag)&0x08)
+
+/*
+:h3.XofY() - Macro to Find X Value at Given Y
+
+This macro can only be used if it is known that the Y is within the
+given edgelist's ymin and ymax.
+*/
+
+#define XofY(edge, y) edge->xvalues[y - edge->ymin]
+
+/*
+:h3.findXofY() - Like XofY(), Except not Restricted
+
+If the Y is out of bounds of the given edgelist, this macro will
+call SearchXofY to search the edge's subpath chain for the correct
+Y range. If the Y value is off the edge, MINPEL is returned.
+*/
+#define findXofY(edge, y) ((y < edge->ymin || y >= edge->ymax) ? SearchXofY(edge, y) : XofY(edge, y))
+
+/*
+:h4.SearchXofY() - Routine Called by FindXofY() for Difficult Cases
+
+The concept of this routine is to follow the subpath chain to find the
+edge just below (i.e., next in chain) or just above (i.e., immediately
+before in chain. It is assumed that the Y value is no more than one
+off of the edge's range; XofY() could be replace by FindXofY() to
+call ourselves recursively if this were not true.
+*/
+
+static pel SearchXofY(edge, y)
+ register struct edgelist *edge; /* represents edge */
+ register pel y; /* 'y' value to find edge for */
+{
+ register struct edgelist *e; /* loop variable */
+
+ if (y < edge->ymin) {
+ if (ISTOP(edge->flag))
+ return(MINPEL);
+ for (e = edge->subpath; e->subpath != edge; e = e->subpath) { ; }
+ if (e->ymax == edge->ymin)
+ return(XofY(e, y));
+ }
+ else if (y >= edge->ymax) {
+ if (ISBOTTOM(edge->flag))
+ return(MINPEL);
+ e = edge->subpath;
+ if (e->ymin == edge->ymax)
+ return(XofY(e, y));
+ }
+ else
+ return(XofY(edge, y));
+
+ t1_abort("bad subpath chain");
+
+ /*NOTREACHED*/
+ return MINPEL;
+}
+/*
+:h3.ISBREAK() Macro - Tests if an Edge List is at a "Break"
+
+The subpath chains are organized top to bottom. When the bottom of
+a given edge is reached, the subpath chain points to the top of the
+next edge. We call this a "break" in the chain. The following macro
+is the simple test for the break condition:
+*/
+
+#define ISBREAK(top,bot) (top->ymax != bot->ymin)
+
+
+/*
+:h3.ImpliedHorizontalLine() - Tests for Horizontal Connectivity
+
+This function returns true if two edges are connected horizontally.
+They are connected horizontally if they are consecutive in the subpath,
+and either we are at the bottom and the first edge is going down or we
+are at the top and the first edge is going up.
+*/
+
+#define BLACKABOVE -1
+#define BLACKBELOW +1
+#define NONE 0
+
+static int ImpliedHorizontalLine(e1, e2, y)
+ register struct edgelist *e1,*e2; /* two edges to check */
+ register int y; /* y where they might be connected */
+{
+ register struct edgelist *e3,*e4;
+
+ if (ISDOWN(e1->flag) == ISDOWN(e2->flag))
+ return(NONE); /* can't be consecutive unless different directions */
+/*
+Now we check for consecutiveness: Can we get from 'e1' to 'e2' with
+only one intervening break? Can we get from 'e2' to 'e1' with only one
+intervening break? 'e3' will be as far as we can get after 'e1'; 'e4'
+will be has far as we can get after 'e2':
+*/
+ for (e3 = e1; !ISBREAK(e3, e3->subpath); e3 = e3->subpath) { ; }
+ for (e3 = e3->subpath; e3 != e2; e3 = e3->subpath)
+ if (ISBREAK(e3, e3->subpath))
+ break;
+
+ for (e4 = e2; !ISBREAK(e4, e4->subpath); e4 = e4->subpath) { ; }
+ for (e4 = e4->subpath; e4 != e1; e4 = e4->subpath)
+ if (ISBREAK(e4, e4->subpath))
+ break;
+/*
+If the edges are mutually consecutive, we must have horizontal lines
+both top and bottom:
+*/
+ if (e3 == e2 && e4 == e1)
+ return(TRUE);
+/*
+If the edges are not consecutive either way, no horizontal lines are
+possible:
+*/
+ if (e3 != e2 && e4 != e1)
+ return(NONE);
+/*
+Now let's swap 'e1' and 'e2' if necessary to enforce the rule that 'e2'
+follows 'e1'. Remember that subpath chains go in the opposite direction
+from the way the subpaths were built; this led to the simplest way
+do build them.
+*/
+ if (e4 != e1) {
+ e2 = e1;
+ e1 = e3; /* remember e3 == e2, this just swaps 'e1' and 'e2' */
+ }
+/*
+Now we have everything to return the answer:
+*/
+ if (ISTOP(e1->flag) && y == e1->ymin)
+ return(ISDOWN(e2->flag));
+ else if (ISBOTTOM(e1->flag) && y == e1->ymax)
+ return(!ISDOWN(e2->flag));
+ else
+ t1_abort("ImpliedHorizontalLine: why ask?");
+ /*NOTREACHED*/
+ return 0;
+}
+
+/*
+:h3 id=fixsubp.FixSubPaths() - Must be Called to Organize Subpath Chains
+
+The region-building code in Interior(), in particular splitedge(),
+maintains the rule that sub-paths are linked top-to-bottom except
+at breaks. However, it is possible that there may be a "false break"
+because the user started the subpath in the middle of an edge (and
+went in the "wrong" direction from there, up instead of down). This
+routine finds and fixes false breaks.
+
+Also, this routine sets the ISTOP and ISBOTTOM flags in the edge lists.
+*/
+
+static void FixSubPaths(R)
+ register struct region *R; /* anchor of region */
+{
+ register struct edgelist *e; /* fast loop variable */
+ register struct edgelist *edge; /* current edge in region */
+ register struct edgelist *next; /* next in subpath after 'edge' */
+ register struct edgelist *break1; /* first break after 'next' */
+ register struct edgelist *break2 = NULL; /* last break before 'edge' */
+ register struct edgelist *prev; /* previous edge for fixing links */
+ int left = TRUE;
+
+ for (edge = R->anchor; edge != NULL; edge = edge->link) {
+
+ if (left)
+ edge->flag |= ISLEFT(ON);
+ left = !left;
+
+ next = edge->subpath;
+
+ if (!ISBREAK(edge, next))
+ continue;
+ if (edge->ymax < next->ymin)
+ t1_abort("disjoint subpath?");
+/*
+'edge' now contains an edgelist at the bottom of an edge, and 'next'
+contains the next subsequent edgelist in the subpath, which must be at
+the top. We refer to this a "break" in the subpath.
+*/
+ next->flag |= ISTOP(ON);
+ edge->flag |= ISBOTTOM(ON);
+
+ if (ISDOWN(edge->flag) != ISDOWN(next->flag))
+ continue;
+/*
+We are now in the unusual case; both edges are going in the same
+direction so this must be a "false break" due to the way that the user
+created the path. We'll have to fix it.
+*/
+ for (break1 = next; !ISBREAK(break1, break1->subpath); break1 = break1->subpath) { ; }
+
+ for (e = break1->subpath; e != edge; e = e->subpath)
+ if (ISBREAK(e, e->subpath))
+ break2 = e;
+/*
+Now we've set up 'break1' and 'break2'. I've found the following
+diagram invaluable. 'break1' is the first break after 'next'. 'break2'
+is the LAST break before 'edge'.
+&drawing.
+ next
+ +------+ +---->+------+
+ +--->| >-----+ | | >-----+
+ | | | | | | | |
+ | +-------------+ | +-------------+
+ | | |break1| | | | |
+ | +->| >-------+ +->| >-----+
+ | | | | | |
+ | | | +-------------+
+ | +------+ | | |
+ | +----------------+ | | |
+ | | +------+ | +->| >-----+
+ | +->| >-----+ | | | |
+ | | | | | +-------------+
+ | +-------------+ | | | |
+ | | |edge | | | |break2|
+ | +->| >-----+ | +->| >-----+
+ | | | | | | | |
+ | | | | | | | |
+ | | | | | | | |
+ | +------+ | | +------+ |
+ | | | |
+ +---------------+ +---------------+
+
+&edrawing.
+We want to fix this situation by having 'edge' point to where 'break1'
+now points, and having 'break1' point to where 'break2' now points.
+Finally, 'break2' should point to 'next'. Also, we observe that
+'break1' can't be a bottom, and is also not a top unless it is the same
+as 'next':
+*/
+ edge->subpath = break1->subpath;
+
+ break1->subpath = break2->subpath;
+ if (ISBREAK(break1, break1->subpath))
+ t1_abort("unable to fix subpath break?");
+
+ break2->subpath = next;
+
+ break1->flag &= ~ISBOTTOM(ON);
+ if (break1 != next)
+ break1->flag &= ~ISTOP(ON);
+ }
+/*
+This region might contain "ambiguous" edges; edges exactly equal to
+edge->link. Due to the random dynamics of where they get sorted into
+the list, they can yield false crossings, where the edges appear
+to cross. This confuses our continuity logic no end. Since we can
+swap them without changing the region, we do.
+*/
+ for (edge = R->anchor, prev = NULL; VALIDEDGE(edge); prev = edge, edge = prev->link) {
+
+ if (! ISAMBIGUOUS(edge->flag))
+ continue;
+
+ next = edge->subpath;
+
+ while (ISAMBIGUOUS(next->flag) && next != edge)
+ next = next->subpath;
+/*
+We've finally found a non-ambiguous edge; we make sure it is left/right
+compatible with 'edge':
+*/
+ if ( (ISLEFT(edge->flag) == ISLEFT(next->flag) && ISDOWN(edge->flag) == ISDOWN(next->flag) )
+ || (ISLEFT(edge->flag) != ISLEFT(next->flag) && ISDOWN(edge->flag) != ISDOWN(next->flag) ) )
+ continue;
+
+/*
+Incompatible, we will swap 'edge' and the following edge in the list.
+You may think that there must be a next edge in this swath. So did I.
+No! If there is a totally ambiguous inner loop, for example, we could
+get all the way to the outside without resolving ambiguity.
+*/
+ next = edge->link; /* note new meaning of 'next' */
+ if (next == NULL || edge->ymin != next->ymin)
+ continue;
+ if (prev == NULL)
+ R->anchor = next;
+ else
+ prev->link = next;
+ edge->link = next->link;
+ next->link = edge;
+ edge->flag ^= ISLEFT(ON);
+ edge->flag &= ~ISAMBIGUOUS(ON);
+ next->flag ^= ISLEFT(ON);
+ next->flag &= ~ISAMBIGUOUS(ON);
+ edge = next;
+ }
+}
+/*
+:h3.DumpSubPaths()
+
+A debug tool.
+*/
+
+static struct edgelist *before(); /* subroutine of DumpSubPaths */
+
+static void DumpSubPaths(anchor)
+ struct edgelist *anchor;
+{
+
+ register struct edgelist *edge,*e,*e2;
+ pel y;
+
+ for (edge = anchor; VALIDEDGE(edge); edge = edge->link) {
+ if (ISPERMANENT(edge->flag))
+ continue;
+ IfTrace0(TRUE, "BEGIN Subpath\n");
+ for (e2 = edge; !ISPERMANENT(e2->flag);) {
+ if (ISDOWN(e2->flag)) {
+ IfTrace1(TRUE, ". Downgoing edge's top at %p\n", e2);
+ for (e = e2;; e = e->subpath) {
+ IfTrace4(TRUE, ". . [%5d] %5d @ %p[%x]\n",
+ e->ymin, *e->xvalues, e, e->flag);
+ for (y=e->ymin+1; y < e->ymax; y++)
+ IfTrace2(TRUE, ". . [%5d] %5d \"\n", y, e->xvalues[y-e->ymin]);
+ e->flag |= ISPERMANENT(ON);
+ if (ISBREAK(e, e->subpath))
+ break;
+ }
+ }
+ else {
+ IfTrace1(TRUE, ". Upgoing edge's top at %p\n", e2);
+ for (e = e2; !ISBREAK(e, e->subpath); e = e->subpath) { ; }
+ for (;; e=before(e)) {
+ IfTrace4(TRUE, ". . [%5d] %5d @ %p[%x]\n",
+ e->ymax-1, e->xvalues[e->ymax-1-e->ymin], e, e->flag);
+ for (y=e->ymax-2; y >= e->ymin; y--)
+ IfTrace2(TRUE, ". . [%5d] %5d \"\n", y, e->xvalues[y-e->ymin]);
+ e->flag |= ISPERMANENT(ON);
+ if (e == e2)
+ break;
+ }
+ }
+ do {
+ e2 = before(e2);
+ } while (!ISBREAK(before(e2), e2));
+ }
+ }
+}
+
+static struct edgelist *before(e)
+ struct edgelist *e;
+{
+ struct edgelist *r;
+ for (r = e->subpath; r->subpath != e; r = r->subpath) { ; }
+ return(r);
+}
+
+/*
+:h2.Fixing Region Continuity Problems
+
+Small regions may become disconnected when their connecting segments are
+less than a pel wide. This may be correct in some applications, but in
+many (especially small font characters), it is more pleasing to keep
+connectivity. ApplyContinuity() (invoked by +CONTINUITY on the
+Interior() fill rule) fixes connection breaks. The resulting region
+is geometrically less accurate, but may be more pleasing to the eye.
+*/
+/*
+Here are some macros which we will need:
+*/
+
+#define IsValidPel(j) (j!=MINPEL)
+
+/*
+:h3.writeXofY() - Stuffs an X Value Into an "edgelist"
+
+writeXofY writes an x value into an edge at position 'y'. It must
+update the edge's xmin and xmax. If there is a possibility that this
+new x might exceed the region's bounds, updating those are the
+responsibility of the caller.
+*/
+
+static void writeXofY(e, y, x)
+ struct edgelist *e; /* relevant edgelist */
+ int y; /* y value */
+ int x; /* new x value */
+{
+ if (e->xmin > x) e->xmin = x;
+ if (e->xmax < x) e->xmax = x;
+ e->xvalues[y - e->ymin] = x;
+}
+
+/*-------------------------------------------------------------------------*/
+/* the following three macros tell us whether we are at a birth point, a */
+/* death point, or simply in the middle of the character */
+/*-------------------------------------------------------------------------*/
+#define WeAreAtTop(e,i) (ISTOP(e->flag) && e->ymin == i)
+#define WeAreAtBottom(e,i) (ISBOTTOM(e->flag) && e->ymax-1 == i)
+#define WeAreInMiddle(e,i) \
+ ((!ISTOP(e->flag) && !ISBOTTOM(e->flag))||(i < e->ymax-1 && i > e->ymin))
+/*
+The following macro tests if two "edgelist" structures are in the same
+swath:
+*/
+#define SAMESWATH(e1,e2) (e1->ymin == e2->ymin)
+
+/*
+:h3.CollapseWhiteRun() - Subroutine of ApplyContinuity()
+
+When we have a white run with an implied horizontal line above or
+below it, we better have black on the other side of this line. This
+function both tests to see if black is there, and adjusts the end
+points (collapses) the white run as necessary if it is not. The
+goal is to collapse the white run as little as possible.
+*/
+
+static void CollapseWhiteRun(anchor, yblack, left, right, ywhite)
+ struct edgelist *anchor; /* anchor of edge list */
+ pel yblack; /* y of (hopefully) black run above or below */
+ struct edgelist *left; /* edgelist at left of WHITE run */
+ struct edgelist *right; /* edgelist at right of WHITE run */
+ pel ywhite; /* y location of white run */
+{
+ struct edgelist *edge;
+ struct edgelist *swathstart = anchor;
+ register pel x;
+
+ if (XofY(left, ywhite) >= XofY(right, ywhite))
+ return;
+/*
+Find the swath with 'yblack'. If we don't find it, completely collapse
+the white run and return:
+*/
+ while (VALIDEDGE(swathstart)) {
+ if (yblack < swathstart->ymin) {
+ writeXofY(left, ywhite, XofY(right, ywhite));
+ return;
+ }
+ if (yblack < swathstart->ymax) break;
+ swathstart = swathstart->link->link;
+ }
+ if(!VALIDEDGE(swathstart)) {
+ writeXofY(left, ywhite, XofY(right, ywhite));
+ return;
+ }
+/*
+Now we are in the swath that contains 'y', the reference line above
+or below that we are trying to maintain continuity with. If black
+in this line begins in the middle of our white run, we must collapse
+the white run from the left to that point. If black ends in the
+middle of our white run, we must collapse the white run from the right
+to that point.
+*/
+ for (edge = swathstart; VALIDEDGE(edge); edge = edge->link) {
+
+ if (!SAMESWATH(swathstart,edge))
+ break;
+ if( XofY(edge, yblack) > XofY(left, ywhite)) {
+ if (ISLEFT(edge->flag)) {
+ x = XofY(edge, yblack);
+ if (XofY(right, ywhite) < x)
+ x = XofY(right, ywhite);
+ writeXofY(left, ywhite, x);
+ }
+ else {
+ x = XofY(edge, yblack);
+ while (edge->link != NULL && SAMESWATH(edge, edge->link)
+ && x >= XofY(edge->link, yblack) ) {
+ edge = edge->link->link;
+ x = XofY(edge, yblack);
+ }
+ if (x < XofY(right, ywhite))
+ writeXofY(right, ywhite, x);
+ return;
+ }
+ }
+ }
+ writeXofY(left, ywhite, XofY(right, ywhite));
+}
+
+/*
+:h3.ApplyContinuity() - Fix False Breaks in a Region
+
+This is the externally visible routine called from the REGIONS module
+when the +CONTINUITY flag is on the Interior() fill rule.
+*/
+
+void ApplyContinuity(R)
+struct region *R;
+{
+ struct edgelist *left;
+ struct edgelist *right;
+ struct edgelist *edge,*e2;
+ pel rightXabove,rightXbelow,leftXabove,leftXbelow;
+ pel leftX,rightX;
+ int i;
+ LONG newcenter,abovecenter,belowcenter;
+
+ FixSubPaths(R);
+ if (RegionDebug >= 3)
+ DumpSubPaths(R->anchor);
+ left = R->anchor;
+/* loop through and do all of the easy checking. ( no tops or bottoms) */
+ while(VALIDEDGE(left))
+ {
+ right = left->link;
+ for(i=left->ymin;i<left->ymax;++i)
+ {
+ leftX = findXofY(left,i);
+ rightX = findXofY(right,i);
+ leftXbelow = findXofY(left,i+1);
+ rightXbelow = findXofY(right,i+1);
+ if(rightX <= leftX)
+ {
+/* then, we have a break in a near vertical line */
+ leftXabove = findXofY(left,i-1);
+ rightXabove = findXofY(right,i-1);
+ if( IsValidPel(leftXabove) && IsValidPel(rightXabove) )
+ {
+ abovecenter = leftXabove + rightXabove;
+ }
+ else
+ {
+ abovecenter = leftX + rightX;
+ }
+ if( IsValidPel(leftXbelow) && IsValidPel(rightXbelow) )
+ {
+ belowcenter = leftXbelow + rightXbelow;
+ }
+ else
+ {
+ belowcenter = leftX + rightX;
+ }
+ newcenter = abovecenter + belowcenter;
+ if( newcenter > 4*leftX )
+ {
+ rightX = rightX + 1;
+ }
+ else if( newcenter < 4*leftX)
+ {
+ leftX = leftX - 1;
+ }
+ else
+ {
+ rightX = rightX + 1;
+ }
+ writeXofY(right,i,rightX);
+ writeXofY(left,i,leftX);
+ if(rightX > R->xmax) {R->xmax = rightX;}
+ if(leftX < R->xmin) {R->xmin = leftX;}
+ }
+ if( !WeAreAtBottom(left,i) && (leftXbelow>=rightX))
+ {
+/* then we have a break in a near horizontal line in the middle */
+ writeXofY(right,i,leftXbelow);
+ }
+ if( !WeAreAtBottom(right,i) && (leftX >=rightXbelow))
+ {
+/* then we have a break in a near horizontal line in the middle */
+ writeXofY(left,i,rightXbelow);
+ }
+ }
+ left = right->link;
+ }
+/*
+There may be "implied horizontal lines" between edges that have
+implications for continuity. This loop looks for white runs that
+have implied horizontal lines on the top or bottom, and calls
+CollapseWhiteRuns to check and fix any continuity problems from
+them.
+*/
+ for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) {
+ if ((!ISTOP(edge->flag) && !ISBOTTOM(edge->flag)) || ISLEFT(edge->flag))
+ continue; /* at some future date we may want left edge logic here too */
+ for (e2 = edge->link; VALIDEDGE(e2) && SAMESWATH(edge,e2); e2 = e2->link) {
+ if (ISTOP(e2->flag) && ISTOP(edge->flag)
+ && NONE != ImpliedHorizontalLine(edge,e2,edge->ymin)) {
+ if (ISLEFT(e2->flag))
+ CollapseWhiteRun(R->anchor, edge->ymin-1,
+ edge, e2, edge->ymin);
+ }
+ if (ISBOTTOM(e2->flag) && ISBOTTOM(edge->flag)
+ && NONE != ImpliedHorizontalLine(edge,e2, edge->ymax)) {
+ if (ISLEFT(e2->flag))
+ CollapseWhiteRun(R->anchor, edge->ymax,
+ edge, e2, edge->ymax-1);
+ }
+ }
+ }
+}
+
+
+
+
diff --git a/Build/source/texk/ps2pkm/hints.h b/Build/source/texk/ps2pkm/hints.h
new file mode 100644
index 00000000000..79a96b42527
--- /dev/null
+++ b/Build/source/texk/ps2pkm/hints.h
@@ -0,0 +1,42 @@
+/* $XConsortium: hints.h,v 1.2 91/10/10 11:18:19 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#define InitHints() t1_InitHints()
+void t1_InitHints(); /* Initialize hint data structure */
+
+#define CloseHints(hintP) t1_CloseHints(hintP)
+void t1_CloseHints(); /* Reverse hints that are still open */
+
+#define ProcessHint(hP, currX, currY, hintP) t1_ProcessHint(hP, currX, currY, hintP)
+void t1_ProcessHint(); /* Process a rasterization hint */
+
+#define ApplyContinuity(R) t1_ApplyContinuity(R)
+void t1_ApplyContinuity(); /* fix false connection breaks in a region */
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/lines.c b/Build/source/texk/ps2pkm/lines.c
new file mode 100644
index 00000000000..9da51242ecc
--- /dev/null
+++ b/Build/source/texk/ps2pkm/lines.c
@@ -0,0 +1,187 @@
+/* $XConsortium: lines.c,v 1.2 91/10/10 11:18:21 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* LINES CWEB V0003 ******** */
+/*
+:h1.LINES Module - Rasterizing Lines
+
+&author. Duaine W. Pryor, Jr. and Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com)
+
+
+:h3.Include Files
+
+The included files are:
+*/
+
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "regions.h"
+#include "lines.h"
+
+/*
+:h3.Functions Provided to the TYPE1IMAGER User
+
+None.
+*/
+
+/*
+:h3.Functions Provided to Other Modules
+
+This module provides the following entry point to other modules:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.Macros Provided to Other Modules
+
+None.
+*/
+
+/*
+:h2.StepLine() - Produces Run Ends for a Line After Checks
+
+The main work is done by Bresenham(); here we just perform checks and
+get the line so that its Y direction is always increasing:
+*/
+
+void StepLine(R, x1, y1, x2, y2)
+ register struct region *R; /* region being built */
+ register fractpel x1,y1; /* starting point */
+ register fractpel x2,y2; /* ending point */
+{
+ register fractpel dy;
+
+ IfTrace4((LineDebug > 0), ".....StepLine: (%dl,%dl) to (%dl,%dl)\n",
+ x1, y1, x2, y2);
+
+ dy = y2 - y1;
+
+/*
+We execute the "GOING_TO" macro to call back the REGIONS module, if
+necessary (like if the Y direction of the edge has changed):
+*/
+ GOING_TO(R, x1, y1, x2, y2, dy);
+
+ if (dy == 0)
+ return;
+
+ if (dy < 0)
+ Bresenham(R->edge, x2, y2, x1, y1);
+ else
+ Bresenham(R->edge, x1, y1, x2, y2);
+ return;
+}
+/*
+:h3.Bresenham() - Actually Produces Run Ends
+
+This routine runs a Bresenham line-stepping
+algorithm. See, for example, Newman and Sproul, :hp1/Principles
+of Interactive Computer Graphics/, pp. 25-27.
+When we enter this, we
+are guaranteed that dy is positive.
+We'd like to work in 8 bit precision, so we'll define some macros and
+constants to let us do that:
+*/
+
+#define PREC 8 /* we'll keep fraction pels in 8 bit precision */
+/*
+RoundFP() rounds down by 'b' bits:
+*/
+#define RoundFP(xy,b) (((xy)+(1<<((b)-1)))>>(b))
+
+/*
+TruncFP() truncates down by 'b' bits:
+*/
+#define TruncFP(xy,b) ((xy)>>(b))
+
+
+void Bresenham(edgeP,x1,y1,x2,y2)
+ register pel *edgeP; /* pointer to top of list (y == 0) */
+ register fractpel x1,y1; /* starting point on line */
+ register fractpel x2,y2; /* ending point on the line (down) */
+{
+ register LONG dx,dy; /* change in x and y, in my own precision */
+ register LONG x,y; /* integer pel starting point */
+ register int count; /* integer pel delta y */
+ register LONG d; /* the Bresenham algorithm error term */
+
+ x1 = TruncFP(x1, FRACTBITS-PREC);
+ y1 = TruncFP(y1, FRACTBITS-PREC);
+ x2 = TruncFP(x2, FRACTBITS-PREC);
+ y2 = TruncFP(y2, FRACTBITS-PREC);
+
+ dx = x2 - x1;
+ dy = y2 - y1;
+/*
+Find the starting x and y integer pel coordinates:
+*/
+
+ x = RoundFP(x1,PREC);
+ y = RoundFP(y1,PREC);
+ edgeP += y;
+ count = RoundFP(y2,PREC) - y;
+/*------------------------------------------------------------------*/
+/* Force dx to be positive so that dfy will be negative */
+/* this means that vertical moves will decrease d */
+/*------------------------------------------------------------------*/
+ if (dx<0)
+ {
+ dx = -dx;
+#define P PREC
+ d=(dy*(x1-(x<<P)+(1<<(P-1)))-dx*((y<<P)-y1+(1<<(P-1))))>>P;
+#undef P
+ while(--count >= 0 )
+ {
+ while(d<0)
+ {
+ --x;
+ d += dy;
+ }
+ *(edgeP++) = x;
+ d -= dx;
+ }
+ }
+ else /* positive dx */
+ {
+#define P PREC
+ d = (dy*((x<<P)-x1+(1<<(P-1)))-dx*((y<<P)-y1+(1<<(P-1))))>>P;
+#undef P
+ while(--count >= 0 )
+ {
+ while(d<0)
+ {
+ ++x;
+ d += dy;
+ }
+ *(edgeP++) = x;
+ d -= dx;
+ }
+ }
+}
diff --git a/Build/source/texk/ps2pkm/lines.h b/Build/source/texk/ps2pkm/lines.h
new file mode 100644
index 00000000000..44b0da1a178
--- /dev/null
+++ b/Build/source/texk/ps2pkm/lines.h
@@ -0,0 +1,37 @@
+/* $XConsortium: lines.h,v 1.2 91/10/10 11:18:23 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#define StepLine(R,x1,y1,x2,y2) t1_StepLine(R,x1,y1,x2,y2)
+#define Bresenham(e,x1,y1,x2,y2) t1_Bresenham(e,x1,y1,x2,y2)
+
+void t1_StepLine(); /* check for special conditions, call Bresenham */
+void t1_Bresenham(); /* produce run ends for lines */
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/mag.1 b/Build/source/texk/ps2pkm/mag.1
new file mode 100644
index 00000000000..8d9f2d4a261
--- /dev/null
+++ b/Build/source/texk/ps2pkm/mag.1
@@ -0,0 +1,68 @@
+.\" e
+.TH MAG 1 UMFT
+.de EX
+.sp
+.in +5
+.nf
+.ft CW
+..
+.de EE
+.in -5
+.ft R
+.sp
+.fi
+..
+.SH NAME
+mag \- computes fontsizes and magsteps
+.SH SYNOPSIS
+.B
+mag
+[-\fBR\fIdpi\fP\fP] magstep . . .
+
+.B
+mag
+[-\fBr\fP] [-\fBR\fP\fIdpi\fP] fontsize . . .
+
+.SH DESCRIPTION
+.EQ
+delim $$
+.EN
+This tool calculates fontsizes given magsteps. TeXfonts are provided as
+true sized fonts or as magnifications. The fontsize of a true sized
+font equals the resolution of the printer (ex. 300). The fontsize
+of a font magnified $n$ \fImagsteps\fP equals:
+.EQ
+1.2 sup{n} times 300
+delim off
+.EN
+rounded to its nearest integer value. Fontnames for TeX fonts normally
+consists of the name (\fIcmr\fP), pointsize (\fI10\fP), type (\fIpk\fP)
+and fontsize (\fI360\fP), for example: \fIcmr10.360pk\fP.
+
+.SH EXAMPLES
+The result of \fImag -R240 -2 0 0.5 1\fP will be:
+.EX
+167 240 263 288
+.EE
+
+The inverse function is computed with the \fI-r\fP option. The result of
+\fImag -r -R240 167 240 263 288\fP
+will be the fontsteps:
+.EX
+-2 0 0.5 1
+.EE
+
+The UNIX shells allow command substitution. One can write:
+.EX
+mag -r -R240 `mag -R240 -2 0 0.5 1`
+.EE
+
+.SH DATE
+18 December, 1989
+
+.SH AUTHOR
+.nf
+Piet Tutelaers
+University of Technology Eindhoven
+<rcpt@urc.tue.nl>
+
diff --git a/Build/source/texk/ps2pkm/mag.c b/Build/source/texk/ps2pkm/mag.c
new file mode 100644
index 00000000000..46bc55acd7d
--- /dev/null
+++ b/Build/source/texk/ps2pkm/mag.c
@@ -0,0 +1,143 @@
+/*
+ * .\" e
+ * .TH MAG 1 UMFT
+ * .SH NAME
+ * mag \- computes fontsizes and magsteps
+ *
+ * .de Ex
+ * .sp
+ * .RS
+ * .nf
+ * .ft C
+ * ..
+ * .de Xe
+ * .RE
+ * .sp
+ * .fi
+ * ..
+ * .SH SYNOPSIS
+ * .B
+ * mag
+ * [-\fBR\fIdpi\fP\fP] magstep . . .
+ *
+ * .B
+ * mag
+ * [-\fBr\fP] [-\fBR\fP\fIdpi\fP] fontsize . . .
+ *
+ * .SH DESCRIPTION
+ * .EQ
+ * delim $$
+ * .EN
+ * This tool calculates fontsizes given magsteps. TeXfonts are provided as
+ * true sized fonts or as magnifications. The fontsize of a true sized
+ * font equals the resolution of the printer (ex. 300). The fontsize
+ * of a font magnified $n$ \fImagsteps\fP equals:
+ * .EQ
+ * 1.2 sup{n} times 300
+ * delim off
+ * .EN
+ * rounded to its nearest integer value. Fontnames for TeX fonts normally
+ * consists of the name (\fIcmr\fP), pointsize (\fI10\fP), type (\fIpk\fP)
+ * and fontsize (\fI360\fP), for example: \fIcmr10.360pk\fP.
+ *
+ * .SH EXAMPLES
+ * The result of \fImag -R240 -2 0 0.5 1\fP will be:
+ * .Ex
+ * 167 240 263 288
+ * .Xe
+ *
+ * The inverse function is computed with the \fI-r\fP option. The result of
+ * \fImag -r -R240 167 240 263 288\fP
+ * will be the fontsteps:
+ * .Ex
+ * -2 0 0.5 1
+ * .Xe
+ *
+ * The UNIX shells allow command substitution. One can write:
+ * .Ex
+ * mag -r -R240 `mag -R240 -2 0 0.5 1`
+ * .Xe
+ *
+ * .SH DATE
+ * August, 1992
+ *
+ * .SH AUTHOR
+ * .nf
+ * Piet Tutelaers
+ * University of Technology Eindhoven
+ * rcpt@urc.tue.nl
+ */
+
+#include <ctype.h>
+#include <math.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "basics.h" /* fatal() */
+
+int invert = 0;
+float DPI = 300.0;
+
+int main(int argc, char *argv[]) {
+ float sz, arg; int c;
+ char *myname = "mag";
+ short done;
+
+ /* prototypes */
+ int fontsize(double);
+ double stepsize(double);
+
+ while (--argc > 0 && (*++argv)[0] == '-') {
+ if (isdigit((int)(*argv)[1])) { /* allow negative numbers as arguments */
+ break;
+ }
+ done=0;
+ while ((!done) && (c = *++argv[0])) /* allow -bcK like options */
+ switch (c) {
+ case 'r':
+ invert = 1; break;
+ case 'R':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ DPI = atof(argv[0]);
+ done = 1;
+ break;
+ default:
+ fatal("%s: %c illegal option\n", myname, c);
+ }
+ }
+
+ if (argc < 1)
+ fatal("Usage: %s [-r] [-Rdpi] size . . .\n", myname);
+
+ for ( ; argc; argc--, argv++) {
+ arg=atof(argv[0]);
+ switch (invert) {
+ case 0:
+ printf("%d%c", fontsize(arg), argc > 1 ? ' ' : '\n');
+ break;
+ case 1:
+ sz=stepsize(arg);
+ if (((int)(10*sz))%10==0)
+ printf("%d%c", (int)sz, argc > 1 ? ' ' : '\n');
+ else
+ printf("%f%c", sz, argc > 1 ? ' ' : '\n');
+ }
+ }
+ return 0;
+}
+
+int fontsize(x) double x;
+{
+ return(DPI*pow(1.2, x) + 0.5);
+}
+
+double stepsize(x) double x;
+{ double s;
+ s=(log(x)-log(DPI))/log(1.2);
+ if (s>=0) return floor(10*s+0.5)/10;
+ return -floor(10*(-s)+0.5)/10;
+}
diff --git a/Build/source/texk/ps2pkm/objects.c b/Build/source/texk/ps2pkm/objects.c
new file mode 100644
index 00000000000..029fd946117
--- /dev/null
+++ b/Build/source/texk/ps2pkm/objects.c
@@ -0,0 +1,1149 @@
+/* $XConsortium: objects.c,v 1.5 92/03/20 15:56:06 eswu Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* OBJECTS CWEB V0025 ******** */
+/*
+:h1.OBJECTS Module - TYPE1IMAGER Objects Common Routines
+
+This module defines and implements the C structures that represent
+objects in the TYPE1IMAGER. All common routines for manipulating these
+objects are defined in this module. Specific routines for
+specific objects are defined in the modules that deal with that
+object type.
+
+
+&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com)
+
+
+:h3.Include Files
+
+The included files are:
+*/
+#define GLOBALS 1 /* see :hdref refid=debugvar. */
+/*
+The following two includes are C standards; we include them because we
+use 'toupper' and the 'str'-type functions in this module. Potentially
+these may be defined as macros; if these ".h" files do not exist on your
+system it is a pretty safe bet that these are external entry points and
+you do do not need to include these header files.
+*/
+
+#include "types.h"
+#include <string.h>
+#include <ctype.h>
+
+/*
+override incorrect system functions; for example you might define
+a macro for "strcpy" that diverts it to "my_strcpy".
+*/
+
+ /* moved these includes from above the */
+ /* was included first (it contains com- */
+ /* piler defines). dsr 081291 */
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+#include "regions.h"
+#include "fonts.h"
+#include "pictures.h"
+#include "strokes.h"
+#include "cluts.h"
+static char *TypeFmt();
+static int ObjectPostMortem(struct xobject *obj);
+
+/*
+:h3.The "pointer" Macro - Define a Generic Pointer
+
+Sadly, many compilers will give a warning message when a pointer to
+one structure is assigned to a pointer to another. We've even seen
+some that give severe errors (when the wrong pointer type is used as
+an initializer or returned from a function). TYPE1IMAGER has routines
+like Dup and Allocate that are perfectly willing to duplicate or
+allocate any of a number of different types of structures. How to
+declare them in a truely portable way?
+
+Well, there is no single good answer that I've found. You can always
+beg the question and "cast" everything. I find this distracting and the
+resulting code ugly. On the other hand, we have found at least one
+compiler that will accept "void *" as a generic pointer that can
+assigned to any other pointer type without error or warning (apparently
+this is also the ANSI standard). So, we define "void *" to be a generic
+pointer. (You might have to change this for your compiler; the "ifndef"
+allows the change to be made on the command line if you want.)
+:i1/portability assumptions/
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Functions Provided to the TYPE1IMAGER User
+
+This module provides the following TYPE1IMAGER entry points:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+Note that entry points that are intended for use external to TYPE1IMAGER
+begin with the characters :q/xi/. Macros are used to make the names
+more mnemonic.
+*/
+
+/*
+:h3.Functions Provided to Other Modules
+
+This module provides the following functions for other modules:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+Note that entry points that intended for use within TYPE1IMAGER, but
+which must be global because they are used across module boundaries,
+begin with the characters :q/I_/. Macros are used to make the names
+more mnemonic.
+
+Entry points totally within a module use mnemonic names and are
+declared :hp2/static/. One of the compilers I used had a bug when
+static functions were passed as addresses. Thus, some functions
+which are logically "static" are not so declared.
+
+Note also the trick of declaring routines, like Consume(), with a
+variable number of arguments. To avoid the restrictions on variable
+numbers of arguments in the macro processor, we just replace the
+text 'Consume' with 'I_Consume'.
+*/
+/*
+:h3.Macros Provided to Other Modules
+
+This is the module where we define all the useful constants like
+TRUE, FALSE, and NULL, and simple expressions like MIN(), MAX(), and ABS().
+We might as well get to it right here:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+Notice that upper case is used for constant values and macro
+definitions. I generally follow that convention.
+
+Many more global macros are defined later in this module.
+*/
+/*
+:h2.Basic TYPE1IMAGER Object Structure
+
+All TYPE1IMAGER objects which are available to the user have a common
+header. This header is defined below:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+The following define is an attempt to centralize the definition of the
+common xobject data shared by structures that are derived from the
+generic xobject structure. For example, the structure font, defined in
+fonts.shr :
+&code.
+ struct font {
+ char type;
+ char flag;
+ int references;
+ ... other data types & structs ...
+ }
+&ecode.
+would now be defined as:
+&code.
+ struct font {
+ XOBJ_COMMON
+ ... other data types & structs ...
+ }
+&ecode.
+Thus we have a better-structured inheritance mechanism. 3-26-91 PNM
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Object Type Definitions
+
+These constants define the values which go in the 'type' field of
+an TYPE1IMAGER object structure:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Flag Byte Definitions
+
+Many programmers define flag bits as a mask (for example, 0x04), and
+test, set, and reset them as follows:
+
+&code.
+ if ((flag & PERMANENT) != 0)
+
+ flag |= PERMANENT;
+ flag &= &inv.PERMANENT;
+:exmp.
+
+I favor a style where the 'if' statement can ask a question:
+
+&code.
+ if (ISPERMANENT(flag))
+
+ flag |= ISPERMANENT(ON);
+ flag &= &inv.ISPERMANENT(ON);
+
+:exmp.
+This said, we now define two bit settings of the flag byte of the
+object. "ISPERMANENT" will be set by the user, when he calls
+Permanent(). "ISIMMORTAL" will be used for compiled-in objects
+that we don't want the user to ever destroy.
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+Flag bit definitions that apply to all objects are assigned
+starting with the least significant (0x01) bit. Flag bit definitions
+specific to a certain object type are assigned starting with the
+most significant (0x80) bit. We hope they never meet.
+*/
+/*
+:h3 id=preserve.PRESERVE() Macro
+
+Occasionally an TYPE1IMAGER operator is implemented by calling other
+TYPE1IMAGER operators. For example, Arc2() calls Conic(). When we
+call more than one operator as a subroutine, we have to be careful
+of temporary objects. A temporary object will be consumed by the
+subroutine operator and then is no longer available for the caller.
+This can be prevented simply by bumping a temporary object's reference
+count.
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.RefRoll() Macro to Detect References Count Rollover
+
+The following macro is designed to check for reference count rollover.
+A return value of TRUE means rollover has not occurred; a return value
+of FALSE means we cannot increment the reference count. Note also that
+those functions that use this macro must decrement the reference count
+afterwards. 3-26-91 PNM
+*/
+
+#define RefRoll(obj) (++(obj)->references > 0)
+
+/*
+:h2.TYPE1IMAGER Object Functions
+
+:h3.LONGCOPY() - Macro to Copy "long" Aligned Data
+
+Copying arbitrary bytes in C is a bit of a problem. "strcpy" can't be
+used, because 0 bytes are special-cased. Most environments have a
+routine "memcopy" or "bcopy" or "bytecopy" that copies memory containing
+zero bytes. Sadly, there is no standard on the name of such a routine,
+which makes it impossible to write truely portable code to use it.
+
+It turns out that TYPE1IMAGER, when it wants to copy data, frequently
+knows that both the source and destination are aligned on "long"
+boundaries. This allows us to copy by using "long *" pointers. This
+is usually very efficient on almost all processors. Frequently, it
+is more efficient than using general-purpose assembly language routines.
+So, we define a macro to do this in a portable way. "dest" and "source"
+must be long-aligned, and "bytes" must be a multiple of "sizeof(long)":
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Allocate() - Allocating a Memory Block
+
+Allocate returns a pointer to memory object that is a copy of
+the template passed (if any). In addition, extra bytes may be
+allocated contiguously with the object. (This may be useful for
+variable size objects such as edge lists. See :hdref refid=regions..)
+
+Allocate() always returns a non-immortal object, even if the template is
+immortal. Therefore a non-NULL template must have a "flag" byte.
+
+If the template is NULL, then 'size' bytes are cleared to all NULLs.
+
+If the template is non-NULL, a new object is allocated in memory.
+It therefore seems logical that its reference count field should be
+set to 1. So, a nun-NULL template must also have a "references" field.
+PNM 3-26-91
+*/
+
+struct xobject *t1_Allocate(size, template, extra) /* non-ANSI; type checking was too strict */
+ register int size; /* number of bytes to allocate & initialize */
+ register struct xobject *template; /* example structure to allocate */
+ register int extra; /* any extra uninitialized bytes needed contiguously */
+{
+#ifdef WIN32
+ extern char *Xalloc(int); /* standard C routine */
+#else
+ extern char *Xalloc(); /* standard C routine */
+#endif
+ register struct xobject *r;
+
+ /*
+ * round up 'size' and 'extra' to be an integer number of 'long's:
+ */
+ size = (size + sizeof(LONG) - 1) & -sizeof(LONG);
+ extra = (extra + sizeof(LONG) - 1) & -sizeof(LONG);
+ if (size + extra <= 0)
+ t1_abort("Non-positive allocate?");
+ r = (struct xobject *) Xalloc(size + extra);
+
+ while (r == NULL) {
+ if (!GimeSpace()) {
+ IfTrace1(TRUE, "malloc attempted %d bytes.\n",
+ size + extra);
+ t1_abort("We have REALLY run out of memory");
+ }
+ r = (struct xobject *) Xalloc(size + extra);
+ }
+
+ /*
+ * copy the template into the new memory:
+ */
+ if (template != NULL) {
+ /* Added references count decrement if template is not permanent.
+ This is for the case where Allocate is called by a Dupxxxx
+ function, which was in turn called by Unique(). (PNM) */
+ if (!ISPERMANENT(template->flag))
+ --template->references;
+ LONGCOPY(r, template, size);
+ r->flag &= ~(ISPERMANENT(ON) | ISIMMORTAL(ON));
+ /* added reference field 3-2-6-91 PNM */
+ r->references = 1;
+ }
+ else {
+ register char **p1;
+
+ for (p1=(char **)r; size > 0; size -= sizeof(char *))
+ *p1++ = NULL;
+ }
+
+ if (MemoryDebug > 1) {
+ register int *L;
+ L = (int *) r;
+ IfTrace4(TRUE, "Allocating at %p: %x %x %x\n",
+ L, L[-1], L[0], L[1]);
+ }
+ return(r);
+}
+
+/*
+:h3.Free() - Frees an Allocated Object
+
+This routine makes a sanity check to make sure the "type" field of the
+standard object structure has not been cleared. If the object is
+not a standard structure, then the macro "NonObjectFree" is available
+that does not perform this check.
+
+In either case, the object must not be the NULL pointer. This preserves
+portability, as the C system Xfree() will not always accept NULL.
+*/
+
+void Free(obj) /* non-ANSI to avoid overly strict type checking */
+ register struct xobject *obj; /* structure to free */
+{
+ if (obj->type == INVALIDTYPE)
+ t1_abort("Free of already freed object?");
+ obj->type = INVALIDTYPE;
+
+ if (MemoryDebug > 1) {
+ register int *L;
+ L = (int *) obj;
+ IfTrace4(TRUE,"Freeing at %p: %x %x %x\n", L, L[-1], L[0], L[1]);
+ }
+
+ Xfree(obj);
+}
+
+/*
+:h3.Permanent() - Makes an Object Permanent
+
+Real simple--just set a flag. Every routine that consumes its objects
+(which is almost every user entry) must check this flag, and not consume
+the object if it is set.
+
+If a temporary object is made permanent, and there is more than one
+reference to it, we must first Copy() it, then set the ISPERMANENT
+flag. Note also that the reference count must be incremented when an
+object is changed from temporary to permanent (see the ISUNIQUE macro).
+
+Note that the purpose of this function is to convert an object into a
+permanent object:
+ If it was permanent to begin with, we do nothing;
+ If it was temporary and unique, we set the PERMANENT flag and increment
+the reference count;
+ If it was temporary and nonunique, we must make a unique Copy(), set
+the PERMANENT flag, and set the reference count to 2. We must also
+decrement the original object's reference count, because what we have
+done is to change one of the old temporary handles to a permanent one.
+3-26-91 PNM
+*/
+
+struct xobject *t1_Permanent(obj) /* non-ANSI to avoid overly strict type checking */
+ register struct xobject *obj; /* object to be made permanent */
+{
+ IfTrace1((MustTraceCalls),"Permanent(%p)\n", obj);
+
+ if ( (obj != NULL) && ( !(ISPERMANENT(obj->flag)) ) )
+ {
+ /* there is a non-NULL, temporary object to be made permanent.
+ If there are multiple references to this object, first get
+ a new COPY().
+ Note also that we have to decrement the reference count if
+ we do a Copy() here, because we are consuming the temporary
+ argument passed, and returning a unique, permanent one.
+ */
+ if ( obj->references > 1)
+ {
+ obj = Copy(obj);
+ }
+ /* now set the permanent flag, and increment the reference
+ count, since a temporary object has now become permanent. */
+ obj->references++;
+ obj->flag |= ISPERMANENT(ON);
+ }
+ return(obj);
+}
+
+/*
+:h3.Temporary() - Undoes the Effect of "Permanent()"
+
+This simply resets the "ISPERMANENT" flag.
+
+If a permanent object is made temporary, and there is more than one reference
+to it, we must first Copy() it, then reset the ISPERMANENT flag. However,
+if the permanent object has obly one reference, we need only decrement the
+reference count ( and reset the flag).
+
+Note that this function, in the case of a PERMANENT argument, basically
+converts the PERMANENT handle to a TEMPORARY one. Thus, in the case of
+a nonunique, permanent argument passed, we not only make a Copy(),
+we also decrement the reference count, to reflect the fact that we have
+lost a permanent handle and gained a temporary one.
+PNM 3-2-6-91
+*/
+
+struct xobject *xiTemporary(obj) /* non-ANSI to avoid overly strict type checking */
+ register struct xobject *obj; /* object to be made permanent */
+{
+ IfTrace1((MustTraceCalls),"Temporary(%p)\n", obj);
+
+ if (obj != NULL) {
+ /* if it's already temporary, there's nothing to do. */
+ if ISPERMANENT(obj->flag)
+ {
+ /* if there are multiple references to this object, get a
+ Copy we can safely alter. Recall that the reference count
+ is incremented for permanent objects.
+ Recall further that Copy returns an object with the
+ same flag state and a reference count of 2 (for PERMANENT
+ objects).
+ Thus, regardless of whether or not we need to copy a
+ permanent object, we still decrement its reference
+ count and reset the flag.
+ */
+ if (obj->references != 2 || ISIMMORTAL(obj->flag))
+ {
+ /* not unique; consume handle, get a temporary Copy! */
+ obj = Copy(obj);
+ }
+ /* else decrement the reference count (since it's going from
+ permanent to temporary) and clear the flag. */
+ else {
+ obj->references--;
+ obj->flag &= ~ISPERMANENT(ON);
+ }
+ }
+ }
+ return(obj);
+}
+
+/*
+:h3.Dup() - Duplicate an Object
+
+Dup will increment the reference count of an object, only making a
+Copy() if needed.
+Note that Dup() retains the state of the permanent flag.
+3-26-91 PNM
+*/
+
+
+struct xobject *t1_Dup(obj) /* non-ANSI avoids overly strict type checking */
+ register struct xobject *obj; /* object to be duplicated */
+{
+ register char oldflag; /* copy of original object's flag byte */
+
+ IfTrace1((MustTraceCalls),"Dup(%p)\n", obj);
+
+ if (obj == NULL)
+ return(NULL);
+ /* An immortal object must be Copy'ed, so that we get a mortal
+ copy of it, since we try not to destroy immortal objects. */
+ if (ISIMMORTAL(obj->flag))
+ return(Copy(obj));
+
+ /* if incrementing the reference count doesn't cause the count
+ to wrap, simply return the object with the count bumped. Note
+ that the RefRoll macro increments the count to perform the
+ rollover check, so we must decrement the count. */
+ if (RefRoll(obj))
+ return(obj);
+
+ /* that didn't work out, so put the count back and call Copy(). */
+ --obj->references;
+ oldflag = obj->flag;
+ obj = Copy(obj);
+ if (ISPERMANENT(oldflag))
+ obj = Permanent(obj);
+ return(obj);
+}
+
+/*
+:h3.Copy() - Make a New Copy of an Object
+
+This is the generic Copy() where the object type is unknown. There
+are specific Copyxxx functions for known object types.
+
+Copy will create a NEW temporary object, and WILL NOT simply bump the
+reference count.
+
+Sometimes duplicating an object is just as simple as Allocating with it
+as a template. But other objects are complicated linked lists. So, we
+let each module provide us a routine (or macro) that duplicates the
+objects it knows about.
+*/
+
+struct xobject *t1_Copy(obj)
+ register struct xobject *obj; /* object to be Copy'ed */
+{
+ if (obj == NULL)
+ return(NULL);
+
+ if (ISPATHTYPE(obj->type))
+ obj = (struct xobject *) CopyPath(obj);
+ else
+ switch (obj->type) {
+ case SPACETYPE:
+ obj = (struct xobject *) CopySpace(obj); break;
+ case FONTTYPE:
+ obj = (struct xobject *) CopyFont(obj); break;
+ case REGIONTYPE:
+ obj = (struct xobject *) CopyRegion(obj); break;
+ case PICTURETYPE:
+ obj = (struct xobject *) CopyPicture(obj); break;
+ case LINESTYLETYPE:
+ obj = (struct xobject *) CopyLineStyle(obj); break;
+ case STROKEPATHTYPE:
+ obj = (struct xobject *) CopyStrokePath(obj); break;
+ case CLUTTYPE:
+ obj = (struct xobject *) CopyCLUT(obj); break;
+ default:
+ return(ArgErr("Copy: invalid object", obj, NULL));
+ }
+
+ return(obj);
+}
+
+/*
+:h3.Destroy() - Destroys an Object
+
+This can get complicated. Just like with Copy(), we let the experts
+handle it.
+*/
+struct xobject *Destroy(obj) /* non-ANSI avoids overly strict type checking */
+ register struct xobject *obj; /* object to be destroyed */
+{
+ IfTrace1((MustTraceCalls),"Destroy(%p)\n", obj);
+
+ if (obj == NULL)
+ return(NULL);
+ if (ISIMMORTAL(obj->flag)) {
+ IfTrace1(TRUE,"Destroy of immortal object %p ignored\n", obj);
+ return(NULL);
+ }
+ if (ISPATHTYPE(obj->type))
+ KillPath(obj);
+ else {
+ switch (obj->type) {
+ case REGIONTYPE:
+ KillRegion(obj);
+ break;
+ case SPACETYPE:
+ KillSpace(obj);
+ break;
+ case LINESTYLETYPE:
+ KillLineStyle(obj);
+ break;
+ case FONTTYPE:
+ KillFont(obj);
+ break;
+ case PICTURETYPE:
+ KillPicture(obj);
+ break;
+ case STROKEPATHTYPE:
+ KillStrokePath(obj);
+ break;
+ case CLUTTYPE:
+ KillCLUT(obj);
+ break;
+ default:
+ return(ArgErr("Destroy: invalid object", obj, NULL));
+ }
+ }
+ return(NULL);
+}
+/*
+:h2.Generally Useful Macros
+
+:h3.FOLLOWING() - Macro to Point to the Data Following a Structure
+
+There are several places in TYPE1IMAGER where we will allocate variable
+data that belongs to a structure immediately after that structure.
+This is a performance technique, because it reduces the number of
+trips we have to take through Xalloc() and Xfree(). It turns out C has
+a very convenient way to point past a structure--if 'p' is a pointer
+to a structure, 'p+1' is a pointer to the data after it. This
+behavior of C is somewhat startling and somewhat hard to follow, if
+you are not used to it, so we define a macro to point to the data
+following a structure:
+*/
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.TYPECHECK() - Verify the Type of an Argument
+
+This macro tests the type of an argument. If the test fails, it consumes
+any other arguments as necessary and causes the imbedding routine to
+return the value 'whenBAD'.
+
+Note that the consumeables list should be an argument list itself, for
+example (0) or (2,A,B). See :hdref refid=consume. below.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.ARGCHECK() - Perform an Arbitrary Check on an Argument
+
+This macro is a generalization of TYPECHECK to take an arbitrary
+predicate. If the error occurs (i.e., the predicate is true), the
+arbitrary message 'msg' is returned.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.TYPENULLCHECK() - Extension of TYPECHECK() for NULL arguments
+
+Many routines allow NULLs to be passed as arguments. 'whenBAD' will
+be returned in this case, too.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.MAKECONSUME() - Create a "Consume"-type Macro
+
+Consuming an object means destroying it if it is not permanent. This
+logic is so common to all the routines, that it is immortalized in this
+macro. For example, ConsumePath(p) can be simply defined as
+MAKECONSUME(p,KillPath(p)). In effect, this macro operates on a
+meta-level.
+:i1/consuming objects/
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.MAKEUNIQUE() - Create a "Unique"-type Macro
+
+Many routines are written to modify their arguments in place. Thus,
+they want to insure that they duplicate an object if it is permanent.
+This is called making an object "unique". For example, UniquePath(p)
+can be simply defined as MAKEUNIQUE(p,DupPath(p)).
+:i1/unique objects/
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+An object is unique (and directly alterable) if there is only one
+reference to it, and it is not permanent (in which case we increment
+the reference count, so we don't have to check the permanent bit).
+3-26-91 PNM
+
+Note the rules for making a unique object:
+&drawing.
+ IF (obj->references = 1) return(obj);
+ ELSE (references > 1)
+ IF (ISPERMANENT(obj->flag)) return(Dupxxx(obj));
+ ELSE (nonunique, temporary object!)
+ obj->references--; return(Dupxxx(obj));
+&edrawing.
+If we must make a Copy of a nonunique, temporary object, we decrement
+reference count of the original object!
+*/
+
+/*
+:h3.Unique() - Make a Unique Object
+
+Here is a generic 'Unique' function if the object type is not known.
+Why didn't we build it with the MAKEUNIQUE macro, you ask? Well, we
+used to, but there is at least one damn compiler in the world that
+raises errors if the types of an "(a) ? b : c" expression do not match.
+Also, when we changed Dup() to retain the permanent/temporary flag, we
+wanted to make sure "Unique" always returned a temporary object.
+
+Note that we cannot use Dup() to create a copy of the object in question,
+because Dup() may simply bump the reference count, and not return a
+unique copy to us. That is why we use t1_Copy().
+
+The purpose of this function is to make sure we have a copy of an object
+that we can safely alter:
+:ol.
+:li.If we have a unique, temporary object, we simply return the argument.
+:li.If we have a nonunique, temporary object, we have to make a new copy
+of it, and decrement the reference count of the original object, to reflect
+the fact that we traded temporary handles.
+:li.If we have a permanent object, we make a temporary copy of it, but
+we do not decrement the reference count of the original permanent object,
+because permanent objects, by definition, are persistent. 3-2-6-91 PNM
+:eol.
+*/
+
+struct xobject *t1_Unique(obj)
+ struct xobject *obj;
+{
+ /* if the original object is not already unique, make a unique
+ copy...Note also that if the object was not permanent, we must
+ consume the old handle! 3-26-91 PNM
+ NOTE : consumption of the old handle moved to Allocate. 4-18-91 */
+ if (!obj || obj->references == 1)
+ return(obj);
+
+ obj = Copy(obj);
+ /* and make sure we return a temporary object ! */
+ if (ISPERMANENT(obj->flag))
+ {
+ obj->flag &= ~ISPERMANENT(ON);
+ obj->references--;
+ }
+ return(obj);
+}
+
+
+/*
+:h2.Initialization, Error, and Debug Routines
+
+:h3 id=debugvar.Declarations for Debug Purposes
+
+We declare all the debug flags here. Some link editors make the not
+unreasonable restriction that only one module may declare and
+initialize global variables; all the rest must declare the variable
+'extern'. This is logical, but is somewhat awkward to implement with
+C include files. We solve the problem by temporarily making the name
+'extern' a null name if GLOBALS is defined. (GLOBALS is only defined
+in this OBJECTS module.) Since 'externs' can't be initialized, we
+have to handle that with #defines too.
+:i1/GLOBALS (&#define.)/
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+static char *ErrorMessage = NULL;
+
+/*
+:h3.Pragmatics() - Set/Reset Debug Flags
+
+We provide a controlled way for the TYPE1IMAGER user to set and reset
+our debugging and tracing:
+*/
+void Pragmatics(username, value)
+ char *username; /* name of the flag */
+ int value; /* value to set it to */
+{
+ register char *p; /* temporary loop variable */
+#define NAMESIZE 40
+ char name[NAMESIZE]; /* buffer to store my copy of 'username' */
+
+ if (strlen(username) >= NAMESIZE)
+ t1_abort("Pragmatics name too large");
+ strcpy(name, username);
+ for (p = name; *p != '\0'; p++)
+ *p = toupper(*p);
+
+ if (!strcmp(name, "ALL"))
+ MustTraceCalls = InternalTrace = /* MustCrash = */
+ LineIOTrace = value;
+
+ else if (!strcmp(name, "LINEIOTRACE"))
+ LineIOTrace = value;
+
+ else if (!strcmp(name, "TRACECALLS"))
+ MustTraceCalls = value;
+
+ else if (!strcmp(name, "CHECKARGS"))
+ MustCheckArgs = value;
+
+ else if (!strcmp(name, "PROCESSHINTS"))
+ ProcessHints = value;
+
+ else if (!strcmp(name, "SAVEFONTPATHS"))
+ SaveFontPaths = value;
+
+ else if (!strcmp(name, "CRASTERCOMPRESSIONTYPE"))
+ CRASTERCompressionType = value;
+
+ else if (!strcmp(name, "CRASHONUSERERROR"))
+ MustCrash = value;
+
+ else if (!strcmp(name, "DEBUG"))
+ StrokeDebug = SpaceDebug = PathDebug = ConicDebug = LineDebug =
+ RegionDebug = MemoryDebug = FontDebug =
+ HintDebug = ImageDebug = OffPageDebug = value;
+
+ else if (!strcmp(name, "CONICDEBUG"))
+ ConicDebug = value;
+
+ else if (!strcmp(name, "LINEDEBUG"))
+ LineDebug = value;
+
+ else if (!strcmp(name, "REGIONDEBUG"))
+ RegionDebug = value;
+
+ else if (!strcmp(name, "PATHDEBUG"))
+ PathDebug = value;
+
+ else if (!strcmp(name, "SPACEDEBUG"))
+ SpaceDebug = value;
+
+ else if (!strcmp(name, "STROKEDEBUG"))
+ StrokeDebug = value;
+
+ else if (!strcmp(name, "MEMORYDEBUG"))
+ MemoryDebug = value;
+
+ else if (!strcmp(name, "FONTDEBUG"))
+ FontDebug = value;
+
+ else if (!strcmp(name, "HINTDEBUG"))
+ HintDebug = value;
+
+ else if (!strcmp(name, "IMAGEDEBUG"))
+ ImageDebug = value;
+
+ else if (!strcmp(name, "OFFPAGEDEBUG"))
+ OffPageDebug = value;
+
+#ifdef MC68000
+/*
+The following pragmatics flag turns on or off instruction histograming
+for performance analysis. It is only defined in the Delta card
+environment.
+*/
+ else if (!strcmp(name, "PROFILE")) {
+ if (value)
+ StartProfile();
+ else
+ StopProfile();
+ }
+#endif
+ else if (!strcmp(name, "FLUSHCACHE")) {
+ while (GimeSpace()) { ; }
+ }
+
+ else if (!strcmp(name, "CACHEDCHARS"))
+ CachedChars = (value <= 0) ? 1 : value;
+
+ else if (!strcmp(name, "CACHEDFONTS"))
+ CachedFonts = (value <= 0) ? 1 : value;
+
+ else if (!strcmp(name, "CACHEBLIMIT"))
+ CacheBLimit = value;
+
+ else if (!strcmp(name, "CONTINUITY"))
+ Continuity = value;
+
+
+ else {
+ printf("Pragmatics flag = '%s'\n", name);
+ ArgErr("Pragmatics: flag not known", NULL, NULL);
+ }
+ return;
+}
+
+/*
+:h3.Consume() - Consume a List of Arguments
+
+This general purpose routine is provided in the case where the object
+type(s) to be consumed are unknown or not yet verified, and/or it is
+not known whether the object is permanent.
+
+If the type of the argument is known, it is faster to directly consume
+that type, for example, ConsumeRegion() or ConsumePath(). Furthermore,
+if it is already known that the object is temporary, it is faster to
+just kill it rather than consume it, for example, KillSpace().
+*/
+
+#ifdef KPATHSEA
+void Consume PVAR1C(int, n, ap)
+{
+ struct xobject *arg;
+ int i;
+
+ for(i = 0; i < n; i++) {
+ arg = va_arg(ap, struct xobject *);
+ if (arg != NULL && !ISPERMANENT(arg->flag))
+ Destroy(arg);
+ }
+ va_end(ap);
+ return;
+}}
+#else
+void Consume(n, obj1, obj2, obj3) /* non-ANSI avoids overly strict type checking */
+ int n;
+ struct xobject *obj1,*obj2,*obj3;
+{
+ switch(n) {
+
+ case 0:
+ return;
+
+ case 1:
+ if (obj1 != NULL && !ISPERMANENT(obj1->flag))
+ Destroy(obj1);
+ return;
+
+ case 2:
+ if (obj1 != NULL && !ISPERMANENT(obj1->flag))
+ Destroy(obj1);
+ if (obj2 != NULL && !ISPERMANENT(obj2->flag))
+ Destroy(obj2);
+ return;
+
+ case 3:
+ if (obj1 != NULL && !ISPERMANENT(obj1->flag))
+ Destroy(obj1);
+ if (obj2 != NULL && !ISPERMANENT(obj2->flag))
+ Destroy(obj2);
+ if (obj3 != NULL && !ISPERMANENT(obj3->flag))
+ Destroy(obj3);
+ return;
+
+ default:
+ t1_abort("Consume: too many objects");
+ }
+}
+#endif /* WIN32 */
+/*
+:h3.TypeErr() - Handles "Invalid Object Type" Errors
+*/
+
+struct xobject *TypeErr(name, obj, expect, ret) /* non-ANSI avoids overly strict type checking */
+ char *name; /* Name of routine (for error message) */
+ struct xobject *obj; /* Object in error */
+ int expect; /* type expected */
+ struct xobject *ret; /* object to return to caller */
+{
+ static char typemsg[80];
+
+ if (MustCrash)
+ LineIOTrace = TRUE;
+
+ sprintf(typemsg, "Wrong object type in %s; expected %s seen %s\n",
+ name, TypeFmt(expect), TypeFmt(obj->type));
+ IfTrace0(TRUE,typemsg);
+
+ ObjectPostMortem(obj);
+
+ if (MustCrash)
+ t1_abort("Terminating because of CrashOnUserError...");
+ else
+ ErrorMessage = typemsg;
+
+/* changed ISPERMANENT to ret->references > 1 3-26-91 PNM */
+ if (ret != NULL && (ret->references > 1))
+ ret = Dup(ret);
+ return(ret);
+}
+
+/*
+:h4.TypeFmt() - Returns Pointer to English Name of Object Type
+
+This is a subroutine of TypeErr().
+*/
+
+static char *TypeFmt(type)
+ int type; /* type field */
+{
+ char *r;
+
+ if (ISPATHTYPE(type))
+ if (type == TEXTTYPE)
+ r = "path or region (from TextPath)";
+ else
+ r = "path";
+ else {
+ switch (type) {
+ case INVALIDTYPE:
+ r = "INVALID (previously consumed?)";
+ break;
+ case REGIONTYPE:
+ r = "region";
+ break;
+ case SPACETYPE:
+ r = "XYspace";
+ break;
+ case LINESTYLETYPE:
+ r = "linestyle";
+ break;
+ case FONTTYPE:
+ r = "font";
+ break;
+ case PICTURETYPE:
+ r = "picture";
+ break;
+ case STROKEPATHTYPE:
+ r = "path (from StrokePath)";
+ break;
+ default:
+ r = "UNKNOWN";
+ break;
+ }
+ }
+ return(r);
+}
+/*
+:h4.ObjectPostMortem() - Prints as Much as We Can About a Bad Object
+
+This is a subroutine of TypeErr() and ArgErr().
+*/
+
+static int ObjectPostMortem(register struct xobject *obj)
+{
+ extern struct XYspace *USER;
+
+ Pragmatics("Debug", 10);
+ IfTrace2(TRUE,"Bad object is of %s type %p\n", TypeFmt(obj->type), obj);
+
+ IfTrace0((obj == (struct xobject *) USER),
+ "Suspect that InitImager() was omitted.\n");
+ Pragmatics("Debug", 0);
+
+ /* NOTREACHED? */
+ return 0;
+}
+
+/*
+:h3.ArgErr() - Invalid Argument Passed to a Routine
+
+A common routine to report argument errors. It is usually called
+is returned to the caller in case MustCrash is FALSE and ArgErr
+returns to its caller.
+*/
+
+struct xobject *ArgErr(str, obj, ret) /* non-ANSI avoids overly strict type checking */
+ char *str; /* description of error */
+ struct xobject *obj; /* object, if any, that was in error */
+ struct xobject *ret; /* object returned to caller or NULL */
+{
+ if (MustCrash)
+ LineIOTrace = TRUE;
+ IfTrace1(TRUE,"ARGUMENT ERROR-- %s.\n", str);
+ if (obj != NULL)
+ ObjectPostMortem(obj);
+ if (MustCrash)
+ t1_abort("Terminating because of CrashOnUserError...");
+ else
+ ErrorMessage = str;
+ return(ret);
+}
+
+/*
+:h3.t1_abort() - Crash Due to Error
+
+We divide by zero, and if that doesn't work, call exit(), the results of
+which is system dependent (and thus is part of the Hourglass required
+environment).
+*/
+static int test = 0;
+
+/*ARGSUSED*/
+void t1_abort(str)
+ char *str;
+{
+ LineIOTrace = TRUE;
+ IfTrace1(TRUE,"\nABORT: reason='%s'\n", str);
+ TraceClose();
+ test = 1/test;
+ exit(99);
+}
+
+/*
+:h3.REAL Miscellaneous Stuff
+
+:h4.ErrorMsg() - Return the User an Error Message
+*/
+
+char *ErrorMsg()
+{
+ register char *r;
+
+ r = ErrorMessage;
+ ErrorMessage = NULL;
+ return(r);
+}
+
+/*
+:h4.InitImager() - Initialize TYPE1IMAGER
+
+We check that a short is 16 bits and a long 32 bits; we have made
+those assumptions elsewhere in the code. (This is almost a C standard,
+anyway.) Note that TYPE1IMAGER makes no assumptions about the size of an
+'int'!
+:i1/portability assumptions/
+*/
+void InitImager()
+{
+
+/* Check to see if we have been using our own malloc. If so,*/
+/* Undef malloc so that we can get to the system call. */
+/* All other calls to malloc are defined to Xalloc. */
+
+ if (sizeof(SHORT) != 2 || sizeof(LONG) != 4)
+ t1_abort("Fundamental TYPE1IMAGER assumptions invalid in this port");
+ InitSpaces();
+ InitFonts();
+ InitFiles();
+/*
+In some environments, constants and/or exception handling need to be
+*/
+ LibInit();
+}
+/*
+:h4.TermImager() - Terminate TYPE1IMAGER
+
+This only makes sense in a server environment; true TYPE1IMAGER needs do
+nothing.
+*/
+void TermImager()
+{
+ return;
+}
+/*
+:h4.reportusage() - A Stub to Get a Clean Link with Portable PMP
+*/
+void reportusage()
+{
+ return;
+}
diff --git a/Build/source/texk/ps2pkm/objects.h b/Build/source/texk/ps2pkm/objects.h
new file mode 100644
index 00000000000..3a6020d0362
--- /dev/null
+++ b/Build/source/texk/ps2pkm/objects.h
@@ -0,0 +1,320 @@
+/* $XConsortium: objects.h,v 1.6 92/03/20 14:35:56 keith Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+/*END SHARED*/
+/*SHARED*/
+
+#ifdef WIN32
+#include <stdio.h>
+#include <stdlib.h>
+#include <kpathsea/kpathsea.h>
+#include <c-auto.h>
+#endif
+
+#include "types.h"
+
+#define Permanent(obj) t1_Permanent(obj)
+#define Temporary(obj) t1_Temporary(obj)
+#define Destroy(obj) t1_Destroy(obj)
+#define Dup(obj) t1_Dup(obj)
+#define InitImager() t1_InitImager()
+#define TermImager() t1_TermImager()
+#define Pragmatics(f,v) t1_Pragmatics(f,v)
+#define ErrorMsg() t1_ErrorMsg()
+
+struct xobject *t1_Permanent(); /* make an object permanent */
+struct xobject *t1_Temporary(); /* make an object temporary */
+struct xobject *t1_Destroy(); /* destroy an object */
+struct xobject *t1_Dup(); /* duplicate an object */
+void t1_InitImager(); /* initialize TYPE1IMAGER */
+void t1_TermImager(); /* terminate TYPE1IMAGER */
+void t1_Pragmatics(); /* set debug flags, etc. */
+char *t1_ErrorMsg(); /* return last TYPE1IMAGER error message */
+
+/*END SHARED*/
+/*SHARED*/
+
+#define Allocate(n,t,s) t1_Allocate(n,t,s)
+#define Free(obj) t1_Free(obj)
+#define NonObjectFree(a) Xfree(a)
+#define Consume t1_Consume
+#define ArgErr(s,o,r) t1_ArgErr(s,o,r)
+#define TypeErr(n,o,e,r) t1_TypeErr(n,o,e,r)
+#define Copy(obj) t1_Copy(obj)
+#define Unique(obj) t1_Unique(obj)
+
+void t1_abort(); /* crash; software logic error */
+struct xobject *t1_Allocate(); /* allocate memory */
+void t1_Free(); /* free memory */
+struct xobject *t1_Unique(); /* make a unique temporary copy of an object */
+struct xobject *t1_ArgErr(); /* handle argument errors */
+struct xobject *t1_TypeErr(); /* handle 'bad type' argument errors */
+#ifdef KPATHSEA
+void t1_Consume PVAR1H(int); /* consume a variable number of arguments */
+#else
+void t1_Consume(); /* consume a variable number of arguments */
+#endif
+struct xobject *t1_Copy(); /* make a new copy, not reference bump PNM */
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ON (~0) /* all bits on */
+#ifndef FALSE
+#define FALSE 0 /* handy zero value */
+#endif
+#ifndef TRUE
+#define TRUE 1 /* handy non-zero value */
+#endif
+
+#ifndef NULL
+#define NULL 0
+/*
+The NULL pointer is system specific. (Most systems, however, use 0.)
+TYPE1IMAGER could have its own NULL, independent of the rest of the system,
+were it not for malloc(). The system call malloc() returns NULL when
+out of memory.
+:i1/portibility assumptions/
+*/
+#endif
+
+#ifdef MAX
+#undef MAX
+#endif
+
+#ifdef MIN
+#undef MIN
+#endif
+
+#ifdef ABS
+#undef ABS
+#endif
+
+#define MIN(a,b) (((a)<(b)) ? a : b)
+#define MAX(a,b) (((a)>(b)) ? a : b)
+#define ABS(a) (((a)>=0)?(a):-(a))
+
+/*END SHARED*/
+/*SHARED*/
+
+struct xobject {
+ char type; /* encoded type of object */
+ unsigned char flag; /* flag byte for temporary object characteristics */
+ short references; /* count of pointers to this object
+ (plus 1 for permanent objects) PNM */
+} ;
+
+/*END SHARED*/
+/*SHARED*/
+
+#define XOBJ_COMMON char type; unsigned char flag; short references;
+
+/*END SHARED*/
+/*SHARED*/
+
+
+#define INVALIDTYPE 0
+#define FONTTYPE 1
+#define REGIONTYPE 3
+#define PICTURETYPE 4
+#define SPACETYPE 5
+#define LINESTYLETYPE 6
+#define EDGETYPE 7
+#define STROKEPATHTYPE 8
+#define CLUTTYPE 9
+
+#define ISPATHTYPE(type) ((type)&0x10) /* all path segments have this bit on */
+#define LINETYPE (0+ISPATHTYPE(ON))
+#define CONICTYPE (1+ISPATHTYPE(ON))
+#define BEZIERTYPE (2+ISPATHTYPE(ON))
+#define HINTTYPE (3+ISPATHTYPE(ON))
+
+#define MOVETYPE (5+ISPATHTYPE(ON))
+#define TEXTTYPE (6+ISPATHTYPE(ON))
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ISPERMANENT(flag) ((flag)&0x01)
+#define ISIMMORTAL(flag) ((flag)&0x02)
+
+/*END SHARED*/
+/*SHARED*/
+
+#define PRESERVE(obj) if (!ISPERMANENT((obj)->flag)) \
+ (obj)->references++;
+
+/*END SHARED*/
+/*SHARED*/
+
+#define LONGCOPY(dest,source,bytes) { \
+ register LONG *p1 = (LONG *)dest; register LONG *p2 = (LONG *)source; \
+ register int count = (bytes) / sizeof(LONG); \
+ while (--count >= 0) *p1++ = *p2++; }
+
+
+/*END SHARED*/
+/*SHARED*/
+
+#define FOLLOWING(p) ((p)+1)
+
+/*END SHARED*/
+/*SHARED*/
+
+#define TYPECHECK(name, obj, expect, whenBAD, consumables, rettype) { \
+ if (obj->type != expect) { \
+ (Consume)consumables; \
+ return((rettype)TypeErr(name, obj, expect, whenBAD)); \
+ } \
+}
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ARGCHECK(test,msg,obj,whenBAD,consumables,rettype) { \
+ if (test) { \
+ (Consume)consumables; \
+ return((rettype)ArgErr(msg, obj, whenBAD)); \
+ } \
+}
+
+/*END SHARED*/
+/*SHARED*/
+
+/* Changed use of Dup() below to Temporary(Copy()) because Dup() does not
+ necessarily return a Unique Copy anymore! 3-26-91 */
+#define TYPENULLCHECK(name, obj, expect, whenBAD, consumables,rettype) \
+ if (obj == NULL) { \
+ (Consume)consumables; \
+ if (whenBAD != NULL && ISPERMANENT(whenBAD->flag)) \
+ return((rettype)Temporary(Copy(whenBAD))); \
+ else return((rettype)whenBAD); \
+ } else { \
+ if (obj->type != expect) { \
+ (Consume)consumables; \
+ return((rettype)TypeErr(name, obj, expect, whenBAD)); \
+ } \
+ }
+/*END SHARED*/
+/*SHARED*/
+
+#define MAKECONSUME(obj,stmt) { if (!ISPERMANENT(obj->flag)) stmt; }
+
+/*END SHARED*/
+/*SHARED*/
+
+#define MAKEUNIQUE(obj,stmt) ( ( (obj)->references > 1 ) ? stmt : obj )
+
+/*END SHARED*/
+/*SHARED*/
+/* NDW: personally, I want to see status and error messages! */
+#define IfTrace0(condition,model) \
+ {if (condition) printf(model);}
+#define IfTrace1(condition,model,arg0) \
+ {if (condition) printf(model,arg0);}
+#define IfTrace2(condition,model,arg0,arg1) \
+ {if (condition) printf(model,arg0,arg1);}
+#define IfTrace3(condition,model,arg0,arg1,arg2) \
+ {if (condition) printf(model,arg0,arg1,arg2);}
+#define IfTrace4(condition,model,arg0,arg1,arg2,arg3) \
+ {if (condition) printf(model,arg0,arg1,arg2,arg3);}
+#define IfTrace5(condition,model,arg0,arg1,arg2,arg3,arg4) \
+ {if (condition) printf(model,arg0,arg1,arg2,arg3,arg4);}
+#define IfTrace6(condition,model,arg0,arg1,arg2,arg3,arg4,arg5) \
+ {if (condition) printf(model,arg0,arg1,arg2,arg3,arg4,arg5);}
+/* NDW: patch ends */
+
+void Trace0();
+char *Trace1(),*Trace2(),*Trace3(),*Trace4(),*Trace5(),*Trace6();
+
+#ifdef GLOBALS
+
+#define extern
+#define INITIALIZED(value) = value
+
+#else
+
+#define INITIALIZED(value)
+
+#endif
+
+extern char MustCheckArgs INITIALIZED(TRUE);
+extern char MustTraceCalls INITIALIZED(FALSE);
+extern char MustCrash INITIALIZED(TRUE);
+extern char InternalTrace INITIALIZED(TRUE);
+extern char LineIOTrace INITIALIZED(TRUE);
+
+extern char ProcessHints INITIALIZED(TRUE);
+
+extern char SaveFontPaths INITIALIZED(TRUE);
+
+extern short CRASTERCompressionType INITIALIZED(1);
+
+extern char ConicDebug INITIALIZED(0);
+extern char LineDebug INITIALIZED(0);
+extern char RegionDebug INITIALIZED(0);
+extern char PathDebug INITIALIZED(0);
+extern char FontDebug INITIALIZED(0);
+extern char SpaceDebug INITIALIZED(0);
+extern char StrokeDebug INITIALIZED(0);
+extern char MemoryDebug INITIALIZED(0);
+extern char HintDebug INITIALIZED(0);
+extern char ImageDebug INITIALIZED(0);
+extern char OffPageDebug INITIALIZED(0);
+
+extern short CachedChars INITIALIZED(0x7FFF);
+extern short CachedFonts INITIALIZED(0x7FFF);
+extern int CacheBLimit INITIALIZED(12500);
+extern char Continuity INITIALIZED(2);
+
+#ifdef extern
+#undef extern
+#endif
+
+extern void Xfree(void*);
+
+/*
+We define other routines formatting parameters
+*/
+#define DumpArea(area) t1_DumpArea(area)
+#define DumpText(text) t1_DumpText(text)
+#define DumpPath(path) t1_DumpPath(path)
+#define DumpSpace(space) t1_DumpSpace(space)
+#define DumpEdges(e) t1_DumpEdges(e)
+#define FormatFP(s,p) t1_FormatFP(s,p)
+
+void t1_DumpArea(); /* dump a region structure */
+void t1_DumpText(); /* dump a textpath structure */
+void t1_DumpPath(); /* dump a path list */
+void t1_DumpSpace(); /* dump a coordinate space structure */
+void t1_DumpEdges(); /* dump a region's edge list */
+void t1_FormatFP(); /* dump a format a "fractpel" coordinate */
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/paths.c b/Build/source/texk/ps2pkm/paths.c
new file mode 100644
index 00000000000..f6c39a3257c
--- /dev/null
+++ b/Build/source/texk/ps2pkm/paths.c
@@ -0,0 +1,1514 @@
+/* $XConsortium: paths.c,v 1.4 91/10/10 11:18:40 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* PATHS CWEB V0021 ******** */
+/*
+:h1 id=paths.PATHS Module - Path Operator Handler
+
+This is the module that is responsible for building and transforming
+path lists.
+
+&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com)
+
+
+:h3.Include Files
+
+The included files are:
+*/
+
+ /* after the system includes (dsr) */
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+#include "regions.h" /* understands about Union */
+#include "fonts.h" /* understands about TEXTTYPEs */
+#include "pictures.h" /* understands about handles */
+#include "strokes.h" /* understands how to coerce stroke paths */
+#include "trig.h"
+
+#ifdef KPATHSEA
+static int UnClose P1H(struct segment *);
+extern void DumpText P1H(struct segment *);
+#else
+static Unclose();
+#endif
+
+/*
+:h3.Routines Available to the TYPE1IMAGER User
+
+The PATHS routines that are made available to the outside user are:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Functions Provided to Other Modules
+
+The path routines that are made available to other TYPE1IMAGER modules
+are defined here:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+NOTE: because of the casts put in the macros for Loc, ArcCA, Conic,
+RoundConic, PathSegment, and JoinSegment, we cannot use the macro names
+when the functions are actually defined. We have to use the unique
+names with their unique first two characters. Thus, if anyone in the
+future ever decided to change the first two characters, it would not be
+enough just to change the macro (as it would for most other functions).
+He would have to also change the function definition.
+*/
+/*
+:h3.Macros Provided to Other Modules
+
+The CONCAT macro is defined here and used in the STROKES module. See
+:hdref refid=pathmac..
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h2.Path Segment Structures
+
+A path is represented as a linked list of the following structure:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+When 'link' is NULL, we are at the last segment in the path (surprise!).
+
+'last' is only non-NULL on the first segment of a path,
+for all the other segments 'last' == NULL. We test for a non-NULL
+'last' (ISPATHANCHOR predicate) when we are given an alleged path
+to make sure the user is not trying to pull a fast one on us.
+
+A path may be a collection of disjoint paths. Every break in the
+disjoint path is represented by a MOVETYPE segment.
+
+Closed paths are discussed in :hdref refid=close..
+
+:h3.CopyPath() - Physically Duplicating a Path
+
+This simple function illustrates moving through the path linked list.
+Duplicating a segment just involves making a copy of it, except for
+text, which has some auxilliary things involved. We don't feel
+competent to duplicate text in this module, so we call someone who
+knows how (in the FONTS module).
+*/
+struct segment *CopyPath(p0)
+ register struct segment *p0; /* path to duplicate */
+{
+ register struct segment *p,*n,*last,*anchor;
+
+ for (p = p0, anchor = NULL; p != NULL; p = p->link) {
+
+ ARGCHECK((!ISPATHTYPE(p->type) || (p != p0 && p->last != NULL)),
+ "CopyPath: invalid segment", p, NULL, (0), struct segment *);
+
+ if (p->type == TEXTTYPE)
+ n = (struct segment *) CopyText(p);
+ else
+ n = (struct segment *)Allocate(p->size, p, 0);
+ n->last = NULL;
+ if (anchor == NULL)
+ anchor = n;
+ else
+ last->link = n;
+ last = n;
+ }
+/*
+At this point we have a chain of newly allocated segments hanging off
+'anchor'. We need to make sure the first segment points to the last:
+*/
+ if (anchor != NULL) {
+ n->link = NULL;
+ anchor->last = n;
+ }
+
+ return(anchor);
+}
+/*
+:h3.KillPath() - Destroying a Path
+
+Destroying a path is simply a matter of freeing each segment in the
+linked list. Again, we let the experts handle text.
+*/
+void KillPath(p)
+ register struct segment *p; /* path to destroy */
+{
+ register struct segment *linkp; /* temp register holding next segment*/
+
+ /* return conditional based on reference count 3-26-91 PNM */
+ if ( (--(p->references) > 1) ||
+ ( (p->references == 1) && !ISPERMANENT(p->flag) ) )
+ return;
+
+ while (p != NULL) {
+ if (!ISPATHTYPE(p->type)) {
+ ArgErr("KillPath: bad segment", p, NULL);
+ return;
+ }
+ linkp = p->link;
+ if (p->type == TEXTTYPE)
+ KillText(p);
+ else
+ Free(p);
+ p = linkp;
+ }
+}
+
+/*
+:h2 id=location."location" Objects
+
+The TYPE1IMAGER user creates and destroys objects of type "location". These
+objects locate points for the primitive path operators. We play a trick
+here and store these objects in the same "segment" structure used for
+paths, with a type field == MOVETYPE.
+
+This allows the Line() operator, for example, to be very trivial:
+It merely stamps its input structure as a LINETYPE and returns it to the
+caller--assuming, of course, the input structure was not permanent (as
+it usually isn't).
+
+:h3.The "movesegment" Template Structure
+
+This template is used as a generic segment structure for Allocate:
+*/
+
+/* added reference field 1 to temporary template below 3-26-91 PNM */
+static struct segment movetemplate = { MOVETYPE, 0, 1, sizeof(struct segment), 0,
+ NULL, NULL, 0, 0 };
+/*
+:h3.Loc() - Create an "Invisible Line" Between (0,0) and a Point
+
+*/
+
+struct segment *t1_Loc(S, x, y)
+ register struct XYspace *S; /* coordinate space to interpret X,Y */
+ DOUBLE x,y; /* destination point */
+{
+ register struct segment *r;
+
+
+ IfTrace3((MustTraceCalls),"..Loc(S=%z, x=%f, y=%f)\n", S, &x, &y);
+
+ r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0);
+ TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *);
+
+ r->last = r;
+ r->context = S->context;
+ (*S->convert)(&r->dest, S, x, y);
+ ConsumeSpace(S);
+ return(r);
+}
+/*
+:h3.ILoc() - Loc() With Integer Arguments
+
+*/
+struct segment *ILoc(S, x, y)
+ register struct XYspace *S; /* coordinate space to interpret X,Y */
+ register int x,y; /* destination point */
+{
+ register struct segment *r;
+
+ IfTrace3((MustTraceCalls),"..ILoc(S=%z, x=%d, y=%d)\n",
+ S, (LONG) x, (LONG) y);
+ r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0);
+ TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *);
+
+ r->last = r;
+ r->context = S->context;
+ (*S->iconvert)(&r->dest, S, (LONG) x, (LONG) y);
+ ConsumeSpace(S);
+ return(r);
+}
+
+/*
+:h3.SubLoc() - Vector Subtraction of Two Locition Objects
+
+This user operator subtracts two location objects, yielding a new
+location object that is the result.
+
+The symmetrical function AddLoc() is totally redundent with Join(),
+so it is not provided.
+*/
+
+struct segment *SubLoc(p1, p2)
+ register struct segment *p1;
+ register struct segment *p2;
+{
+ IfTrace2((MustTraceCalls),"SubLoc(%z, %z)\n", p1, p2);
+
+ ARGCHECK(!ISLOCATION(p1), "SubLoc: bad first arg", p1, NULL, (0), struct segment *);
+ ARGCHECK(!ISLOCATION(p2), "SubLoc: bad second arg", p2, NULL, (0), struct segment *);
+ p1 = UniquePath(p1);
+ p1->dest.x -= p2->dest.x;
+ p1->dest.y -= p2->dest.y;
+ ConsumePath(p2);
+ return(p1);
+}
+
+/*
+:h2.Straight Line Segments
+
+:h3.PathSegment() - Create a Generic Path Segment
+
+Many routines need a LINETYPE or MOVETYPE path segment, but do not
+want to go through the external user's interface, because, for example,
+they already know the "fractpel" destination of the segment and the
+conversion is unnecessary. PathSegment() is an internal routine
+provided to the rest of TYPE1IMAGER for handling these cases.
+*/
+
+struct segment *t1_PathSegment(type, x, y)
+ int type; /* LINETYPE or MOVETYPE */
+ fractpel x,y; /* where to go to, if known */
+{
+ register struct segment *r; /* newly created segment */
+
+ r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0);
+ r->type = type;
+ r->last = r; /* last points to itself for singleton */
+ r->dest.x = x;
+ r->dest.y = y;
+ return(r);
+}
+/*
+:h3.Line() - Create a Line Segment Between (0,0) and a Point P
+
+This involves just creating and filling out a segment structure:
+*/
+struct segment *Line(P)
+ register struct segment *P; /* relevant coordinate space */
+{
+
+ IfTrace1((MustTraceCalls),"..Line(%z)\n", P);
+ ARGCHECK(!ISLOCATION(P), "Line: arg not a location", P, NULL, (0), struct segment *);
+
+ P = UniquePath(P);
+ P->type = LINETYPE;
+ return(P);
+}
+/*
+:h2.Curved Path Segments
+
+We need more points to describe curves. So, the structures for curved
+path segments are slightly different. The first part is identical;
+the curved structures are larger with the extra points on the end.
+
+:h3.Bezier Segment Structure
+
+We support third order Bezier curves. They are specified with four
+control points A, B, C, and D. The curve starts at A with slope AB
+and ends at D with slope CD. The curvature at the point A is inversely
+related to the length |AB|, and the curvature at the point D is
+inversely related to the length |CD|. Point A is always point (0,0).
+
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Bezier() - Generate a Bezier Segment
+
+This is just a simple matter of filling out a 'beziersegment' structure:
+*/
+
+struct beziersegment *Bezier(B, C, D)
+ register struct segment *B; /* second control point */
+ register struct segment *C; /* third control point */
+ register struct segment *D; /* fourth control point (ending point) */
+{
+/* added reference field of 1 to temporary template below 3-26-91 PNM */
+ static struct beziersegment template =
+ { BEZIERTYPE, 0, 1, sizeof(struct beziersegment), 0,
+ NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 } };
+
+ register struct beziersegment *r; /* output segment */
+
+ IfTrace3((MustTraceCalls),"..Bezier(%z, %z, %z)\n", B, C, D);
+ ARGCHECK(!ISLOCATION(B), "Bezier: bad B", B, NULL, (2,C,D), struct beziersegment *);
+ ARGCHECK(!ISLOCATION(C), "Bezier: bad C", C, NULL, (2,B,D), struct beziersegment *);
+ ARGCHECK(!ISLOCATION(D), "Bezier: bad D", D, NULL, (2,B,C), struct beziersegment *);
+
+ r = (struct beziersegment *)Allocate(sizeof(struct beziersegment), &template, 0);
+ r->last = (struct segment *) r;
+ r->dest.x = D->dest.x;
+ r->dest.y = D->dest.y;
+ r->B.x = B->dest.x;
+ r->B.y = B->dest.y;
+ r->C.x = C->dest.x;
+ r->C.y = C->dest.y;
+
+ ConsumePath(B);
+ ConsumePath(C);
+ ConsumePath(D);
+ return(r);
+}
+
+/*
+:h2.Font "Hint" Segments
+
+:h3.Hint() - A Font 'Hint' Segment
+
+This is temporary code while we experiment with hints.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+struct hintsegment *Hint(S, ref, width, orientation, hinttype, adjusttype, direction, label)
+ struct XYspace *S;
+ float ref;
+ float width;
+ char orientation;
+ char hinttype;
+ char adjusttype;
+ char direction;
+ int label;
+{
+/* added reference field of 1 to hintsegment template below 3-26-91 PNM */
+ static struct hintsegment template = { HINTTYPE, 0, 1, sizeof(struct hintsegment), 0,
+ NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 },
+ ' ', ' ', ' ', ' ', 0};
+
+ register struct hintsegment *r;
+
+ r = (struct hintsegment *)Allocate(sizeof(struct hintsegment), &template, 0);
+
+ r->orientation = orientation;
+ if (width == 0.0) width = 1.0;
+
+ if (orientation == 'h') {
+ (*S->convert)(&r->ref, S, 0.0, ref);
+ (*S->convert)(&r->width, S, 0.0, width);
+ }
+ else if (orientation == 'v') {
+ (*S->convert)(&r->ref, S, ref, 0.0);
+ (*S->convert)(&r->width, S, width, 0.0);
+ }
+ else
+ return((struct hintsegment *)ArgErr("Hint: orient not 'h' or 'v'", NULL, NULL));
+ if (r->width.x < 0) r->width.x = - r->width.x;
+ if (r->width.y < 0) r->width.y = - r->width.y;
+ r->hinttype = hinttype;
+ r->adjusttype = adjusttype;
+ r->direction = direction;
+ r->label = label;
+ r->last = (struct segment *) r;
+ ConsumeSpace(S);
+ return(r);
+}
+
+/*
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+POP removes the first segment in a path 'p' and Frees it. 'p' is left
+pointing to the end of the path:
+*/
+#define POP(p) \
+ { register struct segment *linkp; \
+ linkp = p->link; \
+ if (linkp != NULL) \
+ linkp->last = p->last; \
+ Free(p); \
+ p = linkp; }
+/*
+INSERT inserts a single segment in the middle of a chain. 'b' is
+the segment before, 'p' the segment to be inserted, and 'a' the
+segment after.
+*/
+#define INSERT(b,p,a) b->link=p; p->link=a; p->last=NULL
+
+/*
+:h3.Join() - Join Two Objects Together
+
+If these are paths, this operator simply invokes the CONCAT macro.
+Why so much code then, you ask? Well we have to check for object
+types other than paths, and also check for certain path consistency
+rules.
+*/
+
+struct segment *Join(p1, p2)
+ register struct segment *p1,*p2;
+{
+ IfTrace2((MustTraceCalls && PathDebug > 1),"..Join(%z, %z)\n", p1, p2);
+ IfTrace2((MustTraceCalls && PathDebug <=1),"..Join(%x, %x)\n", p1, p2);
+/*
+We start with a whole bunch of very straightforward argument tests:
+*/
+ if (p2 != NULL) {
+ if (!ISPATHTYPE(p2->type)) {
+
+ if (p1 == NULL)
+ return((struct segment *)Unique(p2));
+
+ switch (p1->type) {
+
+ case REGIONTYPE:
+
+ case STROKEPATHTYPE:
+ p1 = CoercePath(p1);
+ break;
+
+ default:
+ return((struct segment *)BegHandle(p1, p2));
+ }
+ }
+
+ ARGCHECK((p2->last == NULL), "Join: right arg not anchor", p2, NULL, (1,p1), struct segment *);
+ p2 = UniquePath(p2);
+
+/*
+In certain circumstances, we don't have to duplicate a permanent
+location. (We would just end up destroying it anyway). These cases
+are when 'p2' begins with a move-type segment:
+*/
+ if (p2->type == TEXTTYPE || p2->type == MOVETYPE) {
+ if (p1 == NULL)
+ return(p2);
+ if (ISLOCATION(p1)) {
+ p2->dest.x += p1->dest.x;
+ p2->dest.y += p1->dest.y;
+ ConsumePath(p1);
+ return(p2);
+ }
+ }
+ }
+ else
+ return((struct segment *)Unique(p1));
+
+ if (p1 != NULL) {
+ if (!ISPATHTYPE(p1->type))
+
+ switch (p2->type) {
+
+ case REGIONTYPE:
+
+ case STROKEPATHTYPE:
+ p2 = CoercePath(p2);
+ break;
+
+ default:
+ return((struct segment *)EndHandle(p1, p2));
+ }
+
+ ARGCHECK((p1->last == NULL), "Join: left arg not anchor", p1, NULL, (1,p2), struct segment *);
+ p1 = UniquePath(p1);
+ }
+ else
+ return(p2);
+
+/*
+At this point all the checking is done. We have two temporary non-null
+path types in 'p1' and 'p2'. If p1 ends with a MOVE, and p2 begins with
+a MOVE, we collapse the two MOVEs into one. We enforce the rule that
+there may not be two MOVEs in a row:
+*/
+
+ if (p1->last->type == MOVETYPE && p2->type == MOVETYPE) {
+ p1->last->flag |= p2->flag;
+ p1->last->dest.x += p2->dest.x;
+ p1->last->dest.y += p2->dest.y;
+ POP(p2);
+ if (p2 == NULL)
+ return(p1);
+ }
+/*
+Now we check for another silly rule. If a path has any TEXTTYPEs,
+then it must have only TEXTTYPEs and MOVETYPEs, and furthermore,
+it must begin with a TEXTTYPE. This rule makes it easy to check
+for the special case of text. If necessary, we will coerce
+TEXTTYPEs into paths so we don't mix TEXTTYPEs with normal paths.
+*/
+ if (p1->type == TEXTTYPE) {
+ if (p2->type != TEXTTYPE && !ISLOCATION(p2))
+ p1 = CoerceText(p1);
+ }
+ else {
+ if (p2->type == TEXTTYPE) {
+ if (ISLOCATION(p1)) {
+ p2->dest.x += p1->dest.x;
+ p2->dest.y += p1->dest.y;
+ Free(p1);
+ return(p2);
+ }
+ else
+ p2 = CoerceText(p2);
+ }
+ }
+/*
+Thank God! Finally! It's hard to believe, but we are now able to
+actually do the join. This is just invoking the CONCAT macro:
+*/
+ CONCAT(p1, p2);
+
+ return(p1);
+}
+
+/*
+:h3.JoinSegment() - Create a Path Segment and Join It to a Known Path
+
+This internal function is quicker than a full-fledged join because
+it can do much less checking.
+*/
+
+struct segment *t1_JoinSegment(before, type, x, y, after)
+ register struct segment *before; /* path to join before new segment */
+ int type; /* type of new segment (MOVETYPE or LINETYPE) */
+ fractpel x,y; /* x,y of new segment */
+ register struct segment *after; /* path to join after new segment */
+{
+ register struct segment *r; /* returned path built here */
+
+ r = PathSegment(type, x, y);
+ if (before != NULL) {
+ CONCAT(before, r);
+ r = before;
+ }
+ else
+ r->context = after->context;
+ if (after != NULL)
+ CONCAT(r, after);
+ return(r);
+}
+
+/*
+:h2.Other Path Functions
+
+*/
+
+
+struct segment *t1_ClosePath(p0,lastonly)
+ register struct segment *p0; /* path to close */
+ register int lastonly; /* flag deciding to close all subpaths or... */
+{
+ register struct segment *p,*last,*start; /* used in looping through path */
+ register fractpel x,y; /* current position in path */
+ register fractpel firstx,firsty; /* start position of sub path */
+ register struct segment *lastnonhint; /* last non-hint segment in path */
+
+ IfTrace1((MustTraceCalls),"ClosePath(%z)\n", p0);
+ if (p0 != NULL && p0->type == TEXTTYPE)
+ return(UniquePath(p0));
+ if (p0->type == STROKEPATHTYPE)
+ return((struct segment *)Unique(p0));
+ /*
+ * NOTE: a null closed path is different from a null open path
+ * and is denoted by a closed (0,0) move segment. We make
+ * sure this path begins and ends with a MOVETYPE:
+ */
+ if (p0 == NULL || p0->type != MOVETYPE)
+ p0 = JoinSegment(NULL, MOVETYPE, 0, 0, p0);
+ TYPECHECK("ClosePath", p0, MOVETYPE, NULL, (0), struct segment *);
+ if (p0->last->type != MOVETYPE)
+ p0 = JoinSegment(p0, MOVETYPE, 0, 0, NULL);
+
+ p0 = UniquePath(p0);
+
+/*
+We now begin a loop through the path,
+incrementing current 'x' and 'y'. We are searching
+for MOVETYPE segments (breaks in the path) that are not already closed.
+At each break, we insert a close segment.
+*/
+ for (p = p0, x = y = 0, start = NULL;
+ p != NULL;
+ x += p->dest.x, y += p->dest.y, last = p, p = p->link)
+ {
+
+ if (p->type == MOVETYPE) {
+ if (start != NULL && (lastonly?p->link==NULL:TRUE) &&
+ !(ISCLOSED(start->flag) && LASTCLOSED(last->flag))) {
+ register struct segment *r; /* newly created */
+
+ start->flag |= ISCLOSED(ON);
+ r = PathSegment(LINETYPE, firstx - x,
+ firsty - y);
+ INSERT(last, r, p);
+ r->flag |= LASTCLOSED(ON);
+ /*< adjust 'last' if possible for a 0,0 close >*/
+{
+
+#define CLOSEFUDGE 3 /* if we are this close, let's change last segment */
+
+ if (r->dest.x != 0 || r->dest.y != 0) {
+ if (r->dest.x <= CLOSEFUDGE && r->dest.x >= -CLOSEFUDGE
+ && r->dest.y <= CLOSEFUDGE && r->dest.y >= -CLOSEFUDGE) {
+ IfTrace2((PathDebug),
+ "ClosePath forced closed by (%p,%p)\n",
+ r->dest.x, r->dest.y);
+ lastnonhint->dest.x += r->dest.x;
+ lastnonhint->dest.y += r->dest.y;
+ r->dest.x = r->dest.y = 0;
+ }
+ }
+}
+ if (p->link != NULL) {
+ p->dest.x += x - firstx;
+ p->dest.y += y - firsty;
+ x = firstx;
+ y = firsty;
+ }
+ }
+ start = p;
+ firstx = x + p->dest.x;
+ firsty = y + p->dest.y;
+ }
+ else if (p->type != HINTTYPE)
+ lastnonhint = p;
+ }
+ return(p0);
+}
+/*
+*/
+/*
+:h2.Reversing the Direction of a Path
+
+This turned out to be more difficult than I thought at first. The
+trickiness was due to the fact that closed paths must remain closed,
+etc.
+
+We need three subroutines:
+*/
+
+static struct segment *SplitPath(); /* break a path at any point */
+static struct segment *DropSubPath(); /* breaks a path after first sub-path */
+static struct segment *ReverseSubPath(); /* reverses a single sub-path */
+
+/*
+:h3.Reverse() - User Operator to Reverse a Path
+
+This operator reverses the entire path.
+*/
+
+struct segment *Reverse(p)
+ register struct segment *p; /* full path to reverse */
+{
+ register struct segment *r; /* output path built here */
+ register struct segment *nextp; /* contains next sub-path */
+
+ IfTrace1((MustTraceCalls),"Reverse(%z)\n", p);
+
+ if (p == NULL)
+ return(NULL);
+
+ ARGCHECK(!ISPATHANCHOR(p), "Reverse: invalid path", p, NULL, (0), struct segment *);
+
+ if (p->type == TEXTTYPE)
+ p = CoerceText(p);
+ p = UniquePath(p);
+
+ r = NULL;
+
+ do {
+ nextp = DropSubPath(p);
+ p = ReverseSubPath(p);
+ r = Join(p, r);
+ p = nextp;
+
+ } while (p != NULL);
+
+ return(r);
+}
+
+/*
+:h4.ReverseSubPath() - Subroutine to Reverse a Single Sub-Path
+*/
+
+static struct segment *ReverseSubPath(p)
+ register struct segment *p; /* input path */
+{
+ register struct segment *r; /* reversed path will be created here */
+ register struct segment *nextp; /* temporary variable used in loop */
+ register int wasclosed; /* flag, path was closed */
+
+ if (p == NULL)
+ return(NULL);
+
+ wasclosed = ISCLOSED(p->flag);
+ r = NULL;
+
+ do {
+/*
+First we reverse the direction of this segment and clean up its flags:
+*/
+ p->dest.x = - p->dest.x; p->dest.y = - p->dest.y;
+ p->flag &= ~(ISCLOSED(ON) | LASTCLOSED(ON));
+
+ switch (p->type) {
+
+ case LINETYPE:
+ case MOVETYPE:
+ break;
+
+ case CONICTYPE:
+ {
+/*
+The logic of this is that the new M point (stored relative to the new
+beginning) is (M - C). However, C ("dest") has already been reversed
+So, we add "dest" instead of subtracting it:
+*/
+ register struct conicsegment *cp = (struct conicsegment *) p;
+
+ cp->M.x += cp->dest.x; cp->M.y += cp->dest.y;
+ }
+ break;
+
+ case BEZIERTYPE:
+ {
+ register struct beziersegment *bp = (struct beziersegment *) p;
+
+ bp->B.x += bp->dest.x; bp->B.y += bp->dest.y;
+ bp->C.x += bp->dest.x; bp->C.y += bp->dest.y;
+ }
+ break;
+
+ case HINTTYPE:
+ {
+ register struct hintsegment *hp = (struct hintsegment *) p;
+
+ hp->ref.x = -hp->ref.x; hp->ref.y = -hp->ref.y;
+ }
+ break;
+
+ default:
+ t1_abort("Reverse: bad path segment");
+ }
+/*
+We need to reverse the order of segments too, so we break this segment
+off of the input path, and tack it on the front of the growing path
+in 'r':
+*/
+ nextp = p->link;
+ p->link = NULL;
+ p->last = p;
+ if (r != NULL)
+ CONCAT(p,r); /* leaves result in 'p'... not what we want */
+ r = p;
+ p = nextp; /* advance to next segment in input path */
+
+ } while (p != NULL);
+
+ if (wasclosed)
+ r = ClosePath(r);
+
+ return(r);
+}
+
+/*
+:h4.DropSubPath() - Drops the First Sub-Path Off a Path
+
+This subroutine returns the remaining sub-path(s). While doing so, it
+breaks the input path after the first sub-path so that a pointer to
+the original path now contains the first sub-path only.
+*/
+
+static struct segment *DropSubPath(p0)
+ register struct segment *p0; /* original path */
+{
+ register struct segment *p; /* returned remainder here */
+
+ for (p = p0; p->link != NULL; p = p->link) {
+ if (p->link->type == MOVETYPE)
+ break;
+ }
+
+ return(SplitPath(p0, p));
+}
+
+static struct segment *SplitPath(anchor, before)
+ register struct segment *anchor;
+ register struct segment *before;
+{
+ register struct segment *r;
+
+ if (before == anchor->last)
+ return(NULL);
+
+ r = before->link;
+ r->last = anchor->last;
+ anchor->last = before;
+ before->link = NULL;
+
+ return(r);
+}
+
+
+/*
+:h3.ReverseSubPaths() - Reverse the Direction of Sub-paths Within a Path
+
+This user operator reverses the sub-paths in a path, but leaves the
+'move' segments unchanged. It builds on top of the subroutines
+already established.
+*/
+
+struct segment *ReverseSubPaths(p)
+ register struct segment *p; /* input path */
+{
+ register struct segment *r; /* reversed path will be created here */
+ register struct segment *nextp; /* temporary variable used in loop */
+ int wasclosed; /* flag; subpath was closed */
+ register struct segment *nomove; /* the part of sub-path without move segment */
+ struct fractpoint delta;
+
+ IfTrace1((MustTraceCalls),"ReverseSubPaths(%z)\n", p);
+
+ if (p == NULL)
+ return(NULL);
+
+ ARGCHECK(!ISPATHANCHOR(p), "ReverseSubPaths: invalid path", p, NULL, (0), struct segment *);
+
+ if (p->type == TEXTTYPE)
+ p = CoerceText(p);
+ if (p->type != MOVETYPE)
+ p = JoinSegment(NULL, MOVETYPE, 0, 0, p);
+
+ p = UniquePath(p);
+
+ r = NULL;
+
+ for (; p != NULL;) {
+ nextp = DropSubPath(p);
+ wasclosed = ISCLOSED(p->flag);
+ if (wasclosed)
+ UnClose(p);
+
+ nomove = SplitPath(p, p);
+ r = Join(r, p);
+
+ PathDelta(nomove, &delta);
+
+ nomove = ReverseSubPath(nomove);
+ p->dest.x += delta.x;
+ p->dest.y += delta.y;
+ if (nextp != NULL) {
+ nextp->dest.x += delta.x;
+ nextp->dest.y += delta.y;
+ }
+ if (wasclosed) {
+ nomove = ClosePath(nomove);
+ nextp->dest.x -= delta.x;
+ nextp->dest.y -= delta.y;
+ }
+ r = Join(r, nomove);
+ p = nextp;
+
+ }
+
+ return(r);
+}
+
+static UnClose(p0)
+ register struct segment *p0;
+{
+ register struct segment *p;
+
+ for (p=p0; p->link->link != NULL; p=p->link) { ; }
+
+ if (!LASTCLOSED(p->link->flag))
+ t1_abort("UnClose: no LASTCLOSED");
+
+ Free(SplitPath(p0, p));
+ p0->flag &= ~ISCLOSED(ON);
+}
+
+/*
+:h2.Transforming and Putting Handles on Paths
+
+:h3.PathTransform() - Transform a Path
+
+Transforming a path involves transforming all the points. In order
+that closed paths do not become "unclosed" when their relative
+positions are slightly changed due to loss of arithmetic precision,
+all point transformations are in absolute coordinates.
+
+(It might be better to reset the "absolute" coordinates every time a
+move segment is encountered. This would mean that we could accumulate
+error from subpath to subpath, but we would be less likely to make
+the "big error" where our fixed point arithmetic "wraps". However, I
+think I'll keep it this way until something happens to convince me
+otherwise.)
+
+The transform is described as a "space", that way we can use our
+old friend the "iconvert" function, which should be very efficient.
+*/
+
+struct segment *PathTransform(p0, S)
+ register struct segment *p0; /* path to transform */
+ register struct XYspace *S; /* pseudo space to transform in */
+{
+ register struct segment *p; /* to loop through path with */
+ register fractpel newx,newy; /* current transformed position in path */
+ register fractpel oldx,oldy; /* current untransformed position in path */
+ register fractpel savex,savey; /* save path delta x,y */
+
+ p0 = UniquePath(p0);
+
+ newx = newy = oldx = oldy = 0;
+
+ for (p=p0; p != NULL; p=p->link) {
+
+ savex = p->dest.x; savey = p->dest.y;
+
+ (*S->iconvert)(&p->dest, S, p->dest.x + oldx, p->dest.y + oldy);
+ p->dest.x -= newx;
+ p->dest.y -= newy;
+
+ switch (p->type) {
+
+ case LINETYPE:
+ case MOVETYPE:
+ break;
+
+ case CONICTYPE:
+ {
+ register struct conicsegment *cp = (struct conicsegment *) p;
+
+ (*S->iconvert)(&cp->M, S, cp->M.x + oldx, cp->M.y + oldy);
+ cp->M.x -= newx;
+ cp->M.y -= newy;
+ /*
+ * Note roundness doesn't change... linear transform
+ */
+ break;
+ }
+
+
+ case BEZIERTYPE:
+ {
+ register struct beziersegment *bp = (struct beziersegment *) p;
+
+ (*S->iconvert)(&bp->B, S, bp->B.x + oldx, bp->B.y + oldy);
+ bp->B.x -= newx;
+ bp->B.y -= newy;
+ (*S->iconvert)(&bp->C, S, bp->C.x + oldx, bp->C.y + oldy);
+ bp->C.x -= newx;
+ bp->C.y -= newy;
+ break;
+ }
+
+ case HINTTYPE:
+ {
+ register struct hintsegment *hp = (struct hintsegment *) p;
+
+ (*S->iconvert)(&hp->ref, S, hp->ref.x + oldx, hp->ref.y + oldy);
+ hp->ref.x -= newx;
+ hp->ref.y -= newy;
+ (*S->iconvert)(&hp->width, S, hp->width.x, hp->width.y);
+ /* Note: width is not relative to origin */
+ break;
+ }
+
+ case TEXTTYPE:
+ {
+ XformText(p,S);
+ break;
+ }
+
+ default:
+ IfTrace1(TRUE,"path = %z\n", p);
+ t1_abort("PathTransform: invalid segment");
+ }
+ oldx += savex;
+ oldy += savey;
+ newx += p->dest.x;
+ newy += p->dest.y;
+ }
+ return(p0);
+}
+
+/*
+:h3.PathDelta() - Return a Path's Ending Point
+*/
+
+void PathDelta(p, pt)
+ register struct segment *p; /* input path */
+ register struct fractpoint *pt; /* pointer to x,y to set */
+{
+ struct fractpoint mypoint; /* I pass this to TextDelta */
+ register fractpel x,y; /* working variables for path current point */
+
+ for (x=y=0; p != NULL; p=p->link) {
+ x += p->dest.x;
+ y += p->dest.y;
+ if (p->type == TEXTTYPE) {
+ TextDelta(p, &mypoint);
+ x += mypoint.x;
+ y += mypoint.y;
+ }
+ }
+
+ pt->x = x;
+ pt->y = y;
+}
+
+/*
+:h3.BoundingBox() - Produce a Bounding Box Path
+
+This function is called by image code, when we know the size of the
+image in pels, and need to get a bounding box path that surrounds it.
+The starting/ending handle is in the lower right hand corner.
+*/
+struct segment *BoundingBox(h, w)
+ register pel h,w; /* size of box */
+{
+ register struct segment *path;
+
+ path = PathSegment(LINETYPE, -TOFRACTPEL(w), 0);
+ path = JoinSegment(NULL, LINETYPE, 0, -TOFRACTPEL(h), path);
+ path = JoinSegment(NULL, LINETYPE, TOFRACTPEL(w), 0, path);
+ path = ClosePath(path);
+
+ return(path);
+}
+
+/*
+:h2.Querying Locations and Paths
+
+:h3.QueryLoc() - Return the X,Y of a Locition
+*/
+
+void QueryLoc(P, S, xP, yP)
+ register struct segment *P; /* location to query, not consumed */
+ register struct XYspace *S; /* XY space to return coordinates in */
+ register DOUBLE *xP,*yP; /* coordinates returned here */
+{
+ IfTrace4((MustTraceCalls),"QueryLoc(P=%z, S=%z, (%x, %x))\n",
+ P, S, xP, yP);
+ if (!ISLOCATION(P)) {
+ ArgErr("QueryLoc: first arg not a location", P, NULL);
+ return;
+ }
+ if (S->type != SPACETYPE) {
+ ArgErr("QueryLoc: second arg not a space", S, NULL);
+ return;
+ }
+ UnConvert(S, &P->dest, xP, yP);
+}
+/*
+:h3.QueryPath() - Find Out the Type of Segment at the Head of a Path
+
+This is a very simple routine that looks at the first segment of a
+path and tells the caller what it is, as well as returning the control
+point(s) of the path segment. Different path segments have different
+number of control points. If the caller knows that the segment is
+a move segment, for example, he only needs to pass pointers to return
+one control point.
+*/
+
+void QueryPath(path, typeP, Bp, Cp, Dp, fP)
+ register struct segment *path; /* path to check */
+ register int *typeP; /* return the type of path here */
+ register struct segment **Bp; /* return location of first point */
+ register struct segment **Cp; /* return location of second point */
+ register struct segment **Dp; /* return location of third point */
+ register DOUBLE *fP; /* return Conic sharpness */
+{
+ register int coerced = FALSE; /* did I coerce a text path? */
+
+ IfTrace3((MustTraceCalls), "QueryPath(%z, %x, %x, ...)\n",
+ path, typeP, Bp);
+ if (path == NULL) {
+ *typeP = -1;
+ return;
+ }
+ if (!ISPATHANCHOR(path)) {
+ ArgErr("QueryPath: arg not a valid path", path, NULL);
+ }
+ if (path->type == TEXTTYPE) {
+ path = CoerceText(path);
+ coerced = TRUE;
+ }
+
+ switch (path->type) {
+
+ case MOVETYPE:
+ *typeP = 0;
+ *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y);
+ break;
+
+ case LINETYPE:
+ *typeP = (LASTCLOSED(path->flag)) ? 4 : 1;
+ *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y);
+ break;
+
+ case CONICTYPE:
+ {
+ register struct conicsegment *cp = (struct conicsegment *) path;
+
+ *typeP = 2;
+ *Bp = PathSegment(MOVETYPE, cp->M.x, cp->M.y);
+ *Cp = PathSegment(MOVETYPE, cp->dest.x, cp->dest.y);
+ *fP = cp->roundness;
+ }
+ break;
+
+ case BEZIERTYPE:
+ {
+ register struct beziersegment *bp = (struct beziersegment *) path;
+
+ *typeP = 3;
+ *Bp = PathSegment(MOVETYPE, bp->B.x, bp->B.y);
+ *Cp = PathSegment(MOVETYPE, bp->C.x, bp->C.y);
+ *Dp = PathSegment(MOVETYPE, bp->dest.x, bp->dest.y);
+ }
+ break;
+
+ case HINTTYPE:
+ *typeP = 5;
+ break;
+
+ default:
+ t1_abort("QueryPath: unknown segment");
+ }
+ if (coerced)
+ KillPath(path);
+}
+/*
+:h3.QueryBounds() - Return the Bounding Box of a Path
+
+Returns the bounding box by setting the user's variables.
+*/
+
+void QueryBounds(p0, S, xminP, yminP, xmaxP, ymaxP)
+ register struct segment *p0; /* object to check for bound */
+ struct XYspace *S; /* coordinate space of returned values */
+ DOUBLE *xminP,*yminP; /* lower left hand corner (set by routine) */
+ DOUBLE *xmaxP,*ymaxP; /* upper right hand corner (set by routine) */
+{
+ register struct segment *path; /* loop variable for path segments */
+ register fractpel lastx,lasty; /* loop variables: previous endingpoint */
+ register fractpel x,y; /* loop variables: current ending point */
+ struct fractpoint min; /* registers to keep lower left hand corner */
+ struct fractpoint max; /* registers to keep upper right hand corner */
+ int coerced = FALSE; /* we have coerced the path from another object */
+ DOUBLE x1,y1,x2,y2,x3,y3,x4,y4; /* corners of rectangle in space X */
+
+ IfTrace2((MustTraceCalls), "QueryBounds(%z, %z,", p0, S);
+ IfTrace4((MustTraceCalls), " %x, %x, %x, %x)\n",
+ xminP, yminP, xmaxP, ymaxP);
+ if (S->type != SPACETYPE) {
+ ArgErr("QueryBounds: bad XYspace", S, NULL);
+ return;
+ }
+
+ min.x = min.y = max.x = max.y = 0;
+ if (p0 != NULL) {
+ if (!ISPATHANCHOR(p0)) {
+ switch(p0->type) {
+ case STROKEPATHTYPE:
+ /* replaced DupStrokePath() with Dup() 3-26-91 PNM */
+ p0 = (struct segment *) DoStroke(Dup(p0));
+ /* no break here, we have a region in p0 */
+ case REGIONTYPE:
+ p0 = RegionBounds(p0);
+ break;
+
+ case PICTURETYPE:
+ p0 = PictureBounds(p0);
+ break;
+
+ default:
+ ArgErr("QueryBounds: bad object", p0, NULL);
+ return;
+ }
+ coerced = TRUE;
+ }
+ if (p0->type == TEXTTYPE) {
+ /* replaced CopyPath() with Dup() 3-26-91 PNM */
+ p0 = (struct segment *)CoerceText(Dup(p0)); /* there are faster ways */
+ coerced = TRUE;
+ }
+ if (p0->type == MOVETYPE) {
+ min.x = max.x = p0->dest.x;
+ min.y = max.y = p0->dest.y;
+ }
+ }
+ lastx = lasty = 0;
+
+ for (path = p0; path != NULL; path = path->link) {
+
+ x = lastx + path->dest.x;
+ y = lasty + path->dest.y;
+
+ switch (path->type) {
+
+ case LINETYPE:
+ break;
+
+ case CONICTYPE:
+ {
+ register struct conicsegment *cp = (struct conicsegment *) path;
+ register fractpel Mx = lastx + cp->M.x;
+ register fractpel My = lasty + cp->M.y;
+ register fractpel deltax = 0.5 * cp->roundness * cp->dest.x;
+ register fractpel deltay = 0.5 * cp->roundness * cp->dest.y;
+ register fractpel Px = Mx - deltax;
+ register fractpel Py = My - deltay;
+ register fractpel Qx = Mx + deltax;
+ register fractpel Qy = My + deltay;
+
+
+ if (Mx < min.x) min.x = Mx;
+ else if (Mx > max.x) max.x = Mx;
+ if (My < min.y) min.y = My;
+ else if (My > max.y) max.y = My;
+
+ if (Px < min.x) min.x = Px;
+ else if (Px > max.x) max.x = Px;
+ if (Py < min.y) min.y = Py;
+ else if (Py > max.y) max.y = Py;
+
+ if (Qx < min.x) min.x = Qx;
+ else if (Qx > max.x) max.x = Qx;
+ if (Qy < min.y) min.y = Qy;
+ else if (Qy > max.y) max.y = Qy;
+ }
+ break;
+
+
+ case MOVETYPE:
+ /*
+ * We can't risk adding trailing Moves to the
+ * bounding box:
+ */
+ if (path->link == NULL)
+ goto done; /* God forgive me */
+ break;
+
+ case BEZIERTYPE:
+ {
+ register struct beziersegment *bp = (struct beziersegment *) path;
+ register fractpel Bx = lastx + bp->B.x;
+ register fractpel By = lasty + bp->B.y;
+ register fractpel Cx = lastx + bp->C.x;
+ register fractpel Cy = lasty + bp->C.y;
+
+ if (Bx < min.x) min.x = Bx;
+ else if (Bx > max.x) max.x = Bx;
+ if (By < min.y) min.y = By;
+ else if (By > max.y) max.y = By;
+
+ if (Cx < min.x) min.x = Cx;
+ else if (Cx > max.x) max.x = Cx;
+ if (Cy < min.y) min.y = Cy;
+ else if (Cy > max.y) max.y = Cy;
+ }
+ break;
+
+ case HINTTYPE:
+ break;
+ default:
+ t1_abort("QueryBounds: unknown type");
+ }
+
+ if (x < min.x) min.x = x;
+ else if (x > max.x) max.x = x;
+ if (y < min.y) min.y = y;
+ else if (y > max.y) max.y = y;
+
+ lastx = x; lasty = y;
+ }
+done:
+ UnConvert(S, &min, &x1, &y1);
+ UnConvert(S, &max, &x4, &y4);
+ x = min.x; min.x = max.x; max.x = x;
+ UnConvert(S, &min, &x2, &y2);
+ UnConvert(S, &max, &x3, &y3);
+
+ *xminP = *xmaxP = x1;
+ if (x2 < *xminP) *xminP = x2;
+ else if (x2 > *xmaxP) *xmaxP = x2;
+ if (x3 < *xminP) *xminP = x3;
+ else if (x3 > *xmaxP) *xmaxP = x3;
+ if (x4 < *xminP) *xminP = x4;
+ else if (x4 > *xmaxP) *xmaxP = x4;
+
+ *yminP = *ymaxP = y1;
+ if (y2 < *yminP) *yminP = y2;
+ else if (y2 > *ymaxP) *ymaxP = y2;
+ if (y3 < *yminP) *yminP = y3;
+ else if (y3 > *ymaxP) *ymaxP = y3;
+ if (y4 < *yminP) *yminP = y4;
+ else if (y4 > *ymaxP) *ymaxP = y4;
+
+ if (coerced)
+ Destroy(p0);
+}
+/*
+:h3.BoxPath()
+*/
+struct segment *BoxPath(S, h, w)
+ struct XYspace *S;
+ int h,w;
+{
+ struct segment *path;
+
+ path = Join( Line(ILoc(S, w, 0)), Line(ILoc(S, 0, h)) );
+ path = JoinSegment(path, LINETYPE, -path->dest.x, -path->dest.y, NULL);
+ return(ClosePath(path));
+}
+
+/*
+:h3.DropSegment() - Drop the First Segment in a Path
+
+This routine takes the path and returns a new path that is one segment
+shorter. It can be used in conjunction with QueryPath(), for example,
+to ask about an entire path.
+*/
+
+struct segment *DropSegment(path)
+ register struct segment *path;
+{
+ IfTrace1((MustTraceCalls),"DropSegment(%z)\n", path);
+ if (path != NULL && path->type == STROKEPATHTYPE)
+ path = CoercePath(path);
+ ARGCHECK((path == NULL || !ISPATHANCHOR(path)),
+ "DropSegment: arg not a non-null path", path, path, (0), struct segment *);
+ if (path->type == TEXTTYPE)
+ path = CoerceText(path);
+ path = UniquePath(path);
+
+ POP(path);
+ return(path);
+}
+/*
+:h3.HeadSegment() - Return the First Segment in a Path
+
+This routine takes the path and returns a new path consists of the
+first segment only.
+*/
+
+struct segment *HeadSegment(path)
+ register struct segment *path; /* input path */
+{
+ IfTrace1((MustTraceCalls),"HeadSegment(%z)\n", path);
+ if (path == NULL)
+ return(NULL);
+ if (path->type == STROKEPATHTYPE)
+ path = CoercePath(path);
+ ARGCHECK(!ISPATHANCHOR(path), "HeadSegment: arg not a path", path, path, (0), struct segment *);
+ if (path->type == TEXTTYPE)
+ path = CoerceText(path);
+ path = UniquePath(path);
+
+ if (path->link != NULL)
+ KillPath(path->link);
+ path->link = NULL;
+ path->last = path;
+ return(path);
+}
+
+/*
+:h2.Path Debug Routines
+
+:h3.DumpPath() - Display a Path on the Trace File
+*/
+
+void DumpPath(p)
+ register struct segment *p;
+{
+ register fractpel x,y;
+ register fractpel lastx,lasty;
+ DOUBLE roundness;
+
+ IfTrace1(TRUE,"Dumping path, anchor=%x:\n", p);
+ lastx = lasty = 0;
+
+ for (;p != NULL; p=p->link) {
+
+ IfTrace0(TRUE,". ");
+ x = p->dest.x;
+ y = p->dest.y;
+ switch (p->type) {
+
+ case LINETYPE:
+ IfTrace1(TRUE,". line<%x> to", (LONG) p->flag);
+ IfTrace4(TRUE," (%p,%p), delta=(%p,%p)",
+ x + lastx, y + lasty, x, y);
+ break;
+
+ case MOVETYPE:
+ IfTrace1(TRUE,"MOVE<%x> to", (LONG) p->flag);
+ IfTrace4(TRUE,"(%p,%p), delta=(%p,%p)",
+ x + lastx, y + lasty, x, y);
+ break;
+
+ case CONICTYPE:
+ {
+ register struct conicsegment *cp = (struct conicsegment *) p;
+
+ roundness = cp->roundness;
+ IfTrace2(TRUE, ". conic to (%p,%p),",
+ x + lastx, y + lasty);
+ IfTrace3(TRUE," M=(%p,%p), r=%f", cp->M.x + lastx,
+ cp->M.y + lasty, &roundness);
+ }
+ break;
+
+ case BEZIERTYPE:
+ {
+ register struct beziersegment *bp = (struct beziersegment *) p;
+
+ IfTrace4(TRUE,". bezier to (%p,%p), B=(%p,%p)",
+ x + lastx, y + lasty,
+ bp->B.x + lastx, bp->B.y + lasty);
+ IfTrace2(TRUE, ", C=(%p,%p)",
+ bp->C.x + lastx, bp->C.y + lasty);
+ }
+ break;
+
+ case HINTTYPE:
+ {
+ register struct hintsegment *hp = (struct hintsegment *) p;
+
+ IfTrace4(TRUE,". hint ref=(%p,%p), width=(%p,%p)",
+ hp->ref.x + lastx, hp->ref.y + lasty,
+ hp->width.x, hp->width.y);
+ IfTrace4(TRUE, ", %c %c %c %c",
+ hp->orientation, hp->hinttype,
+ hp->adjusttype, hp->direction);
+ IfTrace1(TRUE, ", %ld", (LONG) hp->label);
+ }
+ break;
+
+ case TEXTTYPE:
+ DumpText(p);
+ break;
+
+ default:
+ IfTrace0(TRUE, "bad path segment?");
+ }
+ IfTrace1(TRUE," at %x\n", p);
+ lastx += x;
+ lasty += y;
+ }
+}
+
+
diff --git a/Build/source/texk/ps2pkm/paths.h b/Build/source/texk/ps2pkm/paths.h
new file mode 100644
index 00000000000..a09debac579
--- /dev/null
+++ b/Build/source/texk/ps2pkm/paths.h
@@ -0,0 +1,199 @@
+/* $XConsortium: paths.h,v 1.2 91/10/10 11:18:50 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#include "types.h"
+
+#define Loc(S,x,y) t1_Loc(S,(DOUBLE)x,(DOUBLE)y)
+#define ILoc(S,x,y) t1_ILoc(S,x,y)
+#define Line(P) t1_Line(P)
+#define Join(p1,p2) t1_Join(p1,p2)
+#define ClosePath(p) t1_ClosePath(p,0)
+#define CloseLastSubPath(p) t1_ClosePath(p,1)
+#define Conic(B,C,s) t1_Conic(B,C,(DOUBLE)s)
+#define RoundConic(M,C,r) t1_RoundConic(M,C,(DOUBLE)r)
+#define ArcP3(S,P2,P3) t1_ArcP3(S,P2,P3)
+#define ArcCA(S,C,d) t1_ArcCA(S,C,(DOUBLE)d)
+#define Bezier(B,C,D) t1_Bezier(B,C,D)
+#define Hint(S,r,w,o,h,a,d,l) t1_Hint(S,r,w,o,h,a,d,l)
+#define Reverse(p) t1_Reverse(p)
+#define ReverseSubPaths(p) t1_ReverseSubPaths(p)
+#define AddLoc(p1,p2) t1_Join(p1,p2)
+#define SubLoc(p1,p2) t1_SubLoc(p1,p2)
+#define DropSegment(p) t1_DropSegment(p)
+#define HeadSegment(p) t1_HeadSegment(p)
+#define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y)
+#define QueryPath(p,t,B,C,D,r) t1_QueryPath(p,t,B,C,D,r)
+#define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2)
+
+
+struct segment *t1_Loc(); /* create a location object (or "move" segment) */
+struct segment *t1_ILoc(); /* integer argument version of same */
+struct segment *t1_Line(); /* straight line path segment */
+struct segment *t1_Join(); /* join two paths or regions together */
+struct segment *t1_ClosePath(); /* close a path or path set */
+struct conicsegment *t1_Conic(); /* conic curve path segment */
+struct conicsegment *t1_RoundConic(); /* ditto, specified another way */
+struct conicsegment *t1_ArcP3(); /* circular path segment with three points */
+struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */
+struct beziersegment *t1_Bezier(); /* Bezier third order curve path segment */
+struct hintsegment *t1_Hint(); /* produce a font 'hint' path segment */
+struct segment *t1_Reverse(); /* reverse the complete order of paths */
+struct segment *t1_ReverseSubPaths(); /* reverse only sub-paths; moves unchanged */
+struct segment *t1_SubLoc(); /* subtract two location objects */
+struct segment *t1_DropSegment(); /* Drop the first segment in a path */
+struct segment *t1_HeadSegment(); /* return the first segment in a path */
+void t1_QueryLoc(); /* Query location; return its (x,y) */
+void t1_QueryPath(); /* Query segment at head of a path */
+void t1_QueryBounds(); /* Query the bounding box of a path */
+
+/*END SHARED*/
+/*SHARED*/
+
+#define CopyPath(p) t1_CopyPath(p)
+#define KillPath(p) t1_KillPath(p)
+#define PathTransform(p,m) t1_PathXform(p,m)
+#define PathDelta(p,pt) t1_PathDelta(p,pt)
+#define BoundingBox(h,w) t1_BoundingBox(h,w)
+#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y)
+#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a)
+#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy)
+#define BoxPath(S,h,w) t1_BoxPath(S,h,w)
+
+struct segment *t1_CopyPath(); /* duplicate a path */
+void t1_KillPath(); /* destroy a path */
+struct segment *t1_PathXform(); /* transform a path arbitrarily */
+void t1_PathDelta(); /* calculate the ending point of a path */
+struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */
+struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */
+DOUBLE t1_Hypoteneuse(); /* returns the length of a line */
+struct segment *t1_BoxPath(); /* returns a rectangular path */
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ConsumePath(p) MAKECONSUME(p,KillPath(p))
+#define UniquePath(p) MAKEUNIQUE(p,CopyPath(p))
+
+/*END SHARED*/
+/*SHARED*/
+
+struct segment {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ unsigned char size; /* size of the structure */
+ unsigned char context; /* index to device context */
+ struct segment *link; /* pointer to next structure in linked list */
+ struct segment *last; /* pointer to last structure in list */
+ struct fractpoint dest; /* relative ending location of path segment */
+} ;
+
+#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */
+#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */
+
+/*
+NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the
+subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE)
+in the subpath
+
+We define the ISPATHANCHOR predicate to test that a path handle
+passed by the user is valid:
+*/
+
+#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL)
+
+/*
+For performance reasons, a user's "location" object is identical to
+a path whose only segment is a move segment. We define a predicate
+to test for this case. See also :hdref refid=location..
+*/
+
+#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL)
+
+/*END SHARED*/
+/*SHARED*/
+
+struct conicsegment {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ /* type = CONICTYPE */
+ unsigned char size; /* as with any 'segment' type */
+ unsigned char context; /* as with any 'segment' type */
+ struct segment *link; /* as with any 'segment' type */
+ struct segment *last; /* as with any 'segment' type */
+ struct fractpoint dest; /* Ending point (C point) */
+ struct fractpoint M; /* "midpoint" of conic explained above */
+ float roundness; /* explained above */
+} ;
+/*END SHARED*/
+/*SHARED*/
+
+struct beziersegment {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ /* type = BEZIERTYPE */
+ unsigned char size; /* as with any 'segment' type */
+ unsigned char context; /* as with any 'segment' type */
+ struct segment *link; /* as with any 'segment' type */
+ struct segment *last; /* as with any 'segment' type */
+ struct fractpoint dest; /* ending point (D) */
+ struct fractpoint B; /* control point B */
+ struct fractpoint C; /* control point C */
+} ;
+
+/*END SHARED*/
+/*SHARED*/
+
+struct hintsegment {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ /* type = HINTTYPE */
+ unsigned char size; /* size of the structure */
+ unsigned char context; /* device context */
+ struct segment *link; /* pointer to next structure in linked list */
+ struct segment *last; /* pointer to last structure in list */
+ struct fractpoint dest; /* ALWAYS 0,0 */
+ struct fractpoint ref;
+ struct fractpoint width;
+ char orientation;
+ char hinttype;
+ char adjusttype;
+ char direction;
+ int label;
+} ;
+
+/*END SHARED*/
+/*SHARED*/
+
+/*
+CONCAT links the 'p2' path chain on the end of the 'p1' chain. (This macro
+is also used by the STROKES module.)
+*/
+#define CONCAT(p1, p2) { \
+ p1->last->link = p2; /* link p2 on end of p1 */ \
+ p1->last = p2->last; /* last of new is last of p2 */ \
+ p2->last = NULL; } /* only first segment has non-NULL "last" */
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/pfb2pfa.1 b/Build/source/texk/ps2pkm/pfb2pfa.1
new file mode 100644
index 00000000000..f81abb8ed2f
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pfb2pfa.1
@@ -0,0 +1,19 @@
+.TH PFB2PFA 1 TeX
+.SH NAME
+pfb2pfa \- convert a type1 pfb file (binary MSDOS) into a pfa (ASCII)
+.SH SYNOPSIS
+pfb2pfa [-v] pfbfile [pfafile]
+.SH DESCRIPTION
+Program converts a binary MSDOS representation for a type1 PostScript
+font into a readable ASCII version. The MSDOS newline (\\r) is converted
+into the UNIX newline (\\n). The output is written in a file whose name
+is the name that is provided on the command line or the basename of the
+input file plus extension ".pfa".
+.PP
+With the -v option you get some information about what the
+program is doing.
+.SH AUTHOR
+.nf
+Piet Tutelaers <rcpt@urc.tue.nl>
+
+
diff --git a/Build/source/texk/ps2pkm/pfb2pfa.c b/Build/source/texk/ps2pkm/pfb2pfa.c
new file mode 100644
index 00000000000..546467b761c
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pfb2pfa.c
@@ -0,0 +1,113 @@
+/*
+ * NAME
+ * pfb2pfa - convert a type1 pfb file (binary) into a pfa (ASCII)
+ * SYNOPSIS
+ * pfb2pfa [-v] pfbfile [pfafile]
+ * DESCRIPTION
+ * Program converts a binary MSDOS representation for a type1
+ * PostScript font into a readable ASCII version. The MSDOS
+ * newline (\r) is converted into the UNIX newline (\n).
+ * The output is written in a file whose name is the name that
+ * is provided on the command line or the basename of the input
+ * file plus extension ".pfa".
+ *
+ * With the -v option you get some information about what the
+ * program is doing.
+ * AUTHOR
+ * Piet Tutelaers (rcpt@urc.tue.nl)
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "basics.h" /* basic definitions and fatal() */
+#include "filenames.h" /* newname() */
+
+#if defined(MSDOS) || defined(DOSISH)
+#define NEWLINE '\012'
+#else
+#define NEWLINE '\n'
+#endif
+
+#define HEX_PER_LINE 30
+
+int main (int argc, char *argv[])
+{ unsigned int t, l, i;
+ unsigned int l1, l2, l3, l4;
+ short c, done, verbose = 0;
+ FILE *pfb, *pfa;
+ char *pfbname, *pfaname = NULL, *myname = "pfb2pfa";
+
+ /* prototypes */
+ void fatal(char *fmt, ...);
+
+ while (--argc > 0 && (*++argv)[0] == '-') {
+ done=0;
+ while ((!done) && (c = *++argv[0])) /* allow -bcK like options */
+ switch (c) {
+ case 'v':
+ verbose = 1; break;
+ default:
+ fatal("%s: %c illegal option\n", myname, c);
+ }
+ }
+
+ if (argc < 1) fatal("Usage: %s [-v] pfbfile [pfafile]\n", myname);
+
+ pfbname = argv[0]; argc--; argv++;
+ if (argc < 1) pfaname = newname(pfbname, ".pfa");
+ else if (argc == 1) pfaname = argv[0];
+ else fatal("Usage: %s [-v] pfbfile [pfafile]\n", myname);
+
+ pfb = fopen(pfbname, RB);
+ if (pfb == NULL) fatal("Can't open %s\n", pfbname);
+
+ pfa = fopen(pfaname, WB);
+ if (pfa == NULL) fatal("Can't open %s\n", pfaname);
+
+ while(!feof(pfb)) {
+ if (getc(pfb) != 128)
+ fatal("%s: not a pfb file.\n", pfbname);
+ t = getc(pfb);
+ if (verbose) printf("Type: %d, ", t);
+ switch (t) {
+ case 1:
+#if 1
+ l1 = getc(pfb); l2 = getc(pfb); l3 = getc(pfb); l4 = getc(pfb);
+ l = l1 | l2 << 8 | l3 << 16 | l4 << 24;
+ /* printf("%2x %2x %2x %2x -> %x\n", l1, l2, l3, l4, l); */
+#else
+ l = (getc(pfb)) | (getc(pfb)<<8) | (getc(pfb)<<16) | (getc(pfb)<<24);
+#endif
+ if (verbose) printf(" plain text, length %d\n", l);
+ for (i=0; i < l ; i++) {
+ c = getc(pfb);
+ if (c == '\r') putc(NEWLINE, pfa);
+ else putc(c, pfa);
+ }
+ break;
+ case 2:
+#if 1
+ l1 = getc(pfb); l2 = getc(pfb); l3 = getc(pfb); l4 = getc(pfb);
+ l = l1 | l2 << 8 | l3 << 16 | l4 << 24;
+ /* printf("%2x %2x %2x %2x -> %x\n", l1, l2, l3, l4, l); */
+#else
+ l = (getc(pfb)) | (getc(pfb)<<8) | (getc(pfb)<<16) | (getc(pfb)<<24);
+#endif
+ if (verbose) printf(" binary data, length %d\n", l);
+ for(i = 0; i < l ;i++) {
+ fprintf(pfa, "%02x", getc(pfb));
+ if ((i+1) % HEX_PER_LINE == 0) putc(NEWLINE, pfa);
+ }
+ putc(NEWLINE, pfa);
+ break;
+ case 3:
+ if (verbose) printf("End of file\n");
+ exit(0);
+ break;
+ default:
+ fatal("Unknown field type: %d\n", t);
+ }
+ }
+ fclose(pfa); fclose(pfb);
+ return 0;
+}
diff --git a/Build/source/texk/ps2pkm/pictures.h b/Build/source/texk/ps2pkm/pictures.h
new file mode 100644
index 00000000000..69ecf0a4f6b
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pictures.h
@@ -0,0 +1,48 @@
+/* $XConsortium: pictures.h,v 1.2 91/10/10 11:18:53 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* STUB */
+
+#define CopyPicture(p) p
+#define UniquePicture(p) p
+#define KillPicture(p)
+#define BegHandle(o,m) o
+#define EndHandle(o,m) o
+#define PictureBounds(P) P
+
+struct picture {
+ struct fractpoint origin;
+ struct fractpoint ending;
+};
+
+#define Phantom(o) t1_Phantom(o)
+#define Snap(o) t1_Snap(o)
+
+struct segment *t1_Phantom();
+struct segment *t1_Snap();
diff --git a/Build/source/texk/ps2pkm/pk2bm.1 b/Build/source/texk/ps2pkm/pk2bm.1
new file mode 100644
index 00000000000..5b9c6d599db
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pk2bm.1
@@ -0,0 +1,39 @@
+.TH PK2BM 1 TeX
+.SH NAME
+pk2bm \- create a bitmap from a TeX pkfont
+.SH SYNOPSIS:
+pk2bm [-bh] [-W\fIwidth\fP] [-H\fIheight\fP] -c\fIchar\fP pkfont
+
+pk2bm [-bh] [-W\fIwidth\fP] [-H\fIheight\fP] -o\fIoctchar\fP pkfont
+.SH DESCRIPTION
+This program generates a bitmap (ASCII file) which can be used
+to create X11 applications. The bitmap file consists of all pixels
+of the specified character (via the -c or -o option) from
+the given pkfont. The format is described in bitmap(X11).
+.PP
+The pkfont is a packed fontfile generated by gftopk(TeX) from a
+gffont. A gffont is the output of METAFONT a program to design fonts
+in a device independant way.
+.PP
+With the -b flag a bitmap is generated in which all black pixels are
+drawn as a `*' and all white bits as a `.'. With the -h flag a
+hexadecimal bitmap dump is generated.
+.PP
+The -W and/or -H options can be used to create a bitmap of
+respectivally `width' and `height' pixels. The pk-bitmap will in
+this case be centered according to these new dimensions.
+.PP
+The output is written to the standard output.
+.SH SEE ALSO
+.nf
+`METAFONT', Donald Knuth.
+`The PKtype processor', belonging to the METAFONTware.
+bitmap(X11),
+gftopk(TeX),
+pktype(TeX),
+ps2pk(1)
+
+.SH AUTHOR
+.nf
+Piet Tutelaers <rcpt@urc.tue.nl>
+
diff --git a/Build/source/texk/ps2pkm/pk2bm.c b/Build/source/texk/ps2pkm/pk2bm.c
new file mode 100644
index 00000000000..baa9ddd8f4d
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pk2bm.c
@@ -0,0 +1,206 @@
+/*
+ * NAME
+ * pk2bm - create a bitmap from a TeX pkfont
+ * SYNOPSIS:
+ * pk2bm [-bh] [-W width] [-H height] {-c char|-o octchar} pkfont
+ * DESCRIPTION
+ * This program generates a bitmap (ASCII file) which can be used
+ * to create X11 applications. The bitmap file consists of all
+ * pixels of the specified character (via the -c or -o option) from
+ * the given pkfont. The format is described in bitmap(X11).
+ *
+ * The pkfont is a packed fontfile generated by gftopk(TeX) from a
+ * gffont. A gffont is the output of METAFONT a program to design fonts
+ * in a device independant way.
+ *
+ * With the -b flag a bitmap is generated in which all black pixels are
+ * drawn as a `*' and all white bits as a `.'. With the -h flag a
+ * hexadecimal bitmap dump is generated.
+ *
+ * The -W and/or -H options can be used to create a bitmap of
+ * respectivally `width' and `height' pixels. The pk-bitmap will in
+ * this case be centered according to these new dimensions.
+ *
+ * The output is written to the standard output.
+ * SEE ALSO
+ * ``METAFONT'', Donald Knuth.
+ * ``The PKtype processor'', belonging to the METAFONTware.
+ * bitmap(X11), gftopk(TeX), pktype(TeX), ps2pk(1)
+ * AUTHOR
+ * Piet Tutelaers
+ * rcpt@urc.tue.nl
+ */
+#include <stdio.h>
+#include "pkin.h"
+
+int main(int argc, char *argv[])
+{
+ int done, C = 0, c, h = 0, w = 0, row, col;
+ unsigned int bitmap = 0, hexmap = 0;
+ halfword *word;
+ quarterword lsbf();
+ void dots();
+ chardesc cd;
+ char *myname = "pk2bm", *pkname;
+ int atoo(char *);
+
+ while (--argc > 0 && (*++argv)[0] == '-') {
+ done=0;
+ while ((!done) && (c = *++argv[0])) /* allow -bcK as an option */
+ switch (c) {
+ case 'c':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ C = *argv[0];
+ done = 1; break;
+ case 'o':
+ if (*++argv[0] == '\0') {
+ argc--; ++argv;
+ }
+ C = atoo(argv[0]);
+ done = 1; break;
+ case 'H':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ h = atoi(argv[0]);
+ done=1;
+ break;
+ case 'W':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ w = atoi(argv[0]);
+ done=1;
+ break;
+ case 'b':
+ bitmap = 1;
+ break;
+ case 'h':
+ hexmap = 1;
+ break;
+ default:
+ printf("%s: %c illegal option\n", myname, c);
+ exit(1);
+ }
+ }
+
+ if (argc == 0) {
+ printf("Usage: %s [-bh] {-c char|-o octchar} [-W width -H height] pkfile\n", myname);
+ exit(1);
+ }
+
+ pkname = argv[0];
+
+ if (readchar(pkname, C, &cd)) {
+ int H, dh, W, dw, bitsleft;
+ halfword nextword; quarterword nextbyte;
+
+ H=cd.cheight; if (h==0) h=H; dh=(h-H)/2;
+ W=cd.cwidth; if (w==0) w=W; dw=(w-W)/2;
+
+ if (bitmap || hexmap) {
+ printf("character : %d (%c)\n", (int) cd.charcode,
+ (char)cd.charcode);
+ printf(" height : %d\n", (int) cd.cheight);
+ printf(" width : %d\n", (int) cd.cwidth);
+ printf(" xoff : %d\n", (int) cd.xoff);
+ printf(" yoff : %d\n", (int) cd.yoff);
+ }
+ else {
+ printf("#define %s_%c_width \t %d\n",
+ pkname, (char)cd.charcode, (int) w);
+ printf("#define %s_%c_height \t %d\n",
+ pkname, (char)cd.charcode, (int) h);
+ printf("#define %s_%c_xoff \t %d\n",
+ pkname, (char)cd.charcode, (int) dw);
+ printf("#define %s_%c_yoff \t %d\n",
+ pkname, (char)cd.charcode, (int) dh);
+ printf("static char %s_%c_bits[] = {",
+ pkname, (char)cd.charcode);
+ }
+ for (row=0; row<h-H-dh; row++) {
+ printf("\n ");
+ for (col=0; col<w; col+=8)
+ if (bitmap) dots(0, w-col>7? 8: w-col);
+ else if (hexmap) printf("%02x", 0x00);
+ else printf(" 0x%02x, ", 0x00);
+ }
+ word = cd.raster;
+ for (row=h-H-dh; row<h-dh; row++) {
+ bitsleft = dw; nextword = 0;
+ printf("\n ");
+ for (col=0; col<w; col+=8) {
+ if (bitsleft>=8) {
+ nextbyte = nextword >> (bitsleft-8) & 0xff;
+ bitsleft-=8;
+
+ if (bitmap) dots(nextbyte, w-col>7? 8: w-col);
+ else if (hexmap) printf("%02x", nextbyte);
+ else printf(" 0x%02x, ", lsbf(nextbyte));
+ }
+ else {
+ nextbyte = nextword << (8-bitsleft) & 0xff;
+ if (col-dw<W)
+ nextword=(*word++);
+ else nextword=0;
+ nextbyte = nextbyte | (nextword >> (16-(8-bitsleft))
+ & 0xff);
+ bitsleft = 16 - (8-bitsleft);
+
+ if (bitmap) dots(nextbyte, w-col>7? 8: w-col);
+ else if (hexmap) printf("%02x", nextbyte);
+ else printf(" 0x%02x, ", lsbf(nextbyte));
+ }
+ }
+ }
+ for (row=h-dh; row<h; row++) {
+ printf("\n ");
+ for (col=0; col<w; col+=8)
+ if (bitmap) dots(0, w-col>7? 8: w-col);
+ else if (hexmap) printf("%02x", 0x00);
+ else printf(" 0x%02x, ", 0x00);
+ }
+ if ((!bitmap) && (!hexmap)) printf("};\n");
+ else putchar('\n');
+ }
+ return 0;
+}
+
+/*
+ * lsbf() transforms a byte (least significant bit first).
+ */
+quarterword lsbf(u)
+quarterword u;
+{
+ int i; quarterword bit, result = 0;
+
+ for (i=0; i<8; i++) {
+ bit = u & 001;
+ result = (result<<1) | bit;
+ u = u >> 1;
+ }
+ return result;
+}
+
+/*
+ * dots() print byte: `*' for a black and `.' for a white pixel
+ */
+void dots(u, n)
+quarterword u; int n;
+{ unsigned int bit;
+
+ bit=1<<7;
+ for ( ;n>0 ;n--) {
+ if (u & bit) putchar('*');
+ else putchar('.');
+ bit>>=1;
+ }
+}
+
+int atoo(char *oct)
+{ int octal = 0;
+ while (*oct != '\0') octal = 8*octal + (*oct++) - '0';
+ return octal & 0xff;
+}
diff --git a/Build/source/texk/ps2pkm/pkin.c b/Build/source/texk/ps2pkm/pkin.c
new file mode 100644
index 00000000000..a539b1de5b0
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pkin.c
@@ -0,0 +1,454 @@
+/*
+ * NAME
+ * pkin.c - implementation of readchar()
+ * DESCRIPTION
+ * This implementation of readchar() uses parts of the program dvips
+ * written by Tomas Rokicki--the inventor of the pkformat--(loadfont.c,
+ * download.c and unpack.c). Dvips in turn is derived from pktype.
+ * Pktype(TeX) is described in debt in ``The PKtype processor'',
+ * which is available as pktype.weave as part of the METAFONTware.
+ * What was needed to implement readchar() is rearranged in pkfile.c to
+ * get more modularity in the style of MODULA2.
+ * REDESIGN
+ * Piet Tutelaers
+ * rcpt@urc.tue.nl
+ */
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#include <stdlib.h> /* malloc() */
+#include "basics.h" /* basic definitions */
+#include "pkin.h"
+
+/*
+ * Forward declaration
+ */
+static void error();
+
+/*
+ * Now we have some routines to get stuff from the pk file. pkbyte returns
+ * the next byte from the pk file.
+ */
+
+static FILE *pkfile ;
+
+static shalfword
+pkbyte()
+{
+ register shalfword i ;
+
+ if ((i=getc(pkfile))==EOF)
+ error("! unexpected eof in pk file") ;
+ return(i) ;
+}
+
+static integer
+pkquad()
+{
+ register integer i ;
+
+ i = pkbyte() ;
+ if (i > 127)
+ i -= 256 ;
+ i = i * 256 + pkbyte() ;
+ i = i * 256 + pkbyte() ;
+ i = i * 256 + pkbyte() ;
+ return(i) ;
+}
+
+static integer
+pktrio()
+{
+ register integer i ;
+
+ i = pkbyte() ;
+ i = i * 256 + pkbyte() ;
+ i = i * 256 + pkbyte() ;
+ return(i) ;
+}
+
+static integer
+pkpair()
+{
+ register integer i ;
+
+ i = pkbyte() ;
+ i = i * 256 + pkbyte() ;
+ return (i);
+}
+
+static integer
+pkspair()
+{
+ register integer i ;
+
+ i = pkbyte() ;
+ if (i > 127)
+ i -= 256;
+ i = i * 256 + pkbyte();
+ return (i);
+}
+
+static char errbuf[80] ;
+/*
+ * pkopen opens the pk file. This is system dependent.
+ */
+
+static Boolean
+pkopen(name)
+ char name[] ;
+{
+ if ((pkfile=fopen(name, RB))==NULL) {
+ (void)sprintf(errbuf, "Could not open %s", name) ;
+ error(errbuf) ;
+ return(0) ;
+ } else
+ return(1) ;
+}
+
+/*
+ * The next part is devoted to unpacking the character data.
+ */
+
+/*
+ * We need procedures to get a nybble, bit, and packed word from the
+ * packed data structure.
+ */
+
+static halfword inputbyte, flagbyte ;
+static halfword bitweight ;
+static halfword dynf ;
+static halfword repeatcount ;
+
+static shalfword
+getnyb ()
+{ halfword temp;
+ if ( bitweight == 0 )
+ { bitweight = 16 ;
+ inputbyte = pkbyte();
+ temp = inputbyte >> 4 ;
+ } else {
+ bitweight = 0 ;
+ temp = inputbyte & 15 ;
+ }
+ return(temp);
+}
+
+static Boolean
+getbit ()
+{
+ bitweight >>= 1 ;
+ if ( bitweight == 0 )
+ { inputbyte = pkbyte();
+ bitweight = 128 ;
+ }
+ return(inputbyte & bitweight) ;
+}
+
+static halfword (*realfunc)() ;
+long PKremainder ;
+static halfword handlehuge() ;
+
+static halfword pkpackednum () {
+register halfword i, j ;
+ i = getnyb () ;
+ if ( i == 0 )
+ { do { j = getnyb () ;
+ i++ ;
+ } while ( ! ( j != 0 ) ) ;
+ if ( i > 3 ) {
+/*
+ * Damn, we got a huge count! We *fake* it by giving an artificially
+ * large repeat count.
+ */
+ return( handlehuge ( i , j ) ) ;
+ } else {
+ while ( i > 0 )
+ { j = j * 16 + getnyb () ;
+ i-- ;
+ }
+ return ( j - 15 + ( 13 - dynf ) * 16 + dynf ) ;
+ }
+ }
+ else if ( i <= dynf ) return ( i ) ;
+ else if ( i < 14 ) return ( ( i - dynf - 1 ) * 16 + getnyb () + dynf + 1
+ ) ;
+ else
+ { if ( i == 14 ) repeatcount = pkpackednum () ;
+ else repeatcount = 1 ;
+#ifdef DEBUG
+ printf("[%d]", repeatcount);
+#endif
+ return ( (*realfunc)() ) ;
+ }
+ }
+
+static halfword rest ()
+{
+ halfword i ;
+
+ if (PKremainder < 0) {
+ PKremainder = - PKremainder ;
+ return ( 0 ) ;
+ } else if (PKremainder > 0) {
+ if (PKremainder > 4000) {
+ PKremainder = 4000 - PKremainder ;
+ return ( 4000 ) ;
+ } else {
+ i = PKremainder ;
+ PKremainder = 0 ;
+ realfunc = pkpackednum ;
+ return ( i ) ;
+ }
+ } else {
+ error("! shouldn't happen") ;
+ }
+
+ /*NOTREACHED*/
+ return 0;
+}
+
+static halfword handlehuge ( i , k )
+halfword i , k ;
+{
+ register long j = k ;
+
+ while (i) {
+ j = (j << 4L) + getnyb() ;
+ i-- ;
+ }
+ PKremainder = j - 15 + ( 13 - dynf ) * 16 + dynf ;
+ realfunc = rest ;
+ return ( rest() ) ;
+}
+
+/*
+ * And now we have our unpacking routine.
+ */
+
+static halfword gpower[17] = { 0 , 1 , 3 , 7 , 15 , 31 , 63 , 127 ,
+ 255 , 511 , 1023 , 2047 , 4095 , 8191 , 16383 , 32767 , 65535 } ;
+
+static void
+unpack(cd)
+chardesc *cd;
+{
+ register integer i, j ;
+ register halfword word, wordweight ;
+ halfword *raster;
+ shalfword rowsleft ;
+ Boolean turnon ;
+ shalfword hbit ;
+ halfword count ;
+ shalfword wordwidth ;
+
+ wordwidth = (cd->cwidth + 15) / 16 ;
+ i = 2 * cd->cheight * (long)wordwidth ;
+ if (i <= 0)
+ i = 2 ;
+ cd->raster = (halfword *)malloc((unsigned)i) ;
+ if (cd->raster == NULL)
+ error("! out of memory during allocation") ;
+ raster = cd->raster;
+ realfunc = pkpackednum ;
+ dynf = flagbyte / 16 ;
+ turnon = flagbyte & 8 ;
+ if ( dynf == 14 )
+ { bitweight = 0 ;
+ for ( i = 1 ; i <= cd->cheight ; i ++ )
+ { word = 0 ;
+ wordweight = 32768 ;
+ for ( j = 1 ; j <= cd->cwidth ; j ++ )
+ { if ( getbit () ) word += wordweight ;
+ wordweight >>= 1 ;
+ if ( wordweight == 0 )
+ { *raster++ = word ;
+ word = 0 ;
+ wordweight = 32768 ;
+ }
+ }
+ if ( wordweight != 32768 )
+ *raster++ = word ;
+ }
+ } else {
+ rowsleft = cd->cheight ;
+ hbit = cd->cwidth ;
+ repeatcount = 0 ;
+ wordweight = 16 ;
+ word = 0 ;
+ bitweight = 0 ;
+ while ( rowsleft > 0 )
+ { count = (*realfunc)() ;
+#ifdef DEBUG
+ if (turnon) printf("(%d) ",count);
+ else printf("%d ",count);
+#endif
+ 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 ] ;
+ *raster++ = word ;
+ for ( i = 1 ; i <= repeatcount ; i ++ ) {
+ for ( j = 1 ; j <= wordwidth ; j ++ ) {
+ *raster = *(raster - wordwidth) ;
+ raster++ ;
+ }
+ }
+ rowsleft -= repeatcount + 1 ;
+ repeatcount = 0 ;
+ word = 0 ;
+ wordweight = 16 ;
+ count -= hbit ;
+ hbit = cd->cwidth ;
+ }
+ else
+ { if ( turnon ) word += gpower [ wordweight ] ;
+ *raster++ = word ;
+ word = 0 ;
+ count -= wordweight ;
+ hbit -= wordweight ;
+ wordweight = 16 ;
+ }
+ }
+ turnon = ! turnon ;
+ }
+ putchar('\n') ;
+ if ( ( rowsleft != 0 ) || ( hbit != cd->cwidth ) )
+ error ( "! error while unpacking; more bits than required" ) ;
+ }
+}
+
+/*
+ * readchar(): the main routine
+ * Reads the character definition of character `c' into `cd' if available,
+ * return FALSE (0) otherwise.
+ */
+int
+readchar(name, c, cd)
+char name[];
+shalfword c;
+chardesc *cd;
+{
+ register shalfword i ;
+ register integer k ;
+ register integer length = 0;
+
+ if (!pkopen(name)) return(0);
+/*
+ * Check the preamble of the pkfile
+ */
+ if (pkbyte()!=247)
+ error("! bad pk file, expected pre") ;
+ if (pkbyte()!=89)
+ error("! bad version of pk file") ;
+ for(i=pkbyte(); i>0; i--) /* creator of pkfile */
+ (void)pkbyte() ;
+ (void)pkquad(); /* design size */
+ k = pkquad() ; /* checksum */
+ k = pkquad() ; /* hppp */
+ k = pkquad() ; /* vppp */
+/*
+ * Now we skip to the desired character definition
+ */
+ while ((flagbyte=pkbyte())!=245) {
+ if (flagbyte < 240) {
+ switch (flagbyte & 7) {
+case 0: case 1: case 2: case 3:
+ length = (flagbyte & 7) * 256 + pkbyte() - 4 ;
+ cd->charcode = pkbyte() ;
+ (void) pktrio() ; /* TFMwidth */
+ (void) pkbyte() ; /* pixel width */
+ break ;
+case 4:
+ length = pkbyte() * 256 ;
+ length = length + pkbyte() - 5 ;
+ cd->charcode = pkbyte() ;
+ (void) pktrio() ; /* TFMwidth */
+ i = pkbyte() ;
+ i = i * 256 + pkbyte() ; /* pixelwidth */
+ break ;
+case 5: case 6:
+ error("! lost sync in pk file (character too big)") ;
+case 7:
+ length = pkquad() - 12 ;
+ cd->charcode = pkquad() ;
+ (void) pkquad() ; /* TFMwidth */
+/* cd->pixelwidth = (pkquad() + 32768) >> 16 ; */
+ (void) pkquad(); /* pixelwidth */
+ k = pkquad() ;
+ }
+ if (cd->charcode == c) {
+ if (flagbyte & 4) {
+ if ((flagbyte & 7) == 7) { /* long format */
+ cd->cwidth = pkquad() ;
+ cd->cheight = pkquad() ;
+ cd->xoff = pkquad() ;
+ cd->yoff = pkquad() ;
+ } else { /* extended format */
+ cd->cwidth = pkpair(); ;
+ cd->cheight = pkpair() ;
+ cd->xoff = pkspair() ;
+ cd->yoff = pkspair() ;
+ }
+ } else { /* short format */
+ cd->cwidth = pkbyte() ;
+ cd->cheight = pkbyte() ;
+ cd->xoff = pkbyte() ;
+ cd->yoff = pkbyte() ;
+ if (cd->xoff > 127)
+ cd->xoff -= 256 ;
+ if (cd->yoff > 127)
+ cd->yoff -= 256 ;
+ }
+ unpack(cd);
+ (void)fclose(pkfile) ;
+ return(1);
+ }
+ for (; length>0; length--) /* skip this character */
+ (void) pkbyte() ;
+ } else {
+ k = 0 ;
+ switch (flagbyte) {
+case 243:
+ k = pkbyte() ;
+ if (k > 127)
+ k -= 256 ;
+case 242:
+ k = k * 256 + pkbyte() ;
+case 241:
+ k = k * 256 + pkbyte() ;
+case 240:
+ k = k * 256 + pkbyte() ;
+ while (k-- > 0)
+ i = pkbyte() ;
+ break ;
+case 244:
+ k = pkquad() ;
+ break ;
+case 246:
+ break ;
+default:
+ error("! lost sync in pk file") ;
+ }
+ }
+ }
+ (void)fclose(pkfile) ;
+ return(0); /* character not found */
+}
+
+static void error(s)
+char s[];
+{
+ fprintf(stderr, "%s\n", s);
+ exit(1);
+}
diff --git a/Build/source/texk/ps2pkm/pkin.h b/Build/source/texk/ps2pkm/pkin.h
new file mode 100644
index 00000000000..3bc9279a7cb
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pkin.h
@@ -0,0 +1,61 @@
+/*
+ * NAME
+ * pkin.h - header file for readchar()
+ * SYNOPSIS
+ * #include "pkfile.h"
+ *
+ * int readchar(name, c, cd)
+ * char name[]; shalfword c; chardesc *cd;
+ * DESCRIPTION
+ * Readchar() opens the pkfile `name', checks if it's a legal pkfile,
+ * and reads the character description of `c' into `cd'. Readchar()
+ * returns TRUE (1) upon success, FALSE (0) if the character `c' is
+ * not found in the pkfile.
+ *
+ * Parameter `cd' is a pointer to a the following structure:
+ * typedef struct {
+ * integer charcode,
+ * cwidth, cheight,
+ * xoff, yoff;
+ * halfword *raster ;
+ * } chardesc ;
+ *
+ * Charcode is the code of the character returned, cwidth and cheight
+ * respectively the width and height of the character in pixels,
+ * xoff and yoff are the offsets of first pixel to the reference point
+ * of the character box.
+ * Raster is a pointer to the bitmap describing the character. This
+ * raster consists of cheight rows of (cwidth + 15) /16 words of
+ * 16 bits each. Each row contains from left to right all cwidth
+ * pixels of that row.
+ * WARNING
+ * If the machine has a default integer size of 16 bits, and 32-bit
+ * integers must be manipulated with %ld, be carefull!
+ * AUTHORS
+ * Piet Tutelaers
+ * rcpt@urc.tue.nl
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+/*
+ * Type declarations. integer must be a 32-bit signed; shalfword must
+ * be a sixteen-bit signed; halfword must be a sixteen-bit unsigned;
+ * quarterword must be an eight-bit unsigned.
+ */
+typedef long integer;
+typedef short shalfword ;
+typedef unsigned short halfword ;
+typedef unsigned char quarterword ;
+typedef short Boolean ;
+/*
+ * A chardesc describes an individual character.
+ */
+typedef struct {
+ integer charcode,
+ cwidth, cheight,
+ xoff, yoff;
+ halfword *raster ;
+} chardesc ;
+
+int readchar();
diff --git a/Build/source/texk/ps2pkm/pkout.c b/Build/source/texk/ps2pkm/pkout.c
new file mode 100644
index 00000000000..cb6cb627b63
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pkout.c
@@ -0,0 +1,579 @@
+/* FILE: pkout.c
+ *
+ * PURPOSE: implementation of PK output functions
+ *
+ * COMMENT: functions are derived from `The GFtoPK processor' but
+ * presented in a modular fashion so they can be used in other
+ * programs.
+ * (Porting `top-down' WEB code into modular readable C-code is
+ * not a trivial exercise.)
+ *
+ * VERSION: Febr. 1992
+ * Dec. 1993
+ * Sep. 1995
+ *
+ * AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
+ */
+
+/* Some constants */
+#define PK_ID 89
+#define PK_SPC1 240 /* All we need, max length always < 255 */
+#define PK_NUMSPC 244
+#define PK_NOOP 246
+#define PK_PRE 247
+#define PK_POST 245
+
+#define DPI 72.27
+#define MIN(a,b) ( (a<b)? (a): (b))
+
+#include <stdio.h>
+#include <stdarg.h> /* va_start(), va_end() */
+#include <stdlib.h> /* malloc() */
+#include "basics.h" /* definitions and fatal() */
+#include "pkout.h"
+
+#undef DEBUG
+static int pk_len = 0;
+static FILE *pkfile;
+
+void pk_open(char *pkname)
+{
+ pkfile = fopen(pkname, WB);
+ if (pkfile == NULL) fatal("Can not open %s\n", pkname);
+}
+
+void pk_close()
+{
+ fclose(pkfile);
+}
+
+/* Portable Big Endian output functions */
+
+/* Nybble buffer */
+static int pk_output_byte, bitweight;
+static void pk1(int);
+
+static void pk_nybble(int x)
+{
+ if (bitweight == 16) {
+ bitweight = 1; pk_output_byte = x*16;
+ }
+ else {
+ bitweight = 16; pk1(pk_output_byte + x);
+ }
+}
+
+static void pk1(int x)
+{
+ if (x < 0) x += 256;
+ putc(x & 0x00ff, pkfile);
+ pk_len++;
+}
+
+static void pk2(int x)
+{
+ if (x < 0) x += 65536;
+ pk1((x & 0x00ff00) >> 8);
+ pk1(x & 0x0000ff);
+}
+
+static void pk3(INT32 x)
+{
+ pk1((x & 0x00ff0000) >> 16);
+ pk1((x & 0x0000ff00) >> 8);
+ pk1(x & 0x000000ff);
+}
+
+static void pk4(INT32 x)
+{
+ if (x < 0) { /* next two lines from mackay@cs.washington.edu */
+ x += 2<<29; x += 2<<29;
+ pk1(((x & 0x7f000000) >> 24) + 128);
+ }
+ else pk1((x & 0x7f000000) >> 24);
+ pk1((x & 0x00ff0000) >> 16);
+ pk1((x & 0x0000ff00) >> 8);
+ pk1(x & 0x000000ff);
+}
+
+static int MAX_COUNTS; /* length of array to hold runlengths */
+
+void pk_preamble(char *comment, /* source of the font */
+ float pointsize, /* pointsize in points */
+ INT32 checksum, /* should equal to tfm-value */
+ unsigned int h_res, /* horizontal resolution (dpi) */
+ unsigned int v_res) /* vertical resolution (dpi) */
+{
+ int i, len;
+
+ /* compute MAX_COUNTS based upon pointsize, h_res and v_res */
+ MAX_COUNTS = pointsize / DPI * h_res * (pointsize / DPI * v_res + 1);
+
+ pk1(PK_PRE);
+ pk1(PK_ID);
+ len = strlen(comment);
+ len = len>255? 255: len;
+ pk1(len);
+ for (i=0; i<len; i++) pk1(*comment++);
+
+ pk4(pointsize * (1<<20) + 0.5);
+ pk4(checksum);
+ pk4(h_res / DPI * (1<<16)); pk4(v_res / DPI * (1<<16));
+}
+
+/* From `The GFtoPK processor', pp. 231 */
+
+int optimal_size(int W, int H, int cnt, int count[], int *dyn_f)
+{ int comp_size = 0, b_comp_size, deriv[14], i, j, k;
+
+ i = (count[0] == 0? 1: 0); /* skip first empty runlength */
+ /* compute comp_size and deriv[1..13] */
+ for (j=1; j<14; j++) deriv[j] = 0;
+ while (i<cnt) {
+ j = count[i++];
+ if (j == -1) { comp_size++; continue; }
+ if (j < 0) { j = -j; comp_size++; }
+ if (j < 209) comp_size += 2;
+ else {
+ k = j - 193;
+ while (k >= 16) { k=k/16; comp_size += 2; }
+ comp_size++;
+ }
+ if (j < 14) deriv[j]--;
+ else {
+ if (j < 209) deriv[(223 - j) / 15]++;
+ else {
+ k = 16;
+ while (k*16 < j+3) k *= 16;
+ if (j-k <= 192) deriv[(207-j+k)/15] += 2;
+ }
+ }
+ }
+ /* find minimal value */
+ b_comp_size = comp_size; *dyn_f = 0;
+ for (i=1; i<14; i++) {
+ comp_size += deriv[i];
+ if (comp_size <= b_comp_size) {
+ b_comp_size = comp_size; *dyn_f = i;
+ }
+ }
+ comp_size = (b_comp_size + 1) / 2;
+ if (H*W == 0 || (comp_size > (H*W + 7) / 8)) {
+ comp_size = (H*W + 7) / 8; *dyn_f = 14;
+ }
+ return comp_size;
+}
+
+/* Next array contains the runlengths */
+static int *count = NULL;
+
+/* Global variables (interface between pk_runlengths() and pk_char() */
+static int dyn_f, comp_size, cnt;
+
+static void pk_runlengths(int W, int H, int (*next_pixel)())
+{ int current_value, pixel, i, j, max_counts, first_count;
+ int total_pixels, rc, row, col, runlength;
+ int color1, color2, total_pixels2, /* counting equal rows variables */
+ pixels, i1, i2, newrow;
+
+ first_count = H; max_counts = first_count + H * W;
+ if (count == NULL) {
+ count = malloc(MAX_COUNTS * sizeof(int));
+ if (count == NULL) fatal("Out of memory\n");
+ }
+
+ if (max_counts > MAX_COUNTS) {
+ free(count);
+ count = malloc(max_counts * sizeof(int));
+ if (count == NULL) fatal("Out of memory\n");
+ MAX_COUNTS = max_counts;
+ }
+
+ /* 1: compute transitions BLACK<->WHITE */
+
+ cnt = first_count;
+ runlength = 0; current_value = BLACK;
+ for (row=0; row < H; row++) {
+ for (col=0; col<W; col++) {
+ pixel = (*next_pixel)();
+ if (pixel == current_value) runlength++;
+ else if (pixel == OTHER(current_value)) {
+ count[cnt++] = runlength;
+ current_value = OTHER(current_value);
+ runlength = 1;
+ }
+ }
+ }
+ if (runlength>0)
+ count[cnt++] = runlength;
+
+#ifdef DEBUG
+ current_value = BLACK;
+ for (i=first_count; i<cnt; i++)
+ if (count[i] < 0) printf("[%d]", -count[i]);
+ else {
+ if (current_value == BLACK) printf("%d", count[i]);
+ else printf("(%d)", count[i]);
+ current_value = OTHER(current_value);
+ }
+ putchar('\n');
+#endif
+
+ /* 2: Now remove equal lines and add a repeat count at the first
+ transition of a row */
+
+ i = first_count; j = 0;
+ total_pixels = 0; row = -1;
+ current_value = BLACK;
+ if (count[i] == 0) {
+ count[j++] = count[i++];
+ current_value = WHITE;
+ }
+ while (i < cnt) {
+ if (j >= i) fatal("Program error: report to author!\n");
+ count[j++] = count[i];
+ total_pixels += count[i++];
+ current_value = OTHER(current_value);
+ newrow = total_pixels / W; col = total_pixels % W;
+ /* if transition starts in column zero or in a previous row
+ then continue */
+ if (newrow == row || row == H-1 || col == 0) continue;
+ row = newrow;
+
+ /* count equal rows */
+
+ /* 1: goto first transition of next row */
+ color2 = current_value;
+ total_pixels2 = total_pixels; i2 = i;
+ while (i2 < cnt && total_pixels2 / W == row) {
+ total_pixels2 += count[i2++];
+ color2 = OTHER(color2);
+ }
+
+ /* 2: do we need to compute a repeat count? */
+ if (color2 != current_value
+ || total_pixels2 - total_pixels != W) continue;
+
+ /* 3: count them */
+ rc = 0; i1 = i;
+ while (i2 < cnt && count[i1] == count[i2]) {
+#ifdef DEBUG
+ printf("%d (%d)", count[i1], count[i2]);
+#endif
+ total_pixels2 += count[i2++]; i1++;
+ }
+ rc = total_pixels2 / W - row; /* enclosed rows */
+ if (MIN(count[i1], count[i2]) + total_pixels2 % W < W)
+ rc--;
+#ifdef DEBUG
+ printf(" row %d: rc = %d\n", row, rc);
+#endif
+
+ /* 3: now remove the equal rows and finish last row */
+ if (rc > 0) {
+ /* insert a repeat count */
+ if (j >= i) fatal("Program error: report to author\n");
+ count[j++] = -rc;
+
+ /* finish runlengths of current row */
+ while (total_pixels + count[i] < row*W+W) {
+ if (j >= i) fatal("Program error: increase FIRST_COUNT!\n");
+ count[j++] = count[i];
+ total_pixels += count[i++];
+ current_value = OTHER(current_value);
+ }
+
+ /* skip runlengths of equal rows */
+ while (total_pixels + count[i] < (row+rc+1)*W) {
+ total_pixels += count[i++];
+ current_value = OTHER(current_value);
+ }
+ row += rc;
+ }
+ }
+ cnt = j; /* that is what we have now */
+
+ /* 3: compute optimal packing size */
+
+ comp_size = optimal_size(H, W, cnt, count, &dyn_f);
+#ifdef DEBUG
+ current_value = BLACK;
+ for (i=0; i<cnt; i++)
+ if (count[i] < 0) printf("[%d]", -count[i]);
+ else {
+ if (current_value == BLACK) printf("%d", count[i]);
+ else printf("(%d)", count[i]);
+ current_value = OTHER(current_value);
+ }
+ printf("\nOptimal packing with dyn_f = %d total size %d\n",
+ dyn_f, comp_size);
+#endif
+}
+
+#define MAX_TWOBYTE_NYBBLE (208 - 15*dyn_f)
+
+static void pk_number(int x)
+{ int k;
+
+ if (x < 0) { /* repeat count */
+ if (x == -1) pk_nybble(0xF);
+ else { pk_nybble(0xE);
+ pk_number(-x);
+ }
+ }
+ else if (x <= dyn_f) pk_nybble(x);
+ else if (x <= MAX_TWOBYTE_NYBBLE) { /* two nybble values */
+ x-= dyn_f+1;
+ pk_nybble(dyn_f + 1 + x / 16);
+ pk_nybble(x % 16);
+ }
+ else { /* huge counts */
+ x = x - MAX_TWOBYTE_NYBBLE + 15; k = 16;
+ while (k <= x) { k *= 16; pk_nybble(0x0); }
+ while (k > 1) { k = k / 16; pk_nybble(x / k); x = x % k; }
+ }
+}
+
+/* in case runlength encoding is not optimal we send a compressed
+ bitmap in stead of the packed runlengths
+ See GFtoPK processor, pp. 235 */
+static void pk_bitmap(int width, int cnt, int runlength[])
+{ int count, /* number of bits in the current state to send */
+ buff, /* byte buffer */
+ h_bit, /* horizontal bit count for each runlength */
+ p_bit, /* what bit are we about to send out? */
+ r_on, s_on, /* state saving variables */
+ r_count, s_count,/* dito */
+ r_i, s_i, /* dito */
+ rc, /* repeat count */
+ state, /* state variable (what state?) */
+ on, /* starting with black? */
+ i; /* points to next runlength */
+ static int power[9] = {1, 2, 4, 8, 16, 32, 64, 128, 256};
+
+ buff = 0; p_bit = 8; h_bit = width;
+ state = 0; rc = 0;
+ on = 1; count = runlength[0]; i = 1;
+ while (i < cnt || state || count>0) {
+ if (state) {
+ count = r_count; i = r_i; on = r_on; rc--;
+ }
+ else {
+ r_count = count; r_i = i; r_on = on;
+ }
+
+ /* send one row of width bits */
+ do {
+ if (count == 0) {
+ if (runlength[i] < 0) {
+ if (!state) rc = - runlength[i];
+ i++;
+ }
+ count = runlength[i]; i++; on = !on;
+ }
+ if (count >= p_bit && p_bit < h_bit) {
+ /* we end a byte, we don't end a runlength */
+ if (on) buff += power[p_bit] - 1;
+ pk1(buff);
+ buff = 0; h_bit -= p_bit;
+ count -= p_bit; p_bit = 8;
+ }
+ else {
+ if (count < p_bit && count < h_bit) {
+ /* we neither end the row nor the byte */
+ if (on) buff += power[p_bit] - power[p_bit-count];
+ p_bit -= count; h_bit -= count; count = 0;
+ }
+ else { /* we end a row and maybe a byte */
+ if (on) buff += power[p_bit] - power[p_bit-h_bit];
+ count -= h_bit; p_bit -= h_bit; h_bit = width;
+ if (p_bit == 0) {
+ pk1(buff); buff = 0; p_bit = 8;
+ }
+ }
+ }
+ } while (h_bit != width);
+
+ if (state && rc == 0) {
+ count = s_count; i = s_i; on = s_on; state = 0;
+ }
+ else if (!state && rc >0) {
+ s_count = count; s_i = i; s_on = on; state = 1;
+ }
+ }
+ if (p_bit != 8) pk1(buff);
+}
+
+/* For packing a character */
+void pk_char(int char_code, /* character code 0..255 */
+ INT32 tfm_width, /* TFM width of character */
+ int h_escapement, /* horizontal escapement in pixels */
+ unsigned int width, /* width of bounding box */
+ unsigned int height, /* height of bounding box */
+ int h_offset, /* horizontal offset to reference point */
+ int v_offset, /* vertical offset to reference point */
+ int (*next_pixel)()) /* user's next pixel generator */
+{ int i, pl, current_value;
+ short two_byte; /* two_byte quantities? */
+ unsigned short flag_byte;
+
+ pk_runlengths(width, height, next_pixel);
+
+ /* write a character preamble */
+
+ flag_byte = dyn_f * 16;
+ if (count[0] > 0) flag_byte += 8; /* starting in BLACK */
+ if (tfm_width > 0XFFFFFF || width > 65535 || height > 65535
+ || h_offset > 32767 || v_offset > 32767
+ || h_offset < -32768 || v_offset < -32768
+ || comp_size > 196594)
+ { /* write long format */
+ fatal("Can't handle long format yet!\n");
+ }
+ else if (h_escapement > 255 || width > 255 || height > 255
+ || h_offset > 127 || v_offset > 127
+ || h_offset < -128 || v_offset < -128
+ || comp_size > 1015)
+ { /* write two-byte short character preamble */
+ comp_size += 13; flag_byte += comp_size / 65535 + 4;
+ pk1(flag_byte);
+ pk2(comp_size % 65535);
+ pk1(char_code);
+ pk3(tfm_width);
+ pk2(h_escapement); /* pixels ! */
+ pk2(width);
+ pk2(height);
+ pk2(h_offset);
+ pk2(v_offset);
+ }
+ else { /* write one-byte short character preamble */
+ comp_size += 8; flag_byte += comp_size / 256;
+ pk1(flag_byte);
+ pk1(comp_size % 256);
+ pk1(char_code);
+ pk3(tfm_width);
+ pk1(h_escapement); /* pixels ! */
+ pk1(width);
+ pk1(height);
+ pk1(h_offset);
+ pk1(v_offset);
+ }
+
+ /* and now the character itself */
+ if (dyn_f != 14) { /* send compressed format */
+ if (count[0] == 0) i = 1; else i = 0;
+ bitweight = 16;
+ for (i=i; i<cnt; i++) pk_number(count[i]);
+ if (bitweight != 16) pk1(pk_output_byte);
+ }
+ else /* send bitmap */
+ if (height > 0) pk_bitmap(width, cnt, count);
+
+}
+
+/*
+ * Output small string special (<255 chars)
+ */
+static void pkstring(char *fmt, ...) {
+ char buf[256]; int i, len;
+ va_list args;
+
+ va_start(args, fmt);
+#ifdef CHARSPRINTF
+ (void) vsprintf(buf, fmt, args);
+ len = strlen(buf);
+#else
+ len = vsprintf(buf, fmt, args);
+#endif
+ if (len > 255 || len < 0) fatal("PK string exceeds 255 characters\n");
+ va_end(args);
+
+ pk1(PK_SPC1);
+ pk1(len); i = 0;
+ for (i = 0; i < len; i++) pk1(buf[i]);
+}
+
+/*
+ * Compute METAFONT magnification string for <dpi>
+ */
+
+int PSPKINT(float x) {
+ return (int) x;
+}
+
+static char mag_str[64];
+
+char *magnification (int dpi, int BDPI) {
+ double size, magstep;
+
+ if (dpi == BDPI) {
+ sprintf(mag_str, "magstep(0)");
+ return mag_str;
+ }
+ size = BDPI; magstep = 0;
+ while (dpi < size) {
+ size = size / 1.095445115;
+ magstep -= 0.5;
+ if (dpi == PSPKINT(size + 0.5)) {
+ sprintf(mag_str, "magstep(%.1f)", magstep);
+ return mag_str;
+ }
+ if (dpi > size) {
+ sprintf(mag_str, "%d+%d/%d", PSPKINT(dpi/BDPI), dpi%BDPI, BDPI);
+ return mag_str;
+ }
+ }
+ while (dpi > size) {
+ size = size * 1.095445115;
+ magstep += 0.5;
+ if (dpi == PSPKINT(size + 0.5)) {
+ sprintf(mag_str, "magstep(%.1f)", magstep);
+ return mag_str;
+ }
+ if (dpi < size) {
+ sprintf(mag_str, "%d+%d/%d", PSPKINT(dpi/BDPI), dpi%BDPI, BDPI);
+ return mag_str;
+ }
+ }
+}
+
+/*
+ * Barebone postample
+ */
+void pk_postamble()
+{
+ pk1(PK_POST);
+ while (pk_len % 4 != 0) pk1(PK_NOOP);
+}
+
+/*
+ * Write special PK strings in the postamble for identification
+ * purposes as proposed by mackay@cs.washington.edu.
+ */
+void ps2pk_postamble(char *fontname, /* The real FontName from the afm */
+ char *encname, /* The actual name, not the filename */
+ int base_res, /* basic resolution */
+ int h_res, /* Match against base_res for mag */
+ int v_res, /* Match against h_res for aspect_ratio */
+ float pointsize, /* Used for fontfacebyte calculation */
+ char *args) /* Essential ps2pk args */
+{
+ int i;
+
+ pkstring("ps2pk options: %s", args);
+ pkstring("fontid=%s", fontname);
+ if (encname) pkstring("codingscheme=%s", encname);
+ pkstring("fontfacebyte");
+ pk1(PK_NUMSPC);
+ i = (pointsize < 127.0) ?
+ ((254 - (int)((2 * pointsize)+0.5)) * (1 << 16)) : 0;
+ pk4(i);
+ pkstring("pixels_per_inch=%d", base_res);
+ pkstring("mag=%s", magnification(h_res, base_res));
+ if (v_res != h_res)
+ pkstring("aspect ratio=%d / %d",
+ (int)((1.0 * v_res / h_res * base_res) + 0.5), base_res);
+
+ pk1(PK_POST);
+ while (pk_len % 4 != 0) pk1(PK_NOOP);
+}
diff --git a/Build/source/texk/ps2pkm/pkout.h b/Build/source/texk/ps2pkm/pkout.h
new file mode 100644
index 00000000000..cd14c8e38ae
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pkout.h
@@ -0,0 +1,58 @@
+/*
+ * FILE: pkout.h
+ *
+ * PURPOSE: interface to te PK output functions (pkfile.c)
+ *
+ * COMMENT: See the pktest.c example program how to use the PK functions.
+ *
+ * VERSION: Febr. 1992
+ * Dec. 1993
+ *
+ * AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
+ */
+
+#ifdef WORD16
+typedef long INT32;
+#else
+typedef int INT32;
+#endif
+
+/* A function for opening a pk file */
+void pk_open(char *name);
+
+/* A function for closing a pk file */
+void pk_close();
+
+/* A function for writing the preamble */
+void pk_preamble(char *comment, /* comment string: source of font */
+ float pointsize, /* design size in points */
+ INT32 checksum, /* checksum */
+ unsigned int h_res, /* horizontal resolution (dpi) */
+ unsigned int v_res); /* vertical resolution (dpi) */
+
+/* For packing a character */
+void pk_char(int char_code, /* character code 0..255 */
+ INT32 tfm_width, /* TFM width of character */
+ int h_escapement, /* horizontal escapement in pixels */
+ unsigned int width, /* width of bounding box */
+ unsigned int height, /* height of bounding box */
+ int h_offset, /* horizontal offset to reference point */
+ int v_offset, /* vertical offset to reference point */
+ int (*next_pixel)()); /* user's pixel generator */
+
+/* Barebone postample */
+void pk_postamble();
+
+/* PS2PK postamble */
+void ps2pk_postamble(char *fontname, /* The real FontName from the afm */
+ char *encname, /* The actual name, not the filename */
+ int base_res, /* basic resolution */
+ int h_res, /* Match against base_res for mag */
+ int v_res, /* Match against h_res for aspect_ratio */
+ float pointsize, /* Used for fontfacebyte calculation */
+ char *args); /* Essential ps2pk args */
+
+/* Here are some definitions to play with pixels */
+#define BLACK 1
+#define WHITE 0
+#define OTHER(pixel) (pixel==BLACK? WHITE: BLACK)
diff --git a/Build/source/texk/ps2pkm/pktest.c b/Build/source/texk/ps2pkm/pktest.c
new file mode 100644
index 00000000000..3d38db7a274
--- /dev/null
+++ b/Build/source/texk/ps2pkm/pktest.c
@@ -0,0 +1,110 @@
+/*
+ * FILE: pktest.c
+ *
+ * PURPOSE: This program demonstrates how a PK file can be created from
+ * a single character bitmap.
+ *
+ * USAGE: pktest -c<char_code> -W<with> -H<Height> pkname < test.bm
+ * (test.bm contains the character from `The GFtoPK processor')
+ *
+ * VERSION: Febr. 1992
+ *
+ * AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
+ */
+
+int testing = 1;
+#include <stdio.h>
+#include "basics.h" /* fatal() */
+#include "pkout.h"
+
+main(int argc, char *argv[])
+{
+ int done, C = 0, W = 0, H = 0, c;
+ char *myname, *pkname, comment[256];
+ int next_pixel();
+
+ myname = argv[0];
+ while (--argc > 0 && (*++argv)[0] == '-') {
+ done=0;
+ while ((!done) && (c = *++argv[0])) /* allow multiletter options */
+ switch (c) {
+ case 'c':
+ C = *++argv[0];
+ if (C == '\0') {
+ argc--; C = *++argv[0];
+ }
+ break;
+ case 'H':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ H = atoi(*argv); done = 1;
+ break;
+ case 'W':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ W = atoi(*argv); done = 1;
+ break;
+ default:
+ fatal("%s: %c illegal option\n", myname, c);
+ }
+ }
+
+ if (argc == 0 || C == 0 || W*H == 0)
+ fatal("Usage: %s -c<char> -W<width> -H<height> pkfile\n", myname);
+
+ pkname = argv[0];
+ pk_open(pkname);
+
+ sprintf(comment, "Testfont %s designed at 10 points", pkname);
+ pk_preamble(comment, 10.0, 1473505522, 120, 120);
+ printf("character %c Width %d Height %d\n", C, W, H);
+ pk_char(C, 640796, 25, W, H, -2, 28, next_pixel);
+ pk_postamble();
+ pk_close();
+}
+
+/* This function delivers the pixels from the character's bounding box
+ * from left to right and from top to bottom.
+ */
+int next_pixel()
+{ int c;
+ do { c = getchar();
+ if (c==EOF) fatal("reading past end of file!\n");
+ if (c == '*' || c == 'X') return BLACK;
+ if (c == '.') return WHITE;
+ } while (1);
+}
+
+/* The character example from GFtoPK:
+ ********************
+ ********************
+ ********************
+ ********************
+ **................**
+ **................**
+ **................**
+ ....................
+ ....................
+ ..**............**..
+ ..**............**..
+ ..**............**..
+ ..****************..
+ ..****************..
+ ..****************..
+ ..****************..
+ ..**............**..
+ ..**............**..
+ ..**............**..
+ ....................
+ ....................
+ ....................
+ **................**
+ **................**
+ **................**
+ ********************
+ ********************
+ ********************
+ ********************
+*/
diff --git a/Build/source/texk/ps2pkm/protos.h b/Build/source/texk/ps2pkm/protos.h
new file mode 100644
index 00000000000..eb8e62c32f5
--- /dev/null
+++ b/Build/source/texk/ps2pkm/protos.h
@@ -0,0 +1,402 @@
+arith.c
+/* void DLmult(struct *product,unsigned long u,unsigned long v); */
+/* void DLdiv(struct *quotient,unsigned long divisor); */
+/* void DLadd(struct *u,struct *v); */
+/* void DLsub(struct *u,struct *v); */
+extern long FPmult(long u,long v);
+extern long FPdiv(long dividend,long divisor);
+extern long FPstarslash(long a,long b,long c);
+basename.c
+extern int main(int argc,char **argv );
+basics.c
+extern void fatal(char *fmt,...);
+extern void msg(char *fmt,...);
+bstring.c
+extern int memset(void *s,int c,int length);
+curves.c
+extern int BezierTerminationTest(long xa,long ya,long xb,long yb,long xc,long yc,long xd,long yd);
+static struct segment *StepBezierRecurse(struct bezierinfo *I,long xA,long yA,long xB,long yB,long xC,long yC,long xD,long yD);
+extern struct segment *t1_StepBezier(struct region *R,long xA,long yA,long xB,long yB,long xC,long yC,long xD,long yD);
+emxrun.c
+extern int main(int argc,char **argv );
+extern int emx_system(char *cmd);
+encoding.c
+static char *value_after(char *s,char *t);
+extern int decimal(char *s);
+extern char nextsymbol(void);
+extern char *nextpsname(void);
+extern void getenc(char **fontname ,char **encname ,char **ev ,int *width);
+extern void addcc(char *name,int charcode);
+extern int getcc(char *name);
+extern char *string(char *s);
+extern void remove_string(void);
+filenames.c
+static char *charptr(char *name,char c);
+extern int equal(char *s,char *t);
+extern char *extension(char *str);
+extern char *newname(char *name,char *ext);
+extern char *ps2pk_basename(char *str,char *suffix);
+extern int ps_resource(char *name);
+flisearch.c
+extern int main(int argc,char **argv );
+extern int matching(char *font,int size);
+fontfcn.c
+extern int SearchDictName(struct ps_dict *dictP,struct ps_obj *keyP);
+extern int initFont(void);
+extern void resetFont(char *env);
+extern int readFont(char *env);
+extern unsigned char *fontfcnB(unsigned char *S,unsigned char *code,int *lenP,int *mode);
+extern int fontfcnA(char *env,int *mode);
+extern void QueryFontLib(char *env,char *infoName,unsigned char *infoValue,int *rcodeP);
+hints.c
+extern void t1_InitHints(void);
+extern void t1_CloseHints(struct fractpoint *hintP);
+static void ComputeHint(struct hintsegment *hP,long currX,long currY,struct fractpoint *hintP);
+extern void t1_ProcessHint(struct hintsegment *hP,long currX,long currY,struct fractpoint *hintP);
+static short SearchXofY(struct edgelist *edge,short y);
+static int ImpliedHorizontalLine(struct edgelist *e1,struct edgelist *e2,int y);
+static void FixSubPaths(struct region *R);
+static void DumpSubPaths(struct edgelist *anchor);
+static struct edgelist *before(struct edgelist *e);
+static void writeXofY(struct edgelist *e,int y,int x);
+static void CollapseWhiteRun(struct edgelist *anchor,short yblack,struct edgelist *left,struct edgelist *right,short ywhite);
+extern void t1_ApplyContinuity(struct region *R);
+lines.c
+extern void t1_StepLine(struct region *R,long x1,long y1,long x2,long y2);
+extern void t1_Bresenham(short *edgeP,long x1,long y1,long x2,long y2);
+lspsres.c
+mag.c
+extern int main(int argc,char **argv );
+extern int fontsize(double x);
+extern double stepsize(double x);
+objects.c
+extern struct xobject *t1_Allocate(int size,struct xobject *template,int extra);
+extern void t1_Free(struct xobject *obj);
+extern struct xobject *t1_Permanent(struct xobject *obj);
+extern struct xobject *xiTemporary(struct xobject *obj);
+extern struct xobject *t1_Dup(struct xobject *obj);
+extern struct xobject *t1_Copy(struct xobject *obj);
+extern struct xobject *t1_Destroy(struct xobject *obj);
+extern struct xobject *t1_Unique(struct xobject *obj);
+extern void t1_Pragmatics(char *username,int value);
+extern void t1_Consume(int n,...);
+extern struct xobject *t1_TypeErr(char *name,struct xobject *obj,int expect,struct xobject *ret);
+static char *TypeFmt(int type);
+static int ObjectPostMortem(struct xobject *obj);
+extern struct xobject *t1_ArgErr(char *str,struct xobject *obj,struct xobject *ret);
+extern void t1_abort(char *str);
+extern char *t1_ErrorMsg(void);
+extern void t1_InitImager(void);
+extern void t1_TermImager(void);
+extern void reportusage(void);
+paths.c
+extern struct segment *t1_CopyPath(struct segment *p0);
+extern void t1_KillPath(struct segment *p);
+extern struct segment *t1_Loc(struct XYspace *S,double x,double y);
+extern struct segment *t1_ILoc(struct XYspace *S,int x,int y);
+extern struct segment *t1_SubLoc(struct segment *p1,struct segment *p2);
+extern struct segment *t1_PathSegment(int type,long x,long y);
+extern struct segment *t1_Line(struct segment *P);
+extern struct beziersegment *t1_Bezier(struct segment *B,struct segment *C,struct segment *D);
+extern struct hintsegment *t1_Hint(struct XYspace *S,double ref,double width,char orientation,char hinttype,char adjusttype,char direction,int label);
+extern struct segment *t1_Join(struct segment *p1,struct segment *p2);
+extern struct segment *t1_JoinSegment(struct segment *before,int type,long x,long y,struct segment *after);
+extern struct segment *t1_ClosePath(struct segment *p0,int lastonly);
+extern struct segment *t1_Reverse(struct segment *p);
+static struct segment *ReverseSubPath(struct segment *p);
+static struct segment *DropSubPath(struct segment *p0);
+static struct segment *SplitPath(struct segment *anchor,struct segment *before);
+extern struct segment *t1_ReverseSubPaths(struct segment *p);
+static int UnClose(struct segment *p0);
+extern struct segment *t1_PathXform(struct segment *p0,struct XYspace *S);
+extern void t1_PathDelta(struct segment *p,struct fractpoint *pt);
+extern struct segment *t1_BoundingBox(short h,short w);
+extern void t1_QueryLoc(struct segment *P,struct XYspace *S,double *xP,double *yP);
+extern void t1_QueryPath(struct segment *path,int *typeP,struct segment **Bp ,struct segment **Cp ,struct segment **Dp ,double *fP);
+extern void t1_QueryBounds(struct segment *p0,struct XYspace *S,double *xminP,double *yminP,double *xmaxP,double *ymaxP);
+extern struct segment *t1_BoxPath(struct XYspace *S,int h,int w);
+extern struct segment *t1_DropSegment(struct segment *path);
+extern struct segment *t1_HeadSegment(struct segment *path);
+extern void t1_DumpPath(struct segment *p);
+pfb2pfa.c
+extern int main(int argc,char **argv );
+pk2bm.c
+extern int main(int argc,char **argv );
+extern unsigned char lsbf(unsigned char u);
+extern void dots(unsigned char u,int n);
+extern int atoo(char *oct);
+pkin.c
+static short pkbyte(void);
+static long pkquad(void);
+static long pktrio(void);
+static long pklong(void);
+static short pkopen(char *name);
+static short getnyb(void);
+static short getbit(void);
+static unsigned short pkpackednum(void);
+static unsigned short rest(void);
+static unsigned short handlehuge(unsigned short i,unsigned short k);
+/* void unpack(struct *cd); */
+/* int readchar(char *name,short c,struct *cd); */
+static void error(char *s);
+pkout.c
+extern void pk_open(char *pkname);
+extern void pk_close(void);
+static void pk_nybble(int x);
+static void pk1(int x);
+static void pk2(int x);
+static void pk3(int x);
+static void pk4(int x);
+extern void pk_preamble(char *comment,float pointsize,int checksum,unsigned int h_res,unsigned int v_res);
+extern int optimal_size(int W,int H,int cnt,int *count,int *dyn_f);
+static void pk_runlengths(int W,int H,int (*next_pixel)(void));
+static void pk_number(int x);
+static void pk_bitmap(int width,int cnt,int *runlength);
+extern void pk_char(int char_code,int tfm_width,int h_escapement,unsigned int width,unsigned int height,int h_offset,int v_offset,int (*next_pixel)(void));
+static void pkstring(char *fmt,...);
+extern int INT(float x);
+extern char *magnification(int dpi,int BDPI);
+extern void pk_postamble(void);
+extern void ps2pk_postamble(char *fontname,char *encname,int base_res,int h_res,int v_res,float pointsize,char *args);
+pktest.c
+extern int main(int argc,char **argv );
+extern int next_pixel(void);
+ps2pk.c
+psargs.c
+psearch.c
+regions.c
+extern void t1_KillRegion(struct region *area);
+extern struct region *t1_CopyRegion(struct region *area);
+static struct edgelist *NewEdge(short xmin,short xmax,short ymin,short ymax,short *xvalues,int isdown);
+extern struct region *t1_Interior(struct segment *p,int fillrule);
+static int Unwind(struct edgelist *area);
+extern void t1_ChangeDirection(int type,struct region *R,long x,long y,long dy);
+static void newfilledge(struct region *R,long xmin,long xmax,long ymin,long ymax,int isdown);
+extern struct edgelist *t1_SortSwath(struct edgelist *anchor,struct edgelist *edge,struct edgelist *(*swathfcn)(void));
+static struct edgelist *splitedge(struct edgelist *list,short y);
+static void vertjoin(struct edgelist *top,struct edgelist *bottom);
+extern struct edgelist *swathxsort(struct edgelist *before0,struct edgelist *edge);
+extern struct edgelist *t1_SwathUnion(struct edgelist *before0,struct edgelist *edge);
+extern struct edgelist *swathrightmost(struct edgelist *before,struct edgelist *edge);
+static int touches(int h,short *left,short *right);
+static int crosses(int h,short *left,short *right);
+static void cedgemin(int, pel *, pel);
+static void cedgemax(int, pel *, pel);
+static void edgemin(int, pel *, pel *);
+static void edgemax(int, pel *, pel *);
+static void discard(struct edgelist *left,struct edgelist *right);
+extern void t1_MoveEdges(struct region *R,long dx,long dy);
+extern void t1_UnJumble(struct region *region);
+static int OptimizeRegion(struct region *R);
+extern void t1_MoreWorkArea(struct region *R,long x1,long y1,long x2,long y2);
+extern struct region *t1_BoxClip(struct region *R,short xmin,short ymin,short xmax,short ymax);
+extern struct segment *t1_RegionBounds(struct region *R);
+extern void t1_DumpArea(struct region *area);
+extern void t1_DumpEdges(struct edgelist *edges);
+static int edgecheck(struct edgelist *edge,int oldmin,int oldmax);
+scanfont.c
+/* struct ps_obj *MakeEncodingArrayP(struct *encodingTable); */
+extern int Init_BuiltInEncoding(void);
+static int getNextValue(int valueType);
+static int getInt(void);
+static int getEncoding(struct ps_obj *arrayP);
+static int getArray(struct ps_obj *arrayP);
+static int getName(char *nameP);
+static int getNbytes(int N);
+static int getLiteralName(struct ps_obj *nameObjP);
+static int BuildSubrs(struct ps_font *FontP);
+static int BuildCharStrings(struct ps_font *FontP);
+static int BuildFontInfo(struct ps_font *fontP);
+static int BuildPrivate(struct ps_font *fontP);
+static int GetType1Blues(struct ps_font *fontP);
+extern struct ps_obj *GetType1CharString(struct ps_font *fontP,unsigned char code);
+static int FindDictValue(struct ps_dict *dictP);
+extern int scan_font(struct ps_font *FontP);
+sexpr.c
+extern int main(int argc,char **argv );
+spaces.c
+extern struct XYspace *t1_CopySpace(struct XYspace *S);
+static void ConsiderContext(struct xobject *obj,double (*M)[2]);
+extern void FXYConvert(struct fractpoint *pt,struct XYspace *S,double x,double y);
+extern void IXYConvert(struct fractpoint *pt,struct XYspace *S,long x,long y);
+extern void ForceFloat(struct fractpoint *pt,struct XYspace *S,long x,long y);
+extern long FXYboth(double cx,double cy,double x,double y);
+extern long FXonly(double cx,double cy,double x,double y);
+extern long FYonly(double cx,double cy,double x,double y);
+extern long IXYboth(long cx,long cy,long x,long y);
+extern long IXonly(long cx,long cy,long x,long y);
+extern long IYonly(long cx,long cy,long x,long y);
+extern long FPXYboth(long cx,long cy,long x,long y);
+extern long FPXonly(long cx,long cy,long x,long y);
+extern long FPYonly(long cx,long cy,long x,long y);
+static void FillOutFcns(struct XYspace *S);
+static void FindFfcn(double cx,double cy,long (**fcnP )(void));
+static void FindIfcn(double cx,double cy,long *icxP,long *icyP,long (**fcnP )(void));
+extern void t1_UnConvert(struct XYspace *S,struct fractpoint *pt,double *xp,double *yp);
+extern struct xobject *t1_Xform(struct xobject *obj,double (*M)[2]);
+extern struct xobject *t1_Transform(struct xobject *obj,double cxx,double cyx,double cxy,double cyy);
+extern struct xobject *t1_Scale(struct xobject *obj,double sx,double sy);
+extern void t1_PseudoSpace(struct XYspace *S,double (*M)[2]);
+extern void t1_MMultiply(double (*A)[2],double (*B)[2],double (*C)[2]);
+extern void t1_MInvert(double (*M)[2],double (*Mprime)[2]);
+extern void t1_InitSpaces(void);
+extern void t1_QuerySpace(struct XYspace *S,double *cxxP,double *cyxP,double *cxyP,double *cyyP);
+extern void t1_FormatFP(char *str,long fpel);
+extern void t1_DumpSpace(struct XYspace *S);
+strexpr.c
+extern struct val *make_int(int i);
+extern struct val *make_str(char *s);
+extern void free_value(struct val *vp);
+extern int is_integer(struct val *vp,int *r);
+extern int to_integer(struct val *vp);
+extern void to_string(struct val *vp);
+extern void nexttoken(void);
+extern struct val *eval6(void);
+extern struct val *eval4(void);
+extern struct val *eval3(void);
+extern int strexpr(int *result,char *expression);
+t1funcs.c
+extern int Type1OpenScalable(char **ev ,struct _Font **ppFont ,int flags,struct _FontEntry *entry,char *fileName,struct _FontScalable *vals,unsigned long format,unsigned long fmask,double efactor,double slant);
+static int Type1GetGlyphs(struct _Font *pFont,unsigned long count,unsigned char *chars,int charEncoding,unsigned long *glyphCount,struct _CharInfo **glyphs );
+/* int Type1GetMetrics(struct _Font *pFont,unsigned long count,unsigned char *chars,int charEncoding,unsigned long *glyphCount,struct **glyphs ); */
+extern void Type1CloseFont(struct _Font *pFont);
+static void fill(char *dest,int h,int w,struct region *area,int byte,int bit,int wordsize);
+static void fillrun(char *p,short x0,short x1,int bit);
+extern int Type1RegisterFontFileFunctions(void);
+t1info.c
+static void FillHeader(struct _FontInfo *pInfo,struct _FontScalable *Vals);
+/* void adjust_min_max(struct *minc,struct *maxc,struct *tmp); */
+static void ComputeBounds(struct _FontInfo *pInfo,struct _CharInfo *pChars,struct _FontScalable *Vals);
+static void ComputeProps(struct _FontInfo *pInfo,struct _FontScalable *Vals,char *Filename);
+static void ComputeStdProps(struct _FontInfo *pInfo,struct _FontScalable *Vals,char *Filename,char *Fontname);
+extern int Type1GetInfoScalable(struct _FontPathElement *fpe,struct _FontInfo *pInfo,struct _FontEntry *entry,struct _FontName *fontName,char *fileName,struct _FontScalable *Vals);
+extern void T1FillFontInfo(struct _Font *pFont,struct _FontScalable *Vals,char *Filename,char *Fontname);
+extern void T1InitStdProps(void);
+t1io.c
+extern struct F_FILE *T1Open(char *fn,char *mode);
+extern int T1Getc(struct F_FILE *f);
+extern int T1Ungetc(int c,struct F_FILE *f);
+extern int T1Read(char *buffP,int size,int n,struct F_FILE *f);
+extern int T1Close(struct F_FILE *f);
+extern struct F_FILE *T1eexec(struct F_FILE *f);
+static int T1Decrypt(unsigned char *p,int len);
+static int T1Fill(struct F_FILE *f);
+t1snap.c
+extern unsigned __int64 __stdcall Int64ShllMod32(unsigned __int64 Value,unsigned long ShiftCount);
+extern __int64 __stdcall Int64ShraMod32(__int64 Value,unsigned long ShiftCount);
+extern unsigned __int64 __stdcall Int64ShrlMod32(unsigned __int64 Value,unsigned long ShiftCount);
+extern void *GetFiberData(void );
+extern void *GetCurrentFiber(void );
+extern struct segment *t1_Phantom(struct xobject *obj);
+extern struct xobject *t1_Snap(struct segment *p);
+t1stub.c
+extern int xiStub(void);
+extern void t1_DumpText(struct segment *foo);
+t1test.c
+extern int main(int argc,char **argv );
+extern void Display(struct _CharInfo *glyph);
+extern int T1FillVals(struct _FontScalable *vals);
+extern int CheckFSFormat(int format,int fmask,int *bit,int *byte,int *scan,int *glyph,int *image);
+extern char *MakeAtom(char *p);
+extern int GetClientResolutions(int *resP);
+extern char *Xalloc(int size);
+extern void Xfree(void);
+extern int FontDefaultFormat(void);
+extern int FontFileRegisterRenderer(void);
+extern int GenericGetBitmaps(void);
+extern int GenericGetExtents(void);
+extern int FontParseXLFDName(void);
+extern int FontComputeInfoAccelerators(void);
+texfiles.c
+extern unsigned long num(struct _iobuf *fp,int size);
+extern int snum(struct _iobuf *fp,int size);
+token.c
+static double P10(long exponent);
+static int next_char(int ch);
+static int add_char(int ch);
+static int skip_space(int ch);
+static int skip_comment(int ch);
+static int add_sign(int ch);
+static int add_1st_digits(int ch);
+static int add_digits(int ch);
+static int add_1st_decpt(int ch);
+static int add_decpt(int ch);
+static int add_fraction(int ch);
+static int add_e_sign(int ch);
+static int add_exponent(int ch);
+static int add_radix(int ch);
+static int add_r_digits(int ch);
+static int RADIX_NUMBER(int ch);
+static int INTEGER(int ch);
+static int REAL(int ch);
+static int HEX_STRING(int ch);
+static void save_digraph(int ch);
+static int STRING(int ch);
+static int AAH_NAME(int ch);
+static int NAME(int ch);
+static int LITERAL_NAME(int ch);
+static int IMMED_NAME(int ch);
+static int OOPS_NAME(int ch);
+static int RIGHT_ANGLE(int ch);
+static int RIGHT_PAREN(int ch);
+static int LEFT_BRACE(int ch);
+static int RIGHT_BRACE(int ch);
+static int LEFT_BRACKET(int ch);
+static int RIGHT_BRACKET(int ch);
+static int BREAK_SIGNAL(int ch);
+static int NO_TOKEN(int ch);
+extern void scan_token(struct ps_obj *inputP);
+type1.c
+static int ComputeAlignmentZones(void);
+static int InitStems(void);
+static int FinitStems(void);
+static void ComputeStem(int stemno);
+static struct segment *Applyhint(struct segment *p,int stemnumber,int half);
+static struct segment *Applyrevhint(struct segment *p,int stemnumber,int half);
+static struct segment *FindStems(double x,double y,double dx,double dy);
+static void ClearStack(void);
+static void Push(double Num);
+static void ClearCallStack(void);
+static void PushCall(struct ps_obj *CurrStrP,int CurrIndex,unsigned short CurrKey);
+static void PopCall(struct ps_obj **CurrStrPP ,int *CurrIndexP,unsigned short *CurrKeyP);
+static void ClearPSFakeStack(void);
+static void PSFakePush(double Num);
+static double PSFakePop(void);
+static struct segment *CenterStem(double edge1,double edge2);
+static unsigned char Decrypt(unsigned char cipher);
+static int DoRead(int *CodeP);
+static void StartDecrypt(void);
+static void Decode(int Code);
+static void DoCommand(int Code);
+static void Type1Escape(int Code);
+static void HStem(double y,double dy);
+static void VStem(double x,double dx);
+static void RLineTo(double dx,double dy);
+static void RRCurveTo(double dx1,double dy1,double dx2,double dy2,double dx3,double dy3);
+static void DoClosePath(void);
+static void CallSubr(int subrno);
+static void Return(void);
+static void EndChar(void);
+static void RMoveTo(double dx,double dy);
+static void DotSection(void);
+static void Seac(double asb,double adx,double ady,unsigned char bchar,unsigned char achar);
+static void Sbw(double sbx,double sby,double wx,double wy);
+static double Div(double num1,double num2);
+static void FlxProc(double c1x2,double c1y2,double c3x0,double c3y0,double c3x1,double c3y1,double c3x2,double c3y2,double c4x0,double c4y0,double c4x1,double c4y1,double c4x2,double c4y2,double epY,double epX,int idmin);
+static void FlxProc1(void);
+static void FlxProc2(void);
+static void HintReplace(void);
+static void CallOtherSubr(int othersubrno);
+static void SetCurrentPoint(double x,double y);
+extern struct xobject *Type1Char(char *env,struct XYspace *S,struct ps_obj *charstrP,struct ps_obj *subrsP,struct ps_obj *osubrsP,struct blues_struct *bluesP,int *modeP);
+util.c
+extern int vm_init(void);
+extern char *vm_alloc(unsigned int bytes);
+extern void objFormatInteger(struct ps_obj *objP,int value);
+extern void objFormatReal(struct ps_obj *objP,double value);
+extern void objFormatBoolean(struct ps_obj *objP,int value);
+extern void objFormatEncoding(struct ps_obj *objP,int length,struct ps_obj *valueP);
+extern void objFormatArray(struct ps_obj *objP,int length,struct ps_obj *valueP);
+extern void objFormatString(struct ps_obj *objP,int length,char *valueP);
+extern void objFormatName(struct ps_obj *objP,int length,char *valueP);
+extern void objFormatFile(struct ps_obj *objP,struct _iobuf *valueP);
diff --git a/Build/source/texk/ps2pkm/ps2pk.1 b/Build/source/texk/ps2pkm/ps2pk.1
new file mode 100644
index 00000000000..dbeed0cdbfc
--- /dev/null
+++ b/Build/source/texk/ps2pkm/ps2pk.1
@@ -0,0 +1,156 @@
+.TH PS2PK 1 TeX
+.SH NAME
+ps2pk \- creates a TeX pkfont from a type1 PostScript font
+.SH SYNOPSIS
+ps2pk
+[ -v ]
+[ -e\fIenc\fP ]
+[ -X\fIxres\fP ]
+[ -E\fIexpansion\fP ]
+[ -S\fIslant\fP ]
+[ -P\fIpointsize\fP ]
+[ -R\fIbaseres\fP ]
+[ -r\fIaspectratio\fP ]
+[ -Y\fIyres\fP ]
+[ -a\fIAFMfile\fP ]
+[ -m\fImodename\fP ]
+type1 [pkfont]
+.SH DESCRIPTION
+This program renders a given type1 PostScript font at a given pointsize
+(default 10.0 points) and resolution (default 300dpi) into a TeX pkfont.
+.PP
+To generate the pkfont ps2pk needs a valid type1 font file (for
+example Utopia-Regular, Utopia-Regula.pfb or Utopia-Regula.pfa) and
+its corresponding AFM-file (Utopia-Regular.afm) with the font metrics.
+The program accepts both the binary type1 format (Utopia-Regula.pfb)
+and its ASCII equivalent (Utopia-Regular or Utopia-Regula.pfa). To
+locate the files, ps2pk uses the kpathsea library (see the info page
+on kpathsea). Additionally, pfb and pfa files are searched for in the
+directory specified in the environment variable T1INPUTS, and afm
+files are searched in AFMFONTS, if they are set (the -v flag will
+report which filenames are looked for).
+.PP
+The program will make a pkfont in which the character codes are derived
+from their AFM (Adobe Font Metrics) defined values. This can be
+overruled by specifying an explicit encoding file via the -e option.
+The encoding file \fIenc\fP
+should contain a valid PostScript encoding containing PostScript names
+like /hyphen. Here is an incomplete example (see afm2tfm for complete
+syntax):
+
+.RS
+.nf
+% This is the EC encoding.
+/ECEncoding [ % now 256 chars follow
+% 0x00
+ /grave /acute /circumflex /tilde /dieresis /hungarumlaut
+ /ring /caron /breve /macron /dotaccent /cedilla
+ /ogonek /quotesinglbase /guilsinglleft /guilsinglright
+
+ (Rest of lines omitted.)
+
+% 0xF0
+ /eth /ntilde /ograve /oacute /ocircumflex /otilde
+ /odieresis /oe /oslash /ugrave /uacute /ucircumflex
+ /udieresis /yacute /thorn /germandbls ] def
+.fi
+.RE
+.PP
+Options and arguments:
+.IP -a\fIAFMfile\fP 12
+Overrules the name that is used to locate the AFM file.
+
+.IP -e\fIenc\fP 12
+Name of a file containing an encoding scheme
+(default \- the encoding named in the AFM-file is used).
+The actual PostScript name of the encoding scheme is written
+as a "special" at the end of the pkfont.
+
+.IP -E\fIextension\fP 12
+The extension factor (real value, default 1.0).
+
+.IP -m\fImodename\fP 12
+A modename such as would be used by METAFONT (default "Unknown mode").
+
+.IP -P\fIpointsize\fP 12
+The desired pointsize (real value, default 10.0 points).
+
+.IP -R\fIbaseres\fP 12
+The desired base resolution (integer value, default 300 dpi).
+If this differs from the value of \fIxres\fP, the appropriate
+magnification will be shown in the "specials" at the end
+of the pkfont. If possible, this will be expressed as a
+magstep, otherwise as a real number. For example, a pkfont with an \fIxres\fP
+of 329, using the default base resolution of 300,
+will include the "special" text "mag=magstep(0.5)" at the
+end of the font.
+
+.IP -r\fIaspectratio\fP 12
+The desired aspect ratio (expression, integerY/integerX, default 300/300).
+This will be shown in the "specials" at the end
+of the pkfont. Setting the aspect ratio creates a value for
+\fIyres\fP but an explicit \fIyres\fP value will take precedence.
+Argument must be in "" if spaces are left around `/'.
+
+.IP -S\fIslant\fP 12
+The slant (real value, default 0.0).
+
+.IP -X\fIxres\fP 12
+The resolution in the X direction (integer value, default 300 dpi).
+
+.IP -Y\fIyres\fP 12
+The resolution in the Y direction (integer value, default the value
+of \fIxres\fP). If \fIyres\fP differs from \fIxres\fP, a "special"
+text giving the aspect ratio will be written at the end of the
+pkfont.
+
+.IP -v 12
+Verbose flag. (Tells what the program is doing.)
+
+.IP type1 12
+The name of the PostScript type1 font. The name of the AFM-file will be
+constructed from this name by removing the extension (if suplied) and
+adding ".afm". The PostScript "FontName" is extracted from the
+AFM-file and written into a "special" at the end of the pkfont.
+
+.IP [pkfont] 12
+The name of the resulting pkfont can be overruled with this name. The
+default name of pkfont is derived from the basename of the type1
+font, the pointsize and \fIxres\fP. For example
+`ps2pk -P17.28 Utopia-Regular' will result in `Utopia-Regular17.300pk'.
+An explicit value for the name of the pkfont is necessary when
+the type1 font name already shows the point size, otherwise
+the \fIpointsize\fP value is catenated on to the pkfont basename
+which is usually not what is wanted.
+
+.PP
+The following PK "specials" provide an internal check on the
+characteristics of the pkfont, in accordance with the recommendations
+of the TeX Working Group on the TeX Directory Standard (TWG-TDS):
+.br
+"fontid=\fIFontName\fP", "codingscheme=\fIEncoding\fP", "fontfacebyte", "mag",
+"mode=(ps2pk)\fImodename\fP", "pixels-per-inch", and "aspect-ratio" if it
+is other than unity.
+
+.SH ACKNOWLEDGEMENT
+This program uses the type1 hinting and rendering software IBM
+has donated to the X-consortium.
+
+.SH SEE ALSO
+.nf
+`METAFONT: The Program', Donald Knuth.
+`The GFtoPK processor', belonging to the METAFONTware.
+`Adobe Font Metric Files', Version 3.0, PostScript Developer
+Support Group.
+afm2tfm(1)
+pk2bm(1)
+kpsewhich(1)
+info kpathsea
+
+.SH VERSION
+1.4 (January 1994)
+
+.SH AUTHOR
+Piet Tutelaers <rcpt@urc.tue.nl>.
+Modified for ps2pkm by Pierre A. Mackay <mackay@cs.washington.edu>,
+This manpage was adapted to teTeX by Frank Kuester <frank@kuesterei.ch>.
diff --git a/Build/source/texk/ps2pkm/ps2pk.c b/Build/source/texk/ps2pkm/ps2pk.c
new file mode 100644
index 00000000000..806c6ad31b5
--- /dev/null
+++ b/Build/source/texk/ps2pkm/ps2pk.c
@@ -0,0 +1,710 @@
+/*
+ * NAME
+ * ps2pk - creates a PK font from a type1 PostScript font
+ * SYNOPSIS:
+ * pk2pk [options] type1 [pkname]
+ * DESCRIPTION
+ * This program renders a given type1 PostScript font at a given
+ * pointsize (default 10.0 points) and resolution (default 300dpi)
+ * into a TeX PK font.
+ *
+ * To generate the PK font pk2ps needs a valid type1 fontname (for
+ * example Utopia-Regular.pfa) and its corresponding AFMfile
+ * (Utopia-Regular.afm). The program accepts both the MSDOS binary
+ * type1 format (Utopia-Regula.pfb) and its UNIX ASCII equivalent
+ * (Utopia-Regula.pfa). The resulting PK font does contain all
+ * characters for which the C-code is non negative. This can be
+ * overruled by specifying an explicit <encoding> via the -e<encoding>
+ * option. Character codes in AMF files are specified as integer values
+ * after the C, for example Utopia-Regular.afm provides:
+ * C 251 ; WX 601 ; N germandbls ; B 22 -12 573 742 ;
+ * C -1 ; WX 380 ; N onesuperior ; B 81 272 307 680 ;
+ *
+ * The `germandbls' has code 251 and `onesuperior' -1 which means
+ * that this character is not part of the default AdobeStandard-
+ * Encoding scheme. To get this `onesuperior' you have to add it to
+ * an encoding vector as described in the PostScript manuals. But of
+ * course it is better to use standard encodings, like the one provided
+ * with the new psfonts. This `TeXBase1Encoding' encoding does contain
+ * all names of characters as defined in the 256 character TeX fonts.
+ *
+ * The location of files for ps2pk, since version 1.5, has been
+ * improved using PostScript resource databases. These databases
+ * can be created using Adobe's mkpsres(1) utility. On UNIX the
+ * default name is PSres.upr and can be found in directories like
+ * /usr/lib/DPS depending on the machine you are using. The
+ * following example of an UPR file contains three resources
+ * PS-Resources-1.0
+ * Encoding
+ * FontAFM
+ * FontOutline
+ * .
+ * //usr/local/tex/fonts/type1faces
+ * Encoding
+ * ECEncoding=EC.enc
+ * .
+ * FontAFM
+ * Courier=ResidentFonts/Courier.pfa
+ * .
+ * FontOutline
+ * Courier=ResidentFonts/Courier.afm
+ * .
+ *
+ * When this UPR is in the PSRESOURCEPATH ps2pk can make an EC encoded
+ * PK font for Courier with:
+ *
+ * ps2pk -eECEncoding Courier
+ *
+ * It is also possible without the UPR file but then you have to
+ * set T1INPUTS to the directories containing the files you need,
+ * for example:
+ *
+ * setenv T1INPUTS /usr/local/tex/fonts/type1faces//
+ *
+ * and to run ps2pk by providing the proper filenames:
+ *
+ * ps2pk -eEC.enc Courier.pfa
+ *
+ * In both cases the result will be the PK font Courier10.300pk.
+ *
+ * PostScript resource databases eliminate the need for recursive
+ * directory search, this is done by mkpsres(1) instead. And all
+ * resources can be stored in one directory per computer keeping
+ * maintenance easy. Another advantage is the mapping of internal
+ * PostScript names, which are case sensitive and not restricted to
+ * MSDOS limitations, to external platform dependant filenames in
+ * a very natural way. On a MSDOS computer psres.dpr (the equivalent
+ * of PSres.upr) could be:
+ * PS-Resources-1.0
+ * Encoding
+ * FontAFM
+ * FontOutline
+ * .
+ * Encoding
+ * TeXBase1Encoding=c:\emtex\dvips\8r.enc
+ * .
+ * FontAFM
+ * Courier=c:\psfonts\com_____.pfb
+ * .
+ * FontOutline
+ * Courier=c:\psfonts\afm\com_____.afm
+ * .
+ *
+ * Given this psres.dpr resource database
+ *
+ * ps2pk -eTeXBase1Encoding Courier
+ *
+ * will create Courier10.300pk. Unfortunately MSDOS will abbreviate
+ * this name to COURIER1.300. Mkpsres(1) is an improved version
+ * of Adobe's makepsres(1) that runs on UNIX and MSDOS. This program
+ * will treat PFB fonts and PFM fonts correctly and recognize
+ * filenames ending with ".enc" as encoding vectors.
+ *
+ * If the name of <type1font> does not contain an explicit extension
+ * or directory separator it is considered as the name of a resource.
+ * Otherwise as a filename. You can not mix up resource names and file-
+ * names. Filenames must have an extension!
+ *
+ * OPTIONS AND ARGUMENTS
+ * -a<AFM> The name of the AFM resource or file can be
+ * overruled with this option.
+ * -e<encoding> The encoding scheme (default the encoding from the
+ * AFM file is used).
+ * -E<extension> The extension factor (real value, default 1.0).
+ * -O Create old checksums (for compatibility)
+ * -P<pointsize> The desired pointsize (real value, default 10.0
+ * points). PK fonts created with a value different
+ * to 10.0 will cause dvips warnings `dvips: Design
+ * size mismatch in font ...'.
+ * -R<baseres> The base resolution (integer value, default 300
+ * dpi). Only used for creating METAFONT compatible
+ * identification strings in PK postamble.
+ * -S<slant> The slant (real value, default 0.0).
+ * -X<xres> The resolution (integer value) in the X direction
+ * (default 300 dpi).
+ * -Y<yres> The resolution (integer value) in the Y direction
+ * (defaults to the value of <xres>).
+ * -d Debug stat() calls during recursive path searching
+ * -v Verbose flag. (Tells what the program is doing.)
+ *
+ * type1font The name of the PostScript type 1 font. When no
+ * explicit AFMfile is given via the -a option the
+ * name of the AFMfile will be constructed from this
+ * name by removing the extension (if supplied) and
+ * adding ".afm".
+ * [pkname] The name of the resulting PK font can be overruled
+ * with this name. The default name of the PK font is
+ * derived from the basename of the type1 font, the
+ * pointsize and <xres>. For example:
+ * ps2pk -P17.28 Utopia-Regular
+ * will result in:
+ * Utopia-Regular17.300pk
+ *
+ * ENVIRONMENTS
+ *
+ * PSRESOURCEPATH
+ * The path used for locating PS resource database files (PSres.upr
+ * on UNIX and psres.dpr on MSDOS). The default of the path will be
+ * shown by running ps2pk with the -v flag and a non-existant resource
+ * name.
+ *
+ * T1INPUTS
+ * The path used for locating PS type1 fonts, their AFM files and
+ * encoding vectors. Path may contain '//' (UNIX) or '!!' (MSDOS) to
+ * force ps2pk to look into subdirectories. Using PSRESOURCEPATH
+ * instead of T1INPUTS avoids recursion. The default of the path will
+ * be shown by running ps2pk with the -v flag and a non-existant
+ * filename.
+ *
+ * ACKNOWLEDGEMENTS
+ * This program uses the type1 hinting and rendering software IBM
+ * has donated to the X-consortium.
+ *
+ * Since version 1.5 the lookup of PS resources as described in
+ * `Programming the Display PostScript System with X (Appendix A:
+ * Locating PostScript Resources)' from Adobe Systems is used.
+ * SEE ALSO
+ * ``METAFONT: The Program'', Donald Knuth.
+ * ``The GFtoPK processor'', belonging to the METAFONTware.
+ * afm2tfm(1)
+ * mkpsres(1)
+ * mtpk(1)
+ * pk2bm(1)
+ * pkfonts(1)
+ * VERSIONS
+ * 1.1 (May 1992)
+ * 1.3 (August 1992)
+ * 1.4 (December 1994)
+ * 1.5 (Januari 1996)
+ * AUTHOR
+ * Piet Tutelaers
+ * rcpt@urc.tue.nl
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+/* PostScript Resource lookup functions */
+/*
+#include "PSres.h"
+*/
+#include "basics.h" /* basic definitions and fatal() */
+#include "filenames.h" /* newname(), extension(), ps_resource() */
+#include "psearch.h" /* path search functions */
+#include "pkout.h" /* PK output functions */
+
+/* begin interface to type 1 software */
+#include "ffilest.h"
+
+FontScalableRec vals;
+FontEntryRec entry;
+#define Succesful 85
+
+extern int Type1OpenScalable ();
+extern int Type1RegisterFontFileFunctions();
+extern void Type1CloseFont();
+
+/* end interface to type 1 software */
+
+char *encfile = NULL, *afmfile;
+
+char ps2pk_args[MAXSTRLEN] = "none"; /* essential ps2pk arguments */
+typedef char *encoding[256];
+void getenc(char **, char **, encoding, int [256]);
+
+#define POINTSPERINCH 72.27
+#define DEFAULTRES 300
+#define DEFAULTPOINTSIZE 10.0
+
+double pointsize = 0.0; /* wanted pointsize */
+int W, H, /* width and height of character glyph */
+ base_resolution = DEFAULTRES,
+ x_resolution = 0,
+ y_resolution = 0;
+
+int verbose = 0, debug = 0;
+
+/* Provide old (-O flag) and new (default) checksum function */
+typedef unsigned int UINT32;
+UINT32 checksum(encoding, int [256]);
+UINT32 old_checksum(encoding, int [256]);
+UINT32 (*pchecksum)(encoding, int [256]) = checksum;
+
+main(argc, argv)
+int argc; char *argv[];
+{ char *argp, c;
+ int done, i;
+ char *myname = "ps2pk", *psname, *psbasename, *afmname = NULL,
+ *encname = NULL, *psfile = NULL, *psfilebn, pkname[80],
+ *t1inputs, *psrespath, *resourcedb, *AFM_fontname = NULL,
+ *encodingscheme = NULL;
+
+ FontPtr fontptr;
+ unsigned char glyphcode[1]; /* must be an array */
+ CharInfoRec *glyphs[1];
+ unsigned int count;
+ int charcode, rc = -1, charno;
+ char comment[256];
+ long cs;
+ encoding ev;
+ int WX[256];
+
+ float efactor = 1.0, slant = 0.0;
+
+ /* proto's */
+ int next_pixel();
+ void print_pixmap();
+ void first_pixel(CharInfoRec *);
+ INT32 TFMwidth(int);
+ int h_escapement(int);
+ void add_option(char *, char *);
+
+ while (--argc > 0 && (*++argv)[0] == '-') {
+ done=0;
+ while ((!done) && (c = *++argv[0])) /* allow -bcK like options */
+ switch (c) {
+ case 'a':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ afmname = argv[0];
+ done = 1;
+ break;
+ case 'd':
+ debug = 1;
+ break;
+ case 'e':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ encname = argv[0];
+ add_option("-e", encname);
+ done = 1;
+ break;
+ case 'E':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ efactor = atof(argv[0]);
+ add_option("-E", argv[0]);
+ done = 1;
+ break;
+ case 'O':
+ pchecksum = old_checksum;
+ add_option("-O", "");
+ break;
+ case 'P':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ pointsize = atof(argv[0]);
+ add_option("-P", argv[0]);
+ done = 1;
+ break;
+ case 'R':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ base_resolution = atoi(argv[0]);
+ add_option("-R", argv[0]);
+ done = 1;
+ break;
+ case 'S':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ slant = atof(argv[0]);
+ add_option("-S", argv[0]);
+ done = 1;
+ break;
+ case 'X':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ x_resolution = atoi(argv[0]); done = 1;
+ if (y_resolution == 0) y_resolution = x_resolution;
+ add_option("-X", argv[0]);
+ break;
+ case 'Y':
+ if (*++argv[0] == '\0') {
+ argc--; argv++;
+ }
+ y_resolution = atoi(argv[0]); done = 1;
+ if (x_resolution == 0) x_resolution = y_resolution;
+ add_option("-Y", argv[0]);
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ fatal("%s: %c illegal option\n", myname, c);
+ }
+ }
+
+ if (argc < 1 || argc >2) {
+ msg ("Ps2pk: version 1.5 (1992-96)\n");
+ msg ("Usage: %s [ options ] type1font [pkname]\n", myname);
+ msg ("options: -d -v -e<enc> -X<xres> -E<expansion> -S<slant>\n");
+ fatal("options: -O -P<pointsize> -Y<yres> -a<AFM> -R<baseres>\n");
+ }
+
+ psname = argv[0]; argc--; argv++;
+
+#ifdef KPATHSEA
+ kpse_set_progname(myname);
+#endif
+
+#ifndef KPATHSEA
+ if (ps_resource(psname)) {
+ /* if psname does neither contain a DIRSEP or `.' character
+ * then find the filename of this resource in one of the PS
+ * resource database(s) available in PSRESOURCEPATH.
+ */
+ char **names, **files; int i, count;
+
+ psrespath = path(PSRESOURCEPATH, getenv("PSRESOURCEPATH"));
+ if (verbose) msg("PSRESOURCEPATH := %s\n", psrespath);
+
+ count = ListPSResourceFiles(psrespath, NULL,
+ "FontOutline", psname, &names, &files);
+ if (count == 0)
+ fatal("No FontOutline resource found for %s\n", psname);
+ if (verbose && count > 1) {
+ msg("More than one FontOutline resource for %s\n", psname);
+ for (i = 0; i < count; i++) msg("\t<%s>\n", files[i]);
+ }
+ psfile = files[0];
+ if (verbose) msg("Resource <%s>\n", psfile);
+ psbasename = psname;
+ }
+
+ if (psfile != NULL) {
+ char **names, **files; int count;
+
+ if (afmname == NULL || ps_resource(afmname)) {
+ if (afmname == NULL) afmname = psname;
+ count = ListPSResourceFiles(psrespath, NULL,
+ "FontAFM", afmname, &names, &files);
+ if (count == 0)
+ fatal("No FontAFM resource found for %s\n", afmname);
+ if (verbose && count > 1) {
+ msg("More than one FontAFM resource for %s\n", afmname);
+ for (i = 0; i < count; i++) msg("\t<%s>\n", files[i]);
+ }
+ afmfile = files[0];
+ if (verbose) msg("Resource <%s>\n", afmfile);
+ }
+ else fatal("%s: invalid resource name\n", afmname);
+
+ if (encname != NULL) {
+ if (!ps_resource(encname))
+ fatal("%s: invalid Encoding resource\n", encname);
+ count = ListPSResourceFiles(psrespath, NULL,
+ "Encoding", encname, &names, &files);
+ if (count == 0)
+ fatal("No Encoding resource found for %s\n", encname);
+ if (verbose && count > 1) {
+ msg("More than one Encoding resource for %s\n", encname);
+ for (i = 0; i < count; i++) msg("\t<%s>\n", files[i]);
+ }
+ encfile = files[0];
+ if (verbose) msg("Resource <%s>\n", encfile);
+ }
+ }
+ else { /* No PS resource database or no resource for type1font */
+#endif
+#ifdef KPATHSEA
+ psfile = kpse_find_file(psname,kpse_type1_format,0);
+ if (!psfile) {
+ /* kpse_find_file does not look for alternate suffixes */
+ char *altname = newname(psname, ".pfb");
+ psfile = kpse_find_file(altname, kpse_type1_format, 0);
+ free(altname);
+ }
+ if (!psfile)
+ fatal("%s: PS file %s not found!\n", program_invocation_name,
+ psname);
+ if (afmname == NULL)
+ afmname = newname(psname, ".afm");
+ afmfile = kpse_find_file(afmname,kpse_afm_format,0);
+ if (!afmfile)
+ fatal("%s: AFM file %s not found!\n", program_invocation_name,
+ afmname);
+
+ if (encname) {
+ encfile = kpse_find_file(encname,kpse_enc_format,0);
+ if (!encfile)
+ fatal("%s: enc file %s not found!\n", program_invocation_name,
+ encname);
+ }
+ else
+ encfile = NULL;
+ printf("psfile = %s\n", psfile);
+ printf("afmfile = %s\n", afmfile);
+ if (encfile) printf("encfile = %s\n", encfile);
+#else
+ t1inputs = path(T1INPUTS, getenv("T1INPUTS"));
+ if (verbose) msg("T1INPUTS := %s\n", t1inputs);
+
+ psfile = search_file(t1inputs, psname, FATAL);
+ if (verbose) msg("Font file <%s>\n", psfile);
+
+ if (afmname == NULL) afmname = newname(psfile, ".afm");
+ afmfile = search_file(t1inputs, afmname, FATAL);
+ if (verbose) msg("AFM file <%s>\n", afmfile);
+
+ /* get encoding when -e<enc> provided */
+ if (encname) {
+ encfile = search_file(t1inputs, encname, FATAL);
+ if (verbose) msg("Encoding file <%s>\n", encfile);
+ }
+#endif
+ psbasename = basename(psname, extension(psname));
+#ifndef KPATHSEA
+ }
+#endif
+ psfilebn = basename(psfile, NULL);
+
+ if (pointsize == 0.0) pointsize = DEFAULTPOINTSIZE;
+ if (x_resolution == 0) x_resolution = DEFAULTRES;
+ if (y_resolution == 0) y_resolution = x_resolution;
+ if (verbose)
+ msg("Loading encoding vector from %s ...",
+ encname? encname: basename(afmfile, NULL));
+ getenc(&AFM_fontname, &encodingscheme, ev, WX);
+ if (efactor != 1.0)
+ for (i=0; i < 256; i++) {
+ if (ev[i] == NULL) continue;
+ WX[i] = WX[i] * efactor + 0.5;
+ }
+ if (verbose) msg(" done\n");
+
+ if (argc == 1) strcpy(pkname, argv[0]);
+ else
+ sprintf(pkname, "%s%d.%dpk", psbasename,
+ (int) (pointsize + 0.5), x_resolution);
+
+ /* next values are needed! */
+ vals.x = x_resolution;
+ vals.y = y_resolution;
+ vals.point = 10.0 * pointsize + 0.5; /* DECIPOINTS */
+ vals.pixel = pointsize * y_resolution / POINTSPERINCH + 0.5;
+
+ if (verbose) msg("Checking type1 font %s ...", psfilebn);
+ Type1RegisterFontFileFunctions();
+ if (verbose) msg(" done\n");
+
+ /* next line prevents UNIX core dumps */
+ entry.name.name = "-adobe-utopia-medium-r-normal--0-0-0-0-p-0-iso8859-1";
+ if (verbose)
+ msg("Creating character glyphs for %s ...", psfilebn);
+ rc = Type1OpenScalable(ev, &fontptr, 0, &entry,
+ psfile, &vals, 0, 0, efactor, slant);
+ if (rc != Succesful)
+ fatal("Type1OpenScalable error (result: %d) on %s \n", rc, psfile);
+ if (verbose) msg(" done\n");
+
+ pk_open(pkname);
+ sprintf(comment, "%s rendered at %f points", psbasename, pointsize);
+ cs = pchecksum(ev, WX);
+ pk_preamble(comment, pointsize, cs, x_resolution, y_resolution);
+ charno = 0;
+ if (verbose) msg("Creating %s from %s\n", pkname, psfilebn);
+ for (charcode = 0; charcode < 256; charcode++) {
+ if (ev[charcode] == NULL) continue;
+ glyphcode[0] = charcode;
+ (fontptr->get_glyphs)(fontptr, 1, glyphcode, 0, &count, glyphs);
+ if (count > 0) {
+ if (debug) {
+ msg("'%03o ", charcode); charno++;
+ if (charno == 8) {
+ msg("%c", '\n'); charno = 0;
+ }
+ }
+ first_pixel(glyphs[0]); /* assigns W and H */
+ pk_char(charcode, /* charcode */
+ TFMwidth(WX[charcode]), /* TFMwidth */
+ h_escapement(WX[charcode]), /* h_escapement */
+ W, H, /* width and height */
+ - glyphs[0]->metrics.leftSideBearing, /* h_offset */
+ glyphs[0]->metrics.ascent, /* v_offset */
+ next_pixel); /* pixel generator */
+ }
+ }
+ if (debug) msg("%c", '\n');
+ ps2pk_postamble(psbasename, encodingscheme,
+ base_resolution, x_resolution, y_resolution, pointsize,
+ ps2pk_args);
+ pk_close();
+ exit(0);
+}
+
+/*
+ * The checksum should garantee that our PK file belongs to the correct TFM
+ * file! Exactly the same as the afm2tfm (dvips5487) calculation.
+ */
+UINT32 old_checksum(encoding ev, int width[256])
+{
+ int i, leftbit ;
+ UINT32 s1 = 0, s2 = 0;
+ char *p ;
+
+ for (i=0; i<256; i++) {
+ if (ev[i] == NULL) continue;
+ s1 = (s1<<1) ^ width[i]; /* left shift */
+ for (p=ev[i]; *p; p++)
+ s2 = s2 * 3 + *p ;
+ }
+ return (s1<<1) ^ s2 ;
+}
+
+/*
+ * The new checksum algorithm.
+ */
+UINT32 checksum(encoding ev, int width[256])
+{
+ int i, leftbit ;
+ UINT32 s1 = 0, s2 = 0;
+ char *p ;
+
+ for (i=0; i<256; i++) {
+ if (ev[i] == NULL) continue;
+ s1 = ((s1<<1) ^ (s1>>31)) ^ width[i]; /* cyclic left shift */
+ for (p=ev[i]; *p; p++)
+ s2 = s2 * 3 + *p ;
+ }
+ return (s1<<1) ^ s2 ;
+}
+
+static int row, col;
+static int data, bitno;
+static unsigned char *p_data;
+
+int next_pixel()
+{ int pixel;
+
+ while (row < H) {
+ if (col++ < W) {
+ if (bitno == 0) { data = *p_data++; bitno = 8; }
+ pixel = data & 0x80? BLACK: WHITE;
+ data <<= 1; bitno--; return pixel;
+ }
+ col = 0; row++; bitno = 0;
+ }
+ fatal("Not that many pixels!\n");
+}
+
+void first_pixel(CharInfoRec *G)
+{
+ row = col = 0;
+ p_data = (unsigned char *) G->bits;
+ W = G->metrics.rightSideBearing - G->metrics.leftSideBearing;
+ H = G->metrics.ascent + G->metrics.descent;
+ bitno = 0;
+}
+
+void print_pixmap()
+{ int c, r;
+ unsigned char *save_p_data;
+
+ save_p_data = p_data;
+ if (W*H == 0) return; /* easy */
+ for (r = 0; r < H; r++) {
+ for (c = 0; c < W; c++)
+ if (next_pixel() == BLACK) msg("%c", 'X');
+ else msg("%c", '.');
+ msg("%c", '\n');
+ }
+ /* reset data for scanning pixmap */
+ p_data = save_p_data;
+ bitno = 0; row = 0; col = 0;
+}
+
+/* Next function computes the width as a fix_word. A fix_word is
+ an integer representation for fractions. The decimal point is
+ left from bit 20. (The method is `stolen' from afm2tfm.) */
+
+INT32 TFMwidth(int wx)
+{
+ return (((wx / 1000) << 20) +
+ (((wx % 1000) << 20) + 500) / 1000) ;
+}
+
+static float HXU = -1.0; /* horizontal pixels per design unit */
+
+/* the horizontal escapent is the number of pixels to next origin */
+int h_escapement(int wx)
+{
+ if (HXU == -1.0)
+ HXU = (pointsize * x_resolution) / 72270.0;
+ return wx * HXU + 0.5;
+}
+
+/* add ps2pk option to string */
+void add_option(char *option, char *value) {
+ static char *p_args = NULL;
+
+ if (p_args == NULL) {
+ p_args = ps2pk_args;
+ sprintf(p_args, "%s%s", option, value);
+ }
+ else
+ sprintf(p_args, " %s%s", option, value);
+ p_args+= strlen(p_args);
+}
+
+/* Next stuff is needed by type1 rendering functions */
+
+int CheckFSFormat(format, fmask, bit, byte, scan, glyph, image)
+ int format,fmask,*bit,*byte,*scan,*glyph,*image;
+{
+ *bit = *byte = 1;
+ *glyph = *scan = *image = 1;
+ return Successful;
+
+}
+
+long MakeAtom(p, len, foo)
+ char *p;
+ unsigned int len;
+ Bool foo;
+{
+ return (long)p;
+}
+
+GetClientResolutions(resP)
+ int *resP;
+{
+ *resP = 0;
+}
+
+char *Xalloc(size_t size)
+{ char *p;
+ p = malloc(size);
+ if (p == NULL) fatal("Out of memory\n");
+ return p;
+}
+
+void Xfree(void *p)
+{
+ free(p);
+}
+
+#ifdef WIN32
+void FontDefaultFormat(int *bit, int *byte,
+ CharInfoRec *glyphs, int *scan) { ; }
+void FontFileRegisterRenderer(FontRendererRec *foo) { ; }
+void FontParseXLFDName(char *scaledName, FontScalablePtr Vals, int foo ) { ; }
+FontComputeInfoAccelerators(FontInfoPtr foo) { ; }
+#else
+void FontDefaultFormat() { ; }
+
+void FontFileRegisterRenderer() { ; }
+
+GenericGetBitmaps() { ; }
+GenericGetExtents() { ; }
+
+void FontParseXLFDName() { ; }
+FontComputeInfoAccelerators() { ; }
+#endif
diff --git a/Build/source/texk/ps2pkm/ps2pk.rc b/Build/source/texk/ps2pkm/ps2pk.rc
new file mode 100644
index 00000000000..acdf81cde9e
--- /dev/null
+++ b/Build/source/texk/ps2pkm/ps2pk.rc
@@ -0,0 +1,36 @@
+/* ps2pk.rc: ps2pk 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 " ps2pk 1.6"
+
+#define VER_INTERNALNAME_STR "ps2pk"
+#define VER_ORIGINALFILENAME_STR "ps2pk.exe"
+
+#define VER_LEGALCOPYRIGHT_STR "Copyright (C) 1990-97 Radical Eye Software"
+
+#define VER_LEGALCOPYRIGHT_STR ""
+
+#define VER_FILEDESCRIPTION_STR "PS-to-PK Converter"
+
+#include <texlive.version>
+
+/* ps2pk.rc ends here */
diff --git a/Build/source/texk/ps2pkm/psearch.c b/Build/source/texk/ps2pkm/psearch.c
new file mode 100644
index 00000000000..19e44251cd0
--- /dev/null
+++ b/Build/source/texk/ps2pkm/psearch.c
@@ -0,0 +1,557 @@
+/*
+ * FILE: psearch.c
+ * PURPOSE: PATH search module
+ * VERSION: 1.0 (Nov. 1995)
+ * AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
+ */
+
+#define _POSIX_SOURCE 1
+#ifdef ultrix
+#define __POSIX /* otherwise MAXNAMLEN undefined */
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h> /* struct stat */
+#include <dirent.h> /* opendir(), readdir(), closedir() */
+#include "ctype.h" /* isalpha() */
+#include <stdio.h> /* sprintf(), fclose() */
+#include "stdlib.h" /* getenv(), malloc() */
+#include <stdarg.h> /* va_start(), va_arg(), va_end() */
+#include "string.h" /* strcat(), strchr(), strcmp(), strcpy(), strlen(),
+ strncmp(), strncpy(), strstr() */
+#include "basics.h" /* fatal() */
+#include "strexpr.h" /* strexpr() */
+#include "filenames.h" /* equal(), extension() */
+#include "texfiles.h" /* four(), one(), two() */
+
+#ifdef UNIX
+#include <pwd.h> /* getpwnam() */
+
+int tilde = 1; /* Substitute ~ and ~user */
+static char *home = NULL;
+
+/*
+ * During scanning of paths we often need to replace ~user with user's
+ * HOME directory and ~ with HOME directory. Subtilde() copies the actual
+ * value of `~' or `~user' from <path> into <fn>. The pointers <fn> and
+ * <path> are `updated'.
+ */
+void subtilde(char **fn, char **path)
+{ char pattern[32], *p; int i;
+
+ i = 0; p = *path;
+ while (*p != '\0' && *p != DIRSEP && *p != PATHSEP)
+ pattern[i++] = *p++ ;
+ pattern[i] = '\0' ;
+ if (pattern[0] != '~') return;
+ if (pattern[1] == '\0') {
+ if (home == NULL)
+ home = getenv("HOME");
+ if (home == NULL) fatal("You don't have a HOME!\n");
+ sprintf(*fn, "%s\0", home);
+ *fn += strlen(*fn);
+ *path = p;
+ }
+ else {
+ struct passwd *pw;
+ if (pw = getpwnam(&pattern[1])) {
+ sprintf(*fn, "%s\0", pw->pw_dir);
+ *fn += strlen(*fn); *path = p;
+ }
+ else
+ fatal("%s: no such user\n", &pattern[1]) ;
+ }
+}
+#else
+static int tilde = 0; /* Don't substitute ~ and ~user */
+static void subtilde(char **fn, char **path) {}
+#endif
+
+/*
+ * Return a path constructed by <env> and <deFault>. If <env> is empty
+ * the returned path equals <deFault>, otherwise the returned path is
+ * <env> in which empty path elements are replaced by <deFault>. Double
+ * path elements are NOT removed.
+ */
+char *path(char *deFault, char *env) {
+ char *e, *p, *q; int len, left = MAXPATHLEN;
+
+ if (env == NULL) return deFault;
+
+ p = (char *) malloc(MAXPATHLEN);
+ if (p == NULL) fatal("Out of memory\n");
+
+ q = p; e = env;
+ while (*e) {
+ if (*e == PATHSEP) {
+ if (left == MAXPATHLEN) {
+ len = strlen(deFault);
+ if (len > left-1) fatal("'%s' path too long!\n", env);
+ strcpy(q, deFault);
+ q += len; left -= len;
+ *q++ = *e++; left--;
+ }
+ else if (*(e+1) == PATHSEP || *(e+1) == '\0') {
+ *q++ = *e++; left--;
+ len = strlen(deFault);
+ if (len > left) fatal("'%s' path too long!\n", env);
+ strcpy(q, deFault);
+ q += len; left -= len;
+ }
+ else {
+ *q++ = *e++; left--;
+ }
+ }
+ else {
+ *q++ = *e++; left--;
+ }
+ if (left == 0) fatal("'%s' path too long!\n", env);
+ }
+ *q = '\0';
+ return p;
+}
+
+/*
+ * Rsearch() searches <file> through <path>. Recursion introduced by
+ * RECURSIVE string (system dependant) will be followed. Search stops
+ * after first match.
+ */
+static char *rsearch(char *path, char *file)
+{
+ struct stat status;
+ DIR *D;
+ struct dirent *de;
+ int i;
+ char *res = NULL, *ext, *file_ext,
+ head[MAXPATHLEN], target[MAXPATHLEN], *tail;
+ char fn[MAXPATHLEN];
+
+ /* determine head and tail of path */
+ i = 0;
+ while (*(path+i) != '\0' && strncmp(path+i, RECURSIVE, 2) != 0) {
+ head[i] = *(path+i); i++;
+ }
+ head[i] = '\0';
+ if (*(path+i) == '\0') tail = NULL;
+ else tail = path+i+2;
+
+ /* Check if we have found <file> */
+ if (tail == NULL || *tail == '\0') {
+ sprintf(fn, "%s%c%s", head, DIRSEP, file);
+ if (stat(fn, &status) == 0) {
+ res = malloc(strlen(fn)+1);
+ if (res == NULL) fatal("Out of memory\n");
+ strcpy(res, fn);
+ return res;
+ }
+ /* No recursion, so stop */
+ if (tail == NULL) return NULL;
+ }
+
+ if ((D = opendir(head)) == NULL) return NULL;
+ file_ext = extension(file);
+
+ /* now read directories and probe files */
+ while ((de = readdir(D)) != NULL) {
+ /* Ignore `.' and `..' directories */
+ if (strcmp(de->d_name, ".") == 0) continue;
+ if (strcmp(de->d_name, "..") == 0) continue;
+
+ /* Check if we have a directory */
+ sprintf(fn, "%s%c%s", head, DIRSEP, de->d_name);
+ (void) stat(fn, &status);
+ if (!S_ISDIR(status.st_mode)) {
+ /* if we are looking for a file with an extension and we find
+ * files with the same or a different extension we may consider
+ * this directory as a wrong place unless the user has defined
+ * funny directory search paths
+ */
+ if (file_ext && (ext = extension(de->d_name))) {
+ if (equal(ext, ".pk")) break;
+ if (equal(ext, ".vf")) break;
+ if (equal(ext, ".mf")) break;
+ if (equal(ext, ".tfm")) break;
+ if (equal(ext, ".afm")) break;
+ }
+ continue;
+ }
+
+ /* Directories with no real subdirectories can be skipped
+ * unless the file we are looking for is there. Unfortunately
+ * this shortcut only works for UNIX systems. On other systems
+ * the above check on extensions may help.
+ */
+#if defined(UNIX)
+ if (status.st_nlink == 2) {
+ if (strchr(file, DIRSEP)) continue;
+ if ((*tail == '\0') && (res = rsearch(fn, file))) break;
+ continue;
+ }
+#endif
+
+ /* path of the form "/aap/noot/mies//" */
+ if (*tail == '\0') {
+ sprintf(fn, "%s%c%s%s", head, DIRSEP, de->d_name, RECURSIVE);
+ if (res = rsearch(fn, file)) break;
+ continue;
+ }
+
+ /* path of the form "/aap/noot//mies" */
+
+ /* search /aap/noot/<d_name>// <tail>/<file> */
+ sprintf(fn, "%s%c%s%s", head, DIRSEP, de->d_name, RECURSIVE);
+ sprintf(target, "%s%c%s", tail, DIRSEP, file);
+ if (res = rsearch(fn, target)) break;
+ }
+ closedir(D);
+ return res;
+}
+
+/* Is <name> an absolute filename? */
+int absname(char *name) {
+
+ if (*name == DIRSEP) return 1;
+#ifdef MSDOS
+ if (*(name+1) == ':' && *(name+2) == DIRSEP && isalpha(*name)) return 1;
+#endif
+ return 0;
+}
+
+/*
+ * Look for a <file> in <path>. Return absolute filename if found.
+ * If not found return NULL (if <terminate> is 0) or terminate program
+ * with appropriate message (if <terminate> is not equal to 0).
+ */
+char *search_file(char *path, char *file, int terminate) {
+ char *fn, pe[MAXPATHLEN], *ppe, *ppath;
+ struct stat status;
+
+ if (path == NULL || *path == '\0' || absname(file)) {
+ if (stat(file, &status) == 0) return file;
+ if (terminate) fatal("File <%s> not found\n", file);
+ return NULL;
+ }
+ ppath = path;
+ while (*ppath) {
+ /* copy next pathelement into pe */
+ ppe = pe;
+ while (*ppath != PATHSEP && *ppath != '\0') {
+ if (tilde && *ppath == '~')
+ subtilde(&ppe, &ppath);
+ else
+ *ppe++ = *ppath++;
+ }
+ *ppe = '\0';
+ if (*ppath == PATHSEP) ppath++;
+ if (fn = rsearch(pe, file)) return fn;
+ }
+ if (terminate) fatal("File <%s> not found in path \"%s\"\n", file, path);
+ return NULL;
+}
+
+/*
+ * Now some functions for PK font search
+ */
+
+/*
+ * replace <pattern> in <cs> by <value>. If the <pattern> is %b or %d
+ * the value will be converted to a decimal value.
+ */
+static void replace(char *cs, char *pattern, void *value) {
+ char temp[MAXPATHLEN], *p, *q; int len;
+
+ while (q = strstr(cs, pattern)) {
+ strcpy(temp, q+strlen(pattern));
+ switch (*(pattern+1)) {
+ case 'b':
+ case 'd':
+ sprintf(q, "%d", *((int *)value));
+ len = strlen(q);
+ break;
+ case 'F':
+ sprintf(q, "%-8s", (char *) value);
+ len = strlen (q);
+ break;
+ case 'f':
+ sprintf(q, "%s", (char *) value);
+ len = strlen (q);
+ break;
+ default:
+ sprintf(q, "%s", (char *) value);
+ len = strlen (q);
+ break;
+ }
+ strcpy(q+len, temp);
+ }
+}
+
+/*
+ * This function substitutes the <patterns> encountered in <str>
+ * with their corresponding <value>. Recognized patterns are %b, %d,
+ * %f, %F and %m. They will be replaced with their corresponding integer
+ * (%b, %d) or string values (%f, %F and %m). These values can be used as
+ * placeholders for basic resolution (%b), resolution (%d), font name
+ * (%f or %F) or mode definition (%m). The %F is a special case for
+ * representing the fontname leftadjusted in a string of eight characters.
+ */
+
+void substitute(char *str, char *patterns, ...) {
+ va_list ap;
+ char *p;
+ char *svalue; int ivalue;
+
+ /* get arguments ... */
+ va_start(ap, patterns);
+ for (p = patterns; *p; p++) {
+ if (*p != '%') {
+ fatal("%s: invalid format\n");
+ }
+ switch (*++p) {
+ case 'b':
+ ivalue = va_arg(ap, int);
+ replace(str, "%b", &ivalue);
+ break;
+ case 'd':
+ ivalue = va_arg(ap, int);
+ replace(str, "%d", &ivalue);
+ break;
+ case 'F':
+ svalue = va_arg(ap, char *);
+ replace(str, "%F", svalue);
+ break;
+ case 'f':
+ svalue = va_arg(ap, char *);
+ replace(str, "%f", svalue);
+ break;
+ case 'm':
+ svalue = va_arg(ap, char *);
+ replace(str, "%m", svalue);
+ break;
+ case 'p':
+ svalue = va_arg(ap, char *);
+ replace(str, "%p", svalue);
+ break;
+ default:
+ fatal("%s: invalid letter (%c) in format\n", patterns, *p);
+ }
+ }
+ va_end(ap);
+}
+
+/* global font searching parameters */
+static char *_mode = NULL;
+static int _margin = 0, _bdpi = -1;
+static char *_tolerance = NULL;
+
+void init_pksearch(int bdpi, char *mode, int margin, char *tolerance) {
+ _bdpi = bdpi;
+ _mode = mode;
+ _margin = margin;
+ _tolerance = tolerance;
+}
+
+/* evaluate <expr> after substituting %d with <dpi>. Return the
+ * integer result or abort with message when invalid expression.
+ */
+int evaluate(char *expr, int dpi) {
+ char expression[128];
+ int result;
+
+ if (expr == NULL || *expr == '\0') return 0;
+ strcpy(expression, expr);
+ substitute(expression, "%d", dpi);
+ if (strexpr(&result, expression))
+ fatal("%s: expression error\n", expression);
+ return result;
+}
+
+#define INT(x) ((int)(x+0.5))
+
+/*
+ * Round <dpi> to a whole or half magstep if the difference is within
+ * a certain _tolerance from it.
+ */
+int nearesthalf(int dpi) {
+ double near = _bdpi, half = 1.095445115; int tolerance;
+
+ tolerance = evaluate(_tolerance, dpi);
+ if (tolerance == 0 || dpi == _bdpi) return dpi;
+ if (dpi > INT(near)+tolerance)
+ while (dpi > INT(near)+tolerance) near*=half;
+ else if (dpi < INT(near)-tolerance)
+ while (dpi < INT(near)-tolerance) near/=half;
+ if (dpi >= INT(near)-tolerance && dpi <= INT(near)+tolerance)
+ return INT(near);
+ return dpi;
+}
+
+/*
+ * Look for a PK <font> of resolution <dpi> in <path>. To avoid floating
+ * around lots of different font sizes TeX prefers to work with whole
+ * and half magsteps. So instead of using a 330 dpi font for a 11 point
+ * version of a 300 dpi font we would prefer the 329 dpi size because
+ * this size matches magstep 0.5 of 300 (329 = int(300 * 1.2 ** 0.5).
+ * The process of truncating real font sizes to magsteps can be
+ * controlled by the global parameter <tolerance> which may be an
+ * expression of the actual value of <dpi> itself. The value dvips(1)
+ * uses for <tolerance> is 1 + <dpi> / 500 allowing more tolerance in
+ * bigger sizes. Due to round-off different DVI drivers choose different
+ * <dpi> sizes. With <margin> we can define what font sizes are looked
+ * at whenever size <dpi> is wanted. With <margin> set to zero only the
+ * exact size is looked at, while a value of one would allow for a
+ * round-off of one. Both <margin> and <tolerance> can be set before a
+ * search starts otherwise they get their default values (zero) with
+ * init_pksearch().
+ *
+ * When <path> does contain placeholders like %b, %d, %f, %p and %m
+ * they will be substituted by their corresponding values _bdpi, <dpi>,
+ * <font>, "pk" and _mode respectivally. This allows to define paths
+ * for a whole range of printers. Occurrences off ~ or * ~user in <path>
+ * will be substituted by the corresponding HOME directories on UNIX.
+ *
+ * The result of search_pkfile() is a pointer to the name of <font> when
+ * one is found otherwise NULL.
+ */
+char *search_pkfile(char *path, char *texfont, int dpi) {
+ char *ppe, *pkpath, pe[MAXPATHLEN];
+ int del;
+ char *pkname;
+ struct stat status;
+
+ for (del=0; del <= _margin ; del=del>0?-del:-del+1) {
+ pkpath = path;
+ while (*pkpath) {
+ /* copy next pathelement into pe */
+ ppe = pe;
+ while (*pkpath != PATHSEP && *pkpath != '\0') {
+ if (tilde && *pkpath == '~')
+ subtilde(&ppe, &pkpath);
+ else
+ *ppe++ = *pkpath++;
+ }
+ *ppe = '\0';
+ if (strchr(pe, '%')) {
+ if (strstr(pe, "%d") && strstr(pe, "%f")) {
+ /* try filename after replacing placeholders */
+ substitute(pe, "%b%m%f%d%p",
+ _bdpi, _mode, texfont, dpi+del, "pk");
+ if (stat(pe, &status) == 0) {
+ pkname = malloc(strlen(pe)+1);
+ if (pkname == NULL) fatal("Out of memory\n");
+ strcpy(pkname, pe);
+ return pkname;
+ }
+ }
+ else /* %f and %d are required! */
+ fatal("%s: incomplete path element!\n", pe);
+ }
+ else {
+ sprintf(ppe, "%c%s.%dpk", DIRSEP, texfont, dpi+del);
+ if (stat(pe, &status) == 0) {
+ pkname = malloc(strlen(pe)+1);
+ if (pkname == NULL) fatal("Out of memory\n");
+ strcpy(pkname, pe);
+ return pkname;
+ }
+ }
+ if (*pkpath == PATHSEP) pkpath++;
+ }
+ }
+ return NULL;
+}
+
+/*
+ * Functions for handling emTeX's FLI files.
+ */
+
+/*
+ * Look at the fonts in the font library by calling the function <font>.
+ * This function can stop the search by returning a 1 or continue by
+ * returning a zero. In this way we can look for just one font or for
+ * a whole series of fonts. If the search is stopped the name of the
+ * current FLI file is returned otherwise a NULL pointer.
+ */
+char *search_flifile(char *fliname, int (*font)(char *, int)) {
+ unsigned short len, numsizes, numfonts, version1, version2;
+ char fontname[50];
+ int i, size;
+
+ FILE *FLI;
+
+ FLI = fopen(fliname, RB);
+ if (FLI == NULL) return NULL;
+
+ for (i=0; i<4; i++) {
+ fontname[i] = one(FLI); /* read header */
+ }
+ version1 = one(FLI);
+ version2 = one(FLI);
+ if (strncmp(fontname,"FLIB",4)!=0 || version1 != 2 || version2 != 0)
+ fatal("incorrect font library format");
+
+ (void) two(FLI); /* ignore directory length */
+ numsizes = two(FLI); /* number of sizes */
+ numfonts = two(FLI); /* number of fonts */
+ len = two(FLI); /* length of comment */
+ for (i=0; i<len; i++)
+ (void)one(FLI); /* skip comment */
+
+ for ( ;numsizes>0; numsizes--) {
+ /* for each font size in this library */
+ (void)two(FLI); /* length of size entry - ignore */
+ numfonts = two(FLI); /* number of fonts */
+ /* DPI (fixed point 16.16) */
+ size = (int)(four(FLI)/65536.0+0.5);
+
+ for ( ;numfonts > 0; numfonts--) {
+ /* read each entry */
+ (void)four(FLI); /* ignore length of font */
+ (void)four(FLI); /* offset to font */
+ len = one(FLI); /* length of name */
+ for (i=0; i<len; i++)
+ fontname[i] = one(FLI);
+ fontname[len] = '\0';
+ if (font(fontname, size) == 1) {
+ fclose(FLI);
+ return fliname;
+ };
+ }
+ }
+ fclose(FLI);
+ return NULL;
+}
+
+/*
+ * Look for font libraries in <path> (ex.: c:\emtex\texfonts;fli_0;fli_1).
+ * Run <font()> function for each .fli file found in <path>. Continue
+ * if this function returns NULL, stop otherwise.
+ */
+char *search_flipath(char *flipath, int (*font)(char *, int)) {
+ char fn[MAXPATHLEN], *pfn, *pfli, *fliname;
+ int len;
+
+ if (flipath == NULL) fatal("Invalid fli path\n");
+
+ /* treat first element of flipath as a directory */
+ pfn = fn;
+ while (*flipath != PATHSEP && *flipath != '\0') {
+ *pfn++ = *flipath++;
+ }
+ *pfn = '\0'; len = strlen(fn);
+ if (len >= 1 && fn[len-1] != DIRSEP) *pfn++ = DIRSEP;
+
+ /* and next elements as fli files */
+ while (*flipath != '\0') {
+ /* copy next pathelement into fn */
+ pfli = pfn; flipath++;
+ while (*flipath != PATHSEP && *flipath != '\0') {
+ *pfli++ = *flipath++;
+ }
+ *pfli = '\0'; len = strlen(pfn);
+ if (len > 4 && strcmp(pfli-4, ".fli") != 0)
+ strcat(pfli, ".fli");
+ if ((fliname = search_flifile(fn, font)) != NULL)
+ return fliname;
+ }
+ return NULL;
+}
diff --git a/Build/source/texk/ps2pkm/psearch.h b/Build/source/texk/ps2pkm/psearch.h
new file mode 100644
index 00000000000..5058d679258
--- /dev/null
+++ b/Build/source/texk/ps2pkm/psearch.h
@@ -0,0 +1,115 @@
+/*
+ * FILE: psearch.h
+ * PURPOSE: PATH search module
+ * VERSION: 1.0 (Oct. 1995)
+ * AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*
+ * This function initiates a path by using a built-in <deFault> and
+ * a PATH environment variable that can be set at run time by the user.
+ * A typical usage is
+ * userenv = path(".:/someplace", getenv("USERENV"))
+ *
+ * If USERENV is not set getenv("USERENV") returns NULL and the returned
+ * path equals the value of the first argument. Otherwise the returned
+ * path is the value of second argument in which empty path elements are
+ * replaced by <deFault>. For example when USERENV is set to "~/myplace:"
+ * the resulting path will be "~myplace:.:/someplace".
+ */
+char *path(char *deFault, char *env);
+
+/*
+ * This function substitutes the <patterns> encountered in <str>
+ * with their corresponding <value>. Recognized patterns are %b, %d,
+ * %f, %F and %m. They will be replaced with their corresponding integer
+ * (%b, %d) or string values (%f, %F and %m). These values can be used as
+ * placeholders for basic resolution (%b), resolution (%d), font name
+ * (%f or %F) or mode definition (%m). The %F is a special case for
+ * representing the fontname leftadjusted in a string of eight characters.
+ */
+void substitute(char *str, char *patterns, ...);
+
+#define NONFATAL 0
+#undef FATAL
+#define FATAL 1
+/*
+ * Look for a <file> in <path>. Return absolute filename if found.
+ * If not found return NULL (if <terminate> is NONFATAL) or terminate
+ * program with appropriate message (if <terminate> is FATAL).
+ * On UNIX ~ or ~someone in paths are evaluated to the proper HOME
+ * directories.
+ * When the path does contain recursion characters ("//" on UNIX and
+ * "!!" on MSDOS) directories are searched recursively.
+ */
+char *search_file(char *path, char *file, int terminate);
+
+/* set global paramaters for PK font search */
+void init_pksearch(int bdpi, char *mode, int margin, char *tolerance);
+
+/*
+ * Look for a PK <font> of resolution <dpi> in <path>. To avoid floating
+ * around lots of different font sizes TeX prefers to work with whole
+ * and half magsteps. So instead of using a 330 dpi font for a 11 point
+ * version of a 300 dpi font we would prefer the 329 dpi size because
+ * this size matches magstep 0.5 of 300 (329 = int(300 * 1.2 ** 0.5).
+ * The process of truncating real font sizes to magsteps can be
+ * controlled by the global parameter <tolerance> which may be an
+ * expression of the actual value of <dpi> itself. The value dvips(1)
+ * uses for <tolerance> is 1 + <dpi> / 500 allowing more tolerance in
+ * bigger sizes. Due to round-off different DVI drivers choose different
+ * <dpi> sizes. With <margin> we can define what font sizes are looked
+ * at whenever size <dpi> is wanted. With <margin> set to zero only the
+ * exact size is looked at, while a value of one would allow for a
+ * round-off of one. Both <margin> and <tolerance> can be set before a
+ * search starts otherwise they get their default values (zero) with
+ * init_pksearch().
+ *
+ * When <path> does contain placeholders like %b, %d, %f, %p and %m
+ * they will be substituted by their corresponding values _bdpi, <dpi>,
+ * <font>, "pk" and _mode respectivally. This allows to define paths
+ * for a whole range of printers. Occurrences off ~ or * ~user in <path>
+ * will be substituted by the corresponding HOME directories on UNIX.
+ *
+ * The result of search_pkfile() is a pointer to the name of <font> when
+ * one is found otherwise NULL.
+ */
+char *search_pkfile(char *path, char *font, int dpi);
+
+/*
+ * evaluate <expr> after substituting %d with <dpi>. Return the
+ * integer result or abort with message when invalid expression.
+ */
+int evaluate(char *expr, int dpi);
+
+/*
+ * Round <dpi> to a whole or half magstep of <bdpi> if the distance of
+ * <dpi> is within a certain <tolerance> from it. The value of <bdpi> and
+ * <tolerance> should be set with init_pksearch().
+ */
+int nearesthalf(int dpi);
+
+extern int tilde;
+
+/*
+ * During scanning of paths we often need to replace ~user with user's
+ * HOME directory and ~ with HOME directory. Subtilde() copies the actual
+ * value of `~' or `~user' from <path> into <fn>. The pointers <fn> and
+ * <path> are `updated'.
+ */
+void subtilde(char **fn, char **path);
+
+/* Is <name> an absolute filename? */
+int absname(char *name);
+
+/*
+ * Look for font libraries in <path> (ex.: c:\emtex\texfonts;fli_0;fli_1).
+ * Run <font()> function for each .fli file found in <path>. Continue
+ * if this function returns 0, stop when if this function return a 1.
+ * In the last case the name of the FLI file is returned.
+ */
+char *search_flipath(char *flipath, int (*font)(char *, int));
+
diff --git a/Build/source/texk/ps2pkm/regions.c b/Build/source/texk/ps2pkm/regions.c
new file mode 100644
index 00000000000..c58800691c5
--- /dev/null
+++ b/Build/source/texk/ps2pkm/regions.c
@@ -0,0 +1,1765 @@
+/* $XConsortium: regions.c,v 1.4 91/10/10 11:18:57 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* REGIONS CWEB V0023 LOTS */
+/*
+:h1 id=regions.REGIONS Module - Regions Operator Handler
+
+This module is responsible for creating and manipulating regions.
+
+&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com)
+
+
+:h3.Include Files
+
+The included files are:
+*/
+
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "regions.h"
+#include "paths.h"
+#include "curves.h"
+#include "lines.h"
+#include "pictures.h"
+#include "fonts.h"
+#include "hints.h"
+#include "strokes.h" /* to pick up 'DoStroke' */
+static int Unwind();
+#ifdef HAVE_PROTOTYPES
+static void newfilledge(register struct region *, fractpel, fractpel,
+ fractpel, fractpel, int);
+static void vertjoin(register struct edgelist *, register struct edgelist *);
+static void discard(register struct edgelist *, register struct edgelist *);
+static void cedgemin(register int, register pel *, register pel);
+static void cedgemax(register int, register pel *, register pel);
+static void edgemin(register int, register pel *, register pel *);
+static void edgemax(register int, register pel *, register pel *);
+#else
+static int newfilledge();
+static int vertjoin();
+static discard();
+static int edgemin();
+static int edgemax();
+#endif
+static struct edgelist *splitedge();
+static int touches();
+static int crosses();
+static int edgecheck();
+static struct edgelist *NewEdge();
+
+/*
+:h3.Functions Provided to the TYPE1IMAGER User
+
+This module provides the following TYPE1IMAGER entry points:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Functions Provided to Other Modules
+
+This module provides the following entry points to other modules:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Macros Provided to Other Modules
+
+:h4.GOING_TO() - Macro Predicate Needed for Changing Direction, Etc.
+
+The actual generation of run end lists (edge boundaries) is left
+to the low level rasterizing modules, LINES and CURVES. There
+are some global region-type
+questions that occur when doing a low-level
+rasterization:
+:ol.
+:li.Did we just change direction in Y and therefore need to start
+a new edge?
+:li.Did we run out of allocated edge space?
+:li.Do the minimum or maximum X values for the current edge need
+updating?
+:eol.
+In general the REGIONS is not smart enough to answer those questions
+itself. (For example, determining if and when a curve changes direction
+may need detailed curve knowledge.) Yet, this must be done efficiently.
+We provide a macro "GOING_TO" where the invoker tells us where it is
+heading for (x2,y2), plus where it is now (x1,y1), plus the current
+region under construction, and the macro answers the questions above.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h2.Data Structures Used to Represent Regions
+
+:h3.The "region" Structure
+
+The region structure is an anchor for a linked list of "edgelist"
+structures (see :hdref refid=edgelist..). It also summarizes the
+information in the edgelist structures (for example, the bounding
+box of the region). And, it contains scratch areas used during
+the creation of a region.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+The ISOPTIMIZED flag tells us if we've put a permanent region in
+'optimal' form.
+*/
+#define ISOPTIMIZED(flag) ((flag)&0x10)
+
+/*
+The ISRECTANGULAR flag tells us if a region is a rectangle. We don't
+always notice rectangles--if this flag is set, the region definitely
+is a rectangle, but some rectangular regions will not have the flag
+set. The flag is used to optimize some paths.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h4."INFINITY" - A Constant Region Structure of Infinite Extent
+
+Infinity is the complement of a null area:
+Note - removed the refcount = 1 init, replaced with references = 2 3-26-91 PNM
+*/
+static struct region t1_infinity = { REGIONTYPE,
+ ISCOMPLEMENT(ON)+ISINFINITE(ON)+ISPERMANENT(ON)+ISIMMORTAL(ON), 2,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ NULL, NULL,
+ 0, 0, 0, 0, 0, NULL, NULL,
+ NULL, 0, NULL, NULL };
+struct region *INFINITY = &t1_infinity;
+
+/*
+:h4."EmptyRegion" - A Region Structure with Zero Area
+
+This structure is used to initialize the region to be built in
+Interior():
+Note - replaced refcount = 1 init with references = 2 3-26-91 PNM
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+struct region EmptyRegion = { REGIONTYPE,
+ ISPERMANENT(ON)+ISIMMORTAL(ON), 2,
+ 0, 0, 0, 0,
+ MAXPEL, MAXPEL, MINPEL, MINPEL,
+ NULL, NULL,
+ 0, 0, 0, 0, 0, NULL, NULL,
+ NULL, 0, NULL, NULL };
+
+/*
+:h3 id=edgelist.The "edgelist" Structure
+
+Regions are represented by a linked list of 'edgelist' structures.
+When a region is complete, the structures are paired, one for the
+left and one for the right edge. While a region is being built,
+this rule may be violated temporarily.
+
+An 'edgelist' structure contains the X values for a given span
+of Y values. The (X,Y) pairs define an edge. We use the crack
+and edge coordinate system, so that integer values of X and Y
+go between pels. The edge is defined between the minimum Y and
+maximum Y.
+
+The linked list is kept sorted from top to bottom, that is, in
+increasing y. Also, if 'e1' is an edgelist structure and 'e2' is the
+next one in the list, they must have exactly the same ymin,ymax values
+or be totally disjoint. These two requirements mean that if e2's ymin
+is less than e1's ymax, it must be exactly equal to e1's ymin. A
+sublist of structures with identical ymin and ymax values is called a
+'swath'.
+
+In addition, edgelist structures are separately linked together based
+on what subpath originally created them; each subpath is kept as a
+separate circular linked list. This information is ignored unless
+continuity checking is invoked. See :hdref refid=subpath. for a
+complete description of this.
+*/
+
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+The "edgelist" structure follows the convention of TYPE1IMAGER user
+objects, having a type field and a flag field as the first two
+elements. However, the user never sees "edgelist" structures
+directly; he is given handles to "region" structures only.
+
+By having a type field, we can use the "copy" feature of Allocate()
+to duplicate edge lists quickly.
+
+We also define two flag bits for this structure. The ISDOWN bit is set
+if the edge is going in the direction of increasing Y. The ISAMBIGUOUS
+bit is set if the edge is identical to its neighbor (edge->link); such
+edges may be "left" when they should be "right", or vice versa,
+unnecessarily confusing the continuity checking logic. The FixSubPaths()
+routine in HINTS will swap ambiguous edges if that avoids crossing edges;
+see :hdref refid=fixsubp..
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.KillRegion() - Destroys a Region
+
+KillRegion nominally just decrements the reference count to that region.
+If the reference count becomes 0, all memory associated with it is
+freed. We just follow the linked list, freeing as we go, then kill any
+associated (thresholded) picture.
+Note - added conditional return based on references 3-26-91 PNM
+*/
+
+void KillRegion(area)
+ register struct region *area; /* area to free */
+{
+ register struct edgelist *p; /* loop variable */
+ register struct edgelist *next; /* loop variable */
+
+ if (area->references < 0)
+ t1_abort("KillRegion: negative reference count");
+ if ( (--(area->references) > 1) ||
+ ( (area->references == 1) && !ISPERMANENT(area->flag) ) )
+ return;
+
+ for (p=area->anchor; p != NULL; p=next) {
+ next = p->link;
+ Free(p);
+ }
+ if (area->thresholded != NULL)
+ KillPicture(area->thresholded);
+ Free(area);
+}
+/*
+:h3.CopyRegion() - Makes a Copy of a Region
+*/
+struct region *CopyRegion(area)
+ register struct region *area; /* region to duplicate */
+{
+ register struct region *r; /* output region built here */
+ register struct edgelist *last; /* loop variable */
+ register struct edgelist *p,*newp; /* loop variables */
+
+ r = (struct region *)Allocate(sizeof(struct region), area, 0);
+ r->anchor = NULL;
+
+ for (p=area->anchor; VALIDEDGE(p); p=p->link) {
+
+ newp = NewEdge(p->xmin, p->xmax, p->ymin, p->ymax, p->xvalues, ISDOWN(p->flag));
+ if (r->anchor == NULL)
+ r->anchor = last = newp;
+ else
+ last->link = newp;
+
+ last = newp;
+ }
+ if (area->thresholded != NULL)
+ /* replaced DupPicture with Dup() 3-26-91 PNM */
+ r->thresholded = (struct picture *)Dup(area->thresholded);
+ return(r);
+}
+/*
+:h4.NewEdge() - Allocates and Returns a New "edgelist" Structure
+
+We allocate space for the X values contiguously with the 'edgelist'
+structure that locates them. That way, we only have to free the
+edgelist structure to free all memory associated with it. Damn
+clever, huh?
+*/
+
+static struct edgelist *NewEdge(xmin, xmax, ymin, ymax, xvalues, isdown)
+ pel xmin,xmax; /* X extent of edge */
+ pel ymin,ymax; /* Y extent of edge */
+ pel *xvalues; /* list of X values for entire edge */
+ int isdown; /* flag: TRUE means edge progresses downward */
+{
+ static struct edgelist template = {
+ EDGETYPE, 0, 1, NULL, NULL,
+ 0, 0, 0, 0, NULL };
+
+ register struct edgelist *r; /* returned structure */
+ register int iy; /* ymin adjusted for 'long' alignment purposes */
+
+ IfTrace2((RegionDebug),"....new edge: ymin=%d, ymax=%d ",
+ (LONG)ymin, (LONG) ymax);
+ if (ymin >= ymax)
+ t1_abort("newedge: height not positive");
+/*
+We are going to copy the xvalues into a newly allocated area. It
+helps performance if the values are all "long" aligned. We can test
+if the xvalues are long aligned by ANDing the address with the
+(sizeof(long) - 1)--if non zero, the xvalues are not aligned well. We
+set 'iy' to the ymin value that would give us good alignment:
+*/
+#if defined (__alpha)
+ iy = ymin - (((long) xvalues) & (sizeof(LONG) - 1)) / sizeof(pel);
+#else
+ iy = ymin - (((int) xvalues) & (sizeof(LONG) - 1)) / sizeof(pel);
+#endif
+ r = (struct edgelist *)Allocate(sizeof(struct edgelist), &template,
+ (ymax - iy) * sizeof(pel));
+
+ if (isdown) r->flag = ISDOWN(ON);
+ r->xmin = xmin;
+ r->xmax = xmax;
+ r->ymin = ymin;
+ r->ymax = ymax;
+
+ r->xvalues = (pel *) FOLLOWING(r);
+ if (ymin != iy) {
+ r->xvalues += ymin - iy;
+ xvalues -= ymin - iy;
+ }
+
+/*
+We must round up (ymax - iy) so we get the ceiling of the number of
+longs. The destination must be able to hold these extra bytes because
+Allocate() makes everything it allocates be in multiples of longs.
+*/
+ LONGCOPY(&r[1], xvalues, (ymax - iy) * sizeof(pel) + sizeof(LONG) - 1);
+
+ IfTrace1((RegionDebug),"result=%x\n", r);
+ return(r);
+}
+
+/*
+:h2.Building Regions
+
+:h3.Interior() - Iterate Through a Path, Building a Region
+
+This routine is the workhorse driver routine that iterates through a
+path, calling the appropriate stepping routines to actually produce the
+run end "edgelist" structures.
+
+:ol.
+:li."Interior" calls StepLine or StepConic or StepBezier as appropriate
+to produce run ends.
+:li.Occasionally these routines will notice a change in Y direction
+and will call ChangeDirection (through the GOING_TO macro); this is
+a call back to the REGIONS module.
+:li.ChangeDirection will call whatever function is in the region
+structure; for Interior, this function is 'newfilledge'.
+:li.Newfilledge will call NewEdge to create a new edgelist structure,
+then, call SortSwath to sort it onto the linked list being built at
+the region "anchor".
+:eol.
+
+By making the function called by ChangeDirection be a parameter of the
+region, we allow the same ChangeDirection logic to be used by stroking.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+struct region *Interior(p, fillrule)
+ register struct segment *p; /* take interior of this path */
+ register int fillrule; /* rule to follow if path crosses itself */
+{
+ register fractpel x,y; /* keeps ending point of path segment */
+ fractpel lastx,lasty; /* previous x,y from path segment before */
+ register struct region *R; /* region I will build */
+ register struct segment *nextP; /* next segment of path */
+ struct fractpoint hint; /* accumulated hint value */
+ char tempflag; /* flag; is path temporary? */
+ char Cflag; /* flag; should we apply continuity? */
+
+ IfTrace2((MustTraceCalls),". INTERIOR(%x, %d)\n", p, (LONG) fillrule);
+
+ if (p == NULL)
+ return(NULL);
+/*
+Establish the 'Cflag' continuity flag based on user's fill rule and
+our own 'Continuity' pragmatic (0: never do continuity, 1: do what
+user asked, >1: do it regardless).
+*/
+ if (fillrule > 0) {
+ Cflag = Continuity > 0;
+ fillrule -= CONTINUITY;
+ }
+ else
+ Cflag = Continuity > 1;
+
+ ARGCHECK((fillrule != WINDINGRULE && fillrule != EVENODDRULE),
+ "Interior: bad fill rule", NULL, NULL, (1,p), struct region *);
+
+ if (p->type == TEXTTYPE)
+/* if (fillrule != EVENODDRULE)
+ else */
+ return((struct region *)UniquePath(p));
+ if (p->type == STROKEPATHTYPE)
+ if (fillrule == WINDINGRULE)
+ return((struct region *)DoStroke(p));
+ else
+ p = CoercePath(p);
+
+ R = (struct region *)Allocate(sizeof(struct region), &EmptyRegion, 0);
+
+ ARGCHECK(!ISPATHANCHOR(p), "Interior: bad path", p, R, (0), struct region *);
+ ARGCHECK((p->type != MOVETYPE), "Interior: path not closed", p, R, (0), struct region *);
+
+
+/* changed definition from !ISPERMANENT to references <= 1 3-26-91 PNM */
+ tempflag = (p->references <= 1); /* only first segment in path is so marked */
+ if (!ISPERMANENT(p->flag)) p->references -= 1;
+
+ R->newedgefcn = newfilledge;
+/*
+Believe it or not, "R" is now completely initialized. We are counting
+on the copy of template to get other fields the way we want them,
+namely
+:ol.
+:li.anchor = NULL
+:li.xmin, ymin, xmax, ymax, to minimum and maximum values respectively.
+:eol.
+Anchor = NULL is very
+important to ChangeDirection.
+See :hdref refid=CD..
+
+To minimize problems of "wrapping" in our pel arithmetic, we keep an
+origin of the region which is the first move. Hopefully, that keeps
+numbers within plus or minus 32K pels.
+*/
+ R->origin.x = 0/*TOFRACTPEL(NEARESTPEL(p->dest.x))*/;
+ R->origin.y = 0/*TOFRACTPEL(NEARESTPEL(p->dest.y))*/;
+ lastx = - R->origin.x;
+ lasty = - R->origin.y;
+/*
+ChangeDirection initializes other important fields in R, such as
+lastdy, edge, edgeYstop, edgexmin, and edgexmax. The first segment
+is a MOVETYPE, so it will be called first.
+*/
+/*
+The hints data structure must be initialized once for each path.
+*/
+
+ if (ProcessHints)
+ InitHints(); /* initialize hint data structure */
+
+ while (p != NULL) {
+
+ x = lastx + p->dest.x;
+ y = lasty + p->dest.y;
+
+ IfTrace2((HintDebug > 0),"Ending point = (%p,%p)\n", x, y);
+
+ nextP = p->link;
+
+/*
+Here we start the hints processing by initializing the hint value to
+zero. If ProcessHints is FALSE, the value will remain zero.
+Otherwise, hint accumulates the computed hint values.
+*/
+
+ hint.x = hint.y = 0;
+
+/*
+If we are processing hints, and this is a MOVE segment (other than
+the first on the path), we need to close (reverse) any open hints.
+*/
+
+ if (ProcessHints)
+ if ((p->type == MOVETYPE) && (p->last == NULL)) {
+ CloseHints(&hint);
+ IfTrace2((HintDebug>0),"Closed point= (%p,%p)\n",
+ x+hint.x, y+hint.y);
+ }
+
+/*
+Next we run through all the hint segments (if any) attached to this
+segment. If ProcessHints is TRUE, we will accumulate computed hint
+values. In either case, nextP will be advanced to the first non-HINT
+segment (or NULL), and each hint segment will be freed if necessary.
+*/
+
+ while ((nextP != NULL) && (nextP->type == HINTTYPE)) {
+ if (ProcessHints)
+ ProcessHint(nextP, x + hint.x, y + hint.y, &hint);
+
+ {
+ register struct segment *saveP = nextP;
+
+ nextP = nextP->link;
+ if (tempflag)
+ Free(saveP);
+ }
+ }
+
+/*
+We now apply the full hint value to the ending point of the path segment.
+*/
+
+ x += hint.x;
+ y += hint.y;
+
+ IfTrace2((HintDebug>0),"Hinted ending point = (%p,%p)\n", x, y);
+
+ switch(p->type) {
+
+ case LINETYPE:
+ StepLine(R, lastx, lasty, x, y);
+ break;
+
+ case CONICTYPE:
+ {
+
+/*
+For a conic curve, we apply half the hint value to the conic midpoint.
+*/
+
+ }
+ break;
+
+ case BEZIERTYPE:
+ {
+ register struct beziersegment *bp = (struct beziersegment *) p;
+
+/*
+For a Bezier curve, we apply the full hint value to the Bezier C point.
+*/
+
+ StepBezier(R, lastx, lasty,
+ lastx + bp->B.x, lasty + bp->B.y,
+ lastx + bp->C.x + hint.x,
+ lasty + bp->C.y + hint.y,
+ x, y);
+ }
+ break;
+
+ case MOVETYPE:
+/*
+At this point we have encountered a MOVE segment. This breaks the
+path, making it disjoint.
+*/
+ if (p->last == NULL) /* i.e., not first in path */
+ ChangeDirection(CD_LAST, R, lastx, lasty, (fractpel) 0);
+
+ ChangeDirection(CD_FIRST, R, x, y, (fractpel) 0);
+/*
+We'll just double check for closure here. We forgive an appended
+MOVETYPE at the end of the path, if it isn't closed:
+*/
+ if (!ISCLOSED(p->flag) && p->link != NULL)
+ return((struct region *)ArgErr("Fill: sub-path not closed", p, NULL));
+ break;
+
+ default:
+ t1_abort("Interior: path type error");
+ }
+/*
+We're done with this segment. Advance to the next path segment in
+the list, freeing this one if necessary:
+*/
+ lastx = x; lasty = y;
+
+ if (tempflag)
+ Free(p);
+ p = nextP;
+ }
+ ChangeDirection(CD_LAST, R, lastx, lasty, (fractpel) 0);
+ R->ending.x = lastx;
+ R->ending.y = lasty;
+/*
+Finally, clean up the region's based on the user's 'fillrule' request:
+*/
+ if (Cflag)
+ ApplyContinuity(R);
+ if (fillrule == WINDINGRULE)
+ Unwind(R->anchor);
+ return(R);
+}
+/*
+:h4.Unwind() - Discards Edges That Fail the Winding Rule Test
+
+The winding rule says that upward going edges should be paired with
+downward going edges only, and vice versa. So, if two upward edges
+or two downward edges are nominally left/right pairs, Unwind() should
+discard the second one. Everything should balance; we should discard
+an even number of edges; of course, we abort if we don't.
+*/
+static int Unwind(area)
+ register struct edgelist *area; /* input area modified in place */
+{
+ register struct edgelist *last,*next; /* struct before and after current one */
+ register int y; /* ymin of current swath */
+ register int count,newcount; /* winding count registers */
+
+ IfTrace1((RegionDebug>0),"...Unwind(%x)\n", area);
+
+ while (VALIDEDGE(area)) {
+
+ count = 0;
+ y = area->ymin;
+
+ do {
+ next = area->link;
+
+ if (ISDOWN(area->flag))
+ newcount = count + 1;
+ else
+ newcount = count - 1;
+
+ if (count == 0 || newcount == 0)
+ last = area;
+ else
+ discard(last, next);
+
+ count = newcount;
+ area = next;
+
+ } while (area != NULL && area->ymin == y);
+
+ if (count != 0)
+ t1_abort("Unwind: uneven edges");
+ }
+}
+/*
+:h3."workedge" Array
+
+This is a statically allocated array where edges are built
+before being copied into more permanent storage by NewEdge().
+*/
+
+#ifndef MAXEDGE
+#define MAXEDGE 1000
+#endif
+
+static pel workedge[MAXEDGE];
+static pel *currentworkarea = workedge;
+static pel currentsize = MAXEDGE;
+
+/*
+:h3 id=cd.ChangeDirection() - Called When Y Direction Changes
+
+The rasterizing routines call this entry point when they detect
+a change in Y. We then build the current edge and sort it into
+emerging edgelist at 'anchor' by calling whatever "newedgefcn"
+is appropriate.
+*/
+
+void ChangeDirection(type, R, x, y, dy)
+ int type; /* CD_FIRST, CD_CONTINUE, or CD_LAST */
+ register struct region *R; /* region in which we are changing direction */
+ fractpel x,y; /* current beginning x,y */
+ fractpel dy; /* direction and magnitude of change in y */
+{
+ register fractpel ymin,ymax; /* minimum and maximum Y since last call */
+ register fractpel x_at_ymin,x_at_ymax; /* their respective X's */
+ register pel iy; /* nearest integer pel to 'y' */
+ register pel idy; /* nearest integer pel to 'dy' */
+ register int ydiff; /* allowed Y difference in 'currentworkarea' */
+
+ IfTrace4((RegionDebug>0),"Change Y direction (%d) from (%p,%p), dy=%p\n",
+ (LONG) type, x, y, dy);
+
+ if (type != CD_FIRST) {
+
+ if (R->lastdy > 0) {
+ ymin = R->firsty;
+ x_at_ymin = R->firstx;
+ ymax = y;
+ x_at_ymax = x;
+ }
+ else {
+ ymin = y;
+ x_at_ymin = x;
+ ymax = R->firsty;
+ x_at_ymax = R->firstx;
+ }
+
+ if (ymax < ymin)
+ t1_abort("negative sized edge?");
+
+
+ /* FIXME: there are not as much parameters as here. */
+ (*R->newedgefcn)(R, R->edgexmin, R->edgexmax, ymin, ymax,
+ R->lastdy > 0 /*, x_at_ymin, x_at_ymax */);
+
+ }
+
+ R->firsty = y;
+ R->firstx = x;
+ R->lastdy = dy;
+
+ iy = NEARESTPEL(y);
+ idy = NEARESTPEL(dy);
+ if (currentworkarea != workedge && idy < MAXEDGE && idy > -MAXEDGE) {
+ NonObjectFree(currentworkarea);
+ currentworkarea = workedge;
+ currentsize = MAXEDGE;
+ }
+ ydiff = currentsize - 1;
+ if (dy > 0) {
+ R->edge = &currentworkarea[-iy];
+ R->edgeYstop = TOFRACTPEL(ydiff + iy) + FPHALF;
+ }
+ else {
+ R->edge = &currentworkarea[ydiff - iy];
+ R->edgeYstop = TOFRACTPEL(iy - ydiff) - FPHALF;
+ }
+ R->edgexmax = R->edgexmin = x;
+/*
+If this is the end of a subpath, we complete the subpath circular
+chain:
+*/
+ if (type == CD_LAST && R->lastedge != NULL) {
+ register struct edgelist *e = R->firstedge;
+
+ while (e->subpath != NULL)
+ e = e->subpath;
+ e->subpath = R->lastedge;
+ R->lastedge = R->firstedge = NULL;
+ }
+}
+/*
+:h3 id=newfill.newfilledge() - Called When We Have a New Edge While Filling
+
+This is the prototypical "newedge" function passed to "Rasterize" and
+stored in "newedgefcn" in the region being built.
+
+If the edge is non-null, we sort it onto the list of edges we are
+building at "anchor".
+
+This function also has to keep the bounding box of the region
+up to date.
+*/
+
+#ifdef HAVE_PROTOTYPES
+static void newfilledge(register struct region *R,
+ fractpel xmin, fractpel xmax, fractpel ymin, fractpel ymax, int isdown)
+#else
+static int newfilledge(R, xmin, xmax, ymin, ymax, isdown)
+ register struct region *R; /* region being built */
+ fractpel xmin,xmax; /* X range of this edge */
+ fractpel ymin,ymax; /* Y range of this edge */
+ int isdown; /* flag: TRUE means edge goes down, else up */
+#endif
+{
+ struct edgelist *swathxsort(); /* 'SortSwath' function */
+
+ register pel pelxmin,pelymin,pelxmax,pelymax; /* pel versions of bounds */
+ register struct edgelist *edge; /* newly created edge */
+
+ pelymin = NEARESTPEL(ymin);
+ pelymax = NEARESTPEL(ymax);
+ if (pelymin == pelymax)
+ return;
+
+ pelxmin = NEARESTPEL(xmin);
+ pelxmax = NEARESTPEL(xmax);
+
+ if (pelxmin < R->xmin) R->xmin = pelxmin;
+ if (pelxmax > R->xmax) R->xmax = pelxmax;
+ if (pelymin < R->ymin) R->ymin = pelymin;
+ if (pelymax > R->ymax) R->ymax = pelymax;
+
+ edge = NewEdge(pelxmin, pelxmax, pelymin, pelymax, &R->edge[pelymin], isdown);
+ edge->subpath = R->lastedge;
+ R->lastedge = edge;
+ if (R->firstedge == NULL)
+ R->firstedge = edge;
+
+ R->anchor = SortSwath(R->anchor, edge, swathxsort);
+
+}
+
+/*
+:h2.Sorting Edges
+
+:h3.SortSwath() - Vertically Sort an Edge into a Region
+
+This routine sorts an edge or a pair of edges into a growing region,
+so that the region maintains its top-to-bottom, left-to-right form.
+The rules for sorting horizontally may vary depending on what you
+are doing, but the rules for vertical sorting are always the same.
+This routine is passed an argument that is a function that will
+perform the horizontal sort on demand (for example, swathxsort() or
+SwathUnion()).
+
+This is a recursive routine. A new edge (or edge pair) may overlap
+the list I am building in strange and wonderful ways. Edges may
+cross. When this happens, my strategy is to split the incoming edge
+(or the growing list) in two at that point, execute the actual sort on
+the top part of the split, and recursively call myself to figure out
+exactly where the bottom part belongs.
+*/
+
+#define TOP(e) ((e)->ymin) /* the top of an edge (for readability */
+#define BOTTOM(e) ((e)->ymax) /* the bottom of an edge (for readability */
+
+struct edgelist *SortSwath(anchor, edge, swathfcn)
+ struct edgelist *anchor; /* list being built */
+ register struct edgelist *edge; /* incoming edge or pair of edges */
+ struct edgelist *(*swathfcn)(); /* horizontal sorter */
+{
+ register struct edgelist *before,*after;
+ struct edgelist base;
+
+ if (RegionDebug > 0) {
+ if (RegionDebug > 2) {
+ IfTrace3(TRUE,"SortSwath(anchor=%x, edge=%x, fcn=%x)\n",
+ anchor, edge, swathfcn);
+ }
+ else {
+ IfTrace3(TRUE,"SortSwath(anchor=%x, edge=%x, fcn=%x)\n",
+ anchor, edge, swathfcn);
+ }
+ }
+ if (anchor == NULL)
+ return(edge);
+
+ before = &base;
+ before->ymin = before->ymax = MINPEL;
+ before->link = after = anchor;
+
+/*
+If the incoming edge is above the current list, we connect the current
+list to the bottom of the incoming edge. One slight complication is
+if the incoming edge overlaps into the current list. Then, we
+first split the incoming edge in two at the point of overlap and recursively
+call ourselves to sort the bottom of the split into the current list:
+*/
+ if (TOP(edge) < TOP(after)) {
+ if (BOTTOM(edge) > TOP(after)) {
+
+ after = SortSwath(after, splitedge(edge, TOP(after)), swathfcn);
+ }
+ vertjoin(edge, after);
+ return(edge);
+ }
+/*
+At this point the top of edge is not higher than the top of the list,
+which we keep in 'after'. We move the 'after' point down the list,
+until the top of the edge occurs in the swath beginning with 'after'.
+
+If the bottom of 'after' is below the bottom of the edge, we have to
+split the 'after' swath into two parts, at the bottom of the edge.
+If the bottom of 'after' is above the bottom of the swath,
+*/
+
+ while (VALIDEDGE(after)) {
+
+ if (TOP(after) == TOP(edge)) {
+ if (BOTTOM(after) > BOTTOM(edge))
+ vertjoin(after, splitedge(after, BOTTOM(edge)));
+ else if (BOTTOM(after) < BOTTOM(edge)) {
+ after = SortSwath(after,
+ splitedge(edge, BOTTOM(after)), swathfcn);
+ }
+ break;
+ }
+ else if (TOP(after) > TOP(edge)) {
+ IfTrace0((BOTTOM(edge) < TOP(after) && RegionDebug > 0),
+ "SortSwath: disjoint edges\n");
+ if (BOTTOM(edge) > TOP(after)) {
+ after = SortSwath(after,
+ splitedge(edge, TOP(after)), swathfcn);
+ }
+ break;
+ }
+ else if (BOTTOM(after) > TOP(edge))
+ vertjoin(after, splitedge(after, TOP(edge)));
+
+ before = after;
+ after = after->link;
+ }
+
+/*
+At this point 'edge' exactly corresponds in height to the current
+swath pointed to by 'after'.
+*/
+ if (after != NULL && TOP(after) == TOP(edge)) {
+ before = (*swathfcn)(before, edge);
+ after = before->link;
+ }
+/*
+At this point 'after' contains all the edges after 'edge', and 'before'
+contains all the edges before. Whew! A simple matter now of adding
+'edge' to the linked list in its rightful place:
+*/
+ before->link = edge;
+ if (RegionDebug > 1) {
+ IfTrace3(TRUE,"SortSwath: in between %x and %x are %x",
+ before, after, edge);
+ while (edge->link != NULL) {
+ edge = edge->link;
+ IfTrace1(TRUE," and %x", edge);
+ }
+ IfTrace0(TRUE,"\n");
+ }
+ else
+ for (; edge->link != NULL; edge = edge->link) { ; }
+
+ edge->link = after;
+ return(base.link);
+}
+
+/*
+:h3.splitedge() - Split an Edge or Swath in Two at a Given Y Value
+
+This function returns the edge or swath beginning at the Y value, and
+is guaranteed not to change the address of the old swath while splitting
+it.
+*/
+
+static struct edgelist *splitedge(list, y)
+ struct edgelist *list; /* area to split */
+ register pel y; /* Y value to split list at */
+{
+ register struct edgelist *new; /* anchor for newly built list */
+ register struct edgelist *last; /* end of newly built list */
+ register struct edgelist *r; /* temp pointer to new structure */
+ register struct edgelist *lastlist; /* temp pointer to last 'list' value */
+
+ IfTrace2((RegionDebug > 1),"splitedge of %x at %d ", list, (LONG) y);
+
+ lastlist = new = NULL;
+
+ while (list != NULL) {
+ if (y < list->ymin)
+ break;
+ if (y >= list->ymax)
+ t1_abort("splitedge: above top of list");
+ if (y == list->ymin)
+ t1_abort("splitedge: would be null");
+
+ r = (struct edgelist *)Allocate(sizeof(struct edgelist), list, 0);
+/*
+At this point 'r' points to a copy of the single structure at 'list'.
+We will make 'r' be the new split 'edgelist'--the lower half.
+We don't bother to correct 'xmin' and 'xmax', we'll take the
+the pessimistic answer that results from using the old values.
+*/
+ r->ymin = y;
+ r->xvalues = list->xvalues + (y - list->ymin);
+/*
+Note that we do not need to allocate new memory for the X values,
+they can remain with the old "edgelist" structure. We do have to
+update that old structure so it is not as high:
+*/
+ list->ymax = y;
+/*
+Insert 'r' in the subpath chain:
+*/
+ r->subpath = list->subpath;
+ list->subpath = r;
+/*
+Now attach 'r' to the list we are building at 'new', and advance
+'list' to point to the next element in the old list:
+*/
+ if (new == NULL)
+ new = r;
+ else
+ last->link = r;
+ last = r;
+ lastlist = list;
+ list = list->link;
+ }
+/*
+At this point we have a new list built at 'new'. We break the old
+list at 'lastlist', and add the broken off part to the end of 'new'.
+Then, we return the caller a pointer to 'new':
+*/
+ if (new == NULL)
+ t1_abort("null splitedge");
+ lastlist->link = NULL;
+ last->link = list;
+ IfTrace1((RegionDebug > 1),"yields %x\n", new);
+ return(new);
+}
+
+/*
+:h3.vertjoin() - Join Two Disjoint Edge Lists Vertically
+
+The two edges must be disjoint vertically.
+*/
+#ifdef HAVE_PROTOTYPES
+static void vertjoin(register struct edgelist *top,
+ register struct edgelist *bottom)
+#else
+static int vertjoin(top, bottom)
+ register struct edgelist *top; /* uppermost region */
+ register struct edgelist *bottom; /* bottommost region */
+#endif
+{
+ if (BOTTOM(top) > TOP(bottom))
+ t1_abort("vertjoin not disjoint");
+
+ for (; top->link != NULL; top=top->link) { ; }
+
+ top->link = bottom;
+ return;
+}
+
+/*
+:h3.swathxsort() - Sorting by X Values
+
+We need to sort 'edge' into its rightful
+place in the swath by X value, taking care that we do not accidentally
+advance to the next swath while searching for the correct X value. Like
+all swath functions, this function returns a pointer to the edge
+BEFORE the given edge in the sort.
+*/
+
+struct edgelist *swathxsort(before0, edge)
+ register struct edgelist *before0; /* edge before this swath */
+ register struct edgelist *edge; /* input edge */
+{
+ register struct edgelist *before;
+ register struct edgelist *after;
+ register pel y;
+
+ before = before0;
+ after = before->link;
+
+ while (after != NULL && TOP(after) == TOP(edge)) {
+
+ register pel *x1,*x2;
+
+ y = TOP(edge);
+ x1 = after->xvalues;
+ x2 = edge->xvalues;
+
+ while (y < BOTTOM(edge) && *x1 == *x2) {
+ x1++; x2++; y++;
+ }
+ if (y >= BOTTOM(edge)) {
+ edge->flag |= ISAMBIGUOUS(ON);
+ after->flag |= ISAMBIGUOUS(ON);
+ break;
+ }
+
+ if (*x1 >= *x2)
+ break;
+
+ before = after;
+ after = after->link;
+ }
+
+/*
+At this point, 'edge' is between 'before' and 'after'. If 'edge' didn't
+cross either of those other edges, we would be done. We check for
+crossing. If it does cross, we split the problem up by calling SortSwath
+recursively with the part of the edge that is below the crossing point:
+*/
+{
+ register int h0,h; /* height of edge--number of scans */
+
+ h0 = h = BOTTOM(edge) - y;
+ y -= TOP(edge);
+
+ if (h0 <= 0) {
+ IfTrace0((RegionDebug>0),"swathxsort: exactly equal edges\n");
+ return(before);
+ }
+
+ if (TOP(before) == TOP(edge))
+ h -= crosses(h, &before->xvalues[y], &edge->xvalues[y]);
+ if (after != NULL && TOP(after) == TOP(edge))
+ h -= crosses(h, &edge->xvalues[y], &after->xvalues[y]);
+
+ if (h < h0) {
+ SortSwath(before0->link,
+ splitedge(edge, TOP(edge) + y + h),
+ swathxsort);
+
+ }
+}
+
+ return(before);
+}
+/*
+:h3.SwathUnion() - Union Two Edges by X Value
+
+We have a left and right edge that must be unioned into a growing
+swath. If they are totally disjoint, they are just added in. The
+fun comes in they overlap the existing edges. Then some edges
+will disappear.
+*/
+
+struct edgelist *SwathUnion(before0, edge)
+ register struct edgelist *before0; /* edge before the swath */
+ register struct edgelist *edge; /* list of two edges to be unioned */
+{
+ register int h; /* saves height of edge */
+ register struct edgelist *rightedge; /* saves right edge of 'edge' */
+ register struct edgelist *before,*after; /* edge before and after */
+ int h0; /* saves initial height */
+
+ IfTrace2((RegionDebug > 1),"SwathUnion entered, before=%x, edge=%x\n",
+ before0, edge);
+
+ h0 = h = edge->ymax - edge->ymin;
+ if (h <= 0)
+ t1_abort("SwathUnion: 0 height swath?");
+
+ before = before0;
+ after = before->link;
+
+ while (after != NULL && TOP(after) == TOP(edge)) {
+ register struct edgelist *right;
+
+ right = after->link;
+ if (right->xvalues[0] >= edge->xvalues[0])
+ break;
+ before = right;
+ after = before->link;
+ }
+/*
+This is the picture at this point. 'L' indicates a left hand edge,
+'R' indicates the right hand edge.
+'<--->' indicates the degree of uncertainty as to its placement
+relative to other edges:
+:xmp atomic.
+ before after
+ R <---L----> R L R L R
+ <---L---> <------R-------------------------->
+ edge
+:exmp.
+In case the left of 'edge' touches 'before', we need to reduce
+the height by that amount.
+*/
+ if (TOP(before) == TOP(edge))
+ h -= touches(h, before->xvalues, edge->xvalues);
+
+ rightedge = edge->link;
+
+ if (after == NULL || TOP(after) != TOP(edge) ||
+ after->xvalues[0] > rightedge->xvalues[0]) {
+ IfTrace2((RegionDebug > 1),
+ "SwathUnion starts disjoint: before=%x after=%x\n",
+ before, after);
+/*
+On this side of the the above 'if', the new edge is disjoint from the
+existing edges in the swath. This is the picture:
+:xmp atomic.
+ before after
+ R L R L R L R
+ L R
+ edge
+:exmp.
+We will verify it remains disjoint for the entire height. If the
+situation changes somewhere down the edge, we split the edge at that
+point and recursively call ourselves (through 'SortSwath') to figure
+out the new situation:
+*/
+ if (after != NULL && TOP(after) == TOP(edge))
+ h -= touches(h, rightedge->xvalues, after->xvalues);
+ if (h < h0)
+ SortSwath(before0->link, splitedge(edge, edge->ymin + h), t1_SwathUnion);
+ /* go to "return" this edge pair; it is totally disjoint */
+ }
+ else {
+/*
+At this point, at the 'else', we know that the
+new edge overlaps one or more pairs in the existing swath. Here is
+a picture of our knowledge and uncertainties:
+:xmp atomic.
+ before after
+ R L R L R L R
+ <---L---> <---R------------------->
+ edge
+:exmp.
+We need to move 'after' along until it is to the right of the
+right of 'edge'. ('After' should always point to a left edge of a pair:)
+*/
+ register struct edgelist *left; /* variable to keep left edge in */
+
+ do {
+ left = after;
+ after = (after->link)->link;
+
+ } while (after != NULL && TOP(after) == TOP(edge)
+ && after->xvalues[0] <= rightedge->xvalues[0]);
+/*
+At this point this is the picture:
+:xmp atomic.
+ before left after
+ R L R L R L R
+ <---L---> <---R--->
+ edge
+:exmp.
+We need to verify that the situation stays like this all the way
+down the edge. Again, if the
+situation changes somewhere down the edge, we split the edge at that
+point and recursively call ourselves (through 'SortSwath') to figure
+out the new situation:
+*/
+
+ h -= crosses(h, left->xvalues, rightedge->xvalues);
+ h -= crosses(h, edge->xvalues, ((before->link)->link)->xvalues);
+
+ if (after != NULL && TOP(after) == TOP(edge))
+
+ h -= touches(h, rightedge->xvalues, after->xvalues);
+
+ IfTrace3((RegionDebug > 1),
+ "SwathUnion is overlapped until %d: before=%x after=%x\n",
+ (LONG) TOP(edge) + h, before, after);
+/*
+OK, if we touched either of our neighbors we need to split at that point
+and recursively sort the split edge onto the list. One tricky part
+is that when we recursively sort, 'after' will change if it was not
+in our current swath:
+*/
+ if (h < h0) {
+ SortSwath(before0->link,
+ splitedge(edge, edge->ymin + h),
+ t1_SwathUnion);
+
+ if (after == NULL || TOP(after) != TOP(edge))
+ for (after = before0->link;
+ TOP(after) == TOP(edge);
+ after = after->link) { ; }
+ }
+/*
+Now we need to augment 'edge' by the left and right of the overlapped
+swath, and to discard all edges between before and after, because they
+were overlapped and have been combined with the new incoming 'edge':
+*/
+ edge->xmin = MIN(edge->xmin, (before->link)->xmin);
+ edge->xmax = MIN(edge->xmax, (before->link)->xmax);
+ edgemin(h, edge->xvalues, (before->link)->xvalues);
+ rightedge->xmin = MAX(rightedge->xmin, (left->link)->xmin);
+ rightedge->xmax = MAX(rightedge->xmax, (left->link)->xmax);
+ edgemax(h, rightedge->xvalues, (left->link)->xvalues);
+ discard(before, after);
+ }
+ return(before);
+}
+/*
+:h3.swathrightmost() - Simply Sorts New Edge to Rightmost of Swath
+
+Like all swath functions, this function returns a pointer to the edge
+BEFORE the given edge in the sort.
+*/
+
+struct edgelist *swathrightmost(before, edge)
+ register struct edgelist *before; /* edge before this swath */
+ register struct edgelist *edge; /* input edge */
+{
+ register struct edgelist *after;
+
+ after = before->link;
+
+ while (after != NULL && TOP(after) == TOP(edge)) {
+ before = after;
+ after = after->link;
+ }
+
+ return(before);
+
+}
+/*
+:h3.touches() - Returns the Remaining Height When Two Edges Touch
+
+So, it will return 0 if they never touch. Allows incredibly(?) mnemonic
+if (touches(...)) construct.
+*/
+
+static int touches(h, left, right)
+ register int h;
+ register pel *left,*right;
+{
+ for (; h > 0; h--)
+ if (*left++ >= *right++)
+ break;
+ return(h);
+}
+/*
+:h3.crosses() - Returns the Remaining Height When Two Edges Cross
+
+So, it will return 0 if they never cross.
+*/
+
+static int crosses(h, left, right)
+ register int h;
+ register pel *left,*right;
+{
+ for (; h > 0; h--)
+ if (*left++ > *right++)
+ break;
+ return(h);
+}
+/*
+:h3.cedgemin() - Stores the Mininum of an Edge and an X Value
+*/
+
+static void cedgemin(register int h, register pel *e1, register pel x)
+{
+ for (; --h >= 0; e1++)
+ if (*e1 > x)
+ *e1 = x;
+}
+/*
+:h3.cedgemax() - Stores the Maximum of an Edge and an X Value
+*/
+
+static void cedgemax(register int h, register pel *e1, register pel x)
+{
+ for (; --h >= 0; e1++)
+ if (*e1 < x)
+ *e1 = x;
+}
+/*
+:h3.edgemin() - Stores the Mininum of Two Edges in First Edge
+*/
+
+static void edgemin(register int h, register pel *e1, register pel *e2)
+{
+ for (; --h >= 0; e1++,e2++)
+ if (*e1 > *e2)
+ *e1 = *e2;
+}
+/*
+:h3.edgemax() - Stores the Maximum of Two Edges in First Edge
+*/
+
+static void edgemax(register int h, register pel *e1, register pel *e2)
+{
+ for (; --h >= 0; e1++,e2++)
+ if (*e1 < *e2)
+ *e1 = *e2;
+}
+/*
+:h3 id=discard.discard() - Discard All Edges Between Two Edges
+
+At first glance it would seem that we could discard an edgelist
+structure merely by unlinking it from the list and freeing it. You are
+wrong, region-breath! For performance, the X values associated with an
+edge are allocated contiguously with it. So, we free the X values when
+we free a structure. However, once an edge has been split, we are no
+longer sure which control block actually is part of the memory block
+that contains the edges. Rather than trying to decide, we play it safe
+and never free part of a region.
+
+So, to mark a 'edgelist' structure as discarded, we move it to the end
+of the list and set ymin=ymax.
+*/
+
+#ifdef HAVE_PROTOTYPES
+static void discard(register struct edgelist *left, register struct edgelist *right)
+#else
+static discard(left, right)
+ register struct edgelist *left,*right; /* all edges between here exclusive */
+ /* should be discarded */
+#endif
+{
+ register struct edgelist *beg,*end,*p;
+
+ IfTrace2((RegionDebug > 0),"discard: l=%x, r=%x\n", left, right);
+
+ beg = left->link;
+ if (beg == right)
+ return;
+
+ for (p = beg; p != right; p = p->link) {
+ if (p->link == NULL && right != NULL)
+ t1_abort("discard(): ran off end");
+ IfTrace1((RegionDebug > 0),"discarding %x\n", p);
+ p->ymin = p->ymax = 32767;
+ end = p;
+ }
+ /*
+ * now put the chain beg/end at the end of right, if it is not
+ * already there:
+ */
+ if (right != NULL) {
+ left->link = right;
+ while (right->link != NULL)
+ right = right->link;
+ right->link = beg;
+ }
+ end->link = NULL;
+}
+
+/*
+:h2.Changing the Representation of Regions
+
+For convenience and/or performance, we sometimes like to change the way
+regions are represented. This does not change the object itself, just
+the representation, so these transformations can be made on a permanent
+region.
+
+*/
+
+void MoveEdges(R, dx, dy)
+ register struct region *R; /* region to modify */
+ register fractpel dx,dy; /* delta X and Y to move edge list by */
+{
+ register struct edgelist *edge; /* for looping through edges */
+
+ R->origin.x += dx;
+ R->origin.y += dy;
+ R->ending.x += dx;
+ R->ending.y += dy;
+ if (R->thresholded != NULL) {
+ R->thresholded->origin.x -= dx;
+ R->thresholded->origin.y -= dy;
+ }
+/*
+From now on we will deal with dx and dy as integer pel values:
+*/
+ dx = NEARESTPEL(dx);
+ dy = NEARESTPEL(dy);
+ if (dx == 0 && dy == 0)
+ return;
+
+ R->xmin += dx;
+ R->xmax += dx;
+ R->ymin += dy;
+ R->ymax += dy;
+
+ for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) {
+ edge->ymin += dy;
+ edge->ymax += dy;
+ if (dx != 0) {
+ register int h; /* loop index; height of edge */
+ register pel *Xp; /* loop pointer to X values */
+
+ edge->xmin += dx;
+ edge->xmax += dx;
+ for (Xp = edge->xvalues, h = edge->ymax - edge->ymin;
+ --h >= 0; )
+ *Xp++ += dx;
+ }
+ }
+}
+
+/*
+:h3.UnJumble() - Sort a Region Top to Bottom
+
+It is an open question whether it pays in general to do this.
+*/
+
+void UnJumble(region)
+ struct region *region; /* region to sort */
+{
+ register struct edgelist *anchor; /* new lists built here */
+ register struct edgelist *edge; /* edge pointer for loop */
+ register struct edgelist *next; /* ditto */
+
+ anchor = NULL;
+
+ for (edge=region->anchor; VALIDEDGE(edge); edge=next) {
+ if (edge->link == NULL)
+ t1_abort("UnJumble: unpaired edge?");
+ next = edge->link->link;
+ edge->link->link = NULL;
+ anchor = SortSwath(anchor, edge, t1_SwathUnion);
+ }
+
+ if (edge != NULL)
+ vertjoin(anchor, edge);
+
+ region->anchor = anchor;
+ region->flag &= ~ISJUMBLED(ON);
+}
+
+/*
+*/
+
+static OptimizeRegion(R)
+ struct region *R; /* region to optimize */
+{
+ register pel *xP; /* pel pointer for inner loop */
+ register int x; /* holds X value */
+ register int xmin,xmax; /* holds X range */
+ register int h; /* loop counter */
+ register struct edgelist *e; /* edgelist pointer for loop */
+
+ R->flag |= ISRECTANGULAR(ON);
+
+ for (e = R->anchor; VALIDEDGE(e); e=e->link) {
+ xmin = MAXPEL;
+ xmax = MINPEL;
+ for (h = e->ymax - e->ymin, xP = e->xvalues; --h >= 0;) {
+ x = *xP++;
+ if (x < xmin) xmin = x;
+ if (x > xmax) xmax = x;
+ }
+ if (xmin != xmax || (xmin != R->xmin && xmax != R->xmax))
+ R->flag &= ~ISRECTANGULAR(ON);
+ if (xmin < e->xmin || xmax > e->xmax)
+ t1_abort("Tighten: existing edge bound was bad");
+ if (xmin < R->xmin || xmax > R->xmax)
+ t1_abort("Tighten: existing region bound was bad");
+ e->xmin = xmin;
+ e->xmax = xmax;
+ }
+ R->flag |= ISOPTIMIZED(ON);
+}
+
+/*
+:h2.Miscelaneous Routines
+
+:h3.MoreWorkArea() - Allocate New Space for "edge"
+
+Our strategy is to temporarily allocate an array to hold this
+unexpectedly large edge. ChangeDirection frees this array any time
+it gets a shorter 'dy'.
+*/
+
+/*ARGSUSED*/
+void MoreWorkArea(R, x1, y1, x2, y2)
+ struct region *R; /* region we are generating */
+ fractpel x1,y1; /* starting point of line */
+ fractpel x2,y2; /* ending point of line */
+{
+ register int idy; /* integer dy of line */
+
+ idy = NEARESTPEL(y1) - NEARESTPEL(y2);
+ if (idy < 0) idy = - idy;
+
+ /*
+ * we must add one to the delta for the number of run ends we
+ * need to store:
+ */
+ if (++idy > currentsize) {
+ IfTrace1((RegionDebug > 0),"Allocating edge of %d pels\n", idy);
+ if (currentworkarea != workedge)
+ NonObjectFree(currentworkarea);
+ currentworkarea = (pel *)Allocate(0, NULL, idy * sizeof(pel));
+ currentsize = idy;
+ }
+ ChangeDirection(CD_CONTINUE, R, x1, y1, y2 - y1);
+}
+
+/*
+:h3.BoxClip() - Clip a Region to a Rectangle
+
+BoxClip also duplicates the region if it is permanent. Note the
+clipping box is specified in REGION coordinates, that is, in
+coordinates relative to the region (0,0) point
+*/
+
+struct region *BoxClip(R, xmin, ymin, xmax, ymax)
+ register struct region *R; /* region to clip */
+ register pel xmin,ymin; /* upper left hand corner of rectangle */
+ register pel xmax,ymax; /* lower right hand corner */
+{
+ struct edgelist anchor; /* pretend edgelist to facilitate discards */
+ register struct edgelist *e,*laste;
+
+ IfTrace1((OffPageDebug),"BoxClip of %x:\n", R);
+
+ R = UniqueRegion(R);
+
+ if (xmin > R->xmin) {
+ IfTrace2((OffPageDebug),"BoxClip: left clip old %d new %d\n",
+ (LONG) R->xmin, (LONG) xmin);
+ R->xmin = xmin;
+ }
+ if (xmax < R->xmax) {
+ IfTrace2((OffPageDebug),"BoxClip: right clip old %d new %d\n",
+ (LONG) R->xmax, (LONG) xmax);
+ R->xmax = xmax;
+ }
+
+ if (ymin > R->ymin) {
+ IfTrace2((OffPageDebug),"BoxClip: top clip old %d new %d\n",
+ (LONG) R->ymin, (LONG) ymin);
+ R->ymin = ymin;
+ }
+ if (ymax < R->ymax) {
+ IfTrace2((OffPageDebug),"BoxClip: bottom clip old %d new %d\n",
+ (LONG) R->ymax, (LONG) ymax);
+ R->ymax = ymax;
+ }
+
+
+ laste = &anchor;
+ anchor.link = R->anchor;
+
+ for (e = R->anchor; VALIDEDGE(e); e = e->link) {
+ if (TOP(e) < ymin) {
+ e->xvalues += ymin - e->ymin;
+ e->ymin = ymin;
+ }
+ if (BOTTOM(e) > ymax)
+ e->ymax = ymax;
+ if (TOP(e) >= BOTTOM(e)) {
+ discard(laste, e->link->link);
+ e = laste;
+ continue;
+ }
+ if (e->xmin < xmin) {
+ cedgemax(BOTTOM(e) - TOP(e), e->xvalues, xmin);
+ e->xmin = xmin;
+ e->xmax = MAX(e->xmax, xmin);
+ }
+ if (e->xmax > xmax) {
+ cedgemin(BOTTOM(e) - TOP(e), e->xvalues, xmax);
+ e->xmin = MIN(e->xmin, xmax);
+ e->xmax = xmax;
+ }
+ laste = e;
+ }
+
+ R->anchor = anchor.link;
+
+ return(R);
+}
+
+#ifdef notdef
+/*
+:h3.CoerceRegion() - Force a TextPath Structure to Become a Region
+
+We also save the newly created region in the textpath structure, if the
+structure was permanent. Then we don't have to do this again. Why not
+save it all the time? Well, we certainly could, but I suspect it
+wouldn't pay. We would have to make this region permanent (because we
+couldn't have it be consumed) and this would probably require
+unnecessary CopyRegions in most cases.
+*/
+
+struct region *CoerceRegion(tp)
+ register struct textpath *tp; /* input TEXTTYPE */
+{
+ struct segment *path; /* temporary character path */
+ struct region *R; /* returned region */
+
+
+ R = Interior(path, EVENODDRULE);
+ return(R);
+}
+#endif
+
+/*
+:h3.RegionBounds() - Returns Bounding Box of a Region
+*/
+
+struct segment *RegionBounds(R)
+ register struct region *R;
+{
+ extern struct XYspace *IDENTITY;
+
+ register struct segment *path; /* returned path */
+
+ path = BoxPath(IDENTITY, R->ymax - R->ymin, R->xmax - R->xmin);
+ path = Join(PathSegment(MOVETYPE, R->origin.x + TOFRACTPEL(R->xmin),
+ R->origin.y + TOFRACTPEL(R->ymin) ),
+ path);
+ return(path);
+}
+
+/*
+:h2.Formatting/Dump Routines for Debug
+
+:h3.DumpArea() - Display a Region
+*/
+void DumpArea(area)
+ register struct region *area;
+{
+ IfTrace1(TRUE,"Dumping area %x,", area);
+ IfTrace4(TRUE," X %d:%d Y %d:%d;", (LONG) area->xmin,
+ (LONG) area->xmax, (LONG) area->ymin,(LONG) area->ymax);
+ IfTrace4(TRUE," origin=(%p,%p), ending=(%p,%p)\n",
+ area->origin.x, area->origin.y, area->ending.x, area->ending.y);
+ DumpEdges(area->anchor);
+}
+
+#define INSWATH(p, y0, y1) (p != NULL && p->ymin == y0 && p->ymax == y1)
+/*
+:h3.DumpEdges() - Display Run End Lists (Edge Lists)
+*/
+
+static pel RegionDebugYMin = MINPEL;
+static pel RegionDebugYMax = MAXPEL;
+
+void DumpEdges(edges)
+ register struct edgelist *edges;
+{
+ register struct edgelist *p,*p2;
+ register pel ymin = MINPEL;
+ register pel ymax = MINPEL;
+ register int y;
+
+ if (edges == NULL) {
+ IfTrace0(TRUE," NULL area.\n");
+ return;
+ }
+ if (RegionDebug <= 1) {
+ for (p=edges; p != NULL; p = p->link) {
+ edgecheck(p, ymin, ymax);
+ ymin = p->ymin; ymax = p->ymax;
+ IfTrace3(TRUE,". at %x type=%d flag=%x",
+ p, (LONG) p->type,(LONG) p->flag);
+ IfTrace4(TRUE," bounding box HxW is %dx%d at (%d,%d)\n",
+ (LONG) ymax - ymin, (LONG) p->xmax - p->xmin,
+ (LONG) p->xmin, (LONG) ymin);
+ }
+ }
+ else {
+
+ for (p2=edges; p2 != NULL; ) {
+
+ edgecheck(p2, ymin, ymax);
+ ymin = p2->ymin;
+ ymax = p2->ymax;
+
+ if (RegionDebug > 3 || (ymax > RegionDebugYMin
+ && ymin < RegionDebugYMax)) {
+ IfTrace2 (TRUE,". Swath from %d to %d:\n",
+ ymin, ymax);
+ for (p=p2; INSWATH(p,ymin,ymax); p = p->link) {
+ IfTrace4(TRUE,". . at %x[%x] range %d:%d, ",
+ p, (LONG) p->flag,
+ (LONG) p->xmin, (LONG)p->xmax);
+ IfTrace1(TRUE, "subpath=%x,\n", p->subpath);
+ }
+ }
+ for (y=MAX(ymin,RegionDebugYMin); y < MIN(ymax, RegionDebugYMax); y++) {
+ IfTrace1(TRUE,". . . Y[%5d] ", (LONG) y);
+ for (p=p2; INSWATH(p,ymin,ymax); p = p->link)
+ IfTrace1(TRUE,"%5d ",
+ (LONG) p->xvalues[y - ymin]);
+ IfTrace0(TRUE,"\n");
+ }
+ while (INSWATH(p2, ymin, ymax))
+ p2 = p2->link;
+ }
+ }
+}
+
+/*
+:h3.edgecheck() - For Debug, Verify that an Edge Obeys the Rules
+*/
+
+/*ARGSUSED*/
+static int edgecheck(edge, oldmin, oldmax)
+ struct edgelist *edge;
+ int oldmin,oldmax;
+{
+ if (edge->type != EDGETYPE)
+ t1_abort("EDGE ERROR: non EDGETYPE in list");
+/*
+The following check is not valid if the region is jumbled so I took it
+out:
+*/
+/* if (edge->ymin < oldmax && edge->ymin != oldmin)
+ t1_abort("EDGE ERROR: overlapping swaths"); */
+}
diff --git a/Build/source/texk/ps2pkm/regions.h b/Build/source/texk/ps2pkm/regions.h
new file mode 100644
index 00000000000..2d0e6b7968e
--- /dev/null
+++ b/Build/source/texk/ps2pkm/regions.h
@@ -0,0 +1,209 @@
+/* $XConsortium: regions.h,v 1.2 91/10/10 11:19:06 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#define Interior(p,rule) t1_Interior(p,rule)
+#define Union(a1,a2) t1_Union(a1,a2)
+#define Intersect(a1,a2) t1_Intersect(a1,a2)
+#define Complement(area) t1_Complement(area)
+#define Overlap(a1,a2) t1_OverLap(a1,a2)
+
+struct region *t1_Interior(); /* returns the interior of a closed path */
+struct region *t1_Union(); /* set union of paths or regions */
+struct region *t1_Intersect(); /* set intersection of regions */
+struct region *t1_Complement(); /* complement of a region */
+int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */
+
+#define INFINITY t1_Infinity
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy)
+
+void t1_ChangeDirection(); /* called when we change direction in Y */
+#define CD_FIRST -1 /* enumeration of ChangeDirection type */
+#define CD_CONTINUE 0 /* enumeration of ChangeDirection type */
+#define CD_LAST 1 /* enumeration of ChangeDirection type */
+
+#define MoreWorkArea(R,x1,y1,x2,y2) t1_MoreWorkArea(R,x1,y1,x2,y2)
+#define KillRegion(area) t1_KillRegion(area)
+#define CopyRegion(area) t1_CopyRegion(area)
+#define BoxClip(R,xmin,ymin,xmax,ymax) t1_BoxClip(R,xmin,ymin,xmax,ymax)
+#define SortSwath(a,p,f) t1_SortSwath(a,p,f)
+#define SwathUnion(b,e) t1_SwathUnion(b,e)
+#define RegionBounds(r) t1_RegionBounds(r)
+#define CoerceRegion(p) t1_CoerceRegion(p)
+#define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy)
+#define UnJumble(R) t1_UnJumble(R)
+
+void t1_MoreWorkArea(); /* get longer edge list for stepping */
+struct region *t1_CopyRegion(); /* duplicate a region */
+void t1_KillRegion(); /* destroy a region */
+struct region *t1_BoxClip(); /* clip a region to a rectangle */
+struct edgelist *t1_SortSwath(); /* sort edges onto growing edge list */
+struct edgelist *t1_SwathUnion(); /* 'union' two edges into a swath */
+struct segment *t1_RegionBounds(); /* returns bounding box of a region */
+struct region *t1_CoerceRegion(); /* force text to become a true region */
+void t1_MoveEdges(); /* moves the edge values in a region */
+void t1_UnJumble(); /* sort the edges and reset the jumbled flag */
+
+/*END SHARED*/
+/*SHARED*/
+
+#define GOING_TO(R, x1, y1, x2, y2, dy) { \
+ if (dy < 0) { \
+ if (R->lastdy >= 0) \
+ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \
+ if (y2 < R->edgeYstop) \
+ MoreWorkArea(R, x1, y1, x2, y2); \
+ } \
+ else if (dy > 0) { \
+ if (R->lastdy <= 0) \
+ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \
+ if (y2 > R->edgeYstop) \
+ MoreWorkArea(R, x1, y1, x2, y2); \
+ } \
+ else /* dy == 0 */ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \
+ if (x2 < R->edgexmin) R->edgexmin = x2; \
+ else if (x2 > R->edgexmax) R->edgexmax = x2; \
+}
+
+
+#define MINPEL (-1<<(8*sizeof(pel)-1)) /* smallest value fitting in a pel */
+#define MAXPEL ((1<<(8*sizeof(pel)-1))-1)/* largest value fitting in a pel */
+
+/*
+The "Unique"-type macro is different (unique?) for regions, because some
+regions structures are shared among several objects, and might have
+to be made unique for that reason (i.e., references > 1).
+*/
+
+#define ConsumeRegion(R) MAKECONSUME(R,KillRegion(R))
+#define UniqueRegion(R) MAKEUNIQUE(R,CopyRegion(R))
+
+
+/*END SHARED*/
+/*SHARED*/
+
+struct region {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ /* type = REGIONTYPE */
+ struct fractpoint origin; /* beginning handle: X,Y origin of region */
+ struct fractpoint ending; /* ending handle: X,Y change after painting region */
+ pel xmin,ymin; /* minimum X,Y of region */
+ pel xmax,ymax; /* mat1_mum X,Y of region */
+ struct edgelist *anchor; /* list of edges that bound the region */
+ struct picture *thresholded; /* region defined by thresholded picture*/
+/*
+Note that the ending handle and the bounding box values are stored
+relative to 'origin'.
+
+The above elements describe a region. The following elements are
+scratchpad areas used while the region is being built:
+*/
+ fractpel lastdy; /* direction of last segment */
+ fractpel firstx,firsty; /* starting point of current edge */
+ fractpel edgexmin,edgexmax; /* x extent of current edge */
+ struct edgelist *lastedge,*firstedge; /* last and first edges in subpath */
+ pel *edge; /* pointer to array of X values for edge */
+ fractpel edgeYstop; /* Y value where 'edges' array ends */
+#if defined(HAVE_PROTOTYPES)
+ void (*newedgefcn)(struct region *, fractpel, fractpel,
+ fractpel, fractpel, int); /* function to use when
+ building a new edge */
+#else
+ int (*newedgefcn)(); /* function to use when building a new edge */
+#endif
+ struct strokeinfo *strokeinfo; /* scratchpad info during stroking only */
+} ;
+/*
+The ISCOMPLEMENT flag indicates the region is reversed--it is the
+"outside" of the nominal region.
+*/
+#define ISCOMPLEMENT(flag) ((flag)&0x80)
+/*
+The ISJUMBLED flag indicates the region is not sorted top-to-bottom.
+*/
+#define ISJUMBLED(flag) ((flag)&0x40)
+/*
+The ISINFINITE flag allows a quick check for an INFINITE region, which
+is frequently intersected.
+*/
+#define ISINFINITE(flag) ((flag)&0x20)
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ISRECTANGULAR(flag) ((flag)&0x08)
+
+/*END SHARED*/
+/*SHARED*/
+
+#define EmptyRegion t1_EmptyRegion
+
+/*END SHARED*/
+/*SHARED*/
+
+struct edgelist {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ /* type = EDGETYPE */
+ struct edgelist *link; /* pointer to next in linked list */
+ struct edgelist *subpath; /* informational link for "same subpath" */
+ pel xmin,xmax; /* range of edge in X */
+ pel ymin,ymax; /* range of edge in Y */
+ pel *xvalues; /* pointer to ymax-ymin X values */
+} ;
+/*
+The end of the list is marked by either "link" being NULL, or by
+ymin == ymax. See :hdref refid=discard.. We define the VALIDEDGE
+predicate to test for the opposite of these conditions:
+*/
+
+#define VALIDEDGE(p) ((p)!=NULL&&(p)->ymin<(p)->ymax)
+
+/*END SHARED*/
+/*SHARED*/
+
+#define ISDOWN(f) ((f)&0x80)
+
+#define ISAMBIGUOUS(f) ((f)&0x40)
+
+/*END SHARED*/
+/*SHARED*/
+
+/*
+Interior() rule enumerations:
+*/
+#define WINDINGRULE -2
+#define EVENODDRULE -3
+
+#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/scanfont.c b/Build/source/texk/ps2pkm/scanfont.c
new file mode 100644
index 00000000000..3a648a49551
--- /dev/null
+++ b/Build/source/texk/ps2pkm/scanfont.c
@@ -0,0 +1,1506 @@
+/* $XConsortium: scanfont.c,v 1.9 92/07/07 17:14:56 gildea Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
+
+#include <string.h>
+#include "types.h"
+
+#include "t1stdio.h"
+#include "util.h"
+#include "token.h"
+#include "fontfcn.h"
+#include "blues.h"
+
+
+#ifdef HAVE_PROTOTYPES
+extern void objFormatInteger(psobj *,int);
+extern void objFormatReal(psobj *, float);
+extern void objFormatBoolean(psobj *, boolean);
+extern void objFormatEncoding(psobj *, int, psobj *);
+extern void objFormatArray(psobj *, int, psobj *);
+extern void objFormatString(psobj *, int, char *);
+extern void objFormatName(psobj *, int, char *);
+extern void objFormatFile(psobj *, FILE *);
+extern int SearchDictName(psdict *, psobj *);
+extern int T1Getc(struct F_FILE *f);
+extern int T1Ungetc(int c,struct F_FILE *f);
+#endif
+
+static int rc;
+static boolean InPrivateDict;
+static boolean WantFontInfo;
+static boolean TwoSubrs;
+static psobj inputFile;
+static psobj filterFile;
+static psobj *inputP;
+
+
+/**********************************************************************/
+/* Init_BuiltInEncoding() */
+/* */
+/* Initializes the StandardEncoding and ISOLatin1Encoding vector. */
+/* */
+/**********************************************************************/
+typedef struct /* Builtin Standard Encoding */
+{
+ int index;
+ char *name;
+} EncodingTable;
+
+static EncodingTable StdEnc[] = {
+ 040 , "space",
+ 041 , "exclam",
+ 042 , "quotedbl",
+ 043 , "numbersign",
+ 044 , "dollar",
+ 045 , "percent",
+ 046 , "ampersand",
+ 047 , "quoteright",
+ 050 , "parenleft",
+ 051 , "parenright",
+ 052 , "asterisk",
+ 053 , "plus",
+ 054 , "comma",
+ 055 , "hyphen",
+ 056 , "period",
+ 057 , "slash",
+ 060 , "zero",
+ 061 , "one",
+ 062 , "two",
+ 063 , "three",
+ 064 , "four",
+ 065 , "five",
+ 066 , "six",
+ 067 , "seven",
+ 070 , "eight",
+ 071 , "nine",
+ 072 , "colon",
+ 073 , "semicolon",
+ 074 , "less",
+ 075 , "equal",
+ 076 , "greater",
+ 077 , "question",
+ 0100 , "at",
+ 0101 , "A",
+ 0102 , "B",
+ 0103 , "C",
+ 0104 , "D",
+ 0105 , "E",
+ 0106 , "F",
+ 0107 , "G",
+ 0110 , "H",
+ 0111 , "I",
+ 0112 , "J",
+ 0113 , "K",
+ 0114 , "L",
+ 0115 , "M",
+ 0116 , "N",
+ 0117 , "O",
+ 0120 , "P",
+ 0121 , "Q",
+ 0122 , "R",
+ 0123 , "S",
+ 0124 , "T",
+ 0125 , "U",
+ 0126 , "V",
+ 0127 , "W",
+ 0130 , "X",
+ 0131 , "Y",
+ 0132 , "Z",
+ 0133 , "bracketleft",
+ 0134 , "backslash",
+ 0135 , "bracketright",
+ 0136 , "asciicircum",
+ 0137 , "underscore",
+ 0140 , "quoteleft",
+ 0141 , "a",
+ 0142 , "b",
+ 0143 , "c",
+ 0144 , "d",
+ 0145 , "e",
+ 0146 , "f",
+ 0147 , "g",
+ 0150 , "h",
+ 0151 , "i",
+ 0152 , "j",
+ 0153 , "k",
+ 0154 , "l",
+ 0155 , "m",
+ 0156 , "n",
+ 0157 , "o",
+ 0160 , "p",
+ 0161 , "q",
+ 0162 , "r",
+ 0163 , "s",
+ 0164 , "t",
+ 0165 , "u",
+ 0166 , "v",
+ 0167 , "w",
+ 0170 , "x",
+ 0171 , "y",
+ 0172 , "z",
+ 0173 , "braceleft",
+ 0174 , "bar",
+ 0175 , "braceright",
+ 0176 , "asciitilde",
+ 0241 , "exclamdown",
+ 0242 , "cent",
+ 0243 , "sterling",
+ 0244 , "fraction",
+ 0245 , "yen",
+ 0246 , "florin",
+ 0247 , "section",
+ 0250 , "currency",
+ 0251 , "quotesingle",
+ 0252 , "quotedblleft",
+ 0253 , "guillemotleft",
+ 0254 , "guilsinglleft",
+ 0255 , "guilsinglright",
+ 0256 , "fi",
+ 0257 , "fl",
+ 0261 , "endash",
+ 0262 , "dagger",
+ 0263 , "daggerdbl",
+ 0264 , "periodcentered",
+ 0266 , "paragraph",
+ 0267 , "bullet",
+ 0270 , "quotesinglbase",
+ 0271 , "quotedblbase",
+ 0272 , "quotedblright",
+ 0273 , "guillemotright",
+ 0274 , "ellipsis",
+ 0275 , "perthousand",
+ 0277 , "questiondown",
+ 0301 , "grave",
+ 0302 , "acute",
+ 0303 , "circumflex",
+ 0304 , "tilde",
+ 0305 , "macron",
+ 0306 , "breve",
+ 0307 , "dotaccent",
+ 0310 , "dieresis",
+ 0312 , "ring",
+ 0313 , "cedilla",
+ 0315 , "hungarumlaut",
+ 0316 , "ogonek",
+ 0317 , "caron",
+ 0320 , "emdash",
+ 0341 , "AE",
+ 0343 , "ordfeminine",
+ 0350 , "Lslash",
+ 0351 , "Oslash",
+ 0352 , "OE",
+ 0353 , "ordmasculine",
+ 0361 , "ae",
+ 0365 , "dotlessi",
+ 0370 , "lslash",
+ 0371 , "oslash",
+ 0372 , "oe",
+ 0373 , "germandbls",
+ 0, 0
+};
+
+static EncodingTable ISO8859Enc[] = {
+ 32, "space",
+ 33, "exclam",
+ 34, "quotedbl",
+ 35, "numbersign",
+ 36, "dollar",
+ 37, "percent",
+ 38, "ampersand",
+ 39, "quoteright",
+ 40, "parenleft",
+ 41, "parenright",
+ 42, "asterisk",
+ 43, "plus",
+ 44, "comma",
+ 45, "minus",
+ 46, "period",
+ 47, "slash",
+ 48, "zero",
+ 49, "one",
+ 50, "two",
+ 51, "three",
+ 52, "four",
+ 53, "five",
+ 54, "six",
+ 55, "seven",
+ 56, "eight",
+ 57, "nine",
+ 58, "colon",
+ 59, "semicolon",
+ 60, "less",
+ 61, "equal",
+ 62, "greater",
+ 63, "question",
+ 64, "at",
+ 65, "A",
+ 66, "B",
+ 67, "C",
+ 68, "D",
+ 69, "E",
+ 70, "F",
+ 71, "G",
+ 72, "H",
+ 73, "I",
+ 74, "J",
+ 75, "K",
+ 76, "L",
+ 77, "M",
+ 78, "N",
+ 79, "O",
+ 80, "P",
+ 81, "Q",
+ 82, "R",
+ 83, "S",
+ 84, "T",
+ 85, "U",
+ 86, "V",
+ 87, "W",
+ 88, "X",
+ 89, "Y",
+ 90, "Z",
+ 91, "bracketleft",
+ 92, "backslash",
+ 93, "bracketright",
+ 94, "asciicircum",
+ 95, "underscore",
+ 96, "quoteleft",
+ 97, "a",
+ 98, "b",
+ 99, "c",
+ 100, "d",
+ 101, "e",
+ 102, "f",
+ 103, "g",
+ 104, "h",
+ 105, "i",
+ 106, "j",
+ 107, "k",
+ 108, "l",
+ 109, "m",
+ 110, "n",
+ 111, "o",
+ 112, "p",
+ 113, "q",
+ 114, "r",
+ 115, "s",
+ 116, "t",
+ 117, "u",
+ 118, "v",
+ 119, "w",
+ 120, "x",
+ 121, "y",
+ 122, "z",
+ 123, "braceleft",
+ 124, "bar",
+ 125, "braceright",
+ 126, "asciitilde",
+ 161, "exclamdown",
+ 162, "cent",
+ 163, "sterling",
+ 164, "currency",
+ 165, "yen",
+ 166, "brokenbar",
+ 167, "section",
+ 168, "dieresis",
+ 169, "copyright",
+ 170, "ordfeminine",
+ 171, "guillemotleft",
+ 172, "logicalnot",
+ 173, "hyphen",
+ 174, "registered",
+ 175, "macron",
+ 176, "degree",
+ 177, "plusminus",
+ 178, "twosuperior",
+ 179, "threesuperior",
+ 180, "acute",
+ 181, "mu",
+ 182, "paragraph",
+ 183, "periodcentered",
+ 184, "cedilla",
+ 185, "onesuperior",
+ 186, "ordmasculine",
+ 187, "guillemotright",
+ 188, "onequarter",
+ 189, "onehalf",
+ 190, "threequarters",
+ 191, "questiondown",
+ 192, "Agrave",
+ 193, "Aacute",
+ 194, "Acircumflex",
+ 195, "Atilde",
+ 196, "Adieresis",
+ 197, "Aring",
+ 198, "AE",
+ 199, "Ccedilla",
+ 200, "Egrave",
+ 201, "Eacute",
+ 202, "Ecircumflex",
+ 203, "Edieresis",
+ 204, "Igrave",
+ 205, "Iacute",
+ 206, "Icircumflex",
+ 207, "Idieresis",
+ 208, "Eth",
+ 209, "Ntilde",
+ 210, "Ograve",
+ 211, "Oacute",
+ 212, "Ocircumflex",
+ 213, "Otilde",
+ 214, "Odieresis",
+ 215, "multiply",
+ 216, "Oslash",
+ 217, "Ugrave",
+ 218, "Uacute",
+ 219, "Ucircumflex",
+ 220, "Udieresis",
+ 221, "Yacute",
+ 222, "Thorn",
+ 223, "germandbls",
+ 224, "agrave",
+ 225, "aacute",
+ 226, "acircumflex",
+ 227, "atilde",
+ 228, "adieresis",
+ 229, "aring",
+ 230, "ae",
+ 231, "ccedilla",
+ 232, "egrave",
+ 233, "eacute",
+ 234, "ecircumflex",
+ 235, "edieresis",
+ 236, "igrave",
+ 237, "iacute",
+ 238, "icircumflex",
+ 239, "idieresis",
+ 240, "eth",
+ 241, "ntilde",
+ 242, "ograve",
+ 243, "oacute",
+ 244, "ocircumflex",
+ 245, "otilde",
+ 246, "odieresis",
+ 247, "divide",
+ 248, "oslash",
+ 249, "ugrave",
+ 250, "uacute",
+ 251, "ucircumflex",
+ 252, "udieresis",
+ 253, "yacute",
+ 254, "thorn",
+ 255, "ydieresis",
+ 0, 0
+};
+
+static psobj *StdEncArrayP = NULL;
+psobj *ISOLatin1EncArrayP = NULL;
+
+static psobj *MakeEncodingArrayP(encodingTable)
+ EncodingTable *encodingTable;
+{
+ int i;
+ psobj *encodingArrayP;
+
+ encodingArrayP = (psobj *)vm_alloc(256*(sizeof(psobj)));
+ if (!encodingArrayP)
+ return NULL;
+
+ /* initialize everything to .notdef */
+ for (i=0; i<256;i++)
+ objFormatName(&(encodingArrayP[i]),7, ".notdef");
+
+ for (i=0; encodingTable[i].name; i++)
+ {
+ objFormatName(&(encodingArrayP[encodingTable[i].index]),
+ strlen(encodingTable[i].name),
+ encodingTable[i].name);
+ }
+
+ return(encodingArrayP);
+}
+
+boolean Init_BuiltInEncoding()
+{
+ StdEncArrayP = MakeEncodingArrayP(StdEnc);
+ ISOLatin1EncArrayP = MakeEncodingArrayP(ISO8859Enc);
+ return (StdEncArrayP && ISOLatin1EncArrayP);
+}
+
+/********************************************************************/
+/***================================================================***/
+static int getNextValue(valueType)
+ int valueType;
+{
+ scan_token(inputP);
+ if (tokenType != valueType) {
+ return(SCAN_ERROR);
+ }
+ return(SCAN_OK);
+
+}
+/***================================================================***/
+/* This routine will set the global rc if there is an error */
+/***================================================================***/
+static int getInt()
+{
+ scan_token(inputP);
+ if (tokenType != TOKEN_INTEGER) {
+ rc = SCAN_ERROR;
+ return(0);
+ }
+ else {
+ return( tokenValue.integer);
+ }
+
+}
+/***================================================================***/
+/*
+ * See Sec 10.3 of ``Adobe Type 1 Font Format'' v1.1,
+ * for parsing Encoding.
+ */
+static int getEncoding(arrayP)
+ psobj *arrayP;
+{
+
+ scan_token(inputP);
+ if ((tokenType == TOKEN_NAME)
+ &&
+ (((tokenLength==16) && (!strncmp(tokenStartP,"StandardEncoding",16))) ||
+ (((tokenLength==17) && (!strncmp(tokenStartP,"ISOLatin1Encoding",17))))))
+ {
+ /* Adobe Standard Encoding */
+
+ if (tokenLength == 16)
+ arrayP->data.valueP = (char *) StdEncArrayP;
+ else
+ arrayP->data.valueP = (char *) ISOLatin1EncArrayP;
+
+ arrayP->len = 256;
+ return(SCAN_OK);
+ }
+ else if ( (tokenType == TOKEN_LEFT_BRACE) ||
+ (tokenType == TOKEN_LEFT_BRACKET) )
+ {
+ /* Array of literal names */
+
+ psobj *objP;
+ int i;
+
+ objP = (psobj *)vm_alloc(256*(sizeof(psobj)));
+ if (!(objP)) return(SCAN_OUT_OF_MEMORY);
+
+ arrayP->data.valueP = (char *) objP;
+ arrayP->len = 256;
+
+ for (i=0; i<256; i++, objP++)
+ {
+ scan_token(inputP);
+
+ if (tokenType != TOKEN_LITERAL_NAME)
+ return(SCAN_ERROR);
+
+ if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY);
+ objFormatName(objP,tokenLength,tokenStartP);
+ }
+
+ scan_token(inputP);
+ if ( (tokenType == TOKEN_RIGHT_BRACE) ||
+ (tokenType == TOKEN_RIGHT_BRACKET) )
+ return(SCAN_OK);
+ }
+ else
+ {
+ /* Must be sequences of ``dup <index> <charactername> put" */
+
+ psobj *objP;
+ int i;
+
+ objP = (psobj *)vm_alloc(256*(sizeof(psobj)));
+ if (!(objP)) return(SCAN_OUT_OF_MEMORY);
+
+ arrayP->data.valueP = (char *) objP;
+ arrayP->len = 256;
+
+ for (i=0; i<256; i++)
+ objFormatName(objP + i, 7, ".notdef");
+
+ while (TRUE)
+ {
+ scan_token(inputP);
+
+ switch (tokenType)
+ {
+ case TOKEN_NAME:
+ if (tokenLength == 3)
+ {
+ if (strncmp(tokenStartP,"dup",3) == 0)
+ {
+ /* get <index> */
+ scan_token(inputP);
+ if (tokenType != TOKEN_INTEGER ||
+ tokenValue.integer < 0 ||
+ tokenValue.integer > 255)
+ return (SCAN_ERROR);
+ i = tokenValue.integer;
+
+ /* get <characer_name> */
+ scan_token(inputP);
+ if (tokenType != TOKEN_LITERAL_NAME)
+ return(SCAN_ERROR);
+
+ if (!(vm_alloc(tokenLength)) )
+ return(SCAN_OUT_OF_MEMORY);
+ objFormatName(objP + i,tokenLength,tokenStartP);
+
+ /* get "put" */
+ scan_token(inputP);
+ if (tokenType != TOKEN_NAME)
+ return(SCAN_ERROR);
+ }
+ else if (strncmp(tokenStartP,"def",3) == 0)
+ return (SCAN_OK);
+ }
+ break;
+ case TOKEN_EOF:
+ case TOKEN_NONE:
+ case TOKEN_INVALID:
+ return (SCAN_ERROR);
+ }
+ }
+ }
+
+ return (SCAN_ERROR);
+}
+/***================================================================***/
+static int getArray(arrayP)
+ psobj *arrayP;
+{
+ int N; /* count the items in the array */
+ psobj *objP;
+
+
+ scan_token(inputP);
+ if ( (tokenType != TOKEN_LEFT_BRACE) &&
+ (tokenType != TOKEN_LEFT_BRACKET) ) {
+ return(SCAN_ERROR);
+ }
+ /* format the array in memory, save pointer to the beginning */
+ arrayP->data.valueP = tokenStartP;
+ /* loop, picking up next object, until right BRACE or BRACKET */
+ N = 0;
+ do {
+ scan_token(inputP);
+ if ( (tokenType == TOKEN_RIGHT_BRACE) ||
+ (tokenType == TOKEN_RIGHT_BRACKET) ) {
+ /* save then number of items in the array */
+ arrayP->len = N;
+ return(SCAN_OK);
+ }
+ /* allocate the space for the object */
+ objP = (psobj *)vm_alloc(sizeof(psobj));
+ if (!(objP)) return(SCAN_OUT_OF_MEMORY);
+
+ /* array is an array of numbers, (real or integer) */
+ if (tokenType == TOKEN_REAL) {
+ objFormatReal(objP, tokenValue.real);
+ }
+ else
+ if (tokenType == TOKEN_INTEGER) {
+ objFormatInteger(objP, tokenValue.integer);
+ }
+ else return(SCAN_ERROR);
+ N++;
+ } while ( 1>0 );
+ /* NOTREACHED*/
+}
+/***================================================================***/
+static int getName(nameP)
+ char *nameP;
+{
+ do {
+ scan_token(inputP);
+ if (tokenType <= TOKEN_NONE) {
+ if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
+ return(SCAN_ERROR);
+ }
+ } while ((tokenType != TOKEN_NAME) ||
+ (0 != strncmp(tokenStartP,nameP,strlen(nameP))) );
+ /* found */
+ return(SCAN_OK);
+}
+/***================================================================***/
+static int getNbytes(N)
+ int N;
+{
+ int I;
+
+ if (N > vm_free_bytes()) {
+ if (!vm_init()) return(SCAN_OUT_OF_MEMORY);
+ }
+ tokenStartP = vm_next_byte();
+ I = fread(tokenStartP,1,N,inputP->data.fileP);
+ if ( I != N ) return(SCAN_FILE_EOF);
+ return(SCAN_OK);
+}
+
+/***================================================================***/
+/* getLiteralName(nameObjP) */
+/* scan for next literal. */
+/* if we encounter the name 'end' then terminate and say ok. */
+/* It means that the CharStrings does not have as many characters */
+/* as the dictionary said it would and that is ok. */
+/***================================================================***/
+static int getLiteralName(nameObjP)
+ psobj *nameObjP;
+{
+ do {
+ scan_token(inputP);
+ if (tokenType <= TOKEN_NONE) {
+ if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
+ return(SCAN_ERROR);
+ }
+ if (tokenType == TOKEN_NAME) {
+ if (0 == strncmp(tokenStartP,"end",3) ) {
+ return(SCAN_END);
+ }
+ }
+ } while (tokenType != TOKEN_LITERAL_NAME) ;
+ nameObjP->len = tokenLength;
+ /* allocate all the names in the CharStrings Structure */
+ if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY);
+ nameObjP->data.valueP = tokenStartP;
+ /* found */
+ return(SCAN_OK);
+}
+
+/***================================================================***/
+/*
+ * BuildSubrs routine
+ */
+/***================================================================***/
+
+static int BuildSubrs(FontP)
+ psfont *FontP;
+{
+ int N; /* number of values in Subrs */
+ int I; /* index into Subrs */
+ int i; /* loop thru Subrs */
+ int J; /* length of Subrs entry */
+ psobj *arrayP;
+
+ /* next token should be a positive int */
+ /* note: rc is set by getInt. */
+ N = getInt();
+ if (rc) return(rc);
+ if (N < 0 ) return(SCAN_ERROR);
+ /* if we already have a Subrs, then skip the second one */
+ /* The second one is for hiresolution devices. */
+ if (FontP->Subrs.data.arrayP != NULL) {
+ TwoSubrs = TRUE;
+ /* process all the Subrs, but do not update anything */
+ /* can not just skip them because of the binary data */
+ for (i=0;i<N;i++) {
+ /* look for dup */
+ rc = getName("dup");
+ if (rc) return(rc);
+ /* get 2 integers */
+ I = getInt();
+ if (rc) return(rc);
+ J = getInt();
+ if (rc) return(rc);
+ if ( (I < 0) || (J < 0 ) ) return (SCAN_ERROR);
+ /* get the next token, it should be RD or -|, either is ok */
+ rc = getNextValue(TOKEN_NAME);
+ if ( rc != SCAN_OK ) return(rc);
+ rc = getNbytes(J);
+ if (rc) return(rc);
+ }
+ return(SCAN_OK);
+ }
+
+ arrayP = (psobj *)vm_alloc(N*sizeof(psobj));
+ if (!(arrayP) ) return(SCAN_OUT_OF_MEMORY);
+ FontP->Subrs.len = N;
+ FontP->Subrs.data.arrayP = arrayP;
+ /* get N values for Subrs */
+ for (i=0;i<N;i++) {
+ /* look for dup */
+ rc = getName("dup");
+ if (rc) return(rc);
+ /* get 2 integers */
+ I = getInt();
+ if (rc) return(rc);
+ J = getInt();
+ if (rc) return(rc);
+ if ( (I < 0) || (J < 0 ) ) return (SCAN_ERROR);
+ arrayP[I].len = J;
+ /* get the next token, it should be RD or -|, either is ok */
+ rc = getNextValue(TOKEN_NAME);
+ if ( rc != SCAN_OK ) return(rc);
+ rc = getNbytes(J);
+ if (rc == SCAN_OK) {
+ arrayP[I].data.valueP = tokenStartP;
+ if ( !(vm_alloc(J)) ) return(SCAN_OUT_OF_MEMORY);
+ }
+ else return(rc);
+ }
+ return(SCAN_OK);
+
+}
+/***================================================================***/
+/***================================================================***/
+/*
+ * BuildCharStrings routine
+ */
+/***================================================================***/
+
+static int BuildCharStrings(FontP)
+ psfont *FontP;
+{
+ int N; /* number of values in CharStrings */
+ int i; /* loop thru Subrs */
+ int J; /* length of Subrs entry */
+ psdict *dictP;
+
+ /* next token should be a positive int */
+ N = getInt();
+ if (rc) {
+ /* check if file had TwoSubrs, hi resolution stuff is in file*/
+ if (TwoSubrs) {
+ do {
+ scan_token(inputP);
+ if (tokenType <= TOKEN_NONE) {
+ if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
+ return(SCAN_ERROR);
+ }
+ } while (tokenType != TOKEN_INTEGER);
+ N = tokenValue.integer;
+ }
+ else return(rc); /* if next token was not an Int */
+ }
+ if (N<=0) return(SCAN_ERROR);
+ /* save number of entries in the dictionary */
+
+ dictP = (psdict *)vm_alloc((N+1)*sizeof(psdict));
+ if (!(dictP)) return(SCAN_OUT_OF_MEMORY);
+ FontP->CharStringsP = dictP;
+ dictP[0].key.len = N;
+ /* get N values for CharStrings */
+ for (i=1;i<=N;i++) {
+ /* look for next literal name */
+ rc = getLiteralName(&(dictP[i].key));
+ if (rc) return(rc);
+ /* get 1 integer */
+ J = getInt();
+ if (rc) return(rc); /* if next token was not an Int */
+ if (J<0) return (SCAN_ERROR);
+ dictP[i].value.len = J;
+ /* get the next token, it should be RD or -|, either is ok */
+ rc = getNextValue(TOKEN_NAME);
+ if ( rc != SCAN_OK ) return(rc);
+ rc = getNbytes(J);
+ if (rc == SCAN_OK) {
+ dictP[i].value.data.valueP = tokenStartP;
+ if ( !(vm_alloc(J)) ) return(SCAN_OUT_OF_MEMORY);
+ }
+ else return(rc);
+ }
+ return(SCAN_OK);
+
+}
+/***================================================================***/
+/***================================================================***/
+/*
+ * BuildFontInfo Dictionary
+ */
+/***================================================================***/
+static int BuildFontInfo(fontP)
+ psfont *fontP;
+{
+ psdict *dictP;
+
+ /* allocate the private dictionary */
+ dictP = (psdict *)vm_alloc(20*sizeof(psdict));
+ if (!(dictP)) return(SCAN_OUT_OF_MEMORY);
+
+ fontP->fontInfoP = dictP;
+ fontP->fontInfoP[0].key.len = 17; /* number of actual entries */
+ objFormatName(&(dictP[FONTNAME].key),8,"FontName");
+ objFormatName(&(dictP[FONTNAME].value),0,NULL);
+ objFormatName(&(dictP[PAINTTYPE].key),9,"PaintType");
+ objFormatInteger(&(dictP[PAINTTYPE].value),0);
+ objFormatName(&(dictP[FONTTYPENUM].key),8,"FontType");
+ objFormatInteger(&(dictP[FONTTYPENUM].value),0);
+ objFormatName(&(dictP[FONTMATRIX].key),10,"FontMatrix");
+ objFormatArray(&(dictP[FONTMATRIX].value),0,NULL);
+ objFormatName(&(dictP[FONTBBOX].key),8,"FontBBox");
+ objFormatArray(&(dictP[FONTBBOX].value),0,NULL);
+ objFormatName(&(dictP[ENCODING].key),8,"Encoding");
+ objFormatEncoding(&(dictP[ENCODING].value),0,NULL);
+ objFormatName(&(dictP[UNIQUEID].key),8,"UniqueID");
+ objFormatInteger(&(dictP[UNIQUEID].value),0);
+ objFormatName(&(dictP[STROKEWIDTH].key),11,"StrokeWidth");
+ objFormatReal(&(dictP[STROKEWIDTH].value),0.0);
+ objFormatName(&(dictP[VERSION].key),7,"version");
+ objFormatString(&(dictP[VERSION].value),0,NULL);
+ objFormatName(&(dictP[NOTICE].key),6,"Notice");
+ objFormatString(&(dictP[NOTICE].value),0,NULL);
+ objFormatName(&(dictP[FULLNAME].key),8,"FullName");
+ objFormatString(&(dictP[FULLNAME].value),0,NULL);
+ objFormatName(&(dictP[FAMILYNAME].key),10,"FamilyName");
+ objFormatString(&(dictP[FAMILYNAME].value),0,NULL);
+ objFormatName(&(dictP[WEIGHT].key),6,"Weight");
+ objFormatString(&(dictP[WEIGHT].value),0,NULL);
+ objFormatName(&(dictP[ITALICANGLE].key),11,"ItalicAngle");
+ objFormatReal(&(dictP[ITALICANGLE].value),0.0);
+ objFormatName(&(dictP[ISFIXEDPITCH].key),12,"isFixedPitch");
+ objFormatBoolean(&(dictP[ISFIXEDPITCH].value),FALSE);
+ objFormatName(&(dictP[UNDERLINEPOSITION].key),17,"UnderlinePosition");
+ objFormatReal(&(dictP[UNDERLINEPOSITION].value),0.0);
+ objFormatName(&(dictP[UNDERLINETHICKNESS].key),18,"UnderlineThickness");
+ objFormatReal(&(dictP[UNDERLINETHICKNESS].value),0.0);
+ return(SCAN_OK);
+}
+/***================================================================***/
+/*
+ * BuildPrivate Dictionary
+ */
+/***================================================================***/
+static int BuildPrivate(fontP)
+ psfont *fontP;
+{
+ psdict *Private;
+
+ /* allocate the private dictionary */
+ Private = (psdict *)vm_alloc(20*sizeof(psdict));
+
+ if (!(Private)) return(SCAN_OUT_OF_MEMORY);
+
+ fontP->Private = Private;
+ fontP->Private[0].key.len = 16; /* number of actual entries */
+
+ objFormatName(&(Private[BLUEVALUES].key),10,"BlueValues");
+ objFormatArray(&(Private[BLUEVALUES].value),0,NULL);
+ objFormatName(&(Private[OTHERBLUES].key),10,"OtherBlues");
+ objFormatArray(&(Private[OTHERBLUES].value),0,NULL);
+ objFormatName(&(Private[FAMILYBLUES].key),11,"FamilyBlues");
+ objFormatArray(&(Private[FAMILYBLUES].value),0,NULL);
+ objFormatName(&(Private[FAMILYOTHERBLUES].key),16,"FamilyOtherBlues");
+ objFormatArray(&(Private[FAMILYOTHERBLUES].value),0,NULL);
+ objFormatName(&(Private[BLUESCALE].key),9,"BlueScale");
+ objFormatReal(&(Private[BLUESCALE].value),DEFAULTBLUESCALE);
+ objFormatName(&(Private[BLUESHIFT].key),9,"BlueShift");
+ objFormatInteger(&(Private[BLUESHIFT].value),DEFAULTBLUESHIFT);
+ objFormatName(&(Private[BLUEFUZZ].key),8,"BlueFuzz");
+ objFormatInteger(&(Private[BLUEFUZZ].value),DEFAULTBLUEFUZZ);
+ objFormatName(&(Private[STDHW].key),5,"StdHW");
+ objFormatArray(&(Private[STDHW].value),0,NULL);
+ objFormatName(&(Private[STDVW].key),5,"StdVW");
+ objFormatArray(&(Private[STDVW].value),0,NULL);
+ objFormatName(&(Private[STEMSNAPH].key),9,"StemSnapH");
+ objFormatArray(&(Private[STEMSNAPH].value),0,NULL);
+ objFormatName(&(Private[STEMSNAPV].key),9,"StemSnapV");
+ objFormatArray(&(Private[STEMSNAPV].value),0,NULL);
+ objFormatName(&(Private[FORCEBOLD].key),9,"ForceBold");
+ objFormatBoolean(&(Private[FORCEBOLD].value),DEFAULTFORCEBOLD);
+ objFormatName(&(Private[LANGUAGEGROUP].key),13,"LanguageGroup");
+ objFormatInteger(&(Private[LANGUAGEGROUP].value),DEFAULTLANGUAGEGROUP);
+ objFormatName(&(Private[LENIV].key),5,"LenIV");
+ objFormatInteger(&(Private[LENIV].value),DEFAULTLENIV);
+ objFormatName(&(Private[RNDSTEMUP].key),9,"RndStemUp");
+ objFormatBoolean(&(Private[RNDSTEMUP].value),DEFAULTRNDSTEMUP);
+ objFormatName(&(Private[EXPANSIONFACTOR].key),9,"ExpansionFactor");
+ objFormatReal(&(Private[EXPANSIONFACTOR].value),
+ DEFAULTEXPANSIONFACTOR);
+ return(SCAN_OK);
+}
+/***================================================================***/
+/**********************************************************************/
+/* GetType1Blues(fontP) */
+/* */
+/* Routine to support font-level hints. */
+/* */
+/* Gets all the Blues information from the Private dictionary */
+/* for the font. */
+/* */
+/* */
+/**********************************************************************/
+static int GetType1Blues(fontP)
+ psfont *fontP;
+{
+ psdict *PrivateDictP; /* the Private dict relating to hints */
+ struct blues_struct *blues; /* ptr for the blues struct we will allocate */
+ int i;
+ psobj *HintEntryP;
+
+
+
+ /* get the Private dictionary pointer */
+ PrivateDictP = fontP->Private;
+
+ /* allocate the memory for the blues structure */
+ blues = (struct blues_struct *) vm_alloc(sizeof(struct blues_struct));
+
+ if (!blues) return(SCAN_OUT_OF_MEMORY);
+
+ /* Make fontP's blues ptr point to this newly allocated structure. */
+ fontP->BluesP = blues;
+
+ /* fill in the BlueValues array */
+ HintEntryP = &(PrivateDictP[BLUEVALUES].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ blues->numBlueValues = 0;
+ else {
+ /* get the number of values in the array */
+ if (HintEntryP->len > NUMBLUEVALUES) {
+ blues->numBlueValues = NUMBLUEVALUES;
+ } else
+ blues->numBlueValues = HintEntryP->len;
+ for (i = 0; i<= blues->numBlueValues-1; ++i) {
+ if (objPIsInteger(&HintEntryP->data.arrayP[i]))
+ blues->BlueValues[i] =
+ HintEntryP->data.arrayP[i].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[i]))
+ blues->BlueValues[i] =
+ HintEntryP->data.arrayP[i].data.real;
+ else
+ blues->BlueValues[i] = 0;
+ }
+ }
+
+ /* fill in the OtherBlues array */
+ HintEntryP = &(PrivateDictP[OTHERBLUES].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ blues->numOtherBlues = 0;
+ else {
+ /* get the number of values in the array */
+ if (HintEntryP->len > NUMOTHERBLUES) {
+ blues->numOtherBlues = NUMOTHERBLUES;
+ } else
+ blues->numOtherBlues = HintEntryP->len;
+ for (i = 0; i<= blues->numOtherBlues-1; ++i) {
+ if (objPIsInteger(&HintEntryP->data.arrayP[i]))
+ blues->OtherBlues[i] =
+ HintEntryP->data.arrayP[i].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[i]))
+ blues->OtherBlues[i] =
+ HintEntryP->data.arrayP[i].data.real;
+ else
+ blues->OtherBlues[i] = 0;
+ }
+ }
+
+ /* fill in the FamilyBlues array */
+ HintEntryP = &(PrivateDictP[FAMILYBLUES].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ blues->numFamilyBlues = 0;
+ else {
+ /* get the number of values in the array */
+ if (HintEntryP->len > NUMFAMILYBLUES) {
+ blues->numFamilyBlues = NUMFAMILYBLUES;
+ } else
+ blues->numFamilyBlues = HintEntryP->len;
+ for (i = 0; i<= blues->numFamilyBlues-1; ++i) {
+ if (objPIsInteger(&HintEntryP->data.arrayP[i]))
+ blues->FamilyBlues[i] =
+ HintEntryP->data.arrayP[i].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[i]))
+ blues->FamilyBlues[i] =
+ HintEntryP->data.arrayP[i].data.real;
+ else
+ blues->FamilyBlues[i] = 0;
+ }
+ }
+
+ /* fill in the FamilyOtherBlues array */
+ HintEntryP = &(PrivateDictP[FAMILYOTHERBLUES].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ blues->numFamilyOtherBlues = 0;
+ else {
+ /* get the number of values in the array */
+ if (HintEntryP->len > NUMFAMILYOTHERBLUES) {
+ blues->numFamilyOtherBlues = NUMFAMILYOTHERBLUES;
+ } else
+ blues->numFamilyOtherBlues = HintEntryP->len;
+ for (i = 0; i<= blues->numFamilyOtherBlues-1; ++i) {
+ if (objPIsInteger(&HintEntryP->data.arrayP[i]))
+ blues->FamilyOtherBlues[i] =
+ HintEntryP->data.arrayP[i].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[i]))
+ blues->FamilyOtherBlues[i] =
+ HintEntryP->data.arrayP[i].data.real;
+ else
+ blues->FamilyOtherBlues[i] = 0;
+ }
+ }
+
+ /* fill in the StemSnapH array */
+ HintEntryP = &(PrivateDictP[STEMSNAPH].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ blues->numStemSnapH = 0;
+ else {
+ /* get the number of values in the array */
+ if (HintEntryP->len > NUMSTEMSNAPH) {
+ blues->numStemSnapH = NUMSTEMSNAPH;
+ } else
+ blues->numStemSnapH = HintEntryP->len;
+ for (i = 0; i<= blues->numStemSnapH-1; ++i) {
+ if (objPIsInteger(&HintEntryP->data.arrayP[i]))
+ blues->StemSnapH[i] =
+ HintEntryP->data.arrayP[i].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[i]))
+ blues->StemSnapH[i] =
+ HintEntryP->data.arrayP[i].data.real;
+ else
+ blues->StemSnapH[i] = 0;
+ }
+ }
+
+ /* fill in the StemSnapV array */
+ HintEntryP = &(PrivateDictP[STEMSNAPV].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ blues->numStemSnapV = 0;
+ else {
+ /* get the number of values in the array */
+ if (HintEntryP->len > NUMSTEMSNAPV) {
+ blues->numStemSnapV = NUMSTEMSNAPV;
+ } else
+ blues->numStemSnapV = HintEntryP->len;
+ for (i = 0; i<= blues->numStemSnapV-1; ++i) {
+ if (objPIsInteger(&HintEntryP->data.arrayP[i]))
+ blues->StemSnapV[i] =
+ HintEntryP->data.arrayP[i].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[i]))
+ blues->StemSnapV[i] =
+ HintEntryP->data.arrayP[i].data.real;
+ else
+ blues->StemSnapV[i] = 0;
+ }
+ }
+
+ /* fill in the StdVW array */
+ HintEntryP = &(PrivateDictP[STDVW].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ /* a value of zero signifies no entry */
+ blues->StdVW = 0;
+ else {
+ if (HintEntryP->len > NUMSTDVW) {
+ }
+ if (objPIsInteger(&HintEntryP->data.arrayP[0]))
+ blues->StdVW = HintEntryP->data.arrayP[0].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[0]))
+ blues->StdVW = HintEntryP->data.arrayP[0].data.real;
+ else
+ blues->StdVW = 0;
+ }
+
+ /* fill in the StdHW array */
+ HintEntryP = &(PrivateDictP[STDHW].value);
+ /* check to see if the entry exists and if it's an array */
+ if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 ))
+ /* a value of zero signifies no entry */
+ blues->StdHW = 0;
+ else {
+ if (HintEntryP->len > NUMSTDHW) {
+ }
+ if (objPIsInteger(&HintEntryP->data.arrayP[0]))
+ blues->StdHW = HintEntryP->data.arrayP[0].data.integer;
+ else if (objPIsReal(&HintEntryP->data.arrayP[0]))
+ blues->StdHW = HintEntryP->data.arrayP[0].data.real;
+ else
+ blues->StdHW = 0;
+ }
+
+
+ /* get the ptr to the BlueScale entry */
+ HintEntryP = &(PrivateDictP[BLUESCALE].value);
+ /* put the BlueScale in the blues structure */
+ if (objPIsInteger(HintEntryP)) /* Must be integer! */
+ blues->BlueScale = HintEntryP->data.integer;
+ else if (objPIsReal(HintEntryP)) /* Error? */
+ blues->BlueScale = HintEntryP->data.real;
+ else
+ blues->BlueScale = DEFAULTBLUESCALE;
+
+ /* get the ptr to the BlueShift entry */
+ HintEntryP = &(PrivateDictP[BLUESHIFT].value);
+ if (objPIsInteger(HintEntryP)) /* Must be integer! */
+ blues->BlueShift = HintEntryP->data.integer;
+ else if (objPIsReal(HintEntryP)) /* Error? */
+ blues->BlueShift = HintEntryP->data.real;
+ else
+ blues->BlueShift = DEFAULTBLUESHIFT;
+
+ /* get the ptr to the BlueFuzz entry */
+ HintEntryP = &(PrivateDictP[BLUEFUZZ].value);
+ if (objPIsInteger(HintEntryP)) /* Must be integer! */
+ blues->BlueFuzz = HintEntryP->data.integer;
+ else if (objPIsReal(HintEntryP)) /* Error? */
+ blues->BlueFuzz = HintEntryP->data.real;
+ else
+ blues->BlueFuzz = DEFAULTBLUEFUZZ;
+
+ /* get the ptr to the ForceBold entry */
+ HintEntryP = &(PrivateDictP[FORCEBOLD].value);
+ if (objPIsBoolean(HintEntryP)) /* Must be integer! */
+ blues->ForceBold = HintEntryP->data.boolean;
+ else
+ blues->ForceBold = DEFAULTFORCEBOLD;
+
+ /* get the ptr to the LanguageGroup entry */
+ HintEntryP = &(PrivateDictP[LANGUAGEGROUP].value);
+ if (objPIsInteger(HintEntryP)) /* Must be integer! */
+ blues->LanguageGroup = HintEntryP->data.integer;
+ else
+ blues->LanguageGroup = DEFAULTLANGUAGEGROUP;
+
+ /* get the ptr to the RndStemUp entry */
+ HintEntryP = &(PrivateDictP[RNDSTEMUP].value);
+ if (objPIsBoolean(HintEntryP)) /* Must be integer! */
+ blues->RndStemUp = HintEntryP->data.boolean;
+ else
+ blues->RndStemUp = DEFAULTRNDSTEMUP;
+
+ /* get the ptr to the lenIV entry */
+ HintEntryP = &(PrivateDictP[LENIV].value);
+ if (objPIsInteger(HintEntryP)) /* Must be integer! */
+ blues->lenIV = HintEntryP->data.integer;
+ else
+ blues->lenIV = DEFAULTLENIV;
+
+ /* get the ptr to the ExpansionFactor entry */
+ HintEntryP = &(PrivateDictP[EXPANSIONFACTOR].value);
+ if (objPIsInteger(HintEntryP))
+ blues->ExpansionFactor = HintEntryP->data.integer;
+ else if (objPIsReal(HintEntryP))
+ blues->ExpansionFactor = HintEntryP->data.real;
+ else
+ blues->ExpansionFactor = DEFAULTEXPANSIONFACTOR;
+ return(SCAN_OK);
+}
+/**********************************************************************/
+/* GetType1CharString(fontP,code) */
+/* */
+/* Look up code in the standard encoding vector and return */
+/* the charstring associated with the character name. */
+/* */
+/* fontP is the psfont structure. */
+/* */
+/* Returns a psobj (string) */
+/**********************************************************************/
+psobj *GetType1CharString(fontP, code)
+psfont *fontP;
+unsigned char code;
+{
+ int N; /* the 'Nth' entry in the CharStrings */
+ psobj *charnameP; /* points to psobj that is name of character*/
+
+ psdict *CharStringsDictP; /* dictionary with char strings */
+ psobj *theStringP; /* the definition for the code */
+
+
+
+ if (StdEncArrayP == NULL) {
+ return(NULL);
+ }
+ /* use the code to index into the standard encoding vector */
+ charnameP = &(StdEncArrayP[code]);
+
+ /* test if the encoding array points to a name */
+ if (!(objPIsName(charnameP)) ) {
+ return(NULL);
+ }
+
+ /* Now that we have the character name out of the standardencoding */
+ /* get the character definition out of the current font */
+ CharStringsDictP = fontP->CharStringsP;
+
+ /* search the chars string for this charname as key */
+ N = SearchDictName(CharStringsDictP,charnameP);
+ if (N<=0) {
+ return(NULL);
+ }
+ /* OK, the nth item is the psobj that is the string for this char */
+ theStringP = &(CharStringsDictP[N].value);
+
+ return(theStringP);
+}
+
+/***================================================================***/
+/*
+ * FindDictValue
+ */
+/***================================================================***/
+
+static int FindDictValue(dictP)
+ psdict *dictP;
+{
+ psobj LitName;
+ int N;
+ int V;
+
+ /* we have just scanned a token and it is a literal name */
+ /* need to check if that name is in Private dictionary */
+ objFormatName(&LitName,tokenLength,tokenStartP);
+ /* is it in the dictP */
+ N = SearchDictName(dictP,&LitName);
+ /* if found */
+ if ( N > 0 ) {
+ /* what type */
+ switch (dictP[N].value.type) {
+ case OBJ_ENCODING:
+ V = getEncoding(&(dictP[N].value));
+ if ( V != SCAN_OK ) return(V);
+ break;
+ case OBJ_ARRAY:
+ V = getArray(&(dictP[N].value));
+ if ( V != SCAN_OK ) return(V);
+ break;
+ case OBJ_INTEGER:
+ /* next value in integer */
+ dictP[N].value.data.integer = getInt();
+ if (rc) return(rc); /* if next token was not an Int */
+ break;
+ case OBJ_REAL:
+ /* next value must be real or int, store as a real */
+ scan_token(inputP);
+ if (tokenType == TOKEN_REAL) {
+ dictP[N].value.data.real = tokenValue.real;
+ }
+ else
+ if (tokenType == TOKEN_INTEGER) {
+ dictP[N].value.data.real = tokenValue.integer;
+ }
+ else return(SCAN_ERROR);
+ break;
+ case OBJ_NAME:
+ V = getNextValue(TOKEN_LITERAL_NAME);
+ if ( V != SCAN_OK ) return(V);
+ if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY);
+ objFormatName(&(dictP[N].value),tokenLength,tokenStartP);
+ break;
+ case OBJ_STRING:
+ V = getNextValue(TOKEN_STRING);
+ if ( V != SCAN_OK ) return(V);
+ if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY);
+ objFormatString(&(dictP[N].value),tokenLength,tokenStartP);
+ break;
+ case OBJ_BOOLEAN:
+ scan_token(inputP);
+ if (tokenType != TOKEN_NAME) {
+ return(SCAN_ERROR);
+ }
+ if (0 == strncmp(tokenStartP,"true",4) ) {
+ dictP[N].value.data.boolean =TRUE;
+ }
+ else
+ if (0 == strncmp(tokenStartP,"false",5) ) {
+ dictP[N].value.data.boolean =FALSE;
+ }
+ else return(SCAN_ERROR);
+ break;
+
+ default:
+ return(SCAN_ERROR);
+ break;
+ }
+ }
+ /* Name is not in dictionary. That is ok. */
+ return(SCAN_OK);
+
+}
+/***================================================================***/
+
+/*
+ * -------------------------------------------------------------------
+ * Scan the next token and convert it into an object
+ * Result is placed on the Operand Stack as next object
+ * -------------------------------------------------------------------
+ */
+int scan_font(FontP)
+ psfont *FontP;
+{
+
+
+ char filename[128];
+ char filetype[3];
+ FILE *fileP;
+ char *nameP;
+ int namelen;
+ int V;
+ int i;
+ boolean starthex80;
+
+ starthex80 = FALSE;
+ filetype[0] = 'r';
+ filetype[1] = 'b';
+ filetype[2] = '\0';
+ /* copy the filename and remove leading or trailing blanks */
+ /* point to name and search for leading blanks */
+ nameP= FontP->FontFileName.data.nameP;
+ namelen = FontP->FontFileName.len;
+ while (nameP[0] == ' ') {
+ nameP++;
+ namelen--;
+ }
+ /* now remove any trailing blanks */
+ while ((namelen>0) && ( nameP[namelen-1] == ' ')) {
+ namelen--;
+ }
+ strncpy(filename,nameP,namelen);
+ filename[namelen] = '\0';
+ /* file name is now constructed */
+ inputFile.data.fileP = NULL;
+ filterFile.data.fileP = NULL;
+
+ inputP = &inputFile;
+ if (fileP = fopen(filename,filetype)) {
+ /* get the first byte of file */
+ V = getc(fileP);
+ /* if file starts with x'80' then skip next 5 bytes */
+ if ( V == 0X80 ) {
+ for (i=0;i<5;i++) V = getc(fileP);
+ starthex80 = TRUE;
+ }
+ else ungetc(V,fileP);
+ objFormatFile(inputP,fileP);
+ }
+ else {
+ return(SCAN_FILE_OPEN_ERROR);
+ };
+
+ WantFontInfo = TRUE;
+ InPrivateDict = FALSE;
+ TwoSubrs = FALSE;
+ rc = BuildFontInfo(FontP);
+ if (rc != 0) return(rc);
+
+ /* Assume everything will be OK */
+ rc = 0;
+
+ /* Loop until complete font is read */
+ do {
+ /* Scan the next token */
+ scan_token(inputP);
+
+ /* ==> tokenLength, tokenTooLong, tokenType, and tokenValue are */
+ /* now set */
+
+ switch (tokenType) {
+ case TOKEN_EOF:
+ case TOKEN_NONE:
+ case TOKEN_INVALID:
+ /* in this case we are done */
+ if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
+ rc = SCAN_ERROR;
+ break;
+ case TOKEN_LITERAL_NAME:
+ /* Look up the name */
+ tokenStartP[tokenLength] = '\0';
+ if (InPrivateDict ) {
+ if (0== strncmp(tokenStartP,"Subrs",5) ) {
+ rc = BuildSubrs(FontP);
+ break;
+ }
+ if (0== strncmp(tokenStartP,"CharStrings",11) ) {
+ rc = BuildCharStrings(FontP);
+ if ( (rc == SCAN_OK) ||(rc == SCAN_END) ) {
+ fclose(inputP->data.fileP);
+ /* Build the Blues Structure */
+ rc = GetType1Blues(FontP);
+ /* whatever the return code, return it */
+ /* all the work is done. This is the normal exit.*/
+ return(rc);
+ }
+ break;
+ }
+ rc = FindDictValue(FontP->Private);
+ /* we are not going to report errors */
+ /* Sometimes the font file may test a value such as */
+ /* testing to see if the font is alreadly loaded with */
+ /* same UniqueID. We would faile on /UniqueID get */
+ /* because we are expecting a int to follow UniqueID*/
+ /* If the correct object type does not follow a Name*/
+ /* then we will skip over it without reporting error*/
+ rc = SCAN_OK;
+ break;
+ } /* end of reading Private dictionary */
+ else
+ if (0== strncmp(tokenStartP,"Private",7) ) {
+ InPrivateDict = TRUE;
+ rc = BuildPrivate(FontP);
+ break;
+ }
+ else
+ if (WantFontInfo) {
+ rc = FindDictValue(FontP->fontInfoP);
+ /* we are not going to report errors */
+ rc = SCAN_OK;
+ break;
+ }
+ break;
+ case TOKEN_NAME:
+ if (0 == strncmp(tokenStartP,"eexec",5) ) {
+ /* if file started with x'80', check next 5 bytes */
+ if (starthex80) {
+ V = getc(fileP);
+ if ( V == 0X80 ) {
+ for (i=0;i<5;i++) V = getc(fileP);
+ }
+ else ungetc(V,fileP);
+ }
+ filterFile.data.fileP = T1eexec(inputP->data.fileP);
+ if (filterFile.data.fileP == NULL) {
+ fclose(inputFile.data.fileP);
+ return(SCAN_FILE_OPEN_ERROR);
+ }
+ inputP = &filterFile;
+
+ WantFontInfo = FALSE;
+ }
+ break;
+ }
+
+ }
+ while (rc ==0);
+ fclose(inputP->data.fileP);
+ if (tokenTooLong) return(SCAN_OUT_OF_MEMORY);
+ return(rc);
+}
+
diff --git a/Build/source/texk/ps2pkm/sexpr.c b/Build/source/texk/ps2pkm/sexpr.c
new file mode 100644
index 00000000000..d069cce1c0b
--- /dev/null
+++ b/Build/source/texk/ps2pkm/sexpr.c
@@ -0,0 +1,25 @@
+/*
+ * File: sexpr.c
+ * Purpose: evaluate algebraic expression from single argument
+ * (Derived from expr.c from J.T. Conklin <jtc@netbsd.org>.)
+ * Version: 1.0 (Nov 1995)
+ * Author: Piet Tutelaers
+ */
+
+#include <stdio.h>
+#include "strexpr.h" /* strexpr() */
+#include "basics.h" /* fatal() */
+
+int main(int argc, char *argv[]) {
+ int result;
+
+ if (argc < 2) fatal("Usage: sexpr expression ...\n");
+
+ while (--argc > 0) {
+ if (strexpr(&result, *++argv))
+ fatal("expression error\n");
+
+ printf("%s = %d\n", argv[0] , result);
+ }
+ exit(0);
+}
diff --git a/Build/source/texk/ps2pkm/spaces.c b/Build/source/texk/ps2pkm/spaces.c
new file mode 100644
index 00000000000..3d9f6612708
--- /dev/null
+++ b/Build/source/texk/ps2pkm/spaces.c
@@ -0,0 +1,1001 @@
+/* $XConsortium: spaces.c,v 1.4 91/10/10 11:19:16 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+ /* SPACES CWEB V0021 ******** */
+/*
+:h1 id=spaces.SPACES Module - Handles Coordinate Spaces
+
+This module is responsible for handling the TYPE1IMAGER "XYspace" object.
+
+&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com)
+
+
+:h3.Include Files
+*/
+#include "types.h"
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+#include "pictures.h"
+#include "fonts.h"
+#include "arith.h"
+#include "trig.h"
+
+static void FindFfcn();
+static void FindIfcn();
+/*
+:h3.Entry Points Provided to the TYPE1IMAGER User
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.Entry Points Provided to Other Modules
+*/
+
+/*
+In addition, other modules call the SPACES module through function
+vectors in the "XYspace" structure. The entry points accessed that
+way are "FConvert()", "IConvert()", and "ForceFloat()".
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h3.Macros and Typedefs Provided to Other Modules
+
+:h4.Duplicating and Killing Spaces
+
+Destroying XYspaces is so simple we can do it with a
+macro:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+On the other hand, duplicating XYspaces is slightly more difficult
+because of the need to keep a unique ID in the space, see
+:hdref refid=dupspace..
+
+:h4.Fixed Point Pel Representation
+
+We represent pel positions with fixed point numbers. This does NOT
+mean integer, but truly means fixed point, with a certain number
+of binary digits (FRACTBITS) representing the fractional part of the
+pel.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+/*
+:h2.Data Structures for Coordinate Spaces and Points
+*/
+/*
+:h3 id=matrix.Matrices
+
+TYPE1IMAGER uses 2x2 transformation matrices. We'll use C notation for
+such a matrix (M[2][2]), the first index being rows, the second columns.
+*/
+
+/*
+:h3.The "doublematrix" Structure
+
+We frequently find it desirable to store both a matrix and its
+inverse. We store these in a "doublematrix" structure.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.The "XYspace" Structure
+
+The XYspace structure represents the XYspace object.
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+#define RESERVED 10 /* 'n' IDs are reserved for invalid & immortal spaces */
+/*
+*/
+#define NEXTID ((SpaceID < RESERVED) ? (SpaceID = RESERVED) : ++SpaceID)
+
+static unsigned int SpaceID = 1;
+
+struct XYspace *CopySpace(S)
+ register struct XYspace *S;
+{
+ S = (struct XYspace *)Allocate(sizeof(struct XYspace), S, 0);
+ S->ID = NEXTID;
+ return(S);
+}
+/*
+:h3.The "fractpoint" Structure
+
+A fractional point is just a "fractpel" x and y:
+*/
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+/*
+:h3.Lazy Evaluation of Matrix Inverses
+
+Calculating the inverse of a matrix is somewhat involved, and we usually
+do not need them. So, we flag whether or not the space has the inverse
+already calculated:
+*/
+
+#define HASINVERSE(flag) ((flag)&0x80)
+
+/*
+The following macro forces a space to have an inverse:
+*/
+
+#define CoerceInverse(S) if (!HASINVERSE((S)->flag)) { \
+ MatrixInvert((S)->tofract.normal, (S)->tofract.inverse); (S)->flag |= HASINVERSE(ON); }
+/*
+:h3.IDENTITY Space
+
+IDENTITY space is (logically) the space corresponding to the identity
+transformation matrix. However, since all our transformation matrices
+have a common FRACTFLOAT scale factor to convert to 'fractpel's, that
+is actually what we store in 'tofract' matrix of IDENTITY:
+*/
+
+static struct XYspace identity = { SPACETYPE, ISPERMANENT(ON) + ISIMMORTAL(ON)
+ + HASINVERSE(ON), 2, /* added 3-26-91 PNM */
+ NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ INVALIDID + 1, 0,
+ FRACTFLOAT, 0.0, 0.0, FRACTFLOAT,
+ 1.0/FRACTFLOAT, 0.0, 0.0, 1.0/FRACTFLOAT,
+ 0, 0, 0, 0 };
+struct XYspace *IDENTITY = &identity;
+
+/*
+*/
+#define MAXCONTEXTS 16
+
+static struct doublematrix contexts[MAXCONTEXTS];
+
+#ifdef notdef
+
+static int nextcontext = 1;
+
+/*SHARED LINE(S) ORIGINATED HERE*/
+
+#if __STDC__
+#define pointer void *
+#else
+#define pointer char *
+#endif
+
+/*
+:h3.FindDeviceContext() - Find the Context Given a Device
+
+This routine, given a device, returns the index of the device's
+transformation matrix in the context array. If it cannot find it,
+it will allocate a new array entry and fill it out.
+*/
+
+static int FindDeviceContext(device)
+ pointer device; /* device token */
+{
+ DOUBLE M[2][2]; /* temporary matrix */
+ float Xres,Yres; /* device resolution */
+ int orient = -1; /* device orientation */
+ int rc = -1; /* return code for QueryDeviceState */
+
+ if (rc != 0) /* we only bother with this check once */
+ t1_abort("Context: QueryDeviceState didn't work");
+
+ M[0][0] = M[1][0] = M[0][1] = M[1][1] = 0.0;
+
+ switch (orient) {
+ case 0:
+ M[0][0] = Xres; M[1][1] = -Yres;
+ break;
+ case 1:
+ M[1][0] = Yres; M[0][1] = Xres;
+ break;
+ case 2:
+ M[0][0] = -Xres; M[1][1] = Yres;
+ break;
+ case 3:
+ M[1][0] = -Yres; M[0][1] = -Xres;
+ break;
+ default:
+ t1_abort("QueryDeviceState returned invalid orientation");
+ }
+ return(FindContext(M));
+}
+
+/*
+:h3.FindContext() - Find the Context Given a Matrix
+
+This routine, given a matrix, returns the index of that matrix matrix in
+the context array. If it cannot find it, it will allocate a new array
+entry and fill it out.
+*/
+
+int FindContext(M)
+ DOUBLE M[2][2]; /* array to search for */
+{
+ register int i; /* loop variable for search */
+ for (i=0; i < nextcontext; i++)
+ if (M[0][0] == contexts[i].normal[0][0] && M[1][0] == contexts[i].normal[1][0]
+ && M[0][1] == contexts[i].normal[0][1] && M[1][1] == contexts[i].normal[1][1])
+ break;
+
+ if (i >= nextcontext) {
+ if (i >= MAXCONTEXTS)
+ t1_abort("Context: out of them");
+ LONGCOPY(contexts[i].normal, M, sizeof(contexts[i].normal));
+ MatrixInvert(M, contexts[i].inverse);
+ nextcontext++;
+ }
+
+ return(i);
+}
+
+/*
+:h3.Context() - Create a Coordinate Space for a Device
+
+This user operator is implemented by first finding the device context
+array index, then transforming IDENTITY space to create an appropriate
+cooridnate space.
+*/
+
+struct XYspace *Context(device, units)
+ pointer device; /* device token */
+ DOUBLE units; /* multiples of one inch */
+{
+ DOUBLE M[2][2]; /* device transformation matrix */
+ register int n; /* will hold device context number */
+ register struct XYspace *S; /* XYspace constructed */
+
+ IfTrace2((MustTraceCalls),"Context(%x, %f)\n", device, &units);
+
+ ARGCHECK((device == NULL), "Context of NULLDEVICE not allowed",
+ NULL, IDENTITY, (0), struct XYspace *);
+ ARGCHECK((units == 0.0), "Context: bad units", NULL, IDENTITY, (0), struct XYspace *);
+
+ n = FindDeviceContext(device);
+
+ LONGCOPY(M, contexts[n].normal, sizeof(M));
+
+ M[0][0] *= units;
+ M[0][1] *= units;
+ M[1][0] *= units;
+ M[1][1] *= units;
+
+ S = (struct XYspace *)Xform(IDENTITY, M);
+
+ S->context = n;
+ return(S);
+}
+#endif
+
+/*
+:h3.ConsiderContext() - Adjust a Matrix to Take Out Device Transform
+
+Remember, we have :f/x times U times D/ and :f/M/ and and we want :f/x
+times U times M times D/. An easy way to do this is to calculate
+:f/D sup <-1> times M times D/, because:
+:formula.
+x times U times D times D sup <-1> times M times D = x times U times M times D
+:formula.
+So this subroutine, given an :f/M/and an object, finds the :f/D/ for that
+object and modifies :f/M/ so it is :f/D sup <-1> times M times D/.
+*/
+
+static void ConsiderContext(obj, M)
+ register struct xobject *obj; /* object to be transformed */
+ register DOUBLE M[2][2]; /* matrix (may be changed) */
+{
+ register int context; /* index in contexts array */
+
+ if (obj == NULL) return;
+
+ if (ISPATHTYPE(obj->type)) {
+ struct segment *path = (struct segment *) obj;
+
+ context = path->context;
+ }
+ else if (obj->type == SPACETYPE) {
+ struct XYspace *S = (struct XYspace *) obj;
+
+ context = S->context;
+ }
+ else if (obj->type == PICTURETYPE) {
+
+ }
+ else
+ context = NULLCONTEXT;
+
+ if (context != NULLCONTEXT) {
+ MatrixMultiply(contexts[context].inverse, M, M);
+ MatrixMultiply(M, contexts[context].normal, M);
+ }
+}
+
+/*
+:h2.Conversion from User's X,Y to "fractpel" X,Y
+
+When the user is building paths (lines, moves, curves, etc.) he passes
+the control points (x,y) for the paths together with an XYspace. We
+must convert from the user's (x,y) to our internal representation
+which is in pels (fractpels, actually). This involves transforming
+the user's (x,y) under the coordinate space transformation. It is
+important that we do this quickly. So, we store pointers to different
+conversion functions right in the XYspace structure. This allows us
+to have simpler special case functions for the more commonly
+encountered types of transformations.
+
+:h3.Convert(), IConvert(), and ForceFloat() - Called Through "XYspace" Structure
+
+These are functions that fit in the "convert" and "iconvert" function
+pointers in the XYspace structure. They call the "xconvert", "yconvert",
+"ixconvert", and "iyconvert" as appropriate to actually do the work.
+These secondary routines come in many flavors to handle different
+special cases as quickly as possible.
+*/
+
+void FXYConvert(pt, S, x, y)
+ register struct fractpoint *pt; /* point to set */
+ register struct XYspace *S; /* relevant coordinate space */
+ register DOUBLE x,y; /* user's coordinates of point */
+{
+ pt->x = (*S->xconvert)(S->tofract.normal[0][0], S->tofract.normal[1][0], x, y);
+ pt->y = (*S->yconvert)(S->tofract.normal[0][1], S->tofract.normal[1][1], x, y);
+}
+
+void IXYConvert(pt, S, x, y)
+ register struct fractpoint *pt; /* point to set */
+ register struct XYspace *S; /* relevant coordinate space */
+ register LONG x,y; /* user's coordinates of point */
+{
+ pt->x = (*S->ixconvert)(S->itofract[0][0], S->itofract[1][0], x, y);
+ pt->y = (*S->iyconvert)(S->itofract[0][1], S->itofract[1][1], x, y);
+}
+
+/*
+ForceFloat is a substitute for IConvert(), when we just do not have
+enough significant digits in the coefficients to get high enough
+precision in the answer with fixed point arithmetic. So, we force the
+integers to floats, and do the arithmetic all with floats:
+*/
+
+void ForceFloat(pt, S, x, y)
+ register struct fractpoint *pt; /* point to set */
+ register struct XYspace *S; /* relevant coordinate space */
+ register LONG x,y; /* user's coordinates of point */
+{
+ (*S->convert)(pt, S, (DOUBLE) x, (DOUBLE) y);
+}
+
+/*
+:h3.FXYboth(), FXonly(), FYonly() - Floating Point Conversion
+
+These are the routines we use when the user has given us floating
+point numbers for x and y. FXYboth() is the general purpose routine;
+FXonly() and FYonly() are special cases when one of the coefficients
+is 0.0.
+*/
+
+fractpel FXYboth(cx, cy, x, y)
+ register DOUBLE cx,cy; /* x and y coefficients */
+ register DOUBLE x,y; /* user x,y */
+{
+ register DOUBLE r; /* temporary float */
+
+ r = x * cx + y * cy;
+ return((fractpel) r);
+}
+
+/*ARGSUSED*/
+fractpel FXonly(cx, cy, x, y)
+ register DOUBLE cx,cy; /* x and y coefficients */
+ register DOUBLE x,y; /* user x,y */
+{
+ register DOUBLE r; /* temporary float */
+
+ r = x * cx;
+ return((fractpel) r);
+}
+
+/*ARGSUSED*/
+fractpel FYonly(cx, cy, x, y)
+ register DOUBLE cx,cy; /* x and y coefficients */
+ register DOUBLE x,y; /* user x,y */
+{
+ register DOUBLE r; /* temporary float */
+
+ r = y * cy;
+ return((fractpel) r);
+}
+
+/*
+:h3.IXYboth(), IXonly(), IYonly() - Simple Integer Conversion
+
+These are the routines we use when the user has given us integers for
+x and y, and the coefficients have enough significant digits to
+provide precise answers with only "long" (32 bit?) multiplication.
+IXYboth() is the general purpose routine; IXonly() and IYonly() are
+special cases when one of the coefficients is 0.
+*/
+
+fractpel IXYboth(cx, cy, x, y)
+ register fractpel cx,cy; /* x and y coefficients */
+ register LONG x,y; /* user x,y */
+{
+ return(x * cx + y * cy);
+}
+
+/*ARGSUSED*/
+fractpel IXonly(cx, cy, x, y)
+ register fractpel cx,cy; /* x and y coefficients */
+ register LONG x,y; /* user x,y */
+{
+ return(x * cx);
+}
+
+/*ARGSUSED*/
+fractpel IYonly(cx, cy, x, y)
+ register fractpel cx,cy; /* x and y coefficients */
+ register LONG x,y; /* user x,y */
+{
+ return(y * cy);
+}
+
+
+/*
+:h3.FPXYboth(), FPXonly(), FPYonly() - More Involved Integer Conversion
+
+These are the routines we use when the user has given us integers for
+x and y, but the coefficients do not have enough significant digits to
+provide precise answers with only "long" (32 bit?) multiplication.
+We have increased the number of significant bits in the coefficients
+by FRACTBITS; therefore we must use "double long" (64 bit?)
+multiplication by calling FPmult(). FPXYboth() is the general purpose
+routine; FPXonly() and FPYonly() are special cases when one of the
+coefficients is 0.
+
+Note that it is perfectly possible for us to calculate X with the
+"FP" method and Y with the "I" method, or vice versa. It all depends
+on how the functions in the XYspace structure are filled out.
+*/
+
+fractpel FPXYboth(cx, cy, x, y)
+ register fractpel cx,cy; /* x and y coefficients */
+ register LONG x,y; /* user x,y */
+{
+ return( FPmult(x, cx) + FPmult(y, cy) );
+}
+
+/*ARGSUSED*/
+fractpel FPXonly(cx, cy, x, y)
+ register fractpel cx,cy; /* x and y coefficients */
+ register LONG x,y; /* user x,y */
+{
+ return( FPmult(x, cx) );
+}
+
+/*ARGSUSED*/
+fractpel FPYonly(cx, cy, x, y)
+ register fractpel cx,cy; /* x and y coefficients */
+ register LONG x,y; /* user x,y */
+{
+ return( FPmult(y, cy) );
+}
+
+
+
+/*
+:h3.FillOutFcns() - Determine the Appropriate Functions to Use for Conversion
+
+This function fills out the "convert" and "iconvert" function pointers
+in an XYspace structure, and also fills the "helper"
+functions that actually do the work.
+*/
+
+static void FillOutFcns(S)
+ register struct XYspace *S; /* functions will be set in this structure */
+{
+ S->convert = FXYConvert;
+ S->iconvert = IXYConvert;
+
+ FindFfcn(S->tofract.normal[0][0], S->tofract.normal[1][0], &S->xconvert);
+ FindFfcn(S->tofract.normal[0][1], S->tofract.normal[1][1], &S->yconvert);
+ FindIfcn(S->tofract.normal[0][0], S->tofract.normal[1][0],
+ &S->itofract[0][0], &S->itofract[1][0], &S->ixconvert);
+ FindIfcn(S->tofract.normal[0][1], S->tofract.normal[1][1],
+ &S->itofract[0][1], &S->itofract[1][1], &S->iyconvert);
+
+ if (S->ixconvert == NULL || S->iyconvert == NULL)
+ S->iconvert = ForceFloat;
+}
+
+/*
+:h4.FindFfcn() - Subroutine of FillOutFcns() to Fill Out Floating Functions
+
+This function tests for the special case of one of the coefficients
+being zero:
+*/
+
+static void FindFfcn(cx, cy, fcnP)
+ register DOUBLE cx,cy; /* x and y coefficients */
+ register fractpel (**fcnP)(); /* pointer to function to set */
+{
+ if (cx == 0.0)
+ *fcnP = FYonly;
+ else if (cy == 0.0)
+ *fcnP = FXonly;
+ else
+ *fcnP = FXYboth;
+}
+
+/*
+:h4.FindIfcn() - Subroutine of FillOutFcns() to Fill Out Integer Functions
+
+There are two types of integer functions, the 'I' type and the 'FP' type.
+We use the I type functions when we are satisfied with simple integer
+arithmetic. We used the FP functions when we feel we need higher
+precision (but still fixed point) arithmetic. If all else fails,
+we store a NULL indicating that this we should do the conversion in
+floating point.
+*/
+
+static void FindIfcn(cx, cy, icxP, icyP, fcnP)
+ register DOUBLE cx,cy; /* x and y coefficients */
+ register fractpel *icxP,*icyP; /* fixed point coefficients to set */
+ register fractpel (**fcnP)(); /* pointer to function to set */
+{
+ register fractpel imax; /* maximum of cx and cy */
+
+ *icxP = cx;
+ *icyP = cy;
+
+ if (cx != (float) (*icxP) || cy != (float) (*icyP)) {
+/*
+At this point we know our integer approximations of the coefficients
+are not exact. However, we will still use them if the maximum
+coefficient will not fit in a 'fractpel'. Of course, we have little
+choice at that point, but we haven't lost that much precision by
+staying with integer arithmetic. We have enough significant digits
+so that
+any error we introduce is less than one part in 2:sup/16/.
+*/
+
+ imax = MAX(ABS(*icxP), ABS(*icyP));
+ if (imax < (fractpel) (1<<(FRACTBITS-1)) ) {
+/*
+At this point we know our integer approximations just do not have
+enough significant digits for accuracy. We will add FRACTBITS
+significant digits to the coefficients (by multiplying them by
+1<<FRACTBITS) and go to the "FP" form of the functions. First, we
+check to see if we have ANY significant digits at all (that is, if
+imax == 0). If we don't, we suspect that adding FRACTBITS digits
+won't help, so we punt the whole thing.
+*/
+ if (imax == 0) {
+ *fcnP = NULL;
+ return;
+ }
+ cx *= FRACTFLOAT;
+ cy *= FRACTFLOAT;
+ *icxP = cx;
+ *icyP = cy;
+ *fcnP = FPXYboth;
+ }
+ else
+ *fcnP = IXYboth;
+ }
+ else
+ *fcnP = IXYboth;
+/*
+Now we check for special cases where one coefficient is zero (after
+integer conversion):
+*/
+ if (*icxP == 0)
+ *fcnP = (*fcnP == FPXYboth) ? FPYonly : IYonly;
+ else if (*icyP == 0)
+ *fcnP = (*fcnP == FPXYboth) ? FPXonly : IXonly;
+}
+/*
+:h3.UnConvert() - Find User Coordinates From FractPoints
+
+The interesting thing with this routine is that we avoid calculating
+the matrix inverse of the device transformation until we really need
+it, which is to say, until this routine is called for the first time
+with a given coordinate space.
+
+We also only calculate it only once. If the inverted matrix is valid,
+we don't calculate it; if not, we do. We never expect matrices with
+zero determinants, so by convention, we mark the matrix is invalid by
+marking both X terms zero.
+*/
+
+void UnConvert(S, pt, xp, yp)
+ register struct XYspace *S; /* relevant coordinate space */
+ register struct fractpoint *pt; /* device coordinates */
+ DOUBLE *xp,*yp; /* where to store resulting x,y */
+{
+ DOUBLE x,y;
+
+ CoerceInverse(S);
+ x = pt->x;
+ y = pt->y;
+ *xp = S->tofract.inverse[0][0] * x + S->tofract.inverse[1][0] * y;
+ *yp = S->tofract.inverse[0][1] * x + S->tofract.inverse[1][1] * y;
+}
+
+/*
+:h2.Transformations
+*/
+/*
+:h3 id=xform.Xform() - Transform Object in X and Y
+
+TYPE1IMAGER wants transformations of objects like paths to be identical
+to transformations of spaces. For example, if you scale a line(1,1)
+by 10 it should yield the same result as generating the line(1,1) in
+a coordinate space that has been scaled by 10.
+
+We handle fonts by storing the accumulated transform, for example, SR
+(accumulating on the right). Then when we map the font through space TD,
+for example, we multiply the accumulated font transform on the left by
+the space transform on the right, yielding SRTD in this case. We will
+get the same result if we did S, then R, then T on the space and mapping
+an unmodified font through that space.
+*/
+
+struct xobject *t1_Xform(obj, M)
+ register struct xobject *obj; /* object to transform */
+ register DOUBLE M[2][2]; /* transformation matrix */
+{
+ if (obj == NULL)
+ return(NULL);
+
+ if (obj->type == FONTTYPE) {
+ register struct font *F = (struct font *) obj;
+
+ F = UniqueFont(F);
+ return((struct xobject*)F);
+ }
+ if (obj->type == PICTURETYPE) {
+/*
+In the case of a picture, we choose both to update the picture's
+transformation matrix and keep the handles up to date.
+*/
+ register struct picture *P = (struct picture *) obj;
+ register struct segment *handles; /* temporary path to transform handles */
+
+ P = UniquePicture(P);
+ handles = PathSegment(LINETYPE, P->origin.x, P->origin.y);
+ handles = Join(handles,
+ PathSegment(LINETYPE, P->ending.x, P->ending.y) );
+ handles = (struct segment *)Xform((struct xobject *) handles, M);
+ P->origin = handles->dest;
+ P->ending = handles->link->dest;
+ KillPath(handles);
+ return((struct xobject *)P);
+ }
+
+ if (ISPATHTYPE(obj->type)) {
+ struct XYspace pseudo; /* local temporary space */
+ PseudoSpace(&pseudo, M);
+ return((struct xobject *) PathTransform(obj, &pseudo));
+ }
+
+
+ if (obj->type == SPACETYPE) {
+ register struct XYspace *S = (struct XYspace *) obj;
+
+/* replaced ISPERMANENT(S->flag) with S->references > 1 3-26-91 PNM */
+ if (S->references > 1)
+ S = CopySpace(S);
+ else
+ S->ID = NEXTID;
+
+ MatrixMultiply(S->tofract.normal, M, S->tofract.normal);
+ /*
+ * mark inverted matrix invalid:
+ */
+ S->flag &= ~HASINVERSE(ON);
+
+ FillOutFcns(S);
+ return((struct xobject *) S);
+ }
+
+ return(ArgErr("Untransformable object", obj, obj));
+}
+
+/*
+:h3.Transform() - Transform an Object
+
+This is the external user's entry point.
+*/
+struct xobject *t1_Transform(obj, cxx, cyx, cxy, cyy)
+ struct xobject *obj;
+ DOUBLE cxx,cyx,cxy,cyy; /* 2x2 transform matrix elements in row order */
+{
+ DOUBLE M[2][2];
+
+ IfTrace1((MustTraceCalls),"Transform(%z,", obj);
+ IfTrace4((MustTraceCalls)," %f %f %f %f)\n", &cxx, &cyx, &cxy, &cyy);
+
+ M[0][0] = cxx;
+ M[0][1] = cyx;
+ M[1][0] = cxy;
+ M[1][1] = cyy;
+ ConsiderContext(obj, M);
+ return(Xform(obj, M));
+}
+/*
+:h3.Scale() - Special Case of Transform()
+
+This is a user operator.
+*/
+
+struct xobject *t1_Scale(obj, sx, sy)
+ struct xobject *obj; /* object to scale */
+ DOUBLE sx,sy; /* scale factors in x and y */
+{
+ DOUBLE M[2][2];
+ IfTrace3((MustTraceCalls),"Scale(%z, %f, %f)\n", obj, &sx, &sy);
+ M[0][0] = sx;
+ M[1][1] = sy;
+ M[1][0] = M[0][1] = 0.0;
+ ConsiderContext(obj, M);
+ return(Xform(obj, M));
+}
+
+/*
+:h3 id=rotate.Rotate() - Special Case of Transform()
+
+We special-case different settings of 'degrees' for performance
+and accuracy within the DegreeSin() and DegreeCos() routines themselves.
+*/
+
+#ifdef notdef
+struct xobject *xiRotate(obj, degrees)
+ struct xobject *obj; /* object to be transformed */
+ DOUBLE degrees; /* degrees of COUNTER-clockwise rotation */
+{
+ DOUBLE M[2][2];
+
+
+ IfTrace2((MustTraceCalls),"Rotate(%z, %f)\n", obj, &degrees);
+
+ M[0][0] = M[1][1] = DegreeCos(degrees);
+ M[1][0] = - (M[0][1] = DegreeSin(degrees));
+ ConsiderContext(obj, M);
+ return(Xform(obj, M));
+}
+#endif
+
+/*
+:h3.PseudoSpace() - Build a Coordinate Space from a Matrix
+
+Since we have built all this optimized code that, given an (x,y) and
+a coordinate space, yield transformed (x,y), it seems a shame not to
+use the same logic when we need to multiply an (x,y) by an arbitrary
+matrix that is not (initially) part of a coordinate space. This
+subroutine takes the arbitrary matrix and builds a coordinate
+space, with all its nifty function pointers.
+*/
+
+void PseudoSpace(S, M)
+ struct XYspace *S; /* coordinate space structure to fill out */
+ DOUBLE M[2][2]; /* matrix that will become 'tofract.normal' */
+{
+ S->type = SPACETYPE;
+ S->flag = ISPERMANENT(ON) + ISIMMORTAL(ON);
+ S->references = 2; /* 3-26-91 added PNM */
+ S->tofract.normal[0][0] = M[0][0];
+ S->tofract.normal[1][0] = M[1][0];
+ S->tofract.normal[0][1] = M[0][1];
+ S->tofract.normal[1][1] = M[1][1];
+
+ FillOutFcns(S);
+}
+
+/*
+:h2 id=matrixa.Matrix Arithmetic
+
+Following the convention in Newman and Sproull, :hp1/Interactive
+Computer Graphics/,
+matrices are organized:
+:xmp.
+ | cxx cyx |
+ | cxy cyy |
+:exmp.
+A point is horizontal, for example:
+:xmp.
+ [ x y ]
+:exmp.
+This means that:
+:formula/x prime = cxx times x + cxy times y/
+:formula/y prime = cyx times x + cyy times y/
+I've seen the other convention, where transform matrices are
+transposed, equally often in the literature.
+*/
+
+/*
+:h3.MatrixMultiply() - Implements Multiplication of Two Matrices
+
+Implements matrix multiplication, A * B = C.
+
+To remind myself, matrix multiplication goes rows of A times columns
+of B.
+The output matrix may be the same as one of the input matrices.
+*/
+void MatrixMultiply(A, B, C)
+ register DOUBLE A[2][2],B[2][2]; /* input matrices */
+ register DOUBLE C[2][2]; /* output matrix */
+{
+ register DOUBLE txx,txy,tyx,tyy;
+
+ txx = A[0][0] * B[0][0] + A[0][1] * B[1][0];
+ txy = A[1][0] * B[0][0] + A[1][1] * B[1][0];
+ tyx = A[0][0] * B[0][1] + A[0][1] * B[1][1];
+ tyy = A[1][0] * B[0][1] + A[1][1] * B[1][1];
+
+ C[0][0] = txx;
+ C[1][0] = txy;
+ C[0][1] = tyx;
+ C[1][1] = tyy;
+}
+/*
+:h3.MatrixInvert() - Invert a Matrix
+
+My reference for matrix inversion was :hp1/Elementary Linear Algebra/
+by Paul C. Shields, Worth Publishers, Inc., 1968.
+*/
+void MatrixInvert(M, Mprime)
+ DOUBLE M[2][2]; /* input matrix */
+ DOUBLE Mprime[2][2]; /* output inverted matrix */
+{
+ register DOUBLE D; /* determinant of matrix M */
+ register DOUBLE txx,txy,tyx,tyy;
+
+ txx = M[0][0];
+ txy = M[1][0];
+ tyx = M[0][1];
+ tyy = M[1][1];
+
+ D = M[1][1] * M[0][0] - M[1][0] * M[0][1];
+ if (D == 0.0)
+ t1_abort("MatrixInvert: can't");
+
+ Mprime[0][0] = tyy / D;
+ Mprime[1][0] = -txy / D;
+ Mprime[0][1] = -tyx / D;
+ Mprime[1][1] = txx / D;
+}
+/*
+:h2.Initialization, Queries, and Debug
+*/
+/*
+:h3.InitSpaces() - Initialize Constant Spaces
+
+For compatibility, we initialize a coordinate space called USER which
+maps 72nds of an inch to pels on the default device.
+*/
+
+struct XYspace *USER = &identity;
+
+void InitSpaces()
+{
+ extern char *DEFAULTDEVICE;
+
+ IDENTITY->type = SPACETYPE;
+ FillOutFcns(IDENTITY);
+
+ contexts[NULLCONTEXT].normal[1][0]
+ = contexts[NULLCONTEXT].normal[0][1]
+ = contexts[NULLCONTEXT].inverse[1][0]
+ = contexts[NULLCONTEXT].inverse[0][1] = 0.0;
+ contexts[NULLCONTEXT].normal[0][0]
+ = contexts[NULLCONTEXT].normal[1][1]
+ = contexts[NULLCONTEXT].inverse[0][0]
+ = contexts[NULLCONTEXT].inverse[1][1] = 1.0;
+
+ USER->flag |= ISIMMORTAL(ON);
+ CoerceInverse(USER);
+}
+/*
+:h3.QuerySpace() - Returns the Transformation Matrix of a Space
+
+Since the tofract matrix of an XYspace includes the scale factor
+necessary to produce fractpel results (i.e., FRACTFLOAT), this
+must be taken out before we return the matrix to the user. Fortunately,
+this is simple: just multiply by the inverse of IDENTITY!
+*/
+
+void QuerySpace(S, cxxP, cyxP, cxyP, cyyP)
+ register struct XYspace *S; /* space asked about */
+ register DOUBLE *cxxP,*cyxP,*cxyP,*cyyP; /* where to put answer */
+{
+ DOUBLE M[2][2]; /* temp matrix to build user's answer */
+
+ if (S->type != SPACETYPE) {
+ ArgErr("QuerySpace: not a space", S, NULL);
+ return;
+ }
+ MatrixMultiply(S->tofract.normal, IDENTITY->tofract.inverse, M);
+ *cxxP = M[0][0];
+ *cxyP = M[1][0];
+ *cyxP = M[0][1];
+ *cyyP = M[1][1];
+}
+
+/*
+:h3.FormatFP() - Format a Fixed Point Pel
+
+We format the pel as "dddd.XXXX", where XX's are hexidecimal digits,
+and the dd's are decimal digits. This might be a little confusing
+mixing hexidecimal and decimal like that, but it is convenient
+to use for debug.
+
+We make sure we have N (FRACTBITS/4) digits past the decimal point.
+*/
+#define FRACTMASK ((1<<FRACTBITS)-1) /* mask for fractional part */
+
+void FormatFP(str, fpel)
+ register char *str; /* output str */
+ register fractpel fpel; /* fractional pel input */
+{
+ char temp[8];
+ register char *s;
+ register char *sign;
+
+ if (fpel < 0) {
+ sign = "-";
+ fpel = -fpel;
+ }
+ else
+ sign = "";
+
+ sprintf(temp, "000%x", fpel & FRACTMASK);
+ s = temp + strlen(temp) - (FRACTBITS/4);
+
+ sprintf(str, "%s%d.%sx", sign, fpel >> FRACTBITS, s);
+}
+
+/*
+:h3.DumpSpace() - Display a Coordinate Space
+*/
+/*ARGSUSED*/
+void DumpSpace(S)
+ register struct XYspace *S;
+{
+ IfTrace4(TRUE,"--Coordinate space at %x,ID=%d,convert=%x,iconvert=%x\n",
+ S, S->ID, S->convert, S->iconvert);
+ IfTrace2(TRUE," | %12.3f %12.3f |",
+ &S->tofract.normal[0][0], &S->tofract.normal[0][1]);
+ IfTrace2(TRUE," [ %p %p ]\n", S->itofract[0][0], S->itofract[0][1]);
+ IfTrace2(TRUE," | %12.3f %12.3f |",
+ &S->tofract.normal[1][0], &S->tofract.normal[1][1]);
+ IfTrace2(TRUE," [ %p %p ]\n", S->itofract[1][0], S->itofract[1][1]);
+}
diff --git a/Build/source/texk/ps2pkm/spaces.h b/Build/source/texk/ps2pkm/spaces.h
new file mode 100644
index 00000000000..10023195345
--- /dev/null
+++ b/Build/source/texk/ps2pkm/spaces.h
@@ -0,0 +1,142 @@
+/* $XConsortium: spaces.h,v 1.3 91/10/10 11:19:22 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
+ * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+ * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
+ * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
+ * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
+ * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
+ * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/*SHARED*/
+
+#include "types.h"
+
+#define USER t1_User
+#define IDENTITY t1_Identity
+
+#define Context(d,u) t1_Context(d,u)
+#define Transform(o,f1,f2,f3,f4) t1_Transform(o,f1,f2,f3,f4)
+#define Rotate(o,d) t1_Rotate(o,d)
+#define Scale(o,sx,sy) t1_Scale(o,sx,sy)
+#define QuerySpace(S,f1,f2,f3,f4) t1_QuerySpace(S,f1,f2,f3,f4)
+#define Warp(s1,o,s2) t1_Warp(s1,o,s2)
+
+struct XYspace *t1_Context(); /* creates a coordinate space for a device */
+struct xobject *t1_Transform(); /* transform an object */
+struct xobject *t1_Rotate(); /* rotate an object */
+struct xobject *t1_Scale(); /* scale an object */
+struct xobject *t1_Warp(); /* transform like delta of two spaces */
+void t1_QuerySpace(); /* returns coordinate space matrix */
+
+/*END SHARED*/
+/*SHARED*/
+
+#define DeviceResolution t1_DeviceResolution
+#define InitSpaces() t1_InitSpaces()
+#define CopySpace(s) t1_CopySpace(s)
+#define Xform(o,M) t1_Xform(o,M)
+#define UnConvert(S,pt,xp,yp) t1_UnConvert(S,pt,xp,yp)
+#define MatrixMultiply(A,B,C) t1_MMultiply(A,B,C)
+#define MatrixInvert(A,B) t1_MInvert(A,B)
+#define PseudoSpace(S,M) t1_PseudoSpace(S,M)
+#define FindContext(M) t1_FindContext(M)
+
+void t1_InitSpaces(); /* initialize pre-defined coordinate spaces */
+struct XYspace *t1_CopySpace(); /* duplicate a coordinate space */
+struct xobject *t1_Xform(); /* transform object by matrix */
+void t1_UnConvert(); /* return user coordinates from device coordinates */
+void t1_MMultiply(); /* multiply two matrices */
+void t1_MInvert(); /* invert a matrix */
+void t1_PseudoSpace(); /* force a coordinate space from a matrix */
+int t1_FindContext(); /* return the "context" represented by a matrix */
+
+/*END SHARED*/
+/*SHARED*/
+
+/* #define KillSpace(s) Free(s)
+Note - redefined KillSpace() to check references !
+3-26-91 PNM */
+
+#define KillSpace(s) if ( (--(s->references) == 0) ||\
+ ( (s->references == 1) && ISPERMANENT(s->flag) ) )\
+ Free(s)
+
+#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s))
+#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s))
+
+/*END SHARED*/
+/*SHARED*/
+
+typedef SHORT pel; /* integer pel locations */
+typedef LONG fractpel; /* fractional pel locations */
+
+#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */
+/*
+We define the following macros to convert from 'fractpel' to 'pel' and
+vice versa:
+*/
+#define TOFRACTPEL(p) (((fractpel)p)<<FRACTBITS)
+#define FPHALF (1<<(FRACTBITS-1))
+#define NEARESTPEL(fp) (((fp)+FPHALF)>>FRACTBITS)
+#define FRACTFLOAT (DOUBLE)(1L<<FRACTBITS)
+
+/*END SHARED*/
+/*SHARED*/
+
+struct doublematrix {
+ DOUBLE normal[2][2];
+ DOUBLE inverse[2][2];
+} ;
+
+/*END SHARED*/
+/*SHARED*/
+
+struct XYspace {
+ XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
+ /* type = SPACETYPE */
+ void (*convert)(); /* calculate "fractpoint" X,Y from float X,Y */
+ void (*iconvert)(); /* calculate "fractpoint" X,Y from int X,Y */
+ fractpel (*xconvert)(); /* subroutine of convert */
+ fractpel (*yconvert)(); /* subroutine of convert */
+ fractpel (*ixconvert)(); /* subroutine of iconvert */
+ fractpel (*iyconvert)(); /* subroutine of iconvert */
+ int ID; /* unique identifier (used in font caching) */
+ unsigned char context; /* device context of coordinate space */
+ struct doublematrix tofract; /* xform to get to fractional pels */
+ fractpel itofract[2][2]; /* integer version of "tofract.normal" */
+} ;
+
+#define INVALIDID 0 /* no valid space will have this ID */
+
+/*END SHARED*/
+/*SHARED*/
+
+struct fractpoint {
+ fractpel x,y;
+} ;
+
+/*END SHARED*/
+/*SHARED*/
+
+#define NULLCONTEXT 0
+
+/*END SHARED*/
diff --git a/Build/source/texk/ps2pkm/stamp-auto.in b/Build/source/texk/ps2pkm/stamp-auto.in
new file mode 100644
index 00000000000..73d8381f204
--- /dev/null
+++ b/Build/source/texk/ps2pkm/stamp-auto.in
@@ -0,0 +1 @@
+Mo Aug 22 08:28:57 CEST 2005
diff --git a/Build/source/texk/ps2pkm/strexpr.c b/Build/source/texk/ps2pkm/strexpr.c
new file mode 100644
index 00000000000..ebfcc8fcdf5
--- /dev/null
+++ b/Build/source/texk/ps2pkm/strexpr.c
@@ -0,0 +1,292 @@
+/*
+ * File: strexpr.c
+ * Purpose: calculate value from algebraic string expression
+ * (Stripped down from expr.c from J.T. Conklin <jtc@netbsd.org>.)
+ * Version: 1.0 (Nov 1995)
+ * Author: Piet Tutelaers
+ */
+
+#include <stdio.h> /* sprintf() */
+#include <stdlib.h> /* free(), malloc() */
+#include <string.h> /* strchr(), strcpy() */
+#include <ctype.h> /* isdigit(), isspace() */
+#include "basics.h" /* fatal() */
+
+const char *OPERATORS = "+-*/%()";
+
+enum token {
+ ADD, SUB, MUL, DIV, MOD, LP, RP, OPERAND, EOI
+};
+
+struct val {
+ enum {
+ integer,
+ string
+ } type;
+
+ union {
+ char *s;
+ int i;
+ } u;
+};
+
+enum token token;
+struct val *tokval;
+char *pexpr;
+
+struct val *
+make_int(int i)
+{
+ struct val *vp;
+
+ vp = (struct val *) malloc(sizeof(*vp));
+ if (vp == NULL) fatal("expression error\n");
+ vp->type = integer;
+ vp->u.i = i;
+ return vp;
+}
+
+
+struct val *
+make_str(char *s)
+{
+ char operand[32]; int i;
+
+ struct val *vp;
+
+ vp = (struct val *) malloc(sizeof(*vp));
+ if (vp == NULL) fatal("expression error\n");
+
+ pexpr = s; i = 0;
+ while (1) {
+ if (isspace(*pexpr) || *pexpr == '\0') break;
+ if (strchr(OPERATORS, *pexpr) != NULL) break;
+ if (i == 30) fatal("operand too large\n");
+ operand[i++] = *pexpr++;
+ }
+ if (i == 0) fatal("invalid operand\n");
+ operand[i] = '\0';
+ vp->u.s = malloc(i+1);
+ if (vp->u.s == NULL) fatal("Out of memory\n");
+ strcpy(vp->u.s, operand);
+ vp->type = string;
+ return vp;
+}
+
+
+void
+free_value(struct val *vp)
+{
+ if (vp->type == string)
+ free(vp->u.s);
+ free(vp);
+}
+
+
+/* determine if vp is an integer; if so, return it's value in *r */
+int
+is_integer(struct val *vp, int *r)
+{
+ char *s;
+ int neg;
+ int i;
+
+ if (vp->type == integer) {
+ *r = vp->u.i;
+ return 1;
+ }
+
+ /*
+ * POSIX.2 defines an "integer" as an optional unary minus
+ * followed by digits.
+ */
+ s = vp->u.s;
+ i = 0;
+
+ neg = (*s == '-');
+ if (neg)
+ s++;
+
+ while (*s) {
+ if (!isdigit(*s))
+ return 0;
+
+ i *= 10;
+ i += *s - '0';
+
+ s++;
+ }
+
+ if (neg)
+ i *= -1;
+
+ *r = i;
+ return 1;
+}
+
+
+/* coerce to vp to an integer */
+int
+to_integer(struct val *vp)
+{
+ int r;
+
+ if (vp->type == integer)
+ return 1;
+
+ if (is_integer(vp, &r)) {
+ free(vp->u.s);
+ vp->u.i = r;
+ vp->type = integer;
+ return 1;
+ }
+
+ return 0;
+}
+
+
+/* coerce to vp to an string */
+void
+to_string(struct val *vp)
+{
+ char *tmp;
+
+ if (vp->type == string)
+ return;
+
+ tmp = malloc(25);
+ if (tmp == NULL) fatal("Out of memory\n");
+ sprintf(tmp, "%d", vp->u.i);
+ vp->type = string;
+ vp->u.s = tmp;
+}
+
+void
+nexttoken()
+{
+ char *i; /* index */
+
+ while (isspace(*pexpr)) pexpr++;
+
+ if (*pexpr == '\0') {
+ token = EOI;
+ return;
+ }
+
+ if ((i = strchr(OPERATORS, *pexpr)) != NULL) {
+ pexpr++;
+ token = i - OPERATORS;
+ return;
+ }
+ tokval = make_str(pexpr);
+ token = OPERAND;
+ return;
+}
+
+struct val *
+eval6()
+{
+ struct val *eval3(void);
+ struct val *v;
+
+ if (token == OPERAND) {
+ nexttoken();
+ return tokval;
+
+ } else if (token == LP) {
+ nexttoken();
+ v = eval3();
+
+ if (token != RP)
+ fatal("missing parenthesis in expression\n");
+ nexttoken();
+ return v;
+ } else fatal("expression error\n");
+ /* NOTREACHED */
+}
+
+/* Parse and evaluate multiplication and division expressions */
+struct val *
+eval4()
+{
+ struct val *l, *r;
+ enum token op;
+
+ l = eval6();
+ while ((op = token) == MUL || op == DIV || op == MOD) {
+ nexttoken();
+ r = eval6();
+
+ if (!to_integer(l) || !to_integer(r)) {
+ fatal("non-numeric argument\n");
+ }
+
+ if (op == MUL) {
+ l->u.i *= r->u.i;
+ } else {
+ if (r->u.i == 0) {
+ fatal("division by zero\n");
+ }
+ if (op == DIV) {
+ l->u.i /= r->u.i;
+ } else {
+ l->u.i %= r->u.i;
+ }
+ }
+
+ free_value(r);
+ }
+
+ return l;
+}
+
+/* Parse and evaluate addition and subtraction expressions */
+struct val *
+eval3()
+{
+ struct val *l, *r;
+ enum token op;
+
+ l = eval4();
+ while ((op = token) == ADD || op == SUB) {
+ nexttoken();
+ r = eval4();
+
+ if (!to_integer(l) || !to_integer(r)) {
+ fatal("non-numeric argument\n");
+ }
+
+ if (op == ADD) {
+ l->u.i += r->u.i;
+ } else {
+ l->u.i -= r->u.i;
+ }
+
+ free_value(r);
+ }
+
+ return l;
+}
+
+/*
+ * Evaluate the algebraic expression contained in <expression>. The
+ * value will be assigned to <result>. When errors are encountered
+ * non-zero is returned (if program is not aborted) otherwise zero.
+ */
+int strexpr(int *result, char *expression) {
+ struct val *vp;
+
+ pexpr = expression;
+
+ nexttoken();
+ vp = eval3();
+
+ if (token != EOI) return 1;
+
+ if (vp->type == integer || to_integer(vp)) {
+ *result = vp->u.i;
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/Build/source/texk/ps2pkm/strexpr.h b/Build/source/texk/ps2pkm/strexpr.h
new file mode 100644
index 00000000000..6012a8be56f
--- /dev/null
+++ b/Build/source/texk/ps2pkm/strexpr.h
@@ -0,0 +1,13 @@
+/*
+ * File: strexpr.h
+ * Purpose: calculate value from algebraic string expression
+ * Version: 1.0 (Nov 1995)
+ * Author: Piet Tutelaers
+ */
+
+/*
+ * Evaluate the algebraic expression contained in <expression>. The
+ * value will be assigned to <result>. When errors are encountered
+ * non-zero (if program is not aborted) is returned otherwise zero.
+ */
+int strexpr(int *result, char *expression);
diff --git a/Build/source/texk/ps2pkm/strokes.h b/Build/source/texk/ps2pkm/strokes.h
new file mode 100644
index 00000000000..59076329847
--- /dev/null
+++ b/Build/source/texk/ps2pkm/strokes.h
@@ -0,0 +1,38 @@
+/* $XConsortium: strokes.h,v 1.2 91/10/10 11:19:25 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/*STUB*/
+
+#define CopyLineStyle(s) s
+#define CopyStrokePath(p) p
+#define KillStrokePath(p)
+#define KillLineStyle(s)
+#define CoercePath(sp) sp
+#define DoStroke(sp) sp
+
diff --git a/Build/source/texk/ps2pkm/t1funcs.c b/Build/source/texk/ps2pkm/t1funcs.c
new file mode 100644
index 00000000000..a56bb4087d2
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1funcs.c
@@ -0,0 +1,560 @@
+/* $XConsortium: t1funcs.c,v 1.10 92/05/12 18:07:55 gildea Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License, subject to the license given below, to use,
+ * copy, modify, and distribute this software * and its
+ * documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear
+ * in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software
+ * without specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author: Jeffrey B. Lotspiech, IBM Almaden Research Center
+ * Modeled on spfuncs.c by Dave Lemke, Network Computing Devices, Inc
+ * which contains the following copyright and permission notices:
+ *
+ * Copyright 1990, 1991 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation and the
+ * Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this protoype software
+ * and its documentation to Members and Affiliates of the MIT X Consortium
+ * any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Network Computing Devices, Digital or
+ * MIT not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "types.h"
+#include <string.h>
+#include "ffilest.h"
+#ifdef XSERVER
+#include <X11/Xfuncs.h>
+#include "FSproto.h"
+#endif
+#include "t1intf.h"
+
+#include "objects.h"
+#include "spaces.h"
+#include "regions.h"
+#include "t1stdio.h"
+#include "util.h"
+#include "fontfcn.h"
+
+typedef char *encoding[256];
+
+#ifdef HAVE_PROTOTYPES
+int Type1OpenScalable(char **ev, struct _Font **ppFont, int flags,
+ struct _FontEntry *entry, char *fileName,
+ struct _FontScalable *vals, fsBitmapFormat format,
+ ULONG fmask, double efactor,double slant);
+static int Type1GetGlyphs(struct _Font *pFont, ULONG count,
+ unsigned char *chars, FontEncoding charEncoding,
+ ULONG *glyphCount, struct _CharInfo **glyphs );
+void Type1CloseFont(struct _Font *pFont);
+extern int Type1GetInfoScalable(struct _FontPathElement *fpe,
+ struct _FontInfo *pInfo,
+ struct _FontEntry *entry,
+ struct _FontName *fontName,
+ char *fileName,
+ struct _FontScalable *Vals);
+static int Type1GetMetrics(struct _Font *pFont, ULONG count,
+ unsigned char *chars, FontEncoding charEncoding,
+ ULONG *glyphCount, xCharInfo **glyphs );
+static void fillrun(register char *p,pel x0,pel x1,int bit);
+extern char * Xalloc(int size);
+extern void Xfree(void*);
+static void fill(char *dest,int h,int w,struct region *area,
+ int byte,int bit,int wordsize);
+extern Bool fontfcnA(char *env,int *mode);
+extern struct region *fontfcnB(struct XYspace *S, unsigned char *code,
+ int *lenP, int *mode);
+extern int FontDefaultFormat(int *bit, int *byte,
+ int *glyphs, int *scan);
+extern int CheckFSFormat(int format,int fmask,int *bit,int *byte,int *scan,int *glyph,int *image);
+extern void QueryFontLib(char *env,char *infoName,void *infoValue,int *rcodeP);
+extern void T1FillFontInfo(struct _Font *pFont,struct _FontScalable *Vals,char *Filename,char *Fontname);
+extern void T1InitStdProps(void);
+extern int FontFileRegisterRenderer(FontRendererRec *);
+#else
+int Type1OpenScalable ();
+static int Type1GetGlyphs();
+void Type1CloseFont();
+extern int Type1GetInfoScalable ();
+
+static int Type1GetMetrics ();
+
+static void fillrun();
+
+extern char *Xalloc();
+extern void Xfree();
+static void fill();
+
+extern Bool fontfcnA();
+extern struct region *fontfcnB();
+extern int CheckFSFormat();
+extern void QueryFontLib();
+extern void T1FillFontInfo();
+extern void T1InitStdProps();
+extern int FontFileRegisterRenderer();
+#endif
+
+extern psfont *FontP;
+extern psobj *ISOLatin1EncArrayP;
+
+#define DECIPOINTSPERINCH 722.7
+
+extern int currentchar; /* for error reporting */
+
+/*ARGSUSED*/
+int Type1OpenScalable (ev, ppFont, flags, entry, fileName, vals, format,
+ fmask, efactor, slant)
+ encoding ev;
+ FontPtr *ppFont;
+ int flags;
+ FontEntryPtr entry;
+ char *fileName;
+ FontScalablePtr vals;
+ fsBitmapFormat format;
+ fsBitmapFormatMask fmask;
+ DOUBLE efactor;
+ DOUBLE slant;
+{
+ extern struct XYspace *IDENTITY;
+
+ FontPtr pFont;
+ int bit,
+ byte,
+ glyph,
+ scan,
+ image;
+ int pad,wordsize; /* scan & image in bits */
+ int size; /* for memory size calculations */
+ struct XYspace *S; /* coordinate space for character */
+ struct region *area;
+ DOUBLE scale; /* scale factor for font */
+ DOUBLE txx, tyx, txy, tyy;
+ CharInfoRec *glyphs;
+ register int i;
+ int len,rc;
+ struct type1font *type1;
+ char *p;
+
+ /* set up default values */
+ FontDefaultFormat(&bit, &byte, &glyph, &scan);
+ /* get any changes made from above */
+ rc = CheckFSFormat(format, fmask, &bit, &byte, &scan, &glyph, &image);
+ if (rc != Successful)
+ return rc;
+
+ pad = glyph * 8;
+ wordsize = scan * 8;
+
+#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad))
+
+ pFont = (FontPtr) Xalloc(sizeof(FontRec));
+ if (pFont == NULL)
+ return AllocError;
+
+ type1 = (struct type1font *)Xalloc(sizeof(struct type1font));
+ if (type1 == NULL) {
+ Xfree(pFont);
+ return AllocError;
+ }
+ (void) memset(type1, 0, sizeof(struct type1font));
+
+ scale = (DOUBLE) vals->pixel;
+
+ /* Code added by E. Schenk. July 25, 1992.
+ * The following code reads the FontMatrix for the font,
+ * and transforms the font using it. This is necessary
+ * for fonts that are just an oblique, or extend of
+ * a normal font.
+ */
+ { float fontmatrix[6];
+ int rc;
+ QueryFontLib(fileName,"FontMatrix",fontmatrix,&rc);
+ if (!rc) {
+ S = (struct XYspace *) Transform(IDENTITY,
+ fontmatrix[0], fontmatrix[1], fontmatrix[2], fontmatrix[3]);
+ }
+ else {
+ S = (struct XYspace *) Scale(IDENTITY,0.001,0.001);
+ }
+ }
+ /* End of additional code */
+
+ if (efactor == 1.0 && slant == 0.0)
+ S = (struct XYspace *)Permanent(Scale(S, scale, - scale));
+ else {
+ txx = (DOUBLE)vals->x * efactor * vals->point / DECIPOINTSPERINCH;
+ tyy = (DOUBLE)vals->y * vals->point / DECIPOINTSPERINCH;
+ tyx = 0.0;
+ txy = (DOUBLE)vals->x * slant * vals->point / DECIPOINTSPERINCH;
+ S = (struct XYspace *) Permanent(Transform(S, txx, tyx, txy, -tyy));
+ }
+
+ glyphs = type1->glyphs;
+
+ /* load font if not already loaded */
+ if (!fontfcnA(fileName, &rc))
+ return (rc);
+
+ for (i=0; i < 256-FIRSTCOL; i++) {
+ LONG h,w;
+ LONG paddedW;
+
+ if (ev[i] == NULL) continue;
+ len = strlen(ev[i]);
+
+ currentchar = i;
+
+ rc = 0;
+ area = fontfcnB(S, ev[i], &len, &rc);
+ if (rc < 0) {
+ rc = BadFontName;
+ break;
+ }
+ else if (rc > 0)
+ continue;
+
+ if (area == NULL)
+ continue;
+
+ h = area->ymax - area->ymin;
+ w = area->xmax - area->xmin;
+ paddedW = PAD(w, pad);
+
+ if (h > 0 && w > 0) {
+ size = h * paddedW / 8;
+ glyphs[i].bits = (char *)Xalloc(size);
+ if (glyphs[i].bits == NULL) {
+ rc = AllocError;
+ break;
+ }
+ }
+ else {
+ h = w = 0;
+ area->xmin = area->xmax = 0;
+ area->ymax = area->ymax = 0;
+ }
+
+ glyphs[i].metrics.leftSideBearing = area->xmin;
+ glyphs[i].metrics.characterWidth = NEARESTPEL(area->ending.x - area->origin.x);
+ glyphs[i].metrics.rightSideBearing = w + area->xmin;
+ glyphs[i].metrics.descent = area->ymax - NEARESTPEL(area->origin.y);
+ glyphs[i].metrics.ascent = h - glyphs[i].metrics.descent;
+
+ if (h > 0 && w > 0) {
+ (void) memset(glyphs[i].bits, 0, size);
+ fill(glyphs[i].bits, h, paddedW, area, byte, bit, wordsize );
+ }
+
+ Destroy(area);
+ }
+
+ if (i != 256 - FIRSTCOL) {
+ for (i--; i >= 0; i--)
+ if (glyphs[i].bits != NULL)
+ Xfree(glyphs[i].bits);
+ Xfree(type1);
+ Xfree(pFont);
+ return rc;
+ }
+ type1->pDefault = NULL;
+
+ pFont->format = format;
+
+ pFont->bit = bit;
+ pFont->byte = byte;
+ pFont->glyph = glyph;
+ pFont->scan = scan;
+
+ pFont->info.firstCol = FIRSTCOL;
+ pFont->info.lastCol = 255;
+ pFont->info.firstRow = 0;
+ pFont->info.lastRow = 0;
+
+ pFont->get_metrics = Type1GetMetrics;
+ pFont->get_glyphs = Type1GetGlyphs;
+ pFont->unload_font = Type1CloseFont;
+ pFont->refcnt = 0;
+ pFont->maxPrivate = -1;
+ pFont->devPrivates = 0;
+
+ pFont->fontPrivate = (unsigned char *) type1;
+
+ T1FillFontInfo(pFont, vals, fileName, entry->name.name);
+
+ *ppFont = pFont;
+ return Successful;
+}
+
+/* NOTE: ILH removed tests ...->characterWidth != 0 below because zero-width
+ does not mean the character is empty, simply that it has zero escapement. */
+
+static int
+Type1GetGlyphs(pFont, count, chars, charEncoding, glyphCount, glyphs)
+ FontPtr pFont;
+ ULONG count;
+ register unsigned char *chars;
+ FontEncoding charEncoding;
+ ULONG *glyphCount; /* RETURN */
+ CharInfoPtr *glyphs; /* RETURN */
+{
+ unsigned int firstRow;
+ unsigned int numRows;
+ CharInfoPtr *glyphsBase;
+ register unsigned int c;
+ register CharInfoPtr pci;
+ unsigned int r;
+ CharInfoPtr pDefault;
+ register struct type1font *type1Font;
+ register int firstCol;
+
+ type1Font = (struct type1font *) pFont->fontPrivate;
+ firstCol = pFont->info.firstCol;
+ pDefault = type1Font->pDefault;
+ glyphsBase = glyphs;
+
+ switch (charEncoding) {
+
+ case Linear8Bit:
+ case TwoD8Bit:
+ if (pFont->info.firstRow > 0)
+ break;
+ while (count--) {
+ c = (*chars++);
+ if (c >= firstCol)
+ *glyphs++ = &type1Font->glyphs[c-firstCol];
+ else if (pDefault)
+ *glyphs++ = pDefault;
+ }
+ break;
+ case Linear16Bit:
+ while (count--) {
+ c = *chars++ << 8;
+ c = (c | *chars++);
+ if (c < 256 && c >= firstCol)
+ *glyphs++ = &type1Font->glyphs[c-firstCol];
+ else if (pDefault)
+ *glyphs++ = pDefault;
+ }
+ break;
+
+ case TwoD16Bit:
+ firstRow = pFont->info.firstRow;
+ numRows = pFont->info.lastRow - firstRow + 1;
+ while (count--) {
+ r = (*chars++) - firstRow;
+ c = (*chars++);
+ if (r < numRows && c < 256 && c >= firstCol)
+ *glyphs++ = &type1Font->glyphs[(r << 8) + c - firstCol];
+ else if (pDefault)
+ *glyphs++ = pDefault;
+ }
+ break;
+ }
+ *glyphCount = glyphs - glyphsBase;
+ return Successful;
+}
+
+static int
+Type1GetMetrics(pFont, count, chars, charEncoding, glyphCount, glyphs)
+ FontPtr pFont;
+ ULONG count;
+ register unsigned char *chars;
+ FontEncoding charEncoding;
+ ULONG *glyphCount; /* RETURN */
+ xCharInfo **glyphs; /* RETURN */
+{
+ static CharInfoRec nonExistantChar;
+
+ int ret;
+ struct type1font *type1Font;
+ CharInfoPtr oldDefault;
+
+ type1Font = (struct type1font *) pFont->fontPrivate;
+ oldDefault = type1Font->pDefault;
+ type1Font->pDefault = &nonExistantChar;
+ ret = Type1GetGlyphs(pFont, count, chars, charEncoding, glyphCount, (CharInfoPtr *) glyphs);
+ type1Font->pDefault = oldDefault;
+ return ret;
+}
+
+void Type1CloseFont(pFont)
+ FontPtr pFont;
+{
+ register int i;
+ struct type1font *type1;
+
+ type1 = (struct type1font *) pFont->fontPrivate;
+ for (i=0; i < 256 - pFont->info.firstCol; i++)
+ if (type1->glyphs[i].bits != NULL)
+ Xfree(type1->glyphs[i].bits);
+ Xfree(type1);
+
+ if (pFont->info.props)
+ Xfree(pFont->info.props);
+
+ if (pFont->info.isStringProp)
+ Xfree(pFont->info.isStringProp);
+
+ Xfree(pFont);
+}
+
+
+
+static void fill(dest, h, w, area, byte, bit, wordsize)
+ register char *dest; /* destination bitmap */
+ int h,w; /* dimensions of 'dest', w padded */
+ register struct region *area; /* region to write to 'dest' */
+ int byte,bit; /* flags; LSBFirst or MSBFirst */
+ int wordsize; /* number of bits per word for LSB/MSB purposes */
+{
+ register struct edgelist *edge; /* for looping through edges */
+ register char *p; /* current scan line in 'dest' */
+ register int y; /* for looping through scans */
+ register int wbytes = w / 8; /* number of bytes in width */
+ register pel *leftP,*rightP; /* pointers to X values, left and right */
+ int xmin = area->xmin; /* upper left X */
+ int ymin = area->ymin; /* upper left Y */
+
+ for (edge = area->anchor; VALIDEDGE(edge); edge = edge->link->link) {
+
+ p = dest + (edge->ymin - ymin) * wbytes;
+ leftP = edge->xvalues;
+ rightP = edge->link->xvalues;
+
+ for (y = edge->ymin; y < edge->ymax; y++) {
+ fillrun(p, *leftP++ - xmin, *rightP++ - xmin, bit);
+ p += wbytes;
+ }
+ }
+/*
+Now, as an afterthought, we'll go reorganize if odd byte order requires
+it:
+*/
+ if (byte == LSBFirst && wordsize != 8) {
+ register int i;
+
+ switch (wordsize) {
+ case 16:
+ {
+ register unsigned short data,*p;
+
+ p = (unsigned short *) dest;
+
+ for (i = h * w /16; --i >= 0;) {
+ data = *p;
+ *p++ = (data << 8) + (data >> 8);
+ }
+ break;
+ }
+ case 64:
+ case 32:
+ {
+ register ULONG data,*p;
+
+ p = (ULONG *) dest;
+
+ for (i = h * w / 32; --i >= 0;) {
+ data = *p;
+ *p++ = (data << 24) + (data >> 24)
+ + (0xFF00 & (data >> 8))
+ + (0xFF0000 & (data << 8));
+ }
+ if (wordsize == 64) {
+
+ p = (ULONG *) dest;
+
+ for (i = h * w / 64; --i >= 0;) {
+ data = *p++;
+ p[-1] = p[0];
+ *p++ = data;
+ }
+ }
+ break;
+ }
+ default:
+ t1_abort("xiFill: unknown format");
+ }
+ }
+
+}
+
+#define ALLONES 0xFF
+
+static void fillrun(register char *p, pel x0, pel x1, int bit)
+{
+ register int startmask,endmask; /* bits to set in first and last char*/
+ register int middle; /* number of chars between start and end + 1 */
+
+ if (x1 <= x0)
+ return;
+ middle = x1/8 - x0/8;
+ p += x0/8;
+ x0 &= 7; x1 &= 7;
+ if (bit == LSBFirst) {
+ startmask = ALLONES << x0;
+ endmask = ~(ALLONES << x1);
+ }
+ else {
+ startmask = ALLONES >> x0;
+ endmask = ~(ALLONES >> x1);
+ }
+ if (middle == 0)
+ *p++ |= startmask & endmask;
+ else {
+ *p++ |= startmask;
+ while (--middle > 0)
+ *p++ = ALLONES;
+ *p |= endmask;
+ }
+}
+
+
+static FontRendererRec renderers[] = {
+ { ".pfa", 4, (int (*)()) 0, Type1OpenScalable,
+ (int (*)()) 0, Type1GetInfoScalable, 0 },
+ { ".pfb", 4, (int (*)()) 0, Type1OpenScalable,
+ (int (*)()) 0, Type1GetInfoScalable, 0 }
+};
+
+Type1RegisterFontFileFunctions()
+{
+ int i;
+
+ T1InitStdProps();
+ for (i=0; i < sizeof(renderers) / sizeof(FontRendererRec); i++)
+ FontFileRegisterRenderer(&renderers[i]);
+}
diff --git a/Build/source/texk/ps2pkm/t1hdigit.h b/Build/source/texk/ps2pkm/t1hdigit.h
new file mode 100644
index 00000000000..9979ef55ceb
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1hdigit.h
@@ -0,0 +1,40 @@
+/* $XConsortium: t1hdigit.h,v 1.2 91/10/10 11:19:31 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* Indicators for special characters in the p_hdigit.h tables */
+#define HERROR (0xfe)
+#define HWHITE_SPACE (0xfd)
+#define HRIGHT_ANGLE (0xfc)
+#define LAST_HDIGIT (0xf0)
+
+/* Declarations for the tables */
+#define HighHexP (HighHex+1)
+extern unsigned char HighHex[];
+#define LowHexP (LowHex+1)
+extern unsigned char LowHex[];
diff --git a/Build/source/texk/ps2pkm/t1imager.h b/Build/source/texk/ps2pkm/t1imager.h
new file mode 100644
index 00000000000..a8a8e3f609f
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1imager.h
@@ -0,0 +1,152 @@
+/* $XConsortium: t1imager.h,v 1.5 92/03/20 14:36:05 keith Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "types.h"
+#include "fontmisc.h"
+
+typedef pointer xobject;
+typedef pointer location;
+typedef pointer path;
+typedef pointer region;
+typedef pointer XYspace;
+
+#ifndef NOEXTERNS
+/*
+The following are the user entry locations to TYPE1IMAGER
+*/
+extern path t1_Bezier();
+extern path t1_ClosePath();
+extern xobject t1_Destroy();
+extern xobject t1_Dup();
+extern char *t1_ErrorMsg();
+extern void t1_InitImager();
+extern region t1_Interior();
+extern location t1_ILoc();
+extern xobject t1_Join();
+extern path t1_Line();
+extern xobject t1_Permanent();
+extern path t1_Phantom();
+extern location t1_Loc();
+extern xobject t1_Scale();
+extern xobject t1_Snap();
+extern location t1_SubLoc();
+extern xobject t1_Temporary();
+
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+/*
+Here are some TYPE1IMAGER functions that are defined in terms of others:
+*/
+
+#define t1_AddLoc(p1,p2) t1_Join(p1,p2)
+
+#ifndef NONAMES
+/*
+Define the simple form of all the subroutine names:
+*/
+#define AddLoc(p1,p2) t1_AddLoc(p1,p2)
+#define Bezier(B,C,D) t1_Bezier(B,C,D)
+#define ClosePath(p) t1_ClosePath(p,0)
+#define Complement(area) t1_Complement(area)
+#define Destroy(o) t1_Destroy(o)
+#define Dup(o) t1_Dup(o)
+#define ErrorMsg() t1_ErrorMsg()
+#define HeadSegment(p) t1_HeadSegment(p)
+#define InitImager() t1_InitImager()
+#define Interior(p,rule) t1_Interior(p,rule)
+#define ILoc(S,x,y) t1_ILoc(S,x,y)
+#define Join(p1,p2) t1_Join(p1,p2)
+#define Line(P) t1_Line(P)
+#define Permanent(o) t1_Permanent(o)
+#define Phantom(o) t1_Phantom(o)
+#define Loc(S,x,y) t1_Loc(S,(DOUBLE)x,(DOUBLE)y)
+#define Scale(o,sx,sy) t1_Scale(o,(DOUBLE)sx,(DOUBLE)sy)
+#define Snap(o) t1_Snap(o)
+#define SubLoc(a,b) t1_SubLoc(a,b)
+#define Temporary(o) t1_Temporary(o)
+#define TermImager() t1_TermImager()
+#define Transform(o,cxx,cyx,cxy,cyy) t1_Transform(o,(DOUBLE)cxx,(DOUBLE)cyx,\
+ (DOUBLE)cxy,(DOUBLE)cyy)
+
+#endif
+
+#define WINDINGRULE -2
+#define EVENODDRULE -3
+
+#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */
+
+/*
+Stroke() line style constants:
+*/
+
+/*
+Coordinate space constants:
+*/
+#define IDENTITY t1_Identity
+extern XYspace *IDENTITY;
+
+/*
+Generic null object definition:
+*/
+#define NULLOBJECT ((xobject)NULL)
+
+/*
+Null path definition:
+*/
+#define NULLPATH NULLOBJECT
+
+/*
+Full page and null region definition:
+*/
+#define INFINITY t1_Infinity
+#ifndef NOEXTERNS
+extern region *INFINITY;
+#endif
+#ifdef NULLREGION
+#undef NULLREGION
+#endif
+#define NULLREGION NULLOBJECT
+
+#define FF_PARSE_ERROR 5
+#define FF_PATH 1
+
+extern pointer xiStub();
diff --git a/Build/source/texk/ps2pkm/t1info.c b/Build/source/texk/ps2pkm/t1info.c
new file mode 100644
index 00000000000..f7cdb4e5a2e
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1info.c
@@ -0,0 +1,414 @@
+/* $XConsortium: t1info.c,v 1.9 92/03/20 16:00:13 eswu Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License, subject to the license given below, to use,
+ * copy, modify, and distribute this software * and its
+ * documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear
+ * in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software
+ * without specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author: Carol H. Thompson IBM Almaden Research Center
+ * Modeled on spinfo.c by Dave Lemke, Network Computing Devices, Inc
+ * which contains the following copyright and permission notices:
+ *
+ * Copyright 1990, 1991 Network Computing Devices;
+ * Portions Copyright 1987 by Digital Equipment Corporation and the
+ * Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, and distribute this protoype software
+ * and its documentation to Members and Affiliates of the MIT X Consortium
+ * any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Network Computing Devices, Digital or
+ * MIT not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "types.h"
+#include <stdio.h>
+#include <string.h>
+#include "ffilest.h"
+#ifdef XSERVER
+#include "FSproto.h"
+#endif
+#include "ffilest.h"
+#include "t1intf.h"
+
+extern char *Xalloc(int size);
+extern void Xfree(void *);
+extern int FontComputeInfoAccelerators(FontInfoPtr);
+extern long MakeAtom(char *, unsigned int, Bool);
+extern int Type1OpenScalable(FontPathElementPtr ev , FontPtr *ppFont ,
+ int flags,
+ FontEntryPtr entry,
+ char *fileName,
+ FontScalablePtr vals,
+ unsigned long format,
+ unsigned long fmask,double efactor,double slant);
+extern void Type1CloseFont(struct _Font *pFont);
+extern void QueryFontLib(char *env,char *infoName,void *infoValue,int *rcodeP);
+
+#define DECIPOINTSPERINCH 722.7
+#define DEFAULTRES 75
+#define DEFAULTPOINTSIZE 120
+
+enum scaleType {
+ atom, pixel_size, point_size, resolution_x, resolution_y,
+ average_width, scaledX, scaledY, unscaled, scaledXoverY,
+ uncomputed
+};
+
+typedef struct _fontProp {
+ char *name;
+ LONG atom;
+ enum scaleType type;
+} fontProp;
+
+static fontProp fontNamePropTable[] = { /* Example: */
+ "FOUNDRY", 0, atom, /* adobe */
+ "FAMILY_NAME", 0, atom, /* times roman */
+ "WEIGHT_NAME", 0, atom, /* bold */
+ "SLANT", 0, atom, /* i */
+ "SETWIDTH_NAME", 0, atom, /* normal */
+ "ADD_STYLE_NAME", 0, atom, /* */
+ "PIXEL_SIZE", 0, pixel_size, /* 18 */
+ "POINT_SIZE", 0, point_size, /* 180 */
+ "RESOLUTION_X", 0, resolution_x, /* 72 */
+ "RESOLUTION_Y", 0, resolution_y, /* 72 */
+ "SPACING", 0, atom, /* p */
+ "AVERAGE_WIDTH", 0, average_width, /* 0 */
+ "CHARSET_REGISTRY", 0, atom, /* ISO8859 */
+ "CHARSET_ENCODING", 0, atom, /* 1 */
+};
+
+static fontProp extraProps[] = {
+ "FONT", 0, atom,
+ "COPYRIGHT", 0, atom,
+};
+
+/* this is a bit kludgy */
+#define FONTPROP 0
+#define COPYRIGHTPROP 1
+
+#define NNAMEPROPS (sizeof(fontNamePropTable) / sizeof(fontProp))
+#define NEXTRAPROPS (sizeof(extraProps) / sizeof(fontProp))
+
+#define NPROPS (NNAMEPROPS + NEXTRAPROPS)
+
+/*ARGSUSED*/
+static void
+FillHeader(pInfo, Vals)
+ FontInfoPtr pInfo;
+ FontScalablePtr Vals;
+{
+ /* OpenScalable in T1FUNCS sets the following:
+ pInfo->firstCol,
+ pInfo->firstRow,
+ pInfo->lastCol, and
+ pInfo->lastRow. */
+ /* the following are ununsed
+ pInfo->pad. */
+
+ /* Items we should handle better someday +++ */
+ pInfo->defaultCh = 0;
+ pInfo->drawDirection = LeftToRight;
+ /* our size is based only on Vals->pixel, so we won't
+ create an anamorphic font (yet) */
+ pInfo->anamorphic = 0;
+ pInfo->inkMetrics = 0; /* no ink metrics here */
+ pInfo->cachable = 1; /* no licensing (yet) */
+}
+
+static void
+adjust_min_max(minc, maxc, tmp)
+ xCharInfo *minc,
+ *maxc,
+ *tmp;
+{
+#define MINMAX(field,ci) \
+ if (minc->field > (ci)->field) \
+ minc->field = (ci)->field; \
+ if (maxc->field < (ci)->field) \
+ maxc->field = (ci)->field;
+
+ MINMAX(ascent, tmp);
+ MINMAX(descent, tmp);
+ MINMAX(leftSideBearing, tmp);
+ MINMAX(rightSideBearing, tmp);
+ MINMAX(characterWidth, tmp);
+
+#undef MINMAX
+}
+
+static void
+ComputeBounds(pInfo, pChars, Vals)
+ FontInfoPtr pInfo;
+ CharInfoPtr pChars;
+ FontScalablePtr Vals;
+{
+ int i;
+ xCharInfo minchar, maxchar;
+ LONG width = 0;
+ int numchars = 0;
+ int totchars;
+ int overlap;
+ int maxlap;
+
+ minchar.ascent = minchar.descent =
+ minchar.leftSideBearing = minchar.rightSideBearing =
+ minchar.characterWidth = 32767;
+ minchar.attributes = 0; /* What's this for? +++ */
+ maxchar.ascent = maxchar.descent =
+ maxchar.leftSideBearing = maxchar.rightSideBearing =
+ maxchar.characterWidth = -32767;
+ maxchar.attributes = 0;
+
+ maxlap = -32767;
+ totchars = pInfo->lastCol - pInfo->firstCol + 1;
+ pInfo->allExist = 1;
+ for (i = 0; i < totchars; i++,pChars++) {
+ xCharInfo *pmetrics = &pChars->metrics;
+
+ if (pmetrics->characterWidth) {
+ width += pmetrics->characterWidth;
+ numchars++;
+ adjust_min_max(&minchar, &maxchar, pmetrics);
+ overlap = pmetrics->rightSideBearing - pmetrics->characterWidth;
+ if (overlap > maxlap) maxlap = overlap;
+ }
+ else pInfo->allExist = 0;
+ }
+
+ Vals->width = ((width * 10)+((numchars+1)/2)) / numchars;
+ /* (We think the above average width value should be put into
+ the Vals structure. This may be wrong, and the proper
+ behavior might be to regard the values in Vals as sacred,
+ and for us to squirrel the computed number in a static, and
+ then use that static in ComputeStdProps.) */
+ pInfo->maxbounds = maxchar;
+ pInfo->minbounds = minchar;
+ pInfo->ink_maxbounds = maxchar;
+ pInfo->ink_minbounds = minchar;
+ pInfo->maxOverlap = maxlap + -(minchar.leftSideBearing);
+
+ /* Set the pInfo flags */
+ /* Properties set by FontComputeInfoAccelerators:
+ pInfo->noOverlap;
+ pInfo->terminalFont;
+ pInfo->constantMetrics;
+ pInfo->constantWidth;
+ pInfo->inkInside;
+
+ */
+ FontComputeInfoAccelerators (pInfo);
+}
+
+static void
+ComputeProps(pInfo, Vals, Filename)
+ FontInfoPtr pInfo;
+ FontScalablePtr Vals;
+ char *Filename;
+{
+ int infoint;
+ int infoBBox[4];
+ int rc;
+
+ QueryFontLib(Filename, "isFixedPitch", &infoint, &rc);
+ if (!rc) {
+ pInfo->constantWidth = infoint;
+ }
+ QueryFontLib((char *)0, "FontBBox", infoBBox, &rc);
+ if (!rc) {
+ pInfo->fontAscent = (infoBBox[3] * Vals->pixel) / 1000;
+ pInfo->fontDescent = - (infoBBox[1] * Vals->pixel) / 1000;
+ }
+}
+
+static void
+ComputeStdProps(pInfo, Vals, Filename, Fontname)
+ FontInfoPtr pInfo;
+ FontScalablePtr Vals;
+ char *Filename;
+ char *Fontname;
+{
+ FontPropPtr pp;
+ int i,
+ nprops;
+ fontProp *fpt;
+ char *is_str;
+ char *ptr1,
+ *ptr2;
+ char *infostrP;
+ LONG rc;
+ char scaledName[MAXFONTNAMELEN];
+
+ strcpy (scaledName, Fontname);
+#ifdef WIN32
+ /* Fill in our copy of the fontname from the Vals structure */
+ FontParseXLFDName (scaledName, Vals, FONT_XLFD_REPLACE_VALUE);
+#endif
+
+ /* This form of the properties is used by the X-client; the X-server
+ doesn't care what they are. */
+ nprops = pInfo->nprops = NPROPS;
+ pInfo->isStringProp = (char *) Xalloc(sizeof(char) * nprops);
+ pInfo->props = (FontPropPtr) Xalloc(sizeof(FontPropRec) * nprops);
+ if (!pInfo->isStringProp || !pInfo->props) {
+ Xfree(pInfo->isStringProp);
+ pInfo->isStringProp = (char *) 0;
+ Xfree(pInfo->props);
+ pInfo->props = (FontPropPtr) 0;
+ return;
+ }
+ (void) memset(pInfo->isStringProp, 0, (sizeof(char) * nprops));
+
+ ptr2 = scaledName;
+ for (i = NNAMEPROPS, pp = pInfo->props, fpt = fontNamePropTable, is_str = pInfo->isStringProp;
+ i;
+ i--, pp++, fpt++, is_str++) {
+ ptr1 = ptr2 + 1;
+ if (*ptr1 == '-')
+ ptr2 = ptr1;
+ else {
+ if (i > 1)
+ ptr2 = strchr(ptr1 + 1, '-');
+ else
+ ptr2 = strchr(ptr1 + 1, '\0');
+ }
+ pp->name = fpt->atom;
+ switch (fpt->type) {
+ case atom: /* Just copy info from scaledName */
+ *is_str = TRUE;
+ pp->value = MakeAtom(ptr1, ptr2 - ptr1, TRUE);
+ break;
+ case pixel_size:
+ pp->value = Vals->pixel;
+ break;
+ case point_size:
+ pp->value = Vals->point;
+ break;
+ case resolution_x:
+ pp->value = Vals->x;
+ break;
+ case resolution_y:
+ pp->value = Vals->y;
+ break;
+ case average_width:
+ pp->value = Vals->width;
+ break;
+ }
+ }
+
+ for (i = 0, fpt = extraProps;
+ i < NEXTRAPROPS;
+ i++, is_str++, pp++, fpt++) {
+ pp->name = fpt->atom;
+ switch (i) {
+ case FONTPROP:
+ /* Why do we need this property -- nice for debug anyway */
+ *is_str = TRUE;
+ pp->value = MakeAtom(scaledName, strlen(scaledName), TRUE);
+ break;
+ case COPYRIGHTPROP:
+ *is_str = TRUE;
+ QueryFontLib(Filename, "Notice", &infostrP, &rc);
+ if (rc || !infostrP) {
+ infostrP = "Copyright Notice not available";
+ }
+ pp->value = MakeAtom(infostrP, strlen(infostrP), TRUE);
+ break;
+ }
+ }
+}
+
+/*ARGSUSED*/
+int
+Type1GetInfoScalable(fpe, pInfo, entry, fontName, fileName, Vals)
+ FontPathElementPtr fpe;
+ FontInfoPtr pInfo;
+ FontEntryPtr entry;
+ FontNamePtr fontName;
+ char *fileName;
+ FontScalablePtr Vals;
+{
+ FontPtr pfont;
+ int flags = 0;
+ LONG format = 0; /* It doesn't matter what format for just info */
+ LONG fmask = 0;
+ int ret;
+
+ ret = Type1OpenScalable(fpe, &pfont, flags, entry, fileName, Vals, format, fmask, 1.0, 0.0);
+ if (ret != Successful)
+ return ret;
+ *pInfo = pfont->info;
+
+ /* XXX - Set pointers in pfont->info to NULL so they are not freed. */
+ pfont->info.props = NULL;
+ pfont->info.isStringProp = NULL;
+
+ Type1CloseFont(pfont);
+ return Successful;
+}
+
+void
+T1FillFontInfo(pFont, Vals, Filename, Fontname)
+ FontPtr pFont;
+ FontScalablePtr Vals;
+ char *Filename;
+ char *Fontname;
+{
+ FontInfoPtr pInfo = &pFont->info;
+ struct type1font *p = (struct type1font *)pFont->fontPrivate;
+
+ FillHeader(pInfo, Vals);
+
+ ComputeBounds(pInfo, p->glyphs, Vals);
+
+ ComputeProps(pInfo, Vals, Filename);
+ ComputeStdProps(pInfo, Vals, Filename, Fontname);
+}
+
+/* Called once, at renderer registration time */
+void
+T1InitStdProps()
+{
+ int i;
+ fontProp *t;
+
+ i = sizeof(fontNamePropTable) / sizeof(fontProp);
+ for (t = fontNamePropTable; i; i--, t++)
+ t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);
+ i = sizeof(extraProps) / sizeof(fontProp);
+ for (t = extraProps; i; i--, t++)
+ t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE);
+}
diff --git a/Build/source/texk/ps2pkm/t1intf.h b/Build/source/texk/ps2pkm/t1intf.h
new file mode 100644
index 00000000000..21eb910d2ad
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1intf.h
@@ -0,0 +1,36 @@
+/* $XConsortium: t1intf.h,v 1.2 91/10/10 11:19:39 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#define FIRSTCOL 0
+
+struct type1font {
+ CharInfoPtr pDefault;
+ CharInfoRec glyphs[256-FIRSTCOL];
+};
diff --git a/Build/source/texk/ps2pkm/t1io.c b/Build/source/texk/ps2pkm/t1io.c
new file mode 100644
index 00000000000..0c5639fc269
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1io.c
@@ -0,0 +1,290 @@
+/* $XConsortium: t1io.c,v 1.4 91/10/10 11:19:41 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author: Carol H. Thompson IBM Almaden Research Center
+ */
+/*******************************************************************
+* I/O package for Type 1 font reading
+********************************************************************/
+
+#ifndef STATIC
+#define STATIC static
+#endif
+
+#include "c-auto.h"
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include "t1stdio.h"
+#include "t1hdigit.h"
+
+/* Constants and variables used in the decryption */
+#define c1 ((unsigned short)52845)
+#define c2 ((unsigned short)22719)
+static unsigned short r;
+static int asc, Decrypt;
+static int extrach;
+static int haveextrach;
+
+/* Our single FILE structure and buffer for this package */
+STATIC F_FILE TheFile;
+STATIC unsigned char TheBuffer[F_BUFSIZ];
+
+/* Our routines */
+F_FILE *T1Open(), *T1Eexec();
+int T1Close();
+int T1Read(), T1Getc(), T1Ungetc();
+STATIC int T1Decrypt(), T1Fill();
+
+/* -------------------------------------------------------------- */
+/*ARGSUSED*/
+F_FILE *T1Open(fn, mode)
+ char *fn; /* Pointer to filename */
+ char *mode; /* Pointer to open mode string */
+{
+ F_FILE *of = &TheFile;
+
+ Decrypt = 0;
+
+ /* We know we are only reading */
+#if defined(MSDOS) || defined(VMS) || defined(WIN32)
+ if ((of->fd=open(fn, O_RDONLY | O_BINARY)) < 0) return NULL;
+#else
+ if ((of->fd=open(fn, O_RDONLY)) < 0) return NULL;
+#endif
+
+ /* Initialize the buffer information of our file descriptor */
+ of->b_base = TheBuffer;
+ of->b_size = F_BUFSIZ;
+ of->b_ptr = NULL;
+ of->b_cnt = 0;
+ of->flags = 0;
+ of->error = 0;
+ haveextrach = 0;
+ return &TheFile;
+} /* end Open */
+
+/* -------------------------------------------------------------- */
+int T1Getc(f) /* Read one character */
+ F_FILE *f; /* Stream descriptor */
+{
+ if (f->b_base == NULL) return EOF; /* already closed */
+
+ if (f->flags & UNGOTTENC) { /* there is an ungotten c */
+ f->flags &= ~UNGOTTENC;
+ return (int) f->ungotc;
+ }
+
+ if (f->b_cnt == 0) /* Buffer needs to be (re)filled */
+ f->b_cnt = T1Fill(f);
+ if (f->b_cnt > 0) return (f->b_cnt--, (int) *(f->b_ptr++));
+ else {
+ f->flags |= FIOEOF;
+ return EOF;
+ }
+} /* end Getc */
+
+/* -------------------------------------------------------------- */
+int T1Ungetc(c, f) /* Put back one character */
+ int c;
+ F_FILE *f; /* Stream descriptor */
+{
+ if (c != EOF) {
+ f->ungotc = c;
+ f->flags |= UNGOTTENC; /* set flag */
+ f->flags &= ~FIOEOF; /* reset EOF */
+ }
+ return c;
+} /* end Ungetc */
+
+/* -------------------------------------------------------------- */
+int T1Read(buffP, size, n, f) /* Read n items into caller's buffer */
+ char *buffP; /* Buffer to be filled */
+ int size; /* Size of each item */
+ int n; /* Number of items to read */
+ F_FILE *f; /* Stream descriptor */
+{
+ int bytelen, cnt, i;
+ F_char *p = (F_char *)buffP;
+ int icnt; /* Number of characters to read */
+
+ if (f->b_base == NULL) return 0; /* closed */
+ icnt = (size!=1)?n*size:n; /* Number of bytes we want */
+
+ if (f->flags & UNGOTTENC) { /* there is an ungotten c */
+ f->flags &= ~UNGOTTENC;
+ *(p++) = f->ungotc;
+ icnt--; bytelen = 1;
+ }
+ else bytelen = 0;
+
+ while (icnt > 0) {
+ /* First use any bytes we have buffered in the stream buffer */
+ if ((cnt=f->b_cnt) > 0) {
+ if (cnt > icnt) cnt = icnt;
+ for (i=0; i<cnt; i++) *(p++) = *(f->b_ptr++);
+ f->b_cnt -= cnt;
+ icnt -= cnt;
+ bytelen += cnt;
+ }
+
+ if ((icnt == 0) || (f->flags & FIOEOF)) break;
+
+ f->b_cnt = T1Fill(f);
+ }
+ return ((size!=1)?bytelen/size:bytelen);
+} /* end Read */
+
+/* -------------------------------------------------------------- */
+int T1Close(f) /* Close the file */
+ F_FILE *f; /* Stream descriptor */
+{
+ if (f->b_base == NULL) return 0; /* already closed */
+ f->b_base = NULL; /* no valid stream */
+ return close(f->fd);
+} /* end Close */
+
+/* -------------------------------------------------------------- */
+F_FILE *T1eexec(f) /* Initialization */
+ F_FILE *f; /* Stream descriptor */
+{
+ int i, c;
+ int H;
+ unsigned char *p;
+ unsigned char randomP[8];
+
+ r = 55665; /* initial key */
+ asc = 1; /* indicate ASCII form */
+
+ /* Consume the 4 random bytes, determining if we are also to
+ ASCIIDecodeHex as we process our input. (See pages 63-64
+ of the Adobe Type 1 Font Format book.) */
+
+ /* Skip over any initial white space chars */
+ while (HighHexP[c=getc(f)] == HWHITE_SPACE) ;
+
+ /* If ASCII, the next 7 chars are guaranteed consecutive */
+ randomP[0] = c; /* store first non white space char */
+ fread(randomP+1, 1, 3, f); /* read 3 more, for a total of 4 */
+ /* store first four chars */
+ for (i=0,p=randomP; i<4; i++) { /* Check 4 valid ASCIIEncode chars */
+ if (HighHexP[*p++] > LAST_HDIGIT) { /* non-ASCII byte */
+ asc = 0;
+ break;
+ }
+ }
+ if (asc) { /* ASCII form, convert first eight bytes to binary */
+ fread(randomP+4, 1, 4, f); /* Need four more */
+ for (i=0,p=randomP; i<4; i++) { /* Convert */
+ H = HighHexP[*p++];
+ randomP[i] = H | LowHexP[*p++];
+ }
+ }
+
+ /* Adjust our key */
+ for (i=0,p=randomP; i<4; i++) {
+ r = (*p++ + r) * c1 + c2;
+ }
+
+ /* Decrypt the remaining buffered bytes */
+ f->b_cnt = T1Decrypt(f->b_ptr, f->b_cnt);
+ Decrypt = 1;
+ return (feof(f))?NULL:f;
+} /* end eexec */
+
+/* -------------------------------------------------------------- */
+STATIC int T1Decrypt(p, len)
+ unsigned char *p;
+ int len;
+{
+ int n;
+ int H, L;
+ unsigned char *inp = p;
+ unsigned char *tblP;
+
+ if (asc) {
+ if (haveextrach) {
+ H = extrach;
+ tblP = LowHexP;
+ }
+ else tblP = HighHexP;
+ for (n=0; len>0; len--) {
+ L = tblP[*inp++];
+ if (L == HWHITE_SPACE) continue;
+ if (L > LAST_HDIGIT) break;
+ if (tblP == HighHexP) { /* Got first hexit value */
+ H = L;
+ tblP = LowHexP;
+ } else { /* Got second hexit value; compute value and store it */
+ n++;
+ tblP = HighHexP;
+ H |= L;
+ /* H is an int, 0 <= H <= 255, so all of this will work */
+ *p++ = H ^ (r >> 8);
+ r = (H + r) * c1 + c2;
+ }
+ }
+ if (tblP != HighHexP) { /* We had an odd number of hexits */
+ extrach = H;
+ haveextrach = 1;
+ } else haveextrach = 0;
+ return n;
+ } else {
+ for (n = len; n>0; n--) {
+ H = *inp++;
+ *p++ = H ^ (r >> 8);
+ r = (H + r) * c1 + c2;
+ }
+ return len;
+ }
+} /* end Decrypt */
+
+/* -------------------------------------------------------------- */
+STATIC int T1Fill(f) /* Refill stream buffer */
+ F_FILE *f; /* Stream descriptor */
+{
+ int rc;
+
+ rc = read(f->fd, f->b_base, F_BUFSIZ);
+ /* propagate any error or eof to current file */
+ if (rc <= 0) {
+ if (rc == 0) /* means EOF */
+ f->flags |= FIOEOF;
+ else {
+ f->error = (short)-rc;
+ f->flags |= FIOERROR;
+ rc = 0;
+ }
+ }
+ f->b_ptr = f->b_base;
+ if (Decrypt) rc = T1Decrypt(f->b_base, rc);
+ return rc;
+} /* end Fill */
diff --git a/Build/source/texk/ps2pkm/t1snap.c b/Build/source/texk/ps2pkm/t1snap.c
new file mode 100644
index 00000000000..988539b49cb
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1snap.c
@@ -0,0 +1,79 @@
+/* $XConsortium: t1snap.c,v 1.3 91/10/10 11:19:47 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+
+/*
+:h2.Handle Functions
+
+:h3.Phantom() - Returns a Move Segment Equivalent to Handles
+
+This is a user operator. Its new name is QueryHandle.
+*/
+
+struct segment *t1_Phantom(obj)
+ register struct xobject *obj; /* object to take the Phantom of */
+{
+ struct fractpoint pt; /* handle size will built here */
+
+ if (obj == NULL)
+ pt.x = pt.y = 0;
+ else
+ PathDelta(obj, &pt);
+
+ return(PathSegment(MOVETYPE, pt.x, pt.y));
+}
+
+/*
+:h3.Snap() - Force Ending Handle of Object to Origin
+
+This is a user operator.
+*/
+
+struct xobject *t1_Snap(p)
+ register struct segment *p; /* path to snap */
+{
+ struct fractpoint pt; /* for finding length of path */
+
+ if (p == NULL)
+ return(NULL);
+ p = UniquePath(p);
+
+ PathDelta(p, &pt);
+ if (p->last->type == MOVETYPE) {
+ p->last->dest.x -= pt.x;
+ p->last->dest.y -= pt.y;
+ }
+ else
+ p = JoinSegment(p, MOVETYPE, -pt.x, -pt.y, NULL);
+ return((struct xobject *)p);
+}
diff --git a/Build/source/texk/ps2pkm/t1stdio.h b/Build/source/texk/ps2pkm/t1stdio.h
new file mode 100644
index 00000000000..f2d89b17c9a
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1stdio.h
@@ -0,0 +1,108 @@
+/* $XConsortium: t1stdio.h,v 1.4 91/10/10 11:19:49 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* T1IO FILE structure and related stuff */
+
+#include "types.h"
+
+#define FILE F_FILE
+typedef unsigned char F_char;
+
+typedef struct F_FILE {
+ F_char *b_base; /* Pointer to beginning of buffer */
+ LONG b_size; /* Size of the buffer */
+ F_char *b_ptr; /* Pointer to next char in buffer */
+ LONG b_cnt; /* Number of chars remaining in buffer */
+ F_char flags; /* other flags; != 0 means getc must call fgetc */
+ F_char ungotc; /* Place for ungotten char; flag set if present */
+ short error; /* error status */
+ int fd; /* underlying file descriptor */
+} F_FILE;
+
+
+/* defines for flags */
+#define UNGOTTENC (0x01)
+#define FIOEOF (0x80)
+#define FIOERROR (0x40)
+
+#ifndef NULL
+#define NULL 0 /* null pointer */
+#endif
+#define EOF (-1) /* end of file */
+#define F_BUFSIZ (512)
+
+#ifdef fopen
+#undef fopen
+#endif
+
+#ifdef fclose
+#undef fclose
+#endif
+
+#ifdef feof
+#undef feof
+#endif
+
+#ifdef ferror
+#undef ferror
+#endif
+
+#ifdef fread
+#undef fread
+#endif
+
+#ifdef getc
+#undef getc
+#endif
+
+#ifdef ungetc
+#undef ungetc
+#endif
+
+#ifdef fgetc
+#undef fgetc
+#endif
+
+#define getc(f) \
+ ( \
+ ( ((f)->b_cnt > 0) && ((f)->flags == 0) ) ? \
+ ( (f)->b_cnt--, (unsigned int)*( (f)->b_ptr++ ) ) : \
+ T1Getc(f) \
+ )
+
+extern FILE *T1Open(), *T1eexec();
+extern int T1Close(), T1ungetc(), T1Read();
+
+#define fclose(f) T1Close(f)
+#define fopen(name,mode) T1Open(name,mode)
+#define ungetc(c,f) T1Ungetc(c,f)
+#define fgetc(f) T1Getc(f)
+#define fread(bufP,size,n,f) T1Read(bufP,size,n,f)
+#define feof(f) (((f)->flags & FIOEOF) && ((f)->b_cnt==0))
+#define ferror(f) (((f)->flags & FIOERROR)?(f)->error:0)
diff --git a/Build/source/texk/ps2pkm/t1stub.c b/Build/source/texk/ps2pkm/t1stub.c
new file mode 100644
index 00000000000..b537b53b989
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1stub.c
@@ -0,0 +1,46 @@
+/* $XConsortium: t1stub.c,v 1.3 92/03/20 15:58:40 eswu Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "objects.h" /* get #define for t1_abort() */
+
+xiStub()
+{
+ printf("xiStub called\n");
+ t1_abort("xiStub called");
+}
+
+#ifdef WIN32
+void t1_DumpText(struct segment * foo)
+#else
+void t1_DumpText()
+#endif
+{
+ xiStub();
+}
diff --git a/Build/source/texk/ps2pkm/t1test.c b/Build/source/texk/ps2pkm/t1test.c
new file mode 100644
index 00000000000..66291173785
--- /dev/null
+++ b/Build/source/texk/ps2pkm/t1test.c
@@ -0,0 +1,529 @@
+/* $XConsortium: t1test.c,v 1.2 91/10/10 11:19:53 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include "ffilest.h"
+#ifdef XSERVER
+#include "FSproto.h"
+#endif
+
+void Display();
+
+#define DECIPOINTSPERINCH 722.7
+#define DEFAULTRES 75
+#define DEFAULTPOINTSIZE 120
+
+FontScalableRec vals;
+FontEntryRec entry;
+
+typedef char *encoding[256];
+
+/* PostScript ISOLatin1Encoding */
+
+char *ISOLatin1[256] = {
+ /* '000 000 "00 */ NULL,
+ /* '001 001 "01 */ NULL,
+ /* '002 002 "02 */ NULL,
+ /* '003 003 "03 */ NULL,
+ /* '004 004 "04 */ NULL,
+ /* '005 005 "05 */ NULL,
+ /* '006 006 "06 */ NULL,
+ /* '007 007 "07 */ NULL,
+ /* '010 008 "08 */ NULL,
+ /* '011 009 "09 */ NULL,
+ /* '012 010 "0A */ NULL,
+ /* '013 011 "0B */ NULL,
+ /* '014 012 "0C */ NULL,
+ /* '015 013 "0D */ NULL,
+ /* '016 014 "0E */ NULL,
+ /* '017 015 "0F */ NULL,
+ /* '020 016 "10 */ NULL,
+ /* '021 017 "11 */ NULL,
+ /* '022 018 "12 */ NULL,
+ /* '023 019 "13 */ NULL,
+ /* '024 020 "14 */ NULL,
+ /* '025 021 "15 */ NULL,
+ /* '026 022 "16 */ NULL,
+ /* '027 023 "17 */ NULL,
+ /* '030 024 "18 */ NULL,
+ /* '031 025 "19 */ NULL,
+ /* '032 026 "1A */ NULL,
+ /* '033 027 "1B */ NULL,
+ /* '034 028 "1C */ NULL,
+ /* '035 029 "1D */ NULL,
+ /* '036 030 "1E */ NULL,
+ /* '037 031 "1F */ NULL,
+ /* '040 032 "20 */ "space",
+ /* '041 033 "21 */ "exclam",
+ /* '042 034 "22 */ "quotedbl",
+ /* '043 035 "23 */ "numbersign",
+ /* '044 036 "24 */ "dollar",
+ /* '045 037 "25 */ "percent",
+ /* '046 038 "26 */ "ampersand",
+ /* '047 039 "27 */ "quoteright",
+ /* '050 040 "28 */ "parenleft",
+ /* '051 041 "29 */ "parenright",
+ /* '052 042 "2A */ "asterisk",
+ /* '053 043 "2B */ "plus",
+ /* '054 044 "2C */ "comma",
+ /* '055 045 "2D */ "hyphen",
+ /* '056 046 "2E */ "period",
+ /* '057 047 "2F */ "slash",
+ /* '060 048 "30 */ "zero",
+ /* '061 049 "31 */ "one",
+ /* '062 050 "32 */ "two",
+ /* '063 051 "33 */ "three",
+ /* '064 052 "34 */ "four",
+ /* '065 053 "35 */ "five",
+ /* '066 054 "36 */ "six",
+ /* '067 055 "37 */ "seven",
+ /* '070 056 "38 */ "eight",
+ /* '071 057 "39 */ "nine",
+ /* '072 058 "3A */ "colon",
+ /* '073 059 "3B */ "semicolon",
+ /* '074 060 "3C */ "less",
+ /* '075 061 "3D */ "equal",
+ /* '076 062 "3E */ "greater",
+ /* '077 063 "3F */ "question",
+ /* '100 064 "40 */ "at",
+ /* '101 065 "41 */ "A",
+ /* '102 066 "42 */ "B",
+ /* '103 067 "43 */ "C",
+ /* '104 068 "44 */ "D",
+ /* '105 069 "45 */ "E",
+ /* '106 070 "46 */ "F",
+ /* '107 071 "47 */ "G",
+ /* '110 072 "48 */ "H",
+ /* '111 073 "49 */ "I",
+ /* '112 074 "4A */ "J",
+ /* '113 075 "4B */ "K",
+ /* '114 076 "4C */ "L",
+ /* '115 077 "4D */ "M",
+ /* '116 078 "4E */ "N",
+ /* '117 079 "4F */ "O",
+ /* '120 080 "50 */ "P",
+ /* '121 081 "51 */ "Q",
+ /* '122 082 "52 */ "R",
+ /* '123 083 "53 */ "S",
+ /* '124 084 "54 */ "T",
+ /* '125 085 "55 */ "U",
+ /* '126 086 "56 */ "V",
+ /* '127 087 "57 */ "W",
+ /* '130 088 "58 */ "X",
+ /* '131 089 "59 */ "Y",
+ /* '132 090 "5A */ "Z",
+ /* '133 091 "5B */ "bracketleft",
+ /* '134 092 "5C */ "backslash",
+ /* '135 093 "5D */ "bracketright",
+ /* '136 094 "5E */ "asciicircum",
+ /* '137 095 "5F */ "underscore",
+ /* '140 096 "60 */ "quoteleft",
+ /* '141 097 "61 */ "a",
+ /* '142 098 "62 */ "b",
+ /* '143 099 "63 */ "c",
+ /* '144 100 "64 */ "d",
+ /* '145 101 "65 */ "e",
+ /* '146 102 "66 */ "f",
+ /* '147 103 "67 */ "g",
+ /* '150 104 "68 */ "h",
+ /* '151 105 "69 */ "i",
+ /* '152 106 "6A */ "j",
+ /* '153 107 "6B */ "k",
+ /* '154 108 "6C */ "l",
+ /* '155 109 "6D */ "m",
+ /* '156 110 "6E */ "n",
+ /* '157 111 "6F */ "o",
+ /* '160 112 "70 */ "p",
+ /* '161 113 "71 */ "q",
+ /* '162 114 "72 */ "r",
+ /* '163 115 "73 */ "s",
+ /* '164 116 "74 */ "t",
+ /* '165 117 "75 */ "u",
+ /* '166 118 "76 */ "v",
+ /* '167 119 "77 */ "w",
+ /* '170 120 "78 */ "x",
+ /* '171 121 "79 */ "y",
+ /* '172 122 "7A */ "z",
+ /* '173 123 "7B */ "braceleft",
+ /* '174 124 "7C */ "bar",
+ /* '175 125 "7D */ "braceright",
+ /* '176 126 "7E */ "asciitilde",
+ /* '177 127 "7F */ NULL,
+ /* '200 128 "80 */ NULL,
+ /* '201 129 "81 */ NULL,
+ /* '202 130 "82 */ NULL,
+ /* '203 131 "83 */ NULL,
+ /* '204 132 "84 */ NULL,
+ /* '205 133 "85 */ NULL,
+ /* '206 134 "86 */ NULL,
+ /* '207 135 "87 */ NULL,
+ /* '210 136 "88 */ NULL,
+ /* '211 137 "89 */ NULL,
+ /* '212 138 "8A */ NULL,
+ /* '213 139 "8B */ NULL,
+ /* '214 140 "8C */ NULL,
+ /* '215 141 "8D */ NULL,
+ /* '216 142 "8E */ NULL,
+ /* '217 143 "8F */ NULL,
+ /* '220 144 "90 */ "dotlessi",
+ /* '221 145 "91 */ "grave",
+ /* '222 146 "92 */ "acute",
+ /* '223 147 "93 */ "circumflex",
+ /* '224 148 "94 */ "tilde",
+ /* '225 149 "95 */ "macron",
+ /* '226 150 "96 */ "breve",
+ /* '227 151 "97 */ "dotaccent",
+ /* '230 152 "98 */ "dieresis",
+ /* '231 153 "99 */ NULL,
+ /* '232 154 "9A */ "ring",
+ /* '233 155 "9B */ "cedilla",
+ /* '234 156 "9C */ NULL,
+ /* '235 157 "9D */ "hungarumlaut",
+ /* '236 158 "9E */ "ogonek",
+ /* '237 159 "9F */ "caron",
+ /* '240 160 "A0 */ "space",
+ /* '241 161 "A1 */ "exclamdown",
+ /* '242 162 "A2 */ "cent",
+ /* '243 163 "A3 */ "sterling",
+ /* '244 164 "A4 */ "currency",
+ /* '245 165 "A5 */ "yen",
+ /* '246 166 "A6 */ "brokenbar",
+ /* '247 167 "A7 */ "section",
+ /* '250 168 "A8 */ "dieresis",
+ /* '251 169 "A9 */ "copyright",
+ /* '252 170 "AA */ "ordfeminine",
+ /* '253 171 "AB */ "guillemotleft",
+ /* '254 172 "AC */ "logicalnot",
+ /* '255 173 "AD */ "hyphen",
+ /* '256 174 "AE */ "registered",
+ /* '257 175 "AF */ "macron",
+ /* '260 176 "B0 */ "degree",
+ /* '261 177 "B1 */ "plusminus",
+ /* '262 178 "B2 */ "twosuperior",
+ /* '263 179 "B3 */ "threesuperior",
+ /* '264 180 "B4 */ "acute",
+ /* '265 181 "B5 */ "mu",
+ /* '266 182 "B6 */ "paragraph",
+ /* '267 183 "B7 */ "periodcentered",
+ /* '270 184 "B8 */ "cedilla",
+ /* '271 185 "B9 */ "onesuperior",
+ /* '272 186 "BA */ "ordmasculine",
+ /* '273 187 "BB */ "guillemotright",
+ /* '274 188 "BC */ "onequarter",
+ /* '275 189 "BD */ "onehalf",
+ /* '276 190 "BE */ "threequarters",
+ /* '277 191 "BF */ "questiondown",
+ /* '300 192 "C0 */ "Agrave",
+ /* '301 193 "C1 */ "Aacute",
+ /* '302 194 "C2 */ "Acircumflex",
+ /* '303 195 "C3 */ "Atilde",
+ /* '304 196 "C4 */ "Adieresis",
+ /* '305 197 "C5 */ "Aring",
+ /* '306 198 "C6 */ "AE",
+ /* '307 199 "C7 */ "Ccedilla",
+ /* '310 200 "C8 */ "Egrave",
+ /* '311 201 "C9 */ "Eacute",
+ /* '312 202 "CA */ "Ecircumflex",
+ /* '313 203 "CB */ "Edieresis",
+ /* '314 204 "CC */ "Igrave",
+ /* '315 205 "CD */ "Iacute",
+ /* '316 206 "CE */ "Icircumflex",
+ /* '317 207 "CF */ "Idieresis",
+ /* '320 208 "D0 */ "Eth",
+ /* '321 209 "D1 */ "Ntilde",
+ /* '322 210 "D2 */ "Ograve",
+ /* '323 211 "D3 */ "Oacute",
+ /* '324 212 "D4 */ "Ocircumflex",
+ /* '325 213 "D5 */ "Otilde",
+ /* '326 214 "D6 */ "Odieresis",
+ /* '327 215 "D7 */ "multiply",
+ /* '330 216 "D8 */ "Oslash",
+ /* '331 217 "D9 */ "Ugrave",
+ /* '332 218 "DA */ "Uacute",
+ /* '333 219 "DB */ "Ucircumflex",
+ /* '334 220 "DC */ "Udieresis",
+ /* '335 221 "DD */ "Yacute",
+ /* '336 222 "DE */ "Thorn",
+ /* '337 223 "DF */ "Germandbls",
+ /* '340 224 "E0 */ "agrave",
+ /* '341 225 "E1 */ "aacute",
+ /* '342 226 "E2 */ "acircumflex",
+ /* '343 227 "E3 */ "atilde",
+ /* '344 228 "E4 */ "adieresis",
+ /* '345 229 "E5 */ "aring",
+ /* '346 230 "E6 */ "ae",
+ /* '347 231 "E7 */ "ccedilla",
+ /* '350 232 "E8 */ "egrave",
+ /* '351 233 "E9 */ "eacute",
+ /* '352 234 "EA */ "ecircumflex",
+ /* '353 235 "EB */ "edieresis",
+ /* '354 236 "EC */ "igrave",
+ /* '355 237 "ED */ "iacute",
+ /* '356 238 "EE */ "icircumflex",
+ /* '357 239 "EF */ "idieresis",
+ /* '360 240 "F0 */ "eth",
+ /* '361 241 "F1 */ "ntilde",
+ /* '362 242 "F2 */ "ograve",
+ /* '363 243 "F3 */ "oacute",
+ /* '364 244 "F4 */ "ocircumflex",
+ /* '365 245 "F5 */ "otilde",
+ /* '366 246 "F6 */ "odieresis",
+ /* '367 247 "F7 */ "divide",
+ /* '370 248 "F8 */ "oslash",
+ /* '371 249 "F9 */ "ugrave",
+ /* '372 250 "FA */ "uacute",
+ /* '373 251 "FB */ "ucircumflex",
+ /* '374 252 "FC */ "udieresis",
+ /* '375 253 "FD */ "yacute",
+ /* '376 254 "FE */ "thorn",
+ /* '377 255 "FF */ "ydieresis"};
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int h;
+ char temp[80];
+ char file[80];
+ char glyphcode[1];
+ FontPtr fontptr;
+ CharInfoRec *glyphs[1];
+ int count;
+ int code;
+ int rc = -1;
+ float efactor = 1.0, slant = 0.0;
+ encoding *ev = &ISOLatin1;
+
+ T1FillVals(&vals);
+ Type1RegisterFontFileFunctions();
+ entry.name.name = "-adobe-utopia-medium-r-normal--0-0-0-0-p-0-iso8859-1";
+
+ for (;;) {
+ printf("T1TEST: ");
+ gets(temp);
+ glyphcode[0] = '\0';
+
+ switch(temp[0]) {
+
+ case 'E':
+ if (1 != sscanf(&temp[2], "%f", &efactor))
+ printf("expansion factor?\n");
+ break;
+
+ case 'S':
+ if (1 != sscanf(&temp[2], "%f", &slant))
+ printf("slant?\n");
+ break;
+
+ case 'c':
+ if (1 != sscanf(&temp[2], "%c", glyphcode))
+ printf("glyph code?\n");
+ break;
+
+ case 'x':
+ if (1 != sscanf(&temp[2], "%x", &code))
+ printf("glyph code?\n");
+ else
+ glyphcode[0] = code;
+ break;
+
+ case 'd':
+ if (1 != sscanf(&temp[2], "%d", &code))
+ printf("glyph code?\n");
+ else
+ glyphcode[0] = code;
+ break;
+
+ case 'h':
+ if (1 != sscanf(&temp[2], "%d", &h))
+ printf("height?\n");
+ vals.pixel = h;
+ vals.point = (vals.pixel * DECIPOINTSPERINCH) / vals.y;
+ rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
+ file, &vals, 0, 0, efactor, slant);
+ break;
+
+ case 'f':
+ if (1 != sscanf(&temp[2], "%s", file))
+ printf("file name?\n");
+ rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
+ file, &vals, 0, 0, efactor, slant);
+ break;
+
+ case 't':
+ if (1 != sscanf(&temp[2], "%s", file))
+ printf("file name?\n");
+ vals.pixel = 8;
+ rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
+ file, &vals, 0, 0, efactor, slant);
+ if (rc != Successful) break;
+ vals.pixel = 20;
+ rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
+ file, &vals, 0, 0, efactor, slant);
+ if (rc != Successful) break;
+ vals.pixel = 50;
+ rc = Type1OpenScalable(*ev, &fontptr, 0, &entry,
+ file, &vals, 0, 0, efactor, slant);
+ glyphcode[0] = 'A';
+ printf("From font '%s':\n", file);
+ break;
+
+ case 'q':
+ return 0;
+
+ default:
+ printf("unknown command '%c', must one of 'ESqfchdxt'\n", temp[0]);
+
+ }
+ if (rc == Successful) {
+ if (glyphcode[0] != '\0') {
+ (*fontptr->get_glyphs)(fontptr, 1, glyphcode, 0, &count, glyphs);
+ if (count > 0)
+ Display(glyphs[0]);
+ else
+ printf("Code %x not valid in this font\n", glyphcode[0]);
+ }
+ }
+ else
+ printf("Bad font (rc = %d, file='%s')\n", rc, file);
+ }
+}
+
+void Display(glyph)
+ CharInfoRec *glyph;
+{
+ int h,w;
+ unsigned char *p;
+ int data;
+ int i;
+
+ p = (unsigned char *) glyph->bits;
+
+ printf("Metrics: left=%d, right=%d, w=%d, above=%d, below=%d\n",
+ glyph->metrics.leftSideBearing,
+ glyph->metrics.rightSideBearing,
+ glyph->metrics.characterWidth,
+ glyph->metrics.ascent,
+ glyph->metrics.descent);
+
+ for (h=glyph->metrics.ascent + glyph->metrics.descent; --h >= 0;) {
+ w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing;
+ while (w > 0) {
+ data = *p++;
+ for (i=0; i<8; i++) {
+ if (--w < 0)
+ break;
+ if (data & 0x80)
+ printf("X");
+ else
+ printf(".");
+ data <<= 1;
+ }
+ }
+ printf("\n");
+ }
+}
+
+T1FillVals(vals)
+ FontScalablePtr vals;
+{
+ fsResolution *res;
+ int x_res = DEFAULTRES;
+ int y_res = DEFAULTRES;
+ int pointsize = DEFAULTPOINTSIZE; /* decipoints */
+ int num_res;
+
+ /* Must have x, y, and pixel */
+ if (!vals->x || !vals->y || !vals->pixel) {
+ res = (fsResolution *) GetClientResolutions(&num_res);
+ if (num_res) {
+ if (res->x_resolution)
+ x_res = res->x_resolution;
+ if (res->y_resolution)
+ y_res = res->y_resolution;
+ if (res->point_size)
+ pointsize = res->point_size;
+ }
+ if (!vals->x)
+ vals->x = x_res;
+ if (!vals->y)
+ vals->y = y_res;
+ if (!vals->point) {
+ if (!vals->pixel) vals->point = pointsize;
+ else vals->point = (vals->pixel * DECIPOINTSPERINCH) / vals->y;
+ }
+ if (!vals->pixel)
+ vals->pixel = (vals->point * vals->y) / DECIPOINTSPERINCH;
+ /* Make sure above arithmetic is normally in range and will
+ round properly. +++ */
+ }
+}
+
+int CheckFSFormat(format, fmask, bit, byte, scan, glyph, image)
+ int format,fmask,*bit,*byte,*scan,*glyph,*image;
+{
+ *bit = *byte = 1;
+ *glyph = *scan = *image = 1;
+ return Successful;
+
+}
+
+char *MakeAtom(p)
+ char *p;
+{
+ return p;
+}
+GetClientResolutions(resP)
+ int *resP;
+{
+ *resP = 0;
+};
+
+char *Xalloc(size)
+ int size;
+{
+ extern char *malloc();
+ return(malloc(size));
+}
+
+void Xfree()
+{
+ free();
+}
+
+FontDefaultFormat() { ; }
+
+FontFileRegisterRenderer() { ; }
+
+GenericGetBitmaps() { ; }
+GenericGetExtents() { ; }
+
+FontParseXLFDName() { ; }
+FontComputeInfoAccelerators() { ; }
diff --git a/Build/source/texk/ps2pkm/texfiles.c b/Build/source/texk/ps2pkm/texfiles.c
new file mode 100644
index 00000000000..0ec4ce95e08
--- /dev/null
+++ b/Build/source/texk/ps2pkm/texfiles.c
@@ -0,0 +1,26 @@
+/*
+ * File: texfiles.c
+ * Purpose: basic binary TeX reading functions
+ * Version: 1.0 (Nov 1993)
+ * Author: Piet Tutelaers (derived from xdvi/pl16)
+ */
+
+#include <stdio.h>
+#include "texfiles.h"
+
+#define one(fp) ((unsigned char) getc(fp))
+
+unsigned long num(FILE *fp, int size)
+{ unsigned long x = 0;
+
+ while (size--) x = (x << 8) | one(fp);
+ return x;
+}
+
+integer snum(FILE *fp, int size)
+{ integer x;
+
+ x = getc(fp);
+ while (--size) x = (x << 8) | one(fp);
+ return x;
+}
diff --git a/Build/source/texk/ps2pkm/texfiles.h b/Build/source/texk/ps2pkm/texfiles.h
new file mode 100644
index 00000000000..960c1d7a499
--- /dev/null
+++ b/Build/source/texk/ps2pkm/texfiles.h
@@ -0,0 +1,29 @@
+/*
+ * File: texfiles.h
+ * Purpose: headerfile for texfiles.c
+ * Version: 1.0 (Nov 1993)
+ * Author: Piet Tutelaers
+ */
+
+#ifndef __TEXFILES__
+#define __TEXFILES__
+
+#include <stdio.h>
+
+#ifdef MSDOS
+typedef long integer ;
+#else
+typedef int integer ;
+#endif
+
+unsigned long num(FILE *fp, int size);
+integer snum(FILE *fp, int size);
+
+#define one(fp) ((unsigned char) getc(fp))
+#define sone(fp) ((long) one(fp))
+#define two(fp) num (fp, 2)
+#define stwo(fp) snum(fp, 2)
+#define four(fp) num (fp, 4)
+#define sfour(fp) snum(fp, 4)
+
+#endif /* __TEXFILES__ */
diff --git a/Build/source/texk/ps2pkm/token.c b/Build/source/texk/ps2pkm/token.c
new file mode 100644
index 00000000000..00a2966d52d
--- /dev/null
+++ b/Build/source/texk/ps2pkm/token.c
@@ -0,0 +1,1208 @@
+/* $XConsortium: token.c,v 1.2 91/10/10 11:19:55 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* Authors: Sig Nin & Carol Thompson IBM Almaden Research Laboratory */
+#include "types.h"
+#include "t1stdio.h"
+#include "util.h"
+#include "digit.h"
+#include "token.h"
+#include "tokst.h"
+#include "hdigit.h"
+
+extern int T1Getc(struct F_FILE *f);
+extern int T1Ungetc(int c,struct F_FILE *f);
+/*
+ * -------------------------------------------------------------------
+ * Globals
+ * -------------------------------------------------------------------
+ */
+
+/* These variables are set by the caller */
+char *tokenStartP; /* Pointer to token buffer in VM */
+char *tokenMaxP; /* Pointer to last byte in buffer + 1 */
+
+/* These variables are set by TOKEN */
+int tokenLength; /* Characters in token */
+boolean tokenTooLong; /* Token too long for buffer */
+int tokenType; /* Type of token identified */
+psvalue tokenValue; /* Token value */
+
+/*
+ * -------------------------------------------------------------------
+ * Private variables
+ * -------------------------------------------------------------------
+ */
+
+static FILE *inputFileP; /* Current input file */
+
+
+/* Token */
+static char *tokenCharP; /* Pointer to next character in token */
+
+/*
+ * -------------------------------------------------------------------
+ * Private routines for manipulating numbers
+ * -------------------------------------------------------------------
+ */
+
+#define Exp10(e) \
+((e) == 0\
+ ? (DOUBLE)(1.0)\
+ : (-64 <= (e) && (e) <= 63\
+ ? Exp10T[(e)+64]\
+ : P10(e)\
+ )\
+)
+
+static DOUBLE Exp10T[128] = {
+ 1e-64, 1e-63, 1e-62, 1e-61, 1e-60, 1e-59, 1e-58, 1e-57,
+ 1e-56, 1e-55, 1e-54, 1e-53, 1e-52, 1e-51, 1e-50, 1e-49,
+ 1e-48, 1e-47, 1e-46, 1e-45, 1e-44, 1e-43, 1e-42, 1e-41,
+ 1e-40, 1e-39, 1e-38, 1e-37, 1e-36, 1e-35, 1e-34, 1e-33,
+ 1e-32, 1e-31, 1e-30, 1e-29, 1e-28, 1e-27, 1e-26, 1e-25,
+ 1e-24, 1e-23, 1e-22, 1e-21, 1e-20, 1e-19, 1e-18, 1e-17,
+ 1e-16, 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9,
+ 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1,
+ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7,
+ 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15,
+ 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22, 1e23,
+ 1e24, 1e25, 1e26, 1e27, 1e28, 1e29, 1e30, 1e31,
+ 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
+ 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47,
+ 1e48, 1e49, 1e50, 1e51, 1e52, 1e53, 1e54, 1e55,
+ 1e56, 1e57, 1e58, 1e59, 1e60, 1e61, 1e62, 1e63
+};
+
+static DOUBLE P10(exponent)
+ LONG exponent;
+{
+ DOUBLE value, power;
+
+ if (exponent < 0) {
+ power = 0.1;
+ value = (exponent & 1 ? power : 1.0);
+ exponent = -(++exponent >> 1); /* portable C for -(exponent/2) */
+ }
+ else {
+ power = 10.0;
+ value = (exponent & 1 ? power : 1.0);
+ exponent = exponent >> 1;
+ }
+
+ while(exponent > 0) {
+ power *= power;
+ if (exponent & 1)
+ value *= power;
+ exponent >>= 1;
+ }
+
+ return(value);
+}
+
+/*
+ * -------------------------------------------------------------------
+ * Private routines and macros for manipulating the input
+ * -------------------------------------------------------------------
+ */
+
+/* Get next character from the input --
+ *
+ */
+#define next_ch() (getc(inputFileP))
+
+/* Push a character back into the input --
+ *
+ * Ungetc of EOF will fail, but that's ok: the next getc will
+ * return EOF.
+ *
+ * NOTE: These macros are presently written to return the character
+ * pushed, or EOF if none was pushed. However, they are not
+ * required to return anything in particular, and callers should
+ * not rely on the returned value.
+ */
+#define back_ch(ch) (ungetc(ch, inputFileP))
+
+/* Push a character back into the input if it was not white space.
+ * If it is a carriage return (\r) then check next char for
+ * linefeed and consume them both, otherwise put next char back.
+ *
+ */
+#define back_ch_not_white(ch) \
+(\
+isWHITE_SPACE(ch)\
+ ? ((ch == '\r')\
+ ? (((ch = next_ch()) == '\n')\
+ ? EOF\
+ : back_ch(ch)\
+ )\
+ : EOF\
+ )\
+ : back_ch(ch)\
+)
+
+/*
+ * -------------------------------------------------------------------
+ * Private routines and macros for manipulating the token buffer
+ * -------------------------------------------------------------------
+ */
+
+/* Add a character to the token
+ * ---- use ONLY when you KNOW that this character will
+ * be stored within the token buffer.
+ */
+#define save_unsafe_ch(ch) (*tokenCharP++ = ch)
+
+/* Add a character to the token, if not too long to fit */
+#define save_ch(ch) \
+((tokenCharP < tokenMaxP)\
+ ? save_unsafe_ch(ch)\
+ : (tokenTooLong = TRUE)\
+)
+
+/*
+ * -------------------------------------------------------------------
+ * Action Routines
+ *
+ * These routines all
+ * -- take int ch as a parameter
+ * -- return int ch if no token was recognized, DONE otherwise
+ * -- leave the next character in the input, if returning DONE
+ * -------------------------------------------------------------------
+ */
+
+#define DONE (256)
+
+/* Get the next input character */
+static int next_char(ch)
+ int ch;
+{
+ return(next_ch());
+}
+
+/* Add character to token */
+static int add_char(ch)
+ int ch;
+{
+ save_ch(ch);
+ return(next_ch());
+}
+
+
+/* -------------------------------------------------------------------
+ * Skip white space and comments
+ */
+
+/* Skip white space */
+static int skip_space(ch)
+ int ch;
+{
+ do {
+ ch = next_ch();
+ } while(isWHITE_SPACE(ch));
+ return(ch);
+}
+
+/* Skip comments */
+static int skip_comment(ch)
+ int ch;
+{
+ do {
+ ch = next_ch();
+ } while(isCOMMENT(ch));
+ return(ch);
+}
+
+/* -------------------------------------------------------------------
+ * Collect value elements for a number
+ */
+
+/* decimal integer or real number mantissa */
+static int m_sign;
+static LONG m_value;
+static LONG m_scale;
+
+/* real number exponent */
+static int e_sign;
+static LONG e_value;
+static LONG e_scale;
+
+/* radix number */
+static LONG r_base;
+static LONG r_value;
+static LONG r_scale;
+
+static int add_sign(ch)
+ int ch;
+{
+ m_sign = ch;
+ save_unsafe_ch(ch);
+ return(next_ch());
+}
+
+static int add_1st_digits(ch)
+ int ch;
+{
+ m_sign = '+';
+ return(add_digits(ch));
+}
+
+static int add_digits(ch)
+ int ch;
+{
+ LONG value, p_value, scale;
+ int digit;
+
+ /* On entry, expect m_sign to be set to '+' or '-';
+ * ch is a decimal digit.
+ * Expect at most one character saved at this point,
+ * a sign. This routine will save up to 10 more
+ * characters without checking the buffer boundary.
+ */
+
+ value = ch - '0';
+ save_unsafe_ch(ch);
+ ch = next_ch();
+
+ while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) {
+ value = (value << 3) + (value << 1) + (ch - '0');
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ }
+
+ /* Quick exit for small integers --
+ * |x| <= 10*((MAX_INTEGER/10)-1)+9
+ * |x| <= 2,147,483,639 for 32 bit integers
+ */
+ if (isNUMBER_ENDER(ch)) {
+ back_ch_not_white(ch);
+ tokenValue.integer = (m_sign == '-' ? -value : value);
+ tokenType = TOKEN_INTEGER;
+ return(DONE);
+ }
+
+ /* Handle additional digits. Beyond the boundary case,
+ * 10*(MAX_INTEGER/10) <= |number| <= MAX_INTEGER
+ * just count the digits: the number is too large to
+ * represent as an integer and will be returned as a real.
+ * The mantissa of a real holds fewer bits than an integer.
+ */
+ p_value = value;
+ value = (m_sign == '-' ? -value : value);
+ scale = 0;
+
+ if (isDECIMAL_DIGIT(ch)) {
+
+ /* Handle the boundary case */
+ if (p_value == (MAX_INTEGER/10)) {
+ digit = ch - '0';
+
+ /* Must handle positive and negative values separately */
+ /* for 2's complement arithmetic */
+ if (value > 0) {
+ if (digit <= MAX_INTEGER%10)
+ value = (value << 3) + (value << 1) + digit;
+ else
+ ++scale; /* Too big, just count it */
+ }
+ else {
+ /* Use positive % operands for portability */
+ if (digit <= -(MIN_INTEGER+10)%10)
+ value = (value << 3) + (value << 1) - digit;
+ else
+ ++scale; /* Too big, just count it */
+ }
+ }
+ else
+ ++scale; /* Not boundary case, just count digit */
+
+ save_unsafe_ch(ch);
+ ch = next_ch();
+
+ /* Continue scanning digits, but can't store them */
+ while(isDECIMAL_DIGIT(ch)) {
+ ++scale;
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+
+ /* Continue from here scanning radix integer or real */
+ m_value = value;
+ m_scale = scale;
+
+ /* Initialize for possible real */
+ e_sign = '+';
+ e_value = 0;
+ e_scale = 0;
+
+ return(ch);
+}
+
+static int add_1st_decpt(ch)
+ int ch;
+{
+ m_sign = '+';
+ return(add_decpt(ch));
+}
+
+static int add_decpt(ch)
+ int ch;
+{
+ /* On entry, expect m_sign to be set to '+' or '-' */
+ m_value = 0;
+ m_scale = 0;
+ save_unsafe_ch(ch);
+ return(next_ch());
+}
+
+static int add_fraction(ch)
+ int ch;
+{
+ LONG value, scale;
+ int digit;
+
+ /* On entry, expect m_value and m_scale to be initialized,
+ * and m_sign to be set to '+' or '-'. Expect m_value and m_sign
+ * to be consistent (this is not checked).
+ */
+ value = m_value;
+ scale = m_scale;
+
+ /* Scan leading zeroes */
+ if (value == 0) {
+ while(ch == '0') {
+ --scale;
+ save_ch(ch);
+ ch = next_ch();
+ }
+
+ /* Scan first significant digit */
+ if (isDECIMAL_DIGIT(ch)) {
+ --scale;
+ value = ch - '0';
+ value = (m_sign == '-' ? -value : value);
+ save_ch(ch);
+ ch = next_ch();
+ }
+ else
+ /* no significant digits -- number is zero */
+ scale = 0;
+ }
+ /* value != 0 || value == 0 && !isDECIMAL_DIGIT(ch) */
+
+ /* Scan additional significant digits */
+ if (isDECIMAL_DIGIT(ch)) {
+ if (value > 0) {
+ while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) {
+ --scale;
+ value = (value << 3) + (value << 1) + (ch - '0');
+ save_ch(ch);
+ ch = next_ch();
+ }
+ /* Check boundary case */
+ if (isDECIMAL_DIGIT(ch) && value == (MAX_INTEGER/10)) {
+ digit = ch - '0';
+ if (digit <= MAX_INTEGER%10) {
+ --scale;
+ value = (value << 3) + (value << 1) + digit;
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+ }
+ else {
+ /* value < 0 */
+ while(isDECIMAL_DIGIT(ch) && value > -(-(MIN_INTEGER+10)/10+1)) {
+ /* Use positive / operands for portability */
+ --scale;
+ value = (value << 3) + (value << 1) - (ch - '0');
+ save_ch(ch);
+ ch = next_ch();
+ }
+ /* Check boundary case */
+ if (isDECIMAL_DIGIT(ch)
+ && value == -(-(MIN_INTEGER+10)/10+1)) {
+ digit = ch - '0';
+ if (digit <= -(MIN_INTEGER+10)%10) {
+ /* Use positive % operands for portability */
+ --scale;
+ value = (value << 3) + (value << 1) - digit;
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+ }
+
+ /* Additional digits can be discarded */
+ while(isDECIMAL_DIGIT(ch)) {
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+
+ /* Store results */
+ m_value = value;
+ m_scale = scale;
+
+ /* Initialize for possible real */
+ e_sign = '+';
+ e_value = 0;
+ e_scale = 0;
+
+ return(ch);
+}
+
+static int add_e_sign(ch)
+ int ch;
+{
+ e_sign = ch;
+ save_ch(ch);
+ return(next_ch());
+}
+
+static int add_exponent(ch)
+ int ch;
+{
+ LONG value, p_value;
+ LONG scale = 0;
+ int digit;
+
+ /* On entry, expect e_sign to be set to '+' or '-' */
+
+ value = ch - '0';
+ save_ch(ch);
+ ch = next_ch();
+
+ while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) {
+ value = (value << 3) + (value << 1) + (ch - '0');
+ save_ch(ch);
+ ch = next_ch();
+ }
+
+ p_value = value;
+ value = (e_sign == '-' ? -value : value);
+
+ /* Handle additional digits. Beyond the boundary case,
+ * 10*(MAX_INTEGER/10) <= |number| <= MAX_INTEGER
+ * just count the digits: the number is too large to
+ * represent as an integer.
+ */
+ if (isDECIMAL_DIGIT(ch)) {
+
+ /* Examine boundary case */
+ if (p_value == (MAX_INTEGER/10)) {
+ digit = ch - '0';
+
+ /* Must handle positive and negative values separately */
+ /* for 2's complement arithmetic */
+ if (value > 0) {
+ if (digit <= MAX_INTEGER%10)
+ value = (value << 3) + (value << 1) + digit;
+ else
+ ++scale; /* Too big, just count it */
+ }
+ else {
+ /* Use positive % operands for portability */
+ if (digit <= -(MIN_INTEGER+10)%10)
+ value = (value << 3) + (value << 1) - digit;
+ else
+ ++scale; /* Too big, just count it */
+ }
+ }
+ else
+ ++scale; /* Not boundary case, just count digit */
+
+ save_ch(ch);
+ ch = next_ch();
+
+ /* Continue scanning digits, but can't store any more */
+ while(isDECIMAL_DIGIT(ch)) {
+ ++scale;
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+
+ /* Store results */
+ e_value = value;
+ e_scale = scale;
+
+ return(ch);
+}
+
+static int add_radix(ch)
+ int ch;
+{
+ if (2 <= m_value && m_value <= 36 && m_scale == 0) {
+ r_base = m_value;
+ save_ch(ch);
+ return(next_ch());
+ }
+ else {
+ /* Radix invalid, complete a name token */
+ return(AAH_NAME(ch));
+ }
+}
+
+static int add_r_digits(ch)
+ int ch;
+{
+ ULONG value;
+ LONG radix, scale;
+ int digit;
+
+ /* NOTE: The syntax of a radix number allows only for
+ * values of zero or more. The value will be stored as
+ * a 32 bit integer, which PostScript then interprets
+ * as signed. This means, for example, that the numbers:
+ *
+ * 8#37777777777
+ * 10#4294967295
+ * 16#FFFFFFFF
+ * 36#1Z141Z3
+ *
+ * are all interpreted as -1. This routine implements this
+ * idea explicitly: it accumulates the number's value
+ * as unsigned, then casts it to signed when done.
+ */
+
+ /* Expect r_base to be initialized */
+ radix = r_base;
+ value = 0;
+ scale = 0;
+
+ /* Scan leading zeroes */
+ while(ch == '0') {
+ save_ch(ch);
+ ch = next_ch();
+ }
+
+ /* Handle first non-zero digit */
+ if ((digit=digit_value[ch]) < radix) {
+ value = digit;
+ save_ch(ch);
+ ch = next_ch();
+
+ /* Add digits until boundary case reached */
+ while((digit=digit_value[ch]) < radix
+ && value < (MAX_ULONG / radix)) {
+ value = value * radix + digit;
+ save_ch(ch);
+ ch = next_ch();
+ };
+
+ /* Scan remaining digits */
+ if ((digit=digit_value[ch]) < radix) {
+
+ /* Examine boundary case ---
+ * radix*(MAX_ULONG/radix) <= number <= MAX_ULONG
+ */
+ if (value == (MAX_ULONG/radix) && digit <= MAX_ULONG%radix)
+ value = value * radix + digit;
+ else
+ ++scale;
+
+ /* Continue scanning digits, but can't store them */
+ save_ch(ch);
+ ch = next_ch();
+ while(digit_value[ch] < radix) {
+ ++scale;
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+ }
+
+ /* Store result */
+ r_value = (LONG) value; /* result is signed */
+ r_scale = scale;
+
+ return(ch);
+}
+
+/* -------------------------------------------------------------------
+ * Complete a number; set token type and done flag.
+ * Put current input character back, if it is not white space.
+ */
+
+/* Done: Radix Number */
+static int RADIX_NUMBER(ch)
+ int ch;
+{
+ back_ch_not_white(ch);
+ if (r_scale == 0) {
+ tokenValue.integer = r_value;
+ tokenType = TOKEN_INTEGER;
+ }
+ else {
+ tokenType = TOKEN_NAME;
+ }
+ return(DONE);
+}
+
+/* Done: Integer */
+static int INTEGER(ch)
+ int ch;
+{
+ back_ch_not_white(ch);
+ if (m_scale == 0) {
+ tokenValue.integer = m_value;
+ tokenType = TOKEN_INTEGER;
+ }
+ else {
+ tokenValue.real = (DOUBLE)(m_value) * Exp10(m_scale);
+ tokenType = TOKEN_REAL;
+ }
+ return(DONE);
+}
+
+/* Done: Real */
+static int REAL(ch)
+ int ch;
+{
+ DOUBLE temp;
+
+ back_ch_not_white(ch);
+
+ /* NOTE: ignore e_scale, since e_value alone will cause
+ * exponent overflow if e_scale > 0.
+ */
+
+ /* HAZARD: exponent overflow of intermediate result
+ * (e.g., in 370 floating point); this should not be a problem
+ * with IEEE floating point. Reduce exponent overflow hazard by
+ * combining m_scale and e_value first, if they have different signs,
+ * or multiplying m_value and one of the other factors, if both
+ * m_scale and e_value are negative.
+ */
+ if ((m_scale >= 0 && e_value <= 0)
+ || (m_scale <= 0 && e_value >= 0)) {
+ tokenValue.real = (DOUBLE)(m_value) * Exp10(m_scale + e_value);
+ }
+ else {
+ temp = (DOUBLE)(m_value) * Exp10(m_scale);
+ tokenValue.real = temp * Exp10(e_value);
+ }
+
+ tokenType = TOKEN_REAL;
+ return(DONE);
+}
+
+
+/* -------------------------------------------------------------------
+ * Assemble a hex string; set token type and done flag.
+ */
+
+/* Done: Hex String */
+static int HEX_STRING(ch)
+ int ch;
+{
+ int value;
+
+ while(TRUE) {
+
+ /* Process odd digit */
+ ch = next_ch();
+ if (!isHEX_DIGIT(ch)) {
+
+ /* Skip white space */
+ while(isWHITE_SPACE(ch))
+ ch = next_ch();
+
+ /* Check for terminator */
+ if (!isHEX_DIGIT(ch)) {
+ break;
+ }
+ }
+ value = digit_value[ch] << 4;
+
+ /* Process even digit */
+ ch = next_ch();
+ if (!isHEX_DIGIT(ch)) {
+
+ /* Skip white space */
+ while(isWHITE_SPACE(ch))
+ ch = next_ch();
+
+ /* Check for terminator */
+ if (!isHEX_DIGIT(ch)) {
+ save_ch(value);
+ break;
+ }
+ }
+ save_ch(value + digit_value[ch]);
+ }
+
+ /* Classify result, based on why loop ended */
+ if (ch == '>')
+ tokenType = TOKEN_HEX_STRING;
+ else {
+ /* save the invalid character for error reporting */
+ save_ch(ch);
+ tokenType = TOKEN_INVALID;
+ }
+
+ return(DONE);
+}
+
+/* -------------------------------------------------------------------
+ * Assemble a string; set token type and done flag
+ */
+
+/* Save a backslash-coded character in a string --
+ *
+ * Store the proper character for special cases
+ * "\b", "\f", "\n", "\r", and "\t".
+ *
+ * Decode and store octal-coded character, up to
+ * three octal digits, "\o", "\oo", and "\ooo".
+ *
+ * The sequence "\<newline>" is a line continuation,
+ * so consume both without storing anything.
+ *
+ * The sequence "\<EOF>" is an error; exit without
+ * storing anything and let the caller handle it.
+ *
+ * For other characters, including the sequences
+ * "\\", "\(", and "\)", simply store the second
+ * character.
+ */
+static void save_digraph(ch)
+ int ch;
+{
+ int value;
+
+ switch (ch) {
+
+ case 'b': /* backspace */
+ ch = '\b';
+ break;
+
+ case 'f': /* formfeed */
+ ch = '\f';
+ break;
+
+ case 'n': /* newline */
+ ch = '\n';
+ break;
+
+ case 'r': /* carriage return */
+ ch = '\r';
+ break;
+
+ case 't': /* horizontal tab */
+ ch = '\t';
+ break;
+
+ case '\n': /* line continuation -- consume it */
+ return;
+
+ case '\r': /* carriage return -- consume it */
+ ch = next_ch(); /* look at next character, is it \n? */
+ if (ch == '\n') return;
+ back_ch(ch); /* if not a line feed, then return it */
+ return;
+
+ case EOF: /* end of file -- forget it */
+ return;
+
+ default:
+ /* scan up to three octal digits to get value */
+ if (isOCTAL_DIGIT(ch)) {
+ value = digit_value[ch];
+ ch = next_ch();
+ if (isOCTAL_DIGIT(ch)) {
+ value = (value << 3) + digit_value[ch];
+ ch = next_ch();
+ if (isOCTAL_DIGIT(ch))
+ value = (value << 3) + digit_value[ch];
+ else
+ back_ch(ch);
+ }
+ else
+ back_ch(ch);
+ ch = value;
+ }
+ }
+
+ /* Found a character to save */
+ save_ch(ch);
+}
+
+/* Done: String */
+static int STRING(ch)
+ int ch;
+{
+ int nest_level = 1;
+
+ tokenType = TOKEN_STRING;
+
+ do {
+
+ ch = next_ch();
+ while(!isSTRING_SPECIAL(ch)) {
+ save_ch(ch);
+ ch = next_ch();
+ };
+
+ switch (ch) {
+
+ case '(':
+ ++nest_level;
+ save_ch(ch);
+ break;
+
+ case ')':
+ if (--nest_level > 0)
+ save_ch(ch);
+ break;
+
+ case '\\':
+ save_digraph(next_ch());
+ break;
+
+ case '\r':
+ /* All carriage returns (\r) are turned into linefeeds (\n)*/
+ ch = next_ch(); /* get the next one, is it \n? */
+ if (ch != '\n') { /* if not, then put it back. */
+ back_ch(ch);
+ }
+ save_ch('\n'); /* in either case, save a linefeed */
+ break;
+
+
+ case EOF:
+ tokenType = TOKEN_INVALID; /* Unterminated string */
+ nest_level = 0;
+ break;
+ }
+
+ } while(nest_level > 0);
+
+ return(DONE);
+}
+
+
+/* -------------------------------------------------------------------
+ * Assemble a name; set token type and done flag.
+ * Put current input character back, if it is not white space.
+ */
+
+/* Done: Name
+ * (Safe version used to complete name tokens that
+ * start out looking like something else).
+ */
+
+static int AAH_NAME(ch)
+ int ch;
+{
+ do {
+ save_ch(ch);
+ ch = next_ch();
+ } while(isNAME(ch));
+
+ back_ch_not_white(ch);
+ tokenType = TOKEN_NAME;
+ return(DONE);
+}
+
+/* Done: Name */
+static int NAME(ch)
+ int ch;
+{
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ while(isNAME(ch)) {
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ back_ch_not_white(ch);
+ tokenType = TOKEN_NAME;
+ return(DONE);
+}
+
+/* Done: Literal Name */
+static int LITERAL_NAME(ch)
+ int ch;
+{
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ while(isNAME(ch)) {
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ back_ch_not_white(ch);
+ tokenType = TOKEN_LITERAL_NAME;
+ return(DONE);
+}
+
+/* Done: immediate Name */
+static int IMMED_NAME(ch)
+ int ch;
+{
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ if (isNAME(ch)) {
+ save_unsafe_ch(ch);
+ ch = next_ch();
+ while(isNAME(ch)) {
+ save_ch(ch);
+ ch = next_ch();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ back_ch_not_white(ch);
+ tokenType = TOKEN_IMMED_NAME;
+ return(DONE);
+}
+
+/* Done: Name found while looking for something else */
+static int OOPS_NAME(ch)
+ int ch;
+{
+ back_ch_not_white(ch);
+ tokenType = TOKEN_NAME;
+ return(DONE);
+}
+
+
+/* -------------------------------------------------------------------
+ * Complete a miscellaneous token; set token type and done flag.
+ */
+
+/* Done: Unmatched Right Angle-Bracket */
+static int RIGHT_ANGLE(ch)
+ int ch;
+{
+ tokenType = TOKEN_RIGHT_ANGLE;
+ return(DONE);
+}
+
+/* Done: Unmatched Right Parenthesis */
+static int RIGHT_PAREN(ch)
+ int ch;
+{
+ tokenType = TOKEN_RIGHT_PAREN;
+ return(DONE);
+}
+
+/* Done: Left Brace */
+static int LEFT_BRACE(ch)
+ int ch;
+{
+ tokenType = TOKEN_LEFT_BRACE;
+ return(DONE);
+}
+
+/* Done: Right Brace */
+static int RIGHT_BRACE(ch)
+ int ch;
+{
+ tokenType = TOKEN_RIGHT_BRACE;
+ return(DONE);
+}
+
+/* Done: Left Bracket */
+static int LEFT_BRACKET(ch)
+ int ch;
+{
+ save_unsafe_ch(ch);
+ tokenType = TOKEN_LEFT_BRACKET;
+ return(DONE);
+}
+
+/* Done: Right Bracket */
+static int RIGHT_BRACKET(ch)
+ int ch;
+{
+ save_unsafe_ch(ch);
+ tokenType = TOKEN_RIGHT_BRACKET;
+ return(DONE);
+}
+
+/* Done: Break */
+static int BREAK_SIGNAL(ch)
+ int ch;
+{
+ tokenType = TOKEN_BREAK;
+ return(DONE);
+}
+
+/* Done: No Token Found */
+static int NO_TOKEN(ch)
+ int ch;
+{
+ tokenType = TOKEN_EOF;
+ return(DONE);
+}
+
+
+/*
+ * -------------------------------------------------------------------
+ * scan_token -- scan one token from the input. It uses a simple
+ * finite state machine to recognize token classes.
+ *
+ * The input is from a file.
+ *
+ * On entry --
+ *
+ * inputP -> input PostScript object, a file.
+ * tokenStartP -> buffer in VM for accumulating the token.
+ * tokenMaxP -> last character in the token buffer
+ *
+ * On exit --
+ *
+ * tokenLength = number of characters in the token
+ * tokenTooLong = TRUE if the token did not fit in the buffer
+ * tokenType = code for the type of token parsed.
+ * tokenValue = converted value of a numeric token.
+ *
+ *
+ * -------------------------------------------------------------------
+ */
+void scan_token(inputP)
+ psobj *inputP;
+{
+ int ch;
+ unsigned char *stateP = s0;
+ unsigned char entry;
+ int (*actionP)();
+
+ /* Define input source */
+ inputFileP = inputP->data.fileP;
+ if (inputFileP == NULL) {
+ tokenType = TOKEN_EOF;
+ return;
+ }
+
+ /* Ensure enough space for most cases
+ * (so we don't have to keep checking)
+ * The length needs to cover the maximum number
+ * of save_unsafe_ch() calls that might be executed.
+ * That number is 11 (a sign and 10 decimal digits, e.g.,
+ * when scanning -2147483648), but use MAX_NAME_LEN
+ * in case someone changes that without checking.
+ */
+ if (vm_free_bytes() < (MAX_NAME_LEN)) {
+ if (!(vm_init())) {
+ tokenLength = 0;
+ tokenTooLong = TRUE;
+ tokenType = TOKEN_NONE;
+ tokenValue.integer = 0;
+ return;
+ }
+ }
+
+ tokenStartP = vm_next_byte();
+
+ /* Reset token */
+ tokenCharP = tokenStartP;
+ tokenTooLong = FALSE;
+
+ /* Scan one token */
+ ch = next_ch();
+ do {
+ entry = stateP[ch];
+ stateP = classActionTable[entry].nextStateP;
+ actionP = classActionTable[entry].actionRoutineP;
+ ch = (*actionP)(ch);
+ } while(ch != DONE);
+
+
+ /* Return results */
+ tokenLength = tokenCharP - tokenStartP;
+}
diff --git a/Build/source/texk/ps2pkm/token.h b/Build/source/texk/ps2pkm/token.h
new file mode 100644
index 00000000000..6fcfa0e63ce
--- /dev/null
+++ b/Build/source/texk/ps2pkm/token.h
@@ -0,0 +1,77 @@
+/* $XConsortium: token.h,v 1.2 91/10/10 11:19:58 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+#ifndef TOKEN_H
+#define TOKEN_H
+
+/* Special characters */
+#define CONTROL_C (3)
+
+/* Token type codes */
+#define TOKEN_INVALID (-3)
+#define TOKEN_BREAK (-2)
+#define TOKEN_EOF (-1)
+#define TOKEN_NONE (0)
+#define TOKEN_LEFT_PAREN (1)
+#define TOKEN_RIGHT_PAREN (2)
+#define TOKEN_LEFT_ANGLE (3)
+#define TOKEN_RIGHT_ANGLE (4)
+#define TOKEN_LEFT_BRACE (5)
+#define TOKEN_RIGHT_BRACE (6)
+#define TOKEN_LEFT_BRACKET (7)
+#define TOKEN_RIGHT_BRACKET (8)
+#define TOKEN_NAME (9)
+#define TOKEN_LITERAL_NAME (10)
+#define TOKEN_INTEGER (11)
+#define TOKEN_REAL (12)
+#define TOKEN_RADIX_NUMBER (13)
+#define TOKEN_HEX_STRING (14)
+#define TOKEN_STRING (15)
+#define TOKEN_IMMED_NAME (16)
+
+/* Token routines */
+extern void scan_token();
+
+/*
+ * -------------------------------------------------------------------------
+ * Globals shared -- (everyone else KEEP YOUR MITTS OFF THEM!)
+ * -------------------------------------------------------------------------
+ */
+
+/* These variables are set by the caller */
+extern char *tokenStartP; /* Pointer to token buffer in VM */
+extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */
+
+/* These variables are set by P_TOKEN */
+extern int tokenLength; /* Characters in token */
+extern boolean tokenTooLong; /* Token too long for space available */
+extern int tokenType; /* Type of token identified */
+extern psvalue tokenValue; /* Token value */
+
+#endif /* TOKEN_H */
diff --git a/Build/source/texk/ps2pkm/tokst.h b/Build/source/texk/ps2pkm/tokst.h
new file mode 100644
index 00000000000..31a9fd04b02
--- /dev/null
+++ b/Build/source/texk/ps2pkm/tokst.h
@@ -0,0 +1,508 @@
+/* $XConsortium: tokst.h,v 1.2 91/10/10 11:20:00 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* -------------------------------------- */
+/* --- MACHINE GENERATED, DO NOT EDIT --- */
+/* -------------------------------------- */
+
+#ifndef TOKST
+#define TOKST 1
+
+/*
+ * State Index Tables --
+ *
+ * These tables map the input character to the
+ * proper entry in the Class Action Table.
+ * There is one table for each state.
+ *
+ */
+#define s0 (si0+2)
+static unsigned char si0[258] = { 0x10,0x11,
+ 0x02,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x02,0x02,0x0F,0x0F,0x02,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x02,0x0F,0x0F,0x0F,0x0F,0x03,0x0F,0x0F,0x05,0x0B,0x0F,0x0D,0x0F,0x0D,0x0E,0x04,
+ 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x0F,0x08,0x0F,0x0C,0x0F,
+ 0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x0F,0x0A,0x0F,0x0F,
+ 0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0F,0x09,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
+ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F
+};
+
+#define s1 (si1+2)
+static unsigned char si1[258] = { 0x14,0x15,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
+ 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13
+};
+
+#define s2 (si2+2)
+static unsigned char si2[258] = { 0x1B,0x1C,
+ 0x16,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x16,0x16,0x1A,0x1A,0x16,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x16,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x1A,0x17,0x17,0x1A,0x1A,0x1A,0x1A,0x19,0x17,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1A,0x1A,0x17,0x1A,0x17,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x17,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x17,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
+ 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A
+};
+
+#define s3 (si3+2)
+static unsigned char si3[258] = { 0x23,0x24,
+ 0x1D,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1D,0x1D,0x22,0x22,0x1D,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x1D,0x22,0x22,0x20,0x22,0x1E,0x22,0x22,0x1E,0x1E,0x22,0x22,0x22,0x22,0x1F,0x1E,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22
+};
+
+#define s4 (si4+2)
+static unsigned char si4[258] = { 0x29,0x2A,
+ 0x25,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x25,0x25,0x28,0x28,0x25,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x25,0x28,0x28,0x28,0x28,0x26,0x28,0x28,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x26,
+ 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x26,0x28,0x26,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x28,0x26,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x28,0x26,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
+ 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28
+};
+
+#define s5 (si5+2)
+static unsigned char si5[258] = { 0x30,0x31,
+ 0x2B,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2B,0x2B,0x2F,0x2F,0x2B,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2B,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2F,0x2C,0x2C,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,
+ 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2D,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2D,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,
+ 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F
+};
+
+#define s6 (si6+2)
+static unsigned char si6[258] = { 0x36,0x37,
+ 0x32,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x32,0x32,0x35,0x35,0x32,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x32,0x35,0x35,0x35,0x35,0x33,0x35,0x35,0x33,0x33,0x35,0x35,0x35,0x35,0x35,0x33,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,
+ 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35
+};
+
+#define s7 (si7+2)
+static unsigned char si7[258] = { 0x3D,0x3E,
+ 0x38,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x38,0x38,0x3C,0x3C,0x38,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x38,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x3C,0x39,0x39,0x3C,0x3A,0x3C,0x3A,0x3C,0x39,
+ 0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3C,0x3C,0x39,0x3C,0x39,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x39,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x39,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,
+ 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C
+};
+
+#define s8 (si8+2)
+static unsigned char si8[258] = { 0x43,0x44,
+ 0x3F,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3F,0x3F,0x42,0x42,0x3F,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x3F,0x42,0x42,0x42,0x42,0x40,0x42,0x42,0x40,0x40,0x42,0x42,0x42,0x42,0x42,0x40,
+ 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x40,0x42,0x40,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x42,0x40,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x42,0x40,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,
+ 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42
+};
+
+#define s9 (si9+2)
+static unsigned char si9[258] = { 0x48,0x49,
+ 0x45,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x45,0x45,0x47,0x47,0x45,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x45,0x47,0x47,0x47,0x47,0x46,0x47,0x47,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x46,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,
+ 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47
+};
+
+#define s10 (si10+2)
+static unsigned char si10[258] = { 0x4E,0x4F,
+ 0x4A,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4A,0x4A,0x4D,0x4D,0x4A,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4A,0x4D,0x4D,0x4D,0x4D,0x4B,0x4D,0x4D,0x4B,0x4B,0x4D,0x4D,0x4D,0x4D,0x4D,0x4B,
+ 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4D,0x4D,0x4B,0x4D,0x4B,0x4D,
+ 0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,
+ 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4B,0x4D,0x4B,0x4D,0x4D,
+ 0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,
+ 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4B,0x4D,0x4B,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,
+ 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D
+};
+
+#define s11 (si11+2)
+static unsigned char si11[258] = { 0x53,0x54,
+ 0x50,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x50,0x50,0x52,0x52,0x50,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x50,0x52,0x52,0x52,0x52,0x51,0x52,0x52,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x51,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,
+ 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52
+};
+
+/*
+ * Class Action Table --
+ *
+ * The entries in the Class Action Table indicate the
+ * action routine to be called, and the next state to
+ * enter, for each relevant character class in each.
+ * state. There are several entries for each state.
+ *
+ */
+static int AAH_NAME();
+static int BREAK_SIGNAL();
+static int HEX_STRING();
+static int IMMED_NAME();
+static int INTEGER();
+static int LEFT_BRACE();
+static int LEFT_BRACKET();
+static int LITERAL_NAME();
+static int NAME();
+static int NO_TOKEN();
+static int OOPS_NAME();
+static int RADIX_NUMBER();
+static int REAL();
+static int RIGHT_ANGLE();
+static int RIGHT_BRACE();
+static int RIGHT_BRACKET();
+static int RIGHT_PAREN();
+static int STRING();
+static int add_1st_decpt();
+static int add_1st_digits();
+static int add_char();
+static int add_decpt();
+static int add_digits();
+static int add_e_sign();
+static int add_exponent();
+static int add_fraction();
+static int add_r_digits();
+static int add_radix();
+static int add_sign();
+static int next_char();
+static int skip_comment();
+static int skip_space();
+
+static struct cat {
+ int (*actionRoutineP)();
+ unsigned char *nextStateP;
+} classActionTable[] = {
+
+ /* s0: Classify initial character */
+ /* 00 ALPHA */ {NAME, s0}, /* executable name */
+ /* 01 DIGIT */ {add_1st_digits, s3}, /* number? */
+ /* 02 WHITE_SPACE */ {skip_space, s0}, /* skip white space */
+ /* 03 PERCENT */ {skip_comment, s0}, /* comment? */
+ /* 04 SLASH */ {next_char, s1}, /* literal or imm name */
+ /* 05 LEFT_PAREN */ {STRING, s0}, /* string */
+ /* 06 LEFT_BRACE */ {LEFT_BRACE, s0}, /* begin procedure body */
+ /* 07 LEFT_BRACKET */ {LEFT_BRACKET, s0}, /* begin array */
+ /* 08 LEFT_ANGLE */ {HEX_STRING, s0}, /* hex string? */
+ /* 09 RIGHT_BRACE */ {RIGHT_BRACE, s0}, /* end procedure body */
+ /* 0A RIGHT_BRACKET */ {RIGHT_BRACKET, s0}, /* end array */
+ /* 0B RIGHT_PAREN */ {RIGHT_PAREN, s0}, /* unmatched right paren */
+ /* 0C RIGHT_ANGLE */ {RIGHT_ANGLE, s0}, /* unmatched right angle */
+ /* 0D SIGN */ {add_sign, s2}, /* signed number? */
+ /* 0E DECIMAL_POINT */ {add_1st_decpt, s4}, /* real number? */
+ /* 0F ANY */ {NAME, s0}, /* executable name */
+ /* 10 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 11 EOF */ {NO_TOKEN, s0}, /* no token found */
+
+ /* s1: Further classify a '/' */
+ /* 12 SLASH */ {IMMED_NAME, s0}, /* immediate name */
+ /* 13 ANY */ {LITERAL_NAME, s0}, /* literal name */
+ /* 14 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 15 EOF */ {OOPS_NAME, s0}, /* isolated sign */
+
+ /* s2: sign */
+ /* 16 WHITE_SPACE */ {OOPS_NAME, s0}, /* isolated sign */
+ /* 17 SPECIAL */ {OOPS_NAME, s0}, /* isolated sign */
+ /* 18 DIGIT */ {add_digits, s3}, /* number? */
+ /* 19 DECIMAL_POINT */ {add_decpt, s4}, /* real number? */
+ /* 1A ANY */ {NAME, s0}, /* executable name */
+ /* 1B BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 1C EOF */ {OOPS_NAME, s0}, /* isolated sign */
+
+ /* s3: sign? digit+ */
+ /* 1D WHITE_SPACE */ {INTEGER, s0}, /* n-digit integer */
+ /* 1E SPECIAL */ {INTEGER, s0}, /* n-digit integer */
+ /* 1F DECIMAL_POINT */ {add_char, s5}, /* real number? */
+ /* 20 POUND */ {add_radix, s10}, /* radix number? */
+ /* 21 eE */ {add_char, s7}, /* real with exponent? */
+ /* 22 ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 23 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 24 EOF */ {INTEGER, s0}, /* n-digit integer */
+
+ /* s4: sign? . */
+ /* 25 WHITE_SPACE */ {OOPS_NAME, s0}, /* isolated +. or -. */
+ /* 26 SPECIAL */ {OOPS_NAME, s0}, /* isolated +. or -. */
+ /* 27 DIGIT */ {add_fraction, s6}, /* number? */
+ /* 28 ANY */ {NAME, s0}, /* executable name */
+ /* 29 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 2A EOF */ {OOPS_NAME, s0}, /* isolated +. or -. */
+
+ /* s5: sign? digit+ . */
+ /* 2B WHITE_SPACE */ {REAL, s0}, /* real with fraction */
+ /* 2C SPECIAL */ {REAL, s0}, /* real with fraction */
+ /* 2D eE */ {add_char, s7}, /* real with exponent? */
+ /* 2E DIGIT */ {add_fraction, s6}, /* number? */
+ /* 2F ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 30 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 31 EOF */ {REAL, s0}, /* real with fraction */
+
+ /* s6: sign? (digit+ . digit+) | (. digit+) */
+ /* 32 WHITE_SPACE */ {REAL, s0}, /* real with fraction */
+ /* 33 SPECIAL */ {REAL, s0}, /* real with fraction */
+ /* 34 eE */ {add_char, s7}, /* real with exponent? */
+ /* 35 ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 36 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 37 EOF */ {REAL, s0}, /* real with fraction */
+
+ /* s7: sign? ((digit+ (. digit*)?) | (. digit+)) Ee */
+ /* 38 WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid real number */
+ /* 39 SPECIAL */ {OOPS_NAME, s0}, /* invalid real number */
+ /* 3A SIGN */ {add_e_sign, s8}, /* real w signed exponent? */
+ /* 3B DIGIT */ {add_exponent, s9}, /* real w exponent ? */
+ /* 3C ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 3D BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 3E EOF */ {OOPS_NAME, s0}, /* invalid real number */
+
+ /* s8: sign? (digit+ (. digit*)? | (digit* . digit+) Ee sign */
+ /* 3F WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid real number */
+ /* 40 SPECIAL */ {OOPS_NAME, s0}, /* invalid real number */
+ /* 41 DIGIT */ {add_exponent, s9}, /* real w exponent? */
+ /* 42 ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 43 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 44 EOF */ {OOPS_NAME, s0}, /* invalid real number */
+
+ /* s9: sign? (digit+ (. digit*)? | (digit* . digit+) Ee sign? digit+ */
+ /* 45 WHITE_SPACE */ {REAL, s0}, /* real w exponent */
+ /* 46 SPECIAL */ {REAL, s0}, /* real w exponent */
+ /* 47 ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 48 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 49 EOF */ {REAL, s0}, /* real w exponent */
+
+ /* s10: digit+ # */
+ /* 4A WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid radix number */
+ /* 4B SPECIAL */ {OOPS_NAME, s0}, /* invalid radix number */
+ /* 4C R_DIGIT */ {add_r_digits, s11}, /* radix number? */
+ /* 4D ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 4E BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 4F EOF */ {OOPS_NAME, s0}, /* invalid radix number */
+
+ /* s11: digit+ # r_digit+ */
+ /* 50 WHITE_SPACE */ {RADIX_NUMBER, s0}, /* radix number */
+ /* 51 SPECIAL */ {RADIX_NUMBER, s0}, /* radix number */
+ /* 52 ANY */ {AAH_NAME, s0}, /* executable name */
+ /* 53 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */
+ /* 54 EOF */ {RADIX_NUMBER, s0} /* radix number */
+};
+
+/*
+ * Character Classification Tables --
+ *
+ * The entries in the Character Classification Tables
+ * map character codes to character classes. The
+ * tables contains one entry per code. The bits in
+ * each entry indicate which classes the character
+ * code belongs to.
+ *
+ * The macros 'isInCLASS(ch)' generate code to test
+ * whether 'ch' is a character in 'CLASS'.
+ *
+ */
+/* Membership macros for classes defined in table 1 ... */
+#define isRADIX_DIGIT(c) ((isInP1[c] & 0x80) != 0)
+#define isHEX_DIGIT(c) ((isInP1[c] & 0x40) != 0)
+#define isDECIMAL_DIGIT(c) ((isInP1[c] & 0x10) != 0)
+#define isOCTAL_DIGIT(c) ((isInP1[c] & 0x20) != 0)
+
+/* Membership macros for classes defined in table 2 ... */
+#define isWHITE_SPACE(c) ((isInP2[c] & 0x80) != 0)
+#define isCOMMENT(c) ((isInP2[c] & 0x40) != 0)
+#define isNAME(c) ((isInP2[c] & 0x20) != 0)
+#define isSTRING_SPECIAL(c) ((isInP2[c] & 0x10) != 0)
+#define isNUMBER_ENDER(c) ((isInP2[c] & 0x08) != 0)
+
+#define isInP1 (isInT1+2)
+static unsigned char isInT1[258] = { 0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xD0,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
+ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+
+#define isInP2 (isInT2+2)
+static unsigned char isInT2[258] = { 0x18,0x18,
+ 0xC8,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC8,0x88,0x60,0x60,0x98,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0xC8,0x60,0x60,0x60,0x60,0x48,0x60,0x60,0x58,0x58,0x60,0x60,0x60,0x60,0x60,0x48,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x60,0x48,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x70,0x48,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x60,0x48,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
+ 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60
+};
+
+#endif
diff --git a/Build/source/texk/ps2pkm/trig.h b/Build/source/texk/ps2pkm/trig.h
new file mode 100644
index 00000000000..ebc253f243b
--- /dev/null
+++ b/Build/source/texk/ps2pkm/trig.h
@@ -0,0 +1,33 @@
+/* $XConsortium: trig.h,v 1.2 91/10/10 11:20:04 rws Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/*SHARED*/
+
+#define DegreeCos(d) xiStub()
+#define DegreeSin(d) xiStub()
diff --git a/Build/source/texk/ps2pkm/type1.c b/Build/source/texk/ps2pkm/type1.c
new file mode 100644
index 00000000000..027bf1f6ce4
--- /dev/null
+++ b/Build/source/texk/ps2pkm/type1.c
@@ -0,0 +1,1826 @@
+/* $XConsortium: type1.c,v 1.5 91/10/10 11:20:06 rws Exp $ */
+/* Copyright International Business Machines, Corp. 1991
+ * All Rights Reserved
+ * Copyright Lexmark International, Inc. 1991
+ * All Rights Reserved
+ * Portions Copyright (c) 1990 Adobe Systems Incorporated.
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM or Lexmark or Adobe
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission.
+ *
+ * IBM, LEXMARK, AND ADOBE PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY
+ * WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE
+ * ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING
+ * ANY DUTY TO SUPPORT OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY
+ * PORTION OF THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM,
+ * LEXMARK, OR ADOBE) ASSUMES THE ENTIRE COST OF ALL SERVICING, REPAIR AND
+ * CORRECTION. IN NO EVENT SHALL IBM, LEXMARK, OR ADOBE BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*********************************************************************/
+/* */
+/* Type 1 module - Converting fonts in Adobe Type 1 Font Format */
+/* to scaled and hinted paths for rasterization. */
+/* Files: type1.c, type1.h, and blues.h. */
+/* */
+/* Authors: Sten F. Andler, IBM Almaden Research Center */
+/* (Type 1 interpreter, stem & flex hints) */
+/* */
+/* Patrick A. Casey, Lexmark International, Inc. */
+/* (Font level hints & stem hints) */
+/* */
+/*********************************************************************/
+
+/******************/
+/* Include Files: */
+/******************/
+#include "types.h"
+#include <stdio.h> /* a system-dependent include, usually */
+
+#include "objects.h"
+#include "spaces.h"
+#include "paths.h"
+#include "fonts.h" /* understands about TEXTTYPEs */
+#include "pictures.h" /* understands about handles */
+
+typedef struct xobject xobject;
+#include "util.h" /* PostScript objects */
+#include "blues.h" /* Blues structure for font-level hints */
+
+/**********************************/
+/* Type1 Constants and Structures */
+/**********************************/
+#define MAXSTACK 24 /* Adobe Type1 limit */
+#define MAXCALLSTACK 10 /* Adobe Type1 limit */
+#define MAXPSFAKESTACK 32 /* Max depth of fake PostScript stack (local) */
+#define MAXSTRLEN 512 /* Max length of a Type 1 string (local) */
+#define MAXLABEL 256 /* Maximum number of new hints */
+#define MAXSTEMS 128 /* Maximum number of VSTEM and HSTEM hints */
+#define EPS 0.001 /* Small number for comparisons */
+
+/************************************/
+/* Adobe Type 1 CharString commands */
+/************************************/
+#define HSTEM 1
+#define VSTEM 3
+#define VMOVETO 4
+#define RLINETO 5
+#define HLINETO 6
+#define VLINETO 7
+#define RRCURVETO 8
+#define CLOSEPATH 9
+#define CALLSUBR 10
+#define RETURN 11
+#define ESCAPE 12
+#define HSBW 13
+#define ENDCHAR 14
+#define RMOVETO 21
+#define HMOVETO 22
+#define VHCURVETO 30
+#define HVCURVETO 31
+
+/*******************************************/
+/* Adobe Type 1 CharString Escape commands */
+/*******************************************/
+#define DOTSECTION 0
+#define VSTEM3 1
+#define HSTEM3 2
+#define SEAC 6
+#define SBW 7
+#define DIV 12
+#define CALLOTHERSUBR 16
+#define POP 17
+#define SETCURRENTPOINT 33
+
+/*****************/
+/* Useful macros */
+/*****************/
+static DOUBLE tmpx; /* Store macro argument in tmpx to avoid re-evaluation */
+static LONG tmpi; /* Store converted value in tmpi to avoid re-evaluation */
+
+#define FABS(x) (((tmpx = (x)) < 0.0) ? -tmpx : tmpx)
+
+#define CEIL(x) (((tmpi = (LONG) (tmpx = (x))) < tmpx) ? ++tmpi : tmpi)
+
+#define FLOOR(x) (((tmpi = (LONG) (tmpx = (x))) > tmpx) ? --tmpi : tmpi)
+
+#define ROUND(x) FLOOR((x) + 0.5)
+
+#define ODD(x) (((int)(x)) & 01)
+
+int currentchar = -1; /* for error reporting */
+
+#define CC IfTrace1(TRUE, "'%03o ", currentchar)
+
+#define Error {errflag = TRUE; return;}
+
+#define Error0(errmsg) { CC; IfTrace0(TRUE, errmsg); Error;}
+
+#define Error1(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Error;}
+
+/********************/
+/* global variables */
+/********************/
+struct stem { /* representation of a STEM hint */
+ int vertical; /* TRUE if vertical, FALSE otherwise */
+ DOUBLE x, dx; /* interval of vertical stem */
+ DOUBLE y, dy; /* interval of horizontal stem */
+ struct segment *lbhint, *lbrevhint; /* left or bottom hint adjustment */
+ struct segment *rthint, *rtrevhint; /* right or top hint adjustment */
+};
+
+extern struct XYspace *IDENTITY;
+
+static DOUBLE escapementX, escapementY;
+static DOUBLE sidebearingX, sidebearingY;
+static DOUBLE accentoffsetX, accentoffsetY;
+
+static struct segment *path;
+static int errflag;
+
+/*************************************************/
+/* Global variables to hold Type1Char parameters */
+/*************************************************/
+static char *Environment;
+static struct XYspace *CharSpace;
+static psobj *CharStringP, *SubrsP, *OtherSubrsP;
+static int *ModeP;
+
+/************************/
+/* Forward declarations */
+/************************/
+#ifdef WIN32
+/* Unfortunately, there is such a function in the Win32 API */
+#define Escape Type1Escape
+#endif
+#ifdef KPATHSEA
+static void ComputeAlignmentZones P1H(void);
+static void InitStems P1H(void);
+static void FinitStems P1H(void);
+static void ComputeStem P1H(int stemno);
+static struct segment *Applyhint P3H(struct segment *p,int stemnumber,int half);
+static struct segment *Applyrevhint P3H(struct segment *p,int stemnumber,int half);
+static struct segment *FindStems P4H(DOUBLE x,DOUBLE y,DOUBLE dx,DOUBLE dy);
+static void ClearStack P1H(void);
+static void Push P1H(DOUBLE Num);
+static void ClearCallStack P1H(void);
+static void PushCall P3H(psobj *CurrStrP,int CurrIndex,unsigned short CurrKey);
+static void PopCall P3H(psobj **CurrStrPP ,int *CurrIndexP,unsigned short *CurrKeyP);
+static void ClearPSFakeStack P1H(void);
+static void PSFakePush P1H(DOUBLE Num);
+static DOUBLE PSFakePop P1H(void);
+static struct segment *CenterStem P2H(DOUBLE edge1,DOUBLE edge2);
+static unsigned char Decrypt P1H(unsigned char cipher);
+static int DoRead P1H(int *CodeP);
+static void StartDecrypt P1H(void);
+static void Decode P1H(int Code);
+static void DoCommand P1H(int Code);
+static void Escape P1H(int Code);
+static void HStem P2H(DOUBLE y,DOUBLE dy);
+static void VStem P2H(DOUBLE x,DOUBLE dx);
+static void RLineTo P2H(DOUBLE dx,DOUBLE dy);
+static void RRCurveTo P6H(DOUBLE dx1,DOUBLE dy1,DOUBLE dx2,DOUBLE dy2,DOUBLE dx3,DOUBLE dy3);
+static void DoClosePath P1H(void);
+static void CallSubr P1H(int subrno);
+static void Return P1H(void);
+static void EndChar P1H(void);
+static void RMoveTo P2H(DOUBLE dx,DOUBLE dy);
+static void DotSection P1H(void);
+static void Seac P5H(DOUBLE asb,DOUBLE adx,DOUBLE ady,unsigned char bchar,unsigned char achar);
+static void Sbw P4H(DOUBLE sbx,DOUBLE sby,DOUBLE wx,DOUBLE wy);
+static DOUBLE Div P2H(DOUBLE num1,DOUBLE num2);
+static void FlxProc AA((DOUBLE c1x2,DOUBLE c1y2,DOUBLE c3x0,DOUBLE c3y0,DOUBLE c3x1,DOUBLE c3y1,DOUBLE c3x2,DOUBLE c3y2,DOUBLE c4x0,DOUBLE c4y0,DOUBLE c4x1,DOUBLE c4y1,DOUBLE c4x2,DOUBLE c4y2,DOUBLE epY,DOUBLE epX,int idmin));
+static void FlxProc1 P1H(void);
+static void FlxProc2 P1H(void);
+static void HintReplace P1H(void);
+static void CallOtherSubr P1H(int othersubrno);
+static void SetCurrentPoint P2H(DOUBLE x,DOUBLE y);
+extern struct xobject *Type1Char AA((char *env,struct XYspace *S,psobj *charstrP,psobj *subrsP,psobj *osubrsP,struct blues_struct *bluesP,int *modeP));
+#else
+static DOUBLE Div();
+static DOUBLE PSFakePop();
+static DoCommand();
+static Escape();
+static HStem();
+static VStem();
+static RLineTo();
+static RRCurveTo();
+static DoClosePath();
+static CallSubr();
+static Return();
+static EndChar();
+static RMoveTo();
+static DotSection();
+static Seac();
+static Sbw();
+static CallOtherSubr();
+static SetCurrentPoint();
+#endif
+/*****************************************/
+/* statics for Flex procedures (FlxProc) */
+/*****************************************/
+static struct segment *FlxOldPath; /* save path before Flex feature */
+
+/******************************************************/
+/* statics for Font level hints (Blues) (see blues.h) */
+/******************************************************/
+static struct blues_struct *blues; /* the blues structure */
+static struct alignmentzone alignmentzones[MAXALIGNMENTZONES];
+int numalignmentzones; /* total number of alignment zones */
+
+/****************************************************************/
+/* Subroutines for the Font level hints (Alignment zones, etc.) */
+/****************************************************************/
+
+/******************************************/
+/* Fill in the alignment zone structures. */
+/******************************************/
+static void ComputeAlignmentZones()
+{
+ int i;
+ DOUBLE dummy, bluezonepixels, familyzonepixels;
+ struct segment *p;
+
+ numalignmentzones = 0; /* initialize total # of zones */
+
+ /* do the BlueValues zones */
+ for (i = 0; i < blues->numBlueValues; i +=2, ++numalignmentzones) {
+ /* the 0th & 1st numbers in BlueValues are for a bottom zone */
+ /* the rest are topzones */
+ if (i == 0) /* bottom zone */
+ alignmentzones[numalignmentzones].topzone = FALSE;
+ else /* top zone */
+ alignmentzones[numalignmentzones].topzone = TRUE;
+ if (i < blues->numFamilyBlues) { /* we must consider FamilyBlues */
+ p = ILoc(CharSpace,0,blues->BlueValues[i] - blues->BlueValues[i+1]);
+ QueryLoc(p, IDENTITY, &dummy, &bluezonepixels);
+ Destroy(p);
+ p = ILoc(CharSpace,0,blues->FamilyBlues[i]-blues->FamilyBlues[i+1]);
+ QueryLoc(p, IDENTITY, &dummy, &familyzonepixels);
+ Destroy(p);
+ /* is the difference in size of the zones less than 1 pixel? */
+ if (FABS(bluezonepixels - familyzonepixels) < 1.0) {
+ /* use the Family zones */
+ alignmentzones[numalignmentzones].bottomy =
+ blues->FamilyBlues[i];
+ alignmentzones[numalignmentzones].topy =
+ blues->FamilyBlues[i+1];
+ continue;
+ }
+ }
+ /* use this font's Blue zones */
+ alignmentzones[numalignmentzones].bottomy = blues->BlueValues[i];
+ alignmentzones[numalignmentzones].topy = blues->BlueValues[i+1];
+ }
+
+ /* do the OtherBlues zones */
+ for (i = 0; i < blues->numOtherBlues; i +=2, ++numalignmentzones) {
+ /* all of the OtherBlues zones are bottom zones */
+ alignmentzones[numalignmentzones].topzone = FALSE;
+ if (i < blues->numFamilyOtherBlues) {/* consider FamilyOtherBlues */
+ p = ILoc(CharSpace,0,blues->OtherBlues[i] - blues->OtherBlues[i+1]);
+ QueryLoc(p, IDENTITY, &dummy, &bluezonepixels);
+ Destroy(p);
+ p = ILoc(CharSpace,0,blues->FamilyOtherBlues[i] -
+ blues->FamilyOtherBlues[i+1]);
+ QueryLoc(p, IDENTITY, &dummy, &familyzonepixels);
+ Destroy(p);
+ /* is the difference in size of the zones less than 1 pixel? */
+ if (FABS(bluezonepixels - familyzonepixels) < 1.0) {
+ /* use the Family zones */
+ alignmentzones[numalignmentzones].bottomy =
+ blues->FamilyOtherBlues[i];
+ alignmentzones[numalignmentzones].topy =
+ blues->FamilyOtherBlues[i+1];
+ continue;
+ }
+ }
+ /* use this font's Blue zones (as opposed to the Family Blues */
+ alignmentzones[numalignmentzones].bottomy = blues->OtherBlues[i];
+ alignmentzones[numalignmentzones].topy = blues->OtherBlues[i+1];
+ }
+}
+
+/**********************************************************************/
+/* Subroutines and statics for handling of the VSTEM and HSTEM hints. */
+/**********************************************************************/
+int InDotSection; /* DotSection flag */
+struct stem stems[MAXSTEMS]; /* All STEM hints */
+int numstems; /* Number of STEM hints */
+int currstartstem; /* The current starting stem. */
+int oldvert, oldhor; /* Remember hint in effect */
+int oldhorhalf, oldverthalf; /* Remember which half of the stem */
+DOUBLE wsoffsetX, wsoffsetY; /* White space offset - for VSTEM3,HSTEM3 */
+int wsset; /* Flag for whether we've set wsoffsetX,Y */
+
+static void InitStems() /* Initialize the STEM hint data structures */
+{
+ InDotSection = FALSE;
+ currstartstem = numstems = 0;
+ oldvert = oldhor = -1;
+}
+
+static void FinitStems() /* Terminate the STEM hint data structures */
+{
+ int i;
+
+ for (i = 0; i < numstems; i++) {
+ Destroy(stems[i].lbhint);
+ Destroy(stems[i].lbrevhint);
+ Destroy(stems[i].rthint);
+ Destroy(stems[i].rtrevhint);
+ }
+}
+
+/*******************************************************************/
+/* Compute the dislocation that a stemhint should cause for points */
+/* inside the stem. */
+/*******************************************************************/
+static void ComputeStem(stemno)
+int stemno;
+{
+ int verticalondevice, idealwidth;
+ DOUBLE stemstart, stemwidth;
+ struct segment *p;
+ int i;
+ DOUBLE stembottom, stemtop, flatposition;
+ DOUBLE Xpixels, Ypixels;
+ DOUBLE unitpixels, onepixel;
+ int suppressovershoot, enforceovershoot;
+ DOUBLE stemshift, flatpospixels, overshoot;
+ DOUBLE widthdiff; /* Number of character space units to adjust width */
+ DOUBLE lbhintvalue, rthintvalue;
+ DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */
+ int rotated; /* TRUE if character is on the side, FALSE if upright */
+
+ /************************************************/
+ /* DETERMINE ORIENTATION OF CHARACTER ON DEVICE */
+ /************************************************/
+
+ QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */
+
+ if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001)
+ rotated = TRUE; /* Char is on side (90 or 270 degrees), possibly oblique. */
+ else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001)
+ rotated = FALSE; /* Char is upright (0 or 180 degrees), possibly oblique. */
+ else {
+ stems[stemno].lbhint = NULL; /* Char is at non-axial angle, ignore hints. */
+ stems[stemno].lbrevhint = NULL;
+ stems[stemno].rthint = NULL;
+ stems[stemno].rtrevhint = NULL;
+ return;
+ }
+
+ /* Determine orientation of stem */
+
+ if (stems[stemno].vertical) {
+ verticalondevice = !rotated;
+ stemstart = stems[stemno].x;
+ stemwidth = stems[stemno].dx;
+ } else {
+ verticalondevice = rotated;
+ stemstart = stems[stemno].y;
+ stemwidth = stems[stemno].dy;
+ }
+
+ /* Determine how many pixels (non-negative) correspond to 1 character space
+ unit (unitpixels), and how many character space units (non-negative)
+ correspond to one pixel (onepixel). */
+
+ if (stems[stemno].vertical)
+ p = ILoc(CharSpace, 1, 0);
+ else
+ p = ILoc(CharSpace, 0, 1);
+ QueryLoc(p, IDENTITY, &Xpixels, &Ypixels);
+ Destroy(p);
+ if (verticalondevice)
+ unitpixels = FABS(Xpixels);
+ else
+ unitpixels = FABS(Ypixels);
+
+ onepixel = 1.0 / unitpixels;
+
+ /**********************/
+ /* ADJUST STEM WIDTHS */
+ /**********************/
+
+ widthdiff = 0.0;
+
+ /* Find standard stem with smallest width difference from this stem */
+ if (stems[stemno].vertical) { /* vertical stem */
+ if (blues->StdVW != 0) /* there is an entry for StdVW */
+ widthdiff = blues->StdVW - stemwidth;
+ for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */
+ if (blues->StemSnapV[i] - stemwidth < widthdiff)
+ /* this standard width is the best match so far for this stem */
+ widthdiff = blues->StemSnapV[i] - stemwidth;
+ }
+ } else { /* horizontal stem */
+ if (blues->StdHW != 0) /* there is an entry for StdHW */
+ widthdiff = blues->StdHW - stemwidth;
+ for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */
+ if (blues->StemSnapH[i] - stemwidth < widthdiff)
+ /* this standard width is the best match so far for this stem */
+ widthdiff = blues->StemSnapH[i] - stemwidth;
+ }
+ }
+
+ /* Only expand or contract stems if they differ by less than 1 pixel from
+ the closest standard width, otherwise make the width difference = 0. */
+ if (FABS(widthdiff) > onepixel)
+ widthdiff = 0.0;
+
+ /* Expand or contract stem to the nearest integral number of pixels. */
+ idealwidth = ROUND((stemwidth + widthdiff) * unitpixels);
+ /* Ensure that all stems are at least one pixel wide. */
+ if (idealwidth == 0)
+ idealwidth = 1;
+ /* Apply ForceBold to vertical stems. */
+ if (blues->ForceBold && stems[stemno].vertical)
+ /* Force this vertical stem to be at least DEFAULTBOLDSTEMWIDTH wide. */
+ if (idealwidth < DEFAULTBOLDSTEMWIDTH)
+ idealwidth = DEFAULTBOLDSTEMWIDTH;
+ /* Now compute the number of character space units necessary */
+ widthdiff = idealwidth * onepixel - stemwidth;
+
+ /*********************************************************************/
+ /* ALIGNMENT ZONES AND OVERSHOOT SUPPRESSION - HORIZONTAL STEMS ONLY */
+ /*********************************************************************/
+
+ stemshift = 0.0;
+
+ if (!stems[stemno].vertical) {
+
+ /* Get bottom and top boundaries of the stem. */
+ stembottom = stemstart;
+ stemtop = stemstart + stemwidth;
+
+ /* Find out if this stem intersects an alignment zone (the BlueFuzz */
+ /* entry in the Private dictionary specifies the number of character */
+ /* units to extend (in both directions) the effect of an alignment */
+ /* zone on a horizontal stem. The default value of BlueFuzz is 1. */
+ for (i = 0; i < numalignmentzones; ++i) {
+ if (alignmentzones[i].topzone) {
+ if (stemtop >= alignmentzones[i].bottomy &&
+ stemtop <= alignmentzones[i].topy + blues->BlueFuzz) {
+ break; /* We found a top-zone */
+ }
+ } else {
+ if (stembottom <= alignmentzones[i].topy &&
+ stembottom >= alignmentzones[i].bottomy - blues->BlueFuzz) {
+ break; /* We found a bottom-zone */
+ }
+ }
+ }
+
+ if (i < numalignmentzones) { /* We found an intersecting zone (number i). */
+ suppressovershoot = FALSE;
+ enforceovershoot = FALSE;
+
+ /* When 1 character space unit is rendered smaller than BlueScale
+ device units (pixels), we must SUPPRESS overshoots. Otherwise,
+ if the top (or bottom) of this stem is more than BlueShift character
+ space units away from the flat position, we must ENFORCE overshoot. */
+
+ if (unitpixels < blues->BlueScale)
+ suppressovershoot = TRUE;
+ else
+ if (alignmentzones[i].topzone)
+ if (stemtop >= alignmentzones[i].bottomy + blues->BlueShift)
+ enforceovershoot = TRUE;
+ else
+ if (stembottom <= alignmentzones[i].topy - blues->BlueShift)
+ enforceovershoot = TRUE;
+
+ /*************************************************/
+ /* ALIGN THE FLAT POSITION OF THE ALIGNMENT ZONE */
+ /*************************************************/
+
+ /* Compute the position of the alignment zone's flat position in
+ device space and the amount of shift needed to align it on a
+ pixel boundary. Move all stems this amount. */
+
+ if (alignmentzones[i].topzone)
+ flatposition = alignmentzones[i].bottomy;
+ else
+ flatposition = alignmentzones[i].topy;
+
+ /* Find the flat position in pixels */
+ flatpospixels = flatposition * unitpixels;
+
+ /* Find the stem shift necessary to align the flat
+ position on a pixel boundary, and use this shift for all stems */
+ stemshift = (ROUND(flatpospixels) - flatpospixels) * onepixel;
+
+ /************************************************/
+ /* HANDLE OVERSHOOT ENFORCEMENT AND SUPPRESSION */
+ /************************************************/
+
+ /* Compute overshoot amount (non-negative) */
+ if (alignmentzones[i].topzone)
+ overshoot = stemtop - flatposition;
+ else
+ overshoot = flatposition - stembottom;
+
+ if (overshoot > 0.0) {
+ /* ENFORCE overshoot by shifting the entire stem (if necessary) so that
+ it falls at least one pixel beyond the flat position. */
+
+ if (enforceovershoot)
+ if (overshoot < onepixel)
+ if (alignmentzones[i].topzone)
+ stemshift += onepixel - overshoot;
+ else
+ stemshift -= onepixel - overshoot;
+
+ /* SUPPRESS overshoot by aligning the stem to the alignment zone's
+ flat position. */
+
+ if (suppressovershoot)
+ if (alignmentzones[i].topzone)
+ stemshift -= overshoot;
+ else
+ stemshift += overshoot;
+ }
+
+ /************************************************************/
+ /* COMPUTE HINT VALUES FOR EACH SIDE OF THE HORIZONTAL STEM */
+ /************************************************************/
+
+ /* If the stem was aligned by a topzone, we expand or contract the stem
+ only at the bottom - since the stem top was aligned by the zone.
+ If the stem was aligned by a bottomzone, we expand or contract the stem
+ only at the top - since the stem bottom was aligned by the zone. */
+ if (alignmentzones[i].topzone) {
+ lbhintvalue = stemshift - widthdiff; /* bottom */
+ rthintvalue = stemshift; /* top */
+ } else {
+ lbhintvalue = stemshift; /* bottom */
+ rthintvalue = stemshift + widthdiff; /* top */
+ }
+
+ stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, lbhintvalue));
+ stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue));
+ stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, 0.0, rthintvalue));
+ stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue));
+
+ return;
+
+ } /* endif (i < numalignmentzones) */
+
+ /* We didn't find any alignment zones intersecting this stem, so
+ proceed with normal stem alignment below. */
+
+ } /* endif (!stems[stemno].vertical) */
+
+ /* Align stem with pixel boundaries on device */
+ stemstart = stemstart - widthdiff / 2;
+ stemshift = ROUND(stemstart * unitpixels) * onepixel - stemstart;
+
+ /* Adjust the boundaries of the stem */
+ lbhintvalue = stemshift - widthdiff / 2; /* left or bottom */
+ rthintvalue = stemshift + widthdiff / 2; /* right or top */
+
+ if (stems[stemno].vertical) {
+ stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, lbhintvalue, 0.0));
+ stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, -lbhintvalue, 0.0));
+ stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, rthintvalue, 0.0));
+ stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, -rthintvalue, 0.0));
+ } else {
+ stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, lbhintvalue));
+ stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue));
+ stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, 0.0, rthintvalue));
+ stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue));
+ }
+}
+
+#define LEFT 1
+#define RIGHT 2
+#define BOTTOM 3
+#define TOP 4
+
+/*********************************************************************/
+/* Adjust a point using the given stem hint. Use the left/bottom */
+/* hint value or the right/top hint value depending on where the */
+/* point lies in the stem. */
+/*********************************************************************/
+static struct segment *Applyhint(p, stemnumber, half)
+struct segment *p;
+int stemnumber, half;
+{
+ if (half == LEFT || half == BOTTOM)
+ return Join(p, stems[stemnumber].lbhint); /* left or bottom hint */
+ else
+ return Join(p, stems[stemnumber].rthint); /* right or top hint */
+}
+
+/*********************************************************************/
+/* Adjust a point using the given reverse hint. Use the left/bottom */
+/* hint value or the right/top hint value depending on where the */
+/* point lies in the stem. */
+/*********************************************************************/
+static struct segment *Applyrevhint(p, stemnumber, half)
+struct segment *p;
+int stemnumber, half;
+{
+ if (half == LEFT || half == BOTTOM)
+ return Join(p, stems[stemnumber].lbrevhint); /* left or bottom hint */
+ else
+ return Join(p, stems[stemnumber].rtrevhint); /* right or top hint */
+}
+
+/***********************************************************************/
+/* Find the vertical and horizontal stems that the current point */
+/* (x, y) may be involved in. At most one horizontal and one vertical */
+/* stem can apply to a single point, since there are no overlaps */
+/* allowed. */
+/* The actual hintvalue is returned as a location. */
+/* Hints are ignored inside a DotSection. */
+/***********************************************************************/
+static struct segment *FindStems(x, y, dx, dy)
+DOUBLE x, y, dx, dy;
+{
+ int i;
+ int newvert, newhor;
+ struct segment *p;
+ int newhorhalf, newverthalf;
+
+ if (InDotSection) return(NULL);
+
+ newvert = newhor = -1;
+ newhorhalf = newverthalf = -1;
+
+ for (i = currstartstem; i < numstems; i++) {
+ if (stems[i].vertical) { /* VSTEM hint */
+ if ((x >= stems[i].x - EPS) &&
+ (x <= stems[i].x+stems[i].dx + EPS)) {
+ newvert = i;
+ if (dy != 0.0) {
+ if (dy < 0) newverthalf = LEFT;
+ else newverthalf = RIGHT;
+ } else {
+ if (x < stems[i].x+stems[i].dx / 2) newverthalf = LEFT;
+ else newverthalf = RIGHT;
+ }
+ }
+ } else { /* HSTEM hint */
+ if ((y >= stems[i].y - EPS) &&
+ (y <= stems[i].y+stems[i].dy + EPS)) {
+ newhor = i;
+ if (dx != 0.0) {
+ if (dx < 0) newhorhalf = TOP;
+ else newhorhalf = BOTTOM;
+ } else {
+ if (y < stems[i].y+stems[i].dy / 2) newhorhalf = BOTTOM;
+ else newhorhalf = TOP;
+ }
+ }
+ }
+ }
+
+ p = NULL;
+
+ if (newvert == -1 && oldvert == -1) ; /* Outside of any hints */
+ else if (newvert == oldvert &&
+ newverthalf == oldverthalf); /* No hint change */
+ else if (oldvert == -1) { /* New vertical hint in effect */
+ p = Applyhint(p, newvert, newverthalf);
+ } else if (newvert == -1) { /* Old vertical hint no longer in effect */
+ p = Applyrevhint(p, oldvert, oldverthalf);
+ } else { /* New vertical hint in effect, old hint no longer in effect */
+ p = Applyrevhint(p, oldvert, oldverthalf);
+ p = Applyhint(p, newvert, newverthalf);
+ }
+
+ if (newhor == -1 && oldhor == -1) ; /* Outside of any hints */
+ else if (newhor == oldhor &&
+ newhorhalf == oldhorhalf) ; /* No hint change */
+ else if (oldhor == -1) { /* New horizontal hint in effect */
+ p = Applyhint(p, newhor, newhorhalf);
+ } else if (newhor == -1) { /* Old horizontal hint no longer in effect */
+ p = Applyrevhint(p, oldhor, oldhorhalf);
+ }
+ else { /* New horizontal hint in effect, old hint no longer in effect */
+ p = Applyrevhint(p, oldhor, oldhorhalf);
+ p = Applyhint(p, newhor, newhorhalf);
+ }
+
+ oldvert = newvert; oldverthalf = newverthalf;
+ oldhor = newhor; oldhorhalf = newhorhalf;
+
+ return p;
+}
+
+/******************************************************/
+/* Subroutines and statics for the Type1Char routines */
+/******************************************************/
+
+static int strindex; /* index into PostScript string being interpreted */
+static DOUBLE currx, curry; /* accumulated x and y values for hints */
+
+struct callstackentry {
+ psobj *currstrP; /* current CharStringP */
+ int currindex; /* current strindex */
+ unsigned short currkey; /* current decryption key */
+ };
+
+static DOUBLE Stack[MAXSTACK];
+static int Top;
+static struct callstackentry CallStack[MAXCALLSTACK];
+static int CallTop;
+static DOUBLE PSFakeStack[MAXPSFAKESTACK];
+static int PSFakeTop;
+
+static void ClearStack()
+{
+ Top = -1;
+}
+
+static void Push(Num)
+ DOUBLE Num;
+{
+ if (++Top < MAXSTACK) Stack[Top] = Num;
+ else Error0("Push: Stack full\n");
+}
+
+static void ClearCallStack()
+{
+ CallTop = -1;
+}
+
+static void PushCall(psobj *CurrStrP, int CurrIndex, unsigned short CurrKey)
+{
+ if (++CallTop < MAXCALLSTACK) {
+ CallStack[CallTop].currstrP = CurrStrP; /* save CharString pointer */
+ CallStack[CallTop].currindex = CurrIndex; /* save CharString index */
+ CallStack[CallTop].currkey = CurrKey; /* save decryption key */
+ }
+ else Error0("PushCall: Stack full\n");
+}
+
+static void PopCall(CurrStrPP, CurrIndexP, CurrKeyP)
+ psobj **CurrStrPP;
+ int *CurrIndexP;
+ unsigned short *CurrKeyP;
+{
+ if (CallTop >= 0) {
+ *CurrStrPP = CallStack[CallTop].currstrP; /* restore CharString pointer */
+ *CurrIndexP = CallStack[CallTop].currindex; /* restore CharString index */
+ *CurrKeyP = CallStack[CallTop--].currkey; /* restore decryption key */
+ }
+ else Error0("PopCall: Stack empty\n");
+}
+
+static void ClearPSFakeStack()
+{
+ PSFakeTop = -1;
+}
+
+/* PSFakePush: Pushes a number onto the fake PostScript stack */
+static void PSFakePush(Num)
+ DOUBLE Num;
+{
+ if (++PSFakeTop < MAXPSFAKESTACK) PSFakeStack[PSFakeTop] = Num;
+ else Error0("PSFakePush: Stack full\n");
+}
+
+/* PSFakePop: Removes a number from the top of the fake PostScript stack */
+static DOUBLE PSFakePop ()
+{
+ if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]);
+ else Error0("PSFakePop : Stack empty\n");
+ /*NOTREACHED*/
+}
+
+/***********************************************************************/
+/* Center a stem on the pixel grid -- used by HStem3 and VStem3 */
+/***********************************************************************/
+static struct segment *CenterStem(edge1, edge2)
+ DOUBLE edge1;
+ DOUBLE edge2;
+{
+ int idealwidth, verticalondevice;
+ DOUBLE leftx, lefty, rightx, righty, center, width;
+ DOUBLE widthx, widthy;
+ DOUBLE shift, shiftx, shifty;
+ DOUBLE Xpixels, Ypixels;
+ struct segment *p;
+
+ p = Loc(CharSpace, edge1, 0.0);
+ QueryLoc(p, IDENTITY, &leftx, &lefty);
+
+ p = Join(p, Loc(CharSpace, edge2, 0.0));
+ QueryLoc(p, IDENTITY, &rightx, &righty);
+ Destroy(p);
+
+ widthx = FABS(rightx - leftx);
+ widthy = FABS(righty - lefty);
+
+ if (widthy <= EPS) { /* verticalondevice hint */
+ verticalondevice = TRUE;
+ center = (rightx + leftx) / 2.0;
+ width = widthx;
+ }
+ else if (widthx <= EPS) { /* horizontal hint */
+ verticalondevice = FALSE;
+ center = (righty + lefty) / 2.0;
+ width = widthy;
+ }
+ else { /* neither horizontal nor verticalondevice and not oblique */
+ return (NULL);
+ }
+
+ idealwidth = ROUND(width);
+ if (idealwidth == 0) idealwidth = 1;
+ if (ODD(idealwidth)) { /* is ideal width odd? */
+ /* center stem over pixel */
+ shift = FLOOR(center) + 0.5 - center;
+ }
+ else {
+ /* align stem on pixel boundary */
+ shift = ROUND(center) - center;
+ }
+
+ if (verticalondevice) {
+ shiftx = shift;
+ shifty = 0.0;
+ } else {
+ shifty = shift;
+ shiftx = 0.0;
+ }
+
+ p = Loc(IDENTITY, shiftx, shifty);
+ QueryLoc(p, CharSpace, &Xpixels, &Ypixels);
+ wsoffsetX = Xpixels; wsoffsetY = Ypixels;
+ currx += wsoffsetX; curry += wsoffsetY;
+
+ return (p);
+}
+
+/*-----------------------------------------------------------------------
+ Decrypt - From Adobe Type 1 book page 63, with some modifications
+-----------------------------------------------------------------------*/
+#define KEY 4330 /* Initial key (seed) for CharStrings decryption */
+#define C1 52845 /* Multiplier for pseudo-random number generator */
+#define C2 22719 /* Constant for pseudo-random number generator */
+
+static unsigned short r; /* Pseudo-random sequence of keys */
+
+static unsigned char Decrypt(unsigned char cipher)
+{
+ unsigned char plain;
+
+ plain = cipher ^ (r >> 8);
+ r = (cipher + r) * C1 + C2;
+ return plain;
+}
+
+/* Get the next byte from the codestring being interpreted */
+static int DoRead(CodeP)
+ int *CodeP;
+{
+ if (strindex >= CharStringP->len) return(FALSE); /* end of string */
+ *CodeP = Decrypt((unsigned char) CharStringP->data.stringP[strindex++]);
+ return(TRUE);
+}
+
+/* Strip blues->lenIV bytes from CharString and update encryption key */
+/* (the lenIV entry in the Private dictionary specifies the number of */
+/* random bytes at the beginning of each CharString; default is 4) */
+static void StartDecrypt()
+{
+ int Code;
+
+ r = KEY; /* Initial key (seed) for CharStrings decryption */
+ for (strindex = 0; strindex < blues->lenIV;)
+ if (!DoRead(&Code)) /* Read a byte and update decryption key */
+ Error0("StartDecrypt: Premature end of CharString\n");
+}
+
+static void Decode(Code)
+ int Code;
+{
+ int Code1, Code2, Code3, Code4;
+
+ if (Code <= 31) /* Code is [0,31] */
+ DoCommand(Code);
+ else if (Code <= 246) /* Code is [32,246] */
+ Push((DOUBLE)(Code - 139));
+ else if (Code <= 250) { /* Code is [247,250] */
+ if (!DoRead(&Code2)) goto ended;
+ Push((DOUBLE)(((Code - 247) << 8) + Code2 + 108));
+ }
+ else if (Code <= 254) { /* Code is [251,254] */
+ if (!DoRead(&Code2)) goto ended;
+ Push((DOUBLE)( -((Code - 251) << 8) - Code2 - 108));
+ }
+ else { /* Code is 255 */
+ if (!DoRead(&Code1)) goto ended;
+ if (!DoRead(&Code2)) goto ended;
+ if (!DoRead(&Code3)) goto ended;
+ if (!DoRead(&Code4)) goto ended;
+ Push((DOUBLE)((((((Code1<<8) + Code2)<<8) + Code3)<<8) + Code4));
+ }
+ return;
+
+ended: Error0("Decode: Premature end of Type 1 CharString");
+}
+
+/* Interpret a command code */
+static void DoCommand(Code)
+ int Code;
+{
+ switch(Code) {
+ case HSTEM: /* |- y dy HSTEM |- */
+ /* Vertical range of a horizontal stem zone */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ HStem(Stack[0], Stack[1]);
+ ClearStack();
+ break;
+ case VSTEM: /* |- x dx VSTEM |- */
+ /* Horizontal range of a vertical stem zone */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ VStem(Stack[0], Stack[1]);
+ ClearStack();
+ break;
+ case VMOVETO: /* |- dy VMOVETO |- */
+ /* Vertical MOVETO, equivalent to 0 dy RMOVETO */
+ if (Top < 0) Error0("DoCommand: Stack low\n");
+ RMoveTo(0.0, Stack[0]);
+ ClearStack();
+ break;
+ case RLINETO: /* |- dx dy RLINETO |- */
+ /* Like RLINETO in PostScript */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ RLineTo(Stack[0], Stack[1]);
+ ClearStack();
+ break;
+ case HLINETO: /* |- dx HLINETO |- */
+ /* Horizontal LINETO, equivalent to dx 0 RLINETO */
+ if (Top < 0) Error0("DoCommand: Stack low\n");
+ RLineTo(Stack[0], 0.0);
+ ClearStack();
+ break;
+ case VLINETO: /* |- dy VLINETO |- */
+ /* Vertical LINETO, equivalent to 0 dy RLINETO */
+ if (Top < 0) Error0("DoCommand: Stack low\n");
+ RLineTo(0.0, Stack[0]);
+ ClearStack();
+ break;
+ case RRCURVETO:
+ /* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */
+ /* Relative RCURVETO, equivalent to dx1 dy1 */
+ /* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */
+ /* (dy1+dy2+dy3) RCURVETO in PostScript */
+ if (Top < 5) Error0("DoCommand: Stack low\n");
+ RRCurveTo(Stack[0], Stack[1], Stack[2], Stack[3],
+ Stack[4], Stack[5]);
+ ClearStack();
+ break;
+ case CLOSEPATH: /* - CLOSEPATH |- */
+ /* Closes a subpath without repositioning the */
+ /* current point */
+ DoClosePath();
+ ClearStack();
+ break;
+ case CALLSUBR: /* subr# CALLSUBR - */
+ /* Calls a CharString subroutine with index */
+ /* subr# from the Subrs array */
+ if (Top < 0) Error0("DoCommand: Stack low\n");
+ CallSubr((int)Stack[Top--]);
+ break;
+ case RETURN: /* - RETURN - */
+ /* Returns from a Subrs array CharString */
+ /* subroutine called with CALLSUBR */
+ Return();
+ break;
+ case ESCAPE: /* ESCAPE to two-byte command code */
+ if (!DoRead(&Code)) Error0("DoCommand: ESCAPE is last byte\n");
+ Escape(Code);
+ break;
+ case HSBW: /* |- sbx wx HSBW |- */
+ /* Set the left sidebearing point to (sbx,0), */
+ /* set the character width vector to (wx,0). */
+ /* Equivalent to sbx 0 wx 0 SBW. Space */
+ /* character should have sbx = 0 */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ Sbw(Stack[0], 0.0, Stack[1], 0.0);
+ ClearStack();
+ break;
+ case ENDCHAR: /* - ENDCHAR |- */
+ /* Finishes a CharString outline */
+ EndChar();
+ ClearStack();
+ break;
+ case RMOVETO: /* |- dx dy RMOVETO |- */
+ /* Behaves like RMOVETO in PostScript */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ RMoveTo(Stack[0], Stack[1]);
+ ClearStack();
+ break;
+ case HMOVETO: /* |- dx HMOVETO |- */
+ /* Horizontal MOVETO. Equivalent to dx 0 RMOVETO */
+ if (Top < 0) Error0("DoCommand: Stack low\n");
+ RMoveTo(Stack[0], 0.0);
+ ClearStack();
+ break;
+ case VHCURVETO: /* |- dy1 dx2 dy2 dx3 VHCURVETO |- */
+ /* Vertical-Horizontal CURVETO, equivalent to */
+ /* 0 dy1 dx2 dy2 dx3 0 RRCURVETO */
+ if (Top < 3) Error0("DoCommand: Stack low\n");
+ RRCurveTo(0.0, Stack[0], Stack[1], Stack[2],
+ Stack[3], 0.0);
+ ClearStack();
+ break;
+ case HVCURVETO: /* |- dx1 dx2 dy2 dy3 HVCURVETO |- */
+ /* Horizontal-Vertical CURVETO, equivalent to */
+ /* dx1 0 dx2 dy2 0 dy3 RRCURVETO */
+ if (Top < 3) Error0("DoCommand: Stack low\n");
+ RRCurveTo(Stack[0], 0.0, Stack[1], Stack[2], 0.0, Stack[3]);
+ ClearStack();
+ break;
+ default: /* Unassigned command code */
+ ClearStack();
+ Error1("DoCommand: Unassigned code %d\n", Code);
+ }
+}
+
+static void Escape(Code)
+ int Code;
+{
+ int i, Num;
+ struct segment *p;
+
+ switch(Code) {
+ case DOTSECTION: /* - DOTSECTION |- */
+ /* Brackets an outline section for the dots in */
+ /* letters such as "i", "j", and "!". */
+ DotSection();
+ ClearStack();
+ break;
+ case VSTEM3: /* |- x0 dx0 x1 dx1 x2 dx2 VSTEM3 |- */
+ /* Declares the horizontal ranges of three */
+ /* vertical stem zones between x0 and x0+dx0, */
+ /* x1 and x1+dx1, and x2 and x2+dx2. */
+ if (Top < 5) Error0("DoCommand: Stack low\n");
+ if (!wsset && ProcessHints) {
+ /* Shift the whole character so that the middle stem is centered. */
+ p = CenterStem(Stack[2] + sidebearingX, Stack[3]);
+ path = Join(path, p);
+ wsset = 1;
+ }
+
+ VStem(Stack[0], Stack[1]);
+ VStem(Stack[2], Stack[3]);
+ VStem(Stack[4], Stack[5]);
+ ClearStack();
+ break;
+ case HSTEM3: /* |- y0 dy0 y1 dy1 y2 dy2 HSTEM3 |- */
+ /* Declares the vertical ranges of three hori- */
+ /* zontal stem zones between y0 and y0+dy0, */
+ /* y1 and y1+dy1, and y2 and y2+dy2. */
+ if (Top < 5) Error0("DoCommand: Stack low\n");
+ HStem(Stack[0], Stack[1]);
+ HStem(Stack[2], Stack[3]);
+ HStem(Stack[4], Stack[5]);
+ ClearStack();
+ break;
+ case SEAC: /* |- asb adx ady bchar achar SEAC |- */
+ /* Standard Encoding Accented Character. */
+ if (Top < 4) Error0("DoCommand: Stack low\n");
+ Seac(Stack[0], Stack[1], Stack[2],
+ (unsigned char) Stack[3],
+ (unsigned char) Stack[4]);
+ ClearStack();
+ break;
+ case SBW: /* |- sbx sby wx wy SBW |- */
+ /* Set the left sidebearing point to (sbx,sby), */
+ /* set the character width vector to (wx,wy). */
+ if (Top < 3) Error0("DoCommand: Stack low\n");
+ Sbw(Stack[0], Stack[1], Stack[2], Stack[3]);
+ ClearStack();
+ break;
+ case DIV: /* num1 num2 DIV quotient */
+ /* Behaves like DIV in the PostScript language */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ Stack[Top-1] = Div(Stack[Top-1], Stack[Top]);
+ Top--;
+ break;
+ case CALLOTHERSUBR:
+ /* arg1 ... argn n othersubr# CALLOTHERSUBR - */
+ /* Make calls on the PostScript interpreter */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ Num = Stack[Top-1];
+ if (Top < Num+1) Error0("DoCommand: Stack low\n");
+ for (i = 0; i < Num; i++) PSFakePush(Stack[Top - i - 2]);
+ Top -= Num + 2;
+ CallOtherSubr((int)Stack[Top + Num + 2]);
+ break;
+ case POP: /* - POP number */
+ /* Removes a number from the top of the */
+ /* PostScript interpreter stack and pushes it */
+ /* onto the Type 1 BuildChar operand stack */
+ Push(PSFakePop());
+ break;
+ case SETCURRENTPOINT: /* |- x y SETCURRENTPOINT |- */
+ /* Sets the current point to (x,y) in absolute */
+ /* character space coordinates without per- */
+ /* forming a CharString MOVETO command */
+ if (Top < 1) Error0("DoCommand: Stack low\n");
+ SetCurrentPoint(Stack[0], Stack[1]);
+ ClearStack();
+ break;
+ default: /* Unassigned escape code command */
+ ClearStack();
+ Error1("Escape: Unassigned code %d\n", Code);
+ }
+}
+
+/* |- y dy HSTEM |- */
+/* Declares the vertical range of a horizontal stem zone */
+/* between coordinates y and y + dy */
+/* y is relative to the left sidebearing point */
+static void HStem(y, dy)
+ DOUBLE y, dy;
+{
+ IfTrace2((FontDebug), "Hstem %f %f\n", &y, &dy);
+ if (ProcessHints) {
+ if (numstems >= MAXSTEMS) Error0("HStem: Too many hints\n");
+ if (dy < 0.0) {y += dy; dy = -dy;}
+ stems[numstems].vertical = FALSE;
+ stems[numstems].x = 0.0;
+ stems[numstems].y = sidebearingY + y + wsoffsetY;
+ stems[numstems].dx = 0.0;
+ stems[numstems].dy = dy;
+ ComputeStem(numstems);
+ numstems++;
+ }
+}
+
+/* |- x dx VSTEM |- */
+/* Declares the horizontal range of a vertical stem zone */
+/* between coordinates x and x + dx */
+/* x is relative to the left sidebearing point */
+static void VStem(x, dx)
+ DOUBLE x, dx;
+{
+ IfTrace2((FontDebug), "Vstem %f %f\n", &x, &dx);
+ if (ProcessHints) {
+ if (numstems >= MAXSTEMS) Error0("VStem: Too many hints\n");
+ if (dx < 0.0) {x += dx; dx = -dx;}
+ stems[numstems].vertical = TRUE;
+ stems[numstems].x = sidebearingX + x + wsoffsetX;
+ stems[numstems].y = 0.0;
+ stems[numstems].dx = dx;
+ stems[numstems].dy = 0.0;
+ ComputeStem(numstems);
+ numstems++;
+ }
+}
+
+/* |- dx dy RLINETO |- */
+/* Behaves like RLINETO in PostScript */
+static void RLineTo(dx, dy)
+ DOUBLE dx, dy;
+{
+ struct segment *B;
+
+ IfTrace2((FontDebug), "RLineTo %f %f\n", &dx, &dy);
+
+ B = Loc(CharSpace, dx, dy);
+
+ if (ProcessHints) {
+ currx += dx;
+ curry += dy;
+ /* B = Join(B, FindStems(currx, curry)); */
+ B = Join(B, FindStems(currx, curry, dx, dy));
+ }
+
+ path = Join(path, Line(B));
+}
+
+/* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */
+/* Relative RCURVETO, equivalent to dx1 dy1 */
+/* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */
+/* (dy1+dy2+dy3) RCURVETO in PostScript */
+static void RRCurveTo(dx1, dy1, dx2, dy2, dx3, dy3)
+ DOUBLE dx1, dy1, dx2, dy2, dx3, dy3;
+{
+ struct segment *B, *C, *D;
+
+ IfTrace4((FontDebug), "RRCurveTo %f %f %f %f ", &dx1, &dy1, &dx2, &dy2);
+ IfTrace2((FontDebug), "%f %f\n", &dx3, &dy3);
+
+ B = Loc(CharSpace, dx1, dy1);
+ C = Loc(CharSpace, dx2, dy2);
+ D = Loc(CharSpace, dx3, dy3);
+
+ if (ProcessHints) {
+ /* For a Bezier curve, we apply the full hint value to
+ the Bezier C point (and thereby D point). */
+ currx += dx1 + dx2 + dx3;
+ curry += dy1 + dy2 + dy3;
+ /* C = Join(C, FindStems(currx, curry)); */
+ C = Join(C, FindStems(currx, curry, dx3, dy3));
+ }
+
+ /* Since XIMAGER is not completely relative, */
+ /* we need to add up the delta values */
+
+ C = Join(C, Dup(B));
+ D = Join(D, Dup(C));
+
+ path = Join(path, Bezier(B, C, D));
+}
+
+/* - CLOSEPATH |- */
+/* Closes a subpath WITHOUT repositioning the */
+/* current point */
+static void DoClosePath()
+{
+ struct segment *CurrentPoint;
+
+ IfTrace0((FontDebug), "DoClosePath\n");
+ CurrentPoint = Phantom(path);
+ path = ClosePath(path);
+ path = Join(Snap(path), CurrentPoint);
+}
+
+/* subr# CALLSUBR - */
+/* Calls a CharString subroutine with index */
+/* subr# from the Subrs array */
+static void CallSubr(subrno)
+ int subrno;
+{
+ IfTrace1((FontDebug), "CallSubr %d\n", subrno);
+ if ((subrno < 0) || (subrno >= SubrsP->len))
+ Error0("CallSubr: subrno out of range\n");
+ PushCall(CharStringP, strindex, r);
+ CharStringP = &SubrsP->data.arrayP[subrno];
+ StartDecrypt();
+}
+
+/* - RETURN - */
+/* Returns from a Subrs array CharString */
+/* subroutine called with CALLSUBR */
+static void Return()
+{
+ IfTrace0((FontDebug), "Return\n");
+ PopCall(&CharStringP, &strindex, &r);
+}
+
+/* - ENDCHAR |- */
+/* Finishes a CharString outline */
+/* Executes SETCHACHEDEVICE using a bounding box */
+/* it computes directly from the character outline */
+/* and using the width information acquired from a previous */
+/* HSBW or SBW. It then calls a special version of FILL */
+/* or STROKE depending on the value of PaintType in the */
+/* font dictionary */
+static void EndChar()
+{
+ IfTrace0((FontDebug), "EndChar\n");
+
+ /* There is no need to compute and set bounding box for
+ the cache, since XIMAGER does that on the fly. */
+
+ /* Perform a Closepath just in case the command was left out */
+ path = ClosePath(path);
+
+ /* Set character width */
+ path = Join(Snap(path), Loc(CharSpace, escapementX, escapementY));
+
+}
+
+/* |- dx dy RMOVETO |- */
+/* Behaves like RMOVETO in PostScript */
+static void RMoveTo(dx,dy)
+ DOUBLE dx,dy;
+{
+ struct segment *B;
+
+ IfTrace2((FontDebug), "RMoveTo %f %f\n", &dx, &dy);
+
+ B = Loc(CharSpace, dx, dy);
+
+ if (ProcessHints) {
+ currx += dx;
+ curry += dy;
+ /* B = Join(B, FindStems(currx, curry)); */
+ B = Join(B, FindStems(currx, curry, 0.0, 0.0));
+ }
+
+ path = Join(path, B);
+}
+
+/* - DOTSECTION |- */
+/* Brackets an outline section for the dots in */
+/* letters such as "i", "j", and "!". */
+static void DotSection()
+{
+ IfTrace0((FontDebug), "DotSection\n");
+ InDotSection = !InDotSection;
+}
+
+/* |- asb adx ady bchar achar SEAC |- */
+/* Standard Encoding Accented Character. */
+static void Seac(DOUBLE asb, DOUBLE adx, DOUBLE ady,
+ unsigned char bchar, unsigned char achar)
+{
+ int Code;
+ struct segment *mypath;
+
+ IfTrace4((FontDebug), "SEAC %f %f %f %d ", &asb, &adx, &ady, bchar);
+ IfTrace1((FontDebug), "%d\n", achar);
+
+ /* Move adx - asb, ady over and up from base char's sbpoint. */
+ /* (We use adx - asb to counteract the accents sb shift.) */
+ /* The variables accentoffsetX/Y modify sidebearingX/Y in Sbw(). */
+ /* Note that these incorporate the base character's sidebearing shift by */
+ /* using the current sidebearingX, Y values. */
+ accentoffsetX = sidebearingX + adx - asb;
+ accentoffsetY = sidebearingY + ady;
+
+ /* Set path = NULL to avoid complaints from Sbw(). */
+ path = NULL;
+
+ /* Go find the CharString for the accent's code via an upcall */
+ CharStringP = GetType1CharString(Environment, achar);
+ if (CharStringP == NULL) {
+ Error1("Invalid accent ('%03o) in SEAC\n", achar);
+ return;
+ }
+ StartDecrypt();
+
+ ClearStack();
+ ClearPSFakeStack();
+ ClearCallStack();
+
+ for (;;) {
+ if (!DoRead(&Code)) break;
+ Decode(Code);
+ if (errflag) return;
+ }
+ /* Copy snapped path to mypath and set path to NULL as above. */
+ mypath = Snap(path);
+ path = NULL;
+
+ /* We must reset these to null now. */
+ accentoffsetX = accentoffsetY = 0;
+
+ /* go find the CharString for the base char's code via an upcall */
+ CharStringP = GetType1CharString(Environment, bchar);
+ StartDecrypt();
+
+ ClearStack();
+ ClearPSFakeStack();
+ ClearCallStack();
+
+ FinitStems();
+ InitStems();
+
+ for (;;) {
+ if (!DoRead(&Code)) break;
+ Decode(Code);
+ if (errflag) return;
+ }
+ path = Join(mypath, path);
+}
+
+
+/* |- sbx sby wx wy SBW |- */
+/* Set the left sidebearing point to (sbx,sby), */
+/* set the character width vector to (wx,wy). */
+static void Sbw(sbx, sby, wx, wy)
+ DOUBLE sbx, sby, wx, wy;
+{
+ IfTrace4((FontDebug), "SBW %f %f %f %f\n", &sbx, &sby, &wx, &wy);
+
+ escapementX = wx; /* Character width vector */
+ escapementY = wy;
+
+ /* Sidebearing values are sbx, sby args, plus accent offset from Seac(). */
+ sidebearingX = sbx + accentoffsetX;
+ sidebearingY = sby + accentoffsetY;
+
+ path = Join(path, Loc(CharSpace, sidebearingX, sidebearingY));
+ if (ProcessHints) {currx = sidebearingX; curry = sidebearingY;}
+}
+
+ /* num1 num2 DIV quotient */
+/* Behaves like DIV in the PostScript language */
+static DOUBLE Div(num1, num2)
+ DOUBLE num1, num2;
+{
+ IfTrace2((FontDebug), "Div %f %f\n", &num1, &num2);
+ return(num1 / num2);
+}
+
+/*
+ The following four subroutines (FlxProc, FlxProc1, FlxProc2, and
+ HintReplace) are C versions of the OtherSubrs Programs, which were
+ were published in the Adobe Type 1 Font Format book.
+
+ The Flex outline fragment is described by
+ c1: (x0, y0) = c3: (x0, yshrink(y0)) or (xshrink(x0), y0)
+ " (x1, y1) = " (x1, yshrink(y1)) or (xshrink(x1), y1)
+ " (x2, y2) - reference point
+ c2: (x0, y0) = c4: (x0, yshrink(y0)) or (xshrink(x0), y0)
+ " (x1, y1) = " (x1, yshrink(y1)) or (xshrink(x1), y1)
+ " (x2, y2) = " (x2, y2), rightmost endpoint
+ c3: (x0, y0) - control point, 1st Bezier curve
+ " (x1, y1) - control point, -"-
+ " (x2, y2) - end point, -"-
+ c4: (x0, y0) - control point, 2nd Bezier curve
+ " (x1, y1) - control point, -"-
+ " (x2, y2) - end point, -"-
+ ep: (epY, epX) - final endpoint (should be same as c4: (x2, y2))
+ idmin - minimum Flex height (1/100 pixel) at which to render curves
+*/
+
+#define dtransform(dxusr,dyusr,dxdev,dydev) { \
+ register struct segment *point = Loc(CharSpace, dxusr, dyusr); \
+ QueryLoc(point, IDENTITY, dxdev, dydev); \
+ Destroy(point); \
+}
+
+#define itransform(xdev,ydev,xusr,yusr) { \
+ register struct segment *point = Loc(IDENTITY, xdev, ydev); \
+ QueryLoc(point, CharSpace, xusr, yusr); \
+ Destroy(point); \
+}
+
+#define transform(xusr,yusr,xdev,ydev) dtransform(xusr,yusr,xdev,ydev)
+
+#define PaintType (0)
+
+#define lineto(x,y) { \
+ struct segment *CurrentPoint; \
+ DOUBLE CurrentX, CurrentY; \
+ CurrentPoint = Phantom(path); \
+ QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \
+ Destroy(CurrentPoint); \
+ RLineTo(x - CurrentX, y - CurrentY); \
+}
+
+#define curveto(x0,y0,x1,y1,x2,y2) { \
+ struct segment *CurrentPoint; \
+ DOUBLE CurrentX, CurrentY; \
+ CurrentPoint = Phantom(path); \
+ QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \
+ Destroy(CurrentPoint); \
+ RRCurveTo(x0 - CurrentX, y0 - CurrentY, x1 - x0, y1 - y0, x2 - x1, y2 - y1); \
+}
+
+#define xshrink(x) ((x - c4x2) * shrink +c4x2)
+#define yshrink(y) ((y - c4y2) * shrink +c4y2)
+
+#define PickCoords(flag) \
+ if (flag) { /* Pick "shrunk" coordinates */ \
+ x0 = c1x0; y0 = c1y0; \
+ x1 = c1x1; y1 = c1y1; \
+ x2 = c1x2; y2 = c1y2; \
+ x3 = c2x0; y3 = c2y0; \
+ x4 = c2x1; y4 = c2y1; \
+ x5 = c2x2; y5 = c2y2; \
+ } else { /* Pick original coordinates */ \
+ x0 = c3x0; y0 = c3y0; \
+ x1 = c3x1; y1 = c3y1; \
+ x2 = c3x2; y2 = c3y2; \
+ x3 = c4x0; y3 = c4y0; \
+ x4 = c4x1; y4 = c4y1; \
+ x5 = c4x2; y5 = c4y2; \
+ }
+
+/* FlxProc() = OtherSubrs[0]; Main part of Flex */
+/* Calling sequence: 'idmin epX epY 3 0 callothersubr' */
+/* Computes Flex values, and renders the Flex path, */
+/* and returns (leaves) ending coordinates on stack */
+static void FlxProc(c1x2, c1y2, c3x0, c3y0, c3x1, c3y1, c3x2, c3y2,
+ c4x0, c4y0, c4x1, c4y1, c4x2, c4y2, epY, epX, idmin)
+ DOUBLE c1x2, c1y2;
+ DOUBLE c3x0, c3y0, c3x1, c3y1, c3x2, c3y2;
+ DOUBLE c4x0, c4y0, c4x1, c4y1, c4x2, c4y2;
+ DOUBLE epX, epY;
+ int idmin;
+{
+ DOUBLE dmin;
+ DOUBLE c1x0, c1y0, c1x1, c1y1;
+ DOUBLE c2x0, c2y0, c2x1, c2y1, c2x2, c2y2;
+ char yflag;
+ DOUBLE x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5;
+ DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */
+ int flipXY;
+ DOUBLE x, y;
+ DOUBLE erosion = 1; /* Device parameter */
+ /* Erosion may have different value specified in 'internaldict' */
+ DOUBLE shrink;
+ DOUBLE dX, dY;
+ char erode;
+ DOUBLE eShift;
+ DOUBLE cx, cy;
+ DOUBLE ex, ey;
+
+ Destroy(path);
+ path = FlxOldPath; /* Restore previous path (stored in FlxProc1) */
+
+ if (ProcessHints) {
+ dmin = ABS(idmin) / 100.0; /* Minimum Flex height in pixels */
+
+ c2x2 = c4x2; c2y2 = c4y2; /* Point c2 = c4 */
+
+ yflag = FABS(c1y2 - c3y2) > FABS(c1x2 - c3x2); /* Flex horizontal? */
+
+ QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */
+
+ if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001)
+ flipXY = -1; /* Char on side */
+ else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001)
+ flipXY = 1; /* Char upright */
+ else
+ flipXY = 0; /* Char at angle */
+
+ if (yflag) { /* Flex horizontal */
+ if (flipXY == 0 || c3y2 == c4y2) { /* Char at angle or Flex height = 0 */
+ PickCoords(FALSE); /* Pick original control points */
+ } else {
+ shrink = FABS((c1y2 - c4y2) / (c3y2 - c4y2)); /* Slope */
+
+ c1x0 = c3x0; c1y0 = yshrink(c3y0);
+ c1x1 = c3x1; c1y1 = yshrink(c3y1);
+ c2x0 = c4x0; c2y0 = yshrink(c4y0);
+ c2x1 = c4x1; c2y1 = yshrink(c4y1);
+
+ dtransform(0.0, ROUND(c3y2-c1y2), &x, &y); /* Flex height in pixels */
+ dY = FABS((flipXY == 1) ? y : x);
+ PickCoords(dY < dmin); /* If Flex small, pick 'shrunk' control points */
+
+ if (FABS(y2 - c1y2) > 0.001) { /* Flex 'non-zero'? */
+ transform(c1x2, c1y2, &x, &y);
+
+ if (flipXY == 1) {
+ cx = x; cy = y;
+ } else {
+ cx = y; cy = x;
+ }
+
+ dtransform(0.0, ROUND(y2-c1y2), &x, &y);
+ dY = (flipXY == 1) ? y : x;
+ if (ROUND(dY) != 0)
+ dY = ROUND(dY);
+ else
+ dY = (dY < 0) ? -1 : 1;
+
+ erode = PaintType != 2 && erosion >= 0.5;
+ if (erode)
+ cy -= 0.5;
+ ey = cy + dY;
+ ey = CEIL(ey) - ey + FLOOR(ey);
+ if (erode)
+ ey += 0.5;
+
+ if (flipXY == 1) {
+ itransform(cx, ey, &x, &y);
+ } else {
+ itransform(ey, cx, &x, &y);
+ }
+
+ eShift = y - y2;
+ y1 += eShift;
+ y2 += eShift;
+ y3 += eShift;
+ }
+ }
+ } else { /* Flex vertical */
+ if (flipXY == 0 || c3x2 == c4x2) { /* Char at angle or Flex height = 0 */
+ PickCoords(FALSE); /* Pick original control points */
+ } else {
+ shrink = FABS((c1x2 - c4x2) / (c3x2 - c4x2)); /* Slope */
+
+ c1x0 = xshrink(c3x0); c1y0 = c3y0;
+ c1x1 = xshrink(c3x1); c1y1 = c3y1;
+ c2x0 = xshrink(c4x0); c2y0 = c4y0;
+ c2x1 = xshrink(c4x1); c2y1 = c4y1;
+
+ dtransform(ROUND(c3x2 - c1x2), 0.0, &x, &y); /* Flex height in pixels */
+ dX = FABS((flipXY == -1) ? y : x);
+ PickCoords(dX < dmin); /* If Flex small, pick 'shrunk' control points */
+
+ if (FABS(x2 - c1x2) > 0.001) {
+ transform(c1x2, c1y2, &x, &y);
+ if (flipXY == -1) {
+ cx = y; cy = x;
+ } else {
+ cx = x; cy = y;
+ }
+
+ dtransform(ROUND(x2-c1x2), 0.0, &x, &y);
+ dX = (flipXY == -1) ? y : x;
+ if (ROUND(dX) != 0)
+ dX = ROUND(dX);
+ else
+ dX = (dX < 0) ? -1 : 1;
+
+ erode = PaintType != 2 && erosion >= 0.5;
+ if (erode)
+ cx -= 0.5;
+ ex = cx + dX;
+ ex = CEIL(ex) - ex + FLOOR(ex);
+ if (erode)
+ ex += 0.5;
+
+ if (flipXY == -1) {
+ itransform(cy, ex, &x, &y);
+ } else {
+ itransform(ex, cy, &x, &y);
+ }
+
+ eShift = x - x2;
+ x1 += eShift;
+ x2 += eShift;
+ x3 += eShift;
+ }
+ }
+ }
+
+ if (x2 == x5 || y2 == y5) {
+ lineto(x5, y5);
+ } else {
+ curveto(x0, y0, x1, y1, x2, y2);
+ curveto(x3, y3, x4, y4, x5, y5);
+ }
+ } else { /* ProcessHints is off */
+ PickCoords(FALSE); /* Pick original control points */
+ curveto(x0, y0, x1, y1, x2, y2);
+ curveto(x3, y3, x4, y4, x5, y5);
+ }
+
+ PSFakePush(epY);
+ PSFakePush(epX);
+}
+
+/* FlxProc1() = OtherSubrs[1]; Part of Flex */
+/* Calling sequence: '0 1 callothersubr' */
+/* Saves and clears path, then restores currentpoint */
+static void FlxProc1()
+{
+ struct segment *CurrentPoint;
+
+ CurrentPoint = Phantom(path);
+
+ FlxOldPath = path;
+ path = CurrentPoint;
+}
+
+/* FlxProc2() = OtherSubrs[2]; Part of Flex */
+/* Calling sequence: '0 2 callothersubr' */
+/* Returns currentpoint on stack */
+static void FlxProc2()
+{
+ struct segment *CurrentPoint;
+ DOUBLE CurrentX, CurrentY;
+
+ CurrentPoint = Phantom(path);
+ QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY);
+ Destroy(CurrentPoint);
+
+ /* Push CurrentPoint on fake PostScript stack */
+ PSFakePush(CurrentX);
+ PSFakePush(CurrentY);
+}
+
+/* HintReplace() = OtherSubrs[3]; Hint Replacement */
+/* Calling sequence: 'subr# 1 3 callothersubr pop callsubr' */
+/* Reinitializes stem hint structure */
+static void HintReplace()
+{
+ /* Effectively retire the current stems, but keep them around for */
+ /* revhint use in case we are in a stem when we replace hints. */
+ currstartstem = numstems;
+
+ /* 'subr#' is left on PostScript stack (for 'pop callsubr') */
+}
+
+/* arg1 ... argn n othersubr# CALLOTHERSUBR - */
+/* Make calls on the PostScript interpreter (or call equivalent C code) */
+/* NOTE: The n arguments have been pushed on the fake PostScript stack */
+static void CallOtherSubr(othersubrno)
+ int othersubrno;
+{
+ IfTrace1((FontDebug), "CallOtherSubr %d\n", othersubrno);
+
+ switch(othersubrno) {
+ case 0: /* OtherSubrs[0]; Main part of Flex */
+ if (PSFakeTop < 16) Error0("CallOtherSubr: PSFakeStack low");
+ ClearPSFakeStack();
+ FlxProc(
+ PSFakeStack[0], PSFakeStack[1], PSFakeStack[2], PSFakeStack[3],
+ PSFakeStack[4], PSFakeStack[5], PSFakeStack[6], PSFakeStack[7],
+ PSFakeStack[8], PSFakeStack[9], PSFakeStack[10], PSFakeStack[11],
+ PSFakeStack[12], PSFakeStack[13], PSFakeStack[14], PSFakeStack[15],
+ (int) PSFakeStack[16]
+ );
+ break;
+ case 1: /* OtherSubrs[1]; Part of Flex */
+ FlxProc1();
+ break;
+ case 2: /* OtherSubrs[2]; Part of Flex */
+ FlxProc2();
+ break;
+ case 3: /* OtherSubrs[3]; Hint Replacement */
+ HintReplace();
+ break;
+ default: { /* call OtherSubrs[4] or higher if PostScript is present */
+ }
+ }
+}
+
+/* |- x y SETCURRENTPOINT |- */
+/* Sets the current point to (x,y) in absolute */
+/* character space coordinates without per- */
+/* forming a CharString MOVETO command */
+static void SetCurrentPoint(x, y)
+ DOUBLE x, y;
+{
+ IfTrace2((FontDebug), "SetCurrentPoint %f %f\n", &x, &y);
+
+ currx = x;
+ curry = y;
+}
+
+/* The Type1Char routine for use by PostScript. */
+/************************************************/
+struct xobject *Type1Char(env, S, charstrP, subrsP, osubrsP, bluesP, modeP)
+ char *env;
+ struct XYspace *S;
+ psobj *charstrP;
+ psobj *subrsP;
+ psobj *osubrsP;
+ struct blues_struct *bluesP; /* FontID's ptr to the blues struct */
+ int *modeP;
+{
+ int Code;
+
+ path = NULL;
+ errflag = FALSE;
+
+ /* Make parameters available to all Type1 routines */
+ Environment = env;
+ CharSpace = S; /* used when creating path elements */
+ CharStringP = charstrP;
+ SubrsP = subrsP;
+ OtherSubrsP = osubrsP;
+ ModeP = modeP;
+
+ blues = bluesP;
+
+ /* compute the alignment zones */
+ ComputeAlignmentZones();
+
+ StartDecrypt();
+
+ ClearStack();
+ ClearPSFakeStack();
+ ClearCallStack();
+
+ InitStems();
+
+ currx = curry = 0;
+ escapementX = escapementY = 0;
+ sidebearingX = sidebearingY = 0;
+ accentoffsetX = accentoffsetY = 0;
+ wsoffsetX = wsoffsetY = 0; /* No shift to preserve whitspace. */
+ wsset = 0; /* wsoffsetX,Y haven't been set yet. */
+
+ for (;;) {
+ if (!DoRead(&Code)) break;
+ Decode(Code);
+ if (errflag) break;
+ }
+
+ FinitStems();
+
+
+ /* Clean up if an error has occurred */
+ if (errflag) {
+ if (path != NULL) {
+ Destroy(path); /* Reclaim storage */
+ path = NULL; /* Indicate that character could not be built */
+ }
+ }
+
+ return((struct xobject *) path);
+}
+
diff --git a/Build/source/texk/ps2pkm/types.h b/Build/source/texk/ps2pkm/types.h
new file mode 100644
index 00000000000..e935bc3c874
--- /dev/null
+++ b/Build/source/texk/ps2pkm/types.h
@@ -0,0 +1,40 @@
+/*
+ * File: types.h
+ * Purpose: define basic types so that program is portable to non 32 bits
+ * platforms
+ * Version: 1.0 (Dec. 1993)
+ * Author: Piet Tutelaers
+ */
+
+#ifndef __PS2PK_TYPES__
+#define __PS2PK_TYPES__
+
+#ifdef KPATHSEA
+#include <kpathsea/kpathsea.h>
+#include <c-auto.h>
+#endif /* KPATHSEA */
+
+#if defined(WORD16)
+typedef unsigned short USHORT; /* 16 bits */
+typedef short SHORT; /* 16 bits */
+typedef long LONG; /* 32 bits */
+typedef unsigned long ULONG; /* 32 bits */
+typedef double DOUBLE; /* 64 bits */
+#elif defined(WORD64)
+typedef unsigned short USHORT; /* 16 bits */
+typedef short SHORT; /* 16 bits */
+typedef int LONG; /* 32 bits */
+typedef unsigned long ULONG; /* 32 bits */
+typedef double DOUBLE; /* 64 bits */
+#else /* default: WORD32 */
+typedef unsigned short USHORT; /* 16 bits */
+typedef short SHORT; /* 16 bits */
+# ifndef WIN32
+/* These are already defined under WIN32 */
+typedef int LONG; /* 32 bits */
+typedef unsigned int ULONG; /* 32 bits */
+# endif
+typedef double DOUBLE; /* 64 bits */
+#endif
+
+#endif /* __PS2PK_TYPES__ */
diff --git a/Build/source/texk/ps2pkm/usenet b/Build/source/texk/ps2pkm/usenet
new file mode 100644
index 00000000000..14dd5523f77
--- /dev/null
+++ b/Build/source/texk/ps2pkm/usenet
@@ -0,0 +1,64 @@
+Path: tuegate.tue.nl!rw6.urc.tue.nl!rcpt
+From: rcpt@rw6.urc.tue.nl (Piet Tutelaers)
+Newsgroups: comp.text.tex
+Subject: Re: ps2mf
+Message-ID: <rcpt.714861633@rw6.urc.tue.nl>
+Date: 26 Aug 92 20:40:33 GMT
+References: <memo.585707@cix.compulink.co.uk> <ILH.92Aug20112742@winnie-the-pooh.lcs.mit.edu> <1992Aug22.112526.13957@cnix.uucp> <4847@news.duke.edu>
+Sender: root@tuegate.tue.nl
+Reply-To: rcpt@urc.tue.nl
+Lines: 52
+
+jbrehm@acpub.duke.edu (John Brehm) writes:
+
+>I need to convert some postscript fonts for use with the emTeX dvihplj
+>drivers, but at sizes that differ from the standard 10pt. I can
+>easily generate fonts of arbitrary sizes with ps2pk (great tool!),
+>but how do I produce the right .tfm files? That is, if I include
+>the line:
+> \font\opt12=optima at 12pt
+>I get the error message (from LaTeX):
+> ! Font \opt=optima not loadable: Bad metric (TFM) file.
+
+>Any thoughts?
+
+I see that my ps2pk.README does not explain this clearly. So here is a try
+to correct that.
+
+1) Get the latest afm2tfm coming with dvips. You need at least version 7.0
+of afm2tfm othewise the checksums of TFM files generated by afm2tfm and PK
+files generated by ps2pk will be different. Try ftp.urc.tue.nl:pub/tex or
+labrea.stanford.edu for the latest sources. MSDOS binaries are (or will
+become) available in :pub/tex/emtex/dvips.zip.
+
+2) You should have VPtoVF a fonttool coming with emTeX: converts a Virtual
+Property Font format (.vpl: ASCII) to Virtual Font format (.vf: binary).
+
+3) It is possible to name your TeX font `optima' but real TeX-ers
+prefer `popr', a name that can be used on MSDOS (and that can be found
+from grep-ing in the file adobe coming with dvips). You will need:
+ 1) emtex\tfm\popr.tfm
+ 2) emtex\vf\popr.vf
+ 3) emtex\tfm\rpopr.tfm
+ 4) emtex\pixel.lj\360dpi\rpopr.pk (360=12/10*300)
+
+4) To generate them:
+ afm2tfm Optima.afm -v popr.vpl rpopr.tfm
+ vptovf popr.vpl popr.vf popr.tfm
+ (delete popr.vpl if you like)
+ ps2pk -X360 -v Optima.pfb rpopr.360pk
+
+5) To use them install all TFM, VF and PK fonts on their proper place.
+Check that they will be located there and use now within plain TeX
+(especially check that emtex\lj.cnf contains a line telling dvihplj where
+to find its VF fonts. I have no MSDOS machine nearby, so I can't tell what
+exact line you need):
+ \font\opt12=popr at 12pt
+
+The bunch of files are necessary to map PostScript fonts to TeX (virtual
+magic).
+
+Hope this brings some light,
+
+--Piet
+
diff --git a/Build/source/texk/ps2pkm/util.c b/Build/source/texk/ps2pkm/util.c
new file mode 100644
index 00000000000..21fb13b43a9
--- /dev/null
+++ b/Build/source/texk/ps2pkm/util.c
@@ -0,0 +1,211 @@
+/* $XConsortium: util.c,v 1.6 92/03/26 16:42:26 eswu Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
+
+#include "types.h"
+#include <stdio.h>
+#include "util.h"
+#include "fontmisc.h"
+
+extern char *Xalloc();
+
+static char *vm_base = NULL; /* Start of virtual memory area */
+ char *vm_next = NULL; /* Pointer to first free byte */
+ LONG vm_free = 0; /* Count of free bytes */
+ LONG vm_size = 0; /* Total size of memory */
+
+/*
+ * Initialize memory.
+ */
+
+extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */
+
+boolean vm_init()
+{
+ vm_next = vm_base = (char *) Xalloc(MAX_STRING_LEN);
+
+ if (vm_base != NULL) {
+ vm_free = MAX_STRING_LEN;
+ vm_size = MAX_STRING_LEN;
+ tokenMaxP = vm_next_byte() + MAX_STRING_LEN;
+ return(TRUE);
+ }
+ else
+ return(FALSE);
+}
+
+char *vm_alloc(bytes)
+ unsigned int bytes;
+{
+ char *answer;
+
+ /* Round to next LONG multiple (32-bit) */
+#if defined(sun) || defined(__hpux) || defined(__alpha)
+ bytes = (bytes + 7) & ~7;
+#else
+ bytes = (bytes + 3) & ~3;
+#endif
+
+ /* take space from what is left otherwise allocate another CHUNK */
+ if (bytes > vm_free)
+ if (!vm_init()) return NULL;
+ if (bytes <= vm_free) {
+ answer = vm_next;
+ vm_free -= bytes;
+ vm_next += bytes;
+ return answer;
+ }
+ else {
+ printf("Trying to allocate %d bytes (%d maximum)\n", bytes, MAX_STRING_LEN);
+ return NULL;
+ }
+}
+
+/*
+ * Format an Integer object
+ */
+void objFormatInteger(objP,value)
+ psobj *objP;
+ int value;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_INTEGER;
+ objP->len = 0;
+ objP->data.integer = value;
+ }
+}
+
+/*
+ * Format a Real object
+ */
+#if 0
+void objFormatReal(objP,value)
+ psobj *objP;
+ float value;
+#else
+void objFormatReal(psobj *objP, float value)
+#endif
+{
+ if (objP != NULL) {
+ objP->type = OBJ_REAL;
+ objP->len = 0;
+ objP->data.real = value;
+ }
+}
+
+/*
+ * Format a Boolean object
+ */
+void objFormatBoolean(objP,value)
+ psobj *objP;
+ boolean value;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_BOOLEAN;
+ objP->len = 0;
+ objP->data.boolean = value;
+ }
+}
+
+/*
+ * Format an Encoding object
+ */
+void objFormatEncoding(objP,length,valueP)
+ psobj *objP;
+ int length;
+ psobj *valueP;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_ENCODING;
+ objP->len = length;
+ objP->data.arrayP = valueP;
+ }
+}
+
+/*
+ * Format an Array object
+ */
+void objFormatArray(objP,length,valueP)
+ psobj *objP;
+ int length;
+ psobj *valueP;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_ARRAY;
+ objP->len = length;
+ objP->data.arrayP = valueP;
+ }
+}
+
+
+/*
+ * Format a String object
+ */
+void objFormatString(objP,length,valueP)
+ psobj *objP;
+ int length;
+ char *valueP;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_STRING;
+ objP->len = length;
+ objP->data.valueP = valueP;
+ }
+}
+
+/*
+ * Format a Name object
+ */
+void objFormatName(objP,length,valueP)
+ psobj *objP;
+ int length;
+ char *valueP;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_NAME;
+ objP->len = length;
+ objP->data.nameP = valueP;
+ }
+}
+
+/*
+ * Format a File object
+ */
+void objFormatFile(objP,valueP)
+ psobj *objP;
+ FILE *valueP;
+{
+ if (objP != NULL) {
+ objP->type = OBJ_FILE;
+ objP->len = 0;
+ objP->data.fileP = valueP;
+ }
+}
+
diff --git a/Build/source/texk/ps2pkm/util.h b/Build/source/texk/ps2pkm/util.h
new file mode 100644
index 00000000000..fc523e7b473
--- /dev/null
+++ b/Build/source/texk/ps2pkm/util.h
@@ -0,0 +1,184 @@
+/* $XConsortium: util.h,v 1.3 92/03/26 16:42:29 eswu Exp $ */
+/* Copyright International Business Machines,Corp. 1991
+ * All Rights Reserved
+ *
+ * License to use, copy, modify, and distribute this software
+ * and its documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice
+ * appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation,
+ * and that the name of IBM not be used in advertising or
+ * publicity pertaining to distribution of the software without
+ * specific, written prior permission.
+ *
+ * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
+ * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+ * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
+ * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
+ * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
+ * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
+ * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+#ifndef UTIL_H
+#define UTIL_H
+#include "types.h"
+
+#ifndef KPATHSEA
+#ifndef boolean
+typedef int boolean;
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+/***================================================================***/
+/* Portable definitions for 2's complement machines.
+ * NOTE: These really should be based on PostScript types,
+ * for example, sizeof(ps_integer), or sizeof(ps_unsigned)
+ */
+#define MAX_ULONG (~(ULONG)(0))
+/* This code is portable, assuming K&R C and 2's complement arithmetic */
+#define MAX_INTEGER \
+ ((LONG)((((ULONG) 1)<<(sizeof(ULONG)*8-1))-1))
+#define MIN_INTEGER ((-MAX_INTEGER)-1)
+
+#define MAX_ARRAY_CNT (65535)
+#define MAX_DICT_CNT (65535)
+#define MAX_STRING_LEN (65535)
+#define MAX_NAME_LEN (128)
+
+/* this is the size of memory allocated for reading fonts */
+
+#define VM_SIZE (50*1024)
+/***================================================================***/
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b)) ? a : b )
+#endif
+
+/***================================================================***/
+/* Routines for managing virtual memory */
+/***================================================================***/
+extern boolean vm_init();
+extern LONG vm_free;
+extern LONG vm_size;
+extern char *vm_next;
+extern char *vm_alloc();
+/***================================================================***/
+/* Macros for managing virtual memory */
+/***================================================================***/
+#define vm_next_byte() (vm_next)
+#define vm_free_bytes() (vm_free)
+#define vm_avail(B) (B <= vm_free)
+
+
+
+/***================================================================***/
+/* Types of PostScript objects */
+/***================================================================***/
+#define OBJ_INTEGER (0)
+#define OBJ_REAL (1)
+#define OBJ_BOOLEAN (2)
+#define OBJ_ARRAY (3)
+#define OBJ_STRING (4)
+#define OBJ_NAME (5)
+#define OBJ_FILE (6)
+#define OBJ_ENCODING (7)
+
+/***================================================================***/
+/* Value of PostScript objects */
+/***================================================================***/
+typedef union ps_value {
+ char *valueP; /* value pointer for unspecified type */
+ int value; /* value for unspecified type */
+ int integer; /* when type is OBJ_INTEGER */
+ float real; /* when type is OBJ_REAL */
+ int boolean; /* when type is OBJ_BOOLEAN */
+ struct ps_obj *arrayP; /* when type is OBJ_ARRAY */
+ unsigned char *stringP; /* when type is OBJ_STRING */
+ char *nameP; /* when type is OBJ_NAME */
+ FILE *fileP; /* when type is OBJ_FILE */
+} psvalue;
+
+/***================================================================***/
+/* Definition of a PostScript object */
+/***================================================================***/
+typedef struct ps_obj {
+ char type;
+ char unused;
+ unsigned short len;
+ union ps_value data;
+} psobj;
+
+/***================================================================***/
+/* Definition of a PostScript Dictionary Entry */
+/***================================================================***/
+typedef struct ps_dict {
+ psobj key;
+ psobj value;
+} psdict;
+
+/***================================================================***/
+/* Macros for testing type of PostScript objects */
+/***================================================================***/
+#define objIsInteger(o) ((o).type == OBJ_INTEGER)
+#define objIsReal(o) ((o).type == OBJ_REAL)
+#define objIsBoolean(o) ((o).type == OBJ_BOOLEAN)
+#define objIsArray(o) ((o).type == OBJ_ARRAY)
+#define objIsString(o) ((o).type == OBJ_STRING)
+#define objIsName(o) ((o).type == OBJ_NAME)
+#define objIsFile(o) ((o).type == OBJ_FILE)
+
+/***================================================================***/
+/* Macros for setting type of PostScript objects */
+/***================================================================***/
+#define objSetInteger(o) ((o).type = OBJ_INTEGER)
+#define objSetReal(o) ((o).type = OBJ_REAL)
+#define objSetBoolean(o) ((o).type = OBJ_BOOLEAN)
+#define objSetArray(o) ((o).type = OBJ_ARRAY)
+#define objSetString(o) ((o).type = OBJ_STRING)
+#define objSetName(o) ((o).type = OBJ_NAME)
+#define objSetFile(o) ((o).type = OBJ_FILE)
+
+/***================================================================***/
+/* Macros for testing type of PostScript objects (pointer access) */
+/***================================================================***/
+#define objPIsInteger(o) ((o)->type == OBJ_INTEGER)
+#define objPIsReal(o) ((o)->type == OBJ_REAL)
+#define objPIsBoolean(o) ((o)->type == OBJ_BOOLEAN)
+#define objPIsArray(o) ((o)->type == OBJ_ARRAY)
+#define objPIsString(o) ((o)->type == OBJ_STRING)
+#define objPIsName(o) ((o)->type == OBJ_NAME)
+#define objPIsFile(o) ((o)->type == OBJ_FILE)
+
+/***================================================================***/
+/* Macros for setting type of PostScript objects (pointer access) */
+/***================================================================***/
+#define objPSetInteger(o) ((o)->type = OBJ_INTEGER)
+#define objPSetReal(o) ((o)->type = OBJ_REAL)
+#define objPSetBoolean(o) ((o)->type = OBJ_BOOLEAN)
+#define objPSetArray(o) ((o)->type = OBJ_ARRAY)
+#define objPSetString(o) ((o)->type = OBJ_STRING)
+#define objPSetName(o) ((o)->type = OBJ_NAME)
+#define objPSetFile(o) ((o)->type = OBJ_FILE)
+
+/***================================================================***/
+/* Entry point for Type1Char to get entry from CharStrings */
+/***================================================================***/
+extern psobj *GetType1CharString();
+
+#endif
diff --git a/Build/source/texk/ps2pkm/win32.mak b/Build/source/texk/ps2pkm/win32.mak
new file mode 100644
index 00000000000..f921b912808
--- /dev/null
+++ b/Build/source/texk/ps2pkm/win32.mak
@@ -0,0 +1,68 @@
+################################################################################
+#
+# Makefile : Ps2pkm
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <01/11/19 12:04:44 popineau>
+#
+################################################################################
+root_srcdir = ..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+version = 1.5m
+
+USE_GNUW32 = 1
+USE_KPATHSEA = 1
+
+!include <msvc/common.mak>
+
+DEFS = $(DEFS) -DHAVE_CONFIG_H
+
+libobj = $(objdir)\arith.obj $(objdir)\basics.obj $(objdir)\curves.obj \
+ $(objdir)\fontfcn.obj $(objdir)\hints.obj $(objdir)\lines.obj \
+ $(objdir)\objects.obj $(objdir)\paths.obj $(objdir)\regions.obj \
+ $(objdir)\scanfont.obj $(objdir)\spaces.obj $(objdir)\t1funcs.obj \
+ $(objdir)\t1info.obj $(objdir)\t1io.obj $(objdir)\t1snap.obj \
+ $(objdir)\t1stub.obj $(objdir)\token.obj $(objdir)\type1.obj \
+ $(objdir)\util.obj # $(objdir)\bstring.obj
+
+common_objects = $(objdir)\pkout.obj $(objdir)\filenames.obj
+ps2pkobjs = $(libobj) $(objdir)\ps2pk.obj $(objdir)\encoding.obj $(objdir)\pkout.obj $(objdir)\filenames.obj
+pk2bmobjs = $(objdir)\pk2bm.obj $(objdir)\pkin.obj $(objdir)\basics.obj
+pfb2pfaobjs = $(objdir)\pfb2pfa.obj $(objdir)\filenames.obj $(objdir)\basics.obj
+magobjs = $(objdir)\mag.obj $(objdir)\basics.obj
+
+manfiles = mag.1 pfb2pfa.1 pk2bm.1 ps2pk.1
+
+program = $(objdir)\ps2pk.exe
+programs = $(objdir)\pfb2pfa.exe $(objdir)\mag.exe $(objdir)\pk2bm.exe $(program)
+
+default all: $(objdir) $(programs)
+
+$(program): $(ps2pkobjs) $(kpathsealib)
+ $(link) $(**) $(conlibs)
+$(objdir)\pk2bm.exe: $(pk2bmobjs) $(kpathsealib)
+ $(link) $(**) $(conlibs)
+$(objdir)\pfb2pfa.exe: $(pfb2pfaobjs) $(kpathsealib)
+ $(link) $(**) $(conlibs)
+$(objdir)\mag.exe: $(magobjs) $(kpathsealib)
+ $(link) $(**) $(conlibs)
+
+!include <msvc/config.mak>
+
+!include <msvc/install.mak>
+
+install:: install-exec install-man
+
+!include <msvc/clean.mak>
+
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+# Local Variables:
+# mode: Makefile
+# End: