summaryrefslogtreecommitdiff
path: root/systems/unix
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-11-25 03:00:39 +0000
committerNorbert Preining <norbert@preining.info>2020-11-25 03:00:39 +0000
commit224d125bf0d14ba177ef8a181907a713484afa2f (patch)
treec7be3cf437ba902f6fd09520a329e373ed956ede /systems/unix
parent55c6d66f61a96ba63cd8c141229843ad2ab42632 (diff)
CTAN sync 202011250300
Diffstat (limited to 'systems/unix')
-rw-r--r--systems/unix/tex-fpc/MFT/iby/README26
-rw-r--r--systems/unix/tex-fpc/MFT/iby/agr.tex2
-rwxr-xr-x[-rw-r--r--]systems/unix/tex-fpc/MFT/iby/getiby8
-rwxr-xr-xsystems/unix/tex-fpc/MFT/iby/getlevy3
-rwxr-xr-xsystems/unix/tex-fpc/MFT/iby/ibymacros2
-rw-r--r--systems/unix/tex-fpc/MFT/iby/sappho.tex6
-rwxr-xr-xsystems/unix/tex-fpc/MFT/logmacfonts3
-rwxr-xr-xsystems/unix/tex-fpc/MFT/manfonts2
-rwxr-xr-xsystems/unix/tex-fpc/MFT/texwebfonts2
-rwxr-xr-x[-rw-r--r--]systems/unix/tex-fpc/MFT/webfonts0
-rw-r--r--systems/unix/tex-fpc/README288
-rw-r--r--systems/unix/tex-fpc/ch.ch/README19
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkchatty12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkdebug12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkini12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkprod12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkstats12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mktrap19
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mktrip11
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkunchatty12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkundebug12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkunstats12
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkuntrap17
-rwxr-xr-xsystems/unix/tex-fpc/ch.ch/mkuntrip8
-rw-r--r--systems/unix/tex-fpc/dvips/Makefile (renamed from systems/unix/tex-fpc/dvipsnk/Makefile)0
-rw-r--r--systems/unix/tex-fpc/dvips/README (renamed from systems/unix/tex-fpc/dvipsnk/README)0
-rw-r--r--systems/unix/tex-fpc/dvips/afm2tfm.c (renamed from systems/unix/tex-fpc/dvipsnk/afm2tfm.c)0
-rw-r--r--systems/unix/tex-fpc/dvips/dvipsmanfonts (renamed from systems/unix/tex-fpc/dvipsnk/dvipsmanfonts)0
-rw-r--r--systems/unix/tex-fpc/dvitype.ch297
-rw-r--r--systems/unix/tex-fpc/fpcbugs56
-rw-r--r--systems/unix/tex-fpc/gftopk.ch (renamed from systems/unix/tex-fpc/mfware/gftopk.ch)47
-rw-r--r--systems/unix/tex-fpc/gftype.ch184
-rw-r--r--systems/unix/tex-fpc/history99
-rw-r--r--systems/unix/tex-fpc/local.mf (renamed from systems/unix/tex-fpc/MFT/local.mf)0
-rw-r--r--systems/unix/tex-fpc/mf.ch (renamed from systems/unix/tex-fpc/mf/mf.ch)534
-rw-r--r--systems/unix/tex-fpc/mp/dvitomp.ch208
-rw-r--r--systems/unix/tex-fpc/mp/fig.mp11
-rw-r--r--systems/unix/tex-fpc/mp/fig.tex3
-rwxr-xr-xsystems/unix/tex-fpc/mp/mk_MP_dir2
-rw-r--r--systems/unix/tex-fpc/mp/mp.ch734
-rwxr-xr-xsystems/unix/tex-fpc/mp/mpx10
-rw-r--r--systems/unix/tex-fpc/mp/readme204
-rw-r--r--systems/unix/tex-fpc/pltotf.ch97
-rwxr-xr-xsystems/unix/tex-fpc/shell/MakeTeXPK (renamed from systems/unix/tex-fpc/dvipsnk/MakeTeXPK)0
-rwxr-xr-xsystems/unix/tex-fpc/shell/itgl3
-rwxr-xr-xsystems/unix/tex-fpc/shell/mkfont3
-rwxr-xr-xsystems/unix/tex-fpc/shell/mkpkfont3
-rwxr-xr-xsystems/unix/tex-fpc/shell/tgl3
-rw-r--r--systems/unix/tex-fpc/tangle.ch (renamed from systems/unix/tex-fpc/web/tangle.ch)119
-rw-r--r--systems/unix/tex-fpc/tangle.p (renamed from systems/unix/tex-fpc/web/tangle.p)445
-rw-r--r--systems/unix/tex-fpc/tech/gauss.tex (renamed from systems/unix/tex-fpc/tech/schlicht.tex)2
-rw-r--r--systems/unix/tex-fpc/tech/german.ed1
-rwxr-xr-xsystems/unix/tex-fpc/tech/mktech21
-rw-r--r--systems/unix/tex-fpc/tech/readme6
-rw-r--r--systems/unix/tex-fpc/tech/test.tex4
-rw-r--r--systems/unix/tex-fpc/tex-fpc.pdfbin571938 -> 610582 bytes
-rw-r--r--systems/unix/tex-fpc/tex.ch1425
-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/tftopl.ch112
-rw-r--r--systems/unix/tex-fpc/trap/diff_trap.fot10
-rw-r--r--systems/unix/tex-fpc/trap/diff_trap.log118
-rw-r--r--systems/unix/tex-fpc/trap/diff_trap.pl0
-rw-r--r--systems/unix/tex-fpc/trap/diff_trap.typ8
-rw-r--r--systems/unix/tex-fpc/trap/diff_trapin.log14
-rw-r--r--systems/unix/tex-fpc/trap/report59
-rw-r--r--systems/unix/tex-fpc/trip/diff_trip.fot4
-rw-r--r--systems/unix/tex-fpc/trip/diff_trip.log10
-rw-r--r--systems/unix/tex-fpc/trip/diff_trip.log30042
-rw-r--r--systems/unix/tex-fpc/trip/diff_trip.typ8
-rw-r--r--systems/unix/tex-fpc/trip/diff_tripin.log14
-rw-r--r--systems/unix/tex-fpc/trip/report69
-rw-r--r--systems/unix/tex-fpc/weave.ch (renamed from systems/unix/tex-fpc/web/weave.ch)89
-rw-r--r--systems/unix/tex-fpc/webmac-fpc.tex (renamed from systems/unix/tex-fpc/lib/webmac-fpc.tex)5
-rw-r--r--systems/unix/tex-fpc/xdvi/README35
-rw-r--r--systems/unix/tex-fpc/xdvi/Xdvi11
-rwxr-xr-xsystems/unix/tex-fpc/xdvi/config7
-rw-r--r--systems/unix/tex-fpc/xdvi/configdiff12
-rwxr-xr-xsystems/unix/tex-fpc/xdvi/macconfigure662
79 files changed, 5450 insertions, 3001 deletions
diff --git a/systems/unix/tex-fpc/MFT/iby/README b/systems/unix/tex-fpc/MFT/iby/README
index 802aae4137..190ce62dca 100644
--- a/systems/unix/tex-fpc/MFT/iby/README
+++ b/systems/unix/tex-fpc/MFT/iby/README
@@ -1,18 +1,21 @@
This directory contains files that help installing an ancient Greek
-font in TeX-GPC. The font includes a full set of diacritical marks,
+font in TeX-FPC. 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.
+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.
+Get the packages ibygrk and levy from CTAN:fonts/greek and unzip them
+in the MFT directory, so ibygrk and levy are siblings to iby.
+ftp ftp://tug.org/tex-archive/fonts/greek/levy.zip
+ftp ftp://tug.org/tex-archive/fonts/greek/ibygrk.zip
+
+Copy files from the levy and ibygrk directories into this directory,
+with the shell scripts 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
@@ -82,6 +85,15 @@ guillemets << >>
Look at test.tex and sappho.tex for examples.
+If you get messages like that
+ Font \ninegrk=fibr84 at 9.0pt not loaded: Not enough room left.
+you want to enlarge TeX's memory.
+Compile TeX with statistics turned on, set \tracingstats=1
+and observe the statistics at the end. Then you might change the
+constant in tex.p, compile with
+ fpc -Fasysutils,baseunix,unix tex.p
+and try with the bigger tex.
+
Installing the Type 1 fonts in teTeX3.0:
----------------------------------------
List the search directory with `kpsewhich -show-path=.pfb'
@@ -95,4 +107,6 @@ Finally I added the command line option `-u +iby' to dvips
in the dvipdf script.
Aug. 2008
+-
+Nov. 2020
Wolfgang Helbig
diff --git a/systems/unix/tex-fpc/MFT/iby/agr.tex b/systems/unix/tex-fpc/MFT/iby/agr.tex
index 038f6a94bd..c8828880a2 100644
--- a/systems/unix/tex-fpc/MFT/iby/agr.tex
+++ b/systems/unix/tex-fpc/MFT/iby/agr.tex
@@ -1,2 +1,2 @@
-\input ibycusps
+\input ibycus4
\setgreek10/12
diff --git a/systems/unix/tex-fpc/MFT/iby/getiby b/systems/unix/tex-fpc/MFT/iby/getiby
index 23f2b7724a..f5b92e8f6b 100644..100755
--- a/systems/unix/tex-fpc/MFT/iby/getiby
+++ b/systems/unix/tex-fpc/MFT/iby/getiby
@@ -6,12 +6,16 @@ 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
+digamma4.mf cigma4.mf wbary4.mf ibycus4.map
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
+ibycus4.tex iby4extr.tex
do cp -p $IBY/tex/generic/ibycus4/$f .
done
+
+for f in psibycus.tex iby4text.tex
+do cp -p $IBY/doc/generic/ibycus4/$f .
+done
diff --git a/systems/unix/tex-fpc/MFT/iby/getlevy b/systems/unix/tex-fpc/MFT/iby/getlevy
index 899e201492..69fc432f80 100755
--- a/systems/unix/tex-fpc/MFT/iby/getlevy
+++ b/systems/unix/tex-fpc/MFT/iby/getlevy
@@ -3,6 +3,7 @@ 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
+w.mf x.mf y.mf z.mf gen_sigma.mf grpunct.mf grbase.mf graccent.mf \
+gen_acc.mf
do cp -p $LEVY/$f .
done
diff --git a/systems/unix/tex-fpc/MFT/iby/ibymacros b/systems/unix/tex-fpc/MFT/iby/ibymacros
index fc64ea0f6e..3af54083e4 100755
--- a/systems/unix/tex-fpc/MFT/iby/ibymacros
+++ b/systems/unix/tex-fpc/MFT/iby/ibymacros
@@ -1,4 +1,4 @@
-# install tex macros for ibycus4 TeX-GPC
+# install tex macros for ibycus4 TeX-FPC
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
diff --git a/systems/unix/tex-fpc/MFT/iby/sappho.tex b/systems/unix/tex-fpc/MFT/iby/sappho.tex
index 861f5d682f..d097f819cc 100644
--- a/systems/unix/tex-fpc/MFT/iby/sappho.tex
+++ b/systems/unix/tex-fpc/MFT/iby/sappho.tex
@@ -1,7 +1,7 @@
% Ein Beispiel fuer die Benutzung des altgriechischen Fonts:
\hsize 4in
-\input ibycusps
-\setgreek10/12
+\input ibycus4
+\setgreek12/14
\GK
\obeylines
De'duke me`n a) sela'nna
@@ -18,7 +18,7 @@ ga=n e)pi` pai=san.
\medskip
-)'Espere, pa'nta fe'reis, o)'sa fai'nolis e)ske'das' Au)'ws;
+('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.
diff --git a/systems/unix/tex-fpc/MFT/logmacfonts b/systems/unix/tex-fpc/MFT/logmacfonts
new file mode 100755
index 0000000000..24c12db460
--- /dev/null
+++ b/systems/unix/tex-fpc/MFT/logmacfonts
@@ -0,0 +1,3 @@
+# fonts for logmac
+mkfont cmsltt9
+mkfont logosl9
diff --git a/systems/unix/tex-fpc/MFT/manfonts b/systems/unix/tex-fpc/MFT/manfonts
index e98538738b..ba37849e82 100755
--- a/systems/unix/tex-fpc/MFT/manfonts
+++ b/systems/unix/tex-fpc/MFT/manfonts
@@ -1,7 +1,9 @@
mkfont cmtex10
+mkfont cmssi9
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
+mkfont cmss9
diff --git a/systems/unix/tex-fpc/MFT/texwebfonts b/systems/unix/tex-fpc/MFT/texwebfonts
deleted file mode 100755
index 883b186bb1..0000000000
--- a/systems/unix/tex-fpc/MFT/texwebfonts
+++ /dev/null
@@ -1,2 +0,0 @@
-# font used tex.tex
-mkfont logo10 # font used for the METAFONT logo
diff --git a/systems/unix/tex-fpc/MFT/webfonts b/systems/unix/tex-fpc/MFT/webfonts
index 86676e2c70..86676e2c70 100644..100755
--- a/systems/unix/tex-fpc/MFT/webfonts
+++ b/systems/unix/tex-fpc/MFT/webfonts
diff --git a/systems/unix/tex-fpc/README b/systems/unix/tex-fpc/README
index 4d62296690..b227918699 100644
--- a/systems/unix/tex-fpc/README
+++ b/systems/unix/tex-fpc/README
@@ -1,35 +1,57 @@
-2019-03-04
+TeX-FPC, second edition, 2020-11-24
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.
+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 complete TeX system based on the Free Pascal
+Compiler (FPC), and running in any Unix environment.
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 file tex-fpc.pdf shows how and why TeX-FPC differs from the original.
+It was produced by two command lines:
+ $ wve tex.web tex.ch
+ $ dvipdf tex.dvi
-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.
+The MFT directory contains shell scripts to create fonts (xxxfonts).
+Its subdirectory iby shows how to add a font to TeX-FPC. In this
+case a polytonic Greek font, suited for ancient Greek texts.
-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
+The directories dvips and xdvi help to get, compile and install Tom
+Rokicki's dvips and Paul Vojta's xdvi.
+Likewise the directory mp for John Hobby's METAPOST.
+
+The directory tech demonstrates how to build a TeX system that
+supports the german language.
+
+And the ch.ch directory contains change files for change files.
+
+Requirements:
+============
+TeX-FPC is liberal in what it accepts:
+You will succeed with any flavor of the Unix operating system.
+In fact, I only used stuff from:
+ Kernighan, Pike: The Unix programming environment (1984)
+I have to admit, now and then I used vi instead of ed, the Unix Standard
+Editor.
+If it doesn't work on your system, it is not Unix, not even remotely so.
+
+Any version of (FPC) from 3.0.0 on will suffice. To compile TeX and
+METAFONT, three additional units are needed:
+SysUtils, BaseUnix, Unix
+They have to be specified on the command line:
+ $ fpc -Fasysutils,baseunix,unix
+
+To build the DVI-driver xdvi and dvips a C-compiler is necessary.
+To run xdvi, you need X-Window and to print your books, you either
+need a postscript printer or you use ghostscript to translate
+postscript to your printers language.
+
+Everything you need existed in the mid eighties of the last century.
+All the great books produced with TeX demonstrates how much can be
+done with how little.
Overview:
=========
@@ -39,7 +61,7 @@ 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
+.p Pascal source
.pool String pool, contains the string constants of a WEB program.
@@ -57,66 +79,84 @@ METAFONT files:
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.
+ contains the string pool (tex.pool) and fifty .tfm files.
.dvi device independent file, "TeX: The Program" (tex.web), part 31
.log a log file
-
+Dependencies of files and programs:
+File depends on
+---- ----------
+xxx xxx.p
+xxx.p xxx.web, xxx.ch
+tex.pool strings in tex.web or tex.ch
+plain.fmt plain.tex
+ .tfm files (cf. plain.log)
+ hyphen.tex
+ tex.pool
+mf.pool strings in mf.web or mf.ch
+plain.base plain.mf
+ local.mf
+ mf.pool
+
+Program depends on
+------- ----------
+initex TeXformats/tex.pool
+tex TeXformats/tex.fmt
+inimf MFbases/mf.pool
+mf MFbases/plain.base
Files and their processors:
--------------------------
WEB:
tangle
- .web, .ch --------> .p, .pool
+ x.web, x.ch --------> x.p, x.pool
fpc
x.p --------> x
tgl
- x.web, x.ch --------> x (linking the last two steps)
+ x.web, x.ch --------> x (combines the last two steps, no pool)
itgl
- x.web, x.ch --------> x, inix.p, .pool (links the first two steps
- and keeps the pascal sources)
+ x.web, x.ch --------> inix.p, inix, x.pool (like tgl, but with pool)
weave
- .web, .ch --------> .tex (Description of the program)
+ .web, .ch --------> .tex (description of the program)
wve
.web, .ch --------> .dvi (linking the above step and tex)
METAFONT:
- inimf
- plain.mf --------> plain.base
+ inimf
+ mf.pool, local.mf plain.mf --------> plain.base
- mf
- .mf --------> .nnngf, tfm
+ mf
+ plain.base, .mf --------> .nnngf, .tfm
- gftopk
- .nnngf --------> .nnnpk
+ gftopk
+ .nnngf --------> .nnnpk
- mkfont
- .mf --------> TeXfonts/.tfm, PKfonts/.nnnpk
+ mkfont
+ .mf --------> TeXfonts/.tfm, PKfonts/.nnnpk
- mkpkfont
- .mf --------> PKfonts/.nnnpk
+ mkpkfont
+ .mf --------> PKfonts/.nnnpk
TeX:
- initex
- .tfm, plain.tex --------> plain.fmt
-
- tex
- [ .tfm ], .tex --------> .dvi
+ initex
+ tex.pool, hyphen.tex, plain.tex, .tfm --------> plain.fmt
+ tex
+ plain.fmt, .tfm, .tex --------> .dvi
DVI drivers:
- dvips
- .dvi, .nnnpk --------> .ps, PostScript printer
+ dvips
+ .tfm, .nnnpk, .dvi --------> .ps, PostScript printer
- xdvi
- .dvi, .nnnpk --------> X-Window
+ xdvi
+ .tfm, .nnnpk, .dvi --------> X-Window
File names:
@@ -131,8 +171,8 @@ directory:
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:
+Create one set of "master directories" and used symbolic links
+to your working directory like:
ln -s ~/TeXformats .
@@ -142,23 +182,21 @@ 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)
+ .tex local directory and then TeXinputs
+ .mf local directory and then MFinputs
+ .tfm local directory and the TeXfonts
+ .fmt local directory and then TeXformats
+ plain.fmt hard coded (!) TeXformats/plain.fmt
+ .base local directory and MFbases
+ plain.base hard coded (!) MFbases/plain.base
+ .pool hard coded (!) in TeXformats, MFbases
+
+Depending on the context, TeX-FPC programs append ".mf", ".tex", ".fmt",
+".base" or ".tfm" to file names without extensions.
Fonts in TeX-FPC:
----------------
-For each font TeX needs one .tfm file. For each font and
+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
@@ -170,9 +208,9 @@ Running TeX-FPC
===============
Missing files
-------------
-Search missing macro files like (webmac.tex) in Knuth's lib
+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.
+The .ch 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
@@ -185,104 +223,121 @@ command line
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.
+If the generation of a font failed, the failing command is written
+to the file trouble in the working directory. You might want to fix the
+error and rerun the file trouble, (sh trouble).
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
---------------------------
+Printing the web-programs
+-------------------------
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
+and a xxx.ch 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.
+The web-macros need another font. Run MFT/webfonts to install it.
+And run MFT/mfwebfonts for mf.tex.
+The file tex-fpc.pdf provides the doc independent of an installed
+TeX system. It describes how I adopted TeX to FPC, the features and
+and differences of TeX-FPC.
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.
+Both tests are passed by TeX-FPC. See the trip and the trap directories..
-
-Installing TeX-FPC:
-===================
+Hints to build and install TeX-FPC from Knuth's sources.
+========================================================
Get Knuth's source files:
------------------------
-Make a stage directory, say tex-fpc, which mirrors Knuth's distribution
-from
-
+Get Knuth's distribution from
ftp://ftp.dante.de/pub/tex/systems/knuth/dist.zip
+At the DANTE server, passive ftp mode does not work. Try
+ tug.org/tex-archive/systems/knuth
+or ftp ftp.cs.stanford.edu/tex/dist
This gives you the WEB files, manuals, macros and some .mf files.
-At least you need the directories lib, tex, mfware, mf and web.
+At least you need the subdirectories 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/
+or ftp.cs.stanford.edu/tex/fonts/
to MFinputs.
-And Copy the .mf files from the lib directory 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.
+All path names are given relative to directories of Knuth's distribution.
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
+Pascal source with fpc. The command line
tgl xxx.web xxx.ch
will do all that. It produces xxx that you need to move to your binary
-directory.
+directory. Note tgl will not create xxx.pool, since this is only needed
+by the ini-versions that are to be built by itgl.
+
+METAFONT and TEX come in two versions: An initialization version
+(initex, inimf) and a production version (tex, mf). To build the
+initialization version, edit the change file to deactivate the change
+blocks marked by "ini", and use itgl. To build the production version,
+activate the change blocks marked by "ini" and use tgl.
+
+A change block is active, if each of the web commands @x, @y and
+@z are at the start of their lines, inactive if none of the web
+commands are at the start of their lines and defect otherwise.
+See webman.tex, section~11. for details on change files.
Step by step procedure to bootstrap TeX-FPC
-------------------------------------------
-Install Free Pascal Compiler from www.freepascal.org.
+Install the Free Pascal Compiler
+ https://freepascal.org/download.html
-Create the master directories (see above)
+Create the master directories (see above).
-copy the shell scripts from the tex-fpc/shell to your binary direcory.
+Copy the shell scripts from the tex-fpc/shell to your binary directory.
-0. Make tangle tangle.p --> tangle
-------------------------------------------------------------------------
+0. Compile 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.
-------------------------------------------------------------------------
+1. Make inimf and initex
+------------------------
+ mf.web, mf.ch --> inimf, inimf.p, mf.pool
+ ------------------------------------------
+
+ tex.web, tex.ch --> initex,initex.p tex.pool
+ --------------------------------------------
+
+Make sure, the ini-change blocks in mf.ch and tex.ch are deactivated.
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.
+Save tex.pool in TeXformats and mf.pool in MFbases, use itgl instead
+of tgl to keep inimf.p and initex.p and the .pool files.
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
+printer. Adapt local.mf to your printer and copy it to the mf directory.
+ inimf ../lib/plain input 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.
+Activate the the inimf-change block in mf.ch and build it with tgl.
4. Make gftopk gftopk.web, gftopk.ch --> gftopk
------------------------------------------------------------------------
@@ -291,13 +346,13 @@ 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.
+Prepare the stage directory 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
+Copy lib/hyphen.tex to TeXinputs and go to the directory tex
to build plain.fmt.
This command line will do
initex ../lib/plain \\dump # one backslash is consumend by sh!
@@ -305,12 +360,9 @@ Move plain.fmt to TeXformats.
7. Finally build tex tex.web, tex.ch --> tex
------------------------------------------------------------------------
-Change tex.ch for production, and build it with tgl.
+Activate the initex-change block in tex.ch and build it with tgl.
-Enjoy,
-Wolfgang Helbig, Programmierer
+Happy weaving and happy type setting with your system!
+Wolfgang Helbig,
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/ch.ch/README b/systems/unix/tex-fpc/ch.ch/README
new file mode 100644
index 0000000000..9128823308
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/README
@@ -0,0 +1,19 @@
+These shell scripts invoke ed on .ch files to change change files.
+
+The first line of a change block must start with @x <theme>. All
+lines of a deactivated change block must start with a tab, i.e.
+"shifted right."
+
+Under these preconditions, e.g. the script mkinitex deactivates the block
+marked by @x initex and the script mkprodtex activates the same
+block.
+
+The mk* scripts print the changed lines.
+
+Some ch.ch files, like mkchatty, take one optional parameter.
+"mkchatty" or "mkchatty tex" change tex.ch and "mkchatty mf" changes mf.ch.
+
+These commands are idempotent. Applying twice a change script has
+the same effect as applying it once.
+
+Cf. section 11 of webman.tex for the format of change files.
diff --git a/systems/unix/tex-fpc/ch.ch/mkchatty b/systems/unix/tex-fpc/ch.ch/mkchatty
new file mode 100755
index 0000000000..177baf83e9
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkchatty
@@ -0,0 +1,12 @@
+# deactivate chatty blocks. These blocks make tex/mf less chatty.
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^@x chatty/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 $1 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkdebug b/systems/unix/tex-fpc/ch.ch/mkdebug
new file mode 100755
index 0000000000..8402cb7d92
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkdebug
@@ -0,0 +1,12 @@
+# activate debug block to turn debugging on. Takes mf parameter.
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^ @x debug/.,/^ @z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 $1 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkini b/systems/unix/tex-fpc/ch.ch/mkini
new file mode 100755
index 0000000000..91f7862502
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkini
@@ -0,0 +1,12 @@
+# deactivate initex block to make initex or inimf to make inimf
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^@x ini/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 failed; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkprod b/systems/unix/tex-fpc/ch.ch/mkprod
new file mode 100755
index 0000000000..79a4180be4
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkprod
@@ -0,0 +1,12 @@
+# activate ini block to make prod
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^ @x ini/.,/^ @z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 failed; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkstats b/systems/unix/tex-fpc/ch.ch/mkstats
new file mode 100755
index 0000000000..f2a81c00a3
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkstats
@@ -0,0 +1,12 @@
+# activate stats blocks to turn statistics on
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^ @x stat/.,/^ @z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 $1 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mktrap b/systems/unix/tex-fpc/ch.ch/mktrap
new file mode 100755
index 0000000000..dc3b8e7a72
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mktrap
@@ -0,0 +1,19 @@
+# change change blocks to prepare the trap test
+mkini mf \
+&& mkstats mf\
+&& mkdebug mf\
+&& mkchatty mf\
+&& ed mf.ch <<'END'
+g/^ @x trap/.,/^@z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 \
+&& ed mf.ch <<'END'
+g/^@x part/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mktrip b/systems/unix/tex-fpc/ch.ch/mktrip
new file mode 100755
index 0000000000..b8a8e46d5a
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mktrip
@@ -0,0 +1,11 @@
+# change change blocks to prepare the trip test
+mkini\
+&& mkstats\
+&& mkchatty\
+&& ed tex.ch <<'END'
+g/^ @x trip/.,/^@z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 failed; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkunchatty b/systems/unix/tex-fpc/ch.ch/mkunchatty
new file mode 100755
index 0000000000..64025dacda
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkunchatty
@@ -0,0 +1,12 @@
+# activate chatty blocks
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^ @x chatty/.,/^ @z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 || (echo failed; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkundebug b/systems/unix/tex-fpc/ch.ch/mkundebug
new file mode 100755
index 0000000000..f0f6c7655e
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkundebug
@@ -0,0 +1,12 @@
+# deactivate debug block to turn debugging off.
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^@x debug/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 $1 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkunstats b/systems/unix/tex-fpc/ch.ch/mkunstats
new file mode 100755
index 0000000000..6021be7bef
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkunstats
@@ -0,0 +1,12 @@
+# deactivate stats blocks in tex.ch or in mf.ch to turn statistic off.
+case $# in
+1) tm=$1 ;;
+*) tm=tex ;;
+esac
+ed $tm.ch <<'END'
+g/^@x stat/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 $1 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkuntrap b/systems/unix/tex-fpc/ch.ch/mkuntrap
new file mode 100755
index 0000000000..926b9663c2
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkuntrap
@@ -0,0 +1,17 @@
+# undo some changes made for the trap test
+# deactivate trap blocks
+ed mf.ch <<'END'
+g/^@x trap/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+# activate part blocks
+test $? = 0 \
+&& ed mf.ch <<'END'
+g/^ @x part/.,/^ @z/s/^ //\
+?^@x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 failed ; exit 1)
diff --git a/systems/unix/tex-fpc/ch.ch/mkuntrip b/systems/unix/tex-fpc/ch.ch/mkuntrip
new file mode 100755
index 0000000000..3e849c9b1c
--- /dev/null
+++ b/systems/unix/tex-fpc/ch.ch/mkuntrip
@@ -0,0 +1,8 @@
+# undo the changes made for trip
+ed tex.ch <<'END'
+g/^@x trip/.,/^@z/s/^/ /\
+?^ @x?,.p
+w
+q
+END
+test $? = 0 || (echo $0 failed; exit 1)
diff --git a/systems/unix/tex-fpc/dvipsnk/Makefile b/systems/unix/tex-fpc/dvips/Makefile
index cbdf300d17..cbdf300d17 100644
--- a/systems/unix/tex-fpc/dvipsnk/Makefile
+++ b/systems/unix/tex-fpc/dvips/Makefile
diff --git a/systems/unix/tex-fpc/dvipsnk/README b/systems/unix/tex-fpc/dvips/README
index 06119ad5e1..06119ad5e1 100644
--- a/systems/unix/tex-fpc/dvipsnk/README
+++ b/systems/unix/tex-fpc/dvips/README
diff --git a/systems/unix/tex-fpc/dvipsnk/afm2tfm.c b/systems/unix/tex-fpc/dvips/afm2tfm.c
index 7be24734a3..7be24734a3 100644
--- a/systems/unix/tex-fpc/dvipsnk/afm2tfm.c
+++ b/systems/unix/tex-fpc/dvips/afm2tfm.c
diff --git a/systems/unix/tex-fpc/dvipsnk/dvipsmanfonts b/systems/unix/tex-fpc/dvips/dvipsmanfonts
index aa55b0d360..aa55b0d360 100644
--- a/systems/unix/tex-fpc/dvipsnk/dvipsmanfonts
+++ b/systems/unix/tex-fpc/dvips/dvipsmanfonts
diff --git a/systems/unix/tex-fpc/dvitype.ch b/systems/unix/tex-fpc/dvitype.ch
new file mode 100644
index 0000000000..7216ae63e0
--- /dev/null
+++ b/systems/unix/tex-fpc/dvitype.ch
@@ -0,0 +1,297 @@
+This is a change file of DVItype for FPC, Wolfgang Helbig, Oct. 2020
+
+[0] About DVItype-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+
+% \let\maybe=\iftrue % uncomment to print changed modules only.
+
+\def\name{\tt DVItype}
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{DVItype} to the Free Pascal
+Compiler and Unix.
+
+\namefpc\ expects the name of the input file (\.{.dvi}) as the first
+and the name of the output file (\.{.typ} as the second parameter
+on the command line.
+
+\hint
+
+Comments and questions are welcome!
+
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is DVItype, Version 3.6' {printed when the program starts}
+@y
+@d banner=='This is DVItype-FPC, 2nd ed.' {printed when the program starts}
+@z
+
+[2] othercases
+@x
+@d othercases == others: {default for cases not listed explicitly}
+@y
+@d othercases == @+ else {default for cases not listed explicitly}
+@z
+
+[3] filenames from commandline
+@x
+@d print(#)==write(#)
+@d print_ln(#)==write_ln(#)
+
+@p program DVI_type(@!dvi_file,@!output);
+@y
+@d print(#)==write(typ_file, #)
+@d print_ln(#)==write_ln(typ_file, #)
+
+@p @{$MODE@,ISO@}
+@/
+@{$Q+@}
+@/
+@{$R+@}
+@/
+@{$I+@}
+@#
+program DVI_type(@!input, @!output);
+@z
+
+[9] text file.
+@x
+@!text_file=packed file of text_char;
+@y
+@!text_file=text;
+@z
+
+[22] check io_result.
+@x
+@!dvi_file:byte_file; {the stuff we are \.{DVI}typing}
+@!tfm_file:byte_file; {a font metric file}
+@y
+@!dvi_file:byte_file; {the stuff we are \.{DVI}typing}
+@!tfm_file:byte_file; {a font metric file}
+@!tfm_open:boolean; {tfm file is open}
+@!typ_file: text; {output file}
+@z
+
+[23] open dvi file
+@x
+begin reset(dvi_file);
+@y
+begin assign(dvi_file, param_str(1));
+@#
+@{$I-@}
+@#
+io_result; reset(dvi_file);
+if io_result <> 0 then begin
+ write_ln('Could not open dvi file: ', param_str(1));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
+@z
+
+[23] open tfm file
+@x
+procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|}
+begin reset(tfm_file,cur_name);
+end;
+@y
+procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|}
+begin
+io_result; assign(tfm_file, cur_name);
+@#
+@{$I-@}
+@#
+reset(tfm_file);
+tfm_open := io_result = 0;
+if not tfm_open then write_ln(cur_name, ' failed to open');
+end;
+@#
+procedure open_typ_file;
+begin
+if paramcount <> 2 then begin
+ write_ln('Usage: ', param_str(0), ' dvi_file typ_file');
+ halt(1);
+ end;
+io_result; assign(typ_file, param_str(2)); rewrite(typ_file);
+if io_result <> 0 then begin
+ write_ln('Could not open type file: ', param_str(2));
+ halt(1);
+ end;
+end;
+@#
+@{$I+@}
+@#
+@z
+
+[24] cur_name is shortstring;
+@x
+@!cur_name:packed array[1..name_length] of char; {external name,
+@y
+@!cur_name: shortstring; {external name,
+@z
+
+
+[25] random file access
+@x
+@p function dvi_length:integer;
+begin set_pos(dvi_file,-1); dvi_length:=cur_pos(dvi_file);
+end;
+@#
+procedure move_to_byte(n:integer);
+begin set_pos(dvi_file,n); cur_loc:=n;
+end;
+@y
+@p function dvi_length:integer;
+begin dvi_length:=file_size(dvi_file);
+end;
+@#
+procedure move_to_byte(n:integer);
+begin seek(dvi_file,n); cur_loc:=n;
+end;
+@z
+
+[43] options
+ @x
+ out_mode:=the_works; max_pages:=1000000; start_vals:=0; start_there[0]:=false;
+ @y
+ out_mode:=2; max_pages:=1000000; start_vals:=9;
+ for i := 0 to 9 do start_there[i] := false;
+ @z
+
+[45] standard io files
+@x
+and |term_out| for terminal output.
+@^system dependencies@>
+
+@<Glob...@>=
+@!buffer:array[0..terminal_line_length] of ASCII_code;
+@!term_in:text_file; {the terminal, considered as an input file}
+@!term_out:text_file; {the terminal, considered as an output file}
+@y
+and |term_out| for terminal output.
+@^system dependencies@>
+@d term_in == input
+@d term_out == output
+@<Glob...@>=
+@!buffer:array[0..terminal_line_length] of ASCII_code;
+@z
+
+[46] no break known to fpc
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@y
+@d update_terminal == {empty the terminal output buffer}
+@z
+
+[47] input_ln
+@x
+@p procedure input_ln; {inputs a line from the terminal}
+var k:0..terminal_line_length;
+begin update_terminal; reset(term_in);
+if eoln(term_in) then read_ln(term_in);
+k:=0;
+while (k<terminal_line_length)and not eoln(term_in) do
+ begin buffer[k]:=xord[term_in^]; incr(k); get(term_in);
+ end;
+buffer[k]:=" ";
+end;
+@y
+@p procedure input_ln; {inputs a line from the terminal}
+var k:0..terminal_line_length;
+begin
+k:=0;
+while (k<terminal_line_length) and not eoln do
+ begin buffer[k]:=xord[input^]; incr(k); get(input);
+ end;
+readln;
+buffer[k]:=" ";
+end;
+@z
+
+[62] check if tfm file open.
+@x
+if eof(tfm_file) then
+@y
+if not tfm_open then
+@z
+
+[64] default directory
+@x
+@d default_directory_name=='TeXfonts:' {change this to the correct name}
+@y
+@d default_directory_name=='TeXfonts/' {change this to the correct name}
+@z
+
+[66] lower case letters in Unix
+@x
+for k:=1 to name_length do cur_name[k]:=' ';
+if p=0 then
+ begin for k:=1 to default_directory_name_length do
+ cur_name[k]:=default_directory[k];
+ r:=default_directory_name_length;
+ end
+else r:=0;
+for k:=font_name[nf] to font_name[nf+1]-1 do
+ begin incr(r);
+ if r+4>name_length then
+ abort('DVItype capacity exceeded (max font name length=',
+ name_length:1,')!');
+@.DVItype capacity exceeded...@>
+ if (names[k]>="a")and(names[k]<="z") then
+ cur_name[r]:=xchr[names[k]-@'40]
+ else cur_name[r]:=xchr[names[k]];
+ end;
+cur_name[r+1]:='.'; cur_name[r+2]:='T'; cur_name[r+3]:='F'; cur_name[r+4]:='M'
+@y
+setlength(cur_name, 255);
+if p=0 then
+ begin for k:=1 to default_directory_name_length do
+ cur_name[k]:=default_directory[k];
+ r:=default_directory_name_length;
+ end
+else r:=0;
+for k:=font_name[nf] to font_name[nf+1]-1 do
+ begin incr(r);
+ if r+4>name_length then
+ abort('DVItype capacity exceeded (max font name length=',
+ name_length:1,')!');
+@.DVItype capacity exceeded...@>
+ cur_name[r]:=xchr[names[k]];
+ end;
+cur_name[r+1]:='.'; cur_name[r+2]:='t'; cur_name[r+3]:='f'; cur_name[r+4]:='m'
+;setlength(cur_name, r+4)
+@z
+
+
+[105] premature eof on tfm file
+@x
+while (m=223)and not eof(dvi_file) do m:=get_byte;
+@y
+while (m=223)and not eof(dvi_file) do m:=get_byte;
+inc(cur_loc); {FPC-BUG: eof off by one}
+@z
+[107] open typ file
+@x
+@p begin initialize; {get all variables initialized}
+@y
+@p begin open_typ_file; {initialze prints banner on typ file}
+initialize; {get all variables initialized}
+@z
+
+[107 close type file
+@x
+final_end:end.
+@y
+close(typ_file);
+final_end:end.
+@z
+
diff --git a/systems/unix/tex-fpc/fpcbugs b/systems/unix/tex-fpc/fpcbugs
new file mode 100644
index 0000000000..58162f5678
--- /dev/null
+++ b/systems/unix/tex-fpc/fpcbugs
@@ -0,0 +1,56 @@
+1. for a=4095, b=4096, of subtype [0..65535] (halfword in TeX) fpc
+cannot compile a+b-8192: Can't determine which overloaded function
+to call
+
+2. To fix, I changed the expression to abs(int(a+b-8192)). But
+instead of -1 it evaluates to 1.8e+19 With this bug, the first
+edition of TeX-FPC was distributed. Sorry. In preparation of the
+second edition, I turned on overflow checking. And, this deteced
+the error in mf. Which I fixed then.
+
+3. The program
+{$MODE ISO}
+program p (output);
+var f: file of char;
+begin
+ rewrite(f);
+ f^ := 'a';
+ put(f);
+ reset(f);
+ while not eof(f) do
+ begin
+ writeln(f^); get(f)
+ end;
+end.
+prints nothing when compiled with 3.0.4 and produces a runtime error
+when compiled with 3.2.0:
+a
+Runtime error 100 at $000000010124C479
+ $000000010124C479
+
+3.0.4 eof is true, if the file position is set at the last item of
+the file.
+
+3.2.0 eof is true, if the file position is set past the end of file,
+which complies to Pascal.
+
+4. 3.2.0 reports a run time error 100, which means disk error, when
+get is called at the last item, which does not comply to Pascal.
+
+BTW. I detected no errors of the GNU Pascal Compiler.
+
+5. Text files will be flushed automatically.
+But only, if their name occurs in the program header.
+
+6. Files will be assigned to external files from the command line
+if their name occurs in the program header.
+But only for text files.
+
+The last two half baked features let FPC compile the compiler and
+interpreter of the Pascal-p5 system, which claims to be ISO-Pascal,
+since pcom, pint use only text files whose names appear in the
+program header.
+
+TeX-FPC does not depend on one of the last to features, i. e.
+TeX-FPC's programs flush (or close) text-files always and assign
+external file names always, since it is simply easier to code.
diff --git a/systems/unix/tex-fpc/mfware/gftopk.ch b/systems/unix/tex-fpc/gftopk.ch
index ed7f0feaa2..2732b87db7 100644
--- a/systems/unix/tex-fpc/mfware/gftopk.ch
+++ b/systems/unix/tex-fpc/gftopk.ch
@@ -1,21 +1,19 @@
-This is a change file of GFtoPK for FPC, Wolfgang Helbig, Apr. 2008
-To be used with the GNU Pascal Compiler Version 2.1
+This is a change file of GFtoPK for FPC, Wolfgang Helbig, Oct. 2020
[0] About GFtoPK-FPC
@x
\pageno=\contentspagenumber \advance\pageno by 1
@y
-\pageno=\contentspagenumber \advance\pageno by 1
+\pageno=1 \advance\pageno by 1
\input webmac-fpc
-% \let\maybe=\iffalse % uncomment to print changed modules only.
+% \let\maybe=\iffalse % true: print all modules, false: print changed modules
\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
+This is an adaption of Tomas Rokicki's \.{GFtoPK} to Unix and the
+Free Pascal Compiler~(FPC).
\namefpc\ expects the input file (\.{.gf}) and the output file
(\.{.pk}) on the command line.
@@ -34,7 +32,7 @@ Comments and questions are welcome!
@x
@d banner=='This is GFtoPK, Version 2.4' {printed when the program starts}
@y
-@d banner=='This is GFtoPK-FPC'
+@d banner=='This is GFtoPK-FPC, 2nd ed.'
{printed when the program starts}
@z
@@ -49,7 +47,11 @@ Comments and questions are welcome!
@x
@p program GFtoPK(@!gf_file,@!pk_file,@!output);
@y
-@p@{@&$M@&O@&D@&E D@&E@&L@&P@&H@&I@}
+@p@{$MODE@,DELPHI@} {ISO Mode fails with random I/O}
+@/
+@{$Q+@}
+@/
+@{$R+@}
program GFtoPK(@!output);
@z
@@ -70,23 +72,44 @@ begin halt(history);
[39] get gf file name from command line
@x
+@p procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
begin reset(gf_file);
+gf_loc := 0 ;
+end;
@y
-begin assign(gf_file, param_str(1)); reset(gf_file);
+@p procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
+begin assign(gf_file, param_str(1)); ioresult;
+@{$I-@}
+reset(gf_file);
+@{$I+@}
+if ioresult <> 0 then abort('Could not open ', param_str(1));
+gf_loc := 0 ;
+end;
@z
[40] get pk file name from command line
@x
+@p procedure open_pk_file; {prepares to write packed bytes in |pk_file|}
begin rewrite(pk_file);
+pk_loc := 0 ; pk_open := true ;
+end;
@y
-begin assign(pk_file, param_str(2)); rewrite(pk_file);
+@p procedure open_pk_file; {prepares to write packed bytes in |pk_file|}
+begin assign(pk_file, param_str(2)); ioresult;
+@{$I-@}
+rewrite(pk_file);
+@{$I+@}
+if ioresult <> 0 then
+ abort('Could not open ', param_str(2));
+pk_loc := 0 ; pk_open := true ;
+end;
@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);
+ gf_len := file_size(gf_file)-1; seek(gf_file, gf_len);
@z
@x
diff --git a/systems/unix/tex-fpc/gftype.ch b/systems/unix/tex-fpc/gftype.ch
new file mode 100644
index 0000000000..216f9b653e
--- /dev/null
+++ b/systems/unix/tex-fpc/gftype.ch
@@ -0,0 +1,184 @@
+This is a change file of GFtype for FPC, Wolfgang Helbig, Oct. 2020
+To be used with the Free Pascal Compiler
+
+[0] About type-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+
+% \let\maybe=\iftrue % uncomment to print changed modules only.
+
+\def\name{\tt GFtype}
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{GFtype}, to Unix.
+\namefpc\ is based on Free~Pascal.
+
+\namefpc\ expects the name of the input file (\.{.gf}) as the first
+and the name of the output file (\.{.typ} as the second parameter
+on the command line.
+
+\hint
+
+Comments and questions are welcome!
+
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is GFtype, Version 3.1' {printed when the program starts}
+@y
+@d banner=='This is GFtype-FPC, 2nd ed.' {printed when the program starts}
+@z
+
+[2] othercases
+@x
+@d othercases == others: {default for cases not listed explicitly}
+@y
+@d othercases == @+ else {default for cases not listed explicitly}
+@z
+
+[3] filenames from commandline
+@x
+@d print(#)==write(#)
+@d print_ln(#)==write_ln(#)
+@d print_nl==write_ln
+
+@p program GF_type(@!gf_file,@!output);
+@y
+@d print(#)==write(typ_file, #)
+@d print_ln(#)==write_ln(typ_file, #)
+@d print_nl==write_ln(typ_file)
+
+@p @{$MODE@,ISO@}
+@/
+@{$Q+@}
+@/
+@{$R+@}
+@/
+@{$I+@}
+@#
+program GF_type(@!input, @!output);
+@z
+
+[9] text file.
+@x
+@!text_file=packed file of text_char;
+@y
+@!text_file=text;
+@z
+
+[21] declare typ file
+@x
+@!gf_file:byte_file; {the stuff we are \.{GF}typing}
+@y
+@!gf_file:byte_file; {the stuff we are \.{GF}typing}
+@!typ_file: text; { output file }
+@z
+
+[22] open gf file
+@x
+begin reset(gf_file);
+@y
+begin assign(gf_file, param_str(1));
+@#
+@{$I-@}
+@#
+ioresult; reset(gf_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open gf file: ', param_str(1));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
+@z
+
+[27] standard io files
+@x
+and |term_out| for terminal output.
+@^system dependencies@>
+
+@<Glob...@>=
+@!buffer:array[0..terminal_line_length] of ASCII_code;
+@!term_in:text_file; {the terminal, considered as an input file}
+@!term_out:text_file; {the terminal, considered as an output file}
+@y
+and |term_out| for terminal output.
+@^system dependencies@>
+@d term_in == input
+@d term_out == output
+@<Glob...@>=
+@!buffer:array[0..terminal_line_length] of ASCII_code;
+@z
+
+[28] no break known to fpc
+@x
+@d update_terminal == break(term_out) {empty the terminal output buffer}
+@y
+@d update_terminal == {empty the terminal output buffer}
+@z
+
+[29] input_ln
+@x
+@p procedure input_ln; {inputs a line from the terminal}
+var k:0..terminal_line_length;
+begin update_terminal; reset(term_in);
+if eoln(term_in) then read_ln(term_in);
+k:=0;
+while (k<terminal_line_length)and not eoln(term_in) do
+ begin buffer[k]:=xord[term_in^]; incr(k); get(term_in);
+ end;
+buffer[k]:=" ";
+end;
+@y
+@p procedure input_ln; {inputs a line from the terminal}
+var k:0..terminal_line_length;
+begin
+k:=0;
+while (k<terminal_line_length) and not eoln do
+ begin buffer[k]:=xord[input^]; incr(k); get(input);
+ end;
+readln;
+buffer[k]:=" ";
+end;
+@z
+
+[66] open typ file
+@x
+@p begin initialize; {get all variables initialized}
+@y
+@p begin
+if paramcount <> 2 then begin
+ write_ln('Usage: ', param_str(0), ' gf_file typ_file');
+ halt(1);
+ end;
+
+assign(typ_file, param_str(2));
+@#
+@{$I-@}
+@#
+ioresult; rewrite(typ_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open type file: ', param_str(2));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
+initialize; {get all variables initialized}
+@z
+
+[66] terminate last line in typ file
+@x
+final_end:end.
+@y
+print_nl;
+close(typ_file);
+final_end:end.
+@z
+
diff --git a/systems/unix/tex-fpc/history b/systems/unix/tex-fpc/history
new file mode 100644
index 0000000000..45b9840773
--- /dev/null
+++ b/systems/unix/tex-fpc/history
@@ -0,0 +1,99 @@
+2008-07-21: Change files for tex and friends, shell scripts to build
+ a Pascal only implementation of TeX.
+
+ TeX-bugs fixed:
+ (1) TeX warns you about an underful box if the last line
+ of Paragraph contains discardables only. I discovered
+ this bug while trying to prove the line breaking code.
+ I reported to Mrs. Beeton. But the checkers didn't seem
+ to understand my request. They replied: An empty box
+ triggers the underful box warning as designed.
+ But this is not, what I questioned. But I do question,
+ that TeX leaves an empty box as the last line of a
+ paragraph. At least it should contain the \parfilskip
+ glue. Well, I fixed it by protecting \parfilskip from
+ being discarded. By the way, this is one of those bugs
+ you won't find by testing.
+
+ (2) TeX flushes now and then extension and area of input
+ file names. Igor Liferenko reported this bug on
+ 2020-10-29, more than twelve years later.
+
+2008-09-07: MetaPost, dvips, xdvi, polytonic greek fonts added.
+ Less than two month suffice for TeX-GPC to grow autonomous:
+ To typeset, preview and print technical papers containing
+ figures is all covered by the components of TeX-GPC.
+
+ Btw., this turned out to be important for me. The latest
+ Mac OS version running on my 2009 imac is OS X 11.
+ MacTeX 2020 runs on 10.15 or newer.
+
+ TeX-GPC does buffered write for the dvi file. This
+ triples the speed. To process tex.tex web2c needed
+ 7.54s, TeX-FPC 11.40s. Speed is important for the
+ preview-edit cycle.
+
+2010-03-16: The 2nd edition builds and runs on Mac OS 10.2, it includes
+ a directory "tech" that shows how to construct tex with
+ the German hyphenation table and the package german
+ style from Bernd Raichle. Now TeX-GPC contains everything
+ you need to typeset, preview, and print German books,
+ as I did! (Helbig: Analysis 0, Ein logischer Einstieg
+ in die Analysis). When Germans write the word they hear
+ when Knuth says "TeX" they write "tech".
+
+ Now TeX-GPC is compatible to newer versions of GPC as
+ suggested by Martin Monperrus. Louis Rivera kindly
+ reported some problems relating to different versions
+ of the compiler.
+
+ Joachim Kuebart reported: If the first input line
+ contains spaces only, TeX-GPC might loop. In fact TeX-GPC
+ will not loop since it accidently exploits the fact,
+ that the memory is zeroed out when initialized by Unix.
+ But nevertheless it is a bug.
+
+2010-05-26: 2nd edition, first fix: tangle.p forgotten.
+ Aside from tangle.p the same as above.
+
+2014-06-29: 3rd edition, based on Knuth's dististribution from
+ Jan. 2014. The change files of this edition are to be
+ applied to TeX version 3.14159265, MF version 2.7182818.
+
+2015-09-30: Update to macOS 10.11 broke GPC and therefore TeX-GPC
+ as well. Helpless, sad, hoping for a revival of GPC.
+
+2019-02-22: Emergency edition of TeX-FPC. Date fixed at 1776-07-14.
+
+2019-03-04: same as above, fixing three bugs, all reported by Joachim.
+ The shell script tgl tried to launch good old GPC. An
+ extra space in tex.ch corrupted the change file. In
+ tex.ch a '\marke G' still waits to be replaced by '\marke X'.
+
+now: 2nd. edition. All features recreated! Finally arrived the state
+ of 2008-09-07. Exhausted but happy!
+
+ Igor Liferenko reported another bug in TeX: An extra space
+ is printed in the log file and the last line is not terminated
+ when the user switched to \batchmode during error recovery.
+ TeX-FPC fixes both noisances.
+
+ Realizing that TeX-FPC is the only pure Pascal distribution,
+ I decided that my personal preferences are not worthwhile
+ to clutter up TeX-FPC, since I can reinstall them
+ whenever I want them. My wishes are: Don't ignore tailing
+ spaces of input lines, don't ignore leading spaces of
+ the first input line. Don't print extra empty lines on
+ the terminal, when entering a file interactively. These
+ regressions leads us back to IBM's fixed length records
+ and punching cards, when the user could not control the
+ length of a line or a punching card.
+
+future: Bugs that remain to be fixed:
+ This one-liner loops:
+ \def\par{\endgroup\par} \def\a#1{#1} \a\par
+
+ Whatever you enter during error recovery, you cannot convince
+ TeX to forgive your faux pas and continue processing the rest
+ of the file.
+
diff --git a/systems/unix/tex-fpc/MFT/local.mf b/systems/unix/tex-fpc/local.mf
index 491430d781..491430d781 100644
--- a/systems/unix/tex-fpc/MFT/local.mf
+++ b/systems/unix/tex-fpc/local.mf
diff --git a/systems/unix/tex-fpc/mf/mf.ch b/systems/unix/tex-fpc/mf.ch
index 33f19ab49b..0b697ec3da 100644
--- a/systems/unix/tex-fpc/mf/mf.ch
+++ b/systems/unix/tex-fpc/mf.ch
@@ -7,20 +7,24 @@
\input webmac-fpc
\emergencystretch 0.5in % avoid overfull boxes
-\let\maybe=\iffalse % print changed modules only.
+\let\maybe=\iftrue % 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.
+from January 2014, to Free~Pascal (FPC) and Unix.
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.
+The changes needed to make \namefpc\ compile and run to my satisfaction
+are very similar to those applied to \TeXfpc. Look in tex.tex for
+a thorough description of adaptions to Unix, FPC, and my taste.
+
\hint
Comments and questions are welcome!
@@ -34,7 +38,7 @@ Comments and questions are welcome!
@x
@d banner=='This is METAFONT, Version 2.7182818' {printed when \MF\ starts}
@y
-@d banner=='This is METAFONT-FPC' {printed when \MF\ starts}
+@d banner=='This is METAFONT-FPC, 2nd ed.' {printed when \MF\ starts}
@z
[4] terminal output and input
@@ -58,47 +62,57 @@ program MF(@!term_in,@!term_out);
{all other file names are defined dynamically}
@z
+[4] forward declaration for signal handler
+@x
+procedure initialize; {this procedure gets things started properly}
+@y
+procedure catch_signal(i: integer); interrupt; forward;
+procedure initialize; {this procedure gets things started properly}
+@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
+ @x debug
+ @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
+ @x stat
+ @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
+ [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@}
+@{$MODE@,ISO@} {turn on mode ISO}
+@{$Q+@} {turn on overflow checking}
+@{$R+@} {turn on range checking}
+@!debug @{Q+@}@,@{R+@}@+ gubed {turn checks off when debugging}
@z
[10] default case branch
@@ -178,7 +192,7 @@ Shift right all `part' blocks to prepare for TRAP.
@d mem_top==35000 {largest index in the |mem| array dumped by \.{INIMF};
@z
- [12]
+[12]
@x trap
@d mem_top==30000 {largest index in the |mem| array dumped by \.{INIMF};
@y
@@ -186,7 +200,7 @@ Shift right all `part' blocks to prepare for TRAP.
@z
[12] Silvio levy' greek fonts need more opened input files.
-@x
+@x part
@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
@@ -225,8 +239,14 @@ xchr[@'14] := chr(@'14); {accept form feed}
[26] opening for in- and output for all three file types
alpha in
@x
+@p function a_open_in(var @!f:alpha_file):boolean;
+ {open a text file for input}
begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
@y
+@p @{@&$I-@} {turn off I/O checking}
+@#
+function a_open_in(var @!f:alpha_file):boolean;
+ {open a text file for input}
begin clear_io_result; fpc_assign(f,name_of_file);reset(f);
a_open_in:=reset_OK(f);
@z
@@ -259,55 +279,30 @@ w_open_in:=reset_OK(f);
[26] word out
@x
begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f);
+end;
@y
begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
w_open_out:=rewrite_OK(f);
+end;
+@#
+@{@&$I+@} {turn on I/O checking}
@z
-[30] eoln handling
+[30] bypass_eoln
@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;
+@y
+begin
+@z
+
+[30] bypass_eoln
+@x
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;
+ last:=last_nonblank; input_ln:=true;
+ read_ln(f);
end;
-end;
@z
[31] term_in and term_out are the standard pascal files
@@ -344,22 +339,17 @@ The file |term_in| is declared as \\{input} and |term_out| as
@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_string == s@&h@&o@&r@&t@&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|}
+@d fpc_int_to_str == i @& n @& t @& t @& o @& s @& t @& r
@p procedure input_command_ln; {get the command line in |buffer|}
var argc: integer; {argument counter}
@@ -387,42 +377,117 @@ end;
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?');
+loc := first;
+if loc<last then
+ begin init_terminal:=true; return; {first line is the command line}
+ end;
+loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal;
+@z
+
+[36] For Unix, End of file on the terminal is not remarkable
+@x
+ write(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.');
+@y
+@z
+
+[36] control D
+@x
+ write_ln(term_out,'Please type the name of your input file.');
+@y
+ write_ln(term_out,'Please type the name of your input file or Control-D.');
+@z
+
+[51] leave pool file open
+@x
+@ @d bad_pool(#)==begin wake_up_terminal; write_ln(term_out,#);
+ a_close(pool_file); get_strings_started:=false; return;
+ end
+@y
+@ @d bad_pool(#)==begin wake_up_terminal; write_ln(term_out,#);
+ get_strings_started:=false; return;
+ end
+@z
+
+[51] lower case name of mf.pool
+@x
+else bad_pool('! I can''t read MF.POOL.')
+@y
+else bad_pool('! I can''t read mf.pool.')
+@z
+
+[74] start editor
+@x
+@!use_err_help:boolean; {should the |err_help| string be shown?}
+@y
+@!use_err_help:boolean; {should the |err_help| string be shown?}
+@!start_edit: boolean; {start \.{vi}?}
+@z
+
+[75] initial value for edit argument
+@x
+help_ptr:=0; use_err_help:=false; err_help:=0;
+@y
+help_ptr:=0; use_err_help:=false; err_help:=0;
+start_edit := false; { don't start \.{vi}}
+@z
+
+[79] set edit_cmd
+@x
+ begin print_nl("You want to edit file ");
+@.You want to edit file x@>
+ slow_print(input_stack[file_ptr].name_field);
+ print(" at line "); print_int(line);@/
+ interaction:=scroll_mode; jump_out;
+ end;
+@y
+ begin {save values to be passed to the system editor}
+ start_edit := true;
+ interaction:=scroll_mode; jump_out;
+ end;
+@z
+
+[81] extra space on log file and terminate last terminal line
+@x
+"Q":begin print("batchmode"); decr(selector);
+ end;
+@y
+"Q":begin print("batchmode");
end;
-loc := first; {trim leading spaces}
-while buffer[loc]=" " do incr(loc);
-init_terminal:=true;
-exit: end;
+@z
+
+[81] continued
+@x
+print("..."); print_ln; update_terminal; return;
+@y
+print("..."); print_ln; update_terminal;
+if c="Q" then decr(selector); return;
+@z
+
+[194] date and time
+@x
+@p procedure fix_date_and_time;
+begin internal[time]:=12*60*unity; {minutes since midnight}
+internal[day]:=4*unity; {fourth day of the month}
+internal[month]:=7*unity; {seventh month of the year}
+internal[year]:=1776*unity; {Anno Domini}
+end;
+@y
+@p procedure fix_date_and_time;
+var yy,mm,dd: word;
+ hh,ss,ms: word;
+begin
+decodedate(now,yy,mm,dd); {current date}
+internal[day] := dd*unity;
+internal[month] := mm*unity;
+internal[year] := yy*unity;@/
+decodetime(now,hh,mm,ss,ms); {current time}
+internal[time] := (hh*60+mm)*unity; {minutes since midnight}
+end;
@z
[199] character class for tab and lf
@@ -436,10 +501,32 @@ char_class[@'14] := space_class;
[326]
@x
+no rows), we have |n_rover(h)=h|, and |n_pos(h)| is irrelevant.
+@y
+no rows), we have |n_rover(h)=h|, and |n_pos(h)| is irrelevant.
+
+The definition of |valid_range| was changed because the Free Pascal
+Compiler cannot compile expressions like |abs(a+b-4096)| when |a|
+and |b| are |half_words|. It does compile however |abs(int(a+b) -
+int(4096))|, and |abs(int(a+b-4096))| will throw an overflow exception.
+@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?}
+@d valid_range(#)==(abs(int(#)-int(4096))<4096) {is |#| strictly between 0 and 8192?}
@z
+
+ [536] undo Knuth's change from mf-2008 to mf-2012, to explain the
+ diffs of pointer values in the trap.logs.
+ @x
+ done1: if (link(p)<>null) then free_node(link(p),knot_node_size);
+ link(p):=s; beta:=-y_coord(h);
+ @y
+ done1: link(p):=s; beta:=-y_coord(h);
+ @z
+
[564]
@x trap
begin init_screen:=false;
@@ -448,15 +535,15 @@ char_class[@'14] := space_class;
@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
+ @x chatty
+ 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
@@ -521,6 +608,45 @@ fpc_set_length(rbs, name_length);
name_of_file := rbs;
@z
+[786]
+@x spaeter!
+print_nl("Please type another "); print(s);
+@y
+print_nl("Please type another "); print(s); print(" or Control-D");
+@z
+
+[793] name might be needed to be passed to vi
+@x
+if name=str_ptr-1 then {we can conserve string pool space now}
+ begin flush_string(name); name:=cur_name;
+ end;
+@y
+@^Editor@>
+@z
+
+
+ [1023] avoid blank line on terminal after mode command
+ @x chatty
+ mode_command: begin print_ln; interaction:=cur_mod;
+ @y
+ mode_command: begin print_nl(""); interaction:=cur_mod;
+ @z
+
+[1154] blockwrite for gf_buf
+@x
+output an array of words with one system call.
+@y
+output an array of words with one system call.
+
+@d fpc_blockwrite == b @& l @& o @& c @& k @& w @& r @& i @& t @& e
+@z
+
+@x
+begin for k:=a to b do write(gf_file,gf_buf[k]);
+@y
+begin fpc_blockwrite(gf_file,gf_buf[a],b-a+1);
+@z
+
[1199]
@x
undump_int(x);@+if (x<>69069)or eof(base_file) then goto off_base
@@ -537,38 +663,21 @@ undump_int(x);@+if (x<>69069) then goto off_base
@p begin @!{|start_here|}
@z
-[1204] load the base file before printing the banner line
+[1204] start editor and pass history
@x
-start_of_MF: @<Initialize the output routines@>;
+final_end: ready_already:=0;
@y
-start_of_MF: @<Preload the default base file@>;
-@<Initialize the output routines@>;
+final_end:
+if start_edit then exec_editor; {user typed `\.{E}'}
+fpc_halt(history);
+ {pass |history| as the exit value to the system}
@z
-[1205] print last end-of-line marker if needed
+[1205] terminate last line
@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;
+ slow_print(log_name); print_char("."); print_ln;
@z
[1212] return if eof
@@ -605,27 +714,132 @@ itself will get a new section number.
@y
itself will get a new section number.
@^system dependencies@>
+@^fpc Pascal@>
+
+@d edit_file == input_stack[file_ptr].name_field
+@d fpc_fp_exec_vp == fp_exec_vp
+@d fpc_pchar == pchar
+@d vi==@{ {change this to `$\\{vi}\equiv\null$' when you think \.{vi}
+is the system editor}
+@d iv==@t@>@} {change this to `$\\{iv}\equiv\null$' when you think \.{vi}
+is the sytem editor}
+@f vi == begin
+@f iv == end
+@d ed== {change this to `$\\{ed}\equiv\.{@@\{}$' when you think \.{vi}
+is the system editor}
+@d de== {change this to `$\\{de}\equiv\.{@@\}}$' when you think \.{vi}
+is the system editor}
+@f ed == begin
+@f de == end
+
+@<Last-minute...@>=
+procedure exec_editor;
+const arg_size = 100; {maximal size of each of the arguments}
+ vi editor = 'vi'; {name of the binary to be started}
+ iv
+ @#
+ ed editor = 'ed'; {name of the binary to be started}
+ de
+ @#
+ editor_length = 2; {length of the name}
+var i, l: integer; {index into args}
+ j: pool_pointer; {index into |str_pool|}
+ s: str_number; {string to hold line number}
+ sel: integer; { save selector }
+ editor_arg, line_arg, file_arg : array[1..arg_size] of char; { arguments }
+ argv: array [0..3] of fpc_pchar; { vector of arguments }
+begin
+ l := editor_length;
+ for j := 1 to l do editor_arg := editor[j];
+ editor_arg[l+1] := chr(0);
+
+ sel := selector;
+ selector := new_string;
+ print_int(line);
+ s := make_string;
+ @#
+ vi
+ line_arg[1] := '+';
+ j := str_start[s];
+ l := length(s)+1;
+ for i := 2 to l do begin line_arg[i] := xchr[str_pool[j]]; incr(j) end;
+ line_arg := chr(0);
+ iv
+ @#
+ ed
+ selector := term_only;
+ write('You want to edit at line '); print(s); print_ln;
+ de
+ @#
+ selector := sel;
+ j := str_start[edit_file];
+ l := length(edit_file);
+ if l+1 > arg_size then begin
+ write_ln('File name longer than 100 bytes! Nice try!');
+ halt(100);
+ end;
+ for i := 1 to l do
+ begin file_arg[i] := xchr[str_pool[j]]; incr(j)
+ end;
+ file_arg[l+1] := chr(0);
+ argv[0] := @@editor_arg;
+ vi
+ argv[1] := @@line_arg;
+ argv[2] := @@file_arg;
+ argv[3] := nil;
+ iv
+ @#
+ ed
+ argv[1] := @@file_arg;
+ argv[2] := nil;
+ de
+ @#
+ fpc_fp_exec_vp(editor, argv);
+ write_ln('Sorry, executing the editor failed.');
+end;
+@
+A signal handler is a procedure that takes one |integer| parameter.
+The procedure |fpc_fp_signal| takes two parameter, an integer and
+a signal handler. The integer is the number of the signal. Whenever
+the program receives a signal with the designated number, the signal handler
+gets invoked.
-@ 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.
+The integer |SIGINT| is the number of the interrupt signal. The
+system sends an interrupt signal to the program, whenever the user
+types \.{\^C}.
-\indent\.{INIMF} sets |base_ident| to `\.{INIMF}' and won't load a base
-file here.
+The function |fpc_fp_get_errno| returns an integer that is not zero,
+whenever something went wrong.
-@<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
+The identifier |fpc_signal_handler| denotes the |type| of a
+pointer to a signal handler. Since this is foreign to ISO~Pascal,
+we use the type cast to |fpc_signal_handler| as a kludge.
-@
+@^FPC Pascal@>
+@^system dependencies@>
+
+@d fpc_signal_handler == s@&i@&g@&n@&a@&l@&h@&a@&n@&d@&l@&e@&r
+@d fpc_fp_signal == f@&p@&s@&i@&g@&n@&a@&l
+@d fpc_fp_get_errno ==f@&p@&g@&e@&t@&e@&r@&r@&n@&o
+
+@<Set initial values ...@>+=
+
+fpc_fp_signal(SIGINT, fpc_signal_handler(catch_signal));
+if fpc_fp_get_errno <> 0 then
+ write_ln('Could not install signal handler:', fpc_fp_get_errno);
+
+@ The signal handler has the so called modifier |interrupt|.
+Modifiers are an extension of FPC Pascal. This one makes the compiler
+generate the code suitable for a signal handler, which must not
+return to the caller but to the instruction where the program was
+interrupted.
+
+@^FPC Pascal@>
+@^system dependencies@>
+
+@<Error handling ...@>+=
+procedure catch_signal; interrupt;
+begin
+ interrupt := i;
+end;
@z
diff --git a/systems/unix/tex-fpc/mp/dvitomp.ch b/systems/unix/tex-fpc/mp/dvitomp.ch
new file mode 100644
index 0000000000..5f4d7d6bd0
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/dvitomp.ch
@@ -0,0 +1,208 @@
+% This is a change file of DVItoMP-FPC, Wolfgang Helbig, Aug. 2008
+To be used with the GNU Pascal Compiler Version 2.1
+
+[0] About DVItoMP-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-gpc
+
+% \let\maybe=\iffalse % uncomment to print changed modules only.
+
+\def\name{\tt DVItoMP}
+
+\N0\*. About \namegpc.\fi
+
+This is an adaption of John Hobby's \name, version 0.64, to Unix
+and GNU~Pascal, version 2.1.
+
+This program expects the input file (\.{.dvi}) and the output file,
+(\.{mpx}) which is a text file, on the command line. To support shell
+scripting, \namegpc\ 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=='% Written by DVItoMP, Version 0.64'
+@y
+@d banner=='% Written by DVItoMP-FPC, 2nd ed.'
+@z
+
+[3] only stdio files in program header.
+@x
+@p program DVI_to_MP(@!dvi_file,@!mpx_file,@!output);
+@y
+@p
+@{@&$I-@} {no I/O checking}
+program DVI_to_MP(input, output);
+@z
+
+[9] check command line arguments
+@x
+history:=spotless;
+@y
+history:=spotless;
+if param_count <> 2 then
+ begin write_ln('Usage: dvitomp dvi_file mpx_file'); halt(1);
+ end;
+@z
+
+[12] Pascal's type of text_files is text
+@x
+@!text_file=packed file of text_char;
+@y
+@!text_file=text;
+@z
+
+[14] get file name from command line
+@x
+begin rewrite(mpx_file);
+@y
+begin
+rewrite(mpx_file, param_str(2));
+@z
+
+[17] use FPC extension for packing subranges.
+@x
+@!eight_bits=0..255; {unsigned one-byte quantity}
+@y
+@!eight_bits=packed 0..255; {unsigned one-byte quantity}
+@z
+
+[22] declare out_file
+@x
+@!tfm_file:byte_file; {a font metric file}
+@y
+@!tfm_file:byte_file; {a font metric file}
+@!out_file:text; {the outfile}
+@z
+
+[19] open file whose name is not known at compile time
+@x
+has acted, these routines assume that no file named |s| is accessible.
+@y
+has acted, these routines assume that no file named |s| is accessible.
+@d io_ok==io_result=0
+@d clear_io_result==@+if io_result=0 then
+@z
+
+@x
+begin reset(dvi_file);
+@y
+begin reset(dvi_file, param_str(1));
+@z
+
+@x
+begin reset(tfm_file,cur_name);
+@y
+begin reset(tfm_file,trim(cur_name)); {ignore leading and trailing blanks}
+@z
+
+@x
+begin reset(vf_file,cur_name);
+open_vf_file:=(not eof(vf_file));
+@y
+begin clear_io_result; reset(vf_file,trim(cur_name));
+ open_vf_file:=io_ok;
+@z
+
+ [28] no random access
+ @x;
+ begin set_pos(dvi_file,-1); dvi_length:=cur_pos(dvi_file);
+ end;
+ @#
+ procedure move_to_byte(n:integer);
+ begin set_pos(dvi_file,n); cur_loc:=n;
+ end;
+ @y;
+ begin do_nothing;
+ end;
+ @#
+ procedure move_to_byte(n:integer);
+ begin do_nothing;
+ end;
+ @z
+
+[47]
+ @x
+ is always at least one blank space in |buffer|.
+ @^system dependencies@>
+
+ @p procedure input_ln; {inputs a line from the terminal}
+ var k:0..terminal_line_length;
+ begin update_terminal; reset(term_in);
+ if eoln(term_in) then read_ln(term_in);
+ k:=0;
+ while (k<terminal_line_length)and not eoln(term_in) do
+ begin buffer[k]:=xord[term_in^]; incr(k); get(term_in);
+ end;
+ buffer[k]:=" ";
+ end;
+ @y
+ is always at least one blank space in |buffer|.
+ This is changed here: |term_in| is standard input and is not supposed
+ to be opened. There is never an end-of-line marker at the beginning of
+ a line but always at the end of a line.
+ @^system dependencies@>
+
+ @p procedure input_ln; {inputs a line from the terminal}
+ var k:0..terminal_line_length;
+ begin update_terminal;
+ k:=0;
+ while (k<terminal_line_length)and not eoln(term_in) do
+ begin buffer[k]:=xord[term_in^]; incr(k); get(term_in);
+ end;
+ read_ln(term_in);
+ buffer[k]:=" ";
+ end;
+ @z
+
+ [50] don't rewrite output file, write the banner while initializing
+ @x
+ begin rewrite(term_out); {prepare the terminal for output}
+ write_ln(term_out,banner);
+ @y
+ begin
+ @z
+
+[61]
+@x
+@d default_directory_name=='TeXfonts:' {change this to the correct name}
+@y
+@d default_directory_name=='TeXfonts/' {change this to the correct name}
+@z
+
+[63] lowercase filename
+@x
+ if (names[k]>="a")and(names[k]<="z") then
+ cur_name[l]:=xchr[names[k]-@'40]
+ else cur_name[l]:=xchr[names[k]];
+ end;
+cur_name[l+1]:='.'; cur_name[l+2]:='V'; cur_name[l+3]:='F'
+@y
+ cur_name[l]:=xchr[names[k]]
+ end;
+cur_name[l+1]:='.'; cur_name[l+2]:='v'; cur_name[l+3]:='f'
+@z
+
+[64] lowercase filename
+@x
+cur_name[l+2]:='T'; cur_name[l+3]:='F'; cur_name[l+4]:='M'
+@y
+cur_name[l+2]:='t'; cur_name[l+3]:='f'; cur_name[l+4]:='m'
+@z
+
+[107] set exit code
+@x
+final_end:end.
+@y
+final_end:halt(history) end.
+@z
diff --git a/systems/unix/tex-fpc/mp/fig.mp b/systems/unix/tex-fpc/mp/fig.mp
new file mode 100644
index 0000000000..efce9512fa
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/fig.mp
@@ -0,0 +1,11 @@
+beginfig(1)
+a=.7in; b=0.5in;
+z0=(0,0); z1=(a,0); z2=(0,b);
+z0=.5[z1,z3]=.5[z2,z4];
+draw z1..z2..z3..z4..cycle;
+drawarrow z0..z1;
+drawarrow z0..z2;
+label.top(btex $a$ etex, .5[z0, z1]);
+label.lft(btex $b$ etex, .5[z0, z2]);
+endfig
+end
diff --git a/systems/unix/tex-fpc/mp/fig.tex b/systems/unix/tex-fpc/mp/fig.tex
new file mode 100644
index 0000000000..0b22e32c2b
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/fig.tex
@@ -0,0 +1,3 @@
+\input epsf
+\epsfbox{fig.1}
+\bye
diff --git a/systems/unix/tex-fpc/mp/mk_MP_dir b/systems/unix/tex-fpc/mp/mk_MP_dir
new file mode 100755
index 0000000000..7e755a9d40
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/mk_MP_dir
@@ -0,0 +1,2 @@
+ln -s ~/MPlib .
+ln -s ~/MPinputs .
diff --git a/systems/unix/tex-fpc/mp/mp.ch b/systems/unix/tex-fpc/mp/mp.ch
new file mode 100644
index 0000000000..c4a73abf6e
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/mp.ch
@@ -0,0 +1,734 @@
+% This is a change file of METAPOST for FPC, Wolfgang Helbig, Nov. 2020
+% See tex.ch and mf.ch from tex-fpc
+[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 % uncomment to print changed modules only.
+
+\def\name{\MP}
+
+\N0\*. \[0] About \namefpc.
+
+This is an adaption of John Hobby's \MP, version 0.641,
+to the Free Pascal Compiler. It is to be built and runs in
+any Unix environment.
+
+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 MetaPost, Version 0.641' {printed when \MP\ starts}
+@y
+@d banner=='This is MetaPost-FPC' {printed when \MP\ starts}
+@z
+
+[4] terminal output and input
+@x
+@d mtype==t@&y@&p@&e {this is a \.{WEB} coding trick:}
+@y
+@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 MP; {all file names are defined dynamically}
+@y
+program MP(@!term_in,@!term_out);
+@z
+
+[4] forward reference for signal handler
+@x
+procedure initialize; {this procedure gets things started properly}
+@y
+procedure catch_signal(i: integer); interrupt@, forward;@t\2@>
+procedure initialize; {this procedure gets things started properly}
+@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 MP and right it to build INIMP.
+ @x inimp
+ @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
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@{$MODE@,ISO@} {turn on mode ISO}
+@{$Q+@} {turn on overflow checking}
+@{$R+@} {turn on range checking}
+@!debug
+@{@&$Q-@}@,
+@{@&$R-@}@+
+gubed {turn off all checks when debugging}
+@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
+
+[11] location of pool file
+@x
+@!pool_name='MPlib:MP.POOL ';
+ {string of length |file_name_size|; tells where the string pool appears}
+@.MPlib@>
+@!ps_tab_name='MPlib:PSFONTS.MAP ';
+ {string of length |file_name_size|; locates font name translation table}
+@y
+@!pool_name='MPlib/mp.pool';
+ {string of length |file_name_size|; tells where the string pool appears}
+@.MPlib@>
+@!ps_tab_name='MPlib/psfonts.map';
+@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
+@!alpha_file=packed file of text_char; {files that contain textual data}
+@y
+@!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] (reset and rewrite for each of three file types) alpha
+@x
+@p function a_open_in(var @!f:alpha_file):boolean;
+ {open a text file for input}
+begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
+@y
+@p
+@{$I-@} {no i/o checking}
+@#
+function a_open_in(var @!f:alpha_file):boolean;
+ {open a text file for input}
+begin clear_io_result; fpc_assign(f,name_of_file); reset(f);
+a_open_in:=reset_OK(f);
+@z
+
+[26] alpha rewrite
+@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 reset
+@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
+
+[26] byte rewrite
+@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:=reset_OK(f);
+@z
+
+[26] word reset
+@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 rewrite
+@x
+begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f);
+end;
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+w_open_out:=rewrite_OK(f);
+end;
+@#
+@{@&$I+@} {turn on I/O checking}
+@z
+
+[30] eoln handling
+@x
+begin if bypass_eoln then if not eof(f) then get(f);
+@y
+begin
+@z
+
+[30] bypass eoln
+@x
+ last:=last_nonblank; input_ln:=true;
+ end;
+@y
+ last:=last_nonblank; input_ln:=true;
+ read_ln(f);
+ end;
+@z
+
+[31] term_in and term_out are the standard pascal files
+@x
+@!term_in:alpha_file; {the terminal as an input file}
+@!term_out:alpha_file; {the terminal as an output file}
+@y
+@z
+
+[32] no reset(input) and rewrite(output)
+@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] no flushing, clearing on standard i/o
+@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
+
+[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 == s@& h@& o@& r@& t @& 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
+
+@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
+
+[36] init terminal
+@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;
+loc := first;
+if loc<last then
+ begin init_terminal:=true; return; {first line is the command line}
+ end;
+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;
+@z
+
+[76] print banner line on terminal
+@x
+@<Initialize the output...@>=
+update_terminal;
+@y
+@<Initialize the output...@>=
+wterm(banner);
+if mem_ident=0 then wterm_ln(' (no mem preloaded)')
+else begin print(mem_ident); print_ln;
+ end;
+update_terminal;
+@z
+
+[89] start editor
+@x
+@!use_err_help:boolean; {should the |err_help| string be shown?}
+@y
+@^Editor@>
+@!use_err_help:boolean; {should the |err_help| list be shown?}
+@!start_edit: boolean; {start \.{vi}?}
+@z
+
+[90] initial values for start editor
+@x
+help_ptr:=0; use_err_help:=false; err_help:=0;
+@y
+help_ptr:=0; use_err_help:=false; err_help:=0; start_edit :=false;
+@z
+
+[94] start editor
+@x
+ begin print_nl("You want to edit file ");
+@.You want to edit file x@>
+ print(input_stack[file_ptr].name_field);
+ print(" at line "); print_int(true_line);@/
+ interaction:=scroll_mode; jump_out;
+ end;
+@y
+@^Editor@>
+ begin {start \.{vi}}
+ start_edit := true;
+ interaction:=scroll_mode; goto final_end;
+ end;
+@z
+
+ [106] interrupt is predefined and not implemented in GNU~Pascal
+ @x
+ @d check_interrupt==begin if interrupt<>0 then pause_for_instructions;
+ @y
+ @d interrupt==buginterrupt
+ @f interrupt==true
+ @d check_interrupt==begin if interrupt<>0 then pause_for_instructions;
+ @z
+
+ [171] pack subranges
+ @x
+ @!quarterword = min_quarterword..max_quarterword; {1/4 of a word}
+ @!halfword=min_halfword..max_halfword; {1/2 of a word}
+ @y
+ @!quarterword = packed min_quarterword..max_quarterword; {1/4 of a word}
+ @!halfword=packed min_halfword..max_halfword; {1/2 of a word}
+ @z
+
+[212] time and date
+@x
+@p procedure fix_date_and_time;
+begin internal[time]:=12*60*unity; {minutes since midnight}
+internal[day]:=4*unity; {fourth day of the month}
+internal[month]:=7*unity; {seventh month of the year}
+internal[year]:=1776*unity; {Anno Domini}
+end;
+@y
+The functions |now|, |decodedate|, and |decodetime| are provided
+by the unit |sysutils|. The command line \.{fpc~-Fasysutils~tex.p}
+links that unit.
+@^system dependencies@>
+@^FPC Pascal@>
+When FPC is in ISO mode, it does not accept declaring a |unit| in the source
+file.
+@dfpc_now == now
+@dfpc_decode_date == decodedate
+@dfpc_decode_time == decodetime
+@p procedure fix_date_and_time;
+var yy,mm,dd: word;
+ hh,ss,ms: word;
+begin
+fpc_decode_date(fpc_now,yy,mm,dd); {current date}
+internal[day] := dd*unity;
+internal[month] := mm*unity;
+internal[year] := yy*unity;@/
+fpc_decode_time(fpc_now,hh,mm,ss,ms); {current time}
+internal[time] := (hh*60+mm)*unity; {minutes since midnight}
+end;
+@z
+
+[217] 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
+
+[640] spurious empty line on terminal
+@x
+ print_ln; first:=start;
+ prompt_input("*"); {input on-line into |buffer|}
+@y
+ print_nl("");
+ first:=start; {avoid empty lines on terminal and log file}
+ prompt_input("*"); {input on-line into |buffer|}
+@z
+
+[746] Path separator in Unix
+@x
+@d MP_area=="MPinputs:"
+@.MPinputs@>
+@d MF_area=="MFinputs:"
+@.MFinputs@>
+@d MP_font_area=="TeXfonts:"
+@.TeXfonts@>
+@y
+@d MP_area=="MPinputs/"
+@.MPinputs@>
+@d MF_area=="MFinputs/"
+@.MFinputs@>
+@d MP_font_area=="TeXfonts/"
+@.TeXfonts@>
+@z
+
+[748] Path separator in Unix
+@x
+else begin if (c=">")or(c=":") then
+@y
+else begin if c="/" then
+@z
+
+[751] file name handling: pack file name
+@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
+
+[751] pack file name
+@x
+@!j:pool_pointer; {index into |str_pool|}
+@y
+@!j:pool_pointer; {index into |str_pool|}
+@!s: fpc_string;
+@z
+
+[751] pack file name
+@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;
+s := name_of_file;
+fpc_set_length(s, name_length);
+name_of_file := s;
+end;
+@z
+
+[753] file name of plain.mem
+@x
+MP_mem_default:='MPlib:plain.mem';
+@y
+MP_mem_default:='MPlib/plain.mem';
+@z
+
+[755] packed buffered name
+@x
+@!j:integer; {index into |buffer| or |MP_mem_default|}
+@y
+@^FPC Pascal@>
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+s: fpc_string;
+@z
+
+[755] packed buffered name continued
+@x
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+@y
+s := name_of_file; fpc_set_length(s, name_length); name_of_file := s;
+@z
+
+
+[771] (don't) flush file name. Might be needed for vi
+@x
+flush_string(name); name:=cur_name; cur_name:=0
+@y
+@z
+
+
+
+[1293] FPC-BUG eof one too early
+@x
+undump_int(x);@+if (x<>69073)or eof(mem_file) then goto off_base
+@y
+undump_int(x);@+if (x<>69073)then goto off_base
+@z
+
+[1298] define FPC procedure halt
+@x
+@p begin @!{|start_here|}
+@y
+@d fpc_halt == h@&a@&l@&t
+
+@p begin @!{|start_here|}
+@z
+
+[1298] load the mem file before printing the banner line
+@x
+start_of_MP: @<Initialize the output routines@>;
+@y
+start_of_MP: @<Preload the default mem file@>;
+@<Initialize the output routines@>;
+@z
+
+[1298] start editor and pass history
+@x
+final_end: ready_already:=0;
+@y
+final_end:
+if start_edit then edit; {user typed `\.{E}'}
+fpc_halt(history);
+ {pass |history| as the exit value to the system}
+@z
+
+[1299] 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...@>
+ 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...@>
+ print(log_name); print_char(".");
+ end;
+ end;
+ if term_offset > 0 then wterm_cr;
+end;
+@z
+
+[1307] 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
+
+[1307] 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
+
+[1308] 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
+
+[1309 and modules added for METAPOST-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 mem file. This is called even before
+the first line is read from the terminal, and thus turns \.{VIRMP}
+into \.{MP}, at least as seen by the user.
+
+\indent\.{INIMP} sets |mem_ident| to `\.{INIMP}' and won't load a mem
+file here.
+
+@<Preload the default mem file@> =
+if mem_ident = 0 then
+ begin pack_buffered_name(mem_default_length - mem_ext_length, 1, 0);
+ if not w_open_in(mem_file) then
+ begin
+ wterm_ln('I can''t find the mem file');
+ goto final_end
+ end;
+ if not load_mem_file then
+ begin w_close(mem_file); goto final_end
+ end;
+ w_close(mem_file);
+ end
+
+@
+@d fpc_execute == e@&x@&e@&c@&u@&t@&e @& p @& r @& o @& c @& e @& s @& s
+@d fpc_int_to_str == i @& n @& t @& t @& o @& s @& t @& r
+@d edit_file == input_stack[file_ptr].name_field
+
+@<Error hand...@>+=
+procedure edit;
+var i: integer; {index into |name_of_file|}
+ j: pool_pointer; {index into |str_pool|}
+ k: pool_pointer; {index into |str_pool|}
+ s: str_number; {index into |str_start|}
+ f, arg, vi, sl: fpc_string; {area to build the command line}
+begin i := 1; s := edit_file;j := str_start[s]; k:= str_stop(s);
+fpc_set_length(f, length(s));
+while j<k do
+ begin f[i] := xchr[str_pool[j]]; incr(i); incr(j)
+ end;
+sl := fpc_int_to_str(true_line);
+if 0 <> fpc_execute('/usr/bin/vi', '+' + fpc_int_to_str(true_line) + ' ' + f)
+then
+ begin
+ write('I could not start editor with: ', '/usr/bin/vi +', sl , ' ', f);
+ print(edit_file); print_ln;
+ end
+end;
+
+@
+
+@d fpc_signal_handler == s@&i@&g@&n@&a@&l@&h@&a@&n@&d@&l@&e@&r
+@d fpc_fp_signal == f@&p@&s@&i@&g@&n@&a@&l
+@d fpc_fp_get_errno ==f@&p@&g@&e@&t@&e@&r@&r@&n@&o
+
+@<Set initial values ...@>+=
+
+fpc_fp_signal(SIGINT, fpc_signal_handler(catch_signal));
+if fpc_fp_get_errno <> 0 then
+ write_ln('Could not install signal handler:', fpc_fp_get_errno);
+
+@
+The signal handler has the so called modifier |interrupt|.
+Modifiers are an extension of FPC Pascal. This one makes the compiler
+generate code suitable for a signal handler, which must not
+return to the caller but to the instruction where the program was
+interrupted.
+
+@^FPC Pascal@>
+@^dirty \PASCAL@>
+@^system dependencies@>
+
+@<Error handling ...@>+=
+procedure catch_signal; interrupt;
+begin
+ interrupt := i;
+end;
+@z
+ @d fpc_t_signal_handler == t@&s@&i@&g@&n@&a@&l@&h@&a@&n@&d@&l@&e@&r
+ @d fpc_install_signal_handler ==
+ i@&n@&s@&t@&a@&l@&l@&s@&i@&g@&n@&a@&l@&h@&a@&n@&d@&l@&e@&r
+ @d fpc_sig_int == s@&i@&g@&i@&n@&t
+ @d fpc_integer == integer {for later versions of FPC (3.4+) replace
+ \\{integer} by \\{cinteger}}
+
+ @<Error hand...@>=
+ procedure set_interrupt(signal: fpc_integer);
+ begin interrupt := 1 @+end;
+
+ @
+ @<Set initial values ... @>=
+ fpc_install_signal_handler(gpc_sig_int,set_interrupt,true,true,dummy_handler,
+ dummy_boolean);
+
+ @ Here are two variables that are needed to install |set_interrupt|.
+ @<Local variables for initialization@> =
+ dummy_handler: fpc_t_signal_handler;
+ dummy_boolean: boolean;
+ @z
diff --git a/systems/unix/tex-fpc/mp/mpx b/systems/unix/tex-fpc/mp/mpx
new file mode 100755
index 0000000000..d8a6ea4cf8
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/mpx
@@ -0,0 +1,10 @@
+# process .mp files that include TeX programs.
+case $# in
+1) f=`basename $1 .mp`;;
+*) echo Usage: $0 mp-file; exit 1;;
+esac
+mptotex $f.mp \
+| tex \
+&& dvitomp texput.dvi $f.mpx \
+&& mp $f.mp \
+|| echo $0 failed!; exit 1
diff --git a/systems/unix/tex-fpc/mp/readme b/systems/unix/tex-fpc/mp/readme
new file mode 100644
index 0000000000..e0065cce28
--- /dev/null
+++ b/systems/unix/tex-fpc/mp/readme
@@ -0,0 +1,204 @@
+Aug. 2008 - Nov. 2020
+This is the stage directory to build and install John Hobby's
+METAPOST for FPC. METAPOST produces pictures as PostScript files
+that are to be included by dvips in its output.
+
+METAPOST's file formats and their documentation:
+------------------------------------------------
+.mp METAPOST source,
+ see "A User's manual for MetaPost", AT&T Bell Laboratories
+ Computing Science Technical Report 162, 1992
+.mpx METAPOST source, auxiliary file, needed if a .mp file contains
+ TeX-programs.
+.mem METAPOST format file (plain.mp)
+.c C source (Kernighan/Ritchie The C Programming Language)
+.ps Adobe PostScript
+.n Where n an integer, a PostScript file for picture n, to be included
+ by dvips.
+
+
+builtin file names:
+------------------
+MPlib/mp.pool string pool for mp, (in inimp)
+MPlib/plain.mem base file for Plain METAFONT, (in mf)
+
+METAPOST's processors:
+----------------------
+ inimp
+ plain.mp -------> MPlib/plain.mem
+
+
+ mptotex
+.mp -------> .tex (the .tex file contains stuff to be included
+ in the figure, like labels)
+
+ tex
+.tex -------> .dvi (the dvi contains the output of the tex program.)
+
+ dvitomp
+.dvi --------> .mpx (mp will \read the .mpx-file)
+
+ mp
+.mp -------> .n
+
+ mpx
+.mp --------> .n (combines the last four steps)
+
+Use the shell script mpx instead of mp if and only if your .mp file
+contains TeX programs, i. e. if you have a TeX-program, that includes
+a figure, vis. an MP Program, that in turn contains TeX-programs.
+The result is a PS document defined by a TeX-file that includes a
+figure which in turn includes TeX-programs.
+
+The mpx file name is specified in the .mp file in a \read command.
+
+And finally:
+ dvips
+.<n>, .dvi, .pk, .tfm ----> PostScript file/printer
+
+
+Get John Hobby's distribution
+-----------------------------
+The sources from CTAN depend on web2c,
+so I downloaded the originals from netlib:
+ftp ftp://mirrorservice.org/sites/ftp.netlib.org/research/metapost.tar.Z
+
+Be sure to unpack it in a different empty directory, since it clobbers
+the files all over the place.
+
+unpack it with uncompress and tar xf:
+ uncompress metapost.tar.Z
+ tar xf metapost.tar
+Copy at least mp.web, plain.mp, mptotex.c and dvitomp.web into this
+directory.
+
+Masterdirectories:
+------------------
+Create the master directories MPlib and MPinputs. Prepare a directory from
+where you want to run mp with the shell script mk_MP_dir.
+(Additionally to mk_TeX_dir)
+
+Building and installing:
+-----------------------
+Move a.out into your binary directory under the name at the
+right end of --->.
+
+1. mp.web, mp.ch ---> inimp
+Change mp.ch for initialization (see building inimf, initex) and itgl.
+Move mp.pool to MPlib.
+
+2. plain.mp ---> MPlib/plain.mem
+ inimp plain.mp dump
+mv plain.mem to MPlib
+
+3. mp.web, mp.ch ---> mp
+Change mp.ch for production (see building inimf, initex) and tgl.
+
+4. dvitomp.web, dvitomp.ch ---> dvitomp
+Just tgl and move a.out as dvitomp to your binary directory
+
+5. mptotex.c ---> mptotex
+apply patches to mptotex.c:
+ed mptotex.c <mptotex.ed
+cc mptotex.c, ignore the warning and move a.out to ...
+
+6. mpx ---> mpx (just move the shell script to your binary dir)
+
+Using MetaPost:
+--------------
+To include a MetaPost picture xxx.mp in your output, \input
+the TeX macro epsf.tex. At the place where you want to include your
+picture, write
+ \epsfbox{xxx.n}
+where xxx is the name of the picture and n is the argument given
+in the beginfig() command.
+
+fig.mp:
+beginfig(1)
+a=.7in; b=0.5in;
+z0=(0,0); z1=(a,0); z2=(0,b);
+z0=.5[z1,z3]=.5[z2,z4];
+draw z1..z2..z3..z4..cycle;
+drawarrow z0..z1;
+drawarrow z0..z2;
+label.top(btex $a$ etex, .5[z0, z1]);
+label.lft(btex $b$ etex, .5[z0, z2]);
+endfig
+end
+
+fig.mp contains two TeX programs, $a$ and $b$. So you need to call mpx instead
+of mp. This creates fig.mpx:
+
+% Written by DVItoMP-FPC, 2nd ed.
+begingroup save _p,_r,_s,_n; picture _p; _p=nullpicture;
+string _n[];
+vardef _s(expr _t,_f,_m,_x,_y)=
+ addto _p also _t infont _f scaled _m shifted (_x,_y); enddef;
+_n0="cmmi10";
+_s("a",_n0,1.00000,0.0000,0.0000);
+setbounds _p to (0,-0.0000)--(5.2661,-0.0000)--
+ (5.2661,4.2895)--(0,4.2895)--cycle;
+_p endgroup
+mpxbreak
+begingroup save _p,_r,_s,_n; picture _p; _p=nullpicture;
+string _n[];
+vardef _s(expr _t,_f,_m,_x,_y)=
+ addto _p also _t infont _f scaled _m shifted (_x,_y); enddef;
+_n0="cmmi10";
+_s("b",_n0,1.00000,0.0000,0.0000);
+setbounds _p to (0,-0.0000)--(4.2756,-0.0000)--
+ (4.2756,6.9185)--(0,6.9185)--cycle;
+_p endgroup
+mpxbreak
+
+From fig.mp and fig.mpx METAPOST creates fig.1:
+
+%!PS
+%%BoundingBox: -51 -37 51 37
+%%Creator: MetaPost
+%%CreationDate: 2020.10.29:1632
+%%Pages: 1
+%*Font: cmmi10 9.96265 9.96265 61:c
+%%EndProlog
+%%Page: 1 1
+ 0 0.5 dtransform truncate idtransform setlinewidth pop [] 0 setdash
+ 1 setlinejoin 10 setmiterlimit
+newpath 50.39978 0 moveto
+50.39978 23.04858 25.56044 36 0 36 curveto
+-25.56044 36 -50.39978 23.04858 -50.39978 0 curveto
+-50.39978 -23.04858 -25.56044 -36 0 -36 curveto
+25.56044 -36 50.39978 -23.04858 50.39978 0 curveto closepath stroke
+ 1 setlinecap
+newpath 0 0 moveto
+50.39978 0 lineto stroke
+newpath 46.70451 -1.53067 moveto
+50.39978 0 lineto
+46.70451 1.53067 lineto
+ closepath
+gsave fill grestore stroke
+ 0.5 0 dtransform exch truncate exch idtransform pop setlinewidth
+newpath 0 0 moveto
+0 36 lineto stroke
+ 0 0.5 dtransform truncate idtransform setlinewidth pop
+newpath 1.5308 32.3044 moveto
+0 36 lineto
+-1.5308 32.3044 lineto
+ closepath
+gsave fill grestore stroke
+22.56683 3 moveto
+(a) cmmi10 9.96265 fshow
+-7.2756 14.54074 moveto
+(b) cmmi10 9.96265 fshow
+showpage
+%%EOF
+
+Finally, the TeX file that includes a figure, fig.tex:
+
+\input epsf
+\epsfbox{fig.1}
+\bye
+
+Make fig.dvi with tex and fig.ps with dvips. Display the PS file on screen
+with ghostscript by "gs fig.ps". Other than TeX and friends the C-programs
+gs and mptotex don't guess the extension .ps or .mpx. gs just stops and
+mptotex catches a segmentation fault :-)
diff --git a/systems/unix/tex-fpc/pltotf.ch b/systems/unix/tex-fpc/pltotf.ch
new file mode 100644
index 0000000000..03aef8eee8
--- /dev/null
+++ b/systems/unix/tex-fpc/pltotf.ch
@@ -0,0 +1,97 @@
+This is a change file of PLtoTF for TeX-FPC, Wolfgang Helbig, Oct. 2020.
+
+[0] About PLtoTF-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+
+% \let\maybe=\iftrue % uncomment to print changed modules only.
+
+\def\name{\tt PLtoTF}
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{PLtoTF} to Unix. \namefpc\
+is based on the Free~Pascal Compiler.
+
+\namefpc\ expects the name of the input file (\.{.pl}) as the first
+and the name of the output file (\.{.tf}) as the second parameter
+on the command line.
+
+\hint
+
+Comments and questions are welcome!
+
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is PLtoTF, Version 3.6' {printed when the program starts}
+@y
+@d banner=='This is PLtoTF-FPC, 2nd ed.' {printed when the program starts}
+@z
+
+
+[2] compiler directives
+@x
+@p program PLtoTF(@!pl_file,@!tfm_file,@!output);
+@y
+@p@{$MODE@,ISO@}
+@/
+@{$Q+@}
+@/
+@{$R+@}
+@#
+program PLtoTF(@!output);
+@z
+
+[6] open pl_file
+@x
+reset(pl_file);
+@y
+assign(pl_file, param_str(1));
+@#
+@{$I-@}
+@#
+ioresult; reset(pl_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open pl file: ', param_str(1));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@z
+
+
+[15] violation of ISO
+@x
+@!tfm_file:packed file of 0..255;
+@y
+@!tfm_file: packed file of byte;
+@z
+
+[16] open tfm_file
+@x
+rewrite(tfm_file);
+@y
+if paramcount <> 2 then begin
+ write_ln('Usage: ', param_str(0), ' pl_file tfm_file');
+ halt(1);
+ end;
+
+assign(tfm_file, param_str(2));
+@#
+@{$I-@}
+@#
+ioresult; rewrite(tfm_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open tfm file: ', param_str(2));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
+@z
diff --git a/systems/unix/tex-fpc/dvipsnk/MakeTeXPK b/systems/unix/tex-fpc/shell/MakeTeXPK
index 5145b09bfa..5145b09bfa 100755
--- a/systems/unix/tex-fpc/dvipsnk/MakeTeXPK
+++ b/systems/unix/tex-fpc/shell/MakeTeXPK
diff --git a/systems/unix/tex-fpc/shell/itgl b/systems/unix/tex-fpc/shell/itgl
index 2fca45acc6..d73dabd4fd 100755
--- a/systems/unix/tex-fpc/shell/itgl
+++ b/systems/unix/tex-fpc/shell/itgl
@@ -1,6 +1,7 @@
+# Tangles and then compiles web files. Keeps the pool file.
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
+fpc -Fasysutils,baseunix,unix ini$b.p
diff --git a/systems/unix/tex-fpc/shell/mkfont b/systems/unix/tex-fpc/shell/mkfont
index 06d8dd3506..34b2eb7849 100755
--- a/systems/unix/tex-fpc/shell/mkfont
+++ b/systems/unix/tex-fpc/shell/mkfont
@@ -1,11 +1,10 @@
-# Install .tfm and . pk files from .mf files for TeX-GPC
+# Install .tfm and . pk files from .mf files for TeX-FPC
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/'` \
diff --git a/systems/unix/tex-fpc/shell/mkpkfont b/systems/unix/tex-fpc/shell/mkpkfont
index 4eb23f8ac3..4d9dce3a1b 100755
--- a/systems/unix/tex-fpc/shell/mkpkfont
+++ b/systems/unix/tex-fpc/shell/mkpkfont
@@ -1,4 +1,5 @@
-# install pk-file from mf-file for TeX-GPC
+# install pk-file from mf-file for TeX-FPC
+# this script is used by xdvi
#
# xdvi expects the path name of the generated .pk file in the first
# line of stdout, so redirect mf's stdout to stderr.
diff --git a/systems/unix/tex-fpc/shell/tgl b/systems/unix/tex-fpc/shell/tgl
index cb390d3150..26c2bf2c2b 100755
--- a/systems/unix/tex-fpc/shell/tgl
+++ b/systems/unix/tex-fpc/shell/tgl
@@ -1,6 +1,7 @@
+# tangles and compiles web files. Sends the pool file to /dev/null.
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
+fpc -FaUnix,sysutils,baseunix $b.p
diff --git a/systems/unix/tex-fpc/web/tangle.ch b/systems/unix/tex-fpc/tangle.ch
index 97c7232edf..ee73c2a3c8 100644
--- a/systems/unix/tex-fpc/web/tangle.ch
+++ b/systems/unix/tex-fpc/tangle.ch
@@ -1,32 +1,26 @@
% 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
+\pageno=1 \advance\pageno by 1
\input webmac-fpc
\def\name{{\tt TANGLE}}
-\let\maybe=\iffalse % print changed modules only.
+\let\maybe=\iftrue % 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 is an adaption of Donald~E. Knuth's \.{TANGLE} to Unix and the
+Free Pascal Compiler~(FPC).
-This program expects four file names on the command line: Two input
+\namefpc\ 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.
+Pascal and string pool file.
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.
-
+an error occurred and three means \namefpc\ ended prematurely.
\hint
Comments and questions are welcome!
@@ -38,14 +32,7 @@ Comments and questions are welcome!
@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);
+@d banner=='This is TANGLE-FPC, 2nd ed.'
@z
[3] turn debugging on
@@ -57,23 +44,34 @@ program TANGLE(@!input,@!output);
@d gubed==
@z
-[3] turn stats on
+[2]
@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}
+program TANGLE(@!web_file,@!change_file,@!Pascal_file,@!pool);
@y
-@d stat==
-@d tats==
+program TANGLE(@!term_out);
@z
+[3] 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==
+ @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@}
+@{$MODE@,ISO@}
+@/
+@{$Q+@}
+@/
+@{$R+@}
@z
[7] default case branch
@@ -96,7 +94,7 @@ program TANGLE(@!input,@!output);
@y
@d term_out == output
@d term_in == input
-@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
+@d print(#)==write(#) {`|print|' means write on the terminal}
@z
[20] terminal output, implicitely defined in ISO Pasal
@@ -106,7 +104,7 @@ program TANGLE(@!input,@!output);
@y
@z
-[21] terminal output, output is rewritten implicitely in ISO Pascal
+[21] terminal output output is implicitely opened in Pascal
@x
@<Set init...@>=
rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
@@ -120,14 +118,33 @@ rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
@d update_terminal == do_nothing
@z
-[24] get file names from command line arguments
+[24] open input files
@x
+@p procedure open_input; {prepare to read |web_file| and |change_file|}
begin reset(web_file); reset(change_file);
+end;
@y
+@p procedure open_input; {prepare to read |web_file| and |change_file|}
begin
-assign(web_file, paramstr(1));
-assign(change_file, paramstr(2));
-reset(web_file); reset(change_file);
+assign(web_file, param_str(1));
+assign(change_file, param_str(2));
+@#
+@{$I-@}
+@#
+ioresult; reset(web_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open web file: ', param_str(1));
+ halt(1);
+ end;
+ioresult; reset(change_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open change file: ', param_str(2));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
+end;
@z
[26] get file names from command line arguments
@@ -135,10 +152,27 @@ reset(web_file); reset(change_file);
rewrite(Pascal_file); rewrite(pool);
@y
if paramcount <> 4 then begin
- fatal_error('Usage: ntangle web_file change_file pascal_file pool_file');
+ write_ln('Usage: ', param_str(0),
+ ' web_file change_file Pascal_file pool_file');
+ halt(1);
end;
-assign(Pascal_file, paramstr(3)); assign(pool, paramstr(4));
-rewrite(Pascal_file); rewrite(pool);
+assign(Pascal_file, param_str(3)); assign(pool, param_str(4));
+@#
+@{$I-@}
+@#
+ioresult; rewrite(Pascal_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open Pascal file: ', param_str(3));
+ halt(1);
+ end;
+ioresult; rewrite(pool);
+if ioresult <> 0 then begin
+ write_ln('Could not open pool file: ', param_str(4));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
@z
[38] increase token capacity to tangle mf.
@@ -160,11 +194,14 @@ reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
@y
@z
-[183] close output files
+[182] close output files
@x
-@t\4\4@>{here files should be closed if the operating system requires it}
+end_of_TANGLE:
+if string_ptr>256 then @<Finish off the string pool file@>;
@y
-close(Pascal_file); close(pool);
+if string_ptr>256 then @<Finish off the string pool file@>;
+close (Pascal_file); close (pool);
+end_of_TANGLE:
@z
[187] put eol after last terminal out line
diff --git a/systems/unix/tex-fpc/web/tangle.p b/systems/unix/tex-fpc/tangle.p
index fcb3927326..a34f81d7dd 100644
--- a/systems/unix/tex-fpc/web/tangle.p
+++ b/systems/unix/tex-fpc/tangle.p
@@ -1,4 +1,4 @@
-{2:}{4:}{$MODE ISO}{:4}PROGRAM TANGLE(INPUT,OUTPUT);LABEL 9999;
+{2:}{4:}{$MODE ISO}{$Q+}{$R+}{:4}PROGRAM TANGLE(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;
@@ -23,7 +23,7 @@ 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;
+{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;
@@ -43,21 +43,19 @@ 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;
+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,' ');
+BEGIN IF PHASEONE THEN{32:}BEGIN IF CHANGING THEN WRITE(
+'. (change file ')ELSE WRITE('. (');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(' ')ELSE WRITE(XCHR[BUFFER[
+K-1]]);WRITELN(OUTPUT);FOR K:=1 TO L DO WRITE(' ');
+FOR K:=L+1 TO LIMIT DO WRITE(XCHR[BUFFER[K-1]]);WRITE(' ');
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;
+FOR J:=1 TO OUTPTR DO WRITE(XCHR[OUTBUF[J-1]]);WRITE('... ');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]:='#';
@@ -85,21 +83,29 @@ XCHR[125]:='}';XCHR[126]:='~';XCHR[0]:=' ';XCHR[127]:=' ';
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;
+{:18}{26:}IF PARAMCOUNT<>4 THEN BEGIN WRITELN('Usage: ',PARAMSTR(0),
+' web_file change_file Pascal_file pool_file');HALT(1);END;
+ASSIGN(PASCALFILE,PARAMSTR(3));ASSIGN(POOL,PARAMSTR(4));{$I-}IORESULT;
+REWRITE(PASCALFILE);
+IF IORESULT<>0 THEN BEGIN WRITELN('Could not open Pascal file: ',
+PARAMSTR(3));HALT(1);END;IORESULT;REWRITE(POOL);
+IF IORESULT<>0 THEN BEGIN WRITELN('Could not open pool file: ',PARAMSTR(
+4));HALT(1);END;{$I+}{: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;
+BEGIN ASSIGN(WEBFILE,PARAMSTR(1));ASSIGN(CHANGEFILE,PARAMSTR(2));{$I-}
+IORESULT;RESET(WEBFILE);
+IF IORESULT<>0 THEN BEGIN WRITELN('Could not open web file: ',PARAMSTR(1
+));HALT(1);END;IORESULT;RESET(CHANGEFILE);
+IF IORESULT<>0 THEN BEGIN WRITELN('Could not open change file: ',
+PARAMSTR(2));HALT(1);END;{$I+}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
@@ -107,16 +113,15 @@ IF EOF(F)THEN INPUTLN:=FALSE ELSE BEGIN WHILE NOT EOLN(F)DO BEGIN BUFFER
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;
+WRITE('! 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;
+BEGIN IF P>=NAMEPTR THEN WRITE('IMPOSSIBLE')ELSE BEGIN W:=P MOD 2;
+FOR K:=BYTESTART[P]TO BYTESTART[P+2]-1 DO WRITE(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:=
@@ -132,12 +137,11 @@ 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];
+WRITELN(OUTPUT);WRITE('! 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;
+WRITE('! 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;
@@ -145,22 +149,21 @@ 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];
+BEGIN WRITELN(OUTPUT);WRITE('! Identifier conflict with ');END;
+FOR K:=BYTESTART[Q]TO BYTESTART[Q+2]-1 DO WRITE(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;
+WRITE('! Sorry, ','byte memory',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;IF NAMEPTR>MAXNAMES-2 THEN BEGIN WRITELN(OUTPUT);
+WRITE('! 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;
+WRITE('! 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;
@@ -180,20 +183,19 @@ 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;
+WRITE('! Sorry, ','byte memory',' capacity exceeded');ERROR;HISTORY:=3;
+JUMPOUT;END;IF NAMEPTR>MAXNAMES-2 THEN BEGIN WRITELN(OUTPUT);
+WRITE('! 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;
+WRITE('! 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
@@ -201,32 +203,31 @@ 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);
+WRITE('! Name does not match');ERROR;END ELSE BEGIN WRITELN(OUTPUT);
+WRITE('! 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;
+WRITE('! 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];
+BEGIN IF P>=TEXTPTR THEN WRITE('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,'@>');
+IF BYTEMEM[A MOD 2,BYTESTART[A]]=34 THEN WRITE('"')ELSE WRITE(' ');
+END ELSE IF A<208 THEN BEGIN WRITE('@<');
+PRINTID((A-168)*256+TOKMEM[ZP,K]);WRITE('@>');
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;}
+WRITE('@',XCHR[123],A:1,'@',XCHR[125]);END;
+END[:75]ELSE[76:]CASE A OF 9:WRITE('@',XCHR[123]);
+10:WRITE('@',XCHR[125]);12:WRITE('@''');13:WRITE('@"');125:WRITE('@$');
+0:WRITE('#');64:WRITE('@@');2:WRITE('@=');3:WRITE('@\');
+ELSE WRITE(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;
+WRITE('! 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;
@@ -235,8 +236,8 @@ 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];
+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;
@@ -260,64 +261,63 @@ 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;
+WRITELN(OUTPUT);WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;}
+WRITE('! 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;
+WRITE('! 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];
+WRITE('! 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;
+ELSE BEGIN WRITELN(OUTPUT);WRITE('! 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;
+OUTPUT);WRITE('! Not present: <');END;PRINTID(A);WRITE('>');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 LINE MOD 100=0 THEN BEGIN WRITE('.');
+IF LINE MOD 500=0 THEN WRITE(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;
+WRITE('! 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;
@@ -359,11 +359,11 @@ 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;
+WRITE('! 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;
+WRITE('! 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;
@@ -386,18 +386,17 @@ 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;
+WRITE('! 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;
+WRITE('! 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;
+IF N>=134217728 THEN BEGIN WRITELN(OUTPUT);WRITE('! 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;
@@ -417,16 +416,16 @@ 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};
+IF K=LINELENGTH THEN BEGIN WRITELN(OUTPUT);WRITE('! 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;
+END ELSE BEGIN WRITELN(OUTPUT);WRITE('! 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;
@@ -438,22 +437,21 @@ 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);
+WRITE('! 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;
+WRITE('! 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 K=LINELENGTH THEN BEGIN WRITELN(OUTPUT);WRITE('! 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;
@@ -463,10 +461,10 @@ 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;
+BEGIN WRITELN(OUTPUT);WRITE('! 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;
+WRITE('! 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;
@@ -474,33 +472,33 @@ 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;
+WRITE('! 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('! 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;
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;
+BEGIN WRITELN(OUTPUT);WRITE('! 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;
@@ -510,7 +508,7 @@ 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;
+42:BEGIN WRITE('*',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;
@@ -525,12 +523,11 @@ 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;
+WRITE('! 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;
+BEGIN BEGIN WRITELN(OUTPUT);WRITE('! 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;
@@ -553,26 +550,26 @@ 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;
+WRITE('! 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};
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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,'...');
+WRITE('! Section name too long: ');END;
+FOR J:=1 TO 25 DO WRITE(XCHR[MODTEXT[J]]);WRITE('...');
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]=
@@ -580,7 +577,7 @@ IF K>3 THEN BEGIN IF(MODTEXT[K]=46)AND(MODTEXT[K-1]=46)AND(MODTEXT[K-2]=
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;
+WRITE('! 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;
@@ -602,8 +599,8 @@ 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;
+125:BEGIN BEGIN WRITELN(OUTPUT);WRITE('! 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;
@@ -627,77 +624,76 @@ 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;
+WRITE('! Omit semicolon in numeric definition');ERROR;END;
ELSE{159:}BEGIN BEGIN WRITELN(OUTPUT);
-WRITE(OUTPUT,'! Improper numeric definition will be flushed');ERROR;END;
+WRITE('! 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;
+WRITE('! 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;
+41:IF BAL=0 THEN BEGIN WRITELN(OUTPUT);WRITE('! 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;
+);WRITE('! 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;
+);WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;
+BEGIN WRITELN(OUTPUT);WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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};
+WRITE('! 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;
+WRITE('! @',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;
+WRITE('! 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;
+WRITE('! Missing )');ERROR;END ELSE BEGIN WRITELN(OUTPUT);
+WRITE('! 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;
+OUTPUT);WRITE('! 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];
+WRITE('! 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;
@@ -708,7 +704,7 @@ 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 ',
+WRITE('! 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;
@@ -716,14 +712,14 @@ 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;
+WRITE('! 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;
+WRITE('! 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;
+WRITE('! 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);
@@ -735,59 +731,56 @@ 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;;
+WHILE TRUE DO BEGIN BEGIN WRITELN(OUTPUT);WRITE('#');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;
+3:FOR K:=1 TO DD DO WRITE(XCHR[BUFFER[K]]);
+4:FOR K:=1 TO DD DO WRITE(XCHR[MODTEXT[K]]);
+5:FOR K:=1 TO OUTPTR DO WRITE(XCHR[OUTBUF[K]]);
+6:FOR K:=1 TO DD DO WRITE(XCHR[OUTCONTRIB[K]]);ELSE WRITE('?')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, 2nd ed.');{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];
+WRITE('! 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;
+WRITE('! No output was specified.');END;IF HISTORY=0 THEN HISTORY:=1;
+END ELSE BEGIN BEGIN WRITELN(OUTPUT);WRITE('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;
+WRITE('! Program ended at brace level ',BRACELEVEL:1);ERROR;END;{:98};
+BEGIN WRITELN(OUTPUT);WRITE('Done.');END;END{:112};
+IF STRINGPTR>256 THEN{184:}BEGIN BEGIN WRITELN(OUTPUT);
+WRITE(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);
+END{:184};CLOSE(PASCALFILE);CLOSE(POOL);
+9999:{[186:]BEGIN WRITELN(OUTPUT);WRITE('Memory usage statistics:');END;
+BEGIN WRITELN(OUTPUT);
+WRITE(NAMEPTR:1,' names, ',TEXTPTR:1,' replacement texts;');END;
+BEGIN WRITELN(OUTPUT);WRITE(BYTEPTR[0]:1);END;
+FOR WO:=1 TO 1 DO WRITE('+',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);
+WRITE(' bytes, ',MAXTOKPTR[0]:1);
+FOR II:=1 TO 3 DO WRITE('+',MAXTOKPTR[II]:1);WRITE(' tokens.');[:186];}
{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;
+WRITE('(No errors were found.)');END;1:BEGIN WRITELN(OUTPUT);
+WRITE('(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}
+WRITE('(Pardon me, but I think I spotted something wrong.)');END;
+3:BEGIN WRITELN(OUTPUT);WRITE('(That was a fatal error, my friend.)');
+END;END;WRITELN(OUTPUT);HALT(HISTORY){:187};END.{:182}
diff --git a/systems/unix/tex-fpc/tech/schlicht.tex b/systems/unix/tex-fpc/tech/gauss.tex
index ce5a1eeb85..ecc42a3855 100644
--- a/systems/unix/tex-fpc/tech/schlicht.tex
+++ b/systems/unix/tex-fpc/tech/gauss.tex
@@ -6,7 +6,7 @@
\newlanguage\l@german \language=\l@german
\chardef\l@austrian=\language
\chardef\l@french=\language
-\input ghyph31
+\input dehypht.tex
\message{erledigt.}
%% auf USEnglisch voreinstellen
\language=\l@USenglish
diff --git a/systems/unix/tex-fpc/tech/german.ed b/systems/unix/tex-fpc/tech/german.ed
index 89ba82cf2f..3d41edf0c0 100644
--- a/systems/unix/tex-fpc/tech/german.ed
+++ b/systems/unix/tex-fpc/tech/german.ed
@@ -1,5 +1,6 @@
219c
\expandafter\def\csname grq \endcsname{%
.
+g/[^%]$/s//&%/
w
q
diff --git a/systems/unix/tex-fpc/tech/mktech b/systems/unix/tex-fpc/tech/mktech
index e81c623455..835141cbb9 100755
--- a/systems/unix/tex-fpc/tech/mktech
+++ b/systems/unix/tex-fpc/tech/mktech
@@ -2,16 +2,17 @@
# 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'
+sed /TRIESIZE=8000/s//TRIESIZE=16845/ ../tex/initex.p >initech.p \
+&& fpc -Fasysutils,baseunix,unix initech.p \
+&& initech 'gauss \dump' \
+|| (echo schief gelaufen; exit 1)
+#
# 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
+mv gauss.fmt TeXformats/gauss.fmt \
+&& sed -e /plain.fmt/s//gauss.fmt/\
+ -e /TRIESIZE=8000/s//TRIESIZE=16845/\
+ ../tex/tex.p >tech.p \
+&& fpc -Fasysutils,baseunix,unix tech.p \
+|| echo schief gelaufen.
diff --git a/systems/unix/tex-fpc/tech/readme b/systems/unix/tex-fpc/tech/readme
index 98ed483e67..2ee897d330 100644
--- a/systems/unix/tex-fpc/tech/readme
+++ b/systems/unix/tex-fpc/tech/readme
@@ -6,15 +6,15 @@ zu anderen Distributionen. Sie enth"alt US-Englisch und Deutsch
Installation:
Die deutschen Trennmuster holen:
-ftp ftp://ftp.dante.de/pub/tex/macros/ec-plain/ghyph31.tex
+ftp ftp://tug.org/tex-archive/language/hyphenation/dehyph/dehypht.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
+ftp ftp://tug.org/tex-archive/language/german/german.sty
-Diese Datei mit dem Datum vom 13.04.199 enth"alt einen Fehler,
+Diese Datei mit dem Datum vom 13.04.1999 enth"alt einen Fehler,
das \grq verschwindet. Mit
ed <german.ed german.sty
kann man diesen Fehler korrigieren.
diff --git a/systems/unix/tex-fpc/tech/test.tex b/systems/unix/tex-fpc/tech/test.tex
index d25c721da0..d3b8c872cb 100644
--- a/systems/unix/tex-fpc/tech/test.tex
+++ b/systems/unix/tex-fpc/tech/test.tex
@@ -1,9 +1,9 @@
\parindent=0pt
\overfullrule=0pt
-Hier wird gepr\"uft, ob die Einstellungen von plain \TeX erhalten bleiben.
+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
+\ifnum\righthyphenmin=3\else\errmessage{righthyphenmin nicht 3}\fi
\par und jetzt geht's los:
\input german.sty
diff --git a/systems/unix/tex-fpc/tex-fpc.pdf b/systems/unix/tex-fpc/tex-fpc.pdf
index 6222dd48d6..d57450f062 100644
--- a/systems/unix/tex-fpc/tex-fpc.pdf
+++ b/systems/unix/tex-fpc/tex-fpc.pdf
Binary files differ
diff --git a/systems/unix/tex-fpc/tex.ch b/systems/unix/tex-fpc/tex.ch
new file mode 100644
index 0000000000..491307d948
--- /dev/null
+++ b/systems/unix/tex-fpc/tex.ch
@@ -0,0 +1,1425 @@
+% This is a change file of TeX, Wolfgang Helbig, Nov. 2007-Nov. 2020
+
+[0] About TeX-FPC
+Strangely, the first page is page 3
+@x
+\pageno=3
+@y
+@z
+@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 TeXinputs/webmac-fpc
+\pagewidth=14.8 cm % Close to the original book format.
+\setpage
+
+\emergencystretch 0.6in % avoid overfull boxes
+
+\let\maybe=\iffalse % maybe -> print all, notmaybe -> 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 an adaption of Donald~E. Knuth's \TeX82 in
+the version 3.14159265 from January 2014 to Free~Pascal (FPC) and Unix.
+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 F} adds a feature as suggested by Knuth
+\item{\bf P} fixes a violation of Pascal (Jensen, Wirth: {\sl Pascal
+User Manual and Report\/}, 3rd edition, 1985)
+\item{\bf X} describes an FPC extension
+\item{\bf U} necessary change in Unix
+\item{\bf u} enhances usability in a Unix enviroment
+\medskip
+\item{(1)} \marke E \TeX82\ deletes area and extension of an input
+file name and then only shows the base name of the file during error
+recovery.
+
+\item{(2)} \TeX82 prunes discardable nodes from the beginning of a
+new line until it reaches a nondiscardable node. This might leave
+you with an empty box resulting in an \.{Underfull box} warning.
+Btw, I discovered this bug while trying to prove the line breaking
+algorithm, not through by testing. In this regard, I go with Dijkstra, not
+with Knuth.
+
+\item{(3)} \TeX\ fails to respect end of file (Control-D) from
+terminal oinput during debug dialog.
+
+\item{(3)}
+Igor Liferenko reported an extra space in the transcript file and
+a missing last line terminator on terminal output after user switched
+to \.{/batchmode} during error recovery.
+
+\medskip
+\item{(1)}\marke F\namefpc\ treats the command line as the first input line;
+
+\item{(2)}\namefpc\ starts \.{vi} if the user types `\.{E}' during
+error recovery.
+
+\item{(3)}You can interrupt \namefpc\ by typing `\.{Control-C}'.
+
+\medskip
+\item{(1)}\marke P \TeX82 assumes that the terminal input file is
+positioned {\sl before\/} the first character after being opened,
+whereas \namefpc\ assumes that it is positioned {\sl at\/} the first
+character, thus complying with the Pascal standard.
+
+\item{(2)} The names of the standard text files must occur in the
+program header whenever they are used.
+
+\item{(3)} The standard text files must not be declared. Declared files
+with the name of the standard text files are new internal files.
+
+\item{(4)} The program must not open the standard text files.
+
+\medskip
+\item{(1)} \marke X FPC's extensions are needed to specify a file name
+at run time, to check the existence of files and to access the
+system date and time. Identifiers from FPC~Pascal are prefixed
+with \\{fpc\_} to help distinguish them from Pascal and \.{WEB}
+identifiers and to avoid name clashes. Furthermore all FPC~Pascal
+identifiers will appear together in the index.
+
+\medskip
+\item{(1)}\marke U The Unix file seperator is `\.{/}'
+instead of `\.{:}'.
+\medskip
+\item{(1)}\marke u On exit, \namefpc\ passes its `history' to the
+operating system. This integer is zero when everything is fine,
+one when something less serious like an overfull box was detected,
+two when an error happened like an undefined control sequence, and
+three when the program aborted because one of its tables overflowed
+or because it couldn't find an input file while running in batch
+mode.
+
+\item{(2)} Valid input characters are the 94~visible ASCII characters
+together with the three control characters horizontal tabulator,
+form~feed, and space.
+
+\item{(3)} Terminate last line on terminal. This is Unix, not DOS!
+
+\item{(4)} Teach \TeX\ and user how to end the terminal input by Control-D.
+
+\break
+Like Dijkstra,
+\.{http://www.cs.utexas.edu/users/EWD/videos/noorderlicht.mpg},
+I dislike version numbers---I consider \namefpc\ finished.
+I'd rather maintain invariants---not software.
+\address
+\fi
+@z
+
+
+% \TeX82 will emit an underfull box warning here, \namefpc\ won't.
+\setbox0=\hbox to \hsize {\hfil\ \strut}
+\noindent\box0\ \ \par
+\bigskip
+\fi
+
+[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].
+
+Even though \namefpc\ does not differ from \TeX\ I proudly change
+the banner! And take responsibility for any error.
+
+@d banner=='This is TeX-FPC, 2nd ed.'
+@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 parameter list of the program header.
+
+@d term_in==i @& n @& p @& u @& t
+@d term_out==o @& u @& t @& p @& u @& t
+@d mtype==t @& y @& p @& e
+@z
+
+[4] program header
+@x
+program TEX; {all file names are defined dynamically}
+@y
+program TEX(@!term_in,@!term_out);
+@z
+
+[4] forward definition of signal catcher
+@x
+procedure initialize; {this procedure gets things started properly}
+@y
+procedure catch_signal(i: integer); interrupt@, forward;@t\2@>
+procedure initialize; {this procedure gets things started properly}
+@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 debug
+ @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 stats
+ @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''.
+Turn off checking since the debugger might trigger a range
+check when it accesses subfields of a memory word without knowing
+what it is reading.
+Overflow is checked if the result of an integer operation overflows
+the range of 64bit |integer|.
+FPC in default mode neither provides |goto| nor the I/O
+procedures |get| and |put|, and 16-bit |integer|. The compiler
+directive MODE ISO fixes all of it.
+
+@^system dependencies@>
+@^FPC 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
+@{$MODE@,ISO@} {turn on mode ISO}
+@{$Q+@} {turn on overflow checking}
+@{$R+@} {turn on range checking}
+@!debug
+@{$Q-@}@,
+@{$R-@}@+
+gubed {turn off all checks when 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
+
+The changes headed by trip need to be made for the trip test suite.
+ For trip activate all changeblocks with the first line @x trip.
+
+ [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 U Unix filename. }
+@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
+
+[23] we accept horizontal tab and form feed!
+@x
+right of these assignment statements to |chr(i)|.
+@y
+right of these assignment statements to |chr(i)|.
+
+\marke u In Unix tab and form feed are valid characters.
+The plain format categorizes the tab as a spacer and form feed
+as an active character defined as \.{\\outer\\par}.
+@z
+
+[23] continued
+@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\marke u}
+xchr[@'14] := chr(@'14); {accept form feed}
+@z
+
+[25] the type of text_files is text
+@x
+@!alpha_file=packed file of text_char; {files that contain textual data}
+@y
+@!alpha_file=t @& e @& x @& t; {\marke P the type of text files is |text|}
+@z
+
+[25] continued
+@x
+@!byte_file=packed file of eight_bits; {files that contain binary data}
+@y
+@!byte_file=packed file of eight_bits; {files that contain binary data}
+@!untyped_file=file; {untyped files for buffered output}
+@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
+The procedure |fpc_assign| assigns an external file name to a file.
+The function |fpc_io_result| returns a nonzero value if any
+error occurred since the last invocation of |fpc_io_result|.
+The runtime system halts the program when it experiences an
+I/O error. Since \namefpc\ wants to survive while trying to open
+a nonexistence file, it turns off I/O checking for the open procedures.
+
+@^FPC 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
+@p function a_open_in(var f:alpha_file):boolean;
+ {open a text file for input}
+begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
+@y
+@p
+@{@&$I-@} {turn of I/O checking}
+@#
+function a_open_in(var f:alpha_file):boolean;
+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
+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
+
+@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);
+end;
+@y
+begin clear_io_result; fpc_assign(f,name_of_file); rewrite(f);
+w_open_out:=rewrite_OK(f);
+end;
+@#
+@{@&$I+@} {turn on I/O checking}
+@z
+
+[31] bypass eoln
+@x
+finer tuning is often possible at well-developed \PASCAL\ sites.
+@y
+finer tuning is often possible at well-developed \PASCAL\ sites.
+@^|bypass eoln|@>
+
+\marke P Standard Pascal never suppresses the first get, so |input_ln|
+must not bypass the first character of the first line. To maintain
+this rule for subsequent lines, |input_ln| is changed to bypass the
+end of line character at the end of line.
+@z
+
+[31] bypass eoln
+@x
+begin if bypass_eoln then if not eof(f) then get(f);
+@y
+begin
+@z
+
+[31] bypass eoln
+@x
+ last:=last_nonblank; input_ln:=true;
+ end;
+@y
+ last:=last_nonblank; input_ln:=true;
+ read_ln(f);
+ end;
+@z
+
+[31] re-engineered input_ln
+ @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
+ Unlike \TeX82 \namefpc\ leaves trailing spaces in the input line.
+
+ \marke N
+ Whenever |input_ln| is to read the first line of a disk file,
+ |bypass_eoln| is set to |false|, in all other cases it is set to
+ |true|. This causes |input_ln| to advance the file pointer. For
+ the first line, in ISO-Pascal and FPC-Pascal this is done by |reset()|
+ -- on terminals and disk files alike. But \TeX82 turns this off
+ for the terminal, so the old |input_line| has to advance the file
+ pointer if reading the first line from a terminal. On return, the
+ old |input_ln| leaves the file position at the end-of-line marker,
+ which is to be bypassed on next invocation.
+
+ The new |input_ln| bypasses the end-of-line marker allways at the
+ end of line and never at the beginning of line. In other words
+ |reset| establishes and |input_ln| maintains the invariant:
+
+ \centerline {The file is positioned at the first character of the
+ line or |eof|}
+
+ \marke N
+ `To hell with ``meaningful identifiers''!': The parameter |bypass_eoln|
+ does not always cause |input_ln| to bypass an end-of-line marker.
+ And the size of the buffer is not |buf_size| but |buf_size+1|. And
+ the end-of-line marker is not a start-of-line marker!
+
+ @p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean;
+ {inputs the next line or returns |false|}
+ begin
+ {|f| is positioned at the first character of the line, or |eof(f)|}
+ 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 to the first character of next line}
+ input_ln:=true
+ end
+ {|f| is positioned at the first character of the next line, or |eof(f)|}
+ 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 No need to declare standard input/output in standard Pascal.
+@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
+In Unix, nothing needs to be done here.
+
+@^FPC 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
+
+[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 X
+An |@!fpc_string| is a |packed array[1..fpc_length] of
+char| with varying length.
+The function |@!fpc_length(s)| returns the length of the |fpc_string@,
+s|.
+The function |@!fpc_param_count| returns the number of
+command line arguments less one.
+The function |@!fpc_param_str(n)|
+returns the n-th argument for |0 <= n <= fpc_param_count|.
+
+\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.
+
+@^FPC Pascal@>
+@^system dependencies@>
+
+@d loc==cur_input.loc_field {location of first unread character in |buffer|}
+@d fpc_string == s@& h@& o@& r@& t @& 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
+
+@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
+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;
+@y
+\marke F The command line is treated as the first terminal line.
+
+\marke u Tell user to end the terminal file by Control-D.
+
+@p function init_terminal:boolean; {gets the terminal input started}
+label exit;
+begin t_open_in; input_command_ln;
+loc := first;
+if loc<last then
+ begin init_terminal:=true; return; {first line is the command line}
+ end;
+loop@+begin write(term_out,'**');
+@z
+
+[37] chatty
+ @x chatty
+ write(term_out,'! End of file on the terminal... why?');
+ @.End of file on the terminal@>
+ @y
+ @z
+
+[37] hint Control-D
+@x
+ write_ln(term_out,'Please type the name of your input file.');
+@y
+ write_ln(term_out,'Please type the name of your input file or Control-D.');@/
+@z
+
+[51] leave tex.pool open
+@x
+@ @d bad_pool(#)==begin wake_up_terminal; write_ln(term_out,#);
+ a_close(pool_file); get_strings_started:=false; return;
+@y
+@ @d bad_pool(#)==begin wake_up_terminal; write_ln(term_out,#);
+ get_strings_started:=false; return;
+@z
+
+[51] TANGLE would'nt help, but update
+@x
+done: if a<>@$ then bad_pool('! TEX.POOL doesn''t match; TANGLE me again.');
+@y
+done: if a<>@$ then bad_pool('! TeXformats/tex.pool doesn''t match.');
+@z
+
+[79] start editor
+@x
+@!use_err_help:boolean; {should the |err_help| list be shown?}
+@y
+@^Editor@>
+@!use_err_help:boolean; {should the |err_help| list be shown?}
+@!want_edit: boolean; {start \.{vi}?}
+@z
+
+[80] initial value for edit arguments
+@x
+help_ptr:=0; use_err_help:=false;
+@y
+@^Editor@>
+help_ptr:=0; use_err_help:=false;@/
+want_edit := false; {\marke F don't start \.{ed}}
+@z
+
+[84] set edit_cmd
+@x
+ begin print_nl("You want to edit file ");
+@.You want to edit file x@>
+ slow_print(input_stack[base_ptr].name_field);
+ print(" at line "); print_int(line);
+ interaction:=scroll_mode; jump_out;
+ end;
+@y
+@^Editor@>
+ begin print_nl("You want to edit file ");
+@.You want to edit file x@>
+ slow_print(input_stack[base_ptr].name_field);
+ print(" at line "); print_int(line);
+ interaction:=scroll_mode;
+ want_edit := true;
+ jump_out;
+ end;
+@z
+
+[86] extra space in log and missing last line terminator on terminal
+@x
+"Q":begin print_esc("batchmode"); decr(selector);
+ end;
+@y
+"Q":print_esc("batchmode");
+{ \marke E don't turn off terminal now }
+@z
+
+[86] continued
+@x
+print("..."); print_ln; update_terminal; return;
+@y
+print("..."); print_ln; update_terminal;
+if c="Q" then decr(selector); return; { but now }
+@z
+
+[109] fpc_single for glue ratio.
+@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| seems 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 FPC~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
+
+[241]
+@x
+@p procedure fix_date_and_time;
+begin time:=12*60; {minutes since midnight}
+day:=4; {fourth day of the month}
+month:=7; {seventh month of the year}
+year:=1776; {Anno Domini}
+end;
+@y
+\marke X The functions |now|, |decodedate|, and |decodetime| are provided
+by the unit |sysutils|. The command line option \.{fpc~-Fasysutils~tex.p}
+links that unit.
+@^system dependencies@>
+@^sysutils@>
+@^FPC Pascal@>
+When FPC is in ISO mode, it does not accept declaring a |unit| in the source
+file.
+@dfpc_now == now
+@dfpc_decode_date == decodedate
+@dfpc_decode_time == decodetime
+@p procedure fix_date_and_time;
+var yy,mm,dd: word;
+ hh,ss,ms: word;
+begin
+fpc_decode_date(fpc_now,yy,mm,dd); {current date}
+day := dd;
+month := mm;
+year := yy;@/
+fpc_decode_time(fpc_now,hh,mm,ss,ms); {current time}
+time := hh*60+mm; {minutes since midnight}
+end;
+@z
+
+[360] Don't print empty lines
+ @x chatty
+ @ 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 a spurious ugly empty line.
+ Calling |print_nl("")| is smarter. It ends the current
+ line only if it is not empty.
+ @z
+
+ @x chatty
+ if limit=start then {previous line was empty}
+ print_nl("(Please type a command or say `\end')");
+ @.Please type...@>
+ print_ln; first:=start;
+ @y
+ if limit=-1 then {previous line was empty}
+ print_nl("(Please type a command or say `\end')");
+ @.Please type...@>
+ 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
+
+\marke X With Free~Pascal you cannot set the length of a |packed
+array|. And with Unix, it does not help to blank out the rest of
+the |array|. But assigning the |name_of_file| to an |fpc_string|,
+setting the length of the |fpc_string| and then assigning it back
+to the |name_of_file| seems to work. @^FPC Pascal@>
+
+@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|}
+@!s: fpc_string;
+@z
+
+[519] pack file name
+@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;
+s := name_of_file;
+fpc_set_length(s, name_length);
+name_of_file := s;
+end;
+@z
+
+[521] Unix file separator
+@x
+TEX_format_default:='TeXformats:plain.fmt';
+@y
+TEX_format_default:='TeXformats/plain.fmt';
+ {``/'' is the Unix file name separator\marke U}
+@z
+
+[523] packed buffered name
+@x
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+@y
+@^FPC Pascal@>
+@!j:integer; {index into |buffer| or |TEX_format_default|}
+s: fpc_string;
+@z
+
+[523] packed buffered name
+@x
+for k:=name_length+1 to file_name_size do name_of_file[k]:=' ';
+@y
+s := name_of_file; fpc_set_length(s, name_length); name_of_file := s;
+@z
+
+[530] Control D will help
+@x
+print_nl("Please type another "); print(s);
+@y
+print_nl("Please type another "); print(s); print(" or Control-D");
+@z
+
+[537] Editor
+@x
+@ Let's turn now to the procedure that is used to initiate file reading
+when an `\.{\\input}' command is being processed.
+
+@y
+@ Let's turn now to the procedure that is used to initiate file reading
+when an `\.{\\input}' command is being processed.
+@^Editor@>
+@^Fix@>
+
+\marke E Keep the complete file name since it might be needed to
+be passed to the system editor.
+(\TeX82 strips off area and extension to conserve string
+pool space.)
+@z
+
+[537] never flush file name
+@x
+if name=str_ptr-1 then {we can conserve string pool space now}
+ begin flush_string; name:=cur_name;
+ end;
+@y
+@^Editor@>
+@z
+
+[575] Don't check eof (fpc bug: eof off by one)
+@x
+if eof(tfm_file) then abort;
+@y
+@^FPC-EOF@>
+@z
+
+[597] buffered write
+@x
+output an array of words with one system call.
+@y
+output an array of words with one system call.
+@^FPC-buffer@>
+
+\marke P The procedure |fpc_blockwrite| takes a file, the first
+byte in a buffer and the number of bytes to be written as parameters
+and writes all bytes with one system call. This in fact speeds up
+\namefpc.
+
+@d fpc_blockwrite == b @& l @& o @& c @& k @& w @& r @& i @& t @& e
+@z
+
+[597] use buffered i/o to speed up TeX
+@x
+var k:dvi_index;
+begin for k:=a to b do write(dvi_file,dvi_buf[k]);
+@y
+begin fpc_blockwrite(dvi_file, dvi_buf[a], b-a+1);
+@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@>
+@^\TeX-Bug@>
+
+\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
+
+ [1265] empty line after change of interaction mode
+ @x chatty
+ begin print_ln;
+ @y
+ begin print_nl(""); { print new line only if current line not empty \marke h}
+ @z
+
+[1327] eof is broken
+@x
+if (x<>69069)or eof(fmt_file) then goto bad_fmt
+@y
+if (x<>69069) then goto bad_fmt
+@^FPC-EOF@>
+@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 X The procedure |@!fpc_halt| terminates the program and passes its
+parameter to the shell.
+
+@^system dependencies@>
+@^FPC Pascal@>
+@^Unix@>
+
+@d fpc_halt == h@&a@&l@&t
+@z
+
+[1332] simulate tex, not virtex
+ @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:
+if want_edit then exec_editor; {user typed `\.{E}' \marke F}
+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 u
+Terminate the last line on the terminal.
+@z
+
+[1333] print last end-of-line marker if needed
+@x
+ slow_print(log_name); print_char(".");
+@y
+ slow_print(log_name); print_char("."); print_ln;
+@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
+ read(term_in,m);
+@y
+ if eof(term_in) then return; {\marke P never |read| at |eof|}
+ 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; {\marke P never |read| at |eof|}
+ 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; {\marke P never |read| at |eof| }
+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 F If the user typed |'E'| to edit a file after confronted
+with an error message, \TeX\ will clean up and then call |edit|
+as its last feat.
+@^Editor@>
+
+This procedure must not print error messages, since all files are already
+closed.
+
+Beware of using any \.{WEB} strings like \.{"vi +"} since that
+would change the string pool file and you'll need to rebuild all
+format files with the new string pool in case you disagree which
+editor is the system editor.
+
+An overflow of |name_of_file| cannot happen, since |name_of_file|
+kept the file name while the file was being opened.
+/marke F
+The procedure @!|exec_edit| starts \.{vi} passing line number and
+file name.
+
+\marke X
+This procedure executes the Unix system editor, which is \.{ed} of course.
+@^Editor@>
+In case you disagree, modify all four definitions of |ed|, |de|, |vi|, |iv|
+to select code that executes \.{vi} instead. This not just changes
+the name of the system editor, but it adds one argument that contains the
+line number to the argument vector.
+The argument vector for the system editor has two entries:
+
+\indent \.{ed file-name}
+
+\noindent And the argument vector for the west coast editor three:
+
+\indent\.{vi +line file-name}
+
+The system call @!|fpc_fp_exec_vp| expects two parameters, namely
+the name of the editor to be loaded and the argument vector, an
+|array| of the arguments to be passed to the editor. Unix replaces
+the code of \TeX\ by the code of the editor without forking a new
+process. On success this procedure does not return.
+
+The type @!|fpc_pchar| is a pointer to a character. An argument is
+a null-terminated |packed array of char|. The \.{@@}-operator applied
+to an argument evaluates to the address of the first entry, i.e
+a pointer to a character.
+
+The function |fpc_fp_exec_vp| wants the argument vector to be passed
+as a pointer to a pointer to a character. An |array|~parameter is
+always passed as the address of its first entry. Therefore we must
+not apply the \.{@@}-operator to the parameters of |fpc_fp_exec_vp|.
+
+Note that the name of the binary is passed twice, namely as the
+first parameter and as the first entry of the second argument.
+|fpc_fp_exec_vp| searches for the binary in the \.{PATH}. And then
+it seems to replace |argv[0]| by the full name of the editor. At
+least this is what \.{ps -f} shows and might be a bug.
+
+The procedure |fpc_fp_exec_vp| is provided by the |unit@,unix|.
+@^|unit unix|@> The command line option \.{-Faunix} links to that
+unit. @^unix@>
+
+@^FPC Pascal@>
+@^system dependencies@>
+
+@d fpc_fp_exec_vp == fp_exec_vp
+@d fpc_pchar == pchar
+@d edit_file == input_stack[base_ptr].name_field
+@#
+@d vi==@{ {change this to `$\\{vi}\equiv\null$' when you think \.{vi}
+is the system editor}
+@d iv==@t@>@} {change this to `$\\{iv}\equiv\null$' when you think \.{vi}
+is the sytem editor}
+@f vi == begin
+@f iv == end
+@d ed== {change this to `$\\{ed}\equiv\.{@@\{}$' when you think \.{vi}
+is the system editor}
+@d de== {change this to `$\\{de}\equiv\.{@@\}}$' when you think \.{vi}
+is the system editor}
+@f ed == begin
+@f de == end
+
+@<Last-minute...@>=
+procedure exec_editor;
+const arg_size = 100; {maximal size of each of the arguments}
+ vi editor = 'vi'; {name of the binary to be started}
+ iv
+ @#
+ ed editor = 'ed'; {name of the binary to be started}
+ de
+ @#
+ editor_length = 2; {length of the name}
+var i, l: integer; {index into args}
+ j: pool_pointer; {index into |str_pool|}
+ s: str_number; {string to hold line number}
+ sel: integer; {save selector}
+ editor_arg, line_arg, file_arg : array[1..arg_size] of char; {arguments}
+ argv: array [0..3] of fpc_pchar; {vector of arguments}
+begin
+ l := editor_length;
+ for j := 1 to l do editor_arg[j] := editor[j];
+ editor_arg[l+1] := chr(0);@/
+ sel := selector;
+ selector := new_string;
+ print_int(line);
+ selector := sel;
+ s := make_string;
+ line_arg[1] := '+';
+ j := str_start[s];
+ l := length(s)+1;
+ for i := 2 to l do begin line_arg[i] := xchr[str_pool[j]]; incr(j) end;
+ line_arg[l+1] := chr(0);
+ @#
+ j := str_start[edit_file];
+ l := length(edit_file);
+ if l+1 > arg_size then begin
+ write_ln('File name longer than 100 bytes! Nice try!');
+ halt(100);
+ end;
+ for i := 1 to l do
+ begin file_arg[i] := xchr[str_pool[j]]; incr(j)
+ end;
+ file_arg[l+1] := chr(0);
+ @#
+ argv[0] := @@editor_arg;
+ vi
+ argv[1] := @@line_arg;
+ argv[2] := @@file_arg;
+ argv[3] := nil;
+ iv
+ @#
+ ed
+ argv[1] := @@file_arg;
+ argv[2] := nil;
+ de
+ @#
+ fpc_fp_exec_vp(editor, argv);
+ write_ln('Sorry, executing the editor failed.');
+end;
+
+@ \marke X
+A signal handler is a procedure that takes one |integer| parameter.
+The procedure |fpc_fp_signal| takes two parameter, an integer and
+a signal handler. The integer is the number of the signal. When
+the program receives a signal with the designated number, the signal
+handler gets invoked.
+
+The integer |fpc_SIGINT| is the number of the interrupt signal.
+The system interrupts the program, when the user types \.{\^C}.
+
+If |fpc_fp_get_errno| returns an integer that is not zero, an error
+occurred.
+
+The identifier |fpc_signal_handler| denotes the |type| of a
+pointer to a signal handler. Since this is foreign to Pascal,
+we use the type cast to |fpc_signal_handler| as a kludge.
+
+The functions related to installing a signal handler are provided
+by the |unit@,baseunix|. @^|baseunix|@>
+The command line option \.{-Fabaseunix} links to that unit.
+@^FPC Pascal@>
+@^system dependencies@>
+
+@d fpc_signal_handler == signal@&ha@&ndler
+@d fpc_fp_signal == fp_signal
+@d fpc_SIGINT == SIGINT
+@d fpc_fp_get_errno ==f@&p@&g@&e@&t@&e@&r@&r@&n@&o
+
+@<Set initial values ...@>+=
+
+fpc_fp_signal(fpc_SIGINT, fpc_signal_handler(catch_signal));
+if fpc_fp_get_errno <> 0 then
+ write_ln('Could not install signal handler:', fpc_fp_get_errno);
+
+@ \marke X The signal handler has the modifier |interrupt|. Modifiers
+are an extension of FPC Pascal. This one makes the compiler generate
+code suitable for a signal handler, which must not return to the
+caller, i.e. the system, but to the instruction where the program
+was interrupted.
+
+@^FPC Pascal@>
+@^dirty \PASCAL@>
+@^system dependencies@>
+
+@<Error handling ...@>+=
+procedure catch_signal; interrupt;
+begin
+ interrupt := i;
+end;
+@z
diff --git a/systems/unix/tex-fpc/tex/otex.ch b/systems/unix/tex-fpc/tex/otex.ch
deleted file mode 100644
index d84408e65d..0000000000
--- a/systems/unix/tex-fpc/tex/otex.ch
+++ /dev/null
@@ -1,1070 +0,0 @@
-% 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
deleted file mode 100644
index 18cec3b8ea..0000000000
--- a/systems/unix/tex-fpc/tex/tex.ch
+++ /dev/null
@@ -1,1059 +0,0 @@
-% 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/tftopl.ch b/systems/unix/tex-fpc/tftopl.ch
new file mode 100644
index 0000000000..2989bfa028
--- /dev/null
+++ b/systems/unix/tex-fpc/tftopl.ch
@@ -0,0 +1,112 @@
+This is a change file of TFtoPL for TeX-FPC, Wolfgang Helbig, Oct. 2020
+
+[0] About TFtoPL-FPC
+@x
+\pageno=\contentspagenumber \advance\pageno by 1
+@y
+\pageno=\contentspagenumber \advance\pageno by 1
+\input webmac-fpc
+
+% \let\maybe=\iftrue % uncomment to print changed modules only.
+
+\def\name{\tt TFtoPL}
+
+\N0\*. About \namefpc.\fi
+This is an adaption of Donald~E. Knuth's \.{TFtoPL}, to Unix.
+\namefpc\ is based on the Free~Pascal Compiler.
+
+\namefpc\ expects the name of the input file (\.{.pl}) as the first
+and the name of the output file (\.{.tf}) as the second parameter
+on the command line.
+
+\hint
+
+Comments and questions are welcome!
+
+\bigskip
+\address
+@z
+
+[1] Change the banner line
+@x
+@d banner=='This is TFtoPL, Version 3.3' {printed when the program starts}
+@y
+@d banner=='This is TFtoPL-FPC, 2nd ed.' {printed when the program starts}
+@z
+
+
+[2] filenames from commandline
+@x
+@p program TFtoPL(@!tfm_file,@!pl_file,@!output);
+@y
+@p @{$MODE@,ISO@}
+@/
+@{$Q+@}
+@/
+@{$R+@}
+@#
+program TFtoPL(@!output);
+@z
+
+[6] violation of ISO
+@x
+@!tfm_file:packed file of 0..255;
+@y
+@!tfm_file: packed file of byte;
+@z
+
+[7] open tfm file
+@x
+reset(tfm_file);
+@y
+if paramcount <> 2 then begin
+ write_ln('Usage: ', param_str(0), ' tfm_file pl_file');
+ halt(1);
+ end;
+assign(tfm_file, param_str(1));
+@#
+@{$I-@}
+@#
+ioresult; reset(tfm_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open tfm file: ', param_str(1));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
+@z
+
+[17] open pl file
+@x
+rewrite(pl_file);
+@y
+assign(pl_file, param_str(2));
+@#
+@{$I-@}
+@#
+ioresult; rewrite(pl_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open pl file: ', param_str(2));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@z
+
+[20] eof off by one, FPC-BUG
+@x
+ begin if eof(tfm_file) then
+ abort('The file has fewer bytes than it claims!');
+@y
+ begin
+@z
+
+[99] close pl file
+@x
+final_end:end.
+@y
+close(pl_file);
+@#
+final_end:end.
+@z
diff --git a/systems/unix/tex-fpc/trap/diff_trap.fot b/systems/unix/tex-fpc/trap/diff_trap.fot
new file mode 100644
index 0000000000..781928a0e0
--- /dev/null
+++ b/systems/unix/tex-fpc/trap/diff_trap.fot
@@ -0,0 +1,10 @@
+1c1
+< This is METAFONT-FPC (INIMF)
+---
+> This is METAFONT, Version 2.7182818 (INIMF)
+21a22
+>
+38c39
+< String usage 41&161 (817&7699 still untouched)
+---
+> String usage 41&161 (815&7634 still untouched)
diff --git a/systems/unix/tex-fpc/trap/diff_trap.log b/systems/unix/tex-fpc/trap/diff_trap.log
new file mode 100644
index 0000000000..45ca04b762
--- /dev/null
+++ b/systems/unix/tex-fpc/trap/diff_trap.log
@@ -0,0 +1,118 @@
+1c1
+< This is METAFONT-FPC, 2nd ed. (preloaded base=trap 2020.10.20) 20 OCT 2020 09:21
+---
+> This is METAFONT, Version 2.7182818 (preloaded base=trap 2014.1.7) 7 JAN 2014 18:11
+76a77
+>
+1824c1825
+< String usage 24&92 (860&11374 still untouched)
+---
+> String usage 24&92 (858&11309 still untouched)
+3692,3694c3693,3695
+< xpart %CAPSULE1370=xx
+< %CAPSULE1378=2yy-2
+< %CAPSULE1386 = 3.3333xx+3.3333
+---
+> xpart %CAPSULE1359=xx
+> %CAPSULE1367=2yy-2
+> %CAPSULE1375 = 3.3333xx+3.3333
+3754,3756c3755,3757
+< xpart %CAPSULE604 = 8000o2-4000o1+1000o3+9
+< xpart %CAPSULE1394=xpart '
+< ypart %CAPSULE1394=ypart '
+---
+> xpart %CAPSULE1049 = 8000o2-4000o1+1000o3+9
+> xpart %CAPSULE1383=xpart '
+> ypart %CAPSULE1383=ypart '
+3759,3760c3760,3761
+< ### 4000o1 = -xpart %CAPSULE604+8000o2+1000o3+9
+< ### -4.87383o2 = -oo-0.0004xpart %CAPSULE604+0.39673o3-17.99643
+---
+> ### 4000o1 = -xpart %CAPSULE1049+8000o2+1000o3+9
+> ### -4.87383o2 = -oo-0.0004xpart %CAPSULE1049+0.39673o3-17.99643
+3767c3768
+< ### -alfa=-xpart %CAPSULE368
+---
+> ### -alfa=-xpart %CAPSULE1494
+3769,3770c3770,3771
+< {xpart((xpart %CAPSULE368,0))}
+< ### -xpart %CAPSULE17=-%CAPSULE1376
+---
+> {xpart((xpart %CAPSULE1494,0))}
+> ### -xpart %CAPSULE17=-%CAPSULE1176
+3772,3774c3773,3775
+< {(%CAPSULE382)+(%CAPSULE1376)}
+< ### -%CAPSULE382=-%CAPSULE1364+%CAPSULE1376
+< ### -%CAPSULE1364=-ypart %CAPSULE604
+---
+> {(%CAPSULE382)+(%CAPSULE1176)}
+> ### -%CAPSULE382=-%CAPSULE1893+%CAPSULE1176
+> ### -%CAPSULE1893=-ypart %CAPSULE1049
+3779c3780
+< ### p$=-ypart %CAPSULE1360+1
+---
+> ### p$=-ypart %CAPSULE604+1
+3781,3792c3782,3793
+< {(2/3)*((-ypart %CAPSULE1360+1,ypart %CAPSULE1360))}
+< ### ypart %CAPSULE1360=-xpart %CAPSULE1360+1
+< ### -0.66667xpart %CAPSULE1360=-xpart %CAPSULE1744
+< {-((xpart %CAPSULE1744,-xpart %CAPSULE1744+0.66667))}
+< ### xpart %CAPSULE1744=-xpart %CAPSULE1675
+< {((xpart %CAPSULE604,ypart %CAPSULE604))=((xpart %CAPSULE1675,-xpart %CA
+< PSULE1675-0.66667))}
+< ## xpart %CAPSULE1675=-ypart %CAPSULE604-0.66667
+< ## ypart %CAPSULE604=-xpart %CAPSULE604-0.66667
+< ### -xpart %CAPSULE604=-xpart %CAPSULE1675
+< {((xpart ',ypart '))=((xpart %CAPSULE1675,-xpart %CAPSULE1675-0.66667))}
+< ## xpart %CAPSULE1675=-ypart '-0.66667
+---
+> {(2/3)*((-ypart %CAPSULE604+1,ypart %CAPSULE604))}
+> ### ypart %CAPSULE604=-xpart %CAPSULE604+1
+> ### -0.66667xpart %CAPSULE604=-xpart %CAPSULE1889
+> {-((xpart %CAPSULE1889,-xpart %CAPSULE1889+0.66667))}
+> ### xpart %CAPSULE1889=-xpart %CAPSULE1172
+> {((xpart %CAPSULE1049,ypart %CAPSULE1049))=((xpart %CAPSULE1172,-xpart %
+> CAPSULE1172-0.66667))}
+> ## xpart %CAPSULE1172=-ypart %CAPSULE1049-0.66667
+> ## ypart %CAPSULE1049=-xpart %CAPSULE1049-0.66667
+> ### -xpart %CAPSULE1049=-xpart %CAPSULE1172
+> {((xpart ',ypart '))=((xpart %CAPSULE1172,-xpart %CAPSULE1172-0.66667))}
+> ## xpart %CAPSULE1172=-ypart '-0.66667
+3798c3799
+< ### -ooo=-%CAPSULE1051
+---
+> ### -ooo=-%CAPSULE1494
+3800,3809c3801,3810
+< {(%CAPSULE1051)+(1)}
+< ### -%CAPSULE1051=-%CAPSULE1378+1
+< {(1/2)*(%CAPSULE1378)}
+< ### -0.5%CAPSULE1378=-%CAPSULE1370
+< {-(%CAPSULE1370)}
+< ### %CAPSULE1370=-%CAPSULE1362
+< {(2)*(%CAPSULE1362)}
+< ### -2%CAPSULE1362=-%CAPSULE1354
+< {(-0.5%CAPSULE1354-0.5)=(%CAPSULE1354)}
+< ## %CAPSULE1354=-0.33333
+---
+> {(%CAPSULE1494)+(1)}
+> ### -%CAPSULE1494=-%CAPSULE1350+1
+> {(1/2)*(%CAPSULE1350)}
+> ### -0.5%CAPSULE1350=-%CAPSULE1367
+> {-(%CAPSULE1367)}
+> ### %CAPSULE1367=-%CAPSULE1893
+> {(2)*(%CAPSULE1893)}
+> ### -2%CAPSULE1893=-%CAPSULE1885
+> {(-0.5%CAPSULE1885-0.5)=(%CAPSULE1885)}
+> ## %CAPSULE1885=-0.33333
+3965a3967
+>
+4233c4235
+< String usage 41&161 (817&7699 still untouched)
+---
+> String usage 41&161 (815&7634 still untouched)
+4249,4250c4251,4252
+< 68 strings out of 885
+< 3752 string characters out of 11451
+---
+> 68 strings out of 883
+> 3752 string characters out of 11386
diff --git a/systems/unix/tex-fpc/trap/diff_trap.pl b/systems/unix/tex-fpc/trap/diff_trap.pl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/systems/unix/tex-fpc/trap/diff_trap.pl
diff --git a/systems/unix/tex-fpc/trap/diff_trap.typ b/systems/unix/tex-fpc/trap/diff_trap.typ
new file mode 100644
index 0000000000..6eb5b34b08
--- /dev/null
+++ b/systems/unix/tex-fpc/trap/diff_trap.typ
@@ -0,0 +1,8 @@
+1c1
+< This is GFtype, Version 3.1
+---
+> This is GFtype-FPC, 2nd ed.
+3c3
+< ' METAFONT output 2014.01.07:1811'
+---
+> ' METAFONT output 2020.10.19:2226'
diff --git a/systems/unix/tex-fpc/trap/diff_trapin.log b/systems/unix/tex-fpc/trap/diff_trapin.log
new file mode 100644
index 0000000000..7e589355e7
--- /dev/null
+++ b/systems/unix/tex-fpc/trap/diff_trapin.log
@@ -0,0 +1,14 @@
+1c1
+< This is METAFONT-FPC, 2nd ed. (INIMF) 20 OCT 2020 09:18
+---
+> This is METAFONT, Version 2.7182818 (INIMF) 7 JAN 2014 17:51
+150c150
+< String usage 26&83 (893&11504 still untouched)
+---
+> String usage 26&83 (891&11438 still untouched)
+176,177c176,177
+< (preloaded base=trap 2020.10.20)
+< 1115 strings of total length 20549
+---
+> (preloaded base=trap 2014.1.7)
+> 1117 strings of total length 20614
diff --git a/systems/unix/tex-fpc/trap/report b/systems/unix/tex-fpc/trap/report
new file mode 100644
index 0000000000..639eccab79
--- /dev/null
+++ b/systems/unix/tex-fpc/trap/report
@@ -0,0 +1,59 @@
+How to perform the trap test according to the trapman file.
+
+Step 0.
+Move the trap directory to the mf directory, and cd to the trap directory.
+This protects the original files like trap.log from being overwritten.
+Copy trap.mf to the trap directory.
+$ cp ../trap.mf .
+
+Step 1. Prepare a version of inimf. You might want to use the nifty
+script mktrap:
+$ cd ..
+$ mktrap
+...
+$ itgl mf.web mf.ch
+...
+$ mv inimf ~/bin
+$ cd -
+
+Step 2. run inimf
+$ inimf
+This is METAFONT-FPC, 2nd ed. (INIMF)
+**
+Please type the name of your input file or Control-D.
+**\input trap
+...
+
+Step 3. run inimf again
+$ inimf
+This is METAFONT-FPC, 2nd ed. (INIMF)
+** &trap trap
+...
+See diff_trapin.log for the differences of ../trapin.log and trapin.log
+
+Step 4. trap.log differs from the master ../trap.log more than
+expected. Reason: Don Knuth changed the log files from the 2008
+distribution manually. He didn't want to wait for a reference installation
+of TeX and friends. He could have taken a slightly modified TeX-GPC!
+But from 2008 to 2014 the one and only change in mf resulted in
+changed addresses of the capsules. Which are not harmful. I undid
+the change of the 2014 distribution and voila, the difference of
+the addresses was gone.
+
+See diff_trap.log for the differences of ../trap.log and trap.log
+
+See diff_trap.fot for the differences of ../trap.fot and trap.fot
+
+Step 5. Check the generic font file:
+$ gftype trap.72270gf trap.typ
+This is GFtype-FPC, 2nd ed.
+Mnemonic output? (default=no, ? for help): y
+Pixel output? (default=yes, ? for help): y
+
+See diff_trap.typ for the differences of ../trap.typ and trap.typ.
+
+Step 6.
+$ tftopl trap.tfm trap.pl
+...
+
+The file diff_trap.pl is empty!
diff --git a/systems/unix/tex-fpc/trip/diff_trip.fot b/systems/unix/tex-fpc/trip/diff_trip.fot
new file mode 100644
index 0000000000..0d141edb62
--- /dev/null
+++ b/systems/unix/tex-fpc/trip/diff_trip.fot
@@ -0,0 +1,4 @@
+1c1
+< This is TeX-FPC, 2nd ed. (INITEX)
+---
+> This is TeX, Version 3.14159265 (INITEX)
diff --git a/systems/unix/tex-fpc/trip/diff_trip.log b/systems/unix/tex-fpc/trip/diff_trip.log
new file mode 100644
index 0000000000..0a1a5f42ca
--- /dev/null
+++ b/systems/unix/tex-fpc/trip/diff_trip.log
@@ -0,0 +1,10 @@
+1c1
+< This is TeX-FPC, 2nd ed. (preloaded format=trip 2020.11.14) 14 NOV 2020 20:58
+---
+> This is TeX, Version 3.14159265 (preloaded format=trip 2014.1.7) 7 JAN 2014 09:59
+7296,7297c7296,7297
+< 49 strings out of 1676
+< 273 string characters out of 8422
+---
+> 47 strings out of 1674
+> 253 string characters out of 8354
diff --git a/systems/unix/tex-fpc/trip/diff_trip.log300 b/systems/unix/tex-fpc/trip/diff_trip.log300
new file mode 100644
index 0000000000..f3d2e58e3d
--- /dev/null
+++ b/systems/unix/tex-fpc/trip/diff_trip.log300
@@ -0,0 +1,42 @@
+1,3c1,3
+< This is TeX, Version 3.14159265 (preloaded format=trip 2014.1.7) 7 JAN 2014 09:59
+< ** &trip trip
+< (trip.tex ##
+---
+> This is TeX-FPC, 2nd ed. (preloaded format=trip 2020.11.14) 14 NOV 2020 20:12
+> ** &trip ../trip
+> (../trip.tex ##
+870c870
+< \vbox(924.23029+1.0)x0.0, glue set 3.19875 []}
+---
+> \vbox(924.23029+1.0)x0.0, glue set 3.19873 []}
+883c883
+< \vbox(924.23029+1.0)x0.0, glue set 3.19875
+---
+> \vbox(924.23029+1.0)x0.0, glue set 3.19873
+3488c3488
+< .............\hbox(14.00002+2.0)x8.19003, glue set 1.09502fil
+---
+> .............\hbox(14.00002+2.0)x8.19003, glue set 1.095fil
+3512c3512
+< .................\hbox(16.0+4.00002)x6.00002, glue set 0.00002fil
+---
+> .................\hbox(16.0+4.00002)x6.00002, glue set 0.0fil
+7133c7133
+< ..|hbox(0.0+0.0)x0.99, glue set 0.49501fil
+---
+> ..|hbox(0.0+0.0)x0.99, glue set 0.495fil
+7296,7297c7296,7297
+< 47 strings out of 1674
+< 253 string characters out of 8354
+---
+> 50 strings out of 1675
+> 279 string characters out of 8416
+7302c7302
+< 7i,7n,9p,113b,38s stack positions out of 200i,40n,60p,500b,600s
+---
+> 7i,7n,9p,116b,38s stack positions out of 200i,40n,60p,500b,600s
+7304c7304
+< Output written on trip.dvi (16 pages, 2920 bytes).
+---
+> Output written on trip.dvi (16 pages, 2924 bytes).
diff --git a/systems/unix/tex-fpc/trip/diff_trip.typ b/systems/unix/tex-fpc/trip/diff_trip.typ
new file mode 100644
index 0000000000..00ee02fdb5
--- /dev/null
+++ b/systems/unix/tex-fpc/trip/diff_trip.typ
@@ -0,0 +1,8 @@
+1c1
+< This is DVItype-FPC, 2nd ed.
+---
+> This is DVItype, Version 3.6
+9c9
+< ' TeX output 2020.11.14:2058'
+---
+> ' TeX output 2014.01.07:0959'
diff --git a/systems/unix/tex-fpc/trip/diff_tripin.log b/systems/unix/tex-fpc/trip/diff_tripin.log
new file mode 100644
index 0000000000..ed7e3fec2f
--- /dev/null
+++ b/systems/unix/tex-fpc/trip/diff_tripin.log
@@ -0,0 +1,14 @@
+1,3c1,3
+< This is TeX-FPC, 2nd ed. (INITEX) 14 NOV 2020 20:09
+< **\input ../trip
+< (../trip.tex
+---
+> This is TeX, Version 3.14159265 (INITEX) 7 JAN 2014 09:09
+> **\input trip
+> (trip.tex
+450,451c450,451
+< (preloaded format=trip 2020.11.14)
+< 1325 strings of total length 23584
+---
+> (preloaded format=trip 2014.1.7)
+> 1326 strings of total length 23646
diff --git a/systems/unix/tex-fpc/trip/report b/systems/unix/tex-fpc/trip/report
new file mode 100644
index 0000000000..dfe6472d82
--- /dev/null
+++ b/systems/unix/tex-fpc/trip/report
@@ -0,0 +1,69 @@
+This directory suggests how to perform the trip test as described in the
+tripman file.
+
+Step 0.
+mv the trip directory to the tex directory, and cd to the trip directory.
+This protects the original files like trip.log to be overwritten.
+
+Step 1. make and test trip.tfm
+$ pltotf ../trip.pl trip.tfm
+This is PLtoTF-FPC, 2nd ed.
+'000 '055 '057 '061 '062 '063 '064 '065
+'066 '067 '101 '102 '103 '115 '141 '142
+'160 '161 '162 '163 '164 '165 '202.
+$ tftopl trip.tfm tmp.pl
+This is TFtoPL-FPC, 2nd ed.
+'000 '055 '057 '061 '062 '063 '064 '065
+'066 '067 '101 '102 '103 '115 '141 '142
+'160 '161 '162 '163 '164 '165 '202.
+$ diff tmp.pl ../trip.pl
+no news are good news!
+
+Step 2 prepare tex.ch with the handy mktrip script.
+$ cd ..
+$ mktrip
+37493
+...
+$ itgl tex.web tex.ch
+This is TANGLE-FPC, 2nd ed.
+...
+(No errors were found.)
+$ mv initex ~/bin/
+$ cd -
+
+Step 3
+$ initex
+This is TeX-FPC, 2nd ed. (INITEX)
+**
+Please type the name of your input file or Control-D.
+**\input ../trip
+...
+
+Step 4
+This is TeX-FPC, 2nd ed. (INITEX)
+** &trip ../trip
+(../trip.tex ##
+! Bad number (-7).
+...
+Step 5; compare with original files:
+$ diff tripin.log ../tripin.log >mydiff_tripin.log
+... etc. for trip.log, trip.fot,
+Note: The files diff_.. are distributed in this directory.
+Note: I performed the trip test with two versions of initex: One compiled
+by FPC 3.0.0 and one compiled by FPC 3.2.0. They seemed to use different
+floating point implementations as the glue set differences demonstrate. See
+the file diff_trip.log300 (fpc 3.0.0) and diff_trip.log (fpc 3.2.0).
+fpc 3.2.0 seems to have the same floating point implementation as Knuth's
+implementation.
+Note: I copied the terminal window to create the trip.fot. It contains
+both what I typed in and what tex printed.
+
+Step 6
+The file options relieves you from typing the options manually.
+
+$ dvitype trip.dvi trip.typ <options
+This is DVItype-FPC, 2nd ed.
+Output level (default=4, ? for help): Starting page (default=*): Maximum number of pages (default=1000000): Assumed device resolution in pixels per inch (default=300/1): New magnification (default=0 to keep the old one): $
+
+The file diff_trip.typ contains the differences of my run to Knuth's.
+
diff --git a/systems/unix/tex-fpc/web/weave.ch b/systems/unix/tex-fpc/weave.ch
index bcb0a7e7d5..e476736c28 100644
--- a/systems/unix/tex-fpc/web/weave.ch
+++ b/systems/unix/tex-fpc/weave.ch
@@ -9,13 +9,14 @@
\pageno=\contentspagenumber \advance\pageno by 1
\input webmac-fpc
\def\name{\tt WEAVE}
+\tracingstats=1
-\let\maybe=\iffalse % print changed modules only.
+\let\maybe=\iftrue % 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.
+from December 2002, to Unix. \namefpc\ is based on FPC~Pascal,
+version 3.2.0.
This program expects three file names on the command line: A
web~file (\.{.web}), a change~file (\.{.ch}), and a \TeX~file
@@ -32,6 +33,13 @@ 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.
+These commands will do:
+
+{\obeylines
+\indent\.{sed s/MEMMAX=30000/MEMMAX=32000/ ../tex.p >tex.p}
+\indent\.{fpc -Fasysutils,baseunix tex.p}
+}
+
\medskip
Comments and questions are welcome!
\bigskip
@@ -42,18 +50,18 @@ Comments and questions are welcome!
@x
@d banner=='This is WEAVE, Version 4.4'
@y
-@d banner=='This is WEAVE-FPC'
+@d banner=='This is WEAVE-FPC, 2nd. ed'
@z
-[2] terminal output and input
+[2] program header
@x
program WEAVE(@!web_file,@!change_file,@!tex_file);
@y
-program WEAVE(@!input,@!output);
+program WEAVE(@!output);
@z
[3] shift left to turn debugging on, shift right to turn it off
- @x
+ @x debug
@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
@y
@@ -61,23 +69,27 @@ program WEAVE(@!input,@!output);
@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
+ [3] turn stats on
+ @x stats
+ @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@}
+@{$MO@&DE@,ISO@}
+@/
+@{$Q+@}
+@/
+@{$R+@}
@z
[7] default case branch
@@ -98,7 +110,6 @@ program WEAVE(@!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
@@ -124,14 +135,28 @@ rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
@d update_terminal == do_nothing
@z
-[24] get file names from command line arguments
+[24] open input files
@x
begin reset(web_file); reset(change_file);
+end;
@y
begin
-assign(web_file, param_str(1));
-assign(change_file, param_str(2));
-reset(web_file); reset(change_file);
+assign(web_file, param_str(1)); assign(change_file, param_str(2));
+@{$I-@}
+@#
+ioresult; reset(web_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open web file: ', param_str(1));
+ halt(1);
+ end;
+ioresult; reset(change_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open change file: ', param_str(2));
+ halt(1);
+ end;
+@#
+@{$I+@}
+end;
@z
[26] get file names from command line
@@ -139,10 +164,21 @@ reset(web_file); reset(change_file);
rewrite(tex_file);
@y
if param_count <> 3 then begin
- fatal_error('Usage: weave web-file change-file TeX-file');
+ write_ln('Usage: ', param_str(0), ' web-file change-file TeX-file');
+ halt(1);
end;
assign(tex_file, param_str(3));
-rewrite(tex_file);
+@#
+@{$I-@}
+@#
+ioresult; rewrite(tex_file);
+if ioresult <> 0 then begin
+ write_ln('Could not open tex_file: ', param_str(3));
+ halt(1);
+ end;
+@#
+@{$I+@}
+@#
@z
[258] Don't define Pascal's standard text files
@@ -168,9 +204,10 @@ reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
[261] close tex_file
@x
-@t\4\4@>{here files should be closed if the operating system requires it}
+end_of_WEAVE:
@y
fpc_close(tex_file);
+end_of_WEAVE:
@z
[263] put eol after last terminal out line
diff --git a/systems/unix/tex-fpc/lib/webmac-fpc.tex b/systems/unix/tex-fpc/webmac-fpc.tex
index 92ee9c8aef..5d1e3af2ef 100644
--- a/systems/unix/tex-fpc/lib/webmac-fpc.tex
+++ b/systems/unix/tex-fpc/webmac-fpc.tex
@@ -1,8 +1,9 @@
% TeX-FPC extensions to WEB macros
+\tracingonline=1
\def\namefpc{$\hbox{\name}{}_{\fam0 FPC}$}
\def\TeXfpc{\TeX$_{\fam0 FPC}$}
\def\address{{\parindent0pt\sl
- March 2019
+ November 2020
Wolfgang Helbig, Programmierer\hfill
@@ -12,5 +13,5 @@
\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
+the README file in the \TeXfpc\ distribution and the \.{WEB} manual
in Knuth's distribution (\.{webman.tex}).}
diff --git a/systems/unix/tex-fpc/xdvi/README b/systems/unix/tex-fpc/xdvi/README
index 42961d2288..5e1c79750d 100644
--- a/systems/unix/tex-fpc/xdvi/README
+++ b/systems/unix/tex-fpc/xdvi/README
@@ -1,12 +1,12 @@
-How to install xdvi for TeX-GPC:
+How to install xdvi for TeX-FPC:
Get the source from
- https://math.berkeley.edu/~vojta/xdvi/xdvi-22.85.tar.gz
-It unpacks into xdvi-22.85.
+ https://math.berkeley.edu/~vojta/xdvi/xdvi-22.86.tar.gz
+It unpacks into xdvi-22.86.
-Edit config reflecting your binary directory, your man directory
+Edit the file 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
+man1) and the resolution of your printer and then switch to xdvi-22.86
and run
../config && make clean && make && make install
@@ -14,11 +14,26 @@ 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.
+For Mac OS X it gets more involved:
+gcc -g creates files with the suffix .dSYM. The configure script
+then takes .dSYM as the suffix of executables, and thus breaks.
-The xdvi is configured soley by DVIPSconf/XDvi, move XDvi to DVIPSconf.
+The libraries in Mac OS X have the suffix .dynlib which breaks the
+configure script.
+
+See the file configdiff for the changes.
+
+A third error is to be fixed in xdvi.h, where symbol _XOPEN_SOURCE
+is defined. Remove the line, since the definition of _XOPEN_SOURCE
+causes NSIG to be not defined, which breaks signal.h.
+
+To fix the configure file either apply the changes in configdiff
+to it or replace it by the file macconfigure.
+
+Ignore the install-data error from make install.
+
+The file $HOME/Xdvi will be read by xdvi.
+An example configuration file is Xdvi.
You might want to change /etc/man.conf to include your private man pages.
I boldly replaced the line
@@ -26,7 +41,5 @@ _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/Xdvi b/systems/unix/tex-fpc/xdvi/Xdvi
new file mode 100644
index 0000000000..5e7a9d64a7
--- /dev/null
+++ b/systems/unix/tex-fpc/xdvi/Xdvi
@@ -0,0 +1,11 @@
+! Options for xdvi for TeX-FPC:
+! Adapt pixelsPerInch to the resoulution of your printer.
+! mfMode is irrelavant in TeX-FPC (it is configured in mkpkfonts and mkfonts),
+! if set it breaks automatic .pk font making.
+xdvi*pixelsPerInch: 600
+xdvi*geometry: 760x715+0+0
+xdvi*background: white
+xdvi*paper: a4
+xdvi*shrinkFactor: 5
+xdvi*expert: 1
+xdvi*tickUnits: pt
diff --git a/systems/unix/tex-fpc/xdvi/config b/systems/unix/tex-fpc/xdvi/config
index dd8c2f9707..10cd9f4c94 100755
--- a/systems/unix/tex-fpc/xdvi/config
+++ b/systems/unix/tex-fpc/xdvi/config
@@ -1,15 +1,12 @@
# 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 \
+--disable-freetype \
--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
+--without-mfmode
diff --git a/systems/unix/tex-fpc/xdvi/configdiff b/systems/unix/tex-fpc/xdvi/configdiff
new file mode 100644
index 0000000000..d0d6c46ff0
--- /dev/null
+++ b/systems/unix/tex-fpc/xdvi/configdiff
@@ -0,0 +1,12 @@
+1010c1010
+< *.c | *.o | *.obj | *.dSYM) ;;
+---
+> *.c | *.o | *.obj) ;;
+1159c1159
+< for ac_extension in a so sl dylib; do
+---
+> for ac_extension in a so sl; do
+1318c1318
+< for ac_extension in a so sl dylib; do
+---
+> for ac_extension in a so sl; do
diff --git a/systems/unix/tex-fpc/xdvi/macconfigure b/systems/unix/tex-fpc/xdvi/macconfigure
index 71a46d4953..bdf9b63e31 100755
--- a/systems/unix/tex-fpc/xdvi/macconfigure
+++ b/systems/unix/tex-fpc/xdvi/macconfigure
@@ -55,6 +55,9 @@ 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
+ --enable-freetype[=DIR] compile with the freetype2 library (default: enabled);
+ DIR=path of freetype-config binary"
+ac_help="$ac_help
--with-default-texmf-path=PATH
set default texmf list to PATH"
ac_help="$ac_help
@@ -70,6 +73,21 @@ ac_help="$ac_help
--with-default-fig-path=PATH
set default figure path to PATH"
ac_help="$ac_help
+ --with-default-dvips-cf-path=PATH
+ set default dvips configuration file path to PATH"
+ac_help="$ac_help
+ --with-default-fontmap-path=PATH
+ set default path for fontmap files to PATH"
+ac_help="$ac_help
+ --with-default-enc-path=PATH
+ set default path for encoding files to PATH"
+ac_help="$ac_help
+ --with-default-type1-path=PATH
+ set default path for type 1 fonts to PATH"
+ac_help="$ac_help
+ --with-default-gs-lib-path=PATH
+ set default path for finding font aliases to PATH"
+ac_help="$ac_help
--with-default-source-path=PATH
set default path for source specials to PATH"
ac_help="$ac_help
@@ -609,7 +627,7 @@ 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
+echo "configure:631: 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
@@ -639,7 +657,7 @@ 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
+echo "configure:661: 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
@@ -690,7 +708,7 @@ fi
# 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
+echo "configure:712: 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
@@ -722,10 +740,9 @@ fi
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
+echo "configure:744: 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'
@@ -734,12 +751,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 737 "configure"
+#line 755 "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
+if { (eval echo configure:760: \"$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
@@ -765,12 +782,12 @@ 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 "configure:786: 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
+echo "configure:791: 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
@@ -779,7 +796,7 @@ else
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
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:800: \"$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
@@ -798,7 +815,7 @@ 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
+echo "configure:819: 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
@@ -860,7 +877,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# 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
+echo "configure:881: 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
@@ -913,12 +930,12 @@ 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
+echo "configure:934: 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"
+#line 939 "configure"
#include "confdefs.h"
int main() {
@@ -929,7 +946,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -946,19 +963,19 @@ 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
+echo "configure:967: 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"
+#line 972 "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
+if { (eval echo configure:979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -975,10 +992,9 @@ 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
+echo "configure:998: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -988,7 +1004,7 @@ 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
+ if { (eval echo configure:1008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj | *.dSYM) ;;
@@ -998,10 +1014,11 @@ else
else
{ echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
fi
- rm -rf conftest*
+ rm -f 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
@@ -1021,7 +1038,7 @@ 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
+echo "configure:1042: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1036,13 +1053,13 @@ else
# 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"
+#line 1057 "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; }
+{ (eval echo configure:1063: \"$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
:
@@ -1053,13 +1070,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1056 "configure"
+#line 1074 "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; }
+{ (eval echo configure:1080: \"$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
:
@@ -1070,13 +1087,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1073 "configure"
+#line 1091 "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; }
+{ (eval echo configure:1097: \"$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
:
@@ -1105,7 +1122,7 @@ echo "$ac_t""$CPP" 1>&6
# 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
+echo "configure:1126: 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
@@ -1135,12 +1152,11 @@ if mkdir conftestdir; then
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
+ for ac_extension in a so sl 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
@@ -1169,12 +1185,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 1171 "configure"
+#line 1189 "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; }
+{ (eval echo configure:1194: \"$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*
@@ -1243,14 +1259,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1245 "configure"
+#line 1263 "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
+if { (eval echo configure:1270: \"$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.
@@ -1299,7 +1315,7 @@ for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
/usr/openwin/share/lib \
; \
do
- for ac_extension in dylib; do
+ for ac_extension in a so sl dylib; do
if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
@@ -1356,17 +1372,17 @@ else
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
+echo "configure:1376: 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"
+#line 1379 "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
+if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -1385,14 +1401,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 1387 "configure"
+#line 1405 "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
+if { (eval echo configure:1412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@@ -1427,7 +1443,7 @@ rm -f conftest*
# 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
+echo "configure:1447: 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
@@ -1435,7 +1451,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1437 "configure"
+#line 1455 "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
@@ -1446,7 +1462,7 @@ 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
+if { (eval echo configure:1466: \"$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
@@ -1468,7 +1484,7 @@ 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
+echo "configure:1488: 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
@@ -1476,7 +1492,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1478 "configure"
+#line 1496 "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
@@ -1487,7 +1503,7 @@ 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
+if { (eval echo configure:1507: \"$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
@@ -1516,12 +1532,12 @@ fi
# 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
+echo "configure:1536: 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"
+#line 1541 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -1544,7 +1560,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:1546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1564: \"$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
@@ -1565,7 +1581,7 @@ 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
+echo "configure:1585: 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
@@ -1573,7 +1589,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1575 "configure"
+#line 1593 "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
@@ -1584,7 +1600,7 @@ 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
+if { (eval echo configure:1604: \"$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
@@ -1614,12 +1630,12 @@ fi
# -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
+echo "configure:1634: 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"
+#line 1639 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -1642,7 +1658,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:1644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1662: \"$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
@@ -1663,7 +1679,7 @@ 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
+echo "configure:1683: 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
@@ -1671,7 +1687,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1673 "configure"
+#line 1691 "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
@@ -1682,7 +1698,7 @@ 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
+if { (eval echo configure:1702: \"$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
@@ -1706,12 +1722,12 @@ 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
+echo "configure:1726: 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"
+#line 1731 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -1734,7 +1750,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1754: \"$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
@@ -1755,7 +1771,7 @@ 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
+echo "configure:1775: 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
@@ -1763,7 +1779,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1765 "configure"
+#line 1783 "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
@@ -1774,7 +1790,7 @@ 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
+if { (eval echo configure:1794: \"$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
@@ -1798,12 +1814,12 @@ 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
+echo "configure:1818: 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"
+#line 1823 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -1826,7 +1842,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1846: \"$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
@@ -1847,7 +1863,7 @@ 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
+echo "configure:1867: 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
@@ -1855,7 +1871,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1857 "configure"
+#line 1875 "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
@@ -1866,7 +1882,7 @@ 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
+if { (eval echo configure:1886: \"$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
@@ -1899,7 +1915,7 @@ fi
# 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
+echo "configure:1919: 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
@@ -1907,7 +1923,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1909 "configure"
+#line 1927 "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
@@ -1918,7 +1934,7 @@ 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
+if { (eval echo configure:1938: \"$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
@@ -1952,17 +1968,17 @@ 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
+echo "configure:1972: 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"
+#line 1977 "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; }
+{ (eval echo configure:1982: \"$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*
@@ -1992,12 +2008,12 @@ 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
+echo "configure:2012: 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"
+#line 2017 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2005,7 +2021,7 @@ else
#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; }
+{ (eval echo configure:2025: \"$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*
@@ -2022,7 +2038,7 @@ 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"
+#line 2042 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2040,7 +2056,7 @@ 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"
+#line 2060 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2061,7 +2077,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2063 "configure"
+#line 2081 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2072,7 +2088,7 @@ 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
+if { (eval echo configure:2092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2094,7 +2110,7 @@ if test $ac_cv_header_stdc = yes; then
EOF
echo $ac_n "checking for X11/Xosdefs.h""... $ac_c" 1>&6
-echo "configure:2096: checking for X11/Xosdefs.h" >&5
+echo "configure:2114: 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
@@ -2105,12 +2121,12 @@ else
fi
else
cat > conftest.$ac_ext <<EOF
-#line 2107 "configure"
+#line 2125 "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; }
+{ (eval echo configure:2130: \"$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*
@@ -2137,17 +2153,17 @@ 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
+echo "configure:2157: 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"
+#line 2162 "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; }
+{ (eval echo configure:2167: \"$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*
@@ -2178,12 +2194,12 @@ 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
+echo "configure:2198: 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"
+#line 2203 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -2191,7 +2207,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:2193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -2216,7 +2232,7 @@ 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
+echo "configure:2236: 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
@@ -2224,7 +2240,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2226 "configure"
+#line 2244 "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
@@ -2235,7 +2251,7 @@ 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
+if { (eval echo configure:2255: \"$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
@@ -2257,7 +2273,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:2259: checking for opendir in -lx" >&5
+echo "configure:2277: 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
@@ -2265,7 +2281,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2267 "configure"
+#line 2285 "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
@@ -2276,7 +2292,7 @@ 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
+if { (eval echo configure:2296: \"$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
@@ -2299,12 +2315,12 @@ 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
+echo "configure:2319: 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"
+#line 2324 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -2320,7 +2336,7 @@ 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
+if { (eval echo configure:2340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -2343,14 +2359,14 @@ fi
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:2345: checking whether byte ordering is bigendian" >&5
+echo "configure:2363: 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"
+#line 2370 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -2361,11 +2377,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:2363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2381: \"$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"
+#line 2385 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -2376,7 +2392,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:2378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -2396,7 +2412,7 @@ 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"
+#line 2416 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -2409,7 +2425,7 @@ main () {
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
+if { (eval echo configure:2429: \"$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
@@ -2432,9 +2448,8 @@ 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
+echo "configure:2453: 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
@@ -2442,7 +2457,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2443 "configure"
+#line 2461 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -2460,7 +2475,7 @@ main()
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
+if { (eval echo configure:2479: \"$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
@@ -2485,12 +2500,12 @@ 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
+echo "configure:2504: 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"
+#line 2509 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2499,7 +2514,7 @@ puts("Testing" " string" " concatenation");
; return 0; }
EOF
-if { (eval echo configure:2500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
xdvi_cc_concat=yes
else
@@ -2522,12 +2537,12 @@ EOF
fi
echo $ac_n "checking for stropts.h and isastream()""... $ac_c" 1>&6
-echo "configure:2523: checking for stropts.h and isastream()" >&5
+echo "configure:2541: 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"
+#line 2546 "configure"
#include "confdefs.h"
#include <stropts.h>
@@ -2539,7 +2554,7 @@ 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
+if { (eval echo configure:2558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_cv_sys_streams=yes
else
@@ -2559,7 +2574,7 @@ EOF
fi
echo $ac_n "checking for SunOS 4""... $ac_c" 1>&6
-echo "configure:2560: checking for SunOS 4" >&5
+echo "configure:2578: 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
@@ -2578,7 +2593,7 @@ 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
+echo "configure:2597: 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
@@ -2597,12 +2612,12 @@ EOF
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2598: checking for off_t" >&5
+echo "configure:2616: 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"
+#line 2621 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2630,12 +2645,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2631: checking for pid_t" >&5
+echo "configure:2649: 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"
+#line 2654 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2663,12 +2678,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2664: checking for size_t" >&5
+echo "configure:2682: 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"
+#line 2687 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2696,12 +2711,12 @@ EOF
fi
echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:2697: checking for ptrdiff_t" >&5
+echo "configure:2715: 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"
+#line 2720 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2729,12 +2744,12 @@ 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
+echo "configure:2748: 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"
+#line 2753 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2751,7 +2766,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:2752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -2770,12 +2785,12 @@ EOF
echo $ac_n "checking for poll.h and poll()""... $ac_c" 1>&6
-echo "configure:2771: checking for poll.h and poll()" >&5
+echo "configure:2789: 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"
+#line 2794 "configure"
#include "confdefs.h"
#include <poll.h>
@@ -2783,7 +2798,7 @@ 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
+if { (eval echo configure:2802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_cv_func_poll=yes
else
@@ -2806,17 +2821,17 @@ else
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
+echo "configure:2825: 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"
+#line 2830 "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; }
+{ (eval echo configure:2835: \"$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*
@@ -2845,17 +2860,17 @@ 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
+echo "configure:2864: 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"
+#line 2869 "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; }
+{ (eval echo configure:2874: \"$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*
@@ -2880,18 +2895,18 @@ else
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2881: checking for working vfork" >&5
+echo "configure:2899: 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
+echo "configure:2905: 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"
+#line 2910 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
@@ -2914,7 +2929,7 @@ vfork();
; return 0; }
EOF
-if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2933: \"$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
@@ -2936,7 +2951,7 @@ fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
else
cat > conftest.$ac_ext <<EOF
-#line 2937 "configure"
+#line 2955 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
@@ -3031,7 +3046,7 @@ main() {
}
}
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
+if { (eval echo configure:3050: \"$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
@@ -3055,7 +3070,7 @@ 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
+echo "configure:3074: 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
@@ -3063,7 +3078,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3064 "configure"
+#line 3082 "configure"
#include "confdefs.h"
/* Test adapted from Gnu autoconf */
/* Thanks to Paul Eggert for this test. */
@@ -3102,7 +3117,7 @@ main() {
}
}
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
+if { (eval echo configure:3121: \"$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
@@ -3125,12 +3140,12 @@ EOF
fi
fi
echo $ac_n "checking for waitpid""... $ac_c" 1>&6
-echo "configure:3126: checking for waitpid" >&5
+echo "configure:3144: 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"
+#line 3149 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char waitpid(); below. */
@@ -3153,7 +3168,7 @@ waitpid();
; return 0; }
EOF
-if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3172: \"$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
@@ -3176,12 +3191,12 @@ else
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
+echo "configure:3195: 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"
+#line 3200 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3204,7 +3219,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3223: \"$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
@@ -3231,12 +3246,12 @@ done
fi
echo $ac_n "checking for putenv""... $ac_c" 1>&6
-echo "configure:3232: checking for putenv" >&5
+echo "configure:3250: 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"
+#line 3255 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char putenv(); below. */
@@ -3259,7 +3274,7 @@ putenv();
; return 0; }
EOF
-if { (eval echo configure:3260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3278: \"$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
@@ -3282,12 +3297,12 @@ else
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
+echo "configure:3301: 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"
+#line 3306 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3310,7 +3325,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3329: \"$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
@@ -3336,15 +3351,15 @@ done
fi
-for ac_func in mkstemp sigaction strerror vsnprintf
+for ac_func in mkstemp sigaction strerror vsnprintf vasprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3340: checking for $ac_func" >&5
+echo "configure:3358: 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"
+#line 3363 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3367,7 +3382,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3386: \"$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
@@ -3391,47 +3406,10 @@ else
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
+echo "configure:3413: 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
@@ -3439,7 +3417,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3440 "configure"
+#line 3421 "configure"
#include "confdefs.h"
#include <stdio.h>
int main()
@@ -3448,7 +3426,7 @@ int main()
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
+if { (eval echo configure:3430: \"$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
@@ -3473,12 +3451,12 @@ fi
MATH_LIB=
echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:3474: checking for sin" >&5
+echo "configure:3455: 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"
+#line 3460 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char sin(); below. */
@@ -3501,7 +3479,7 @@ sin();
; return 0; }
EOF
-if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3483: \"$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
@@ -3519,7 +3497,7 @@ if eval "test \"`echo '$ac_cv_func_'sin`\" = yes"; then
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
+echo "configure:3501: 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
@@ -3527,7 +3505,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3528 "configure"
+#line 3509 "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
@@ -3538,7 +3516,7 @@ 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
+if { (eval echo configure:3520: \"$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
@@ -3563,7 +3541,7 @@ 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
+echo "configure:3545: 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
@@ -3571,7 +3549,7 @@ else
LDFLAGS="-Xlinker --allow-multiple-definition"
x_linker_options=""
cat > conftest.$ac_ext <<EOF
-#line 3572 "configure"
+#line 3553 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3580,7 +3558,7 @@ 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
+if { (eval echo configure:3562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_linker_multiple_defns=yes
else
@@ -3616,14 +3594,14 @@ yes | xaw)
# 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
+echo "configure:3598: 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"
+#line 3605 "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
@@ -3634,7 +3612,7 @@ 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
+if { (eval echo configure:3616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_needs_explicit_xpm=no
else
@@ -3643,7 +3621,7 @@ else
rm -rf conftest*
LIBS="$LIBS -lXpm"
cat > conftest.$ac_ext <<EOF
-#line 3644 "configure"
+#line 3625 "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
@@ -3654,7 +3632,7 @@ 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
+if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_needs_explicit_xpm=yes
else
@@ -3688,14 +3666,14 @@ xaw3d)
# 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
+echo "configure:3670: 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"
+#line 3677 "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
@@ -3706,7 +3684,7 @@ 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
+if { (eval echo configure:3688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_needs_explicit_xpm=no
else
@@ -3715,7 +3693,7 @@ else
rm -rf conftest*
LIBS="$LIBS -lXpm"
cat > conftest.$ac_ext <<EOF
-#line 3716 "configure"
+#line 3697 "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
@@ -3726,7 +3704,7 @@ 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
+if { (eval echo configure:3708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_needs_explicit_xpm=yes
else
@@ -3766,7 +3744,8 @@ EOF
OPT_SRCS="$OPT_SRCS popups.c"
OPT_OBJS="$OPT_OBJS popups.o" ;;
no)
- X_PRE_LIBS= ;;
+ X_PRE_LIBS=
+ X_EXT_LIBS=" -lXext" ;;
*)
{ echo "configure: error: invalid toolkit $withval given" 1>&2; exit 1; } ;;
esac
@@ -3778,14 +3757,14 @@ else
# 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
+echo "configure:3761: 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"
+#line 3768 "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
@@ -3796,7 +3775,7 @@ 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
+if { (eval echo configure:3779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_needs_explicit_xpm=no
else
@@ -3805,7 +3784,7 @@ else
rm -rf conftest*
LIBS="$LIBS -lXpm"
cat > conftest.$ac_ext <<EOF
-#line 3806 "configure"
+#line 3788 "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
@@ -3816,7 +3795,7 @@ 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
+if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
xdvi_needs_explicit_xpm=yes
else
@@ -3846,6 +3825,50 @@ EOF
fi
+
+echo $ac_n "checking for XKB Bell extension""... $ac_c" 1>&6
+echo "configure:3831: checking for XKB Bell extension" >&5
+if eval "test \"`echo '$''{'xdvi_cv_xkb_bell_ext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ xdvi_save_LIBS=$LIBS
+LIBS="$X_PRE_LIBS""$X_EXT_LIBS"" $LIBS $X_LIBS -lX11"
+cat > conftest.$ac_ext <<EOF
+#line 3838 "configure"
+#include "confdefs.h"
+
+#include <X11/X.h>
+#include <X11/XKBlib.h> /* has the prototype */
+
+int main() {
+
+ Atom y;
+ XkbBell((Display *)0, (Window)0, 0, y);
+
+; return 0; }
+EOF
+if { (eval echo configure:3851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ xdvi_cv_xkb_bell_ext=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ xdvi_cv_xkb_bell_ext=no
+fi
+rm -f conftest*
+LIBS=$xdvi_save_LIBS
+fi
+
+echo "$ac_t""$xdvi_cv_xkb_bell_ext" 1>&6
+if test "$xdvi_cv_xkb_bell_ext" = yes; then
+ X_PRE_LIBS="$X_PRE_LIBS""$X_EXT_LIBS"
+ cat >> confdefs.h <<\EOF
+#define HAVE_XKB_BELL_EXT 1
+EOF
+
+fi
+
# Check whether --with-tetex or --without-tetex was given.
if test "${with_tetex+set}" = set; then
withval="$with_tetex"
@@ -3974,7 +3997,7 @@ fi
fi
-xdvi_ps_c= xdvi_ps_o=
+xdvi_ps_c= xdvi_ps_o= xdvi_need_gs_lib=
# Check whether --enable-ps-gs or --disable-ps-gs was given.
if test "${enable_ps_gs+set}" = set; then
enableval="$enable_ps_gs"
@@ -4033,6 +4056,7 @@ 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"
+ xdvi_need_gs_lib=y
fi
# Check whether --enable-config-file or --disable-config-file was given.
@@ -4141,6 +4165,56 @@ EOF
fi
+# Extra libraries
+EXTRA_CPPFLAGS=
+EXTRA_LIBS=
+
+# Check whether --enable-freetype or --disable-freetype was given.
+if test "${enable_freetype+set}" = set; then
+ enableval="$enable_freetype"
+ if test "x$enableval" != xno; then
+ xdvi_freetype_config=freetype-config
+ if test "x$enableval" != xyes; then
+ if test -x "$enableval/freetype-config"; then
+ xdvi_freetype_config="$enableval/freetype-config"
+ elif test -x "$enableval/bin/freetype-config"; then
+ xdvi_freetype_config="$enableval/bin/freetype-config"
+ else
+ echo "configure: warning: Cannot find $enableval/freetype-config or $enableval/bin/freetype-config" 1>&2
+ fi
+ fi
+ EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS `$xdvi_freetype_config --cflags`"
+ EXTRA_LIBS="$EXTRA_LIBS `$xdvi_freetype_config --libs`"
+ cat >> confdefs.h <<\EOF
+#define FREETYPE 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS ft.c"
+ OPT_OBJS="$OPT_OBJS ft.o"
+ xdvi_need_gs_lib=y
+fi
+else
+ if freetype-config --cflags >conftest.cflags 2>/dev/null \
+ && freetype-config --libs >conftest.libs 2>/dev/null ; then
+ EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS `cat conftest.cflags`"
+ EXTRA_LIBS="$EXTRA_LIBS `cat conftest.libs`"
+ rm -f conftest.cflags conftest.libs
+ cat >> confdefs.h <<\EOF
+#define FREETYPE 1
+EOF
+
+ OPT_SRCS="$OPT_SRCS ft.c"
+ OPT_OBJS="$OPT_OBJS ft.o"
+ xdvi_need_gs_lib=y
+fi
+fi
+
+
+
+
+
+# End extra libraries section
+
# 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"
@@ -4226,6 +4300,124 @@ EOF
fi
+# Check whether --with-default-dvips-cf-path or --without-default-dvips-cf-path was given.
+if test "${with_default_dvips_cf_path+set}" = set; then
+ withval="$with_default_dvips_cf_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_DVIPS_CF_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_DVIPS_CF_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-fontmap-path or --without-default-fontmap-path was given.
+if test "${with_default_fontmap_path+set}" = set; then
+ withval="$with_default_fontmap_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_FONTMAP_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_FONTMAP_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-enc-path or --without-default-enc-path was given.
+if test "${with_default_enc_path+set}" = set; then
+ withval="$with_default_enc_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_ENC_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_ENC_PATH ".:%S"
+EOF
+
+
+fi
+
+
+# Check whether --with-default-type1-path or --without-default-type1-path was given.
+if test "${with_default_type1_path+set}" = set; then
+ withval="$with_default_type1_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_TYPE1_PATH "$withval"
+EOF
+
+
+else
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_TYPE1_PATH ".:%S"
+EOF
+
+
+fi
+
+
+if test -n "$xdvi_need_gs_lib"; then
+ # Check whether --with-default-gs-lib-path or --without-default-gs-lib-path was given.
+if test "${with_default_gs_lib_path+set}" = set; then
+ withval="$with_default_gs_lib_path"
+ cat >> confdefs.h <<EOF
+#define DEFAULT_GS_LIB_PATH "$withval"
+EOF
+
+
+else
+ echo $ac_n "checking for the path to be used for Ghostscript searches""... $ac_c" 1>&6
+echo "configure:4383: checking for the path to be used for Ghostscript searches" >&5
+if eval "test \"`echo '$''{'xdvi_gs_lib_path'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if gs -h >/dev/null 2>&1; then
+ ac_tmp="`gs -h \
+ | sed \
+ -e '1,/Search path:/d' \
+ -e '/For more information/,$d' \
+ -e '/Initialization files are compiled/d' \
+ -e 's/$/\/\/\//' \
+ -e 's/^ //' \
+ | tr '\n' '/'`"
+ # Solaris 9 sed doesn't handle incomplete lines at eof
+ xdvi_gs_lib_path=`echo "$ac_tmp" \
+ | sed -e 's/\/\/\/\// /g' -e 's/ *$//' -e 's/ : /:/g'`
+else
+ xdvi_gs_lib_path=none
+fi
+fi
+
+echo "$ac_t""$xdvi_gs_lib_path" 1>&6
+if test "$xdvi_gs_lib_path" != none; then
+ cat >> confdefs.h <<EOF
+#define DEFAULT_GS_LIB_PATH "$xdvi_gs_lib_path"
+EOF
+
+else
+ echo "configure: warning: Could not determine Ghostscript search path" 1>&2
+ cat >> confdefs.h <<\EOF
+#define DEFAULT_GS_LIB_PATH NULL
+EOF
+
+fi
+
+fi
+
+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"
@@ -4411,6 +4603,8 @@ 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%@EXTRA_CPPFLAGS@%$EXTRA_CPPFLAGS%g
+s%@EXTRA_LIBS@%$EXTRA_LIBS%g
s%@OPT_SRCS@%$OPT_SRCS%g
s%@OPT_OBJS@%$OPT_OBJS%g