summaryrefslogtreecommitdiff
path: root/systems/unix/tex-fpc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /systems/unix/tex-fpc
Initial commit
Diffstat (limited to 'systems/unix/tex-fpc')
-rw-r--r--systems/unix/tex-fpc/MFT/iby/README98
-rw-r--r--systems/unix/tex-fpc/MFT/iby/agr.tex2
-rw-r--r--systems/unix/tex-fpc/MFT/iby/getiby17
-rwxr-xr-xsystems/unix/tex-fpc/MFT/iby/getlevy8
-rwxr-xr-xsystems/unix/tex-fpc/MFT/iby/ibyfonts13
-rwxr-xr-xsystems/unix/tex-fpc/MFT/iby/ibymacros6
-rw-r--r--systems/unix/tex-fpc/MFT/iby/sappho.tex27
-rw-r--r--systems/unix/tex-fpc/MFT/iby/test.tex91
-rw-r--r--systems/unix/tex-fpc/MFT/local.mf33
-rwxr-xr-xsystems/unix/tex-fpc/MFT/manfonts7
-rwxr-xr-xsystems/unix/tex-fpc/MFT/mfwebfonts4
-rwxr-xr-xsystems/unix/tex-fpc/MFT/plainfonts52
-rwxr-xr-xsystems/unix/tex-fpc/MFT/texwebfonts2
-rwxr-xr-xsystems/unix/tex-fpc/MFT/tripmanfonts2
-rw-r--r--systems/unix/tex-fpc/MFT/webfonts2
-rw-r--r--systems/unix/tex-fpc/README316
-rwxr-xr-xsystems/unix/tex-fpc/dvipsnk/MakeTeXPK17
-rw-r--r--systems/unix/tex-fpc/dvipsnk/Makefile233
-rw-r--r--systems/unix/tex-fpc/dvipsnk/README33
-rw-r--r--systems/unix/tex-fpc/dvipsnk/afm2tfm.c1966
-rw-r--r--systems/unix/tex-fpc/dvipsnk/dvipsmanfonts61
-rw-r--r--systems/unix/tex-fpc/lib/webmac-fpc.tex16
-rw-r--r--systems/unix/tex-fpc/license21
-rw-r--r--systems/unix/tex-fpc/mf/mf.ch631
-rw-r--r--systems/unix/tex-fpc/mfware/gftopk.ch119
-rwxr-xr-xsystems/unix/tex-fpc/shell/itgl6
-rwxr-xr-xsystems/unix/tex-fpc/shell/mk_MF_dir3
-rwxr-xr-xsystems/unix/tex-fpc/shell/mk_TeX_dir6
-rwxr-xr-xsystems/unix/tex-fpc/shell/mkfont15
-rwxr-xr-xsystems/unix/tex-fpc/shell/mkpkfont19
-rwxr-xr-xsystems/unix/tex-fpc/shell/tgl6
-rwxr-xr-xsystems/unix/tex-fpc/shell/wve6
-rw-r--r--systems/unix/tex-fpc/tech/german.ed5
-rwxr-xr-xsystems/unix/tex-fpc/tech/mktech17
-rw-r--r--systems/unix/tex-fpc/tech/readme30
-rw-r--r--systems/unix/tex-fpc/tech/schlicht.tex14
-rw-r--r--systems/unix/tex-fpc/tech/test.tex95
-rw-r--r--systems/unix/tex-fpc/tex-fpc.pdfbin0 -> 571938 bytes
-rw-r--r--systems/unix/tex-fpc/tex/otex.ch1070
-rw-r--r--systems/unix/tex-fpc/tex/tex.ch1059
-rw-r--r--systems/unix/tex-fpc/web/tangle.ch179
-rw-r--r--systems/unix/tex-fpc/web/tangle.p793
-rw-r--r--systems/unix/tex-fpc/web/weave.ch185
-rw-r--r--systems/unix/tex-fpc/xdvi/README32
-rwxr-xr-xsystems/unix/tex-fpc/xdvi/config15
-rwxr-xr-xsystems/unix/tex-fpc/xdvi/macconfigure4640
-rw-r--r--systems/unix/tex-fpc/xdvi/macxdvi.h1299
47 files changed, 13271 insertions, 0 deletions
diff --git a/systems/unix/tex-fpc/MFT/iby/README b/systems/unix/tex-fpc/MFT/iby/README
new file mode 100644
index 0000000000..802aae4137
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/README
@@ -0,0 +1,98 @@
+This directory contains files that help installing an ancient Greek
+font in TeX-GPC. The font includes a full set of diacritical marks,
+the preclassic letters digamma, quoppa and sampi, and the lunatic
+variant of sigma.
+
+The font was originally cut by Firmin Didot(*1764, +1836), put into
+METAFONT files by Silvio Levy in 1987 and improved by Pierre A. MacKay,
+the author of Ibycus4. Here I used version 4.5 as of
+2004-10-27.
+
+Preparation:
+------------
+Get the packages ibygrk and levy from CTAN:fonts/greek and copy
+files from levy and ibygrk directories into this directory, with
+the shellscripts getlevy and getiby.
+
+Link METAFONT's and TeX's master directories to this directory, so
+you can run mf and tex from here. Make sure MFinputs contains
+Knuth's computer modern fonts.
+
+Installation:
+-------------
+Run ibyfonts to build and install the .tfm and .pk fonts.
+Run ibymacros to install macro files into TeXinputs.
+
+Usage:
+------
+From your .tex file \input agr and enclose Greek between \GK and
+\RM.
+
+
+Typing Greek characters
+-----------------------
+You don't need a monster keyboard or even the ALT-key to enter
+Greek text into your TeX---ASCII suffices. The ASCII representation
+used here follows the Beta Code from the Thesaurus Linguae Graecae.
+(http://www.tlg.uci.edu/BetaCode.html)
+
+Greek Letters:
+Since the Latin alphabet emerged from the Greek one, you enter most
+Greek letters as their corresponding ASCII character.
+But there are some exceptions:
+Greek ASCII
+eta h
+theta q
+ksi c
+ypsilon u
+phi f
+chi x
+psi y
+omega w
+digamma v
+koppa k+
+sampi s+ (lowercase only)
+lunatic
+sigma c
+
+Diacritics:
+rough breathing: (
+smooth breathing: )
+diaeresis: +
+acute: '
+grave: `
+circumflex: =
+iota subscript: |
+dubious(dot under): !
+
+Order of diacritics with lowercase letters:
+letter, diaeresis, breathing, accent, iota subscript. E.g. u"(=|
+A diaeresis (+) won't work together with a circumflex.
+
+Order of diacritics with uppercase letters:
+breathing, accent, letter, iota subscript (=W|
+A breathing is mandatory before an accent.
+
+Punctuation
+Period .
+Apostroph ' (if after a vowel, use a{}', not a')
+Colon :
+Question Mark ;
+guillemets << >>
+
+Look at test.tex and sappho.tex for examples.
+
+Installing the Type 1 fonts in teTeX3.0:
+----------------------------------------
+List the search directory with `kpsewhich -show-path=.pfb'
+I selected ~/texmf from that list.
+From the ibygrk/fonts directory do:
+ mkdir ~/texmf/fonts
+ cp -rp * ~/texmf/fonts
+ texhash
+
+Finally I added the command line option `-u +iby' to dvips
+in the dvipdf script.
+
+Aug. 2008
+Wolfgang Helbig
diff --git a/systems/unix/tex-fpc/MFT/iby/agr.tex b/systems/unix/tex-fpc/MFT/iby/agr.tex
new file mode 100644
index 0000000000..038f6a94bd
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/agr.tex
@@ -0,0 +1,2 @@
+\input ibycusps
+\setgreek10/12
diff --git a/systems/unix/tex-fpc/MFT/iby/getiby b/systems/unix/tex-fpc/MFT/iby/getiby
new file mode 100644
index 0000000000..23f2b7724a
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/getiby
@@ -0,0 +1,17 @@
+# copy .tex and .mf files from the ibygrk package
+IBY=../ibygrk
+
+for f in \
+abary4.mf version4.mf ubary4.mf sampi4.mf obary4.mf koppa4.mf \
+ibyupr4.mf ibypnct4.mf ibylwr4.mf ibylig4.mf ibycus4.mf ibyacc4.mf \
+ibary4.mf hbary4.mf fibr849.mf fibr848.mf fibr84.mf fibo849.mf \
+fibo848.mf fibo84.mf fibb849.mf fibb848.mf fibb84.mf ebary4.mf \
+digamma4.mf cigma4.mf wbary4.mf gen_acc.mf graccent.mf grbase.mf
+do cp -p $IBY/fonts/source/public/ibycus4/$f .
+done
+
+for f in \
+pssetiby.tex tlgsqq.tex setiby4.tex version4.tex ibycusps.tex \
+ibycus4.tex iby4extr.tex psibycus.tex iby4text.tex
+do cp -p $IBY/tex/generic/ibycus4/$f .
+done
diff --git a/systems/unix/tex-fpc/MFT/iby/getlevy b/systems/unix/tex-fpc/MFT/iby/getlevy
new file mode 100755
index 0000000000..899e201492
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/getlevy
@@ -0,0 +1,8 @@
+# copy fonts from the levy directory
+LEVY=../levy
+for f in \
+a.mf b.mf d.mf e.mf f.mf g.mf h.mf i.mf j.mf k.mf \
+l.mf m.mf n.mf o.mf p.mf q.mf r.mf s.mf t.mf u.mf \
+w.mf x.mf y.mf z.mf gen_sigma.mf grpunct.mf grbase.mf graccent.mf
+do cp -p $LEVY/$f .
+done
diff --git a/systems/unix/tex-fpc/MFT/iby/ibyfonts b/systems/unix/tex-fpc/MFT/iby/ibyfonts
new file mode 100755
index 0000000000..ceb04b49e4
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/ibyfonts
@@ -0,0 +1,13 @@
+# build and install ibyfonts
+rm -f trouble
+mkfont fibo84
+mkfont fibr84
+mkfont fibr849
+mkfont fibo849
+mkfont fibr848
+mkfont fibo848
+mkpkfont fibr84 magstep0.5
+mkpkfont fibo84 magstep0.5
+mkpkfont fibr84 magstep1
+mkpkfont fibo84 magstep1
+mkpkfont cmr10 magstep0.5
diff --git a/systems/unix/tex-fpc/MFT/iby/ibymacros b/systems/unix/tex-fpc/MFT/iby/ibymacros
new file mode 100755
index 0000000000..fc64ea0f6e
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/ibymacros
@@ -0,0 +1,6 @@
+# install tex macros for ibycus4 TeX-GPC
+for f in \
+pssetiby.tex tlgsqq.tex setiby4.tex version4.tex ibycusps.tex \
+ibycus4.tex iby4extr.tex psibycus.tex iby4text.tex agr.tex ibycus4.map
+do cp -p $f TeXinputs
+done
diff --git a/systems/unix/tex-fpc/MFT/iby/sappho.tex b/systems/unix/tex-fpc/MFT/iby/sappho.tex
new file mode 100644
index 0000000000..861f5d682f
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/sappho.tex
@@ -0,0 +1,27 @@
+% Ein Beispiel fuer die Benutzung des altgriechischen Fonts:
+\hsize 4in
+\input ibycusps
+\setgreek10/12
+\GK
+\obeylines
+De'duke me`n a) sela'nna
+kai` Plhi'ades, me'sai de`
+nu'ktes, pa'ra d' e)'rxet' w)'ra,
+e)gw` de` mo'na kate'udw.
+
+\medskip
+
+)Aste'res me`n a)mfi` kala`n sela'nnan
+a)'y' a)pokru'ptoisi fae'nnon ei)=dos,
+o)'ppotan plh'qoisa ma'lista la'mph|
+ga=n e)pi` pai=san.
+
+\medskip
+
+)'Espere, pa'nta fe'reis, o)'sa fai'nolis e)ske'das' Au)'ws;
+fe'reis o)'in,
+fe'reis ai)=ga,
+fe'reis a)'pu ma'teri pai=da.
+\hfill Sapfw'
+\RM
+\bye
diff --git a/systems/unix/tex-fpc/MFT/iby/test.tex b/systems/unix/tex-fpc/MFT/iby/test.tex
new file mode 100644
index 0000000000..8acf09d185
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/iby/test.tex
@@ -0,0 +1,91 @@
+% Pruefdatei fuer ibycus4
+\input agr
+\obeylines
+\noindent {\bf Vokale}
+\GK a e h i o u w A E H I O U W\RM
+Kurze Vokale: \GK e o\RM
+Lange Vokale: \GK h w\RM
+
+\medskip \noindent{\bf Hauchzeichen}
+Spiritus asper: \GK a( e( h( i( o( u( w( (A (E (H (I (O (U (W \RM
+Spiritus lenis: \GK a) e) h) i) o) u) w) )A )E )H )I )O )U )W \RM
+
+\medskip \noindent{\bf Akzente}
+Akut: \GK a' e' h' i' o' u' w'\RM
+Gravis: \GK a` e` h` i` o` u` w` \RM
+Zirkumflex: \GK a= h= i= u= w= \RM
+
+\medskip \noindent{\bf Hauchzeichen und Akzente}
+Spiritus asper und Akut: \GK a(' e(' h(' i(' o(' u(' w(' %
+ ('A ('E ('H ('I ('O ('U ('W\RM
+Spiritus lenis und Akut: \GK a)' e)' h)' i)' o)' u)' w)' %
+ )'A )'E )'H )'I )'O )'U )'W\RM
+Spiritus asper und Gravis: \GK a(` e(` h(` i(` o(` u(` w(` %
+ (`A (`E (`H (`I (`O (`U (`W\RM
+Spiritus lenis und Gravis: \GK a)` e)` h)` i)` o)` u)` w)` %
+ )`A )`E )`H )`I )`O )`U )`W\RM
+Spiritus asper und Zirkumflex: \GK a(= h(= i(= u(= w(= %
+ (=A (=E (=H (=I (=O (=U (=W\RM
+Spiritus lenis und Zirkumflex: \GK a)= h)= i)= u)= w)= %
+ )=A )=E )=H )=I )=O )=U )=W\RM
+
+\medskip \noindent{\bf Trema}
+\GK i+ u+\RM
+\medskip \noindent{\bf $\ldots$ und Akzente}
+Akut: \GK i+' u+'\RM
+Gravis: \GK i+` u+`\RM
+% Zirkumflex: \GK i+= u+=\RM gibt's nicht XXX
+
+\medskip \noindent{\bf Iota subscriptum}
+\GK a| h| w|\RM
+
+\medskip \noindent{\bf $\ldots$ mit Hauchzeichen}
+Spiritus asper: \GK a(| h(| w(|\RM
+Spiritus lenis: \GK a)| h)| w)|\RM
+
+\medskip \noindent{\bf $\ldots$ mit Akzenten}
+Akut: \GK a'| h'| w'|\RM
+Gravis: \GK a`| h`| w`|\RM
+Zirkumflex: \GK a=| h=| w=|\RM
+
+\medskip \noindent{\bf $\ldots$ mit Hauchzeichen und Akzenten}
+Spiritus asper und Akut: \GK a('| h('| w('|\RM
+Spiritus asper und Gravis: \GK a(`| h(`| w(`|\RM
+Spiritus asper und Zirkumflex: \GK a(=| h(=| w(=|\RM
+Spiritus lenis und Akut: \GK a)'| h)'| w)'|\RM
+Spiritus lenis und Gravis: \GK a)`| h)`| w)`|\RM
+Spiritus lenis und Zirkumflex: \GK a)=| h)=| w)=|\RM
+
+\medskip\noindent {\bf Dauerlaute}
+Nasale: \GK m n M N\RM
+Liquidae: \GK l r L R\RM, Rho mit Spiritus asper: \GK r(\RM
+Spirant: \GK s\noboundary\ S\RM, Sigma am Wortende: \GK s s. s, s; s?\RM
+
+\filbreak\noindent {\bf Verschlu\ss laute}
+Labiale: \GK p b f P B F \RM
+Dentale: \GK t d q T D Q\RM
+Gutturale: \GK k g x K G X\RM
+Aspiratae: \GK f q x F Q X\RM
+
+\medskip\noindent {\bf Konsonantenverbindungen mit dem Laut ``s''}
+\GK y z c Y Z C\RM
+
+\medskip \noindent {\bf Satzzeichen}
+Punkt: \GK.\RM
+Komma: \GK,\RM
+Hochpunkt: \GK;\RM
+Fragezeichen: \GK?\RM
+Guillemet: \GK<<$\ldots$>>\RM
+
+\medskip \noindent {\bf Vorklassische Zeichen, Zahlzeichen}
+Digamma (6): \GK v V \RM
+Qoppa (90): \GK k+ K+ \RM
+Sampi (900): \GK s+\RM
+
+\medskip \noindent {\bf andere Zeichen}
+Sigma Lunate: \GK c+ C+\RM
+
+Punkt unter Buchstaben: \GK kosm!os\RM
+
+
+\bye
diff --git a/systems/unix/tex-fpc/MFT/local.mf b/systems/unix/tex-fpc/MFT/local.mf
new file mode 100644
index 0000000000..491430d781
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/local.mf
@@ -0,0 +1,33 @@
+% This is local.mf for my HP LaserJet 1320.
+% It works with two resolutions.
+% The values are from modes.mf (ftp://tug.org/tex/modes.mf) Version 3.8.
+% as supplied by Niko Sauer <nikos@friedrichs.up.ac.za>. Niko writes:
+% Here are modes developed for and tested on the HP LaserJet 2100T/TN.
+% Mode ljtozz is for a resolution of 1200dpi, and ljtozzfr for 600dpi
+% Tradeoffs between |fillin| and |blacker| resulted in very clear,
+% sharp renderings of Computer Modern fonts which appears to be
+% preferable to what the modes ljfzzz ljfzzzfr for HP LaserJet 4000
+% yield on this printer. Preferences were tested by scrutiny of the
+% results by sample of people in the vicinity.
+%
+%
+mode_def lj = % HP LaserJet 1320 ProRes (1200 dpi)
+ proofing :=0;
+ fontmaking := 1;
+ tracingtitels := 1;
+ pixels_per_inch := 1200;
+ blacker := .7;
+ fillin := .15;
+ o_correction := 1;
+enddef;
+%
+mode_def ljfr = % HP LaserJet 1320 FastRes (600dpi)
+ proofing :=0;
+ fontmaking := 1;
+ tracingtitels := 1;
+ pixels_per_inch := 600;
+ blacker := .25;
+ fillin := .3;
+ o_correction := 1;
+enddef;
+localfont := ljfr;
diff --git a/systems/unix/tex-fpc/MFT/manfonts b/systems/unix/tex-fpc/MFT/manfonts
new file mode 100755
index 0000000000..e98538738b
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/manfonts
@@ -0,0 +1,7 @@
+mkfont cmtex10
+mkfont cminch
+mkfont cmssdc10 4
+mkpkfont cmr5 2
+mkfont cmman # font used for miscellaneous Computer Modern variations
+ # from ctan:/systems/knuth/local/mf/cmman.mf
+mkfont random # from ctan:/systems/knuth/local/lib/random.mf
diff --git a/systems/unix/tex-fpc/MFT/mfwebfonts b/systems/unix/tex-fpc/MFT/mfwebfonts
new file mode 100755
index 0000000000..a66d9a6be8
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/mfwebfonts
@@ -0,0 +1,4 @@
+# fonts used by mf.web
+mkfont logo10 # font used for the METAFONT logo
+mkfont logosl10
+mkfont logo8
diff --git a/systems/unix/tex-fpc/MFT/plainfonts b/systems/unix/tex-fpc/MFT/plainfonts
new file mode 100755
index 0000000000..d2d18bd490
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/plainfonts
@@ -0,0 +1,52 @@
+# This script builds and installs .tfm and .pk fonts for plain.tex.
+rm -f trouble # clean list of trouble makeing fonts
+mkfont cmr10 # roman text
+mkfont cmr9
+mkfont cmr8
+mkfont cmr7
+mkfont cmr6
+mkfont cmr5
+mkfont cmmi10 # math italic
+mkfont cmmi9
+mkfont cmmi8
+mkfont cmmi7
+mkfont cmmi6
+mkfont cmmi5
+mkfont cmsy10 # math symbols
+mkfont cmsy9
+mkfont cmsy8
+mkfont cmsy7
+mkfont cmsy6
+mkfont cmsy5
+mkfont cmex10 # math extension
+mkfont cmss10 # sans serif
+mkfont cmssq8
+mkfont cmssi10 # sans serif italic
+mkfont cmssqi8
+mkfont cmbx10 # boldface extended
+mkfont cmbx9
+mkfont cmbx8
+mkfont cmbx7
+mkfont cmbx6
+mkfont cmbx5
+mkfont cmtt10 # typewriter
+mkfont cmtt9
+mkfont cmtt8
+mkfont cmsltt10 # slanted typewriter
+mkfont cmsl10 # slanted roman
+mkfont cmsl9
+mkfont cmsl8
+mkfont cmti10 # text italic
+mkfont cmti9
+mkfont cmti8
+mkfont cmti7
+mkfont cmu10 # unslanted text italic
+mkfont cmmib10 # bold math italic
+mkfont cmbsy10 # bold math symbols
+mkfont cmcsc10 # caps and small caps
+mkfont cmssbx10 # sans serif bold extended
+mkfont cmdunh10 # Dunhill style
+mkpkfont cmr7 magstep4 # for titles
+mkpkfont cmtt10 magstep2
+mkpkfont cmssbx10 magstep2
+mkfont manfnt # METAFONT logo and dragon curve and special symbols
diff --git a/systems/unix/tex-fpc/MFT/texwebfonts b/systems/unix/tex-fpc/MFT/texwebfonts
new file mode 100755
index 0000000000..883b186bb1
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/texwebfonts
@@ -0,0 +1,2 @@
+# font used tex.tex
+mkfont logo10 # font used for the METAFONT logo
diff --git a/systems/unix/tex-fpc/MFT/tripmanfonts b/systems/unix/tex-fpc/MFT/tripmanfonts
new file mode 100755
index 0000000000..1d4e4356c4
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/tripmanfonts
@@ -0,0 +1,2 @@
+# font for tripman
+mkpkfont cmr7 magstep5 # for titles
diff --git a/systems/unix/tex-fpc/MFT/webfonts b/systems/unix/tex-fpc/MFT/webfonts
new file mode 100644
index 0000000000..86676e2c70
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/webfonts
@@ -0,0 +1,2 @@
+# fonts for the web macros
+mkfont cmtex10
diff --git a/systems/unix/tex-fpc/README b/systems/unix/tex-fpc/README
new file mode 100644
index 0000000000..4d62296690
--- /dev/null
+++ b/systems/unix/tex-fpc/README
@@ -0,0 +1,316 @@
+2019-03-04
+
+This directory contains change files for Donald E. Knuth's suite
+of TeX related programs. The change files (.ch) and Don Knuth's
+WEB files (.web) from January 2014 are the key components of a
+construction kit for "TeX-FPC"---a TeX system which is based on
+the Free Pascal Compiler (FPC) and runs in a Unix environment. It's
+by magnitudes smaller than other TeX distributions.
+
+These building bricks are glued together by shell scripts in
+the---guess where---shell subdirectory.
+
+The MFT directory contains shell scripts for installing fonts
+(xxxfonts), and the directory iby shows how to install fonts
+with TeX-FPC. In this case a polytonic Greek font, suited for ancient
+Greek texts.
+
+The directories dvipsnk and xdvi show how to install Tom Rokicki's
+dvips and Paul Vojta's xdvi.
+If your printer does not accept postscript, you might want to install
+ghostscript, which converts postscript to the language of you printer or
+to pdf. Use ghostscripts dvipdf to convert ps to pdf.
+
+TeX-FPC replaces the famous and beautiful TeX-GPC. The GNU Pascal Compiler
+is not supported on Linux, the BSDs and OS X. Free Pascal is chosen
+not because it is the best alternative but because it is the only
+alternative.
+In FPC 3.0.4 I spotted to errors: See
+0035136: The function EOF does not comply to ISO Pascal
+0035066: fpc says "cannot determine which overloaded function to call"
+at bugs.freepascal.org
+
+
+Overview:
+=========
+
+File formats and their documentation:
+-------------------------------------
+WEB files:
+.web WEB programs, "The WEB System of Structured Documentation" (webman.tex)
+.ch Change files for WEB programs (patches to be applied to .web files)
+.p Free Pascal source
+.pool String pool, contains the string constants of a WEB program.
+
+
+METAFONT files:
+.mf METAFONT source, "The METAFONTbook" (mfbook.tex)
+.base Base file, a compact representation of METAFONT's memory.
+.tfm TeX font metric, "TeX: The Program" (tex.web) part 30
+.nnngf generic font file, "METAFONT: The Program" (mf.web), part 46
+.nnnpk packed font file, gftopk.web, modules 21-36
+ The last two are bitmap font formats, where nnn is a number that
+ stands for "dots per inch". The number equals resolution of the
+ output device as specified in your mode times the magnification.
+.log a log file
+
+TeX files:
+.tex TeX source, "The TeXbook" (texbook.tex)
+.fmt Format file, a compact representation of TeX's memory.
+ contains the string pool (tex.pool) and preloaded .tfm files.
+.dvi device independent file, "TeX: The Program" (tex.web), part 31
+.log a log file
+
+
+
+Files and their processors:
+--------------------------
+WEB:
+ tangle
+ .web, .ch --------> .p, .pool
+
+ fpc
+ x.p --------> x
+
+ tgl
+ x.web, x.ch --------> x (linking the last two steps)
+
+ itgl
+ x.web, x.ch --------> x, inix.p, .pool (links the first two steps
+ and keeps the pascal sources)
+
+ weave
+ .web, .ch --------> .tex (Description of the program)
+
+ wve
+ .web, .ch --------> .dvi (linking the above step and tex)
+
+
+METAFONT:
+ inimf
+ plain.mf --------> plain.base
+
+ mf
+ .mf --------> .nnngf, tfm
+
+ gftopk
+ .nnngf --------> .nnnpk
+
+ mkfont
+ .mf --------> TeXfonts/.tfm, PKfonts/.nnnpk
+
+ mkpkfont
+ .mf --------> PKfonts/.nnnpk
+
+
+TeX:
+ initex
+ .tfm, plain.tex --------> plain.fmt
+
+ tex
+ [ .tfm ], .tex --------> .dvi
+
+
+DVI drivers:
+ dvips
+ .dvi, .nnnpk --------> .ps, PostScript printer
+
+ xdvi
+ .dvi, .nnnpk --------> X-Window
+
+
+File names:
+-----------
+TeX-FPC searches files in directories which are local to the working
+directory:
+ TeXinputs .tex
+ TeXfonts .tfm
+ TeXformats .pool, .fmt
+ MFinputs .mf
+ MFbases .pool, .base
+ PKfonts .nnnpk
+ DVIPSconf .pro, .ps, .map (Header and configuration files for dvips)
+
+I created one set of "master directories" and used symbolic links
+to my working directory like:
+
+ ln -s ~/TeXformats .
+
+The scripts mk_TeX_dir and mk_MF_dir help to prepare a directory
+for running TeX resp. METAFONT. Adapt these scripts to the locations
+of your master directories.
+
+TeX-FPC's path searching applies to file names without directory
+components, i.e. without a /:
+ .tex local directory and then TeXinputs
+ .mf local directory and then MFinputs
+ .tfm TeXfonts
+
+Depending on the context, TeX-FPC programs append ".mf", ".tex",
+or ".tfm" to file names without extensions.
+
+builtin file names:
+------------------
+TeXformats/tex.pool string pool for tex, (in initex)
+MFbases/mf.pool string pool for mf, (in inimf)
+TeXformats/plain.fmt format file for Plain TeX, (in tex)
+MFbases/plain.base base file for Plain METAFONT, (in mf)
+
+Fonts in TeX-FPC:
+----------------
+For each font TeX needs one .tfm file. For each font and
+resolution/magnification the DVI drivers need one .nnnpk file.
+The script mkfont will install both a .tfm and an .nnnpk file, the
+script mkpkfont will install an .nnnpk file only. You specify the
+resolution in your METAFONT mode and the magnification as an optional
+second argument to mkpkfont or mkfont. The DVI drivers will invoke
+mkpkfont automatically to create missing .nnnpk files.
+
+Running TeX-FPC
+===============
+Missing files
+-------------
+Search missing macro files like (webmac.tex) in Knuth's lib
+directory and copy them to the working directory or to TeXinputs.
+My change files import webmac-fpc.tex; move it to TeXinputs.
+
+Search the sources of missing fonts in the lib directory (.mf),
+copy them to MFinputs and use the scripts mkfont or mkpkfont to
+create and install .tfm files respective .pk files. The shell scripts
+assume the METAFONT mode localfont which is defined in MFT/local.mf.
+Remember, you've loaded local.mf into the file plain.base. Or you
+might want to grep for font assignments in your .tex files. The
+command line
+ grep '\\font.*=' plain.tex > plainfonts
+creates a list of the font names used by plain.tex. I edited
+plainfonts to convert it to a shell script that creates all fonts
+of the plain format. In the MFT directory you'll find other examples.
+
+Installing new fonts from CTAN
+------------------------------
+The directory MFT/iby contains instructions on how to install a font
+from CTAN, in this case ibygrk to typeset polytonic ancient Greek.
+
+Printing the documentation
+--------------------------
+The weave program generates an xxx.tex file from an xxx.web file
+and a possibly empty change file. Use tex to generate an xxx.dvi
+file. This is done by the script wve. For example, to view the
+description of TeX-FPC, use
+ wve tex.web tex.ch && xdvi tex
+The web-macros need another font. Use webfonts to install it.
+The scripts texwebfonts installs additional fonts for tex.tex,
+and mfwebfonts for mf.tex.
+
+TRIP TRAP
+---------
+Both tests might not be passed by TeX-FPC: TeX and METAFONT trim
+trailing spaces from input lines for compatibility with IBM's
+punched cards. TeX-FPC's programs don't.
+
+
+Installing TeX-FPC:
+===================
+
+Get Knuth's source files:
+------------------------
+Make a stage directory, say tex-fpc, which mirrors Knuth's distribution
+from
+
+ ftp://ftp.dante.de/pub/tex/systems/knuth/dist.zip
+
+This gives you the WEB files, manuals, macros and some .mf files.
+At least you need the directories lib, tex, mfware, mf and web.
+
+You need another set of source files, namely the METAFONT source
+files (.mf) for Knuth's font Computer Modern.
+
+Copy the .mf files from
+ ftp://ftp.dante.de/pub/tex/fonts/cm/mf/
+to MFinputs.
+
+And Copy the .mf files from the lib directory to MFinputs.
+ cp -p lib/*.mf MFinputs
+
+I prefer the DANTE server, because that server preserves modification
+times. This is not true with other CTAN mirrors.
+
+Building from WEB sources, (xxx.web and xxx.ch --> xxx, xxx.pool)
+----------------------------------------------------------------
+The general procedure to build a binary xxx from its WEB files is:
+Move xxx.ch to the directory that contains xxx.web, apply tangle
+to xxx.web and xxx.ch to generate xxx.p and xxx.pool, and compile the
+Pascal source with gpc. The command line
+ tgl xxx.web xxx.ch
+will do all that. It produces xxx that you need to move to your binary
+directory.
+
+Step by step procedure to bootstrap TeX-FPC
+-------------------------------------------
+Install Free Pascal Compiler from www.freepascal.org.
+
+Create the master directories (see above)
+
+copy the shell scripts from the tex-fpc/shell to your binary direcory.
+
+
+0. Make tangle tangle.p --> tangle
+------------------------------------------------------------------------
+Compile tangle.p (fpc tangle.p) and move tangle to your
+binary directory.
+
+1. Make inimf and initex mf.web, mf.ch --> inimf, inimf.p, MFbases/mf.pool
+ tex.web, tex.ch --> initex,initex.p TeXformats/tex.pool
+Make sure, mf.ch and tex.ch are prepared to produce ini versions of
+tex and mf.
+------------------------------------------------------------------------
+Build the ini-programs and save them as initex, resp. inimf.
+Move tex.pool to TeXformats and mf.pool to MFbases, use itgl instead
+of tgl to keep inimf.p and initex.p.
+
+2. Make plain.base lib/plain.mf --> MFbases/plain.base
+------------------------------------------------------------------------
+Go to the directory tex-fpc/mf and use inimf to create plain.base.
+The file local.mf contains mode definitions for my HP LaserJet 1320
+printer. Adapt local.mf to your printer and then type
+ inimf ../lib/plain input ../MFT/local dump
+
+Move plain.base to MFbases.
+
+3. Make mf mf.web, mf.ch --> mf
+------------------------------------------------------------------------
+Edit mf.ch and look for the string @x inimf that introduces a change
+block. This change block is commented out, since it is shifted
+right. Shift left this block to uncomment it. This way mf.ch is
+changed to build a production version.
+
+4. Make gftopk gftopk.web, gftopk.ch --> gftopk
+------------------------------------------------------------------------
+Build gftopk in the mfware directory. You need gftopk to install
+packed font files (.nnnpk) in the next step.
+
+5. Install fonts: MFinputs/*.mf --> TeXfonts/*.tfm, PKfonts/*.pk
+------------------------------------------------------------------------
+Prepare tex-fpc to run both METAFONT (mk_MF_dir) and TeX (mk_TeX_dir)
+and run the shell script MFT/plainfonts from there.
+Check the file trouble that might contain commands that failed.
+
+6. Make plain.fmt lib/plain.tex --> TeXformats/plain.fmt
+------------------------------------------------------------------------
+Copy lib/hyphen.tex to TeXinputs and go to the directory tex-fpc/tex
+to build plain.fmt.
+This command line will do
+ initex ../lib/plain \\dump # one backslash is consumend by sh!
+Move plain.fmt to TeXformats.
+
+7. Finally build tex tex.web, tex.ch --> tex
+------------------------------------------------------------------------
+Change tex.ch for production, and build it with tgl.
+
+Enjoy,
+Wolfgang Helbig, Programmierer
+
+Comments welcome: helbig@mailbox.org
+
+TeX is a trademark of the American Mathematical Society.
+METAFONT is a trademark of Addison Wesley Publishing Company.
diff --git a/systems/unix/tex-fpc/dvipsnk/MakeTeXPK b/systems/unix/tex-fpc/dvipsnk/MakeTeXPK
new file mode 100755
index 0000000000..5145b09bfa
--- /dev/null
+++ b/systems/unix/tex-fpc/dvipsnk/MakeTeXPK
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# Do not run this script, or dvips, as setuid programs! This will
+# result in a major security hole!
+#
+# This script file makes a new TeX PK font, because one wasn't
+# found. Parameters are:
+#
+# name dpi bdpi magnification [mode [subdir]]
+#
+# `name' is the name of the font, such as `cmr10'. `dpi' is
+# the resolution the font is needed at. `bdpi' is the base
+# resolution, useful for figuring out the mode to make the font
+# in. `magnification' is a string to pass to MF as the
+# magnification. `mode', if supplied, is the mode to use.
+#
+mkpkfont $1 $4
diff --git a/systems/unix/tex-fpc/dvipsnk/Makefile b/systems/unix/tex-fpc/dvipsnk/Makefile
new file mode 100644
index 0000000000..cbdf300d17
--- /dev/null
+++ b/systems/unix/tex-fpc/dvipsnk/Makefile
@@ -0,0 +1,233 @@
+#
+# Makefile for dvips. Edit this first part of the file.
+# Adapted to TeX-GPC in Aug. 2008.
+#
+# First, the things that absolutely must be edited for your system.
+# Please, don't forget to edit MakeTeXPK in the same way!
+
+# Change to your binary directory.
+BINDIR = $(HOME)/bin
+# the place man pages are located.
+MANDIR = $(HOME)/man/man1
+
+# Change the default resolution to reflect your printer's.
+DEFS= -DDEBUG -DDEFRES=600 -DCREATIONDATE
+
+# where TeX is `rooted'. Sometimes /usr/local/lib/tex.
+# TEXDIR = /usr/lib/tex
+TEXDIR = .
+
+# another place pk, tfm, and vf files might be found.
+# LOCALDIR = /LocalLibrary/Fonts/TeXFonts
+LOCALDIR = TeXFonts
+
+# the default path to search for TFM files
+# (this usually is identical to TeX's defaultfontpath, which omits `.')
+# (private fonts are given an explicit directory, which overrides the path)
+# overridden by the environment variable TEXFONTS
+# TFMPATH = $(LOCALDIR)/tfm:$(TEXDIR)/fonts/tfm
+TFMPATH = TeXFonts
+
+# the default path to search for PK files (usually omits `.')
+# Don't forget to add the directory that
+# MakeTeXPK puts the files! (In this case, /LocalLibrary/Fonts...)
+# overridden by the environment variable TEXPKS or TEXPACKED or PKFONTS
+# PKPATH = $(LOCALDIR)/pk:$(TEXDIR)/fonts/pk
+PKPATH = PKfonts
+
+# the default path to search for VF files (usually omits `.')
+# overridden by the environment variable VFFONTS
+# VFPATH = $(LOCALDIR)/vf:$(TEXDIR)/fonts/vf
+VFPATH = VFfonts
+
+# additional directories in which to search for subdirectories to find
+# both tfm and pk files
+FONTSUBDIRPATH =
+
+# where the config files go
+# CONFIGDIR = $(TEXDIR)/ps
+CONFIGDIR = DVIPSconf
+
+# the default path to search for config files
+# overridden by the environment variable TEXCONFIG
+# CONFIGPATH = .:$(CONFIGDIR)
+CONFIGPATH = DVIPSconf
+
+# the name of your config file
+# CONFIGFILE = config.ps
+CONFIGFILE = config.ps
+
+# where the header PS files go
+# HEADERDIR = $(TEXDIR)/ps
+HEADERDIR = DVIPSconf
+
+# the default path to search for header files
+# HEADERPATH = .:$(HEADERDIR)
+HEADERPATH = DVIPSconf
+
+# where epsf.tex and rotate.tex go (usually the TeX macros directory)
+# TEXMACRODIR = $(TEXDIR)/inputs
+TEXMACRODIR = TeXinputs
+
+# the default path to search for epsf and psfiles
+# (usually the same as TeX's defaultinputpath)
+# FIGPATH = .:..:$(TEXDIR)/inputs
+FIGPATH = .:TeXinputs
+
+# change -DDEFRES=300 or whatever is required
+# if the default resolution is not 300 dpi,
+# add -DDEBUG to turn on debugging capability
+# add -DTPIC for tpic support
+# add -DFONTLIB to search font libraries
+# add -DSEARCH_SUBDIRECTORIES to search the FONTSUBDIRPATH.
+# add -DHAVE_GETCWD if you have getcwd (relevant only for subdir searching)
+# add -DIBM6000 for compiling on IBM 6000 systems
+# add -DCREATIONDATE if your system has a working time() and you want dated files
+# (for VM/CMS, see the MKDVIPS.EXEC file in the vmcms subdirectory).
+#
+# If you define FONTLIB, make sure to also give definitions to
+# FLIPATH and FLINAME.
+#
+# If your compiler doesn't like void*, then add
+# -DVOID=char
+#
+
+# either use
+# OPT = -O -funsigned-char
+# or
+OPT = -g -Wall -funsigned-char
+
+# libraries to include (-lm -lc on most systems)
+#FLIBS= -lNeXT_s -lsys_s
+FLIBS= -lm -lc
+
+# If you are compiling dvips for suid or other privileges, you will
+# definitely want to define the following symbol; else don't.
+# SECURE = -DSECURE
+
+# If you want EMTEX specials, define the following.
+# EMTEX = -DEMTEX
+
+# for SYSV (and friends which use <string.h> instead of <strings.h>)
+# define the c-compiler flag
+# add -D_POSIX_SOURCE if you are POSIX (also define SYSV) (only relevant
+# for subdir searching)
+# SYS = -DSYSV
+
+# Define this to be whatever you use for installation. If you don't have
+# install, use a script that invokes copy and chmod's the files
+# appropriately.
+# INSTALL = install
+INSTALL = install
+
+PATHS = -DTFMPATH=\"$(TFMPATH)\" \
+ -DPKPATH=\"$(PKPATH)\" \
+ -DVFPATH=\"$(VFPATH)\" \
+ -DHEADERPATH=\"$(HEADERPATH)\" \
+ -DCONFIGPATH=\"$(CONFIGPATH)\" \
+ -DCONFIGFILE=\"$(CONFIGFILE)\" \
+ -DFONTSUBDIRPATH=\"$(FONTSUBDIRPATH)\" \
+ -DFIGPATH=\"$(FIGPATH)\"
+
+CFLAGS = $(DEFS) $(OPT) $(SYS) $(SECURE) $(EMTEX) $(DEFPFMT)
+
+SRC = dospecial.c dviinput.c fontdef.c loadfont.c dvips.c tfmload.c \
+ download.c prescan.c scanpage.c skippage.c output.c scalewidth.c \
+ dosection.c dopage.c resident.c search.c unpack.c drawPS.c \
+ header.c makefont.c repack.c virtualfont.c dpicheck.c finclude.c \
+ pprescan.c papersiz.c flib.c color.c bbox.c emspecial.c t1part.c \
+ hps.c
+
+OBJ = dospecial.o dviinput.o fontdef.o loadfont.o dvips.o tfmload.o \
+ download.o prescan.o scanpage.o skippage.o output.o scalewidth.o \
+ dosection.o dopage.o resident.o search.o unpack.o drawPS.o \
+ header.o makefont.o repack.o virtualfont.o dpicheck.o finclude.o \
+ pprescan.o papersiz.o flib.o color.o bbox.o emspecial.o t1part.o \
+ hps.o
+
+all : afm2tfm dvips tex.pro texps.pro texc.pro special.pro finclude.pro \
+ color.pro crop.pro hps.pro
+
+dvips : $(OBJ)
+ $(CC) $(CFLAGS) $(OBJ) $(LIBS) $(FLIBS) -o dvips
+
+dvips.o: dvips.c
+ $(CC) $(CFLAGS) $(PATHS) -c dvips.c
+
+afm2tfm: afm2tfm.c
+ $(CC) $(CFLAGS) -o afm2tfm afm2tfm.c $(LIBS) $(FLIBS)
+
+$(OBJ) : dvips.h debug.h
+flib.o resident.o dvips.o loadfont.o tfmload.o : paths.h
+
+squeeze : squeeze.o
+ $(CC) $(CFLAGS) squeeze.o -o squeeze $(LIBS) $(FLIBS)
+
+tex.pro : tex.lpro squeeze
+ ./squeeze <tex.lpro > tex.pro
+
+texc.pro: texc.lpro squeeze
+ ./squeeze <texc.lpro >texc.pro
+
+texc.lpro: texc.script tex.lpro
+ sh texc.script tex.lpro texc.lpro
+
+texps.pro : texps.lpro squeeze
+ ./squeeze <texps.lpro >texps.pro
+
+special.pro : special.lpro squeeze
+ ./squeeze <special.lpro >special.pro
+
+finclude.pro : finclude.lpro squeeze
+ ./squeeze <finclude.lpro >finclude.pro
+
+color.pro : color.lpro squeeze
+ ./squeeze <color.lpro >color.pro
+
+crop.pro : crop.lpro squeeze
+ ./squeeze <crop.lpro >crop.pro
+
+hps.pro : hps.lpro squeeze
+ ./squeeze <hps.lpro >hps.pro
+
+install : afm2tfm dvips MakeTeXPK \
+ tex.pro texc.pro texps.pro special.pro finclude.pro color.pro \
+ crop.pro hps.pro config.ps psfonts.map epsf.tex rotate.tex \
+ colordvi.tex blackdvi.tex \
+ dvips.tex dvipsmac.tex
+ - mkdir $(BINDIR)
+ - mkdir $(CONFIGDIR)
+ - mkdir $(HEADERDIR)
+ - mkdir $(TEXMACRODIR)
+ $(INSTALL) -c -m 755 afm2tfm $(BINDIR)/afm2tfm
+ $(INSTALL) -c -m 755 dvips $(BINDIR)/dvips
+ $(INSTALL) -c -m 755 MakeTeXPK $(BINDIR)/MakeTeXPK
+ $(INSTALL) -c -m 644 tex.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 texc.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 texps.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 special.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 finclude.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 color.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 crop.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 hps.pro $(HEADERDIR)
+ $(INSTALL) -c -m 644 config.ps $(CONFIGDIR)/$(CONFIGFILE)
+ $(INSTALL) -c -m 644 psfonts.map $(CONFIGDIR)
+ $(INSTALL) -c -m 644 epsf.tex $(TEXMACRODIR)
+ $(INSTALL) -c -m 644 rotate.tex $(TEXMACRODIR)
+ $(INSTALL) -c -m 644 colordvi.tex $(TEXMACRODIR)
+ $(INSTALL) -c -m 644 blackdvi.tex $(TEXMACRODIR)
+ $(INSTALL) -c -m 644 dvips.tex $(TEXMACRODIR)
+ $(INSTALL) -c -m 644 dvipsmac.tex $(TEXMACRODIR)
+ - $(INSTALL) -c -m 644 dvips.1 $(MANDIR)
+ - $(INSTALL) -c -m 644 afm2tfm.1 $(MANDIR)
+
+veryclean :
+ rm -f *.o dvips squeeze afm2tfm texc.lpro *.pro *~ *.log *.dvi
+
+clean :
+ rm -f *.o squeeze afm2tfm *~ *.log *.dvi
+
+lint :
+ lint $(DEFS) $(PATHS) $(SRC)
+ lint $(DEFS) squeeze.c
+ lint $(DEFS) afm2tfm.c
diff --git a/systems/unix/tex-fpc/dvipsnk/README b/systems/unix/tex-fpc/dvipsnk/README
new file mode 100644
index 0000000000..06119ad5e1
--- /dev/null
+++ b/systems/unix/tex-fpc/dvipsnk/README
@@ -0,0 +1,33 @@
+Feb 2019
+The files in this directory help to build Tom Rockiki's dvips for TeX-FPC.
+
+Since KPSE does not blend with TeX-FPC, and CTAN only offers KPSE based
+versions of DVIPS, I downloaded the latest release from Stanford:
+ ftp ftp://ftp.cs.stanford.edu/pub/dvips/dvips576.tar.gz
+
+It unpacks in a directory dvips576. Edit Makefile from this directory
+to reflect the default resolution of your printer, the location
+of your binary and "man" directory.
+
+Copy the files afm2tfm.c, Makefile and MakeTeXPK to divps576/dvips/.
+
+See xdvi/README for hints on the man directory.
+
+Create a master directory DVIPSconf if you haven't done so already, goto
+dvips576/dvips, run mk_TeX_dir, mk_MF_dir, and make install.
+
+Edit DVIPSconf/config.ps to reflect paper size and resolution of
+your printer. To make dvips generate missing .pk fonts automatically,
+the resolutions in config.ps and in the mf mode "localfont" must
+agree.
+
+Hint: With an A4 papersize you might want to adjust the origin
+to 1in-3mm,1in+8.8m. This line in config.ps does that:
+O -3mm,8.8mm
+
+This will give you equal left and right margins with Plain TeX's
+predefined \hsize of 6.5in, and therefore the pagenumbers will line up
+nicely on two sided output.
+
+Enjoy,
+Wolfgang
diff --git a/systems/unix/tex-fpc/dvipsnk/afm2tfm.c b/systems/unix/tex-fpc/dvipsnk/afm2tfm.c
new file mode 100644
index 0000000000..7be24734a3
--- /dev/null
+++ b/systems/unix/tex-fpc/dvipsnk/afm2tfm.c
@@ -0,0 +1,1966 @@
+/*
+ * This program converts AFM files to TeX TFM files, and optionally
+ * to TeX VPL files that retain all kerning and ligature information.
+ * Both files make the characters not normally encoded by TeX available
+ * by character codes greater than 127.
+ */
+
+/* (Modified by Don Knuth from Tom Rokicki's pre-VPL version.) */
+/* VM/CMS port by J. Hafner (hafner@almaden.ibm.com), based on
+ * the port by Alessio Guglielmi (guglielmi@ipisnsib.bitnet)
+ * and Marco Prevedelli (prevedelli@ipisnsva.bitnet).
+ * This port is still in test state. No guarantees.
+ * 11/3/92: more corrections to VM/CMS port. Now it looks correct
+ * and will be supported by J. Hafner.
+ *
+ */
+/*
+ * More changes, primarily from Karl Berry, enough for a new version
+ * number to 8.0; 1 December 1996. Note that this version computes
+ * checksums differently (more intelligently).
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#if defined(SYSV) || defined(VMS) || defined(__THINK__) || defined(MSDOS) || defined(OS2) || defined(ATARIST)
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <math.h>
+#ifdef ATARIST
+#include <float.h>
+#endif
+
+/* JLH: added these to make the code easier to read and remove some
+ ascii<->ebcdic dependencies */
+#define ASCII_A 65
+#define ASCII_Z 90
+#define ASCII_a 97
+#define ASCII_z 122
+#define ASCII_0 48
+#define ASCII_9 57
+
+#ifdef VMCMS
+#define interesting lookstr /* for 8 character truncation conflicts */
+#include "dvipscms.h"
+extern FILE *cmsfopen() ;
+extern char ebcdic2ascii[] ;
+extern char ascii2ebcdic[] ;
+#ifdef fopen
+#undef fopen
+#endif
+#define fopen cmsfopen
+#endif
+
+#if defined MSDOS || defined OS2
+#define WRITEBIN "wb"
+#else
+#ifdef VMCMS
+#define WRITEBIN "wb, lrecl=1024, recfm=f"
+#else
+#define WRITEBIN "w"
+#endif
+#endif
+
+#if (defined(MSDOS) && defined(__TURBOC__)) || (defined(OS2) && defined(_MSC_VER))
+#define SMALLMALLOC
+#endif
+
+struct encoding {
+ char *name ;
+ char *vec[256] ;
+} ;
+struct encoding staticencoding = {
+ "TeX text",
+ {"Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi", "Sigma",
+ "Upsilon", "Phi", "Psi", "Omega", "arrowup", "arrowdown", "quotesingle",
+ "exclamdown", "questiondown", "dotlessi", "dotlessj", "grave", "acute",
+ "caron", "breve", "macron", "ring", "cedilla", "germandbls", "ae", "oe",
+ "oslash", "AE", "OE", "Oslash", "space", "exclam", "quotedbl", "numbersign",
+ "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright",
+ "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one",
+ "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon",
+ "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C",
+ "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
+ "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash",
+ "bracketright", "circumflex", "underscore", "quoteleft", "a", "b", "c", "d",
+ "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
+ "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright",
+ "tilde", "dieresis", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "" } } ;
+/*
+ * It's easier to put this in static storage and parse it as we go
+ * than to build the structures ourselves.
+ */
+char *staticligkern[] = {
+ "% LIGKERN space l =: lslash ; space L =: Lslash ;",
+ "% LIGKERN question quoteleft =: questiondown ;",
+ "% LIGKERN exclam quoteleft =: exclamdown ;",
+ "% LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ;",
+ "% LIGKERN quoteleft quoteleft =: quotedblleft ;",
+ "% LIGKERN quoteright quoteright =: quotedblright ;",
+ "% LIGKERN space {} * ; * {} space ; zero {} * ; * {} zero ;",
+ "% LIGKERN one {} * ; * {} one ; two {} * ; * {} two ;",
+ "% LIGKERN three {} * ; * {} three ; four {} * ; * {} four ;",
+ "% LIGKERN five {} * ; * {} five ; six {} * ; * {} six ;",
+ "% LIGKERN seven {} * ; * {} seven ; eight {} * ; * {} eight ;",
+ "% LIGKERN nine {} * ; * {} nine ;",
+/* Kern accented characters the same way as their base. */
+ "% LIGKERN Aacute <> A ; aacute <> a ;",
+ "% LIGKERN Acircumflex <> A ; acircumflex <> a ;",
+ "% LIGKERN Adieresis <> A ; adieresis <> a ;",
+ "% LIGKERN Agrave <> A ; agrave <> a ;",
+ "% LIGKERN Aring <> A ; aring <> a ;",
+ "% LIGKERN Atilde <> A ; atilde <> a ;",
+ "% LIGKERN Ccedilla <> C ; ccedilla <> c ;",
+ "% LIGKERN Eacute <> E ; eacute <> e ;",
+ "% LIGKERN Ecircumflex <> E ; ecircumflex <> e ;",
+ "% LIGKERN Edieresis <> E ; edieresis <> e ;",
+ "% LIGKERN Egrave <> E ; egrave <> e ;",
+ "% LIGKERN Iacute <> I ; iacute <> i ;",
+ "% LIGKERN Icircumflex <> I ; icircumflex <> i ;",
+ "% LIGKERN Idieresis <> I ; idieresis <> i ;",
+ "% LIGKERN Igrave <> I ; igrave <> i ;",
+ "% LIGKERN Ntilde <> N ; ntilde <> n ;",
+ "% LIGKERN Oacute <> O ; oacute <> o ;",
+ "% LIGKERN Ocircumflex <> O ; ocircumflex <> o ;",
+ "% LIGKERN Odieresis <> O ; odieresis <> o ;",
+ "% LIGKERN Ograve <> O ; ograve <> o ;",
+ "% LIGKERN Oslash <> O ; oslash <> o ;",
+ "% LIGKERN Otilde <> O ; otilde <> o ;",
+ "% LIGKERN Scaron <> S ; scaron <> s ;",
+ "% LIGKERN Uacute <> U ; uacute <> u ;",
+ "% LIGKERN Ucircumflex <> U ; ucircumflex <> u ;",
+ "% LIGKERN Udieresis <> U ; udieresis <> u ;",
+ "% LIGKERN Ugrave <> U ; ugrave <> u ;",
+ "% LIGKERN Yacute <> Y ; yacute <> y ;",
+ "% LIGKERN Ydieresis <> Y ; ydieresis <> y ;",
+ "% LIGKERN Zcaron <> Z ; zcaron <> z ;",
+/*
+ * These next are only included for deficient afm files that
+ * have the lig characters but not the lig commands.
+ */
+ "% LIGKERN f i =: fi ; f l =: fl ; f f =: ff ; ff i =: ffi ;",
+ "% LIGKERN ff l =: ffl ;",
+ 0 } ;
+/*
+ * The above layout corresponds to TeX Typewriter Type and is compatible
+ * with TeX Text because the position of ligatures is immaterial.
+ */
+struct encoding *outencoding = 0 ;
+struct encoding *inencoding = 0 ;
+char *outenname, *inenname ;/* the file names for input and output encodings */
+int boundarychar = -1 ; /* the boundary character */
+int ignoreligkern ; /* do we look at ligkern info in the encoding? */
+/*
+ * This is what we store Adobe data in.
+ */
+struct adobeinfo {
+ struct adobeinfo *next ;
+ int adobenum, texnum, width ;
+ char *adobename ;
+ int llx, lly, urx, ury ;
+ struct lig *ligs ;
+ struct kern *kerns ;
+ struct adobeptr *kern_equivs ;
+ struct pcc *pccs ;
+ int wptr, hptr, dptr, iptr ;
+} *adobechars, *adobeptrs[256], *texptrs[256],
+ *uppercase[256], *lowercase[256] ;
+int nexttex[256] ; /* for characters encoded multiple times in output */
+/*
+ * These are the eight ligature ops, in VPL terms and in METAFONT terms.
+ */
+char *vplligops[] = {
+ "LIG", "/LIG", "/LIG>", "LIG/", "LIG/>", "/LIG/", "/LIG/>", "/LIG/>>", 0
+} ;
+char *encligops[] = {
+ "=:", "|=:", "|=:>", "=:|", "=:|>", "|=:|", "|=:|>", "|=:|>>", 0
+} ;
+struct lig {
+ struct lig *next ;
+ char *succ, *sub ;
+ short op, boundleft ;
+} ;
+struct kern {
+ struct kern *next ;
+ char *succ ;
+ int delta ;
+} ;
+struct adobeptr {
+ struct adobeptr *next;
+ struct adobeinfo *ch;
+};
+struct pcc {
+ struct pcc *next ;
+ char * partname ;
+ int xoffset, yoffset ;
+} ;
+
+FILE *afmin, *vplout, *tfmout ;
+char inname[200], outname[200] ; /* names of input and output files */
+char buffer[255]; /* input buffer (modified while parsing) */
+char obuffer[255] ; /* unmodified copy of input buffer */
+char *param ; /* current position in input buffer */
+char *fontname = "Unknown" ;
+char *codingscheme = "Unspecified" ;
+#ifdef VMCMS
+char *ebfontname ;
+char *ebcodingscheme ;
+#endif
+float italicangle = 0.0 ;
+char fixedpitch ;
+char makevpl ;
+char pedantic ;
+int xheight = 400 ;
+int fontspace ;
+int bc, ec ;
+long cksum ;
+float efactor = 1.0, slant = 0.0 ;
+float capheight = 0.8 ;
+char *efactorparam, *slantparam ;
+double newslant ;
+char titlebuf[500] ;
+
+void
+error(s)
+register char *s ;
+{
+ (void)fprintf(stderr, "%s\n", s) ;
+ if (obuffer[0]) {
+ (void)fprintf(stderr, "%s\n", obuffer) ;
+ while (param > buffer) {
+ (void)fprintf(stderr, " ") ;
+ param-- ;
+ }
+ (void)fprintf(stderr, "^\n") ;
+ }
+ if (*s == '!')
+ exit(1) ;
+}
+
+int
+transform(x,y)
+ register int x,y ;
+{
+ register double acc ;
+ acc = efactor * x + slant *y ;
+ return (int)(acc>=0? floor(acc+0.5) : ceil(acc-0.5) ) ;
+}
+
+int
+gaetline() {
+ register char *p ;
+ register int c ;
+
+ param = buffer ;
+ for (p=buffer; (c=getc(afmin)) != EOF && c != '\n';)/* changed 10 to '\n' */
+ *p++ = c ;
+ *p = 0 ;
+ (void)strcpy(obuffer, buffer) ;
+ if (p == buffer && c == EOF)
+ return(0) ;
+ else
+ return(1) ;
+}
+
+char *interesting[] = { "FontName", "ItalicAngle", "IsFixedPitch",
+ "XHeight", "C", "KPX", "CC", "EncodingScheme", NULL} ;
+#define FontName (0)
+#define ItalicAngle (1)
+#define IsFixedPitch (2)
+#define XHeight (3)
+#define C (4)
+#define KPX (5)
+#define CC (6)
+#define EncodingScheme (7)
+#define NONE (-1)
+int
+interest(s)
+char *s ;
+{
+ register char **p ;
+ register int n ;
+
+ for (p=interesting, n=0; *p; p++, n++)
+ if (strcmp(s, *p)==0)
+ return(n) ;
+ return(NONE) ;
+}
+
+char *
+mymalloc(len)
+unsigned long len ;
+{
+ register char *p ;
+ int i ;
+
+#ifdef SMALLMALLOC
+ if (len > 65500L)
+ error("! can't allocate more than 64K!") ;
+#endif
+ p = malloc((unsigned)len) ;
+ if (p==NULL)
+ error("! out of memory") ;
+ for (i=0; i<len; i++)
+ p[i] = 0 ;
+ return(p) ;
+}
+
+char *
+newstring(s)
+char *s ;
+{
+ char *q = mymalloc((unsigned long)(strlen(s) + 1)) ;
+ (void)strcpy(q, s) ;
+ return q ;
+}
+
+char *
+paramnewstring() {
+ register char *p, *q ;
+
+ p = param ;
+ while (*p > ' ')
+ p++ ;
+ if (*p != 0)
+ *p++ = 0 ;
+ q = newstring(param) ;
+ while (*p && *p <= ' ')
+ p++ ;
+ param = p ;
+ return(q) ;
+}
+
+char *
+paramstring() {
+ register char *p, *q ;
+
+ p = param ;
+ while (*p > ' ')
+ p++ ;
+ q = param ;
+ if (*p != 0)
+ *p++ = 0 ;
+ while (*p && *p <= ' ')
+ p++ ;
+ param = p ;
+ return(q) ;
+}
+
+int
+paramnum() {
+ register char *p ;
+ int i ;
+
+ p = paramstring() ;
+ if (sscanf(p, "%d", &i) != 1)
+ error("! integer expected") ;
+ return(i) ;
+}
+
+float
+paramfloat() {
+ register char *p ;
+ float i ;
+
+ p = paramstring() ;
+ if (sscanf(p, "%f", &i) != 1)
+ error("! number expected") ;
+ return(i) ;
+}
+
+struct adobeinfo *
+newchar() {
+ register struct adobeinfo *ai ;
+
+ ai = (struct adobeinfo *)mymalloc((unsigned long)sizeof(struct adobeinfo)) ;
+ ai->adobenum = -1 ;
+ ai->texnum = -1 ;
+ ai->width = -1 ;
+ ai->adobename = NULL ;
+ ai->llx = -1 ;
+ ai->lly = -1 ;
+ ai->urx = -1 ;
+ ai->ury = -1 ;
+ ai->ligs = NULL ;
+ ai->kerns = NULL ;
+ ai->kern_equivs = NULL ;
+ ai->pccs = NULL ;
+ ai->next = adobechars ;
+ adobechars = ai ;
+ return(ai) ;
+}
+
+struct kern *
+newkern() {
+ register struct kern *nk ;
+
+ nk = (struct kern *)mymalloc((unsigned long)sizeof(struct kern)) ;
+ nk->next = NULL ;
+ nk->succ = NULL ;
+ nk->delta = 0 ;
+ return(nk) ;
+}
+
+struct pcc *
+newpcc() {
+ register struct pcc *np ;
+
+ np = (struct pcc *)mymalloc((unsigned long)sizeof(struct pcc)) ;
+ np->next = NULL ;
+ np->partname = NULL ;
+ np->xoffset = 0 ;
+ np->yoffset = 0 ;
+ return(np) ;
+}
+
+struct lig *
+newlig() {
+ register struct lig *nl ;
+
+ nl = (struct lig *)mymalloc((unsigned long)sizeof(struct lig)) ;
+ nl->next = NULL ;
+ nl->succ = NULL ;
+ nl->sub = NULL ;
+ nl->op = 0 ; /* the default =: op */
+ nl->boundleft = 0 ;
+ return(nl) ;
+}
+
+void
+expect(s)
+char *s ;
+{
+ if (strcmp(paramstring(), s) != 0) {
+ (void)fprintf(stderr, "%s expected: ", s) ;
+ error("! syntax error") ;
+ }
+}
+
+void
+handlechar() { /* an input line beginning with C */
+ register struct adobeinfo *ai ;
+ register struct lig *nl ;
+
+ ai = newchar() ;
+ ai->adobenum = paramnum() ;
+ expect(";") ;
+ expect("WX") ;
+ ai->width = transform(paramnum(),0) ;
+ if (ai->adobenum >= 0 && ai->adobenum < 256) {
+ adobeptrs[ai->adobenum] = ai ;
+ }
+ expect(";") ;
+ expect("N") ;
+ ai->adobename = paramnewstring() ;
+ expect(";") ;
+ expect("B") ;
+ ai->llx = paramnum() ;
+ ai->lly = paramnum() ;
+ ai->llx = transform(ai->llx, ai->lly) ;
+ ai->urx = paramnum() ;
+ ai->ury = paramnum() ;
+ ai->urx = transform(ai->urx, ai->ury) ;
+/* We need to avoid negative heights or depths. They break accents in
+ math mode, among other things. */
+ if (ai->lly > 0)
+ ai->lly = 0 ;
+ if (ai->ury < 0)
+ ai->ury = 0 ;
+ expect(";") ;
+/* Now look for ligatures (which aren't present in fixedpitch fonts) */
+ while (*param == 'L' && !fixedpitch) {
+ expect("L") ;
+ nl = newlig() ;
+ nl->succ = paramnewstring() ;
+ nl->sub = paramnewstring() ;
+ nl->next = ai->ligs ;
+ ai->ligs = nl ;
+ expect(";") ;
+ }
+}
+
+struct adobeinfo *
+findadobe(p)
+char *p ;
+{
+ register struct adobeinfo *ai ;
+
+ for (ai=adobechars; ai; ai = ai->next)
+ if (strcmp(p, ai->adobename)==0)
+ return(ai) ;
+ return(NULL) ;
+}
+
+
+/*
+ * The following comment no longer applies; we rely on the LIGKERN
+ * entries to kill space kerns. Also, the same applies to numbers.
+ *
+ * We ignore kerns before and after space characters, because (1) TeX
+ * is using the space only for Polish ligatures, and (2) TeX's
+ * boundarychar mechanisms are not oriented to kerns (they apply
+ * to both spaces and punctuation) so we don't want to use them.
+ */
+void
+handlekern() { /* an input line beginning with KPX */
+ register struct adobeinfo *ai ;
+ register char *p ;
+ register struct kern *nk ;
+
+ p = paramstring() ;
+ ai = findadobe(p) ;
+ if (ai == NULL)
+ error("kern char not found") ;
+ else {
+ nk = newkern() ;
+ nk->succ = paramnewstring() ;
+ nk->delta = transform(paramnum(),0) ;
+ nk->next = ai->kerns ;
+ ai->kerns = nk ;
+ }
+}
+
+void
+handleconstruct() { /* an input line beginning with CC */
+ register struct adobeinfo *ai ;
+ register char *p ;
+ register struct pcc *np ;
+ register int n ;
+ struct pcc *npp = NULL;
+
+ p = paramstring() ;
+ ai = findadobe(p) ;
+ if (ai == NULL)
+ error("! composite character name not found") ;
+ n = paramnum() ;
+ expect(";") ;
+ while (n--) {
+ if (strcmp(paramstring(),"PCC") != 0) return ;
+ /* maybe I should expect("PCC") instead, but I'm playing it safe */
+ np = newpcc() ;
+ np->partname = paramnewstring() ;
+ if (findadobe(np->partname)==NULL) return ;
+ np->xoffset = paramnum() ;
+ np->yoffset = paramnum() ;
+ np->xoffset = transform(np->xoffset, np->yoffset) ;
+ if (npp) npp->next = np ;
+ else ai->pccs = np ;
+ npp = np ;
+ expect(";") ;
+ }
+}
+
+struct encoding *readencoding() ;
+
+void
+makeaccentligs() {
+ register struct adobeinfo *ai, *aci ;
+ register char *p ;
+ register struct lig *nl ;
+ for (ai=adobechars; ai; ai=ai->next) {
+ p = ai->adobename ;
+ if (strlen(p)>2)
+ if ((aci=findadobe(p+1)) && (aci->adobenum > 127)) {
+ nl = newlig() ;
+ nl->succ = mymalloc((unsigned long)2) ;
+ *(nl->succ + 1) = 0 ;
+ *(nl->succ) = *p ;
+ nl->sub = ai->adobename ;
+ nl->next = aci->ligs ;
+ aci->ligs = nl ;
+ }
+ }
+}
+
+void
+readadobe() {
+ struct adobeinfo *ai ;
+#ifdef VMCMS
+ int i;
+#endif
+
+/*
+ * We allocate a placeholder boundary char.
+ */
+ ai = newchar() ;
+ ai->adobenum = -1 ;
+ ai->adobename = "||" ; /* boundary character name */
+ while (gaetline()) {
+ switch(interest(paramstring())) {
+case FontName:
+ fontname = paramnewstring() ;
+#ifdef VMCMS
+/* fontname comes in as ebcdic but we need it asciified for tfm file
+ so we save it in ebfontname and change it in fontname */
+ ebfontname = newstring(fontname) ;
+ i=0;
+ while(fontname[i] != '\0') {
+ fontname[i]=ebcdic2ascii[fontname[i]];
+ i++;
+ };
+#endif
+ break ;
+case EncodingScheme:
+ codingscheme = paramnewstring() ;
+#ifdef VMCMS
+/* for codingscheme, we do the same as we did for fontname */
+ ebcodingscheme = newstring(codingscheme) ;
+ i=0;
+ while(codingscheme[i] != '\0') {
+ codingscheme[i]=ebcdic2ascii[codingscheme[i]];
+ i++;
+ }
+#endif
+ break ;
+case ItalicAngle:
+ italicangle = paramfloat() ;
+ break ;
+case IsFixedPitch:
+ if (*param == 't' || *param == 'T')
+ fixedpitch = 1 ;
+ else
+ fixedpitch = 0 ;
+ break ;
+case XHeight:
+ xheight = paramnum() ;
+ break ;
+case C:
+ handlechar() ;
+ break ;
+case KPX:
+ handlekern() ;
+ break ;
+case CC:
+ handleconstruct() ;
+ break ;
+default:
+ break ;
+ }
+ }
+ fclose(afmin) ;
+ afmin = 0 ;
+}
+/*
+ * Re-encode the adobe font. Assumes that the header file will
+ * also contain the appropriate instructions!
+ */
+void
+handlereencoding() {
+ if (inenname) {
+ int i ;
+ struct adobeinfo *ai ;
+ char *p ;
+
+ ignoreligkern = 1 ;
+ inencoding = readencoding(inenname) ;
+ for (i=0; i<256; i++)
+ if (0 != (ai=adobeptrs[i])) {
+ ai->adobenum = -1 ;
+ adobeptrs[i] = NULL ;
+ }
+ for (i=0; i<256; i++) {
+ p = inencoding->vec[i] ;
+ if (p && *p && 0 != (ai = findadobe(p))) {
+ ai->adobenum = i ;
+ adobeptrs[i] = ai ;
+ }
+ }
+ codingscheme = inencoding->name ;
+ }
+ ignoreligkern = 0 ;
+ if (outenname) {
+ outencoding = readencoding(outenname) ;
+ } else {
+ outencoding = readencoding((char *)0) ;
+ }
+}
+
+/*
+ * This routine reverses a list. We use it because we accumulate the
+ * adobeinfo list in reverse order, but when we go to map the
+ * characters, we would prefer to use the original ordering. It just
+ * makes more sense.
+ */
+struct adobeinfo *revlist(p)
+struct adobeinfo *p ;
+{
+ struct adobeinfo *q = 0, *t ;
+
+ while (p) {
+ t = p->next ;
+ p->next = q ;
+ q = p ;
+ p = t ;
+ }
+ return q ;
+}
+
+void
+assignchars() {
+ register char **p ;
+ register int i, j ;
+ register struct adobeinfo *ai, *pai ;
+ int nextfree = 128 ;
+ struct pcc *pcp ;
+
+/*
+ * First, we assign all those that match perfectly.
+ */
+ for (i=0, p=outencoding->vec; i<256; i++, p++)
+ if ((ai=findadobe(*p)) && (ai->adobenum >= 0 || ai->pccs != NULL)) {
+ if (ai->texnum >= 0)
+ nexttex[i] = ai->texnum ; /* linked list */
+ ai->texnum = i ;
+ texptrs[i] = ai ;
+ }
+ if (pedantic)
+ return ;
+/*
+ * Next, we assign all the others, retaining the adobe positions, possibly
+ * multiply assigning characters. Unless the output encoding was
+ * precisely specified.
+ */
+ for (ai=adobechars; ai; ai=ai->next)
+ if (ai->adobenum >= 0 && ai->texnum < 0 && texptrs[ai->adobenum]==0) {
+ ai->texnum = ai->adobenum ;
+ texptrs[ai->adobenum] = ai ;
+ }
+/*
+ * Finally, we map all remaining characters into free locations beginning
+ * with 128, if we know how to construct those characters. We need to
+ * make sure the component pieces are mapped.
+ */
+ adobechars = revlist(adobechars) ;
+ for (ai=adobechars; ai; ai=ai->next)
+ if (ai->texnum<0 && (ai->adobenum>=0 || ai->pccs != NULL)) {
+ while (texptrs[nextfree]) {
+ nextfree=(nextfree+1)&255 ;
+ if (nextfree==128) goto finishup ; /* all slots full */
+ }
+ ai->texnum = nextfree ;
+ texptrs[nextfree] = ai ;
+ }
+finishup:
+/*
+ * We now check all of the composite characters. If any of the
+ * components are not mapped, we unmap the composite character.
+ */
+ for (i=0; i<256; i++) {
+ ai = texptrs[i] ;
+ if (ai && ai->pccs != NULL && ai->texnum >= 0) {
+ for (pcp = ai->pccs; pcp; pcp = pcp->next) {
+ pai = findadobe(pcp->partname) ;
+ if (pai == NULL || pai->texnum < 0) {
+ texptrs[ai->texnum] = 0 ;
+ ai->texnum = -1 ;
+ break ;
+ }
+ }
+ }
+ }
+/*
+ * Now, if any of the characters are encoded multiple times, we want
+ * ai->texnum to be the first one assigned, since that is most likely
+ * to be the most important one. So we reverse the above lists.
+ */
+ for (ai=adobechars; ai; ai=ai->next)
+ if (ai->texnum >= 0 && ai->texnum < 256) {
+ j = -1 ;
+ while (nexttex[ai->texnum] >= 0) {
+ i = nexttex[ai->texnum] ;
+ nexttex[ai->texnum] = j ;
+ j = ai->texnum ;
+ ai->texnum = i ;
+ }
+ nexttex[ai->texnum] = j ;
+ }
+}
+
+void
+upmap() { /* Compute uppercase mapping, when making a small caps font */
+ register struct adobeinfo *ai, *Ai ;
+ register char *p, *q ;
+ register struct pcc *np, *nq ;
+ int i ;
+ char lwr[50] ;
+
+/* JLH: changed some lines below to be ascii<->ebcdic independent
+ any reason we don't use 'isupper'?.
+ Looks like we should use isupper to me --karl. */
+ for (Ai=adobechars; Ai; Ai=Ai->next) {
+ p = Ai->adobename ;
+ if (isupper (*p)) {
+ q = lwr ;
+ for (; *p; p++)
+ *q++ = tolower (*p);
+ *q = '\0'; /* changed this too! */
+
+ if (0 != (ai=findadobe(lwr))) {
+ for (i = ai->texnum; i >= 0; i = nexttex[i])
+ uppercase[i] = Ai ;
+ for (i = Ai->texnum; i >= 0; i = nexttex[i])
+ lowercase[i] = ai ;
+ }
+ }
+ }
+/* Note that, contrary to the normal true/false conventions,
+ * uppercase[i] is NULL and lowercase[i] is non-NULL when i is the
+ * ASCII code of an uppercase letter; and vice versa for lowercase letters */
+
+ if (0 != (ai=findadobe("germandbls")))
+ if (0 != (Ai=findadobe("S"))) { /* we also construct SS */
+ for (i=ai->texnum; i >= 0; i = nexttex[i])
+ uppercase[i] = ai ;
+ ai->adobenum = -1 ;
+ ai->width = Ai->width << 1 ;
+ ai->llx = Ai->llx ;
+ ai->lly = Ai->lly ;
+ ai->urx = Ai->width + Ai->urx ;
+ ai->ury = Ai->ury ;
+ ai->kerns = Ai->kerns ;
+ np = newpcc() ;
+ np->partname = "S" ;
+ nq = newpcc() ;
+ nq->partname = "S" ;
+ nq->xoffset = Ai->width ;
+ np->next = nq ;
+ ai->pccs = np ;
+ }
+ if ((ai=findadobe("dotlessi")))
+ for (i=ai->texnum; i >= 0; i = nexttex[i])
+ uppercase[i] = findadobe("I") ;
+ if ((ai=findadobe("dotlessj")))
+ for (i=ai->texnum; i >= 0; i = nexttex[i])
+ uppercase[i] = findadobe("J") ;
+}
+/* The logic above seems to work well enough, but it leaves useless characters
+ * like `fi' and `fl' in the font if they were present initially,
+ * and it omits characters like `dotlessj' if they are absent initially */
+
+/* Now we turn to computing the TFM file */
+
+int lf, lh, nw, nh, nd, ni, nl, nk, ne, np ;
+
+void
+write16(what)
+register short what ;
+{
+ (void)fputc(what >> 8, tfmout) ;
+ (void)fputc(what & 255, tfmout) ;
+}
+
+void
+writearr(p, n)
+register long *p ;
+register int n ;
+{
+ while (n) {
+ write16((short)(*p >> 16)) ;
+ write16((short)(*p & 65535)) ;
+ p++ ;
+ n-- ;
+ }
+}
+
+void
+makebcpl(p, s, n)
+register long *p ;
+register char *s ;
+register int n ;
+{
+ register long t ;
+ register long sc ;
+
+ if (strlen(s) < n)
+ n = strlen(s) ;
+ t = ((long)n) << 24 ;
+ sc = 16 ;
+ while (n > 0) {
+ t |= ((long)(*(unsigned char *)s++)) << sc ;
+ sc -= 8 ;
+ if (sc < 0) {
+ *p++ = t ;
+ t = 0 ;
+ sc = 24 ;
+ }
+ n-- ;
+ }
+ *p++ = t ;
+}
+
+int source[257] ;
+int unsort[257] ;
+
+/*
+ * Next we need a routine to reduce the number of distinct dimensions
+ * in a TFM file. Given an array what[0]...what[oldn-1], we want to
+ * group its elements into newn clusters, in such a way that the maximum
+ * difference between elements of a cluster is as small as possible.
+ * Furthermore, what[0]=0, and this value must remain in a cluster by
+ * itself. Data such as `0 4 6 7 9' with newn=3 shows that an iterative
+ * scheme in which 6 is first clustered with 7 will not work. So we
+ * borrow a neat algorithm from METAFONT to find the true optimum.
+ * Memory location what[oldn] is set to 0x7fffffffL for convenience.
+ */
+long nextd ; /* smallest value that will give a different mincover */
+int
+mincover(what,d) /* tells how many clusters result, given max difference d */
+register long d ;
+long *what ;
+{
+ register int m ;
+ register long l ;
+ register long *p ;
+
+ nextd = 0x7fffffffL ;
+ p = what+1 ;
+ m = 1 ;
+ while (*p<0x7fffffffL) {
+ m++ ;
+ l = *p ;
+ while (*++p <= l+d) ;
+ if (*p-l < nextd) nextd = *p-l ;
+ }
+ return (m) ;
+}
+
+void
+remap(what, oldn, newn)
+long *what ;
+int oldn, newn ;
+{
+ register int i, j ;
+ register long d, l ;
+
+ what[oldn] = 0x7fffffffL ;
+ for (i=oldn-1; i>0; i--) {
+ d = what[i] ;
+ for (j=i; what[j+1]<d; j++) {
+ what[j] = what[j+1] ;
+ source[j] = source[j+1] ;
+ }
+ what[j] = d ;
+ source[j] = i ;
+ } /* Tom, don't let me ever catch you using bubblesort again! -- Don */
+
+ i = mincover(what, 0L) ;
+ d = nextd ;
+ while (mincover(what,d+d)>newn) d += d ;
+ while (mincover(what,d)>newn) d = nextd ;
+
+ i = 1 ;
+ j = 0 ;
+ while (i<oldn) {
+ j++ ;
+ l = what[i] ;
+ unsort[source[i]] = j ;
+ while (what[++i] <= l+d) {
+ unsort[source[i]] = j ;
+ if (i-j == oldn-newn) d = 0 ;
+ }
+ what[j] = (l+what[i-1])/2 ;
+ }
+}
+
+long checksum() {
+ int i ;
+ unsigned long s1 = 0, s2 = 0 ;
+ char *p ;
+ struct adobeinfo *ai ;
+
+ for (i=0; i<256; i++)
+ if (0 != (ai=adobeptrs[i])) {
+ s1 = ((s1 << 1) ^ (s1>>31)) ^ ai->width ; /* cyclic left shift */
+ s1 &= 0xffffffff; /* in case we're on a 64-bit machine */
+ for (p=ai->adobename; *p; p++)
+#ifndef VMCMS
+ s2 = (s2 * 3) + *p ;
+#else
+ s2 = (s2 * 3) + ebcdic2ascii[*p] ;
+#endif
+ }
+ s1 = (s1 << 1) ^ s2 ;
+ return s1 ;
+}
+
+/*
+ * The next routine simply scales something.
+ * Input is in 1000ths of an em. Output is in FIXFACTORths of 1000.
+ */
+#define FIXFACTOR (0x100000L) /* 2^{20}, the unit fixnum */
+long
+scale(what)
+long what ;
+{
+ return(((what / 1000) << 20) +
+ (((what % 1000) << 20) + 500) / 1000) ;
+}
+
+long *header, *charinfo, *width, *height, *depth, *ligkern, *kern, *tparam,
+ *italic ;
+long *tfmdata ;
+
+void
+buildtfm() {
+ register int i, j ;
+ register struct adobeinfo *ai ;
+
+ header = tfmdata ;
+ cksum = checksum() ;
+ header[0] = cksum ;
+ header[1] = 0xa00000 ; /* 10pt design size */
+ makebcpl(header+2, codingscheme, 39) ;
+ makebcpl(header+12, fontname, 19) ;
+ lh = 17 ;
+ charinfo = header + lh ;
+
+ for (i=0; i<256 && adobeptrs[i]==NULL; i++) ;
+ bc = i ;
+ for (i=255; i>=0 && adobeptrs[i]==NULL; i--) ;
+ ec = i;
+ if (ec < bc)
+ error("! no Adobe characters") ;
+
+ width = charinfo + (ec - bc + 1) ;
+ width[0] = 0 ;
+ nw++ ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i])) {
+ width[nw]=ai->width ;
+ for (j=1; width[j]!=ai->width; j++) ;
+ ai->wptr = j ;
+ if (j==nw)
+ nw++ ;
+ }
+ if (nw>256)
+ error("! 256 chars with different widths") ;
+ depth = width + nw ;
+ depth[0] = 0 ;
+ nd = 1 ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i])) {
+ depth[nd] = -ai->lly ;
+ for (j=0; depth[j]!=-ai->lly; j++) ;
+ ai->dptr = j ;
+ if (j==nd)
+ nd++ ;
+ }
+ if (nd > 16) {
+ remap(depth, nd, 16) ;
+ nd = 16 ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i]))
+ ai->dptr = unsort[ai->dptr] ;
+ }
+ height = depth + nd ;
+ height[0] = 0 ;
+ nh = 1 ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i])) {
+ height[nh]=ai->ury ;
+ for (j=0; height[j]!=ai->ury; j++) ;
+ ai->hptr = j ;
+ if (j==nh)
+ nh++ ;
+ }
+ if (nh > 16) {
+ remap(height, nh, 16) ;
+ nh = 16 ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i]))
+ ai->hptr = unsort[ai->hptr] ;
+ }
+ italic = height + nh ;
+ italic[0] = 0 ;
+ ni = 1 ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i])) {
+ italic[ni] = ai->urx - ai->width ;
+ if (italic[ni]<0)
+ italic[ni] = 0 ;
+ for (j=0; italic[j]!=italic[ni]; j++) ;
+ ai->iptr = j ;
+ if (j==ni)
+ ni++ ;
+ }
+ if (ni > 64) {
+ remap(italic, ni, 64) ;
+ ni = 64 ;
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i]))
+ ai->iptr = unsort[ai->iptr] ;
+ }
+
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=adobeptrs[i]))
+ charinfo[i-bc] = ((long)(ai->wptr)<<24) +
+ ((long)(ai->hptr)<<20) +
+ ((long)(ai->dptr)<<16) +
+ ((long)(ai->iptr)<<10) ;
+
+ ligkern = italic + ni ;
+ nl = 0 ; /* ligatures and kerns omitted from raw Adobe font */
+ kern = ligkern + nl ;
+ nk = 0 ;
+
+ newslant = (double)slant - efactor * tan(italicangle*(3.1415926535/180.0)) ;
+ tparam = kern + nk ;
+ tparam[0] = (long)(FIXFACTOR * newslant + 0.5) ;
+ tparam[1] = scale((long)fontspace) ;
+ tparam[2] = (fixedpitch ? 0 : scale((long)(300*efactor+0.5))) ;
+ tparam[3] = (fixedpitch ? 0 : scale((long)(100*efactor+0.5))) ;
+ tparam[4] = scale((long)xheight) ;
+ tparam[5] = scale((long)(1000*efactor+0.5)) ;
+ np = 6 ;
+}
+
+void
+writesarr(what, len)
+long *what ;
+int len ;
+{
+ register long *p ;
+ int i ;
+
+ p = what ;
+ i = len ;
+ while (i) {
+ *p = scale(*p) ;
+ (void)scale(*p) ; /* need this kludge for some compilers */
+ p++ ;
+ i-- ;
+ }
+ writearr(what, len) ;
+}
+
+void
+writetfm() {
+ lf = 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np ;
+ write16(lf) ;
+ write16(lh) ;
+ write16(bc) ;
+ write16(ec) ;
+ write16(nw) ;
+ write16(nh) ;
+ write16(nd) ;
+ write16(ni) ;
+ write16(nl) ;
+ write16(nk) ;
+ write16(ne) ;
+ write16(np) ;
+ writearr(header, lh) ;
+ writearr(charinfo, ec-bc+1) ;
+ writesarr(width, nw) ;
+ writesarr(height, nh) ;
+ writesarr(depth, nd) ;
+ writesarr(italic, ni) ;
+ writearr(ligkern, nl) ;
+ writesarr(kern, nk) ;
+ writearr(tparam, np) ;
+}
+
+/* OK, the TFM file is done! Now for our next trick, the VPL file. */
+
+/* For TeX we want to compute a character height that works properly
+ * with accents. The following list of accents doesn't need to be complete. */
+/*
+ * We only do this if the xheight has a reasonable value.
+ * (>50)
+ */
+char *accents[] = { "acute", "tilde", "caron", "dieresis", NULL} ;
+int
+texheight(ai)
+register struct adobeinfo *ai ;
+{
+ register char **p;
+ register struct adobeinfo *aci, *acci ;
+ if (xheight <= 50 || *(ai->adobename + 1)) return (ai->ury) ;
+ /* that was the simple case */
+ for (p=accents; *p; p++) /* otherwise we look for accented letters */
+ if (0 != (aci=findadobe(*p))) {
+ strcpy(buffer,ai->adobename) ;
+ strcat(buffer,*p) ;
+ if (0 != (acci=findadobe(buffer)))
+ return (acci->ury - aci->ury + xheight) ;
+ }
+ return (ai->ury) ;
+}
+
+/* modified tgr to eliminate varargs problems */
+
+#define vout(s) fprintf(vplout, s)
+int level ; /* the depth of parenthesis nesting in VPL file being written */
+void vlevout() {
+ register int l = level ;
+ while (l--) vout(" ") ;
+}
+void vlevnlout() {
+ vout("\n") ;
+ vlevout() ;
+}
+#define voutln(str) {fprintf(vplout,"%s\n",str);vlevout();}
+#define voutln2(f,s) {fprintf(vplout,f,s);vlevnlout();}
+#define voutln3(f,a,b) {fprintf(vplout,f,a,b);vlevnlout();}
+#define voutln4(f,a,b,c) {fprintf(vplout,f,a,b,c);vlevnlout();}
+void
+vleft()
+{
+ level++ ;
+ vout("(") ;
+}
+
+void
+vright()
+{
+ level-- ;
+ voutln(")") ;
+}
+
+int forceoctal = 0 ;
+
+char vcharbuf[6] ;
+char *vchar(c)
+int c ;
+{
+ if (forceoctal == 0 && isalnum (c))
+ (void) sprintf(vcharbuf,"C %c",
+#ifndef VMCMS
+ c) ;
+#else
+ ascii2ebcdic[c]) ;
+#endif
+ else (void) sprintf(vcharbuf,"O %o", (unsigned)c) ;
+ return (vcharbuf) ;
+}
+
+char vnamebuf[100];
+char *vname (c)
+int c;
+{
+ if (!forceoctal && isalnum (c)) {
+ vnamebuf[0] = 0;
+ } else {
+ sprintf (vnamebuf, " (comment %s)", texptrs[c]->adobename);
+ }
+ return vnamebuf;
+}
+
+void
+writevpl()
+{
+ register int i, j, k ;
+ register struct adobeinfo *ai ;
+ register struct lig *nlig ;
+ register struct kern *nkern ;
+ register struct pcc *npcc ;
+ struct adobeinfo *asucc, *asub, *api ;
+ struct adobeptr *kern_eq;
+ int xoff, yoff, ht ;
+ char unlabeled ;
+
+ voutln2("(VTITLE Created by %s)", titlebuf) ;
+ voutln("(COMMENT Please edit that VTITLE if you edit this file)") ;
+ (void)sprintf(obuffer, "TeX-%s%s%s%s", outname,
+ (efactor==1.0? "" : "-E"), (slant==0.0? "" : "-S"),
+ (makevpl==1? "" : "-CSC")) ;
+ if (strlen(obuffer)>19) { /* too long, will retain first 9 and last 10 */
+ register char *p, *q ;
+ for (p = &obuffer[9], q = &obuffer[strlen(obuffer)-10] ; p<&obuffer[19];
+ p++, q++) *p = *q ;
+ obuffer[19] = '\0' ;
+ }
+ voutln2("(FAMILY %s)" , obuffer) ;
+ {
+ char tbuf[300] ;
+ char *base_encoding =
+#ifndef VMCMS
+ codingscheme ;
+#else
+ ebcodingscheme ;
+#endif
+
+ if (strcmp (outencoding->name, base_encoding) == 0) {
+ sprintf(tbuf, "%s", outencoding->name);
+ } else {
+ sprintf(tbuf, "%s + %s", base_encoding, outencoding->name);
+ }
+
+ if (strlen(tbuf) > 39) {
+ error("Coding scheme too long; shortening to 39 characters.") ;
+ tbuf[39] = 0 ;
+ }
+ voutln2("(CODINGSCHEME %s)", tbuf) ;
+ }
+ voutln("(DESIGNSIZE R 10.0)") ;
+ voutln("(DESIGNUNITS R 1000)") ;
+ voutln("(COMMENT DESIGNSIZE (1 em) IS IN POINTS)") ;
+ voutln("(COMMENT OTHER DIMENSIONS ARE MULTIPLES OF DESIGNSIZE/1000)") ;
+ /* Let vptovf compute the checksum. */
+ /* voutln2("(CHECKSUM O %lo)",cksum ^ 0xffffffff) ; */
+ if (boundarychar >= 0)
+ voutln2("(BOUNDARYCHAR O %lo)", (unsigned long)boundarychar) ;
+ vleft() ; voutln("FONTDIMEN") ;
+ if (newslant)
+ voutln2("(SLANT R %f)", newslant) ;
+ voutln2("(SPACE D %d)", fontspace) ;
+ if (! fixedpitch) {
+ voutln2("(STRETCH D %d)", transform(200,0)) ;
+ voutln2("(SHRINK D %d)", transform(100,0)) ;
+ }
+ voutln2("(XHEIGHT D %d)", xheight) ;
+ voutln2("(QUAD D %d)", transform(1000,0)) ;
+ voutln2("(EXTRASPACE D %d)", fixedpitch ? fontspace : transform(111, 0)) ;
+ vright() ;
+ vleft() ; voutln("MAPFONT D 0");
+ voutln2("(FONTNAME %s)", outname) ;
+ /* voutln2("(FONTCHECKSUM O %lo)", (unsigned long)cksum) ; */
+ vright() ;
+ if (makevpl>1) {
+ vleft() ; voutln("MAPFONT D 1");
+ voutln2("(FONTNAME %s)", outname) ;
+ voutln2("(FONTAT D %d)", (int)(1000.0*capheight+0.5)) ;
+ /* voutln2("(FONTCHECKSUM O %lo)", (unsigned long)cksum) ; */
+ vright() ;
+ }
+
+ for (i=0; i<256 && texptrs[i]==NULL; i++) ;
+ bc = i ;
+ for (i=255; i>=0 && texptrs[i]==NULL; i--) ;
+ ec = i;
+
+ vleft() ; voutln("LIGTABLE") ;
+ ai = findadobe("||") ;
+ unlabeled = 1 ;
+ for (nlig=ai->ligs; nlig; nlig=nlig->next)
+ if (0 != (asucc=findadobe(nlig->succ))) {
+ if (0 != (asub=findadobe(nlig->sub)))
+ if (asucc->texnum>=0)
+ if (asub->texnum>=0) {
+ if (unlabeled) {
+ voutln("(LABEL BOUNDARYCHAR)") ;
+ unlabeled = 0 ;
+ }
+ for (j = asucc->texnum; j >= 0; j = nexttex[j]) {
+ voutln4("(%s %s O %o)", vplligops[nlig->op],
+ vchar(j), (unsigned)asub->texnum) ;
+ }
+ }
+ }
+ if (! unlabeled) voutln("(STOP)") ;
+ for (i=bc; i<=ec; i++)
+ if ((ai=texptrs[i]) && ai->texnum == i) {
+ unlabeled = 1 ;
+ if (uppercase[i]==NULL) /* omit ligatures from smallcap lowercase */
+ for (nlig=ai->ligs; nlig; nlig=nlig->next)
+ if (0 != (asucc=findadobe(nlig->succ)))
+ if (0 != (asub=findadobe(nlig->sub)))
+ if (asucc->texnum>=0)
+ if (asub->texnum>=0) {
+ if (unlabeled) {
+ for (j = ai->texnum; j >= 0; j = nexttex[j])
+ voutln3("(LABEL %s)%s", vchar(j), vname(j)) ;
+ unlabeled = 0 ;
+ }
+ for (j = asucc->texnum; j >= 0; j = nexttex[j]) {
+ voutln4("(%s %s O %o)", vplligops[nlig->op],
+ vchar(j), (unsigned)asub->texnum) ;
+ if (nlig->boundleft)
+ break ;
+ }
+ }
+ for (nkern = (uppercase[i] ? uppercase[i]->kerns : ai->kerns);
+ nkern; nkern=nkern->next)
+ if (0 != (asucc=findadobe(nkern->succ)))
+ for (j = asucc->texnum; j >= 0; j = nexttex[j]) {
+ if (uppercase[j]==NULL) {
+ if (unlabeled) {
+ for (k = ai->texnum; k >= 0; k = nexttex[k])
+ voutln3("(LABEL %s)%s", vchar(k), vname(k)) ;
+ unlabeled = 0 ;
+ }
+ /* If other characters have the same kerns as this
+ one, output the label here. This makes the TFM
+ file much smaller than if we output all the
+ kerns again under a different label. */
+ for (kern_eq = ai->kern_equivs; kern_eq;
+ kern_eq = kern_eq->next) {
+ k = kern_eq->ch->texnum;
+ if (k >= 0 && k < 256)
+ voutln3("(LABEL %s)%s", vchar(k), vname(k)) ;
+ }
+ ai->kern_equivs = 0; /* Only output those labels once. */
+ if (uppercase[i]) {
+ if (lowercase[j]) {
+ for (k=lowercase[j]->texnum; k >= 0; k = nexttex[k])
+ voutln4("(KRN %s R %.1f)%s", vchar(k),
+ capheight*nkern->delta, vname(k)) ;
+ } else voutln4("(KRN %s R %.1f)%s",
+ vchar(j), capheight*nkern->delta, vname(j)) ;
+ } else {
+ voutln4("(KRN %s R %d)%s", vchar(j),
+ nkern->delta, vname(j)) ;
+ if (lowercase[j])
+ for (k=lowercase[j]->texnum; k >= 0; k = nexttex[k])
+ voutln4("(KRN %s R %.1f)%s", vchar(k),
+ capheight*nkern->delta, vname(k)) ;
+ }
+ }
+ }
+ if (! unlabeled) voutln("(STOP)") ;
+ }
+ vright() ;
+
+ for (i=bc; i<=ec; i++)
+ if (0 != (ai=texptrs[i])) {
+ vleft() ; fprintf(vplout, "CHARACTER %s", vchar(i)) ;
+ if (*vcharbuf=='C') {
+ voutln("") ;
+ } else
+ voutln2(" (comment %s)", ai->adobename) ;
+ if (uppercase[i]) {
+ ai=uppercase[i] ;
+ voutln2("(CHARWD R %.1f)", capheight * (ai->width)) ;
+ if (0 != (ht=texheight(ai)))
+ voutln2("(CHARHT R %.1f)", capheight * ht) ;
+ if (ai->lly)
+ voutln2("(CHARDP R %.1f)", -capheight * ai->lly) ;
+ if (ai->urx > ai->width)
+ voutln2("(CHARIC R %.1f)", capheight * (ai->urx - ai->width)) ;
+ } else {
+ voutln2("(CHARWD R %d)", ai->width) ;
+ if (0 != (ht=texheight(ai)))
+ voutln2("(CHARHT R %d)", ht) ;
+ if (ai->lly)
+ voutln2("(CHARDP R %d)", -ai->lly) ;
+ if (ai->urx > ai->width)
+ voutln2("(CHARIC R %d)", ai->urx - ai->width) ;
+ }
+ if (ai->adobenum != i || uppercase[i]) {
+ vleft() ; voutln("MAP") ;
+ if (uppercase[i]) voutln("(SELECTFONT D 1)") ;
+ if (ai->pccs && ai->adobenum < 0) {
+ xoff = 0 ; yoff = 0 ;
+ for (npcc = ai->pccs; npcc; npcc=npcc->next)
+ if (0 != (api=findadobe(npcc->partname)))
+ if (api->texnum>=0) {
+ if (npcc->xoffset != xoff) {
+ if (uppercase[i]) {
+ voutln2("(MOVERIGHT R %.1f)",
+ capheight * (npcc->xoffset - xoff)) ;
+ } else voutln2("(MOVERIGHT R %d)",
+ npcc->xoffset - xoff) ;
+ xoff = npcc->xoffset ;
+ }
+ if (npcc->yoffset != yoff) {
+ if (uppercase[i]) {
+ voutln2("(MOVEUP R %.1f)",
+ capheight * (npcc->yoffset - yoff)) ;
+ } else voutln2("(MOVEUP R %d)",
+ npcc->yoffset - yoff) ;
+ yoff = npcc->yoffset ;
+ }
+ voutln2("(SETCHAR O %o)", (unsigned)api->adobenum) ;
+ xoff += texptrs[api->texnum]->width ;
+ }
+ } else voutln2("(SETCHAR O %o)", (unsigned)ai->adobenum) ;
+ vright() ;
+ }
+ vright() ;
+ }
+ if (level) error("! I forgot to match the parentheses") ;
+}
+
+void usage(f)
+FILE *f ;
+{
+ (void)fprintf(f,
+ "afm2tfm 8.1, Copyright 1990-97 by Radical Eye Software\n") ;
+ (void)fprintf(f,
+ "Usage: afm2tfm foo[.afm] [-O] [-u] [-v|-V bar[.vpl]]\n") ;
+ (void)fprintf(f,
+ " [-e expansion] [-s slant] [-c capheight]\n") ;
+ (void)fprintf(f,
+ " [-p|-t|-T encodingfile] [foo[.tfm]]\n") ;
+}
+
+void
+openfiles(argc, argv)
+int argc ;
+char *argv[] ;
+{
+ register int lastext ;
+ register int i ;
+ int arginc ;
+
+ tfmout = (FILE *)NULL ;
+ if (argc == 1) {
+ usage(stdout) ;
+ exit(0) ;
+ }
+
+#if defined(MSDOS) || defined(OS2) || defined(ATARIST)
+ /* Make VPL file identical to that created under Unix */
+ (void)sprintf(titlebuf, "afm2tfm %s", argv[1]) ;
+#else
+#ifdef VMCMS
+ /* Make VPL file identical to that created under Unix */
+ (void)sprintf(titlebuf, "afm2tfm %s", argv[1]) ;
+#else
+ (void)sprintf(titlebuf, "%s %s", argv[0], argv[1]) ;
+#endif
+#endif
+ (void)strcpy(inname, argv[1]) ;
+ lastext = -1 ;
+ for (i=0; inname[i]; i++)
+ if (inname[i] == '.')
+ lastext = i ;
+ else if (inname[i] == '/' || inname[i] == ':')
+ lastext = -1 ;
+ if (lastext == -1) (void)strcat(inname, ".afm") ;
+
+ while (argc>2 && *argv[2]=='-') {
+ arginc = 2 ;
+ i = argv[2][1] ;
+ if (i == '/')
+ i = argv[2][2] - 32 ; /* /a ==> A for VMS */
+ switch (i) {
+case 'V': makevpl++ ;
+case 'v': makevpl++ ;
+ (void)strcpy(outname, argv[3]) ;
+ lastext = -1 ;
+ for (i=0; outname[i]; i++)
+ if (outname[i] == '.')
+ lastext = i ;
+ else if (outname[i] == '/' || outname[i] == ':')
+ lastext = -1 ;
+ if (lastext == -1) (void)strcat(outname, ".vpl") ;
+#ifndef VMCMS
+#ifndef ATARIST
+ if ((vplout=fopen(outname, WRITEBIN))==NULL)
+#else
+ if ((vplout=fopen(outname, "w"))==NULL)
+#endif
+#else
+ if ((vplout=fopen(outname, "w"))==NULL)
+#endif
+ error("! can't open vpl output file") ;
+ break ;
+case 'e': if (sscanf(argv[3], "%f", &efactor)==0 || efactor<0.01)
+ error("! Bad extension factor") ;
+ efactorparam = argv[3] ;
+ break ;
+case 'c':
+ if (sscanf(argv[3], "%f", &capheight)==0 || capheight<0.01)
+ error("! Bad small caps height") ;
+ break ;
+case 's': if (sscanf(argv[3], "%f", &slant)==0)
+ error("! Bad slant parameter") ;
+ slantparam = argv[3] ;
+ break ;
+case 'P':
+case 'p':
+ inenname = argv[3] ;
+ break ;
+case 'T':
+ inenname = outenname = argv[3] ;
+ break ;
+case 't':
+ outenname = argv[3] ;
+ break ;
+case 'O':
+ forceoctal = 1 ;
+ arginc = 1 ;
+ break ;
+case 'u':
+ pedantic = 1 ;
+ arginc = 1 ;
+ break ;
+default: (void)fprintf(stderr, "Unknown option %s %s will be ignored.\n",
+ argv[2], argv[3]) ;
+ }
+ for (i=0; i<arginc; i++) {
+ (void)sprintf(titlebuf + strlen(titlebuf), " %s", argv[2]) ;
+ argv++ ;
+ argc-- ;
+ }
+ }
+
+ if ((afmin=fopen(inname, "r"))==NULL)
+ error("! can't open afm input file") ;
+
+ if (argc>3 || (argc==3 && *argv[2]=='-')) {
+ usage(stderr) ;
+ error("! incorrect usage") ;
+ }
+
+ if (argc == 2) (void)strcpy(outname, inname) ;
+ else (void)strcpy(outname, argv[2]) ;
+
+ lastext = -1 ;
+ for (i=0; outname[i]; i++)
+ if (outname[i] == '.')
+ lastext = i ;
+ else if (outname[i] == '/' || outname[i] == ':' || outname[i] == '\\')
+ lastext = -1 ;
+ if (argc == 2) {
+ outname[lastext] = 0 ;
+ lastext = -1 ;
+ }
+ if (lastext == -1) {
+ lastext = strlen(outname) ;
+ (void)strcat(outname, ".tfm") ;
+ }
+ if (tfmout == NULL && (tfmout=fopen(outname, WRITEBIN))==NULL)
+ error("! can't open tfm output file") ;
+ outname[lastext] = 0 ;
+/*
+ * Now we strip off any directory information, so we only use the
+ * base name in the vf file. We accept any of /, :, or \ as directory
+ * delimiters, so none of these are available for use inside the
+ * base name; this shouldn't be a problem.
+ */
+ for (i=0, lastext=0; outname[i]; i++)
+ if (outname[i] == '/' || outname[i] == ':' || outname[i] == '\\')
+ lastext = i + 1 ;
+ if (lastext)
+ strcpy(outname, outname + lastext) ;
+}
+/*
+ * Some routines to remove kerns that match certain patterns.
+ */
+struct kern *rmkernmatch(k, s)
+struct kern *k ;
+char *s ;
+{
+ struct kern *nkern ;
+
+ while (k && strcmp(k->succ, s)==0)
+ k = k->next ;
+ if (k) {
+ for (nkern = k; nkern; nkern = nkern->next)
+ while (nkern->next && strcmp(nkern->next->succ, s)==0)
+ nkern->next = nkern->next->next ;
+ }
+ return k ;
+}
+/*
+ * Recursive to one level.
+ */
+void rmkern(s1, s2, ai)
+char *s1, *s2 ;
+struct adobeinfo *ai ;
+{
+ if (ai == 0) {
+ if (strcmp(s1, "*") == 0) {
+ for (ai=adobechars; ai; ai = ai->next)
+ rmkern(s1, s2, ai) ;
+ return ;
+ } else {
+ ai = findadobe(s1) ;
+ if (ai == 0)
+ return ;
+ }
+ }
+ if (strcmp(s2, "*")==0)
+ ai->kerns = 0 ; /* drop them on the floor */
+ else
+ ai->kerns = rmkernmatch(ai->kerns, s2) ;
+}
+/* Make the kerning for character S1 equivalent to that for S2.
+ If either S1 or S2 do not exist, do nothing.
+ If S1 already has kerning, do nothing. */
+void
+addkern (s1, s2)
+ char *s1, *s2;
+{
+ struct adobeinfo *ai1 = findadobe (s1);
+ struct adobeinfo *ai2 = findadobe (s2);
+ if (ai1 && ai2 && !ai1->kerns) {
+ /* Put the new one at the head of the list, since order is immaterial. */
+ struct adobeptr *ap
+ = (struct adobeptr *) mymalloc((unsigned long)sizeof(struct adobeptr));
+ ap->next = ai2->kern_equivs;
+ ap->ch = ai1;
+ ai2->kern_equivs = ap;
+ }
+}
+int sawligkern ;
+/*
+ * Reads a ligkern line, if this is one. Assumes the first character
+ * passed is `%'.
+ */
+void checkligkern(s)
+char *s ;
+{
+ char *oparam = param ;
+ char *mlist[5] ;
+ int n ;
+
+ s++ ;
+ while (*s && *s <= ' ')
+ s++ ;
+ if (strncmp(s, "LIGKERN", 7)==0) {
+ sawligkern = 1 ;
+ s += 7 ;
+ while (*s && *s <= ' ')
+ s++ ;
+ param = s ;
+ while (*param) {
+ for (n=0; n<5;) {
+ if (*param == 0)
+ break ;
+ mlist[n] = paramstring() ;
+ if (strcmp(mlist[n], ";") == 0)
+ break ;
+ n++ ;
+ }
+ if (n > 4)
+ error("! too many parameters in lig kern data") ;
+ if (n < 3)
+ error("! too few parameters in lig kern data") ;
+ if (n == 3 && strcmp(mlist[1], "{}") == 0) { /* rmkern command */
+ rmkern(mlist[0], mlist[2], (struct adobeinfo *)0) ;
+ } else if (n == 3 && strcmp(mlist[1], "<>") == 0) { /* addkern */
+ addkern(mlist[0], mlist[2]) ;
+ } else if (n == 3 && strcmp(mlist[0], "||") == 0 &&
+ strcmp(mlist[1], "=") == 0) { /* bc command */
+ struct adobeinfo *ai = findadobe("||") ;
+
+ if (boundarychar != -1)
+ error("! multiple boundary character commands?") ;
+ if (sscanf(mlist[2], "%d", &n) != 1)
+ error("! expected number assignment for boundary char") ;
+ if (n < 0 || n > 255)
+ error("! boundary character number must be 0..255") ;
+ boundarychar = n ;
+ if (ai == 0)
+ error("! internal error: boundary char") ;
+ ai->texnum = n ; /* prime the pump, so to speak, for lig/kerns */
+ } else if (n == 4) {
+ int op = -1 ;
+ struct adobeinfo *ai ;
+
+ for (n=0; encligops[n]; n++)
+ if (strcmp(mlist[2], encligops[n])==0) {
+ op = n ;
+ break ;
+ }
+ if (op < 0)
+ error("! bad ligature op specified") ;
+ if (0 != (ai = findadobe(mlist[0]))) {
+ struct lig *lig ;
+
+ if (findadobe(mlist[2])) /* remove coincident kerns */
+ rmkern(mlist[0], mlist[1], ai) ;
+ if (strcmp(mlist[3], "||") == 0)
+ error("! you can't lig to the boundary character!") ;
+ if (! fixedpitch) { /* fixed pitch fonts get *0* ligs */
+ for (lig=ai->ligs; lig; lig = lig->next)
+ if (strcmp(lig->succ, mlist[1]) == 0)
+ break ; /* we'll re-use this structure */
+ if (lig == 0) {
+ lig = newlig() ;
+ lig->succ = newstring(mlist[1]) ;
+ lig->next = ai->ligs ;
+ ai->ligs = lig ;
+ }
+ lig->sub = newstring(mlist[3]) ;
+ lig->op = op ;
+ if (strcmp(mlist[1], "||")==0) {
+ lig->boundleft = 1 ;
+ if (strcmp(mlist[0], "||")==0)
+ error("! you can't lig boundarychar boundarychar!") ;
+ } else
+ lig->boundleft = 0 ;
+ }
+ }
+ } else
+ error("! bad form in LIGKERN command") ;
+ }
+ }
+ param = oparam ;
+}
+/*
+ * Here we get a token from the AFM file. We parse just as much PostScript
+ * as we expect to find in an encoding file. We allow commented lines and
+ * names like 0, .notdef, _foo_. We do not allow //abc.
+ */
+char smbuffer[100] ; /* for tokens */
+char *gettoken() {
+ char *p, *q ;
+
+ while (1) {
+ while (param == 0 || *param == 0) {
+ if (gaetline() == 0)
+ error("! premature end in encoding file") ;
+ for (p=buffer; *p; p++)
+ if (*p == '%') {
+ if (ignoreligkern == 0)
+ checkligkern(p) ;
+ *p = 0 ;
+ break ;
+ }
+ }
+ while (*param && *param <= ' ')
+ param++ ;
+ if (*param) {
+ if (*param == '[' || *param == ']' ||
+ *param == '{' || *param == '}') {
+ smbuffer[0] = *param++ ;
+ smbuffer[1] = 0 ;
+ return smbuffer ;
+ } else if (*param == '/' || *param == '-' || *param == '_' ||
+ *param == '.' ||
+ ('0' <= *param && *param <= '9') ||
+ ('a' <= *param && *param <= 'z') ||
+ ('A' <= *param && *param <= 'Z')) {
+ smbuffer[0] = *param ;
+ for (p=param+1, q=smbuffer+1;
+ *p == '-' || *p == '_' || *p == '.' ||
+ ('0' <= *p && *p <= '9') ||
+ ('a' <= *p && *p <= 'z') ||
+ ('A' <= *p && *p <= 'Z'); p++, q++)
+ *q = *p ;
+ *q = 0 ;
+ param = p ;
+ return smbuffer ;
+ }
+ }
+ }
+}
+void getligkerndefaults() {
+ int i ;
+
+ for (i=0; staticligkern[i]; i++) {
+ strcpy(buffer, staticligkern[i]) ;
+ strcpy(obuffer, staticligkern[i]) ;
+ param = buffer ;
+ checkligkern(buffer) ;
+ }
+}
+/*
+ * This routine reads in an encoding file, given the name. It returns
+ * the final total structure. It performs a number of consistency checks.
+ */
+struct encoding *readencoding(enc)
+char *enc ;
+{
+ char *p ;
+ int i ;
+ struct encoding *e =
+ (struct encoding *)mymalloc((unsigned long)sizeof(struct encoding)) ;
+
+ sawligkern = 0 ;
+ if (afmin)
+ error("! oops; internal afmin error") ;
+ if (enc) {
+ afmin = fopen(enc, "r") ;
+ param = 0 ;
+ if (afmin == 0)
+ error("! couldn't open that encoding file") ;
+ p = gettoken() ;
+ if (*p != '/' || p[1] == 0)
+ error("! first token in encoding must be literal encoding name") ;
+ e->name = newstring(p+1) ;
+ p = gettoken() ;
+ if (strcmp(p, "["))
+ error("! second token in encoding must be mark ([) token") ;
+ for (i=0; i<256; i++) {
+ p = gettoken() ;
+ if (*p != '/' || p[1] == 0)
+ error("! tokens 3 to 257 in encoding must be literal names") ;
+ e->vec[i] = newstring(p+1) ;
+ }
+ p = gettoken() ;
+ if (strcmp(p, "]"))
+ error("! token 258 in encoding must be make-array (])") ;
+ while (gaetline()) {
+ for (p=buffer; *p; p++)
+ if (*p == '%') {
+ if (ignoreligkern == 0)
+ checkligkern(p) ;
+ *p = 0 ;
+ break ;
+ }
+ }
+ fclose(afmin) ;
+ afmin = 0 ;
+ if (ignoreligkern == 0 && sawligkern == 0)
+ getligkerndefaults() ;
+ } else {
+ e = &staticencoding ;
+ getligkerndefaults() ;
+ }
+ param = 0 ;
+ return e ;
+}
+/*
+ * This routine prints out the line that needs to be added to psfonts.map.
+ */
+void conspsfonts() {
+ (void)printf("%s %s", outname,
+#ifndef VMCMS
+ fontname) ;
+#else /* VM/CMS: fontname is ascii, so we use ebfontname */
+ ebfontname) ;
+#endif
+ if (slantparam || efactorparam || inenname) {
+ (void)printf(" \"") ;
+ if (slantparam)
+ (void)printf(" %s SlantFont", slantparam) ;
+ if (efactorparam)
+ (void)printf(" %s ExtendFont", efactorparam) ;
+ if (inenname)
+ (void)printf(" %s ReEncodeFont", inencoding->name) ;
+ (void)printf(" \"") ;
+ if (inenname)
+ (void)printf(" <%s", inenname) ;
+ }
+ (void)printf("\n") ;
+}
+#ifndef VMS
+int
+#endif
+main(argc, argv)
+int argc ;
+char *argv[] ;
+{
+ int i ;
+
+ for (i=0; i<256; i++)
+ nexttex[i] = -1 ; /* encoding chains have length 0 */
+ tfmdata = (long *)mymalloc((unsigned long)40000L) ;
+ openfiles(argc, argv) ;
+ readadobe() ;
+ if (fontspace == 0) {
+ struct adobeinfo *ai ;
+
+ if (0 != (ai = findadobe("space")))
+ fontspace = ai->width ;
+ else if (adobeptrs[32])
+ fontspace = adobeptrs[32]->width ;
+ else
+ fontspace = transform(500, 0) ;
+ }
+ handlereencoding() ;
+ buildtfm() ;
+ writetfm() ;
+ conspsfonts() ;
+ if (makevpl) {
+ assignchars() ;
+ if (makevpl>1) upmap() ;
+ writevpl() ;
+ }
+ exit(0) ;
+ /*NOTREACHED*/
+}
diff --git a/systems/unix/tex-fpc/dvipsnk/dvipsmanfonts b/systems/unix/tex-fpc/dvipsnk/dvipsmanfonts
new file mode 100644
index 0000000000..aa55b0d360
--- /dev/null
+++ b/systems/unix/tex-fpc/dvipsnk/dvipsmanfonts
@@ -0,0 +1,61 @@
+# This script builds and installs .pk fonts for dvips.tex
+rm -f trouble # clean list of trouble makeing fonts
+mkpkfont logo10 magstep0.5
+mkpkfont cminch magstep0.5
+mkpkfont cmbx10 '2.272*magstep0.5'
+mkpkfont cmbx10 '1.577*magstep0.5'
+mkpkfont cmbx10 '1.315*magstep0.5'
+mkpkfont cmr7 magstep4.5 # for titles
+mkpkfont cmtt10 magstep2.5
+mkpkfont cmssbx10 magstep2.5
+mkpkfont ../lib/manfnt magstep 0.5
+mkpkfont cmr10 magstep0.5 # roman text
+mkpkfont cmr9 magstep0.5
+mkpkfont cmr8 magstep0.5
+mkpkfont cmr7 magstep0.5
+mkpkfont cmr6 magstep0.5
+mkpkfont cmr5 magstep0.5
+mkpkfont cmmi10 magstep0.5 # math italic
+mkpkfont cmmi9 magstep0.5
+mkpkfont cmmi8 magstep0.5
+mkpkfont cmmi7 magstep0.5
+mkpkfont cmmi6 magstep0.5
+mkpkfont cmmi5 magstep0.5
+mkpkfont cmsy10 magstep0.5 # math symbols
+mkpkfont cmsy9 magstep0.5
+mkpkfont cmsy8 magstep0.5
+mkpkfont cmsy7 magstep0.5
+mkpkfont cmsy6 magstep0.5
+mkpkfont cmsy5 magstep0.5
+mkpkfont cmex10 magstep0.5 # math extension
+mkpkfont cmss10 magstep0.5 # sans serif
+mkpkfont cmssq8 magstep0.5
+mkpkfont cmssi10 magstep0.5 # sans serif italic
+mkpkfont cmssqi8 magstep0.5
+mkpkfont cmbx10 magstep0.5 # boldface extended
+mkpkfont cmbx9 magstep0.5
+mkpkfont cmbx8 magstep0.5
+mkpkfont cmbx7 magstep0.5
+mkpkfont cmbx6 magstep0.5
+mkpkfont cmbx5 magstep0.5
+mkpkfont cmtt10 magstep0.5 # typewriter
+mkpkfont cmtt9 magstep0.5
+mkpkfont cmtt8 magstep0.5
+mkpkfont cmsltt10 magstep0.5 # slanted typewriter
+mkpkfont cmsl10 magstep0.5 # slanted roman
+mkpkfont cmsl9 magstep0.5
+mkpkfont cmsl8 magstep0.5
+mkpkfont cmti10 magstep0.5 # text italic
+mkpkfont cmti9 magstep0.5
+mkpkfont cmti8 magstep0.5
+mkpkfont cmti7 magstep0.5
+mkpkfont cmu10 magstep0.5 # unslanted text italic
+mkpkfont cmmib10 magstep0.5 # bold math italic
+mkpkfont cmbsy10 magstep0.5 # bold math symbols
+mkpkfont cmcsc10 magstep0.5 # caps and small caps
+mkpkfont cmssbx10 magstep0.5 # sans serif bold extended
+mkpkfont cmdunh10 magstep0.5 # Dunhill style
+mkfont cmtex10
+mkfont cminch
+mkfont cmssdc10 4
+mkpkfont cmr5 2
diff --git a/systems/unix/tex-fpc/lib/webmac-fpc.tex b/systems/unix/tex-fpc/lib/webmac-fpc.tex
new file mode 100644
index 0000000000..92ee9c8aef
--- /dev/null
+++ b/systems/unix/tex-fpc/lib/webmac-fpc.tex
@@ -0,0 +1,16 @@
+% TeX-FPC extensions to WEB macros
+\def\namefpc{$\hbox{\name}{}_{\fam0 FPC}$}
+\def\TeXfpc{\TeX$_{\fam0 FPC}$}
+\def\address{{\parindent0pt\sl
+ March 2019
+
+ Wolfgang Helbig, Programmierer\hfill
+
+ Waiblingen, Baden-\kern-1.4pt W\"urttemberg\hfill
+ \.{helbig@mailbox.org}
+}}
+\def\title{\namefpc}
+
+\def\hint{For hints on how to install and use this program, see
+the readme file in the \TeXfpc\ distribution and the \.{WEB} manual
+in Knuth's distribution (\.{webman.tex}).}
diff --git a/systems/unix/tex-fpc/license b/systems/unix/tex-fpc/license
new file mode 100644
index 0000000000..1783216cf9
--- /dev/null
+++ b/systems/unix/tex-fpc/license
@@ -0,0 +1,21 @@
+Copyright (c) Wolfgang Helbig, All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/systems/unix/tex-fpc/mf/mf.ch b/systems/unix/tex-fpc/mf/mf.ch
new file mode 100644
index 0000000000..33f19ab49b
--- /dev/null
+++ b/systems/unix/tex-fpc/mf/mf.ch
@@ -0,0 +1,631 @@
+% This is a change file of Metafont for FPC, Wolfgang Helbig, Nov. 2007
+[0] to print changed sections only
+@x
+\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
+@y
+\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
+\input webmac-fpc
+\emergencystretch 0.5in % avoid overfull boxes
+
+\let\maybe=\iffalse % print changed modules only.
+
+\def\name{\MF}
+
+\N0\*. \[0] About \namefpc.
+
+This is an adaption of Donald~E. Knuth's \MF, version 2.7182815
+from January 2014, to Unix. It is based on GNU~Pascal, version 2.1.
+
+The features added include treating the command line as the first
+input line and invoking a system editor, in this case \.{vi}, to
+let the user correct the input file.
+On exit, \namefpc\ passes its `history' to the operating system.
+
+\hint
+
+Comments and questions are welcome!
+
+\bigskip
+\address
+\fi
+@z
+
+[2] Change the banner line
+@x
+@d banner=='This is METAFONT, Version 2.7182818' {printed when \MF\ starts}
+@y
+@d banner=='This is METAFONT-FPC' {printed when \MF\ starts}
+@z
+
+[4] terminal output and input
+@x
+@^system dependencies@>
+
+@d mtype==t@&y@&p@&e {this is a \.{WEB} coding trick:}
+@y
+@^system dependencies@>
+
+@d term_in==i@&n@&p@&u@&t
+@d term_out==o@&u@&t@&p@&u@&t
+@d mtype==t@&y@&p@&e {this is a \.{WEB} coding trick:}
+@z
+
+[4] terminal output and input
+@x
+program MF; {all file names are defined dynamically}
+@y
+program MF(@!term_in,@!term_out);
+{all other file names are defined dynamically}
+@z
+
+Since @x, @y, and @z only define a change block when they begin a
+line, you deactivate a block by indenting it (shift right) and
+activate it by unindenting it (shift left). With vi set the
+cursor to the @x line and enter >} or <} to (un)indent a paragraph.
+
+[7] shift left to turn debugging on, right to turn it off
+@x
+@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
+@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
+@y
+@d debug== {change this to `$\\{debug}\equiv\.{@@\{}$' when not debugging}
+@d gubed== {change this to `$\\{gubed}\equiv\.{@@\}}$' when not debugging}
+@z
+
+[7] shift left to turn on statistics, shift rigth to turn off statistics
+@x
+@d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering
+ usage statistics}
+@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering
+ usage statistics}
+@y
+@d stat== {change this to `$\\{stat}\equiv\.{@@\{}$' to turn off statistics}
+@d tats== {change this to `$\\{tats}\equiv\.{@@\}}$' to turn off statistics}
+@z
+
+ [8] shift left to build MF and right it to build INIMF.
+ @x inimf
+ @d init== {change this to `$\\{init}\equiv\.{@@\{}$' in the production version}
+ @d tini== {change this to `$\\{tini}\equiv\.{@@\}}$' in the production version}
+ @y
+ @d init==@{
+ @d tini==@}
+ @z
+
+[9] compiler directives, turn off I/O checking.
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@{@&$I-@} {no I/O checking}
+@{@&$M@&O@&D@&E I@&S@&O@}
+@z
+
+[10] default case branch
+@x
+@d othercases == others: {default for cases not listed explicitly}
+@y
+@d othercases == @+ else {default for cases not listed explicitly}
+@z
+
+Shift left all `trap' blocks to prepare for TRAP.
+Shift right all `part' blocks to prepare for TRAP.
+[11]
+@x part
+@!mem_max=30000; {greatest index in \MF's internal |mem| array;
+@y
+@!mem_max=35000; {increased for ibycus4,
+ greatest index in \MF's internal |mem| array;
+@z
+
+[11]
+@x part
+@!max_strings=2000; {maximum number of strings; must not exceed |max_halfword|}
+@y
+@!max_strings=6000; {maximum number of strings; increased for ibycus4}
+@z
+
+@x part
+@!pool_size=32000; {maximum number of characters in strings, including all
+@y
+@!pool_size=60000; {increased for ibycus4,
+ maximum number of characters in strings, including all
+@z
+
+[11]
+ @x trap
+ @!mem_max=30000; {greatest index in \MF's internal |mem| array;
+ @y
+ @!mem_max=3000; {greatest index in \MF's internal |mem| array;
+ @z
+
+[11]
+ @x trap
+ @!error_line=72; {width of context lines on terminal error messages}
+ @!half_error_line=42; {width of first lines of contexts in terminal
+ error messages; should be between 30 and |error_line-15|}
+ @!max_print_line=79; {width of longest text lines output; should be at least 60}
+ @!screen_width=768; {number of pixels in each row of screen display}
+ @!screen_depth=1024; {number of pixels in each column of screen display}
+ @y
+ @!error_line=64; {width of context lines on terminal error messages}
+ @!half_error_line=32; {width of first lines of contexts in terminal
+ error messages; should be between 30 and |error_line-15|}
+ @!max_print_line=72; {width of longest text lines output; should be at least 60}
+ @!screen_width=100; {number of pixels in each row of screen display}
+ @!screen_depth=200; {number of pixels in each column of screen display}
+ @z
+
+[11]
+ @x trap
+ @!gf_buf_size=800; {size of the output buffer, must be a multiple of 8}
+ @y
+ @!gf_buf_size=8; {size of the output buffer, must be a multiple of 8}
+ @z
+
+[11] location of pool file
+@x
+@!pool_name='MFbases:MF.POOL ';
+@y
+@!pool_name='MFbases/mf.pool';
+@z
+
+
+[12]
+@x part
+@d mem_top==30000 {largest index in the |mem| array dumped by \.{INIMF};
+@y
+@d mem_top==35000 {largest index in the |mem| array dumped by \.{INIMF};
+@z
+
+ [12]
+ @x trap
+ @d mem_top==30000 {largest index in the |mem| array dumped by \.{INIMF};
+ @y
+ @d mem_top==3000 {largest index in the |mem| array dumped by \.{INIMF};
+ @z
+
+[12] Silvio levy' greek fonts need more opened input files.
+@x
+@d max_in_open=6 {maximum number of input files and error insertions that
+@y
+@d max_in_open=10 {maximum number of input files and error insertions that
+@z
+
+[22] accept tab and formfeed
+@x
+for i:=0 to @'37 do xchr[i]:=' ';
+@y
+for i:=0 to @'37 do xchr[i]:=' ';
+xchr[@'11] := chr(@'11); {accept horizontal tab}
+xchr[@'14] := chr(@'14); {accept form feed}
+@z
+
+[24] the type of text_files is text in ISO Pascal
+@x
+@!eight_bits=0..255; {unsigned one-byte quantity}
+@!alpha_file=packed file of text_char; {files that contain textual data}
+@y
+@!eight_bits=0..255; {unsigned one-byte quantity}
+@!alpha_file=t@&e@&x@&t; {coding trick is needed since |text| is a macro}
+@z
+
+[26] dynamic io
+@x
+@d reset_OK(#)==erstat(#)=0
+@d rewrite_OK(#)==erstat(#)=0
+@y
+@d fpc_io_result==i@&o@&r@&e@&s@&u@&l@&t
+@d fpc_assign==a@&s@&s@&i@&g@&n
+@d reset_OK(#)==fpc_io_result=0
+@d rewrite_OK(#)==fpc_io_result=0
+@d clear_io_result==@+if fpc_io_result=0 then do_nothing
+@z
+
+[26] opening for in- and output for all three file types
+alpha in
+@x
+begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file);reset(f);
+a_open_in:=reset_OK(f);
+@z
+
+[26]
+alpha out
+@x
+begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+a_open_out:=rewrite_OK(f);
+@z
+
+[26] byte out
+@x
+begin rewrite(f,name_of_file,'/O'); b_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+b_open_out:=rewrite_OK(f);
+@z
+
+[26] word in
+@x
+begin reset(f,name_of_file,'/O'); w_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f);
+w_open_in:=reset_OK(f);
+@z
+
+[26] word out
+@x
+begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+w_open_out:=rewrite_OK(f);
+@z
+
+[30] eoln handling
+@x
+@p function input_ln(var @!f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+var @!last_nonblank:0..buf_size; {|last| with trailing blanks removed}
+begin if bypass_eoln then if not eof(f) then get(f);
+ {input the first character of the line into |f^|}
+last:=first; {cf.\ Matthew 19\thinspace:\thinspace30}
+if eof(f) then input_ln:=false
+else begin last_nonblank:=first;
+ while not eoln(f) do
+ begin if last>=max_buf_stack then
+ begin max_buf_stack:=last+1;
+ if max_buf_stack=buf_size then
+ @<Report overflow of the input buffer, and abort@>;
+ end;
+ buffer[last]:=xord[f^]; get(f); incr(last);
+ if buffer[last-1]<>" " then last_nonblank:=last;
+ end;
+ last:=last_nonblank; input_ln:=true;
+ end;
+end;
+@y
+@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+begin
+ {ignore |bypass_eoln|. Assuming |f| being positioned at the first character}
+last:=first; {cf.\ Matthew 19\thinspace:\thinspace30}
+if eof(f) then input_ln:=false
+else begin
+ while not eoln(f) do
+ begin if last>=max_buf_stack then
+ begin max_buf_stack:=last+1;
+ if max_buf_stack=buf_size then begin
+ read_ln(f); {complete the current line}
+ @<Report overflow of the input buffer, and abort@>;
+ end;
+ end;
+ buffer[last]:=xord[f^]; get(f); incr(last);
+ end;
+ get(f); {Advance |f| to the first character of the next line}
+ input_ln:=true;
+ end;
+end;
+@z
+
+[31] term_in and term_out are the standard pascal files
+@x
+is considered an output file the file variable is |term_out|.
+@^system dependencies@>
+
+@<Glob...@>=
+@!term_in:alpha_file; {the terminal as an input file}
+@!term_out:alpha_file; {the terminal as an output file}
+@y
+is considered an output file the file variable is |term_out|.
+The file |term_in| is declared as \\{input} and |term_out| as
+\\{output} in the program header.
+@^system dependencies@>
+@z
+
+[32]
+@x
+@d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input}
+@d t_open_out==rewrite(term_out,'TTY:','/O')
+ {open the terminal for text output}
+@y
+@d t_open_in==do_nothing {open the terminal for text input}
+@d t_open_out==do_nothing {open the terminal for text output}
+@z
+
+[33]
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@d clear_terminal == break_in(term_in,true) {clear the terminal input buffer}
+@y
+@d update_terminal == do_nothing {empty the terminal output buffer}
+@d clear_terminal == do_nothing {clear the terminal input buffer}
+@z
+
+@x
+ begin write_ln(term_out,'Buffer size exceeded!'); goto final_end;
+@y
+ begin write_ln(term_out,'Buffer size exceeded!'); fpc_halt(3);
+@z
+
+[35] command line
+@x
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+@y
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+@d fpc_string == r@&a@&w@&b@&y@&t@&e@&s@&t@&r@&i@&n@&g
+@d fpc_length==l @& e @& n @& g @& t @& h
+@d fpc_param_count==p @& a @& r @& a @& m @& c @& o @& u @& n @& t
+@d fpc_param_str==p @& a @& r @& a @& m @&s @& t @& r
+ {FPC function returning the length of a |fpc_string|}
+
+@p procedure input_command_ln; {get the command line in |buffer|}
+var argc: integer; {argument counter}
+ arg: fpc_string; {argument}
+ cc: integer; {character counter in argument}
+begin last := first; argc := 1;
+while argc <= fpc_param_count do
+ begin cc := 1; arg := fpc_param_str(argc); incr(argc);
+ while cc <= fpc_length(arg) do
+ begin
+ if last+1>=buf_size then
+ @<Report overflow of the input buffer, and abort@>;
+ buffer[last] := xord[arg[cc]]; incr(last); incr(cc);
+ end;
+ if (argc <= fpc_param_count) then begin
+ buffer[last] := " "; incr(last);
+ end;
+ end;
+end;
+@z
+
+[36] command line
+@x
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in;
+loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal;
+@.**@>
+ if not input_ln(term_in,true) then {this shouldn't happen}
+ begin write_ln(term_out);
+ write(term_out,'! End of file on the terminal... why?');
+@.End of file on the terminal@>
+ init_terminal:=false; return;
+ end;
+ loc:=first;
+ while (loc<last)and(buffer[loc]=" ") do incr(loc);
+ if loc<last then
+ begin init_terminal:=true;
+ return; {return unless the line was all blank}
+ end;
+ write_ln(term_out,'Please type the name of your input file.');
+ end;
+exit:end;
+@y
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in; input_command_ln;
+while first=last do begin
+ wake_up_terminal; write(term_out,'**'); update_terminal;
+@.**@>
+ if not input_ln(term_in, true) then {this shouldn't happen}
+ begin write_ln(term_out);
+ write_ln(term_out,'! End of file on the terminal... why?');
+@.End of file on the terminal@>
+ init_terminal:=false; return;
+ end;
+ if first=last then
+ write_ln(term_out,'Please type the name of your input file.');
+ end;
+loc := first; {trim leading spaces}
+while buffer[loc]=" " do incr(loc);
+init_terminal:=true;
+exit: end;
+@z
+
+[199] character class for tab and lf
+@x
+for k:=127 to 255 do char_class[k]:=invalid_class;
+@y
+for k:=127 to 255 do char_class[k]:=invalid_class;
+char_class[@'11] := space_class;
+char_class[@'14] := space_class;
+@z
+
+[326]
+@x
+@d valid_range(#)==(abs(#-4096)<4096) {is |#| strictly between 0 and 8192?}
+@y
+@d valid_range(#)==(abs(int(#-4096))<4096) {is |#| strictly between 0 and 8192?}
+@z
+[564]
+ @x trap
+ begin init_screen:=false;
+ @y
+ begin init_screen:=true;
+ @z
+
+[679] spurious empty line on terminal
+@x
+ print_ln; first:=start;
+ prompt_input("*"); {input on-line into |buffer|}
+@y
+@.Please type...@>
+ print_nl("");
+ first:=start; {avoid empty lines on terminal and log file}
+ prompt_input("*"); {input on-line into |buffer|}
+@z
+
+[769] Path separator in Unix
+@x
+@d MF_area=="MFinputs:"
+@y
+@d MF_area=="MFinputs/"
+@z
+
+[771]
+@x
+else begin if (c=">")or(c=":") then
+@y
+else begin if c="/" then
+@z
+
+[774]
+@x
+@d append_to_name(#)==begin c:=#; incr(k);
+@y
+@d fpc_set_length==s@&e@&t@&l@&e@&n@&g@&t@&h
+@d append_to_name(#)==begin c:=#; incr(k);
+@z
+
+[774]
+@x
+@!j:pool_pointer; {index into |str_pool|}
+@y
+@!j:pool_pointer; {index into |str_pool|}
+rbs: fpc_string;
+@z
+
+[774]
+@x
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+@y
+rbs := name_of_file;
+fpc_set_length(rbs, name_length);
+name_of_file := rbs;
+@z
+
+[776]
+@x
+MF_base_default:='MFbases:plain.base';
+@y
+MF_base_default:='MFbases/plain.base';
+@z
+
+[778]
+@x
+@!j:integer; {index into |buffer| or |MF_base_default|}
+@y
+@!j:integer; {index into |buffer| or |MF_base_default|}
+rbs: fpc_string;
+@z
+
+[778]
+@x
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+@y
+rbs := name_of_file;
+fpc_set_length(rbs, name_length);
+name_of_file := rbs;
+@z
+
+[1199]
+@x
+undump_int(x);@+if (x<>69069)or eof(base_file) then goto off_base
+@y
+undump_int(x);@+if (x<>69069) then goto off_base
+@z
+
+[1204]
+@x
+@p begin @!{|start_here|}
+@y
+@d fpc_halt == h@&a@&l@&t
+
+@p begin @!{|start_here|}
+@z
+
+[1204] load the base file before printing the banner line
+@x
+start_of_MF: @<Initialize the output routines@>;
+@y
+start_of_MF: @<Preload the default base file@>;
+@<Initialize the output routines@>;
+@z
+
+[1205] print last end-of-line marker if needed
+@x
+if log_opened then
+ begin wlog_cr;
+ a_close(log_file); selector:=selector-2;
+ if selector=term_only then
+ begin print_nl("Transcript written on ");
+@.Transcript written...@>
+ slow_print(log_name); print_char(".");
+ end;
+ end;
+end;
+@y
+if log_opened then
+ begin if file_offset > 0 then wlog_cr;
+ a_close(log_file); selector:=selector-2;
+ if selector=term_only then
+ begin print_nl("Transcript written on ");
+@.Transcript written...@>
+ slow_print(log_name); print_char(".");
+ end;
+ end;
+ if term_offset > 0 then wterm_cr;
+end;
+@z
+
+[1212] return if eof
+@x
+ read(term_in,m);
+@y
+ if eof(term_in) then return;
+ {don't try to read past end of file}
+ read(term_in,m);
+@z
+
+[1212] return if eof
+@x
+ else begin read(term_in,n);
+@y
+ else begin if eof(term_in) then return;
+ {don't try to read past end of file}
+ read(term_in,n);
+@z
+
+[1213] return eof
+@x
+13: begin read(term_in,l); print_cmd_mod(n,l);
+@y
+13: begin if eof(term_in) then return;
+ {don't try to read past end of file}
+read(term_in,l); print_cmd_mod(n,l);
+@z
+
+[1214 and modules added for METAFONT-FPC]
+@x
+itself will get a new section number.
+@^system dependencies@>
+@y
+itself will get a new section number.
+@^system dependencies@>
+
+@ Try to preload the default base file. This is called even before
+the first line is read from the terminal, and thus turns \.{VIRMF}
+into \.{MF}, at least as seen by the user.
+
+\indent\.{INIMF} sets |base_ident| to `\.{INIMF}' and won't load a base
+file here.
+
+@<Preload the default base file@> =
+if base_ident = 0 then
+ begin pack_buffered_name(base_default_length - base_ext_length, 1, 0);
+ if not w_open_in(base_file) then
+ begin
+ wterm_ln('I can''t find the base file ', name_of_file);
+ goto final_end
+ end;
+ if not load_base_file then
+ begin w_close(base_file); goto final_end
+ end;
+ w_close(base_file);
+ end
+
+@
+@z
diff --git a/systems/unix/tex-fpc/mfware/gftopk.ch b/systems/unix/tex-fpc/mfware/gftopk.ch
new file mode 100644
index 0000000000..ed7f0feaa2
--- /dev/null
+++ b/systems/unix/tex-fpc/mfware/gftopk.ch
@@ -0,0 +1,119 @@
+This is a change file of GFtoPK for FPC, Wolfgang Helbig, Apr. 2008
+To be used with the GNU Pascal Compiler Version 2.1
+
+[0] About GFtoPK-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+
+% \let\maybe=\iffalse % uncomment to print changed modules only.
+
+\def\name{\tt GFtoPK}
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{GFtoPK}, version 2.4
+from January 2014, to Unix. \namefpc\ is based on Free~Pascal,
+version 3.0.0
+
+\namefpc\ expects the input file (\.{.gf}) and the output file
+(\.{.pk}) on the command line.
+To support shell scripting, it sets the exit code to one
+when something was wrong with the input file.
+
+\hint
+
+Comments and questions are welcome!
+
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is GFtoPK, Version 2.4' {printed when the program starts}
+@y
+@d banner=='This is GFtoPK-FPC'
+ {printed when the program starts}
+@z
+
+[3] default case branch
+@x
+@d othercases == others: {default for cases not listed explicitly}
+@y
+@d othercases == @+else {default for cases not listed explicitly}
+@z
+
+[4] filenames from commandline
+@x
+@p program GFtoPK(@!gf_file,@!pk_file,@!output);
+@y
+@p@{@&$M@&O@&D@&E D@&E@&L@&P@&H@&I@}
+
+ program GFtoPK(@!output);
+@z
+
+[8] pint end of line at end of line
+@x
+@d abort(#)==begin print(' ',#); jump_out;
+@y
+@d abort(#)==begin print_ln(' ',#); history := 1; jump_out;
+@z
+
+[8] cannot use nonlocal goto in DELPHI-Mode
+@x
+begin goto final_end;
+@y
+begin halt(history);
+@z
+
+[39] get gf file name from command line
+@x
+begin reset(gf_file);
+@y
+begin assign(gf_file, param_str(1)); reset(gf_file);
+@z
+
+[40] get pk file name from command line
+@x
+begin rewrite(pk_file);
+@y
+begin assign(pk_file, param_str(2)); rewrite(pk_file);
+@z
+
+[46] Random access
+@x
+ set_pos(gf_file, -1) ; gf_len := cur_pos(gf_file) ;
+@y
+ gf_len := file_size(gf_file); seek(gf_file, gf_len);
+@z
+
+@x
+ set_pos(gf_file, n); gf_loc := n ;
+@y
+ seek(gf_file, n); gf_loc := n ;
+@z
+
+[51] check command line arguments
+@x
+ open_gf_file ;
+@y
+ if param_count <> 2 then abort('Usage: gftopk gf-file pk-file');
+ open_gf_file ;
+@z
+
+[88 ff] system dependent changes
+@x
+itself will get a new section number.
+@^system dependencies@>
+@y
+itself will get a new section number.
+@^system dependencies@>
+
+@<Glob...@>=
+@! history : integer;
+
+@ @<Set init...@>=
+history := 0;
+@z
diff --git a/systems/unix/tex-fpc/shell/itgl b/systems/unix/tex-fpc/shell/itgl
new file mode 100755
index 0000000000..2fca45acc6
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/itgl
@@ -0,0 +1,6 @@
+case $# in
+1) b=`basename $1 .web`; tangle $1 /dev/null ini$b.p $b.pool;;
+2) b=`basename $2 .ch`; tangle $1 $2 ini$b.p $b.pool;;
+*) echo Usage: `basename $0` web-file [ ch-file ] ; exit 1
+esac && \
+fpc ini$b.p
diff --git a/systems/unix/tex-fpc/shell/mk_MF_dir b/systems/unix/tex-fpc/shell/mk_MF_dir
new file mode 100755
index 0000000000..f91e0156c8
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/mk_MF_dir
@@ -0,0 +1,3 @@
+# Prepare the current directory to run METAFONT, mkfont and mkpkfont
+ln -s ~/MFbases .
+ln -s ~/MFinputs .
diff --git a/systems/unix/tex-fpc/shell/mk_TeX_dir b/systems/unix/tex-fpc/shell/mk_TeX_dir
new file mode 100755
index 0000000000..bf6dcaa8c1
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/mk_TeX_dir
@@ -0,0 +1,6 @@
+# Prepare the current directory to run TeX, dvips and xdvi
+ln -s ~/TeXinputs .
+ln -s ~/TeXformats .
+ln -s ~/TeXfonts .
+ln -s ~/PKfonts .
+ln -s ~/DVIPSconf .
diff --git a/systems/unix/tex-fpc/shell/mkfont b/systems/unix/tex-fpc/shell/mkfont
new file mode 100755
index 0000000000..06d8dd3506
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/mkfont
@@ -0,0 +1,15 @@
+# Install .tfm and . pk files from .mf files for TeX-GPC
+f=`basename $1 .mf`
+case $# in
+1) mag=1;;
+2) mag=$2;;
+*) echo Usage: $0 mf-file [ magnification ]; exit 1
+esac
+echo $0: $f magnification=$mag
+rm -f $f.*gf
+mf "\\mode=localfont; mag=$mag; batchmode; input $1"\
+&& gftopk $f.*gf `echo $f.*gf | sed 's/gf$/pk/'` \
+&& mv $f.*pk PKfonts/ \
+&& mv $f.tfm TeXfonts/ \
+&& rm $f.log && rm $f.*gf \
+|| echo $0 $1 $mag >>trouble
diff --git a/systems/unix/tex-fpc/shell/mkpkfont b/systems/unix/tex-fpc/shell/mkpkfont
new file mode 100755
index 0000000000..4eb23f8ac3
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/mkpkfont
@@ -0,0 +1,19 @@
+# install pk-file from mf-file for TeX-GPC
+#
+# xdvi expects the path name of the generated .pk file in the first
+# line of stdout, so redirect mf's stdout to stderr.
+f=`basename $1 .mf`
+case $# in
+1) mag=1;;
+2) mag=$2;;
+*) echo Usage: $0 mf-file [ magnification ]; exit 1
+esac
+rm -f $f.*gf
+rm -f $f.*pk
+mf '\mode=localfont; mag='$mag'; batchmode; input' $1 </dev/null >&2 \
+&& pkname=`echo $f.*gf | sed 's/gf$/pk/'` \
+&& gftopk $f.*gf $pkname >&2 \
+&& mv $f.*pk PKfonts/ \
+&& echo PKfonts/$pkname \
+&& rm $f.tfm && rm $f.log && rm $f.*gf \
+|| (echo $0 $1 $mag >>trouble; exit 1)
diff --git a/systems/unix/tex-fpc/shell/tgl b/systems/unix/tex-fpc/shell/tgl
new file mode 100755
index 0000000000..cb390d3150
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/tgl
@@ -0,0 +1,6 @@
+case $# in
+1) b=`basename $1 .web`; tangle $1 /dev/null $b.p /dev/null;;
+2) b=`basename $2 .ch`; tangle $1 $2 $b.p /dev/null;;
+*) echo Usage: `basename $0` web-file [ ch-file ] ; exit 1
+esac && \
+fpc $b.p
diff --git a/systems/unix/tex-fpc/shell/wve b/systems/unix/tex-fpc/shell/wve
new file mode 100755
index 0000000000..a445975cb6
--- /dev/null
+++ b/systems/unix/tex-fpc/shell/wve
@@ -0,0 +1,6 @@
+case $# in
+1) b=`basename $1 .web`; weave $1 /dev/null $b.tex;;
+2) b=`basename $1 .web`; weave $1 $2 $b.tex;;
+*) echo Usage: `basename $0` web-file [ ch-file ]; exit 1
+esac && \
+tex $b
diff --git a/systems/unix/tex-fpc/tech/german.ed b/systems/unix/tex-fpc/tech/german.ed
new file mode 100644
index 0000000000..89ba82cf2f
--- /dev/null
+++ b/systems/unix/tex-fpc/tech/german.ed
@@ -0,0 +1,5 @@
+219c
+\expandafter\def\csname grq \endcsname{%
+.
+w
+q
diff --git a/systems/unix/tex-fpc/tech/mktech b/systems/unix/tex-fpc/tech/mktech
new file mode 100755
index 0000000000..e81c623455
--- /dev/null
+++ b/systems/unix/tex-fpc/tech/mktech
@@ -0,0 +1,17 @@
+# Schritt 1: Formatdatei bauen.
+# Hierzu muss die Konstante TRIESIZE vergroessert werden.
+# 16844 ist schon zu klein, obwohl TeX behauptet, er braucht weniger
+# als 14000 (im log-file).
+sed /TRIESIZE=8000/s//TRIESIZE=16845/ ../tex/initex.p >initech.p
+fpc initech.p
+initech 'schlicht \dump'
+# Schritt 2: Den Namen der Formatdatei und die TRIESIZE anpassen.
+# Wenn die TRIESIZE hier nicht angepasst wird, kann er die Formatdatei
+# nicht laden.
+# Die Laenge des Namens muss mit der Laenge von 'plain' uebereinstimmen,
+# daher die haessliche Abkuerzung.
+mv schlicht.fmt TeXformats/schli.fmt
+sed -e /plain.fmt/s//schli.fmt/\
+ -e /TRIESIZE=8000/s//TRIESIZE=16845/\
+ ../tex/tex.p >tech.p
+fpc tech.p
diff --git a/systems/unix/tex-fpc/tech/readme b/systems/unix/tex-fpc/tech/readme
new file mode 100644
index 0000000000..98ed483e67
--- /dev/null
+++ b/systems/unix/tex-fpc/tech/readme
@@ -0,0 +1,30 @@
+$\pi$-Tag 2010
+TeCH: TeX mit deutschen Trennmustern
+Die hier vorgeschlagene Konfiguration der Trennmuster ist kompatibel
+zu anderen Distributionen. Sie enth"alt US-Englisch und Deutsch
+(nach der bew"ahrten Rechtschreibung). Voreingestellt ist US-Englisch.
+
+Installation:
+Die deutschen Trennmuster holen:
+ftp ftp://ftp.dante.de/pub/tex/macros/ec-plain/ghyph31.tex
+Und tech bauen:
+$ mktech
+Dies erzeugt das Programm tech. Am besten ins bin-Verzeichnis damit.
+
+Das Macropaket german.sty holen:
+ftp ftp://ftp.dante.de/pub/tex/language/german/german.sty
+
+Diese Datei mit dem Datum vom 13.04.199 enth"alt einen Fehler,
+das \grq verschwindet. Mit
+ed <german.ed german.sty
+kann man diesen Fehler korrigieren.
+
+Um die Installation zu testen, tech test aufrufen.
+Die Datei test.tex fa"st die Hinweise aus gerdoc, dem Handbuch f"ur
+german.sty, zusammen.
+Die Datei german.sty ins Verzeichnis TeXinputs stellen.
+
+Nach dem Laden des Pakets german.sty ist deutsch voreingestellt.
+
+\originalTeX zum Zur"uckschalten auf plain.tex
+"FF als Zahl sollte "0FF geschrieben werden.
diff --git a/systems/unix/tex-fpc/tech/schlicht.tex b/systems/unix/tex-fpc/tech/schlicht.tex
new file mode 100644
index 0000000000..ce5a1eeb85
--- /dev/null
+++ b/systems/unix/tex-fpc/tech/schlicht.tex
@@ -0,0 +1,14 @@
+%% hier kommen die deutschen Trenntabellen rein.
+\input ../lib/plain.tex
+\catcode`@=11 % at signs are letters again
+\chardef\l@USenglish=\language
+\chardef\l@english=\language
+\newlanguage\l@german \language=\l@german
+\chardef\l@austrian=\language
+\chardef\l@french=\language
+\input ghyph31
+\message{erledigt.}
+%% auf USEnglisch voreinstellen
+\language=\l@USenglish
+\catcode`@=12 % at signs are no longer letters again
+\def\fmtname{schlicht}\def\fmtversion{3.141592653} %
diff --git a/systems/unix/tex-fpc/tech/test.tex b/systems/unix/tex-fpc/tech/test.tex
new file mode 100644
index 0000000000..d25c721da0
--- /dev/null
+++ b/systems/unix/tex-fpc/tech/test.tex
@@ -0,0 +1,95 @@
+\parindent=0pt
+\overfullrule=0pt
+Hier wird gepr\"uft, ob die Einstellungen von plain \TeX erhalten bleiben.
+\ifnum\language=0\else\errmessage{language nicht 0}\fi
+\ifnum\lefthyphenmin=2\else\errmessage{lefthyphenmin nicht 2}\fi
+\ifnum\righthyphenmin=3\else\errmessage{righthyphenmin nicht 3\fi
+\par und jetzt geht's los:
+\input german.sty
+
+% Das Anf"uhrungszeichen wird schon bei der Definition eines Makros
+% als aktives Zeichen behandelt, nicht erst bei der Expansion.
+\def\qq#1{"`{\tt\char`\" #1}"'}
+
+% Wird hier zwar nicht gebraucht, aber gut zu wissen!
+\def\qq#1{{\tt\char`\" #1}}
+\def\bs#1{{\tt\char`\\ #1}}
+
+\par Die deutschen Trennparameter
+\par Nummer der deutschen Trennmuster: \the\language
+\par Minimall"ange vor dem Trennstrich: \the\lefthyphenmin
+\par Minimall"ange nach dem Trennstrich: \the\righthyphenmin
+\originalTeX
+\par und die originalen Trennparameter:
+\par Nummer der US-Trennmuster: \the\language
+\par Minimall\"ange vor dem Trennstrich: \the\lefthyphenmin
+\par Minimall\"ange nach dem Trennstrich: \the\righthyphenmin
+\germanTeX
+\par Die Trema \qq o und \bs {\char`\"} sind gleich hoch: sch"on und sch\"on
+\originalTeX
+\par In plain \TeX\ sind die Trema h\"oher.
+\germanTeX
+\par Hier gibt es Unterschiede, bei \bs {\char`\"} sind die Trema tiefer:
+Citro"en und Citro\"en
+\originalTeX
+\par und so siehts in plain \TeX\ aus: Citro\"en.
+\germanTeX
+\par Stra"se Ma"ze,
+STRA"SE MA"ZE
+\par "`Anf"uhrungszeichen"' und \glq halbe Anf"uhrungszeichen\grq
+\vskip 1cm
+Warum wird Stra"se nicht getrennt, Ma"se aber sehr wohl?
+
+\centerline{\vbox {\hsize 1pt Stra"se, Ma"se}}
+
+Weil \TeX\ nicht das erste Wort im Paragraphen trennt!
+
+\centerline{\vbox {\hsize 1pt Ma"se, Stra"se}}
+\vskip 1cm
+\par\qq{ck}, \qq{ll}, \qq{tt}, \qq{ff}: Dru"cker, Ro"lladen, Be"ttuch,
+Schi"ffahrt (\TeX\ denkt hier, "`Dru"' sei ein Wort,
+denn \qq{ck} ist, wie alle Befehle, ein Worttrenner.):
+
+\centerline {\vbox {\hsize 1pt Dru"cker, Ro"lladen, Be"ttuch, Schi"ffahrt}}
+\vskip 1cm
+Auflage ({\tt fl}) und Auf"|lage ({\tt f\qq |l}) werden gleich getrennt:
+
+\centerline{\vbox {\hsize 1pt Auf"|lage, Auflage}}
+\eject
+\bs - deaktiviert alle anderen Trennstellen, aber nicht so \qq-:
+
+\centerline{\vbox {\hsize 1pt \relax A "ubertragen, "uber\-tragen, "uber"-tragen }}
+\vskip 1cm
+{\tt -} ist eine Trennstelle, aber nicht \qq {\char`~}:
+
+\centerline{\vbox {\hsize 1pt A bergauf und -ab, bergauf und "~ab}}
+\vskip 0,5cm
+\centerline{\vbox {\hsize 1pt I-Punkt, I"~Punkt}}
+\vskip 1cm
+{\tt -} deaktiviert alle anderen Trennstellen, aber nicht so \qq=:
+
+\centerline{\vbox {\hsize 1pt A Arbeiter-Unfallgesetz, Arbeiter"=Unfallgesetz}}
+\eject
+\bs- verhindert falsche Trennungen, die \qq- erm"oglicht:
+
+\centerline{\vbox {\hsize 1pt A Bedienoberfl"ache, Bedien"-oberfl"ache,
+ Be\-dien"-oberfl"ache}}
+\vskip 1cm
+\qq{\char`\"} unterdr"uckt den Trennstrich: (Wer braucht das?)
+
+\centerline{\vbox {\hsize 1pt Wolf""gang}}
+\vskip 1cm
+Was ist sch"oner: "`Wolfgang"' oder "`\negthinspace Wolfgang"',
+{ \it"`Hof"'\/} oder {\it "`Hof\/"'\/}, "`Hof"' oder "`Hof\/"'?
+\eject
+Die originalen Trennmuster:
+\selectlanguage{USenglish}
+
+\centerline{\vbox {\hsize 1pt A Arbeiterunfallversicherung awsome astonished}}
+\vskip 1cm
+
+Und die deutschen nach bew"ahrter Rechtschreibung:
+\selectlanguage{german}
+
+\centerline{\vbox {\hsize 1pt A Arbeiterunfallversicherung awsome astonished}}
+\end
diff --git a/systems/unix/tex-fpc/tex-fpc.pdf b/systems/unix/tex-fpc/tex-fpc.pdf
new file mode 100644
index 0000000000..6222dd48d6
--- /dev/null
+++ b/systems/unix/tex-fpc/tex-fpc.pdf
Binary files differ
diff --git a/systems/unix/tex-fpc/tex/otex.ch b/systems/unix/tex-fpc/tex/otex.ch
new file mode 100644
index 0000000000..d84408e65d
--- /dev/null
+++ b/systems/unix/tex-fpc/tex/otex.ch
@@ -0,0 +1,1070 @@
+% This is a change file of TeX for GNU Pascal, Wolfgang Helbig, Nov. 2007
+% Handle command line as the first line, Apr. 2008
+% Open vi at the offending line in error dialog Apr. 2008
+% Avoid an underful last line, use buffered output for dvi file, Jul. 2008
+% That "finished" the program. But I kept on improving:
+% July 2008:
+% Don't print empty lines on terminal and log file.
+% Don't trim ninput lines.
+% November 2009:
+% The last improvement caused an error: On reading a blank only
+% first line might go into a loop. This error cannot be noticed by the user.
+% It was noticed by Joachim Kuebart
+% Some changes were necessary run TeX_GPC to Mac OS X
+% with the current version of GPC. (pointed out by Martin Monperrus and
+% Luis Rivera)
+% July 2016: Switch from GNU Pascal to Free Pascal
+% There is no GPC on Mac OS X, Debian 8, OpenBSD.
+%
+
+[0] About TeX-FPC
+@x
+\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
+@y
+\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
+\input webmac-fpc
+
+\emergencystretch 0.6in % avoid overfull boxes
+
+\let\maybe=\iffalse % print changed modules only.
+
+% put a mark in the left margin. (see Exercise 14.28 in The TeXbook)
+\def\marke#1{\strut\vadjust{\kern-\dp\strutbox\vbox to 0pt{\vss
+ \llap{\bf #1\/\quad\strut}}}\ignorespaces }
+
+\def\name{\TeX}
+
+\N0\*. \[0] About \namefpc.
+\namefpc\ is a Unix implementation of Donald~E. Knuth's \TeX82 in
+the version 3.14159265 from January 2014. It is based on Free~Pascal.
+The accompaning \.{README} file tells you how to build and run
+\namefpc. To help you identify the differences of \TeX82 and
+\namefpc, the numbers of modified modules carry an asterisk. Letters
+in the left margin indicate the reason for a change. They mean:
+\medskip
+\item{\bf E} fixes an error in \TeX82
+\item{\bf e} fixes a small error in \TeX82
+\item{\bf F} adds a feature as suggested by Knuth
+\item{\bf P} removes a violation of Pascal (Jensen, Wirth: {\sl Pascal
+User Manual and Report\/}, 3rd edition, 1985)
+\item{\bf X} an FPC extension
+\item{\bf U} make Unix happy
+\item{\bf u} make Unix user happy
+\item{\bf h} make Helbig happy
+\item{\bf N} a note that helped me to understand this program.
+\item{\bf B} a bug I couldn't fix.
+\medskip
+
+Identifiers that come with FPC~Pascal are coded as \.{WEB} macros and prefixed
+by `\\{fpc\_}'. That helps to resolve name clashes.
+\filbreak
+\namefpc\ is slightly slower than web2c based programs. To compile
+the device independend file for this document, the web2c version from \TeX~Life 2008
+ran 1.1 seconds and \namefpc\ 1.2 seconds.
+\filbreak
+Going with Dijkstra, see
+\.{http://www.cs.utexas.edu/users/EWD/videos/noorderlicht.mpg}, I
+don't believe in version numbers, since I don't believe in maintaining
+software---I consider \namefpc\ finished---and it must go without
+a number. This does not mean that I don't care any more about
+\namefpc; comments or questions are quite welcome. In fact, I
+tried to explain why I changed what and how in order to encourage
+you to undertake further modifications or bugfixes yourself and
+I'll be glad to help.
+\filbreak
+The 2008 edition of \namegpc\ was tested on NetBSD 3.1 and GPC~20020510,
+which happens to be the version of GNU~Pascal offered in the NetBSD
+package collection. The final edition of \namegpc was built in July
+2014 on Mac~OS~X 10.6.2 and GPC~20070904. This is the first edition
+of \namefpc which was built on Mac~OS~X 10.11.5 and FPC~3.0.0.
+The switch to FPC was necessary because Mac-OS-X broke GPC~20070904.
+And the switch was possible, because finally FPC accepts ISO-Pascal.
+\filbreak
+Joachim Kuebart spotted an error in the 2008 edition. When the
+first line consists of blanks only, a loop is not terminated properly.
+Joachim found this by reading this document, not by running \namegpc.
+This in turn motivated me to improve the comments resulting in a
+lot of changes.
+\filbreak
+\namefpc\ slightly differs from \TeX: On input, trailing blanks are
+not removed, on input of the first line, leading blanks are not
+removed either. This lets you interactively enter `\.{I \\showbox0\
+}' to make \namefpc\ show box 0. This doesn't work if the trailing
+blank were removed.
+
+\TeX\ writes an additional empty line whenever it prompts you on
+the terminal. \namefpc\ doesn't. Finally \TeX\ emits an `\.{Underfull
+\\hbox}' warning whenever the last line of a paragraph happens to include
+glue only, because then \TeX\ would erroneously remove the
+\.{parfillskip}. \namefpc\ will keep it.
+
+% \TeX82 will emit an underfull box warning here, \namefpc\ won't.
+\setbox0=\hbox to \hsize {\hfil\ \strut}
+\noindent\box0\ \ \par
+\bigskip
+\address
+\fi
+@z
+
+[2] Change the banner line
+@x
+known as `\TeX' [cf.~Stanford Computer Science report CS1027,
+November 1984].
+
+@d banner=='This is TeX, Version 3.14159265' {printed when \TeX\ starts}
+@y
+known as `\TeX' [cf.~Stanford Computer Science report CS1027,
+November 1984].
+
+\marke h Since \namefpc\ differs from \TeX\ to make me happy, I have to
+change the banner line.
+
+@d banner=='This is TeX-FPC'
+@z
+
+[4] program header
+@x
+@d mtype==t@&y@&p@&e {this is a \.{WEB} coding trick:}
+@y
+
+\marke P Pascal wants the identifiers of the standard text files
+\\{input} and \\{output} in the parameterlist of the program header.
+
+\marke N One of the \.{WEB} macros is named \\{input}
+as well. To make \.{TANGLE} write \.{INPUT} into the Pascal source
+file instead of the expansion of the macro, you code the name as
+a concatenation of one letter identifiers since one letter identifiers
+cannot be macro names. The same
+applies to \\{type}.
+
+@d term_in==i @& n @& p @& u @& t
+@d term_out==o @& u @& t @& p @& u @& t
+@d mtype==t @& y @& p @& e
+@f mtype==type
+@z
+
+[4] program header
+@x
+program TEX; {all file names are defined dynamically}
+@y
+program TEX(@!term_in,@!term_out);
+@z
+
+Since @x, @y, and @z only define a change block when they begin a
+line, you deactivate a block by indenting it (shift right) and
+activate it by unindenting it (shift left). With vi set the cursor
+to the @x line and type >} or <} to (un)indent a paragraph.
+
+[7] shift left to turn debugging on, right to turn it off
+@x
+@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
+@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
+@y
+@d debug== {change this to `$\\{debug}\equiv\.{@@\{}$' when not debugging}
+@d gubed== {change this to `$\\{gubed}\equiv\.{@@\}}$' when not debugging}
+@z
+
+[7] shift left to turn stats on, right to turn them off.
+@x
+@d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering
+ usage statistics}
+@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering
+ usage statistics}
+@y
+@d stat== {change this to `$\\{stat}\equiv\.{@@\{}$' to turn off statistics}
+@d tats== {change this to `$\\{tats}\equiv\.{@@\}}$' to turn off statistics}
+@z
+
+
+[8] shift left to build TEX and right to build INITEX.
+@x initex
+@d init== {change this to `$\\{init}\equiv\.{@@\{}$' in the production version}
+@d tini== {change this to `$\\{tini}\equiv\.{@@\}}$' in the production version}
+@y
+@d init==@{ {change this to `$\\{init}\equiv $' for \.{INITEX}}
+@d tini==@t@>@} {change this to `$\\{tini}\equiv $' for \.{INITEX}}
+@z
+
+[9] compiler directives, turn off I/O checking.
+@x
+@^overflow in arithmetic@>
+@y
+@^overflow in arithmetic@>
+
+\marke X If the first character of a \PASCAL\ comment is a dollar
+sign, Free~Pascal treats the comment as a ``compiler directive''.
+FPC aborts when it detects an I/O error. To let \namefpc\ handle
+an I/O error while opening an input file, you have to turn off I/O
+checking altogether by the \.{I-} directive.
+
+\marke X $GOTO is not harmful. So turn it on!
+
+\marke X $MODE ISO sets integer size to 32 bit, defines file procedures
+get, put and allows nonlocal gotos.
+
+\marke b In contrast to \ph\ Free~Pascal offers no directive to
+check for arithmetic overflow.
+
+\marke e Knuth suggests to turn on range checking while debugging.
+FPC aborts when it spots range violation. Those violations might
+happen when the debugger shows a memery cell assumed to contain a
+|glue_ratio|. Even though turning of range checking doubles the
+speed of \TeX\ I suggest to turn it on when not debugging, just to
+get another check from Knuth for discovering an error.
+
+@^system dependencies@>
+@^GNU Pascal@>
+@z
+
+[9] compiler directives, turn off I/O checking, continued
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@{@&$I-@} {no I/O checking}
+@{@&$M@&O@&D@&E I@&S@&O@}
+@!debug @{@&$R-@}@+ gubed {no range check while debugging}
+@z
+
+[10] default case branch
+@x
+\PASCAL s have, in fact, done this, successfully but not happily!)
+@:PASCAL H}{\ph@>
+
+@d othercases == others: {default for cases not listed explicitly}
+@y
+\PASCAL s have, in fact, done this, successfully but not happily!)
+@:PASCAL H}{\ph@>
+
+\marke G This is the only place I voluntarily use an FPC extension
+to Pascal.
+@^FPC Pascal@>
+
+@d othercases == @+ else {default for cases not listed explicitly}
+@z
+
+[11]
+@x
+in production versions of \TeX.
+@y
+in production versions of \TeX.
+
+\marke N I didn't change the constants, leaving it up to you to
+adopt them to your task. Just keep the Pascal source for \.{tex}
+around. So you can change them without going all the way through
+modifying \.{tex.ch} and tangeling it. Note that for \.{initex}
+|mem_top| and |mem_max| must agree.
+
+\marke U One of the constants is the filename of the string pool
+file which needs an adoption to Unix.
+@z
+
+The changes headed by trip need to be made for the trip test suite.
+
+[11]
+ @x trip
+ @!mem_max=30000; {greatest index in \TeX's internal |mem| array;
+ @y
+ @!mem_max=3000; {greatest index in \TeX's internal |mem| array;
+ @z
+
+[11]
+ @x trip
+ @!mem_min=0; {smallest index in \TeX's internal |mem| array;
+ @y
+ @!mem_min=1; {smallest index in \TeX's internal |mem| array;
+ @z
+
+[11]
+ @x trip
+ @!error_line=72; {width of context lines on terminal error messages}
+ @!half_error_line=42; {width of first lines of contexts in terminal
+ error messages; should be between 30 and |error_line-15|}
+ @!max_print_line=79; {width of longest text lines output; should be at least 60}
+ @y
+ @!error_line=64; {width of context lines on terminal error messages}
+ @!half_error_line=32; {width of first lines of contexts in terminal
+ error messages; should be between 30 and |error_line-15|}
+ @!max_print_line=72; {width of longest text lines output; should be at least 60}
+ @z
+
+[11] location of pool file
+@x
+@!pool_name='TeXformats:TEX.POOL ';
+@y
+@!pool_name='TeXformats/tex.pool'; { \marke X arrays of different length are
+assignment compatible. }
+@z
+
+
+[12]
+ @x trip
+ @d mem_bot=0 {smallest index in the |mem| array dumped by \.{INITEX};
+ must not be less than |mem_min|}
+ @d mem_top==30000 {largest index in the |mem| array dumped by \.{INITEX};
+ must be substantially larger than |mem_bot|
+ and not greater than |mem_max|}
+ @y
+ @d mem_bot=1 {smallest index in the |mem| array dumped by \.{INITEX};
+ must not be less than |mem_min|}
+ @d mem_top==3000 {largest index in the |mem| array dumped by \.{INITEX};
+ must be substantially larger than |mem_bot|
+ and not greater than |mem_max|}
+ @z
+
+
+[25]
+@x
+for us to specify simple operations on word files before they are defined.
+@y
+for us to specify simple operations on word files before they are
+defined.
+
+\marke X
+@d fpc_byte==b @& y @& t @& e
+@d fpc_string == r@&a@&w@&b@&y@&t@&e@&s@&t@&r@&i@&n@&g
+
+@^FPC Pascal@>
+@z
+
+[25] the type of text_files is text
+@x
+@!eight_bits=0..255; {unsigned one-byte quantity}
+@!alpha_file=packed file of text_char; {files that contain textual data}
+@y
+@!eight_bits=fpc_byte; {unsigned one-byte quantity}
+@!alpha_file=t @& e @& x @& t; {\marke P Pascal requires |text|}
+@z
+
+[27]
+@x
+\TeX's file-opening procedures return |false| if no file identified by
+|name_of_file| could be opened.
+
+@d reset_OK(#)==erstat(#)=0
+@d rewrite_OK(#)==erstat(#)=0
+@y
+\marke X In Pascal, external files must occur in the program heading
+and FPC~Pascal asks the user whenever an external file is
+opened. But \.{initex} wants to reset \.{tex.pool} and rewrite
+\.{plain.fmt} without asking
+the user for the file name.
+FPC~Pascal lets you assign the file name to an external file.
+The function |fpc_io_result| returns a nonzero value if any
+error occurred since the last invocation of |fpc_io_result|.
+
+@^GNU Pascal@>
+@^system dependencies@>
+
+@d fpc_io_result==i@&o@&r@&e@&s@&u@&l@&t
+@d fpc_assign==a@&s@&s@&i@&g@&n
+@d reset_OK(#)==fpc_io_result=0
+@d rewrite_OK(#)==fpc_io_result=0
+@d clear_io_result==@+if fpc_io_result=0 then do_nothing
+@z
+
+[27] reset and rewrite for each of three file types
+@x alpha_file
+begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f);
+a_open_in:=reset_OK(f);
+@z
+@x
+begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+a_open_out:=rewrite_OK(f);
+@z
+
+byte_file
+@x
+begin reset(f,name_of_file,'/O'); b_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f);
+b_open_in:=reset_OK(f);
+@z
+@x
+function b_open_out(var f:byte_file):boolean;
+ {open a binary file for output}
+begin rewrite(f,name_of_file,'/O'); b_open_out:=rewrite_OK(f);
+@y
+function b_open_out(var f:byte_file):boolean;
+ {open a binary file for output}
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+b_open_out:=rewrite_OK(f);
+@z
+
+@x word_file
+begin reset(f,name_of_file,'/O'); w_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f); w_open_in:=reset_OK(f);
+@z
+@x
+begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+w_open_out:=rewrite_OK(f);
+@z
+
+[31]
+@x
+finer tuning is often possible at well-developed \PASCAL\ sites.
+@^inner loop@>
+
+@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+var last_nonblank:0..buf_size; {|last| with trailing blanks removed}
+begin if bypass_eoln then if not eof(f) then get(f);
+ {input the first character of the line into |f^|}
+last:=first; {cf.\ Matthew 19\thinspace:\thinspace30}
+if eof(f) then input_ln:=false
+else begin last_nonblank:=first;
+ while not eoln(f) do
+ begin if last>=max_buf_stack then
+ begin max_buf_stack:=last+1;
+ if max_buf_stack=buf_size then
+ @<Report overflow of the input buffer, and abort@>;
+ end;
+ buffer[last]:=xord[f^]; get(f); incr(last);
+ if buffer[last-1]<>" " then last_nonblank:=last;
+ end;
+ last:=last_nonblank; input_ln:=true;
+ end;
+end;
+@y
+finer tuning is often possible at well-developed \PASCAL\ sites.
+@^inner loop@>
+
+\marke h Since \namefpc\ does not remove trailing spaces, |buffer[last-1]|
+might hold a space.
+
+\marke P
+\ph\ lets you |reset| the terminal input file with the first |get|
+`surpressed'. For several reasons, this feature is not exploited by
+\namefpc. First, it is not provided by GPC. Second rightly so, since
+it violates the specification of Pascal. Third, it makes the program
+quite ugly by destroying the beautiful equivalence of terminal and
+disk files. Fourth, since \namefpc\ uses Pascal's standard text
+file |input|, it should not reset that file at all. Fifth, surpressing
+the first |get| is offered by \ph\ to address a problem, namely
+that the program stays in the reset function waiting for user input
+and this problem is solved much more beautiful by ``lazy I/O'',
+whereby the program only waits for user input if it is needed. This
+is suggested in the {\sl Pascal User Manual}, implemented by
+GNU~Pascal and exploited by \namefpc. This leads to a much cleaner
+implementaion of |input_ln|, which can always savely assume that
+|f^| holds the first character of the next line. This condition is
+established by Pascal's |reset| and maintained by |input_ln|.
+
+\marke h
+Unlike \TeX82 \namefpc\ leaves trailing spaces in the input line.
+
+@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+var ch: char;
+begin
+ {ignore |bypass_eoln|. Assuming |f| being positioned at the first character}
+last:=first; {cf.\ Matthew 19\thinspace:\thinspace30}
+if eof(f) then input_ln:=false
+else begin
+ while not eoln(f) do
+ begin if last>=max_buf_stack then
+ begin max_buf_stack:=last+1;
+ if max_buf_stack=buf_size then begin
+ read_ln(f); {complete the current line}
+ @<Report overflow of the input buffer, and abort@>;
+ end;
+ end;
+ read(f, ch); buffer[last]:=xord[ch]; incr(last);
+ end;
+ read_ln(f); {Advance |f| to the first character of the next line}
+ input_ln:=true;
+ end;
+end;
+@z
+
+[32] term_in and term_out are the standard pascal files
+@x
+is considered an output file the file variable is |term_out|.
+@^system dependencies@>
+
+@<Glob...@>=
+@!term_in:alpha_file; {the terminal as an input file}
+@!term_out:alpha_file; {the terminal as an output file}
+@y
+is considered an output file the file variable is |term_out|.
+\marke P Pascal's standard text files are declared implicitly.
+@z
+
+[33]
+@x
+@ Here is how to open the terminal files
+in \ph. The `\.{/I}' switch suppresses the first |get|.
+@:PASCAL H}{\ph@>
+@^system dependencies@>
+
+@d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input}
+@d t_open_out==rewrite(term_out,'TTY:','/O') {open the terminal for text output}
+@y
+@ Here is how to open the terminal files
+in \ph. The `\.{/I}' switch suppresses the first |get|.
+@:PASCAL H}{\ph@>
+@^system dependencies@>
+
+\marke P In Pascal, the standard text files are openend implicitly.
+
+@d t_open_in==do_nothing {open the terminal for text input}
+@d t_open_out==do_nothing {open the terminal for text output}
+@z
+
+[34]
+@x
+some instruction to the operating system. The following macros show how
+these operations can be specified in \ph:
+@:PASCAL H}{\ph@>
+@^system dependencies@>
+@y
+some instruction to the operating system.
+
+\marke X
+Unix holds terminal output, when it receives \.{\^S} and
+continues writing to the terminal, when it receives \.{\^Q}. These
+`flow control' characters only work when sent from the terminal but
+not when sent to the terminal. \marke B Here I give up, since I
+don't know how to restart the output from the writing side so
+\namefpc\ does nothing. Mac OS X does not stop terminal output when
+it receives \.{\^S}.
+
+@^Free Pascal@>
+@^system dependencies@>
+@z
+
+[34]
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@d clear_terminal == break_in(term_in,true) {clear the terminal input buffer}
+@d wake_up_terminal == do_nothing {cancel the user's cancellation of output}
+@y
+@d fpc_flush == f@&l@&u@&s@&h
+@d update_terminal == fpc_flush(term_out) {empty the terminal output buffer}
+@d clear_terminal == do_nothing {clear the terminal input buffer}
+@d wake_up_terminal == do_nothing {cancel the user's cancellation of output}
+@z
+
+[35]
+@x
+ begin write_ln(term_out,'Buffer size exceeded!'); goto final_end;
+@y
+ begin write_ln(term_out,'Buffer size exceeded!'); fpc_halt(3);
+@z
+
+[36] command line
+@x
+not be typed immediately after~`\.{**}'.)
+
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+
+@y
+not be typed immediately after~`\.{**}'.)
+
+\marke F This procedure puts the command line arguments separated
+by spaces into |buffer|. Like |input_ln| it updates |last| so that
+|buffer[first..last)| will contain the command line.
+
+\marke X FPC~Pascal's function~|@!fpc_param_count| gives the number of
+command line arguments. The function~|@!fpc_param_str(n)| returns the
+n-th argument for |0 <= n <= gpc_param_count| in a |@!fpc_string|,
+whose length is returned by the function~|@!gpc_length|.
+A |fpc_string| is like a |packed array[1..fpc_length] of char| with
+varying length.
+
+@^FPC Pascal@>
+@^system dependencies@>
+
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+@d fpc_length==l @& e @& n @& g @& t @& h
+@d fpc_param_count==p @& a @& r @& a @& m @& c @& o @& u @& n @& t
+@d fpc_param_str==p @& a @& r @& a @& m @&s @& t @& r
+ {FPC function returning the length of a |fpc_string|}
+
+@p procedure input_command_ln; {get the command line in |buffer|}
+var argc: integer; {argument counter}
+ arg: fpc_string; {argument}
+ cc: integer; {character counter in argument}
+begin last := first; argc := 1;
+while argc <= fpc_param_count do
+ begin cc := 1; arg := fpc_param_str(argc); incr(argc);
+ while cc <= fpc_length(arg) do
+ begin
+ if last+1>=buf_size then
+ @<Report overflow of the input buffer, and abort@>;
+ buffer[last] := xord[arg[cc]]; incr(last); incr(cc);
+ end;
+ if (argc <= fpc_param_count) then begin
+ buffer[last] := " "; incr(last); {insert a space between arguments}
+ end;
+ end;
+end;
+@z
+
+[37] command line.
+@x
+@ The following program does the required initialization
+without retrieving a possible command line.
+It should be clear how to modify this routine to deal with command lines,
+if the system permits them.
+@^system dependencies@>
+
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in;
+loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal;
+@.**@>
+ if not input_ln(term_in,true) then {this shouldn't happen}
+ begin write_ln(term_out);
+ write(term_out,'! End of file on the terminal... why?');
+@.End of file on the terminal@>
+ init_terminal:=false; return;
+ end;
+ loc:=first;
+ while (loc<last)and(buffer[loc]=" ") do incr(loc);
+ if loc<last then
+ begin init_terminal:=true;
+ return; {return unless the line was all blank}
+ end;
+ write_ln(term_out,'Please type the name of your input file.');
+ end;
+exit:end;
+@y
+@ \marke F The following program treats a non empty command line as
+the first line.
+
+The 2008 edition of \namegpc\ erranously assumed |buffer[last-1] <> " "|
+which does not hold if your first line is all blank as Joachim Kuebart noted.
+@^Kuebart, Joachim@>
+
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in; input_command_ln;
+while first=last do begin
+ wake_up_terminal; write(term_out,'**'); update_terminal;
+@.**@>
+ if not input_ln(term_in, true) then {this shouldn't happen}
+ begin write_ln(term_out);
+ write_ln(term_out,'! End of file on the terminal... why?');
+@.End of file on the terminal@>
+ init_terminal:=false; return;
+ end;
+ if first=last then
+ write_ln(term_out,'Please type the name of your input file.');
+ end;
+loc := first;
+init_terminal:=true;
+exit: end;
+@z
+[109]
+@x
+routines cited there must be modified to allow negative glue ratios.)
+@y
+routines cited there must be modified to allow negative glue ratios.)
+
+\marke X In FPC~Pascal the type |fpc_single| is appropiate.
+@d fpc_single== s@&i@&n@&g@&l@&e
+@z
+
+@x
+@!glue_ratio=real; {one-word representation of a glue expansion factor}
+@y
+@!glue_ratio=fpc_single; {one-word representation of a glue expansion
+ factor in GNU~Pascal}
+@^FPC Pascal@>
+@z
+
+[112]
+@x
+macros are simplified in the obvious way when |min_quarterword=0|.
+@^inner loop@>@^system dependencies@>
+
+@d qi(#)==#+min_quarterword
+ {to put an |eight_bits| item into a quarterword}
+@d qo(#)==#-min_quarterword
+ {to take an |eight_bits| item out of a quarterword}
+@d hi(#)==#+min_halfword
+ {to put a sixteen-bit item into a halfword}
+@d ho(#)==#-min_halfword
+ {to take a sixteen-bit item from a halfword}
+@y
+macros are simplified in the obvious way when |min_quarterword=0|.
+\marke X Which is the case with FPC.
+@^inner loop@>@^system dependencies@>
+
+@d qi(#)==#
+ {to put an |eight_bits| item into a quarterword}
+@d qo(#)==#
+ {to take an |eight_bits| item out of a quarterword}
+@d hi(#)==#
+ {to put a sixteen-bit item into a halfword}
+@d ho(#)==#
+ {to take a sixteen-bit item from a halfword}
+@z
+
+[360] Don't print empty lines
+@x
+@ All of the easy branches of |get_next| have now been taken care of.
+There is one more branch.
+@y
+@ All of the easy branches of |get_next| have now been taken care of.
+There is one more branch.
+
+\marke h \TeX82 ends the current line by calling |print_ln| even
+if the line is empty. This causes an additional empty line, which
+is ugly. Calling |print_nl("")| is smarter. It ends the current
+line only if it is not empty.
+@z
+
+@x
+ print_ln; first:=start;
+@y
+ print_nl(""); first:=start;
+@z
+
+@x [514]
+|TEX_font_area|. These system area names will, of course, vary from place
+to place.
+@y
+|TEX_font_area|. These system area names will, of course, vary from place
+to place.
+
+\marke U Use the Unix file separator.
+@z
+
+[514]
+@x
+@d TEX_area=="TeXinputs:"
+@.TeXinputs@>
+@d TEX_font_area=="TeXfonts:"
+@.TeXfonts@>
+@y
+@d TEX_area=="TeXinputs/" {i.e., a subdirectory of the working directory}
+@.TeXinputs@>
+@d TEX_font_area=="TeXfonts/" {dito}
+@.TeXfonts@>
+@z
+
+[516]
+@x
+ if (c=">")or(c=":") then
+@y
+ if c="/" then {use ``/'' as a file name separator\marke U}
+@z
+
+[519]
+@x
+@d append_to_name(#)==begin c:=#; incr(k);
+@y
+@d fpc_set_length==s@&e@&t@&l@&e@&n@&g@&t@&h
+
+@d append_to_name(#)==begin c:=#; incr(k);
+@z
+
+[519]
+@x
+@!j:pool_pointer; {index into |str_pool|}
+@y
+@!j:pool_pointer; {index into |str_pool|}
+@!rbs: fpc_string;
+@z
+
+[519]
+@x
+if k<=file_name_size then name_length:=k@+else name_length:=file_name_size;
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+end;
+@y
+if k<=file_name_size then name_length:=k@+else name_length:=file_name_size;
+rbs := name_of_file;
+fpc_set_length(rbs, name_length);
+name_of_file := rbs;
+end;
+@z
+
+[521]
+@x
+TEX_format_default:='TeXformats:plain.fmt';
+@y
+TEX_format_default:='TeXformats/plain.fmt';
+ {``/'' is the Unix file name separator\marke U}
+@z
+
+[523]
+@x
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+@y
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+rbs: fpc_string;
+@z
+
+[523]
+@x
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+@y
+rbs := name_of_file;
+fpc_set_length(rbs, name_length);
+name_of_file := rbs;
+@z
+
+[575] Don't check eof
+@x
+if eof(tfm_file) then abort;
+@y
+@z
+
+[816] save pointer to penalty_node
+@x
+same number of |mem|~words.
+@^data structure assumptions@>
+@y
+same number of |mem|~words.
+@^data structure assumptions@>
+
+\marke E
+\TeX82 prunes discardable nodes from the beginning of a new line until
+it reaches a nondiscardable node. Now, if the last line of a paragraph
+contains discardables only, the \.{\\parfillskip} glue at the end of the
+paragraph will also be removed, since it is a discardable. This will
+give you an empty \.{\\hbox}. Finally \TeX\ appends \.{\\rightskip} glue.
+This gives you a nonempty \.{\\hbox}, raising a \.{Underfull \\hbox}
+warning.
+
+To avoid this happening, \namefpc\ saves a pointer to the node
+immediately preceding the \.{\\parfillskip} node and quits pruning
+when it encounters this node several procedures later.
+@^Underfull \\hbox...@>
+@z
+
+@x
+link(tail):=new_param_glue(par_fill_skip_code);
+@y
+non_prunable_p := tail; {points to the node immediately before
+\.{\\parfillskip}}
+link(tail):=new_param_glue(par_fill_skip_code);
+@z
+
+[862] declare non_prunable_p
+@x
+The following declarations provide for a few other local variables that are
+used in special calculations.
+
+@y
+The following declarations provide for a few other local variables that are
+used in special calculations.
+
+\marke E Declare the |non_prunable_p| pointer.
+@z
+
+@x
+@!auto_breaking:boolean; {is node |cur_p| outside a formula?}
+@y
+@!auto_breaking:boolean; {is node |cur_p| outside a formula?}
+non_prunable_p:pointer; {pointer to the node before \.{\\parfillskip}}
+@z
+
+[876] pass non_prunable_p
+@x
+(By introducing this subprocedure, we are able to keep |line_break|
+from getting extremely long.)
+@y
+(By introducing this subprocedure, we are able to keep |line_break|
+from getting extremely long.)
+
+\marke E Pass |non_prunable_p| to the |post_line_break|~procedure.
+@z
+
+@x
+post_line_break(final_widow_penalty)
+@y
+post_line_break(final_widow_penalty, non_prunable_p)
+@z
+
+[877] declare non_prunable_p
+@x
+of their new significance.) Then the lines are justified, one by one.
+
+@y
+of their new significance.) Then the lines are justified, one by one.
+
+\marke E Declare another parameter. It holds the pointer to the node
+immediately preceding \.{\\parfillskip}.
+@z
+
+@x
+procedure post_line_break(@!final_widow_penalty:integer);
+@y
+procedure post_line_break(@!final_widow_penalty:integer;
+ non_prunable_p:pointer);
+@z
+
+[879]
+@x
+are computed for non-discretionary breakpoints.
+@y
+are computed for non-discretionary breakpoints.
+
+\marke E The pointer |non_prunable_p| references the node immediately
+preceding the \.{\\parfillskip} node at the end of the paragraph.
+Stop pruning at this node.
+@z
+
+[879]
+@x
+ if non_discardable(q) then goto done1;
+@y
+ if non_discardable(q) then goto done1;
+ if q = non_prunable_p then goto done1; {retain \.{\\parfillskip} glue}
+@z
+
+[1327]
+@x
+if (x<>69069)or eof(fmt_file) then goto bad_fmt
+@y
+if (x<>69069) then goto bad_fmt
+@z
+
+[1332]
+@x
+The initial test involving |ready_already| should be deleted if the
+\PASCAL\ runtime system is smart enough to detect such a ``mistake.''
+@^system dependencies@>
+@y
+The initial test involving |ready_already| should be deleted if the
+\PASCAL\ runtime system is smart enough to detect such a ``mistake.''
+@^system dependencies@>
+
+\marke h \namefpc\ tries to load the format file even before it
+initializes the output routines. That way, it will print the name of
+the format file on the terminal.
+
+\marke X
+|@!fpc_halt|
+passes the |history| as an exit code to the shell.
+
+@^system dependencies@>
+@^GNU Pascal@>
+@^Unix@>
+
+@d fpc_halt == h@&a@&l@&t
+@z
+
+[1332]
+@x
+start_of_TEX: @<Initialize the output routines@>;
+@y
+start_of_TEX: @<Preload the default format file@>;
+@<Initialize the output routines@>;
+@z
+
+[1332]
+@x
+final_end: ready_already:=0;
+@y
+final_end:
+fpc_halt(history);
+ {pass |history| as the exit value to the system\marke u}
+@z
+
+[1333] print last end-of-line marker if needed
+@x
+This program doesn't bother to close the input files that may still be open.
+@y
+This program doesn't bother to close the input files that may still be open.
+
+\marke h
+Special care is taken to terminate the last line on the terminal.
+
+@z
+
+[1333] print last end-of-line marker if needed
+@x
+ slow_print(log_name); print_char(".");
+ end;
+ end;
+end;
+@y
+ slow_print(log_name); print_char(".");
+ end;
+ end;
+ if term_offset > 0 then wterm_cr;
+end;
+@z
+
+[1338] return if eof.
+@x
+program below. (If |m=13|, there is an additional argument, |l|.)
+@.debug \#@>
+
+@y
+program below. (If |m=13|, there is an additional argument, |l|.)
+@.debug \#@>
+
+\marke P A Pascal program must not read from the standard text file
+if the end of file is reached. Even in this respect, Unix and Pascal
+treat terminals and disk files alike.
+
+@z
+@x
+begin loop begin wake_up_terminal;
+@y
+begin loop begin; wake_up_terminal;
+@z
+
+@x
+ read(term_in,m);
+@y
+ if eof(term_in) then return;
+ read(term_in,m);
+@z
+
+[1338] return if eof
+@x
+ else begin read(term_in,n);
+@y
+ else begin if eof(term_in) then return;
+ read(term_in,n);
+@z
+
+[1339] return if eof
+@x
+13: begin read(term_in,l); print_cmd_chr(n,l);
+@y
+13: begin if eof(term_in) then return;
+read(term_in,l); print_cmd_chr(n,l);
+@z
+
+[1379 and modules added for TeX-FPC]
+@x
+itself will get a new section number.
+@^system dependencies@>
+@y
+itself will get a new section number.
+
+\marke h Try to preload the default format file. This is called
+even before the first line is read from the terminal, and thus
+turns \.{VIRTEX} into \.{TEX}, at least as experienced by the user.
+\.{INITEX} sets |format_ident| to `\.{INITEX}' and won't load a
+format file here.
+
+@<Preload the default format file@>=
+if format_ident = 0 then
+ begin pack_buffered_name(format_default_length - format_ext_length, 1, 0);
+ if not w_open_in(fmt_file) then
+ begin
+ wterm_ln('I can''t find the format file ', name_of_file);
+ goto final_end
+ end;
+ if not load_fmt_file then
+ begin w_close(fmt_file); goto final_end
+ end;
+ w_close(fmt_file);
+ end
+@z
diff --git a/systems/unix/tex-fpc/tex/tex.ch b/systems/unix/tex-fpc/tex/tex.ch
new file mode 100644
index 0000000000..18cec3b8ea
--- /dev/null
+++ b/systems/unix/tex-fpc/tex/tex.ch
@@ -0,0 +1,1059 @@
+% This is a change file of TeX for GNU Pascal, Wolfgang Helbig, Nov. 2007
+% Handle command line as the first line, Apr. 2008
+% Open vi at the offending line in error dialog Apr. 2008
+% Avoid an underful last line, use buffered output for dvi file, Jul. 2008
+% That "finished" the program. But I kept on improving:
+% July 2008:
+% Don't print empty lines on terminal and log file.
+% Don't trim ninput lines.
+% November 2009:
+% The last improvement caused an error: On reading a blank only
+% first line might go into a loop. This error cannot be noticed by the user.
+% It was noticed by Joachim Kuebart
+% Some changes were necessary run TeX_GPC to Mac OS X
+% with the current version of GPC. (pointed out by Martin Monperrus and
+% Luis Rivera)
+% July 2016: Switch from GNU Pascal to Free Pascal
+% There is no GPC on Mac OS X, Debian 8, OpenBSD.
+%
+
+[0] About TeX-FPC
+@x
+\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
+@y
+\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
+\input webmac-fpc
+
+\emergencystretch 0.6in % avoid overfull boxes
+
+\let\maybe=\iffalse % print changed modules only.
+
+% put a mark in the left margin. (see Exercise 14.28 in The TeXbook)
+\def\marke#1{\strut\vadjust{\kern-\dp\strutbox\vbox to 0pt{\vss
+ \llap{\bf #1\/\quad\strut}}}\ignorespaces }
+
+\def\name{\TeX}
+
+\N0\*. \[0] About \namefpc.
+\namefpc\ is a Unix implementation of Donald~E. Knuth's \TeX82 in
+the version 3.14159265 from January 2014. It is based on Free~Pascal.
+The accompaning \.{README} file tells you how to build and run
+\namefpc. To help you identify the differences of \TeX82 and
+\namefpc, the numbers of modified modules carry an asterisk. Letters
+in the left margin indicate the reason for a change. They mean:
+\medskip
+\item{\bf E} fixes an error in \TeX82
+\item{\bf e} fixes a small error in \TeX82
+\item{\bf F} adds a feature as suggested by Knuth
+\item{\bf P} removes a violation of Pascal (Jensen, Wirth: {\sl Pascal
+User Manual and Report\/}, 3rd edition, 1985)
+\item{\bf X} an FPC extension
+\item{\bf U} make Unix happy
+\item{\bf u} make Unix user happy
+\item{\bf h} make Helbig happy
+\item{\bf N} a note that helped me to understand this program.
+\item{\bf B} a bug I couldn't fix.
+\medskip
+
+Identifiers that come with FPC~Pascal are coded as \.{WEB} macros and prefixed
+by `\\{fpc\_}'. That helps to resolve name clashes.
+\filbreak
+Going with Dijkstra, see
+\.{http://www.cs.utexas.edu/users/EWD/videos/noorderlicht.mpg}, I
+don't believe in version numbers, since I don't believe in maintaining
+software---I consider \namefpc\ finished---and it must go without
+a number.
+\filbreak
+\namefpc\ slightly differs from \TeX: On input, trailing blanks are
+not removed, on input of the first line, leading blanks are not
+removed either. This lets you interactively enter `\.{I \\showbox0\
+}' to make \namefpc\ show box 0. This doesn't work if the trailing
+blank were removed.
+
+\TeX\ writes an additional empty line whenever it prompts you on
+the terminal. \namefpc\ doesn't. Finally \TeX\ emits an `\.{Underfull
+\\hbox}' warning whenever the last line of a paragraph happens to include
+glue only, because then \TeX\ would erroneously remove the
+\.{parfillskip}. \namefpc\ will keep it.
+
+% \TeX82 will emit an underfull box warning here, \namefpc\ won't.
+\setbox0=\hbox to \hsize {\hfil\ \strut}
+\noindent\box0\ \ \par
+\bigskip
+\address
+\fi
+@z
+
+[2] Change the banner line
+@x
+known as `\TeX' [cf.~Stanford Computer Science report CS1027,
+November 1984].
+
+@d banner=='This is TeX, Version 3.14159265' {printed when \TeX\ starts}
+@y
+known as `\TeX' [cf.~Stanford Computer Science report CS1027,
+November 1984].
+
+\marke h Since \namefpc\ differs from \TeX\ to make me happy, I have to
+change the banner line.
+
+@d banner=='This is TeX-FPC'
+@z
+
+[4] program header
+@x
+@d mtype==t@&y@&p@&e {this is a \.{WEB} coding trick:}
+@y
+
+\marke P Pascal wants the identifiers of the standard text files
+\\{input} and \\{output} in the parameterlist of the program header.
+
+\marke N One of the \.{WEB} macros is named \\{input}
+as well. To make \.{TANGLE} write \.{INPUT} into the Pascal source
+file instead of the expansion of the macro, you code the name as
+a concatenation of one letter identifiers since one letter identifiers
+cannot be macro names. The same
+applies to \\{type}.
+
+@d term_in==i @& n @& p @& u @& t
+@d term_out==o @& u @& t @& p @& u @& t
+@d mtype==t @& y @& p @& e
+@f mtype==type
+@z
+
+[4] program header
+@x
+program TEX; {all file names are defined dynamically}
+@y
+program TEX(@!term_in,@!term_out);
+@z
+
+Since @x, @y, and @z only define a change block when they begin a
+line, you deactivate a block by indenting it (shift right) and
+activate it by unindenting it (shift left). With vi set the cursor
+to the @x line and type >} or <} to (un)indent a paragraph.
+
+[7] shift left to turn debugging on, right to turn it off
+@x
+@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
+@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
+@y
+@d debug== {change this to `$\\{debug}\equiv\.{@@\{}$' when not debugging}
+@d gubed== {change this to `$\\{gubed}\equiv\.{@@\}}$' when not debugging}
+@z
+
+[7] shift left to turn stats on, right to turn them off.
+@x
+@d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering
+ usage statistics}
+@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering
+ usage statistics}
+@y
+@d stat== {change this to `$\\{stat}\equiv\.{@@\{}$' to turn off statistics}
+@d tats== {change this to `$\\{tats}\equiv\.{@@\}}$' to turn off statistics}
+@z
+
+
+ [8] shift left to build TEX and right to build INITEX.
+ @x initex
+ @d init== {change this to `$\\{init}\equiv\.{@@\{}$' in the production version}
+ @d tini== {change this to `$\\{tini}\equiv\.{@@\}}$' in the production version}
+ @y
+ @d init==@{ {change this to `$\\{init}\equiv $' for \.{INITEX}}
+ @d tini==@t@>@} {change this to `$\\{tini}\equiv $' for \.{INITEX}}
+ @z
+
+[9] compiler directives, turn off I/O checking.
+@x
+@^overflow in arithmetic@>
+@y
+@^overflow in arithmetic@>
+
+\marke X If the first character of a \PASCAL\ comment is a dollar
+sign, Free~Pascal treats the comment as a ``compiler directive''.
+FPC aborts when it detects an I/O error. To let \namefpc\ handle
+an I/O error while opening an input file, you have to turn off I/O
+checking altogether by the \.{I-} directive.
+
+
+\marke X \$MODE ISO sets integer size to 32 bit, defines file procedures
+get, put and allows nonlocal gotos.
+
+\marke b In contrast to \ph\ Free~Pascal offers no directive to
+check for arithmetic overflow.
+
+\marke e Knuth suggests to turn on range checking while debugging.
+FPC aborts when it spots range violation. Those violations might
+happen when the debugger shows a memery cell assumed to contain a
+|glue_ratio|. Even though turning of range checking doubles the
+speed of \TeX\ I suggest to turn it on when not debugging, just to
+get another check from Knuth for discovering an error.
+
+@^system dependencies@>
+@^GNU Pascal@>
+@z
+
+[9] compiler directives, turn off I/O checking, continued
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@{@&$I-@} {no I/O checking}
+@{@&$M@&O@&D@&E I@&S@&O@}
+@!debug @{@&$R-@}@+ gubed {no range check while debugging}
+@z
+
+[10] default case branch
+@x
+\PASCAL s have, in fact, done this, successfully but not happily!)
+@:PASCAL H}{\ph@>
+
+@d othercases == others: {default for cases not listed explicitly}
+@y
+\PASCAL s have, in fact, done this, successfully but not happily!)
+@:PASCAL H}{\ph@>
+
+\marke X This is the only place I voluntarily use an FPC extension
+to Pascal.
+@^FPC Pascal@>
+
+@d othercases == @+ else {default for cases not listed explicitly}
+@z
+
+[11]
+@x
+in production versions of \TeX.
+@y
+in production versions of \TeX.
+
+\marke N I didn't change the constants, leaving it up to you to
+adopt them to your task. Just keep the Pascal source for \.{tex}
+around. So you can change them without going all the way through
+modifying \.{tex.ch} and tangeling it. Note that for \.{initex}
+|mem_top| and |mem_max| must agree.
+
+\marke U One of the constants is the filename of the string pool
+file which needs an adoption to Unix.
+@z
+
+The changes headed by trip need to be made for the trip test suite.
+
+[11]
+ @x trip
+ @!mem_max=30000; {greatest index in \TeX's internal |mem| array;
+ @y
+ @!mem_max=3000; {greatest index in \TeX's internal |mem| array;
+ @z
+
+[11]
+ @x trip
+ @!mem_min=0; {smallest index in \TeX's internal |mem| array;
+ @y
+ @!mem_min=1; {smallest index in \TeX's internal |mem| array;
+ @z
+
+[11]
+ @x trip
+ @!error_line=72; {width of context lines on terminal error messages}
+ @!half_error_line=42; {width of first lines of contexts in terminal
+ error messages; should be between 30 and |error_line-15|}
+ @!max_print_line=79; {width of longest text lines output; should be at least 60}
+ @y
+ @!error_line=64; {width of context lines on terminal error messages}
+ @!half_error_line=32; {width of first lines of contexts in terminal
+ error messages; should be between 30 and |error_line-15|}
+ @!max_print_line=72; {width of longest text lines output; should be at least 60}
+ @z
+
+[11] location of pool file
+@x
+@!pool_name='TeXformats:TEX.POOL ';
+@y
+@!pool_name='TeXformats/tex.pool'; { \marke X arrays of different length are
+assignment compatible. }
+@z
+
+
+[12]
+ @x trip
+ @d mem_bot=0 {smallest index in the |mem| array dumped by \.{INITEX};
+ must not be less than |mem_min|}
+ @d mem_top==30000 {largest index in the |mem| array dumped by \.{INITEX};
+ must be substantially larger than |mem_bot|
+ and not greater than |mem_max|}
+ @y
+ @d mem_bot=1 {smallest index in the |mem| array dumped by \.{INITEX};
+ must not be less than |mem_min|}
+ @d mem_top==3000 {largest index in the |mem| array dumped by \.{INITEX};
+ must be substantially larger than |mem_bot|
+ and not greater than |mem_max|}
+ @z
+
+
+[25]
+@x
+for us to specify simple operations on word files before they are defined.
+@y
+for us to specify simple operations on word files before they are
+defined.
+
+\marke X
+@d fpc_byte==b @& y @& t @& e
+@d fpc_string == r@&a@&w@&b@&y@&t@&e@&s@&t@&r@&i@&n@&g
+
+@^FPC Pascal@>
+@z
+
+[25] the type of text_files is text
+@x
+@!eight_bits=0..255; {unsigned one-byte quantity}
+@!alpha_file=packed file of text_char; {files that contain textual data}
+@y
+@!eight_bits=fpc_byte; {unsigned one-byte quantity}
+@!alpha_file=t @& e @& x @& t; {\marke P Pascal requires |text|}
+@z
+
+[27]
+@x
+\TeX's file-opening procedures return |false| if no file identified by
+|name_of_file| could be opened.
+
+@d reset_OK(#)==erstat(#)=0
+@d rewrite_OK(#)==erstat(#)=0
+@y
+\marke X In Pascal, external files must occur in the program heading
+and FPC~Pascal asks the user whenever an external file is
+opened. But \.{initex} wants to reset \.{tex.pool} and rewrite
+\.{plain.fmt} without asking
+the user for the file name.
+FPC~Pascal lets you assign the file name to an external file.
+The function |fpc_io_result| returns a nonzero value if any
+error occurred since the last invocation of |fpc_io_result|.
+
+@^GNU Pascal@>
+@^system dependencies@>
+
+@d fpc_io_result==i@&o@&r@&e@&s@&u@&l@&t
+@d fpc_assign==a@&s@&s@&i@&g@&n
+@d reset_OK(#)==fpc_io_result=0
+@d rewrite_OK(#)==fpc_io_result=0
+@d clear_io_result==@+if fpc_io_result=0 then do_nothing
+@z
+
+[27] reset and rewrite for each of three file types
+@x alpha_file
+begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f);
+a_open_in:=reset_OK(f);
+@z
+@x
+begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+a_open_out:=rewrite_OK(f);
+@z
+
+byte_file
+@x
+begin reset(f,name_of_file,'/O'); b_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f);
+b_open_in:=reset_OK(f);
+@z
+@x
+function b_open_out(var f:byte_file):boolean;
+ {open a binary file for output}
+begin rewrite(f,name_of_file,'/O'); b_open_out:=rewrite_OK(f);
+@y
+function b_open_out(var f:byte_file):boolean;
+ {open a binary file for output}
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+b_open_out:=rewrite_OK(f);
+@z
+
+@x word_file
+begin reset(f,name_of_file,'/O'); w_open_in:=reset_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f); w_open_in:=reset_OK(f);
+@z
+@x
+begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f);
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+w_open_out:=rewrite_OK(f);
+@z
+
+[31]
+@x
+finer tuning is often possible at well-developed \PASCAL\ sites.
+@^inner loop@>
+
+@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+var last_nonblank:0..buf_size; {|last| with trailing blanks removed}
+begin if bypass_eoln then if not eof(f) then get(f);
+ {input the first character of the line into |f^|}
+last:=first; {cf.\ Matthew 19\thinspace:\thinspace30}
+if eof(f) then input_ln:=false
+else begin last_nonblank:=first;
+ while not eoln(f) do
+ begin if last>=max_buf_stack then
+ begin max_buf_stack:=last+1;
+ if max_buf_stack=buf_size then
+ @<Report overflow of the input buffer, and abort@>;
+ end;
+ buffer[last]:=xord[f^]; get(f); incr(last);
+ if buffer[last-1]<>" " then last_nonblank:=last;
+ end;
+ last:=last_nonblank; input_ln:=true;
+ end;
+end;
+@y
+finer tuning is often possible at well-developed \PASCAL\ sites.
+@^inner loop@>
+
+\marke h Since \namefpc\ does not remove trailing spaces, |buffer[last-1]|
+might hold a space.
+
+\marke P
+\ph\ lets you |reset| the terminal input file with the first |get|
+`surpressed'. For several reasons, this feature is not exploited by
+\namefpc. First, it is not provided by FPC. Second rightly so, since
+it violates the specification of Pascal. Third, it makes the program
+quite ugly by destroying the beautiful equivalence of terminal and
+disk files. Fourth, since \namefpc\ uses Pascal's standard text
+file |input|, it should not reset that file at all. Fifth, surpressing
+the first |get| is offered by \ph\ to address a problem, namely
+that the program stays in the reset function waiting for user input
+and this problem is solved much more beautiful by ``lazy I/O'',
+whereby the program only waits for user input if it is needed. This
+is suggested in the {\sl Pascal User Manual}, implemented by
+Free~Pascal and exploited by \namefpc. This leads to a much cleaner
+implementaion of |input_ln|, which can always savely assume that
+|f^| holds the first character of the next line. This condition is
+established by Pascal's |reset| and maintained by |input_ln|.
+
+\marke h
+Unlike \TeX82 \namefpc\ leaves trailing spaces in the input line.
+
+@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+var ch: char;
+begin
+ {ignore |bypass_eoln|. Assuming |f| being positioned at the first character}
+last:=first; {cf.\ Matthew 19\thinspace:\thinspace30}
+if eof(f) then input_ln:=false
+else begin
+ while not eoln(f) do
+ begin if last>=max_buf_stack then
+ begin max_buf_stack:=last+1;
+ if max_buf_stack=buf_size then begin
+ read_ln(f); {complete the current line}
+ @<Report overflow of the input buffer, and abort@>;
+ end;
+ end;
+ read(f, ch); buffer[last]:=xord[ch]; incr(last);
+ end;
+ read_ln(f); {Advance |f| to the first character of the next line}
+ input_ln:=true;
+ end;
+end;
+@z
+
+[32] term_in and term_out are the standard pascal files
+@x
+is considered an output file the file variable is |term_out|.
+@^system dependencies@>
+
+@<Glob...@>=
+@!term_in:alpha_file; {the terminal as an input file}
+@!term_out:alpha_file; {the terminal as an output file}
+@y
+is considered an output file the file variable is |term_out|.
+\marke P Pascal's standard text files are declared implicitly.
+@z
+
+[33]
+@x
+@ Here is how to open the terminal files
+in \ph. The `\.{/I}' switch suppresses the first |get|.
+@:PASCAL H}{\ph@>
+@^system dependencies@>
+
+@d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input}
+@d t_open_out==rewrite(term_out,'TTY:','/O') {open the terminal for text output}
+@y
+@ Here is how to open the terminal files
+in \ph. The `\.{/I}' switch suppresses the first |get|.
+@:PASCAL H}{\ph@>
+@^system dependencies@>
+
+\marke P In Pascal, the standard text files are openend implicitly.
+
+@d t_open_in==do_nothing {open the terminal for text input}
+@d t_open_out==do_nothing {open the terminal for text output}
+@z
+
+[34]
+@x
+some instruction to the operating system. The following macros show how
+these operations can be specified in \ph:
+@:PASCAL H}{\ph@>
+@^system dependencies@>
+@y
+some instruction to the operating system.
+
+\marke X
+Unix holds terminal output, when it receives \.{\^S} and
+continues writing to the terminal, when it receives \.{\^Q}. These
+`flow control' characters only work when sent from the terminal but
+not when sent to the terminal. \marke B Here I give up, since I
+don't know how to restart the output from the writing side so
+\namefpc\ does nothing. Mac OS X does not stop terminal output when
+it receives \.{\^S}.
+
+@^Free Pascal@>
+@^system dependencies@>
+@z
+
+[34]
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@d clear_terminal == break_in(term_in,true) {clear the terminal input buffer}
+@d wake_up_terminal == do_nothing {cancel the user's cancellation of output}
+@y
+@d fpc_flush == f@&l@&u@&s@&h
+@d update_terminal == fpc_flush(term_out) {empty the terminal output buffer}
+@d clear_terminal == do_nothing {clear the terminal input buffer}
+@d wake_up_terminal == do_nothing {cancel the user's cancellation of output}
+@z
+
+[35]
+@x
+ begin write_ln(term_out,'Buffer size exceeded!'); goto final_end;
+@y
+ begin write_ln(term_out,'Buffer size exceeded!'); fpc_halt(3);
+@z
+
+[36] command line
+@x
+not be typed immediately after~`\.{**}'.)
+
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+
+@y
+not be typed immediately after~`\.{**}'.)
+
+\marke F This procedure puts the command line arguments separated
+by spaces into |buffer|. Like |input_ln| it updates |last| so that
+|buffer[first..last)| will contain the command line.
+
+\marke X FPC~Pascal's function~|@!fpc_param_count| gives the number of
+command line arguments. The function~|@!fpc_param_str(n)| returns the
+n-th argument for |0 <= n <= gpc_param_count| in a |@!fpc_string|,
+whose length is returned by the function~|@!gpc_length|.
+A |fpc_string| is like a |packed array[1..fpc_length] of char| with
+varying length.
+
+@^FPC Pascal@>
+@^system dependencies@>
+
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+@d fpc_length==l @& e @& n @& g @& t @& h
+@d fpc_param_count==p @& a @& r @& a @& m @& c @& o @& u @& n @& t
+@d fpc_param_str==p @& a @& r @& a @& m @&s @& t @& r
+ {FPC function returning the length of a |fpc_string|}
+
+@p procedure input_command_ln; {get the command line in |buffer|}
+var argc: integer; {argument counter}
+ arg: fpc_string; {argument}
+ cc: integer; {character counter in argument}
+begin last := first; argc := 1;
+while argc <= fpc_param_count do
+ begin cc := 1; arg := fpc_param_str(argc); incr(argc);
+ while cc <= fpc_length(arg) do
+ begin
+ if last+1>=buf_size then
+ @<Report overflow of the input buffer, and abort@>;
+ buffer[last] := xord[arg[cc]]; incr(last); incr(cc);
+ end;
+ if (argc <= fpc_param_count) then begin
+ buffer[last] := " "; incr(last); {insert a space between arguments}
+ end;
+ end;
+end;
+@z
+
+[37] command line.
+@x
+@ The following program does the required initialization
+without retrieving a possible command line.
+It should be clear how to modify this routine to deal with command lines,
+if the system permits them.
+@^system dependencies@>
+
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in;
+loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal;
+@.**@>
+ if not input_ln(term_in,true) then {this shouldn't happen}
+ begin write_ln(term_out);
+ write(term_out,'! End of file on the terminal... why?');
+@.End of file on the terminal@>
+ init_terminal:=false; return;
+ end;
+ loc:=first;
+ while (loc<last)and(buffer[loc]=" ") do incr(loc);
+ if loc<last then
+ begin init_terminal:=true;
+ return; {return unless the line was all blank}
+ end;
+ write_ln(term_out,'Please type the name of your input file.');
+ end;
+exit:end;
+@y
+@ \marke F The following program treats a non empty command line as
+the first line.
+
+
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in; input_command_ln;
+while first=last do begin
+ wake_up_terminal; write(term_out,'**'); update_terminal;
+@.**@>
+ if not input_ln(term_in, true) then {this shouldn't happen}
+ begin write_ln(term_out);
+ write_ln(term_out,'! End of file on the terminal... why?');
+@.End of file on the terminal@>
+ init_terminal:=false; return;
+ end;
+ if first=last then
+ write_ln(term_out,'Please type the name of your input file.');
+ end;
+loc := first;
+init_terminal:=true;
+exit: end;
+@z
+[109]
+@x
+routines cited there must be modified to allow negative glue ratios.)
+@y
+routines cited there must be modified to allow negative glue ratios.)
+
+\marke X In FPC~Pascal the type |fpc_single| is appropiate.
+@d fpc_single== s@&i@&n@&g@&l@&e
+@z
+
+@x
+@!glue_ratio=real; {one-word representation of a glue expansion factor}
+@y
+@!glue_ratio=fpc_single; {one-word representation of a glue expansion
+ factor in GNU~Pascal}
+@^FPC Pascal@>
+@z
+
+[112]
+@x
+macros are simplified in the obvious way when |min_quarterword=0|.
+@^inner loop@>@^system dependencies@>
+
+@d qi(#)==#+min_quarterword
+ {to put an |eight_bits| item into a quarterword}
+@d qo(#)==#-min_quarterword
+ {to take an |eight_bits| item out of a quarterword}
+@d hi(#)==#+min_halfword
+ {to put a sixteen-bit item into a halfword}
+@d ho(#)==#-min_halfword
+ {to take a sixteen-bit item from a halfword}
+@y
+macros are simplified in the obvious way when |min_quarterword=0|.
+\marke X Which is the case with FPC.
+@^inner loop@>@^system dependencies@>
+
+@d qi(#)==#
+ {to put an |eight_bits| item into a quarterword}
+@d qo(#)==#
+ {to take an |eight_bits| item out of a quarterword}
+@d hi(#)==#
+ {to put a sixteen-bit item into a halfword}
+@d ho(#)==#
+ {to take a sixteen-bit item from a halfword}
+@z
+
+[360] Don't print empty lines
+@x
+@ All of the easy branches of |get_next| have now been taken care of.
+There is one more branch.
+@y
+@ All of the easy branches of |get_next| have now been taken care of.
+There is one more branch.
+
+\marke h \TeX82 ends the current line by calling |print_ln| even
+if the line is empty. This causes an additional empty line, which
+is ugly. Calling |print_nl("")| is smarter. It ends the current
+line only if it is not empty.
+@z
+
+@x
+ print_ln; first:=start;
+@y
+ print_nl(""); first:=start;
+@z
+
+@x [514]
+|TEX_font_area|. These system area names will, of course, vary from place
+to place.
+@y
+|TEX_font_area|. These system area names will, of course, vary from place
+to place.
+
+\marke U Use the Unix file separator.
+@z
+
+[514]
+@x
+@d TEX_area=="TeXinputs:"
+@.TeXinputs@>
+@d TEX_font_area=="TeXfonts:"
+@.TeXfonts@>
+@y
+@d TEX_area=="TeXinputs/" {i.e., a subdirectory of the working directory}
+@.TeXinputs@>
+@d TEX_font_area=="TeXfonts/" {dito}
+@.TeXfonts@>
+@z
+
+[516]
+@x
+ if (c=">")or(c=":") then
+@y
+ if c="/" then {use ``/'' as a file name separator\marke U}
+@z
+
+[519]
+@x
+@d append_to_name(#)==begin c:=#; incr(k);
+@y
+@d fpc_set_length==s@&e@&t@&l@&e@&n@&g@&t@&h
+
+@d append_to_name(#)==begin c:=#; incr(k);
+@z
+
+[519]
+@x
+@!j:pool_pointer; {index into |str_pool|}
+@y
+@!j:pool_pointer; {index into |str_pool|}
+@!rbs: fpc_string;
+@z
+
+[519]
+@x
+if k<=file_name_size then name_length:=k@+else name_length:=file_name_size;
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+end;
+@y
+if k<=file_name_size then name_length:=k@+else name_length:=file_name_size;
+rbs := name_of_file;
+fpc_set_length(rbs, name_length);
+name_of_file := rbs;
+end;
+@z
+
+[521]
+@x
+TEX_format_default:='TeXformats:plain.fmt';
+@y
+TEX_format_default:='TeXformats/plain.fmt';
+ {``/'' is the Unix file name separator\marke U}
+@z
+
+[523]
+@x
+isn't found.
+@y
+isn't found.
+\marke X With Free~Pascal you cannot set the length of a |packed array|.
+But assigning the |name_of_file| to a |fpc_string|, setting the length to the
+|fpc_string| and then assigning it to the |name_of_file| saves the day.
+@z
+[523]
+@x
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+@y
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+rbs: fpc_string;
+@z
+
+@x
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+@y
+rbs := name_of_file;
+fpc_set_length(rbs, name_length);
+name_of_file := rbs;
+@z
+
+[575] Don't check eof
+@x
+no error message is given for files having more than |lf| words.
+@y
+no error message is given for files having more than |lf| words.
+\marke X EOF is true, even before the end of file is passed. This is
+an error of the free pascal runtime library.
+@z
+@x
+if eof(tfm_file) then abort;
+@y
+@z
+
+[816] save pointer to penalty_node
+@x
+same number of |mem|~words.
+@^data structure assumptions@>
+@y
+same number of |mem|~words.
+@^data structure assumptions@>
+
+\marke E
+\TeX82 prunes discardable nodes from the beginning of a new line until
+it reaches a nondiscardable node. Now, if the last line of a paragraph
+contains discardables only, the \.{\\parfillskip} glue at the end of the
+paragraph will also be removed, since it is a discardable. This will
+give you an empty \.{\\hbox}. Finally \TeX\ appends \.{\\rightskip} glue.
+This gives you a nonempty \.{\\hbox}, raising a \.{Underfull \\hbox}
+warning.
+
+To avoid this happening, \namefpc\ saves a pointer to the node
+immediately preceding the \.{\\parfillskip} node and quits pruning
+when it encounters this node several procedures later.
+@^Underfull \\hbox...@>
+@z
+
+@x
+link(tail):=new_param_glue(par_fill_skip_code);
+@y
+non_prunable_p := tail; {points to the node immediately before
+\.{\\parfillskip}}
+link(tail):=new_param_glue(par_fill_skip_code);
+@z
+
+[862] declare non_prunable_p
+@x
+The following declarations provide for a few other local variables that are
+used in special calculations.
+
+@y
+The following declarations provide for a few other local variables that are
+used in special calculations.
+
+\marke E Declare the |non_prunable_p| pointer.
+@z
+
+@x
+@!auto_breaking:boolean; {is node |cur_p| outside a formula?}
+@y
+@!auto_breaking:boolean; {is node |cur_p| outside a formula?}
+non_prunable_p:pointer; {pointer to the node before \.{\\parfillskip}}
+@z
+
+[876] pass non_prunable_p
+@x
+(By introducing this subprocedure, we are able to keep |line_break|
+from getting extremely long.)
+@y
+(By introducing this subprocedure, we are able to keep |line_break|
+from getting extremely long.)
+
+\marke E Pass |non_prunable_p| to the |post_line_break|~procedure.
+@z
+
+@x
+post_line_break(final_widow_penalty)
+@y
+post_line_break(final_widow_penalty, non_prunable_p)
+@z
+
+[877] declare non_prunable_p
+@x
+of their new significance.) Then the lines are justified, one by one.
+
+@y
+of their new significance.) Then the lines are justified, one by one.
+
+\marke E Declare another parameter. It holds the pointer to the node
+immediately preceding \.{\\parfillskip}.
+@z
+
+@x
+procedure post_line_break(@!final_widow_penalty:integer);
+@y
+procedure post_line_break(@!final_widow_penalty:integer;
+ non_prunable_p:pointer);
+@z
+
+[879]
+@x
+are computed for non-discretionary breakpoints.
+@y
+are computed for non-discretionary breakpoints.
+
+\marke E The pointer |non_prunable_p| references the node immediately
+preceding the \.{\\parfillskip} node at the end of the paragraph.
+Stop pruning at this node.
+@z
+
+[879]
+@x
+ if non_discardable(q) then goto done1;
+@y
+ if non_discardable(q) then goto done1;
+ if q = non_prunable_p then goto done1; {retain \.{\\parfillskip} glue}
+@z
+
+[1327]
+@x
+if (x<>69069)or eof(fmt_file) then goto bad_fmt
+@y
+if (x<>69069) then goto bad_fmt
+@z
+
+[1332]
+@x
+The initial test involving |ready_already| should be deleted if the
+\PASCAL\ runtime system is smart enough to detect such a ``mistake.''
+@^system dependencies@>
+@y
+The initial test involving |ready_already| should be deleted if the
+\PASCAL\ runtime system is smart enough to detect such a ``mistake.''
+@^system dependencies@>
+
+\marke h \namefpc\ tries to load the format file even before it
+initializes the output routines. That way, it will print the name of
+the format file on the terminal.
+
+\marke X
+|@!fpc_halt|
+passes the |history| as an exit code to the shell.
+
+@^system dependencies@>
+@^GNU Pascal@>
+@^Unix@>
+
+@d fpc_halt == h@&a@&l@&t
+@z
+
+[1332]
+@x
+start_of_TEX: @<Initialize the output routines@>;
+@y
+start_of_TEX: @<Preload the default format file@>;
+@<Initialize the output routines@>;
+@z
+
+[1332]
+@x
+final_end: ready_already:=0;
+@y
+final_end:
+fpc_halt(history);
+ {pass |history| as the exit value to the system\marke u}
+@z
+
+[1333] print last end-of-line marker if needed
+@x
+This program doesn't bother to close the input files that may still be open.
+@y
+This program doesn't bother to close the input files that may still be open.
+
+\marke h
+Special care is taken to terminate the last line on the terminal.
+
+@z
+
+[1333] print last end-of-line marker if needed
+@x
+ slow_print(log_name); print_char(".");
+ end;
+ end;
+end;
+@y
+ slow_print(log_name); print_char(".");
+ end;
+ end;
+ if term_offset > 0 then wterm_cr;
+end;
+@z
+
+[1338] return if eof.
+@x
+program below. (If |m=13|, there is an additional argument, |l|.)
+@.debug \#@>
+
+@y
+program below. (If |m=13|, there is an additional argument, |l|.)
+@.debug \#@>
+
+\marke P A Pascal program must not read from the standard text file
+if the end of file is reached. Even in this respect, Unix and Pascal
+treat terminals and disk files alike.
+
+@z
+@x
+begin loop begin wake_up_terminal;
+@y
+begin loop begin; wake_up_terminal;
+@z
+
+@x
+ read(term_in,m);
+@y
+ if eof(term_in) then return;
+ read(term_in,m);
+@z
+
+[1338] return if eof
+@x
+ else begin read(term_in,n);
+@y
+ else begin if eof(term_in) then return;
+ read(term_in,n);
+@z
+
+[1339] return if eof
+@x
+13: begin read(term_in,l); print_cmd_chr(n,l);
+@y
+13: begin if eof(term_in) then return;
+read(term_in,l); print_cmd_chr(n,l);
+@z
+
+[1379 and modules added for TeX-FPC]
+@x
+itself will get a new section number.
+@^system dependencies@>
+@y
+itself will get a new section number.
+
+\marke h Try to preload the default format file. This is called
+even before the first line is read from the terminal, and thus
+turns \.{VIRTEX} into \.{TEX}, at least as experienced by the user.
+\.{INITEX} sets |format_ident| to `\.{INITEX}' and won't load a
+format file here.
+
+@<Preload the default format file@>=
+if format_ident = 0 then
+ begin pack_buffered_name(format_default_length - format_ext_length, 1, 0);
+ if not w_open_in(fmt_file) then
+ begin
+ wterm_ln('I can''t find the format file ', name_of_file);
+ goto final_end
+ end;
+ if not load_fmt_file then
+ begin w_close(fmt_file); goto final_end
+ end;
+ w_close(fmt_file);
+ end
+@z
diff --git a/systems/unix/tex-fpc/web/tangle.ch b/systems/unix/tex-fpc/web/tangle.ch
new file mode 100644
index 0000000000..97c7232edf
--- /dev/null
+++ b/systems/unix/tex-fpc/web/tangle.ch
@@ -0,0 +1,179 @@
+% This is a change file for TANGLE-FPC, Wolfgang Helbig, Nov. 2007
+% Apr. 2008 take file names from command line
+% Jul. 2008 pass the exit code
+% Jul. 2016 change from gpc to fpc
+
+[0] About TANGLE-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+\def\name{{\tt TANGLE}}
+
+\let\maybe=\iffalse % print changed modules only.
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{TANGLE}, version 4.5
+from December 2002, to Unix. \namefpc\ is based on Free Pascal, version
+3.0
+
+This program expects four file names on the command line: Two input
+files, the web and change file, followed by two output files, the
+Pascal and string pool file. If you call \namefpc\ with the wrong number
+of command line arguments, it will tell you and exit.
+
+To support shell scripting, tangle sets the exit code to its
+`\\{history}'---zero means ok, one means a warning was issued, two
+an error occurred and three means \.{TANGLE} ended prematurely.
+
+\hint
+
+Comments and questions are welcome!
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is TANGLE, Version 4.5'
+@y
+@d banner=='This is TANGLE-FPC'
+@z
+
+[2] terminal output and input
+@x
+program TANGLE(@!web_file,@!change_file,@!Pascal_file,@!pool);
+@y
+program TANGLE(@!input,@!output);
+@z
+
+ [3] turn debugging on
+ @x
+ @d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
+ @d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
+ @y
+ @d debug==
+ @d gubed==
+ @z
+
+[3] turn stats on
+@x
+@d stat==@{ {change this to `$\\{stat}\equiv\null$'
+ when gathering usage statistics}
+@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
+ when gathering usage statistics}
+@y
+@d stat==
+@d tats==
+@z
+
+[4] compiler directives
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@{@&$M@&O@&D@&E I@&S@&O@}
+@z
+
+[7] default case branch
+@x
+@d othercases == others: {default for cases not listed explicitly}
+@y
+@d othercases == @+else {default for cases not listed explicitly}
+@z
+
+[12] the type of text_files is text in ISO Pascal
+@x
+@!text_file=packed file of text_char;
+@y
+@!text_file=text;
+@z
+
+[20] terminal output
+@x
+@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
+@y
+@d term_out == output
+@d term_in == input
+@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
+@z
+
+[20] terminal output, implicitely defined in ISO Pasal
+@x
+@<Globals...@>=
+@!term_out:text_file; {the terminal as an output file}
+@y
+@z
+
+[21] terminal output, output is rewritten implicitely in ISO Pascal
+@x
+@<Set init...@>=
+rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
+@y
+@z
+
+[22] terminal output, don't need update in ISO Pascal
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@y
+@d update_terminal == do_nothing
+@z
+
+[24] get file names from command line arguments
+@x
+begin reset(web_file); reset(change_file);
+@y
+begin
+assign(web_file, paramstr(1));
+assign(change_file, paramstr(2));
+reset(web_file); reset(change_file);
+@z
+
+[26] get file names from command line arguments
+@x
+rewrite(Pascal_file); rewrite(pool);
+@y
+if paramcount <> 4 then begin
+ fatal_error('Usage: ntangle web_file change_file pascal_file pool_file');
+ end;
+assign(Pascal_file, paramstr(3)); assign(pool, paramstr(4));
+rewrite(Pascal_file); rewrite(pool);
+@z
+
+[38] increase token capacity to tangle mf.
+@x
+@d zz=3 {we multiply the token capacity by approximately this amount}
+@y
+@d zz=4 {we need 4 not 3 to tangle mf}
+@z
+
+[179]
+@x
+@!term_in:text_file; {the user's terminal as an input file}
+@y
+@z
+
+[180] terminal input, implicitely done by Pascal
+@x
+reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
+@y
+@z
+
+[183] close output files
+@x
+@t\4\4@>{here files should be closed if the operating system requires it}
+@y
+close(Pascal_file); close(pool);
+@z
+
+[187] put eol after last terminal out line
+@x
+fatal_message: print_nl('(That was a fatal error, my friend.)');
+end {there are no other cases}
+@y
+fatal_message: print_nl('(That was a fatal error, my friend.)');
+end; {there are no other cases}
+new_line;
+halt(history) {pass the history as exit code to the operating system}
+@z
diff --git a/systems/unix/tex-fpc/web/tangle.p b/systems/unix/tex-fpc/web/tangle.p
new file mode 100644
index 0000000000..fcb3927326
--- /dev/null
+++ b/systems/unix/tex-fpc/web/tangle.p
@@ -0,0 +1,793 @@
+{2:}{4:}{$MODE ISO}{:4}PROGRAM TANGLE(INPUT,OUTPUT);LABEL 9999;
+CONST{8:}BUFSIZE=100;MAXBYTES=45000;MAXTOKS=50000;MAXNAMES=4000;
+MAXTEXTS=2000;HASHSIZE=353;LONGESTNAME=400;LINELENGTH=72;OUTBUFSIZE=144;
+STACKSIZE=50;MAXIDLENGTH=12;UNAMBIGLENGT=7;
+{:8}TYPE{11:}ASCIICODE=0..255;{:11}{12:}TEXTFILE=TEXT;
+{:12}{37:}EIGHTBITS=0..255;SIXTEENBITS=0..65535;
+{:37}{39:}NAMEPOINTER=0..MAXNAMES;{:39}{43:}TEXTPOINTER=0..MAXTEXTS;
+{:43}{78:}OUTPUTSTATE=RECORD ENDFIELD:SIXTEENBITS;BYTEFIELD:SIXTEENBITS;
+NAMEFIELD:NAMEPOINTER;REPLFIELD:TEXTPOINTER;MODFIELD:0..12287;END;
+{:78}VAR{9:}HISTORY:0..3;{:9}{13:}XORD:ARRAY[CHAR]OF ASCIICODE;
+XCHR:ARRAY[ASCIICODE]OF CHAR;{:13}{23:}WEBFILE:TEXTFILE;
+CHANGEFILE:TEXTFILE;{:23}{25:}PASCALFILE:TEXTFILE;POOL:TEXTFILE;
+{:25}{27:}BUFFER:ARRAY[0..BUFSIZE]OF ASCIICODE;
+{:27}{29:}PHASEONE:BOOLEAN;
+{:29}{38:}BYTEMEM:PACKED ARRAY[0..1,0..MAXBYTES]OF ASCIICODE;
+TOKMEM:PACKED ARRAY[0..3,0..MAXTOKS]OF EIGHTBITS;
+BYTESTART:ARRAY[0..MAXNAMES]OF SIXTEENBITS;
+TOKSTART:ARRAY[0..MAXTEXTS]OF SIXTEENBITS;
+LINK:ARRAY[0..MAXNAMES]OF SIXTEENBITS;
+ILK:ARRAY[0..MAXNAMES]OF SIXTEENBITS;
+EQUIV:ARRAY[0..MAXNAMES]OF SIXTEENBITS;
+TEXTLINK:ARRAY[0..MAXTEXTS]OF SIXTEENBITS;{:38}{40:}NAMEPTR:NAMEPOINTER;
+STRINGPTR:NAMEPOINTER;BYTEPTR:ARRAY[0..1]OF 0..MAXBYTES;
+POOLCHECKSUM:INTEGER;{:40}{44:}TEXTPTR:TEXTPOINTER;
+TOKPTR:ARRAY[0..3]OF 0..MAXTOKS;Z:0..3;
+MAXTOKPTR:ARRAY[0..3]OF 0..MAXTOKS;{:44}{50:}IDFIRST:0..BUFSIZE;
+IDLOC:0..BUFSIZE;DOUBLECHARS:0..BUFSIZE;
+HASH,CHOPHASH:ARRAY[0..HASHSIZE]OF SIXTEENBITS;
+CHOPPEDID:ARRAY[0..UNAMBIGLENGT]OF ASCIICODE;
+{:50}{65:}MODTEXT:ARRAY[0..LONGESTNAME]OF ASCIICODE;
+{:65}{70:}LASTUNNAMED:TEXTPOINTER;{:70}{79:}CURSTATE:OUTPUTSTATE;
+STACK:ARRAY[1..STACKSIZE]OF OUTPUTSTATE;STACKPTR:0..STACKSIZE;
+{:79}{80:}ZO:0..3;{:80}{82:}BRACELEVEL:EIGHTBITS;
+{:82}{86:}CURVAL:INTEGER;
+{:86}{94:}OUTBUF:ARRAY[0..OUTBUFSIZE]OF ASCIICODE;OUTPTR:0..OUTBUFSIZE;
+BREAKPTR:0..OUTBUFSIZE;SEMIPTR:0..OUTBUFSIZE;
+{:94}{95:}OUTSTATE:EIGHTBITS;OUTVAL,OUTAPP:INTEGER;OUTSIGN:ASCIICODE;
+LASTSIGN:-1..+1;{:95}{100:}OUTCONTRIB:ARRAY[1..LINELENGTH]OF ASCIICODE;
+{:100}{124:}II:INTEGER;LINE:INTEGER;OTHERLINE:INTEGER;TEMPLINE:INTEGER;
+LIMIT:0..BUFSIZE;LOC:0..BUFSIZE;INPUTHASENDE:BOOLEAN;CHANGING:BOOLEAN;
+{:124}{126:}CHANGEBUFFER:ARRAY[0..BUFSIZE]OF ASCIICODE;
+CHANGELIMIT:0..BUFSIZE;{:126}{143:}CURMODULE:NAMEPOINTER;
+SCANNINGHEX:BOOLEAN;{:143}{156:}NEXTCONTROL:EIGHTBITS;
+{:156}{164:}CURREPLTEXT:TEXTPOINTER;{:164}{171:}MODULECOUNT:0..12287;
+{:171}{179:}{TROUBLESHOOT:BOOLEAN;DDT:INTEGER;DD:INTEGER;
+DEBUGCYCLE:INTEGER;DEBUGSKIPPED:INTEGER;}{:179}{185:}WO:0..1;
+{:185}{30:}{PROCEDURE DEBUGHELP;FORWARD;}{:30}{31:}PROCEDURE ERROR;
+VAR J:0..OUTBUFSIZE;K,L:0..BUFSIZE;
+BEGIN IF PHASEONE THEN{32:}BEGIN IF CHANGING THEN WRITE(OUTPUT,
+'. (change file ')ELSE WRITE(OUTPUT,'. (');
+WRITELN(OUTPUT,'l.',LINE:1,')');IF LOC>=LIMIT THEN L:=LIMIT ELSE L:=LOC;
+FOR K:=1 TO L DO IF BUFFER[K-1]=9 THEN WRITE(OUTPUT,' ')ELSE WRITE(
+OUTPUT,XCHR[BUFFER[K-1]]);WRITELN(OUTPUT);
+FOR K:=1 TO L DO WRITE(OUTPUT,' ');
+FOR K:=L+1 TO LIMIT DO WRITE(OUTPUT,XCHR[BUFFER[K-1]]);
+WRITE(OUTPUT,' ');
+END{:32}ELSE{33:}BEGIN WRITELN(OUTPUT,'. (l.',LINE:1,')');
+FOR J:=1 TO OUTPTR DO WRITE(OUTPUT,XCHR[OUTBUF[J-1]]);
+WRITE(OUTPUT,'... ');END{:33};;HISTORY:=2;{DEBUGSKIPPED:=DEBUGCYCLE;
+DEBUGHELP;}END;{:31}{34:}PROCEDURE JUMPOUT;BEGIN GOTO 9999;END;
+{:34}PROCEDURE INITIALIZE;VAR{16:}I:0..255;{:16}{41:}WI:0..1;
+{:41}{45:}ZI:0..3;{:45}{51:}H:0..HASHSIZE;{:51}BEGIN{10:}HISTORY:=0;
+{:10}{14:}XCHR[32]:=' ';XCHR[33]:='!';XCHR[34]:='"';XCHR[35]:='#';
+XCHR[36]:='$';XCHR[37]:='%';XCHR[38]:='&';XCHR[39]:='''';XCHR[40]:='(';
+XCHR[41]:=')';XCHR[42]:='*';XCHR[43]:='+';XCHR[44]:=',';XCHR[45]:='-';
+XCHR[46]:='.';XCHR[47]:='/';XCHR[48]:='0';XCHR[49]:='1';XCHR[50]:='2';
+XCHR[51]:='3';XCHR[52]:='4';XCHR[53]:='5';XCHR[54]:='6';XCHR[55]:='7';
+XCHR[56]:='8';XCHR[57]:='9';XCHR[58]:=':';XCHR[59]:=';';XCHR[60]:='<';
+XCHR[61]:='=';XCHR[62]:='>';XCHR[63]:='?';XCHR[64]:='@';XCHR[65]:='A';
+XCHR[66]:='B';XCHR[67]:='C';XCHR[68]:='D';XCHR[69]:='E';XCHR[70]:='F';
+XCHR[71]:='G';XCHR[72]:='H';XCHR[73]:='I';XCHR[74]:='J';XCHR[75]:='K';
+XCHR[76]:='L';XCHR[77]:='M';XCHR[78]:='N';XCHR[79]:='O';XCHR[80]:='P';
+XCHR[81]:='Q';XCHR[82]:='R';XCHR[83]:='S';XCHR[84]:='T';XCHR[85]:='U';
+XCHR[86]:='V';XCHR[87]:='W';XCHR[88]:='X';XCHR[89]:='Y';XCHR[90]:='Z';
+XCHR[91]:='[';XCHR[92]:='\';XCHR[93]:=']';XCHR[94]:='^';XCHR[95]:='_';
+XCHR[96]:='`';XCHR[97]:='a';XCHR[98]:='b';XCHR[99]:='c';XCHR[100]:='d';
+XCHR[101]:='e';XCHR[102]:='f';XCHR[103]:='g';XCHR[104]:='h';
+XCHR[105]:='i';XCHR[106]:='j';XCHR[107]:='k';XCHR[108]:='l';
+XCHR[109]:='m';XCHR[110]:='n';XCHR[111]:='o';XCHR[112]:='p';
+XCHR[113]:='q';XCHR[114]:='r';XCHR[115]:='s';XCHR[116]:='t';
+XCHR[117]:='u';XCHR[118]:='v';XCHR[119]:='w';XCHR[120]:='x';
+XCHR[121]:='y';XCHR[122]:='z';XCHR[123]:='{';XCHR[124]:='|';
+XCHR[125]:='}';XCHR[126]:='~';XCHR[0]:=' ';XCHR[127]:=' ';
+{:14}{17:}FOR I:=1 TO 31 DO XCHR[I]:=' ';
+FOR I:=128 TO 255 DO XCHR[I]:=' ';
+{:17}{18:}FOR I:=0 TO 255 DO XORD[CHR(I)]:=32;
+FOR I:=1 TO 255 DO XORD[XCHR[I]]:=I;XORD[' ']:=32;
+{:18}{26:}IF PARAMCOUNT<>4 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'Usage: ntangle web_file change_file pascal_file pool_file'
+);ERROR;HISTORY:=3;JUMPOUT;END;END;ASSIGN(PASCALFILE,PARAMSTR(3));
+ASSIGN(POOL,PARAMSTR(4));REWRITE(PASCALFILE);REWRITE(POOL);
+{:26}{42:}FOR WI:=0 TO 1 DO BEGIN BYTESTART[WI]:=0;BYTEPTR[WI]:=0;END;
+BYTESTART[2]:=0;NAMEPTR:=1;STRINGPTR:=256;POOLCHECKSUM:=271828;
+{:42}{46:}FOR ZI:=0 TO 3 DO BEGIN TOKSTART[ZI]:=0;TOKPTR[ZI]:=0;END;
+TOKSTART[4]:=0;TEXTPTR:=1;Z:=1 MOD 4;{:46}{48:}ILK[0]:=0;EQUIV[0]:=0;
+{:48}{52:}FOR H:=0 TO HASHSIZE-1 DO BEGIN HASH[H]:=0;CHOPHASH[H]:=0;END;
+{:52}{71:}LASTUNNAMED:=0;TEXTLINK[0]:=0;{:71}{144:}SCANNINGHEX:=FALSE;
+{:144}{152:}MODTEXT[0]:=32;{:152}{180:}{TROUBLESHOOT:=TRUE;
+DEBUGCYCLE:=1;DEBUGSKIPPED:=0;TROUBLESHOOT:=FALSE;DEBUGCYCLE:=99999;}
+{:180}END;{:2}{24:}PROCEDURE OPENINPUT;
+BEGIN ASSIGN(WEBFILE,PARAMSTR(1));ASSIGN(CHANGEFILE,PARAMSTR(2));
+RESET(WEBFILE);RESET(CHANGEFILE);END;
+{:24}{28:}FUNCTION INPUTLN(VAR F:TEXTFILE):BOOLEAN;
+VAR FINALLIMIT:0..BUFSIZE;BEGIN LIMIT:=0;FINALLIMIT:=0;
+IF EOF(F)THEN INPUTLN:=FALSE ELSE BEGIN WHILE NOT EOLN(F)DO BEGIN BUFFER
+[LIMIT]:=XORD[F^];GET(F);LIMIT:=LIMIT+1;
+IF BUFFER[LIMIT-1]<>32 THEN FINALLIMIT:=LIMIT;
+IF LIMIT=BUFSIZE THEN BEGIN WHILE NOT EOLN(F)DO GET(F);LIMIT:=LIMIT-1;
+IF FINALLIMIT>LIMIT THEN FINALLIMIT:=LIMIT;BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Input line too long');END;LOC:=0;ERROR;END;END;
+READLN(F);LIMIT:=FINALLIMIT;INPUTLN:=TRUE;END;END;
+{:28}{49:}PROCEDURE PRINTID(P:NAMEPOINTER);VAR K:0..MAXBYTES;W:0..1;
+BEGIN IF P>=NAMEPTR THEN WRITE(OUTPUT,'IMPOSSIBLE')ELSE BEGIN W:=P MOD 2
+;
+FOR K:=BYTESTART[P]TO BYTESTART[P+2]-1 DO WRITE(OUTPUT,XCHR[BYTEMEM[W,K]
+]);END;END;{:49}{53:}FUNCTION IDLOOKUP(T:EIGHTBITS):NAMEPOINTER;
+LABEL 31,32;VAR C:EIGHTBITS;I:0..BUFSIZE;H:0..HASHSIZE;K:0..MAXBYTES;
+W:0..1;L:0..BUFSIZE;P,Q:NAMEPOINTER;S:0..UNAMBIGLENGT;
+BEGIN L:=IDLOC-IDFIRST;{54:}H:=BUFFER[IDFIRST];I:=IDFIRST+1;
+WHILE I<IDLOC DO BEGIN H:=(H+H+BUFFER[I])MOD HASHSIZE;I:=I+1;END{:54};
+{55:}P:=HASH[H];
+WHILE P<>0 DO BEGIN IF BYTESTART[P+2]-BYTESTART[P]=L THEN{56:}BEGIN I:=
+IDFIRST;K:=BYTESTART[P];W:=P MOD 2;
+WHILE(I<IDLOC)AND(BUFFER[I]=BYTEMEM[W,K])DO BEGIN I:=I+1;K:=K+1;END;
+IF I=IDLOC THEN GOTO 31;END{:56};P:=LINK[P];END;P:=NAMEPTR;
+LINK[P]:=HASH[H];HASH[H]:=P;31:{:55};
+IF(P=NAMEPTR)OR(T<>0)THEN{57:}BEGIN IF((P<>NAMEPTR)AND(T<>0)AND(ILK[P]=0
+))OR((P=NAMEPTR)AND(T=0)AND(BUFFER[IDFIRST]<>34))THEN{58:}BEGIN I:=
+IDFIRST;S:=0;H:=0;
+WHILE(I<IDLOC)AND(S<UNAMBIGLENGT)DO BEGIN IF BUFFER[I]<>95 THEN BEGIN IF
+BUFFER[I]>=97 THEN CHOPPEDID[S]:=BUFFER[I]-32 ELSE CHOPPEDID[S]:=BUFFER[
+I];H:=(H+H+CHOPPEDID[S])MOD HASHSIZE;S:=S+1;END;I:=I+1;END;
+CHOPPEDID[S]:=0;END{:58};
+IF P<>NAMEPTR THEN{59:}BEGIN IF ILK[P]=0 THEN BEGIN IF T=1 THEN BEGIN
+WRITELN(OUTPUT);WRITE(OUTPUT,'! This identifier has already appeared');
+ERROR;END;{60:}Q:=CHOPHASH[H];
+IF Q=P THEN CHOPHASH[H]:=EQUIV[P]ELSE BEGIN WHILE EQUIV[Q]<>P DO Q:=
+EQUIV[Q];EQUIV[Q]:=EQUIV[P];END{:60};END ELSE BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! This identifier was defined before');ERROR;END;
+ILK[P]:=T;
+END{:59}ELSE{61:}BEGIN IF(T=0)AND(BUFFER[IDFIRST]<>34)THEN{62:}BEGIN Q:=
+CHOPHASH[H];WHILE Q<>0 DO BEGIN{63:}BEGIN K:=BYTESTART[Q];S:=0;
+W:=Q MOD 2;
+WHILE(K<BYTESTART[Q+2])AND(S<UNAMBIGLENGT)DO BEGIN C:=BYTEMEM[W,K];
+IF C<>95 THEN BEGIN IF C>=97 THEN C:=C-32;
+IF CHOPPEDID[S]<>C THEN GOTO 32;S:=S+1;END;K:=K+1;END;
+IF(K=BYTESTART[Q+2])AND(CHOPPEDID[S]<>0)THEN GOTO 32;
+BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Identifier conflict with ');END;
+FOR K:=BYTESTART[Q]TO BYTESTART[Q+2]-1 DO WRITE(OUTPUT,XCHR[BYTEMEM[W,K]
+]);ERROR;Q:=0;32:END{:63};Q:=EQUIV[Q];END;EQUIV[P]:=CHOPHASH[H];
+CHOPHASH[H]:=P;END{:62};W:=NAMEPTR MOD 2;K:=BYTEPTR[W];
+IF K+L>MAXBYTES THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','byte memory',' capacity exceeded');ERROR;
+HISTORY:=3;JUMPOUT;END;IF NAMEPTR>MAXNAMES-2 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','name',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;I:=IDFIRST;WHILE I<IDLOC DO BEGIN BYTEMEM[W,K]:=BUFFER[I];
+K:=K+1;I:=I+1;END;BYTEPTR[W]:=K;BYTESTART[NAMEPTR+2]:=K;
+NAMEPTR:=NAMEPTR+1;
+IF BUFFER[IDFIRST]<>34 THEN ILK[P]:=T ELSE{64:}BEGIN ILK[P]:=1;
+IF L-DOUBLECHARS=2 THEN EQUIV[P]:=BUFFER[IDFIRST+1]+32768 ELSE BEGIN
+EQUIV[P]:=STRINGPTR+32768;L:=L-DOUBLECHARS-1;
+IF L>99 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Preprocessed string is too long');ERROR;END;
+STRINGPTR:=STRINGPTR+1;WRITE(POOL,XCHR[48+L DIV 10],XCHR[48+L MOD 10]);
+POOLCHECKSUM:=POOLCHECKSUM+POOLCHECKSUM+L;
+WHILE POOLCHECKSUM>536870839 DO POOLCHECKSUM:=POOLCHECKSUM-536870839;
+I:=IDFIRST+1;WHILE I<IDLOC DO BEGIN WRITE(POOL,XCHR[BUFFER[I]]);
+POOLCHECKSUM:=POOLCHECKSUM+POOLCHECKSUM+BUFFER[I];
+WHILE POOLCHECKSUM>536870839 DO POOLCHECKSUM:=POOLCHECKSUM-536870839;
+IF(BUFFER[I]=34)OR(BUFFER[I]=64)THEN I:=I+2 ELSE I:=I+1;END;
+WRITELN(POOL);END;END{:64};END{:61};END{:57};IDLOOKUP:=P;END;
+{:53}{66:}FUNCTION MODLOOKUP(L:SIXTEENBITS):NAMEPOINTER;LABEL 31;
+VAR C:0..4;J:0..LONGESTNAME;K:0..MAXBYTES;W:0..1;P:NAMEPOINTER;
+Q:NAMEPOINTER;BEGIN C:=2;Q:=0;P:=ILK[0];
+WHILE P<>0 DO BEGIN{68:}BEGIN K:=BYTESTART[P];W:=P MOD 2;C:=1;J:=1;
+WHILE(K<BYTESTART[P+2])AND(J<=L)AND(MODTEXT[J]=BYTEMEM[W,K])DO BEGIN K:=
+K+1;J:=J+1;END;
+IF K=BYTESTART[P+2]THEN IF J>L THEN C:=1 ELSE C:=4 ELSE IF J>L THEN C:=3
+ELSE IF MODTEXT[J]<BYTEMEM[W,K]THEN C:=0 ELSE C:=2;END{:68};Q:=P;
+IF C=0 THEN P:=LINK[Q]ELSE IF C=2 THEN P:=ILK[Q]ELSE GOTO 31;END;
+{67:}W:=NAMEPTR MOD 2;K:=BYTEPTR[W];
+IF K+L>MAXBYTES THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','byte memory',' capacity exceeded');ERROR;
+HISTORY:=3;JUMPOUT;END;IF NAMEPTR>MAXNAMES-2 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','name',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;P:=NAMEPTR;IF C=0 THEN LINK[Q]:=P ELSE ILK[Q]:=P;LINK[P]:=0;
+ILK[P]:=0;C:=1;EQUIV[P]:=0;
+FOR J:=1 TO L DO BYTEMEM[W,K+J-1]:=MODTEXT[J];BYTEPTR[W]:=K+L;
+BYTESTART[NAMEPTR+2]:=K+L;NAMEPTR:=NAMEPTR+1;{:67};
+31:IF C<>1 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Incompatible section names');ERROR;END;P:=0;END;
+MODLOOKUP:=P;END;
+{:66}{69:}FUNCTION PREFIXLOOKUP(L:SIXTEENBITS):NAMEPOINTER;VAR C:0..4;
+COUNT:0..MAXNAMES;J:0..LONGESTNAME;K:0..MAXBYTES;W:0..1;P:NAMEPOINTER;
+Q:NAMEPOINTER;R:NAMEPOINTER;BEGIN Q:=0;P:=ILK[0];COUNT:=0;R:=0;
+WHILE P<>0 DO BEGIN{68:}BEGIN K:=BYTESTART[P];W:=P MOD 2;C:=1;J:=1;
+WHILE(K<BYTESTART[P+2])AND(J<=L)AND(MODTEXT[J]=BYTEMEM[W,K])DO BEGIN K:=
+K+1;J:=J+1;END;
+IF K=BYTESTART[P+2]THEN IF J>L THEN C:=1 ELSE C:=4 ELSE IF J>L THEN C:=3
+ELSE IF MODTEXT[J]<BYTEMEM[W,K]THEN C:=0 ELSE C:=2;END{:68};
+IF C=0 THEN P:=LINK[P]ELSE IF C=2 THEN P:=ILK[P]ELSE BEGIN R:=P;
+COUNT:=COUNT+1;Q:=ILK[P];P:=LINK[P];END;IF P=0 THEN BEGIN P:=Q;Q:=0;END;
+END;IF COUNT<>1 THEN IF COUNT=0 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Name does not match');ERROR;
+END ELSE BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Ambiguous prefix');ERROR;
+END;PREFIXLOOKUP:=R;END;{:69}{73:}PROCEDURE STORETWOBYTE(X:SIXTEENBITS);
+BEGIN IF TOKPTR[Z]+2>MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=X DIV 256;
+TOKMEM[Z,TOKPTR[Z]+1]:=X MOD 256;TOKPTR[Z]:=TOKPTR[Z]+2;END;
+{:73}{74:}{PROCEDURE PRINTREPL(P:TEXTPOINTER);VAR K:0..MAXTOKS;
+A:SIXTEENBITS;ZP:0..3;
+BEGIN IF P>=TEXTPTR THEN WRITE(OUTPUT,'BAD')ELSE BEGIN K:=TOKSTART[P];
+ZP:=P MOD 4;WHILE K<TOKSTART[P+4]DO BEGIN A:=TOKMEM[ZP,K];
+IF A>=128 THEN[75:]BEGIN K:=K+1;
+IF A<168 THEN BEGIN A:=(A-128)*256+TOKMEM[ZP,K];PRINTID(A);
+IF BYTEMEM[A MOD 2,BYTESTART[A]]=34 THEN WRITE(OUTPUT,'"')ELSE WRITE(
+OUTPUT,' ');END ELSE IF A<208 THEN BEGIN WRITE(OUTPUT,'@<');
+PRINTID((A-168)*256+TOKMEM[ZP,K]);WRITE(OUTPUT,'@>');
+END ELSE BEGIN A:=(A-208)*256+TOKMEM[ZP,K];
+WRITE(OUTPUT,'@',XCHR[123],A:1,'@',XCHR[125]);END;
+END[:75]ELSE[76:]CASE A OF 9:WRITE(OUTPUT,'@',XCHR[123]);
+10:WRITE(OUTPUT,'@',XCHR[125]);12:WRITE(OUTPUT,'@''');
+13:WRITE(OUTPUT,'@"');125:WRITE(OUTPUT,'@$');0:WRITE(OUTPUT,'#');
+64:WRITE(OUTPUT,'@@');2:WRITE(OUTPUT,'@=');3:WRITE(OUTPUT,'@\');
+ELSE WRITE(OUTPUT,XCHR[A])END[:76];K:=K+1;END;END;END;}
+{:74}{84:}PROCEDURE PUSHLEVEL(P:NAMEPOINTER);
+BEGIN IF STACKPTR=STACKSIZE THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','stack',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END ELSE BEGIN STACK[STACKPTR]:=CURSTATE;STACKPTR:=STACKPTR+1;
+CURSTATE.NAMEFIELD:=P;CURSTATE.REPLFIELD:=EQUIV[P];
+ZO:=CURSTATE.REPLFIELD MOD 4;
+CURSTATE.BYTEFIELD:=TOKSTART[CURSTATE.REPLFIELD];
+CURSTATE.ENDFIELD:=TOKSTART[CURSTATE.REPLFIELD+4];CURSTATE.MODFIELD:=0;
+END;END;{:84}{85:}PROCEDURE POPLEVEL;LABEL 10;
+BEGIN IF TEXTLINK[CURSTATE.REPLFIELD]=0 THEN BEGIN IF ILK[CURSTATE.
+NAMEFIELD]=3 THEN{91:}BEGIN NAMEPTR:=NAMEPTR-1;TEXTPTR:=TEXTPTR-1;
+Z:=TEXTPTR MOD 4;IF TOKPTR[Z]>MAXTOKPTR[Z]THEN MAXTOKPTR[Z]:=TOKPTR[Z];
+TOKPTR[Z]:=TOKSTART[TEXTPTR];
+{BYTEPTR[NAMEPTR MOD 2]:=BYTEPTR[NAMEPTR MOD 2]-1;}END{:91};
+END ELSE IF TEXTLINK[CURSTATE.REPLFIELD]<MAXTEXTS THEN BEGIN CURSTATE.
+REPLFIELD:=TEXTLINK[CURSTATE.REPLFIELD];ZO:=CURSTATE.REPLFIELD MOD 4;
+CURSTATE.BYTEFIELD:=TOKSTART[CURSTATE.REPLFIELD];
+CURSTATE.ENDFIELD:=TOKSTART[CURSTATE.REPLFIELD+4];GOTO 10;END;
+STACKPTR:=STACKPTR-1;IF STACKPTR>0 THEN BEGIN CURSTATE:=STACK[STACKPTR];
+ZO:=CURSTATE.REPLFIELD MOD 4;END;10:END;
+{:85}{87:}FUNCTION GETOUTPUT:SIXTEENBITS;LABEL 20,30,31;
+VAR A:SIXTEENBITS;B:EIGHTBITS;BAL:SIXTEENBITS;K:0..MAXBYTES;W:0..1;
+BEGIN 20:IF STACKPTR=0 THEN BEGIN A:=0;GOTO 31;END;
+IF CURSTATE.BYTEFIELD=CURSTATE.ENDFIELD THEN BEGIN CURVAL:=-CURSTATE.
+MODFIELD;POPLEVEL;IF CURVAL=0 THEN GOTO 20;A:=129;GOTO 31;END;
+A:=TOKMEM[ZO,CURSTATE.BYTEFIELD];
+CURSTATE.BYTEFIELD:=CURSTATE.BYTEFIELD+1;
+IF A<128 THEN IF A=0 THEN{92:}BEGIN PUSHLEVEL(NAMEPTR-1);GOTO 20;
+END{:92}ELSE GOTO 31;A:=(A-128)*256+TOKMEM[ZO,CURSTATE.BYTEFIELD];
+CURSTATE.BYTEFIELD:=CURSTATE.BYTEFIELD+1;
+IF A<10240 THEN{89:}BEGIN CASE ILK[A]OF 0:BEGIN CURVAL:=A;A:=130;END;
+1:BEGIN CURVAL:=EQUIV[A]-32768;A:=128;END;2:BEGIN PUSHLEVEL(A);GOTO 20;
+END;
+3:BEGIN{90:}WHILE(CURSTATE.BYTEFIELD=CURSTATE.ENDFIELD)AND(STACKPTR>0)DO
+POPLEVEL;
+IF(STACKPTR=0)OR(TOKMEM[ZO,CURSTATE.BYTEFIELD]<>40)THEN BEGIN BEGIN
+WRITELN(OUTPUT);WRITE(OUTPUT,'! No parameter given for ');END;
+PRINTID(A);ERROR;GOTO 20;END;{93:}BAL:=1;
+CURSTATE.BYTEFIELD:=CURSTATE.BYTEFIELD+1;
+WHILE TRUE DO BEGIN B:=TOKMEM[ZO,CURSTATE.BYTEFIELD];
+CURSTATE.BYTEFIELD:=CURSTATE.BYTEFIELD+1;
+IF B=0 THEN STORETWOBYTE(NAMEPTR+32767)ELSE BEGIN IF B>=128 THEN BEGIN
+BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=B;TOKPTR[Z]:=TOKPTR[Z]+1;END;
+B:=TOKMEM[ZO,CURSTATE.BYTEFIELD];
+CURSTATE.BYTEFIELD:=CURSTATE.BYTEFIELD+1;
+END ELSE CASE B OF 40:BAL:=BAL+1;41:BEGIN BAL:=BAL-1;
+IF BAL=0 THEN GOTO 30;END;
+39:REPEAT BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=B;TOKPTR[Z]:=TOKPTR[Z]+1;END;
+B:=TOKMEM[ZO,CURSTATE.BYTEFIELD];
+CURSTATE.BYTEFIELD:=CURSTATE.BYTEFIELD+1;UNTIL B=39;ELSE END;
+BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=B;TOKPTR[Z]:=TOKPTR[Z]+1;END;END;END;
+30:{:93};EQUIV[NAMEPTR]:=TEXTPTR;ILK[NAMEPTR]:=2;W:=NAMEPTR MOD 2;
+K:=BYTEPTR[W];{IF K=MAXBYTES THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','byte memory',' capacity exceeded');ERROR;
+HISTORY:=3;JUMPOUT;END;BYTEMEM[W,K]:=35;K:=K+1;BYTEPTR[W]:=K;}
+IF NAMEPTR>MAXNAMES-2 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','name',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;BYTESTART[NAMEPTR+2]:=K;NAMEPTR:=NAMEPTR+1;
+IF TEXTPTR>MAXTEXTS-4 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','text',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TEXTLINK[TEXTPTR]:=0;TOKSTART[TEXTPTR+4]:=TOKPTR[Z];
+TEXTPTR:=TEXTPTR+1;Z:=TEXTPTR MOD 4{:90};PUSHLEVEL(A);GOTO 20;END;
+ELSE BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! This can''t happen (','output',')');ERROR;HISTORY:=3;
+JUMPOUT;END END;GOTO 31;END{:89};IF A<20480 THEN{88:}BEGIN A:=A-10240;
+IF EQUIV[A]<>0 THEN PUSHLEVEL(A)ELSE IF A<>0 THEN BEGIN BEGIN WRITELN(
+OUTPUT);WRITE(OUTPUT,'! Not present: <');END;PRINTID(A);
+WRITE(OUTPUT,'>');ERROR;END;GOTO 20;END{:88};CURVAL:=A-20480;A:=129;
+CURSTATE.MODFIELD:=CURVAL;31:{IF TROUBLESHOOT THEN DEBUGHELP;}
+GETOUTPUT:=A;END;{:87}{97:}PROCEDURE FLUSHBUFFER;VAR K:0..OUTBUFSIZE;
+B:0..OUTBUFSIZE;BEGIN B:=BREAKPTR;
+IF(SEMIPTR<>0)AND(OUTPTR-SEMIPTR<=LINELENGTH)THEN BREAKPTR:=SEMIPTR;
+FOR K:=1 TO BREAKPTR DO WRITE(PASCALFILE,XCHR[OUTBUF[K-1]]);
+WRITELN(PASCALFILE);LINE:=LINE+1;
+IF LINE MOD 100=0 THEN BEGIN WRITE(OUTPUT,'.');
+IF LINE MOD 500=0 THEN WRITE(OUTPUT,LINE:1);;END;
+IF BREAKPTR<OUTPTR THEN BEGIN IF OUTBUF[BREAKPTR]=32 THEN BEGIN BREAKPTR
+:=BREAKPTR+1;IF BREAKPTR>B THEN B:=BREAKPTR;END;
+FOR K:=BREAKPTR TO OUTPTR-1 DO OUTBUF[K-BREAKPTR]:=OUTBUF[K];END;
+OUTPTR:=OUTPTR-BREAKPTR;BREAKPTR:=B-BREAKPTR;SEMIPTR:=0;
+IF OUTPTR>LINELENGTH THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Long line must be truncated');ERROR;END;
+OUTPTR:=LINELENGTH;END;END;{:97}{99:}PROCEDURE APPVAL(V:INTEGER);
+VAR K:0..OUTBUFSIZE;BEGIN K:=OUTBUFSIZE;REPEAT OUTBUF[K]:=V MOD 10;
+V:=V DIV 10;K:=K-1;UNTIL V=0;REPEAT K:=K+1;
+BEGIN OUTBUF[OUTPTR]:=OUTBUF[K]+48;OUTPTR:=OUTPTR+1;END;
+UNTIL K=OUTBUFSIZE;END;{:99}{101:}PROCEDURE SENDOUT(T:EIGHTBITS;
+V:SIXTEENBITS);LABEL 20;VAR K:0..LINELENGTH;
+BEGIN{102:}20:CASE OUTSTATE OF 1:IF T<>3 THEN BEGIN BREAKPTR:=OUTPTR;
+IF T=2 THEN BEGIN OUTBUF[OUTPTR]:=32;OUTPTR:=OUTPTR+1;END;END;
+2:BEGIN BEGIN OUTBUF[OUTPTR]:=44-OUTAPP;OUTPTR:=OUTPTR+1;END;
+IF OUTPTR>LINELENGTH THEN FLUSHBUFFER;BREAKPTR:=OUTPTR;END;
+3,4:BEGIN{103:}IF(OUTVAL<0)OR((OUTVAL=0)AND(LASTSIGN<0))THEN BEGIN
+OUTBUF[OUTPTR]:=45;OUTPTR:=OUTPTR+1;
+END ELSE IF OUTSIGN>0 THEN BEGIN OUTBUF[OUTPTR]:=OUTSIGN;
+OUTPTR:=OUTPTR+1;END;APPVAL(ABS(OUTVAL));
+IF OUTPTR>LINELENGTH THEN FLUSHBUFFER;{:103};OUTSTATE:=OUTSTATE-2;
+GOTO 20;END;
+5:{104:}BEGIN IF(T=3)OR({105:}((T=2)AND(V=3)AND(((OUTCONTRIB[1]=68)AND(
+OUTCONTRIB[2]=73)AND(OUTCONTRIB[3]=86))OR((OUTCONTRIB[1]=77)AND(
+OUTCONTRIB[2]=79)AND(OUTCONTRIB[3]=68))))OR((T=0)AND((V=42)OR(V=47)))
+{:105})THEN BEGIN{103:}IF(OUTVAL<0)OR((OUTVAL=0)AND(LASTSIGN<0))THEN
+BEGIN OUTBUF[OUTPTR]:=45;OUTPTR:=OUTPTR+1;
+END ELSE IF OUTSIGN>0 THEN BEGIN OUTBUF[OUTPTR]:=OUTSIGN;
+OUTPTR:=OUTPTR+1;END;APPVAL(ABS(OUTVAL));
+IF OUTPTR>LINELENGTH THEN FLUSHBUFFER;{:103};OUTSIGN:=43;OUTVAL:=OUTAPP;
+END ELSE OUTVAL:=OUTVAL+OUTAPP;OUTSTATE:=3;GOTO 20;END{:104};
+0:IF T<>3 THEN BREAKPTR:=OUTPTR;ELSE END{:102};
+IF T<>0 THEN FOR K:=1 TO V DO BEGIN OUTBUF[OUTPTR]:=OUTCONTRIB[K];
+OUTPTR:=OUTPTR+1;END ELSE BEGIN OUTBUF[OUTPTR]:=V;OUTPTR:=OUTPTR+1;END;
+IF OUTPTR>LINELENGTH THEN FLUSHBUFFER;
+IF(T=0)AND((V=59)OR(V=125))THEN BEGIN SEMIPTR:=OUTPTR;BREAKPTR:=OUTPTR;
+END;IF T>=2 THEN OUTSTATE:=1 ELSE OUTSTATE:=0 END;
+{:101}{106:}PROCEDURE SENDSIGN(V:INTEGER);
+BEGIN CASE OUTSTATE OF 2,4:OUTAPP:=OUTAPP*V;3:BEGIN OUTAPP:=V;
+OUTSTATE:=4;END;5:BEGIN OUTVAL:=OUTVAL+OUTAPP;OUTAPP:=V;OUTSTATE:=4;END;
+ELSE BEGIN BREAKPTR:=OUTPTR;OUTAPP:=V;OUTSTATE:=2;END END;
+LASTSIGN:=OUTAPP;END;{:106}{107:}PROCEDURE SENDVAL(V:INTEGER);
+LABEL 666,10;
+BEGIN CASE OUTSTATE OF 1:BEGIN{110:}IF(OUTPTR=BREAKPTR+3)OR((OUTPTR=
+BREAKPTR+4)AND(OUTBUF[BREAKPTR]=32))THEN IF((OUTBUF[OUTPTR-3]=68)AND(
+OUTBUF[OUTPTR-2]=73)AND(OUTBUF[OUTPTR-1]=86))OR((OUTBUF[OUTPTR-3]=77)AND
+(OUTBUF[OUTPTR-2]=79)AND(OUTBUF[OUTPTR-1]=68))THEN GOTO 666{:110};
+OUTSIGN:=32;OUTSTATE:=3;OUTVAL:=V;BREAKPTR:=OUTPTR;LASTSIGN:=+1;END;
+0:BEGIN{109:}IF(OUTPTR=BREAKPTR+1)AND((OUTBUF[BREAKPTR]=42)OR(OUTBUF[
+BREAKPTR]=47))THEN GOTO 666{:109};OUTSIGN:=0;OUTSTATE:=3;OUTVAL:=V;
+BREAKPTR:=OUTPTR;LASTSIGN:=+1;END;{108:}2:BEGIN OUTSIGN:=43;OUTSTATE:=3;
+OUTVAL:=OUTAPP*V;END;3:BEGIN OUTSTATE:=5;OUTAPP:=V;
+BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Two numbers occurred without a sign between them');
+ERROR;END;END;4:BEGIN OUTSTATE:=5;OUTAPP:=OUTAPP*V;END;
+5:BEGIN OUTVAL:=OUTVAL+OUTAPP;OUTAPP:=V;BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Two numbers occurred without a sign between them');
+ERROR;END;END;{:108}ELSE GOTO 666 END;GOTO 10;
+666:{111:}IF V>=0 THEN BEGIN IF OUTSTATE=1 THEN BEGIN BREAKPTR:=OUTPTR;
+BEGIN OUTBUF[OUTPTR]:=32;OUTPTR:=OUTPTR+1;END;END;APPVAL(V);
+IF OUTPTR>LINELENGTH THEN FLUSHBUFFER;OUTSTATE:=1;
+END ELSE BEGIN BEGIN OUTBUF[OUTPTR]:=40;OUTPTR:=OUTPTR+1;END;
+BEGIN OUTBUF[OUTPTR]:=45;OUTPTR:=OUTPTR+1;END;APPVAL(-V);
+BEGIN OUTBUF[OUTPTR]:=41;OUTPTR:=OUTPTR+1;END;
+IF OUTPTR>LINELENGTH THEN FLUSHBUFFER;OUTSTATE:=0;END{:111};10:END;
+{:107}{113:}PROCEDURE SENDTHEOUTPU;LABEL 2,21,22;VAR CURCHAR:EIGHTBITS;
+K:0..LINELENGTH;J:0..MAXBYTES;W:0..1;N:INTEGER;
+BEGIN WHILE STACKPTR>0 DO BEGIN CURCHAR:=GETOUTPUT;
+21:CASE CURCHAR OF 0:;
+{116:}65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,
+87,88,89,90:BEGIN OUTCONTRIB[1]:=CURCHAR;SENDOUT(2,1);END;
+97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115
+,116,117,118,119,120,121,122:BEGIN OUTCONTRIB[1]:=CURCHAR-32;
+SENDOUT(2,1);END;130:BEGIN K:=0;J:=BYTESTART[CURVAL];W:=CURVAL MOD 2;
+WHILE(K<MAXIDLENGTH)AND(J<BYTESTART[CURVAL+2])DO BEGIN K:=K+1;
+OUTCONTRIB[K]:=BYTEMEM[W,J];J:=J+1;
+IF OUTCONTRIB[K]>=97 THEN OUTCONTRIB[K]:=OUTCONTRIB[K]-32 ELSE IF
+OUTCONTRIB[K]=95 THEN K:=K-1;END;SENDOUT(2,K);END;
+{:116}{119:}48,49,50,51,52,53,54,55,56,57:BEGIN N:=0;
+REPEAT CURCHAR:=CURCHAR-48;IF N>=214748364 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Constant too big');ERROR;END ELSE N:=10*N+CURCHAR;
+CURCHAR:=GETOUTPUT;UNTIL(CURCHAR>57)OR(CURCHAR<48);SENDVAL(N);K:=0;
+IF CURCHAR=101 THEN CURCHAR:=69;IF CURCHAR=69 THEN GOTO 2 ELSE GOTO 21;
+END;125:SENDVAL(POOLCHECKSUM);12:BEGIN N:=0;CURCHAR:=48;
+REPEAT CURCHAR:=CURCHAR-48;IF N>=268435456 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Constant too big');ERROR;END ELSE N:=8*N+CURCHAR;
+CURCHAR:=GETOUTPUT;UNTIL(CURCHAR>55)OR(CURCHAR<48);SENDVAL(N);GOTO 21;
+END;13:BEGIN N:=0;CURCHAR:=48;
+REPEAT IF CURCHAR>=65 THEN CURCHAR:=CURCHAR-55 ELSE CURCHAR:=CURCHAR-48;
+IF N>=134217728 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Constant too big');ERROR;END ELSE N:=16*N+CURCHAR;
+CURCHAR:=GETOUTPUT;
+UNTIL(CURCHAR>70)OR(CURCHAR<48)OR((CURCHAR>57)AND(CURCHAR<65));
+SENDVAL(N);GOTO 21;END;128:SENDVAL(CURVAL);46:BEGIN K:=1;
+OUTCONTRIB[1]:=46;CURCHAR:=GETOUTPUT;
+IF CURCHAR=46 THEN BEGIN OUTCONTRIB[2]:=46;SENDOUT(1,2);
+END ELSE IF(CURCHAR>=48)AND(CURCHAR<=57)THEN GOTO 2 ELSE BEGIN SENDOUT(0
+,46);GOTO 21;END;END;{:119}43,45:SENDSIGN(44-CURCHAR);
+{114:}4:BEGIN OUTCONTRIB[1]:=65;OUTCONTRIB[2]:=78;OUTCONTRIB[3]:=68;
+SENDOUT(2,3);END;5:BEGIN OUTCONTRIB[1]:=78;OUTCONTRIB[2]:=79;
+OUTCONTRIB[3]:=84;SENDOUT(2,3);END;6:BEGIN OUTCONTRIB[1]:=73;
+OUTCONTRIB[2]:=78;SENDOUT(2,2);END;31:BEGIN OUTCONTRIB[1]:=79;
+OUTCONTRIB[2]:=82;SENDOUT(2,2);END;24:BEGIN OUTCONTRIB[1]:=58;
+OUTCONTRIB[2]:=61;SENDOUT(1,2);END;26:BEGIN OUTCONTRIB[1]:=60;
+OUTCONTRIB[2]:=62;SENDOUT(1,2);END;28:BEGIN OUTCONTRIB[1]:=60;
+OUTCONTRIB[2]:=61;SENDOUT(1,2);END;29:BEGIN OUTCONTRIB[1]:=62;
+OUTCONTRIB[2]:=61;SENDOUT(1,2);END;30:BEGIN OUTCONTRIB[1]:=61;
+OUTCONTRIB[2]:=61;SENDOUT(1,2);END;32:BEGIN OUTCONTRIB[1]:=46;
+OUTCONTRIB[2]:=46;SENDOUT(1,2);END;{:114}39:{117:}BEGIN K:=1;
+OUTCONTRIB[1]:=39;REPEAT IF K<LINELENGTH THEN K:=K+1;
+OUTCONTRIB[K]:=GETOUTPUT;UNTIL(OUTCONTRIB[K]=39)OR(STACKPTR=0);
+IF K=LINELENGTH THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! String too long');ERROR;END;SENDOUT(1,K);
+CURCHAR:=GETOUTPUT;IF CURCHAR=39 THEN OUTSTATE:=6;GOTO 21;END{:117};
+{115:}33,34,35,36,37,38,40,41,42,44,47,58,59,60,61,62,63,64,91,92,93,94,
+95,96,123,124{:115}:SENDOUT(0,CURCHAR);
+{121:}9:BEGIN IF BRACELEVEL=0 THEN SENDOUT(0,123)ELSE SENDOUT(0,91);
+BRACELEVEL:=BRACELEVEL+1;END;
+10:IF BRACELEVEL>0 THEN BEGIN BRACELEVEL:=BRACELEVEL-1;
+IF BRACELEVEL=0 THEN SENDOUT(0,125)ELSE SENDOUT(0,93);
+END ELSE BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Extra @}');ERROR;END;
+129:BEGIN K:=2;
+IF BRACELEVEL=0 THEN OUTCONTRIB[1]:=123 ELSE OUTCONTRIB[1]:=91;
+IF CURVAL<0 THEN BEGIN OUTCONTRIB[K]:=58;CURVAL:=-CURVAL;K:=K+1;END;
+N:=10;WHILE CURVAL>=N DO N:=10*N;REPEAT N:=N DIV 10;
+OUTCONTRIB[K]:=48+(CURVAL DIV N);CURVAL:=CURVAL MOD N;K:=K+1;UNTIL N=1;
+IF OUTCONTRIB[2]<>58 THEN BEGIN OUTCONTRIB[K]:=58;K:=K+1;END;
+IF BRACELEVEL=0 THEN OUTCONTRIB[K]:=125 ELSE OUTCONTRIB[K]:=93;
+SENDOUT(1,K);END;{:121}127:BEGIN SENDOUT(3,0);OUTSTATE:=6;END;
+2:{118:}BEGIN K:=0;REPEAT IF K<LINELENGTH THEN K:=K+1;
+OUTCONTRIB[K]:=GETOUTPUT;UNTIL(OUTCONTRIB[K]=2)OR(STACKPTR=0);
+IF K=LINELENGTH THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Verbatim string too long');ERROR;END;SENDOUT(1,K-1);
+END{:118};3:{122:}BEGIN SENDOUT(1,0);
+WHILE OUTPTR>0 DO BEGIN IF OUTPTR<=LINELENGTH THEN BREAKPTR:=OUTPTR;
+FLUSHBUFFER;END;OUTSTATE:=0;END{:122};ELSE BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Can''t output ASCII code ',CURCHAR:1);ERROR;END END;
+GOTO 22;2:{120:}REPEAT IF K<LINELENGTH THEN K:=K+1;
+OUTCONTRIB[K]:=CURCHAR;CURCHAR:=GETOUTPUT;
+IF(OUTCONTRIB[K]=69)AND((CURCHAR=43)OR(CURCHAR=45))THEN BEGIN IF K<
+LINELENGTH THEN K:=K+1;OUTCONTRIB[K]:=CURCHAR;CURCHAR:=GETOUTPUT;
+END ELSE IF CURCHAR=101 THEN CURCHAR:=69;
+UNTIL(CURCHAR<>69)AND((CURCHAR<48)OR(CURCHAR>57));
+IF K=LINELENGTH THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Fraction too long');ERROR;END;SENDOUT(3,K);
+GOTO 21{:120};22:END;END;{:113}{127:}FUNCTION LINESDONTMAT:BOOLEAN;
+LABEL 10;VAR K:0..BUFSIZE;BEGIN LINESDONTMAT:=TRUE;
+IF CHANGELIMIT<>LIMIT THEN GOTO 10;
+IF LIMIT>0 THEN FOR K:=0 TO LIMIT-1 DO IF CHANGEBUFFER[K]<>BUFFER[K]THEN
+GOTO 10;LINESDONTMAT:=FALSE;10:END;{:127}{128:}PROCEDURE PRIMETHECHAN;
+LABEL 22,30,10;VAR K:0..BUFSIZE;BEGIN CHANGELIMIT:=0;
+{129:}WHILE TRUE DO BEGIN LINE:=LINE+1;
+IF NOT INPUTLN(CHANGEFILE)THEN GOTO 10;IF LIMIT<2 THEN GOTO 22;
+IF BUFFER[0]<>64 THEN GOTO 22;
+IF(BUFFER[1]>=88)AND(BUFFER[1]<=90)THEN BUFFER[1]:=BUFFER[1]+32;
+IF BUFFER[1]=120 THEN GOTO 30;
+IF(BUFFER[1]=121)OR(BUFFER[1]=122)THEN BEGIN LOC:=2;
+BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Where is the matching @x?');ERROR;
+END;END;22:END;30:{:129};{130:}REPEAT LINE:=LINE+1;
+IF NOT INPUTLN(CHANGEFILE)THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Change file ended after @x');ERROR;END;GOTO 10;END;
+UNTIL LIMIT>0;{:130};{131:}BEGIN CHANGELIMIT:=LIMIT;
+IF LIMIT>0 THEN FOR K:=0 TO LIMIT-1 DO CHANGEBUFFER[K]:=BUFFER[K];
+END{:131};10:END;{:128}{132:}PROCEDURE CHECKCHANGE;LABEL 10;
+VAR N:INTEGER;K:0..BUFSIZE;BEGIN IF LINESDONTMAT THEN GOTO 10;N:=0;
+WHILE TRUE DO BEGIN CHANGING:=NOT CHANGING;TEMPLINE:=OTHERLINE;
+OTHERLINE:=LINE;LINE:=TEMPLINE;LINE:=LINE+1;
+IF NOT INPUTLN(CHANGEFILE)THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Change file ended before @y');ERROR;END;CHANGELIMIT:=0;
+CHANGING:=NOT CHANGING;TEMPLINE:=OTHERLINE;OTHERLINE:=LINE;
+LINE:=TEMPLINE;GOTO 10;END;
+{133:}IF LIMIT>1 THEN IF BUFFER[0]=64 THEN BEGIN IF(BUFFER[1]>=88)AND(
+BUFFER[1]<=90)THEN BUFFER[1]:=BUFFER[1]+32;
+IF(BUFFER[1]=120)OR(BUFFER[1]=122)THEN BEGIN LOC:=2;
+BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Where is the matching @y?');ERROR;
+END;END ELSE IF BUFFER[1]=121 THEN BEGIN IF N>0 THEN BEGIN LOC:=2;
+BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Hmm... ',N:1,' of the preceding lines failed to match');
+ERROR;END;END;GOTO 10;END;END{:133};{131:}BEGIN CHANGELIMIT:=LIMIT;
+IF LIMIT>0 THEN FOR K:=0 TO LIMIT-1 DO CHANGEBUFFER[K]:=BUFFER[K];
+END{:131};CHANGING:=NOT CHANGING;TEMPLINE:=OTHERLINE;OTHERLINE:=LINE;
+LINE:=TEMPLINE;LINE:=LINE+1;
+IF NOT INPUTLN(WEBFILE)THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! WEB file ended during a change');ERROR;END;
+INPUTHASENDE:=TRUE;GOTO 10;END;IF LINESDONTMAT THEN N:=N+1;END;10:END;
+{:132}{135:}PROCEDURE GETLINE;LABEL 20;
+BEGIN 20:IF CHANGING THEN{137:}BEGIN LINE:=LINE+1;
+IF NOT INPUTLN(CHANGEFILE)THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Change file ended without @z');ERROR;END;BUFFER[0]:=64;
+BUFFER[1]:=122;LIMIT:=2;END;
+IF LIMIT>1 THEN IF BUFFER[0]=64 THEN BEGIN IF(BUFFER[1]>=88)AND(BUFFER[1
+]<=90)THEN BUFFER[1]:=BUFFER[1]+32;
+IF(BUFFER[1]=120)OR(BUFFER[1]=121)THEN BEGIN LOC:=2;
+BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Where is the matching @z?');ERROR;
+END;END ELSE IF BUFFER[1]=122 THEN BEGIN PRIMETHECHAN;
+CHANGING:=NOT CHANGING;TEMPLINE:=OTHERLINE;OTHERLINE:=LINE;
+LINE:=TEMPLINE;END;END;END{:137};
+IF NOT CHANGING THEN BEGIN{136:}BEGIN LINE:=LINE+1;
+IF NOT INPUTLN(WEBFILE)THEN INPUTHASENDE:=TRUE ELSE IF LIMIT=CHANGELIMIT
+THEN IF BUFFER[0]=CHANGEBUFFER[0]THEN IF CHANGELIMIT>0 THEN CHECKCHANGE;
+END{:136};IF CHANGING THEN GOTO 20;END;LOC:=0;BUFFER[LIMIT]:=32;END;
+{:135}{139:}FUNCTION CONTROLCODE(C:ASCIICODE):EIGHTBITS;
+BEGIN CASE C OF 64:CONTROLCODE:=64;39:CONTROLCODE:=12;
+34:CONTROLCODE:=13;36:CONTROLCODE:=125;32,9:CONTROLCODE:=136;
+42:BEGIN WRITE(OUTPUT,'*',MODULECOUNT+1:1);;CONTROLCODE:=136;END;
+68,100:CONTROLCODE:=133;70,102:CONTROLCODE:=132;123:CONTROLCODE:=9;
+125:CONTROLCODE:=10;80,112:CONTROLCODE:=134;
+84,116,94,46,58:CONTROLCODE:=131;38:CONTROLCODE:=127;
+60:CONTROLCODE:=135;61:CONTROLCODE:=2;92:CONTROLCODE:=3;
+ELSE CONTROLCODE:=0 END;END;{:139}{140:}FUNCTION SKIPAHEAD:EIGHTBITS;
+LABEL 30;VAR C:EIGHTBITS;
+BEGIN WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GETLINE;
+IF INPUTHASENDE THEN BEGIN C:=136;GOTO 30;END;END;BUFFER[LIMIT+1]:=64;
+WHILE BUFFER[LOC]<>64 DO LOC:=LOC+1;IF LOC<=LIMIT THEN BEGIN LOC:=LOC+2;
+C:=CONTROLCODE(BUFFER[LOC-1]);IF(C<>0)OR(BUFFER[LOC-1]=62)THEN GOTO 30;
+END;END;30:SKIPAHEAD:=C;END;{:140}{141:}PROCEDURE SKIPCOMMENT;LABEL 10;
+VAR BAL:EIGHTBITS;C:ASCIICODE;BEGIN BAL:=0;
+WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GETLINE;
+IF INPUTHASENDE THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Input ended in mid-comment');ERROR;END;GOTO 10;END;END;
+C:=BUFFER[LOC];LOC:=LOC+1;{142:}IF C=64 THEN BEGIN C:=BUFFER[LOC];
+IF(C<>32)AND(C<>9)AND(C<>42)AND(C<>122)AND(C<>90)THEN LOC:=LOC+1 ELSE
+BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Section ended in mid-comment');ERROR;END;LOC:=LOC-1;
+GOTO 10;
+END END ELSE IF(C=92)AND(BUFFER[LOC]<>64)THEN LOC:=LOC+1 ELSE IF C=123
+THEN BAL:=BAL+1 ELSE IF C=125 THEN BEGIN IF BAL=0 THEN GOTO 10;
+BAL:=BAL-1;END{:142};END;10:END;{:141}{145:}FUNCTION GETNEXT:EIGHTBITS;
+LABEL 20,30,31;VAR C:EIGHTBITS;D:EIGHTBITS;J,K:0..LONGESTNAME;
+BEGIN 20:IF LOC>LIMIT THEN BEGIN GETLINE;
+IF INPUTHASENDE THEN BEGIN C:=136;GOTO 31;END;END;C:=BUFFER[LOC];
+LOC:=LOC+1;
+IF SCANNINGHEX THEN{146:}IF((C>=48)AND(C<=57))OR((C>=65)AND(C<=70))THEN
+GOTO 31 ELSE SCANNINGHEX:=FALSE{:146};
+CASE C OF 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85
+,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
+,112,113,114,115,116,117,118,119,120,121,122:{148:}BEGIN IF((C=101)OR(C=
+69))AND(LOC>1)THEN IF(BUFFER[LOC-2]<=57)AND(BUFFER[LOC-2]>=48)THEN C:=0;
+IF C<>0 THEN BEGIN LOC:=LOC-1;IDFIRST:=LOC;REPEAT LOC:=LOC+1;
+D:=BUFFER[LOC];
+UNTIL((D<48)OR((D>57)AND(D<65))OR((D>90)AND(D<97))OR(D>122))AND(D<>95);
+IF LOC>IDFIRST+1 THEN BEGIN C:=130;IDLOC:=LOC;END;END ELSE C:=69;
+END{:148};34:{149:}BEGIN DOUBLECHARS:=0;IDFIRST:=LOC-1;
+REPEAT D:=BUFFER[LOC];LOC:=LOC+1;
+IF(D=34)OR(D=64)THEN IF BUFFER[LOC]=D THEN BEGIN LOC:=LOC+1;D:=0;
+DOUBLECHARS:=DOUBLECHARS+1;
+END ELSE BEGIN IF D=64 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Double @ sign missing');ERROR;
+END END ELSE IF LOC>LIMIT THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! String constant didn''t end');ERROR;END;D:=34;END;
+UNTIL D=34;IDLOC:=LOC-1;C:=130;END{:149};
+64:{150:}BEGIN C:=CONTROLCODE(BUFFER[LOC]);LOC:=LOC+1;
+IF C=0 THEN GOTO 20 ELSE IF C=13 THEN SCANNINGHEX:=TRUE ELSE IF C=135
+THEN{151:}BEGIN{153:}K:=0;
+WHILE TRUE DO BEGIN IF LOC>LIMIT THEN BEGIN GETLINE;
+IF INPUTHASENDE THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Input ended in section name');ERROR;END;GOTO 30;END;END;
+D:=BUFFER[LOC];{154:}IF D=64 THEN BEGIN D:=BUFFER[LOC+1];
+IF D=62 THEN BEGIN LOC:=LOC+2;GOTO 30;END;
+IF(D=32)OR(D=9)OR(D=42)THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Section name didn''t end');ERROR;END;GOTO 30;END;K:=K+1;
+MODTEXT[K]:=64;LOC:=LOC+1;END{:154};LOC:=LOC+1;
+IF K<LONGESTNAME-1 THEN K:=K+1;IF(D=32)OR(D=9)THEN BEGIN D:=32;
+IF MODTEXT[K-1]=32 THEN K:=K-1;END;MODTEXT[K]:=D;END;
+30:{155:}IF K>=LONGESTNAME-2 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Section name too long: ');END;
+FOR J:=1 TO 25 DO WRITE(OUTPUT,XCHR[MODTEXT[J]]);WRITE(OUTPUT,'...');
+IF HISTORY=0 THEN HISTORY:=1;END{:155};
+IF(MODTEXT[K]=32)AND(K>0)THEN K:=K-1;{:153};
+IF K>3 THEN BEGIN IF(MODTEXT[K]=46)AND(MODTEXT[K-1]=46)AND(MODTEXT[K-2]=
+46)THEN CURMODULE:=PREFIXLOOKUP(K-3)ELSE CURMODULE:=MODLOOKUP(K);
+END ELSE CURMODULE:=MODLOOKUP(K);
+END{:151}ELSE IF C=131 THEN BEGIN REPEAT C:=SKIPAHEAD;UNTIL C<>64;
+IF BUFFER[LOC-1]<>62 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Improper @ within control text');ERROR;END;GOTO 20;END;
+END{:150};
+{147:}46:IF BUFFER[LOC]=46 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=32;
+LOC:=LOC+1;END;
+END ELSE IF BUFFER[LOC]=41 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=93;
+LOC:=LOC+1;END;END;
+58:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=24;
+LOC:=LOC+1;END;END;
+61:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=30;
+LOC:=LOC+1;END;END;
+62:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=29;
+LOC:=LOC+1;END;END;
+60:IF BUFFER[LOC]=61 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=28;
+LOC:=LOC+1;END;
+END ELSE IF BUFFER[LOC]=62 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=26;
+LOC:=LOC+1;END;END;
+40:IF BUFFER[LOC]=42 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=9;
+LOC:=LOC+1;END;
+END ELSE IF BUFFER[LOC]=46 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=91;
+LOC:=LOC+1;END;END;
+42:IF BUFFER[LOC]=41 THEN BEGIN IF LOC<=LIMIT THEN BEGIN C:=10;
+LOC:=LOC+1;END;END;{:147}32,9:GOTO 20;123:BEGIN SKIPCOMMENT;GOTO 20;END;
+125:BEGIN BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Extra }');ERROR;END;
+GOTO 20;END;ELSE IF C>=128 THEN GOTO 20 ELSE END;
+31:{IF TROUBLESHOOT THEN DEBUGHELP;}GETNEXT:=C;END;
+{:145}{157:}PROCEDURE SCANNUMERIC(P:NAMEPOINTER);LABEL 21,30;
+VAR ACCUMULATOR:INTEGER;NEXTSIGN:-1..+1;Q:NAMEPOINTER;VAL:INTEGER;
+BEGIN{158:}ACCUMULATOR:=0;NEXTSIGN:=+1;
+WHILE TRUE DO BEGIN NEXTCONTROL:=GETNEXT;
+21:CASE NEXTCONTROL OF 48,49,50,51,52,53,54,55,56,57:BEGIN{160:}VAL:=0;
+REPEAT VAL:=10*VAL+NEXTCONTROL-48;NEXTCONTROL:=GETNEXT;
+UNTIL(NEXTCONTROL>57)OR(NEXTCONTROL<48){:160};
+BEGIN ACCUMULATOR:=ACCUMULATOR+NEXTSIGN*(VAL);NEXTSIGN:=+1;END;GOTO 21;
+END;12:BEGIN{161:}VAL:=0;NEXTCONTROL:=48;
+REPEAT VAL:=8*VAL+NEXTCONTROL-48;NEXTCONTROL:=GETNEXT;
+UNTIL(NEXTCONTROL>55)OR(NEXTCONTROL<48){:161};
+BEGIN ACCUMULATOR:=ACCUMULATOR+NEXTSIGN*(VAL);NEXTSIGN:=+1;END;GOTO 21;
+END;13:BEGIN{162:}VAL:=0;NEXTCONTROL:=48;
+REPEAT IF NEXTCONTROL>=65 THEN NEXTCONTROL:=NEXTCONTROL-7;
+VAL:=16*VAL+NEXTCONTROL-48;NEXTCONTROL:=GETNEXT;
+UNTIL(NEXTCONTROL>70)OR(NEXTCONTROL<48)OR((NEXTCONTROL>57)AND(
+NEXTCONTROL<65)){:162};BEGIN ACCUMULATOR:=ACCUMULATOR+NEXTSIGN*(VAL);
+NEXTSIGN:=+1;END;GOTO 21;END;130:BEGIN Q:=IDLOOKUP(0);
+IF ILK[Q]<>1 THEN BEGIN NEXTCONTROL:=42;GOTO 21;END;
+BEGIN ACCUMULATOR:=ACCUMULATOR+NEXTSIGN*(EQUIV[Q]-32768);NEXTSIGN:=+1;
+END;END;43:;45:NEXTSIGN:=-NEXTSIGN;132,133,135,134,136:GOTO 30;
+59:BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Omit semicolon in numeric definition');ERROR;END;
+ELSE{159:}BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Improper numeric definition will be flushed');ERROR;END;
+REPEAT NEXTCONTROL:=SKIPAHEAD UNTIL(NEXTCONTROL>=132);
+IF NEXTCONTROL=135 THEN BEGIN LOC:=LOC-2;NEXTCONTROL:=GETNEXT;END;
+ACCUMULATOR:=0;GOTO 30;END{:159}END;END;30:{:158};
+IF ABS(ACCUMULATOR)>=32768 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Value too big: ',ACCUMULATOR:1);ERROR;END;
+ACCUMULATOR:=0;END;EQUIV[P]:=ACCUMULATOR+32768;END;
+{:157}{165:}PROCEDURE SCANREPL(T:EIGHTBITS);LABEL 22,30,31,21;
+VAR A:SIXTEENBITS;B:ASCIICODE;BAL:EIGHTBITS;BEGIN BAL:=0;
+WHILE TRUE DO BEGIN 22:A:=GETNEXT;CASE A OF 40:BAL:=BAL+1;
+41:IF BAL=0 THEN BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'! Extra )');ERROR;
+END ELSE BAL:=BAL-1;39:{168:}BEGIN B:=39;
+WHILE TRUE DO BEGIN BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT
+);WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;
+HISTORY:=3;JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=B;TOKPTR[Z]:=TOKPTR[Z]+1;
+END;
+IF B=64 THEN IF BUFFER[LOC]=64 THEN LOC:=LOC+1 ELSE BEGIN WRITELN(OUTPUT
+);WRITE(OUTPUT,'! You should double @ signs in strings');ERROR;END;
+IF LOC=LIMIT THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! String didn''t end');ERROR;END;BUFFER[LOC]:=39;
+BUFFER[LOC+1]:=0;END;B:=BUFFER[LOC];LOC:=LOC+1;
+IF B=39 THEN BEGIN IF BUFFER[LOC]<>39 THEN GOTO 31 ELSE BEGIN LOC:=LOC+1
+;BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=39;TOKPTR[Z]:=TOKPTR[Z]+1;END;END;END;
+END;31:END{:168};35:IF T=3 THEN A:=0;{167:}130:BEGIN A:=IDLOOKUP(0);
+BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=(A DIV 256)+128;TOKPTR[Z]:=TOKPTR[Z]+1;
+END;A:=A MOD 256;END;
+135:IF T<>135 THEN GOTO 30 ELSE BEGIN BEGIN IF TOKPTR[Z]=MAXTOKS THEN
+BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=(CURMODULE DIV 256)+168;
+TOKPTR[Z]:=TOKPTR[Z]+1;END;A:=CURMODULE MOD 256;END;
+2:{169:}BEGIN BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=2;TOKPTR[Z]:=TOKPTR[Z]+1;END;
+BUFFER[LIMIT+1]:=64;
+21:IF BUFFER[LOC]=64 THEN BEGIN IF LOC<LIMIT THEN IF BUFFER[LOC+1]=64
+THEN BEGIN BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=64;TOKPTR[Z]:=TOKPTR[Z]+1;END;
+LOC:=LOC+2;GOTO 21;END;
+END ELSE BEGIN BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=BUFFER[LOC];TOKPTR[Z]:=TOKPTR[Z]+1;END;
+LOC:=LOC+1;GOTO 21;END;IF LOC>=LIMIT THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Verbatim string didn''t end');ERROR;
+END ELSE IF BUFFER[LOC+1]<>62 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! You should double @ signs in verbatim strings');ERROR;
+END;LOC:=LOC+2;END{:169};
+133,132,134:IF T<>135 THEN GOTO 30 ELSE BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! @',XCHR[BUFFER[LOC-1]],' is ignored in Pascal text');
+ERROR;END;GOTO 22;END;136:GOTO 30;{:167}ELSE END;
+BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=A;TOKPTR[Z]:=TOKPTR[Z]+1;END;END;
+30:NEXTCONTROL:=A;
+{166:}IF BAL>0 THEN BEGIN IF BAL=1 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Missing )');ERROR;END ELSE BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Missing ',BAL:1,' )''s');ERROR;END;
+WHILE BAL>0 DO BEGIN BEGIN IF TOKPTR[Z]=MAXTOKS THEN BEGIN WRITELN(
+OUTPUT);WRITE(OUTPUT,'! Sorry, ','token',' capacity exceeded');ERROR;
+HISTORY:=3;JUMPOUT;END;TOKMEM[Z,TOKPTR[Z]]:=41;TOKPTR[Z]:=TOKPTR[Z]+1;
+END;BAL:=BAL-1;END;END{:166};
+IF TEXTPTR>MAXTEXTS-4 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Sorry, ','text',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;CURREPLTEXT:=TEXTPTR;TOKSTART[TEXTPTR+4]:=TOKPTR[Z];
+TEXTPTR:=TEXTPTR+1;IF Z=3 THEN Z:=0 ELSE Z:=Z+1;END;
+{:165}{170:}PROCEDURE DEFINEMACRO(T:EIGHTBITS);VAR P:NAMEPOINTER;
+BEGIN P:=IDLOOKUP(T);SCANREPL(T);EQUIV[P]:=CURREPLTEXT;
+TEXTLINK[CURREPLTEXT]:=0;END;{:170}{172:}PROCEDURE SCANMODULE;
+LABEL 22,30,10;VAR P:NAMEPOINTER;BEGIN MODULECOUNT:=MODULECOUNT+1;
+{173:}NEXTCONTROL:=0;
+WHILE TRUE DO BEGIN 22:WHILE NEXTCONTROL<=132 DO BEGIN NEXTCONTROL:=
+SKIPAHEAD;IF NEXTCONTROL=135 THEN BEGIN LOC:=LOC-2;NEXTCONTROL:=GETNEXT;
+END;END;IF NEXTCONTROL<>133 THEN GOTO 30;NEXTCONTROL:=GETNEXT;
+IF NEXTCONTROL<>130 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Definition flushed, must start with ',
+'identifier of length > 1');ERROR;END;GOTO 22;END;NEXTCONTROL:=GETNEXT;
+IF NEXTCONTROL=61 THEN BEGIN SCANNUMERIC(IDLOOKUP(1));GOTO 22;
+END ELSE IF NEXTCONTROL=30 THEN BEGIN DEFINEMACRO(2);GOTO 22;
+END ELSE{174:}IF NEXTCONTROL=40 THEN BEGIN NEXTCONTROL:=GETNEXT;
+IF NEXTCONTROL=35 THEN BEGIN NEXTCONTROL:=GETNEXT;
+IF NEXTCONTROL=41 THEN BEGIN NEXTCONTROL:=GETNEXT;
+IF NEXTCONTROL=61 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Use == for macros');ERROR;END;NEXTCONTROL:=30;END;
+IF NEXTCONTROL=30 THEN BEGIN DEFINEMACRO(3);GOTO 22;END;END;END;END;
+{:174};BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Definition flushed since it starts badly');ERROR;END;
+END;30:{:173};{175:}CASE NEXTCONTROL OF 134:P:=0;135:BEGIN P:=CURMODULE;
+{176:}REPEAT NEXTCONTROL:=GETNEXT;UNTIL NEXTCONTROL<>43;
+IF(NEXTCONTROL<>61)AND(NEXTCONTROL<>30)THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Pascal text flushed, = sign is missing');ERROR;END;
+REPEAT NEXTCONTROL:=SKIPAHEAD;UNTIL NEXTCONTROL=136;GOTO 10;END{:176};
+END;ELSE GOTO 10 END;{177:}STORETWOBYTE(53248+MODULECOUNT);{:177};
+SCANREPL(135);
+{178:}IF P=0 THEN BEGIN TEXTLINK[LASTUNNAMED]:=CURREPLTEXT;
+LASTUNNAMED:=CURREPLTEXT;
+END ELSE IF EQUIV[P]=0 THEN EQUIV[P]:=CURREPLTEXT ELSE BEGIN P:=EQUIV[P]
+;WHILE TEXTLINK[P]<MAXTEXTS DO P:=TEXTLINK[P];TEXTLINK[P]:=CURREPLTEXT;
+END;TEXTLINK[CURREPLTEXT]:=MAXTEXTS;{:178};{:175};10:END;
+{:172}{181:}{PROCEDURE DEBUGHELP;LABEL 888,10;VAR K:INTEGER;
+BEGIN DEBUGSKIPPED:=DEBUGSKIPPED+1;
+IF DEBUGSKIPPED<DEBUGCYCLE THEN GOTO 10;DEBUGSKIPPED:=0;
+WHILE TRUE DO BEGIN BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'#');END;;
+READ(INPUT,DDT);IF DDT<0 THEN GOTO 10 ELSE IF DDT=0 THEN BEGIN GOTO 888;
+888:DDT:=0;
+END ELSE BEGIN READ(INPUT,DD);CASE DDT OF 1:PRINTID(DD);2:PRINTREPL(DD);
+3:FOR K:=1 TO DD DO WRITE(OUTPUT,XCHR[BUFFER[K]]);
+4:FOR K:=1 TO DD DO WRITE(OUTPUT,XCHR[MODTEXT[K]]);
+5:FOR K:=1 TO OUTPTR DO WRITE(OUTPUT,XCHR[OUTBUF[K]]);
+6:FOR K:=1 TO DD DO WRITE(OUTPUT,XCHR[OUTCONTRIB[K]]);
+ELSE WRITE(OUTPUT,'?')END;END;END;10:END;}{:181}{182:}BEGIN INITIALIZE;
+{134:}OPENINPUT;LINE:=0;OTHERLINE:=0;CHANGING:=TRUE;PRIMETHECHAN;
+CHANGING:=NOT CHANGING;TEMPLINE:=OTHERLINE;OTHERLINE:=LINE;
+LINE:=TEMPLINE;LIMIT:=0;LOC:=1;BUFFER[0]:=32;INPUTHASENDE:=FALSE;{:134};
+WRITELN(OUTPUT,'This is TANGLE-FPC');{183:}PHASEONE:=TRUE;
+MODULECOUNT:=0;REPEAT NEXTCONTROL:=SKIPAHEAD;UNTIL NEXTCONTROL=136;
+WHILE NOT INPUTHASENDE DO SCANMODULE;
+{138:}IF CHANGELIMIT<>0 THEN BEGIN FOR II:=0 TO CHANGELIMIT DO BUFFER[II
+]:=CHANGEBUFFER[II];LIMIT:=CHANGELIMIT;CHANGING:=TRUE;LINE:=OTHERLINE;
+LOC:=CHANGELIMIT;BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Change file entry did not match');ERROR;END;END{:138};
+PHASEONE:=FALSE;{:183};FOR II:=0 TO 3 DO MAXTOKPTR[II]:=TOKPTR[II];
+{112:}IF TEXTLINK[0]=0 THEN BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! No output was specified.');END;
+IF HISTORY=0 THEN HISTORY:=1;END ELSE BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'Writing the output file');END;;{83:}STACKPTR:=1;
+BRACELEVEL:=0;CURSTATE.NAMEFIELD:=0;CURSTATE.REPLFIELD:=TEXTLINK[0];
+ZO:=CURSTATE.REPLFIELD MOD 4;
+CURSTATE.BYTEFIELD:=TOKSTART[CURSTATE.REPLFIELD];
+CURSTATE.ENDFIELD:=TOKSTART[CURSTATE.REPLFIELD+4];CURSTATE.MODFIELD:=0;
+{:83};{96:}OUTSTATE:=0;OUTPTR:=0;BREAKPTR:=0;SEMIPTR:=0;OUTBUF[0]:=0;
+LINE:=1;{:96};SENDTHEOUTPU;{98:}BREAKPTR:=OUTPTR;SEMIPTR:=0;FLUSHBUFFER;
+IF BRACELEVEL<>0 THEN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'! Program ended at brace level ',BRACELEVEL:1);ERROR;END;
+{:98};BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,'Done.');END;END{:112};
+9999:IF STRINGPTR>256 THEN{184:}BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,STRINGPTR-256:1,' strings written to string pool file.');
+END;WRITE(POOL,'*');
+FOR II:=1 TO 9 DO BEGIN OUTBUF[II]:=POOLCHECKSUM MOD 10;
+POOLCHECKSUM:=POOLCHECKSUM DIV 10;END;
+FOR II:=9 DOWNTO 1 DO WRITE(POOL,XCHR[48+OUTBUF[II]]);WRITELN(POOL);
+END{:184};{186:}BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'Memory usage statistics:');END;BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,NAMEPTR:1,' names, ',TEXTPTR:1,' replacement texts;');END;
+BEGIN WRITELN(OUTPUT);WRITE(OUTPUT,BYTEPTR[0]:1);END;
+FOR WO:=1 TO 1 DO WRITE(OUTPUT,'+',BYTEPTR[WO]:1);
+IF PHASEONE THEN FOR II:=0 TO 3 DO MAXTOKPTR[II]:=TOKPTR[II];
+WRITE(OUTPUT,' bytes, ',MAXTOKPTR[0]:1);
+FOR II:=1 TO 3 DO WRITE(OUTPUT,'+',MAXTOKPTR[II]:1);
+WRITE(OUTPUT,' tokens.');{:186};CLOSE(PASCALFILE);CLOSE(POOL);
+{187:}CASE HISTORY OF 0:BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'(No errors were found.)');END;1:BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'(Did you see the warning message above?)');END;
+2:BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'(Pardon me, but I think I spotted something wrong.)');END;
+3:BEGIN WRITELN(OUTPUT);
+WRITE(OUTPUT,'(That was a fatal error, my friend.)');END;END;
+WRITELN(OUTPUT);HALT(HISTORY){:187};END.{:182}
diff --git a/systems/unix/tex-fpc/web/weave.ch b/systems/unix/tex-fpc/web/weave.ch
new file mode 100644
index 0000000000..bcb0a7e7d5
--- /dev/null
+++ b/systems/unix/tex-fpc/web/weave.ch
@@ -0,0 +1,185 @@
+% This is a change file for WEAVE-FPC, Wolfgang Helbig, Nov. 2007
+% Apr. 2008 get file names from command line
+% Jul. 2008 pass the exit code
+% Jul. 2016 change from gpc to fpc
+[0] About WEAVE-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+\def\name{\tt WEAVE}
+
+\let\maybe=\iffalse % print changed modules only.
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{WEAVE}, version 4.4
+from December 2002, to Unix. \namefpc\ is based on GNU~Pascal,
+version 2.1.
+
+This program expects three file names on the command line: A
+web~file (\.{.web}), a change~file (\.{.ch}), and a \TeX~file
+(\.{.tex}). If you call \namefpc\ with the wrong number of command
+line arguments, it will tell you and exit.
+To support shell scripting, \namefpc\ sets the exit code to its
+`\\{history}'---zero means ok, one means a warning was issued, two
+an error occurred and three means \.{WEAVE} ended prematurely.
+
+\hint
+
+The input file \.{weave.tex} will exceed \TeX's memory. To fix,
+change the constant value \.{MEMMAX} to 32000 in \.{tex.p},
+recompile and run it on \.{weave.tex}. Put \.{\\tracingstats1}
+in \.{weave.tex}. The log file then shows the memory \TeX\ needed
+to compile its input.
+\medskip
+Comments and questions are welcome!
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is WEAVE, Version 4.4'
+@y
+@d banner=='This is WEAVE-FPC'
+@z
+
+[2] terminal output and input
+@x
+program WEAVE(@!web_file,@!change_file,@!tex_file);
+@y
+program WEAVE(@!input,@!output);
+@z
+
+[3] shift left to turn debugging on, shift right to turn it off
+ @x
+ @d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
+ @d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
+ @y
+ @d debug==
+ @d gubed==
+ @z
+
+[3] turn stats on
+@x
+@d stat==@{ {change this to `$\\{stat}\equiv\null$'
+ when gathering usage statistics}
+@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
+ when gathering usage statistics}
+@y
+@d stat==
+@d tats==
+@z
+
+[4] compiler directives
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@{@&$M@&O@&D@&E I@&S@&O@}
+@z
+
+[7] default case branch
+@x
+@d othercases == others: {default for cases not listed explicitly}
+@y
+@d othercases == @+else {default for cases not listed explicitly}
+@z
+
+[12] the type of text_files is text in ISO Pascal
+@x
+@!text_file=packed file of text_char;
+@y
+@!text_file=text;
+@z
+
+[20] terminal input/output
+@x
+@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
+@y
+@d term_in == input
+@d term_out == output
+@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
+@z
+
+[20] terminal output, implicitely defined in ISO Pasal
+@x
+@<Globals...@>=
+@!term_out:text_file; {the terminal as an output file}
+@y
+@z
+
+[21] terminal output, output is rewritten implicitely in ISO Pascal
+@x
+@<Set init...@>=
+rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
+@y
+@z
+
+[22] terminal output, don't need update in ISO Pascal
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@y
+@d update_terminal == do_nothing
+@z
+
+[24] get file names from command line arguments
+@x
+begin reset(web_file); reset(change_file);
+@y
+begin
+assign(web_file, param_str(1));
+assign(change_file, param_str(2));
+reset(web_file); reset(change_file);
+@z
+
+[26] get file names from command line
+@x
+rewrite(tex_file);
+@y
+if param_count <> 3 then begin
+ fatal_error('Usage: weave web-file change-file TeX-file');
+ end;
+assign(tex_file, param_str(3));
+rewrite(tex_file);
+@z
+
+[258] Don't define Pascal's standard text files
+@x
+@!term_in:text_file; {the user's terminal as an input file}
+@y
+@z
+
+[259] terminal input, implicitely done in ISO Pascal
+@x
+reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
+@y
+@z
+
+[261] define fpc_close
+@x
+@^split procedures@>
+@y
+@^split procedures@>
+
+@d fpc_close == c@&l@&o@&s@&e
+@z
+
+[261] close tex_file
+@x
+@t\4\4@>{here files should be closed if the operating system requires it}
+@y
+fpc_close(tex_file);
+@z
+
+[263] put eol after last terminal out line
+@x
+fatal_message: print_nl('(That was a fatal error, my friend.)');
+end {there are no other cases}
+@y
+fatal_message: print_nl('(That was a fatal error, my friend.)');
+end; {there are no other cases}
+new_line;
+halt(history) {pass the history as exit code to the operating system}
+@z
diff --git a/systems/unix/tex-fpc/xdvi/README b/systems/unix/tex-fpc/xdvi/README
new file mode 100644
index 0000000000..42961d2288
--- /dev/null
+++ b/systems/unix/tex-fpc/xdvi/README
@@ -0,0 +1,32 @@
+How to install xdvi for TeX-GPC:
+
+Get the source from
+ https://math.berkeley.edu/~vojta/xdvi/xdvi-22.85.tar.gz
+It unpacks into xdvi-22.85.
+
+Edit config reflecting your binary directory, your man directory
+(i. e. a directory you have write permissions and has a subdirectory
+man1) and the resolution of your printer and then switch to xdvi-22.84
+and run
+../config && make clean && make && make install
+
+Unfortunately this neither works for NetBSD nor for Mac OS X.
+For NetBSD use this:
+../config && make clean && make && ../load && make install
+
+For Mac OS X use this:
+Instead replace the configure script in xdvi-22.84 with macconfigure,
+and replace xdvi.h with macxdvi.h.
+
+The xdvi is configured soley by DVIPSconf/XDvi, move XDvi to DVIPSconf.
+
+You might want to change /etc/man.conf to include your private man pages.
+I boldly replaced the line
+_default /usr/{share,X11R6,pkg,local}/man/
+to
+_default /usr/{helbig,share,X11R6,pkg,local}/man/
+
+For whatever reason, I couldn't make configure work on Mac OS X. Please help!
+
+enjoy
+Wolfgang
diff --git a/systems/unix/tex-fpc/xdvi/config b/systems/unix/tex-fpc/xdvi/config
new file mode 100755
index 0000000000..dd8c2f9707
--- /dev/null
+++ b/systems/unix/tex-fpc/xdvi/config
@@ -0,0 +1,15 @@
+# configure script for xdvi for TeX-FPC and Mac OS X
+# change the prefix and the base resolution in BDPI.
+# The resolution must agree with the one in the METAFONT mode localfont!
+# Do not specify a mfmode here! It will break automatic font generation.
+CPPFLAGS='-DBDPI=600 -DMAKEPK=4' ./configure \
+--mandir=/users/helbig/man \
+--bindir=/users/helbig/bin \
+--with-default-texmf-path=DVIPSconf \
+--enable-ps-gs \
+--enable-old-make-pk \
+--enable-extra-app-defaults=DVIPSconf \
+--with-default-font-path=PKfonts \
+--with-default-header-path=DVIPSconf \
+--with-default-fig-path=.:TeXinputs \
+--without-mfmode
diff --git a/systems/unix/tex-fpc/xdvi/macconfigure b/systems/unix/tex-fpc/xdvi/macconfigure
new file mode 100755
index 0000000000..71a46d4953
--- /dev/null
+++ b/systems/unix/tex-fpc/xdvi/macconfigure
@@ -0,0 +1,4640 @@
+#! /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
+ --with-x-toolkit=PKG use X toolkit PKG (xaw, xaw3d, motif, or no) [xaw]"
+ac_help="$ac_help
+ --with-tetex compile for use with teTeX"
+ac_help="$ac_help
+ --disable-grey disable greyscale anti-aliasing for shrunken bitmaps"
+ac_help="$ac_help
+ --disable-color disable support for color specials"
+ac_help="$ac_help
+ --disable-buttons disable buttons on the side of the window"
+ac_help="$ac_help
+ --disable-make-pk disable automatic generation of pk files via mktexpk
+ --enable-make-pk=PATH specify path for mktexpk"
+ac_help="$ac_help
+ --enable-old-make-pk[=PATH]
+ use old-style MakeTeXPK script instead of mktexpk"
+ac_help="$ac_help
+ --enable-gf enable gf format pixel files (in addition to pk)"
+ac_help="$ac_help
+ --enable-ps-gs[=PATH] enable PostScript support via ghostscript
+ (PATH, if given, points to the gs interpreter)"
+ac_help="$ac_help
+ --enable-ps-dps enable PostScript support via Display PostScript"
+ac_help="$ac_help
+ --enable-ps-news enable PostScript support via NeWS (Sun OpenWin)"
+ac_help="$ac_help
+ --enable-config-file=PATHLIST
+ look for configuration file in PATHLIST"
+ac_help="$ac_help
+ --enable-self-auto[=PATHLIST]
+ same as above; also determine xdvi binary path"
+ac_help="$ac_help
+ --enable-extra-app-defaults[=PATHLIST]
+ same as above; also enable extra app-defaults file"
+ac_help="$ac_help
+ --enable-dosnames use DOS-style names for fonts (e.g., dpi300/cmr10.pk)"
+ac_help="$ac_help
+ --enable-a4 set default paper size to A4 and default unit to cm"
+ac_help="$ac_help
+ --enable-texxet enable typesetting for right-to-left languages"
+ac_help="$ac_help
+ --with-mfmode=MODE:DPI set default Metafont mode to MODE at DPI dots/inch
+ --without-mfmode set default Metafont mode to none"
+ac_help="$ac_help
+ --with-default-texmf-path=PATH
+ set default texmf list to PATH"
+ac_help="$ac_help
+ --with-default-font-path=PATH
+ set default font path to PATH"
+ac_help="$ac_help
+ --with-default-vf-path=PATH
+ set default virtual font path to PATH"
+ac_help="$ac_help
+ --with-default-header-path=PATH
+ set default path path for PS figures to PATH"
+ac_help="$ac_help
+ --with-default-fig-path=PATH
+ set default figure path to PATH"
+ac_help="$ac_help
+ --with-default-source-path=PATH
+ set default path for source specials to PATH"
+ac_help="$ac_help
+ --with-default-dvips-path=CMD
+ set default print command to CMD"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+aux_top=NONE
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+imake=
+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
+x_top=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.
+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
+
+ -aux-top | --aux-top | --aux-to | --aux-t | --aux- | --aux | --au | --a)
+ ac_prev=aux_top ;;
+ -aux-top=* | --aux-top=* | --aux-to=* | --aux-t=* | --aux-=* | --aux=* \
+ | --au=* | --a=*)
+ aux_top="$ac_optarg" ;;
+
+ -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
+ --imake set flag for running from within imake
+ --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:
+ --x-top=XTOP installation directory for X
+ --aux-top=AUXTOP secondary X top directory (e.g., for toolkit)
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [XTOP or $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 [XTOP/include or guessed]
+ --x-libraries=DIR X library files are in DIR [XTOP/lib or guessed]
+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" ;;
+
+ --imake | --imak | --ima | --im | -imake | -imak | -ima | -im)
+ imake=yes ;;
+
+ -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-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" ;;
+
+ -x-top | --x-top | --x-to | --x-t)
+ ac_prev=x_top ;;
+ -x-top=* | --x-top=* | --x-to=* | --x-t=*)
+ x_top="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ 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
+
+# Set prefix to x-top if appropriate.
+test "x$prefix" = xNONE && prefix="$x_top"
+
+# 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=xdvi.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:613: 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_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $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:643: 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
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $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:694: 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_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $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:726: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+ac_exeext=
+# 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 737 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:742: \"$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:768: 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:773: 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:782: \"$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:801: 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
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ 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:863: 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=":"
+ 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 -f $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_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:916: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 921 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:949: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 954 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+# helbig: gcc -g will create a directory conftest.dSYM, and configure thinks
+# that dSYM is the suffix. Furthermore, rm -rf is needed to remove the directory.
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:980: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.dSYM) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -rf conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+
+cat <<EOF >>confdefs.h
+#undef _XOPEN_SOURCE /* needed because of imake */
+#define _XOPEN_SOURCE 1
+#define _XOPEN_SOURCE_EXTENDED 1
+#define __EXTENSIONS__ 1
+#ifdef _AIX
+#define _ALL_SOURCE 1
+#endif
+EOF
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1024: 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 1039 "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:1045: \"$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 1056 "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:1062: \"$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 1073 "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:1079: \"$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
+
+# If we find X, set shell vars x_includes and x_libraries to the
+# paths, otherwise set no_x=yes.
+# Uses ac_ vars as temps to allow command line to override cache and checks.
+# --without-x overrides everything else, but does not touch the cache.
+echo $ac_n "checking for X""... $ac_c" 1>&6
+echo "configure:1108: checking for X" >&5
+
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+ # The user explicitly disabled X.
+ have_x=disabled
+else
+ if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+ # Both variables are already set.
+ have_x=yes
+ else
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # One or both of the vars are not set, and there is no cached value.
+if test "x$x_top" != xNONE; then
+ ac_x_includes="$x_top/include" ac_x_libraries="$x_top/lib"
+ if test ! -f "$ac_x_includes/X11/Xos.h" || test ! -d "$ac_x_libraries"; then
+ { echo "configure: error: $x_top does not point to a valid X install tree" 1>&2; exit 1; }
+ fi
+else
+ ac_x_includes=NO ac_x_libraries=NO
+ rm -fr conftestdir
+if mkdir conftestdir; then
+ cd conftestdir
+ # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+ cat > Imakefile <<'EOF'
+acfindx:
+ @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+EOF
+# helbig: The suffix for libraries in Mac OS X is dylib.
+ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+ eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+ for ac_extension in dylib; do
+ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+ test -f $ac_im_libdir/libX11.$ac_extension; then
+ ac_im_usrlibdir=$ac_im_libdir; break
+ fi
+ done
+ # Screen out bogus values from the imake configuration. They are
+ # bogus both because they are the default anyway, and because
+ # using them would break gcc on systems where it needs fixed includes.
+ case "$ac_im_incroot" in
+ /usr/include) ;;
+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+ esac
+ case "$ac_im_usrlibdir" in
+ /usr/lib | /lib) ;;
+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+ esac
+ fi
+ cd ..
+ rm -fr conftestdir
+fi
+
+fi
+if test "$ac_x_includes" = NO; then
+ # Guess where to find include files, by looking for this one X11 .h file.
+ test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+
+ # First, try using that file with no special directory specified.
+cat > conftest.$ac_ext <<EOF
+#line 1171 "configure"
+#include "confdefs.h"
+#include <$x_direct_test_include>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1176: \"$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*
+ # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ # Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ for ac_dir in \
+ /usr/X11/include \
+ /usr/X11R6/include \
+ /usr/X11R5/include \
+ /usr/X11R4/include \
+ \
+ /usr/include/X11 \
+ /usr/include/X11R6 \
+ /usr/include/X11R5 \
+ /usr/include/X11R4 \
+ \
+ /usr/local/X11/include \
+ /usr/local/X11R6/include \
+ /usr/local/X11R5/include \
+ /usr/local/X11R4/include \
+ \
+ /usr/local/include/X11 \
+ /usr/local/include/X11R6 \
+ /usr/local/include/X11R5 \
+ /usr/local/include/X11R4 \
+ \
+ /usr/X386/include \
+ /usr/x386/include \
+ /usr/XFree86/include/X11 \
+ \
+ /usr/include \
+ /usr/local/include \
+ /usr/unsupported/include \
+ /usr/athena/include \
+ /usr/local/x11r5/include \
+ /usr/lpp/Xamples/include \
+ \
+ /usr/openwin/include \
+ /usr/openwin/share/include \
+ ; \
+ do
+ if test -r "$ac_dir/$x_direct_test_include"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+ done
+fi
+rm -f conftest*
+fi # $ac_x_includes = NO
+
+if test "$ac_x_libraries" = NO; then
+ # Check for the libraries.
+
+ test -z "$x_direct_test_library" && x_direct_test_library=Xt
+ test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+
+ # See if we find them without any special options.
+ # Don't add to $LIBS permanently.
+ ac_save_LIBS="$LIBS"
+ LIBS="-l$x_direct_test_library $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1245 "configure"
+#include "confdefs.h"
+
+int main() {
+${x_direct_test_function}()
+; return 0; }
+EOF
+if { (eval echo configure:1252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ LIBS="$ac_save_LIBS"
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ LIBS="$ac_save_LIBS"
+# First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
+ /usr/X11/lib \
+ /usr/X11R6/lib \
+ /usr/X11R5/lib \
+ /usr/X11R4/lib \
+ \
+ /usr/lib/X11 \
+ /usr/lib/X11R6 \
+ /usr/lib/X11R5 \
+ /usr/lib/X11R4 \
+ \
+ /usr/local/X11/lib \
+ /usr/local/X11R6/lib \
+ /usr/local/X11R5/lib \
+ /usr/local/X11R4/lib \
+ \
+ /usr/local/lib/X11 \
+ /usr/local/lib/X11R6 \
+ /usr/local/lib/X11R5 \
+ /usr/local/lib/X11R4 \
+ \
+ /usr/X386/lib \
+ /usr/x386/lib \
+ /usr/XFree86/lib/X11 \
+ \
+ /usr/lib \
+ /usr/local/lib \
+ /usr/unsupported/lib \
+ /usr/athena/lib \
+ /usr/local/x11r5/lib \
+ /usr/lpp/Xamples/lib \
+ /lib/usr/lib/X11 \
+ \
+ /usr/openwin/lib \
+ /usr/openwin/share/lib \
+ ; \
+do
+ for ac_extension in dylib; do
+ if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+ ac_x_libraries=$ac_dir
+ break 2
+ fi
+ done
+done
+fi
+rm -f conftest*
+fi # $ac_x_libraries = NO
+
+if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+ # Didn't find X anywhere. Cache the known absence of X.
+ ac_cv_have_x="have_x=no"
+else
+ # Record where we found X for the cache.
+ ac_cv_have_x="have_x=yes \
+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+ fi
+ eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+ echo "$ac_t""$have_x" 1>&6
+ no_x=yes
+else
+ # If each of the values was on the command line, it overrides each guess.
+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+ # Update the cache value to reflect the command line values.
+ ac_cv_have_x="have_x=yes \
+ ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+ echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+fi
+
+if test "$no_x" = yes || test -n "$imake"; then
+ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+ if test "x$aux_top" != xNONE; then
+ X_CFLAGS="$X_CFLAGS -I$aux_top/include"
+ X_LIBS="$X_LIBS -L$aux_top/lib"
+ fi
+
+ if test -n "$x_includes"; then
+ X_CFLAGS="$X_CFLAGS -I$x_includes"
+ fi
+
+ # It would also be nice to do this for all -L options, not just this one.
+ if test -n "$x_libraries"; then
+ X_LIBS="$X_LIBS -L$x_libraries"
+ # For Solaris; some versions of Sun CC require a space after -R and
+ # others require no space. Words are not sufficient . . . .
+ case "`(uname -sr) 2>/dev/null`" in
+ "SunOS 5"*)
+ echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
+echo "configure:1358: checking whether -R must be followed by a space" >&5
+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
+ cat > conftest.$ac_ext <<EOF
+#line 1361 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_R_nospace=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_R_nospace=no
+fi
+rm -f conftest*
+ if test $ac_R_nospace = yes; then
+ echo "$ac_t""no" 1>&6
+ if test "x$aux_top" != xNONE; then
+ X_LIBS="$X_LIBS -R$aux_top/lib"
+ fi
+ X_LIBS="$X_LIBS -R$x_libraries"
+ else
+ LIBS="$ac_xsave_LIBS -R $x_libraries"
+ cat > conftest.$ac_ext <<EOF
+#line 1387 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_R_space=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_R_space=no
+fi
+rm -f conftest*
+ if test $ac_R_space = yes; then
+ echo "$ac_t""yes" 1>&6
+ if test "x$aux_top" != xNONE; then
+ X_LIBS="$X_LIBS -R $aux_top/lib"
+ fi
+ X_LIBS="$X_LIBS -R $x_libraries"
+ else
+ echo "$ac_t""neither works" 1>&6
+ fi
+ fi
+ LIBS="$ac_xsave_LIBS"
+ esac
+ fi
+
+ # Check for system-dependent libraries X programs must link with.
+ # Do this before checking for the system-independent R6 libraries
+ # (-lICE), since we may need -lsocket or whatever for X linking.
+
+ if test "$ISC" = yes; then
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+ else
+ # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
+ # libraries were built with DECnet support. And karl@cs.umb.edu says
+ # the Alpha needs dnet_stub (dnet does not exist).
+ echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
+echo "configure:1429: checking for dnet_ntoa in -ldnet" >&5
+ac_lib_var=`echo dnet'_'dnet_ntoa | 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="-ldnet $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1437 "configure"
+#include "confdefs.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 dnet_ntoa();
+
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:1448: \"$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
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+ echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
+echo "configure:1470: checking for dnet_ntoa in -ldnet_stub" >&5
+ac_lib_var=`echo dnet_stub'_'dnet_ntoa | 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="-ldnet_stub $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1478 "configure"
+#include "confdefs.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 dnet_ntoa();
+
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:1489: \"$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
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+ # to get the SysV transport functions.
+ # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
+ # needs -lnsl.
+ # The nsl library prevents programs from opening the X display
+ # on Irix 5.2, according to dickey@clark.net.
+ echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:1518: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1523 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostbyname(); 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 gethostbyname();
+
+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_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_gethostbyname = no; then
+ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:1567: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | 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="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1575 "configure"
+#include "confdefs.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 gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:1586: \"$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
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # lieder@skyler.mavd.honeywell.com says without -lsocket,
+ # socket/setsockopt and other routines are undefined under SCO ODT
+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
+ # on later versions), says simon@lia.di.epfl.ch: it contains
+ # gethostby* variants that don't use the nameserver (or something).
+ # -lsocket must be given before -lnsl if both are needed.
+ # We assume that if connect needs -lnsl, so does gethostbyname.
+ echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:1616: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1621 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char connect(); 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 connect();
+
+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_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_connect=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_connect=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_connect = no; then
+ echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:1665: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | 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="-lsocket $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1673 "configure"
+#include "confdefs.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 connect();
+
+int main() {
+connect()
+; return 0; }
+EOF
+if { (eval echo configure:1684: \"$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
+ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
+ echo $ac_n "checking for remove""... $ac_c" 1>&6
+echo "configure:1708: checking for remove" >&5
+if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1713 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char remove(); 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 remove();
+
+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_remove) || defined (__stub___remove)
+choke me
+#else
+remove();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_remove=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_remove=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_remove = no; then
+ echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
+echo "configure:1757: checking for remove in -lposix" >&5
+ac_lib_var=`echo posix'_'remove | 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="-lposix $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1765 "configure"
+#include "confdefs.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 remove();
+
+int main() {
+remove()
+; return 0; }
+EOF
+if { (eval echo configure:1776: \"$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
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+ echo $ac_n "checking for shmat""... $ac_c" 1>&6
+echo "configure:1800: checking for shmat" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1805 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shmat(); 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 shmat();
+
+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_shmat) || defined (__stub___shmat)
+choke me
+#else
+shmat();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shmat=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_shmat=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test $ac_cv_func_shmat = no; then
+ echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
+echo "configure:1849: checking for shmat in -lipc" >&5
+ac_lib_var=`echo ipc'_'shmat | 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="-lipc $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1857 "configure"
+#include "confdefs.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 shmat();
+
+int main() {
+shmat()
+; return 0; }
+EOF
+if { (eval echo configure:1868: \"$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
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ fi
+
+ # Check for libraries that X11R6 Xt/Xaw programs need.
+ ac_save_LDFLAGS="$LDFLAGS"
+ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+ # check for ICE first), but we must link in the order -lSM -lICE or
+ # we get undefined symbols. So assume we have SM if we have ICE.
+ # These have to be linked with before -lX11, unlike the other
+ # libraries we check for below, so use a different variable.
+ # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+ echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
+echo "configure:1901: checking for IceConnectionNumber in -lICE" >&5
+ac_lib_var=`echo ICE'_'IceConnectionNumber | 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="-lICE $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1909 "configure"
+#include "confdefs.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 IceConnectionNumber();
+
+int main() {
+IceConnectionNumber()
+; return 0; }
+EOF
+if { (eval echo configure:1920: \"$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
+ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ LDFLAGS="$ac_save_LDFLAGS"
+
+fi
+
+if test "x$have_x" != xyes; then
+ { echo "configure: error: this program cannot be compiled without X" 1>&2; exit 1; }
+fi
+
+ac_save_cpp=$ac_cpp
+ac_cpp="$ac_cpp $X_CFLAGS"
+for ac_hdr in X11/IntrinsicI.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1954: 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 1959 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1964: \"$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
+
+ac_cpp=$ac_save_cpp
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1994: 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 1999 "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:2007: \"$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 2024 "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 2042 "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 2063 "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:2074: \"$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
+
+ echo $ac_n "checking for X11/Xosdefs.h""... $ac_c" 1>&6
+echo "configure:2096: checking for X11/Xosdefs.h" >&5
+if eval "test \"`echo '$''{'ac_cv_x11_xosdefs_h'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_x11_xosdefs_h=no
+ if test -n "$x_includes"; then
+ if test -r "$x_includes/X11/Xosdefs.h"; then
+ ac_cv_x11_xosdefs_h=yes
+ fi
+ else
+ cat > conftest.$ac_ext <<EOF
+#line 2107 "configure"
+#include "confdefs.h"
+#include <X11/Xosdefs.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2112: \"$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_x11_xosdefs_h=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+ fi
+fi
+
+echo "$ac_t""$ac_cv_x11_xosdefs_h" 1>&6
+ if test $ac_cv_x11_xosdefs_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_X11_XOSDEFS_H 1
+EOF
+
+ fi
+fi
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2139: 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 2144 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2149: \"$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
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:2180: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2185 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:2193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$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
+ ac_header_dirent=$ac_hdr; break
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:2218: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | 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="-ldir $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2226 "configure"
+#include "confdefs.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 opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:2237: \"$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
+ LIBS="$LIBS -ldir"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:2259: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | 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="-lx $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2267 "configure"
+#include "confdefs.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 opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:2278: \"$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
+ LIBS="$LIBS -lx"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:2301: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2306 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:2322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:2345: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 2352 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:2363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 2367 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:2378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2398 "configure"
+#include "confdefs.h"
+main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_bigendian=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+ cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+ac_exeext=
+echo $ac_n "checking for integer type to use in bitmaps""... $ac_c" 1>&6
+echo "configure:2435: checking for integer type to use in bitmaps" >&5
+if eval "test \"`echo '$''{'xdvi_cv_bitmap_type'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2443 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ if ((sizeof(unsigned long) == 4 || sizeof(unsigned long) == 2)
+ && sizeof(unsigned long) != sizeof(unsigned int))
+ fprintf(f, "BMTYPE=long BMBYTES=%d\n", sizeof(unsigned long));
+ if (sizeof(unsigned int) == 4 || sizeof(unsigned int) == 2)
+ fprintf(f, "BMTYPE=int BMBYTES=%d\n", sizeof(unsigned int));
+ else if (sizeof(unsigned short) == 4 || sizeof(unsigned short) == 2)
+ fprintf(f, "BMTYPE=short BMBYTES=%d\n", sizeof(unsigned short));
+ else fprintf(f, "BMTYPE=char BMBYTES=%d\n", sizeof(unsigned char));
+ exit(0);
+}
+EOF
+if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ xdvi_cv_bitmap_type="`cat conftestval`"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ { echo "configure: error: could not determine integer type for bitmap" 1>&2; exit 1; }
+fi
+rm -fr conftest*
+fi
+
+fi
+
+eval "$xdvi_cv_bitmap_type"
+cat >> confdefs.h <<EOF
+#define BMTYPE $BMTYPE
+EOF
+
+cat >> confdefs.h <<EOF
+#define BMBYTES $BMBYTES
+EOF
+
+echo "$ac_t""unsigned $BMTYPE, size = $BMBYTES" 1>&6
+echo $ac_n "checking for whether the C compiler supports string concatenation""... $ac_c" 1>&6
+echo "configure:2486: checking for whether the C compiler supports string concatenation" >&5
+if eval "test \"`echo '$''{'xdvi_cc_concat'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2491 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+
+int main() {
+puts("Testing" " string" " concatenation");
+
+; return 0; }
+EOF
+if { (eval echo configure:2500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ xdvi_cc_concat=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_cc_concat=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$xdvi_cc_concat" 1>&6
+KRHEADER_H=
+if test $xdvi_cc_concat = no; then
+ cat >> confdefs.h <<\EOF
+#define CC_K_AND_R 1
+EOF
+
+ KRHEADER_H=krheader.h
+fi
+
+echo $ac_n "checking for stropts.h and isastream()""... $ac_c" 1>&6
+echo "configure:2523: checking for stropts.h and isastream()" >&5
+if eval "test \"`echo '$''{'xdvi_cv_sys_streams'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2528 "configure"
+#include "confdefs.h"
+#include <stropts.h>
+
+int main() {
+#ifndef I_SETSIG
+choke me
+#else
+isastream(0);
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:2540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_cv_sys_streams=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_cv_sys_streams=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$xdvi_cv_sys_streams" 1>&6
+if test $xdvi_cv_sys_streams = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STREAMS 1
+EOF
+
+fi
+echo $ac_n "checking for SunOS 4""... $ac_c" 1>&6
+echo "configure:2560: checking for SunOS 4" >&5
+if eval "test \"`echo '$''{'xdvi_cv_sys_sunos_4'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "`(uname -sr) 2>/dev/null`" in
+"SunOS 4."*)
+ xdvi_cv_sys_sunos_4=yes ;;
+*) xdvi_cv_sys_sunos_4=no ;;
+esac
+fi
+
+echo "$ac_t""$xdvi_cv_sys_sunos_4" 1>&6
+if test $xdvi_cv_sys_sunos_4 = yes; then
+ cat >> confdefs.h <<\EOF
+#define SUNOS4 1
+EOF
+
+fi
+echo $ac_n "checking for certain old versions of Linux""... $ac_c" 1>&6
+echo "configure:2579: checking for certain old versions of Linux" >&5
+if eval "test \"`echo '$''{'xdvi_cv_sys_old_linux'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "`(uname -sr) 2>/dev/null`" in
+"Linux 2."[01].* | "Linux 2.2."[0-8] | "Linux 2.2."[0-8]-*)
+ xdvi_cv_sys_old_linux=yes ;;
+*) xdvi_cv_sys_old_linux=no ;;
+esac
+fi
+
+echo "$ac_t""$xdvi_cv_sys_old_linux" 1>&6
+if test $xdvi_cv_sys_old_linux = yes; then
+ cat >> confdefs.h <<\EOF
+#define FLAKY_SIGPOLL 1
+EOF
+
+fi
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:2598: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2603 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_off_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+ cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:2631: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2636 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_pid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:2664: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2669 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
+echo "configure:2697: checking for ptrdiff_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2702 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])ptrdiff_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_ptrdiff_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_ptrdiff_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6
+if test $ac_cv_type_ptrdiff_t = no; then
+ cat >> confdefs.h <<\EOF
+#define ptrdiff_t long
+EOF
+
+fi
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:2730: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2735 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:2752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+echo $ac_n "checking for poll.h and poll()""... $ac_c" 1>&6
+echo "configure:2771: checking for poll.h and poll()" >&5
+if eval "test \"`echo '$''{'xdvi_cv_func_poll'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2776 "configure"
+#include "confdefs.h"
+#include <poll.h>
+
+int main() {
+poll((struct pollfd *) 0, 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_cv_func_poll=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_cv_func_poll=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$xdvi_cv_func_poll" 1>&6
+if test $xdvi_cv_func_poll = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_POLL 1
+EOF
+
+else
+ for ac_hdr in sys/select.h select.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2807: 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 2812 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2817: \"$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
+
+fi
+ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
+echo "configure:2846: checking for vfork.h" >&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 2851 "configure"
+#include "confdefs.h"
+#include <vfork.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2856: \"$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
+ cat >> confdefs.h <<\EOF
+#define HAVE_VFORK_H 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for working vfork""... $ac_c" 1>&6
+echo "configure:2881: checking for working vfork" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ echo $ac_n "checking for vfork""... $ac_c" 1>&6
+echo "configure:2887: checking for vfork" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2892 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vfork(); 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 vfork();
+
+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_vfork) || defined (__stub___vfork)
+choke me
+#else
+vfork();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vfork=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_vfork=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2937 "configure"
+#include "confdefs.h"
+/* Thanks to Paul Eggert for this test. */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent.
+ The compiler is told about this with #include <vfork.h>,
+ but some compilers (e.g. gcc -O) don't grok <vfork.h>.
+ Test for this by using a static variable whose address
+ is put into a register that is clobbered by the vfork. */
+static
+#ifdef __cplusplus
+sparc_address_test (int arg)
+#else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+main() {
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test ();
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems.
+ This test uses lots of local variables, at least
+ as many local variables as main has allocated so far
+ including compiler temporaries. 4 locals are enough for
+ gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
+ A buggy compiler should reuse the register of parent
+ for one of the local variables, since it will think that
+ parent can't possibly be used any more in this routine.
+ Assigning to the local variable will thus munge parent
+ in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3),
+ vfork doesn't separate parent from child file descriptors.
+ If the child closes a descriptor before it execs or exits,
+ this munges the parent's descriptor as well.
+ Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ exit(
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+EOF
+if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_vfork_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_vfork_works=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
+if test $ac_cv_func_vfork_works = no; then
+ cat >> confdefs.h <<\EOF
+#define vfork fork
+EOF
+
+fi
+
+if test $ac_cv_func_vfork_works = yes; then
+echo $ac_n "checking for whether setsid() is allowed within vfork()""... $ac_c" 1>&6
+echo "configure:3056: checking for whether setsid() is allowed within vfork()" >&5
+if eval "test \"`echo '$''{'xdvi_cv_setsid_in_vfork'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3064 "configure"
+#include "confdefs.h"
+/* Test adapted from Gnu autoconf */
+/* Thanks to Paul Eggert for this test. */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
+#endif
+int
+main() {
+ pid_t parent = getpid ();
+ pid_t child;
+
+ child = vfork ();
+
+ if (child == 0) {
+ if (setsid () == -1)
+ _exit(1);
+ _exit(0);
+ } else {
+ int status;
+
+ while (wait(&status) != child)
+ ;
+ exit(
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+ );
+ }
+}
+EOF
+if { (eval echo configure:3103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ xdvi_cv_setsid_in_vfork=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ xdvi_cv_setsid_in_vfork=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$xdvi_cv_setsid_in_vfork" 1>&6
+if test $xdvi_cv_setsid_in_vfork = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GOOD_SETSID_VFORK 1
+EOF
+
+fi
+fi
+echo $ac_n "checking for waitpid""... $ac_c" 1>&6
+echo "configure:3126: checking for waitpid" >&5
+if eval "test \"`echo '$''{'ac_cv_func_waitpid'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3131 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char waitpid(); 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 waitpid();
+
+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_waitpid) || defined (__stub___waitpid)
+choke me
+#else
+waitpid();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_waitpid=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_waitpid=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'waitpid`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_WAITPID 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+for ac_func in wait4
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3177: 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 3182 "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:3205: \"$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
+
+fi
+
+echo $ac_n "checking for putenv""... $ac_c" 1>&6
+echo "configure:3232: checking for putenv" >&5
+if eval "test \"`echo '$''{'ac_cv_func_putenv'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3237 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char putenv(); 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 putenv();
+
+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_putenv) || defined (__stub___putenv)
+choke me
+#else
+putenv();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_putenv=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_putenv=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'putenv`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_PUTENV 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+for ac_func in setenv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3283: 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 3288 "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:3311: \"$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
+
+fi
+
+for ac_func in mkstemp sigaction strerror vsnprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3340: 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 3345 "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:3368: \"$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
+
+echo $ac_n "checking for the function ulltostr() and the long long type""... $ac_c" 1>&6
+echo "configure:3393: checking for the function ulltostr() and the long long type" >&5
+if eval "test \"`echo '$''{'xdvi_cv_func_ulltostr'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3398 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+#endif
+int main() {
+ char s[3 * sizeof(unsigned long long)];
+ unsigned long long value = 12345;
+ puts(ulltostr(value, s))
+; return 0; }
+EOF
+if { (eval echo configure:3410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_cv_func_ulltostr=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_cv_func_ulltostr=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$xdvi_cv_func_ulltostr" 1>&6
+if test $xdvi_cv_func_ulltostr = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ULLTOSTR 1
+EOF
+
+fi
+
+if test $ac_cv_func_vsnprintf = yes; then
+ echo $ac_n "checking for a c99-compatible implementation of (v)snprintf()""... $ac_c" 1>&6
+echo "configure:3432: checking for a c99-compatible implementation of (v)snprintf()" >&5
+if eval "test \"`echo '$''{'xdvi_cv_func_good_vsnprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3440 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+int main()
+{
+ char s[2];
+ return (snprintf(s, 0, "test") != 4);
+}
+EOF
+if { (eval echo configure:3449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ xdvi_cv_func_good_vsnprintf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ xdvi_cv_func_good_vsnprintf=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$xdvi_cv_func_good_vsnprintf" 1>&6
+if test $xdvi_cv_func_good_vsnprintf = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GOOD_VSNPRINTF 1
+EOF
+
+fi
+fi
+
+MATH_LIB=
+echo $ac_n "checking for sin""... $ac_c" 1>&6
+echo "configure:3474: checking for sin" >&5
+if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3479 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char sin(); 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 sin();
+
+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_sin) || defined (__stub___sin)
+choke me
+#else
+sin();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_sin=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_sin=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
+echo "configure:3520: checking for sin in -lm" >&5
+ac_lib_var=`echo m'_'sin | 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 3528 "configure"
+#include "confdefs.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 sin();
+
+int main() {
+sin()
+; return 0; }
+EOF
+if { (eval echo configure:3539: \"$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
+ MATH_LIB="-lm"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+
+echo $ac_n "checking whether linker supports the --allow-multiple-definition flag""... $ac_c" 1>&6
+echo "configure:3564: checking whether linker supports the --allow-multiple-definition flag" >&5
+if eval "test \"`echo '$''{'xdvi_linker_multiple_defns'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ xdvi_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="-Xlinker --allow-multiple-definition"
+x_linker_options=""
+cat > conftest.$ac_ext <<EOF
+#line 3572 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+
+int main() {
+void foo(void);
+
+; return 0; }
+EOF
+if { (eval echo configure:3581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_linker_multiple_defns=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_linker_multiple_defns=no
+
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$xdvi_linker_multiple_defns" 1>&6
+if test $xdvi_linker_multiple_defns = yes; then
+x_linker_options="-Xlinker --allow-multiple-definition"
+fi
+LDFLAGS="$xdvi_save_LDFLAGS"
+
+
+
+
+OPT_SRCS= OPT_OBJS=
+
+# Check whether --with-x-toolkit or --without-x-toolkit was given.
+if test "${with_x_toolkit+set}" = set; then
+ withval="$with_x_toolkit"
+ case "$withval" in
+yes | xaw)
+ X_PRE_LIBS="$X_PRE_LIBS $MATH_LIB"
+ MATH_LIB=
+ if test -z "$imake"; then
+# Cygwin needs -lXpm to be linked in explicitly; yet on older (<4.2)
+# versions of XFree86, -lXpm exists, but is not needed. So we do two checks.
+echo $ac_n "checking for whether -lXpm needs to be explicitly given""... $ac_c" 1>&6
+echo "configure:3617: checking for whether -lXpm needs to be explicitly given" >&5
+if eval "test \"`echo '$''{'xdvi_needs_explicit_xpm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ xdvi_save_LIBS=$LIBS
+LIBS="-lXaw -lXmu -lXt$X_PRE_LIBS -lXext $LIBS $X_LIBS -lX11"
+cat > conftest.$ac_ext <<EOF
+#line 3624 "configure"
+#include "confdefs.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 XawTextReplace();
+
+int main() {
+XawTextReplace()
+; return 0; }
+EOF
+if { (eval echo configure:3635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ LIBS="$LIBS -lXpm"
+cat > conftest.$ac_ext <<EOF
+#line 3644 "configure"
+#include "confdefs.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 XawTextReplace();
+
+int main() {
+XawTextReplace()
+; return 0; }
+EOF
+if { (eval echo configure:3655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=unknown
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+LIBS=$xdvi_save_LIBS
+fi
+
+echo "$ac_t""$xdvi_needs_explicit_xpm" 1>&6
+if test "$xdvi_needs_explicit_xpm" = yes; then
+ X_PRE_LIBS=" -lXpm$X_PRE_LIBS"
+fi
+fi
+ X_PRE_LIBS=" -lXaw -lXmu -lXt$X_PRE_LIBS -lXext"
+ cat >> confdefs.h <<\EOF
+#define XAW 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS popups.c"
+ OPT_OBJS="$OPT_OBJS popups.o" ;;
+xaw3d)
+ X_PRE_LIBS="$X_PRE_LIBS $MATH_LIB"
+ MATH_LIB=
+ if test -z "$imake"; then
+# Cygwin needs -lXpm to be linked in explicitly; yet on older (<4.2)
+# versions of XFree86, -lXpm exists, but is not needed. So we do two checks.
+echo $ac_n "checking for whether -lXpm needs to be explicitly given""... $ac_c" 1>&6
+echo "configure:3689: checking for whether -lXpm needs to be explicitly given" >&5
+if eval "test \"`echo '$''{'xdvi_needs_explicit_xpm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ xdvi_save_LIBS=$LIBS
+LIBS="-lXaw3d -lXmu -lXt$X_PRE_LIBS -lXext $LIBS $X_LIBS -lX11"
+cat > conftest.$ac_ext <<EOF
+#line 3696 "configure"
+#include "confdefs.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 XawTextReplace();
+
+int main() {
+XawTextReplace()
+; return 0; }
+EOF
+if { (eval echo configure:3707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ LIBS="$LIBS -lXpm"
+cat > conftest.$ac_ext <<EOF
+#line 3716 "configure"
+#include "confdefs.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 XawTextReplace();
+
+int main() {
+XawTextReplace()
+; return 0; }
+EOF
+if { (eval echo configure:3727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=unknown
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+LIBS=$xdvi_save_LIBS
+fi
+
+echo "$ac_t""$xdvi_needs_explicit_xpm" 1>&6
+if test "$xdvi_needs_explicit_xpm" = yes; then
+ X_PRE_LIBS=" -lXpm$X_PRE_LIBS"
+fi
+fi
+ X_PRE_LIBS=" -lXaw3d -lXmu -lXt$X_PRE_LIBS -lXext"
+ cat >> confdefs.h <<\EOF
+#define XAW 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define XAW3D 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS popups.c"
+ OPT_OBJS="$OPT_OBJS popups.o" ;;
+motif)
+ X_PRE_LIBS=" -lXm -lXmu -lXt$X_PRE_LIBS -lXext"
+ cat >> confdefs.h <<\EOF
+#define MOTIF 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS popups.c"
+ OPT_OBJS="$OPT_OBJS popups.o" ;;
+no)
+ X_PRE_LIBS= ;;
+*)
+ { echo "configure: error: invalid toolkit $withval given" 1>&2; exit 1; } ;;
+esac
+
+else
+ X_PRE_LIBS="$X_PRE_LIBS $MATH_LIB"
+ MATH_LIB=
+ if test -z "$imake"; then
+# Cygwin needs -lXpm to be linked in explicitly; yet on older (<4.2)
+# versions of XFree86, -lXpm exists, but is not needed. So we do two checks.
+echo $ac_n "checking for whether -lXpm needs to be explicitly given""... $ac_c" 1>&6
+echo "configure:3779: checking for whether -lXpm needs to be explicitly given" >&5
+if eval "test \"`echo '$''{'xdvi_needs_explicit_xpm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ xdvi_save_LIBS=$LIBS
+LIBS="-lXaw -lXmu -lXt$X_PRE_LIBS -lXext $LIBS $X_LIBS -lX11"
+cat > conftest.$ac_ext <<EOF
+#line 3786 "configure"
+#include "confdefs.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 XawTextReplace();
+
+int main() {
+XawTextReplace()
+; return 0; }
+EOF
+if { (eval echo configure:3797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ LIBS="$LIBS -lXpm"
+cat > conftest.$ac_ext <<EOF
+#line 3806 "configure"
+#include "confdefs.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 XawTextReplace();
+
+int main() {
+XawTextReplace()
+; return 0; }
+EOF
+if { (eval echo configure:3817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_needs_explicit_xpm=unknown
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+LIBS=$xdvi_save_LIBS
+fi
+
+echo "$ac_t""$xdvi_needs_explicit_xpm" 1>&6
+if test "$xdvi_needs_explicit_xpm" = yes; then
+ X_PRE_LIBS=" -lXpm$X_PRE_LIBS"
+fi
+fi
+ X_PRE_LIBS=" -lXaw -lXmu -lXt$X_PRE_LIBS -lXext"
+ cat >> confdefs.h <<\EOF
+#define XAW 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS popups.c"
+ OPT_OBJS="$OPT_OBJS popups.o"
+fi
+
+
+# Check whether --with-tetex or --without-tetex was given.
+if test "${with_tetex+set}" = set; then
+ withval="$with_tetex"
+ if test "$withval" != "no"; then
+ if test "${enable_ps_gs+set}" != set; then
+ enable_ps_gs=yes
+ fi
+ if test "${enable_extra_app_defaults+set}" != set; then
+ enable_extra_app_defaults="$withval"
+ fi
+ if test "${enable_dosnames+set}" != set; then
+ enable_dosnames=yes
+ fi
+fi
+
+fi
+
+
+# Check whether --enable-grey or --disable-grey was given.
+if test "${enable_grey+set}" = set; then
+ enableval="$enable_grey"
+ if test "$enableval" = yes; then
+ cat >> confdefs.h <<\EOF
+#define GREY 1
+EOF
+
+fi
+else
+ cat >> confdefs.h <<\EOF
+#define GREY 1
+EOF
+
+fi
+
+
+# Check whether --enable-color or --disable-color was given.
+if test "${enable_color+set}" = set; then
+ enableval="$enable_color"
+ if test "$enableval" = yes; then
+ cat >> confdefs.h <<\EOF
+#define COLOR 1
+EOF
+
+fi
+else
+ cat >> confdefs.h <<\EOF
+#define COLOR 1
+EOF
+
+fi
+
+
+# Check whether --enable-buttons or --disable-buttons was given.
+if test "${enable_buttons+set}" = set; then
+ enableval="$enable_buttons"
+ if test "$enableval" = yes; then
+ cat >> confdefs.h <<\EOF
+#define BUTTONS 1
+EOF
+
+fi
+else
+ cat >> confdefs.h <<\EOF
+#define BUTTONS 1
+EOF
+
+fi
+
+
+# Check whether --enable-make-pk or --disable-make-pk was given.
+if test "${enable_make_pk+set}" = set; then
+ enableval="$enable_make_pk"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define MKTEXPK 1
+EOF
+
+ if test "$enableval" != yes; then
+ cat >> confdefs.h <<EOF
+#define MKTEXPK_PATH "$enableval"
+EOF
+
+ fi
+fi
+else
+ cat >> confdefs.h <<\EOF
+#define MKTEXPK 1
+EOF
+
+fi
+
+
+# Check whether --enable-old-make-pk or --disable-old-make-pk was given.
+if test "${enable_old_make_pk+set}" = set; then
+ enableval="$enable_old_make_pk"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define MKTEXPK 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define MAKETEXPK 1
+EOF
+
+ if test "$enableval" != yes; then
+ cat >> confdefs.h <<EOF
+#define MKTEXPK_PATH "$enableval"
+EOF
+
+ fi
+fi
+fi
+
+
+# Check whether --enable-gf or --disable-gf was given.
+if test "${enable_gf+set}" = set; then
+ enableval="$enable_gf"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define USE_GF 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS gf.c"
+ OPT_OBJS="$OPT_OBJS gf.o"
+fi
+fi
+
+
+xdvi_ps_c= xdvi_ps_o=
+# Check whether --enable-ps-gs or --disable-ps-gs was given.
+if test "${enable_ps_gs+set}" = set; then
+ enableval="$enable_ps_gs"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define PS_GS 1
+EOF
+
+ xdvi_ps_c=" psgs.c"
+ xdvi_ps_o=" psgs.o"
+ if test "$enableval" != yes; then
+ cat >> confdefs.h <<EOF
+#define GS_PATH "$enableval"
+EOF
+
+ fi
+fi
+fi
+
+
+# Check whether --enable-ps-dps or --disable-ps-dps was given.
+if test "${enable_ps_dps+set}" = set; then
+ enableval="$enable_ps_dps"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define PS_DPS 1
+EOF
+
+ xdvi_ps_c="$xdvi_ps_c psdps.c"
+ xdvi_ps_o="$xdvi_ps_o psdps.o"
+ X_PRE_LIBS=" -ldps$X_PRE_LIBS"
+ # Work around a bug in Solaris 2. This doesn't work with imake.
+ if test "x$x_includes" = x/usr/openwin/include && test ! -d $x_includes/DPS \
+ && test -d $x_includes/X11/DPS; then
+ CFLAGS="$CFLAGS -I$x_includes/X11"
+ fi
+fi
+fi
+
+
+# Check whether --enable-ps-news or --disable-ps-news was given.
+if test "${enable_ps_news+set}" = set; then
+ enableval="$enable_ps_news"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define PS_NEWS 1
+EOF
+
+ xdvi_ps_c="$xdvi_ps_c psnews.c"
+ xdvi_ps_o="$xdvi_ps_o psnews.o"
+ X_PRE_LIBS=" -u _xv_psview_pkg -lxvps -lxview -lcps -lolgx$X_PRE_LIBS"
+fi
+fi
+
+
+if test -n "$xdvi_ps_c"; then
+ OPT_SRCS="$OPT_SRCS psheader.c$xdvi_ps_c"
+ OPT_OBJS="$OPT_OBJS psheader.o$xdvi_ps_o"
+fi
+
+# Check whether --enable-config-file or --disable-config-file was given.
+if test "${enable_config_file+set}" = set; then
+ enableval="$enable_config_file"
+ if test "$enableval" != no; then
+ if test "$enableval" = yes; then
+ { echo "configure: error: Option \`--enable-config-file' requires an argument" 1>&2; exit 1; }
+ fi
+ cat >> confdefs.h <<EOF
+#define DEFAULT_CONFIG_PATH "$enableval"
+EOF
+
+fi
+fi
+
+
+# Check whether --enable-self-auto or --disable-self-auto was given.
+if test "${enable_self_auto+set}" = set; then
+ enableval="$enable_self_auto"
+ if test "$enableval" != no; then
+ if test "$enableval" != yes; then
+ cat >> confdefs.h <<EOF
+#define DEFAULT_CONFIG_PATH "$enableval"
+EOF
+
+ fi
+ cat >> confdefs.h <<\EOF
+#define SELFAUTO 1
+EOF
+
+fi
+fi
+
+
+# Check whether --enable-extra-app-defaults or --disable-extra-app-defaults was given.
+if test "${enable_extra_app_defaults+set}" = set; then
+ enableval="$enable_extra_app_defaults"
+ if test "$enableval" != no; then
+ if test "$enableval" != yes; then
+ cat >> confdefs.h <<EOF
+#define DEFAULT_CONFIG_PATH "$enableval"
+EOF
+
+ fi
+ cat >> confdefs.h <<\EOF
+#define EXTRA_APP_DEFAULTS 1
+EOF
+
+fi
+fi
+
+
+# Check whether --enable-dosnames or --disable-dosnames was given.
+if test "${enable_dosnames+set}" = set; then
+ enableval="$enable_dosnames"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define DOSNAMES 1
+EOF
+
+fi
+fi
+
+
+# Check whether --enable-a4 or --disable-a4 was given.
+if test "${enable_a4+set}" = set; then
+ enableval="$enable_a4"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define A4 1
+EOF
+
+fi
+fi
+
+
+# Check whether --enable-texxet or --disable-texxet was given.
+if test "${enable_texxet+set}" = set; then
+ enableval="$enable_texxet"
+ if test "$enableval" != no; then
+ cat >> confdefs.h <<\EOF
+#define TEXXET 1
+EOF
+
+fi
+fi
+
+
+# Check whether --with-mfmode or --without-mfmode was given.
+if test "${with_mfmode+set}" = set; then
+ withval="$with_mfmode"
+ if test "x$withval" != xno; then
+ echo "$withval" | grep ':[0-9][0-9]*$' >/dev/null 2>&1 \
+ || echo "configure: warning: the mfmode should end with a dots-per-inch value" 1>&2
+ cat >> confdefs.h <<EOF
+#define MFMODE "$withval"
+EOF
+
+fi
+else
+ cat >> confdefs.h <<\EOF
+#define MFMODE "cx:300"
+EOF
+
+fi
+
+
+# Check whether --with-default-texmf-path or --without-default-texmf-path was given.
+if test "${with_default_texmf_path+set}" = set; then
+ withval="$with_default_texmf_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_TEXMF_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_TEXMF_PATH "/usr/local/tex/texmf"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-font-path or --without-default-font-path was given.
+if test "${with_default_font_path+set}" = set; then
+ withval="$with_default_font_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_FONT_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_FONT_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-vf-path or --without-default-vf-path was given.
+if test "${with_default_vf_path+set}" = set; then
+ withval="$with_default_vf_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_VF_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_VF_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-header-path or --without-default-header-path was given.
+if test "${with_default_header_path+set}" = set; then
+ withval="$with_default_header_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_HEADER_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_HEADER_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-fig-path or --without-default-fig-path was given.
+if test "${with_default_fig_path+set}" = set; then
+ withval="$with_default_fig_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_FIG_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_FIG_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-source-path or --without-default-source-path was given.
+if test "${with_default_source_path+set}" = set; then
+ withval="$with_default_source_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_SOURCE_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_SOURCE_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-dvips-path or --without-default-dvips-path was given.
+if test "${with_default_dvips_path+set}" = set; then
+ withval="$with_default_dvips_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_DVIPS_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_DVIPS_PATH "dvips"
+EOF
+
+
+fi
+
+
+
+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}'
+
+# A kludge necessary for CPPFLAGS to allow quoted args
+CPPFLAGS="`echo "$CPPFLAGS" | sed 's/\\\"/\\\\\\\"/g'`"
+
+# 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 " config.h:config.hin" | 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%@x_top@%$x_top%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%@EXEEXT@%$EXEEXT%g
+s%@CPP@%$CPP%g
+s%@X_CFLAGS@%$X_CFLAGS%g
+s%@X_PRE_LIBS@%$X_PRE_LIBS%g
+s%@X_LIBS@%$X_LIBS%g
+s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
+s%@KRHEADER_H@%$KRHEADER_H%g
+s%@MATH_LIB@%$MATH_LIB%g
+s%@x_linker_options@%$x_linker_options%g
+s%@OPT_SRCS@%$OPT_SRCS%g
+s%@OPT_OBJS@%$OPT_OBJS%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
+
+if test -n "$imake"; then
+ ac_noimake_makefile=
+else
+ ac_noimake_makefile='Makefile '
+fi
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"$ac_noimake_makefile"}
+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 ;;
+ /*) 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
+ [/$]*) 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
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# 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="config.h:config.hin"
+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/%" -e "s%:% $ac_given_srcdir/%g"`
+ 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
+
+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
+
diff --git a/systems/unix/tex-fpc/xdvi/macxdvi.h b/systems/unix/tex-fpc/xdvi/macxdvi.h
new file mode 100644
index 0000000000..c72024fa51
--- /dev/null
+++ b/systems/unix/tex-fpc/xdvi/macxdvi.h
@@ -0,0 +1,1299 @@
+/*========================================================================*\
+
+Copyright (c) 1990-2004 Paul Vojta
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+NOTE:
+ xdvi is based on prior work, as noted in the modification history
+ in xdvi.c.
+
+\*========================================================================*/
+ /* helbig changed this file to make it work on Mac OS X */
+ /* it defined XOPEN_SOURCE, which causes NSIG to be not defined,
+ which breaks signal.h included by event.c */
+
+/*
+ * Written by Eric C. Cooper, CMU
+ */
+
+#ifndef XDVI_H
+#define XDVI_H
+
+/********************************
+ * The C environment *
+ *******************************/
+
+#ifdef __hpux
+/* On HP-UX 10.10 B and 20.10, compiling with _XOPEN_SOURCE + ..._EXTENDED
+ * leads to poll() not realizing that a file descriptor is writable in psgs.c.
+ */
+#define _HPUX_SOURCE 1
+#else
+#undef _XOPEN_SOURCE /* needed because of imake */
+#define _XOPEN_SOURCE_EXTENDED 1
+#define __EXTENSIONS__ 1 /* needed to get struct timeval on SunOS 5.5 */
+#define _SVID_SOURCE 1 /* needed to get S_IFLNK in glibc */
+#define _BSD_SOURCE 1 /* needed to get F_SETOWN in glibc-2.1.3 */
+#endif
+
+#include "config.h"
+
+/* Some O/S dependent kludges. */
+#ifdef _AIX
+#define _ALL_SOURCE 1
+#endif
+
+/* If xmkmf is broken and there's a symlink from /usr/include/X11 to the right
+ * place, then there will be no -I... argument on the cc command line for the
+ * X include files. Since gcc version 3 and higher sets __STDC__ to 0 when
+ * including system header files on some platforms, we may end up with
+ * NeedFunctionPrototypes set to 0 when it should be 1. So, let's force the
+ * issue.
+ */
+
+#if __STDC__ && !defined(FUNCPROTO)
+# define FUNCPROTO (-1)
+#endif
+
+#if STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+ /* the following works around the wchar_t problem */
+# include <X11/X.h>
+# if HAVE_X11_XOSDEFS_H
+# include <X11/Xosdefs.h>
+# endif
+# ifdef X_NOT_STDC_ENV
+# undef X_NOT_STDC_ENV
+# undef X_WCHAR
+# include <X11/Xlib.h>
+# define X_NOT_STDC_ENV
+# endif
+#endif
+
+#include <X11/Xlib.h> /* include Xfuncs.h, if available */
+#include <X11/Xutil.h> /* needed for XDestroyImage */
+#include <X11/Xos.h>
+
+#if XlibSpecificationRelease >= 5
+#include <X11/Xfuncs.h>
+#endif
+
+#undef TOOLKIT
+
+#if XAW || MOTIF
+
+#define TOOLKIT 1
+#include <X11/Intrinsic.h>
+#if (defined(VMS) && (XtSpecificationRelease <= 4)) || defined(lint)
+# include <X11/IntrinsicP.h>
+#endif
+#if MOTIF
+# include <Xm/Xm.h>
+# ifndef MOTIF_TIMERS /* see comment in events.c */
+# define MOTIF_TIMERS (XmVERSION >= 2)
+# endif
+#endif
+
+#else /* not TOOLKIT */
+
+#define XtNumber(arr) (sizeof(arr)/sizeof(arr[0]))
+#define XtWindow(win) (win)
+typedef unsigned long Pixel;
+typedef char Boolean;
+typedef unsigned int Dimension;
+#undef BUTTONS
+#undef EXTRA_APP_DEFAULTS
+
+#endif /* not TOOLKIT */
+
+#if EXTRA_APP_DEFAULTS && !SELFAUTO
+#define SELFAUTO 1
+#endif
+
+#if SELFAUTO && !defined(DEFAULT_CONFIG_PATH)
+#define DEFAULT_CONFIG_PATH \
+ ".:$SELFAUTOLOC:$SELFAUTODIR:$SELFAUTOPARENT:$SELFAUTODIR/share/texmf/web2c:$SELFAUTOPARENT/share/texmf/web2c:$SELFAUTODIR/texmf/web2c:$SELFAUTOPARENT/texmf/web2c:$TETEXDIR:$TEXMF/web2c"
+#endif
+
+#undef CFGFILE /* no cheating */
+
+#if defined(DEFAULT_CONFIG_PATH)
+#define CFGFILE 1
+#endif
+
+typedef char Bool3; /* Yes/No/Maybe */
+
+#define True 1
+#define False 0
+#define Maybe 2
+
+#ifdef VMS
+#include <string.h>
+#define index strchr
+#define rindex strrchr
+#define bzero(a, b) (void) memset ((void *) (a), 0, (size_t) (b))
+#define bcopy(a, b, c) (void) memmove ((void *) (b), (void *) (a), (size_t) (c))
+#endif
+
+#include <stdio.h>
+#include <setjmp.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#ifndef NeedFunctionPrototypes
+#if __STDC__
+#define NeedFunctionPrototypes 1
+#else /* STDC */
+#define NeedFunctionPrototypes 0
+#endif /* STDC */
+#endif /* NeedFunctionPrototypes */
+
+#if NeedFunctionPrototypes
+#define ARGS(x) x
+#else
+#define ARGS(x) ()
+#endif
+
+#ifndef KPATHSEA
+
+/* These macros munge function declarations to make them work in both
+ cases. The P?H macros are used for declarations, the P?C for
+ definitions. See <ansidecl.h> from the GNU C library. P1H(void)
+ also works for definitions of routines which take no args. */
+
+#if NeedFunctionPrototypes /* Don't use __STDC__ here (gcc + SunOS 4) */
+
+#define P1H(p1) (p1)
+#define P2H(p1, p2) (p1, p2)
+
+#define P1C(t1,n1)(t1 n1)
+#define P2C(t1,n1, t2,n2)(t1 n1, t2 n2)
+#define P3C(t1,n1, t2,n2, t3,n3)(t1 n1, t2 n2, t3 n3)
+#define P4C(t1,n1, t2,n2, t3,n3, t4,n4)(t1 n1, t2 n2, t3 n3, t4 n4)
+
+#else /* not NeedFunctionPrototypes */
+
+#define P1H(p1) ()
+#define P2H(p1, p2) ()
+
+#define P1C(t1,n1) (n1) t1 n1;
+#define P2C(t1,n1, t2,n2) (n1,n2) t1 n1; t2 n2;
+#define P3C(t1,n1, t2,n2, t3,n3) (n1,n2,n3) t1 n1; t2 n2; t3 n3;
+#define P4C(t1,n1, t2,n2, t3,n3, t4,n4) (n1,n2,n3,n4) \
+ t1 n1; t2 n2; t3 n3; t4 n4;
+
+#endif /* not NeedFunctionPrototypes */
+
+#endif /* not KPATHSEA */
+
+#ifndef NeedWidePrototypes
+#define NeedWidePrototypes NeedFunctionPrototypes
+#endif
+
+#ifndef NeedVarargsPrototypes
+#define NeedVarargsPrototypes NeedFunctionPrototypes
+#endif
+
+#if NeedVarargsPrototypes
+#define VARGS(x) x
+#else
+#define VARGS(x) ()
+#endif
+
+#ifndef _XFUNCPROTOBEGIN
+#define _XFUNCPROTOBEGIN
+#define _XFUNCPROTOEND
+#endif
+
+#ifndef _Xconst
+#if __STDC__
+#define _Xconst const
+#else /* STDC */
+#define _Xconst
+#endif /* STDC */
+#endif /* _Xconst */
+
+#ifndef VOLATILE
+#if __STDC__ || (defined(__stdc__) && defined(__convex__))
+#define VOLATILE volatile
+#else
+#define VOLATILE /* nothing */
+#endif
+#endif
+
+#ifndef NORETURN
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
+# define NORETURN __attribute__((__noreturn__))
+# else
+# define NORETURN /* nothing */
+# endif
+#endif
+
+#ifndef UNUSED
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# define UNUSED __attribute__((__unused__))
+# else
+# define UNUSED /* nothing */
+# endif
+#endif
+
+#ifndef OPEN_MODE
+#ifndef VMS
+#define OPEN_MODE "r"
+#else /* VMS */
+#define OPEN_MODE "r", "ctx=stm"
+#endif /* VMS */
+#endif /* OPEN_MODE */
+
+#ifndef VMS
+#define OPEN_MODE_ARGS _Xconst char *
+#else
+#define OPEN_MODE_ARGS _Xconst char *, _Xconst char *
+#endif
+
+#define Printf (void) printf
+#define Puts (void) puts
+#define Fprintf (void) fprintf
+#define Sprintf (void) sprintf
+#define Fseek (void) fseek
+#define Fread (void) fread
+#define Fputs (void) fputs
+#define Putc (void) putc
+#define Putchar (void) putchar
+#define Fclose (void) fclose
+#define Fflush (void) fflush
+#define Strcat (void) strcat
+#define Strcpy (void) strcpy
+
+/********************************
+ * Types and data *
+ *******************************/
+
+#ifndef EXTERN
+#define EXTERN extern
+#define INIT(x)
+#endif
+
+#define MAXDIM 32767
+
+typedef unsigned char ubyte;
+
+#if NeedWidePrototypes
+typedef unsigned int wide_ubyte;
+typedef int wide_bool;
+#define WIDENINT (int)
+#else
+typedef ubyte wide_ubyte;
+typedef Boolean wide_bool;
+#define WIDENINT
+#endif
+
+#if defined(MAKETEXPK) && !defined(MKTEXPK)
+#define MKTEXPK 1
+#endif
+
+/*
+ * pixel_conv is currently used only for converting absolute positions
+ * to pixel values; although normally it should be
+ * ((int) ((x) / shrink_factor + (1 << 15) >> 16)),
+ * the rounding is achieved instead by moving the constant 1 << 15 to
+ * PAGE_OFFSET in dvi-draw.c.
+ */
+#define pixel_conv(x) ((int) ((x) / shrink_factor >> 16))
+#define pixel_round(x) ((int) ROUNDUP(x, shrink_factor << 16))
+#define spell_conv0(n, f) ((long) (n * f))
+#define spell_conv(n) spell_conv0(n, dimconv)
+
+#define BMUNIT unsigned BMTYPE
+#define BMBITS (8 * BMBYTES)
+
+#define ADD(a, b) ((BMUNIT *) (((char *) a) + b))
+#define SUB(a, b) ((BMUNIT *) (((char *) a) - b))
+
+extern BMUNIT bit_masks[BMBITS + 1];
+
+struct frame {
+ struct framedata {
+ long dvi_h, dvi_v, w, x, y, z;
+ int pxl_v;
+ } data;
+ struct frame *next, *prev;
+};
+
+#ifndef TEXXET
+typedef long (*set_char_proc) ARGS((wide_ubyte));
+#else
+typedef void (*set_char_proc) ARGS((wide_ubyte, wide_ubyte));
+#endif
+
+typedef void (*home_proc) ARGS((wide_bool));
+
+struct drawinf { /* this information is saved when using virtual fonts */
+ struct framedata data;
+ struct font *fontp;
+ set_char_proc set_char_p;
+ int tn_table_len;
+ struct font **tn_table;
+ struct tn *tn_head;
+ ubyte *pos, *end;
+ struct font *virtual;
+#ifdef TEXXET
+ int dir;
+#endif
+};
+
+EXTERN struct drawinf currinf;
+
+/* entries below with the characters 'dvi' in them are actually stored in
+ scaled pixel units */
+
+#define DVI_H currinf.data.dvi_h
+#define PXL_H pixel_conv(currinf.data.dvi_h)
+#define DVI_V currinf.data.dvi_v
+#define PXL_V currinf.data.pxl_v
+#define WW currinf.data.w
+#define XX currinf.data.x
+#define YY currinf.data.y
+#define ZZ currinf.data.z
+#define ROUNDUP(x,y) (((x)+(y)-1)/(y))
+
+EXTERN int current_page;
+EXTERN int total_pages;
+EXTERN int pageno_correct INIT(1);
+EXTERN long magnification;
+EXTERN double dimconv;
+EXTERN double tpic_conv;
+EXTERN int n_files_left INIT(32767); /* for LRU closing of fonts */
+EXTERN unsigned int page_w, page_h;
+
+#if defined(GS_PATH) && !defined(PS_GS)
+#define PS_GS 1
+#endif
+
+#if defined(PS_DPS) || defined(PS_NEWS) || defined(PS_GS)
+#define PS 1
+#else
+#define PS 0
+#endif
+
+EXTERN int scanned_page; /* last page prescanned */
+
+#if PS
+EXTERN int scanned_page_ps; /* last page scanned for PS specials */
+EXTERN int scanned_page_ps_bak; /* save the above if PS is turned off */
+#endif
+
+#if COLOR
+EXTERN int scanned_page_color; /* last page scanned for color spcls */
+#endif
+
+EXTERN int scanned_page_reset; /* number to reset the above to */
+
+/*
+ * The following is set when we're prescanning before opening up the windows,
+ * and we hit a PostScript header file. We can't start up gs until we get
+ * a window to associate the process to, so we have to prescan twice.
+ */
+#if PS_GS
+EXTERN Boolean gs_postpone_prescan INIT(False);
+#endif
+
+/*
+ * Per-page data in DVI file, indexed by page number - 1.
+ * Offset is initialized in prepare_pages().
+ * Page size is initialized while prescanning.
+ */
+struct per_page {
+ long offset;
+ unsigned int pw, ph; /* page size */
+ unsigned int ww, wh; /* window size */
+};
+
+EXTERN struct per_page *page_info;
+
+/*
+ * Set if the -paper option overrides papersize specials.
+ */
+EXTERN Boolean ignore_papersize_specials INIT(False);
+
+/*
+ * Mechanism for reducing repeated warning about specials, lost characters, etc.
+ */
+EXTERN Boolean warn_spec_now;
+
+/*
+ * If we're in the middle of a PSFIG special.
+ */
+EXTERN Boolean psfig_begun INIT(False);
+
+/*
+ * Page on which to draw box from forward source special searching.
+ */
+EXTERN int source_fwd_box_page INIT(-1); /* -1 means no box */
+
+/*
+ * Information on deferred source operation. See do_pages() for meaning.
+ */
+EXTERN _Xconst char *source_forward_string INIT(NULL);
+EXTERN int source_reverse_x, source_reverse_y;
+EXTERN int source_show_all;
+
+
+/*
+ * Bitmap structure for raster ops.
+ */
+struct bitmap {
+ unsigned short w, h; /* width and height in pixels */
+ short bytes_wide; /* scan-line width in bytes */
+ char *bits; /* pointer to the bits */
+};
+
+/*
+ * Per-character information.
+ * There is one of these for each character in a font (raster fonts only).
+ * All fields are filled in at font definition time,
+ * except for the bitmap, which is "faulted in"
+ * when the character is first referenced.
+ */
+struct glyph {
+ long addr; /* address of bitmap in font file */
+ long dvi_adv; /* DVI units to move reference point */
+ short x, y; /* x and y offset in pixels */
+ struct bitmap bitmap; /* bitmap for character */
+ short x2, y2; /* x and y offset in pixels (shrunken bitmap) */
+#if GREY
+# if COLOR
+ struct fgrec *fg; /* fgrec for which these pixmaps are valid */
+# endif
+ XImage *image2;
+ char *pixmap2;
+ char *pixmap2_t;
+#endif /* GREY */
+ struct bitmap bitmap2; /* shrunken bitmap for character */
+};
+
+/*
+ * Per-character information for virtual fonts
+ */
+struct macro {
+ ubyte *pos; /* address of first byte of macro */
+ ubyte *end; /* address of last+1 byte */
+ long dvi_adv; /* DVI units to move reference point */
+ Boolean free_me; /* if free(pos) should be called when */
+ /* freeing space */
+};
+
+/*
+ * The layout of a font information block.
+ * There is one of these for every loaded font or magnification thereof.
+ * Duplicates are eliminated: this is necessary because of possible recursion
+ * in virtual fonts.
+ *
+ * Also note the strange units. The design size is in 1/2^20 point
+ * units (also called micro-points), and the individual character widths
+ * are in the TFM file in 1/2^20 ems units, i.e., relative to the design size.
+ *
+ * We then change the sizes to SPELL units (unshrunk pixel / 2^16).
+ */
+
+#define NOMAGSTP (-29999)
+
+typedef void (*read_char_proc) ARGS((struct font *, wide_ubyte));
+
+struct font {
+ struct font *next; /* link to next font info block */
+ char *fontname; /* name of font */
+ float fsize; /* size information (dots per inch) */
+ int magstepval; /* magstep number * two, or NOMAGSTP */
+ FILE *file; /* open font file or NULL */
+ char *filename; /* name of font file */
+ long checksum; /* checksum */
+ unsigned short timestamp; /* for LRU management of fonts */
+ ubyte flags; /* flags byte (see values below) */
+ ubyte maxchar; /* largest character code */
+ double dimconv; /* size conversion factor */
+ set_char_proc set_char_p; /* proc used to set char */
+ /* these fields are used by (loaded) raster fonts */
+ read_char_proc read_char; /* function to read bitmap */
+ struct glyph *glyph;
+ /* these fields are used by (loaded) virtual fonts */
+ struct font **vf_table; /* list of fonts used by this vf */
+ struct tn *vf_chain; /* ditto, if TeXnumber >= VFTABLELEN */
+ struct font *first_font; /* first font defined */
+ struct macro *macro;
+ /* I suppose the above could be put into a union, but we */
+ /* wouldn't save all that much space. */
+};
+
+#define FONT_IN_USE 1 /* used for housekeeping */
+#define FONT_LOADED 2 /* if font file has been read */
+#define FONT_VIRTUAL 4 /* if font is virtual */
+
+#define TNTABLELEN 30 /* length of TeXnumber array (dvi file) */
+#define VFTABLELEN 5 /* length of TeXnumber array (virtual fonts) */
+
+struct tn {
+ struct tn *next; /* link to next TeXnumber info block */
+ int TeXnumber; /* font number (in DVI file) */
+ struct font *fontp; /* pointer to the rest of the info */
+};
+
+EXTERN struct font *tn_table[TNTABLELEN];
+EXTERN struct font *font_head INIT(NULL);
+EXTERN struct tn *tn_head INIT(NULL);
+EXTERN ubyte maxchar;
+EXTERN unsigned short current_timestamp INIT(0);
+
+/*
+ * Command line flags.
+ */
+
+extern struct _resource {
+#if TOOLKIT && CFGFILE
+ _Xconst char *progname;
+#endif
+#if TOOLKIT
+ int shrinkfactor;
+ _Xconst char *main_translations;
+ _Xconst char *wheel_translations;
+ int dvips_hang;
+ int dvips_fail_hang;
+#endif
+ int wheel_unit;
+ int _density;
+#ifdef GREY
+ float _gamma;
+#endif
+ int _pixels_per_inch;
+ _Xconst char *sidemargin;
+ _Xconst char *topmargin;
+ _Xconst char *xoffset;
+ _Xconst char *yoffset;
+ _Xconst char *paper;
+ _Xconst char *_alt_font;
+#ifdef MKTEXPK
+ Boolean makepk;
+#endif
+ _Xconst char *mfmode;
+ _Xconst char *editor;
+ _Xconst char *src_pos;
+ Boolean src_fork;
+ Boolean _list_fonts;
+ Boolean reverse;
+ Boolean _warn_spec;
+ Boolean _hush_chars;
+ Boolean _hush_chk;
+ Boolean safer;
+#if defined(VMS) || !defined(TOOLKIT)
+ _Xconst char *fore_color;
+ _Xconst char *back_color;
+#endif
+ Pixel _fore_Pixel;
+ Pixel _back_Pixel;
+#ifdef TOOLKIT
+ Pixel _brdr_Pixel;
+ Pixel _hl_Pixel;
+ Pixel _cr_Pixel;
+#endif
+ _Xconst char *icon_geometry;
+ Boolean keep_flag;
+ Boolean copy;
+ Boolean thorough;
+#if PS
+ /* default is to use DPS, then NEWS, then GhostScript;
+ * we will figure out later on which one we will use */
+ Boolean _postscript;
+ Boolean allow_shell;
+#ifdef PS_DPS
+ Boolean useDPS;
+#endif
+#ifdef PS_NEWS
+ Boolean useNeWS;
+#endif
+#ifdef PS_GS
+ Boolean useGS;
+ Boolean gs_safer;
+ Boolean gs_alpha;
+ _Xconst char *gs_path;
+ _Xconst char *gs_palette;
+#endif
+#endif /* PS */
+ Boolean prescan;
+ _Xconst char *debug_arg;
+ Boolean version_flag;
+#if BUTTONS
+ Boolean expert;
+ _Xconst char *button_translations;
+ int shrinkbutton[9];
+ Dimension btn_side_spacing;
+ Dimension btn_top_spacing;
+ Dimension btn_between_spacing;
+ Dimension btn_between_extra;
+ Dimension btn_border_width;
+#endif
+ _Xconst char *mg_arg[5];
+#if COLOR
+ Boolean _use_color;
+#endif
+#ifdef GREY
+ Boolean _use_grey;
+ Bool3 install;
+#endif
+#if TOOLKIT
+ _Xconst char *dvips_path;
+#endif
+} resource;
+
+/* As a convenience, we define the field names without leading underscores
+ * to point to the field of the above record. Here are the global ones;
+ * the local ones are defined in each module. */
+
+#define density resource._density
+#define pixels_per_inch resource._pixels_per_inch
+#define alt_font resource._alt_font
+#define list_fonts resource._list_fonts
+#define warn_spec resource._warn_spec
+#define hush_chars resource._hush_chars
+#define hush_chk resource._hush_chk
+#if COLOR
+#define use_color resource._use_color
+#endif
+#ifdef GREY
+#define use_grey resource._use_grey
+#endif
+
+#ifndef TOOLKIT
+EXTERN Pixel brdr_Pixel;
+#endif
+
+#if GREY
+EXTERN Pixel plane_masks[4];
+#endif
+
+#if GREY || COLOR
+EXTERN XColor color_data[2];
+#define fore_color_data color_data[0]
+#define back_color_data color_data[1]
+#endif
+
+#if COLOR
+
+struct rgb {
+ unsigned short r, g, b;
+};
+
+struct pagecolor {
+ struct rgb bg;
+ unsigned int stacksize;
+ _Xconst struct rgb *colorstack;
+};
+
+/* Information on background color and initial color stack for each page. */
+EXTERN struct pagecolor *page_colors INIT(NULL);
+
+/* The initial color stack is gotten from the pagecolor record for a page. */
+EXTERN _Xconst struct rgb *color_bottom;
+EXTERN unsigned int color_bot_size; /* number of entries */
+
+/* Additions to the runtime color stack on a given page are stored in a linked
+ list. "struct colorframe" is defined in special.c. */
+EXTERN struct colorframe *rcs_top;
+
+/* Color states. */
+EXTERN struct rgb fg_initial; /* Initial fg (from command line) */
+EXTERN struct rgb bg_initial; /* Initial bg */
+
+/*
+ * For each (foreground, background) color pair, we keep information (depending
+ * on the color model). It is organized as a linked list of linked lists,
+ * with background color more significant.
+ */
+
+struct bgrec {
+ struct bgrec *next;
+ struct rgb color;
+ struct fgrec *fg_head;
+ Boolean pixel_good; /* if the pixel entry is valid */
+ Pixel pixel;
+};
+
+struct fgrec {
+ struct fgrec *next;
+ struct rgb color;
+ Boolean pixel_good; /* if the pixel entry is valid */
+ Pixel pixel;
+#if GREY
+ Boolean palette_good; /* if the palette entry is valid */
+ Pixel palette[16]; /* non-TrueColor only */
+#endif
+};
+
+EXTERN struct bgrec *bg_head INIT(NULL); /* head of list */
+EXTERN struct bgrec *bg_current INIT(NULL); /* current bg value */
+EXTERN struct fgrec *fg_current; /* current fg value */
+EXTERN struct fgrec *fg_active INIT(NULL); /* where the GCs are */
+
+/* List of allocated colors (to be deallocated upon document change) */
+EXTERN Pixel *color_list; /* list of colors */
+EXTERN unsigned int color_list_len INIT(0); /* current len of list*/
+EXTERN unsigned int color_list_max INIT(0); /* allocated size */
+
+/* Whether the color situation has been warned about. */
+EXTERN Boolean color_warned INIT(False);
+
+/* Cursor color (for XRecolorCursor). */
+extern XColor cr_Color;
+
+#endif /* COLOR */
+
+extern struct mg_size_rec {
+ int w;
+ int h;
+}
+ mg_size[5];
+
+EXTERN int debug INIT(0);
+
+#define DBG_BITMAP 1
+#define DBG_DVI 2
+#define DBG_PK 4
+#define DBG_BATCH 8
+#define DBG_EVENT 16
+#define DBG_OPEN 32
+#define DBG_PS 64
+#define DBG_CLIENT 128
+#define DBG_ALL (~DBG_BATCH)
+
+EXTERN int offset_x, offset_y;
+EXTERN unsigned int unshrunk_paper_w, unshrunk_paper_h;
+EXTERN unsigned int unshrunk_page_w, unshrunk_page_h;
+
+EXTERN char *dvi_name INIT(NULL); /* dvi file name */
+EXTERN FILE *dvi_file; /* user's file */
+EXTERN time_t dvi_time; /* last modification time */
+EXTERN ino_t dvi_inode; /* used for source specials */
+EXTERN unsigned char *dvi_property; /* for setting in window */
+EXTERN size_t dvi_property_length;
+#if TOOLKIT
+EXTERN Boolean titles_are_stale INIT(True);
+ /* replace icon/window titles */
+#endif
+EXTERN _Xconst char *prog;
+EXTERN int bak_shrink; /* last shrink factor != 1 */
+EXTERN Dimension window_w, window_h;
+EXTERN XImage *image;
+EXTERN int backing_store;
+EXTERN int home_x, home_y;
+
+EXTERN Display *DISP;
+EXTERN Screen *SCRN;
+#if TOOLKIT
+extern XtActionsRec Actions[];
+extern Cardinal num_actions;
+#endif
+#if XAW
+EXTERN XtAccelerators accels_cr, accels_cr_click;
+#endif
+#ifdef GREY
+EXTERN Visual *our_visual;
+EXTERN unsigned int our_depth;
+EXTERN Colormap our_colormap;
+#else
+#define our_depth (unsigned int) DefaultDepthOfScreen(SCRN)
+#define our_visual DefaultVisualOfScreen(SCRN)
+#define our_colormap DefaultColormapOfScreen(SCRN)
+#endif
+EXTERN GC ruleGC;
+EXTERN GC foreGC, highGC;
+EXTERN GC foreGC2;
+EXTERN GC copyGC;
+EXTERN Boolean copy;
+
+EXTERN Cursor redraw_cursor, ready_cursor, drag_cursor[3];
+
+#if TOOLKIT
+struct xdvi_action {
+ struct xdvi_action *next;
+ XtActionProc proc;
+ Cardinal num_params;
+ String param;
+};
+
+struct wheel_acts {
+ struct wheel_acts *next;
+ Modifiers mask;
+ Modifiers value;
+ struct _LateBindings *late_bindings;
+ unsigned int button;
+ struct xdvi_action *action;
+};
+
+EXTERN struct wheel_acts *wheel_actions;
+#endif
+
+#if MOTIF && BUTTONS
+EXTERN XtTranslations wheel_trans_table INIT(NULL);
+#endif
+
+#ifdef GREY
+EXTERN Pixel *pixeltbl;
+EXTERN Pixel *pixeltbl_t;
+#endif /* GREY */
+
+/*
+ * Flag values and masks for event_flags
+ */
+
+#define EV_IDLE (1<<0) /* non-event */
+#define EV_CURSOR (1<<1) /* cursor needs to revert back to ready */
+#define EV_EXPOSE (1<<2) /* expose occurred somewhere */
+#define EV_MAG_MOVE (1<<3) /* magnifier moved */
+#define EV_MAG_GONE (1<<4) /* magnifier gone while being drawn */
+#define EV_ACK (1<<5) /* used internally */
+#define EV_SRC (1<<6) /* source special operation is pending */
+#define EV_NEWPAGE (1<<7) /* new page requested */
+#define EV_PS_TOGGLE (1<<8) /* PostScript toggled on or off */
+#define EV_NEWDOC (1<<9) /* new dvi file requested */
+#define EV_TERM (1<<10) /* quit */
+#define EV_MAXPLUS1 (1<<11)
+
+#define EV_GE_IDLE (EV_MAXPLUS1 - EV_IDLE)
+#define EV_GT_IDLE (EV_MAXPLUS1 - EV_CURSOR)
+#define EV_GE_CURSOR (EV_MAXPLUS1 - EV_CURSOR)
+#define EV_GE_EXPOSE (EV_MAXPLUS1 - EV_EXPOSE)
+#define EV_GE_MAG_MOVE (EV_MAXPLUS1 - EV_MAG_MOVE)
+#define EV_GE_MAG_GONE (EV_MAXPLUS1 - EV_MAG_GONE)
+#define EV_GE_ACK (EV_MAXPLUS1 - EV_ACK)
+#define EV_GE_NEWPAGE (EV_MAXPLUS1 - EV_NEWPAGE)
+#define EV_GE_PS_TOGGLE (EV_MAXPLUS1 - EV_PS_TOGGLE)
+#define EV_GE_NEWDOC (EV_MAXPLUS1 - EV_NEWDOC)
+#define EV_GE_TERM (EV_MAXPLUS1 - EV_TERM)
+
+#define EV_NOWAIT EV_GE_IDLE
+
+EXTERN unsigned int ev_flags INIT(EV_IDLE);
+EXTERN VOLATILE int event_counter INIT(0);
+EXTERN jmp_buf canit_env;
+
+struct xchild {
+ struct xchild *next; /* link to next in list */
+ pid_t pid; /* pid of process, or 0 */
+ Boolean killable; /* if can be killed with SIGKILL */
+ void (*proc) ARGS((int)); /* procedure to call */
+};
+
+struct xio {
+ struct xio *next; /* link to next in list */
+ int fd; /* file descriptor */
+ int xio_events; /* same as in struct pollfd (can't call
+ it events because poll.h on AIX
+ defines events to something else) */
+#if HAVE_POLL
+ struct pollfd *pfd;
+#endif
+ void (*read_proc) ARGS((void)); /* call to read */
+ void (*write_proc) ARGS((void)); /* call to write */
+};
+
+struct xtimer {
+ struct xtimer *next; /* link to next in chain */
+ struct timeval when; /* when to call the routine */
+ void (*proc) ARGS((struct xtimer *)); /* procedure to call */
+#if MOTIF_TIMERS
+ XtTimerCallbackProc xt_proc; /* additional data for Xm */
+ XtPointer closure;
+#endif
+};
+
+#if MOTIF_TIMERS
+# define TIMER_INIT(proc) {NULL, {0, 0}, proc, NULL, NULL}
+#else
+# define TIMER_INIT(proc) {NULL, {0, 0}, proc}
+#endif
+
+struct WindowRec {
+ Window win;
+ int shrinkfactor;
+ int base_x, base_y;
+ unsigned int width, height;
+ int min_x, max_x, min_y, max_y; /* for pending expose events */
+};
+
+extern struct WindowRec mane, alt, currwin;
+EXTERN int min_x, max_x, min_y, max_y;
+EXTERN Boolean drawing_mag INIT(False);
+
+#define shrink_factor currwin.shrinkfactor
+
+#if TOOLKIT
+EXTERN Widget top_level INIT(0);
+EXTERN Widget vport_widget, draw_widget, clip_widget;
+# if MOTIF
+EXTERN Widget shrink_button[4];
+EXTERN Widget x_bar, y_bar; /* horizontal and vert. scroll bars */
+# endif
+# if BUTTONS
+EXTERN Widget form_widget;
+EXTERN int xtra_wid INIT(0);
+extern _Xconst char default_button_config[]; /* defined in events.c */
+# if XAW
+EXTERN Widget panel_widget;
+EXTERN Cursor panel_cursor INIT(0);
+# endif
+# endif
+#else /* not TOOLKIT */
+EXTERN Window top_level INIT(0);
+
+#define BAR_WID 12 /* width of darkened area */
+#define BAR_THICK 15 /* gross amount removed */
+#endif /* not TOOLKIT */
+
+#if XAW
+#define WARN(t, s) (void) warning_popup(s, "OK", NULL)
+#define WARN1(t, s, s1) (void) warning_popup_long(s, "OK", NULL, s1)
+#define WARN2(t, s, s1, s2) (void) warning_popup_long(s, "OK", NULL, s1, s2)
+#elif MOTIF
+#define WARN(t, s) (void) warning_popup(s, t, NULL, NULL)
+#define WARN1(t, s, s1) (void) warning_popup_long(s, t, NULL, NULL, s1)
+#define WARN2(t, s, s1, s2) (void) warning_popup_long(s, t, NULL, NULL, s1, s2)
+#elif CC_K_AND_R
+#define WARN(t, s) (void) fputs(s "\n", stderr)
+#define WARN1(t, s, s1) (void) fprintf(stderr, s "\n", s1)
+#else
+#define WARN(t, s) (void) (fputs(s, stderr), putc('\n', stderr))
+#define WARN1(t, s, s1) (void) (fprintf(stderr, s, s1), putc('\n', stderr))
+#endif
+
+/*
+ * If a popup is popped up before the main window, then the main window is
+ * likely to cover it. So we have to postpone popping them up until after
+ * realizing the main window. It is not workable to pop them up immediately
+ * and then raise them later, due to unpredictable window manager behavior.
+ */
+
+#if TOOLKIT
+EXTERN Boolean postpone_popups INIT(True);
+EXTERN size_t n_init_popups INIT(0);
+EXTERN Widget *init_popups;
+EXTERN size_t alloc_init_popups INIT(0);
+#endif
+
+/*
+ * Structure to use for status popups.
+ */
+
+#if TOOLKIT
+struct status_popup {
+ Widget shell;
+ Widget label;
+ int expected_type;
+ Boolean popped;
+ Boolean spurious;
+};
+#endif
+
+EXTERN char *ffline INIT(NULL); /* an array used by filefind to store */
+ /* the file name being formed. */
+ /* It expands as needed. */
+ /* Also used elsewhere. */
+EXTERN size_t ffline_len INIT(0); /* current length of ffline[] */
+
+/*
+ * Used by the geometry-scanning routines.
+ * It passes pointers to routines to be called at certain
+ * points in the dvi file, and other information.
+ */
+
+struct geom_info {
+ void (*geom_box) ARGS((struct geom_info *,
+ long, long, long, long));
+ void (*geom_special) ARGS((struct geom_info *, _Xconst char *));
+ jmp_buf done_env;
+ void *geom_data;
+};
+
+typedef void (*mouse_proc) ARGS((XEvent *));
+extern void null_mouse ARGS((XEvent *));
+
+EXTERN mouse_proc mouse_motion INIT(null_mouse);
+EXTERN mouse_proc mouse_release INIT(null_mouse);
+
+/* Used for source special lookup (forward search) and for window manager
+ delete protocol (toolkit only). */
+
+#if XAW
+EXTERN Atom atoms[5];
+#elif MOTIF
+EXTERN Atom atoms[4];
+#else
+EXTERN Atom atoms[3];
+#endif
+
+#define ATOM_XDVI_WINDOWS (atoms[0])
+#define ATOM_DVI_FILE (atoms[1])
+#define ATOM_SRC_GOTO (atoms[2])
+#if TOOLKIT
+#define XA_WM_DELETE_WINDOW (atoms[3])
+#endif
+#if XAW
+#define XA_WM_PROTOCOLS (atoms[4])
+#endif
+
+#ifdef SELFAUTO
+EXTERN _Xconst char *argv0; /* argv[0] */
+#endif
+
+#if PS
+
+extern struct psprocs {
+ void (*toggle) ARGS((void));
+ void (*destroy) ARGS((void));
+ void (*interrupt) ARGS((void));
+ void (*endpage) ARGS((void));
+ void (*drawbegin) ARGS((int, int, _Xconst char *));
+ void (*drawraw) ARGS((_Xconst char *));
+ void (*drawfile) ARGS((_Xconst char *, FILE *));
+ void (*drawend) ARGS((_Xconst char *));
+ void (*beginheader) ARGS((void));
+ void (*endheader) ARGS((void));
+ void (*newdoc) ARGS((void));
+} psp, no_ps_procs;
+
+#endif /* PS */
+
+/********************************
+ * Procedures *
+ *******************************/
+
+_XFUNCPROTOBEGIN
+
+extern int atopix ARGS((_Xconst char *, wide_bool));
+#if TOOLKIT
+extern Bool compile_action ARGS((_Xconst char *, struct xdvi_action **));
+#endif
+#if BUTTONS
+extern void create_buttons ARGS((void));
+#if XAW
+extern void set_button_panel_height ARGS((XtArgVal));
+#endif
+#endif /* BUTTONS */
+#if GREY
+extern void init_plane_masks ARGS((void));
+#endif
+#if COLOR
+extern Pixel alloc_color ARGS((_Xconst struct rgb *, Pixel));
+extern void do_color_change ARGS((void));
+#elif GREY
+extern void init_pix ARGS((void));
+#endif
+extern void expose ARGS((struct WindowRec *, int, int,
+ unsigned int, unsigned int));
+extern void home ARGS((wide_bool));
+extern void reconfig ARGS((void));
+#if TOOLKIT
+extern void handle_resize ARGS((Widget, XtPointer, XEvent *, Boolean *));
+extern void handle_expose ARGS((Widget, XtPointer, XEvent *, Boolean *));
+extern void handle_property_change ARGS((Widget, XtPointer, XEvent *,
+ Boolean *));
+#endif
+#if XAW
+extern void handle_messages ARGS((Widget, XtPointer, XEvent *, Boolean *));
+#elif MOTIF
+extern void handle_wm_delete ARGS((Widget, XtPointer, XtPointer));
+#endif
+extern void goto_page ARGS((int, home_proc));
+#if MOTIF
+extern void file_pulldown_callback ARGS((Widget, XtPointer, XtPointer));
+extern void navigate_pulldown_callback ARGS((Widget, XtPointer, XtPointer));
+extern void scale_pulldown_callback ARGS((Widget, XtPointer, XtPointer));
+extern void set_shrink_factor ARGS((int));
+extern void popdown_callback ARGS((Widget, XtPointer, XtPointer));
+#endif
+#if !TOOLKIT
+extern void showmessage ARGS((_Xconst char *));
+#endif
+extern void set_chld ARGS((struct xchild *));
+extern void clear_chld ARGS((struct xchild *));
+extern void set_io ARGS((struct xio *));
+extern void clear_io ARGS((struct xio *));
+extern void set_timer ARGS((struct xtimer *, int));
+extern void cancel_timer ARGS((struct xtimer *));
+extern unsigned int read_events ARGS((unsigned int));
+extern void enable_intr ARGS((void));
+extern void do_pages ARGS((void)) NORETURN;
+#if XAW
+extern void simple_popup ARGS((struct status_popup *, _Xconst char *,
+ XtCallbackProc));
+extern void simple_popdown ARGS((struct status_popup *));
+extern void do_popup ARGS((Widget));
+extern Widget warning_popup ARGS((_Xconst char *, _Xconst char *,
+ XtCallbackProc));
+extern Widget warning_popup_long VARGS((_Xconst char *, _Xconst char *,
+ XtCallbackProc, ...));
+extern void Act_print ARGS((Widget, XEvent *, String *, Cardinal *));
+extern void Act_open_dvi_file ARGS((Widget, XEvent *, String *,
+ Cardinal *));
+#elif MOTIF
+extern void simple_popup ARGS((struct status_popup *, _Xconst char *,
+ XtCallbackProc));
+extern void simple_popdown ARGS((struct status_popup *));
+extern void do_popup ARGS((Widget));
+extern Widget warning_popup ARGS((_Xconst char *, int, _Xconst char *,
+ XtCallbackProc));
+extern Widget warning_popup_long ARGS((_Xconst char *, int, _Xconst char *,
+ XtCallbackProc, ...));
+extern void Act_print ARGS((Widget, XEvent *, String *, Cardinal *));
+extern void Act_open_dvi_file ARGS((Widget, XEvent *, String *,
+ Cardinal *));
+#endif
+extern void reset_fonts ARGS((void));
+#if COLOR
+extern void reset_colors ARGS((void));
+extern void full_reset_colors ARGS((void));
+#endif
+extern void realloc_font ARGS((struct font *, wide_ubyte));
+extern void realloc_virtual_font ARGS((struct font *, wide_ubyte));
+extern Boolean load_font ARGS((struct font *));
+extern struct font *define_font ARGS((FILE *, wide_ubyte,
+ struct font *, struct font **, unsigned int,
+ struct tn **));
+extern void init_page ARGS((void));
+extern Boolean open_dvi_file ARGS((_Xconst char *));
+extern void form_dvi_property ARGS((ino_t));
+extern void init_dvi_file ARGS((void));
+extern void set_dvi_property ARGS((void));
+extern Boolean check_dvi_file ARGS((void));
+extern void reload_dvi_file ARGS((void));
+#ifndef TEXXET
+extern long set_char ARGS((wide_ubyte));
+extern long load_n_set_char ARGS((wide_ubyte));
+extern long set_vf_char ARGS((wide_ubyte));
+#else
+extern void set_char ARGS((wide_ubyte, wide_ubyte));
+extern void load_n_set_char ARGS((wide_ubyte, wide_ubyte));
+extern void set_vf_char ARGS((wide_ubyte, wide_ubyte));
+#endif
+extern void prescan ARGS((void));
+extern void draw_page ARGS((void));
+extern void source_reverse_search ARGS((int, int));
+extern void source_special_show ARGS((wide_bool));
+extern void source_forward_search ARGS((_Xconst char *));
+#if CFGFILE
+extern void readconfig ARGS((void));
+#endif
+extern void init_font_open ARGS((void));
+extern FILE *font_open ARGS((_Xconst char *, char **, double, int *, int,
+ char **));
+#if PS
+extern void ps_clear_cache ARGS((void));
+extern void ps_destroy ARGS((void));
+#endif
+extern void init_prescan ARGS((void));
+#if COLOR
+extern void scan_color_eop ARGS((void));
+extern void set_fg_color ARGS((_Xconst struct rgb *));
+#endif
+extern void applicationDoSpecial ARGS((char *));
+extern void scan_special ARGS((char *));
+extern void geom_do_special ARGS((struct geom_info *, char *, double));
+extern void xdvi_exit ARGS((int)) NORETURN;
+extern void oops VARGS((_Xconst char *, ...)) NORETURN;
+#ifndef KPATHSEA
+extern void *xmalloc ARGS((unsigned));
+extern void *xrealloc ARGS((void *, unsigned));
+extern char *xstrdup ARGS((_Xconst char *));
+extern char *xmemdup ARGS((_Xconst char *, size_t));
+#endif
+#if TOOLKIT && !HAVE_STRERROR && !defined strerror
+extern char *strerror ARGS((int));
+#endif
+extern void expandline ARGS((size_t));
+extern void alloc_bitmap ARGS((struct bitmap *));
+#ifndef KPATHSEA
+extern void xputenv ARGS((_Xconst char *, _Xconst char *));
+#endif
+extern int memicmp ARGS((_Xconst char *, _Xconst char *, size_t));
+extern FILE *xfopen ARGS((_Xconst char *, OPEN_MODE_ARGS));
+#if XAW
+extern int xopen ARGS((_Xconst char *, int));
+#endif
+extern int xpipe ARGS((int *));
+extern DIR *xopendir ARGS((_Xconst char *));
+extern _Xconst struct passwd *ff_getpw ARGS((_Xconst char **, _Xconst char *));
+extern unsigned long num ARGS((FILE *, int));
+extern long snum ARGS((FILE *, int));
+extern size_t property_get_data ARGS((Window, Atom, unsigned char **,
+ int (*x_get_property) (Display *, Window, Atom, long,
+ long, Bool, Atom, Atom *, int *, unsigned long *,
+ unsigned long *, unsigned char **)));
+#if PS
+extern int xdvi_temp_fd ARGS((char **));
+#endif
+extern void prep_fd ARGS((int, wide_bool));
+extern void read_PK_index ARGS((struct font *, wide_bool));
+extern void read_GF_index ARGS((struct font *, wide_bool));
+extern void read_VF_index ARGS((struct font *, wide_bool));
+
+#if PS
+extern void ps_init_paths ARGS((void));
+extern void drawbegin_none ARGS((int, int, _Xconst char *));
+extern void draw_bbox ARGS((void));
+extern void NullProc ARGS((void));
+#ifdef PS_DPS
+extern Boolean initDPS ARGS((void));
+#endif
+#ifdef PS_NEWS
+extern Boolean initNeWS ARGS((void));
+#endif
+#ifdef PS_GS
+extern Boolean initGS ARGS((void));
+extern void gs_resume_prescan ARGS((void));
+#endif
+#endif /* PS */
+
+_XFUNCPROTOEND
+
+#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 /* XDVI_H */