summaryrefslogtreecommitdiff
path: root/Build/source/texk/makeindexk
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/makeindexk
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/makeindexk')
-rw-r--r--Build/source/texk/makeindexk/ACK17
-rw-r--r--Build/source/texk/makeindexk/CONTRIB24
-rw-r--r--Build/source/texk/makeindexk/COPYING42
-rw-r--r--Build/source/texk/makeindexk/ChangeLog36
-rw-r--r--Build/source/texk/makeindexk/FILES38
-rw-r--r--Build/source/texk/makeindexk/INSTALL181
-rw-r--r--Build/source/texk/makeindexk/Makefile.in53
-rw-r--r--Build/source/texk/makeindexk/NEWS3
-rw-r--r--Build/source/texk/makeindexk/NOTES84
-rw-r--r--Build/source/texk/makeindexk/PORTING11
-rw-r--r--Build/source/texk/makeindexk/README160
-rw-r--r--Build/source/texk/makeindexk/acconfig.h6
-rw-r--r--Build/source/texk/makeindexk/c-auto.in19
-rwxr-xr-xBuild/source/texk/makeindexk/configure1805
-rw-r--r--Build/source/texk/makeindexk/configure.in18
-rw-r--r--Build/source/texk/makeindexk/depend.mak27
-rw-r--r--Build/source/texk/makeindexk/depend.mk63
-rw-r--r--Build/source/texk/makeindexk/genind.c498
-rw-r--r--Build/source/texk/makeindexk/genind.h58
-rw-r--r--Build/source/texk/makeindexk/makeindex.11203
-rw-r--r--Build/source/texk/makeindexk/makeindex.rc37
-rw-r--r--Build/source/texk/makeindexk/mkind.c570
-rw-r--r--Build/source/texk/makeindexk/mkind.h586
-rwxr-xr-xBuild/source/texk/makeindexk/mkindex39
-rw-r--r--Build/source/texk/makeindexk/mkindex.142
-rw-r--r--Build/source/texk/makeindexk/qsort.c222
-rw-r--r--Build/source/texk/makeindexk/scanid.c837
-rw-r--r--Build/source/texk/makeindexk/scanid.h135
-rw-r--r--Build/source/texk/makeindexk/scanst.c613
-rw-r--r--Build/source/texk/makeindexk/scanst.h195
-rw-r--r--Build/source/texk/makeindexk/sortid.c345
-rw-r--r--Build/source/texk/makeindexk/stamp-auto.in1
-rw-r--r--Build/source/texk/makeindexk/win32.mak56
33 files changed, 8024 insertions, 0 deletions
diff --git a/Build/source/texk/makeindexk/ACK b/Build/source/texk/makeindexk/ACK
new file mode 100644
index 00000000000..870339c54bb
--- /dev/null
+++ b/Build/source/texk/makeindexk/ACK
@@ -0,0 +1,17 @@
+ Acknowledgements
+
+The author would like to thank the copyright holders for agreeing to
+release MakeIndex to the public domain and for allowing the author to
+continue his support for this software.
+
+The author would also like to express his gratitude to the users of
+MakeIndex for reporting bugs, and in many instances, for fixing them.
+In particular, thanks must go to the contributors who have made
+substantial contributions to the MakeIndex software. Their names are
+listed in the CONTRIB file which comes with this release.
+
+
+
+ Pehong Chen
+ 11/11/1989
+
diff --git a/Build/source/texk/makeindexk/CONTRIB b/Build/source/texk/makeindexk/CONTRIB
new file mode 100644
index 00000000000..a6ff1918ac5
--- /dev/null
+++ b/Build/source/texk/makeindexk/CONTRIB
@@ -0,0 +1,24 @@
+Key contributors of this MakeIndex distribution include
+
+ Pehong Chen chen@renoir.berkeley.edu
+ Leslie Lamport lamport@src.dec.com
+
+and, in reverse alphabetical order by last name,
+
+ Klaus Zuenkler kl%falke@ztivax.siemens.com
+ Martha Wershofen-Mersbach grztex%dbngmd21.bitnet@net.bio.net
+ Art Werschulz werschulz@cs.columbia.edu
+ Ed Sznyter ews@pescadero.stanford.edu
+ Joachim Schrod schrod@iti.informatik.th-darmstadt.de
+ Rainer Schoepf schoepf@sc.zib-berlin.de
+ Rick Rodgers rodgers@maxwell.mmwb.ucsf.edu
+ Sebastian Rahtz spqr@ecs.southampton.ac.uk
+ Eberhard Mattes mattes@azu.informatik.uni-stuttgart.de
+ Charles Karney karney%ppc.mfenet@nmfecc.arpa
+ Mark James mark@bdblues.altair.fr
+ Anita Hoover anita@brahms.udel.edu
+ Michael Harrison harrison@berkeley.edu
+ Baron Grey baron@cs.ucla.edu
+ Andreas Brosig brosig@gmdzi.gmd.de
+ Johannes Braams braams@hlsdnl5.bitnet
+ Nelson Beebe beebe@math.utah.edu
diff --git a/Build/source/texk/makeindexk/COPYING b/Build/source/texk/makeindexk/COPYING
new file mode 100644
index 00000000000..20c03550f35
--- /dev/null
+++ b/Build/source/texk/makeindexk/COPYING
@@ -0,0 +1,42 @@
+
+ MakeIndex Distribution Notice
+
+ 11/11/1989
+
+ Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ Copyright (C) 1988 by Olivetti Research Center
+ Copyright (C) 1987 by Regents of the University of California
+
+ Author:
+ Pehong Chen (phc@renoir.berkeley.edu)
+ Chen & Harrison International Systems, Inc.
+ Palo Alto, California
+ USA
+
+Permission is hereby granted to make and distribute original copies of
+this program provided that the copyright notice and this permission
+notice are preserved and provided that the recipient is not asked to
+waive or limit his right to redistribute copies as allowed by this
+permission notice and provided that anyone who receives an executable
+form of this program is granted access to a machine-readable form of
+the source code for this program at a cost not greater than reasonable
+reproduction, shipping, and handling costs. Executable forms of this
+program distributed without the source code must be accompanied by a
+conspicuous copy of this permission notice and a statement that tells
+the recipient how to obtain the source code.
+
+Permission is granted to distribute modified versions of all or part
+of this program under the conditions above with the additional
+requirement that the entire modified work must be covered by a
+permission notice identical to this permission notice. Anything
+distributed with and usable only in conjunction with something derived
+from this program, whose useful purpose is to extend or adapt or add
+capabilities to this program, is to be considered a modified version
+of this program under the requirement above. Ports of this program to
+other systems not supported in the distribution are also considered
+modified versions. All modified versions should be reported back to
+the author.
+
+This program is distributed with no warranty of any sort. No
+contributor accepts responsibility for the consequences of using this
+program or for whether it serves any particular purpose.
diff --git a/Build/source/texk/makeindexk/ChangeLog b/Build/source/texk/makeindexk/ChangeLog
new file mode 100644
index 00000000000..4c706ea9cda
--- /dev/null
+++ b/Build/source/texk/makeindexk/ChangeLog
@@ -0,0 +1,36 @@
+Sa Sep 25 22:25:15 CEST 2004
+ * set locale according to LC_CTYPE in genind.c for correct
+ tolower() behaviour
+
+1998-10-22 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * mkind.h [DOSISH] (ENV_SEPAR, DIR_DELIM, ALT_DIR_DELIM,
+ IS_DIR_DELIM): Define.
+
+ * mkind.c (main, check_idx): If ALT_DIR_DELIM is defined, use it
+ in addition to DIR_DELIM to find the basename.
+
+Fri Jan 30 13:05:22 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * mkindex: make executable (Thomas Esser)
+
+Tue Jan 27 14:32:25 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * configure etc: new configure.in, c-auto.in, Makefile.in from
+ Olaf Weber
+
+Tue Jan 20 10:13:57 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * added check of function prototypes to c-auto.in
+
+Thu Jan 1 11:10:15 1998 Sebastian Rahtz <s.rahtz@elsevier.co.uk>
+
+ * A placeholder to note texk7-2 version, changed configure.in at
+ least
+
+Sat Mar 8 13:44:45 MET 1997:
+ - removed non-UNIX code
+ - added GNU autoconf support
+ - added Kpathsea support based on a patch from
+ Matthias Clasen (stu30917@mail.uni-kiel.d400.de)
+ - changed version number to 2.13
diff --git a/Build/source/texk/makeindexk/FILES b/Build/source/texk/makeindexk/FILES
new file mode 100644
index 00000000000..c683e53ee0e
--- /dev/null
+++ b/Build/source/texk/makeindexk/FILES
@@ -0,0 +1,38 @@
+ ----- Files sent under Automatic Mail Distribution -----
+
+ Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ Copyright (C) 1988 by Olivetti Research Center
+ Copyright (C) 1987 by Regents of the University of California
+
+If you receive MakeIndex by ftp or from any distribution tape, you can
+ignore this file because you should have the complete version. This
+file explains what you should receive by mail on a file by file basis.
+There is a shell script that will send the files listed below to you
+automatically. This facility is intended for people with no access to
+other distribution channels.
+
+What follows is a subset of the current MakeIndex distribution. It
+contains the following files for important info about MakeIndex:
+
+FILES README CONTRIB ACK COPYING PORTING
+
+This distribution includes the file test.tex, which is a documentation
+written by Leslie Lamport on the use of MakeIndex with LaTeX. Nelson
+Beebe added index terms to the document, so that you can try out
+MakeIndex with the test.idx file generated by running LaTeX on
+test.tex. Also included is makeindex.l, which is a UNIX man page on
+the general use of MakeIndex.
+
+You should also receice the following files, which comprise the full
+MakeIndex source directory.
+
+ Makefile.kcc Makefile.vms mkind.c scanid.h
+ Makefile.msc VMSmake.com mkind.h scanst.c
+LOG Makefile.pcc genind.c qsort.c scanst.h
+Makefile Makefile.unx genind.h scanid.c sortid.c
+
+Altogether, you should receive 26 messages, each containing one file,
+from this automatic mail distribution of MakeIndex.
+
+ Pehong Chen
+ 10/11/1989
diff --git a/Build/source/texk/makeindexk/INSTALL b/Build/source/texk/makeindexk/INSTALL
new file mode 100644
index 00000000000..eba1e0d6dc5
--- /dev/null
+++ b/Build/source/texk/makeindexk/INSTALL
@@ -0,0 +1,181 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes a while. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/Build/source/texk/makeindexk/Makefile.in b/Build/source/texk/makeindexk/Makefile.in
new file mode 100644
index 00000000000..b47d547e2a7
--- /dev/null
+++ b/Build/source/texk/makeindexk/Makefile.in
@@ -0,0 +1,53 @@
+# Makefile for makeindexk --te@dbs.uni-hannover.de. Public domain.
+version = 2.13
+
+kpse_include ../make/paths.mk
+kpse_include ../make/common.mk
+kpse_include ../make/programs.mk
+
+objects = genind.o mkind.o qsort.o scanid.o scanst.o sortid.o
+program = makeindex
+programs = $(program)
+
+default all: $(programs)
+
+$(program): $(kpathsea) $(objects)
+ $(kpathsea_link) $(objects) $(LOADLIBES)
+kpse_include ../make/tkpathsea.mk
+
+install: install-exec install-data
+uninstall: uninstall-exec uninstall-data
+
+install-exec: $(programs)
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
+ $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
+ $(INSTALL_SCRIPT) $(srcdir)/mkindex $(scriptdir)/mkindex
+uninstall-exec:
+ cd $(bindir) && rm -f $(program)
+ cd $(scriptdir) && rm -f mkindex
+
+install-data: makeindex.1
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir)
+ $(INSTALL_DATA) $(srcdir)/makeindex.1 $(man1dir)/makeindex.$(manext)
+ $(INSTALL_DATA) $(srcdir)/mkindex.1 $(man1dir)/mkindex.$(manext)
+
+uninstall-data:
+
+distname = makeindex
+program_files =
+version_files =
+
+pre-dist-$(distname):
+post-dist-$(distname):
+
+kpse_include ../make/dist.mk
+kpse_include ../make/config.mk
+
+info dvi check:
+
+kpse_include ../make/clean.mk
+
+distclean::
+
+kpse_include ../make/rdepend.mk
+kpse_include depend.mk
diff --git a/Build/source/texk/makeindexk/NEWS b/Build/source/texk/makeindexk/NEWS
new file mode 100644
index 00000000000..7bccf44ae40
--- /dev/null
+++ b/Build/source/texk/makeindexk/NEWS
@@ -0,0 +1,3 @@
+Sat Mar 8 13:44:45 MET 1997:
+ - added GNU autoconf support
+ - added Kpathsea support for .ist files
diff --git a/Build/source/texk/makeindexk/NOTES b/Build/source/texk/makeindexk/NOTES
new file mode 100644
index 00000000000..ca81552fe53
--- /dev/null
+++ b/Build/source/texk/makeindexk/NOTES
@@ -0,0 +1,84 @@
+ Investigation of Size Reduction in MakeIndex
+ [25-Jul-1991]
+
+Joachim Schrod in his work on MakeIndex 3.0 (to be reported at
+EuroTeX'91 in Paris, September 1991) found that substantial
+storage economizations in MakeIndex are possible by dynamically
+allocating some arrays. Since that version is not yet available, it
+seemed worthwhile to try to apply such changes to version 2.10, making
+version 2.11.
+
+The major memory consumption in MakeIndex is by the arrays af[][] and
+sf[][] in
+
+#define FIELD_MAX 3
+#define STRING_MAX 256
+
+typedef struct KFIELD
+{
+ char sf[FIELD_MAX][STRING_MAX]; /* sort key */
+ char af[FIELD_MAX][STRING_MAX]; /* actual key */
+...
+} FIELD, *FIELD_PTR;
+
+These arrays are referenced in genind.c, scanid.c, and sortid.c. They
+are defined in mkind.h, and initialized to empty strings in scanid.c.
+
+Each index entry has one such struct KFIELD slot, and with current
+dimension limits, sizeof(FIELD) == 1844. book.idx has 4241 index
+entries, so we need 1844*4241 = 7820404 bytes of dynamic storage.
+However, book.idx is only 142027 bytes long, and in entry, 16
+characters ("\indexentry{}{}") need not be stored; the true storage
+requirement is therefore 142027 - 4241*16 = 74171 so 99.05% of the
+storage is being wasted,
+
+After sorting and removal of duplicate lines, book.idx reduces to
+85935 bytes and 2531 entries, so the actual storage required is
+1844*2531 = 4667164 bytes; the wastage is still high: 98.4%.
+
+If we change to
+
+typedef struct KFIELD
+{
+ char *sf[FIELD_MAX]; /* sort key */
+ char *af[FIELD_MAX]; /* actual key */
+...
+} FIELD, *FIELD_PTR;
+
+then sizeof(FIELD) = 332, and the required storage is 332*2531 =
+840292 bytes. This is still too large for an IBM PC. However, KFIELD
+also contains
+
+ char encap[STRING_MAX]; /* encapsulator */
+
+and that field is only rarely used, so by dynamically allocating it
+when needed, we can reduce the KFIELD node storage by 256 - 4 = 252
+bytes, reducing sizeof(FIELD) to 80 bytes. For book.idx, we then need
+80*2531 = 202480 bytes, and that should be small enough to run on the
+PC.
+
+encap is used in genind.c, scanid.c, and sortid.c, and defined in
+mkind.h.
+
+We can handle dynamic allocation of af[] and sf[] three ways: (1)
+initialize them both to (char*)NULL, then allocate space as needed,
+(2) initialize them both to calloc(1), and (3) initialize them both to
+a constant empty string, "". MakeIndex makes many references to the
+first character (*af[i] or af[i][0]), the first scheme would require
+many changes to avoid dereferencing NULL pointers. The second scheme
+would not have this problem, but would require a lot of overhead in
+malloc'ing 1-character blocks. The third scheme seems the best
+choice, and requires few changes; no free() or realloc() calls are
+made by MakeIndex, so we need take no precautions about attempting to
+free or reallocate constant string storage.
+
+Examination of the code in genind.c, scanid.c, and sortid.c which
+references af[] and sf[] shows that changes are needed only in
+scanid.c, where we introduce a new function, make_string(), to handle
+the dynamic allocation of strings when needed. Similarly, of the
+encap[] uses in genind.c, scanid.c, and sortid.c, only scanid.c needs
+changes. The definition of struct KFIELD in mkind.h must be updated
+so that af, sf, and encap become pointers to strings, rather than
+arrays of characters.
+
+
diff --git a/Build/source/texk/makeindexk/PORTING b/Build/source/texk/makeindexk/PORTING
new file mode 100644
index 00000000000..2f6daaf653e
--- /dev/null
+++ b/Build/source/texk/makeindexk/PORTING
@@ -0,0 +1,11 @@
+ ----- MakeIndex Porting Note -----
+
+You are welcome and encouraged to port MakeIndex to any system not
+support under the current distribution. The standard way of doing
+that is by adding patches with enclosed #ifdef ... #endif pairs. You
+can invent your own variables with the OS_ prefix attached in the
+front. Please report your port back to me, so that I can make it
+available to other people.
+
+ Pehong Chen
+ 11/11/1989
diff --git a/Build/source/texk/makeindexk/README b/Build/source/texk/makeindexk/README
new file mode 100644
index 00000000000..0ae677040f8
--- /dev/null
+++ b/Build/source/texk/makeindexk/README
@@ -0,0 +1,160 @@
+------------------------------------------------------------------------------
+ MakeIndex General Release Information
+
+ Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ Copyright (C) 1988 by Olivetti Research Center
+ Copyright (C) 1987 by Regents of the University of California
+
+ Author: Pehong Chen
+
+MakeIndex is a general purpose index processor. This release contains
+a FILES file, this README file, a CONTRIB file, an ACK file, a COPYING
+notice, a brief PORTING instruction, a doc directory, a paper
+directory, a src directory, a lib directory, and a test directory.
+
+------------------------------------------------------------------------------
+Everyone should read COPYING before installing or distributing MakeIndex.
+
+------------------------------------------------------------------------------
+The CONTRIB file lists the names of people who have contributed to
+to this release.
+
+------------------------------------------------------------------------------
+The ACK file contains the author's acknowledgements.
+
+------------------------------------------------------------------------------
+FILES is a note to people receiving MakeIndex from the automatic mail
+distribution, which is done by the shell script "auto".
+
+------------------------------------------------------------------------------
+PORTING contains some information for people interested in porting
+MakeIndex to systems not supported under the current distribution.
+
+------------------------------------------------------------------------------
+The doc directory contains
+
+deblank.awk AWK script used in the Makefile steps
+
+makeindex.hlp ASCII version of makeindex.l
+
+makeindex.info an Emacs (TOPS-20 and GNU) INFO node produced
+ automatically from makeindex.vms by vmshelp2
+ (available from Utah)
+
+makeindex.l a UNIX man page
+
+makeindex.ps PostScript translation of makeindex.l
+
+makeindex.tex documentation for the use under LaTeX
+ by Leslie Lamport
+
+makeindex.vms VAX/VMS equivalent of makeindex.l suitable
+ for inclusion in a local help library
+
+------------------------------------------------------------------------------
+For a detailed discussion on the design of MakeIndex, please read
+
+ Pehong Chen and Michael Harrison, ``Automating Index Preparation'',
+ Tech. Report No. 87/347, Computer Science Division,
+ University of California, Berkeley, March 1987.
+
+A version of this report is included in the paper directory. A
+somewhat condensed version entitled
+
+ ``Index Preparation and Processing''
+
+appears in Software: Practice and Experience, 18(9):897-915, September 1988.
+
+------------------------------------------------------------------------------
+
+The src directory contains the C source of MakeIndex. This current
+version is known to compile and run on UNIX (BSD and System V, cc and
+gcc), VAX/VMS (VMS cc), TOPS-20 (kcc-20 and pcc-20), and IBM PC DOS
+(Microsoft C Version 5.0, Turbo C Version 2.0), Atari ST, Siemens
+BS2000 (CCD-2000), and IBM MVS/XA (IBM-C370). Consult the files
+README and LOG in the src directory for further details.
+
+Type make to compile under BSD UNIX. Makefiles or command scripts for
+the other operating systems are included as well. Implementations of
+Make for them are available as part of the Utah DVI driver
+distribution (send e-mail to beebe@math.utah.edu).
+
+Early porting work was carried out by Charles Karney
+(karney%ppc.mfenet@nmfecc.arpa) at Princeton University and David J.
+Buerger (dbeurger%scu.bitnet@jade.berkeley.edu) at University of Santa
+Clara. These efforts were independent of the port to PC DOS, TOPS-20,
+VAX VMS, and the draft-ANSI C environment for version 2.3 carried out
+by Nelson H.F. Beebe (beebe@math.utah.edu). That port is described
+in the file LOG in the src directory.
+
+------------------------------------------------------------------------------
+The lib directory contains the file idxmac.tex, which is an excerpt of
+LaTeX's macros for indexing. This file can be included in plain TeX
+documents to generate the .idx file. Similarly, the file
+idxmac-amstex.tex can be used with AmSTeX. Some hacking may be
+necessary to incorporate it with other dialects. Some people have
+complained not having the LaTeX sty file mentioned in
+doc/makeindex.tex in their library, so a copy of makeidx.sty and
+makeidx.doc is also included in the lib directory.
+
+The file showidx.sty provides a LaTeX document style option that
+records index references on each page in marginal notes; this
+facilitates checking that important phrases have been indexed, without
+the need to continually consult the index.
+
+------------------------------------------------------------------------------
+The test directory contains several sets of test files:
+
+b209*.idx Miscellaneous tests that uncovered bugs at
+ makeindex version 2.09 which were fixed for
+ version 2.10.
+
+book.idx Raw index generated from ``The Technology War'',
+ David Brandin and Michael Harrison,
+ John Wiley and Sons, New York, 1988.
+
+tort.idx a host of odd raw index entries
+
+test.tex, test.idx a version of doc/makeindex.tex (due to Leslie
+ Lamport) that incorporates index entries
+ (prepared by Nelson Beebe).
+ This can be used both to test MakeIndex, as well as to
+ illustrate the production of an index for new users.
+ Read src/README for more info.
+
+ok-*.inx, ok-*.ilg Correct output for files without the ok- prefix.
+
+Makefile UNIX makefile to run regression tests on
+ ../src/makeindex
+
+vmsdiff.com VAX VMS command file to run differences; its
+ definition of the symbol MAKEINDEX must be
+ adapted for each site, since VAX VMS foreign
+ command symbols require an absolute file
+ directory name.
+
+------------------------------------------------------------------------------
+The troff directory contains
+
+troff.ist a sample style file
+ixmac defines macros to be used for indexing under troff
+sample.txt a sample troff document with embedded index commands
+sample.idx raw index file
+sample.ind the pre-formatted index file
+makeind a shell script that creates the raw index file (.idx),
+ invokes makeindex which creates the final index file
+ (.ind). Note that
+ makeind sample.txt
+ will create sample.idx, sample.ilg, and sample.ind.
+
+------------------------------------------------------------------------------
+ Pehong Chen
+ 11-Nov-1989
+
+ Nelson H.F. Beebe
+ 28-Jan-1988, 05-Jul-1991
+
+ Joachim Schrod
+ 21-Jun-1990
+
+------------------------------------------------------------------------------
diff --git a/Build/source/texk/makeindexk/acconfig.h b/Build/source/texk/makeindexk/acconfig.h
new file mode 100644
index 00000000000..67e51bad4ab
--- /dev/null
+++ b/Build/source/texk/makeindexk/acconfig.h
@@ -0,0 +1,6 @@
+/* acconfig.h -- used by autoheader when generating c-auto.in.
+
+ If you're thinking of editing acconfig.h to fix a configuration
+ problem, don't. Edit the c-auto.h file created by configure,
+ instead. Even better, fix configure to give the right answer. */
+
diff --git a/Build/source/texk/makeindexk/c-auto.in b/Build/source/texk/makeindexk/c-auto.in
new file mode 100644
index 00000000000..23dd30d3514
--- /dev/null
+++ b/Build/source/texk/makeindexk/c-auto.in
@@ -0,0 +1,19 @@
+/* c-auto.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the strchr function. */
+#undef HAVE_STRCHR
+
+/* Define if you have the strrchr function. */
+#undef HAVE_STRRCHR
+
+/* Define if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <types.h> header file. */
+#undef HAVE_TYPES_H
diff --git a/Build/source/texk/makeindexk/configure b/Build/source/texk/makeindexk/configure
new file mode 100755
index 00000000000..af1e552ca16
--- /dev/null
+++ b/Build/source/texk/makeindexk/configure
@@ -0,0 +1,1805 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --without-mktexmf-default do not run mktexmf if MF source missing"
+ac_help="$ac_help
+ --without-mktexpk-default do not run mktexpk if PK font missing"
+ac_help="$ac_help
+ --without-mktextfm-default do not run mktextfm if TFM file missing"
+ac_help="$ac_help
+ --without-mkocp-default do not run mkocp if OCP file missing"
+ac_help="$ac_help
+ --without-mkofm-default do not run mkofm if OFM file missing"
+ac_help="$ac_help
+ --with-mktexfmt-default run mktexfmt if format file missing"
+ac_help="$ac_help
+ --with-mktextex-default run mktextex if TeX source missing"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+ac_config_files=
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; }
+ fi
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=mkind.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:559: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:590: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:642: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:675: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 686 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:722: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:750: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:818: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ # Hack for MSDOS and descendants.
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test $ac_x $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:873: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:900: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+# MS-DOS is a special case, because it sort of pretends that ln -s
+# works for executables.
+if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:925: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+ if test "x$USE_MAINTAINER_MODE" = xyes; then
+ MAINT=
+ else
+ MAINT='#M#'
+ fi
+
+
+
+echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6
+echo "configure:944: checking for loader (symbol LD)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$LD" && LD=ld
+cf_cv_subst_LD=$LD
+fi
+
+LD=${cf_cv_subst_LD}
+echo "$ac_t""$LD" 1>&6
+
+
+echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6
+echo "configure:958: checking for archiver (symbol AR)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$AR" && AR=ar
+cf_cv_subst_AR=$AR
+fi
+
+AR=${cf_cv_subst_AR}
+echo "$ac_t""$AR" 1>&6
+
+
+echo $ac_n "checking for archiver options (symbol ARFLAGS)""... $ac_c" 1>&6
+echo "configure:972: checking for archiver options (symbol ARFLAGS)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_ARFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$ARFLAGS" && ARFLAGS=rc
+cf_cv_subst_ARFLAGS=$ARFLAGS
+fi
+
+ARFLAGS=${cf_cv_subst_ARFLAGS}
+echo "$ac_t""$ARFLAGS" 1>&6
+
+
+
+# Check whether --with-mktexmf-default or --without-mktexmf-default was given.
+if test "${with_mktexmf_default+set}" = set; then
+ withval="$with_mktexmf_default"
+ :
+else
+ with_mktexmf_default=yes
+fi
+
+# Check whether --with-mktexpk-default or --without-mktexpk-default was given.
+if test "${with_mktexpk_default+set}" = set; then
+ withval="$with_mktexpk_default"
+ :
+else
+ with_mktexpk_default=yes
+fi
+
+# Check whether --with-mktextfm-default or --without-mktextfm-default was given.
+if test "${with_mktextfm_default+set}" = set; then
+ withval="$with_mktextfm_default"
+ :
+else
+ with_mktextfm_default=yes
+fi
+
+# Check whether --with-mkocp-default or --without-mkocp-default was given.
+if test "${with_mkocp_default+set}" = set; then
+ withval="$with_mkocp_default"
+ :
+else
+ with_mkocp_default=yes
+fi
+
+# Check whether --with-mkofm-default or --without-mkofm-default was given.
+if test "${with_mkofm_default+set}" = set; then
+ withval="$with_mkofm_default"
+ :
+else
+ with_mkofm_default=yes
+fi
+
+# Check whether --with-mktexfmt-default or --without-mktexfmt-default was given.
+if test "${with_mktexfmt_default+set}" = set; then
+ withval="$with_mktexfmt_default"
+ :
+fi
+
+# Check whether --with-mktextex-default or --without-mktextex-default was given.
+if test "${with_mktextex_default+set}" = set; then
+ withval="$with_mktextex_default"
+ with_mktextex_default=yes
+else
+ with_mktextex_default=no
+fi
+
+
+echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6
+echo "configure:1042: checking where the main texmf tree is located" >&5
+texmfmain=
+if test "x$datadir" != 'x${prefix}/share'; then
+ # First case, datadir is defined...
+ eval p=\"$datadir\"
+ # Unconditionally set the directory, but...
+ texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'`
+ # ... do complain if it wasn't found.
+ if test -d "$texmfmain"; then
+ echo "$ac_t"""$texmfmain"" 1>&6
+ else
+ echo "$ac_t""not found" 1>&6
+ echo "configure: warning: No texmf tree found at $texmfmain.
+ *****************************************************************
+ * Error: The main texmf tree was not found. *
+ * If you do not have the files, you should be able to them from *
+ * the same place you got these sources from, or from one of the *
+ * CTAN hosts. *
+ *****************************************************************
+ Winging it." 1>&2
+ fi
+else
+ # Second case, datadir is default...
+ if test "x$prefix" = "xNONE"; then
+ p="$ac_default_prefix"
+ else
+ eval p=\"$prefix\"
+ fi
+ for e in share/texmf lib/texmf texmf; do
+ if test -d "$p/$e"; then
+ texmfmain='${prefix}'/"$e"
+ break
+ fi
+ done
+ if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then
+ # Still no texmfmain found, no prefix set, perhaps kpsewhich is
+ # installed and can help us out.
+ texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null
+ fi
+ texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'`
+ if test -n "$texmfmain"; then
+ echo "$ac_t"""$texmfmain"" 1>&6
+ else
+ eval texmfmain="$datadir/texmf"
+ echo "$ac_t""not found" 1>&6
+ echo "configure: warning: The main texmf tree was not found at $texmfmain.
+ *****************************************************************
+ * Error: The main texmf tree was not found. *
+ * Use the --datadir option to specify its parent directory. *
+ * If you do not have the files, you should be able to them from *
+ * the same place you got these sources from, or from one of the *
+ * CTAN hosts. *
+ *****************************************************************
+ Winging it by pretending $texmfmain is correct." 1>&2
+ fi
+fi
+
+
+
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1121: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1136 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1142: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1153 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1170 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in ctype.h types.h locale.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1204: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1209 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strchr strrchr setlocale
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1243: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1248 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ac_config_files="$ac_config_files Makefile"
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+
+trap 'rm -fr `echo "$ac_config_files c-auto.h:c-auto.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@LN_S@%$LN_S%g
+s%@MAINT@%$MAINT%g
+s%@LD@%$LD%g
+s%@AR@%$AR%g
+s%@ARFLAGS@%$ARFLAGS%g
+s%@texmfmain@%$texmfmain%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*|[A-z]:/*) # Absolute path.
+ srcdir="$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ rm -f conftest.in
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+ #
+ # Replace lines of the form ac_include foo with the contents of foo:
+ # first, from the ac_include lines construct a list of file names.
+ # From that list, we construct a second list of those files that exist.
+ # Then we construct lists of sed commands for including those files,
+ # and a sed command that removes the ac_include lines. We don't attempt
+ # to read non-existent files because some (buggy) versions of sed choke
+ # on this. Have to use sed because old (Ultrix, SunOS) awk does not support
+ # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+ # Can't use only one -e and commands {dr foo} because foo has to be last.
+ # Be careful, because the filename may contain /. Be careful with
+ # whitespace; we need to use echo.
+ #
+ file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in`
+ # Create the sed command line ...
+ if test -n "$file_substs"; then
+ echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2
+ file_subst_cmd="sed -e 's/^ac_include/kpse_include/'"
+ else
+ file_subst_cmd='sed'
+ fi
+ kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in`
+ for ac_inc in $file_substs $kpse_substs; do
+ if test -f "$ac_given_srcdir/$ac_inc"; then
+ ac_mung=`echo $ac_inc | sed 's,/,%,g'`
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'"
+ fi
+ done
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'"
+ # ... and fix the whitespace and escaped slashes.
+ file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \
+-e 's/kpse_include /kpse_include[ ]*/g'`
+ # I can't find any way to do variable substitution in the sed commands
+ # (so the user could have, e.g., $top_srcdir in their ac_include line).
+ (eval $file_subst_cmd conftest.in) \
+ | sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s* conftest.in
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS=" c-auto.h:c-auto.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+date >stamp-auto
+
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file and --srcdir arguments so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $ac_configure_args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case "$ac_arg" in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ for ac_config_dir in : $subdirs; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ if test ! -d $srcdir/$ac_config_dir; then
+ continue
+ fi
+
+ echo configuring in $ac_config_dir
+
+ case "$srcdir" in
+ .) ;;
+ *)
+ if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+ else
+ { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+ fi
+ ;;
+ esac
+
+ ac_popdir=`pwd`
+ cd $ac_config_dir
+
+ # A "../" for each directory in /$ac_config_dir.
+ ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+
+ case "$srcdir" in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ /*|[A-z]:/*) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f ./configure; then
+ ac_sub_configure=./configure
+ elif test -f $ac_sub_srcdir/configure; then
+ ac_sub_configure=$ac_sub_srcdir/configure
+ elif test -f $ac_sub_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ then :
+ else
+ { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+ fi
+ fi
+
+ cd $ac_popdir
+ done
+fi
+
diff --git a/Build/source/texk/makeindexk/configure.in b/Build/source/texk/makeindexk/configure.in
new file mode 100644
index 00000000000..434e56f1008
--- /dev/null
+++ b/Build/source/texk/makeindexk/configure.in
@@ -0,0 +1,18 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(mkind.c)
+
+AC_CONFIG_HEADERS([c-auto.h:c-auto.in], [date >stamp-auto])
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_LN_S
+
+sinclude(../kpathsea/withenable.ac)
+
+AC_ARG_PROGRAM
+AC_HAVE_HEADERS(ctype.h types.h locale.h)
+AC_CHECK_FUNCS(strchr strrchr setlocale)
+
+KPSE_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/Build/source/texk/makeindexk/depend.mak b/Build/source/texk/makeindexk/depend.mak
new file mode 100644
index 00000000000..1b602039bd9
--- /dev/null
+++ b/Build/source/texk/makeindexk/depend.mak
@@ -0,0 +1,27 @@
+$(objdir)/qsort.obj: \
+ mkind.h \
+ c-auto.h
+
+$(objdir)/scanst.obj: \
+ mkind.h \
+ c-auto.h \
+ scanst.h
+
+$(objdir)/genind.obj: \
+ mkind.h \
+ c-auto.h \
+ genind.h
+
+$(objdir)/sortid.obj: \
+ mkind.h \
+ c-auto.h
+
+$(objdir)/scanid.obj: \
+ mkind.h \
+ c-auto.h \
+ scanid.h
+
+$(objdir)/mkind.obj: \
+ mkind.h \
+ c-auto.h
+
diff --git a/Build/source/texk/makeindexk/depend.mk b/Build/source/texk/makeindexk/depend.mk
new file mode 100644
index 00000000000..0ad2dafdf90
--- /dev/null
+++ b/Build/source/texk/makeindexk/depend.mk
@@ -0,0 +1,63 @@
+genind.o: genind.c mkind.h c-auto.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)/lib.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/expand.h \
+ genind.h
+mkind.o: mkind.c mkind.h c-auto.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)/lib.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/expand.h
+qsort.o: qsort.c mkind.h c-auto.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)/lib.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/expand.h
+scanid.o: scanid.c mkind.h c-auto.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)/lib.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/expand.h \
+ scanid.h
+scanst.o: scanst.c mkind.h c-auto.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)/lib.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/expand.h \
+ scanst.h
+sortid.o: sortid.c mkind.h c-auto.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)/lib.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-glyph.h \
+ $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h $(kpathsea_srcdir)/expand.h
diff --git a/Build/source/texk/makeindexk/genind.c b/Build/source/texk/makeindexk/genind.c
new file mode 100644
index 00000000000..dd03593d186
--- /dev/null
+++ b/Build/source/texk/makeindexk/genind.c
@@ -0,0 +1,498 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#include "mkind.h"
+#include "genind.h"
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+static FIELD_PTR curr = NULL;
+static FIELD_PTR prev = NULL;
+static FIELD_PTR begin = NULL;
+static FIELD_PTR the_end = NULL;
+static FIELD_PTR range_ptr;
+static int level = 0;
+static int prev_level = 0;
+static char *encap = NULL;
+static char *prev_encap = NULL;
+static int in_range = FALSE;
+static int encap_range = FALSE;
+static char buff[2 * ARGUMENT_MAX];
+static char line[2 * ARGUMENT_MAX]; /* output buffer */
+static int ind_lc = 0; /* overall line count */
+static int ind_ec = 0; /* erroneous line count */
+static int ind_indent;
+
+static void flush_line ARGS((int print));
+static void insert_page ARGS((void));
+static int make_entry ARGS((int n));
+static void make_item ARGS((char* term));
+static unsigned char first_letter ARGS((char* term));
+static void new_entry ARGS((void));
+static void old_entry ARGS((void));
+static int page_diff ARGS((struct KFIELD *a,struct KFIELD *b));
+static void put_header ARGS((int let));
+static void wrap_line ARGS((int print));
+
+void
+gen_ind(VOID_ARG)
+{
+ int n;
+ int tmp_lc;
+
+ MESSAGE("Generating output file %s...", ind_fn);
+ PUT(preamble);
+ ind_lc += prelen;
+ if (init_page)
+ insert_page();
+
+ /* reset counters for putting out dots */
+ idx_dc = 0;
+ for (n = 0; n < idx_gt; n++) {
+ if (idx_key[n]->type != DUPLICATE)
+ if (make_entry(n)) {
+ IDX_DOT(DOT_MAX);
+ }
+ }
+ tmp_lc = ind_lc;
+ if (in_range) {
+ curr = range_ptr;
+ IND_ERROR("Unmatched range opening operator %c.\n", idx_ropen);
+ }
+ prev = curr;
+ flush_line(TRUE);
+ PUT(delim_t);
+ PUT(postamble);
+ tmp_lc = ind_lc + postlen;
+ if (ind_ec == 1) {
+ DONE(tmp_lc, "lines written", ind_ec, "warning");
+ } else {
+ DONE(tmp_lc, "lines written", ind_ec, "warnings");
+ }
+}
+
+
+static int
+#if STDC
+make_entry(int n)
+#else
+make_entry(n)
+int n;
+#endif
+{
+ int let;
+
+ /* determine current and previous pointer */
+ prev = curr;
+ curr = idx_key[n];
+ /* check if current entry is in range */
+ if ((*curr->encap == idx_ropen) || (*curr->encap == idx_rclose))
+ encap = &(curr->encap[1]);
+ else
+ encap = curr->encap;
+
+ /* determine the current nesting level */
+ if (n == 0) {
+ prev_level = level = 0;
+ let = *curr->sf[0];
+ put_header(let);
+ make_item(NIL);
+ } else {
+ prev_level = level;
+ for (level = 0; level < FIELD_MAX; level++)
+ if (STRNEQ(curr->sf[level], prev->sf[level]) ||
+ STRNEQ(curr->af[level], prev->af[level]))
+ break;
+ if (level < FIELD_MAX)
+ new_entry();
+ else
+ old_entry();
+ }
+
+ if (*curr->encap == idx_ropen)
+ if (in_range) {
+ IND_ERROR("Extra range opening operator %c.\n", idx_ropen);
+ } else {
+ in_range = TRUE;
+ range_ptr = curr;
+ }
+ else if (*curr->encap == idx_rclose)
+ if (in_range) {
+ in_range = FALSE;
+ if (STRNEQ(&(curr->encap[1]), "") &&
+ STRNEQ(prev_encap, &(curr->encap[1]))) {
+IND_ERROR("Range closing operator has an inconsistent encapsulator %s.\n",
+ &(curr->encap[1]));
+ }
+ } else {
+ IND_ERROR("Unmatched range closing operator %c.\n", idx_rclose);
+ }
+ else if ((*curr->encap != NUL) &&
+ STRNEQ(curr->encap, prev_encap) && in_range)
+ IND_ERROR("Inconsistent page encapsulator %s within range.\n",
+ curr->encap);
+ return (1);
+}
+
+
+static void
+#if STDC
+make_item(char *term)
+#else
+make_item(term)
+char *term;
+#endif
+{
+ int i;
+
+ if (level > prev_level) {
+ /* ascending level */
+ if (*curr->af[level] == NUL)
+ sprintf(line, "%s%s%s", term, item_u[level], curr->sf[level]);
+ else
+ sprintf(line, "%s%s%s", term, item_u[level], curr->af[level]);
+ ind_lc += ilen_u[level];
+ } else {
+ /* same or descending level */
+ if (*curr->af[level] == NUL)
+ sprintf(line, "%s%s%s", term, item_r[level], curr->sf[level]);
+ else
+ sprintf(line, "%s%s%s", term, item_r[level], curr->af[level]);
+ ind_lc += ilen_r[level];
+ }
+
+ i = level + 1;
+ while (i < FIELD_MAX && *curr->sf[i] != NUL) {
+ PUT(line);
+ if (*curr->af[i] == NUL)
+ sprintf(line, "%s%s", item_x[i], curr->sf[i]);
+ else
+ sprintf(line, "%s%s", item_x[i], curr->af[i]);
+ ind_lc += ilen_x[i];
+ level = i; /* Added at 2.11 <brosig@gmdzi.gmd.de> */
+ i++;
+ }
+
+ ind_indent = 0;
+ strcat(line, delim_p[level]);
+ SAVE;
+}
+
+static unsigned char
+#if STDC
+first_letter(char *term)
+#else
+first_letter(term)
+char *term;
+#endif
+{
+ if (thai_sort)
+ return strchr("àáâãä", term[0]) ? term[1] : term[0];
+
+ return TOLOWER(term[0]);
+}
+
+static void
+new_entry(VOID_ARG)
+{
+ int let;
+ FIELD_PTR ptr;
+#ifdef HAVE_SETLOCALE
+ char *prev_locale;
+ prev_locale = setlocale(LC_CTYPE, NULL);
+ setlocale(LC_CTYPE, "");
+#endif
+
+ if (in_range) {
+ ptr = curr;
+ curr = range_ptr;
+ IND_ERROR("Unmatched range opening operator %c.\n", idx_ropen);
+ in_range = FALSE;
+ curr = ptr;
+ }
+ flush_line(TRUE);
+
+ /* beginning of a new group? */
+
+ if (((curr->group != ALPHA) && (curr->group != prev->group) &&
+ (prev->group == SYMBOL)) ||
+ ((curr->group == ALPHA) &&
+ ((unsigned char)(let = first_letter(curr->sf[0]))
+ != first_letter(prev->sf[0]))) ||
+ (german_sort &&
+ (curr->group != ALPHA) && (prev->group == ALPHA))) {
+ PUT(delim_t);
+ PUT(group_skip);
+ ind_lc += skiplen;
+ /* beginning of a new letter? */
+ put_header(let);
+ make_item(NIL);
+ } else
+ make_item(delim_t);
+#ifdef HAVE_SETLOCALE
+ setlocale(LC_CTYPE, prev_locale);
+#endif
+}
+
+
+static void
+old_entry(VOID_ARG)
+{
+ int diff;
+
+ /* current entry identical to previous one: append pages */
+ diff = page_diff(the_end, curr);
+
+ if ((prev->type == curr->type) && (diff != -1) &&
+ (((diff == 0) && (prev_encap != NULL) && STREQ(encap, prev_encap)) ||
+ (merge_page && (diff == 1) &&
+ (prev_encap != NULL) && STREQ(encap, prev_encap)) ||
+ in_range)) {
+ the_end = curr;
+ /* extract in-range encaps out */
+ if (in_range &&
+ (*curr->encap != NUL) &&
+ (*curr->encap != idx_rclose) &&
+ STRNEQ(curr->encap, prev_encap)) {
+ sprintf(buff, "%s%s%s%s%s", encap_p, curr->encap,
+ encap_i, curr->lpg, encap_s);
+ wrap_line(FALSE);
+ }
+ if (in_range)
+ encap_range = TRUE;
+ } else {
+ flush_line(FALSE);
+ if ((diff == 0) && (prev->type == curr->type)) {
+IND_ERROR(
+"Conflicting entries: multiple encaps for the same page under same key.\n",
+"");
+ } else if (in_range && (prev->type != curr->type)) {
+IND_ERROR(
+"Illegal range formation: starting & ending pages are of different types.\n",
+"");
+ } else if (in_range && (diff == -1)) {
+IND_ERROR(
+"Illegal range formation: starting & ending pages cross chap/sec breaks.\n",
+"");
+ }
+ SAVE;
+ }
+}
+
+
+static int
+#if STDC
+page_diff(FIELD_PTR a,FIELD_PTR b)
+#else
+page_diff(a, b)
+FIELD_PTR a;
+FIELD_PTR b;
+#endif
+{
+ short i;
+
+ if (a->count != b->count)
+ return (-1);
+ for (i = 0; i < a->count - 1; i++)
+ if (a->npg[i] != b->npg[i])
+ return (-1);
+ return (b->npg[b->count - 1] - a->npg[a->count - 1]);
+}
+
+static void
+#if STDC
+put_header(int let)
+#else
+put_header(let)
+int let;
+#endif
+{
+ if (headings_flag)
+ {
+ PUT(heading_pre);
+ ind_lc += headprelen;
+ switch (curr->group)
+ {
+ case SYMBOL:
+ if (headings_flag > 0)
+ {
+ PUT(symhead_pos);
+ }
+ else
+ {
+ PUT(symhead_neg);
+ }
+ break;
+ case ALPHA:
+ if (headings_flag > 0)
+ {
+ let = TOUPPER(let);
+ PUTC(let);
+ }
+ else
+ {
+ let = TOLOWER(let);
+ PUTC(let);
+ }
+ break;
+ default:
+ if (headings_flag > 0)
+ {
+ PUT(numhead_pos);
+ }
+ else
+ {
+ PUT(numhead_neg);
+ }
+ break;
+ }
+ PUT(heading_suf);
+ ind_lc += headsuflen;
+ }
+}
+
+
+/* changes for 2.12 (May 20, 1993) by Julian Reschke (jr@ms.maus.de):
+ Use keywords suffix_2p, suffix_3p or suffix_mp for one, two or
+ multiple page ranges (when defined) */
+
+static void
+#if STDC
+flush_line(int print)
+#else
+flush_line(print)
+int print;
+#endif
+{
+ char tmp[sizeof(buff)];
+
+ if (page_diff(begin, the_end) != 0)
+ if (encap_range || (page_diff(begin, prev) > (*suffix_2p ? 0 : 1)))
+ {
+ int diff = page_diff(begin, the_end);
+
+ if ((diff == 1) && *suffix_2p)
+ sprintf(buff, "%s%s", begin->lpg, suffix_2p);
+ else if ((diff == 2) && *suffix_3p)
+ sprintf(buff, "%s%s", begin->lpg, suffix_3p);
+ else if ((diff >= 2) && *suffix_mp)
+ sprintf(buff, "%s%s", begin->lpg, suffix_mp);
+ else
+ sprintf(buff, "%s%s%s", begin->lpg, delim_r, the_end->lpg);
+
+ encap_range = FALSE;
+ }
+ else
+ sprintf(buff, "%s%s%s", begin->lpg, delim_n, the_end->lpg);
+ else
+ {
+ encap_range = FALSE; /* might be true from page range on same page */
+ strcpy(buff, begin->lpg);
+ }
+
+ if (*prev_encap != NUL)
+ {
+ strcpy(tmp, buff);
+ sprintf(buff, "%s%s%s%s%s",
+ encap_p, prev_encap, encap_i, tmp, encap_s);
+ }
+ wrap_line(print);
+}
+
+static void
+#if STDC
+wrap_line(int print)
+#else
+wrap_line(print)
+int print;
+#endif
+{
+ int len;
+
+ len = strlen(line) + strlen(buff) + ind_indent;
+ if (print) {
+ if (len > linemax) {
+ PUTLN(line);
+ PUT(indent_space);
+ ind_indent = indent_length;
+ } else
+ PUT(line);
+ PUT(buff);
+ } else {
+ if (len > linemax) {
+ PUTLN(line);
+ sprintf(line, "%s%s%s", indent_space, buff, delim_n);
+ ind_indent = indent_length;
+ } else {
+ strcat(buff, delim_n);
+ strcat(line, buff);
+ }
+ }
+}
+
+
+static void
+insert_page(VOID_ARG)
+{
+ int i = 0;
+ int j = 0;
+ int page = 0;
+
+ if (even_odd >= 0) {
+ /* find the rightmost digit */
+ while (pageno[i++] != NUL);
+ j = --i;
+ /* find the leftmost digit */
+ while (isdigit(pageno[--i]) && i > 0);
+ if (!isdigit(pageno[i]))
+ i++;
+ /* convert page from literal to numeric */
+ page = strtoint(&pageno[i]) + 1;
+ /* check even-odd numbering */
+ if (((even_odd == 1) && (page % 2 == 0)) ||
+ ((even_odd == 2) && (page % 2 == 1)))
+ page++;
+ pageno[j + 1] = NUL;
+ /* convert page back to literal */
+ while (page >= 10) {
+ pageno[j--] = TOASCII(page % 10);
+ page = page / 10;
+ }
+ pageno[j] = TOASCII(page);
+ if (i < j) {
+ while (pageno[j] != NUL)
+ pageno[i++] = pageno[j++];
+ pageno[i] = NUL;
+ }
+ }
+ PUT(setpage_open);
+ PUT(pageno);
+ PUT(setpage_close);
+ ind_lc += setpagelen;
+}
diff --git a/Build/source/texk/makeindexk/genind.h b/Build/source/texk/makeindexk/genind.h
new file mode 100644
index 00000000000..445f52d7ae9
--- /dev/null
+++ b/Build/source/texk/makeindexk/genind.h
@@ -0,0 +1,58 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#define IND_ERROR(F, D) { \
+ if (idx_dot) { \
+ fprintf(ilg_fp, "\n"); \
+ idx_dot = FALSE; \
+ } \
+ fprintf(ilg_fp, \
+ "## Warning (input = %s, line = %d; output = %s, line = %d):\n -- ", \
+ curr->fn, curr->lc, ind_fn, ind_lc+1); \
+ fprintf(ilg_fp, F, D); \
+ ind_ec++; \
+}
+
+#define PUTC(C) { \
+ fputc(C, ind_fp); \
+}
+
+#define PUT(S) { \
+ fputs(S, ind_fp); \
+}
+
+#define PUTLN(S) { \
+ fputs(S, ind_fp); \
+ fputc('\n', ind_fp); \
+ ind_lc++; \
+}
+
+#define SAVE { \
+ begin = the_end = curr; \
+ prev_encap = encap; \
+}
+
diff --git a/Build/source/texk/makeindexk/makeindex.1 b/Build/source/texk/makeindexk/makeindex.1
new file mode 100644
index 00000000000..1404df6cf74
--- /dev/null
+++ b/Build/source/texk/makeindexk/makeindex.1
@@ -0,0 +1,1203 @@
+.if t .ds LX L\\h'-0.36m'\\v'-0.15v'\\s-2A\\s+2\\h'-0.15m'\\v'0.15v'T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
+.if n .ds LX LaTeX
+.if t .ds TX T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
+.if n .ds TX TeX
+.ds Ts T\s-2RAN\s+2S\s-2CRIPT\s+2
+.if t .ds Uc \fIU\\h'-0.12m'C\\v'0.27m'\\h'-.23m'S\\h'-0.11m'F\\v'-0.27m'\fP
+.if n .ds Uc UCSF
+.ds Et \\f(boE\\h'-0.1667m'\\v'-0.20v'T\\v'0.20v'\\h'-0.125m'T\\fP
+.TH MAKEINDEX 1L "10 December 1991"
+.\"=====================================================================
+.SH NAME
+makeindex \- a general purpose, formatter-independent index processor
+.SH SYNOPSIS
+.B makeindex
+.BR [ \-c ]
+.BR [ \-g ]
+.BR [ \-i ]
+.BR [ \-l ]
+.BR [ \-o
+.IR ind ]
+.BR [ \-p
+.IR num ]
+.BR [ \-q ]
+.BR [ \-r ]
+.BR [ \-s
+.IR sfile ]
+.BR [ \-t
+.IR log ]
+.BR [ \-L ]
+.BR [ \-T ]
+.BI [ idx0
+.I idx1
+.IR idx2 .\|.\|.]
+.\"=====================================================================
+.SH DESCRIPTION
+The program
+.I makeindex
+is a general purpose hierarchical index generator; it accepts one or
+more input files (often produced by a text formatter such as \*(TX
+.RI ( tex (1L))
+or
+.IR troff (1),
+sorts the entries, and produces an output file which can be formatted.
+The index can have up to three levels (0, 1, and 2) of subitem nesting.
+The way in which words are flagged for indexing within the main document
+is specific to the formatter used;
+.I makeindex
+does
+.I not
+automate the process of selecting these words. As the output index
+is hierarchical,
+.I makeindex
+can be considered complimentary to the
+.IR awk (1)-based
+.IR make.index (1L)
+system of Bentley and Kernighan, which is specific to
+.IR troff (1),
+generates non-hierarchical indices, and employs a much simpler syntax
+for indicating index entries. For illustration of use with
+.I troff
+and
+.IR \*(TX ,
+see the section \s-2EXAMPLES\s+2 below.
+.LP
+The formats of the input and output files are
+specified in a style file; by default, input is assumed to be a
+.I \&.idx
+file, as generated by \*(LX.
+.LP
+Unless specified explicitly, the base name of the first input file
+.RI ( idx0 )
+is used to determine the names of other files. For each input file
+name specified, a file of that name is sought. If this file is not
+found and the file name has no extension, the extension
+.I \&.idx
+is appended. If no file with this name is found,
+.I makeindex
+aborts.
+.LP
+If exactly one input file was given and no explicit style file was
+specified using
+.BR \-s ,
+.I makeindex
+uses a file with the extension
+.I \&.mst
+as default style file (when present).
+.LP
+For important notes on how to select index keywords, see the document
+by Lamport cited below. As an issue separate from selecting index
+keywords, a systematic mechanism for placing index terms in a document
+is suggested in
+.IR "Index Preparation and Processing" ,
+a paper cited below.
+.\"=====================================================================
+.SH OPTIONS
+.TP 10
+.B \-c
+Compress intermediate blanks (ignoring leading and trailing blanks and
+tabs). By default, blanks in the index key are retained.
+.TP 10
+.B \-g
+Employ German word ordering in the index, in accord with rules set forth
+in DIN 5007. By default,
+.I makeindex
+employs a word ordering in which precedence is: symbols, numbers,
+uppercase letters, lowercase letters. The sequence in German word
+ordering is: symbols, lowercase letters, uppercase letters, numbers.
+Additionally, this option enables
+.I makeindex
+to recognize the German \*(TX-commands {"a, "o, "u and "s} as {ae, oe,
+ue and ss} during the sorting of the entries. The quote character
+must be redefined in a style file (for example, redefine quote
+as '+'). If the quote character is not redefined,
+.I makeindex
+will produce an error message and abort.
+.TP 10
+.B \-i
+Take input from
+.IR stdin .
+When this option is specified and
+.B \-o
+is not, output is written to
+.IR stdout .
+.TP 10
+.B \-l
+Letter ordering; by default, word ordering is used (see
+the \s-2ORDERING\s+2 section).
+.TP 10
+.BI \-o " ind"
+Employ
+.I ind
+as the output index file. By default, the file name
+is created by appending the extension
+.I .ind
+to the base name of
+the first input file
+.RI ( idx0 ).
+.TP 10
+.BI \-p " num"
+Set the starting page number of the output index file to be
+.I num
+(useful when the index file is to be formatted separately). The
+argument
+.I num
+may be numerical or one of the following:
+.RS
+.TP 10
+.I any
+The starting page is the last source page number plus 1.
+.TP
+.I odd
+The starting page is the first odd page following the last source page
+number.
+.TP
+.I even
+The starting page is the first even page following the last source
+page number.
+.RE
+.IP
+The last source page is obtained by searching backward in the log file
+for the first instance of a number included within paired square
+brackets
+.RB ( [ .\|.\|. ] ).
+If a page number is missing or the log file is not found, no attempt
+will be made to set the starting page number. The source log file
+name is determined by appending the extension
+.I \&.log
+to the base name of the first input file
+.RI ( idx0 ).
+.TP 10
+.B \-q
+Quiet mode; send no messages to
+.IR stderr .
+By default, progress
+and error messages are sent to
+.I stderr
+as well as to the
+transcript file.
+.TP 10
+.B \-r
+Disable implicit page range formation; page ranges must be created by
+using explicit range operators; see \s-2SPECIAL EFFECTS\s+2 below. By
+default, three or more successive pages are automatically abbreviated
+as a range (e.g. 1\(em5).
+.TP 10
+.BR \-s " sty"
+Employ
+.I sty
+as the style file (no default). The environment
+variable \s-2INDEXSTYLE\s+2 defines the path where the style file
+should be found.
+.TP 10
+.BR \-t " log"
+Employ
+.I log
+as the transcript file. By default, the file name is
+created by appending the extension
+.I .ilg
+to the base name of the
+first input file
+.RI ( idx0 ).
+.TP 10
+.BR \-L
+sort based on locale settings. Not available on all systems.
+.TP 10
+.BR \-T
+special support for Thai documents. Not available on all systems.
+.\"=====================================================================
+.SH "STYLE FILE"
+The style file informs
+.I makeindex
+about the format of the
+.I \&.idx
+input files and the intended format of the final output file; examples
+appear below. This file can reside anywhere in the path defined by
+the environment variable \s-2INDEXSTYLE\s+2. The style file contains
+a list of
+.RI < specifier , " attribute" >
+pairs. There are two types of specifiers: input and output.
+Pairs do not have to appear in any particular order.
+A line begun by `%' is a comment. In the following list of
+specifiers and arguments, <string> is an arbitrary string delimited by
+double quotes (".\|.\|."), <char> is a single letter embraced by
+single quotes ('.\|.\|.'), and <number> is a nonnegative integer.
+The maximum length of a <string> is 2048. A literal backslash or
+quote must be escaped (by a backslash). Anything not specified in the
+style file will be assigned a default value, which is shown at the
+head of the rightmost column.
+.\"----------------------------------------------------------------------
+.SS "INPUT STYLE SPECIFIERS"
+.TP 25
+.BR actual " <char>"
+\'@\'
+.RS
+Symbol indicating that the next entry is to appear in the output file.
+.RE
+.TP
+.BR arg_close " <char>"
+\'}\'
+.RS
+Closing delimiter for the index entry argument.
+.RE
+.TP
+.BR arg_open " <char>"
+\'{\'
+.RS
+Opening delimiter for the index entry argument.
+.RE
+.TP
+.BR encap " <char>"
+\'|\'
+.RS
+Symbol indicating that the rest of the argument list
+is to be used as the encapsulating command for the page number.
+.RE
+.TP
+.BR escape " <char>"
+\'\\\\\'
+.RS
+Symbol which escapes the following letter, unless its preceding letter
+is
+.BR escape .
+Note:
+.B quote
+is used to escape the letter which immediately follows it, but if it is
+preceded by
+.BR escape ,
+it is treated as a ordinary character. These two symbols
+.I must
+be distinct.
+.RE
+.TP
+.BR keyword " <string>"
+"\\\\indexentry"
+.RS
+Command which tells
+.I makeindex
+that its argument is an index entry.
+.RE
+.TP
+.BR level " <char>"
+\'!\'
+.RS
+Delimiter denoting a new level of subitem.
+.RE
+.TP
+.BR quote " <char>"
+\'"\'
+.RS
+Note:
+.B quote
+is used to escape the letter which immediately follows it, but if it is
+preceded by
+.BR escape ,
+it is treated as a ordinary character. These two symbols
+.I must
+be distinct.
+.RE
+.TP
+.BR range_close " <char>"
+\')\'
+.RS
+Closing delimiter indicating the end of an explicit page range.
+.RE
+.TP
+.BR range_open " <char>"
+\'(\'
+.RS
+Opening delimiter indicating the beginning of an explicit page range.
+.RE
+.\"---------------------------------------------------------------------
+.SS "OUTPUT STYLE SPECIFIERS"
+.TP 25
+.BR preamble " <string>"
+"\\\\begin{theindex}\\n"
+.RS
+Preamble of output file.
+.RE
+.TP
+.BR postamble " <string>"
+"\\n\\n\\\\end{theindex}\\n"
+.RS
+Postamble of output file.
+.RE
+.TP
+.BR setpage_prefix " <string>"
+"\\n \\\\setcounter{page}{"
+.RS
+Prefix of command which sets the starting page number.
+.RE
+.TP
+.BR setpage_suffix " <string>"
+"}\\n"
+.RS
+Suffix of command which sets the starting page number.
+.RE
+.TP
+.BR group_skip " <string>"
+"\\n\\n \\\\indexspace\\n"
+.RS
+Vertical space to be inserted before a new group begins.
+.RE
+.TP
+.BR headings_flag " <string>"
+0
+.RS
+Flag indicating treatment of new group headers, which are inserted
+when before a new group (symbols, numbers, and the 26 letters):
+positive values cause an uppercase letter to be inserted between
+prefix and suffix, and negative values cause a lowercase letter to be
+inserted (default is 0, which produces no header).
+.RE
+.TP
+.BR heading_prefix " <string>"
+""
+.RS
+Header prefix to be inserted before a new letter begins.
+.RE
+.TP
+.BR symhead_positive " <string>"
+"Symbols"
+.RS
+Heading for symbols to be inserted if
+.B headings_flag
+is positive.
+.RE
+.TP
+.BR symhead_negative " <string>"
+"symbols"
+.RS
+Heading for symbols to be inserted if
+.B headings_flag
+is negative.
+.RE
+.TP
+.BR numhead_positive " <string>"
+"Numbers"
+.RS
+Heading for numbers to be inserted if
+.B headings_flag
+is positive.
+.RE
+.TP
+.BR numhead_negative " <string>"
+"numbers"
+.RS
+Heading for numbers to be inserted if
+.B headings_flag
+is negative.
+.RE
+.TP
+.BR item_0 " <string>"
+"\\n \\\\item "
+.RS
+Command to be inserted between two primary (level 0) items.
+.RE
+.TP
+.BR item_1 " <string>"
+"\\n \\\\subitem "
+.RS
+Command to be inserted between two secondary (level 1) items.
+.RE
+.TP
+.BR item_2 " <string>"
+"\\n \\\\subsubitem "
+.RS
+Command to be inserted between two level 2 items.
+.RE
+.TP
+.B item_01 " <string>"
+"\\n \\\\subitem "
+.RS
+Command to be inserted between a level 0 item and a level 1 item.
+.RE
+.TP
+.BR item_x1 " <string>"
+"\\n \\\\subitem "
+.RS
+Command to be inserted between a level 0 item and a level 1 item,
+where the level 0 item does not have associated page numbers.
+.RE
+.TP
+.BR item_12 " <string>"
+"\\n \\\\subsubitem "
+.RS
+Command to be inserted between a level 1 item and a level 2 item.
+.RE
+.TP
+.BR item_x2 " <string>"
+"\\n \\\\subsubitem "
+.RS
+Command to be inserted between a level 1 item and a level 2 item,
+where the level 1 item does not have associated page numbers.
+.RE
+.TP
+.BR delim_0 " <string>"
+", "
+.RS
+Delimiter to be inserted between a level 0 key and its first page number
+(default: comma followed by a blank).
+.RE
+.TP
+.BR delim_1 " <string>"
+", "
+.RS
+Delimiter to be inserted between a level 1 key and its first page number
+(default: comma followed by a blank).
+.RE
+.TP
+.BR delim_2 " <string>"
+", "
+.RS
+Delimiter to be inserted between a level 2 key and its first page number
+(default: comma followed by a blank).
+.RE
+.TP
+.BR delim_n " <string>"
+", "
+.RS
+Delimiter to be inserted between two page numbers for the same key
+in any level (default: comma followed by a blank).
+.RE
+.TP
+.BR delim_r " <string>"
+"--"
+.RS
+Delimiter to be inserted between the starting and ending page numbers
+of a range.
+.RE
+.TP
+.BR delim_t " <string>"
+""
+.RS
+Delimiter to be inserted at the end of a page list. This delimiter
+has no effect on entries which have no associated page list.
+.RE
+.TP
+.BR encap_prefix " <string>"
+"\\\\"
+.RS
+First part of prefix for the command which encapsulates the page number.
+.RE
+.TP
+.BR encap_infix " <string>"
+"{"
+.RS
+Second part of prefix for the command which encapsulates the page
+number.
+.RE
+.TP
+.BR encap_suffix " <string>"
+"}".
+.RS
+Suffix for the command which encapsulates the page number.
+.RE
+.TP
+.BR line_max " <number>"
+72
+.RS
+Maximum length of a line in the output, beyond which a line wraps.
+.RE
+.TP
+.BR indent_space " <string>"
+"\\t\\t"
+.RS
+Space to be inserted in front of a wrapped line (default: two tabs).
+.RE
+.TP
+.BR indent_length " <number>"
+16
+.RS
+Length of
+.B indent_space
+(default: 16, equivalent to 2 tabs).
+.RE
+.TP
+.BR suffix_2p " <string>"
+""
+.RS
+Delimiter to replace the range delimiter and the second page number of
+a two page list. When present, it overrides
+.BR delim_r .
+Example: "f.".
+.RE
+.TP
+.BR suffix_3p " <string>"
+""
+.RS
+Delimiter to replace the range delimiter and the second page number of
+a three page list. When present, it overrides
+.B delim_r
+and
+.BR suffix_mp .
+Example: "ff.".
+.RE
+.TP
+.BR suffix_mp " <string>"
+""
+.RS
+Delimiter to replace the range delimiter and the second page number of
+a multiple page list (three or more pages). When present, it overrides
+.BR delim_r .
+Example: "f.".
+.RE
+.\"=====================================================================
+.SH EXAMPLES
+.\"---------------------------------------------------------------------
+.SS "\*(TX EXAMPLE"
+The following example shows a style file called
+.IR book.ist ,
+which defines an index for a book which can be formatted independently
+of the main source:
+.LP
+.RS
+.nf
+\fCpreamble
+"\\\\documentstyle[12pt]{book}
+\\\\begin{document}
+\\\\begin{theindex}
+{\\\\small\\n"
+postamble
+"\\n\\n}
+\\\\end{theindex}
+\\\\end{document}\\n\fP"
+.fi
+.RE
+.LP
+Assuming that a particular book style requires the index (as well as any
+chapters) to start from an odd page number, and that the input file is
+named
+.IR foo.idx ,
+the following command line produces output in file
+.IR footmp.ind :
+.LP
+.RS
+\fCmakeindex \-s book.ist \-o footmp.ind \-p odd foo\fP
+.RE
+.LP
+Here a non-default output file name is used to avoid clobbering the
+output for the book itself (presumably
+.IR foo.dvi ,
+which would have been the default name for the index output file!).
+.\"---------------------------------------------------------------------
+.SS "TROFF EXAMPLE"
+A sample control file for creating an index, which we will assume
+resides in the file
+.IR sample.ist :
+.LP
+.RS
+.nf
+\&\fCkeyword "IX:"
+\&preamble
+\&".\\\\\\" start of index output
+\&\\".\\\\\\" enter two column mode
+\&.2C
+\&.SH
+\&.ce
+\&INDEX
+\&.XS
+\&INDEX
+\&.XE
+\&.R
+\&.ps 9p
+\&.vs 11p
+\&.sp
+\&.de I1
+\&.ti 0.25i
+\&..
+\&.de I2
+\&.ti 0.5i
+\&.."
+\&postamble "\\n.\\\\\\" end of index output"
+\&setpage_prefix "\\n.nr % "
+\&setpage_suffix ""
+\&group_skip "\\n.sp 1.0"
+\&headings_flag 1
+\&heading_prefix "\\n.IS\\n"
+\&heading_suffix "\\n.IE"
+\&item_0 "\\n.br\\n"
+\&item_1 "\\n.I1\\n"
+\&item_2 "\\n.I2\\n"
+\&item_01 "\\n.I1\\n"
+\&item_x1 "\\n.I1\\n"
+\&item_12 "\\n.I2\\n"
+\&item_x2 "\\n.I2\\n"
+\&delim_0 ", "
+\&delim_1 ", "
+\&delim_2 ", "
+\&delim_r "-"
+\&delim_t "."
+\&encap_prefix "\\\\fB"
+\&encap_infix ""
+\&encap_suffix "\\\\fP"
+\&indent_space ""
+\&indent_length 0\fP
+.fi
+.RE
+.LP
+The local macro package may require modification, as in this example
+of an extension to the
+.B \-ms
+macros (note that at some sites, this macro should
+.I replace
+a pre-existing macro of the same name):
+.LP
+.RS
+.nf
+\fC\&.\" IX - index words to stderr
+\&.de IX
+\&.ie '\\\\n(.z'' .tm IX: \\\\$1 \\\\$2 \\\\$3 \\\\$4 \\\\$5 \\\\$6 \\\\$7 \\\\$8 \\\\$9 {\\\\n(PN}
+\&.el \\\\!.IX \\\\$1 \\\\$2 \\\\$3 \\\\$4 \\\\$5 \\\\$6 \\\\$7 \\\\$8 \\\\$9 {\\\\n(PN}
+\&..\fP
+.fi
+.RE
+.LP
+(note that the string {\fC\\\\n(PN\fP} is separated from the rest of the
+line by a tab.
+If your local macro package does not contain this extension,
+just include those lines at the beginning of your file.
+Here is a simple
+.IR troff (1)
+input file, which we will assume is named
+.IR sample.txt :
+.LP
+.RS
+.nf
+\fC\&This is a sample file to test the \\fImakeindex\\fP(1L)
+\&program, and see
+\&.IX {indexing!programs!C language}
+\&.IX {makeindex@\\fImakeindex\\fP(1L)}
+\&.bp
+\&.rs
+\&.IX {Knuth}
+\&.IX {typesetting!computer-aided}
+\&how well it functions in the \\fItroff\\fP(1) environment.\fP
+.fi
+.RE
+.LP
+Note that index entries are indicated by the
+.B .IX
+macro, which
+causes the following text to be written to
+.I stdout
+along with the
+current page number.
+.\"---------------------------------------------------------------------
+.SS "CREATING THE INDEX FILE IN THE BOURNE SHELL"
+To create an input file for
+.IR makeindex ,
+.B "in the Bourne shell"
+environment, do the equivalent at your site of the command:
+.LP
+.nf
+\fCpsroff -ms -Tpsc -t sample.txt > /dev/null 2> sample.tmp\fP
+.fi
+.LP
+Some sites will require
+.I ditroff
+instead of
+.IR psroff .
+To filter out any genuine error messages, invoke
+.IR grep (1):
+.LP
+.RS
+\fCgrep '^IX: ' sample.tmp > sample.idx\fP
+.RE
+.\"---------------------------------------------------------------------
+.SS "CREATING THE INDEX FILE USING \*(Uc ENHANCED TROFF/\*(Ts"
+With \*(Uc Enhanced troff/\*(Ts, the
+.B \-I
+option of
+.IR psroff (1L)
+can produce both formatter output and an index file:
+.LP
+.RS
+\fCpsroff -ms -I sample.inp -Tpsc sample.txt\fP
+.RE
+.LP
+If it is wished to suppress the formatter output:
+.RS
+.LP
+.nf
+\fCpsroff -ms -I sample.inp -Tpsc -t sample.txt > /dev/null\fP
+.fi
+.RE
+.\"---------------------------------------------------------------------
+.SS "COMPLETING THE INDEX"
+Any of the above procedures leaves the input for
+.I makeindex
+in
+.IR sample.inp .
+The next step is to invoke
+.IR makeindex :
+.LP
+.RS
+\fCmakeindex -s sample.ist sample.idx\fP
+.RE
+.LP
+This leaves
+.IR troff (1)-ready
+output in the file
+.IR sample.ind .
+.\"=====================================================================
+.SH "ORDERING"
+By default,
+.I makeindex
+assumes
+.IR "word ordering" ;
+if the
+.B \-l
+option is in effect,
+.I "letter ordering"
+is used. In word ordering, a blank precedes any letter in the
+alphabet, whereas in letter ordering, it does not count at all. This
+is illustrated by the following example:
+.LP
+.RS
+\fIword order letter order\fP
+.br
+sea lion seal
+.br
+seal sea lion
+.RE
+.LP
+Numbers are always sorted in numeric order. For instance,
+.LP
+.RS
+9 (nine), 123
+.br
+10 (ten), see Derek, Bo
+.RE
+.LP
+Letters are first sorted without regard to case; when words are
+identical, the uppercase version precedes its lowercase counterpart.
+.LP
+A special symbol is defined here to be any character not appearing in
+the union of digits and the English alphabetic characters. Patterns
+starting with special symbols precede numbers, which precede patterns
+starting with letters. As a special case, a string starting with a
+digit but mixed with non-digits is considered to be a pattern starting
+with a special character.
+.\"=====================================================================
+.SH "SPECIAL EFFECTS"
+Entries such as
+.LP
+.RS
+.nf
+\fC\\indexentry{alpha}{1}
+\\indexentry{alpha!beta}{3}
+\\indexentry{alpha!beta!gamma}{10}\fP
+.fi
+.RE
+.LP
+in the input file will be converted to
+.LP
+.RS
+.nf
+\fC\\item alpha, 1
+\0\0\0\\subitem beta, 3
+\0\0\0\0\0\0\\subsubitem gamma, 10\fP
+.fi
+.RE
+.LP
+in the output index file.
+Notice that the
+.B level
+symbol (`!') is used above to delimit
+hierarchical levels.
+.LP
+It is possible to make an item appear in a designated form by
+using the
+.B actual
+(`@') operator. For instance,
+.LP
+.RS
+\fC\\indexentry{alpha@{\\it alpha\\/}}{1}\fP
+.RE
+.LP
+will become
+.LP
+.RS
+\fC\\item {\\it alpha\\/}, 1\fP
+.RE
+.LP
+after processing. The pattern preceding `@' is
+used as sort key, whereas the one following it is written to the
+output file. Note that two appearances of the same key, one with and
+one without the
+.B actual
+operator, are regarded as
+.I distinct
+entries.
+.LP
+The item, subitem, and subsubitem fields may have individual sort keys:
+.LP
+.RS
+.nf
+\fC\\indexentry{aa@{\\it aa\\/}!bb@{\\it bb\\/}!cc@{\\it cc\\/}}{1}\fP
+.fi
+.RE
+.LP
+This will be converted to
+.LP
+.RS
+.nf
+\fC\\item {\\it aa}, 1
+\0\0\0\\subitem {\\it bb}, 3
+\0\0\0\0\0\0\\subsubitem {\\it cc}, 10\fP
+.fi
+.RE
+.LP
+It is possible to encapsulate a page number with a designated
+command using the
+.B encap
+(`|') operator:
+.LP
+.RS
+\fC\\indexentry{alpha|bold}{1}\fP
+.RE
+.LP
+will be converted to
+.LP
+.RS
+\fC\\item alpha, \\bold{1}\fP
+.RE
+.LP
+where, with a suitable definition for \*(TX, \fC\\bold{n}\fP
+will expand to \fC{\\bf n}\fP.
+In this example, the three output attributes associated with page
+encapsulation
+.BR encap_prefix ,
+.BR encap_infix ,
+and
+.BR encap_suffix ,
+correspond to backslash, left brace, and right brace, respectively.
+This mechanism allows page numbers to be set in different fonts. For
+example, the page where the definition of a keyword appears can be in
+one font, the location of a primary example can be in another font,
+and other appearances in yet a third font.
+.LP
+The
+.B encap
+operator can also be used to create cross references in
+the index:
+.LP
+.RS
+\fC\\indexentry{alpha|see{beta}}{1}\fP
+.RE
+.LP
+will become
+.LP
+.RS
+\fC\\item alpha, \\see{beta}{1}\fP
+.RE
+.LP
+in the output file, where
+.LP
+.RS
+\fC\\see{beta}{1}\fP
+.RE
+.LP
+will expand to
+.LP
+.RS
+\fC{\\it see\\/} beta\fP
+.RE
+.LP
+Note that in a cross reference like this the page number disappears.
+.LP
+A pair of
+.B encap
+concatenated with
+.B range_open
+(`|(') and
+.B range_close
+(`|)') creates an explicit page range:
+.LP
+.RS
+.nf
+\fC\\indexentry{alpha|(}{1}
+\\indexentry{alpha|)}{5}\fP
+.fi
+.RE
+.LP
+will become
+.LP
+.RS
+\fC\\item alpha, 1\(em5\fP
+.RE
+.LP
+Intermediate pages indexed by the same key will be merged into the
+range implicitly. This is especially useful when an entire section
+about a particular subject is to be indexed, in which case only the
+range opening and closing operators need to be inserted at the
+beginning and end of the section. Explicit page range formation can
+also include an extra command to set the page range in a designated
+font:
+.LP
+.RS
+.nf
+\fC\\indexentry{alpha|(bold}{1}
+\\indexentry{alpha|)}{5}\fP
+.fi
+.RE
+.LP
+will become
+.LP
+.RS
+\fC\\item alpha, \\bold{1--5}\fP
+.RE
+.LP
+Several potential problems are worth mentioning. First, entries like
+.LP
+.RS
+.nf
+\fC\\indexentry{alpha|(}{1}
+\\indexentry{alpha|bold}{3}
+\\indexentry{alpha|)}{5}\fP
+.fi
+.RE
+.LP
+will be interpreted as
+.LP
+.RS
+\fC\\item alpha, \\bold{3}, 1--5\fP
+.RE
+.LP
+but with a warning message in the transcript about encountering an
+inconsistent page encapsulator.
+An explicit range beginning in a Roman page number and ending
+in Arabic is also considered an error. In this instance, (if
+possible) the range is broken into two subranges, one in Roman and the
+other in Arabic. For instance,
+.LP
+.RS
+.nf
+\fC\\indexentry{alpha|(}{i}
+\\indexentry{alpha}{iv}
+\\indexentry{alpha}{3}
+\\indexentry{alpha|)}{7}\fP
+.fi
+.RE
+.LP
+will be turned into
+.LP
+.RS
+\fC\\item alpha, i--iv, 3--7\fP
+.RE
+.LP
+with a warning message in the transcript file complaining about an
+illegal range formation.
+.LP
+Finally, every special symbol mentioned in this section may be
+escaped by the
+.B quote
+operator (`"'). Thus
+.LP
+.RS
+\fC\\indexentry{alpha"@beta}{1}\fP
+.RE
+.LP
+will actually become
+.LP
+.RS
+\fC\\item alpha@beta, 1\fP
+.RE
+.LP
+as a result of executing
+.IR makeindex .
+The quoting power of
+.B quote
+is eliminated if it is immediately preceded
+by
+.B escape
+(`\\'). For example,
+.LP
+.RS
+\fC\\indexentry{f\\"ur}{1}\fP
+.RE
+.LP
+becomes
+.LP
+.RS
+\fC\\item f\\"ur, 1\fP
+.RE
+.LP
+which represents an umlaut-accented `u' to the \*(TX family of
+processors.
+.PP
+From version 2.11 of
+.IR makeindex ,
+the
+.B quote
+operator may quote
+.I any
+character in the range 1 .\|.\|. 255. Character 0 is excluded because
+it is used internally in the
+.I makeindex
+source code as a string terminator. With this change, sort keys can
+be created for all eight-bit characters except 0. The sorting order
+is
+.RS
+.nf
+
+punctuation characters (in ASCII order),
+digits,
+control characters (1 .\|.\|. 31),
+space (32),
+letters (ignoring case),
+characters 127 .\|.\|. 255.
+
+.fi
+.RE
+Here is an example showing the indexing of all printable ASCII
+characters other than letters and digits, assuming the default
+\*(TX format. For convenience, the page number references are
+the corresponding ASCII ordinal values.
+.RS
+.nf
+
+\fC\\indexentry{" @" (space)}{32}
+\\indexentry{"!@"! (exclamation point)}{33}
+\\indexentry{""@"" (quotation mark)}{34}
+\\indexentry{"#@"\\# (sharp sign)}{35}
+\\indexentry{"$@"\\$ (dollar sign)}{36}
+\\indexentry{"%@"\\% (percent sign)}{37}
+\\indexentry{"&@"\\& (ampersand)}{38}
+\\indexentry{"<@"$<$ (left angle bracket)}{60}
+\\indexentry{"=@"= (equals)}{61}
+\\indexentry{">@"$>$ (right angle bracket)}{62}
+\\indexentry{"?@"? (query)}{63}
+\\indexentry{"@@"@ (at sign)}{64}
+\\indexentry{"[@"[ (left square bracket)}{91}
+\\indexentry{"\\@"\\verb=\\= (backslash)}{92}
+\\indexentry{"]@"] (right square bracket)}{93}
+\\indexentry{"^@"\\verb=^= (caret)}{94}
+\\indexentry{"_@"\\verb=_= (underscore)}{95}
+\\indexentry{"`@"\\verb=~= (grave accent)}{96}
+\\indexentry{"{@"\\"{ (left brace)}{123}
+\\indexentry{"|@"\\verb="|= (vertical bar)}{124}
+\\indexentry{"}@"\\"} (right brace)}{125}
+\\indexentry{"~@"\\verb=~= (tilde)}{126}\fP
+
+.fi
+.RE
+Characters in the actual fields following the `@' character which
+have special significance to \*(TX must be represented as control
+sequences, or as math mode characters. Note particularly how the
+entries for the at sign, left and right braces, and the vertical
+bar, are coded. The index file output by
+.I makeindex
+for this example looks like this:
+.RS
+.nf
+
+\fC\\begin{theindex}
+
+ \\item ! (exclamation point), 33
+ \\item " (quotation mark), 34
+ \\item \\# (sharp sign), 35
+ \\item \\$ (dollar sign), 36
+ \\item \\% (percent sign), 37
+ \\item \\& (ampersand), 38
+ \\item $<$ (left angle bracket), 60
+ \\item = (equals), 61
+ \\item $>$ (right angle bracket), 62
+ \\item ? (query), 63
+ \\item @ (at sign), 64
+ \\item [ (left square bracket), 91
+ \\item \\verb=\\= (backslash), 92
+ \\item ] (right square bracket), 93
+ \\item \\verb=^= (caret), 94
+ \\item \\verb=_= (underscore), 95
+ \\item \\verb=~= (grave accent), 96
+ \\item \\{ (left brace), 123
+ \\item \\verb=|= (vertical bar), 124
+ \\item \\} (right brace), 125
+ \\item \\verb=~= (tilde), 126
+
+ \\indexspace
+
+ \\item (space), 32
+
+\\end{theindex}\fP
+.fi
+.RE
+.\"=====================================================================
+.SH "FILES"
+.TP 2.2i
+.I makeindex
+executable file
+.TP
+.I $TEXMFMAIN/tex/plain/misc/idxmac.tex
+\*(TX macro file used by
+.I makeindex
+.TP
+.I $TEXMFMAIN/tex/latex/base/makeidx.sty
+\*(TX macro file used by
+.I makeindex
+.\"=====================================================================
+.SH "SEE ALSO"
+ditroff(1L),
+latex(1L),
+make.index (1L),
+qsort(3),
+tex(1L),
+troff(1L)
+.LP
+.IR "\*(Uc Enhanced troff/\*(Ts \(em An Overview" ,
+R. P. C. Rodgers and Conrad Huang, LSMB Technical Report 90-2,
+UCSF School of Pharmacy, San Francisco, 1990.
+.LP
+.IR "Index Preparation and Processing" ,
+Pehong Chen and Michael A. Harrison,
+.IR "Software: Practice and Experience" ,
+.BR 19 (9),
+897\(en915,
+September 1988.
+.LP
+.IR "Automating Index Preparation" ,
+Pehong Chen and Michael A. Harrison. Technical Report 87/347,
+Computer Science Division, University of California, Berkeley, 1987
+(a \*(LX document supplied with
+.IR makeindex ).
+.LP
+.IR "MakeIndex: An Index Processor for \*(LX" ,
+Leslie Lamport, February 1987 (a \*(LX document supplied
+with
+.IR makeindex ).
+.LP
+.IR "Tools for Printing Indices" ,
+Jon L. Bentley and Brian W. Kernighan,
+.IR "Electronic Publishing \(em Origination, Dissemination, and Design" ,
+1(1), 3\(en18, June 1988 (also available as: Computing Science
+Technical Report No. 128,
+AT&T Bell Laboratories, Murray Hill, NJ 07974, 1986).
+.\"=====================================================================
+.SH "AUTHOR"
+Pehong Chen, Chen & Harrison International Systems, Inc.
+Palo Alto, California, USA <chen@renoir.berkeley.edu>.
+.br
+Manual page extensively revised and corrected, and
+.IR troff (1)
+examples created by Rick P. C. Rodgers, UCSF School
+of Pharmacy <rodgers@cca.ucsf.edu>.
+.\"=====================================================================
+.SH ACKNOWLEDGMENTS
+Leslie Lamport contributed significantly to the design.
+Michael Harrison provided valuable comments and suggestions.
+Nelson Beebe improved on the portable version, and maintains the
+source distribution for the \*(TX Users Group.
+Andreas Brosig contributed to the German word ordering.
+The modification to the
+.B \-ms
+macros was derived from a method proposed by Ravi Sethi of AT&T
+Bell Laboratories.
+The
+.I LOG
+and
+.I CONTRIB
+files in the
+.I makeindex
+source distribution record other contributions.
diff --git a/Build/source/texk/makeindexk/makeindex.rc b/Build/source/texk/makeindexk/makeindex.rc
new file mode 100644
index 00000000000..67a6e3b0b14
--- /dev/null
+++ b/Build/source/texk/makeindexk/makeindex.rc
@@ -0,0 +1,37 @@
+/* makeindex.rc: makeindex resources -*- C++ -*-
+
+ Copyright (C) 1996-2003 Fabrice Popineau <fabrice.popineau@supelec.fr>
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; if not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include <texlive-version.h>
+
+#define VER_FILEVERSION TEXLIVE_MAJOR_VERSION,TEXLIVE_MINOR_VERSION,TEXLIVE_BETA_NUMBER,TEXLIVE_ALPHA_NUMBER
+#define VER_FILEVERSION_STR TEXLIVE_PRODUCTVERSION_STR " makeindex(k) 2.14"
+
+#define VER_INTERNALNAME_STR "makeindex"
+#define VER_ORIGINALFILENAME_STR "makeindex.exe"
+
+#define VER_FILEDESCRIPTION_STR "General Purpose Index Processor"
+
+#define VER_LEGALCOPYRIGHT_STR "Copyright (C) 1989 Chen & Harrison \
+International Systems, Inc. \
+(C) 1988 Olivetti Research Center \
+(C) 1987 Regents of the University of California"
+
+#include <texlive.version>
+
+/* makeindex.rc ends here */
diff --git a/Build/source/texk/makeindexk/mkind.c b/Build/source/texk/makeindexk/mkind.c
new file mode 100644
index 00000000000..bd184308fcb
--- /dev/null
+++ b/Build/source/texk/makeindexk/mkind.c
@@ -0,0 +1,570 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#define MKIND_C 1
+#include "mkind.h"
+#undef MKIND_C
+
+int letter_ordering = FALSE;
+int compress_blanks = FALSE;
+int merge_page = TRUE;
+int init_page = FALSE;
+int even_odd = -1;
+int verbose = TRUE;
+int german_sort = FALSE;
+int thai_sort = FALSE;
+int locale_sort = FALSE;
+int fn_no = -1; /* total number of files */
+int idx_dot = TRUE; /* flag which shows dot in ilg being
+ * active */
+int idx_tt = 0; /* total entry count (all files) */
+int idx_et = 0; /* erroneous entry count (all files) */
+int idx_gt = 0; /* good entry count (all files) */
+
+FIELD_PTR *idx_key;
+FILE *log_fp;
+FILE *sty_fp;
+FILE *idx_fp;
+FILE *ind_fp;
+FILE *ilg_fp;
+
+char *pgm_fn;
+char sty_fn[LINE_MAX];
+char *idx_fn;
+char ind[STRING_MAX];
+char *ind_fn;
+char ilg[STRING_MAX];
+char *ilg_fn;
+char pageno[NUMBER_MAX];
+
+static char log_fn[STRING_MAX];
+static char base[STRING_MAX];
+static int need_version = TRUE;
+
+static void check_all ARGS((char *fn,int ind_given,int ilg_given,
+ int log_given));
+static void check_idx ARGS((char *fn,int open_fn));
+static void find_pageno ARGS((void));
+static void open_sty ARGS((char *fn));
+static void prepare_idx ARGS((void));
+static void process_idx ARGS((char * *fn,int use_stdin,int sty_given,
+ int ind_given,int ilg_given,int log_given));
+
+#ifdef DEBUG
+long totmem = 0L; /* for debugging memory usage */
+#endif /* DEBUG */
+
+int
+#if STDC
+main(int argc, char *argv[])
+#else
+main(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+ char *fns[ARRAY_MAX];
+ char *ap;
+ int use_stdin = FALSE;
+ int sty_given = FALSE;
+ int ind_given = FALSE;
+ int ilg_given = FALSE;
+ int log_given = FALSE;
+
+ /* determine program name */
+ pgm_fn = strrchr(*argv, DIR_DELIM);
+#ifdef ALT_DIR_DELIM
+ {
+ char *alt_delim = strrchr(*argv, ALT_DIR_DELIM);
+
+ if (pgm_fn == NULL || (alt_delim != NULL && alt_delim > pgm_fn))
+ pgm_fn = alt_delim;
+ }
+#endif
+ if (pgm_fn == NULL)
+ pgm_fn = *argv;
+ else
+ pgm_fn++;
+
+#if USE_KPATHSEA
+ kpse_set_progname (pgm_fn); /* use the same name as the intro message */
+#endif
+
+
+ /* process command line options */
+ while (--argc > 0) {
+ if (**++argv == SW_PREFIX) {
+ if (*(*argv + 1) == NUL)
+ break;
+ for (ap = ++*argv; *ap != NUL; ap++)
+ switch (*ap) {
+ /* use standard input */
+ case 'i':
+ use_stdin = TRUE;
+ break;
+
+ /* enable letter ordering */
+ case 'l':
+ letter_ordering = TRUE;
+ break;
+
+ /* disable range merge */
+ case 'r':
+ merge_page = FALSE;
+ break;
+
+ /* supress progress message -- quiet mode */
+ case 'q':
+ verbose = FALSE;
+ break;
+
+ /* compress blanks */
+ case 'c':
+ compress_blanks = TRUE;
+ break;
+
+ /* style file */
+ case 's':
+ argc--;
+ if (argc <= 0)
+ FATAL("Expected -s <stylefile>\n","");
+ open_sty(*++argv);
+ sty_given = TRUE;
+ break;
+
+ /* output index file name */
+ case 'o':
+ argc--;
+ if (argc <= 0)
+ FATAL("Expected -o <ind>\n","");
+ ind_fn = *++argv;
+ ind_given = TRUE;
+ break;
+
+ /* transcript file name */
+ case 't':
+ argc--;
+ if (argc <= 0)
+ FATAL("Expected -t <logfile>\n","");
+ ilg_fn = *++argv;
+ ilg_given = TRUE;
+ break;
+
+ /* initial page */
+ case 'p':
+ argc--;
+ if (argc <= 0)
+ FATAL("Expected -p <num>\n","");
+ strcpy(pageno, *++argv);
+ init_page = TRUE;
+ if (STREQ(pageno, EVEN)) {
+ log_given = TRUE;
+ even_odd = 2;
+ } else if (STREQ(pageno, ODD)) {
+ log_given = TRUE;
+ even_odd = 1;
+ } else if (STREQ(pageno, ANY)) {
+ log_given = TRUE;
+ even_odd = 0;
+ }
+ break;
+
+ /* enable german sort */
+ case 'g':
+ german_sort = TRUE;
+ break;
+
+#ifdef HAVE_SETLOCALE
+ /* enable locale-based sort */
+ case 'L':
+ locale_sort = TRUE;
+ break;
+
+ /* enable Thai sort */
+ case 'T':
+ thai_sort = locale_sort = TRUE;
+ break;
+#endif
+
+ /* bad option */
+ default:
+ FATAL("Unknown option -%c.\n", *ap);
+ break;
+ }
+ } else {
+ if (fn_no < ARRAY_MAX) {
+ check_idx(*argv, FALSE);
+ fns[++fn_no] = *argv;
+ } else {
+ FATAL("Too many input files (max %d).\n", ARRAY_MAX);
+ }
+ }
+ }
+
+ if (fn_no == 0 && !sty_given)
+ {
+ char tmp[STRING_MAX + 5];
+
+ /* base set by last call to check_idx */
+ sprintf (tmp, "%s%s", base, INDEX_STY);
+ if (0 == access(tmp, R_OK)) {
+ open_sty (tmp);
+ sty_given = TRUE;
+ }
+ }
+
+ process_idx(fns, use_stdin, sty_given, ind_given, ilg_given, log_given);
+ idx_gt = idx_tt - idx_et;
+ ALL_DONE;
+ if (idx_gt > 0) {
+ prepare_idx();
+ sort_idx();
+ gen_ind();
+ MESSAGE("Output written in %s.\n", ind_fn);
+ } else
+ MESSAGE("Nothing written in %s.\n", ind_fn);
+
+ MESSAGE("Transcript written in %s.\n", ilg_fn);
+ CLOSE(ind_fp);
+ CLOSE(ilg_fp);
+ EXIT(0);
+
+ return (0); /* never executed--avoids complaints */
+ /* about no return value */
+}
+
+
+static void
+prepare_idx(VOID_ARG)
+{
+ NODE_PTR ptr = head;
+ int i = 0;
+
+#ifdef DEBUG
+ totmem += idx_gt * sizeof(FIELD_PTR);
+ (void)fprintf(stderr,"prepare_idx(): calloc(%d,%d)\ttotmem = %ld\n",
+ idx_gt,sizeof(FIELD_PTR),totmem);
+#endif /* DEBUG */
+
+ if (head == (NODE_PTR)NULL)
+ FATAL("No valid index entries collected.\n", "");
+
+ if ((idx_key = (FIELD_PTR *) calloc(idx_gt, sizeof(FIELD_PTR))) == NULL) {
+ FATAL("Not enough core...abort.\n", "");
+ }
+ for (i = 0; i < idx_gt; i++) {
+ idx_key[i] = &(ptr->data);
+ ptr = ptr->next;
+ }
+}
+
+
+static void
+#if STDC
+process_idx(char *fn[], int use_stdin, int sty_given, int ind_given,
+ int ilg_given, int log_given)
+#else
+process_idx(fn, use_stdin, sty_given, ind_given, ilg_given, log_given)
+char *fn[];
+int use_stdin;
+int sty_given;
+int ind_given;
+int ilg_given;
+int log_given;
+#endif
+{
+ int i;
+
+ if (fn_no == -1)
+ /* use stdin if no input files specified */
+ use_stdin = TRUE;
+ else {
+ check_all(fn[0], ind_given, ilg_given, log_given);
+ PUT_VERSION;
+ if (sty_given)
+ scan_sty();
+ if (german_sort && (idx_quote == '"'))
+FATAL("Option -g invalid, quote character must be different from '%c'.\n",
+'"');
+ scan_idx();
+ ind_given = TRUE;
+ ilg_given = TRUE;
+ for (i = 1; i <= fn_no; i++) {
+ check_idx(fn[i], TRUE);
+ scan_idx();
+ }
+ }
+
+ if (use_stdin) {
+ idx_fn = "stdin";
+ idx_fp = stdin;
+
+ if (ind_given) {
+ if (!ind_fp && ((ind_fp = OPEN_OUT(ind_fn)) == NULL))
+ FATAL("Can't create output index file %s.\n", ind_fn);
+ } else {
+ ind_fn = "stdout";
+ ind_fp = stdout;
+ }
+
+ if (ilg_given) {
+ if (!ilg_fp && ((ilg_fp = OPEN_OUT(ilg_fn)) == NULL))
+ FATAL("Can't create transcript file %s.\n", ilg_fn);
+ } else {
+ ilg_fn = "stderr";
+ ilg_fp = stderr;
+ /* This is already equivalent to verbose mode... */
+ verbose = FALSE;
+ }
+
+ if ((fn_no == -1) && (sty_given))
+ scan_sty();
+ if (german_sort && (idx_quote == '"'))
+FATAL("Option -g ignored, quote character must be different from '%c'.\n",
+'"');
+
+ if (need_version) {
+ PUT_VERSION;
+ }
+ scan_idx();
+ fn_no++;
+ }
+}
+
+
+static void
+#if STDC
+check_idx(char *fn, int open_fn)
+#else
+check_idx(fn, open_fn)
+char *fn;
+int open_fn;
+#endif
+{
+ char *ptr = fn;
+ char *ext;
+ int with_ext = FALSE;
+ int i = 0;
+
+ ext = strrchr(fn, EXT_DELIM);
+ if ((ext != NULL) && (ext != fn) && (strchr(ext + 1, DIR_DELIM) == NULL)
+#ifdef ALT_DIR_DELIM
+ && (strchr(ext + 1, ALT_DIR_DELIM) == NULL)
+#endif
+ ) {
+ with_ext = TRUE;
+ while ((ptr != ext) && (i < STRING_MAX))
+ base[i++] = *ptr++;
+ } else
+ while ((*ptr != NUL) && (i < STRING_MAX))
+ base[i++] = *ptr++;
+
+ if (i < STRING_MAX)
+ base[i] = NUL;
+ else
+ FATAL2("Index file name %s too long (max %d).\n",
+ base, STRING_MAX);
+
+ idx_fn = fn;
+
+ if ( ( open_fn &&
+ ((idx_fp = OPEN_IN(idx_fn)) == NULL)
+ ) ||
+ ((!open_fn) && (access(idx_fn, R_OK) != 0)))
+ if (with_ext) {
+ FATAL("Input index file %s not found.\n", idx_fn);
+ } else {
+
+#ifdef DEBUG
+ totmem += STRING_MAX;
+ (void)fprintf(stderr,"check_idx()-2: malloc(%d)\ttotmem = %ld\n",
+ STRING_MAX,totmem);
+#endif /* DEBUG */
+
+ if ((idx_fn = (char *) malloc(STRING_MAX)) == NULL)
+ FATAL("Not enough core...abort.\n", "");
+ sprintf(idx_fn, "%s%s", base, INDEX_IDX);
+ if ((open_fn &&
+ ((idx_fp = OPEN_IN(idx_fn)) == NULL)
+ ) ||
+ ((!open_fn) && (access(idx_fn, R_OK) != 0))) {
+ FATAL2("Couldn't find input index file %s nor %s.\n", base,
+ idx_fn);
+ }
+ }
+}
+
+
+static void
+#if STDC
+check_all(char *fn, int ind_given, int ilg_given, int log_given)
+#else
+check_all(fn, ind_given, ilg_given, log_given)
+char *fn;
+int ind_given;
+int ilg_given;
+int log_given;
+#endif
+{
+ check_idx(fn, TRUE);
+
+ /* index output file */
+ if (!ind_given) {
+ sprintf(ind, "%s%s", base, INDEX_IND);
+ ind_fn = ind;
+ }
+ if ((ind_fp = OPEN_OUT(ind_fn)) == NULL)
+ FATAL("Can't create output index file %s.\n", ind_fn);
+
+ /* index transcript file */
+ if (!ilg_given) {
+ sprintf(ilg, "%s%s", base, INDEX_ILG);
+ ilg_fn = ilg;
+ }
+ if ((ilg_fp = OPEN_OUT(ilg_fn)) == NULL)
+ FATAL("Can't create transcript file %s.\n", ilg_fn);
+
+ if (log_given) {
+ sprintf(log_fn, "%s%s", base, INDEX_LOG);
+ if ((log_fp = OPEN_IN(log_fn)) == NULL) {
+ FATAL("Source log file %s not found.\n", log_fn);
+ } else {
+ find_pageno();
+ CLOSE(log_fp);
+ }
+ }
+}
+
+
+static void
+find_pageno(VOID_ARG)
+{
+ int i = 0;
+ int p, c;
+
+ fseek(log_fp, -1L, 2);
+ p = GET_CHAR(log_fp);
+ fseek(log_fp, -2L, 1);
+ do {
+ c = p;
+ p = GET_CHAR(log_fp);
+ } while (!(((p == LSQ) && isdigit(c)) || (fseek(log_fp, -2L, 1) != 0)));
+ if (p == LSQ) {
+ while ((c = GET_CHAR(log_fp)) == SPC);
+ do {
+ pageno[i++] = (char) c;
+ c = GET_CHAR(log_fp);
+ } while (isdigit(c));
+ pageno[i] = NUL;
+ } else {
+ fprintf(ilg_fp, "Couldn't find any page number in %s...ignored\n",
+ log_fn);
+ init_page = FALSE;
+ }
+}
+
+static void
+#if STDC
+open_sty(char *fn)
+#else
+open_sty(fn)
+char *fn;
+#endif
+{
+ char *path;
+ char *ptr;
+ int i;
+ int len;
+#if USE_KPATHSEA
+ char *found;
+
+ if ((found = kpse_find_file (fn, kpse_ist_format, 1)) == NULL) {
+ FATAL("Index style file %s not found.\n", fn);
+ } else {
+ strcpy(sty_fn,found);
+ if ((sty_fp = OPEN_IN(sty_fn)) == NULL) {
+ FATAL("Could not open style file %s.\n", sty_fn);
+ }
+ }
+#else
+ if ((path = getenv(STYLE_PATH)) == NULL) {
+ /* style input path not defined */
+ strcpy(sty_fn, fn);
+ sty_fp = OPEN_IN(sty_fn);
+ } else {
+ len = ARRAY_MAX - strlen(fn) - 1;
+ while (*path != NUL) {
+ ptr = strchr(path, ENV_SEPAR);
+ i = 0;
+ if (ptr == (char*)NULL)
+ {
+ int j = strlen(path);
+
+ while (i < j)
+ sty_fn[i++] = *path++;
+ }
+ else
+ {
+ while ((path != ptr) && (i < len))
+ sty_fn[i++] = *path++;
+ }
+ if (i == len) {
+ FATAL2("Path %s too long (max %d).\n", sty_fn, ARRAY_MAX);
+ } else {
+ sty_fn[i++] = DIR_DELIM;
+ sty_fn[i] = NUL;
+ strcat(sty_fn, fn);
+ if ((sty_fp = OPEN_IN(sty_fn)) == NULL)
+ path++;
+ else
+ break;
+ }
+ }
+ }
+
+ if (sty_fp == NULL)
+ FATAL("Index style file %s not found.\n", fn);
+#endif
+}
+
+
+int
+#if STDC
+strtoint(char *str)
+#else
+strtoint(str)
+char *str;
+#endif
+{
+ int val = 0;
+
+ while (*str != NUL) {
+ val = 10 * val + *str - 48;
+ str++;
+ }
+ return (val);
+}
diff --git a/Build/source/texk/makeindexk/mkind.h b/Build/source/texk/makeindexk/mkind.h
new file mode 100644
index 00000000000..a00d94d3727
--- /dev/null
+++ b/Build/source/texk/makeindexk/mkind.h
@@ -0,0 +1,586 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#include "c-auto.h"
+
+/***********************************************************************
+
+ INSTALLATION NOTES
+ <11-Nov-1989>
+
+ At compile-time (or here, if compile-time definition is not
+ available), set non-zero ONE OS_xxxx operating system flag, and if
+ more than one compiler is available, ONE compiler flag:
+
+ Operating Systems Compiler(s)
+ ================= ===========
+ OS_ATARI
+ OS_BS2000 CCD_2000
+ OS_BSD
+ OS_MVSXA IBM_C370
+ OS_VMCMS IBM_C370
+ OS_PCDOS IBM_PC_MICROSOFT
+ OS_SYSV
+ OS_TOPS20 KCC_20 or PCC_20
+ OS_VAXVMS
+ OS_XENIX
+ ================= ===========
+
+ If no OS_xxxx symbol is defined, OS_BSD is assumed.
+
+ If Standard C prototypes are supported, define the symbol
+ STDC_PROTOTYPES in the appropriate OS_xxxx section below, and insert
+ #include's for the standard system files which define library
+ prototypes. STDC_PROTOTYPES will be defined automatically if
+ __STDC__ is; the latter must be defined by all Standard C conformant
+ implementations.
+
+ All function declarations in MakeIndex are contained at the end of
+ this file. If 185STDC_PROTOTYPES is not selected, then all the standard
+ library functions must be declared explicitly.
+
+ If the host system restricts external names to 6 characters, set
+ SHORTNAMES non-zero in the appropriate OS_xxxx section below.
+
+ Installing MakeIndex under BS2000 requires at least Version 8.5
+ supporting Multiple Public Volume Sets (MPVS). Define WORK in this
+ file to your CATID (default :w:) for temporary files (.ilg, .ind),
+ in case of no MPVS support define WORK to NIL.
+
+*/
+
+/**********************************************************************/
+
+#define STDC (__STDC__ || __cplusplus)
+
+/*
+ * Establish needed operating symbols (defaulting to OS_BSD if none
+ * specified at compile time). If you add one, add it to the check
+ * list at the end of this section, too.
+ */
+
+#define SHORTNAMES 0
+#define STDC_PROTOTYPES STDC
+
+/**********************************************************************/
+
+#ifndef USE_KPATHSEA
+#define USE_KPATHSEA 1
+#endif
+
+#if USE_KPATHSEA
+#ifndef DEBUG /* strange logic: makeindex uses DEBUG to force debugging */
+#define NO_DEBUG /* kpathsea uses NO_DEBUG to suppress it. */
+#endif
+#include <kpathsea/config.h>
+#include <kpathsea/c-limits.h>
+#include <kpathsea/c-memstr.h>
+#include <kpathsea/magstep.h>
+#include <kpathsea/proginit.h>
+#include <kpathsea/progname.h>
+#include <kpathsea/tex-glyph.h>
+#include <kpathsea/expand.h>
+#include <c-auto.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+#ifndef HAVE_STRCHR
+#define strchr index /* convert STDC form to old K&R form */
+#endif
+
+#ifndef HAVE_STRRCHR
+#define strrchr rindex /* convert STDC form to old K&R form */
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <string.h>
+#endif
+#endif
+
+#ifdef HAVE_TYPES_H
+#include <types.h>
+#endif
+
+#if SHORTNAMES
+/*
+ * Provide alternate external names which are unique in the first SIX
+ * characters as required for portability (and Standard C)
+ */
+#define check_all chk_all
+#define check_idx chk_idx
+#define check_mixsym chk_mix
+#define compare_one cmp_one
+#define compare_page cmp_page
+#define compare_string cmp_string
+#define delim_n dlm_n
+#define delim_p dlm_p
+#define delim_r dlm_r
+#define delim_t dlm_t
+#define encap_i ecp_i
+#define encap_p ecp_p
+#define encap_range ecp_range
+#define encap_s ecp_s
+#define group_skip grp_skip
+#define group_type grp_type
+#define idx_aclose idxaclose
+#define idx_actual idxactual
+#define idx_keyword idx_kwd
+#define indent_length ind_length
+#define indent_space ind_space
+#define headings_flag hd_flag
+#define heading_pre hd_pre
+#define heading_suf hd_suf
+#define symhead_pos sym_pos
+#define symhead_neg sym_neg
+#define numhead_pos num_pos
+#define numhead_neg num_neg
+#define process_idx prc_idx
+#define process_precedence prc_pre
+#define range_ptr rng_ptr
+#define scan_alpha_lower scnalw
+#define scan_alpha_upper scnaup
+#define scan_arabic scnarabic
+#define scan_arg1 scna1
+#define scan_arg2 scna2
+#define scan_char scnchr
+#define scan_field scnfld
+#define scan_idx scnidx
+#define scan_key scnkey
+#define scan_no scnno
+#define scan_roman_lower scnrlw
+#define scan_roman_upper scnrup
+#define scan_spec scnspc
+#define scan_string scnstr
+#define scan_style scnsty
+#define setpagelen spg_len
+#define setpage_close spg_close
+#define setpage_open spg_open
+#define suffix_2p suf_2p
+#define suffix_3p suf_3p
+#define suffix_mp suf_mp
+#endif /* SHORTNAMES */
+
+#define EXIT exit
+
+#undef TRUE
+#define TRUE 1
+
+#undef FALSE
+#define FALSE 0
+
+#undef NUL
+#define NUL '\0'
+
+#undef NIL
+#define NIL ""
+
+#define TAB '\t'
+#define LFD '\n'
+#define SPC ' '
+#define LSQ '['
+#define RSQ ']'
+#define BSH '\\'
+
+#ifdef DOSISH
+#define ENV_SEPAR ';'
+#define DIR_DELIM '/'
+#define ALT_DIR_DELIM '\\'
+#define IS_DIR_DELIM(c) ((c) == DIR_DELIM || (c) == ALT_DIR_DELIM)
+#else /* not DOSISH */
+#define ENV_SEPAR ':'
+#define DIR_DELIM '/'
+#define IS_DIR_DELIM(c) ((c) == DIR_DELIM)
+#endif /* not DOSISH */
+
+#ifndef SW_PREFIX /* can override at compile time */
+#define SW_PREFIX '-'
+#endif
+
+#define EXT_DELIM '.'
+#define ROMAN_SIGN '*'
+#define EVEN "even"
+#define ODD "odd"
+#define ANY "any"
+
+#define GET_CHAR getc
+
+#define TOASCII(i) (char)((i) + 48)
+
+/* NB: The typecasts here are CRITICAL for correct sorting of entries
+ that use characters in the range 128..255! */
+#define TOLOWER(C) (isupper((unsigned char)(C)) ? \
+ (unsigned char)tolower((unsigned char)(C)) : (unsigned char)(C))
+#define TOUPPER(C) (isupper((unsigned char)(C)) ? \
+ (unsigned char)(C) : (unsigned char)toupper((unsigned char)(C)))
+
+#if USE_KPATHSEA /* kpathsea defines STREQ */
+#undef STREQ
+#undef STRNEQ
+#endif
+
+#define STREQ(A, B) (strcmp(A, B) == 0)
+#define STRNEQ(A, B) (strcmp(A, B) != 0)
+
+#define MESSAGE(F, S) { \
+ if (verbose) \
+ fprintf(stderr, F, S); \
+ fprintf(ilg_fp, F, S); \
+}
+
+#if USE_KPATHSEA /* kpathsea defines a different FATAL */
+#undef FATAL
+#endif
+
+#define FATAL(F, S) { \
+ fprintf(stderr, F, S); \
+ fprintf(stderr, USAGE, pgm_fn); \
+ EXIT(1); \
+}
+
+#if USE_KPATHSEA /* kpathsea defines a different FATAL2 */
+#undef FATAL2
+#endif
+
+#define FATAL2(F, D1, D2) { \
+ fprintf(stderr, F, D1, D2); \
+ fprintf(stderr, USAGE, pgm_fn); \
+ EXIT(1); \
+}
+
+#define OPEN_IN(FP) fopen(FP, "r")
+#define OPEN_OUT(FP) fopen(FP, "w")
+#define CLOSE(FP) fclose(FP)
+
+#define ISDIGIT(C) ('0' <= C && C <= '9')
+#define ISSYMBOL(C) (('!' <= C && C <= '@') || \
+ ('[' <= C && C <= '`') || \
+ ('{' <= C && C <= '~'))
+
+/*====================================================================
+Many arrays in MakeIndex are dimensioned [xxx_MAX], where the xxx_MAX
+values are defined below. The use of each of these is described in
+comments. However, no run-time check is made to ensure that these are
+consistent, or reasonable! Therefore, change them only with great
+care.
+
+The array sizes should be made generously large: there are a great
+many uses of strings in MakeIndex with the strxxx() and sprintf()
+functions where no checking is done for adequate target storage sizes.
+Although some input checking is done to avoid this possibility, it is
+highly likely that there are still several places where storage
+violations are possible, with core dumps, or worse, incorrect output,
+ensuing.
+======================================================================*/
+
+#define ARABIC_MAX 10 /* maximum digits in an Arabic page */
+ /* number field */
+
+#define ARGUMENT_MAX 1024 /* maximum length of sort or actual key */
+ /* in index entry */
+
+#define ARRAY_MAX 1024 /* maximum length of constant values in */
+ /* style file */
+
+#define FIELD_MAX 3 /* maximum levels of index entries (item, */
+ /* subitem, subsubitem); cannot be */
+ /* increased beyond 3 without */
+ /* significant design changes (no field */
+ /* names are known beyond 3 levels) */
+
+#ifdef LINE_MAX /* IBM RS/6000 AIX has this in <sys/limits.h> */
+#undef LINE_MAX
+#endif
+#define LINE_MAX 72 /* maximum output line length (longer */
+ /* ones wrap if possible) */
+
+#define NUMBER_MAX 16 /* maximum digits in a Roman or Arabic */
+ /* page number */
+ /* (MAX(ARABIC_MAX,ROMAN_MAX)) */
+
+#define PAGEFIELD_MAX 10 /* maximum fields in a composite page */
+ /* number */
+
+#define PAGETYPE_MAX 5 /* fixed at 5; see use in scanst.c */
+
+#define ROMAN_MAX 16 /* maximum length of Roman page number */
+ /* field */
+
+#define STRING_MAX 256 /* maximum length of host filename */
+
+/*====================================================================*/
+
+#if USE_KPATHSEA
+#define VERSION "version 2.14 [02-Oct-2002] (kpathsea + Thai support)"
+#else
+#define VERSION "version 2.14 [02-Oct-2002] (with Thai support)"
+#endif
+
+#define PUT_VERSION { \
+ MESSAGE("This is %s, ", pgm_fn); \
+ MESSAGE("%s.\n", VERSION); \
+ need_version = FALSE; \
+}
+
+#ifdef HAVE_SETLOCALE
+#define USAGE \
+ "Usage: %s [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]\n"
+#else
+#define USAGE \
+ "Usage: %s [-ilqrcg] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]\n"
+#endif
+
+#define STYLE_PATH "INDEXSTYLE" /* environment variable defining search */
+ /* path for style files */
+#define INDEX_IDX ".idx"
+#define INDEX_ILG ".ilg"
+#define INDEX_IND ".ind"
+#define INDEX_STY ".mst"
+
+#define INDEX_LOG ".log"
+
+#define EMPTY -9999
+#define ROML 0
+#define ROMU 1
+#define ARAB 2
+#define ALPL 3
+#define ALPU 4
+#define DUPLICATE 9999
+
+#define SYMBOL -1
+#define ALPHA -2
+
+#define GERMAN 0
+
+typedef struct KFIELD
+{
+ char *sf[FIELD_MAX]; /* sort key */
+ char *af[FIELD_MAX]; /* actual key */
+ int group; /* key group */
+ char lpg[NUMBER_MAX]; /* literal page */
+ int npg[PAGEFIELD_MAX]; /* page field array */
+ short count; /* page field count */
+ short type; /* page number type */
+ char *encap; /* encapsulator */
+ char *fn; /* input filename */
+ int lc; /* line number */
+} FIELD, *FIELD_PTR;
+
+typedef struct KNODE
+{
+ FIELD data;
+ struct KNODE *next;
+} NODE, *NODE_PTR;
+
+extern int letter_ordering;
+extern int compress_blanks;
+extern int init_page;
+extern int merge_page;
+extern int even_odd;
+extern int verbose;
+extern int german_sort;
+extern int thai_sort;
+extern int locale_sort;
+
+extern char idx_keyword[ARRAY_MAX];
+extern char idx_aopen;
+extern char idx_aclose;
+extern char idx_level;
+extern char idx_ropen;
+extern char idx_rclose;
+extern char idx_quote;
+extern char idx_actual;
+extern char idx_encap;
+extern char idx_escape;
+
+extern char page_comp[ARRAY_MAX];
+extern int page_offset[PAGETYPE_MAX];
+
+extern char preamble[ARRAY_MAX];
+extern char postamble[ARRAY_MAX];
+extern char setpage_open[ARRAY_MAX];
+extern char setpage_close[ARRAY_MAX];
+extern char group_skip[ARRAY_MAX];
+extern int headings_flag;
+extern char heading_pre[ARRAY_MAX];
+extern char heading_suf[ARRAY_MAX];
+extern char symhead_pos[ARRAY_MAX];
+extern char symhead_neg[ARRAY_MAX];
+extern char numhead_pos[ARRAY_MAX];
+extern char numhead_neg[ARRAY_MAX];
+extern int prelen;
+extern int postlen;
+extern int skiplen;
+extern int headprelen;
+extern int headsuflen;
+extern int setpagelen;
+
+extern char item_r[FIELD_MAX][ARRAY_MAX];
+extern char item_u[FIELD_MAX][ARRAY_MAX];
+extern char item_x[FIELD_MAX][ARRAY_MAX];
+extern int ilen_r[FIELD_MAX];
+extern int ilen_u[FIELD_MAX];
+extern int ilen_x[FIELD_MAX];
+
+extern char delim_p[FIELD_MAX][ARRAY_MAX];
+extern char delim_n[ARRAY_MAX];
+extern char delim_r[ARRAY_MAX];
+extern char delim_t[ARRAY_MAX];
+
+extern char suffix_2p[ARRAY_MAX];
+extern char suffix_3p[ARRAY_MAX];
+extern char suffix_mp[ARRAY_MAX];
+
+extern char encap_p[ARRAY_MAX];
+extern char encap_i[ARRAY_MAX];
+extern char encap_s[ARRAY_MAX];
+
+extern int linemax;
+extern char indent_space[ARRAY_MAX];
+extern int indent_length;
+
+extern FILE *idx_fp;
+extern FILE *sty_fp;
+extern FILE *ind_fp;
+extern FILE *ilg_fp;
+
+extern char *idx_fn;
+extern char *pgm_fn;
+extern char *ind_fn;
+extern char *ilg_fn;
+
+#ifndef MKIND_C
+extern char sty_fn[];
+extern char ind[];
+extern char ilg[];
+extern char pageno[];
+
+#ifdef DEBUG
+extern long totmem;
+#endif /* DEBUG */
+
+#endif
+
+extern FIELD_PTR *idx_key;
+extern NODE_PTR head;
+extern NODE_PTR tail;
+
+extern int idx_dot;
+extern int idx_tt;
+extern int idx_gt;
+extern int idx_et;
+extern int idx_dc;
+
+#define DOT "."
+#define DOT_MAX 1000
+#define CMP_MAX 1500
+
+#define IDX_DOT(MAX) { \
+ idx_dot = TRUE; \
+ if (idx_dc++ == 0) { \
+ if (verbose) \
+ fprintf(stderr, DOT); \
+ fprintf(ilg_fp, DOT); \
+ } \
+ if (idx_dc == MAX) \
+ idx_dc = 0; \
+}
+
+#define ALL_DONE { \
+ if (fn_no > 0) { \
+ if (verbose) \
+fprintf(stderr, \
+ "Overall %d files read (%d entries accepted, %d rejected).\n", \
+ fn_no+1, idx_gt, idx_et); \
+fprintf(ilg_fp, \
+ "Overall %d files read (%d entries accepted, %d rejected).\n", \
+ fn_no+1, idx_gt, idx_et); \
+ } \
+}
+
+#define DONE(A, B, C, D) { \
+ if (verbose) \
+ fprintf(stderr, "done (%d %s, %d %s).\n", (A), B, C, D); \
+ fprintf(ilg_fp, "done (%d %s, %d %s).\n", (A), B, C, D); \
+}
+
+#if STDC_PROTOTYPES
+#define ARGS(arg_list) arg_list
+#define VOIDP void*
+#define VOID_ARG void
+#else
+#define ARGS(arg_list) ()
+#define const
+#define VOIDP char*
+#define VOID_ARG
+#endif
+
+extern void gen_ind ARGS((void));
+extern int group_type ARGS((char *str));
+extern int main ARGS((int argc, char **argv));
+extern void qqsort ARGS((char *base, int n, int size,
+ int (*compar)ARGS((char*,char*))));
+extern void scan_idx ARGS((void));
+extern void scan_sty ARGS((void));
+extern void sort_idx ARGS((void));
+extern int strtoint ARGS((char *str));
+
+#if STDC
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if __NeXT__
+int access ARGS((const char *, int));
+#else
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#endif
+#else
+/* Miscellaneous standard library routines */
+int access ARGS((const char *, int));
+
+char *getenv ARGS((const char *name));
+
+char *strchr ARGS((const char *s,int c));
+char *strrchr ARGS((const char *s,int c));
+#ifndef USE_KPATHSEA
+VOIDP calloc ARGS((size_t nitems,size_t size));
+VOIDP malloc ARGS((size_t size));
+#endif
+#endif /* __STDC__ */
+
+#ifndef R_OK
+#define R_OK 4 /* only symbol from sys/file.h */
+#endif
diff --git a/Build/source/texk/makeindexk/mkindex b/Build/source/texk/makeindexk/mkindex
new file mode 100755
index 00000000000..565f805695d
--- /dev/null
+++ b/Build/source/texk/makeindexk/mkindex
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+test -f /bin/sh5 && test -z "$RUNNING_SH5" \
+ && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
+ && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
+unset RUNNING_SH5
+
+test -f /bin/bsh && test -z "$RUNNING_BSH" \
+ && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
+ && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
+unset RUNNING_BSH
+
+progname=`basename $0`
+case $# in
+ 0)
+ echo "usage: `basename $0` file[.idx] ..." 1>&2
+ exit 1
+ ;;
+esac
+
+gind=gind.ist
+gglo=gglo.ist
+
+# remember starting directory
+dir=`pwd`
+
+# loop over all files
+for i
+do
+ destdir=`echo $i | sed 's/^[^\/]*$/./; s/\/[^\/]*$//'`
+ test -d "$destdir"||continue
+ cd "$destdir"
+ FILENAME=`basename $i .idx`
+ test -f "$FILENAME".idx \
+ && makeindex -s $gind "$FILENAME"
+ test -f "$FILENAME".glo \
+ && makeindex -s $gglo -o "$FILENAME".gls "$FILENAME".glo
+ cd "$dir"
+done
diff --git a/Build/source/texk/makeindexk/mkindex.1 b/Build/source/texk/makeindexk/mkindex.1
new file mode 100644
index 00000000000..503b70020fd
--- /dev/null
+++ b/Build/source/texk/makeindexk/mkindex.1
@@ -0,0 +1,42 @@
+.TH "mkindex" "1" "September 2000" "teTeX" "teTeX"
+.PP
+.SH "NAME"
+mkindex \- script to process LaTeX index and glossary files
+.PP
+.SH "SYNOPSIS"
+.PP
+\fBmkindex\fP \fIBASENAME\fP[\&.idx] \&.\&.\&.
+.PP
+.SH "DESCRIPTION"
+.PP
+\fBmkindex\fP runs \fBmakeindex\fP(1) on any index
+(\f(CW\&.idx\fP) or glossary (\f(CW\&.glo\fP) files created by TeXing the file
+\fI\fIBASENAME\fP\&.tex\fP\&.
+.PP
+.SH "FILES"
+.IP "\fIgind\&.ist\fP"
+MakeIndex index style file
+.IP
+.IP "\fIgglo\&.ist\fP"
+MakeIndex glossary style file
+.IP
+.PP
+.SH "SEE ALSO"
+.PP
+\fBmakeindex\fP(1)
+.PP
+.SH "BUGS"
+.PP
+None known, but report any bugs found to <tetex@informatik\&.uni-hannover\&.de> (mailing list)\&.
+.PP
+.SH "AUTHOR"
+.PP
+Written by Thomas Esser
+<te@informatik\&.uni-hannover\&.de>\&.
+.PP
+This manual page was written by C\&.M\&. Connelly
+<c@eskimo\&.com>, for
+the Debian GNU/Linux system\&. It may be used by other distributions
+without contacting the author\&. Any mistakes or omissions in the
+manual page are my fault; inquiries about or corrections to this
+manual page should be directed to me (and not to the primary author)\&.
diff --git a/Build/source/texk/makeindexk/qsort.c b/Build/source/texk/makeindexk/qsort.c
new file mode 100644
index 00000000000..7223a205450
--- /dev/null
+++ b/Build/source/texk/makeindexk/qsort.c
@@ -0,0 +1,222 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * This file is public domain software donated by
+ * Nelson Beebe (beebe@science.utah.edu).
+ *
+ */
+
+/*
+ * qsort.c: Our own version of the system qsort routine which is faster by an
+ * average of 25%, with lows and highs of 10% and 50%. The THRESHold below is
+ * the insertion sort threshold, and has been adjusted for records of size 48
+ * bytes. The MTHREShold is where we stop finding a better median.
+ */
+
+/* #include <stdio.h> -- mkind.h includes this */
+#include "mkind.h" /* only for type declarations */
+
+#define THRESH 4 /* threshold for insertion */
+#define MTHRESH 6 /* threshold for median */
+
+static int qsz; /* size of each record */
+static int thresh; /* THRESHold in chars */
+static int mthresh; /* MTHRESHold in chars */
+
+static int (*qcmp) ARGS((char*,char*)); /* the comparison routine */
+static void qst ARGS((char *base, char *max));
+/*
+ * qqsort: First, set up some global parameters for qst to share. Then,
+ * quicksort with qst(), and then a cleanup insertion sort ourselves. Sound
+ * simple? It's not...
+ */
+
+void
+#if STDC
+qqsort(char *base, int n, int size, int (*compar) ARGS((char*,char*)))
+#else
+qqsort(base, n, size, compar)
+char *base;
+int n;
+int size;
+int (*compar) ARGS((char*,char*));
+#endif
+{
+ register char *i;
+ register char *j;
+ register char *lo;
+ register char *hi;
+ register char *min;
+ register char c;
+ char *max;
+
+ if (n <= 1)
+ return;
+ qsz = size;
+ qcmp = compar;
+ thresh = qsz * THRESH;
+ mthresh = qsz * MTHRESH;
+ max = base + n * qsz;
+ if (n >= THRESH) {
+ qst(base, max);
+ hi = base + thresh;
+ } else {
+ hi = max;
+ }
+ /*
+ * First put smallest element, which must be in the first THRESH, in the
+ * first position as a sentinel. This is done just by searching the
+ * first THRESH elements (or the first n if n < THRESH), finding the min,
+ * and swapping it into the first position.
+ */
+ for (j = lo = base; (lo += qsz) < hi;) {
+ if ((*qcmp) (j, lo) > 0)
+ j = lo;
+ }
+ if (j != base) { /* swap j into place */
+ for (i = base, hi = base + qsz; i < hi;) {
+ c = *j;
+ *j++ = *i;
+ *i++ = c;
+ }
+ }
+ /*
+ * With our sentinel in place, we now run the following hyper-fast
+ * insertion sort. For each remaining element, min, from [1] to [n-1],
+ * set hi to the index of the element AFTER which this one goes. Then, do
+ * the standard insertion sort shift on a character at a time basis for
+ * each element in the frob.
+ */
+ for (min = base; (hi = min += qsz) < max;) {
+ while ((*qcmp) (hi -= qsz, min) > 0);
+ if ((hi += qsz) != min) {
+ for (lo = min + qsz; --lo >= min;) {
+ c = *lo;
+ for (i = j = lo; (j -= qsz) >= hi; i = j)
+ *i = *j;
+ *i = c;
+ }
+ }
+ }
+}
+
+
+
+/*
+ * qst: Do a quicksort. First, find the median element, and put that one in
+ * the first place as the discriminator. (This "median" is just the median
+ * of the first, last and middle elements). (Using this median instead of
+ * the first element is a big win). Then, the usual partitioning/swapping,
+ * followed by moving the discriminator into the right place. Then, figure
+ * out the sizes of the two partions, do the smaller one recursively and the
+ * larger one via a repeat of this code. Stopping when there are less than
+ * THRESH elements in a partition and cleaning up with an insertion sort (in
+ * our caller) is a huge win. All data swaps are done in-line, which is
+ * space-losing but time-saving. (And there are only three places where this
+ * is done).
+ */
+
+static void
+#if STDC
+qst(char *base, char *max)
+#else
+qst(base, max)
+char *base;
+char *max;
+#endif
+{
+ register char *i;
+ register char *j;
+ register char *jj;
+ register char *mid;
+ register int ii;
+ register char c;
+ char *tmp;
+ int lo;
+ int hi;
+
+ lo = (int)(max - base); /* number of elements as chars */
+ do {
+ /*
+ * At the top here, lo is the number of characters of elements in the
+ * current partition. (Which should be max - base). Find the median
+ * of the first, last, and middle element and make that the middle
+ * element. Set j to largest of first and middle. If max is larger
+ * than that guy, then it's that guy, else compare max with loser of
+ * first and take larger. Things are set up to prefer the middle,
+ * then the first in case of ties.
+ */
+ mid = i = base + qsz * ((unsigned) (lo / qsz) >> 1);
+ if (lo >= mthresh) {
+ j = ((*qcmp) ((jj = base), i) > 0 ? jj : i);
+ if ((*qcmp) (j, (tmp = max - qsz)) > 0) {
+ /* switch to first loser */
+ j = (j == jj ? i : jj);
+ if ((*qcmp) (j, tmp) < 0)
+ j = tmp;
+ }
+ if (j != i) {
+ ii = qsz;
+ do {
+ c = *i;
+ *i++ = *j;
+ *j++ = c;
+ } while (--ii);
+ }
+ }
+ /* Semi-standard quicksort partitioning/swapping */
+ for (i = base, j = max - qsz;;) {
+ while (i < mid && (*qcmp) (i, mid) <= 0)
+ i += qsz;
+ while (j > mid) {
+ if ((*qcmp) (mid, j) <= 0) {
+ j -= qsz;
+ continue;
+ }
+ tmp = i + qsz; /* value of i after swap */
+ if (i == mid) { /* j <-> mid, new mid is j */
+ mid = jj = j;
+ } else { /* i <-> j */
+ jj = j;
+ j -= qsz;
+ }
+ goto swap;
+ }
+ if (i == mid) {
+ break;
+ } else { /* i <-> mid, new mid is i */
+ jj = mid;
+ tmp = mid = i; /* value of i after swap */
+ j -= qsz;
+ }
+ swap:
+ ii = qsz;
+ do {
+ c = *i;
+ *i++ = *jj;
+ *jj++ = c;
+ } while (--ii);
+ i = tmp;
+ }
+ /*
+ * Look at sizes of the two partitions, do the smaller one first by
+ * recursion, then do the larger one by making sure lo is its size,
+ * base and max are update correctly, and branching back. But only
+ * repeat (recursively or by branching) if the partition is of at
+ * least size THRESH.
+ */
+ i = (j = mid) + qsz;
+ if ((lo = (int)(j - base)) <= (hi = (int)(max - i))) {
+ if (lo >= thresh)
+ qst(base, j);
+ base = i;
+ lo = hi;
+ } else {
+ if (hi >= thresh)
+ qst(i, max);
+ max = j;
+ }
+ } while (lo >= thresh);
+}
diff --git a/Build/source/texk/makeindexk/scanid.c b/Build/source/texk/makeindexk/scanid.c
new file mode 100644
index 00000000000..73cd90eaea6
--- /dev/null
+++ b/Build/source/texk/makeindexk/scanid.c
@@ -0,0 +1,837 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#include "mkind.h"
+#include "scanid.h"
+
+#define CHECK_LENGTH() if (i > len_field) goto FIELD_OVERFLOW
+
+int idx_lc; /* line count */
+int idx_tc; /* total entry count */
+int idx_ec; /* erroneous entry count */
+int idx_dc; /* number of dots printed so far */
+
+static int first_entry = TRUE;
+static int comp_len;
+static char key[ARGUMENT_MAX];
+static char no[NUMBER_MAX];
+#ifndef WIN32
+extern char *strchr ARGS((const char* s,int c));
+#endif
+
+NODE_PTR head;
+NODE_PTR tail;
+
+static void flush_to_eol ARGS((void));
+static int make_key ARGS((void));
+static void make_string ARGS((char **ppstr,int n));
+static int scan_alpha_lower ARGS((char *no,int *npg,short *count));
+static int scan_alpha_upper ARGS((char *no,int *npg,short *count));
+static int scan_arabic ARGS((char *no,int *npg,short *count));
+static int scan_arg1 ARGS((void));
+static int scan_arg2 ARGS((void));
+static int scan_field ARGS((int *n,char field[],int len_field,
+ int ck_level, int ck_encap,int ck_actual));
+static int scan_key ARGS((struct KFIELD *data));
+static int scan_no ARGS((char *no,int *npg,short *count,short *type));
+static int scan_roman_lower ARGS((char *no,int *npg,short *count));
+static int scan_roman_upper ARGS((char *no,int *npg,short *count));
+static void search_quote ARGS((char **sort_key,char **actual_key));
+
+void
+scan_idx(VOID_ARG)
+{
+ char keyword[ARRAY_MAX];
+ int c;
+ int i = 0;
+ int not_eof = TRUE;
+ int arg_count = -1;
+
+ MESSAGE("Scanning input file %s...", idx_fn);
+ idx_lc = idx_tc = idx_ec = idx_dc = 0;
+ comp_len = strlen(page_comp);
+ while (not_eof) {
+ switch (c = GET_CHAR(idx_fp)) {
+ case EOF:
+ if (arg_count == 2) {
+ idx_lc++;
+ if (make_key())
+ IDX_DOT(DOT_MAX);
+ arg_count = -1;
+ } else
+ not_eof = FALSE;
+ break;
+
+ case LFD:
+ idx_lc++;
+ if (arg_count == 2) {
+ if (make_key())
+ IDX_DOT(DOT_MAX);
+ arg_count = -1;
+ } else if (arg_count > -1) {
+ IDX_ERROR("Missing arguments -- need two (premature LFD).\n",
+ NULL);
+ arg_count = -1;
+ }
+ case TAB:
+ case SPC:
+ break;
+
+ default:
+ switch (arg_count) {
+ case -1:
+ i = 0;
+ keyword[i++] = (char) c;
+ arg_count++;
+ idx_tc++;
+ break;
+ case 0:
+ if (c == idx_aopen) {
+ arg_count++;
+ keyword[i] = NUL;
+ if (STREQ(keyword, idx_keyword)) {
+ if (!scan_arg1()) {
+ arg_count = -1;
+ }
+ } else {
+ IDX_SKIPLINE;
+ IDX_ERROR("Unknown index keyword %s.\n", keyword);
+ }
+ } else {
+ if (i < ARRAY_MAX)
+ keyword[i++] = (char) c;
+ else {
+ IDX_SKIPLINE;
+ IDX_ERROR2("Index keyword %s too long (max %d).\n",
+ keyword, ARRAY_MAX);
+ }
+ }
+ break;
+ case 1:
+ if (c == idx_aopen) {
+ arg_count++;
+ if (!scan_arg2()) {
+ arg_count = -1;
+ }
+ } else {
+ IDX_SKIPLINE;
+IDX_ERROR(
+"No opening delimiter for second argument (illegal character `%c').\n", c);
+ }
+ break;
+ case 2:
+ IDX_SKIPLINE;
+IDX_ERROR(
+"No closing delimiter for second argument (illegal character `%c').\n", c);
+ break;
+ }
+ break;
+ }
+ }
+
+ /* fixup the total counts */
+ idx_tt += idx_tc;
+ idx_et += idx_ec;
+
+ DONE(idx_tc - idx_ec, "entries accepted", idx_ec, "rejected");
+ CLOSE(idx_fp);
+}
+
+static void
+flush_to_eol(VOID_ARG)
+{ /* flush to end-of-line, or end-of-file, whichever is first */
+ int a;
+
+ while ( ((a = GET_CHAR(idx_fp)) != LFD) && (a != EOF) )
+ /* NO-OP */;
+}
+
+static int
+make_key(VOID_ARG)
+{
+ NODE_PTR ptr;
+ int i;
+ static size_t len = sizeof(NODE);
+
+ /* allocate and initialize a node */
+
+#ifdef DEBUG
+ totmem += len;
+ (void)fprintf(stderr,"make_key(): malloc(%d)\ttotmem = %ld\n",
+ len,totmem);
+#endif /* DEBUG */
+
+ if ((ptr = (NODE_PTR) malloc(len)) == NULL)
+ fprintf (stderr, "Not enough core...abort.\n");
+
+ bzero(ptr, len);
+ /* Initialize dangling pointers
+ * Note: it would be a nice work to redesign the code to use NULL for
+ * comparision ... nevertheless, using local "" in a global environment
+ * isn't the hit because the allocation of the keys with german_sort may
+ * crash with a nitpicking memory allocation (Linux, libc-5.4.46).
+ * <werner@suse.de>
+ */
+ for (i = 0; i < FIELD_MAX; i++)
+ {
+ make_string(&(ptr->data.sf[i]), 1);
+ make_string(&(ptr->data.af[i]), 1);
+ }
+ make_string(&(ptr->data.encap), 1);
+ ptr->data.lpg[0] = NUL;
+ ptr->data.count = 0;
+ ptr->data.type = EMPTY;
+
+ /* process index key */
+ if (!scan_key(&(ptr->data)))
+ return (FALSE);
+
+ /* determine group type */
+ ptr->data.group = group_type(ptr->data.sf[0]);
+
+ /* process page number */
+ strcpy(ptr->data.lpg, no);
+ if (!scan_no(no, ptr->data.npg, &(ptr->data.count), &(ptr->data.type)))
+ return (FALSE);
+
+ if (first_entry) {
+ head = tail = ptr;
+ first_entry = FALSE;
+ } else {
+ tail->next = ptr;
+ tail = ptr;
+ }
+ ptr->data.lc = idx_lc;
+ ptr->data.fn = idx_fn;
+ tail->next = NULL;
+
+ return (TRUE);
+}
+
+static void
+#if STDC
+make_string(char **ppstr, int n)
+#else
+make_string(ppstr,n) /* allocate n-byte string if *ppstr */
+char **ppstr; /* points to an empty string */
+int n;
+#endif
+{
+ if (*ppstr) /* Do NOT leaking here, <werner@suse.de> */
+ free(*ppstr);
+
+ /* Note: we have always allocate the correct amount of memory to
+ * avoid chrashes because the string length of the actual and
+ * sort key may differ at german_sort and strange indexentries
+ * <werner@suse.de>
+ */
+ (*ppstr) = (char*)malloc(n);
+ if (!(*ppstr))
+ fprintf (stderr, "Not enough core...abort.\n");
+ bzero(*ppstr, n); /* Always zero anything, <werner@suse.de> */
+}
+
+static int
+#if STDC
+scan_key(FIELD_PTR data)
+#else
+scan_key(data)
+FIELD_PTR data;
+#endif
+{
+ int i = 0; /* current level */
+ int n = 0; /* index to the key[] array */
+ int second_round = FALSE;
+ int last = FIELD_MAX - 1;
+ size_t len;
+
+ while (TRUE) {
+ if (key[n] == NUL)
+ break;
+ len = strlen(key);
+ if (key[n] == idx_encap)
+ {
+ n++;
+ make_string(&(data->encap), len + 1);
+ if (scan_field(&n, data->encap, len, FALSE, FALSE, FALSE))
+ break;
+ else
+ return (FALSE);
+ }
+ if (key[n] == idx_actual) {
+ n++;
+
+ make_string(&(data->af[i]), len + 1);
+ if (i == last)
+ {
+ if (!scan_field(&n, data->af[i], len, FALSE, TRUE, FALSE))
+ return (FALSE);
+ }
+ else
+ {
+ if (!scan_field(&n, data->af[i], len, TRUE, TRUE, FALSE))
+ return (FALSE);
+ }
+ } else {
+ /* Next nesting level */
+ if (second_round) {
+ i++;
+ n++;
+ }
+
+ make_string(&(data->sf[i]), len + 1);
+ if (i == last)
+ {
+ if (!scan_field(&n, data->sf[i], len, FALSE, TRUE, TRUE))
+ return (FALSE);
+ }
+ else
+ {
+ if (!scan_field(&n, data->sf[i], len, TRUE, TRUE, TRUE))
+ return (FALSE);
+ }
+ second_round = TRUE;
+ if (german_sort && strchr(data->sf[i], '"'))
+ {
+ make_string(&(data->af[i]),strlen(data->sf[i]) + 1);
+ search_quote(&(data->sf[i]), &(data->af[i]));
+ }
+ }
+ }
+
+ /* check for empty fields which shouldn't be empty */
+ if (*data->sf[0] == NUL) {
+ NULL_RTN;
+ }
+ for (i = 1; i < FIELD_MAX - 1; i++)
+ if ((*data->sf[i] == NUL) &&
+ ((*data->af[i] != NUL) || (*data->sf[i + 1] != NUL))) {
+ NULL_RTN;
+ }
+ /* i == FIELD_MAX-1 */
+ if ((*data->sf[i] == NUL) && (*data->af[i] != NUL)) {
+ NULL_RTN;
+ }
+ return (TRUE);
+}
+
+static int
+#if STDC
+scan_field(int *n, char field[], int len_field, int ck_level, int ck_encap,
+ int ck_actual)
+#else
+scan_field(n, field, len_field, ck_level, ck_encap, ck_actual)
+int *n;
+char field[];
+int len_field; /* length of field[], EXCLUDING space for final NUL */
+int ck_level;
+int ck_encap;
+int ck_actual;
+#endif
+{
+ int i = 0;
+ int nbsh; /* backslash count */
+
+ if (compress_blanks && ((key[*n] == SPC) || (key[*n] == TAB)))
+ ++* n;
+
+ while (TRUE) {
+ nbsh = 0;
+ while (key[*n] == idx_escape)
+ {
+ nbsh++;
+ field[i++] = key[*n];
+ CHECK_LENGTH();
+ ++*n;
+ }
+
+ if (key[*n] == idx_quote)
+ {
+ if (nbsh % 2 == 0)
+ field[i++] = key[++*n];
+ else
+ field[i++] = key[*n];
+ CHECK_LENGTH();
+ }
+ else if ((ck_level && (key[*n] == idx_level)) ||
+ (ck_encap && (key[*n] == idx_encap)) ||
+ (ck_actual && (key[*n] == idx_actual)) ||
+ (key[*n] == NUL))
+ {
+ if ((i > 0) && compress_blanks && (field[i - 1] == SPC))
+ field[i - 1] = NUL;
+ else
+ field[i] = NUL;
+ return (TRUE);
+ } else {
+ field[i++] = key[*n];
+ CHECK_LENGTH();
+ if ((!ck_level) && (key[*n] == idx_level)) {
+ IDX_ERROR2("Extra `%c' at position %d of first argument.\n",
+ idx_level, *n + 1);
+ return (FALSE);
+ } else if ((!ck_encap) && (key[*n] == idx_encap)) {
+ IDX_ERROR2("Extra `%c' at position %d of first argument.\n",
+ idx_encap, *n + 1);
+ return (FALSE);
+ } else if ((!ck_actual) && (key[*n] == idx_actual)) {
+ IDX_ERROR2("Extra `%c' at position %d of first argument.\n",
+ idx_actual, *n + 1);
+ return (FALSE);
+ }
+ }
+ /* check if max field length is reached */
+ if (i > len_field)
+ {
+ FIELD_OVERFLOW:
+ if (!ck_encap) {
+ IDX_ERROR("Encapsulator of page number too long (max. %d).\n",
+ len_field);
+ } else if (ck_actual) {
+ IDX_ERROR("Index sort key too long (max. %d).\n", len_field);
+ } else {
+ IDX_ERROR("Text of key entry too long (max. %d).\n", len_field);
+ }
+ return (FALSE);
+ }
+ ++*n;
+ }
+}
+
+int
+#if STDC
+group_type(char *str)
+#else
+group_type(str)
+char *str;
+#endif
+{
+ int i = 0;
+
+ while ((str[i] != NUL) && ISDIGIT(str[i]))
+ i++;
+
+ if (str[i] == NUL) {
+ sscanf(str, "%d", &i);
+ return (i);
+ } else if (ISSYMBOL(str[0]))
+ return (SYMBOL);
+ else
+ return (ALPHA);
+}
+
+static int
+#if STDC
+scan_no(char no[], int npg[], short *count, short *type)
+#else
+scan_no(no, npg, count, type)
+char no[];
+int npg[];
+short *count;
+short *type;
+#endif
+{
+ int i = 1;
+
+ if (isdigit(no[0])) {
+ *type = ARAB;
+ if (!scan_arabic(no, npg, count))
+ return (FALSE);
+ /* simple heuristic to determine if a letter is Roman or Alpha */
+ } else if (IS_ROMAN_LOWER(no[0]) && (!IS_COMPOSITOR)) {
+ *type = ROML;
+ if (!scan_roman_lower(no, npg, count))
+ return (FALSE);
+ /* simple heuristic to determine if a letter is Roman or Alpha */
+ } else if (IS_ROMAN_UPPER(no[0]) &&
+ ((no[0] == ROMAN_I) || (!IS_COMPOSITOR))) {
+ *type = ROMU;
+ if (!scan_roman_upper(no, npg, count))
+ return (FALSE);
+ } else if (IS_ALPHA_LOWER(no[0])) {
+ *type = ALPL;
+ if (!scan_alpha_lower(no, npg, count))
+ return (FALSE);
+ } else if (IS_ALPHA_UPPER(no[0])) {
+ *type = ALPU;
+ if (!scan_alpha_upper(no, npg, count))
+ return (FALSE);
+ } else {
+ IDX_ERROR("Illegal page number %s.\n", no);
+ return (FALSE);
+ }
+ return (TRUE);
+}
+
+
+static int
+#if STDC
+scan_arabic(char no[], int npg[], short *count)
+#else
+scan_arabic(no, npg, count)
+char no[];
+int npg[];
+short *count;
+#endif
+{
+ short i = 0;
+ char str[ARABIC_MAX+1]; /* space for trailing NUL */
+
+ while ((no[i] != NUL) && (i <= ARABIC_MAX) && (!IS_COMPOSITOR)) {
+ if (isdigit(no[i])) {
+ str[i] = no[i];
+ i++;
+ } else {
+IDX_ERROR2("Illegal Arabic digit: position %d in %s.\n", i + 1, no);
+ return (FALSE);
+ }
+ }
+ if (i > ARABIC_MAX) {
+ IDX_ERROR2("Arabic page number %s too big (max %d digits).\n",
+ no, ARABIC_MAX);
+ return (FALSE);
+ }
+ str[i] = NUL;
+
+ ENTER(strtoint(str) + page_offset[ARAB]);
+
+ if (IS_COMPOSITOR)
+ return (scan_no(&no[i + comp_len], npg, count, &i));
+ else
+ return (TRUE);
+}
+
+
+static int
+#if STDC
+scan_roman_lower(char no[], int npg[], short *count)
+#else
+scan_roman_lower(no, npg, count)
+char no[];
+int npg[];
+short *count;
+#endif
+{
+ short i = 0;
+ int inp = 0;
+ int prev = 0;
+ int the_new;
+
+ while ((no[i] != NUL) && (i < ROMAN_MAX) && (!IS_COMPOSITOR)) {
+ if ((IS_ROMAN_LOWER(no[i])) &&
+ ((the_new = ROMAN_LOWER_VAL(no[i])) != 0)) {
+ if (prev == 0)
+ prev = the_new;
+ else {
+ if (prev < the_new) {
+ prev = the_new - prev;
+ the_new = 0;
+ }
+ inp += prev;
+ prev = the_new;
+ }
+ } else {
+IDX_ERROR2("Illegal Roman number: position %d in %s.\n", i + 1, no);
+ return (FALSE);
+ }
+ i++;
+ }
+ if (i == ROMAN_MAX) {
+ IDX_ERROR2("Roman page number %s too big (max %d digits).\n",
+ no, ROMAN_MAX);
+ return (FALSE);
+ }
+ inp += prev;
+
+ ENTER(inp + page_offset[ROML]);
+
+ if (IS_COMPOSITOR)
+ return (scan_no(&no[i + comp_len], npg, count, &i));
+ else
+ return (TRUE);
+}
+
+
+static int
+#if STDC
+scan_roman_upper(char no[], int npg[], short *count)
+#else
+scan_roman_upper(no, npg, count)
+char no[];
+int npg[];
+short *count;
+#endif
+{
+ short i = 0;
+ int inp = 0;
+ int prev = 0;
+ int the_new;
+
+ while ((no[i] != NUL) && (i < ROMAN_MAX) && (!IS_COMPOSITOR)) {
+ if ((IS_ROMAN_UPPER(no[i])) &&
+ ((the_new = ROMAN_UPPER_VAL(no[i])) != 0)) {
+ if (prev == 0)
+ prev = the_new;
+ else {
+ if (prev < the_new) {
+ prev = the_new - prev;
+ the_new = 0;
+ }
+ inp += prev;
+ prev = the_new;
+ }
+ } else {
+IDX_ERROR2("Illegal Roman number: position %d in %s.\n", i + 1, no);
+ return (FALSE);
+ }
+ i++;
+ }
+ if (i == ROMAN_MAX) {
+ IDX_ERROR2("Roman page number %s too big (max %d digits).\n",
+ no, ROMAN_MAX);
+ return (FALSE);
+ }
+ inp += prev;
+
+ ENTER(inp + page_offset[ROMU]);
+
+ if (IS_COMPOSITOR)
+ return (scan_no(&no[i + comp_len], npg, count, &i));
+ else
+ return (TRUE);
+}
+
+
+static int
+#if STDC
+scan_alpha_lower(char no[], int npg[], short *count)
+#else
+scan_alpha_lower(no, npg, count)
+char no[];
+int npg[];
+short *count;
+#endif
+{
+ short i;
+
+ ENTER(ALPHA_VAL(no[0]) + page_offset[ALPL]);
+
+ i = 1;
+ if (IS_COMPOSITOR)
+ return (scan_no(&no[comp_len + 1], npg, count, &i));
+ else
+ return (TRUE);
+}
+
+
+static int
+#if STDC
+scan_alpha_upper(char no[], int npg[], short *count)
+#else
+scan_alpha_upper(no, npg, count)
+char no[];
+int npg[];
+short *count;
+#endif
+{
+ short i;
+
+ ENTER(ALPHA_VAL(no[0]) + page_offset[ALPU]);
+
+ i = 1;
+ if (IS_COMPOSITOR)
+ return (scan_no(&no[comp_len + 1], npg, count, &i));
+ else
+ return (TRUE);
+}
+
+
+static int
+scan_arg1(VOID_ARG)
+{
+ int i = 0;
+ int n = 0; /* delimiter count */
+ int a;
+
+ if (compress_blanks)
+ while (((a = GET_CHAR(idx_fp)) == SPC) || (a == TAB));
+ else
+ a = GET_CHAR(idx_fp);
+
+ while ((i < ARGUMENT_MAX) && (a != EOF))
+ {
+ if ((a == idx_quote) || (a == idx_escape))
+ { /* take next character literally */
+ key[i++] = (char) a; /* but preserve quote or escape */
+ a = GET_CHAR(idx_fp);
+ key[i++] = (char) a; /* save literal character */
+ }
+ else if (a == idx_aopen)
+ { /* opening delimiters within the argument list */
+ key[i++] = (char) a;
+ n++;
+ }
+ else if (a == idx_aclose)
+ {
+ if (n == 0) /* end of argument */
+ {
+ if (compress_blanks && key[i - 1] == SPC)
+ key[i - 1] = NUL;
+ else
+ key[i] = NUL;
+ return (TRUE);
+ }
+ else /* nested delimiters */
+ {
+ key[i++] = (char) a;
+ n--;
+ }
+ }
+ else
+ {
+ switch (a)
+ {
+ case LFD:
+ idx_lc++;
+ IDX_ERROR("Incomplete first argument (premature LFD).\n", "");
+ return (FALSE);
+ case TAB:
+ case SPC:
+ /* compress successive SPC's to one SPC */
+ if (compress_blanks)
+ {
+ if ((i > 0) && (key[i - 1] != SPC) && (key[i - 1] != TAB))
+ key[i++] = SPC;
+ break;
+ }
+ default:
+ key[i++] = (char) a;
+ break;
+ }
+ }
+ a = GET_CHAR(idx_fp);
+ }
+
+ flush_to_eol(); /* Skip to end of line */
+ idx_lc++;
+ IDX_ERROR("First argument too long (max %d).\n", ARGUMENT_MAX);
+ return (FALSE);
+}
+
+
+static int
+scan_arg2(VOID_ARG)
+{
+ int i = 0;
+ int a;
+ int hit_blank = FALSE;
+
+ while (((a = GET_CHAR(idx_fp)) == SPC) || (a == TAB));
+
+ while (i < NUMBER_MAX) {
+ if (a == idx_aclose) {
+ no[i] = NUL;
+ return (TRUE);
+ } else
+ switch (a) {
+ case LFD:
+ idx_lc++;
+IDX_ERROR("Incomplete second argument (premature LFD).\n", "");
+ return (FALSE);
+ case TAB:
+ case SPC:
+ hit_blank = TRUE;
+ break;
+ default:
+ if (hit_blank) {
+ flush_to_eol(); /* Skip to end of line */
+ idx_lc++;
+IDX_ERROR("Illegal space within numerals in second argument.\n", "");
+ return (FALSE);
+ }
+ no[i++] = (char) a;
+ break;
+ }
+ a = GET_CHAR(idx_fp);
+ }
+ flush_to_eol(); /* Skip to end of line */
+ idx_lc++;
+ IDX_ERROR("Second argument too long (max %d).\n", NUMBER_MAX);
+ return (FALSE);
+}
+
+
+static void
+#if STDC
+search_quote(char **sort_key, char **actual_key)
+#else
+search_quote(sort_key, actual_key)
+char **sort_key;
+char **actual_key;
+#endif
+{
+ char *ptr; /* pointer to sort_key */
+ char *sort; /* contains sorting text */
+ int char_found = FALSE;
+
+ strcpy(*actual_key, *sort_key);
+ ptr = strchr(*sort_key, '"'); /* look for first double quote */
+ while (ptr != (char*)NULL)
+ {
+ sort = NULL;
+ switch (*(ptr + 1))
+ { /* skip to umlaut or sharp S */
+ case 'a':
+ case 'A':
+ sort = isupper(*(ptr + 1)) ? "Ae" : "ae";
+ break;
+ case 'o':
+ case 'O':
+ sort = isupper(*(ptr + 1)) ? "Oe" : "oe";
+ break;
+ case 'u':
+ case 'U':
+ sort = isupper(*(ptr + 1)) ? "Ue" : "ue";
+ break;
+ case 's':
+ sort = "ss";
+ break;
+ default:
+ break;
+ }
+ if (sort != NULL)
+ {
+ char_found = TRUE;
+ *ptr = sort[0]; /* write to sort_key */
+ *(ptr + 1) = sort[1];
+ }
+ ptr = strchr(ptr + 1, '"'); /* next double quote */
+ }
+ if (!char_found) /* reset actual_key ? */
+ make_string(actual_key, 1);
+ return;
+}
diff --git a/Build/source/texk/makeindexk/scanid.h b/Build/source/texk/makeindexk/scanid.h
new file mode 100644
index 00000000000..62a9de32758
--- /dev/null
+++ b/Build/source/texk/makeindexk/scanid.h
@@ -0,0 +1,135 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#define IS_COMPOSITOR (strncmp(&no[i], page_comp, comp_len) == 0)
+
+#define ROMAN_I 'I'
+#define ROMAN_V 'V'
+#define ROMAN_X 'X'
+#define ROMAN_L 'L'
+#define ROMAN_C 'C'
+#define ROMAN_D 'D'
+#define ROMAN_M 'M'
+
+#define ROMAN_i 'i'
+#define ROMAN_v 'v'
+#define ROMAN_x 'x'
+#define ROMAN_l 'l'
+#define ROMAN_c 'c'
+#define ROMAN_d 'd'
+#define ROMAN_m 'm'
+
+#define VAL_I 1
+#define VAL_V 5
+#define VAL_X 10
+#define VAL_L 50
+#define VAL_C 100
+#define VAL_D 500
+#define VAL_M 1000
+
+#define ROMAN_LOWER_VAL(C) \
+ ((C == ROMAN_i) ? VAL_I : \
+ (C == ROMAN_v) ? VAL_V : \
+ (C == ROMAN_x) ? VAL_X : \
+ (C == ROMAN_l) ? VAL_L : \
+ (C == ROMAN_c) ? VAL_C : \
+ (C == ROMAN_d) ? VAL_D : \
+ (C == ROMAN_m) ? VAL_M : 0)
+
+#define ROMAN_UPPER_VAL(C) \
+ ((C == ROMAN_I) ? VAL_I : \
+ (C == ROMAN_V) ? VAL_V : \
+ (C == ROMAN_X) ? VAL_X : \
+ (C == ROMAN_L) ? VAL_L : \
+ (C == ROMAN_C) ? VAL_C : \
+ (C == ROMAN_D) ? VAL_D : \
+ (C == ROMAN_M) ? VAL_M : 0)
+
+#define IS_ROMAN_LOWER(C) \
+ ((C == ROMAN_i) || (C == ROMAN_v) || (C == ROMAN_x) || \
+ (C == ROMAN_l) || (C == ROMAN_c) || (C == ROMAN_d) || (C == ROMAN_m))
+
+#define IS_ROMAN_UPPER(C) \
+ ((C == ROMAN_I) || (C == ROMAN_V) || (C == ROMAN_X) || \
+ (C == ROMAN_L) || (C == ROMAN_C) || (C == ROMAN_D) || (C == ROMAN_M))
+
+#define ALPHA_VAL(C) \
+ ((('A' <= C) && (C <= 'Z')) ? C - 'A' : \
+ (('a' <= C) && (C <= 'z')) ? C - 'a' : 0)
+
+#define IS_ALPHA_LOWER(C) \
+ (('a' <= C) && (C <= 'z'))
+
+#define IS_ALPHA_UPPER(C) \
+ (('A' <= C) && (C <= 'Z'))
+
+#define IDX_SKIPLINE { \
+ int tmp; \
+ while ((tmp = GET_CHAR(idx_fp)) != LFD) \
+ if (tmp == EOF) \
+ break; \
+ idx_lc++; \
+ arg_count = -1; \
+}
+
+#define NULL_RTN { \
+ IDX_ERROR("Illegal null field.\n", NULL); \
+ return (FALSE); \
+}
+
+#define IDX_ERROR(F, D) { \
+ if (idx_dot) { \
+ fprintf(ilg_fp, "\n"); \
+ idx_dot = FALSE; \
+ } \
+ fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n -- ", \
+ idx_fn, idx_lc); \
+ fprintf(ilg_fp, F, D); \
+ idx_ec++; \
+}
+
+#define IDX_ERROR2(F, D1, D2) { \
+ if (idx_dot) { \
+ fprintf(ilg_fp, "\n"); \
+ idx_dot = FALSE; \
+ } \
+ fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n -- ", \
+ idx_fn, idx_lc); \
+ fprintf(ilg_fp, F, D1, D2); \
+ idx_ec++; \
+}
+
+
+#define ENTER(V) { \
+ if (*count >= PAGEFIELD_MAX) { \
+ IDX_ERROR2("Page number %s has too many fields (max. %d).", \
+ no, PAGEFIELD_MAX); \
+ return (FALSE); \
+ } \
+ npg[*count] = (V); \
+ ++*count; \
+}
diff --git a/Build/source/texk/makeindexk/scanst.c b/Build/source/texk/makeindexk/scanst.c
new file mode 100644
index 00000000000..b626c20d051
--- /dev/null
+++ b/Build/source/texk/makeindexk/scanst.c
@@ -0,0 +1,613 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#include "mkind.h"
+#include "scanst.h"
+
+static int sty_lc = 0; /* line count */
+static int sty_tc = 0; /* total count */
+static int sty_ec = 0; /* error count */
+
+char idx_keyword[ARRAY_MAX] = IDX_KEYWORD;
+char idx_aopen = IDX_AOPEN;
+char idx_aclose = IDX_ACLOSE;
+char idx_level = IDX_LEVEL;
+char idx_ropen = IDX_ROPEN;
+char idx_rclose = IDX_RCLOSE;
+char idx_quote = IDX_QUOTE;
+char idx_actual = IDX_ACTUAL;
+char idx_encap = IDX_ENCAP;
+char idx_escape = IDX_ESCAPE;
+
+char preamble[ARRAY_MAX] = PREAMBLE_DEF;
+char postamble[ARRAY_MAX] = POSTAMBLE_DEF;
+int prelen = PREAMBLE_LEN;
+int postlen = POSTAMBLE_LEN;
+
+char setpage_open[ARRAY_MAX] = SETPAGEOPEN_DEF;
+char setpage_close[ARRAY_MAX] = SETPAGECLOSE_DEF;
+int setpagelen = SETPAGE_LEN;
+
+char group_skip[ARRAY_MAX] = GROUPSKIP_DEF;
+int skiplen = GROUPSKIP_LEN;
+
+int headings_flag = HEADINGSFLAG_DEF;
+char heading_pre[ARRAY_MAX] = HEADINGPRE_DEF;
+char heading_suf[ARRAY_MAX] = HEADINGSUF_DEF;
+int headprelen = HEADINGPRE_LEN;
+int headsuflen = HEADINGSUF_LEN;
+
+char symhead_pos[ARRAY_MAX] = SYMHEADPOS_DEF;
+char symhead_neg[ARRAY_MAX] = SYMHEADNEG_DEF;
+
+char numhead_pos[ARRAY_MAX] = NUMHEADPOS_DEF;
+char numhead_neg[ARRAY_MAX] = NUMHEADNEG_DEF;
+
+char item_r[FIELD_MAX][ARRAY_MAX] = {ITEM0_DEF, ITEM1_DEF, ITEM2_DEF};
+char item_u[FIELD_MAX][ARRAY_MAX] = {"", ITEM1_DEF, ITEM2_DEF};
+char item_x[FIELD_MAX][ARRAY_MAX] = {"", ITEM1_DEF, ITEM2_DEF};
+
+int ilen_r[FIELD_MAX] = {ITEM_LEN, ITEM_LEN, ITEM_LEN};
+int ilen_u[FIELD_MAX] = {0, ITEM_LEN, ITEM_LEN};
+int ilen_x[FIELD_MAX] = {0, ITEM_LEN, ITEM_LEN};
+
+char delim_p[FIELD_MAX][ARRAY_MAX] = {DELIM_DEF, DELIM_DEF, DELIM_DEF};
+char delim_n[ARRAY_MAX] = DELIM_DEF; /* page number separator */
+char delim_r[ARRAY_MAX] = DELIMR_DEF;/* page range designator */
+char delim_t[ARRAY_MAX] = DELIMT_DEF;/* page list terminating delimiter */
+
+char suffix_2p[ARRAY_MAX] = ""; /* suffix for two page ranges */
+char suffix_3p[ARRAY_MAX] = ""; /* suffix for three page ranges */
+char suffix_mp[ARRAY_MAX] = ""; /* suffix for multiple page ranges */
+
+char encap_p[ARRAY_MAX] = ENCAP0_DEF;/* encapsulator prefix */
+char encap_i[ARRAY_MAX] = ENCAP1_DEF;/* encapsulator infix */
+char encap_s[ARRAY_MAX] = ENCAP2_DEF;/* encapsulator postfix */
+
+int linemax = LINE_MAX;
+
+int indent_length = INDENTLEN_DEF;
+char indent_space[ARRAY_MAX] = INDENTSPC_DEF;
+
+char page_comp[ARRAY_MAX] = COMPOSITOR_DEF;
+int page_offset[PAGETYPE_MAX] = {
+0,
+ROMAN_LOWER_OFFSET,
+ROMAN_LOWER_OFFSET + ARABIC_OFFSET,
+ROMAN_LOWER_OFFSET + ARABIC_OFFSET + ALPHA_LOWER_OFFSET,
+ROMAN_LOWER_OFFSET + ARABIC_OFFSET + ALPHA_LOWER_OFFSET + ROMAN_UPPER_OFFSET
+};
+static char page_prec[ARRAY_MAX] = PRECEDENCE_DEF;
+
+static int put_dot;
+
+static int count_lfd ARGS((char *str));
+static int next_nonblank ARGS((void));
+static int process_precedence ARGS((void));
+static int scan_char ARGS((char *c));
+static int scan_spec ARGS((char *spec));
+static int scan_string ARGS((char *str));
+
+void
+scan_sty(VOID_ARG)
+{
+ char spec[STRING_MAX];
+ int tmp;
+
+ MESSAGE("Scanning style file %s", sty_fn);
+ while (scan_spec(spec)) {
+ sty_tc++;
+ put_dot = TRUE;
+
+ /* output pre- and post-ambles */
+ if (STREQ(spec, PREAMBLE)) {
+ (void) scan_string(preamble);
+ prelen = count_lfd(preamble);
+ } else if (STREQ(spec, POSTAMBLE)) {
+ (void) scan_string(postamble);
+ postlen = count_lfd(postamble);
+ } else if (STREQ(spec, GROUP_SKIP)) {
+ (void) scan_string(group_skip);
+ skiplen = count_lfd(group_skip);
+ } else if (STREQ(spec, HEADINGS_FLAG)) {
+ SCAN_NO(&headings_flag);
+ } else if (STREQ(spec, HEADING_PRE)) {
+ (void) scan_string(heading_pre);
+ headprelen = count_lfd(heading_pre);
+ } else if (STREQ(spec, HEADING_SUF)) {
+ (void) scan_string(heading_suf);
+ headsuflen = count_lfd(heading_suf);
+ } else if (STREQ(spec, SYMHEAD_POS)) {
+ (void) scan_string(symhead_pos);
+ } else if (STREQ(spec, SYMHEAD_NEG)) {
+ (void) scan_string(symhead_neg);
+ } else if (STREQ(spec, NUMHEAD_POS)) {
+ (void) scan_string(numhead_pos);
+ } else if (STREQ(spec, NUMHEAD_NEG)) {
+ (void) scan_string(numhead_neg);
+ } else if (STREQ(spec, SETPAGEOPEN)) {
+ (void) scan_string(setpage_open);
+ setpagelen = count_lfd(setpage_open);
+ } else if (STREQ(spec, SETPAGECLOSE)) {
+ (void) scan_string(setpage_close);
+ setpagelen = count_lfd(setpage_close);
+ /* output index item commands */
+ } else if (STREQ(spec, ITEM_0)) {
+ (void) scan_string(item_r[0]);
+ ilen_r[0] = count_lfd(item_r[0]);
+ } else if (STREQ(spec, ITEM_1)) {
+ (void) scan_string(item_r[1]);
+ ilen_r[1] = count_lfd(item_r[1]);
+ } else if (STREQ(spec, ITEM_2)) {
+ (void) scan_string(item_r[2]);
+ ilen_r[2] = count_lfd(item_r[2]);
+ } else if (STREQ(spec, ITEM_01)) {
+ (void) scan_string(item_u[1]);
+ ilen_u[1] = count_lfd(item_u[1]);
+ } else if (STREQ(spec, ITEM_12)) {
+ (void) scan_string(item_u[2]);
+ ilen_u[2] = count_lfd(item_u[2]);
+ } else if (STREQ(spec, ITEM_x1)) {
+ (void) scan_string(item_x[1]);
+ ilen_x[1] = count_lfd(item_x[1]);
+ } else if (STREQ(spec, ITEM_x2)) {
+ (void) scan_string(item_x[2]);
+ ilen_x[2] = count_lfd(item_x[2]);
+ /* output encapsulators */
+ } else if (STREQ(spec, ENCAP_0))
+ (void) scan_string(encap_p);
+ else if (STREQ(spec, ENCAP_1))
+ (void) scan_string(encap_i);
+ else if (STREQ(spec, ENCAP_2))
+ (void) scan_string(encap_s);
+ /* output delimiters */
+ else if (STREQ(spec, DELIM_0))
+ (void) scan_string(delim_p[0]);
+ else if (STREQ(spec, DELIM_1))
+ (void) scan_string(delim_p[1]);
+ else if (STREQ(spec, DELIM_2))
+ (void) scan_string(delim_p[2]);
+ else if (STREQ(spec, DELIM_N))
+ (void) scan_string(delim_n);
+ else if (STREQ(spec, DELIM_R))
+ (void) scan_string(delim_r);
+ else if (STREQ(spec, DELIM_T))
+ (void) scan_string(delim_t);
+ else if (STREQ(spec, SUFFIX_2P))
+ (void) scan_string(suffix_2p);
+ else if (STREQ(spec, SUFFIX_3P))
+ (void) scan_string(suffix_3p);
+ else if (STREQ(spec, SUFFIX_MP))
+ (void) scan_string(suffix_mp);
+ /* output line width */
+ else if (STREQ(spec, LINEMAX)) {
+ SCAN_NO(&tmp);
+ if (tmp > 0)
+ linemax = tmp;
+ else
+ STY_ERROR2("%s must be positive (got %d)",
+ LINEMAX, tmp);
+ /* output line indentation length */
+ } else if (STREQ(spec, INDENT_LENGTH)) {
+ SCAN_NO(&tmp);
+ if (tmp >= 0)
+ indent_length = tmp;
+ else
+ STY_ERROR2("%s must be nonnegative (got %d)",
+ INDENT_LENGTH, tmp);
+ /* output line indentation */
+ } else if (STREQ(spec, INDENT_SPACE)) {
+ (void) scan_string(indent_space);
+ /* composite page delimiter */
+ } else if (STREQ(spec, COMPOSITOR)) {
+ (void) scan_string(page_comp);
+ /* page precedence */
+ } else if (STREQ(spec, PRECEDENCE)) {
+ (void) scan_string(page_prec);
+ (void) process_precedence();
+ /* index input format */
+ } else if (STREQ(spec, KEYWORD))
+ (void) scan_string(idx_keyword);
+ else if (STREQ(spec, AOPEN))
+ (void) scan_char(&idx_aopen);
+ else if (STREQ(spec, ACLOSE))
+ (void) scan_char(&idx_aclose);
+ else if (STREQ(spec, LEVEL))
+ (void) scan_char(&idx_level);
+ else if (STREQ(spec, ROPEN))
+ (void) scan_char(&idx_ropen);
+ else if (STREQ(spec, RCLOSE))
+ (void) scan_char(&idx_rclose);
+ else if (STREQ(spec, QUOTE))
+ (void) scan_char(&idx_quote);
+ else if (STREQ(spec, ACTUAL))
+ (void) scan_char(&idx_actual);
+ else if (STREQ(spec, ENCAP))
+ (void) scan_char(&idx_encap);
+ else if (STREQ(spec, ESCAPE))
+ (void) scan_char(&idx_escape);
+ else {
+ (void) next_nonblank();
+ STY_SKIPLINE;
+ STY_ERROR("Unknown specifier %s.\n", spec);
+ put_dot = FALSE;
+ }
+ if (put_dot) {
+ STY_DOT;
+ }
+ }
+
+ /* check if quote and escape are distinct */
+ if (idx_quote == idx_escape) {
+ STY_ERROR(
+ "Quote and escape symbols must be distinct (both `%c' now).\n",
+ idx_quote);
+ idx_quote = IDX_QUOTE;
+ idx_escape = IDX_ESCAPE;
+ }
+ DONE(sty_tc - sty_ec, "attributes redefined", sty_ec, "ignored");
+ CLOSE(sty_fp);
+}
+
+static int
+#if STDC
+scan_spec(char spec[])
+#else
+scan_spec(spec)
+char spec[];
+#endif
+{
+ int i = 0;
+ int c;
+
+ while (TRUE)
+ if ((c = next_nonblank()) == -1)
+ return (FALSE);
+ else if (c == COMMENT) {
+ STY_SKIPLINE;
+ } else
+ break;
+
+ spec[0] = TOLOWER(c);
+ while ((i++ < STRING_MAX) && ((c = GET_CHAR(sty_fp)) != SPC) &&
+ (c != TAB) && (c != LFD) && (c != EOF))
+ spec[i] = TOLOWER(c);
+ if (i < STRING_MAX) {
+ spec[i] = NUL;
+ if (c == EOF) {
+ STY_ERROR(
+ "No attribute for specifier %s (premature EOF)\n",
+ spec);
+ return (-1);
+ }
+ if (c == LFD)
+ sty_lc++;
+ return (TRUE);
+ } else {
+ STY_ERROR2("Specifier %s too long (max %d).\n",
+ spec, STRING_MAX);
+ return (FALSE);
+ }
+}
+
+
+static int
+next_nonblank(VOID_ARG)
+{
+ int c;
+
+ while (TRUE) {
+ switch (c = GET_CHAR(sty_fp)) {
+ case EOF:
+ return (-1);
+
+ case LFD:
+ sty_lc++;
+ case SPC:
+ case TAB:
+ break;
+ default:
+ return (c);
+ }
+ }
+}
+
+
+static int
+#if STDC
+scan_string(char str[])
+#else
+scan_string(str)
+char str[];
+#endif
+{
+ char clone[ARRAY_MAX];
+ int i = 0;
+ int c;
+
+ switch (c = next_nonblank()) {
+ case STR_DELIM:
+ while (TRUE)
+ switch (c = GET_CHAR(sty_fp)) {
+ case EOF:
+ STY_ERROR("No closing delimiter in %s.\n",
+ clone);
+ return (FALSE);
+ case STR_DELIM:
+ clone[i] = NUL;
+ strcpy(str, clone);
+ return (TRUE);
+ case BSH:
+ switch (c = GET_CHAR(sty_fp)) {
+ case 't':
+ clone[i++] = TAB;
+ break;
+ case 'n':
+ clone[i++] = LFD;
+ break;
+
+ default:
+ clone[i++] = (char) c;
+ break;
+ }
+ break;
+ default:
+ if (c == LFD)
+ sty_lc++;
+ if (i < ARRAY_MAX)
+ clone[i++] = (char) c;
+ else {
+ STY_SKIPLINE;
+ STY_ERROR2(
+ "Attribute string %s too long (max %d).\n",
+ clone, ARRAY_MAX);
+ return (FALSE);
+ }
+ break;
+ }
+ break;
+ case COMMENT:
+ STY_SKIPLINE;
+ break;
+ default:
+ STY_SKIPLINE;
+ STY_ERROR("No opening delimiter.\n", "");
+ return (FALSE);
+ }
+ return (TRUE); /* function value no longer used */
+}
+
+
+static int
+#if STDC
+scan_char(char *c)
+#else
+scan_char(c)
+char *c;
+#endif
+{
+ int clone;
+
+ switch (clone = next_nonblank()) {
+ case CHR_DELIM:
+ switch (clone = GET_CHAR(sty_fp)) {
+ case CHR_DELIM:
+ STY_SKIPLINE;
+ STY_ERROR("Premature closing delimiter.\n", "");
+ return (FALSE);
+ case LFD:
+ sty_lc++;
+ case EOF:
+ STY_ERROR("No character (premature EOF).\n", "");
+ return (FALSE);
+ case BSH:
+ clone = GET_CHAR(sty_fp);
+ default:
+ if (GET_CHAR(sty_fp) == CHR_DELIM) {
+ *c = (char) clone;
+ return (TRUE);
+ } else {
+ STY_ERROR("No closing delimiter or too many letters.\n", "");
+ return (FALSE);
+ }
+ }
+ /* break; */ /* NOT REACHED */
+ case COMMENT:
+ STY_SKIPLINE;
+ break;
+ default:
+ STY_SKIPLINE;
+ STY_ERROR("No opening delimiter.\n", "");
+ return (FALSE);
+ }
+ return (TRUE); /* function value no longer used */
+}
+
+
+static int
+#if STDC
+count_lfd(char *str)
+#else
+count_lfd(str)
+char *str;
+#endif
+{
+ int i = 0;
+ int n = 0;
+
+ while (str[i] != NUL) {
+ if (str[i] == LFD)
+ n++;
+ i++;
+ }
+ return (n);
+}
+
+
+static int
+process_precedence(VOID_ARG)
+{
+ int order[PAGETYPE_MAX];
+ int type[PAGETYPE_MAX];
+ int i = 0;
+ int last;
+ int roml = FALSE;
+ int romu = FALSE;
+ int arab = FALSE;
+ int alpl = FALSE;
+ int alpu = FALSE;
+
+ /* check for llegal specifiers first */
+ while ((i < PAGETYPE_MAX) && (page_prec[i] != NUL)) {
+ switch (page_prec[i]) {
+ case ROMAN_LOWER:
+ if (roml) {
+ MULTIPLE(ROMAN_LOWER);
+ } else
+ roml = TRUE;
+ break;
+ case ROMAN_UPPER:
+ if (romu) {
+ MULTIPLE(ROMAN_UPPER);
+ } else
+ romu = TRUE;
+ break;
+ case ARABIC:
+ if (arab) {
+ MULTIPLE(ARABIC);
+ } else
+ arab = TRUE;
+ break;
+ case ALPHA_LOWER:
+ if (alpl) {
+ MULTIPLE(ALPHA_UPPER);
+ } else
+ alpl = TRUE;
+ break;
+ case ALPHA_UPPER:
+ if (alpu) {
+ MULTIPLE(ALPHA_UPPER);
+ } else
+ alpu = TRUE;
+ break;
+ default:
+ STY_SKIPLINE;
+ STY_ERROR("Unknow type `%c' in page precedence specification.\n",
+ page_prec[i]);
+ return (FALSE);
+ }
+ i++;
+ }
+ if (page_prec[i] != NUL) {
+ STY_SKIPLINE;
+ STY_ERROR("Page precedence specification string too long.\n", "");
+ return (FALSE);
+ }
+ last = i;
+ switch (page_prec[0]) {
+ case ROMAN_LOWER:
+ order[0] = ROMAN_LOWER_OFFSET;
+ type[0] = ROML;
+ break;
+ case ROMAN_UPPER:
+ order[0] = ROMAN_UPPER_OFFSET;
+ type[0] = ROMU;
+ break;
+ case ARABIC:
+ order[0] = ARABIC_OFFSET;
+ type[0] = ARAB;
+ break;
+ case ALPHA_LOWER:
+ order[0] = ALPHA_LOWER_OFFSET;
+ type[0] = ALPL;
+ break;
+ case ALPHA_UPPER:
+ order[0] = ALPHA_LOWER_OFFSET;
+ type[0] = ALPU;
+ break;
+ }
+
+ i = 1;
+ while (i < last) {
+ switch (page_prec[i]) {
+ case ROMAN_LOWER:
+ order[i] = order[i - 1] + ROMAN_LOWER_OFFSET;
+ type[i] = ROML;
+ break;
+ case ROMAN_UPPER:
+ order[i] = order[i - 1] + ROMAN_UPPER_OFFSET;
+ type[i] = ROMU;
+ break;
+ case ARABIC:
+ order[i] = order[i - 1] + ARABIC_OFFSET;
+ type[i] = ARAB;
+ break;
+ case ALPHA_LOWER:
+ order[i] = order[i - 1] + ALPHA_LOWER_OFFSET;
+ type[i] = ALPL;
+ break;
+ case ALPHA_UPPER:
+ order[i] = order[i - 1] + ALPHA_LOWER_OFFSET;
+ type[i] = ALPU;
+ break;
+ }
+ i++;
+ }
+
+ for (i = 0; i < PAGETYPE_MAX; i++) {
+ page_offset[i] = -1;
+ }
+ page_offset[type[0]] = 0;
+ for (i = 1; i < last; i++) {
+ page_offset[type[i]] = order[i - 1];
+ }
+ for (i = 0; i < PAGETYPE_MAX; i++) {
+ if (page_offset[i] == -1) {
+ switch (type[last - 1]) {
+ case ROML:
+ order[last] = order[last - 1] + ROMAN_LOWER_OFFSET;
+ break;
+ case ROMU:
+ order[last] = order[last - 1] + ROMAN_UPPER_OFFSET;
+ break;
+ case ARAB:
+ order[last] = order[last - 1] + ARABIC_OFFSET;
+ break;
+ case ALPL:
+ order[last] = order[last - 1] + ALPHA_LOWER_OFFSET;
+ break;
+ case ALPU:
+ order[last] = order[last - 1] + ALPHA_UPPER_OFFSET;
+ break;
+ }
+ type[last] = i;
+ page_offset[i] = order[last];
+ last++;
+ }
+ }
+ return (TRUE); /* function value no longer used */
+}
diff --git a/Build/source/texk/makeindexk/scanst.h b/Build/source/texk/makeindexk/scanst.h
new file mode 100644
index 00000000000..6b4eb135a64
--- /dev/null
+++ b/Build/source/texk/makeindexk/scanst.h
@@ -0,0 +1,195 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#define COMMENT '%'
+#define STR_DELIM '"'
+#define CHR_DELIM '\''
+
+#define KEYWORD "keyword"
+#define AOPEN "arg_open"
+#define ACLOSE "arg_close"
+#define ROPEN "range_open"
+#define RCLOSE "range_close"
+#define LEVEL "level"
+#define QUOTE "quote"
+#define ACTUAL "actual"
+#define ENCAP "encap"
+#define ESCAPE "escape"
+
+#define IDX_KEYWORD "\\indexentry"
+#define IDX_AOPEN '{'
+#define IDX_ACLOSE '}'
+#define IDX_ROPEN '('
+#define IDX_RCLOSE ')'
+#define IDX_LEVEL '!'
+#define IDX_QUOTE '"'
+#define IDX_ACTUAL '@'
+#define IDX_ENCAP '|'
+#define IDX_ESCAPE '\\'
+
+#define COMPOSITOR "page_compositor"
+#define COMPOSITOR_DEF "-"
+#define PRECEDENCE "page_precedence"
+#define PRECEDENCE_DEF "rnaRA"
+#define ROMAN_LOWER 'r'
+#define ROMAN_UPPER 'R'
+#define ARABIC 'n'
+#define ALPHA_LOWER 'a'
+#define ALPHA_UPPER 'A'
+#define ROMAN_LOWER_OFFSET 10000
+#define ROMAN_UPPER_OFFSET 10000
+#define ARABIC_OFFSET 10000
+#define ALPHA_LOWER_OFFSET 26
+#define ALPHA_UPPER_OFFSET 26
+
+#define PREAMBLE "preamble"
+#define PREAMBLE_DEF "\\begin{theindex}\n"
+#define PREAMBLE_LEN 1
+#define POSTAMBLE "postamble"
+#define POSTAMBLE_DEF "\n\n\\end{theindex}\n"
+#define POSTAMBLE_LEN 3
+
+#define SETPAGEOPEN "setpage_prefix"
+#define SETPAGECLOSE "setpage_suffix"
+
+#define SETPAGEOPEN_DEF "\n \\setcounter{page}{"
+
+#define SETPAGECLOSE_DEF "}\n"
+#define SETPAGE_LEN 2
+
+#define GROUP_SKIP "group_skip"
+#define GROUPSKIP_DEF "\n\n \\indexspace\n"
+#define GROUPSKIP_LEN 3
+
+#define HEADINGS_FLAG "headings_flag"
+#define HEADINGSFLAG_DEF 0
+#define HEADING_PRE "heading_prefix"
+#define HEADINGPRE_DEF ""
+#define HEADINGPRE_LEN 0
+#define HEADING_SUF "heading_suffix"
+#define HEADINGSUF_DEF ""
+#define HEADINGSUF_LEN 0
+#define SYMHEAD_POS "symhead_positive"
+#define SYMHEADPOS_DEF "Symbols"
+#define SYMHEAD_NEG "symhead_negative"
+#define SYMHEADNEG_DEF "symbols"
+#define NUMHEAD_POS "numhead_positive"
+#define NUMHEADPOS_DEF "Numbers"
+#define NUMHEAD_NEG "numhead_negative"
+#define NUMHEADNEG_DEF "numbers"
+
+#define ITEM_0 "item_0"
+#define ITEM_1 "item_1"
+#define ITEM_2 "item_2"
+#define ITEM_01 "item_01"
+#define ITEM_x1 "item_x1"
+#define ITEM_12 "item_12"
+#define ITEM_x2 "item_x2"
+
+#define ITEM0_DEF "\n \\item "
+#define ITEM1_DEF "\n \\subitem "
+#define ITEM2_DEF "\n \\subsubitem "
+
+#define ITEM_LEN 1
+
+#define DELIM_0 "delim_0"
+#define DELIM_1 "delim_1"
+#define DELIM_2 "delim_2"
+#define DELIM_N "delim_n"
+#define DELIM_R "delim_r"
+#define DELIM_T "delim_t"
+#define DELIM_DEF ", "
+#define DELIMR_DEF "--"
+#define DELIMT_DEF ""
+
+#define SUFFIX_2P "suffix_2p"
+#define SUFFIX_3P "suffix_3p"
+#define SUFFIX_MP "suffix_mp"
+
+#define ENCAP_0 "encap_prefix"
+#define ENCAP_1 "encap_infix"
+#define ENCAP_2 "encap_suffix"
+#define ENCAP0_DEF "\\"
+#define ENCAP1_DEF "{"
+#define ENCAP2_DEF "}"
+
+#define LINEMAX "line_max"
+#define INDENT_SPACE "indent_space"
+#define INDENT_LENGTH "indent_length"
+
+#define INDENTSPC_DEF "\t\t"
+
+#define INDENTLEN_DEF 16
+
+#define STY_ERROR(F, D) { \
+ if (idx_dot) { \
+ fprintf(ilg_fp, "\n"); \
+ idx_dot = FALSE; \
+ } \
+ fprintf(ilg_fp, "** Input style error (file = %s, line = %d):\n -- ", \
+ sty_fn, sty_lc); \
+ fprintf(ilg_fp, F, D); \
+ sty_ec++; \
+ put_dot = FALSE; \
+}
+
+#define STY_ERROR2(F, D1, D2) { \
+ if (idx_dot) { \
+ fprintf(ilg_fp, "\n"); \
+ idx_dot = FALSE; \
+ } \
+ fprintf(ilg_fp, "** Input style error (file = %s, line = %d):\n -- ", \
+ sty_fn, sty_lc); \
+ fprintf(ilg_fp, F, D1, D2); \
+ sty_ec++; \
+ put_dot = FALSE; \
+}
+
+#define STY_DOT { \
+ idx_dot = TRUE; \
+ if (verbose) \
+ fprintf(stderr, DOT); \
+ fprintf(ilg_fp, DOT); \
+}
+
+#define STY_SKIPLINE { \
+ int a; \
+ while ( ((a = GET_CHAR(sty_fp)) != LFD) && (a != EOF) ); \
+ sty_lc++; \
+}
+
+#define SCAN_NO(N) { \
+ fscanf(sty_fp, "%d", N); \
+}
+
+#define MULTIPLE(C) { \
+ STY_SKIPLINE; \
+STY_ERROR2( \
+"Multiple instances of type `%c' in page precedence specification `%s'.\n", \
+C, page_prec); \
+ return (FALSE); \
+}
diff --git a/Build/source/texk/makeindexk/sortid.c b/Build/source/texk/makeindexk/sortid.c
new file mode 100644
index 00000000000..db1f25609bd
--- /dev/null
+++ b/Build/source/texk/makeindexk/sortid.c
@@ -0,0 +1,345 @@
+/*
+ *
+ * This file is part of
+ * MakeIndex - A formatter and format independent index processor
+ *
+ * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
+ * Copyright (C) 1988 by Olivetti Research Center
+ * Copyright (C) 1987 by Regents of the University of California
+ *
+ * Author:
+ * Pehong Chen
+ * Chen & Harrison International Systems, Inc.
+ * Palo Alto, California
+ * USA
+ * (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
+ *
+ * Contributors:
+ * Please refer to the CONTRIB file that comes with this release
+ * for a list of people who have contributed to this and/or previous
+ * release(s) of MakeIndex.
+ *
+ * All rights reserved by the copyright holders. See the copyright
+ * notice distributed with this software for a complete description of
+ * the conditions under which it is made available.
+ *
+ */
+
+#include "mkind.h"
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+static long idx_gc;
+
+static int check_mixsym ARGS((char *x,char *y));
+static int compare ARGS((struct KFIELD * *a,struct KFIELD * *b));
+static int compare_one ARGS((char *x,char *y));
+static int compare_page ARGS((struct KFIELD * *a,struct KFIELD * *b));
+static int compare_string ARGS((unsigned char *a,unsigned char *b));
+static int new_strcmp ARGS((unsigned char *a, unsigned char *b,
+ int option));
+
+void
+sort_idx(VOID_ARG)
+{
+#ifdef HAVE_SETLOCALE
+ char *prev_locale;
+#endif
+
+ MESSAGE("Sorting entries...", "");
+#ifdef HAVE_SETLOCALE
+ prev_locale = setlocale(LC_COLLATE, NULL);
+ setlocale(LC_COLLATE, "");
+#endif
+ idx_dc = 0;
+ idx_gc = 0L;
+ qqsort((char *) idx_key, (int) idx_gt, (int) sizeof(FIELD_PTR),
+ (int (*) ARGS((char*,char*)))compare);
+#ifdef HAVE_SETLOCALE
+ setlocale(LC_COLLATE, prev_locale);
+#endif
+ MESSAGE("done (%ld comparisons).\n", idx_gc);
+}
+
+static int
+#if STDC
+compare(FIELD_PTR *a, FIELD_PTR *b)
+#else
+compare(a, b)
+FIELD_PTR *a;
+FIELD_PTR *b;
+#endif
+{
+ int i;
+ int dif;
+
+ idx_gc++;
+ IDX_DOT(CMP_MAX);
+
+ for (i = 0; i < FIELD_MAX; i++) {
+ /* compare the sort fields */
+ if ((dif = compare_one((*a)->sf[i], (*b)->sf[i])) != 0)
+ break;
+
+ /* compare the actual fields */
+ if ((dif = compare_one((*a)->af[i], (*b)->af[i])) != 0)
+ break;
+ }
+
+ /* both key aggregates are identical, compare page numbers */
+ if (i == FIELD_MAX)
+ dif = compare_page(a, b);
+ return (dif);
+}
+
+static int
+#if STDC
+compare_one(char *x,char *y)
+#else
+compare_one(x, y)
+char *x;
+char *y;
+#endif
+{
+ int m;
+ int n;
+
+ if ((x[0] == NUL) && (y[0] == NUL))
+ return (0);
+
+ if (x[0] == NUL)
+ return (-1);
+
+ if (y[0] == NUL)
+ return (1);
+
+ m = group_type(x);
+ n = group_type(y);
+
+ /* both pure digits */
+ if ((m >= 0) && (n >= 0))
+ return (m - n);
+
+ /* x digit, y non-digit */
+ if (m >= 0) {
+ if (german_sort)
+ return (1);
+ else
+ return ((n == -1) ? 1 : -1);
+ }
+ /* x non-digit, y digit */
+ if (n >= 0) {
+ if (german_sort)
+ return (-1);
+ else
+ return ((m == -1) ? -1 : 1);
+ }
+ /* strings started with a symbol (including digit) */
+ if ((m == SYMBOL) && (n == SYMBOL))
+ return (check_mixsym(x, y));
+
+ /* x symbol, y non-symbol */
+ if (m == SYMBOL)
+ return (-1);
+
+ /* x non-symbol, y symbol */
+ if (n == SYMBOL)
+ return (1);
+
+ /* strings with a leading letter, the ALPHA type */
+ return (compare_string((unsigned char*)x, (unsigned char*)y));
+}
+
+static int
+#if STDC
+check_mixsym(char *x, char *y)
+#else
+check_mixsym(x, y)
+char *x;
+char *y;
+#endif
+{
+ int m;
+ int n;
+
+ m = ISDIGIT(x[0]);
+ n = ISDIGIT(y[0]);
+
+ if (m && !n)
+ return (1);
+
+ if (!m && n)
+ return (-1);
+
+ return (locale_sort ? strcoll(x, y) : strcmp(x, y));
+}
+
+
+static int
+#if STDC
+compare_string(unsigned char *a, unsigned char *b)
+#else
+compare_string(a, b)
+unsigned char *a;
+unsigned char *b;
+#endif
+{
+ int i = 0;
+ int j = 0;
+ int al;
+ int bl;
+
+ if (locale_sort) return strcoll(a, b);
+
+ while ((a[i] != NUL) || (b[j] != NUL)) {
+ if (a[i] == NUL)
+ return (-1);
+ if (b[j] == NUL)
+ return (1);
+ if (letter_ordering) {
+ if (a[i] == SPC)
+ i++;
+ if (b[j] == SPC)
+ j++;
+ }
+ al = TOLOWER(a[i]);
+ bl = TOLOWER(b[j]);
+
+ if (al != bl)
+ return (al - bl);
+ i++;
+ j++;
+ }
+ if (german_sort)
+ return (new_strcmp(a, b, GERMAN));
+ else
+ return (strcmp((char*)a, (char*)b));
+}
+
+static int
+#if STDC
+compare_page(FIELD_PTR *a, FIELD_PTR *b)
+#else
+compare_page(a, b)
+FIELD_PTR *a;
+FIELD_PTR *b;
+#endif
+{
+ int m = 0;
+ short i = 0;
+
+ while ((i < (*a)->count) && (i < (*b)->count) &&
+ ((m = (*a)->npg[i] - (*b)->npg[i]) == 0))
+ {
+ i++;
+ }
+ if (m == 0)
+ { /* common leading page numbers match */
+ if ((i == (*a)->count) && (i == (*b)->count))
+ { /* all page numbers match */
+ /***********************************************************
+ We have identical entries, except possibly in encap fields.
+ The ordering is tricky here. Consider the following input
+ sequence of index names, encaps, and page numbers:
+
+ foo|( 2
+ foo|) 6
+ foo|( 6
+ foo|) 10
+
+ This might legimately occur when a page range ends, and
+ subsequently, a new range starts, on the same page. If we
+ just order by range_open and range_close (here, parens),
+ then we will produce
+
+ foo|( 2
+ foo|( 6
+ foo|) 6
+ foo|) 10
+
+ This will later generate the index entry
+
+ foo, 2--6, \({6}, 10
+
+ which is not only wrong, but has also introduced an illegal
+ LaTeX macro, \({6}, because the merging step treated this
+ like a \see{6} entry.
+
+ The solution is to preserve the original input order, which
+ we can do by treating range_open and range_close as equal,
+ and then ordering by input line number. This will then
+ generate the correct index entry
+
+ foo, 2--10
+
+ Ordering inconsistencies from missing range open or close
+ entries, or mixing roman and arabic page numbers, will be
+ detected later.
+ ***********************************************************/
+
+#define isrange(c) ( ((c) == idx_ropen) || ((c) == idx_rclose) )
+
+ /* Order two range values by input line number */
+
+ if (isrange(*(*a)->encap) && isrange(*(*b)->encap))
+ m = (*a)->lc - (*b)->lc;
+
+ /* Handle identical encap fields; neither is a range delimiter */
+
+ else if (STREQ((*a)->encap, (*b)->encap))
+ {
+ /* If neither are yet marked duplicate, mark the second
+ of them to be ignored. */
+ if (((*a)->type != DUPLICATE) &&
+ ((*b)->type != DUPLICATE))
+ (*b)->type = DUPLICATE;
+ /* leave m == 0 to show equality */
+ }
+
+ /* Encap fields differ: only one may be a range delimiter, */
+ /* or else neither of them is. If either of them is a range */
+ /* delimiter, order by input line number; otherwise, order */
+ /* by name. */
+
+ else
+ {
+ if ( isrange(*(*a)->encap) || isrange(*(*b)->encap) )
+ m = (*a)->lc - (*b)->lc; /* order by input line number */
+ else /* order non-range items by */
+ /* their encap strings */
+ m = compare_string((unsigned char*)((*a)->encap),
+ (unsigned char*)((*b)->encap));
+ }
+ }
+ else if ((i == (*a)->count) && (i < (*b)->count))
+ m = -1;
+ else if ((i < (*a)->count) && (i == (*b)->count))
+ m = 1;
+ }
+ return (m);
+}
+
+
+static int
+#if STDC
+new_strcmp(unsigned char *s1, unsigned char *s2, int option)
+#else
+new_strcmp(s1, s2, option)
+unsigned char *s1;
+unsigned char *s2;
+int option;
+#endif
+{
+ int i;
+
+ i = 0;
+ while (s1[i] == s2[i])
+ if (s1[i++] == NUL)
+ return (0);
+ if (option) /* ASCII */
+ return (isupper(s1[i]) ? -1 : 1);
+ else /* GERMAN */
+ return (isupper(s1[i]) ? 1 : -1);
+}
diff --git a/Build/source/texk/makeindexk/stamp-auto.in b/Build/source/texk/makeindexk/stamp-auto.in
new file mode 100644
index 00000000000..313c8608f7e
--- /dev/null
+++ b/Build/source/texk/makeindexk/stamp-auto.in
@@ -0,0 +1 @@
+Mo Aug 22 08:28:55 CEST 2005
diff --git a/Build/source/texk/makeindexk/win32.mak b/Build/source/texk/makeindexk/win32.mak
new file mode 100644
index 00000000000..c2107ae2c45
--- /dev/null
+++ b/Build/source/texk/makeindexk/win32.mak
@@ -0,0 +1,56 @@
+################################################################################
+#
+# Makefile : MakeIndex(k)
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <01/11/19 11:36:09 popineau>
+#
+################################################################################
+root_srcdir = ..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+version = 2.13
+
+USE_KPATHSEA = 1
+USE_GNUW32 = 1
+
+!include <msvc/common.mak>
+
+DEFS = $(DEFS) -DHAVE_CONFIG_H
+
+objects = \
+ $(objdir)\genind.obj \
+ $(objdir)\mkind.obj \
+ $(objdir)\qsort.obj \
+ $(objdir)\scanid.obj \
+ $(objdir)\scanst.obj \
+ $(objdir)\sortid.obj
+program = $(objdir)\makeindex.exe
+programs = $(program)
+
+manfiles = makeindex.1
+
+default all: $(objdir) $(programs)
+
+$(program): $(objects) $(objdir)\makeindex.res $(kpathsealib)
+ $(link) $(**) $(conlibs)
+
+!include <msvc/config.mak>
+
+!include <msvc/install.mak>
+
+install:: install-exec install-man
+
+!include <msvc/clean.mak>
+
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+#
+# Local Variables:
+# mode: makefile
+# End: