summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/web2c/lib
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog2063
-rw-r--r--Build/source/texk/web2c/lib/Makefile.in32
-rw-r--r--Build/source/texk/web2c/lib/README2
-rw-r--r--Build/source/texk/web2c/lib/alloca.c504
-rw-r--r--Build/source/texk/web2c/lib/basechsuffix.c42
-rw-r--r--Build/source/texk/web2c/lib/chartostring.c22
-rw-r--r--Build/source/texk/web2c/lib/coredump.c58
-rw-r--r--Build/source/texk/web2c/lib/depend.mak355
-rw-r--r--Build/source/texk/web2c/lib/depend.mk140
-rw-r--r--Build/source/texk/web2c/lib/eofeoln.c65
-rw-r--r--Build/source/texk/web2c/lib/fprintreal.c14
-rw-r--r--Build/source/texk/web2c/lib/input2int.c47
-rw-r--r--Build/source/texk/web2c/lib/inputint.c20
-rw-r--r--Build/source/texk/web2c/lib/main.c42
-rw-r--r--Build/source/texk/web2c/lib/mfmpi386.asm144
-rw-r--r--Build/source/texk/web2c/lib/mfmpw32.c189
-rw-r--r--Build/source/texk/web2c/lib/openclose.c251
-rw-r--r--Build/source/texk/web2c/lib/printversion.c58
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c2250
-rw-r--r--Build/source/texk/web2c/lib/uexit.c20
-rw-r--r--Build/source/texk/web2c/lib/usage.c35
-rw-r--r--Build/source/texk/web2c/lib/version.c6
-rw-r--r--Build/source/texk/web2c/lib/win32.mak62
-rw-r--r--Build/source/texk/web2c/lib/win32main.c30
-rw-r--r--Build/source/texk/web2c/lib/zround.c41
25 files changed, 6492 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
new file mode 100644
index 00000000000..be9c1de8894
--- /dev/null
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -0,0 +1,2063 @@
+2005-08-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c: Update copyright messages.
+
+2005-08-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement -etex switch.
+
+2005-07-29 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (opennameok): Check all occurrences of ".." in a
+ filename, not just the first. Reported by Yutaka OIWA
+ <y.oiwa@aist.go.jp>.
+
+2005-07-27 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c: libkpathsea is covered by the LGPL, not the GPL,
+ and is the common factor that brings in the *GPL to all
+ web2c-based programs.
+
+ * texmfmp.c (get_seconds_and_micros): New function, gets high-res
+ time if possible. Remove references to pdfxtex.
+
+2005-07-22 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * input2int.c: The correct format string to use depends on whether
+ integer is an int or a long int. Reported by M.J. Rutter
+ <mjr19@cus.cam.ac.uk>.
+
+2005-06-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * Makefile.in: Replace ac_include with kpse_include. From Peter
+ Breitenlohner.
+
+2005-06-22 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [MP][BANNER]: Update for MetaPost 0.901.
+
+2005-06-21 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (opennameok,openinnameok,openoutnameok): Add new
+ parameter to opennameok() so its diagnostics are correct wrt to
+ whether we are testing a file name for reading or writing.
+
+2005-04-12 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (getjobname): Add a parameter, the string to return if
+ --jobname wasn't given.
+ This is part of a group of changes that fix pdftex bug 302.
+ http://sarovar.org/tracker/?func=detail&atid=493&aid=302&group_id=106
+
+ * openclose.c (open_input): kpse_find_file() always returns a new
+ string, so we can unconditionally deallocate it.
+
+ * texmfmp.c (maininit): Factor out common code into texmf_yesno().
+ (texmf_yesno): New function, return true if a variable is set and set
+ to 't', 'y', or '1' in texmf.cnf or the environment.
+
+2004-12-20 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [pdfTeX,pdfeTeX,pdfxTeX]: New variable ptexbanner.
+
+2004-12-19 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [TeX] (maininit): For all TeX variants, recognize
+ "initex" and "virtex" program names, just in case.
+
+2004-09-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c (printversionandexit): Hartmut Henkel
+ <hartmut_henkel@gmx.de> noticed that the engines start running
+ like this: "This is TeX, Version 3.141592 (Web2C 7.5.3)" but the
+ -version output looks like this "TeX (Web2C 7.5.3) 3.141592".
+ He supplied a small patch to rectify this.
+
+2004-08-28 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c (open_input,open_output): Implement output_directory
+ option.
+
+ * texmfmp.c: Accept -output-directory option.
+
+2004-07-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): Remove this fuction. The
+ initialization is performed is done by the engine.
+ (read_char_translation_file): Rename to readtcxfile.
+ (readtcxfile): Some comment changes compared to its previous
+ incarnation.
+
+ * usage.c (usagehelp): Add second argument, email address for bug
+ reports. Requested by the pdftex team.
+
+ * texmfmp.c: Add -output-format to the long_options array.
+ Also add BUG_ADDRESS to the macros defined for each engine.
+ Call usagehelp with BUG_ADDRESS as second argument.
+
+2004-07-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Make it so that aleph and omega also
+ parse the -translate-file and -8bit options, even though they now
+ silently ignore them. (They have to ignore them in any case, as
+ neither makes sense for these programs.)
+
+2004-07-02 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [TeX]: Implement -efmt as alternate spelling for -fmt.
+ This option is only present for backward compatibility, and will
+ go away in the future.
+
+2004-06-29 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * Makefile.in: Don't include alloca.o in the objects. It
+ shouldn't be used anywhere.
+
+2004-06-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (get_input_name): Off-by-one errors when
+ erasing/restoring the final quote. From Akira Kakuto
+ <kakuto@fsci.fuk.kindai.ac.jp>.
+
+2004-06-15 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: (normalize_quotes): New function, takes a filename
+ and returns an allocated string with the name quoted iff it
+ contains a space.
+ (get_input_file_name): Factor out normalize_quotes.
+ (getjobname): Add quotes if needed. callmakempx: Add quotes if
+ needed.
+
+2004-06-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (get_input_file_name): New function. Get the name of
+ the input file for use by parse_first_line(), and if the filename
+ contains spaces make sure a properly quoted version will be given
+ to TeX.
+ (parse_first_line): Now takes the name of the input file (or NULL) as
+ an argument, instead of looking for it.
+
+2004-05-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove -oem code.
+
+2004-05-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove much of the locale-dependent code. Some
+ pieces remain because they are related to the Win32 '-oem' option,
+ where I do not know yet whether that option should go as well.
+
+2004-05-10 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): Fixing a regression. When a line in a
+ TCX file contains two numbers and a comment, set printable=1.
+ Reported by Staszek Wawrykiewicz <staw@gust.org.pl>.
+
+2004-05-08 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (main): We can now put TEXMFENGINENAME into the
+ environment for $engine in all cases.
+
+ * texmfmp.c: Add -halt-on-error option.
+
+2004-05-07 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maininit): Set $engine appropriately.
+
+ * texmfmp.c: Implement -8bit option.
+
+ * texmfmp.c (makesrcspecial): Always put a space after the line
+ number.
+
+2004-04-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): More compact xprn assignment.
+
+2004-03-28 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement -no-shell-escape, -no-parse-first-line,
+ -no-file-line-error.
+
+2004-03-25 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [eTeX](maininit): e-TeX will no longer treat being
+ called as "initex" or "virtex" special.
+ (tcx_get_num): Additional argument, upper bound we're accepting.
+ (read_char_translation_file): Allow for a third integer, 0 or 1, to
+ set printable status. This way you can translate characters
+ without making them printable. However, enforce that 7bit ASCII
+ remains printable.
+
+ * texmfmp.c (maininit): Add sanity check for -enc or -mltex
+ without -ini.
+
+2004-03-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * zround.c: Add public domain notice.
+
+ * win32main.c: Add public domain notice.
+
+ * version.c: Add public domain notice.
+
+ * uexit.c: Add public domain notice.
+
+ * printversion.c: Bump 2003 to 2004 in copyright notices.
+
+ * main.c: Add public domain notice.
+
+ * inputint.c: Add public domain notice.
+
+ * input2int.c: Add public domain notice.
+
+ * fprintreal.c: Add public domain notice.
+
+ * eofeoln.c: Add public domain notice.
+
+2004-03-22 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Add -output-format for the pdf*TeX
+ family.
+
+ * texmfmp.c: Changes for Aleph.
+
+ * texmfmp.c (long_options): Enable "enc" option.
+
+2004-03-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Allow file:line:error style messages to be enabled
+ from texmf.cnf. From Akira Kakuto <kakuto@fsci.fuk.kindai.ac.jp>.
+
+2004-02-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Rename isprintable to xprn.
+
+ * win32main.c: Sync with TeXlive.
+
+ * texmfmp.c: Add -enc option.
+
+ * texmfmp.c: Add support for pdfxTeX.
+
+2003-02-16 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Update banners for TeX 3.141592, MF 2.71828.
+
+2003-02-07 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: e-Omega support.
+
+2003-01-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupcharset): Do not adapt the isprintable array to
+ the locale.
+
+2003-01-10 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c (printversionandexit): Update copyright notice
+ years.
+
+2002-12-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove some unsused variables.
+
+2002-11-11 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement a -parse-first-line option. With the
+ current code it is possible to switch %&-line parsing on from the
+ command line. To switch it off when it is enabled in texmf.cnf
+ requires the use of an environment variable.
+
+2002-10-20 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Add support for -jobname option.
+
+2002-10-06 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maybe_parse_first_line): Split
+ maybe_parse_first_line: maybe_parse_first_line is called to set
+ parse_first_line_p for TeX, MF, MP, and parse_first_line is called
+ to do the actual parsing.
+
+ * texmfmp.c: Add support for mktexfmt; from Fabrice Popineau.
+
+2002-06-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Do not allow texmf.cnf to set the src_specials
+ option.
+
+2002-06-02 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Change handling of source specials so that there is a
+ single flag, src_specials_p, which can be used to see if any
+ source specials are generated.
+
+ * win32main.c: From Fabrice.
+
+2002-04-02 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [Omega] (ipcpage,gettexstring): Correction of the way
+ the strstartar array is handled. Reported by Akira Kakuto
+ <kakuto@fsci.fuk.kindai.ac.jp>
+
+2001-11-27 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (initscreen): Clarify message generated when an X
+ window cannot be opened.
+
+2001-11-25 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove unnecessary casts to (int*). If C++ ->
+ NO_MF_ASM.
+
+ * alloca.c: Changes to allow this file to compile with C++.
+
+2001-11-19 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Changes to keep C++ compilers from choking.
+
+ * openclose.c: Remove double declaration of recorder_name, make
+ prototype of open_input consistent with cpascal.h.
+
+2001-11-18 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * uexit.c: Changes to keep C++ compilers from choking.
+
+ * texmfmp.c: Changes to keep C++ compilers from choking. Changes
+ to support the filename recorder.
+
+ * printversion.c: Changes to keep C++ compilers from choking.
+
+ * openclose.c: Changes to keep C++ compilers from choking.
+ (recorder_start): New function, starts filename recorder.
+ (recorder_change_filename): New function, change the name of the file
+ used by the filename recorder.
+ (open_input,open_output): Record filename, starting recorder if
+ necessary.
+
+ * chartostring.c: Changes to keep C++ compilers from choking.
+
+ * basechsuffix.c: Changes to keep C++ compilers from choking.
+
+2001-11-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (getrandomseed): If available use gettimeofday or
+ ftime to obtain a random seed number. These functions have a
+ higher resolution, so fix the problem that subsequent MF or MP
+ runs could have the same seed.
+
+2001-10-30 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Add support for source specials.
+
+ * openclose.c: Add support for file:line:style messages.
+
+2001-10-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Implement -tex=program option for mp.
+
+2001-10-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * usage.c (usage): Remove first argument, should now only be
+ called on abnormal exit.
+ (usage_help): Print help message, implies a normal exit.
+
+ * texmfmp.c: Modify usage/usage_help invocation.
+
+ * eofeoln.c (readln): New function, read a line and accept CRNL,
+ CR, and NL as end-of-line delimiters.
+
+2001-04-23 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * eofeoln.c (eoln): Accept both CR and LF as end-of-line
+ characters.
+
+2000-08-25 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (setupboundvariable): Add parentheses for clarity, and
+ to silence stupid compilers.
+
+2000-05-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (calledit): The first argument should be a pointer to
+ packedASCIIcode. This matters for Omega. From "C.M. Connelly"
+ <c@eskimo.com>.
+
+2000-04-21 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [WIN32]: Add support for -oem option. From Fabrice.
+
+2000-04-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c: Disabled the supporting code for remembering the
+ full name while the code for C style error messages and source
+ specials is under review.
+
+2000-04-03 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c (open_input): Save full name of found file in
+ full_name_of_file variable. For "C-style" error messages and
+ source-file specials. After Stefan Ulrich
+ <ulrich@cis.uni-muenchen.de> and Fabrice Popineau
+ <Fabrice.Popineau@supelec.fr>.
+
+2000-01-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Stop option-processing at the first
+ non-option, so that a command line like 'tex \&sgmlbase
+ -lhtmlbase.tex -ousing.html using.html' feeds the '-lhtmlbase.tex'
+ and '-ousing.html' to the format. Reported by Jonathan Fine
+ <fine@active-tex.demon.co.uk>.
+
+1999-07-12 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maininit): Add a --default-translate-file option, to
+ facilitate CSTeX. Suggestion (relayed?) by Petr Olsak
+ <olsak@math.feld.cvut.cz>.
+ (input_line): Make sure that catching a SIGINT won't be seen as a EOF
+ on the terminal. Problem noticed by DEK.
+
+1999-06-28 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * openclose.c (open_input): The pdfTeX people asked that the disk
+ not be pounded for .vf files.
+
+1999-05-29 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (opennameok): Allow ./ or its equivalent. Use
+ IS_DIR_SEP rather than comparing against DIR_SEP.
+
+ * openclose.c (open_input): Correct comment.
+
+1999-03-15 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Explicit --progname override the
+ inferred programe of the --fmt option. Suggested by Sebastian.
+ (ztakefraction,ztakescaled,zmakescaled,blankrectangle,paintrow): Add
+ prototypes. From Thomas.
+
+1999-02-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: The translate_filename variable is now external. Use
+ kpse_web2c_format to find tcx files.
+
+1999-02-06 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Remove include for kpathsea/config.h because it is
+ superfluous.
+ (calledit): Use P?C macro in definition.
+
+1999-02-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (maybe_parse_first_line): Allow both --translate-file
+ and -translate-file in first line.
+
+ * main.c (main): Remove __cdecl, from Fabrice.
+
+1999-01-27 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * zround.c (zround): Add cast to quiet compiler. By Fabrice.
+
+ * usage.c (usage): Use KPSEDLL for kpse_bug_address. By Fabrice.
+
+ * texmfmp.c [WIN32]: include sys/timeb.h.
+ (mainbody): Add TEXDLL to declaration.
+ (maininit): The old main function renamed.
+ (main): A new main function, stripped to the bones.
+ (getrandomseed): Get a random seed from the current time.
+ All after Fabrice.
+
+ * printversion.c (printversionandexit): Add KPSEDLL for
+ kpathsea_version_string, by Fabrice.
+
+ * main.c (main): Add __cdecl, from Fabrice.
+
+1999-01-24 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Support for pdfeTeX. From Thomas Esser.
+
+ * texmfmp.c (maybe_parse_first_line): Default to parsing if
+ maybe_parse_first_line is not defined in texmf.cnf.
+ (opennameok): Add an argument to specify default.
+ (openinok): Default to "a" if no openin_any found.
+ (openoutok): Default to "p" if no openout_any found.
+
+ * mfmpw32.c: Change CRNL to NL line-endings.
+
+1999-01-14 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Further changes and fixes for maybe_parse_first_line.
+ Add openinnameok and openoutnameok, which call opennameok.
+ (opennameok): Change implementation to reflect this.
+
+1999-01-13 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Rename maybe_set_dump_default_from_input to
+ maybe_parse_first_line. Add TCX support in the form of allowing a
+ --translate-file pseudo-option, as proposed by Wlodzimierz Bzyl
+ <matwb@monika.univ.gda.pl>.
+
+ * printversion.c: Correct --version output.
+
+ * Makefile.in: Rename kpathsea.make to kpathsea.mk.
+
+1999-01-10 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Update banners, add MFNOWIN ifdef.
+
+ * printversion.c (printversionandexit): Improve & update message.
+
+ * Makefile.in: Change of ../make/*.make to ../make/*.mk.
+
+1998-12-04 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Replace isblank with ISBLANK, to improve handling of
+ whitespace.
+
+1998-07-26 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c (parse_options): Make --progname a no-op after --fmt
+ has been seen. Thus the order of these options no longer matters.
+
+ * texmfmp.c: Rename openoutnameok to opennameok.
+
+Sun May 31 17:27:22 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c: Add a parse_first_line configuration entry, so the
+ %&format construct can be switched off when desired. Suggested by
+ Denis B Roegel.
+ Add a --debug-format option.
+
+Mon May 4 19:41:22 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * basechsuffix.c (basenamechangesuffix): Replace call of basename
+ with xbasename.
+
+ * texmfmp.c (openoutnameok): Replace call of basename with
+ xbasename.
+
+Tue Mar 10 06:37:51 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * texmfmp.c [TeX & IPC] (ipcpage): Remember to set begun to true
+ once we've begun.
+
+Sun Mar 8 18:21:46 1998 Olaf Weber <olaf@infovore.xs4all.nl>
+
+ * printversion.c (printversionandexit): Copyright year is 1998.
+
+Tue Feb 10 17:56:36 1998 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Provide the hooks for the epsf server. From Mathias
+ Herberts.
+
+ * eofeoln.c: Prototype eoln. Spotted by Andreas Scherer
+ <Andreas.Scherer@Pobox.Com>
+
+ * fprintreal.c: Prototype fprintreal. Spotted by Andreas Scherer
+ <Andreas.Scherer@Pobox.Com>
+
+Fri Jan 23 15:01:31 1998 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Various patches for Omega from John Plaice.
+ (ipcpage [Omega]): Fix because string handling in Omega differs.
+ (maybe_set_dump_default): Fix to get %& to work in more cases.
+
+Thu Dec 18 20:37:20 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Change spelling of -maketex option to -mktex.
+
+Fri Dec 12 10:22:52 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * openclose.c (open_output): Don't use TEXMFOUTPUT value if it is
+ the empty string.
+
+ * texmfmp.c (openoutnameok): Rewritten to support three levels of
+ permissiveness.
+ (main): Assignment to shellenabledp has been rewritten: we now
+ enable only if certain values are found.
+
+Mon Dec 1 19:05:06 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (maybe_set_dump_default_from_input): Reset the program
+ name if the dump_name changes.
+
+ * texmfmp.c [WIN32 && !NO_MF_ASM]: Include "lib/mfmpw32.c" instead
+ of "../win32/mfmpi386.c".
+
+ * texmfmp.c (main, parse_options): Add support for --interaction
+ option.
+
+ * texmfmp.c (main) [eTeX]: Make sure calling e-TeX as initex or
+ virtex works as it should.
+
+Sat Nov 29 13:06:53 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (main): We assume "plain" for the dump_name iff the
+ program was called as ini* or vir*. And in the case of ini*, the
+ file name will override this anyway.
+
+ * texmfmp.c (callmakempx): Add xstrdup, because we end up
+ potentially freeing a static string otherwise. From Fabrice
+ Popineau.
+
+Sun Nov 23 19:43:57 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (openoutnameok): When we're trying to be safe, add
+ some extra paranoia supplied by Charles Karney <karney@pppl.gov>.
+
+Sat Nov 22 19:26:13 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (main): Use kpse_set_program_name and
+ kpse_program_name instead of kpse_set_progname and
+ program_invocation_short_name.
+
+Sat Nov 15 21:27:23 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Various changes to support Omega.
+
+Fri Nov 14 16:43:28 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c [eTeX,PDFTeX]: Inclusion of header file with
+ appropriate banner.
+
+Fri Oct 24 13:41:56 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Prototypes for the mf_*_{blankrectangle,paintrow}
+ functions.
+
+Mon Oct 20 08:16:40 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c [WIN32]: Added support for WIN32WIN. Added suppport
+ for redirection of stderr to a logfile. Added support for asm
+ routines. Prototyped mainbody.
+ (setupboudvariable): Don't try to free expansion if it is NULL.
+ From Fabrice Popineau.
+
+ * main.c (main): Prototype mainbody. From Fabrice Popineau.
+
+Sun Oct 19 10:57:43 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * printversion.c (printversionandexit): Removed web2c maintainer's
+ name from version info.
+
+Fri Oct 17 10:33:06 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Correct prototypes for all the varieties of
+ ...initscreen and ...updatescreen. No prototypes for
+ ...blankrectangle and ...paintrow.
+
+ * texmfmp.c (main) [MSDOS, WIN32]: Use case-insensitive comparison
+ for filenames on MS-DOS/MS-Windows.
+ (openoutnameok): When testing for `unix' make sure `MSDOS' is NOT
+ defined since DJGPP defines both.
+ (initscreen): Use "mftalk" for DJGPP as well.
+ From Eli Zaretskii <eliz@is.elta.co.il>.
+
+Thu Oct 16 20:34:25 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (parseoptions [TeX], main): Remove everything related
+ to the -extend-jobname option.
+
+Fri Oct 3 11:46:15 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c: Add prototypes for the mf_trap_* functions. After
+ Fabrice Popineau.
+
+Thu Oct 2 18:07:24 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * texmfmp.c (main): Added locale support. From Bernd Raichle
+ <raichle@informatik.uni-stuttgart.de>.
+
+Tue Sep 30 12:00:13 1997 Olaf Weber <infovore@xs4all.nl>
+
+ * version.c: use version string from c-auto.h.
+
+ * texmfmp.c: Changed return type of main int.
+
+Fri Mar 21 16:38:48 1997 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (struct msg): Do not try to declare the zero-length
+ array, just leave it out.
+ Bug from: jumper@lens.sri.com (Greg Jumper)
+
+Wed Feb 12 08:18:07 1997 Fabrice POPINEAU <popineau@ese-metz.fr>
+
+ * texmfmp.c (catch_interrupt): Win32, differentiate between user
+ interrupt and console closing.
+
+Mon Feb 3 18:01:42 1997 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): Check for -1, not EOF,
+ per new getopt.
+
+Mon Jan 27 22:44:29 1997 Ulrik vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * texmfmp.c (BANNER) [MP]: Update to version 0.632.
+
+Sat Jan 18 13:04:34 1997 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c: Update len.
+ From: Gregor Hoffleit <flight@mathi.uni-heidelberg.de>.
+
+Thu Jan 16 14:29:50 1997 Karl Berry <karl@cs.umb.edu>
+
+ * alloca.c: New version from /gd/gnu/lib.
+
+ * texmfmp.c (funny_core_dump): Move to new file.
+ * coredump.c: New file.
+ * Makefile.in (objects): Add coredump.o.
+ This makes it possible for BibTeX to find the function
+ (not that it needs it).
+ From: Richard Walker <Richard.Walker@cs.anu.edu.au>
+
+Sun Jan 5 16:11:12 1997 Karl Berry <karl@cs.umb.edu>
+
+ * printversion.c: It's 1997 now.
+
+Sun Dec 29 17:11:03 1996 Karl Berry <karl@cs.umb.edu>
+
+ * basechsuffix.c (basenamechangesuffix): Filename comparison may
+ be case-insensitive. From Fabrice.
+
+Sat Dec 28 17:37:14 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (ipcpage): Pass the whole DVI filename to the other
+ end of the connection, not just the relative name. (It may have
+ been already started up.)
+
+Sun Dec 15 16:50:25 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c: #if 0-out all the TCX file stuff.
+ Suggested by David Carlisle et al.
+
+Sun Dec 8 16:40:57 1996 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c (standardinput, standardoutput): Remove these;
+ make them globals in bibtex.ch itself.
+
+ * printversion.c, texmfmp.c, usage.c: WIN32 changes.
+ From Fabrice.
+
+Sat Dec 7 11:10:39 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (topenin): Rewrite to avoid strcat, for Omega.
+ From: John Plaice <plaice@iad.ift.ulaval.ca>.
+
+Fri Dec 6 17:44:45 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main) [TeX && Omega]: Initialize MakeTeX{OCP,OFM}.
+ * openclose.c (ocptemp): New global.
+ (open_input): Read ahead in ofm and ocp files.
+
+Tue Dec 3 15:15:14 1996 Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * Makefile.in: Remove spurious targets for wsun.c and wx11.c.
+
+Tue Dec 3 15:15:14 1996 Ulrik Vieth <vieth@thphy.uni-duesseldorf.de>
+
+ * texmfmp.c (long_options): mpost -T or -troff doesn't take an
+ optional argument.
+
+ * Makefile.in: Remove spurious targets for wsun.c and wx11.c.
+
+Wed Nov 27 10:02:21 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (NO_MF_ASM) [__sun__]: Define; our assembler code
+ doesn't work with the Solaris/x86 assembler.
+ * mfmpi386.asm: Doc fix.
+
+Sat Nov 23 14:42:53 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutok): Allow .tex as a special case.
+
+Fri Nov 15 16:15:32 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutnameok): Do not free the result of basename;
+ it's never dynamically allocated anyway.
+
+Sun Nov 10 16:37:19 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c: Check for inimpost and virmpost instead of
+ inimp and virmp.
+
+Mon Oct 14 17:27:34 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (DUMP_EXT) [DOS]: Only truncate to .bas if DOS,
+ not DOSISH; WinNT/Win95 support long filenames (at long last).
+ (initscreen) [WIN32]: Use mftalk a la OS2.
+ (get_date_and_time): Include parameter in old_handler decl.
+
+Mon Oct 7 12:49:38 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Include printversion.o.
+ * printversion.c: New file.
+
+ * texmfmp.c: Oops, iniversion doesn't it, it's global.
+ (parse_options): Call printversionandexit.
+
+Sun Oct 6 10:17:00 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main): Initialize iniversion and virversion.
+
+Sat Sep 7 16:14:41 1996 Karl Berry <karl@cs.umb.edu>
+
+ * usage.c: Include the bug reporting address.
+
+Sun Aug 4 15:48:03 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): Print the Kpathsea version string, too.
+ * version.c: Do `Web2c VERSION' instead of `C version VERSION'.
+
+Fri Jul 26 15:47:29 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: Remove co.make.
+
+Sat Jun 1 13:17:09 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutnameok): Change #ifdef to TeX || MP.
+
+Fri May 24 11:38:59 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main): Initialize extend_jobname.
+ (parse_options) [TeX]: New option -extend-jobname.
+
+Sun Apr 28 15:13:22 1996 Karl Berry <karl@cs.umb.edu>
+
+ * mfmpi386.asm [ASM_NEEDS_UNDERSCORE]: #ifdef labels on new
+ configure condition.
+ From: Peter Breitenlohner <peb@MPPMU.MPG.DE>.
+
+Tue Apr 23 08:26:11 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): Always pass -troff, even if we got the
+ command name from texmf.cnf.
+
+Sun Apr 21 16:59:44 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): New options -maketex and -no-maketex
+ for TeX and MF.
+
+Sat Apr 20 17:55:37 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c [IPC_DEBUG]: Text changes.
+
+Fri Mar 22 15:30:45 1996 Karl Berry <karl@cs.umb.edu>
+
+ * Remove GPL from these files; Web2c proper can stay p.d.
+
+Sun Mar 10 16:12:14 1996 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c: Oops, forgot to #include variable.h.
+
+Fri Mar 8 16:00:20 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (init_maketex): Remove this; we will do it in Kpathsea
+ instead now, in the format initialization tex-file.c.
+
+ * openclose.c (open_output): Look for TEXMFOUTPUT in texmf.cnf.
+
+Wed Feb 21 11:45:02 1996 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c: Don't abort if the TFM file is empty.
+
+Sat Feb 17 15:22:52 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (openoutnameok): New function.
+
+Fri Feb 16 17:51:53 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (long_options) [NONASCII]: Include --translate
+ conditionally. (Really should change the help message, too.)
+
+Sat Feb 10 15:22:59 1996 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (parse_options): Make DUMP_OPTION also set the user
+ progname, since -progname sets the dump name.
+
+Fri Dec 29 17:16:42 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: misc.make is now clean.make.
+
+Sun Dec 17 15:09:44 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (long_options): New option --debug-format, suggested
+ by David Carlisle.
+
+Sun Dec 10 16:13:46 1995 Karl Berry <karl@cs.umb.edu>
+
+ * mfmpi386.asm: Remove _'s. From Wayne.
+
+ * texmfmp.c (PROGRAM_VERSION) [MP]: Now at 0.631.
+ [TeX] No asm stuff. From Gregor Hoffleit, et al.
+
+Sun Nov 26 13:39:00 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main): Enable mltex extensions if --mltex option or
+ the program name is mltex.
+
+Fri Nov 17 14:35:45 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (-program): New option for TeX, MF, MP. Suggested by Bernd.
+
+Thu Nov 16 16:20:03 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (argv, argc): Do not define as static, as we declare
+ them extern in cpascal.h. From Andreas Scherer.
+
+Sun Nov 12 16:32:27 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (sysopt_o): Remove this stuff. From Wayne.
+ * texmfmp.c [i386 && GNUC && !NO_MF_ASM]: #include mfmpi386.asm
+ instead of using the C code.
+
+ * texmfmp.c: Disable shell escapes by default.
+
+Fri Oct 6 16:23:03 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (maybe_set_dump_default_from_input): Make %&ini set
+ iniversion. Suggested by Wayne.
+
+Mon Oct 2 15:48:21 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (init_maketex): Really disable if the value is zero.
+
+Sat Sep 30 16:02:56 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (main) [TeX]: Look up the `noshell' config variable.
+ (parse_options): No options -noshell and -output-comment.
+
+Sat Sep 23 15:04:54 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Remove strtol.o, this is in kpathsea now.
+
+Fri Sep 22 15:51:13 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (init_maketex): New routine.
+ (main): Call it, instead of repeating the weird code.
+
+Mon Sep 4 17:16:06 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Remove xopenfile.o.
+ * xopenfile.c: Move to kpathsea.
+
+Thu Aug 31 13:35:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c [!MF_ASM_FRACTION] (takefraction, ...): Conditionalize
+ the floating-point definitions on this, too.
+ * Makefile.in (optx86.o): New target.
+ * optx86.s: New file.
+
+Tue Aug 22 14:11:27 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in: Include rdepend.make, instead of repeating the code.
+
+Mon Jul 31 17:46:31 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (setupboundvariable): Call kpse_var_value, so we don't
+ have to pass in the $. Similarly everywhere else.
+
+Sat Jul 29 19:26:33 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): Rewrite to pass -troff flag, instead of
+ invoking troff script. And use new kpse_var_value.
+
+Fri Jul 28 11:10:26 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (depend): Comment out this target in the
+ distribution, it doesn't work when $srcdir != build-dir.
+
+ * texmfmp.c (callmakempx): Don't call anything if the command is
+ `none'.
+
+Tue Jul 25 13:39:04 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): Free the variable expansion.
+
+Mon Jul 24 11:48:35 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (callmakempx): New fn.
+
+Sun Jul 23 11:39:51 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmfmp.c (edit_value): Remove this #define.
+ (calledit): Call kpse_var_expand for TEXEDIT et al., instead of
+ just getenv.
+ (ztakefraction, zmakefraction, ztakescaled, zmakescaled): Include
+ Hobby's C code from mpmath.c.
+
+Sat Jul 22 14:20:38 1995 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c (open_input) [FUNNY_CORE_DUMP]: Recognize
+ HackyInput... for MetaPost. Doc fixes.
+
+ * texmf.c: Rename to texmfmp.c for MetaPost support.
+ (long_options) [MP]: Add -T and -troff.
+
+Thu Jul 20 13:40:39 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (setupboundvariable) [TeX]: Remove conditional, since MF
+ sets a couple simple variables dynamically now.
+ (initscreen): Get MFTERM from texmf.cnf file if it's there,
+ instead of just calling getenv.
+
+Tue Jul 18 13:40:25 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (initscreen): Give warning if they're using X, but there
+ is no X support.
+
+Mon Jul 17 13:10:37 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (NO_FMTBASE_SHARE): Rename to NO_DUMP_SHARE.
+ [MF]: Declare return types for window routines.
+ Also, move trap support to another file, window/trap.c.
+
+Sun Jul 16 14:35:33 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (main): Rewrite enabling of MakeTeX* to match new
+ configure stuff.
+
+Sat Jul 15 16:05:37 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c: Doc fix.
+
+Fri Jul 14 14:31:57 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (read_char_translation_file): Compute `charssavedbycharset'.
+ (setupcharset): Do not allow dynamic translation in initex.
+
+Thu Jul 13 14:05:24 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (setupcharset, read_char_translation_file,
+ tcx_get_num): New functions to implement dynamic char translations.
+ (parse_options): Add -translate-file option.
+
+Sun Jul 9 15:28:09 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (maybe_set_dump_default_from_input): Don't index
+ argv[optind] if optind is >= argc.
+
+Tue Jul 4 16:58:54 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (maybe_set_dump_default_from_input): Finish implementing
+ this (%&FNAME on first line => use FNAME for dump file).
+
+Thu Jun 29 17:50:38 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (parse_options) [TeX && IPC]: Concatenate TEX_IPC_HELP
+ to the help string.
+
+ * openclose.c (open_input): Detect nonexistent files correctly again.
+
+Wed Jun 21 15:54:45 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (parse_options): Add --fmt (TeX) and --base (MF).
+ (DUMP_OPTION): #ifdef'd #define to determine which.
+
+Mon Jun 19 20:09:34 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c: Add IPC support.
+ From: Shamim Mohamed <shamim@howland.isu.edu>
+ From: Tomas G. Rokicki <rokicki@CS.Stanford.EDU>
+
+Sat Jun 10 16:06:06 1995 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c: Doc fix.
+
+Fri Jun 9 19:36:12 1995 Karl Berry <karl@cs.umb.edu>
+
+ * main.c, texmf.c (main) [__EMX__]: Add _wildcard and _response calls.
+ * texmf.c: Add mftalk support.
+ (funny_core_dump, catch_interrupt) [__EMX__]: OS2 support.
+ From: rs@purple.in-ulm.de (Ralph Schleicher).
+
+Sun Jun 4 10:30:36 1995 Karl Berry <karl@cs.umb.edu>
+
+ * eofeoln.c (eof): Return true if the file doesn't exist.
+
+ * texmf.c: Add support for AMIGAWIN. From Andreas Scherer.
+
+ * alloca.c (NULL, xmalloc): Do not define these here, they're
+ (indirectly) in config.h. From Andreas Scherer.
+
+ * texmf.c (setupboundvariable): Don't complain about 0 in the cnf
+ file if the default is also 0.
+
+Sat Jun 3 11:54:28 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: Include the program name in the error message.
+
+ * texmf.c (setupboundvariable): If the variable is unset in
+ texmf.cnf, the expansion is the empty string, not NULL. Also, free
+ the expansion.
+
+Fri Jun 2 13:41:41 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (DUMP_EXT) [DOSISH]: Must be `.bas'. From Wayne.
+ (input_line): Cast buf_size in printf to avoid warning.
+ (setupboundvariable): New routine for lookup of dynamic bounds.
+
+Sun May 28 17:41:49 1995 Karl Berry <karl@cs.umb.edu>
+
+ * zround.c: Compare against TeX's boundary integers (as floating
+ point constants), instead of INTEGER_{MIN,MAX}.
+
+Fri May 26 17:47:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * strtol.c: New file, from textutils.
+ * Makefile.in (objects): Add strtol.o.
+
+Wed May 24 17:07:39 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c (parse_options): New routine for TeX & MF.
+ (PROGRAM_VERSION, PROGRAM_HELP): Define these.
+ (main): Call it.
+
+Sat May 20 17:28:51 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: Do perror if we had a full filename to try.
+
+ * basechsuffix.c: Take old suffix, and only do the change if the
+ old suffix matches.
+
+ * usage.c (usage): If bad status, construct the --help message.
+
+Tue May 9 15:46:25 1995 Karl Berry <karl@cs.umb.edu>
+
+ * usage.c: Doc fix.
+
+Sat May 6 11:23:23 1995 Karl Berry <karl@cs.umb.edu>
+
+ * usage.c: New file.
+ * Makefile.in (objects): Add it.
+
+Tue Apr 25 14:02:10 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (library): Set to lib instead of lib.a, to match the
+ other Makefile conventions.
+
+Sun Apr 23 10:54:35 1995 Karl Berry <karl@cs.umb.edu>
+
+ * texmf.c: Have to include {tex,mf}d.h before #ifdef TeX, so do it
+ from the Makefile.
+
+Sat Apr 22 10:26:10 1995 Karl Berry <karl@cs.umb.edu>
+
+ * main.c (main): Call mainbody, not main_body.
+
+ * openclose.c (aclose): Don't complain if the file is already closed.
+ (texinputtype): Define this.
+
+ * texmf.c (main): Do program_name stuff unconditionally, not just
+ in vir*, and rewrite it to use program_invocation_short_name.
+
+Fri Apr 21 11:39:14 1995 Karl Berry <karl@cs.umb.edu>
+
+ * main.c: Doc fix.
+
+ * input2int.c: Split off from inputint.c.
+
+Sun Apr 16 11:47:37 1995 Karl Berry <karl@cs.umb.edu>
+
+ * openclose.c (open_input, open_output): Retrieve and store the
+ filename from name_of_file + 1, not name_of_file, to avoid extra
+ hassles in the change files.
+
+Fri Apr 14 15:28:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Include openclose.o.
+ * openclose.c: New file, from openinout.c.
+
+Tue Feb 21 13:51:58 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: Have to take another arg, the original name.
+
+Mon Feb 20 17:18:59 1995 Karl Berry <karl@cs.umb.edu>
+
+ * xopenfile.c: New file.
+ * Makefile.in (objects): Add it, and remove xfopen-pas.o.
+
+Sun Feb 5 15:33:29 1995 Karl Berry <karl@cs.umb.edu>
+
+ * basechsuffix.c: New file.
+ * Makefile.in (objects): Add it.
+
+Tue Jan 10 13:20:47 1995 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Remove strpascal.o (no longer needed) and
+ getopt.o (in kpathsea).
+
+Sun Dec 18 16:38:03 1994 Karl Berry <karl@cs.umb.edu>
+
+ * strpascal.c (errprintpascalstring, etc.): Don't need these any more?
+
+Sat Dec 17 13:42:03 1994 Karl Berry <karl@cs.umb.edu>
+
+ * mksuffixchar.c: This was short-lived.
+ * chartostring.c: This replaces it.
+ * Makefile.in (objects): Ditto. Also remove ourpaths.o.
+
+Mon Nov 14 15:13:50 1994 Karl Berry <karl@cs.umb.edu>
+
+ * mksuffixchar.c: New file.
+ * Makefile.in (objects): Add it.
+
+Sun Nov 13 16:43:40 1994 Karl Berry <karl@cs.umb.edu>
+
+ * Makefile.in (objects): Add w*.o.
+ (wsun.c, wx11.c): Add links for these.
+
+Fri Oct 28 11:14:08 1994 Karl Berry <karl@cs.umb.edu>
+
+ * strpascal.c (extendfilename): Remove this.
+
+Thu Oct 27 17:59:07 1994 Karl Berry <karl@cs.umb.edu>
+
+ * main.c (argv): Return a regular C string, instead of a Pascal string.
+
+Fri May 27 09:50:14 1994 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (main): Don't look for USE_MAKETEX*.
+
+ * c-auto.h.top, texmf.c (NO_FMTBASE_SHARE): Rename from
+ NO_FMTBASE_SWAP.
+
+Thu May 26 20:37:24 1994 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.top: Why did I take out the #ifndef's? Put them back.
+
+Tue May 24 14:43:12 1994 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (funny_core_dump): No need to declare, since we define
+ it later in this file.
+
+Mon Apr 18 17:31:59 1994 Karl Berry (karl@ra.cs.umb.edu)
+
+ * c-auto.h.top: Rename from c-auto.h.in for autoheader convention,
+ and don't #ifndef the #undef's.
+ * Makefile.in: autoheader/autoconf changes.
+
+Thu Feb 24 11:00:53 1994 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: Include tex-file.h instead of init-path.h.
+
+Mon Feb 21 14:29:52 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in: srcdir changes from simon.
+
+ * gftodmem.h: Move here from fontutil, to simplify srcdir stuff.
+
+Wed Feb 2 11:00:47 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 6.1.
+
+Tue Feb 1 11:25:44 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (c-auto.h.in): New target.
+
+ * common.defines (rh): Declare as a field, for TeX--Xet.
+
+Mon Jan 24 07:33:49 1994 Karl Berry (karl@cs.umb.edu)
+
+ * Version 6.0.
+
+Thu Jan 20 14:22:07 1994 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in: Doc fix.
+
+ * MakeTeX{TFM,MF}: Include these as samples, from
+ pnoma@wk.estec.esa.nl.
+
+Fri Dec 24 13:48:46 1993 Karl Berry (karl@cs.umb.edu)
+
+ * getopt.c (_NO_PROTO): Define before including config.h.
+
+Tue Dec 7 10:23:59 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (objs): Ah, flexfatal is in the library now.
+
+Sun Dec 5 15:23:47 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c (setpaths): Remove the KPSE_MAKE_* enables, this file
+ is not compiled in the tex/mf/bibtex directories.
+ * texmf.c (main): Set them here.
+
+ * c-auto.h.in (XVIEWWIN): Remove this, as x11-Xt should work
+ with OpenWindows. (But leave it in configure, just for old-times'
+ sake.)
+
+Sat Dec 4 11:29:57 1993 Karl Berry (karl@cs.umb.edu)
+
+ * flexfatal.c: New file.
+ * Makefile.in (flexfatal.o): New target.
+ (objs): Include it.
+
+ * texmf.h (NO_DEBUG) [!TEXMF_DEBUG]: Define this.
+
+ * openinout.c (make_tex_file): Pass address of nameoffile, as required.
+
+Sun Nov 14 02:30:34 1993 Karl Berry (karl@cs.umb.edu)
+
+ * version.c (VERSION_STRING) [!VERSION_STRING]: Define and protect.
+
+Fri Nov 12 19:38:26 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (reset, rewrite): Use FOPEN_[RW]BIN_MODE instead of
+ "r" and "w". Still not 100% right, but at least something of an
+ improvement.
+
+Sun Nov 7 14:17:24 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (.c.o): Use $< instead of $*.c; maybe it will help
+ with $(srcdir) stuff?
+
+ * texmf.c (input_line): Trim trailing spaces, tabs, and \r's.
+
+ * lib.h: Remove, this is in Kpathsea now.
+
+ * config.h (INTEGER_TYPE) [LONG_64_BITS && !NO_FMTBASE_SWAP]:
+ Define as int in this case.
+ (INTEGER_MAX,INTEGER_MIN): Define these as well.
+ * zround.c (zround): Use INTEGER_{MAX,MIN}.
+ From raichle@informatik.uni-stuttgart.de.
+
+Sat Nov 6 13:21:11 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (NEXTWIN, REGISWIN): #undef by default.
+ * texmf.c (mfwin_sw): Add cases for regis and next.
+ (mf_{next,regis}_*) [NEXT,REGISWIN]: Declare.
+
+Tue Oct 12 14:03:23 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_input): Allow HackyCoreDump's for MF, too.
+
+ * ourpaths.c (testreadaccess): Update fontmap stuff, use it for GF
+ and PK as well as TFM.
+
+ * texmf.c: Doc fix.
+
+ * common.defines (cinttype): Declare.
+ * cpascal.h (cinttype): Define.
+
+Sun Oct 10 16:17:48 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: Rewrite for new kpathsea facilities.
+
+Sun Oct 3 13:49:40 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: kpathsea/pathsrch.h has been renamed to pathsearch.h.
+
+ * config.h [ibm032]: Remove all this stuff; I don't think it's
+ needed any longer.
+
+ * Makefile.in (*clean): Include standard targets.
+
+Mon Jun 7 08:29:45 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (addressofint): Do not cast to int first.
+
+Mon May 31 09:40:00 1993 Karl Berry (karl@cs.umb.edu)
+
+ * config.h (EXIT_SUCCESS): Move to c-std.h.
+
+Tue May 25 14:37:16 1993 Karl Berry (karl@cs.umb.edu)
+
+ * config.h (EXIT_SUCCESS): Rename from EXIT_SUCCESS_CODE.
+ Change callers in various files.
+
+Fri May 21 11:56:02 1993 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (paintrow): Put args in the printf for paintrow.
+
+ * texmf.c (custom_default) [INI]: Declare conditionally, since
+ it's used conditionally.
+ (main): Declare as void.
+
+ * openinout.c (open_input): Rename IS_PATH_SEP to IS_DIR_SEP.
+
+ * alloca.c: Replace with version from gcc 2.4.0.
+
+ * config.h (testreadaccess): Declare.
+
+ * xfopen-pas.c: Remove unused variable `cp'.
+
+ * main.c (main): Return 0 instead of using uexit.
+
+Tue May 18 13:43:07 1993 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (do_undump) [VMS]: Remove this. barabash says it works ok.
+
+Thu May 13 16:53:47 1993 Karl Berry (karl@cs.umb.edu)
+
+ * getopt.c (my_index): Return const char *, and change callers.
+
+ * Not quite all of Bill's changes below have been merged (not the
+ new descrip.mms or convert.com files, in particular), but just to
+ get the gist, I'll include the whole log.
+
+Wed Mar 24 12:28:25 1993 Bill Barabash (barabash@ops5.lmo.dec.com)
+
+ * c-auto.h : It's too complicated to convert the big hairy config
+ shell script; I just created a VMS-acceptable c-auto.h manually.
+
+ * c-std.h : Declare VMS's unix-compatibillity routines by including
+ <unixlib.h> and <unixio.h>; don't declare popen() on VMS.
+
+ * common.h : Declare EXIT_SUCCESS_CODE to be 1 on VMS, 0 elsewhere.
+ Throw away the VMS system library's getname() declaration, it steps
+ on a WEB procedure and is not needed. Declare routines eof(),
+ testreadaccess(), zinput2ints(), extendfilename(), and uexit().
+
+ * convert.com : VMS command procedure based on the shell script
+ "convert" (new file).
+
+ * descrip.mms : VMS equivalent of makefile (new file).
+
+ * dirio.h : Don't declare xopendir and xclosedir on VMS.
+
+ * getopt.h : Make my_index accept and return a const character
+ pointer. Have it return NULL instead of 0 when necessary.
+
+ * main.c : Add function prototype for main_body().
+
+ * openinout.c, pascal.h, c-auto.h : For BibTeX, use stdin and stdout
+ on VMS (standardinput and standardoutput become macros).
+
+ * pascal.h : On VMS use system-defined abs() and fabs().
+
+ * paths.h : Hand-coded for VMS.
+
+ * pathsrch.c : On VMS, don't compile routine expand_subdir(), and
+ look in current directory for input file if path searching fails.
+ Routine absolute_p() can now deal with VMS directory specifications.
+
+ * texmf.c : Declare argc so that it links cleanly. Add an unused
+ formal parameter to catch_interrupt so that it can be passed to
+ signal without the compiler complaining. Cast argument to time()
+ as a (time_t *) rather than as a (long *). Get rid of the VMS
+ undump code contributed by joe%ril3.decnet@hydra.tamri.com -- it
+ causes the TRAP test to fail.
+
+ * texmf.h : Add function prototypes for routines in texmf.c and
+ openinout.c.
+
+Thu May 13 14:43:42 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (fabs) [fabs]: Undefine if it's already defined.
+
+Sun May 9 09:53:05 1993 Karl Berry (karl@cs.umb.edu)
+
+ * convert: Redirect error echo to stderr; exit 0 if no error.
+
+ * config.h: Changes for kpathsea. Toss volatile defn.
+
+ * Makefile.in (objs): Remove kpathsea files.
+
+Fri Apr 30 15:06:29 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (make_tex_file): Free cmd.
+
+Fri Apr 16 19:42:15 1993 Karl Berry (karl@cs.umb.edu)
+
+ * find-suffix.c: Declare arg and return string const.
+ * lib.h (find_suffix): Change decl.
+
+ * c-pathch.h (IS_PATH_SEP) [DOS & otherwise]: New defn.
+ * pathsrch.c, openinout.c, find-suffix.c: Consequent changes.
+
+Mon Apr 12 06:14:42 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (clean): Remove core here.
+
+Sat Apr 10 15:20:25 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (make_tex_file): Throw away all output.
+
+ * texmf.c (swap_items): Add case for 16-byte items.
+ (From james@miller.cs.uwm.edu.)
+
+ * texmf.c (get_date_and_time): Cast arg to time_t *, not long *.
+ (From james@miller.cs.uwm.edu.)
+
+ * texmf.c (get_date_and_time) [SA_INTERRUPT]: Add code for SunOS
+ 4.1, from ken@cs.toronto.edu.
+
+ * pathsrch.c (expand_subdir) [UNIX_ST_NLINK]: Don't check st_link
+ if we don't have Unix semantics.
+ * c-auto.h.in (UNIX_ST_NLINK): Define if not DOS or VMS or VMCMS.
+ (Suggested by buers@dg1.chemie.uni-konstanz.de.)
+
+ * texmf.c (catch_interrupt): Declare a(n unused) parameter `arg'
+ (from beebe).
+ (get_date_and_time): Don't do assignment in if condition.
+
+Fri Apr 9 16:10:06 1993 Karl Berry (karl@cs.umb.edu)
+
+ * xrealloc.c (xrealloc): Don't print old_ptr.
+
+ * c-std.h (stddef.h): Don't include.
+
+ * openinout.c (make_tex_file): cmd is a string, not a character.
+
+Mon Mar 29 08:33:51 1993 Karl Berry (karl@cs.umb.edu)
+
+ * cpascal.h (abs) [abs]: Undef.
+
+Sat Mar 13 10:22:54 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (CPPFLAGS): Add @DEFS@, for -DHAVE_CONFIG_H.
+
+ * texmf.h: Include cpascal.h instead of config.h.
+
+ * common.h: Merge into config.h and remove.
+
+ * common.h (pascal.h): Don't include this.
+ * cpascal.h: Rename from pascal.h.
+
+ * convert: Exit with bad status if the pipeline failed; use
+ cpascal.h instead of config.h.
+
+ * openinout.c (make_tex_file): Call xmalloc instead of declaring
+ an array; put quotes around the arg of sh -c.
+
+Sun Feb 28 11:10:48 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (MAKE_TEX_*): Replace single NO_MAKETEX with
+ individual symbols.
+
+ * openinout.c (maketex*) [MAKE_TEX*]: Make them individually
+ selectable.
+
+Sun Feb 21 08:28:06 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Version 5.851d.
+
+ * common.defines (maketexmf): New defn.
+
+ * Makefile.in (.c.o): Put $(CFLAGS) after $(CPPFLAGS).
+
+ * openinout.c: Include c-namemx.h.
+
+Tue Feb 16 17:53:54 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (install-exec, install-data): New targets.
+
+Mon Feb 15 10:19:02 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (NO_MAKETEX): New #define for installers.
+
+ * openinout.c (maketex*): New routines, rewrite from yesterday.
+
+ * common.defines (maketextex): Define.
+
+Sun Feb 14 11:54:30 1993 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_input) [BibTeX]: Only do NO_FILE_PATH stuff if
+ we are BibTeX; declare tfmtemp only when we need it, instead of at
+ the outer level; add support for MakeTeX{TeX,MF,TFM}.
+
+Fri Feb 12 07:33:49 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in (const): Add defn for Autoconf to use.
+
+ * paths.h.in (TEXFORMATS): Only define once.
+
+Sat Jan 30 09:46:04 1993 Karl Berry (karl@cs.umb.edu)
+
+ * fontmap.c (map_lookup): Only extend the filename if we have one.
+
+Tue Jan 26 16:07:21 1993 Karl Berry (karl@cs.umb.edu)
+
+ * version.c: New file to define web2c version.
+ * common.h (versionstring): Declare it here.
+ * common.defines (versionstring): And here.
+ * Makefile.in (objs): Add it.
+
+ * c-auto.h.in (X11WIN) [XVIEWWIN]: Undefine.
+
+Mon Jan 25 12:04:28 1993 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c (testreadaccess.c): Don't free `found' after copying,
+ as it might not be malloc-ed.
+
+Sun Jan 24 11:04:37 1993 Karl Berry (karl@cs.umb.edu)
+
+ * lib.h (FATAL*, WARNING*): Use `str' instead of `s' for macro formals.
+
+ * xcalloc.c: Remove prototypes.
+ * remove-suffx.c, line.c, fontmap.c: Cast *alloc calls to avoid
+ silly warnings.
+
+ * texmf.c (swap_items): Rewrite as four while loops, since `size'
+ is invariant. (From Tom.)
+
+Sat Jan 23 10:13:51 1993 Karl Berry (karl@cs.umb.edu)
+
+ * remove-suffx.c: New file.
+
+Thu Jan 21 11:21:14 1993 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in (objs5): New variable.
+ ($(lib)): Include it in the archive.
+
+ * extend-fname.c, find-suffix.c, xfopen.c, fontmap.[ch]: New files.
+
+ * ourpaths.c, fontmap.[ch]: Implement a mapping file.
+
+Sat Jan 16 08:36:36 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in, paths.h.in: Doc fix.
+
+Sun Jan 3 13:27:37 1993 Karl Berry (karl@cs.umb.edu)
+
+ * config.h: Move some includes to c-std.h.
+
+ * xcalloc.c: New file.
+ * Makefile.in (objs): Add it.
+
+ * Makefile.in (distclean): Remove Makefile; depend on clean.
+
+Fri Jan 1 14:17:37 1993 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in, c-memstr.h, dirio.h: Changes for new Autoconf.
+
+ * texmf.c (RETSIGTYPE): Don't default to void.
+
+Fri Dec 18 13:16:47 1992 Karl Berry (karl@cs.umb.edu)
+
+ * strpascal.c (makesuffixpas): Rename to `extendfilename'.
+ * common.defines (extendfilename): Declare.
+
+Wed Dec 16 18:12:51 1992 Karl Berry (karl@cs.umb.edu)
+
+ * common.defines (atoi): Declare.
+
+Mon Dec 14 07:25:03 1992 Karl Berry (karl@cs.umb.edu)
+
+ * ourpaths.c: Include paths.h.
+
+Sun Dec 13 17:06:15 1992 Karl Berry (karl@cs.umb.edu)
+
+ * c-auto.h.in: Merge stuff from site.h.
+ * site.h: Delete.
+ * config.h: Don't include site.h.
+
+Sat Dec 12 13:08:52 1992 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile.in: Rewrite from Makefile.
+
+ * openinout.c (open_{in,out}put): Take an extra arg for the fopen mode.
+ * texmf.h ([bw]open{in,out}): Use appropriate fopen modes.
+ * pascal.h (aopen{in,out}): Likewise.
+
+Fri Dec 11 15:19:25 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c: Change ctype references to use uppercase macros.
+
+Sat Dec 5 15:21:24 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.h (writedvi, writegf): Check the return status of the write.
+
+ * config.h (UNSIGNED_SHORT_STRING): Toss; I think everyone
+ understands `unsigned short' now.
+
+Thu Dec 3 13:21:06 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c: include c-pathch.h.
+
+Sun Nov 29 14:50:04 1992 Karl Berry (karl@cs.umb.edu)
+
+ * strpascal.c: include c-pathch.h.
+
+Mon Nov 16 08:12:16 1992 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c: include c-pathch.h.
+
+Tue Nov 10 06:49:33 1992 Karl Berry (karl@cs.umb.edu)
+
+ * texmf.c (main): Change '/' to PATH_SEP.
+ * openinout.c (open_input): Likewise.
+ * strpascal.c (makesuffixpas): And here.
+
+Mon Nov 9 09:38:58 1992 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_input): Use FOPEN_RBIN_MODE instead of simply "r".
+ (open_output): Analogously.
+
+ * c-auto.h.in (DOS): New definition, #undef'd by default.
+
+Fri Nov 6 14:52:34 1992 Karl Berry (karl@cs.umb.edu)
+
+ * Makefile (lib): Use $(AR) and $(ARFLAGS) several times.
+ (AR, ARFLAGS): New variables.
+ (objs1..4): New variables, breaking up the old $(objs).
+
+Tue Oct 27 08:16:41 1992 Karl Berry (karl@cs.umb.edu)
+
+ * openinout.c (open_output): Remove `openable', just use *f !=
+ NULL; also, don't chdir to the envvar's directory, just prepend
+ the value and change nameoffile.
+
+ * site.h (TEXPOOLNAME): More instructions for MLTeX.
+
+Sun Oct 25 06:26:22 1992 Karl Berry (karl@cs.umb.edu)
+
+ * getopt.c: New version.
+
+Tue Oct 6 08:17:45 1992 Karl Berry (karl@cs.umb.edu)
+
+ * site.h.in: Doc fix.
+
+Thu Sep 24 11:06:14 1992 Karl Berry (karl@cs.umb.edu)
+
+ * site.h.in: change instructions for OpenWindows. (mroth@afit.af.mil)
+
+Thu Sep 17 08:29:53 1992 Karl Berry (karl@hayley)
+
+ * texmf.c (initscreen): if DISPLAY is set, assume we're running
+ under X11 for MF online output.
+
+ * texmf.c: remove BibTeX conditionals.
+
+Tue Sep 8 17:06:54 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in (_MINIX, _{ALL,POSIX,POSIX_1}_SOURCE): add #undef's
+ for configure to define.
+
+Fri Sep 4 09:01:59 1992 Karl Berry (karl@hayley)
+
+ * Makefile (extraclean): new target.
+
+Fri Aug 14 07:02:41 1992 Karl Berry (karl@hayley)
+
+ * ourpaths.h (path_constant_type): remove trailing comma from
+ enum, since ANSI stupidly disallows this.
+
+Wed Aug 12 16:20:10 1992 Karl Berry (karl@hayley)
+
+ * texmf.c (catch_interrupt): change return type to `RETSIGTYPE'.
+
+ * config.h: remove conditional include of c-memstr if `index' is
+ defined.
+
+Sat Aug 8 10:11:18 1992 Karl Berry (karl@hayley)
+
+ * openinout.c (EXTERN) [!BibTeX]: define as `extern'. How did
+ this ever work?
+
+Fri Jul 3 11:23:32 1992 Karl Berry (karl@hayley)
+
+ * texmf.c (input_line): ignore \r's at the end of the line.
+
+ * site.h.in (XVIEWWIN): undef by default.
+ * texmf.c (X11WIN) [MF && (TRAP || INI)]: #undef.
+
+Thu Jul 2 16:11:46 1992 Karl Berry (karl@hayley)
+
+ * Makefile (CPPFLAGS): new variable
+ (.c.o): use it.
+ (cflags): change to CFLAGS.
+
+Tue Jun 23 09:09:49 1992 Karl Berry (karl@hayley)
+
+ * Makefile (CC): change default to `gcc -posix'.
+
+ * site.h.in (NONASCII): document that xord and xchr are ignored
+ unless this is defined.
+
+Thu Jun 11 09:20:51 1992 Karl Berry (karl@hayley)
+
+ * zround.c (zround): return LONG_MAX or LONG_MIN if the double
+ being rounded is outside the range of `integer'.
+ * c-minmax.h (LONG_{MIN,MAX}): define these if they aren't defined
+ by the system.
+
+Fri May 15 10:23:47 1992 Karl Berry (karl@hayley)
+
+ * getopt.[ch]: new versions.
+
+Thu May 14 19:21:40 1992 Karl Berry (karl@claude.cs.umb.edu)
+
+ * Version 5.851c.
+
+Wed May 13 14:32:14 1992 Karl Berry (karl@hayley)
+
+ * pathsrch.c (initalize_path_list): initialize path to the
+ original path.
+
+Mon May 4 14:50:20 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in: doc fix.
+
+Sun May 3 08:06:07 1992 Karl Berry (karl@hayley)
+
+ * main.c (argv): use a prototype if possibile.
+
+ * texmf.ch (*dumpthings): parenthesize `len'.
+
+Wed Apr 29 16:07:52 1992 Karl Berry (karl@hayley)
+
+ * texmfmem.h (memoryword): had mutually exclusive #if's.
+ (twohalves.u): don't need junk at the end?
+
+Sat Apr 25 08:55:34 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in (__CHAR_UNSIGNED__): protect with #ifndef.
+
+ * site.h.in: remove #ifndef's from around the #define's. I don't
+ think these help anything.
+
+Thu Apr 23 07:49:18 1992 Karl Berry (karl@hayley)
+
+ * c-auto.h.in: new file.
+
+Wed Apr 22 12:43:30 1992 Karl Berry (karl@hayley)
+
+ * texmf.c: SIGTYPE is now RETSIGTYPE.
+
+Sun Apr 19 10:26:16 1992 Karl Berry (karl@hayley)
+
+ * texmf.c: had sense of tests on FMTBASE_SWAP reversed.
+
+Thu Apr 16 13:49:36 1992 Karl Berry (karl@ra.cs.umb.edu)
+
+ * Version 5.851b.
+
+Tue Apr 14 17:06:57 1992 Karl Berry (karl@hayley)
+
+ * common.defines (BSTINPUTPATHBIT): define.
+
+Sun Apr 12 11:42:14 1992 Karl Berry (karl@hayley)
+
+ * common.defines (BSTINPUTPATH): define.
+ * ourpaths.h (path_constant_type): add BSTINPUTPATH.
+ (BSTINPUTPATHBIT): define.
+ * site.h-dist (BSTINPUTS): default is TEXINPUTS.
+ * ourpaths.c (setpaths): add stuff for BSTINPUTS.
+
+Sat Apr 11 09:26:55 1992 Karl Berry (karl@hayley)
+
+ * uexit.c: include config.h, for EXIT_SUCCESS_CODE.
+
+Fri Apr 10 16:56:18 1992 Karl Berry (karl@hayley)
+
+ * ourpaths.c (setpaths): don't pass cwd to initialize_path_list.
+
+ * site.h-dist (*INPUTS, TEXFONTS): add . to these paths.
+
+Wed Apr 8 15:34:21 1992 Karl Berry (karl@hayley)
+
+ * texmf.c [FMTBASE_SWAP]: make swapping conditional.
+ * site.h-dist: add it here for configuration.
+
+ * main.c (do_undump) [VMS]: add code from joe.
+
+ * main.c: use exit, not exit.
+
+ * Makefile (objs): add uexit.o.
+ * uexit.c: new file.
+ * pascal.h (uexit): remove this, as it's now a function.
+
+Fri Apr 3 09:55:00 1992 Karl Berry (karl at hayley)
+
+ * Version 5.851a.
+
+Thu Apr 2 11:57:06 1992 Karl Berry (karl at apollo.cs.umb.edu)
+
+ * c-memstr.h (memcpy) [!NEED_MEMORY_H]: conditionalize.
+
+Thu Apr 2 10:51:11 1992 Karl Berry (karl at ra.cs.umb.edu)
+
+ * xstat.c (xlstat): (un)prototype-ize.
+
+ * c-limits.h: test for FLOAT_H_MISSING instead of relying on
+ _POSIX_VERSION to include <float.h>.
+
+ * c-pathmx.h [_POSIX_VERSION]: don't do pathconf stuff.
+
+Wed Apr 1 16:57:30 1992 Karl Berry (karl at hayley)
+
+ * common.h (FATAL): use `str' as the arg name, not `s', since we
+ need to do `%s'.
+
+ * xopendir.c (xclosedir): prototype-ize it.
+
+ * dir-p (leaf_dir_p): don't initialize a structure (!).
+
+ * {concat,pathsrch,texmf,xmalloc,xstrdup,xrealloc}.c: cast results from
+ xmalloc/malloc/realloc (argh).
+
+ * alloca.c: comment things after #endif.
+
+ * site.h-dist (REGFIX): put this back.
+
+ * c-proto.h (P5C) [!__STDC__]: insert missing backslash.
+
+Mon Mar 30 07:28:25 1992 Karl Berry (karl at hayley)
+
+ * texmfmem.h (u, v, twohalves) [big MF]: define the halfword junks
+ again.
+
+Sun Mar 29 15:33:29 1992 Karl Berry (karl at hayley)
+
+ * alloca.c: new version from gcc 2.1.
+
+Sat Mar 28 09:46:53 1992 Karl Berry (karl at hayley)
+
+ * main.c (main): return int, exit (EXIT_SUCCESS_CODE).
+ * texmf.c (main): likewise.
+
+ * config.h (SCHAR_TYPE): use `__CHAR_UNSIGNED__' again.
+
+Thu Mar 26 06:57:38 1992 Karl Berry (karl at hayley)
+
+ * Makefile (clean, realclean): depend on mostlyclean.
+
+Sun Mar 22 09:16:04 1992 Karl Berry (karl at hayley)
+
+ * common.h [BibTeX]: remove the include of <setjmp.h>, as
+ bibtex/convert does it.
+
+Sat Mar 21 11:09:55 1992 Karl Berry (karl at hayley)
+
+ * common.defines (input2ints): for patgen2.
+ * inputint.c (zinput2ints): new routine.
+ * pascal.h (input2ints): new macro to call it.
+
+ * config.h: include c-pathmx.h.
+
+ * common.defines (TEXPOOLNAME): declare as a constant.
+
+Fri Mar 20 16:10:44 1992 Karl Berry (karl at hayley)
+
+ * paths.h: new file.
+
+ * config.h: update for new files c-*.h.
+ * common.h: remove stuff that is now in lib.h.
+
+Thu Mar 19 11:52:17 1992 Karl Berry (karl at hayley)
+
+ * ourpaths.c (append_path_list): remove this.
+
+ * ourpaths.c (setpaths): use the envvar TEXFONTS if VFFONTS isn't set.
+
+Tue Feb 11 10:27:38 1992 Karl Berry (karl at hayley)
+
+ * config.h [NEED_MEMORY_H]: include <memory.h>.
+
+ * config.h [LIMITS_H_MISSING]: include <sys/param.h>.
+
+Sun Feb 2 07:54:53 1992 Karl Berry (karl at hayley)
+
+ * pathsearch.c (parse_envpath): remove the second / before doing
+ subdirectories.
+
+ * pascal.h (optiontable): remove, as getopt no longer has a global
+ table for the long options.
+
+Sat Feb 1 15:32:50 1992 Karl Berry (karl at hayley)
+
+ * ourpaths.c (setpaths): use TEXFONTS if PKFONTS/GFFONTS is not
+ set for GF/PK files, as the documentation claims.
+
+ * ourpaths.c (setpaths): remove subdirectory stuff.
+ * pathsearch.[ch]: new versions to integrate subdirectories into
+ the main paths.
+
+ * texmf{,mem}.c (WEB2C_BIGENDIAN): rename to WORDS_BIGENDIAN.
+
+Fri Jan 31 11:54:46 1992 Karl Berry (karl at hayley)
+
+ * strpascal.c ({null,space}_terminate): do not translate using
+ xord/xchr (from raichle@azu.informatik.uni-stuttgart.de).
+
+Fri Jan 24 07:14:05 1992 Karl Berry (karl at hayley)
+
+ * Makefile (cflags): don't include -I../config.
+
+ * config.h (__CHAR_UNSIGNED__) [CHAR_UNSIGNED]: define as autoconf
+ uses the latter and gcc sometimes the former.
+
+ * config.h: move from config.
+
+ * openinout.c (extensionirrelevantp): new function.
+ * common.defines: declare it.
+
+ * ourpaths.h (path_constant_type): rename from `path_constants'.
+ * openinout.c (open_input): use it for the path arg.
+
+Wed Jan 15 11:13:45 1992 Karl Berry (karl at hayley)
+
+ * xgetcwd.c, xchdir.c: don't need these.
+ * Makefile (objs): remove from list.
+ * dirio.h: remove decls.
+
+ * pathsearch.c (check_subdir): do not cd to the directory we're
+ testing.
+ (add_directory): test if the name is a directory before adding it
+ to the list.
+ (parse_envpath): don't test if the names are directories here.
+ (initialize_path_list): don't find and cd to the current directory
+ between each subdirectory.
+
+Tue Jan 14 16:06:24 1992 Karl Berry (karl at hayley)
+
+ * texmf.c: do not include <sys/types.h>; it's in config.h now.
+ * types.h: likewise.
+
+Sun Jan 12 07:41:34 1992 Karl Berry (karl at hayley)
+
+ * pathsearch.c (initialize_path_list): cd back to . after checking
+ each subdirectory.
+
+ * dirio.h: change directory header stuff as suggested in the
+ autoconf manual.
+
+ * ourpaths.h: make the path list an enumeration type.
+
+ * openinout.c (open_input): correctly compute namelength.
+
+ * texmfmem.h (memoryword) [TeX]: make declaration of `glueratio'
+ conditional.
+
+ * openinout.c: rearrange ifdefs for coherency.
+
+ * ourpaths.c (append_path_list): overwrite the null in the first
+ list.
+
+ * pathsearch.c (initialize_path_list): unconditionally call
+ parse_envpath.
+ (parse_envpath): if the envvar name is null, don't call getenv.
+ If both args are null, do nothing.
+
+ * ourpaths.c (setpaths): initialize the TFM path.
+
+ * common.h (FATAL*): new macros.
+
+ * pascal.h (real): define to be `double'.
+
+ * xfopen-pas.c: new file.
+
+ * eofeoln.c (test_eof): rename to `eof'.
+ * pascal.h (eof): remove.
+
+ * pascal.h (reset, rewrite): `checked_fopen' => `xfopen_pas'.
+
+ * common.h (link): define as `link_var', to avoid conflicts
+ between the system call and the web var.
+
+ * common.defines (FILENAMESIZE): rename to `PATHMAX'.
+
+Tue Jan 7 11:26:02 1992 Karl Berry (karl at hayley)
+
+ * getopt*: new versions.
+
+ * extra.c (getwd) [GETWD_MISSING]: conditionalize.
+
+ * extra.c (zinput3ints): new implementation, from jmr@nada.kth.se.
+
+ * texmf.c (swap_items) [!WEB2C_BIG_ENDIAN]: ifdef on this.
+ * texmfmem.h (twohalves, fourquarters): incorporate changes from
+ raichle@azu.informatik.uni-stuttgart.de which he says make
+ format files finally work.
+
+ * common.h (SCHAR_TYPE): use `signed_char' if ANSI, `short' if
+ char is unsigned, otherwise `char'.
+
diff --git a/Build/source/texk/web2c/lib/Makefile.in b/Build/source/texk/web2c/lib/Makefile.in
new file mode 100644
index 00000000000..330b1b50eb2
--- /dev/null
+++ b/Build/source/texk/web2c/lib/Makefile.in
@@ -0,0 +1,32 @@
+# Makefile for the web2c library.
+
+kpse_include ../make/common.mk
+kpse_include ../make/library.mk
+kpse_include kpathsea.mk
+
+library = lib
+
+# We don't make `texmfmp.o', since TeX, Metafont, and MetaPost need to
+# use different routine names, hence they need different .o files. Maybe
+# we should change this via #define's someday ...
+objects = basechsuffix.o chartostring.o coredump.o \
+ eofeoln.o fprintreal.o inputint.o input2int.o main.o \
+ openclose.o printversion.o uexit.o usage.o version.o zround.o
+
+default all: $(library).a
+$(library).a: $(objects)
+ rm -f $@
+ $(AR) $(ARFLAGS) $@ $(objects)
+ $(RANLIB) $@
+
+# Do not use CPPFLAGS for this, because including config.h might
+# result in a conflicting decl of xmalloc. How annoying.
+alloca.o: alloca.c
+ $(CC) $(CFLAGS) -c $(srcdir)/alloca.c
+
+Makefile: Makefile.in ../config.status
+ cd .. && $(SHELL) config.status
+
+kpse_include ../make/clean.mk
+kpse_include ../make/rdepend.mk
+kpse_include lib/depend.mk
diff --git a/Build/source/texk/web2c/lib/README b/Build/source/texk/web2c/lib/README
new file mode 100644
index 00000000000..8cd3761bef9
--- /dev/null
+++ b/Build/source/texk/web2c/lib/README
@@ -0,0 +1,2 @@
+This directory contains the web2c library, just a few functions mostly
+common to both the TeX programs and the web2c conversion itself.
diff --git a/Build/source/texk/web2c/lib/alloca.c b/Build/source/texk/web2c/lib/alloca.c
new file mode 100644
index 00000000000..385793295fe
--- /dev/null
+++ b/Build/source/texk/web2c/lib/alloca.c
@@ -0,0 +1,504 @@
+/* alloca.c -- allocate automatically reclaimed memory
+ (Mostly) portable public-domain implementation -- D A Gwyn
+
+ This implementation of the PWB library alloca function,
+ which is used to allocate space off the run-time stack so
+ that it is automatically reclaimed upon procedure exit,
+ was inspired by discussions with J. Q. Johnson of Cornell.
+ J.Otto Tennant <jot@cray.com> contributed the Cray support.
+
+ There are some preprocessor constants that can
+ be defined when compiling for your specific system, for
+ improved efficiency; however, the defaults should be okay.
+
+ The general concept of this implementation is to keep
+ track of all alloca-allocated blocks, and reclaim any
+ that are found to be deeper in the stack than the current
+ invocation. This heuristic does not reclaim storage as
+ soon as it becomes invalid, but it will do so eventually.
+
+ As a special case, alloca(0) reclaims storage without
+ allocating any. It is a good idea to use alloca(0) in
+ your main control loop, etc. to force garbage collection. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef emacs
+#include "blockinput.h"
+#endif
+
+/* If compiling with GCC 2, this file's not needed. */
+#if !defined (__GNUC__) || __GNUC__ < 2
+
+/* If someone has defined alloca as a macro,
+ there must be some other way alloca is supposed to work. */
+#ifndef alloca
+
+#ifdef emacs
+#ifdef static
+/* actually, only want this if static is defined as ""
+ -- this is for usg, in which emacs must undefine static
+ in order to make unexec workable
+ */
+#ifndef STACK_DIRECTION
+you
+lose
+-- must know STACK_DIRECTION at compile-time
+#endif /* STACK_DIRECTION undefined */
+#endif /* static */
+#endif /* emacs */
+
+/* If your stack is a linked list of frames, you have to
+ provide an "address metric" ADDRESS_FUNCTION macro. */
+
+#if defined (CRAY) && defined (CRAY_STACKSEG_END)
+long i00afunc ();
+#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
+#else
+#define ADDRESS_FUNCTION(arg) &(arg)
+#endif
+
+#if __STDC__
+typedef void *pointer;
+#else
+typedef char *pointer;
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Different portions of Emacs need to call different versions of
+ malloc. The Emacs executable needs alloca to call xmalloc, because
+ ordinary malloc isn't protected from input signals. On the other
+ hand, the utilities in lib-src need alloca to call malloc; some of
+ them are very simple, and don't have an xmalloc routine.
+
+ Non-Emacs programs expect this to call use xmalloc.
+
+ Callers below should use malloc. */
+
+#ifndef emacs
+#define malloc xmalloc
+#endif
+extern pointer malloc ();
+
+/* Define STACK_DIRECTION if you know the direction of stack
+ growth for your system; otherwise it will be automatically
+ deduced at run-time.
+
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+
+#ifndef STACK_DIRECTION
+#define STACK_DIRECTION 0 /* Direction unknown. */
+#endif
+
+#if STACK_DIRECTION != 0
+
+#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
+
+#else /* STACK_DIRECTION == 0; need run-time code. */
+
+static int stack_dir; /* 1 or -1 once known. */
+#define STACK_DIR stack_dir
+
+static void
+find_stack_direction ()
+{
+ static char *addr = NULL; /* Address of first `dummy', once known. */
+ auto char dummy; /* To get stack address. */
+
+ if (addr == NULL)
+ { /* Initial entry. */
+ addr = ADDRESS_FUNCTION (dummy);
+
+ find_stack_direction (); /* Recurse once. */
+ }
+ else
+ {
+ /* Second entry. */
+ if (ADDRESS_FUNCTION (dummy) > addr)
+ stack_dir = 1; /* Stack grew upward. */
+ else
+ stack_dir = -1; /* Stack grew downward. */
+ }
+}
+
+#endif /* STACK_DIRECTION == 0 */
+
+/* An "alloca header" is used to:
+ (a) chain together all alloca'ed blocks;
+ (b) keep track of stack depth.
+
+ It is very important that sizeof(header) agree with malloc
+ alignment chunk size. The following default should work okay. */
+
+#ifndef ALIGN_SIZE
+#define ALIGN_SIZE sizeof(double)
+#endif
+
+typedef union hdr
+{
+ char align[ALIGN_SIZE]; /* To force sizeof(header). */
+ struct
+ {
+ union hdr *next; /* For chaining headers. */
+ char *deep; /* For stack depth measure. */
+ } h;
+} header;
+
+static header *last_alloca_header = NULL; /* -> last alloca header. */
+
+/* Return a pointer to at least SIZE bytes of storage,
+ which will be automatically reclaimed upon exit from
+ the procedure that called alloca. Originally, this space
+ was supposed to be taken from the current stack frame of the
+ caller, but that method cannot be made to work for some
+ implementations of C, for example under Gould's UTX/32. */
+
+pointer
+alloca (size)
+ unsigned size;
+{
+ auto char probe; /* Probes stack depth: */
+ register char *depth = ADDRESS_FUNCTION (probe);
+
+#if STACK_DIRECTION == 0
+ if (STACK_DIR == 0) /* Unknown growth direction. */
+ find_stack_direction ();
+#endif
+
+ /* Reclaim garbage, defined as all alloca'd storage that
+ was allocated from deeper in the stack than currently. */
+
+ {
+ register header *hp; /* Traverses linked list. */
+
+#ifdef emacs
+ BLOCK_INPUT;
+#endif
+
+ for (hp = last_alloca_header; hp != NULL;)
+ if ((STACK_DIR > 0 && hp->h.deep > depth)
+ || (STACK_DIR < 0 && hp->h.deep < depth))
+ {
+ register header *np = hp->h.next;
+
+ free ((pointer) hp); /* Collect garbage. */
+
+ hp = np; /* -> next header. */
+ }
+ else
+ break; /* Rest are not deeper. */
+
+ last_alloca_header = hp; /* -> last valid storage. */
+
+#ifdef emacs
+ UNBLOCK_INPUT;
+#endif
+ }
+
+ if (size == 0)
+ return NULL; /* No allocation required. */
+
+ /* Allocate combined header + user data storage. */
+
+ {
+ register pointer newm = malloc (sizeof (header) + size);
+ /* Address of header. */
+
+ if (newm == 0)
+ abort();
+
+ ((header *) newm)->h.next = last_alloca_header;
+ ((header *) newm)->h.deep = depth;
+
+ last_alloca_header = (header *) newm;
+
+ /* User storage begins just after header. */
+
+ return (pointer) ((char *) newm + sizeof (header));
+ }
+}
+
+#if defined (CRAY) && defined (CRAY_STACKSEG_END)
+
+#ifdef DEBUG_I00AFUNC
+#include <stdio.h>
+#endif
+
+#ifndef CRAY_STACK
+#define CRAY_STACK
+#ifndef CRAY2
+/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
+struct stack_control_header
+ {
+ long shgrow:32; /* Number of times stack has grown. */
+ long shaseg:32; /* Size of increments to stack. */
+ long shhwm:32; /* High water mark of stack. */
+ long shsize:32; /* Current size of stack (all segments). */
+ };
+
+/* The stack segment linkage control information occurs at
+ the high-address end of a stack segment. (The stack
+ grows from low addresses to high addresses.) The initial
+ part of the stack segment linkage control information is
+ 0200 (octal) words. This provides for register storage
+ for the routine which overflows the stack. */
+
+struct stack_segment_linkage
+ {
+ long ss[0200]; /* 0200 overflow words. */
+ long sssize:32; /* Number of words in this segment. */
+ long ssbase:32; /* Offset to stack base. */
+ long:32;
+ long sspseg:32; /* Offset to linkage control of previous
+ segment of stack. */
+ long:32;
+ long sstcpt:32; /* Pointer to task common address block. */
+ long sscsnm; /* Private control structure number for
+ microtasking. */
+ long ssusr1; /* Reserved for user. */
+ long ssusr2; /* Reserved for user. */
+ long sstpid; /* Process ID for pid based multi-tasking. */
+ long ssgvup; /* Pointer to multitasking thread giveup. */
+ long sscray[7]; /* Reserved for Cray Research. */
+ long ssa0;
+ long ssa1;
+ long ssa2;
+ long ssa3;
+ long ssa4;
+ long ssa5;
+ long ssa6;
+ long ssa7;
+ long sss0;
+ long sss1;
+ long sss2;
+ long sss3;
+ long sss4;
+ long sss5;
+ long sss6;
+ long sss7;
+ };
+
+#else /* CRAY2 */
+/* The following structure defines the vector of words
+ returned by the STKSTAT library routine. */
+struct stk_stat
+ {
+ long now; /* Current total stack size. */
+ long maxc; /* Amount of contiguous space which would
+ be required to satisfy the maximum
+ stack demand to date. */
+ long high_water; /* Stack high-water mark. */
+ long overflows; /* Number of stack overflow ($STKOFEN) calls. */
+ long hits; /* Number of internal buffer hits. */
+ long extends; /* Number of block extensions. */
+ long stko_mallocs; /* Block allocations by $STKOFEN. */
+ long underflows; /* Number of stack underflow calls ($STKRETN). */
+ long stko_free; /* Number of deallocations by $STKRETN. */
+ long stkm_free; /* Number of deallocations by $STKMRET. */
+ long segments; /* Current number of stack segments. */
+ long maxs; /* Maximum number of stack segments so far. */
+ long pad_size; /* Stack pad size. */
+ long current_address; /* Current stack segment address. */
+ long current_size; /* Current stack segment size. This
+ number is actually corrupted by STKSTAT to
+ include the fifteen word trailer area. */
+ long initial_address; /* Address of initial segment. */
+ long initial_size; /* Size of initial segment. */
+ };
+
+/* The following structure describes the data structure which trails
+ any stack segment. I think that the description in 'asdef' is
+ out of date. I only describe the parts that I am sure about. */
+
+struct stk_trailer
+ {
+ long this_address; /* Address of this block. */
+ long this_size; /* Size of this block (does not include
+ this trailer). */
+ long unknown2;
+ long unknown3;
+ long link; /* Address of trailer block of previous
+ segment. */
+ long unknown5;
+ long unknown6;
+ long unknown7;
+ long unknown8;
+ long unknown9;
+ long unknown10;
+ long unknown11;
+ long unknown12;
+ long unknown13;
+ long unknown14;
+ };
+
+#endif /* CRAY2 */
+#endif /* not CRAY_STACK */
+
+#ifdef CRAY2
+/* Determine a "stack measure" for an arbitrary ADDRESS.
+ I doubt that "lint" will like this much. */
+
+static long
+i00afunc (long *address)
+{
+ struct stk_stat status;
+ struct stk_trailer *trailer;
+ long *block, size;
+ long result = 0;
+
+ /* We want to iterate through all of the segments. The first
+ step is to get the stack status structure. We could do this
+ more quickly and more directly, perhaps, by referencing the
+ $LM00 common block, but I know that this works. */
+
+ STKSTAT (&status);
+
+ /* Set up the iteration. */
+
+ trailer = (struct stk_trailer *) (status.current_address
+ + status.current_size
+ - 15);
+
+ /* There must be at least one stack segment. Therefore it is
+ a fatal error if "trailer" is null. */
+
+ if (trailer == 0)
+ abort ();
+
+ /* Discard segments that do not contain our argument address. */
+
+ while (trailer != 0)
+ {
+ block = (long *) trailer->this_address;
+ size = trailer->this_size;
+ if (block == 0 || size == 0)
+ abort ();
+ trailer = (struct stk_trailer *) trailer->link;
+ if ((block <= address) && (address < (block + size)))
+ break;
+ }
+
+ /* Set the result to the offset in this segment and add the sizes
+ of all predecessor segments. */
+
+ result = address - block;
+
+ if (trailer == 0)
+ {
+ return result;
+ }
+
+ do
+ {
+ if (trailer->this_size <= 0)
+ abort ();
+ result += trailer->this_size;
+ trailer = (struct stk_trailer *) trailer->link;
+ }
+ while (trailer != 0);
+
+ /* We are done. Note that if you present a bogus address (one
+ not in any segment), you will get a different number back, formed
+ from subtracting the address of the first block. This is probably
+ not what you want. */
+
+ return (result);
+}
+
+#else /* not CRAY2 */
+/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
+ Determine the number of the cell within the stack,
+ given the address of the cell. The purpose of this
+ routine is to linearize, in some sense, stack addresses
+ for alloca. */
+
+static long
+i00afunc (long address)
+{
+ long stkl = 0;
+
+ long size, pseg, this_segment, stack;
+ long result = 0;
+
+ struct stack_segment_linkage *ssptr;
+
+ /* Register B67 contains the address of the end of the
+ current stack segment. If you (as a subprogram) store
+ your registers on the stack and find that you are past
+ the contents of B67, you have overflowed the segment.
+
+ B67 also points to the stack segment linkage control
+ area, which is what we are really interested in. */
+
+ stkl = CRAY_STACKSEG_END ();
+ ssptr = (struct stack_segment_linkage *) stkl;
+
+ /* If one subtracts 'size' from the end of the segment,
+ one has the address of the first word of the segment.
+
+ If this is not the first segment, 'pseg' will be
+ nonzero. */
+
+ pseg = ssptr->sspseg;
+ size = ssptr->sssize;
+
+ this_segment = stkl - size;
+
+ /* It is possible that calling this routine itself caused
+ a stack overflow. Discard stack segments which do not
+ contain the target address. */
+
+ while (!(this_segment <= address && address <= stkl))
+ {
+#ifdef DEBUG_I00AFUNC
+ fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
+#endif
+ if (pseg == 0)
+ break;
+ stkl = stkl - pseg;
+ ssptr = (struct stack_segment_linkage *) stkl;
+ size = ssptr->sssize;
+ pseg = ssptr->sspseg;
+ this_segment = stkl - size;
+ }
+
+ result = address - this_segment;
+
+ /* If you subtract pseg from the current end of the stack,
+ you get the address of the previous stack segment's end.
+ This seems a little convoluted to me, but I'll bet you save
+ a cycle somewhere. */
+
+ while (pseg != 0)
+ {
+#ifdef DEBUG_I00AFUNC
+ fprintf (stderr, "%011o %011o\n", pseg, size);
+#endif
+ stkl = stkl - pseg;
+ ssptr = (struct stack_segment_linkage *) stkl;
+ size = ssptr->sssize;
+ pseg = ssptr->sspseg;
+ result += size;
+ }
+ return (result);
+}
+
+#endif /* not CRAY2 */
+#endif /* CRAY */
+
+#endif /* no alloca */
+#endif /* not GCC version 2 */
diff --git a/Build/source/texk/web2c/lib/basechsuffix.c b/Build/source/texk/web2c/lib/basechsuffix.c
new file mode 100644
index 00000000000..f2c2d7bb06f
--- /dev/null
+++ b/Build/source/texk/web2c/lib/basechsuffix.c
@@ -0,0 +1,42 @@
+/* basechsuffix.c: replace the last bit of a filename with something else.
+
+ Written in 1995 by Karl Berry. Public domain. */
+
+#include "config.h"
+
+/* Return the basename of NAME, with trailing characters OLD replaced by
+ NEW. (If last characters in NAME are not OLD, just append NEW.)
+ Since this is used to turn, e.g., foo/cmr10.300pk -> cmr10.300gf,
+ don't assume a `.' preceding OLD or NEW.
+
+ In other words, we're implementing `basename NAME OLD`NEW. */
+
+string
+basenamechangesuffix P3C(const_string, name, const_string, old_suffix,
+ const_string, new_suffix)
+{
+ string answer;
+ unsigned c;
+ const_string base = xbasename (name);
+ unsigned base_len = strlen (base);
+ unsigned copy_limit = base_len;
+ unsigned old_suffix_len = strlen (old_suffix);
+
+ if (old_suffix_len <= base_len) {
+ for (c = 0; c < old_suffix_len; c++) {
+ if (!FILECHARCASEEQ (old_suffix[old_suffix_len - c - 1],
+ base[base_len - c - 1]))
+ break;
+ }
+ if (c == old_suffix_len) {
+ copy_limit -= old_suffix_len;
+ }
+ }
+
+ answer = (string)xmalloc (copy_limit + strlen (new_suffix) + 1);
+ strncpy (answer, base, copy_limit);
+ answer[copy_limit] = 0;
+ strcat (answer, new_suffix);
+
+ return answer;
+}
diff --git a/Build/source/texk/web2c/lib/chartostring.c b/Build/source/texk/web2c/lib/chartostring.c
new file mode 100644
index 00000000000..8f98feb7dac
--- /dev/null
+++ b/Build/source/texk/web2c/lib/chartostring.c
@@ -0,0 +1,22 @@
+/* chartostring.c: change a character (i.e., an integer) to a
+ one-character string.
+
+Written in 1994 by Karl Berry. Public domain. */
+
+#include "config.h"
+
+/* This is needed because web2c turns the Pascal construct 'x' into the
+ C character constant 'x', not the string "x". And we need to keep it
+ that way because that's how xord is initialized, etc. But sometimes
+ we want one-character strings -- e.g., in tangle.ch and weave.ch.
+ There's no real alternative to wasting the two bytes of memory (plus
+ malloc overhead) here, but it doesn't matter. */
+
+string
+chartostring P1C(char, ch)
+{
+ string str = (string)xmalloc (2);
+ str[0] = ch;
+ str[1] = 0;
+ return str;
+}
diff --git a/Build/source/texk/web2c/lib/coredump.c b/Build/source/texk/web2c/lib/coredump.c
new file mode 100644
index 00000000000..b465969294c
--- /dev/null
+++ b/Build/source/texk/web2c/lib/coredump.c
@@ -0,0 +1,58 @@
+/* coredump.c. Public domain.
+
+ This procedure is due to Chris Torek, chris@umd.edu. It makes a core
+ dump without any sort of error status (abort(2) does return an error
+ status, so we don't want to use that). It is used only when making a
+ preloaded TeX from virtex, and is triggered by a magic file name
+ requested as input (see `open_input', above). Finding a way to
+ reconstitute the core dump into a binary (i.e., with undump) is up to
+ you. Perl has some things to say about these days. */
+
+#include "config.h"
+
+/* Do not try to compile this Unix-y unportable stuff unless it's needed. */
+
+#ifdef FUNNY_CORE_DUMP
+#include <signal.h>
+#include <sys/wait.h>
+
+void
+funny_core_dump P1H(void)
+{
+#ifdef __EMX__
+ {
+ int handle = open ("core", O_WRONLY | O_CREAT | O_TRUNC | O_BINARY);
+ if (handle >= 0 && _core (handle) == 0)
+ exit (0);
+ (void) write (2, "attempt to dump core failed\n", 28);
+ exit (1);
+ }
+#else /* !__EMX__ */
+ int pid, w;
+ union wait status;
+
+ switch (pid = fork ())
+ {
+ case -1: /* failed */
+ perror ("vfork");
+ exit (-1);
+ /*NOTREACHED*/
+
+ case 0: /* child */
+ (void) signal (SIGQUIT, SIG_DFL);
+ (void) kill (getpid (), SIGQUIT);
+ (void) write (2, "how did we get here?\n", 21);
+ _exit (1);
+ /*NOTREACHED*/
+
+ default: /* parent */
+ while ((w = wait (&status)) != pid && w != -1)
+ ;
+ if (status.w_coredump)
+ exit (0);
+ (void) write (2, "attempt to dump core failed\n", 28);
+ exit (1);
+ }
+#endif /* not __EMX__ */
+}
+#endif /* FUNNY_CORE_DUMP */
diff --git a/Build/source/texk/web2c/lib/depend.mak b/Build/source/texk/web2c/lib/depend.mak
new file mode 100644
index 00000000000..ec2590f959e
--- /dev/null
+++ b/Build/source/texk/web2c/lib/depend.mak
@@ -0,0 +1,355 @@
+$(objdir)/coredump.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/basechsuffix.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/chartostring.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/usage.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/version.obj: \
+ ../c-auto.h
+
+$(objdir)/texmfmp.obj: \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/line.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/readable.h \
+ $(kpathseadir)/c-proto.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/absolute.h \
+ ../texmfmp-help.h
+
+$(objdir)/printversion.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/input2int.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/openclose.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-pathch.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/variable.h \
+ $(kpathseadir)/absolute.h
+
+$(objdir)/oem.obj: \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/c-vararg.h
+
+$(objdir)/win32main.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/zround.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/uexit.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/eofeoln.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/main.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/fprintreal.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/alloca.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
+$(objdir)/inputint.obj: \
+ ../config.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/../web2c/c-auto.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/c-fopen.h
+
diff --git a/Build/source/texk/web2c/lib/depend.mk b/Build/source/texk/web2c/lib/depend.mk
new file mode 100644
index 00000000000..20e5de20c8a
--- /dev/null
+++ b/Build/source/texk/web2c/lib/depend.mk
@@ -0,0 +1,140 @@
+alloca.o: alloca.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+basechsuffix.o: basechsuffix.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+chartostring.o: chartostring.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+coredump.o: coredump.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+eofeoln.o: eofeoln.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+fprintreal.o: fprintreal.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+input2int.o: input2int.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+inputint.o: inputint.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+main.o: main.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+mfmpw32.o: mfmpw32.c
+openclose.o: openclose.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-pathch.h $(kpathsea_srcdir)/c-ctype.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/variable.h \
+ $(kpathsea_srcdir)/absolute.h
+printversion.o: printversion.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+uexit.o: uexit.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+usage.o: usage.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+version.o: version.c ../c-auto.h
+win32main.o: win32main.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
+zround.o: zround.c ../config.h $(kpathsea_srcdir)/config.h \
+ $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ ../../web2c/c-auto.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/c-fopen.h
diff --git a/Build/source/texk/web2c/lib/eofeoln.c b/Build/source/texk/web2c/lib/eofeoln.c
new file mode 100644
index 00000000000..1107a30e855
--- /dev/null
+++ b/Build/source/texk/web2c/lib/eofeoln.c
@@ -0,0 +1,65 @@
+/* eofeoln.c: implement Pascal's ideas for end-of-file and end-of-line
+ testing. Public domain. */
+
+#include "config.h"
+
+
+/* Return true if we're at the end of FILE, else false. This implements
+ Pascal's `eof' builtin. */
+
+boolean
+eof P1C(FILE *, file)
+{
+ register int c;
+
+ /* If FILE doesn't exist, return false. This happens when, for
+ example, when a user does `mft foo.mf' -- there's no change file,
+ so we never open it, so we end up calling this with a null pointer. */
+ if (!file)
+ return true;
+
+ /* Maybe we're already at the end? */
+ if (feof (file))
+ return true;
+
+ if ((c = getc (file)) == EOF)
+ return true;
+
+ /* We weren't at the end. Back up. */
+ (void) ungetc (c, file);
+
+ return false;
+}
+
+
+/* Return true on end-of-line in FILE or at the end of FILE, else false. */
+/* Accept both CR and LF as end-of-line. */
+
+boolean
+eoln P1C(FILE*, file)
+{
+ register int c;
+
+ if (feof (file))
+ return true;
+
+ c = getc (file);
+
+ if (c != EOF)
+ (void) ungetc (c, file);
+
+ return c == '\n' || c == '\r' || c == EOF;
+}
+
+/* Consume input up and including the first eol encountered. */
+/* Handle CRLF as a single end-of-line. */
+
+void
+readln P1C(FILE*, f)
+{
+ int c;
+ while ((c = getc (f)) != '\n' && c != '\r' && c != EOF)
+ ;
+ if (c == '\r' && (c = getc (f)) != '\n' && c != EOF)
+ ungetc (c, f);
+}
diff --git a/Build/source/texk/web2c/lib/fprintreal.c b/Build/source/texk/web2c/lib/fprintreal.c
new file mode 100644
index 00000000000..55f3fdc50a0
--- /dev/null
+++ b/Build/source/texk/web2c/lib/fprintreal.c
@@ -0,0 +1,14 @@
+/* fprintreal.c: print the real number R in the Pascal format N:M on the
+ file F. Public domain. */
+
+#include "config.h"
+
+void
+fprintreal P4C(FILE*, f, double, r, int, n, int, m)
+{
+ char fmt[50]; /* Surely enough, since N and M won't be more than 25
+ digits each! */
+
+ sprintf (fmt, "%%%d.%dlf", n, m);
+ fprintf (f, fmt, r);
+}
diff --git a/Build/source/texk/web2c/lib/input2int.c b/Build/source/texk/web2c/lib/input2int.c
new file mode 100644
index 00000000000..0ed5cf94686
--- /dev/null
+++ b/Build/source/texk/web2c/lib/input2int.c
@@ -0,0 +1,47 @@
+/* input2int.c: read two or three integers from text files. These
+ routines are only used in patgen. Public domain. */
+
+#include "config.h"
+
+#ifdef INTEGER_IS_INT
+#define SCAN2INT "%d %d"
+#define SCAN3INT "%d %d %d"
+#else
+#define SCAN2INT "%ld %ld"
+#define SCAN3INT "%ld %ld %ld"
+#endif
+
+/* Read two integers from stdin. */
+
+void
+zinput2ints P2C(integer *, a, integer *, b)
+{
+ int ch;
+
+ while (scanf (SCAN2INT, a, b) != 2)
+ {
+ while ((ch = getchar ()) != EOF && ch != '\n');
+ if (ch == EOF) return;
+ (void) fprintf (stderr, "Please enter two integers.\n");
+ }
+
+ while ((ch = getchar ()) != EOF && ch != '\n');
+}
+
+
+/* Read three integers from stdin. */
+
+void
+zinput3ints P3C(integer *, a, integer *, b, integer *, c)
+{
+ int ch;
+
+ while (scanf (SCAN3INT, a, b, c) != 3)
+ {
+ while ((ch = getchar ()) != EOF && ch != '\n');
+ if (ch == EOF) return;
+ (void) fprintf (stderr, "Please enter three integers.\n");
+ }
+
+ while ((ch = getchar ()) != EOF && ch != '\n');
+}
diff --git a/Build/source/texk/web2c/lib/inputint.c b/Build/source/texk/web2c/lib/inputint.c
new file mode 100644
index 00000000000..6ee9a59db00
--- /dev/null
+++ b/Build/source/texk/web2c/lib/inputint.c
@@ -0,0 +1,20 @@
+/* inputint.c: read integers from text files. These routines are only
+ used for debugging and such, so perfect error checking isn't
+ necessary. Public domain. */
+
+#include "config.h"
+
+
+/* Read an integer from the file F, reading past the subsequent end of
+ line. */
+
+integer
+inputint P1C(FILE *, f)
+{
+ char buffer[MAX_INT_LENGTH]; /* Long enough for anything reasonable. */
+
+ return
+ fgets (buffer, sizeof (buffer), f)
+ ? atoi (buffer)
+ : 0;
+}
diff --git a/Build/source/texk/web2c/lib/main.c b/Build/source/texk/web2c/lib/main.c
new file mode 100644
index 00000000000..b699db57b94
--- /dev/null
+++ b/Build/source/texk/web2c/lib/main.c
@@ -0,0 +1,42 @@
+/* main.c -- the main program for everything but TeX & MF. */
+/* Public domain. */
+
+#include "config.h"
+
+
+/* These variables are referenced from the change files. */
+char **argv;
+int argc;
+
+/* The entry point for all the programs except TeX and Metafont, which
+ have more to do. We just have to set up the command line. web2c
+ transforms Pascal's main block into a procedure `main_body'. */
+
+int main P2C(int, ac, string *, av)
+{
+#ifdef __EMX__
+ _wildcard (&ac, &av);
+ _response (&ac, &av);
+#endif
+ extern void mainbody P1H(void);
+
+ argc = ac;
+ argv = av;
+ mainbody ();
+ return EXIT_SUCCESS;
+}
+
+
+/* Return the Nth (counted as in C) argument from the command line. */
+
+string
+cmdline P1C(int, n)
+{
+ if (n >= argc)
+ { /* This error message should never happen, because the callers
+ should always check they've got the arguments they expect. */
+ fprintf (stderr, "%s: Oops; not enough arguments.\n", argv[0]);
+ uexit (1);
+ }
+ return argv[n];
+}
diff --git a/Build/source/texk/web2c/lib/mfmpi386.asm b/Build/source/texk/web2c/lib/mfmpi386.asm
new file mode 100644
index 00000000000..9f0df8825ea
--- /dev/null
+++ b/Build/source/texk/web2c/lib/mfmpi386.asm
@@ -0,0 +1,144 @@
+/* i386 assembly routines for inner loop fraction routines in Metafont
+ and MetaPost. Public domain. Included in texmfmp.c.
+ By Wayne Sullivan <wgs@maths.ucd.ie>. */
+
+asm(" .align 4\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _ztakefraction\n"
+"_ztakefraction:\n"
+#else
+".globl ztakefraction\n"
+"ztakefraction:\n"
+#endif
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" xorl %ecx,%ecx\n"
+" movl 8(%ebp),%eax\n"
+" cmpl $0x80000000,%eax\n"
+" jz LL5\n"
+" imull 12(%ebp)\n"
+" orl %edx,%edx\n"
+" jns LL2\n"
+" negl %edx\n"
+" negl %eax\n"
+" sbbl %ecx,%edx\n"
+" incl %ecx\n"
+"LL2:\n"
+" addl $0x08000000,%eax\n"
+" adcl $0,%edx\n"
+" cmpl $0x07ffffff,%edx\n"
+" ja LL3\n"
+" shrd $28, %edx,%eax\n"
+"LL1: jecxz LL4\n"
+" negl %eax\n"
+"LL4:\n"
+" movl %ebp,%esp\n"
+" popl %ebp\n"
+" ret\n"
+"LL5: incl %ecx\n"
+"LL3: movl $0x7fffffff,%eax\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+" movb $1,_aritherror\n"
+#else
+" movb $1,aritherror\n"
+#endif
+" jmp LL1\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _ztakescaled\n"
+"_ztakescaled:\n"
+#else
+".globl ztakescaled\n"
+"ztakescaled:\n"
+#endif
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" movl 8(%ebp),%eax\n"
+" xorl %ecx,%ecx\n"
+" cmpl $0x80000000,%eax\n"
+" jz LL5\n"
+" imull 12(%ebp)\n"
+" orl %edx,%edx\n"
+" jns LL12\n"
+" negl %edx\n"
+" negl %eax\n"
+" sbbl %ecx,%edx\n"
+" incl %ecx\n"
+"LL12:\n"
+" addl $0x00008000,%eax\n"
+" adcl $0,%edx\n"
+" cmpl $0x00007fff,%edx\n"
+" ja LL3\n"
+" shrd $16, %edx,%eax\n"
+" jecxz LL4\n"
+" negl %eax\n"
+" jmp LL4\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _zmakescaled\n"
+".globl _zmakefraction\n"
+"_zmakescaled:\n"
+#else
+".globl zmakescaled\n"
+".globl zmakefraction\n"
+"zmakescaled:\n"
+#endif
+" movb $16,%cl\n"
+" jmp LL30\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+"_zmakefraction:\n"
+#else
+"zmakefraction:\n"
+#endif
+" movb $4,%cl\n"
+"LL30:\n"
+" movb $0,%ch\n"
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" pushl %ebx\n"
+" movl 8(%ebp),%edx\n"
+" xorl %eax,%eax\n"
+" orl %edx,%edx\n"
+" jns LL32\n"
+" inc %ch\n"
+" negl %edx\n"
+"LL32:\n"
+" movl 12(%ebp),%ebx\n"
+" orl %ebx,%ebx\n"
+" jns LL33\n"
+" dec %ch\n"
+" negl %ebx\n"
+" orl %ebx,%ebx\n"
+" js LL34\n"
+"LL33:\n"
+" orl %edx,%edx\n"
+" js LL34\n"
+" shrd %cl,%edx,%eax\n"
+" shrl %cl,%edx\n"
+" cmpl %ebx,%edx\n"
+" jae LL34\n"
+" divl %ebx\n"
+" addl %edx,%edx\n"
+" incl %edx\n"
+" subl %edx,%ebx\n"
+" adcl $0,%eax\n"
+" jc LL34\n"
+" cmpl $0x7fffffff,%eax\n"
+" ja LL34\n"
+"LL31: or %ch,%ch\n"
+" jz LL35\n"
+" negl %eax\n"
+"LL35:\n"
+" popl %ebx\n"
+" movl %ebp,%esp\n"
+" popl %ebp\n"
+" ret\n"
+"LL34: movl $0x7fffffff,%eax\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+" movb $1,_aritherror\n"
+#else
+" movb $1,aritherror\n"
+#endif
+" jmp LL31\n");
+
diff --git a/Build/source/texk/web2c/lib/mfmpw32.c b/Build/source/texk/web2c/lib/mfmpw32.c
new file mode 100644
index 00000000000..de065fd96e2
--- /dev/null
+++ b/Build/source/texk/web2c/lib/mfmpw32.c
@@ -0,0 +1,189 @@
+/* i386 assembly routines for inner loop fraction routines in Metafont
+ and MetaPost. Included from texmfmp.c. By Wayne Sullivan
+ <wgs@maths.ucd.ie>. */
+
+/*
+ Converted to inline assembler for Visual C++ [45].xx
+ by Fabrice Popineau <Fabrice.Popineau@supelec.fr> */
+
+__declspec(naked) fraction __stdcall ztakefraction(integer p, integer q) {
+__asm {
+ push ebp
+ mov ebp,esp
+ xor ecx,ecx
+ mov eax, p
+; mov eax, [ebp+8]
+ cmp eax, 0x80000000
+ jz LL5
+ imul q
+ or edx,edx
+ jns LL2
+ neg edx
+ neg eax
+ sbb edx, ecx
+ inc ecx
+LL2:
+ add eax, 0x08000000
+ adc edx, 0
+ cmp edx, 0x07ffffff
+ ja LL3
+ shrd eax,edx,28
+LL1:
+ jecxz LL4
+ neg eax
+LL4:
+ mov esp,ebp
+ pop ebp
+ ret 8
+LL5:
+ inc ecx
+LL3:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL1
+}
+}
+
+__declspec(naked) integer __stdcall ztakescaled(integer p, scaled q) {
+__asm {
+ push ebp
+ mov ebp,esp
+; mov eax, [ebp+8]
+ xor ecx,ecx
+ mov eax, p
+ cmp eax, 0x80000000
+ jz LL5
+ imul q
+ or edx,edx
+ jns LL12
+ neg edx
+ neg eax
+ sbb edx,ecx
+ inc ecx
+LL12:
+ add eax, 0x00008000
+ adc edx, 0x0
+ cmp edx, 0x00007fff
+ ja LL3
+ shrd eax,edx,16
+LL1:
+ jecxz LL4
+ neg eax
+LL4:
+ mov esp,ebp
+ pop ebp
+ ret 8
+LL5:
+ inc ecx
+LL3:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL1
+ }
+}
+
+__declspec(naked) scaled __stdcall zmakescaled(integer p, integer q) {
+ __asm {
+ mov cx, 16
+ push ebp
+ mov ebp,esp
+ push ebx
+; mov edx, [ebp+8]
+ mov edx, p
+ xor eax,eax
+ or edx,edx
+ jns LL32
+ inc ch
+ neg edx
+LL32:
+; mov ebx, [ebp+12]
+ mov ebx,q
+ or ebx,ebx
+ jns LL33
+ dec ch
+ neg ebx
+ or ebx,ebx
+ js LL34
+LL33:
+ or edx,edx
+ js LL34
+ shrd eax,edx,cl
+ shr edx,cl
+ cmp edx,ebx
+ jae LL34
+ div ebx
+ add edx,edx
+ inc edx
+ sub ebx,edx
+ adc eax, 0
+ jc LL34
+ cmp eax, 0x7fffffff
+ ja LL34
+LL31: or ch,ch
+ jz LL35
+ neg eax
+LL35:
+ pop ebx
+ mov esp, ebp
+ pop ebp
+ ret 8
+LL34:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL31
+ }
+}
+
+__declspec(naked) fraction __stdcall zmakefraction(integer p, integer q) {
+ __asm {
+ mov cx, 4
+ push ebp
+ mov ebp,esp
+ push ebx
+ mov edx, p
+; mov [ebp+8],edx
+ xor eax,eax
+ or edx,edx
+ jns LL32
+ inc ch
+ neg edx
+LL32:
+; mov [ebp+12],ebx
+ mov ebx, q
+ or ebx,ebx
+ jns LL33
+ dec ch
+ neg ebx
+ or ebx,ebx
+ js LL34
+LL33:
+ or edx,edx
+ js LL34
+ shrd eax,edx, cl
+ shr edx,cl
+ cmp edx,ebx
+ jae LL34
+ div ebx
+ add edx,edx
+ inc edx
+ sub ebx,edx
+ adc eax, 0
+ jc LL34
+ cmp eax, 0x7fffffff
+ ja LL34
+LL31: or ch,ch
+ jz LL35
+ neg eax
+LL35:
+ pop ebx
+ mov esp, ebp
+ pop ebp
+ ret 8
+LL34:
+ mov eax, 0x7fffffff
+ mov aritherror, 1
+ jmp LL31
+ }
+}
+
+
diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c
new file mode 100644
index 00000000000..6e542d247fa
--- /dev/null
+++ b/Build/source/texk/web2c/lib/openclose.c
@@ -0,0 +1,251 @@
+/* openclose.c: open and close files for TeX, Metafont, and BibTeX.
+
+ Written 1995, 96 Karl Berry. Public domain. */
+
+#include "config.h"
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/variable.h>
+#include <kpathsea/absolute.h>
+
+/* The globals we use to communicate. */
+extern string nameoffile;
+extern unsigned namelength;
+/* For "file:line:error style error messages. */
+extern string fullnameoffile;
+/* For the filename recorder. */
+extern boolean recorder_enabled;
+/* For the output-dir option. */
+extern string output_directory;
+
+/* Define some variables. */
+string fullnameoffile; /* Defaults to NULL. */
+static string recorder_name; /* Defaults to NULL. */
+static FILE *recorder_file; /* Defaults to NULL. */
+boolean recorder_enabled; /* Defaults to false. */
+string output_directory; /* Defaults to NULL. */
+
+/* For TeX and MetaPost. See below. Always defined so we don't have to
+ #ifdef, and thus this file can be compiled once and go in lib.a. */
+int tfmtemp;
+int ocptemp;
+int texinputtype;
+
+/* Helpers for the filename recorder... */
+/* Start the recorder */
+static void
+recorder_start()
+{
+ /* Alas, while we might want to use mkstemp it is not portable.
+ So we have to be content with using a default name... */
+ string cwd;
+ recorder_name = (string)xmalloc(strlen(kpse_program_name)+5);
+ strcpy(recorder_name, kpse_program_name);
+ strcat(recorder_name, ".fls");
+ recorder_file = xfopen(recorder_name, FOPEN_W_MODE);
+ cwd = xgetcwd();
+ fprintf(recorder_file, "PWD %s\n", cwd);
+ free(cwd);
+}
+
+/* Change the name of the recorder file. */
+void
+recorder_change_filename P1C(string, new_name)
+{
+ if (!recorder_file)
+ return;
+ rename(recorder_name, new_name);
+ free(recorder_name);
+ recorder_name = xstrdup(new_name);
+}
+
+/* Open an input file F, using the kpathsea format FILEFMT and passing
+ FOPEN_MODE to fopen. The filename is in `nameoffile+1'. We return
+ whether or not the open succeeded. If it did, `nameoffile' is set to
+ the full filename opened, and `namelength' to its length. */
+
+boolean
+open_input P3C(FILE **, f_ptr, int, filefmt, const_string, fopen_mode)
+{
+ string fname = NULL;
+#ifdef FUNNY_CORE_DUMP
+ /* This only applies if a preloaded TeX/Metafont is being made;
+ it allows automatic creation of the core dump (typing ^\ loses
+ since that requires manual intervention). */
+ if ((filefmt == kpse_tex_format || filefmt == kpse_mf_format
+ || filefmt == kpse_mp_format)
+ && STREQ (nameoffile + 1, "HackyInputFileNameForCoreDump.tex"))
+ funny_core_dump ();
+#endif
+
+ /* We havent found anything yet. */
+ *f_ptr = NULL;
+ if (fullnameoffile)
+ free(fullnameoffile);
+ fullnameoffile = NULL;
+
+ /* Handle -output-directory.
+ FIXME: We assume that it is OK to look here first. Possibly it
+ would be better to replace lookups in "." with lookups in the
+ output_directory followed by "." but to do this requires much more
+ invasive surgery in libkpathsea. */
+ /* FIXME: This code assumes that the filename of the input file is
+ not an absolute filename. */
+ if (output_directory) {
+ fname = concat3(output_directory, DIR_SEP_STRING, nameoffile + 1);
+ *f_ptr = fopen(fname, fopen_mode);
+ if (*f_ptr) {
+ free(nameoffile);
+ namelength = strlen (fname);
+ nameoffile = (string)xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname);
+ fullnameoffile = fname;
+ } else {
+ free(fname);
+ }
+ }
+
+ /* No file means do the normal search. */
+ if (*f_ptr == NULL) {
+ /* A negative FILEFMT means don't use a path. */
+ if (filefmt < 0) {
+ /* no_file_path, for BibTeX .aux files and MetaPost things. */
+ *f_ptr = fopen(nameoffile + 1, fopen_mode);
+ /* FIXME... fullnameoffile = xstrdup(nameoffile + 1); */
+ } else {
+ /* The only exception to `must_exist' being true is \openin, for
+ which we set `tex_input_type' to 0 in the change file. */
+ /* According to the pdfTeX people, pounding the disk for .vf files
+ is overkill as well. A more general solution would be nice. */
+ boolean must_exist = (filefmt != kpse_tex_format || texinputtype)
+ && (filefmt != kpse_vf_format);
+ fname = kpse_find_file (nameoffile + 1,
+ (kpse_file_format_type)filefmt,
+ must_exist);
+ if (fname) {
+ fullnameoffile = xstrdup(fname);
+ /* If we found the file in the current directory, don't leave
+ the `./' at the beginning of `nameoffile', since it looks
+ dumb when `tex foo' says `(./foo.tex ... )'. On the other
+ hand, if the user said `tex ./foo', and that's what we
+ opened, then keep it -- the user specified it, so we
+ shouldn't remove it. */
+ if (fname[0] == '.' && IS_DIR_SEP (fname[1])
+ && (nameoffile[1] != '.' || !IS_DIR_SEP (nameoffile[2])))
+ {
+ unsigned i = 0;
+ while (fname[i + 2] != 0) {
+ fname[i] = fname[i + 2];
+ i++;
+ }
+ fname[i] = 0;
+ }
+
+ /* kpse_find_file always returns a new string. */
+ free (nameoffile);
+ namelength = strlen (fname);
+ nameoffile = (string)xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname);
+ free (fname);
+
+ /* This fopen is not allowed to fail. */
+ *f_ptr = xfopen (nameoffile + 1, fopen_mode);
+ }
+ }
+ }
+
+ if (*f_ptr) {
+ if (recorder_enabled) {
+ if (!recorder_file)
+ recorder_start();
+ fprintf(recorder_file, "INPUT %s\n", nameoffile + 1);
+ }
+
+ /* If we just opened a TFM file, we have to read the first
+ byte, to pretend we're Pascal. See tex.ch and mp.ch.
+ Ditto for the ocp/ofm Omega file formats. */
+ if (filefmt == kpse_tfm_format) {
+ tfmtemp = getc (*f_ptr);
+ /* We intentionally do not check for EOF here, i.e., an
+ empty TFM file. TeX will see the 255 byte and complain
+ about a bad TFM file, which is what we want. */
+ } else if (filefmt == kpse_ocp_format) {
+ ocptemp = getc (*f_ptr);
+ } else if (filefmt == kpse_ofm_format) {
+ tfmtemp = getc (*f_ptr);
+ }
+ }
+
+ return *f_ptr != NULL;
+}
+
+/* Open an output file F either in the current directory or in
+ $TEXMFOUTPUT/F, if the environment variable `TEXMFOUTPUT' exists.
+ (Actually, this also applies to the BibTeX and MetaPost output files,
+ but `TEXMFMPBIBOUTPUT' was just too long.) The filename is in the
+ global `nameoffile' + 1. We return whether or not the open
+ succeeded. If it did, `nameoffile' is reset to the name opened if
+ necessary, and `namelength' to its length. */
+
+boolean
+open_output P2C(FILE **, f_ptr, const_string, fopen_mode)
+{
+ string fname;
+ boolean absolute = kpse_absolute_p(nameoffile+1, false);
+
+ /* If we have an explicit output directory, use it. */
+ if (output_directory && !absolute) {
+ fname = concat3(output_directory, DIR_SEP_STRING, nameoffile + 1);
+ } else {
+ fname = nameoffile + 1;
+ }
+
+ /* Is the filename openable as given? */
+ *f_ptr = fopen (fname, fopen_mode);
+
+ if (!*f_ptr) {
+ /* Can't open as given. Try the envvar. */
+ string texmfoutput = kpse_var_value("TEXMFOUTPUT");
+
+ if (texmfoutput && *texmfoutput && !absolute) {
+ string fname = concat3(texmfoutput, DIR_SEP_STRING, nameoffile+1);
+ *f_ptr = fopen(fname, fopen_mode);
+ }
+ }
+ /* If this succeeded, change nameoffile accordingly. */
+ if (*f_ptr) {
+ if (fname != nameoffile + 1) {
+ free (nameoffile);
+ namelength = strlen (fname);
+ nameoffile = (string)xmalloc (namelength + 2);
+ strcpy (nameoffile + 1, fname);
+ }
+ if (recorder_enabled) {
+ if (!recorder_file)
+ recorder_start();
+ fprintf(recorder_file, "OUTPUT %s\n", fname);
+ }
+ }
+ if (fname != nameoffile +1)
+ free(fname);
+ return *f_ptr != NULL;
+}
+
+/* Close F. */
+
+void
+aclose P1C(FILE *, f)
+{
+ /* If F is null, just return. bad_pool might close a file that has
+ never been opened. */
+ if (!f)
+ return;
+
+ if (fclose (f) == EOF) {
+ /* It's not always nameoffile, we might have opened something else
+ in the meantime. And it's not easy to extract the filenames out
+ of the pool array. So just punt on the filename. Sigh. This
+ probably doesn't need to be a fatal error. */
+ perror ("fclose");
+ }
+}
diff --git a/Build/source/texk/web2c/lib/printversion.c b/Build/source/texk/web2c/lib/printversion.c
new file mode 100644
index 00000000000..cbcf5d56a00
--- /dev/null
+++ b/Build/source/texk/web2c/lib/printversion.c
@@ -0,0 +1,58 @@
+/* printversion.c: Output for the standard GNU option --version.
+
+ Written in 1996 by K. Berry. Public domain. */
+
+#include "config.h"
+
+/* We're passed in the original WEB banner string, which has the form
+This is PROGRAM, Version VERSION-NUMBER
+ We parse the PROGRAM and VERSION-NUMBER out of this.
+
+ If COPYRIGHT_HOLDER is specified and AUTHOR isn't, then use the
+ former for the latter. If AUTHOR is specified and COPYRIGHT_HOLDER
+ isn't, it means the original program is public domain.
+
+ Maybe I should have just done it all inline in each individual
+ program, but tangle doesn't allow multiline string constants ... */
+
+void
+printversionandexit P3C(const_string, banner,
+ const_string, copyright_holder, const_string, author)
+{
+ extern string versionstring; /* from web2c/lib/version.c */
+ extern KPSEDLL string kpathsea_version_string;/* from kpathsea/version.c */
+ string prog_name;
+ unsigned len;
+ const_string prog_name_end = strchr (banner, ',');
+ const_string prog_version = strrchr (banner, ' ');
+ assert (prog_name_end && prog_version);
+ prog_version++;
+
+ len = prog_name_end - banner - sizeof ("This is");
+ prog_name = (string)xmalloc (len + 1);
+ strncpy (prog_name, banner + sizeof ("This is"), len);
+ prog_name[len] = 0;
+
+ /* The Web2c version string starts with a space. */
+ printf ("%s %s%s\n", prog_name, prog_version, versionstring);
+ puts (kpathsea_version_string);
+
+ if (copyright_holder) {
+ printf ("Copyright 2005 %s.\n", copyright_holder);
+ if (!author)
+ author = copyright_holder;
+ }
+
+ puts ("Kpathsea is copyright 2005 Karl Berry and Olaf Weber.");
+
+ puts ("There is NO warranty. Redistribution of this software is");
+ fputs ("covered by the terms of ", stdout);
+ printf ("both the %s copyright and\n", prog_name);
+ puts ("the Lesser GNU General Public License.");
+ puts ("For more information about these matters, see the file");
+ printf ("named COPYING and the %s source.\n", prog_name);
+ printf ("Primary author of %s: %s.\n", prog_name, author);
+ puts ("Kpathsea written by Karl Berry, Olaf Weber, and others.\n");
+
+ uexit (0);
+}
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
new file mode 100644
index 00000000000..ff69d12df4f
--- /dev/null
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -0,0 +1,2250 @@
+/* texmf.c: Hand-coded routines for TeX or Metafont in C. Originally
+ written by Tim Morgan, drawing from other Unix ports of TeX. This is
+ a collection of miscellany, everything that's easier (or only
+ possible) to do in C.
+
+ This file is public domain. */
+
+#define EXTERN /* Instantiate data from {tex,mf,mp}d.h here. */
+
+/* This file is used to create texextra.c etc., with this line
+ changed to include texd.h, mfd.h, or mpd.h. The ?d.h file is what
+ #defines TeX or MF or MP, which avoids the need for a special
+ Makefile rule. */
+#include "TEX-OR-MF-OR-MPd.h"
+
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/line.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/variable.h>
+#include <kpathsea/absolute.h>
+
+#include <time.h> /* For `struct tm'. */
+#if defined (HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#elif defined (HAVE_SYS_TIMEB_H)
+#include <sys/timeb.h>
+#endif
+
+#if defined(__STDC__)
+#include <locale.h>
+#endif
+
+#include <signal.h> /* Catch interrupts. */
+
+#include <texmfmp-help.h>
+
+/* {tex,mf}d.h defines TeX, MF, INI, and other such symbols.
+ Unfortunately there's no way to get the banner into this code, so
+ just repeat the text. */
+#ifdef TeX
+#if defined (eTeX)
+#include <etexdir/etexextra.h>
+#elif defined (pdfTeX)
+#include <pdftexdir/pdftexextra.h>
+#elif defined (pdfeTeX)
+#include <pdfetexdir/pdfetexextra.h>
+#elif defined (Omega)
+#include <omegadir/omegaextra.h>
+#elif defined (eOmega)
+#include <eomegadir/eomegaextra.h>
+#elif defined (Aleph)
+#include <alephdir/alephextra.h>
+#else
+#define BANNER "This is TeX, Version 3.141592"
+#define COPYRIGHT_HOLDER "D.E. Knuth"
+#define AUTHOR NULL
+#define PROGRAM_HELP TEXHELP
+#define BUG_ADDRESS "tex-k@mail.tug.org"
+#define DUMP_VAR TEXformatdefault
+#define DUMP_LENGTH_VAR formatdefaultlength
+#define DUMP_OPTION "fmt"
+#define DUMP_EXT ".fmt"
+#define INPUT_FORMAT kpse_tex_format
+#define INI_PROGRAM "initex"
+#define VIR_PROGRAM "virtex"
+#endif
+#define edit_var "TEXEDIT"
+#endif /* TeX */
+#ifdef MF
+#define BANNER "This is Metafont, Version 2.71828"
+#define COPYRIGHT_HOLDER "D.E. Knuth"
+#define AUTHOR NULL
+#define PROGRAM_HELP MFHELP
+#define BUG_ADDRESS "tex-k@mail.tug.org"
+#define DUMP_VAR MFbasedefault
+#define DUMP_LENGTH_VAR basedefaultlength
+#define DUMP_OPTION "base"
+#ifdef DOS
+#define DUMP_EXT ".bas"
+#else
+#define DUMP_EXT ".base"
+#endif
+#define INPUT_FORMAT kpse_mf_format
+#define INI_PROGRAM "inimf"
+#define VIR_PROGRAM "virmf"
+#define edit_var "MFEDIT"
+#endif /* MF */
+#ifdef MP
+#define BANNER "This is MetaPost, Version 0.901"
+#define COPYRIGHT_HOLDER "AT&T Bell Laboratories"
+#define AUTHOR "John Hobby"
+#define PROGRAM_HELP MPHELP
+#define BUG_ADDRESS "tex-k@mail.tug.org"
+#define DUMP_VAR MPmemdefault
+#define DUMP_LENGTH_VAR memdefaultlength
+#define DUMP_OPTION "mem"
+#define DUMP_EXT ".mem"
+#define INPUT_FORMAT kpse_mp_format
+#define INI_PROGRAM "inimpost"
+#define VIR_PROGRAM "virmpost"
+#define edit_var "MPEDIT"
+#endif /* MP */
+
+/* The main program, etc. */
+
+/* What we were invoked as and with. */
+char **argv;
+int argc;
+
+/* If the user overrides argv[0] with -progname. */
+static string user_progname;
+
+/* The C version of what might wind up in DUMP_VAR. */
+static const_string dump_name;
+
+/* The C version of the jobname, if given. */
+static const_string job_name;
+
+/* Full source file name. */
+extern string fullnameoffile;
+
+/* The filename for dynamic character translation, or NULL. */
+string translate_filename;
+string default_translate_filename;
+
+/* Needed for --src-specials option. */
+static char *last_source_name;
+static int last_lineno;
+static boolean srcspecialsoption = false;
+static void parse_src_specials_option P1H(const_string);
+
+/* The main body of the WEB is transformed into this procedure. */
+extern TEXDLL void mainbody P1H(void);
+
+/* Parsing a first %&-line in the input file. */
+static void parse_first_line P1H(const_string);
+
+/* Parse option flags. */
+static void parse_options P2H(int, string *);
+
+/* Try to figure out if we have been given a filename. */
+static string get_input_file_name P1H(void);
+
+#if defined(Omega) || defined(eOmega) || defined(Aleph)
+/* Declare this for Omega family, so they can parse the -8bit option,
+ * even though it is a no-op for them.
+ */
+static int eightbitp;
+#endif /* Omega || eOmega || Aleph */
+
+#if defined(pdfTeX) || defined(pdfeTeX)
+char *ptexbanner;
+#endif
+
+#ifdef MP
+/* name of TeX program to pass to makempx */
+static string mpost_tex_program = "";
+#endif
+
+/* Get a true/false value for a variable from texmf.cnf and the environment. */
+static boolean
+texmf_yesno(const_string var)
+{
+ string value = kpse_var_value (var);
+ return value && (*value == 't' || *value == 'y' || *value == '1');
+}
+
+/* The entry point: set up for reading the command line, which will
+ happen in `topenin', then call the main body. */
+
+void TEXDLL
+maininit P2C(int, ac, string *, av)
+{
+ string main_input_file;
+
+ /* Save to pass along to topenin. */
+ argc = ac;
+ argv = av;
+
+ /* Must be initialized before options are parsed. */
+ interactionoption = 4;
+
+#if defined(pdfTeX) || defined(pdfeTeX)
+ ptexbanner = BANNER;
+#endif
+
+ /* If the user says --help or --version, we need to notice early. And
+ since we want the --ini option, have to do it before getting into
+ the web (which would read the base file, etc.). */
+ parse_options (ac, av);
+
+ /* Do this early so we can inspect program_invocation_name and
+ kpse_program_name below, and because we have to do this before
+ any path searching. */
+ kpse_set_program_name (argv[0], user_progname);
+
+ /* FIXME: gather engine names in a single spot. */
+ xputenv("engine", TEXMFENGINENAME);
+
+ /* Were we given a simple filename? */
+ main_input_file = get_input_file_name();
+
+ /* Second chance to activate file:line:error style messages, this
+ time from texmf.cnf. */
+ if (filelineerrorstylep < 0) {
+ filelineerrorstylep = 0;
+ } else if (!filelineerrorstylep) {
+ filelineerrorstylep = texmf_yesno ("file_line_error_style");
+ }
+
+ /* If no dump default yet, and we're not doing anything special on
+ this run, we may want to look at the first line of the main input
+ file for a %&<dumpname> specifier. */
+ if (parsefirstlinep < 0) {
+ parsefirstlinep = 0;
+ } else if (!parsefirstlinep) {
+ parsefirstlinep = texmf_yesno ("parse_first_line");
+ }
+ if (parsefirstlinep && (!dump_name || !translate_filename)) {
+ parse_first_line (main_input_file);
+ }
+ /* Check whether there still is no translate_filename known. If so,
+ use the default_translate_filename. */
+ /* FIXME: deprecated. */
+ if (!translate_filename) {
+ translate_filename = default_translate_filename;
+ }
+ /* If we're preloaded, I guess everything is set up. I don't really
+ know any more, it's been so long since anyone preloaded. */
+ if (readyalready != 314159) {
+ /* The `ini_version' variable is declared/used in the change files. */
+ boolean virversion = false;
+ if (FILESTRCASEEQ (kpse_program_name, INI_PROGRAM)) {
+ iniversion = true;
+ } else if (FILESTRCASEEQ (kpse_program_name, VIR_PROGRAM)) {
+ virversion = true;
+#ifdef TeX
+ } else if (FILESTRCASEEQ (kpse_program_name, "initex")) {
+ iniversion = true;
+ } else if (FILESTRCASEEQ (kpse_program_name, "virtex")) {
+ virversion = true;
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ } else if (FILESTRCASEEQ (kpse_program_name, "mltex")) {
+ mltexp = true;
+#endif /* !Omega && !eOmega && !Aleph */
+#endif /* TeX */
+ }
+
+ if (!dump_name) {
+ /* If called as *vir{mf,tex,mpost} use `plain'. Otherwise, use the
+ name we were invoked under. */
+ dump_name = (virversion ? "plain" : kpse_program_name);
+ }
+ }
+
+#ifdef TeX
+ /* Sanity check: -mltex, -enc, -etex only work in combination with -ini. */
+ if (!iniversion) {
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ if (mltexp) {
+ fprintf(stderr, "-mltex only works with -ini\n");
+ }
+ if (enctexp) {
+ fprintf(stderr, "-enc only works with -ini\n");
+ }
+#endif
+#if defined(eTeX) || defined(pdfeTeX) || defined(Aleph)
+ if (etexp) {
+ fprintf(stderr, "-etex only works with -ini\n");
+ }
+#endif
+ }
+#endif
+
+ /* If we've set up the fmt/base default in any of the various ways
+ above, also set its length. */
+ if (dump_name) {
+ /* adjust array for Pascal and provide extension */
+ DUMP_VAR = concat3 (" ", dump_name, DUMP_EXT);
+ DUMP_LENGTH_VAR = strlen (DUMP_VAR + 1);
+ } else {
+ /* For dump_name to be NULL is a bug. */
+ abort();
+ }
+
+ /* Additional initializations. No particular reason for doing them
+ here instead of first thing in the change file; less symbols to
+ propagate through Webc, that's all. */
+#ifdef MF
+ kpse_set_program_enabled (kpse_mf_format, MAKE_TEX_MF_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_base_format, MAKE_TEX_FMT_BY_DEFAULT,
+ kpse_src_compile);
+#endif /* MF */
+#ifdef MP
+ kpse_set_program_enabled (kpse_mem_format, MAKE_TEX_FMT_BY_DEFAULT,
+ kpse_src_compile);
+#endif /* MP */
+#ifdef TeX
+#if defined(Omega) || defined (eOmega) || defined (Aleph)
+ kpse_set_program_enabled (kpse_ocp_format, MAKE_OMEGA_OCP_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_ofm_format, MAKE_OMEGA_OFM_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_tfm_format, false, kpse_src_compile);
+#else /* !Omega && !eOmega && !Aleph */
+ kpse_set_program_enabled (kpse_tfm_format, MAKE_TEX_TFM_BY_DEFAULT,
+ kpse_src_compile);
+#endif /* !Omega && !eOmega && !Aleph */
+ kpse_set_program_enabled (kpse_tex_format, MAKE_TEX_TEX_BY_DEFAULT,
+ kpse_src_compile);
+ kpse_set_program_enabled (kpse_fmt_format, MAKE_TEX_FMT_BY_DEFAULT,
+ kpse_src_compile);
+
+ if (shellenabledp < 0) {
+ shellenabledp = 0;
+ } else if (!shellenabledp) {
+ shellenabledp = texmf_yesno ("shell_escape");
+ }
+ if (!outputcomment) {
+ outputcomment = kpse_var_value ("output_comment");
+ }
+#endif /* TeX */
+}
+
+#ifndef WIN32
+/* The entry point: set up for reading the command line, which will
+ happen in `topenin', then call the main body. */
+
+int
+main P2C(int, ac, string *, av)
+{
+#ifdef __EMX__
+ _wildcard (&ac, &av);
+ _response (&ac, &av);
+#endif
+
+ maininit(ac, av);
+
+ /* Call the real main program. */
+ mainbody ();
+ return EXIT_SUCCESS;
+}
+#endif /* ! WIN32 */
+
+/* This is supposed to ``open the terminal for input'', but what we
+ really do is copy command line arguments into TeX's or Metafont's
+ buffer, so they can handle them. If nothing is available, or we've
+ been called already (and hence, argc==0), we return with
+ `last=first'. */
+
+void
+topenin P1H(void)
+{
+ int i;
+
+ buffer[first] = 0; /* In case there are no arguments. */
+
+ if (optind < argc) { /* We have command line arguments. */
+ int k = first;
+ for (i = optind; i < argc; i++) {
+ char *ptr = &(argv[i][0]);
+ /* Don't use strcat, since in Omega the buffer elements aren't
+ single bytes. */
+ while (*ptr) {
+ buffer[k++] = *(ptr++);
+ }
+ buffer[k++] = ' ';
+ }
+ argc = 0; /* Don't do this again. */
+ buffer[k] = 0;
+ }
+
+ /* Find the end of the buffer. */
+ for (last = first; buffer[last]; ++last)
+ ;
+
+ /* Make `last' be one past the last non-blank character in `buffer'. */
+ /* ??? The test for '\r' should not be necessary. */
+ for (--last; last >= first
+ && ISBLANK (buffer[last]) && buffer[last] != '\r'; --last)
+ ;
+ last++;
+
+ /* One more time, this time converting to TeX's internal character
+ representation. */
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ for (i = first; i < last; i++)
+ buffer[i] = xord[buffer[i]];
+#endif
+}
+
+/* IPC for TeX. By Tom Rokicki for the NeXT; it makes TeX ship out the
+ DVI file in a pipe to TeXView so that the output can be displayed
+ incrementally. Shamim Mohamed adapted it for Web2c. */
+#if defined (TeX) && defined (IPC)
+
+#include <sys/socket.h>
+#include <fcntl.h>
+#ifndef O_NONBLOCK /* POSIX */
+#ifdef O_NDELAY /* BSD */
+#define O_NONBLOCK O_NDELAY
+#else
+#ifdef FNDELAY /* NeXT */
+#define O_NONBLOCK O_FNDELAY
+#else
+what the fcntl? cannot implement IPC without equivalent for O_NONBLOCK.
+#endif /* no FNDELAY */
+#endif /* no O_NDELAY */
+#endif /* no O_NONBLOCK */
+
+#ifndef IPC_PIPE_NAME /* $HOME is prepended to this. */
+#define IPC_PIPE_NAME "/.TeXview_Pipe"
+#endif
+#ifndef IPC_SERVER_CMD /* Command to run to start the server. */
+#define IPC_SERVER_CMD "open `which TeXview`"
+#endif
+
+struct msg
+{
+ short namelength; /* length of auxiliary data */
+ int eof; /* new eof for dvi file */
+#if 0 /* see usage of struct msg below */
+ char more_data[0]; /* where the rest of the stuff goes */
+#endif
+};
+
+static char *ipc_name;
+static struct sockaddr *ipc_addr;
+static int ipc_addr_len;
+
+static int
+ipc_make_name P1H(void)
+{
+ if (ipc_addr_len == 0) {
+ string s = getenv ("HOME");
+ if (s) {
+ ipc_addr = (struct sockaddr*)xmalloc (strlen (s) + 40);
+ ipc_addr->sa_family = 0;
+ ipc_name = ipc_addr->sa_data;
+ strcpy (ipc_name, s);
+ strcat (ipc_name, IPC_PIPE_NAME);
+ ipc_addr_len = strlen (ipc_name) + 3;
+ }
+ }
+ return ipc_addr_len;
+}
+
+
+static int sock = -1;
+
+static int
+ipc_is_open P1H(void)
+{
+ return sock >= 0;
+}
+
+
+static void
+ipc_open_out P1H(void) {
+#ifdef IPC_DEBUG
+ fputs ("tex: Opening socket for IPC output ...\n", stderr);
+#endif
+ if (sock >= 0) {
+ return;
+ }
+
+ if (ipc_make_name () < 0) {
+ sock = -1;
+ return;
+ }
+
+ sock = socket (PF_UNIX, SOCK_STREAM, 0);
+ if (sock >= 0) {
+ if (connect (sock, ipc_addr, ipc_addr_len) != 0
+ || fcntl (sock, F_SETFL, O_NONBLOCK) < 0) {
+ close (sock);
+ sock = -1;
+ return;
+ }
+#ifdef IPC_DEBUG
+ fputs ("tex: Successfully opened IPC socket.\n", stderr);
+#endif
+ }
+}
+
+
+static void
+ipc_close_out P1H(void)
+{
+#ifdef IPC_DEBUG
+ fputs ("tex: Closing output socket ...\n", stderr);
+#endif
+ if (ipc_is_open ()) {
+ close (sock);
+ sock = -1;
+ }
+}
+
+
+static void
+ipc_snd P3C(int, n, int, is_eof, char *, data)
+{
+ struct
+ {
+ struct msg msg;
+ char more_data[1024];
+ } ourmsg;
+
+#ifdef IPC_DEBUG
+ fputs ("tex: Sending message to socket ...\n", stderr);
+#endif
+ if (!ipc_is_open ()) {
+ return;
+ }
+
+ ourmsg.msg.namelength = n;
+ ourmsg.msg.eof = is_eof;
+ if (n) {
+ strcpy (ourmsg.more_data, data);
+ }
+ n += sizeof (struct msg);
+#ifdef IPC_DEBUG
+ fputs ("tex: Writing to socket...\n", stderr);
+#endif
+ if (write (sock, &ourmsg, n) != n) {
+ ipc_close_out ();
+ }
+#ifdef IPC_DEBUG
+ fputs ("tex: IPC message sent.\n", stderr);
+#endif
+}
+
+
+/* This routine notifies the server if there is an eof, or the filename
+ if a new DVI file is starting. This is the routine called by TeX.
+ Omega defines str_start(#) as str_start_ar[# - too_big_char], with
+ too_big_char = biggest_char + 1 = 65536 (omstr.ch).*/
+
+void
+ipcpage P1C(int, is_eof)
+{
+ static boolean begun = false;
+ unsigned len = 0;
+ unsigned i;
+ string p = "";
+
+ if (!begun) {
+ string name; /* Just the filename. */
+ string cwd = xgetcwd ();
+
+ ipc_open_out ();
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ len = strstart[outputfilename + 1] - strstart[outputfilename];
+#else
+ len = strstartar[outputfilename + 1 - 65536L] -
+ strstartar[outputfilename - 65536L];
+#endif
+ name = (string)xmalloc (len + 1);
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ strncpy (name, &strpool[strstart[outputfilename]], len);
+#else
+ for (i=0; i<len; i++)
+ name[i] = strpool[i+strstartar[outputfilename - 65536L]];
+#endif
+ name[len] = 0;
+
+ /* Have to pass whole filename to the other end, since it may have
+ been started up and running as a daemon, e.g., as with the NeXT
+ preview program. */
+ p = concat3 (cwd, DIR_SEP_STRING, name);
+ free (name);
+ len = strlen(p);
+ begun = true;
+ }
+ ipc_snd (len, is_eof, p);
+
+ if (len > 0) {
+ free (p);
+ }
+}
+#endif /* TeX && IPC */
+
+#if defined (TeX) || defined (MF) || defined (MP)
+ /* TCX and Omega get along like sparks and gunpowder. */
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+
+/* Return the next number following START, setting POST to the following
+ character, as in strtol. Issue a warning and return -1 if no number
+ can be parsed. */
+
+static int
+tcx_get_num P4C(int, upb,
+ unsigned, line_count,
+ string, start,
+ string *, post)
+{
+ int num = strtol (start, post, 0);
+ assert (post && *post);
+ if (*post == start) {
+ /* Could not get a number. If blank line, fine. Else complain. */
+ string p = start;
+ while (*p && ISSPACE (*p))
+ p++;
+ if (*p != 0)
+ fprintf (stderr, "%s:%d: Expected numeric constant, not `%s'.\n",
+ translate_filename, line_count, start);
+ num = -1;
+ } else if (num < 0 || num > upb) {
+ fprintf (stderr, "%s:%d: Destination charcode %d <0 or >%d.\n",
+ translate_filename, line_count, num, upb);
+ num = -1;
+ }
+
+ return num;
+}
+
+/* Update the xchr, xord, and xprn arrays for TeX, allowing a
+ translation table specified at runtime via an external file.
+ Look for the character translation file FNAME along the same path as
+ tex.pool. If no suffix in FNAME, use .tcx (don't bother trying to
+ support extension-less names for these files). */
+
+/* FIXME: A new format ought to be introduced for these files. */
+
+void
+readtcxfile P1H(void)
+{
+ string orig_filename;
+ if (!find_suffix (translate_filename)) {
+ translate_filename = concat (translate_filename, ".tcx");
+ }
+ orig_filename = translate_filename;
+ translate_filename
+ = kpse_find_file (translate_filename, kpse_web2c_format, true);
+ if (translate_filename) {
+ string line;
+ unsigned line_count = 0;
+ FILE *translate_file = xfopen (translate_filename, FOPEN_R_MODE);
+ while (line = read_line (translate_file)) {
+ int first;
+ string start2;
+ string comment_loc = strchr (line, '%');
+ if (comment_loc)
+ *comment_loc = 0;
+
+ line_count++;
+
+ first = tcx_get_num (255, line_count, line, &start2);
+ if (first >= 0) {
+ string start3;
+ int second;
+ int printable;
+
+ second = tcx_get_num (255, line_count, start2, &start3);
+ if (second >= 0) {
+ /* I suppose we could check for nonempty junk following the
+ "printable" code, but let's not bother. */
+ string extra;
+
+ /* If they mention a second code, make that the internal number. */
+ xord[first] = second;
+ xchr[second] = first;
+
+ printable = tcx_get_num (1, line_count, start3, &extra);
+ /* Not-a-number, may be a comment. */
+ if (printable == -1)
+ printable = 1;
+ /* Don't allow the 7bit ASCII set to become unprintable. */
+ if (32 <= second && second <= 126)
+ printable = 1;
+ } else {
+ second = first; /* else make internal the same as external */
+ /* If they mention a charcode, call it printable. */
+ printable = 1;
+ }
+
+ xprn[second] = printable;
+ }
+ free (line);
+ }
+ xfclose(translate_file, translate_filename);
+ } else {
+ WARNING1 ("Could not open char translation file `%s'", orig_filename);
+ }
+}
+#endif /* !Omega && !eOmega && !Aleph */
+#endif /* TeX || MF || MP [character translation] */
+
+/* Normalize quoting of filename -- that is, only quote if there is a space,
+ and always use the quote-name-quote style. */
+string
+normalize_quotes P2C(const_string, name, const_string, mesg)
+{
+ boolean quoted = false;
+ boolean must_quote = (strchr(name, ' ') != NULL);
+ /* Leave room for quotes and NUL. */
+ string ret = (string)xmalloc(strlen(name)+3);
+ string p;
+ const_string q;
+ p = ret;
+ if (must_quote)
+ *p++ = '"';
+ for (q = name; *q; q++) {
+ if (*q == '"')
+ quoted = !quoted;
+ else
+ *p++ = *q;
+ }
+ if (must_quote)
+ *p++ = '"';
+ *p = '\0';
+ if (quoted) {
+ fprintf(stderr, "! Unbalanced quotes in %s %s\n", mesg, name);
+ uexit(1);
+ }
+ return ret;
+}
+
+/* Getting the input filename. */
+string
+get_input_file_name P1H(void)
+{
+ string input_file_name = NULL;
+
+ if (argv[optind] && argv[optind][0] != '&' && argv[optind][0] != '\\') {
+ /* Not &format, not \input, so assume simple filename. */
+ string name = normalize_quotes(argv[optind], "argument");
+ boolean quoted = (name[0] == '"');
+ if (quoted) {
+ /* Overwrite last quote and skip first quote. */
+ name[strlen(name)-1] = '\0';
+ name++;
+ }
+ input_file_name = kpse_find_file(name, INPUT_FORMAT, false);
+ if (quoted) {
+ /* Undo modifications */
+ name[strlen(name)] = '"';
+ name--;
+ }
+ argv[optind] = name;
+ }
+ return input_file_name;
+}
+
+/* Reading the options. */
+
+/* Test whether getopt found an option ``A''.
+ Assumes the option index is in the variable `option_index', and the
+ option table in a variable `long_options'. */
+#define ARGUMENT_IS(a) STREQ (long_options[option_index].name, a)
+
+/* SunOS cc can't initialize automatic structs, so make this static. */
+static struct option long_options[]
+ = { { DUMP_OPTION, 1, 0, 0 },
+#ifdef TeX
+ /* FIXME: Obsolete -- for backward compatibility only. */
+ { "efmt", 1, 0, 0 },
+#endif
+ { "help", 0, 0, 0 },
+ { "ini", 0, &iniversion, 1 },
+ { "interaction", 1, 0, 0 },
+ { "halt-on-error", 0, &haltonerrorp, 1 },
+ { "kpathsea-debug", 1, 0, 0 },
+ { "progname", 1, 0, 0 },
+ { "version", 0, 0, 0 },
+ { "recorder", 0, &recorder_enabled, 1 },
+#ifdef TeX
+#ifdef IPC
+ { "ipc", 0, &ipcon, 1 },
+ { "ipc-start", 0, &ipcon, 2 },
+#endif /* IPC */
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ { "mltex", 0, &mltexp, 1 },
+ { "enc", 0, &enctexp, 1 },
+#endif /* !Omega && !eOmega && !Aleph */
+#if defined (eTeX) || defined(pdfeTeX) || defined(Aleph)
+ { "etex", 0, &etexp, 1 },
+#endif /* eTeX || pdfeTeX || Aleph */
+ { "output-comment", 1, 0, 0 },
+ { "output-directory", 1, 0, 0 },
+#if defined(pdfTeX) || defined(pdfeTeX)
+ { "output-format", 1, 0, 0 },
+#endif /* pdfTeX or pdfeTeX */
+ { "shell-escape", 0, &shellenabledp, 1 },
+ { "no-shell-escape", 0, &shellenabledp, -1 },
+ { "debug-format", 0, &debugformatfile, 1 },
+ { "src-specials", 2, 0, 0 },
+#endif /* TeX */
+#if defined (TeX) || defined (MF) || defined (MP)
+ { "file-line-error-style", 0, &filelineerrorstylep, 1 },
+ { "no-file-line-error-style", 0, &filelineerrorstylep, -1 },
+ /* Shorter option names for the above. */
+ { "file-line-error", 0, &filelineerrorstylep, 1 },
+ { "no-file-line-error", 0, &filelineerrorstylep, -1 },
+ { "jobname", 1, 0, 0 },
+ { "parse-first-line", 0, &parsefirstlinep, 1 },
+ { "no-parse-first-line", 0, &parsefirstlinep, -1 },
+ { "translate-file", 1, 0, 0 },
+ { "default-translate-file", 1, 0, 0 },
+ { "8bit", 0, &eightbitp, 1 },
+#endif /* TeX || MF || MP */
+#if defined (TeX) || defined (MF)
+ { "mktex", 1, 0, 0 },
+ { "no-mktex", 1, 0, 0 },
+#endif /* TeX or MF */
+#ifdef MP
+ { "T", 0, &troffmode, 1 },
+ { "troff", 0, &troffmode, 1 },
+ { "tex", 1, 0, 0 },
+#endif /* MP */
+ { 0, 0, 0, 0 } };
+
+
+static void
+parse_options P2C(int, argc, string *, argv)
+{
+ int g; /* `getopt' return code. */
+ int option_index;
+
+ for (;;) {
+ g = getopt_long_only (argc, argv, "+", long_options, &option_index);
+
+ if (g == -1) /* End of arguments, exit the loop. */
+ break;
+
+ if (g == '?') { /* Unknown option. */
+ /* FIXME: usage (argv[0]); replaced by continue. */
+ continue;
+ }
+
+ assert (g == 0); /* We have no short option names. */
+
+ if (ARGUMENT_IS ("kpathsea-debug")) {
+ kpathsea_debug |= atoi (optarg);
+
+ } else if (ARGUMENT_IS ("progname")) {
+ user_progname = optarg;
+
+ } else if (ARGUMENT_IS ("jobname")) {
+ job_name = normalize_quotes(optarg, "jobname");
+
+ } else if (ARGUMENT_IS (DUMP_OPTION)) {
+ dump_name = optarg;
+ if (!user_progname) user_progname = optarg;
+ dumpoption = true;
+
+#ifdef TeX
+ /* FIXME: Obsolete -- for backward compatibility only. */
+ } else if (ARGUMENT_IS ("efmt")) {
+ dump_name = optarg;
+ if (!user_progname) user_progname = optarg;
+ dumpoption = true;
+#endif
+
+ } else if (ARGUMENT_IS ("output-directory")) {
+ output_directory = optarg;
+
+#ifdef TeX
+ } else if (ARGUMENT_IS ("output-comment")) {
+ unsigned len = strlen (optarg);
+ if (len < 256) {
+ outputcomment = optarg;
+ } else {
+ WARNING2 ("Comment truncated to 255 characters from %d. (%s)",
+ len, optarg);
+ outputcomment = (string)xmalloc (256);
+ strncpy (outputcomment, optarg, 255);
+ outputcomment[255] = 0;
+ }
+
+#ifdef IPC
+ } else if (ARGUMENT_IS ("ipc-start")) {
+ ipc_open_out ();
+ /* Try to start up the other end if it's not already. */
+ if (!ipc_is_open ()) {
+ if (system (IPC_SERVER_CMD) == 0) {
+ unsigned i;
+ for (i = 0; i < 20 && !ipc_is_open (); i++) {
+ sleep (2);
+ ipc_open_out ();
+ }
+ }
+ }
+#endif /* IPC */
+ } else if (ARGUMENT_IS ("src-specials")) {
+ last_source_name = xstrdup("");
+ /* Option `--src" without any value means `auto' mode. */
+ if (optarg == NULL) {
+ insertsrcspecialeverypar = true;
+ insertsrcspecialauto = true;
+ srcspecialsoption = true;
+ srcspecialsp = true;
+ } else {
+ parse_src_specials_option(optarg);
+ }
+#endif /* TeX */
+#if defined(pdfTeX) || defined(pdfeTeX)
+ } else if (ARGUMENT_IS ("output-format")) {
+ pdfoutputoption = 1;
+ if (strcmp(optarg, "dvi") == 0) {
+ pdfoutputvalue = 0;
+ } else if (strcmp(optarg, "pdf") == 0) {
+ pdfoutputvalue = 2;
+ } else {
+ WARNING1 ("Ignoring unknown value `%s' for --output-format", optarg);
+ pdfoutputoption = 0;
+ }
+#endif /* pdfTeX || pdfeTeX */
+#if defined (TeX) || defined (MF) || defined (MP)
+ } else if (ARGUMENT_IS ("translate-file")) {
+ translate_filename = optarg;
+ } else if (ARGUMENT_IS ("default-translate-file")) {
+ default_translate_filename = optarg;
+#if defined(Omega) || defined(eOmega) || defined(Aleph)
+ } else if (ARGUMENT_IS ("8bit")) {
+ /* FIXME: print snippy message? Possibly also for above? */
+#endif /* !Omega && !eOmega && !Aleph */
+#endif /* TeX || MF || MP */
+
+#if defined (TeX) || defined (MF)
+ } else if (ARGUMENT_IS ("mktex")) {
+ kpse_maketex_option (optarg, true);
+
+ } else if (ARGUMENT_IS ("no-mktex")) {
+ kpse_maketex_option (optarg, false);
+#endif /* TeX or MF */
+#if defined (MP)
+ } else if (ARGUMENT_IS ("tex")) {
+ mpost_tex_program = optarg;
+#endif /* MP */
+ } else if (ARGUMENT_IS ("interaction")) {
+ /* These numbers match @d's in *.ch */
+ if (STREQ (optarg, "batchmode")) {
+ interactionoption = 0;
+ } else if (STREQ (optarg, "nonstopmode")) {
+ interactionoption = 1;
+ } else if (STREQ (optarg, "scrollmode")) {
+ interactionoption = 2;
+ } else if (STREQ (optarg, "errorstopmode")) {
+ interactionoption = 3;
+ } else {
+ WARNING1 ("Ignoring unknown argument `%s' to --interaction", optarg);
+ }
+
+ } else if (ARGUMENT_IS ("help")) {
+ usagehelp (PROGRAM_HELP, BUG_ADDRESS);
+
+ } else if (ARGUMENT_IS ("version")) {
+ printversionandexit (BANNER, COPYRIGHT_HOLDER, AUTHOR);
+
+ } /* Else it was a flag; getopt has already done the assignment. */
+ }
+}
+
+#if defined(TeX)
+void
+parse_src_specials_option P1C(const_string, opt_list)
+{
+ char * toklist = xstrdup(opt_list);
+ char * tok;
+ insertsrcspecialauto = false;
+ tok = strtok (toklist, ", ");
+ while (tok) {
+ if (strcmp (tok, "everypar") == 0
+ || strcmp (tok, "par") == 0
+ || strcmp (tok, "auto") == 0) {
+ insertsrcspecialauto = true;
+ insertsrcspecialeverypar = true;
+ } else if (strcmp (tok, "everyparend") == 0
+ || strcmp (tok, "parend") == 0)
+ insertsrcspecialeveryparend = true;
+ else if (strcmp (tok, "everycr") == 0
+ || strcmp (tok, "cr") == 0)
+ insertsrcspecialeverycr = true;
+ else if (strcmp (tok, "everymath") == 0
+ || strcmp (tok, "math") == 0)
+ insertsrcspecialeverymath = true;
+ else if (strcmp (tok, "everyhbox") == 0
+ || strcmp (tok, "hbox") == 0)
+ insertsrcspecialeveryhbox = true;
+ else if (strcmp (tok, "everyvbox") == 0
+ || strcmp (tok, "vbox") == 0)
+ insertsrcspecialeveryvbox = true;
+ else if (strcmp (tok, "everydisplay") == 0
+ || strcmp (tok, "display") == 0)
+ insertsrcspecialeverydisplay = true;
+ else if (strcmp (tok, "none") == 0) {
+ /* This one allows to reset an option that could appear in texmf.cnf */
+ insertsrcspecialauto = insertsrcspecialeverypar =
+ insertsrcspecialeveryparend = insertsrcspecialeverycr =
+ insertsrcspecialeverymath = insertsrcspecialeveryhbox =
+ insertsrcspecialeveryvbox = insertsrcspecialeverydisplay = false;
+ } else {
+ WARNING1 ("Ignoring unknown argument `%s' to --src-specials", tok);
+ }
+ tok = strtok(0, ", ");
+ }
+ free(toklist);
+ srcspecialsp=insertsrcspecialauto | insertsrcspecialeverypar |
+ insertsrcspecialeveryparend | insertsrcspecialeverycr |
+ insertsrcspecialeverymath | insertsrcspecialeveryhbox |
+ insertsrcspecialeveryvbox | insertsrcspecialeverydisplay;
+ srcspecialsoption = true;
+}
+#endif
+
+/* If the first thing on the command line (we use the globals `argv' and
+ `optind') is a normal filename (i.e., does not start with `&' or
+ `\'), and if we can open it, and if its first line is %&FORMAT, and
+ FORMAT is a readable dump file, then set DUMP_VAR to FORMAT.
+ Also call kpse_reset_program_name to ensure the correct paths for the
+ format are used. */
+static void
+parse_first_line P1C(const_string, filename)
+{
+ FILE *f = filename ? fopen (filename, FOPEN_R_MODE) : NULL;
+ if (f) {
+ string first_line = read_line (f);
+ xfclose (f, filename);
+
+ /* We deal with the general format "%&fmt --translate-file=tcx" */
+ /* The idea of using this format came from Wlodzimierz Bzyl
+ <matwb@monika.univ.gda.pl> */
+ if (first_line && first_line[0] == '%' && first_line[1] == '&') {
+ /* Parse the first line into at most three space-separated parts. */
+ char *s;
+ char *part[4];
+ int npart;
+ char **parse;
+
+ for (s = first_line+2; ISBLANK(*s); ++s)
+ ;
+ npart = 0;
+ while (*s && npart != 3) {
+ part[npart++] = s;
+ while (*s && *s != ' ') s++;
+ while (*s == ' ') *s++ = '\0';
+ }
+ part[npart] = NULL;
+ parse = part;
+ /* Look at what we've got. Very crude! */
+ if (*parse && **parse != '-') {
+ /* A format name */
+ if (dump_name) {
+ /* format already determined, do nothing. */
+ } else {
+ string f_name = concat (part[0], DUMP_EXT);
+ string d_name = kpse_find_file (f_name, DUMP_FORMAT, false);
+ if (d_name && kpse_readable_file (d_name)) {
+ dump_name = xstrdup (part[0]);
+ kpse_reset_program_name (dump_name);
+ /* Tell TeX/MF/MP we have a %&name line... */
+ dumpline = true;
+ }
+ free (f_name);
+ }
+ parse++;
+ }
+ /* The tcx stuff, if any. Should we support the -translate-file
+ form as well as --translate-file? */
+ if (*parse) {
+ if (translate_filename) {
+ /* TCX file already set, do nothing. */
+ } else if (STREQ (*parse, "--translate-file")) {
+ s = *(parse+1);
+ } else if (STREQ (*parse, "-translate-file")) {
+ s = *(parse+1);
+ } else if (STRNEQ (*parse, "--translate-file=", 17)) {
+ s = *parse+17;
+ } else if (STRNEQ (*parse, "-translate-file=", 16)) {
+ s = *parse+16;
+ }
+ /* Just set the name, no sanity checks here. */
+ /* FIXME: remove trailing spaces. */
+ if (s && *s) {
+ translate_filename = xstrdup(s);
+ }
+ }
+ }
+ if (first_line)
+ free (first_line);
+ }
+}
+
+/* Return true if FNAME is acceptable as a name for \openout, \openin, or
+ \input. */
+
+typedef enum ok_type {
+ ok_reading,
+ ok_writing
+} ok_type;
+
+static const_string ok_type_name[] = {
+ "reading",
+ "writing"
+};
+
+static boolean
+opennameok P4C(const_string, fname, const_string, check_var,
+ const_string, default_choice, ok_type, action)
+{
+ /* We distinguish three cases:
+ 'a' (any) allows any file to be opened.
+ 'r' (restricted) means disallowing special file names.
+ 'p' (paranoid) means being really paranoid: disallowing special file
+ names and restricting output files to be in or below
+ the working directory or $TEXMFOUTPUT, while input files
+ must be below the current directory, $TEXMFOUTPUT, or
+ (implicitly) in the system areas.
+ We default to "paranoid". The error messages from TeX will be somewhat
+ puzzling...
+ This function contains several return statements... */
+
+ const_string open_choice = kpse_var_value (check_var);
+
+ if (!open_choice) open_choice = default_choice;
+
+ if (*open_choice == 'a' || *open_choice == 'y' || *open_choice == '1')
+ return true;
+
+#if defined (unix) && !defined (MSDOS)
+ {
+ const_string base = xbasename (fname);
+ /* Disallow .rhosts, .login, etc. Allow .tex (for LaTeX). */
+ if (base[0] == 0 ||
+ (base[0] == '.' && !IS_DIR_SEP(base[1]) && !STREQ (base, ".tex"))) {
+ fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
+ program_invocation_name, ok_type_name[action], fname,
+ check_var, open_choice);
+ return false;
+ }
+ }
+#else
+ /* Other OSs don't have special names? */
+#endif
+
+ if (*open_choice == 'r' || *open_choice == 'n' || *open_choice == '0')
+ return true;
+
+ /* Paranoia supplied by Charles Karney... */
+ if (kpse_absolute_p (fname, false)) {
+ const_string texmfoutput = kpse_var_value ("TEXMFOUTPUT");
+ /* Absolute pathname is only OK if TEXMFOUTPUT is set, it's not empty,
+ fname begins the TEXMFOUTPUT, and is followed by / */
+ if (!texmfoutput || *texmfoutput == '\0'
+ || fname != strstr (fname, texmfoutput)
+ || !IS_DIR_SEP(fname[strlen(texmfoutput)])) {
+ fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
+ program_invocation_name, ok_type_name[action], fname,
+ check_var, open_choice);
+ return false;
+ }
+ }
+ /* For all pathnames, we disallow "../" at the beginning or "/../"
+ anywhere. */
+ if (fname[0] == '.' && fname[1] == '.' && IS_DIR_SEP(fname[2])) {
+ fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
+ program_invocation_name, ok_type_name[action], fname,
+ check_var, open_choice);
+ return false;
+ } else {
+ /* Check for "/../". Since more than one characted can be matched
+ by IS_DIR_SEP, we cannot use "/../" itself. */
+ const_string dotpair = strstr(fname, "..");
+ while (dotpair) {
+ /* If dotpair[2] == DIR_SEP, then dotpair[-1] is well-defined,
+ because the "../" case was handled above. */
+ if (IS_DIR_SEP(dotpair[2]) && IS_DIR_SEP(dotpair[-1])) {
+ fprintf(stderr, "%s: Not %s to %s (%s = %s).\n",
+ program_invocation_name, ok_type_name[action], fname,
+ check_var, open_choice);
+ return false;
+ }
+ /* Continue after the dotpair. */
+ dotpair = strstr(dotpair+2, "..");
+ }
+ }
+
+ /* We passed all tests. */
+ return true;
+}
+
+boolean openinnameok P1C(const_string, fname)
+{
+ /* For input default to all. */
+ return opennameok (fname, "openin_any", "a", ok_reading);
+}
+
+boolean openoutnameok P1C(const_string, fname)
+{
+ /* For output, default to paranoid. */
+ return opennameok (fname, "openout_any", "p", ok_writing);
+}
+
+/* All our interrupt handler has to do is set TeX's or Metafont's global
+ variable `interrupt'; then they will do everything needed. */
+#ifdef WIN32
+/* Win32 doesn't set SIGINT ... */
+BOOL WINAPI
+catch_interrupt (DWORD arg)
+{
+ switch (arg) {
+ case CTRL_C_EVENT:
+ case CTRL_BREAK_EVENT:
+ interrupt = 1;
+ return TRUE;
+ default:
+ /* No need to set interrupt as we are exiting anyway */
+ return FALSE;
+ }
+}
+#else /* not WIN32 */
+static RETSIGTYPE
+catch_interrupt P1C (int, arg)
+{
+ interrupt = 1;
+#ifdef OS2
+ (void) signal (SIGINT, SIG_ACK);
+#else
+ (void) signal (SIGINT, catch_interrupt);
+#endif /* not OS2 */
+}
+#endif /* not WIN32 */
+
+/* Besides getting the date and time here, we also set up the interrupt
+ handler, for no particularly good reason. It's just that since the
+ `fix_date_and_time' routine is called early on (section 1337 in TeX,
+ ``Get the first line of input and prepare to start''), this is as
+ good a place as any. */
+
+void
+get_date_and_time P4C(integer *, minutes, integer *, day,
+ integer *, month, integer *, year)
+{
+ time_t clock = time ((time_t *) 0);
+ struct tm *tmptr = localtime (&clock);
+
+ *minutes = tmptr->tm_hour * 60 + tmptr->tm_min;
+ *day = tmptr->tm_mday;
+ *month = tmptr->tm_mon + 1;
+ *year = tmptr->tm_year + 1900;
+
+ {
+#ifdef SA_INTERRUPT
+ /* Under SunOS 4.1.x, the default action after return from the
+ signal handler is to restart the I/O if nothing has been
+ transferred. The effect on TeX is that interrupts are ignored if
+ we are waiting for input. The following tells the system to
+ return EINTR from read() in this case. From ken@cs.toronto.edu. */
+
+ struct sigaction a, oa;
+
+ a.sa_handler = catch_interrupt;
+ sigemptyset (&a.sa_mask);
+ sigaddset (&a.sa_mask, SIGINT);
+ a.sa_flags = SA_INTERRUPT;
+ sigaction (SIGINT, &a, &oa);
+ if (oa.sa_handler != SIG_DFL)
+ sigaction (SIGINT, &oa, (struct sigaction *) 0);
+#else /* no SA_INTERRUPT */
+#ifdef WIN32
+ SetConsoleCtrlHandler(catch_interrupt, TRUE);
+#else /* not WIN32 */
+ RETSIGTYPE (*old_handler) P1H(int);
+
+ old_handler = signal (SIGINT, catch_interrupt);
+ if (old_handler != SIG_DFL)
+ signal (SIGINT, old_handler);
+#endif /* not WIN32 */
+#endif /* no SA_INTERRUPT */
+ }
+}
+
+/*
+ Getting a high resolution time.
+ */
+void
+get_seconds_and_micros P2C(integer *, seconds, integer *, micros)
+{
+#if defined (HAVE_GETTIMEOFDAY)
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ *seconds = tv.tv_sec;
+ *micros = tv.tv_usec;
+#elif defined (HAVE_FTIME)
+ struct timeb tb;
+ ftime(&tb);
+ *seconds = tb.time;
+ *micros = tb.millitm*1000;
+#else
+ time_t clock = time((time_t*)NULL);
+ *seconds = clock;
+ *micros = 0;
+#endif
+}
+
+/*
+ Generating a better seed numbers
+ */
+integer
+getrandomseed()
+{
+#if defined (HAVE_GETTIMEOFDAY)
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (tv.tv_usec + 1000000 * tv.tv_usec);
+#elif defined (HAVE_FTIME)
+ struct timeb tb;
+ ftime(&tb);
+ return (tb.millitm + 1000 * tb.time);
+#else
+ time_t clock = time ((time_t*)NULL);
+ struct tm *tmptr = localtime(&clock);
+ return (tmptr->tm_sec + 60*(tmptr->tm_min + 60*tmptr->tm_hour));
+#endif
+}
+
+/* Read a line of input as efficiently as possible while still looking
+ like Pascal. We set `last' to `first' and return `false' if we get
+ to eof. Otherwise, we return `true' and set last = first +
+ length(line except trailing whitespace). */
+
+boolean
+input_line P1C(FILE *, f)
+{
+ int i;
+
+ /* Recognize either LF or CR as a line terminator. */
+ last = first;
+ while (last < bufsize && (i = getc (f)) != EOF && i != '\n' && i != '\r')
+ buffer[last++] = i;
+
+ if (i == EOF && errno != EINTR && last == first)
+ return false;
+
+ /* We didn't get the whole line because our buffer was too small. */
+ if (i != EOF && i != '\n' && i != '\r') {
+ fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
+ (unsigned) bufsize);
+ fputs ("Please increase buf_size in texmf.cnf.\n", stderr);
+ uexit (1);
+ }
+
+ buffer[last] = ' ';
+ if (last >= maxbufstack)
+ maxbufstack = last;
+
+ /* If next char is LF of a CRLF, read it. */
+ if (i == '\r') {
+ while ((i = getc (f)) == EOF && errno == EINTR)
+ ;
+ if (i != '\n')
+ ungetc (i, f);
+ }
+
+ /* Trim trailing whitespace. */
+ while (last > first && ISBLANK (buffer[last - 1]))
+ --last;
+
+ /* Don't bother using xord if we don't need to. */
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ for (i = first; i <= last; i++)
+ buffer[i] = xord[buffer[i]];
+#endif
+
+ return true;
+}
+
+/* This string specifies what the `e' option does in response to an
+ error message. */
+static char *edit_value = EDITOR;
+
+/* This procedure originally due to sjc@s1-c. TeX & Metafont call it when
+ the user types `e' in response to an error, invoking a text editor on
+ the erroneous source file. FNSTART is how far into FILENAME the
+ actual filename starts; FNLENGTH is how long the filename is. */
+
+void
+calledit P4C(packedASCIIcode *, filename,
+ poolpointer, fnstart,
+ integer, fnlength,
+ integer, linenumber)
+{
+ char *temp, *command;
+ char c;
+ int sdone, ddone, i;
+
+ sdone = ddone = 0;
+ filename += fnstart;
+
+ /* Close any open input files, since we're going to kill the job. */
+ for (i = 1; i <= inopen; i++)
+ xfclose (inputfile[i], "inputfile");
+
+ /* Replace the default with the value of the appropriate environment
+ variable or config file value, if it's set. */
+ temp = kpse_var_value (edit_var);
+ if (temp != NULL)
+ edit_value = temp;
+
+ /* Construct the command string. The `11' is the maximum length an
+ integer might be. */
+ command = (string) xmalloc (strlen (edit_value) + fnlength + 11);
+
+ /* So we can construct it as we go. */
+ temp = command;
+
+ while ((c = *edit_value++) != 0)
+ {
+ if (c == '%')
+ {
+ switch (c = *edit_value++)
+ {
+ case 'd':
+ if (ddone)
+ FATAL ("call_edit: `%%d' appears twice in editor command");
+ sprintf (temp, "%ld", linenumber);
+ while (*temp != '\0')
+ temp++;
+ ddone = 1;
+ break;
+
+ case 's':
+ if (sdone)
+ FATAL ("call_edit: `%%s' appears twice in editor command");
+ for (i =0; i < fnlength; i++)
+ *temp++ = Xchr (filename[i]);
+ sdone = 1;
+ break;
+
+ case '\0':
+ *temp++ = '%';
+ /* Back up to the null to force termination. */
+ edit_value--;
+ break;
+
+ default:
+ *temp++ = '%';
+ *temp++ = c;
+ break;
+ }
+ }
+ else
+ *temp++ = c;
+ }
+
+ *temp = 0;
+
+ /* Execute the command. */
+#ifdef WIN32
+ /* Win32 reimplementation of the system() command
+ provides opportunity to call it asynchronously */
+ if (win32_system(command, true) != 0 )
+#else
+ if (system (command) != 0)
+#endif
+ fprintf (stderr, "! Trouble executing `%s'.\n", command);
+
+ /* Quit, since we found an error. */
+ uexit (1);
+}
+
+/* Read and write dump files. As distributed, these files are
+ architecture dependent; specifically, BigEndian and LittleEndian
+ architectures produce different files. These routines always output
+ BigEndian files. This still does not guarantee them to be
+ architecture-independent, because it is possible to make a format
+ that dumps a glue ratio, i.e., a floating-point number. Fortunately,
+ none of the standard formats do that. */
+
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
+
+/* This macro is always invoked as a statement. It assumes a variable
+ `temp'. */
+
+#define SWAP(x, y) temp = (x); (x) = (y); (y) = temp
+
+
+/* Make the NITEMS items pointed at by P, each of size SIZE, be the
+ opposite-endianness of whatever they are now. */
+
+static void
+swap_items P3C(char *, p, int, nitems, int, size)
+{
+ char temp;
+
+ /* Since `size' does not change, we can write a while loop for each
+ case, and avoid testing `size' for each time. */
+ switch (size)
+ {
+ /* 16-byte items happen on the DEC Alpha machine when we are not
+ doing sharable memory dumps. */
+ case 16:
+ while (nitems--)
+ {
+ SWAP (p[0], p[15]);
+ SWAP (p[1], p[14]);
+ SWAP (p[2], p[13]);
+ SWAP (p[3], p[12]);
+ SWAP (p[4], p[11]);
+ SWAP (p[5], p[10]);
+ SWAP (p[6], p[9]);
+ SWAP (p[7], p[8]);
+ p += size;
+ }
+ break;
+
+ case 8:
+ while (nitems--)
+ {
+ SWAP (p[0], p[7]);
+ SWAP (p[1], p[6]);
+ SWAP (p[2], p[5]);
+ SWAP (p[3], p[4]);
+ p += size;
+ }
+ break;
+
+ case 4:
+ while (nitems--)
+ {
+ SWAP (p[0], p[3]);
+ SWAP (p[1], p[2]);
+ p += size;
+ }
+ break;
+
+ case 2:
+ while (nitems--)
+ {
+ SWAP (p[0], p[1]);
+ p += size;
+ }
+ break;
+
+ case 1:
+ /* Nothing to do. */
+ break;
+
+ default:
+ FATAL1 ("Can't swap a %d-byte item for (un)dumping", size);
+ }
+}
+#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
+
+
+/* Here we write NITEMS items, each item being ITEM_SIZE bytes long.
+ The pointer to the stuff to write is P, and we write to the file
+ OUT_FILE. */
+
+void
+do_dump P4C(char *, p, int, item_size, int, nitems, FILE *, out_file)
+{
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items (p, nitems, item_size);
+#endif
+
+ if (fwrite (p, item_size, nitems, out_file) != nitems)
+ {
+ fprintf (stderr, "! Could not write %d %d-byte item(s).\n",
+ nitems, item_size);
+ uexit (1);
+ }
+
+ /* Have to restore the old contents of memory, since some of it might
+ get used again. */
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items (p, nitems, item_size);
+#endif
+}
+
+
+/* Here is the dual of the writing routine. */
+
+void
+do_undump P4C(char *, p, int, item_size, int, nitems, FILE *, in_file)
+{
+ if (fread (p, item_size, nitems, in_file) != nitems)
+ FATAL2 ("Could not undump %d %d-byte item(s)", nitems, item_size);
+
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items (p, nitems, item_size);
+#endif
+}
+
+/* Look up VAR_NAME in texmf.cnf; assign either the value found there or
+ DFLT to *VAR. */
+
+void
+setupboundvariable P3C(integer *, var, const_string, var_name, integer, dflt)
+{
+ string expansion = kpse_var_value (var_name);
+ *var = dflt;
+
+ if (expansion) {
+ integer conf_val = atoi (expansion);
+ /* It's ok if the cnf file specifies 0 for extra_mem_{top,bot}, etc.
+ But negative numbers are always wrong. */
+ if (conf_val < 0 || (conf_val == 0 && dflt > 0)) {
+ fprintf (stderr,
+ "%s: Bad value (%ld) in texmf.cnf for %s, keeping %ld.\n",
+ program_invocation_name,
+ (long) conf_val, var_name + 1, (long) dflt);
+ } else {
+ *var = conf_val; /* We'll make further checks later. */
+ }
+ free (expansion);
+ }
+}
+
+/* FIXME -- some (most?) of this can/should be moved to the Pascal/WEB side. */
+#if defined(TeX) || defined(MP) || defined(MF)
+static void
+checkpoolpointer (poolpointer poolptr, size_t len)
+{
+ if (poolptr + len >= poolsize) {
+ fprintf (stderr, "\nstring pool overflow [%i bytes]\n",
+ (int)poolsize); /* fixme */
+ exit(1);
+ }
+}
+
+#if !defined(pdfTeX) && !defined(pdfeTeX)
+static int
+maketexstring(const_string s)
+{
+ size_t len;
+ assert (s != 0);
+ len = strlen(s);
+ checkpoolpointer (poolptr, len);
+ while (len-- > 0)
+ strpool[poolptr++] = *s++;
+ return (makestring());
+}
+#endif
+
+strnumber
+makefullnamestring()
+{
+ return maketexstring(fullnameoffile);
+}
+
+/* Get the job name to be used, which may have been set from the
+ command line. */
+strnumber
+getjobname(strnumber name)
+{
+ strnumber ret = name;
+ if (job_name != NULL)
+ ret = maketexstring(job_name);
+ return ret;
+}
+#endif
+
+#if defined(TeX)
+int
+compare_paths P2C(const_string, p1, const_string, p2)
+{
+ int ret;
+ while (
+#ifdef MONOCASE_FILENAMES
+ (((ret = (toupper(*p1) - toupper(*p2))) == 0) && (*p2 != 0))
+#else
+ (((ret = (*p1 - *p2)) == 0) && (*p2 != 0))
+#endif
+ || (IS_DIR_SEP(*p1) && IS_DIR_SEP(*p2))) {
+ p1++, p2++;
+ }
+ ret = (ret < 0 ? -1 : (ret > 0 ? 1 : 0));
+ return ret;
+}
+
+string
+gettexstring P1C(strnumber, s)
+{
+ poolpointer i, len;
+ string name;
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ len = strstart[s + 1] - strstart[s];
+#else
+ len = strstartar[s + 1 - 65536L] - strstartar[s - 65536L];
+#endif
+ name = (string)xmalloc (len + 1);
+#if !defined(Omega) && !defined(eOmega) && !defined(Aleph)
+ strncpy (name, (string)&strpool[strstart[s]], len);
+#else
+ /* Don't use strncpy. The strpool is not made up of chars. */
+ for (i=0; i<len; i++) name[i] = strpool[i+strstartar[s - 65536L]];
+#endif
+ name[len] = 0;
+ return name;
+}
+
+boolean
+isnewsource P2C(strnumber, srcfilename, int, lineno)
+{
+ char *name = gettexstring(srcfilename);
+ return (compare_paths(name, last_source_name) != 0 || lineno != last_lineno);
+}
+
+void
+remembersourceinfo P2C(strnumber, srcfilename,
+ int, lineno)
+{
+ if (last_source_name)
+ free(last_source_name);
+ last_source_name = gettexstring(srcfilename);
+ last_lineno = lineno;
+}
+
+poolpointer
+makesrcspecial P2C(strnumber, srcfilename,
+ int, lineno)
+{
+ poolpointer oldpoolptr = poolptr;
+ char *filename = gettexstring(srcfilename);
+ /* FIXME: Magic number. */
+ char buf[40];
+ size_t len = strlen(filename);
+ char * s = buf;
+
+ /* Always put a space after the number, which makes things easier
+ * to parse.
+ */
+ sprintf (buf, "src:%d ", lineno);
+
+ if (poolptr + strlen(buf) + strlen(filename) >= poolsize) {
+ fprintf (stderr, "\nstring pool overflow\n"); /* fixme */
+ exit (1);
+ }
+ s = buf;
+ while (*s)
+ strpool[poolptr++] = *s++;
+
+ s = filename;
+ while (*s)
+ strpool[poolptr++] = *s++;
+
+ return (oldpoolptr);
+}
+#endif
+
+#ifdef MP
+/* Invoke makempx (or troffmpx) to make sure there is an up-to-date
+ .mpx file for a given .mp file. (Original from John Hobby 3/14/90) */
+
+#include <kpathsea/concatn.h>
+
+#ifndef MPXCOMMAND
+#define MPXCOMMAND "makempx"
+#endif
+
+boolean
+callmakempx P2C(string, mpname, string, mpxname)
+{
+ int ret;
+ string cnf_cmd = kpse_var_value ("MPXCOMMAND");
+
+ if (cnf_cmd && STREQ (cnf_cmd, "0")) {
+ /* If they turned off this feature, just return success. */
+ ret = 0;
+
+ } else {
+ /* We will invoke something. Compile-time default if nothing else. */
+ string cmd;
+ string qmpname = normalize_quotes(mpname, "mpname");
+ string qmpxname = normalize_quotes(mpxname, "mpxname");
+ if (!cnf_cmd)
+ cnf_cmd = xstrdup (MPXCOMMAND);
+
+ if (troffmode)
+ cmd = concatn (cnf_cmd, " -troff ",
+ qmpname, " ", qmpxname, NULL);
+ else if (mpost_tex_program && *mpost_tex_program)
+ cmd = concatn (cnf_cmd, " -tex=", mpost_tex_program, " ",
+ qmpname, " ", qmpxname, NULL);
+ else
+ cmd = concatn (cnf_cmd, " -tex ", qmpname, " ", qmpxname, NULL);
+
+ /* Run it. */
+ ret = system (cmd);
+ free (cmd);
+ free (qmpname);
+ free (qmpxname);
+ }
+
+ free (cnf_cmd);
+ return ret == 0;
+}
+#endif /* MP */
+
+/* Metafont/MetaPost fraction routines. Replaced either by assembler or C.
+ The assembler syntax doesn't work on Solaris/x86. */
+#ifndef TeX
+#if defined (__sun__) || defined (__cplusplus)
+#define NO_MF_ASM
+#endif
+#if defined(WIN32) && !defined(NO_MF_ASM)
+#include "lib/mfmpw32.c"
+#elif defined (__i386__) && defined (__GNUC__) && !defined (NO_MF_ASM)
+#include "lib/mfmpi386.asm"
+#else
+/* Replace fixed-point fraction routines from mf.web and mp.web with
+ Hobby's floating-point C code. */
+
+/****************************************************************
+Copyright 1990 - 1995 by AT&T Bell Laboratories.
+
+Permission to use, copy, modify, and distribute this software
+and its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the names of AT&T Bell Laboratories or
+any of its entities not be used in advertising or publicity
+pertaining to distribution of the software without specific,
+written prior permission.
+
+AT&T disclaims all warranties with regard to this software,
+including all implied warranties of merchantability and fitness.
+In no event shall AT&T be liable for any special, indirect or
+consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract,
+negligence or other tortious action, arising out of or in
+connection with the use or performance of this software.
+****************************************************************/
+
+/**********************************************************
+ The following is by John Hobby
+ **********************************************************/
+
+#ifndef FIXPT
+
+/* These replacements for takefraction, makefraction, takescaled, makescaled
+ run about 3 to 11 times faster than the standard versions on modern machines
+ that have fast hardware for double-precision floating point. They should
+ produce approximately correct results on all machines and agree exactly
+ with the standard versions on machines that satisfy the following conditions:
+ 1. Doubles must have at least 46 mantissa bits; i.e., numbers expressible
+ as n*2^k with abs(n)<2^46 should be representable.
+ 2. The following should hold for addition, subtraction, and multiplcation but
+ not necessarily for division:
+ A. If the true answer is between two representable numbers, the computed
+ answer must be one of them.
+ B. When the true answer is representable, this must be the computed result.
+ 3. Dividing one double by another should always produce a relative error of
+ at most one part in 2^46. (This is why the mantissa requirement is
+ 46 bits instead of 45 bits.)
+ 3. In the absence of overflow, double-to-integer conversion should truncate
+ toward zero and do this in an exact fashion.
+ 4. Integer-to-double convesion should produce exact results.
+ 5. Dividing one power of two by another should yield an exact result.
+ 6. ASCII to double conversion should be exact for integer values.
+ 7. Integer arithmetic must be done in the two's-complement system.
+*/
+#define ELGORDO 0x7fffffff
+#define TWEXP31 2147483648.0
+#define TWEXP28 268435456.0
+#define TWEXP16 65536.0
+#define TWEXP_16 (1.0/65536.0)
+#define TWEXP_28 (1.0/268435456.0)
+
+integer
+ztakefraction P2C(integer, p, integer, q) /* Approximate p*q/2^28 */
+{ register double d;
+ register integer i;
+ d = (double)p * (double)q * TWEXP_28;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {
+ if (d!=TWEXP31 || (((p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && (((p&077777)*(q&077777))&040000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {
+ if (d!= -TWEXP31 || ((-(p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return -ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && ((-(p&077777)*(q&077777))&040000)!=0) ++i;
+ }
+ return i;
+}
+
+integer
+ztakescaled P2C(integer, p, integer, q) /* Approximate p*q/2^16 */
+{ register double d;
+ register integer i;
+ d = (double)p * (double)q * TWEXP_16;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {
+ if (d!=TWEXP31 || (((p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && (((p&077777)*(q&077777))&040000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {
+ if (d!= -TWEXP31 || ((-(p&077777)*(q&077777))&040000)==0)
+ aritherror = true;
+ return -ELGORDO;
+ }
+ i = (integer) d;
+ if (d==i && ((-(p&077777)*(q&077777))&040000)!=0) ++i;
+ }
+ return i;
+}
+
+/* Note that d cannot exactly equal TWEXP31 when the overflow test is made
+ because the exact value of p/q cannot be strictly between (2^31-1)/2^28
+ and 8/1. No pair of integers less than 2^31 has such a ratio.
+*/
+integer
+zmakefraction P2C(integer, p, integer, q) /* Approximate 2^28*p/q */
+{ register double d;
+ register integer i;
+#ifdef DEBUG
+ if (q==0) confusion(47);
+#endif /* DEBUG */
+ d = TWEXP28 * (double)p /(double)q;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {aritherror=true; return ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? -q : q)&077777)
+ * (((i&037777)<<1)-1) & 04000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {aritherror=true; return -ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? q : -q)&077777)
+ * (((i&037777)<<1)+1) & 04000)!=0) ++i;
+ }
+ return i;
+}
+
+/* Note that d cannot exactly equal TWEXP31 when the overflow test is made
+ because the exact value of p/q cannot be strictly between (2^31-1)/2^16
+ and 2^15/1. No pair of integers less than 2^31 has such a ratio.
+*/
+integer
+zmakescaled P2C(integer, p, integer, q) /* Approximate 2^16*p/q */
+{ register double d;
+ register integer i;
+#ifdef DEBUG
+ if (q==0) confusion(47);
+#endif /* DEBUG */
+ d = TWEXP16 * (double)p /(double)q;
+ if ((p^q) >= 0) {
+ d += 0.5;
+ if (d>=TWEXP31) {aritherror=true; return ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? -q : q)&077777)
+ * (((i&037777)<<1)-1) & 04000)!=0) --i;
+ } else {
+ d -= 0.5;
+ if (d<= -TWEXP31) {aritherror=true; return -ELGORDO;}
+ i = (integer) d;
+ if (d==i && ( ((q>0 ? q : -q)&077777)
+ * (((i&037777)<<1)+1) & 04000)!=0) ++i;
+ }
+ return i;
+}
+
+#endif /* not FIXPT */
+#endif /* not assembler */
+#endif /* not TeX, i.e., MF or MP */
+
+#ifdef MF
+/* On-line display routines for Metafont. Here we use a dispatch table
+ indexed by the MFTERM or TERM environment variable to select the
+ graphics routines appropriate to the user's terminal. stdout must be
+ connected to a terminal for us to do any graphics. */
+
+#ifdef MFNOWIN
+#undef AMIGAWIN
+#undef EPSFWIN
+#undef HP2627WIN
+#undef MFTALKWIN
+#undef NEXTWIN
+#undef REGISWIN
+#undef SUNWIN
+#undef TEKTRONIXWIN
+#undef UNITERMWIN
+#undef WIN32WIN
+#undef X11WIN
+#endif
+
+#ifdef AMIGAWIN
+extern int mf_amiga_initscreen P1H(void);
+extern void mf_amiga_updatescreen P1H(void);
+extern void mf_amiga_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_amiga_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef EPSFWIN
+extern int mf_epsf_initscreen P1H(void);
+extern void mf_epsf_updatescreen P1H(void);
+extern void mf_epsf_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_epsf_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef HP2627WIN
+extern int mf_hp2627_initscreen P1H(void);
+extern void mf_hp2627_updatescreen P1H(void);
+extern void mf_hp2627_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_hp2627_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef MFTALKWIN
+extern int mf_mftalk_initscreen P1H(void);
+extern void mf_mftalk_updatescreen P1H(void);
+extern void mf_mftalk_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_mftalk_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef NEXTWIN
+extern int mf_next_initscreen P1H(void);
+extern void mf_next_updatescreen P1H(void);
+extern void mf_next_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_next_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef REGISWIN
+extern int mf_regis_initscreen P1H(void);
+extern void mf_regis_updatescreen P1H(void);
+extern void mf_regis_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_regis_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef SUNWIN
+extern int mf_sun_initscreen P1H(void);
+extern void mf_sun_updatescreen P1H(void);
+extern void mf_sun_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_sun_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef TEKTRONIXWIN
+extern int mf_tektronix_initscreen P1H(void);
+extern void mf_tektronix_updatescreen P1H(void);
+extern void mf_tektronix_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_tektronix_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef UNITERMWIN
+extern int mf_uniterm_initscreen P1H(void);
+extern void mf_uniterm_updatescreen P1H(void);
+extern void mf_uniterm_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_uniterm_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef WIN32WIN
+extern int mf_win32_initscreen P1H(void);
+extern void mf_win32_updatescreen P1H(void);
+extern void mf_win32_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_win32_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+#ifdef X11WIN
+extern int mf_x11_initscreen P1H(void);
+extern void mf_x11_updatescreen P1H(void);
+extern void mf_x11_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_x11_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+#endif
+extern int mf_trap_initscreen P1H(void);
+extern void mf_trap_updatescreen P1H(void);
+extern void mf_trap_blankrectangle P4H(screencol, screencol, screenrow, screenrow);
+extern void mf_trap_paintrow P4H(screenrow, pixelcolor, transspec, screencol);
+
+
+/* This variable, `mfwsw', contains the dispatch tables for each
+ terminal. We map the Pascal calls to the routines `init_screen',
+ `update_screen', `blank_rectangle', and `paint_row' into the
+ appropriate entry point for the specific terminal that MF is being
+ run on. */
+
+struct mfwin_sw
+{
+ char *mfwsw_type; /* Name of terminal a la TERMCAP. */
+ int (*mfwsw_initscreen) P1H(void);
+ void (*mfwsw_updatescrn) P1H(void);
+ void (*mfwsw_blankrect) P4H(screencol, screencol, screenrow, screenrow);
+ void (*mfwsw_paintrow) P4H(screenrow, pixelcolor, transspec, screencol);
+} mfwsw[] =
+{
+#ifdef AMIGAWIN
+ { "amiterm", mf_amiga_initscreen, mf_amiga_updatescreen,
+ mf_amiga_blankrectangle, mf_amiga_paintrow },
+#endif
+#ifdef EPSFWIN
+ { "epsf", mf_epsf_initscreen, mf_epsf_updatescreen,
+ mf_epsf_blankrectangle, mf_epsf_paintrow },
+#endif
+#ifdef HP2627WIN
+ { "hp2627", mf_hp2627_initscreen, mf_hp2627_updatescreen,
+ mf_hp2627_blankrectangle, mf_hp2627_paintrow },
+#endif
+#ifdef MFTALKWIN
+ { "mftalk", mf_mftalk_initscreen, mf_mftalk_updatescreen,
+ mf_mftalk_blankrectangle, mf_mftalk_paintrow },
+#endif
+#ifdef NEXTWIN
+ { "next", mf_next_initscreen, mf_next_updatescreen,
+ mf_next_blankrectangle, mf_next_paintrow },
+#endif
+#ifdef REGISWIN
+ { "regis", mf_regis_initscreen, mf_regis_updatescreen,
+ mf_regis_blankrectangle, mf_regis_paintrow },
+#endif
+#ifdef SUNWIN
+ { "sun", mf_sun_initscreen, mf_sun_updatescreen,
+ mf_sun_blankrectangle, mf_sun_paintrow },
+#endif
+#ifdef TEKTRONIXWIN
+ { "tek", mf_tektronix_initscreen, mf_tektronix_updatescreen,
+ mf_tektronix_blankrectangle, mf_tektronix_paintrow },
+#endif
+#ifdef UNITERMWIN
+ { "uniterm", mf_uniterm_initscreen, mf_uniterm_updatescreen,
+ mf_uniterm_blankrectangle, mf_uniterm_paintrow },
+#endif
+#ifdef WIN32WIN
+ { "win32term", mf_win32_initscreen, mf_win32_updatescreen,
+ mf_win32_blankrectangle, mf_win32_paintrow },
+#endif
+#ifdef X11WIN
+ { "xterm", mf_x11_initscreen, mf_x11_updatescreen,
+ mf_x11_blankrectangle, mf_x11_paintrow },
+#endif
+
+ /* Always support this. */
+ { "trap", mf_trap_initscreen, mf_trap_updatescreen,
+ mf_trap_blankrectangle, mf_trap_paintrow },
+
+/* Finally, we must have an entry with a terminal type of NULL. */
+ { NULL, NULL, NULL, NULL, NULL }
+
+}; /* End of the array initialization. */
+
+
+/* This is a pointer to the mfwsw[] entry that we find. */
+static struct mfwin_sw *mfwp;
+
+
+/* The following are routines that just jump to the correct
+ terminal-specific graphics code. If none of the routines in the
+ dispatch table exist, or they fail, we produce trap-compatible
+ output, i.e., the same words and punctuation that the unchanged
+ mf.web would produce. */
+
+
+/* This returns true if we can do window operations, else false. */
+
+boolean
+initscreen P1H(void)
+{
+ /* If MFTERM is set, use it. */
+ const_string tty_type = kpse_var_value ("MFTERM");
+
+ if (tty_type == NULL)
+ {
+#if defined (AMIGA)
+ tty_type = "amiterm";
+#elif defined (WIN32)
+ tty_type = "win32term";
+#elif defined (OS2) || defined (__DJGPP__) /* not AMIGA nor WIN32 */
+ tty_type = "mftalk";
+#else /* not (OS2 or WIN32 or __DJGPP__ or AMIGA) */
+ /* If DISPLAY is set, we are X11; otherwise, who knows. */
+ boolean have_display = getenv ("DISPLAY") != NULL;
+ tty_type = have_display ? "xterm" : getenv ("TERM");
+
+ /* If we don't know what kind of terminal this is, or if Metafont
+ isn't being run interactively, don't do any online output. */
+ if (tty_type == NULL
+ || (!STREQ (tty_type, "trap") && !isatty (fileno (stdout))))
+ return 0;
+#endif /* not (OS2 or WIN32 or __DJGPP__ or AMIGA) */
+ }
+
+ /* Test each of the terminals given in `mfwsw' against the terminal
+ type, and take the first one that matches, or if the user is running
+ under Emacs, the first one. */
+ for (mfwp = mfwsw; mfwp->mfwsw_type != NULL; mfwp++) {
+ if (!strncmp (mfwp->mfwsw_type, tty_type, strlen (mfwp->mfwsw_type))
+ || STREQ (tty_type, "emacs"))
+ if (mfwp->mfwsw_initscreen)
+ return ((*mfwp->mfwsw_initscreen) ());
+ else {
+ fprintf (stderr, "mf: Couldn't initialize online display for `%s'.\n",
+ tty_type);
+ break;
+ }
+ }
+
+ /* We disable X support by default, since most sites don't use it, and
+ variations in X configurations seem impossible to overcome
+ automatically. Too frustrating for everyone involved. */
+ if (STREQ (tty_type, "xterm")) {
+ fputs ("\nmf: Window support for X was not compiled into this binary.\n",
+ stderr);
+ fputs ("mf: There may be a binary called `mfw' on your system which\n",
+ stderr);
+ fputs ("mf: does contain X window support.\n\n", stderr);
+ fputs ("mf: If you need to recompile, remember to give the --with-x\n",
+ stderr);
+ fputs ("mf: option to configure\n\n", stderr);
+ fputs ("mf: (Or perhaps you just failed to specify the mode.)\n", stderr);
+ }
+
+ /* The current terminal type wasn't found in any of the entries, or
+ initalization failed, so silently give up, assuming that the user
+ isn't on a terminal that supports graphic output. */
+ return 0;
+}
+
+
+/* Make sure everything is visible. */
+
+void
+updatescreen P1H(void)
+{
+ if (mfwp->mfwsw_updatescrn)
+ (*mfwp->mfwsw_updatescrn) ();
+}
+
+
+/* This sets the rectangle bounded by ([left,right], [top,bottom]) to
+ the background color. */
+
+void
+blankrectangle P4C(screencol, left, screencol, right,
+ screenrow, top, screenrow, bottom)
+{
+ if (mfwp->mfwsw_blankrect)
+ (*mfwp->mfwsw_blankrect) (left, right, top, bottom);
+}
+
+
+/* This paints ROW, starting with the color INIT_COLOR.
+ TRANSITION_VECTOR then specifies the length of the run; then we
+ switch colors. This goes on for VECTOR_SIZE transitions. */
+
+void
+paintrow P4C(screenrow, row, pixelcolor, init_color,
+ transspec, transition_vector, screencol, vector_size)
+{
+ if (mfwp->mfwsw_paintrow)
+ (*mfwp->mfwsw_paintrow) (row, init_color, transition_vector, vector_size);
+}
+#endif /* MF */
diff --git a/Build/source/texk/web2c/lib/uexit.c b/Build/source/texk/web2c/lib/uexit.c
new file mode 100644
index 00000000000..21f34ded35f
--- /dev/null
+++ b/Build/source/texk/web2c/lib/uexit.c
@@ -0,0 +1,20 @@
+/* uexit.c: define uexit to do an exit with the right status. We can't
+ just call `exit' from the web files, since the webs use `exit' as a
+ loop label. Public domain. */
+
+#include "config.h"
+
+void
+uexit P1C(int, unix_code)
+{
+ int final_code;
+
+ if (unix_code == 0)
+ final_code = EXIT_SUCCESS;
+ else if (unix_code == 1)
+ final_code = EXIT_FAILURE;
+ else
+ final_code = unix_code;
+
+ exit (final_code);
+}
diff --git a/Build/source/texk/web2c/lib/usage.c b/Build/source/texk/web2c/lib/usage.c
new file mode 100644
index 00000000000..194cc73c84d
--- /dev/null
+++ b/Build/source/texk/web2c/lib/usage.c
@@ -0,0 +1,35 @@
+/* usage.c: Output a help message (from help.h).
+
+ Modified in 2001 by O. Weber.
+ Written in 1995 by K. Berry. Public domain. */
+
+#include "config.h"
+
+/* Call usage if the program exits with an "usage error". STR is supposed
+ to be the program name. */
+
+void
+usage P1C(const_string, str)
+{
+ fprintf (stderr, "Try `%s --help' for more information.\n", str);
+ uexit (1);
+}
+
+/* Call usage if the program exits by printing the help message.
+ MESSAGE is an NULL-terminated array or strings which make up the
+ help message. Each string is printed on a separate line.
+ We use arrays instead of a single string to work around compiler
+ limitations (sigh).
+*/
+void
+usagehelp P2C(const_string*, message, const_string,bug_email)
+{
+ if (!bug_email)
+ bug_email = "tex-k@mail.tug.org";
+ while (*message) {
+ printf("%s\n", *message);
+ ++message;
+ }
+ printf("\nEmail bug reports to %s.\n", bug_email);
+ uexit(0);
+}
diff --git a/Build/source/texk/web2c/lib/version.c b/Build/source/texk/web2c/lib/version.c
new file mode 100644
index 00000000000..8c7efb17cc9
--- /dev/null
+++ b/Build/source/texk/web2c/lib/version.c
@@ -0,0 +1,6 @@
+#include "c-auto.h"
+
+/* This string is appended to all the banners and used in --version. */
+/* Public domain. */
+
+char *versionstring = WEB2CVERSION;
diff --git a/Build/source/texk/web2c/lib/win32.mak b/Build/source/texk/web2c/lib/win32.mak
new file mode 100644
index 00000000000..44b9ef118aa
--- /dev/null
+++ b/Build/source/texk/web2c/lib/win32.mak
@@ -0,0 +1,62 @@
+################################################################################
+#
+# Makefile : Web2C / library
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <02/10/26 18:58:43 popineau>
+#
+################################################################################
+root_srcdir=..\..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+USE_KPATHSEA = 1
+USE_GNUW32 = 1
+USE_TEX = 1
+
+!include <msvc/common.mak>
+
+DEFS = -I.. $(DEFS) -DMAKE_TEX_DLL -DHAVE_CONFIG_H -DOEM \
+ -DJOBTIME -DTIME_STATS \
+ -DOUTPUT_DIR -DHALT_ON_ERROR
+
+library = lib
+
+# We don't make `texmfmp.o', since TeX, Metafont, and MetaPost need to
+# use different routine names, hence they need different .o files. Maybe
+# we should change this via #define's someday ...
+objects = \
+ $(objdir)\basechsuffix.obj \
+ $(objdir)\oem.obj \
+ $(objdir)\chartostring.obj \
+ $(objdir)\coredump.obj \
+ $(objdir)\eofeoln.obj \
+ $(objdir)\fprintreal.obj \
+ $(objdir)\inputint.obj \
+ $(objdir)\input2int.obj \
+ $(objdir)\main.obj \
+ $(objdir)\openclose.obj \
+ $(objdir)\printversion.obj \
+ $(objdir)\uexit.obj \
+ $(objdir)\usage.obj \
+ $(objdir)\version.obj \
+ $(objdir)\zround.obj
+
+default: all
+
+all: $(objdir) $(objdir)\$(library).lib
+
+$(objdir)\$(library).lib: $(objects)
+ $(archive) $(objects)
+
+!include <msvc/install.mak>
+!include <msvc/clean.mak>
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+# Local Variables:
+# mode: Makefile
+# End:
diff --git a/Build/source/texk/web2c/lib/win32main.c b/Build/source/texk/web2c/lib/win32main.c
new file mode 100644
index 00000000000..aa1c1f865d7
--- /dev/null
+++ b/Build/source/texk/web2c/lib/win32main.c
@@ -0,0 +1,30 @@
+#include "config.h"
+
+/* The entry point: set up for reading the command line, which will
+ happen in `topenin', then call the main body. Public domain. */
+
+extern TEXDLL void mainbody P1H(void);
+extern TEXDLL void maininit P2H(int, string *);
+
+int
+main P2C(int, ac, string *, av)
+{
+#ifdef __EMX__
+ _wildcard (&ac, &av);
+ _response (&ac, &av);
+#endif
+
+#if defined(WIN32)
+ /* if _DEBUG is not defined, these macros will result in nothing. */
+ SETUP_CRTDBG;
+ /* Set the debug-heap flag so that freed blocks are kept on the
+ linked list, to catch any inadvertent use of freed memory */
+ SET_CRT_DEBUG_FIELD( _CRTDBG_DELAY_FREE_MEM_DF );
+#endif
+
+ maininit(ac, av);
+
+ /* Call the real main program. */
+ mainbody ();
+ return EXIT_SUCCESS;
+}
diff --git a/Build/source/texk/web2c/lib/zround.c b/Build/source/texk/web2c/lib/zround.c
new file mode 100644
index 00000000000..1df2e5d5c96
--- /dev/null
+++ b/Build/source/texk/web2c/lib/zround.c
@@ -0,0 +1,41 @@
+/* zround.c: round R to the nearest whole number. This is supposed to
+ implement the predefined Pascal round function. Public domain. */
+
+#include "config.h"
+
+integer
+zround P1C(double, r)
+{
+ integer i;
+
+ /* R can be outside the range of an integer if glue is stretching or
+ shrinking a lot. We can't do any better than returning the largest
+ or smallest integer possible in that case. It doesn't seem to make
+ any practical difference. Here is a sample input file which
+ demonstrates the problem, from phil@cs.arizona.edu:
+ \documentstyle{article}
+ \begin{document}
+ \begin{flushleft}
+ $\hbox{} $\hfill
+ \filbreak
+ \eject
+
+ djb@silverton.berkeley.edu points out we should testing against
+ TeX's largest or smallest integer (32 bits), not the machine's. So
+ we might as well use a floating-point constant, and avoid potential
+ compiler bugs (also noted by djb, on BSDI). */
+ if (r > 2147483647.0)
+ i = 2147483647;
+ /* should be ...8, but atof bugs are too common */
+ else if (r < -2147483647.0)
+ i = -2147483647;
+ /* Admittedly some compilers don't follow the ANSI rules of casting
+ meaning truncating toward zero; but it doesn't matter enough to do
+ anything more complicated here. */
+ else if (r >= 0.0)
+ i = (integer)(r + 0.5);
+ else
+ i = (integer)(r - 0.5);
+
+ return i;
+}