summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2022-06-05 21:33:52 +0200
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2022-06-05 21:33:52 +0200
commit4d576e8053c28da45129553b25871f4fe9824925 (patch)
treee812ca5cf5c6c54d74f9b7d2060366213eae4f6b
parent3aa5fb00be821a198f42c69924ae02b393ac2b4b (diff)
parent24eaa721effcf2f56d1da62344ee27ac9721d3ec (diff)
downloadexim4-add-xfpt.tar.gz
Add '3rd-party/xfpt/' from commit '24eaa721effcf2f56d1da62344ee27ac9721d3ec'add-xfpt
git-subtree-dir: 3rd-party/xfpt git-subtree-mainline: 3aa5fb00be821a198f42c69924ae02b393ac2b4b git-subtree-split: 24eaa721effcf2f56d1da62344ee27ac9721d3ec
-rw-r--r--3rd-party/xfpt/.gitignore5
-rw-r--r--3rd-party/xfpt/INSTALL184
-rw-r--r--3rd-party/xfpt/LICENCE340
-rw-r--r--3rd-party/xfpt/Makefile.in63
-rw-r--r--3rd-party/xfpt/NOTICE21
-rw-r--r--3rd-party/xfpt/README30
-rwxr-xr-x3rd-party/xfpt/configure4016
-rw-r--r--3rd-party/xfpt/configure.ac29
-rw-r--r--3rd-party/xfpt/doc/xfpt.148
-rw-r--r--3rd-party/xfpt/doc/xfpt.html1463
-rw-r--r--3rd-party/xfpt/doc/xfpt.pdfbin0 -> 70341 bytes
-rw-r--r--3rd-party/xfpt/doc/xfpt.xfpt1211
-rwxr-xr-x3rd-party/xfpt/install-sh251
-rwxr-xr-x3rd-party/xfpt/mkinstalldirs40
-rw-r--r--3rd-party/xfpt/share/stdflags21
-rw-r--r--3rd-party/xfpt/share/stdmacs454
-rw-r--r--3rd-party/xfpt/src/Makefile51
-rw-r--r--3rd-party/xfpt/src/dot.c906
-rw-r--r--3rd-party/xfpt/src/error.c186
-rw-r--r--3rd-party/xfpt/src/functions.h28
-rw-r--r--3rd-party/xfpt/src/globals.c50
-rw-r--r--3rd-party/xfpt/src/globals.h52
-rw-r--r--3rd-party/xfpt/src/literal.c39
-rw-r--r--3rd-party/xfpt/src/misc.c198
-rw-r--r--3rd-party/xfpt/src/mytypes.h96
-rw-r--r--3rd-party/xfpt/src/para.c385
-rw-r--r--3rd-party/xfpt/src/read.c388
-rw-r--r--3rd-party/xfpt/src/structs.h78
-rw-r--r--3rd-party/xfpt/src/tree.c216
-rw-r--r--3rd-party/xfpt/src/xfpt.c259
-rw-r--r--3rd-party/xfpt/src/xfpt.h65
-rw-r--r--3rd-party/xfpt/testing/infiles/01431
-rw-r--r--3rd-party/xfpt/testing/infiles/0266
-rw-r--r--3rd-party/xfpt/testing/infiles/02.inc3
-rw-r--r--3rd-party/xfpt/testing/infiles/0314
-rw-r--r--3rd-party/xfpt/testing/infiles/049
-rw-r--r--3rd-party/xfpt/testing/infiles/pic01.aspic.inc1
-rw-r--r--3rd-party/xfpt/testing/infiles/pic01.eps.inc47
-rw-r--r--3rd-party/xfpt/testing/outfiles/01479
-rw-r--r--3rd-party/xfpt/testing/outfiles/01.err6
-rw-r--r--3rd-party/xfpt/testing/outfiles/0240
-rw-r--r--3rd-party/xfpt/testing/outfiles/02.err118
-rw-r--r--3rd-party/xfpt/testing/outfiles/0311
-rw-r--r--3rd-party/xfpt/testing/outfiles/0416
-rwxr-xr-x3rd-party/xfpt/testing/runtest165
45 files changed, 12579 insertions, 0 deletions
diff --git a/3rd-party/xfpt/.gitignore b/3rd-party/xfpt/.gitignore
new file mode 100644
index 000000000..ef0ad5fd8
--- /dev/null
+++ b/3rd-party/xfpt/.gitignore
@@ -0,0 +1,5 @@
+Makefile
+config.log
+config.status
+src/*.o
+src/xfpt
diff --git a/3rd-party/xfpt/INSTALL b/3rd-party/xfpt/INSTALL
new file mode 100644
index 000000000..d9f8acd21
--- /dev/null
+++ b/3rd-party/xfpt/INSTALL
@@ -0,0 +1,184 @@
+Basic Installation
+==================
+
+ These are generic installation instructions that apply to systems that
+can run the `configure' shell script - Unix systems and any that imitate
+it. They are not specific to xfpt.
+
+ 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 awhile. 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. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--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/3rd-party/xfpt/LICENCE b/3rd-party/xfpt/LICENCE
new file mode 100644
index 000000000..31d076d96
--- /dev/null
+++ b/3rd-party/xfpt/LICENCE
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program 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 of the License, or
+ (at your option) any later version.
+
+ This program 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 program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/3rd-party/xfpt/Makefile.in b/3rd-party/xfpt/Makefile.in
new file mode 100644
index 000000000..2c3835e79
--- /dev/null
+++ b/3rd-party/xfpt/Makefile.in
@@ -0,0 +1,63 @@
+
+# Makefile.in for xfpt. The building work is done by a separate Makefile in
+# the src directory, which gets passed settings from here.
+
+mkinstalldirs = $(SHELL) mkinstalldirs
+
+# These variables get set up by the configure script.
+
+CC=@CC@
+CFLAGS=@CFLAGS@
+LFLAGS=@LFLAGS@
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+BINDIR=@prefix@/bin
+DATADIR=@prefix@/share/xfpt
+MANDIR=@prefix@/man
+
+# BINDIR is the directory in which the commands are installed.
+# DATADIR is the directory in which the include styles are installed.
+# MANDIR is the directory in which the man pages are installed.
+
+# The compile commands can be very long. To make the output look better,
+# they are not normally echoed in full. To get full echoing, the caller
+# must set FULLECHO='' on the command line and call make with -e. We default
+# FULLECHO to '@' to suppress the full echo. Then define an abbreviation.
+
+FULLECHO = @
+FE = $(FULLECHO)
+
+# Do the building in the src directory
+
+build:; @cd src; $(MAKE) all \
+ BINDIR=$(BINDIR) \
+ DATADIR=$(DATADIR) \
+ MANDIR=$(MANDIR) \
+ CC="$(CC)" \
+ CFLAGS="$(CFLAGS)" \
+ LFLAGS="$(LFLAGS)" \
+ FE="$(FE)"
+
+clean:; cd src; $(MAKE) clean
+
+distclean:; rm Makefile config.cache config.log config.status; \
+ cd src; $(MAKE) clean
+
+test:; cd testing; runtest
+
+install: build
+ $(mkinstalldirs) $(BINDIR)
+ $(mkinstalldirs) $(DATADIR)
+ $(mkinstalldirs) $(MANDIR)
+ $(mkinstalldirs) $(MANDIR)/man1
+ $(INSTALL) src/xfpt $(BINDIR)/xfpt
+ $(INSTALL_DATA) share/* $(DATADIR)
+ $(INSTALL_DATA) doc/xfpt.1 $(MANDIR)/man1
+
+uninstall:; rm -rf \
+ $(BINDIR)/xfpt \
+ $(DATADIR) \
+ $(MANDIR)/man1/xfpt.1
+# End
diff --git a/3rd-party/xfpt/NOTICE b/3rd-party/xfpt/NOTICE
new file mode 100644
index 000000000..5e206b514
--- /dev/null
+++ b/3rd-party/xfpt/NOTICE
@@ -0,0 +1,21 @@
+THE XFPT PLAIN TEXT TO XML PROCESSOR
+------------------------------------
+
+Copyright (c) 2006 University of Cambridge
+
+This program 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 of the License, or
+(at your option) any later version.
+
+This program 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+--
+Philip Hazel University of Cambridge Computing Service.
diff --git a/3rd-party/xfpt/README b/3rd-party/xfpt/README
new file mode 100644
index 000000000..688e1641c
--- /dev/null
+++ b/3rd-party/xfpt/README
@@ -0,0 +1,30 @@
+THE XFPT PLAIN TEXT TO XML PROCESSOR
+------------------------------------
+
+UNIX AND UNIX-LIKE SYSTEMS
+--------------------------
+
+It should just be a matter of typing
+
+ ./configure
+ make
+ make install
+
+to get youself an installed xfpt command. There is a man page that lists the
+command arguments. However, the main documentation is provided only as a PDF
+file in the doc directory. The xfpt source that was used to create the XML that
+in turn was used to generate the PDF is also included. You can get rid of xfpt
+by "make uninstall".
+
+
+OTHER SYSTEMS
+-------------
+
+xfpt consists almost entirely of Standard C code, and so it should be possible
+to compile it on any system with a Standard C compiler and library.
+
+Philip Hazel
+January 2006
+
+Domain: cam.ac.uk
+Local part: ph10
diff --git a/3rd-party/xfpt/configure b/3rd-party/xfpt/configure
new file mode 100755
index 000000000..55bf78a87
--- /dev/null
+++ b/3rd-party/xfpt/configure
@@ -0,0 +1,4016 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="configure.ac"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+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'
+
+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
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # 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_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$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 ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) 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 | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$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 | -n)
+ 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_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ 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 "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# 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_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ 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 "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # 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 <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# 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
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# 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 "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+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 "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+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 $# != 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
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&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
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $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
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# 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"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /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
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+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 "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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'
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+ return 0;
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_size_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+
+
+
+
+
+for ac_func in bcopy memmove strerror
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* 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 ();
+/* 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
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+ ac_config_files="$ac_config_files Makefile"
+cat >confcache <<\_ACEOF
+# 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, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# 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 \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+t quote
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LFLAGS@,$LFLAGS,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # 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_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ esac
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/3rd-party/xfpt/configure.ac b/3rd-party/xfpt/configure.ac
new file mode 100644
index 000000000..ae510b372
--- /dev/null
+++ b/3rd-party/xfpt/configure.ac
@@ -0,0 +1,29 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl This is required at the start; the name is the name of a file
+dnl it should be seeing, to verify it is in the same directory.
+
+AC_INIT(configure.ac)
+
+dnl Checks for programs.
+
+AC_PROG_CC
+AC_PROG_INSTALL
+
+dnl Checks for header files.
+
+AC_HEADER_STDC
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+AC_C_CONST
+AC_TYPE_SIZE_T
+
+dnl Checks for library functions.
+
+AC_CHECK_FUNCS(bcopy memmove strerror)
+
+AC_SUBST(LFLAGS)
+
+dnl This must be last; it determines what files are written
+AC_OUTPUT(Makefile)
diff --git a/3rd-party/xfpt/doc/xfpt.1 b/3rd-party/xfpt/doc/xfpt.1
new file mode 100644
index 000000000..756c231fe
--- /dev/null
+++ b/3rd-party/xfpt/doc/xfpt.1
@@ -0,0 +1,48 @@
+.TH XFPT 1
+.SH NAME
+xfpt - make XML from plain text
+.SH SYNOPSIS
+.B xfpt [options] [source file]
+.
+.SH DESCRIPTION
+.rs
+.sp
+\fBxfpt\fP converts a marked up text file to XML. The markup is simple and
+consists of lines that begin with a dot ("directive lines") and sequences in
+the text that begin with an ampersand ("flags"). The flag sequences are not
+built-in, but are defined by directives. As well as the in-built directives,
+macros can be used to implement higher level concepts. A standard set of macros
+and flags that generate DocBook XML is provided. There is a full description in
+the \fBxfpt\fP specification, which is distributed as a PDF file, an HTML file,
+and as \Bxfpt\fP source.
+.
+.SH OPTIONS
+.rs
+.TP 10
+\fB-help\fP
+This causes \fBxfpt\fP to output its "usage" information and then exit.
+.TP
+\fB-o\fP \fIfile\fP
+This specifies the output file. The default is the standard output if no source
+file is given, and the source file name with a \fI.xml\fP extension otherwise.
+.TP
+\fB-S\fP \fIdirectory\fP
+This specifies an alternative "share" directory in which to find standard
+configuration files.
+.TP
+\fB-v\fP
+Output the \fBxfpt\fP version and exit.
+.
+.SH AUTHOR
+.rs
+.sp
+Philip Hazel
+.br
+University Computing Service
+.br
+Cambridge CB2 3QG, England.
+.P
+.in 0
+Last updated: 22 March 2007
+.br
+Copyright (c) 2007 University of Cambridge.
diff --git a/3rd-party/xfpt/doc/xfpt.html b/3rd-party/xfpt/doc/xfpt.html
new file mode 100644
index 000000000..344416c33
--- /dev/null
+++ b/3rd-party/xfpt/doc/xfpt.html
@@ -0,0 +1,1463 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style xmlns="" type="text/css">
+div.added { background-color: #ffff99; }
+div.deleted { text-decoration: line-through;
+ background-color: #FF7F7F; }
+div.changed { background-color: #99ff99; }
+div.off { }
+
+span.added { background-color: #ffff99; }
+span.deleted { text-decoration: line-through;
+ background-color: #FF7F7F; }
+span.changed { background-color: #99ff99; }
+span.off { }
+
+
+
+pre.literallayout {
+ background-color: #E8E8D0;
+ padding-left: 0.5cm;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+div[class=changed] pre.literallayout {
+ background-color: #99ff99;
+ padding-left: 0.5cm;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+div.literallayout {
+ background-color: #E8E8D0;
+ padding-left: 0.5cm;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+div[class=changed] div.literallayout {
+ background-color: #99ff99;
+ padding-left: 0.5cm;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+</style>
+<title>
+The xfpt plain text to XML processor</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
+</head>
+<body>
+<div class="book" title="The xfpt plain text to XML processor">
+<div class="titlepage">
+<div>
+<div>
+<h1 class="title">
+<a id="idm3387464">
+</a>
+The xfpt plain text to XML processor</h1>
+</div>
+<div>
+<div class="author">
+<h3 class="author">
+<span class="firstname">
+Philip</span>
+<span class="surname">
+Hazel</span>
+</h3>
+</div>
+</div>
+<div>
+<p class="copyright">
+Copyright © 2012 University of Cambridge</p>
+</div>
+<div>
+<div class="revhistory">
+<table border="1" width="100%" summary="Revision history">
+<tr>
+<th align="left" valign="top" colspan="3">
+<strong>
+Revision History</strong>
+</th>
+</tr>
+<tr>
+<td align="left">
+Revision 0.09</td>
+<td align="left">
+18 May 2012</td>
+<td align="left">
+PH</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+<hr />
+</div>
+<div class="toc">
+<p>
+<strong>
+Table of Contents</strong>
+</p>
+<dl>
+<dt>
+<span xmlns="" class="chapter">
+<a id="toc0001" href="#ID00">
+1. Introduction</a>
+</span>
+</dt>
+<dd>
+<dl>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0002" href="#ID01">
+1.1. The <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis">
+<em>
+xfpt</em>
+</span>
+command line</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0003" href="#ID02">
+1.2. A short <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis">
+<em>
+xfpt</em>
+</span>
+example</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0004" href="#SECTliteralprocessing">
+1.3. Literal and non-literal processing</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0005" href="#ID04">
+1.4. Format of directive lines</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0006" href="#SECTcallingmacro">
+1.5. Calling macros</a>
+</span>
+</dt>
+</dl>
+</dd>
+<dt>
+<span xmlns="" class="chapter">
+<a id="toc0007" href="#ID06">
+2. Flag sequences</a>
+</span>
+</dt>
+<dd>
+<dl>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0008" href="#ID07">
+2.1. Flag sequences for XML entities and <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis">
+<em>
+xfpt</em>
+</span>
+variables</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0009" href="#ID08">
+2.2. Flag sequences for calling macros</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0010" href="#ID09">
+2.3. Other flag sequences</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0011" href="#ID10">
+2.4. Unrecognized flag sequences</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0012" href="#ID11">
+2.5. Standard flag sequences</a>
+</span>
+</dt>
+</dl>
+</dd>
+<dt>
+<span xmlns="" class="chapter">
+<a id="toc0013" href="#ID12">
+3. Built-in directive processing</a>
+</span>
+</dt>
+<dd>
+<dl>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0014" href="#ID13">
+3.1. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.arg</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0015" href="#ID14">
+3.2. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.eacharg</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0016" href="#ID15">
+3.3. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.echo</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0017" href="#ID16">
+3.4. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.endarg</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0018" href="#ID17">
+3.5. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.endeach</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0019" href="#ID18">
+3.6. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.endinliteral</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0020" href="#ID19">
+3.7. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.flag</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0021" href="#ID20">
+3.8. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.include</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0022" href="#ID21">
+3.9. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.inliteral</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0023" href="#ID22">
+3.10. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.literal</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0024" href="#SECTmacro">
+3.11. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.macro</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0025" href="#ID24">
+3.12. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.nest</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0026" href="#ID25">
+3.13. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.nonl</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0027" href="#ID26">
+3.14. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.pop</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0028" href="#ID27">
+3.15. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.push</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0029" href="#SECTrevision">
+3.16. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.revision</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0030" href="#ID29">
+3.17. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.set</strong>
+</span>
+directive</a>
+</span>
+</dt>
+</dl>
+</dd>
+<dt>
+<span xmlns="" class="chapter">
+<a id="toc0031" href="#CHAPstdmac">
+4. The standard macros for DocBook</a>
+</span>
+</dt>
+<dd>
+<dl>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0032" href="#ID31">
+4.1. Overall setup</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0033" href="#idp3069176">
+4.2. Processing instructions</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0034" href="#ID32">
+4.3. Chapters, sections, and subsections</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0035" href="#ID33">
+4.4. Prefaces, appendixes, and colophons</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0036" href="#idp3081992">
+4.5. Terminating chapters, etc.</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0037" href="#ID34">
+4.6. URL references</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0038" href="#ID35">
+4.7. Itemized lists</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0039" href="#ID36">
+4.8. Ordered lists</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0040" href="#ID37">
+4.9. Variable lists</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0041" href="#ID38">
+4.10. Nested lists</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0042" href="#ID39">
+4.11. Displayed text</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0043" href="#ID40">
+4.12. Block quotes</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0044" href="#SECTrevmacs">
+4.13. Revision markings</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0045" href="#ID42">
+4.14. Informal tables</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0046" href="#ID43">
+4.15. Formal tables</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0047" href="#ID44">
+4.16. Figures and images</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0048" href="#ID45">
+4.17. Footnotes</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0049" href="#ID46">
+4.18. Indexes</a>
+</span>
+</dt>
+</dl>
+</dd>
+</dl>
+</div>
+<div class="chapter" title="1. Introduction"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="ID00">1. Introduction</a></h2></div></div></div><p><span class="emphasis"><em>xfpt</em></span> is a program that reads a marked-up ASCII source file, and converts it into
+XML. It was written with DocBook XML in mind, but can also be used for other
+forms of XML. Unlike <span class="emphasis"><em>AsciiDoc</em></span> (<span class="bold"><strong><a class="ulink" href="http://www.methods.co.nz/asciidoc/" target="_top">http://www.methods.co.nz/asciidoc/</a></strong></span>),
+<span class="emphasis"><em>xfpt</em></span> does not try to produce XML from a document that is also usable as a
+freestanding ASCII document. The input for <span class="emphasis"><em>xfpt</em></span> is very definitely <span class="quote">“<span class="quote">marked
+up</span>”</span>. This makes it less ambiguous for large and/or complicated documents. <span class="emphasis"><em>xfpt</em></span>
+is also much faster than <span class="emphasis"><em>AsciiDoc</em></span> because it is written in C and does not
+rely on pattern matching.
+</p><p>
+<span class="emphasis"><em>xfpt</em></span> is aimed at users who understand the XML that they are generating. It makes
+it easy to include literal XML, either in blocks, or within paragraphs. <span class="emphasis"><em>xfpt</em></span>
+restricts itself to two special characters that trigger all its processing.
+</p><p>
+<span class="emphasis"><em>xfpt</em></span> treats any input line that starts with a dot as a <span class="emphasis"><em>directive</em></span> line.
+Directives control the way the input is processed. A small number of directives
+are implemented in the program itself. A macro facility makes it possible to
+combine these in various ways to define directives for higher-level concepts
+such as chapters and sections. A standard macro library that generates a simple
+subset of DocBook XML is provided. The only XML element that the program itself
+generates is <code class="literal">&lt;para&gt;</code>; all the others must be included as literal XML, either
+directly in the input text, or, more commonly, as part of the text that is
+generated by a macro call.
+</p><p>
+The ampersand character is special within non-literal text that is processed by
+<span class="emphasis"><em>xfpt</em></span>. An ampersand introduces a <span class="emphasis"><em>flag sequence</em></span> that modifies the output.
+Ampersand was chosen because it is also special in XML. As well as recognizing
+flag sequences that begin with an ampersand, <span class="emphasis"><em>xfpt</em></span> converts grave accents and
+apostrophes that appear in non-literal text into typographic opening and
+closing quotes, as follows:
+</p><div class="literallayout">
+ <code class="literal"> `    </code>  becomes  ‘<br />
+ <code class="literal"> '    </code>  becomes  ’<br />
+</div><p>
+Within normal input text, ampersand, grave accent, and apostrophe are the only
+characters that cause <span class="emphasis"><em>xfpt</em></span> to change the input text, but this applies only to
+non-literal text. In literal text, there are no markup characters, and only a
+dot at the start of a line is recognized as special. Within the body of a
+macro, there is one more special character: the dollar character is used to
+introduce an argument substitution.
+</p><p>
+Notwithstanding the previous paragraph, <span class="emphasis"><em>xfpt</em></span> knows that it is generating XML,
+and in all cases when a literal ampersand or angle bracket is required in the
+output, the appropriate XML entity reference (<code class="literal">&amp;amp;</code>, <code class="literal">&amp;lt;</code>, or
+<code class="literal">&amp;gt;</code>, respectively) is generated.
+</p><div class="section" title="1.1 The xfpt command line"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID01">1.1 The <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> command line</a></h3></div></div></div><p>The format of the <span class="emphasis"><em>xfpt</em></span> command line is:
+</p><div class="literallayout">
+ <code class="literal">xfpt [</code><span class="emphasis"><em>options</em></span><code class="literal">] [</code><span class="emphasis"><em>input source</em></span><code class="literal">]</code><br />
+</div><p>
+If no input is specified, the standard input is read. There are four options:
+</p><div class="variablelist"><dl><dt><span class="term"><span class="option"><strong>-help</strong></span></span></dt><dd><p>
+This option causes <span class="emphasis"><em>xfpt</em></span> to output its <span class="quote">“<span class="quote">usage</span>”</span> message, and exit.
+</p></dd><dt><span class="term"><span class="option"><strong>-o</strong></span> <span class="emphasis"><em>&lt;output destination&gt;</em></span></span></dt><dd><p>
+This option overrides the default destination. If the standard input is being
+read, the default destination is the standard output. Otherwise, the default
+destination is the name of the input file with the extension <em class="filename">.xml</em>,
+replacing its existing extension if there is one. A single hyphen character can
+be given as an output destination to refer to the standard output.
+</p></dd><dt><span class="term"><span class="option"><strong>-S</strong></span> <span class="emphasis"><em>&lt;directory path&gt;</em></span></span></dt><dd><p>
+This option overrides the path to <span class="emphasis"><em>xfpt</em></span>’s library directory that is built into
+the program. This makes it possible to use or test alternate libraries.
+</p></dd><dt><span class="term"><span class="option"><strong>-v</strong></span></span></dt><dd><p>
+This option causes <span class="emphasis"><em>xfpt</em></span> to output its version number and exit.
+</p></dd></dl></div></div><div class="section" title="1.2 A short xfpt example"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID02">1.2 A short <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> example</a></h3></div></div></div><p>Here is a very short example of a complete <span class="emphasis"><em>xfpt</em></span> input file that uses some of the
+standard macros and flags:
+</p><pre class="literallayout">
+ .include stdflags
+ .include stdmacs
+ .docbook
+ .book
+
+ .chapter "The first chapter"
+ This is the text of the first chapter. Here is an &amp;'italic'&amp;
+ word, and here is a &amp;*bold*&amp; one.
+
+ .section "This is a section heading"
+ We can use the &amp;*ilist*&amp; macro to generate an itemized list:
+ .ilist
+ The first item in the list.
+ .next
+ The last item in the list.
+ .endlist
+
+ There are also standard macros for ordered lists, literal
+ layout blocks, code blocks, URL references, index entries,
+ tables, footnotes, figures, etc.
+</pre></div><div class="section" title="1.3 Literal and non-literal processing"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTliteralprocessing">1.3 Literal and non-literal processing</a></h3></div></div></div><p><span class="emphasis"><em>xfpt</em></span> processes non-directive input lines in one of four ways (known as
+<span class="quote">“<span class="quote">modes</span>”</span>):
+</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+In the default mode, text is processed paragraph by paragraph.
+<sup>[<a id="idp58896" href="#ftn.idp58896" class="footnote">1</a>]</sup>
+The end of a paragraph is indicated by the end of the input, a blank line, or
+by an occurrence of the <span class="bold"><strong>.literal</strong></span> directive. Other directives (for example,
+<span class="bold"><strong>.include</strong></span>) do not of themselves terminate a paragraph. Most of the standard
+macros (such as <span class="bold"><strong>.chapter</strong></span> and <span class="bold"><strong>.section</strong></span>) force a paragraph end by
+starting their contents with a <span class="bold"><strong>.literal</strong></span> directive.
+</p><p>
+Because <span class="emphasis"><em>xfpt</em></span> reads a whole paragraph before processing it, error messages
+contain the phrase <span class="quote">“<span class="quote">detected near line <span class="emphasis"><em>nnn</em></span></span>”</span>, where the line number is
+typically that of the last line of the paragraph.
+</p></li><li class="listitem"><p>
+In the <span class="quote">“<span class="quote">literal layout</span>”</span> mode, text is processed line by line, but is
+otherwise handled as in the default mode. The only real difference this makes
+to the markup from the user’s point of view is that both parts of a set of
+paired flags must be on the same line. In this mode, error messages are more
+likely to contain the exact line number where the fault lies. Literal layout
+mode is used by the standard <span class="bold"><strong>.display</strong></span> macro to generate <code class="literal">&lt;literallayout&gt;</code>
+elements.
+</p></li><li class="listitem"><p>
+In the <span class="quote">“<span class="quote">literal text</span>”</span> mode, text is also processed line by line, but no flags
+are recognized. The only modification <span class="emphasis"><em>xfpt</em></span> makes to the text is to turn
+ampersand and angle bracket characters into XML entity references. This mode is
+used by the standard <span class="bold"><strong>.code</strong></span> macro to generate <code class="literal">&lt;literallayout&gt;</code> elements
+that include <code class="literal">class=monospaced</code>.
+</p></li><li class="listitem"><p>
+In the <span class="quote">“<span class="quote">literal XML</span>”</span> mode, text lines are copied to the output without
+modification. This is the easiest way to include a chunk of literal XML in the
+output. An example might be the <code class="literal">&lt;bookinfo&gt;</code> element, which occurs only once
+in a document. It is not worth setting up a macro for a one-off item like this.
+</p></li></ul></div><p>
+The <span class="bold"><strong>.literal</strong></span> directive switches between the modes. It is not normally used
+directly, but instead is incorported into appropriate macro definitions. The
+<span class="bold"><strong>.inliteral</strong></span> directive can be used to test the current mode.
+</p><p>
+Directive lines are recognized and acted upon in all four modes. However, an
+unrecognized line that starts with a dot in the literal text or literal XML
+mode is treated as data. In the other modes, such a line provokes an error.
+</p><p>
+If you need to have a data line that begins with a dot in literal layout mode,
+you can either specify it by character number, or precede it with some
+non-acting markup. These two examples are both valid:
+</p><pre class="literallayout">
+ &amp;#x2e;start with a dot
+ &amp;''&amp;.start with a dot
+</pre><p>
+The second example assumes the standard flags are defined: it precedes the dot
+with an empty italic string. However, this is untidy because the empty string
+will be carried over into the XML.
+</p><p>
+In literal text or literal XML mode, it is not possible to have a data line
+that starts with a dot followed by the name of a directive or macro. You have
+to use literal layout mode if you require such output. Another solution, which
+is used in the source for this document (where many examples show directive
+lines), is to indent every displayed line by one space, and thereby avoid the
+problem altogether.
+</p></div><div class="section" title="1.4 Format of directive lines"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID04">1.4 Format of directive lines</a></h3></div></div></div><p>If an input line starts with a dot followed by a space, it is ignored by <span class="emphasis"><em>xfpt</em></span>.
+This provides a facility for including comments in the input. Otherwise, the
+dot must be followed by a directive or macro name, and possibly one or more
+arguments. Arguments that are strings are delimited by white space unless they
+are enclosed in single or double quotes. The delimiting quote character can be
+included within a quoted string by doubling it. Here are some examples:
+</p><pre class="literallayout">
+ .literal layout
+ .set version 0.00
+ .row "Jack's house" 'Jill''s house'
+</pre><p>
+An unrecognized directive line normally causes an error; however, in the
+literal text and literal XML modes, an unrecognized line that starts with a
+dot is treated as a data line.
+</p></div><div class="section" title="1.5 Calling macros"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTcallingmacro">1.5 Calling macros</a></h3></div></div></div><p>Macros are defined by the <span class="bold"><strong>.macro</strong></span> directive, which is described in section
+<a class="xref" href="#SECTmacro" title="3.11 The .macro directive">3.11</a>. There are two ways of calling a macro. It can be called in the
+same way as a directive, or it can be called from within text that is being
+processed. The second case is called an <span class="quote">“<span class="quote">inline macro call</span>”</span>.
+</p><p>
+When a macro is called as a directive, its name is given after a dot at the
+start of a line, and the name may be followed by any number of optional
+arguments, in the same way as a built-in directive (see the previous section).
+For example:
+</p><pre class="literallayout">
+ .chapter "Chapter title" chapter-reference
+</pre><p>
+The contents of the macro, after argument substitution, are processed in
+exactly the same way as normal input lines. A macro that is called as a
+directive may contain nested macro calls.
+</p><p>
+When a macro is called from within a text string, its name is given after an
+ampersand, and is followed by an opening parenthesis. Arguments, delimited by
+commas, can then follow, up to a closing parenthesis. If an argument contains a
+comma or a closing parenthesis, it must be quoted. White space after a
+separating comma is ignored. The most common example of this type of macro
+call is the standard macro for generating a URL reference:
+</p><pre class="literallayout">
+ Refer to a URL via &amp;url(http://x.example,this text).
+</pre><p>
+There are differences in the behaviour of macros, depending on which way they
+are called. A macro that is called inline may not contain references to other
+macros; it must contain only text lines and calls to built-in directives.
+Also, newlines that terminate text lines within the macro are not included in
+the output.
+</p><p>
+A macro that can be called inline can always be called as a directive, but the
+opposite is not always true. Macros are usually designed to be called either
+one way or the other. However, the <span class="bold"><strong>.new</strong></span> and <span class="bold"><strong>.index</strong></span> macros in the
+standard library are examples of macros that are designed be called either way.
+</p></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.idp58896" href="#idp58896" class="para">1</a>] </sup>
+There is, however, a special case when a paragraph contains one or more
+footnotes. In that situation, each part of the outer paragraph is processed
+independently.
+</p></div></div></div><div class="chapter" title="2. Flag sequences"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="ID06">2. Flag sequences</a></h2></div></div></div><p>Only one flag sequence is built-into the code itself. If an input line ends
+with three ampersands (ignoring trailing white space), the ampersands are
+removed, and the next input line, with any leading white space removed, is
+joined to the original line. This happens before any other processing, and may
+involve any number of lines. Thus:
+</p><div class="literallayout">
+ <code class="literal">The quick &amp;&amp;&amp;</code><br />
+ <code class="literal">    brown &amp;&amp;&amp;</code><br />
+ <code class="literal">      fox.</code><br />
+</div><p>
+produces exactly the same output as:
+</p><pre class="literallayout">
+ The quick brown fox.
+</pre><div class="section" title="2.1 Flag sequences for XML entities and xfpt variables"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID07">2.1 Flag sequences for XML entities and <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> variables</a></h3></div></div></div><p>If an ampersand is followed by a # character, a number, and a semicolon, it is
+understood as a numerical reference to an XML entity, and is passed through
+unmodified. The number can be decimal, or hexadecimal preceded by <code class="literal">x</code>. For
+example:
+</p><pre class="literallayout">
+ This is an Ohm sign: &amp;#x2126;.
+ This is a degree sign: &amp;#176;.
+</pre><p>
+If an ampersand is followed by a letter, a sequence of letters, digits, and
+dots is read. If this is terminated by a semicolon, the characters between the
+ampersand and the semicolon are interpreted as an entity name. This can be:
+</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+The name of an inbuilt <span class="emphasis"><em>xfpt</em></span> variable. At present, there is only one of these,
+called <code class="literal">xfpt.rev</code>. Its use is described with the <span class="bold"><strong>.revision</strong></span> directive
+below.
+</p></li><li class="listitem"><p>
+The name of a user variable that has been set by the <span class="bold"><strong>.set</strong></span> directive, also
+described below.
+</p></li><li class="listitem"><p>
+The name of an XML entity. This is assumed if the name is not recognized as one
+of the previous types. In this case, the input text is passed to the output
+without modification. For example:
+</p><pre class="literallayout">
+ This is an Ohm sign: &amp;Ohm;.
+</pre></li></ul></div></div><div class="section" title="2.2 Flag sequences for calling macros"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID08">2.2 Flag sequences for calling macros</a></h3></div></div></div><p>If an ampersand is followed by a sequence of alphanumeric characters starting
+with a letter, terminated by an opening parenthesis, the characters between the
+ampersand and the parenthesis are interpreted as the name of a macro. See
+section <a class="xref" href="#SECTcallingmacro" title="1.5 Calling macros">1.5</a> for more details.
+</p></div><div class="section" title="2.3 Other flag sequences"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID09">2.3 Other flag sequences</a></h3></div></div></div><p>Any other flag sequences that are needed must be defined by means of the
+<span class="bold"><strong>.flag</strong></span> directive. These are of two types, standalone and paired. Both cases
+define replacement text. This is always literal; it is not itself scanned for
+flag occurrences.
+</p><p>
+Lines are scanned from left to right when flags are being interpreted. If
+there is any ambiguity when a text string is being scanned, the longest flag
+sequence wins. Thus, it is possible (as in the standard flag sequences) to
+define both <code class="literal">&amp;&lt;</code> and <code class="literal">&amp;&lt;&lt;</code> as flags, provided that you never want to
+follow the first of them with a <code class="literal">&lt;</code> character.
+</p><p>
+You can define flags that start with <code class="literal">&amp;#</code>, but these must be used with care,
+lest they be misinterpreted as numerical references to XML entities.
+</p><p>
+A standalone flag consists of an ampersand followed by any number of
+non-alphanumeric characters. When it is encountered, it is replaced by its
+replacement text. For example, in the standard flag definitions, <code class="literal">&amp;&amp;</code>
+is defined as a standalone flag with with the replacement text <code class="literal">&amp;amp;</code>.
+</p><p>
+A paired flag is defined as two sequences. The first takes the same form as a
+standalone flag. The second also consists of non-alphanumeric characters, but
+need not start with an ampersand. It is often defined as the reverse of the
+first sequence. For example, in the standard definitions, <code class="literal">&amp;'</code> and
+<code class="literal">'&amp;</code> are defined as a flag pair for enclosing text in an <code class="literal">&lt;emphasis&gt;</code>
+element.
+</p><p>
+When the first sequence of a paired flag is encountered, its partner is
+expected to be found within the same text unit. In the default mode, the units
+are a paragraphs, or part-paragraphs if footnotes intervene. In literal layout
+mode, the text is processed line by line. Each member of the pair is replaced
+by its replacement text.
+</p><p>
+Multiple occurrences of paired flags must be correctly nested. Note that,
+though <span class="emphasis"><em>xfpt</em></span> diagnoses an error for badly nested flag pairs, it does not prevent
+you from generating invalid XML. For example, DocBook does not allow
+<code class="literal">&lt;emphasis&gt;</code> within <code class="literal">&lt;literal&gt;</code>, though it does allow <code class="literal">&lt;literal&gt;</code> within
+<code class="literal">&lt;emphasis&gt;</code>.
+</p></div><div class="section" title="2.4 Unrecognized flag sequences"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID10">2.4 Unrecognized flag sequences</a></h3></div></div></div><p>If an ampersand is not followed by a character sequence in one of the forms
+described in the preceding sections, an error occurs.
+</p></div><div class="section" title="2.5 Standard flag sequences"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID11">2.5 Standard flag sequences</a></h3></div></div></div><p>These are the standalone flag sequences that are defined in the <em class="filename">stdflags</em>
+file in the <span class="emphasis"><em>xfpt</em></span> library:
+</p><div class="literallayout">
+ <code class="literal">&amp;&amp;        </code> becomes <code class="literal"> &amp;amp;</code> (ampersand)<br />
+ <code class="literal">&amp;--       </code> becomes <code class="literal"> &amp;ndash;</code> (en-dash)<br />
+ <code class="literal">&amp;~        </code> becomes <code class="literal"> &amp;nbsp;</code> (‘hard’ space)<br />
+</div><p>
+These are the flag pairs that are defined in the <em class="filename">stdflags</em> file in the <span class="emphasis"><em>xfpt</em></span>
+library:
+</p><div class="literallayout">
+ <code class="literal">&amp;"..."&amp;   </code> becomes <code class="literal">&lt;quote&gt;...&lt;/quote&gt;</code><br />
+ <code class="literal">&amp;'...'&amp;   </code> becomes <code class="literal">&lt;emphasis&gt;...&lt;/emphasis&gt;</code><br />
+ <code class="literal">&amp;*...*&amp;   </code> becomes <code class="literal">&lt;emphasis role="bold"&gt;...&lt;/emphasis&gt;</code><br />
+ <code class="literal">&amp;`...`&amp;   </code> becomes <code class="literal">&lt;literal&gt;...&lt;/literal&gt;</code><br />
+ <code class="literal">&amp;_..._&amp;   </code> becomes <code class="literal">&lt;filename&gt;...&lt;/filename&gt;</code><br />
+ <code class="literal">&amp;(...)&amp;   </code> becomes <code class="literal">&lt;command&gt;...&lt;/command&gt;</code><br />
+ <code class="literal">&amp;[...]&amp;   </code> becomes <code class="literal">&lt;function&gt;...&lt;/function&gt;</code><br />
+ <code class="literal">&amp;%...%&amp;   </code> becomes <code class="literal">&lt;option&gt;...&lt;/option&gt;</code><br />
+ <code class="literal">&amp;$...$&amp;   </code> becomes <code class="literal">&lt;varname&gt;...&lt;/varname&gt;</code><br />
+ <code class="literal">&amp;&lt;...&gt;&amp;   </code> becomes <code class="literal">&lt;...&gt;</code><br />
+ <code class="literal">&amp;&lt;&lt;...&gt;&gt;&amp; </code> becomes <code class="literal">&lt;xref linkend="..."/&gt;</code><br />
+</div><p>
+For example, if you want to include a literal XML element in your output, you
+can do it like this: <code class="literal">&amp;&lt;element&gt;&amp;</code>. If you want to include a longer
+sequence of literal XML, changing to the literal XML mode may be more
+convenient.
+</p></div></div><div class="chapter" title="3. Built-in directive processing"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="ID12">3. Built-in directive processing</a></h2></div></div></div><p>The directives that are built into the code of <span class="emphasis"><em>xfpt</em></span> are now described in
+alphabetical order. You can see more examples of their use in the descriptions
+of the standard macros in chapter <a class="xref" href="#CHAPstdmac" title="4. The standard macros for DocBook">4</a>.
+</p><div class="section" title="3.1 The .arg directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID13">3.1 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.arg</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It must be followed
+by a single number, optionally preceded by a minus sign. If the number is
+positive (no minus sign), subsequent lines, up to a <span class="bold"><strong>.endarg</strong></span> directive, are
+skipped unless the macro has been called with at least that number of
+arguments and the given argument is not an empty string. If the number is
+negative (minus sign present), subsequent lines are skipped if the macro has
+been called with fewer than that number of arguments, or with an empty string
+for the given argument. For example:
+</p><pre class="literallayout">
+ .macro example
+ .arg 2
+ Use these lines if there are at least 2 arguments
+ and the second one is not empty. Normally there would
+ be a reference to the 2nd argument.
+ .endarg
+ .arg -2
+ Use this line unless there are at least 2 arguments
+ and the second one is not empty.
+ .endarg
+ .endmacro
+</pre><p>
+Note that if a macro is defined with default values for its arguments, these
+are not counted by the <span class="bold"><strong>.arg</strong></span> directive, which looks only at the actual
+arguments in a particular macro call.
+</p><p>
+The <span class="bold"><strong>.arg</strong></span> directive may be nested.
+</p></div><div class="section" title="3.2 The .eacharg directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID14">3.2 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.eacharg</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It may optionally be
+followed by a single number; if omitted the value is taken to be 1. Subsequent
+lines, up to a <span class="bold"><strong>.endeach</strong></span> directive, are processed multiple times, once for
+each remaining argument. Unlike <span class="bold"><strong>.arg</strong></span>, an argument that is an empty string
+is not treated specially. However, like <span class="bold"><strong>.arg</strong></span>, only the actual arguments of
+a macro call are considered. Default argument values do not count.
+</p><p>
+The number given with <span class="bold"><strong>.eacharg</strong></span> defines which argument to start with. If the
+macro is called with fewer arguments, the lines up to <span class="bold"><strong>.endeach</strong></span> are skipped,
+and are not processed at all. When these lines are being processed, the
+remaining macro arguments can be referenced relative to the current argument.
+<code class="literal">$+1</code> refers to the current argument, <code class="literal">$+2</code> to the next argument, and so
+on.
+</p><p>
+The <span class="bold"><strong>.endeach</strong></span> directive may also be followed by a number, again defaulting
+to 1. When <span class="bold"><strong>.endeach</strong></span> is reached, the current argument number is incremented
+by that number. If there are still unused arguments available, the lines
+between <span class="bold"><strong>.eacharg</strong></span> and <span class="bold"><strong>.endeach</strong></span> are processed again.
+</p><p>
+This example is taken from the coding for the standard <span class="bold"><strong>.row</strong></span> macro, which
+generates an <code class="literal">&lt;entry&gt;</code> element for each of its arguments:
+</p><pre class="literallayout">
+ .eacharg
+ &amp;&lt;entry&gt;&amp;$+1&amp;&lt;/entry&gt;&amp;
+ .endeach
+</pre><p>
+This example is taken from the coding for the standard <span class="bold"><strong>.itable</strong></span> macro, which
+processes arguments in pairs to define the table’s columns, starting from the
+fifth argument:
+</p><pre class="literallayout">
+ .eacharg 5
+ &amp;&lt;colspec colwidth="$+1" align="$+2"/&gt;&amp;
+ .endeach 2
+</pre><p>
+The <span class="bold"><strong>.eacharg</strong></span> directive may in principle be nested, though this does not
+seem useful in practice.
+</p></div><div class="section" title="3.3 The .echo directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID15">3.3 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.echo</strong></span> directive</a></h3></div></div></div><p>This directive takes a single string argument. It writes it to the standard
+error stream. Within a macro, argument substitution takes place, but no other
+processing is done on the string. This directive can be useful for debugging
+macros or writing comments to the user.
+</p></div><div class="section" title="3.4 The .endarg directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID16">3.4 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endarg</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.arg</strong></span> above.
+</p></div><div class="section" title="3.5 The .endeach directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID17">3.5 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endeach</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.eacharg</strong></span> above.
+</p></div><div class="section" title="3.6 The .endinliteral directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID18">3.6 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endinliteral</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.inliteral</strong></span> below.
+</p></div><div class="section" title="3.7 The .flag directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID19">3.7 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.flag</strong></span> directive</a></h3></div></div></div><p>This directive is used to define flag sequences. The directive must be followed
+either by a standalone flag sequence and one string in quotes, or by a flag
+pair and two strings in quotes. White space separates these items. For example:
+</p><pre class="literallayout">
+ .flag &amp;&amp; "&amp;amp;"
+ .flag &amp;" "&amp; "&lt;quote&gt;" "&lt;/quote&gt;"
+</pre><p>
+There are more examples in the definitions of the standard flags. If you
+redefine an existing flag, the new definition overrides the old. There is no
+way to revert to the previous definition.
+</p></div><div class="section" title="3.8 The .include directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID20">3.8 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.include</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a single string argument that is the path to
+a file. The contents of the file are read and incorporated into the input at
+this point. If the string does not contain any slashes, the path to the <span class="emphasis"><em>xfpt</em></span>
+library is prepended. Otherwise, the path is used unaltered. If
+<span class="bold"><strong>.include</strong></span> is used inside a macro, it is evaluated each time the macro is
+called, and thus can be used to include a different file on each occasion.
+</p></div><div class="section" title="3.9 The .inliteral directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID21">3.9 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.inliteral</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It must be followed
+by one of the words <span class="quote">“<span class="quote">layout</span>”</span>, <span class="quote">“<span class="quote">text</span>”</span>, <span class="quote">“<span class="quote">off</span>”</span>, or <span class="quote">“<span class="quote">xml</span>”</span>. If the current
+literal mode does not correspond to the word, subsequent lines, up to a
+<span class="bold"><strong>.endinliteral</strong></span> directive, are skipped. The <span class="bold"><strong>.inliteral</strong></span> directive may be
+nested.
+</p></div><div class="section" title="3.10 The .literal directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID22">3.10 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.literal</strong></span> directive</a></h3></div></div></div><p>This must be followed by one of the words <span class="quote">“<span class="quote">layout</span>”</span>, <span class="quote">“<span class="quote">text</span>”</span>, <span class="quote">“<span class="quote">off</span>”</span>, or
+<span class="quote">“<span class="quote">xml</span>”</span>. It forces an end to a previous paragraph, if there is one, and then
+switches between processing modes. The default mode is the <span class="quote">“<span class="quote">off</span>”</span> mode, in
+which text is processed paragraph by paragraph, and flags are recognized.
+Section <a class="xref" href="#SECTliteralprocessing" title="1.3 Literal and non-literal processing">1.3</a> describes how input lines are processed in
+the four modes.
+</p></div><div class="section" title="3.11 The .macro directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTmacro">3.11 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.macro</strong></span> directive</a></h3></div></div></div><p>This directive is used to define macros. It must be followed by a macro name,
+and then, optionally, by any number of arguments. The macro name can be any
+sequence of non-whitespace characters. The arguments in the definition provide
+default values. The following lines, up to <span class="bold"><strong>.endmacro</strong></span>, form the body of the
+macro. They are not processed in any way when the macro is defined; they are
+processed only when the macro is called (see section <a class="xref" href="#SECTcallingmacro" title="1.5 Calling macros">1.5</a>).
+</p><p>
+Within the body of a macro, argument substitutions can be specified by means of
+a dollar character and an argument number, for example, <code class="literal">$3</code> for the third
+argument. See also <span class="bold"><strong>.eacharg</strong></span> above for the use of <code class="literal">$+</code> to refer to
+relative arguments when looping through them. A reference to an argument that
+is not supplied, and is not given a default, results in an empty substitution.
+</p><p>
+There is also a facility for a conditional substitution. A reference to an
+argument of the form:
+</p><div class="literallayout">
+<code class="literal">$=</code><span class="emphasis"><em>&lt;digits&gt;&lt;delimiter&gt;&lt;text&gt;&lt;delimiter&gt;</em></span><br />
+</div><p>
+inserts the text if the argument is defined and is not an empty string, and
+nothing otherwise. The text is itself scanned for flags and argument
+substitutions. The delimiter must be a single character that does not appear in
+the text. For example:
+</p><pre class="literallayout">
+&amp;&lt;chapter$=2+ id="$2"+&gt;&amp;
+</pre><p>
+If this appears in a macro that is called with only one argument, the result
+is:
+</p><pre class="literallayout">
+&lt;chapter&gt;
+</pre><p>
+but if the second argument is, say <code class="literal">abcd</code>, the result is:
+</p><pre class="literallayout">
+&lt;chapter id="abcd"&gt;
+</pre><p>
+This conditional feature can be used with both absolute and relative argument
+references.
+</p><p>
+If a dollar character is required as data within the body of a macro, it must
+be doubled. For example:
+</p><pre class="literallayout">
+ .macro price
+ The price is $$1.
+ .endmacro
+</pre><p>
+If you redefine an existing macro, the new definition overrides the old. There
+is no way to revert to the previous definition. If you define a macro whose
+name is the same as the name of a built-in directive you will not be able to
+call it, because <span class="emphasis"><em>xfpt</em></span> looks for built-in directives before it looks for macros.
+</p><p>
+It is possible to define a macro within a macro, though clearly care must be
+taken with argument references to ensure that substitutions happen at the right
+level.
+</p></div><div class="section" title="3.12 The .nest directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID24">3.12 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.nest</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by one of the words <span class="quote">“<span class="quote">begin</span>”</span> or <span class="quote">“<span class="quote">end</span>”</span>. It is
+used to delimit a nested sequence of independent text items that occurs inside
+another, such as the contents of a footnote inside a paragraph. This directive
+is usually used inside a macro. For example, a <span class="bold"><strong>footnote</strong></span> macro could be
+defined like this:
+</p><pre class="literallayout">
+ .macro footnote
+ &amp;&lt;footnote&gt;&amp;
+ .nest begin
+ .endmacro
+</pre><p>
+At the start of a nested sequence, the current mode and paragraph state are
+remembered and <span class="emphasis"><em>xfpt</em></span> then reverts to the default mode and <span class="quote">“<span class="quote">not in a paragraph</span>”</span>.
+At the end of a nested sequence, if a paragraph has been started, it is
+terminated, and then <span class="emphasis"><em>xfpt</em></span> reverts to the previous state.
+</p></div><div class="section" title="3.13 The .nonl directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID25">3.13 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.nonl</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a single string argument. It is processed
+as an input line without a newline at the end. This facility is useful
+in macros when constructing a single data line from several text fragments. See
+for example the <span class="bold"><strong>.new</strong></span> macro in the standard macros.
+</p></div><div class="section" title="3.14 The .pop directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID26">3.14 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.pop</strong></span> directive</a></h3></div></div></div><p><span class="emphasis"><em>xfpt</em></span> keeps a stack of text strings that are manipulated by the <span class="bold"><strong>.push</strong></span> and
+<span class="bold"><strong>.pop</strong></span> directives. When the end of the input is reached, any strings that
+remain on the stack are popped off, processed for flags, and written to the
+output. In some cases (see the <span class="bold"><strong>.push</strong></span> directive below) a warning message is
+given.
+</p><p>
+Each string on the stack may, optionally, be associated with an upper case
+letter. If <span class="bold"><strong>.pop</strong></span> is followed by an upper case letter, it searches down the
+stack for a string with the same letter. If it cannot find one, it does
+nothing. Otherwise, it pops off, processes, and writes out all the strings down
+to and including the one that matches.
+</p><p>
+If <span class="bold"><strong>.pop</strong></span> is given without a following letter, it pops one string off the
+stack and writes it out. If there is nothing on the stack, an error occurs.
+</p></div><div class="section" title="3.15 The .push directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID27">3.15 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.push</strong></span> directive</a></h3></div></div></div><p>This directive pushes a string onto the stack. If the rest of the command line
+starts with an upper case letter followed by white space or the end of the
+line, that letter is associated with the string that is pushed, which consists
+either of a quoted string, or the rest of the line. After a quoted string, the
+word ‘check’ may appear. In this case, if the string has not been popped off
+the stack by the end of processing, a warning message is output. This facility
+is used by the standard macros to give warnings for unclosed items such as
+<span class="bold"><strong>.ilist</strong></span>.
+</p><p>
+For example, the <span class="bold"><strong>.chapter</strong></span> macro contains this line:
+</p><pre class="literallayout">
+ .push C &amp;&lt;/chapter&gt;&amp;
+</pre><p>
+Earlier in the macro there is the line:
+</p><pre class="literallayout">
+ .pop C
+</pre><p>
+This arrangement ensures that any previous chapter is terminated before
+starting a new one, and also when the end of the input is reached. The
+<span class="bold"><strong>.ilist</strong></span> macro contains this line:
+</p><pre class="literallayout">
+ .push L "&amp;&lt;/itemizedlist&gt;&amp;" check
+</pre><p>
+Item lists are terminatated by <span class="bold"><strong>.endlist</strong></span>, which contains:
+</p><pre class="literallayout">
+ .pop L
+</pre><p>
+However, if <span class="bold"><strong>.endlist</strong></span> is accidentally omitted (or <span class="bold"><strong>.ilist</strong></span> is accidentally
+included), the appearance of ‘check’ means that a warning is issued to alert
+the user to a possible problem.
+</p></div><div class="section" title="3.16 The .revision directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTrevision">3.16 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.revision</strong></span> directive</a></h3></div></div></div><p>This directive is provided to make it easy to set the <code class="literal">revisionflag</code>
+attribute on XML elements in a given portion of the document. The DocBook
+specification states that the <code class="literal">revisionflag</code> attribute is common to all
+elements.
+</p><p>
+The <span class="bold"><strong>.revision</strong></span> directive must be followed by one of the words <span class="quote">“<span class="quote">changed</span>”</span>,
+<span class="quote">“<span class="quote">added</span>”</span>, <span class="quote">“<span class="quote">deleted</span>”</span>, or <span class="quote">“<span class="quote">off</span>”</span>. For any value other than <span class="quote">“<span class="quote">off</span>”</span>, it causes
+the internal variable <span class="emphasis"><em>xfpt.rev</em></span> to be set to <code class="literal">revisionflag=</code> followed by
+the given argument. If the argument is <span class="quote">“<span class="quote">off</span>”</span>, the internal variable is
+emptied.
+</p><p>
+The contents of <span class="emphasis"><em>xfpt.rev</em></span> are included in every <code class="literal">&lt;para&gt;</code> element that <span class="emphasis"><em>xfpt</em></span>
+generates. In addition, a number of the standard macros contain references to
+<span class="emphasis"><em>xfpt.rev</em></span> in appropriate places. Thus, setting:
+</p><pre class="literallayout">
+ .revision changed
+</pre><p>
+should cause all subsequent text to be marked up with <code class="literal">revisionflag</code>
+attributes, until
+</p><pre class="literallayout">
+ .revision off
+</pre><p>
+is encountered. Unfortunately, at the time of writing, not all DocBook
+processing software pays attention to the <code class="literal">revisionflag</code> attribute.
+Furthermore, some software grumbles that it is <span class="quote">“<span class="quote">unexpected</span>”</span> on some elements,
+though it does still seem to process it correctly.
+</p><p>
+For handling the most common case (setting and unsetting <span class="quote">“<span class="quote">changed</span>”</span>), the
+standard macros <span class="bold"><strong>.new</strong></span> and <span class="bold"><strong>.wen</strong></span> are provided (see section
+<a class="xref" href="#SECTrevmacs" title="4.13 Revision markings">4.13</a>).
+</p></div><div class="section" title="3.17 The .set directive"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID29">3.17 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.set</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a name and a text string. It defines a user
+variable and gives it a name. A reference to the name in the style of an XML
+entity causes the string to be substituted, without further processing. For
+example:
+</p><pre class="literallayout">
+ .set version 4.99
+</pre><p>
+This could be referenced as <code class="literal">&amp;version;</code>. If a variable is given the name of
+an XML entity, you will not be able to refer to the XML entity, because local
+variables take precedence. There is no way to delete a local variable after it
+has been defined.
+</p></div></div><div class="chapter" title="4. The standard macros for DocBook"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="CHAPstdmac">4. The standard macros for DocBook</a></h2></div></div></div><p>A set of simple macros for commonly needed DocBook features is provided in
+<span class="emphasis"><em>xfpt</em></span>’s library. This may be extended as experience with <span class="emphasis"><em>xfpt</em></span> accumulates. The
+standard macros assume that the standard flags are defined, so a document that
+is going to use these features should start with:
+</p><pre class="literallayout">
+ .include stdflags
+ .include stdmacs
+</pre><p>
+All the standard macros except <span class="bold"><strong>new</strong></span>, <span class="bold"><strong>index</strong></span>, and <span class="bold"><strong>url</strong></span> are intended to
+be called as directive lines. Their names are therefore shown with a leading
+dot in the discussion below.
+</p><div class="section" title="4.1 Overall setup"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID31">4.1 Overall setup</a></h3></div></div></div><p>There are two macros that should be used only once, at the start of the
+document. The <span class="bold"><strong>.docbook</strong></span> macro has no arguments. It inserts into the output
+file the standard header material for a DocBook XML file, which is:
+</p><pre class="literallayout">
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"&gt;
+</pre><p>
+The <span class="bold"><strong>.book</strong></span> macro has no arguments. It generates <code class="literal">&lt;book&gt;</code> and pushes
+<code class="literal">&lt;/book&gt;</code> onto the stack so that it will be output at the end.
+</p></div><div class="section" title="4.2 Processing instructions"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="idp3069176">4.2 Processing instructions</a></h3></div></div></div><p>XML processing instructions such as <code class="literal">&lt;?sdop</code> <code class="literal">toc_sections="no"?&gt;</code> can, of
+course, be written written literally between <code class="literal">.literal</code> <code class="literal">xml</code> and
+<code class="literal">.literal</code> <code class="literal">off</code>. If there are a lot of them, this is perhaps the most
+convenient approach. A macro called <span class="bold"><strong>.pi</strong></span> is provided as an easy way of
+setting up a short processing instruction. Its first argument is the name of
+the processor for which the instruction is intended, and its second argument is
+the contents of the instruction, for example:
+</p><pre class="literallayout">
+ .pi sdop 'toc_sections="yes,yes,no"'
+</pre><p>
+This generates <code class="literal">&lt;?sdop</code> <code class="literal">toc_sections="yes,yes,no"?&gt;</code>.
+</p></div><div class="section" title="4.3 Chapters, sections, and subsections"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID32">4.3 Chapters, sections, and subsections</a></h3></div></div></div><p>Chapters, sections, and subsections are supported by three macros that all
+operate in the same way. They are <span class="bold"><strong>.chapter</strong></span>, <span class="bold"><strong>.section</strong></span>, and
+<span class="bold"><strong>.subsection</strong></span>. They take either one, two, or three arguments. The first
+argument is the title. If a second argument is present, and is not an empty
+string, it is set as an ID, and can be used in cross-references. For example:
+</p><pre class="literallayout">
+ .chapter "Introduction"
+</pre><p>
+sets no ID, but
+</p><pre class="literallayout">
+ .section "A section title" "SECTdemo"
+</pre><p>
+can be referenced from elsewhere in the document by a phrase such as:
+</p><pre class="literallayout">
+ see section &amp;&lt;&lt;SECTdemo&gt;&gt;&amp;
+</pre><p>
+When the title of a chapter of section is being used as a running head or foot
+(for example), it may be too long to fit comfortably into the available space.
+DocBook provides the facility for a title abbreviation to be specified to deal
+with this problem. If a third argument is given to one of these macros, it
+causes a <code class="literal">&lt;titleabbrev&gt;</code> element to be generated. In this case, a second
+argument must also be provided, but if you do not need an ID, the second
+argument can be an empty string. For example:
+</p><pre class="literallayout">
+ .chapter "This chapter has quite a long title" "" "Long title"
+</pre><p>
+Where and when the abbreviation is used in place of the full title is
+controlled by the stylesheet when the XML is processed.
+</p></div><div class="section" title="4.4 Prefaces, appendixes, and colophons"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID33">4.4 Prefaces, appendixes, and colophons</a></h3></div></div></div><p>The macros <span class="bold"><strong>.preface</strong></span>, <span class="bold"><strong>.appendix</strong></span>, and <span class="bold"><strong>.colophon</strong></span> operate in the same
+way as <span class="bold"><strong>.chapter</strong></span>, except that the first and the last have the default title
+strings <span class="quote">“<span class="quote">Preface</span>”</span> and <span class="quote">“<span class="quote">Colophon</span>”</span>.
+</p></div><div class="section" title="4.5 Terminating chapters, etc."><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="idp3081992">4.5 Terminating chapters, etc.</a></h3></div></div></div><p>The macros for chapters, sections, appendixes, etc. use the stack to ensure
+that each one is terminated at the correct point, without the need for an
+explicit terminator. For example, starting a new section automatically
+terminates an open subsection and a previous section.
+</p><p>
+Occasionally, however, there is a need to force an explicit termination. The
+<span class="bold"><strong>.endchapter</strong></span>, <span class="bold"><strong>.endsection</strong></span>, <span class="bold"><strong>.endsubsection</strong></span>, <span class="bold"><strong>.endpreface</strong></span>,
+<span class="bold"><strong>.endappendix</strong></span>, and <span class="bold"><strong>.endcolophon</strong></span> macros provide this facility. For
+example, if you want to include an XML processing instruction after a preface,
+but before the start of the following chapter, you must terminate the preface
+with <span class="bold"><strong>.endpreface</strong></span>. Otherwise a processing instruction that precedes the next
+<span class="bold"><strong>.chapter</strong></span> will end up inside the <code class="literal">&lt;preface&gt;</code> element. You should not
+include any actual text items at these points.
+</p></div><div class="section" title="4.6 URL references"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID34">4.6 URL references</a></h3></div></div></div><p>The <span class="bold"><strong>url</strong></span> macro generates URL references, and is intended to be called inline
+within the text that is being processed. It generates a <code class="literal">&lt;ulink&gt;</code> element,
+and has either one or two arguments. The first argument is the URL, and the
+second is the text that describes it. For example:
+</p><pre class="literallayout">
+ More details are &amp;url(http://x.example, here).
+</pre><p>
+This generates the following XML:
+</p><pre class="literallayout">
+ More details are &lt;ulink url="http://x.example"&gt;here&lt;/ulink&gt;.
+</pre><p>
+If the second argument is absent, the contents of the first argument are used
+instead. If <span class="bold"><strong>url</strong></span> is called as a directive, there will be a newline in the
+output after <code class="literal">&lt;/ulink&gt;</code>, which in most cases (such as the example above), you
+do not want.
+</p></div><div class="section" title="4.7 Itemized lists"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID35">4.7 Itemized lists</a></h3></div></div></div><p>The <span class="bold"><strong>.ilist</strong></span> macro marks the start of an itemized list, the items of which
+are normally rendered with bullets or similar markings. The macro can
+optionally be called with one argument, for which there is no default. If the
+argument is present, it is used to add a <code class="literal">mark=</code> attribute to the
+<code class="literal">&lt;itemizedlist&gt;</code> element that is generated. The mark names that can be used
+depend on the software that processes the resulting XML. For HTML output,
+<span class="quote">“<span class="quote">square</span>”</span> and <span class="quote">“<span class="quote">opencircle</span>”</span> work in some browsers.
+</p><p>
+The text for the first item follows the macro call. The start of the next item
+is indicated by the <span class="bold"><strong>.next</strong></span> macro, and the end of the list by <span class="bold"><strong>.endlist</strong></span>.
+For example:
+</p><pre class="literallayout">
+ .ilist
+ This is the first item.
+ .next
+ This is the next item.
+ .endlist
+</pre><p>
+There may be more than one paragraph in an item.
+</p></div><div class="section" title="4.8 Ordered lists"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID36">4.8 Ordered lists</a></h3></div></div></div><p>The <span class="bold"><strong>.olist</strong></span> macro marks the start of an ordered list, the items of which are
+numbered. If no argument is given, arabic numerals are used. One of the
+following words can be given as the macro’s argument to specify the numeration:
+</p><div class="literallayout">
+<code class="literal">arabic     </code>   arabic numerals<br />
+<code class="literal">loweralpha </code>   lower case letters<br />
+<code class="literal">lowerroman </code>   lower case roman numerals<br />
+<code class="literal">upperalpha </code>   upper case letters<br />
+<code class="literal">upperroman </code>   upper case roman numerals<br />
+</div><p>
+The text for the first item follows the macro call. The start of the next item
+is indicated by the <span class="bold"><strong>.next</strong></span> macro, and the end of the list by <span class="bold"><strong>.endlist</strong></span>.
+For example:
+</p><pre class="literallayout">
+ .olist lowerroman
+ This is the first item.
+ .next
+ This is the next item.
+ .endlist
+</pre><p>
+There may be more than one paragraph in an item.
+</p></div><div class="section" title="4.9 Variable lists"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID37">4.9 Variable lists</a></h3></div></div></div><p>A variable list is one in which each entry is composed of a set of one or more
+terms and an associated description. Typically, the terms are printed in a
+style that makes them stand out, and the description is indented underneath.
+The start of a variable list is indicated by the <span class="bold"><strong>.vlist</strong></span> macro, which has
+one optional argument. If present, it defines a title for the list.
+</p><p>
+Each entry is defined by a <span class="bold"><strong>.vitem</strong></span> macro, whose arguments are the terms.
+This is followed by the body of the entry. The list is terminated by the
+<span class="bold"><strong>.endlist</strong></span> macro. For example:
+</p><pre class="literallayout">
+ .vlist "Font filename extensions"
+ .vitem "TTF"
+ TrueType fonts.
+ .vitem "PFA" "PFB"
+ PostScript fonts.
+ .endlist
+</pre><p>
+As for the other lists, there may be more than one paragraph in an item.
+</p></div><div class="section" title="4.10 Nested lists"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID38">4.10 Nested lists</a></h3></div></div></div><p>Lists may be nested as required. Some DocBook processors automatically choose
+different bullets for nested itemized lists, but others do not. The
+<span class="bold"><strong>.endlist</strong></span> macro has no useful arguments. Any text that follows it is
+treated as a comment. This can provide an annotation facility that may make the
+input easier to understand when lists are nested.
+</p></div><div class="section" title="4.11 Displayed text"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID39">4.11 Displayed text</a></h3></div></div></div><p>In displayed text each non-directive input line generates one output line. The
+<code class="literal">&lt;literallayout&gt;</code> DocBook element is used to achieve this. Two kinds of
+displayed text are supported by the standard macros. They differ in their
+handling of the text itself.
+</p><p>
+The macro <span class="bold"><strong>.display</strong></span> is followed by lines that are processed in the same way
+as normal paragraphs: flags are interpreted, and so there may be font changes
+and so on. The lines are processed in literal layout mode. For example:
+</p><pre class="literallayout">
+ .display
+ &amp;`-o`&amp; set output destination
+ &amp;`-S`&amp; set library path
+ .endd
+</pre><p>
+The output is as follows:
+</p><div class="literallayout">
+ <code class="literal">-o</code>   set output destination<br />
+ <code class="literal">-S</code>   set library path<br />
+</div><p>
+The macro <span class="bold"><strong>.code</strong></span> is followed lines that are not processed in any way, except
+to turn ampersands and angle brackets into XML entities. The lines are
+processed in literal text mode. In addition, <code class="literal">class="monospaced"</code> is added to
+the <code class="literal">&lt;literallayout&gt;</code> element, so that the lines are displayed in a
+monospaced font. For example:
+</p><pre class="literallayout">
+ .code
+ z = sqrt(x*x + y*y);
+ .endd
+</pre><p>
+As the examples illustrate, both kinds of display are terminated by the
+<span class="bold"><strong>.endd</strong></span> macro.
+</p></div><div class="section" title="4.12 Block quotes"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID40">4.12 Block quotes</a></h3></div></div></div><p>The macro pair <span class="bold"><strong>.blockquote</strong></span> and <span class="bold"><strong>.endblockquote</strong></span> are used to wrap the
+lines between them in a <code class="literal">&lt;blockquote&gt;</code> element.
+</p></div><div class="section" title="4.13 Revision markings"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTrevmacs">4.13 Revision markings</a></h3></div></div></div><p>Two macros are provided to simplify setting and unsetting the <span class="quote">“<span class="quote">changed</span>”</span>
+revision marking (see section <a class="xref" href="#SECTrevision" title="3.16 The .revision directive">3.16</a>). When the revised text is
+substantial (for example, a complete paragraph, table, display, or section), it
+can be placed between <span class="bold"><strong>.new</strong></span> and <span class="bold"><strong>.wen</strong></span>, as in this example:
+</p><pre class="literallayout">
+ This paragraph is not flagged as changed.
+ .new
+ This is a changed paragraph that contains a display:
+ .display
+ whatever
+ .endd
+ This is the next paragraph.
+ .wen
+ Here is the next, unmarked, paragraph.
+</pre><p>
+When called like this, without an argument, in ordinary text, <span class="bold"><strong>.new</strong></span>
+terminates the current paragraph, and <span class="bold"><strong>.wen</strong></span> always does so. Therefore, even
+though there are no blank lines before <span class="bold"><strong>.new</strong></span> or <span class="bold"><strong>.wen</strong></span> above, the revised
+text will end up in a paragraph of its own. (You can, of course, put in blank
+lines if you wish.)
+</p><p>
+If want to indicate that just a few words inside a paragraph are revised, you
+can call the <span class="bold"><strong>new</strong></span> macro with an argument. The macro can be called either as
+a directive or inline:
+</p><pre class="literallayout">
+ This is a paragraph that has
+ .new "a few marked words"
+ within it. Here are &amp;new(some more) marked words.
+</pre><p>
+The effect of this is to generate a <code class="literal">&lt;phrase&gt;</code> XML element with the
+<code class="literal">revisionflag</code> attribute set. The <span class="bold"><strong>.wen</strong></span> macro is not used in this case.
+</p><p>
+You can use the <span class="bold"><strong>.new</strong></span>/<span class="bold"><strong>.wen</strong></span> macro pair to generate a <code class="literal">&lt;phrase&gt;</code> element
+inside a section of displayed text. For example:
+</p><pre class="literallayout">
+ .display
+ This line is not flagged as changed.
+ .new
+ This line is flagged as changed.
+ .wen
+ This line is not flagged as changed.
+ .endd
+</pre><p>
+This usage works with both <span class="bold"><strong>.display</strong></span> and <span class="bold"><strong>.code</strong></span>. Within a <span class="bold"><strong>.display</strong></span>
+section you can also call <span class="bold"><strong>.new</strong></span> with an argument, either as a directive or
+inline. This does not work for <span class="bold"><strong>.code</strong></span> because its lines are processed in
+literal text mode.
+</p><p>
+If you want to add revision indications to part of a table, you must use an
+inline call of <span class="bold"><strong>new</strong></span> within an argument of the <span class="bold"><strong>.row</strong></span> macro (see below).
+This is the only usage that works in this case.
+</p></div><div class="section" title="4.14 Informal tables"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID42">4.14 Informal tables</a></h3></div></div></div><p>The <span class="bold"><strong>.itable</strong></span> macro starts an informal (untitled) table with some basic
+parameterization. If you are working on a large document that has many tables
+with the same parameters, the best approach is to define your own table macros,
+possibly calling the standard one with specific arguments.
+</p><p>
+The <span class="bold"><strong>.itable</strong></span> macro has four basic arguments:
+</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
+The frame requirement for the table, which may be one of the words <span class="quote">“<span class="quote">all</span>”</span>,
+<span class="quote">“<span class="quote">bottom</span>”</span>, <span class="quote">“<span class="quote">none</span>”</span> (the default), <span class="quote">“<span class="quote">sides</span>”</span>, <span class="quote">“<span class="quote">top</span>”</span>, or <span class="quote">“<span class="quote">topbot</span>”</span>.
+</p></li><li class="listitem"><p>
+The <span class="quote">“<span class="quote">colsep</span>”</span> value for the table. The default is <span class="quote">“<span class="quote">0</span>”</span>, meaning no vertical
+separator lines between columns. The value <span class="quote">“<span class="quote">1</span>”</span> requests vertical separator
+lines.
+</p></li><li class="listitem"><p>
+The <span class="quote">“<span class="quote">rowsep</span>”</span> value for the table. The default is <span class="quote">“<span class="quote">0</span>”</span>, meaning no horizontal
+lines between rows. The value <span class="quote">“<span class="quote">1</span>”</span> requests horizontal separator lines.
+</p></li><li class="listitem"><p>
+The number of columns.
+</p></li></ol></div><p>
+These arguments must be followed by two arguments for each column. The first
+specifies the column width, and the second its aligmnent. A column width can be
+specified as an absolute dimension such as 36pt or 2in, or as a proportional
+measure, which has the form of a number followed by an asterisk. The two forms
+can be mixed – see the DocBook specification for details.
+</p><p>
+Straightforward column alignments can be specified as <span class="quote">“<span class="quote">center</span>”</span>, <span class="quote">“<span class="quote">left</span>”</span>, or
+<span class="quote">“<span class="quote">right</span>”</span>. DocBook also has some other possibilities, but sadly they do not
+seem to include <span class="quote">“<span class="quote">centre</span>”</span>.
+</p><p>
+Each row of the table is specified using a <span class="bold"><strong>.row</strong></span> macro; the entries in
+the row are the macros’s arguments. The table is terminated by <span class="bold"><strong>.endtable</strong></span>,
+which has no arguments. For example:
+</p><pre class="literallayout">
+ .itable all 1 1 2 1in left 2in center
+ .row "cell 11" "cell 12"
+ .row "cell 21" "cell 22"
+ .endtable
+</pre><p>
+This specifies a framed table, with both column and row separator lines. There
+are two columns: the first is one inch wide and left aligned, and the second is
+two inches wide and centred. There are two rows. The resulting table looks like
+this:
+</p><div class="informaltable"><table border="1"><colgroup><col width="1in" align="left" /><col width="2in" align="center" /></colgroup><tbody><tr><td align="left">cell 11</td><td align="center">cell 12</td></tr><tr><td align="left">cell 21</td><td align="center">cell 22</td></tr></tbody></table></div><p>
+The <span class="bold"><strong>.row</strong></span> macro does not set the <code class="literal">revisionflag</code> attribute in the
+<code class="literal">&lt;entry&gt;</code> elements that it generates because this appears to be ignored by
+all current XML processors. However, you can use an inline call of the <span class="bold"><strong>new</strong></span>
+macro within an entry to generate a <code class="literal">&lt;phrase&gt;</code> element with <code class="literal">revisionflag</code>
+set.
+</p></div><div class="section" title="4.15 Formal tables"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID43">4.15 Formal tables</a></h3></div></div></div><p>The <span class="bold"><strong>.table</strong></span> macro starts a formal table, that is, a table that has a title,
+and which can be cross referenced. The first argument of this macro is the
+table’s title; the second is an identifier for cross-referencing. If you are
+not going to reference the table, an empty string must be supplied. From the
+third argument onwards, the arguments are identical to the <span class="bold"><strong>.itable</strong></span> macro.
+For example:
+</p><pre class="literallayout">
+ .table "A title for the table" "" all 1 1 2 1in left 2in center
+ .row "cell 11" "cell 12"
+ .row "cell 21" "cell 22"
+ .endtable
+</pre></div><div class="section" title="4.16 Figures and images"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID44">4.16 Figures and images</a></h3></div></div></div><p>A figure is enclosed between <span class="bold"><strong>.figure</strong></span> and <span class="bold"><strong>.endfigure</strong></span> macros. The first
+argument of <span class="bold"><strong>.figure</strong></span> provides a title for the figure. The second is
+optional; if present, it is a tag for references to the figure.
+</p><p>
+A figure normally contains an image. The <span class="bold"><strong>.image</strong></span> macro can be used in simple
+cases. It generates a <code class="literal">&lt;mediaobject&gt;</code> element containing an
+<code class="literal">&lt;imageobject&gt;</code>. The first argument is the name of the file containing the
+image. The remaining arguments are optional; an empty string must be
+supplied as a placeholder when one that is not required is followed by one that
+is set.
+</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+The second argument specifies a scaling factor for the image, as a percentage.
+Thus, a value of 50 reduces the image to half size.
+</p></li><li class="listitem"><p>
+The third argument specifies an alignment for the image. It must be one of
+<code class="literal">left</code> (default), <code class="literal">right</code> or <code class="literal">center</code> (or even <code class="literal">centre</code> if the
+DocBook processor you are using can handle it).
+</p></li><li class="listitem"><p>
+The fourth and fifth arguments specify the depth and width, respectively. How
+these values are handled depends on the processing software.
+</p></li></ul></div><p>
+Here is an example of the input for a figure, with all the image options
+defaulted:
+</p><pre class="literallayout">
+ .figure "My figure's title" "FIGfirst"
+ .image figure01.eps
+ .endfigure
+</pre><p>
+Here is another example, where the figure is reduced to 80% and centred:
+</p><pre class="literallayout">
+ .figure "A reduced figure"
+ .image figure02.eps 80 center
+ .endfigure
+</pre></div><div class="section" title="4.17 Footnotes"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID45">4.17 Footnotes</a></h3></div></div></div><p>Footnotes can be specified between <span class="bold"><strong>.footnote</strong></span> and <span class="bold"><strong>.endnote</strong></span> macros.
+Within a footnote there can be any kind of text item, including displays and
+tables. When a footnote occurs in the middle of a paragraph, paired flags
+must not straddle the footnote. This example is wrong:
+</p><pre class="literallayout">
+ The &amp;'quick
+ .footnote
+ That's really fast.
+ .endf
+ brown'&amp; fox.
+</pre><p>
+The correct markup for this example is:
+</p><pre class="literallayout">
+ The &amp;'quick'&amp;
+ .footnote
+ That's really fast.
+ .endf
+ &amp;'brown'&amp; fox.
+</pre></div><div class="section" title="4.18 Indexes"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="ID46">4.18 Indexes</a></h3></div></div></div><p>The <span class="bold"><strong>.index</strong></span> macro generates <code class="literal">&lt;indexterm&gt;</code> elements (index entries) in the
+output. It takes one or two arguments. The first is the text for the primary
+index term, and the second, if present, specifies a secondary index term. This
+macro can be called either from a directive line, or inline. However, it is
+mostly called as a directive, at the start of a relevant paragraph. For
+example:
+</p><pre class="literallayout">
+ .index goose "wild chase"
+ The chasing of wild geese...
+</pre><p>
+You can generate <span class="quote">“<span class="quote">see</span>”</span> and <span class="quote">“<span class="quote">see also</span>”</span> index entries by using <span class="bold"><strong>.index-see</strong></span>
+and <span class="bold"><strong>.index-seealso</strong></span> instead of <span class="bold"><strong>.index</strong></span>. The first argument of these
+macros is the text for the <span class="quote">“<span class="quote">see</span>”</span>. For example:
+</p><pre class="literallayout">
+ .index-see "chase" "wild goose"
+</pre><p>
+This generates:
+</p><pre class="literallayout">
+ &lt;indexterm&gt;
+ &lt;primary&gt;wild goose&lt;/primary&gt;
+ &lt;see&gt;chase&lt;/see&gt;
+ &lt;/indexterm&gt;
+</pre><p>
+If you want to generate an index entry for a range of pages, you can use the
+<span class="bold"><strong>.index-from</strong></span> and <span class="bold"><strong>.index-to</strong></span> macros. The first argument of each of them is
+an ID that ties them together. The second and third arguments of
+<span class="bold"><strong>.index-from</strong></span> are the primary and secondary index items. For example:
+</p><pre class="literallayout">
+ .index-from "ID5" "indexes" "handling ranges"
+ ... &lt;lines of text&gt; ...
+ .index-to "ID5"
+</pre><p>
+The <span class="bold"><strong>.makeindex</strong></span> macro should be called at the end of the document, at the
+point where you want an index to be generated. It can have up to two
+arguments. The first is the title for the index, for which the default is
+<span class="quote">“<span class="quote">Index</span>”</span>. The second, if present, causes a <code class="literal">role=</code> attribute to be added to
+the <code class="literal">&lt;index&gt;</code> element that is generated. For this to be useful, you need to
+generate <code class="literal">&lt;indexterm&gt;</code> elements that have similar <code class="literal">role=</code> attributes. The
+standard <span class="bold"><strong>index</strong></span> macro cannot do this. If you want to generate multiple
+indexes using this mechanism, it is best to define your own macros for each
+index type. For example:
+</p><pre class="literallayout">
+ .macro cindex
+ &amp;&lt;indexterm role="concept"&gt;&amp;
+ &amp;&lt;primary&gt;&amp;$1&amp;&lt;/primary&gt;&amp;
+ .arg 2
+ &amp;&lt;secondary&gt;&amp;$2&amp;&lt;/secondary&gt;&amp;
+ .endarg
+ &amp;&lt;/indexterm&gt;&amp;
+ .endmacro
+</pre><p>
+This defines a <span class="bold"><strong>.cindex</strong></span> macro for the <span class="quote">“<span class="quote">concept</span>”</span> index. At the end of the
+document you might have:
+</p><pre class="literallayout">
+ .makeindex "Concept index" "concept"
+ .makeindex
+</pre><p>
+As long as the processing software can handle multiple indexes, this causes two
+indexes to be generated. The first is entitled <span class="quote">“<span class="quote">Concept index</span>”</span>, and contains
+only those index entries that were generated by the <span class="bold"><strong>.cindex</strong></span> macro. The
+second contains all index entries.
+</p></div></div></div></body></html>
diff --git a/3rd-party/xfpt/doc/xfpt.pdf b/3rd-party/xfpt/doc/xfpt.pdf
new file mode 100644
index 000000000..5e68b1a7c
--- /dev/null
+++ b/3rd-party/xfpt/doc/xfpt.pdf
Binary files differ
diff --git a/3rd-party/xfpt/doc/xfpt.xfpt b/3rd-party/xfpt/doc/xfpt.xfpt
new file mode 100644
index 000000000..58bbccd09
--- /dev/null
+++ b/3rd-party/xfpt/doc/xfpt.xfpt
@@ -0,0 +1,1211 @@
+.include stdflags
+.include stdmacs
+
+. We are going to type the name xfpt rather a lot. Make it easier:
+.set X "<emphasis>xfpt</emphasis>"
+
+
+. ----------------------------------------------------------------------------
+.docbook
+.book
+
+.literal xml
+<bookinfo>
+<title>The xfpt plain text to XML processor</title>
+<titleabbrev>xfpt</titleabbrev>
+<date>18 May 2012</date>
+<author>
+ <firstname>Philip</firstname>
+ <surname>Hazel</surname>
+</author>
+<authorinitials>PH</authorinitials>
+<revhistory><revision><revnumber>0.09</revnumber><date>18 May 2012</date><authorinitials>PH</authorinitials></revision></revhistory>
+<copyright><year>2012</year><holder>University of Cambridge</holder></copyright>
+</bookinfo>
+.literal off
+
+. /////////////////////////////////////////////////////////////////////////////
+. These lines are processing instructions for the Simple DocBook Processor that
+. Philip Hazel has developed as a less cumbersome way of making PostScript and
+. PDFs than using xmlto and fop. They will be ignored by all other XML
+. processors.
+. /////////////////////////////////////////////////////////////////////////////
+
+.literal xml
+<?sdop
+ foot_right_recto="&chaptertitle;"
+ foot_right_verso="&chaptertitle;"
+?>
+.literal off
+
+
+
+. ----------------------------------------------------------------------------
+.chapter "Introduction" ID00
+&X; is a program that reads a marked-up ASCII source file, and converts it into
+XML. It was written with DocBook XML in mind, but can also be used for other
+forms of XML. Unlike &'AsciiDoc'& (&url(http://www.methods.co.nz/asciidoc/)),
+&X; does not try to produce XML from a document that is also usable as a
+freestanding ASCII document. The input for &X; is very definitely &"marked
+up"&. This makes it less ambiguous for large and/or complicated documents. &X;
+is also much faster than &'AsciiDoc'& because it is written in C and does not
+rely on pattern matching.
+
+&X; is aimed at users who understand the XML that they are generating. It makes
+it easy to include literal XML, either in blocks, or within paragraphs. &X;
+restricts itself to two special characters that trigger all its processing.
+
+&X; treats any input line that starts with a dot as a &'directive'& line.
+Directives control the way the input is processed. A small number of directives
+are implemented in the program itself. A macro facility makes it possible to
+combine these in various ways to define directives for higher-level concepts
+such as chapters and sections. A standard macro library that generates a simple
+subset of DocBook XML is provided. The only XML element that the program itself
+generates is &`<para>`&; all the others must be included as literal XML, either
+directly in the input text, or, more commonly, as part of the text that is
+generated by a macro call.
+
+The ampersand character is special within non-literal text that is processed by
+&X;. An ampersand introduces a &'flag sequence'& that modifies the output.
+Ampersand was chosen because it is also special in XML. As well as recognizing
+flag sequences that begin with an ampersand, &X; converts grave accents and
+apostrophes that appear in non-literal text into typographic opening and
+closing quotes, as follows:
+
+.display
+ &`&nbsp;&#x60; `& becomes &nbsp;`
+ &`&nbsp;&#x27; `& becomes &nbsp;'
+.endd
+
+Within normal input text, ampersand, grave accent, and apostrophe are the only
+characters that cause &X; to change the input text, but this applies only to
+non-literal text. In literal text, there are no markup characters, and only a
+dot at the start of a line is recognized as special. Within the body of a
+macro, there is one more special character: the dollar character is used to
+introduce an argument substitution.
+
+Notwithstanding the previous paragraph, &X; knows that it is generating XML,
+and in all cases when a literal ampersand or angle bracket is required in the
+output, the appropriate XML entity reference (&`&&amp;`&, &`&&lt;`&, or
+&`&&gt;`&, respectively) is generated.
+
+
+.section "The &X; command line" ID01
+The format of the &X; command line is:
+.display
+ &`xfpt [`&&'options'&&`] [`&&'input source'&&`]`&
+.endd
+If no input is specified, the standard input is read. There are four options:
+
+.vlist
+.vitem &%-help%&
+This option causes &X; to output its &"usage"& message, and exit.
+
+.vitem "&%-o%&&~&'<output destination>'&"
+This option overrides the default destination. If the standard input is being
+read, the default destination is the standard output. Otherwise, the default
+destination is the name of the input file with the extension &_.xml_&,
+replacing its existing extension if there is one. A single hyphen character can
+be given as an output destination to refer to the standard output.
+
+.vitem "&%-S%&&~&'<directory path>'&"
+This option overrides the path to &X;'s library directory that is built into
+the program. This makes it possible to use or test alternate libraries.
+
+.vitem &%-v%&
+This option causes &X; to output its version number and exit.
+.endlist
+
+
+.section "A short &X; example" ID02
+Here is a very short example of a complete &X; input file that uses some of the
+standard macros and flags:
+.code
+ .include stdflags
+ .include stdmacs
+ .docbook
+ .book
+
+ .chapter "The first chapter"
+ This is the text of the first chapter. Here is an &'italic'&
+ word, and here is a &*bold*& one.
+
+ .section "This is a section heading"
+ We can use the &*ilist*& macro to generate an itemized list:
+ .ilist
+ The first item in the list.
+ .next
+ The last item in the list.
+ .endlist
+
+ There are also standard macros for ordered lists, literal
+ layout blocks, code blocks, URL references, index entries,
+ tables, footnotes, figures, etc.
+.endd
+
+
+
+.section "Literal and non-literal processing" "SECTliteralprocessing" ID03
+&X; processes non-directive input lines in one of four ways (known as
+&"modes"&):
+
+.ilist
+In the default mode, text is processed paragraph by paragraph.
+.footnote
+There is, however, a special case when a paragraph contains one or more
+footnotes. In that situation, each part of the outer paragraph is processed
+independently.
+.endnote
+The end of a paragraph is indicated by the end of the input, a blank line, or
+by an occurrence of the &*.literal*& directive. Other directives (for example,
+&*.include*&) do not of themselves terminate a paragraph. Most of the standard
+macros (such as &*.chapter*& and &*.section*&) force a paragraph end by
+starting their contents with a &*.literal*& directive.
+
+Because &X; reads a whole paragraph before processing it, error messages
+contain the phrase &"detected near line &'nnn'&"&, where the line number is
+typically that of the last line of the paragraph.
+
+
+.next
+In the &"literal layout"& mode, text is processed line by line, but is
+otherwise handled as in the default mode. The only real difference this makes
+to the markup from the user's point of view is that both parts of a set of
+paired flags must be on the same line. In this mode, error messages are more
+likely to contain the exact line number where the fault lies. Literal layout
+mode is used by the standard &*.display*& macro to generate &`<literallayout>`&
+elements.
+
+.next
+In the &"literal text"& mode, text is also processed line by line, but no flags
+are recognized. The only modification &X; makes to the text is to turn
+ampersand and angle bracket characters into XML entity references. This mode is
+used by the standard &*.code*& macro to generate &`<literallayout>`& elements
+that include &`class=monospaced`&.
+
+.next
+In the &"literal XML"& mode, text lines are copied to the output without
+modification. This is the easiest way to include a chunk of literal XML in the
+output. An example might be the &`<bookinfo>`& element, which occurs only once
+in a document. It is not worth setting up a macro for a one-off item like this.
+.endlist
+
+The &*.literal*& directive switches between the modes. It is not normally used
+directly, but instead is incorported into appropriate macro definitions. The
+&*.inliteral*& directive can be used to test the current mode.
+
+Directive lines are recognized and acted upon in all four modes. However, an
+unrecognized line that starts with a dot in the literal text or literal XML
+mode is treated as data. In the other modes, such a line provokes an error.
+
+If you need to have a data line that begins with a dot in literal layout mode,
+you can either specify it by character number, or precede it with some
+non-acting markup. These two examples are both valid:
+.code
+ &#x2e;start with a dot
+ &''&.start with a dot
+.endd
+The second example assumes the standard flags are defined: it precedes the dot
+with an empty italic string. However, this is untidy because the empty string
+will be carried over into the XML.
+
+In literal text or literal XML mode, it is not possible to have a data line
+that starts with a dot followed by the name of a directive or macro. You have
+to use literal layout mode if you require such output. Another solution, which
+is used in the source for this document (where many examples show directive
+lines), is to indent every displayed line by one space, and thereby avoid the
+problem altogether.
+
+
+.section "Format of directive lines" ID04
+If an input line starts with a dot followed by a space, it is ignored by &X;.
+This provides a facility for including comments in the input. Otherwise, the
+dot must be followed by a directive or macro name, and possibly one or more
+arguments. Arguments that are strings are delimited by white space unless they
+are enclosed in single or double quotes. The delimiting quote character can be
+included within a quoted string by doubling it. Here are some examples:
+.code
+ .literal layout
+ .set version 0.00
+ .row "Jack's house" 'Jill''s house'
+.endd
+An unrecognized directive line normally causes an error; however, in the
+literal text and literal XML modes, an unrecognized line that starts with a
+dot is treated as a data line.
+
+
+
+.section "Calling macros" "SECTcallingmacro" ID05
+Macros are defined by the &*.macro*& directive, which is described in section
+&<<SECTmacro>>&. There are two ways of calling a macro. It can be called in the
+same way as a directive, or it can be called from within text that is being
+processed. The second case is called an &"inline macro call"&.
+
+When a macro is called as a directive, its name is given after a dot at the
+start of a line, and the name may be followed by any number of optional
+arguments, in the same way as a built-in directive (see the previous section).
+For example:
+.code
+ .chapter "Chapter title" chapter-reference
+.endd
+The contents of the macro, after argument substitution, are processed in
+exactly the same way as normal input lines. A macro that is called as a
+directive may contain nested macro calls.
+
+When a macro is called from within a text string, its name is given after an
+ampersand, and is followed by an opening parenthesis. Arguments, delimited by
+commas, can then follow, up to a closing parenthesis. If an argument contains a
+comma or a closing parenthesis, it must be quoted. White space after a
+separating comma is ignored. The most common example of this type of macro
+call is the standard macro for generating a URL reference:
+.code
+ Refer to a URL via &url(http://x.example,this text).
+.endd
+
+There are differences in the behaviour of macros, depending on which way they
+are called. A macro that is called inline may not contain references to other
+macros; it must contain only text lines and calls to built-in directives.
+Also, newlines that terminate text lines within the macro are not included in
+the output.
+
+A macro that can be called inline can always be called as a directive, but the
+opposite is not always true. Macros are usually designed to be called either
+one way or the other. However, the &*.new*& and &*.index*& macros in the
+standard library are examples of macros that are designed be called either way.
+
+
+
+
+
+. ----------------------------------------------------------------------------
+.chapter "Flag sequences" ID06
+Only one flag sequence is built-into the code itself. If an input line ends
+with three ampersands (ignoring trailing white space), the ampersands are
+removed, and the next input line, with any leading white space removed, is
+joined to the original line. This happens before any other processing, and may
+involve any number of lines. Thus:
+
+.display
+ &`The quick &amp;&amp;&amp;`&
+ &` brown &amp;&amp;&amp;`&
+ &` fox.`&
+.endd
+
+produces exactly the same output as:
+
+.code
+ The quick brown fox.
+.endd
+
+
+.section "Flag sequences for XML entities and &X; variables" ID07
+If an ampersand is followed by a # character, a number, and a semicolon, it is
+understood as a numerical reference to an XML entity, and is passed through
+unmodified. The number can be decimal, or hexadecimal preceded by &`x`&. For
+example:
+.code
+ This is an Ohm sign: &#x2126;.
+ This is a degree sign: &#176;.
+.endd
+If an ampersand is followed by a letter, a sequence of letters, digits, and
+dots is read. If this is terminated by a semicolon, the characters between the
+ampersand and the semicolon are interpreted as an entity name. This can be:
+.ilist
+The name of an inbuilt &X; variable. At present, there is only one of these,
+called &`xfpt.rev`&. Its use is described with the &*.revision*& directive
+below.
+.next
+The name of a user variable that has been set by the &*.set*& directive, also
+described below.
+.next
+The name of an XML entity. This is assumed if the name is not recognized as one
+of the previous types. In this case, the input text is passed to the output
+without modification. For example:
+.code
+ This is an Ohm sign: &Ohm;.
+.endd
+.endlist
+
+
+.section "Flag sequences for calling macros" ID08
+If an ampersand is followed by a sequence of alphanumeric characters starting
+with a letter, terminated by an opening parenthesis, the characters between the
+ampersand and the parenthesis are interpreted as the name of a macro. See
+section &<<SECTcallingmacro>>& for more details.
+
+
+
+.section "Other flag sequences" ID09
+Any other flag sequences that are needed must be defined by means of the
+&*.flag*& directive. These are of two types, standalone and paired. Both cases
+define replacement text. This is always literal; it is not itself scanned for
+flag occurrences.
+
+Lines are scanned from left to right when flags are being interpreted. If
+there is any ambiguity when a text string is being scanned, the longest flag
+sequence wins. Thus, it is possible (as in the standard flag sequences) to
+define both &`&&<`& and &`&&<<`& as flags, provided that you never want to
+follow the first of them with a &`<`& character.
+
+You can define flags that start with &`&&#`&, but these must be used with care,
+lest they be misinterpreted as numerical references to XML entities.
+
+A standalone flag consists of an ampersand followed by any number of
+non-alphanumeric characters. When it is encountered, it is replaced by its
+replacement text. For example, in the standard flag definitions, &`&&&&`&
+is defined as a standalone flag with with the replacement text &`&&amp;`&.
+
+A paired flag is defined as two sequences. The first takes the same form as a
+standalone flag. The second also consists of non-alphanumeric characters, but
+need not start with an ampersand. It is often defined as the reverse of the
+first sequence. For example, in the standard definitions, &`&&&#x27;`& and
+&`&#x27;&&`& are defined as a flag pair for enclosing text in an &`<emphasis>`&
+element.
+
+When the first sequence of a paired flag is encountered, its partner is
+expected to be found within the same text unit. In the default mode, the units
+are a paragraphs, or part-paragraphs if footnotes intervene. In literal layout
+mode, the text is processed line by line. Each member of the pair is replaced
+by its replacement text.
+
+Multiple occurrences of paired flags must be correctly nested. Note that,
+though &X; diagnoses an error for badly nested flag pairs, it does not prevent
+you from generating invalid XML. For example, DocBook does not allow
+&`<emphasis>`& within &`<literal>`&, though it does allow &`<literal>`& within
+&`<emphasis>`&.
+
+
+.section "Unrecognized flag sequences" ID10
+If an ampersand is not followed by a character sequence in one of the forms
+described in the preceding sections, an error occurs.
+
+
+.section "Standard flag sequences" ID11
+These are the standalone flag sequences that are defined in the &_stdflags_&
+file in the &X; library:
+.display
+ &`&&&& `& becomes &` &&amp;`& (ampersand)
+ &`&&-- `& becomes &` &&ndash;`& (en-dash)
+ &`&&~ `& becomes &` &&nbsp;`& (`hard' space)
+.endd
+These are the flag pairs that are defined in the &_stdflags_& file in the &X;
+library:
+.display
+ &`&&"..."&& `& becomes &`<quote>...</quote>`&
+ &`&&&#x27;...&#x27;&& `& becomes &`<emphasis>...</emphasis>`&
+ &`&&*...*&& `& becomes &`<emphasis role="bold">...</emphasis>`&
+ &`&&&#x60;...&#x60;&& `& becomes &`<literal>...</literal>`&
+ &`&&_..._&& `& becomes &`<filename>...</filename>`&
+ &`&&(...)&& `& becomes &`<command>...</command>`&
+ &`&&[...]&& `& becomes &`<function>...</function>`&
+ &`&&%...%&& `& becomes &`<option>...</option>`&
+ &`&&$...$&& `& becomes &`<varname>...</varname>`&
+ &`&&<...>&& `& becomes &`<...>`&
+ &`&&<<...>>&& `& becomes &`<xref linkend="..."/>`&
+.endd
+For example, if you want to include a literal XML element in your output, you
+can do it like this: &`&&<element>&&`&. If you want to include a longer
+sequence of literal XML, changing to the literal XML mode may be more
+convenient.
+
+
+
+
+. ----------------------------------------------------------------------------
+.chapter "Built-in directive processing" ID12
+The directives that are built into the code of &X; are now described in
+alphabetical order. You can see more examples of their use in the descriptions
+of the standard macros in chapter &<<CHAPstdmac>>&.
+
+
+.section "The &*.arg*& directive" ID13
+This directive may appear only within the body of a macro. It must be followed
+by a single number, optionally preceded by a minus sign. If the number is
+positive (no minus sign), subsequent lines, up to a &*.endarg*& directive, are
+skipped unless the macro has been called with at least that number of
+arguments and the given argument is not an empty string. If the number is
+negative (minus sign present), subsequent lines are skipped if the macro has
+been called with fewer than that number of arguments, or with an empty string
+for the given argument. For example:
+.code
+ .macro example
+ .arg 2
+ Use these lines if there are at least 2 arguments
+ and the second one is not empty. Normally there would
+ be a reference to the 2nd argument.
+ .endarg
+ .arg -2
+ Use this line unless there are at least 2 arguments
+ and the second one is not empty.
+ .endarg
+ .endmacro
+.endd
+Note that if a macro is defined with default values for its arguments, these
+are not counted by the &*.arg*& directive, which looks only at the actual
+arguments in a particular macro call.
+
+The &*.arg*& directive may be nested.
+
+
+.section "The &*.eacharg*& directive" ID14
+This directive may appear only within the body of a macro. It may optionally be
+followed by a single number; if omitted the value is taken to be 1. Subsequent
+lines, up to a &*.endeach*& directive, are processed multiple times, once for
+each remaining argument. Unlike &*.arg*&, an argument that is an empty string
+is not treated specially. However, like &*.arg*&, only the actual arguments of
+a macro call are considered. Default argument values do not count.
+
+The number given with &*.eacharg*& defines which argument to start with. If the
+macro is called with fewer arguments, the lines up to &*.endeach*& are skipped,
+and are not processed at all. When these lines are being processed, the
+remaining macro arguments can be referenced relative to the current argument.
+&`$+1`& refers to the current argument, &`$+2`& to the next argument, and so
+on.
+
+The &*.endeach*& directive may also be followed by a number, again defaulting
+to 1. When &*.endeach*& is reached, the current argument number is incremented
+by that number. If there are still unused arguments available, the lines
+between &*.eacharg*& and &*.endeach*& are processed again.
+
+This example is taken from the coding for the standard &*.row*& macro, which
+generates an &`<entry>`& element for each of its arguments:
+.code
+ .eacharg
+ &<entry>&$+1&</entry>&
+ .endeach
+.endd
+This example is taken from the coding for the standard &*.itable*& macro, which
+processes arguments in pairs to define the table's columns, starting from the
+fifth argument:
+.code
+ .eacharg 5
+ &<colspec colwidth="$+1" align="$+2"/>&
+ .endeach 2
+.endd
+The &*.eacharg*& directive may in principle be nested, though this does not
+seem useful in practice.
+
+
+.section "The &*.echo*& directive" ID15
+This directive takes a single string argument. It writes it to the standard
+error stream. Within a macro, argument substitution takes place, but no other
+processing is done on the string. This directive can be useful for debugging
+macros or writing comments to the user.
+
+
+.section "The &*.endarg*& directive" ID16
+See the description of &*.arg*& above.
+
+
+.section "The &*.endeach*& directive" ID17
+See the description of &*.eacharg*& above.
+
+
+.section "The &*.endinliteral*& directive" ID18
+See the description of &*.inliteral*& below.
+
+
+.section "The &*.flag*& directive" ID19
+This directive is used to define flag sequences. The directive must be followed
+either by a standalone flag sequence and one string in quotes, or by a flag
+pair and two strings in quotes. White space separates these items. For example:
+.code
+ .flag && "&amp;"
+ .flag &" "& "<quote>" "</quote>"
+.endd
+There are more examples in the definitions of the standard flags. If you
+redefine an existing flag, the new definition overrides the old. There is no
+way to revert to the previous definition.
+
+
+.section "The &*.include*& directive" ID20
+This directive must be followed by a single string argument that is the path to
+a file. The contents of the file are read and incorporated into the input at
+this point. If the string does not contain any slashes, the path to the &X;
+library is prepended. Otherwise, the path is used unaltered. If
+&*.include*& is used inside a macro, it is evaluated each time the macro is
+called, and thus can be used to include a different file on each occasion.
+
+
+.section "The &*.inliteral*& directive" ID21
+This directive may appear only within the body of a macro. It must be followed
+by one of the words &"layout"&, &"text"&, &"off"&, or &"xml"&. If the current
+literal mode does not correspond to the word, subsequent lines, up to a
+&*.endinliteral*& directive, are skipped. The &*.inliteral*& directive may be
+nested.
+
+
+.section "The &*.literal*& directive" ID22
+This must be followed by one of the words &"layout"&, &"text"&, &"off"&, or
+&"xml"&. It forces an end to a previous paragraph, if there is one, and then
+switches between processing modes. The default mode is the &"off"& mode, in
+which text is processed paragraph by paragraph, and flags are recognized.
+Section &<<SECTliteralprocessing>>& describes how input lines are processed in
+the four modes.
+
+
+.section "The &*.macro*& directive" "SECTmacro" ID23
+This directive is used to define macros. It must be followed by a macro name,
+and then, optionally, by any number of arguments. The macro name can be any
+sequence of non-whitespace characters. The arguments in the definition provide
+default values. The following lines, up to &*.endmacro*&, form the body of the
+macro. They are not processed in any way when the macro is defined; they are
+processed only when the macro is called (see section &<<SECTcallingmacro>>&).
+
+Within the body of a macro, argument substitutions can be specified by means of
+a dollar character and an argument number, for example, &`$3`& for the third
+argument. See also &*.eacharg*& above for the use of &`$+`& to refer to
+relative arguments when looping through them. A reference to an argument that
+is not supplied, and is not given a default, results in an empty substitution.
+
+There is also a facility for a conditional substitution. A reference to an
+argument of the form:
+.display
+&`$=`&&'<digits><delimiter><text><delimiter>'&
+.endd
+inserts the text if the argument is defined and is not an empty string, and
+nothing otherwise. The text is itself scanned for flags and argument
+substitutions. The delimiter must be a single character that does not appear in
+the text. For example:
+.code
+&<chapter$=2+ id="$2"+>&
+.endd
+If this appears in a macro that is called with only one argument, the result
+is:
+.code
+<chapter>
+.endd
+but if the second argument is, say &`abcd`&, the result is:
+.code
+<chapter id="abcd">
+.endd
+This conditional feature can be used with both absolute and relative argument
+references.
+
+If a dollar character is required as data within the body of a macro, it must
+be doubled. For example:
+.code
+ .macro price
+ The price is $$1.
+ .endmacro
+.endd
+
+If you redefine an existing macro, the new definition overrides the old. There
+is no way to revert to the previous definition. If you define a macro whose
+name is the same as the name of a built-in directive you will not be able to
+call it, because &X; looks for built-in directives before it looks for macros.
+
+It is possible to define a macro within a macro, though clearly care must be
+taken with argument references to ensure that substitutions happen at the right
+level.
+
+
+.section "The &*.nest*& directive" ID24
+This directive must be followed by one of the words &"begin"& or &"end"&. It is
+used to delimit a nested sequence of independent text items that occurs inside
+another, such as the contents of a footnote inside a paragraph. This directive
+is usually used inside a macro. For example, a &*footnote*& macro could be
+defined like this:
+.code
+ .macro footnote
+ &<footnote>&
+ .nest begin
+ .endmacro
+.endd
+At the start of a nested sequence, the current mode and paragraph state are
+remembered and &X; then reverts to the default mode and &"not in a paragraph"&.
+At the end of a nested sequence, if a paragraph has been started, it is
+terminated, and then &X; reverts to the previous state.
+
+
+.section "The &*.nonl*& directive" ID25
+This directive must be followed by a single string argument. It is processed
+as an input line without a newline at the end. This facility is useful
+in macros when constructing a single data line from several text fragments. See
+for example the &*.new*& macro in the standard macros.
+
+
+.section "The &*.pop*& directive" ID26
+&X; keeps a stack of text strings that are manipulated by the &*.push*& and
+&*.pop*& directives. When the end of the input is reached, any strings that
+remain on the stack are popped off, processed for flags, and written to the
+output. In some cases (see the &*.push*& directive below) a warning message is
+given.
+
+Each string on the stack may, optionally, be associated with an upper case
+letter. If &*.pop*& is followed by an upper case letter, it searches down the
+stack for a string with the same letter. If it cannot find one, it does
+nothing. Otherwise, it pops off, processes, and writes out all the strings down
+to and including the one that matches.
+
+If &*.pop*& is given without a following letter, it pops one string off the
+stack and writes it out. If there is nothing on the stack, an error occurs.
+
+
+.section "The &*.push*& directive" ID27
+This directive pushes a string onto the stack. If the rest of the command line
+starts with an upper case letter followed by white space or the end of the
+line, that letter is associated with the string that is pushed, which consists
+either of a quoted string, or the rest of the line. After a quoted string, the
+word `check' may appear. In this case, if the string has not been popped off
+the stack by the end of processing, a warning message is output. This facility
+is used by the standard macros to give warnings for unclosed items such as
+&*.ilist*&.
+
+For example, the &*.chapter*& macro contains this line:
+.code
+ .push C &</chapter>&
+.endd
+Earlier in the macro there is the line:
+.code
+ .pop C
+.endd
+This arrangement ensures that any previous chapter is terminated before
+starting a new one, and also when the end of the input is reached. The
+&*.ilist*& macro contains this line:
+.code
+ .push L "&</itemizedlist>&" check
+.endd
+Item lists are terminatated by &*.endlist*&, which contains:
+.code
+ .pop L
+.endd
+However, if &*.endlist*& is accidentally omitted (or &*.ilist*& is accidentally
+included), the appearance of `check' means that a warning is issued to alert
+the user to a possible problem.
+
+.section "The &*.revision*& directive" "SECTrevision" ID28
+This directive is provided to make it easy to set the &`revisionflag`&
+attribute on XML elements in a given portion of the document. The DocBook
+specification states that the &`revisionflag`& attribute is common to all
+elements.
+
+The &*.revision*& directive must be followed by one of the words &"changed"&,
+&"added"&, &"deleted"&, or &"off"&. For any value other than &"off"&, it causes
+the internal variable &'xfpt.rev'& to be set to &`revisionflag=`& followed by
+the given argument. If the argument is &"off"&, the internal variable is
+emptied.
+
+The contents of &'xfpt.rev'& are included in every &`<para>`& element that &X;
+generates. In addition, a number of the standard macros contain references to
+&'xfpt.rev'& in appropriate places. Thus, setting:
+.code
+ .revision changed
+.endd
+should cause all subsequent text to be marked up with &`revisionflag`&
+attributes, until
+.code
+ .revision off
+.endd
+is encountered. Unfortunately, at the time of writing, not all DocBook
+processing software pays attention to the &`revisionflag`& attribute.
+Furthermore, some software grumbles that it is &"unexpected"& on some elements,
+though it does still seem to process it correctly.
+
+For handling the most common case (setting and unsetting &"changed"&), the
+standard macros &*.new*& and &*.wen*& are provided (see section
+&<<SECTrevmacs>>&).
+
+
+.section "The &*.set*& directive" ID29
+This directive must be followed by a name and a text string. It defines a user
+variable and gives it a name. A reference to the name in the style of an XML
+entity causes the string to be substituted, without further processing. For
+example:
+.code
+ .set version 4.99
+.endd
+This could be referenced as &`&&version;`&. If a variable is given the name of
+an XML entity, you will not be able to refer to the XML entity, because local
+variables take precedence. There is no way to delete a local variable after it
+has been defined.
+
+
+
+. ----------------------------------------------------------------------------
+.chapter "The standard macros for DocBook" "CHAPstdmac" "Standard macros" ID30
+A set of simple macros for commonly needed DocBook features is provided in
+&X;'s library. This may be extended as experience with &X; accumulates. The
+standard macros assume that the standard flags are defined, so a document that
+is going to use these features should start with:
+.code
+ .include stdflags
+ .include stdmacs
+.endd
+All the standard macros except &*new*&, &*index*&, and &*url*& are intended to
+be called as directive lines. Their names are therefore shown with a leading
+dot in the discussion below.
+
+.section "Overall setup" ID31
+There are two macros that should be used only once, at the start of the
+document. The &*.docbook*& macro has no arguments. It inserts into the output
+file the standard header material for a DocBook XML file, which is:
+.code
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+.endd
+The &*.book*& macro has no arguments. It generates &`<book>`& and pushes
+&`</book>`& onto the stack so that it will be output at the end.
+
+
+.section "Processing instructions"
+XML processing instructions such as &`<?sdop`& &`toc_sections="no"?>`& can, of
+course, be written written literally between &`.literal`& &`xml`& and
+&`.literal`& &`off`&. If there are a lot of them, this is perhaps the most
+convenient approach. A macro called &*.pi*& is provided as an easy way of
+setting up a short processing instruction. Its first argument is the name of
+the processor for which the instruction is intended, and its second argument is
+the contents of the instruction, for example:
+.code
+ .pi sdop 'toc_sections="yes,yes,no"'
+.endd
+This generates &`<?sdop`& &`toc_sections="yes,yes,no"?>`&.
+
+
+.section "Chapters, sections, and subsections" ID32
+Chapters, sections, and subsections are supported by three macros that all
+operate in the same way. They are &*.chapter*&, &*.section*&, and
+&*.subsection*&. They take either one, two, or three arguments. The first
+argument is the title. If a second argument is present, and is not an empty
+string, it is set as an ID, and can be used in cross-references. For example:
+.code
+ .chapter "Introduction"
+.endd
+sets no ID, but
+.code
+ .section "A section title" "SECTdemo"
+.endd
+can be referenced from elsewhere in the document by a phrase such as:
+.code
+ see section &<<SECTdemo>>&
+.endd
+When the title of a chapter of section is being used as a running head or foot
+(for example), it may be too long to fit comfortably into the available space.
+DocBook provides the facility for a title abbreviation to be specified to deal
+with this problem. If a third argument is given to one of these macros, it
+causes a &`<titleabbrev>`& element to be generated. In this case, a second
+argument must also be provided, but if you do not need an ID, the second
+argument can be an empty string. For example:
+.code
+ .chapter "This chapter has quite a long title" "" "Long title"
+.endd
+Where and when the abbreviation is used in place of the full title is
+controlled by the stylesheet when the XML is processed.
+
+
+.section "Prefaces, appendixes, and colophons" ID33
+The macros &*.preface*&, &*.appendix*&, and &*.colophon*& operate in the same
+way as &*.chapter*&, except that the first and the last have the default title
+strings &"Preface"& and &"Colophon"&.
+
+
+.section "Terminating chapters, etc."
+The macros for chapters, sections, appendixes, etc. use the stack to ensure
+that each one is terminated at the correct point, without the need for an
+explicit terminator. For example, starting a new section automatically
+terminates an open subsection and a previous section.
+
+Occasionally, however, there is a need to force an explicit termination. The
+&*.endchapter*&, &*.endsection*&, &*.endsubsection*&, &*.endpreface*&,
+&*.endappendix*&, and &*.endcolophon*& macros provide this facility. For
+example, if you want to include an XML processing instruction after a preface,
+but before the start of the following chapter, you must terminate the preface
+with &*.endpreface*&. Otherwise a processing instruction that precedes the next
+&*.chapter*& will end up inside the &`<preface>`& element. You should not
+include any actual text items at these points.
+
+
+
+.section "URL references" ID34
+The &*url*& macro generates URL references, and is intended to be called inline
+within the text that is being processed. It generates a &`<ulink>`& element,
+and has either one or two arguments. The first argument is the URL, and the
+second is the text that describes it. For example:
+.code
+ More details are &url(http://x.example, here).
+.endd
+This generates the following XML:
+.code
+ More details are <ulink url="http://x.example">here</ulink>.
+.endd
+If the second argument is absent, the contents of the first argument are used
+instead. If &*url*& is called as a directive, there will be a newline in the
+output after &`</ulink>`&, which in most cases (such as the example above), you
+do not want.
+
+
+
+.section "Itemized lists" ID35
+The &*.ilist*& macro marks the start of an itemized list, the items of which
+are normally rendered with bullets or similar markings. The macro can
+optionally be called with one argument, for which there is no default. If the
+argument is present, it is used to add a &`mark=`& attribute to the
+&`<itemizedlist>`& element that is generated. The mark names that can be used
+depend on the software that processes the resulting XML. For HTML output,
+&"square"& and &"opencircle"& work in some browsers.
+
+The text for the first item follows the macro call. The start of the next item
+is indicated by the &*.next*& macro, and the end of the list by &*.endlist*&.
+For example:
+.code
+ .ilist
+ This is the first item.
+ .next
+ This is the next item.
+ .endlist
+.endd
+There may be more than one paragraph in an item.
+
+
+.section "Ordered lists" ID36
+The &*.olist*& macro marks the start of an ordered list, the items of which are
+numbered. If no argument is given, arabic numerals are used. One of the
+following words can be given as the macro's argument to specify the numeration:
+.display
+&`arabic `& arabic numerals
+&`loweralpha `& lower case letters
+&`lowerroman `& lower case roman numerals
+&`upperalpha `& upper case letters
+&`upperroman `& upper case roman numerals
+.endd
+The text for the first item follows the macro call. The start of the next item
+is indicated by the &*.next*& macro, and the end of the list by &*.endlist*&.
+For example:
+.code
+ .olist lowerroman
+ This is the first item.
+ .next
+ This is the next item.
+ .endlist
+.endd
+There may be more than one paragraph in an item.
+
+
+.section "Variable lists" ID37
+A variable list is one in which each entry is composed of a set of one or more
+terms and an associated description. Typically, the terms are printed in a
+style that makes them stand out, and the description is indented underneath.
+The start of a variable list is indicated by the &*.vlist*& macro, which has
+one optional argument. If present, it defines a title for the list.
+
+Each entry is defined by a &*.vitem*& macro, whose arguments are the terms.
+This is followed by the body of the entry. The list is terminated by the
+&*.endlist*& macro. For example:
+.code
+ .vlist "Font filename extensions"
+ .vitem "TTF"
+ TrueType fonts.
+ .vitem "PFA" "PFB"
+ PostScript fonts.
+ .endlist
+.endd
+As for the other lists, there may be more than one paragraph in an item.
+
+
+.section "Nested lists" ID38
+Lists may be nested as required. Some DocBook processors automatically choose
+different bullets for nested itemized lists, but others do not. The
+&*.endlist*& macro has no useful arguments. Any text that follows it is
+treated as a comment. This can provide an annotation facility that may make the
+input easier to understand when lists are nested.
+
+
+.section "Displayed text" ID39
+In displayed text each non-directive input line generates one output line. The
+&`<literallayout>`& DocBook element is used to achieve this. Two kinds of
+displayed text are supported by the standard macros. They differ in their
+handling of the text itself.
+
+The macro &*.display*& is followed by lines that are processed in the same way
+as normal paragraphs: flags are interpreted, and so there may be font changes
+and so on. The lines are processed in literal layout mode. For example:
+.code
+ .display
+ &`-o`& set output destination
+ &`-S`& set library path
+ .endd
+.endd
+The output is as follows:
+.display
+ &`-o`& set output destination
+ &`-S`& set library path
+.endd
+
+The macro &*.code*& is followed lines that are not processed in any way, except
+to turn ampersands and angle brackets into XML entities. The lines are
+processed in literal text mode. In addition, &`class="monospaced"`& is added to
+the &`<literallayout>`& element, so that the lines are displayed in a
+monospaced font. For example:
+.code
+ .code
+ z = sqrt(x*x + y*y);
+ .endd
+.endd
+
+As the examples illustrate, both kinds of display are terminated by the
+&*.endd*& macro.
+
+
+
+.section "Block quotes" ID40
+The macro pair &*.blockquote*& and &*.endblockquote*& are used to wrap the
+lines between them in a &`<blockquote>`& element.
+
+
+.section "Revision markings" "SECTrevmacs" ID41
+Two macros are provided to simplify setting and unsetting the &"changed"&
+revision marking (see section &<<SECTrevision>>&). When the revised text is
+substantial (for example, a complete paragraph, table, display, or section), it
+can be placed between &*.new*& and &*.wen*&, as in this example:
+.code
+ This paragraph is not flagged as changed.
+ .new
+ This is a changed paragraph that contains a display:
+ .display
+ whatever
+ .endd
+ This is the next paragraph.
+ .wen
+ Here is the next, unmarked, paragraph.
+.endd
+When called like this, without an argument, in ordinary text, &*.new*&
+terminates the current paragraph, and &*.wen*& always does so. Therefore, even
+though there are no blank lines before &*.new*& or &*.wen*& above, the revised
+text will end up in a paragraph of its own. (You can, of course, put in blank
+lines if you wish.)
+
+If want to indicate that just a few words inside a paragraph are revised, you
+can call the &*new*& macro with an argument. The macro can be called either as
+a directive or inline:
+.code
+ This is a paragraph that has
+ .new "a few marked words"
+ within it. Here are &new(some more) marked words.
+.endd
+The effect of this is to generate a &`<phrase>`& XML element with the
+&`revisionflag`& attribute set. The &*.wen*& macro is not used in this case.
+
+You can use the &*.new*&/&*.wen*& macro pair to generate a &`<phrase>`& element
+inside a section of displayed text. For example:
+.code
+ .display
+ This line is not flagged as changed.
+ .new
+ This line is flagged as changed.
+ .wen
+ This line is not flagged as changed.
+ .endd
+.endd
+This usage works with both &*.display*& and &*.code*&. Within a &*.display*&
+section you can also call &*.new*& with an argument, either as a directive or
+inline. This does not work for &*.code*& because its lines are processed in
+literal text mode.
+
+If you want to add revision indications to part of a table, you must use an
+inline call of &*new*& within an argument of the &*.row*& macro (see below).
+This is the only usage that works in this case.
+
+
+.section "Informal tables" ID42
+The &*.itable*& macro starts an informal (untitled) table with some basic
+parameterization. If you are working on a large document that has many tables
+with the same parameters, the best approach is to define your own table macros,
+possibly calling the standard one with specific arguments.
+
+The &*.itable*& macro has four basic arguments:
+.olist
+The frame requirement for the table, which may be one of the words &"all"&,
+&"bottom"&, &"none"& (the default), &"sides"&, &"top"&, or &"topbot"&.
+.next
+The &"colsep"& value for the table. The default is &"0"&, meaning no vertical
+separator lines between columns. The value &"1"& requests vertical separator
+lines.
+.next
+The &"rowsep"& value for the table. The default is &"0"&, meaning no horizontal
+lines between rows. The value &"1"& requests horizontal separator lines.
+.next
+The number of columns.
+.endlist
+These arguments must be followed by two arguments for each column. The first
+specifies the column width, and the second its aligmnent. A column width can be
+specified as an absolute dimension such as 36pt or 2in, or as a proportional
+measure, which has the form of a number followed by an asterisk. The two forms
+can be mixed &-- see the DocBook specification for details.
+
+Straightforward column alignments can be specified as &"center"&, &"left"&, or
+&"right"&. DocBook also has some other possibilities, but sadly they do not
+seem to include &"centre"&.
+
+Each row of the table is specified using a &*.row*& macro; the entries in
+the row are the macros's arguments. The table is terminated by &*.endtable*&,
+which has no arguments. For example:
+
+.code
+ .itable all 1 1 2 1in left 2in center
+ .row "cell 11" "cell 12"
+ .row "cell 21" "cell 22"
+ .endtable
+.endd
+
+This specifies a framed table, with both column and row separator lines. There
+are two columns: the first is one inch wide and left aligned, and the second is
+two inches wide and centred. There are two rows. The resulting table looks like
+this:
+
+.itable all 1 1 2 1in left 2in center
+.row "cell 11" "cell 12"
+.row "cell 21" "cell 22"
+.endtable
+
+The &*.row*& macro does not set the &`revisionflag`& attribute in the
+&`<entry>`& elements that it generates because this appears to be ignored by
+all current XML processors. However, you can use an inline call of the &*new*&
+macro within an entry to generate a &`<phrase>`& element with &`revisionflag`&
+set.
+
+
+.section "Formal tables" ID43
+The &*.table*& macro starts a formal table, that is, a table that has a title,
+and which can be cross referenced. The first argument of this macro is the
+table's title; the second is an identifier for cross-referencing. If you are
+not going to reference the table, an empty string must be supplied. From the
+third argument onwards, the arguments are identical to the &*.itable*& macro.
+For example:
+
+.code
+ .table "A title for the table" "" all 1 1 2 1in left 2in center
+ .row "cell 11" "cell 12"
+ .row "cell 21" "cell 22"
+ .endtable
+.endd
+
+
+.section "Figures and images" ID44
+A figure is enclosed between &*.figure*& and &*.endfigure*& macros. The first
+argument of &*.figure*& provides a title for the figure. The second is
+optional; if present, it is a tag for references to the figure.
+
+A figure normally contains an image. The &*.image*& macro can be used in simple
+cases. It generates a &`<mediaobject>`& element containing an
+&`<imageobject>`&. The first argument is the name of the file containing the
+image. The remaining arguments are optional; an empty string must be
+supplied as a placeholder when one that is not required is followed by one that
+is set.
+
+.ilist
+The second argument specifies a scaling factor for the image, as a percentage.
+Thus, a value of 50 reduces the image to half size.
+.next
+The third argument specifies an alignment for the image. It must be one of
+&`left`& (default), &`right`& or &`center`& (or even &`centre`& if the
+DocBook processor you are using can handle it).
+.next
+The fourth and fifth arguments specify the depth and width, respectively. How
+these values are handled depends on the processing software.
+.endlist
+
+Here is an example of the input for a figure, with all the image options
+defaulted:
+.code
+ .figure "My figure's title" "FIGfirst"
+ .image figure01.eps
+ .endfigure
+.endd
+
+Here is another example, where the figure is reduced to 80% and centred:
+.code
+ .figure "A reduced figure"
+ .image figure02.eps 80 center
+ .endfigure
+.endd
+
+
+.section "Footnotes" ID45
+Footnotes can be specified between &*.footnote*& and &*.endnote*& macros.
+Within a footnote there can be any kind of text item, including displays and
+tables. When a footnote occurs in the middle of a paragraph, paired flags
+must not straddle the footnote. This example is wrong:
+.code
+ The &'quick
+ .footnote
+ That's really fast.
+ .endf
+ brown'& fox.
+.endd
+The correct markup for this example is:
+.code
+ The &'quick'&
+ .footnote
+ That's really fast.
+ .endf
+ &'brown'& fox.
+.endd
+
+
+.section "Indexes" ID46
+The &*.index*& macro generates &`<indexterm>`& elements (index entries) in the
+output. It takes one or two arguments. The first is the text for the primary
+index term, and the second, if present, specifies a secondary index term. This
+macro can be called either from a directive line, or inline. However, it is
+mostly called as a directive, at the start of a relevant paragraph. For
+example:
+.code
+ .index goose "wild chase"
+ The chasing of wild geese...
+.endd
+You can generate &"see"& and &"see also"& index entries by using &*.index-see*&
+and &*.index-seealso*& instead of &*.index*&. The first argument of these
+macros is the text for the &"see"&. For example:
+.code
+ .index-see "chase" "wild goose"
+.endd
+This generates:
+.code
+ <indexterm>
+ <primary>wild goose</primary>
+ <see>chase</see>
+ </indexterm>
+.endd
+
+If you want to generate an index entry for a range of pages, you can use the
+&*.index-from*& and &*.index-to*& macros. The first argument of each of them is
+an ID that ties them together. The second and third arguments of
+&*.index-from*& are the primary and secondary index items. For example:
+.code
+ .index-from "ID5" "indexes" "handling ranges"
+ ... <lines of text> ...
+ .index-to "ID5"
+.endd
+
+The &*.makeindex*& macro should be called at the end of the document, at the
+point where you want an index to be generated. It can have up to two
+arguments. The first is the title for the index, for which the default is
+&"Index"&. The second, if present, causes a &`role=`& attribute to be added to
+the &`<index>`& element that is generated. For this to be useful, you need to
+generate &`<indexterm>`& elements that have similar &`role=`& attributes. The
+standard &*index*& macro cannot do this. If you want to generate multiple
+indexes using this mechanism, it is best to define your own macros for each
+index type. For example:
+.code
+ .macro cindex
+ &<indexterm role="concept">&
+ &<primary>&$1&</primary>&
+ .arg 2
+ &<secondary>&$2&</secondary>&
+ .endarg
+ &</indexterm>&
+ .endmacro
+.endd
+This defines a &*.cindex*& macro for the &"concept"& index. At the end of the
+document you might have:
+.code
+ .makeindex "Concept index" "concept"
+ .makeindex
+.endd
+As long as the processing software can handle multiple indexes, this causes two
+indexes to be generated. The first is entitled &"Concept index"&, and contains
+only those index entries that were generated by the &*.cindex*& macro. The
+second contains all index entries.
+
+. === End ===
diff --git a/3rd-party/xfpt/install-sh b/3rd-party/xfpt/install-sh
new file mode 100755
index 000000000..e9de23842
--- /dev/null
+++ b/3rd-party/xfpt/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/3rd-party/xfpt/mkinstalldirs b/3rd-party/xfpt/mkinstalldirs
new file mode 100755
index 000000000..70f983f5c
--- /dev/null
+++ b/3rd-party/xfpt/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.12.2.1 1998/12/26 17:32:14 bje Exp $
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/3rd-party/xfpt/share/stdflags b/3rd-party/xfpt/share/stdflags
new file mode 100644
index 000000000..577330cfe
--- /dev/null
+++ b/3rd-party/xfpt/share/stdflags
@@ -0,0 +1,21 @@
+. These are the standard flag definitions for xfpt.
+.
+.flag &~ "&nbsp;"
+.flag && "&amp;"
+.flag &-- "&ndash;"
+.
+.flag &' '& "<emphasis>" "</emphasis>"
+.flag &* *& "<emphasis role=""bold"">" "</emphasis>"
+.
+.flag &( )& "<command>" "</command>"
+.flag &_ _& "<filename>" "</filename>"
+.flag &[ ]& "<function>" "</function>"
+.flag &` `& "<literal>" "</literal>"
+.flag &% %& "<option>" "</option>"
+.flag &" "& "<quote>" "</quote>"
+.flag &$ $& "<varname>" "</varname>"
+.
+.flag &< >& "<" ">"
+.flag &<< >>& "<xref linkend=""" """/>"
+.
+. End
diff --git a/3rd-party/xfpt/share/stdmacs b/3rd-party/xfpt/share/stdmacs
new file mode 100644
index 000000000..03f5e572c
--- /dev/null
+++ b/3rd-party/xfpt/share/stdmacs
@@ -0,0 +1,454 @@
+. Standard macros for xfpt
+
+. Letters used for push/pop:
+. B blockquote
+. C chapter, appendix, preface, colophon
+. D display
+. F footnote
+. G figure
+. I item in list
+. L list
+. S section
+. T table
+. U subsection
+
+. =============== Standard boilerplate ===============
+
+.macro docbook
+.literal layout
+&<?xml version="1.0" encoding="UTF-8"?>&
+&<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">&
+.endmacro
+
+. =============== Large text items ===============
+
+.macro book
+.literal layout
+.push &</book&xfpt.rev;>&
+&<book>&
+.literal off
+.endmacro
+
+.macro preface "Preface"
+.literal layout
+.pop C
+.push C
+.push &</preface>&
+&<preface$=2+ id="$2"+&xfpt.rev;>&
+&<title>&$1&</title>&
+.arg 3
+&<titleabbrev>&$3&</titleabbrev>&
+.endarg
+.literal off
+.endmacro
+
+.macro endpreface
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
+.macro chapter
+.literal layout
+.pop C
+.push C
+.push &</chapter>&
+&<chapter$=2+ id="$2"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.arg 3
+&<titleabbrev>&$3&</titleabbrev>&
+.endarg
+.literal off
+.endmacro
+
+.macro endchapter
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
+.macro appendix
+.literal layout
+.pop C
+.push C
+.push &</appendix>&
+&<appendix$=2+ id="$2"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.arg 3
+&<titleabbrev>&$3&</titleabbrev>&
+.endarg
+.literal off
+.endmacro
+
+.macro endappendix
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
+.macro colophon "Colophon"
+.literal layout
+.pop C
+.push C
+.push &</colophon>&
+&<colophon$=2+ id="$2"+&xfpt.rev;>&
+&<title>&$1&</title>&
+.arg 3
+&<titleabbrev>&$3&</titleabbrev>&
+.endarg
+.literal off
+.endmacro
+
+.macro endcolophon
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
+.macro section
+.literal layout
+.pop S
+.push S &</section>&
+&<section$=2+ id="$2"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.arg 3
+&<titleabbrev>&$3&</titleabbrev>&
+.endarg
+.literal off
+.endmacro
+
+.macro endsection
+.literal layout
+.pop S
+.push S
+.literal off
+.endmacro
+
+.macro subsection
+.literal layout
+.pop U
+.push U &</section>&
+&<section$=2+ id="$2"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.arg 3
+&<titleabbrev>&$3&</titleabbrev>&
+.endarg
+.literal off
+.endmacro
+
+.macro endsubsection
+.literal layout
+.pop U
+.push U
+.literal off
+.endmacro
+
+. =============== Lists ===============
+
+.macro ilist
+.literal layout
+.push L "&</itemizedlist>&" check
+.push I &</listitem>&
+&<itemizedlist$=1/ mark="$1"/&xfpt.rev;>&
+&<listitem>&
+.literal off
+.endmacro
+
+.macro olist "arabic"
+.literal layout
+.push L "&</orderedlist>&" check
+.push I &</listitem>&
+&<orderedlist numeration="$1"&xfpt.rev;>&
+&<listitem>&
+.literal off
+.endmacro
+
+.macro next
+.literal layout
+.pop I
+.push I &</listitem>&
+&<listitem>&
+.literal off
+.endmacro
+
+.macro endlist
+.literal layout
+.pop L
+.literal off
+.endmacro
+
+.macro vlist
+.literal layout
+.push L "&</variablelist>&" check
+&<variablelist&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.literal off
+.endmacro
+
+.macro vitem
+.literal layout
+.pop I
+.push I &</listitem>&&</varlistentry>&
+&<varlistentry&xfpt.rev;>&
+.eacharg
+&<term>&$+1&</term>&
+.endeach
+&<listitem>&
+.literal off
+.endmacro
+
+. =============== Displayed text ===============
+
+.macro display
+.literal layout
+.push D "&</literallayout>&" check
+&<literallayout&xfpt.rev;>&
+.endmacro
+
+.macro code
+.literal layout
+.push D "&</literallayout>&" check
+&<literallayout class="monospaced"&xfpt.rev;>&
+.literal text
+.endmacro
+
+.macro endd
+.literal layout
+.pop D
+.literal off
+.endmacro
+
+. =============== Block quotes ===============
+
+.macro blockquote
+.literal layout
+.push B "&</blockquote>&" check
+&<blockquote&xfpt.rev;>&
+.literal off
+.endmacro
+
+.macro endblockquote
+.literal layout
+.pop B
+.literal off
+.endmacro
+
+. =============== Tables ===============
+
+.macro itable "none" "0" "0" "2"
+.literal layout
+.push T "&</informaltable>&" check
+&<informaltable frame="$1"&xfpt.rev;>&
+&<tgroup cols="$4" colsep="$2" rowsep="$3">&
+.eacharg 5
+&<colspec colwidth="$+1" align="$+2"/>&
+.endeach 2
+&<tbody>&
+.endmacro
+
+.macro table "title" "ref" "none" "0" "0" "2"
+.literal layout
+.push T "&</table>&" check
+&<table$=2+ id="$2"+ $=3+frame="$3"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+&<tgroup cols="$6" colsep="$4" rowsep="$5">&
+.eacharg 7
+&<colspec colwidth="$+1" align="$+2"/>&
+.endeach 2
+&<tbody>&
+.endmacro
+
+.macro row
+.literal layout
+&<row>&
+.eacharg
+&<entry>&$+1&</entry>&
+.endeach
+&</row>&
+.endmacro
+
+.macro endtable
+.literal layout
+&</tbody>&
+&</tgroup>&
+.pop T
+.literal off
+.endmacro
+
+. =============== Indexing ===============
+
+.macro index
+&<indexterm>&
+&<primary>&$1&</primary>&
+.arg 2
+&<secondary>&$2&</secondary>&
+.endarg
+&</indexterm>&
+.endmacro
+
+.macro index-from
+&<indexterm id="$1" class="startofrange">&
+&<primary>&$2&</primary>&
+.arg 3
+&<secondary>&$3&</secondary>&
+.endarg
+&</indexterm>&
+.endmacro
+
+.macro index-to
+&<indexterm startref="$1" class="endofrange"/>&
+.endmacro
+
+.macro index-see
+&<indexterm>&
+&<primary>&$2&</primary>&
+.arg 3
+&<secondary>&$3&</secondary>&
+.endarg
+&<see>&$1&</see>&
+&</indexterm>&
+.endmacro
+
+.macro index-seealso
+&<indexterm>&
+&<primary>&$2&</primary>&
+.arg 3
+&<secondary>&$3&</secondary>&
+.endarg
+&<seealso>&$1&</seealso>&
+&</indexterm>&
+.endmacro
+
+.macro makeindex "Index"
+.literal layout
+.pop C
+.push C
+.push &</index>&
+.arg -2
+&<index>&
+.endarg
+.arg 2
+&<index role="$2">&
+.endarg
+&<title>&$1&</title>&
+.literal off
+.endmacro
+
+. =============== URL ===============
+
+.macro url
+.arg -2
+&*&<ulink url="$1">&$1&</ulink>&*&
+.endarg
+.arg 2
+&*&<ulink url="$1">&$2&</ulink>&*&
+.endarg
+.endmacro
+
+. =============== Change flags ===============
+
+.macro new
+.arg -1
+.inliteral off
+.literal layout
+.revision changed
+.literal off
+.endinliteral
+.inliteral layout
+.nonl '&<phrase revisionflag="changed">&'
+.endinliteral
+.inliteral text
+.literal layout
+.nonl '&<phrase revisionflag="changed">&'
+.literal text
+.endinliteral
+.endarg
+.arg 1
+&<phrase revisionflag="changed">&$1&</phrase>&
+.endmacro
+
+.macro wen
+.inliteral off
+.literal layout
+.revision off
+.literal off
+.endinliteral
+.inliteral layout
+.nonl &</phrase>&
+.endinliteral
+.inliteral text
+.literal layout
+.nonl &</phrase>&
+.literal text
+.endinliteral
+.endmacro
+
+. =============== Footnotes ===============
+
+.macro footnote
+&<footnote>&
+.push F "&</footnote>&" check
+.nest begin
+.endmacro
+
+.macro endnote
+.nest end
+.pop F
+.endmacro
+
+. =============== Figures ===============
+
+.macro figure
+.literal layout
+.push G "&</figure>&" check
+&<figure$=2+ id="$2"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.literal off
+.endmacro
+
+.macro endfigure
+.literal layout
+.pop G
+.literal off
+.endmacro
+
+. =============== Images ===============
+
+. This is a complete image wrapped inside a <mediaobject>.
+.
+.macro image
+.literal layout
+&<mediaobject>&&<imageobject>&
+&<imagedata fileref="$1" $=2+ scale="$2"+$=3+ align="$3"+&&&
+ $=4+ depth="$4"+$=5+ width="$5"+>&&&&
+&</imagedata>&&</imageobject>&&</mediaobject>&
+.literal off
+.endmacro
+
+. =============== Processing instructions =============
+
+.macro pi
+.literal layout
+&<?$1 $2?>&
+.literal off
+.endmacro
+
+. End
diff --git a/3rd-party/xfpt/src/Makefile b/3rd-party/xfpt/src/Makefile
new file mode 100644
index 000000000..b34184d9e
--- /dev/null
+++ b/3rd-party/xfpt/src/Makefile
@@ -0,0 +1,51 @@
+# Unix base make file for xfpt.
+
+# The normal targets in this Makefile are not called directly, but should be
+# called from the top-level Makefile. To make it easy when developing from
+# within the source directory, a call with no target gets passed back up to
+# the outer Makefile.
+
+intcall:; cd ..; $(MAKE);
+
+# This is the main target
+
+all: xfpt
+
+# Compile step for the modules
+
+.SUFFIXES: .o .c
+.c.o:; @echo "$(CC) $*.c"
+ $(FE)$(CC) -c $(CFLAGS) -DDATADIR='"$(DATADIR)"' $*.c
+
+# List of general dependencies
+
+DEP = ../Makefile Makefile xfpt.h structs.h functions.h globals.h mytypes.h
+
+# Object module list for xfpt
+
+SDOBJ = dot.o error.o globals.o literal.o misc.o para.o read.o tree.o xfpt.o
+
+# Link step
+
+xfpt : $(SDOBJ)
+ @echo "$(CC) -o xfpt"
+ $(FE)$(CC) $(LFLAGS) $(EFENCE) -o xfpt $(SDOBJ)
+ @echo ">>> xfpt command built"; echo ""
+
+# Dependencies
+
+dot.o: $(DEP) dot.c
+error.o: $(DEP) error.c
+globals.o: $(DEP) globals.c
+literal.o: $(DEP) literal.c
+misc.o: $(DEP) misc.c
+para.o: $(DEP) para.c
+read.o: $(DEP) read.c
+tree.o: $(DEP) tree.c
+xfpt.o: $(DEP) xfpt.c
+
+# Clean up etc
+
+clean:; /bin/rm -f *.o
+
+# End
diff --git a/3rd-party/xfpt/src/dot.c b/3rd-party/xfpt/src/dot.c
new file mode 100644
index 000000000..6bad490bd
--- /dev/null
+++ b/3rd-party/xfpt/src/dot.c
@@ -0,0 +1,906 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2008 */
+/* Written by Philip Hazel. */
+
+/* This module contains code for processing a line that starts with a dot. */
+
+#include "xfpt.h"
+
+
+
+/*************************************************
+* Static variables *
+*************************************************/
+
+static uschar *circumflexes =
+ US"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
+static uschar *spaces =
+ US" ";
+static uschar *thisdir = NULL;
+
+
+
+/*************************************************
+* Read a single number argument *
+*************************************************/
+
+/* Several directives take just a single number as an argument.
+
+Argument: pointer in the input line
+Returns: the number, or -1 on error
+*/
+
+static int
+readnumber(uschar *p)
+{
+int n = 0;
+if (!isdigit(*p)) { error(11, thisdir); return -1; }
+while (isdigit(*p)) n = n * 10 + *p++ - '0';
+while (isspace(*p)) p++;
+if (*p != 0) { error(11, thisdir); return -1; }
+return n;
+}
+
+
+
+/*************************************************
+* Skip macro lines *
+*************************************************/
+
+/* This function skips to the end of the current macro or to the given
+terminator line. It is called only when we know we are in a macro. The current
+macro line is the conditional directive.
+
+Arguments:
+ s the conditional directive
+ t the terminator directive
+Returns: nothing
+*/
+
+static void
+skipto(uschar *s, uschar *t)
+{
+int nest = -1;
+int slength = Ustrlen(s);
+int tlength = Ustrlen(t);
+BOOL done = macrocurrent->nextline == NULL;
+while (!done)
+ {
+ uschar *p = macrocurrent->nextline->string;
+ done = Ustrncmp(p, t, tlength) == 0 &&
+ (p[tlength] == 0 || isspace(p[tlength])) &&
+ nest-- <= 0;
+ if (Ustrncmp(p, s, slength) == 0 && (p[slength] == 0 || isspace(p[slength])))
+ nest++;
+ macrocurrent->nextline = macrocurrent->nextline->next;
+ if (macrocurrent->nextline == NULL)
+ {
+ macroexe *temp = macrocurrent;
+ macrocurrent = macrocurrent->prev;
+ free(temp);
+ from_type_ptr--;
+ break;
+ }
+ }
+}
+
+
+
+/*************************************************
+* Handle .arg *
+*************************************************/
+
+/* The .arg directive is permitted only within a macro. It must be followed by
+a positive or negative number. For a positive number, if an argument of that
+number was given to the macro and is not an empty string, nothing happens.
+Otherwise, the macro's input is skipped, either to .endarg or to the end of the
+macro. For a negative number, the test is reversed: nothing happens if that
+argument was not given or is empty.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_arg(uschar *p)
+{
+BOOL mustexist = TRUE;
+argstr *arg;
+int i, argn;
+
+if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".arg"); return; }
+
+if (*p == '-')
+ {
+ mustexist = FALSE;
+ p++;
+ }
+
+argn = readnumber(p);
+if (argn < 0) return;
+
+arg = macrocurrent->args;
+for (i = 1; arg != NULL && i < argn; i++) arg = arg->next;
+
+if (mustexist != (arg != NULL && arg->string[0] != 0))
+ skipto(US".arg", US".endarg");
+}
+
+
+
+/*************************************************
+* Handle .eacharg *
+*************************************************/
+
+/* This may be followed by a number to specify which argument to start at. The
+lines between this and ".endeach" are repeated for each argument.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_eacharg(uschar *p)
+{
+argstr *arg;
+int argn, i;
+
+if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".eacharg"); return; }
+
+argn = (*p == 0)? 1 : readnumber(p);
+if (argn < 0) return;
+
+arg = macrocurrent->args;
+for (i = 1; arg != NULL && i < argn; i++) arg = arg->next;
+
+/* If we did not find the starting argument, skip. Otherwise, set up the
+substitution for relative arguments, and remember where to come back to. */
+
+if (arg == NULL) skipto(US"eacharg", US".endeach"); else
+ {
+ macro_argbase = arg;
+ macro_starteach = macrocurrent->nextline;
+ }
+}
+
+
+
+/*************************************************
+* Handle .echo *
+*************************************************/
+
+/* This directive provides a debugging and commenting facility.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_echo(uschar *p)
+{
+(void)fprintf(stderr, "%s\n", p);
+}
+
+
+
+/*************************************************
+* Handle .endarg *
+*************************************************/
+
+/* We only hit this as a stand-alone directive when the argument exists and the
+previous lines have been obeyed. There is nothing to do.
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_endarg(uschar *p)
+{
+if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".endarg"); return; }
+if (*p != 0) error(19, ".endarg", p, 8, spaces, Ustrlen(p), circumflexes);
+}
+
+
+
+/*************************************************
+* Handle .endeach *
+*************************************************/
+
+/* This marks the end of an ".eacharg" section of lines. Advance the relative
+argument base pointer by the given number (default 1). If there are still some
+arguments left, repeat the section.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_endeach(uschar *p)
+{
+int count;
+
+if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".endeach"); return; }
+
+count = (*p == 0)? 1 : readnumber(p);
+if (count < 0) return;
+
+while (count-- > 0 && macro_argbase != NULL)
+ macro_argbase = macro_argbase->next;
+
+if (macro_argbase == NULL) macro_starteach = NULL;
+ else macrocurrent->nextline = macro_starteach;
+}
+
+
+
+
+/*************************************************
+* Handle .endinliteral *
+*************************************************/
+
+/* We only hit this as a stand-alone directive when in a literal section and
+the previous lines have been obeyed. There is nothing to do.
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_endinliteral(uschar *p)
+{
+if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".endinliteral"); return; }
+if (*p != 0) error(19, ".endinliteral", p, 8, spaces, Ustrlen(p), circumflexes);
+}
+
+
+
+/*************************************************
+* Handle .flag *
+*************************************************/
+
+/* The .flag directive defines either a single flag (starting with &) or a pair
+of flags, the first of which must start with &. We put the data into a block
+that's added to the flaglist chain. We have to cope with all these (example)
+possibilities:
+
+ .flag &+ "stuff"
+ .flag &" "stuff"
+ .flag &" "& "stuff1" "stuff2"
+
+Argument: the rest of the command line
+Returns: nothing
+*/
+
+static void
+do_flag(uschar *p)
+{
+uschar *pp, *q;
+int length, term;
+flagstr *f, **ff;
+
+f = misc_malloc(sizeof(flagstr));
+
+/* Check that the flag starts with & and then get a copy of the rest of it. */
+
+if (*p++ != '&') { error(9); return; }
+
+for (pp = p; *pp != 0 && !isspace(*pp); pp++);
+length = pp - p;
+if (length == 0) { error(10); return; }
+
+f->length1 = length;
+f->flag1 = misc_copystring(p, length);
+
+/* Now look backwards from the end of the line and find the last quoted string
+that is there. */
+
+q = pp + Ustrlen(pp);
+if (*(--q) != '\"' && *q != '\'') { error(11, thisdir); return; }
+
+term = *q;
+while (--q > pp)
+ {
+ if (*q == term) { if (q[-1] == term) q--; else break; }
+ }
+
+if (q <= pp) { error(11, thisdir); return; }
+
+/* If there's nothing between pp and q, we have the definition of a single,
+non-paired flag. */
+
+while (isspace(*pp)) pp++;
+if (pp == q)
+ {
+ f->rep1 = misc_readstring(q, NULL, NULL, 0);
+ f->length2 = 0;
+ f->flag2 = f->rep2 = NULL;
+ }
+
+/* Otherwise, we are dealing with a pair of flags. */
+
+else
+ {
+ f->rep2 = misc_readstring(q, NULL, NULL, 0);
+ p = pp;
+ while (*pp != 0 && !isspace(*pp)) pp++;
+ length = pp - p;
+ if (length == 0) { error(10); return; }
+ f->length2 = length;
+ f->flag2 = misc_copystring(p, length);
+ while (isspace(*pp)) pp++;
+ if (*pp != '\"' && *pp != '\'') { error(11, thisdir); return; }
+ f->rep1 = misc_readstring(pp, &length, NULL, 0);
+ if (pp + length >= q) { error(11, thisdir); return; }
+ }
+
+/* Successfully defined the flag(s). Attach the block to the chain. The order
+is not defined, except that the longer (initial) flag comes first. */
+
+ff = &flaglist;
+while (*ff != NULL && f->length1 < (*ff)->length1) ff = &((*ff)->next);
+f->next = *ff;
+*ff = f;
+}
+
+
+/*************************************************
+* Handle .include *
+*************************************************/
+
+/* Add to the stack of included files and push a new input type onto the
+from_type stack.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_include(uschar *p)
+{
+istackstr *ist;
+
+ist = misc_malloc(sizeof(istackstr));
+ist->prev = istack;
+istack = ist;
+ist->linenumber = 0;
+
+if (Ustrchr(p, '/') != NULL) Ustrcpy(ist->filename, p);
+ else sprintf(CS ist->filename, "%s/%s", xfpt_share, p);
+
+ist->file = Ufopen(ist->filename, "rb");
+if (ist->file == NULL) error(0, ist->filename, strerror(errno)); /* Hard */
+
+from_type[++from_type_ptr] = FROM_FILE;
+}
+
+
+
+/*************************************************
+* Handle .inliteral *
+*************************************************/
+
+/* The .inliteral directive is permitted only within a macro. If we are
+handling the appropriate kind of literal text, nothing happens. Otherwise, the
+macro's input is skipped, either to .endinliteral or to the end of the macro.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_inliteral(uschar *p)
+{
+int state = -1;
+if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".inliteral"); return; }
+if (Ustrcmp(p, "layout") == 0) state = LITERAL_LAYOUT;
+else if (Ustrcmp(p, "text") == 0) state = LITERAL_TEXT;
+else if (Ustrcmp(p, "off") == 0) state = LITERAL_OFF;
+else if (Ustrcmp(p, "xml") == 0) state = LITERAL_XML;
+else error(5, p);
+if (literal_state != state) skipto(US"inliteral", US".endinliteral");
+}
+
+
+
+
+/*************************************************
+* Handle .literal *
+*************************************************/
+
+/*
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_literal(uschar *p)
+{
+if (Ustrcmp(p, "layout") == 0) literal_state = LITERAL_LAYOUT;
+else if (Ustrcmp(p, "text") == 0) literal_state = LITERAL_TEXT;
+else if (Ustrcmp(p, "off") == 0) literal_state = LITERAL_OFF;
+else if (Ustrcmp(p, "xml") == 0) literal_state = LITERAL_XML;
+else error(5, p);
+}
+
+
+/*************************************************
+* Handle .macro *
+*************************************************/
+
+/* We set up a macro definition, whose contents are all the following lines,
+uninterpreted, until we reach .endmacro.
+
+Argument: the rest of the .macro line
+Returns: nothing
+*/
+
+static void
+do_macro(uschar *p)
+{
+int length;
+int nest = 0;
+argstr **pp;
+macrodef *md = misc_malloc(sizeof(macrodef));
+
+md->name = misc_readitem(p, NULL, &length, NULL, 0);
+md->namelength = Ustrlen(md->name);
+p += length;
+
+if (length == 0)
+ {
+ error(14);
+ return;
+ }
+
+md->lines = md->args = NULL;
+md->next = macrolist;
+macrolist = md;
+
+pp = &(md->args);
+while (*p != 0)
+ {
+ argstr *as = misc_malloc(sizeof(argstr));
+ as->next = NULL;
+ *pp = as;
+ pp = &(as->next);
+ as->string = misc_readitem(p, NULL, &length, NULL, 0);
+ p += length;
+ }
+
+pp = &(md->lines);
+for (;;)
+ {
+ argstr *as;
+ uschar *line = read_nextline();
+ if (line == NULL) { error(13, ".endmacro"); return; }
+
+ if (Ustrncmp(line, ".macro ", 7) == 0) nest++;
+ else if (Ustrncmp(line, ".endmacro", 9) == 0)
+ {
+ if (isspace(line[9]) || line[9] == '\n')
+ if (--nest < 0) break;
+ }
+
+ as = misc_malloc(sizeof(argstr));
+ as->next = NULL;
+ *pp = as;
+ pp = &(as->next);
+ as->string = misc_copystring(line, Ustrlen(line));
+ }
+
+/* If there aren't any replacement lines, fake up a comment so that there's
+always something for a macro to generate. */
+
+if (md->lines == NULL)
+ {
+ md->lines = misc_malloc(sizeof(argstr));
+ md->lines->next = NULL;
+ md->lines->string = misc_copystring(US". Dummy line\n", 13);
+ }
+}
+
+
+
+/*************************************************
+* Handle .nest *
+*************************************************/
+
+/* This processing happens when .nest is encountered when not in the middle of
+reading a normal paragraph. That is, it's either between paragraphs or in a
+literal section. Otherwise .nest is handled in read_paragraph().
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_nest(uschar *p)
+{
+if (Ustrcmp(p, "begin") == 0)
+ {
+ if (nest_level >= MAXNEST) error(27); else
+ {
+ nest_literal_stack[nest_level++] = literal_state;
+ literal_state = LITERAL_OFF;
+ }
+ }
+else if (Ustrcmp(p, "end") == 0)
+ {
+ if (nest_level <= 0) error(28);
+ else literal_state = nest_literal_stack[--nest_level];
+ }
+else error(26, p);
+}
+
+
+
+
+/*************************************************
+* Handle .nonl *
+*************************************************/
+
+/* The argument is handled as a line without a terminating newline by putting
+it into a buffer and pointing next_line at it.
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_nonl(uschar *p)
+{
+static uschar nonlbuffer[INBUFFSIZE];
+int len = Ustrlen(p) + 1;
+if (len > INBUFFSIZE) len = INBUFFSIZE;
+Ustrncpy(nonlbuffer, p, len);
+next_line = nonlbuffer;
+}
+
+
+/*************************************************
+* Handle .pop *
+*************************************************/
+
+/* This may optionally be followed by an upper case letter identifier. This
+causes a search down the stack for an item with that letter. If one is found,
+we arrange for the stack to pop back to it. If not, nothing happens. If no
+letter is specified, arrange to pop just one item.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_pop(uschar *p)
+{
+pushstr *ps;
+
+if (*p == 0)
+ {
+ popto = 0;
+ return;
+ }
+
+if (!isupper(*p) || p[1] != 0) { error(11, thisdir); return; }
+
+for (ps = pushed; ps != NULL; ps = ps->next)
+ { if (ps->letter == *p) break; }
+
+if (ps != NULL) popto = *p;
+}
+
+
+
+/*************************************************
+* Handle .push *
+*************************************************/
+
+/* This directive pushes the rest of the line onto a stack. If the first thing
+on the line is a single upper case letter followed by space, we set that as the
+stack marker letter. Following that we either have a quoted item, or the rest
+of the line unquoted. After a quoted item, the word "check" means we should
+record the base file line number for a warning if the item is not popped by the
+end of the input.
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_push(uschar *p)
+{
+int length;
+int letter = 0;
+int check = 0;
+pushstr *ps;
+uschar *macname = NULL;
+uschar *porig = p;
+uschar buffer[INBUFFSIZE];
+
+if (isupper(*p) && (p[1] == 0 || isspace(p[1])))
+ {
+ letter = *p++;
+ while (isspace(*p)) p++;
+ }
+
+if (*p == '"')
+ {
+ uschar *s = misc_readitem(p, NULL, &length, buffer, INBUFFSIZE);
+ p += length;
+ while (isspace(*p)) p++;
+ if (Ustrncmp(p, "check", 5) == 0 && (p[5] == 0 || isspace(p[5])))
+ {
+ p += 5;
+ while (isspace(*p)) p++;
+ check = istackbase->linenumber;
+ if (from_type[from_type_ptr] == FROM_MACRO)
+ macname = macrocurrent->macro->name;
+ }
+ if (*p != 0) error(19, ".push", porig, p - porig + 6, spaces, Ustrlen(p),
+ circumflexes);
+ p = s;
+ }
+
+length = Ustrlen(p);
+ps = misc_malloc(sizeof(pushstr) + length);
+ps->letter = letter;
+ps->check = check;
+ps->macname = macname;
+memcpy(ps->string, p, length);
+ps->string[length] = 0;
+ps->next = pushed;
+pushed = ps;
+}
+
+
+
+
+/*************************************************
+* Handle .revision *
+*************************************************/
+
+/* Set or unset a text for <revisionflag= in many elements. If the text if
+"off", treat it as empty.
+
+Arguments: a single argument string
+Returns: nothing
+*/
+
+static void
+do_revision(uschar *p)
+{
+if (revision != NULL)
+ {
+ free(revision);
+ revision = NULL;
+ }
+
+if (*p != 0 && Ustrcmp(p, "off") != 0)
+ {
+ revision = misc_malloc(Ustrlen(p) + 1);
+ Ustrcpy(revision, p);
+ }
+}
+
+
+
+
+/*************************************************
+* Handle .set *
+*************************************************/
+
+/* Set the value of a locally-defined entity.
+
+Arguments: the rest of the command line
+Returns: nothing
+*/
+
+static void
+do_set(uschar *p)
+{
+int length;
+tree_node *t;
+uschar *porig = p;
+uschar buffer[INBUFFSIZE];
+uschar *name = misc_readitem(p, NULL, &length, buffer, INBUFFSIZE);
+
+p += length;
+while (isspace(*p)) p++;
+
+t = misc_malloc(sizeof(tree_node) + Ustrlen(name));
+Ustrcpy(t->name, name);
+
+t->data = misc_readitem(p, NULL, &length, NULL, 0);
+
+p += length;
+while (isspace(*p)) p++;
+if (*p != 0) error(19, ".set", porig, p - porig + 5, spaces, Ustrlen(p),
+ circumflexes);
+
+if (!tree_insertnode(&entities, t)) error(21, name);
+}
+
+
+
+/*************************************************
+* Table of directives *
+*************************************************/
+
+/* Quite a few directives have a single argument that can either be quoted, or
+just the rest of the line. These are flagged up so that the code to read that
+argument can be central. Only those directives that control macro behaviour are
+permitted in macros that are called inline. */
+
+typedef struct dirstr {
+ uschar *name;
+ int length;
+ void (*function)(uschar *);
+ BOOL onearg;
+ BOOL okinline;
+} dirstr;
+
+
+static dirstr dirs[] = {
+ { US".arg", 4, do_arg, TRUE, TRUE },
+ { US".eacharg", 8, do_eacharg, TRUE, TRUE },
+ { US".echo", 5, do_echo, TRUE, FALSE },
+ { US".endarg", 7, do_endarg, FALSE, TRUE },
+ { US".endeach", 8, do_endeach, TRUE, TRUE },
+ { US".endinliteral", 13, do_endinliteral, FALSE, TRUE },
+ { US".flag", 5, do_flag, FALSE, FALSE },
+ { US".include", 8, do_include, TRUE, FALSE },
+ { US".inliteral", 10, do_inliteral, TRUE, TRUE },
+ { US".literal", 8, do_literal, TRUE, FALSE },
+ { US".macro", 6, do_macro, FALSE, FALSE },
+ { US".nest", 5, do_nest, TRUE, FALSE },
+ { US".nonl", 5, do_nonl, TRUE, FALSE },
+ { US".pop", 4, do_pop, TRUE, FALSE },
+ { US".push", 5, do_push, FALSE, FALSE },
+ { US".revision", 9, do_revision, TRUE, FALSE },
+ { US".set", 4, do_set, FALSE, FALSE },
+};
+
+static int cmdcount = sizeof(dirs)/sizeof(dirstr);
+
+
+/*************************************************
+* Process a line starting with a dot *
+*************************************************/
+
+/* There are a small number of built-in commands, but many more may be defined
+as macros. When we are in literal text or literal xml states, unknown lines
+starting with dot are treated as data.
+
+Argument: the line to be processed
+Returns: nothing
+*/
+
+void
+dot_process(uschar *p)
+{
+macrodef *md;
+macroexe *me;
+argstr **pp;
+int top, bot, length;
+
+thisdir = p; /* Save for error messages */
+
+misc_detrail(p);
+
+if (p[1] == 0 || isspace(p[1])) return; /* Comment */
+
+/* Seek a built-in directive by binary chop. */
+
+bot = 0;
+top = cmdcount;
+
+while (top > bot)
+ {
+ int c;
+ int mid = (top + bot)/2;
+ dirstr *dir = dirs + mid;
+
+ length = dir->length;
+ c = Ustrncmp(p, dir->name, length);
+
+ /* Found a built-in directive; if it takes a single argument, read it here
+ to avoid repeating the code in the individual directive functions. If there
+ is text after the argument, give a warning. */
+
+ if (c == 0 && (p[length] == 0 || isspace(p[length])))
+ {
+ uschar buffer[INBUFFSIZE];
+ p += length;
+ while (isspace(*p)) p++;
+
+ if (dir->onearg)
+ {
+ int alength;
+ uschar *s = misc_readitem(p, NULL, &alength, buffer, INBUFFSIZE);
+ if (p[alength] != 0)
+ error(19, dir->name, p, alength + length + 1, spaces,
+ Ustrlen(p) - alength, circumflexes);
+ p = s;
+ }
+
+ /* If we are in an inline macro, only certain directives are permitted */
+
+ if (para_inline_macro == 0 || dir->okinline) (dir->function)(p);
+ else error(22, dir->name);
+
+ return; /* Dealt with this directive line */
+ }
+
+ /* No match; do the chop and continue */
+
+ if (c < 0) top = mid; else bot = mid + 1;
+ }
+
+/* If we can't match a built-in directive, we normally seek a macro. However,
+this is not permitted if we are already expanding an inline macro call. */
+
+if (para_inline_macro > 0)
+ {
+ error(22, p);
+ return;
+ }
+
+for (md = macrolist; md != NULL; md = md->next)
+ {
+ length = md->namelength;
+ if (Ustrncmp(p+1, md->name, length) == 0 &&
+ (p[length+1] == 0 || isspace(p[length+1])))
+ {
+ p += length + 1;
+ break;
+ }
+ }
+
+/* Could not find a macro. In literal text and xml states, treat as data. Note
+that the newline has been removed. */
+
+if (md == NULL)
+ {
+ switch(literal_state)
+ {
+ case LITERAL_TEXT:
+ case LITERAL_XML:
+ fprintf(outfile, "%s\n", CS p);
+ break;
+
+ default:
+ error(2, p);
+ break;
+ }
+ return;
+ }
+
+/* Found a macro. Add it to the chain, and set the input type. */
+
+me = misc_malloc(sizeof(macroexe));
+me->prev = macrocurrent;
+macrocurrent = me;
+me->macro = md;
+me->nextline = md->lines;
+from_type[++from_type_ptr] = FROM_MACRO;
+
+me->args = NULL;
+pp = &(me->args);
+
+while (isspace(*p)) p++;
+while (*p != 0)
+ {
+ argstr *as = misc_malloc(sizeof(argstr));
+ as->next = NULL;
+ *pp = as;
+ pp = &(as->next);
+ as->string = misc_readitem(p, NULL, &length, NULL, 0);
+ p += length;
+ }
+}
+
+/* End of dot.c */
diff --git a/3rd-party/xfpt/src/error.c b/3rd-party/xfpt/src/error.c
new file mode 100644
index 000000000..b82eea806
--- /dev/null
+++ b/3rd-party/xfpt/src/error.c
@@ -0,0 +1,186 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2012 */
+/* Written by Philip Hazel. */
+
+/* Error handling routines */
+
+#include "xfpt.h"
+
+
+/* Error codes */
+
+#define ec_noerror 0
+#define ec_warning 1
+#define ec_serious 2
+#define ec_failed 3
+#define ec_disaster 4
+
+
+/*************************************************
+* Static variables *
+*************************************************/
+
+static int error_count = 0;
+static int warning_count = 0;
+
+
+
+/*************************************************
+* Texts and return codes *
+*************************************************/
+
+typedef struct {
+ char ec;
+ const char *text;
+} error_struct;
+
+
+static error_struct error_data[] = {
+
+/* 0-4 */
+{ ec_disaster, "failed to open %s: %s" },
+{ ec_disaster, "malloc failed: requested %d bytes" },
+{ ec_serious, "unknown directive line: %s" },
+{ ec_serious, "missing semicolon after \"&%.*s\"" },
+{ ec_serious, "unexpected character \"%c\" after \"&#\"" },
+/* 5-9 */
+{ ec_serious, "\"layout\", \"text\", \"xml\", or \"off\" expected, but \"%s\" found" },
+{ ec_serious, "unknown flag \"&%c\"" },
+{ ec_serious, "missing closing flag %s" },
+{ ec_serious, "flag nesting error: \"%s\" expected before \"%s\"" },
+{ ec_serious, "a flag must begin with \"&\"" },
+/* 10-14 */
+{ ec_serious, "a flag must contain more than just \"&\"" },
+{ ec_serious, "malformed directive\n %s" },
+{ ec_serious, "line stack is empty" },
+{ ec_serious, "missing %s at end of file" },
+{ ec_serious, "a macro must be given a name" },
+/* 15-19 */
+{ ec_serious, "%s is permitted only inside a macro" },
+{ ec_serious, "unexpected %s" },
+{ ec_serious, "bad macro argument substitution: \"%c\" follows \"%s\"" },
+{ ec_serious, "relative macro argument not in \"eacharg\" section" },
+{ ec_warning, "extra characters at end of directive\n"
+ " %s %s\n %.*s%.*s" },
+/* 20-24 */
+{ ec_disaster, "string too long for internal buffer (%d > %d)" },
+{ ec_serious, "entity \"%s\" has already been defined" },
+{ ec_serious, "\"%s\" is not permitted in an inline macro call" },
+{ ec_serious, "unknown macro \"%.*s\" in inline macro call" },
+{ ec_serious, "missing closing parenthesis in inline macro call:\n %s" },
+/* 25-29 */
+{ ec_serious, "ampersand found at end of line or string - ignored" },
+{ ec_serious, "\"begin\" or \"end\" expected, but \"%s\" found" },
+{ ec_serious, "\".nest begin\" too deeply nested" },
+{ ec_serious, "\".nest end\" incorrectly nested" }
+};
+
+#define error_maxerror 28
+
+
+
+/*************************************************
+* Error message generator *
+*************************************************/
+
+/* This function output an error or warning message, and may abandon the
+process if the error is sufficiently serious, or if there have been too many
+less serious errors. If there are too many warnings, subsequent ones are
+suppressed.
+
+Arguments:
+ n error number
+ ... arguments to fill into message
+
+Returns: nothing, but some errors do not return
+*/
+
+void
+error(int n, ...)
+{
+int ec, i;
+macroexe *me;
+istackstr *fe;
+va_list ap;
+va_start(ap, n);
+
+if (n > error_maxerror)
+ {
+ (void)fprintf(stderr, "** Unknown error number %d\n", n);
+ ec = ec_disaster;
+ }
+else
+ {
+ ec = error_data[n].ec;
+ if (ec == ec_warning)
+ {
+ if (suppress_warnings) return;
+ (void)fprintf(stderr, "** Warning: ");
+ }
+ else if (ec > ec_warning)
+ (void)fprintf(stderr, "** Error: ");
+ (void)vfprintf(stderr, error_data[n].text, ap);
+ (void)fprintf(stderr, "\n");
+ }
+
+va_end(ap);
+
+me = macrocurrent;
+fe = istack;
+
+for (i = from_type_ptr; i >= 0; i--)
+ {
+ if (from_type[i] == FROM_MACRO)
+ {
+ (void)fprintf(stderr, " Processing macro %s\n", me->macro->name);
+ me = me->prev;
+ }
+ else
+ {
+ if (fe != NULL)
+ {
+ (void)fprintf(stderr, " Detected near line %d of %s\n",
+ fe->linenumber, fe->filename);
+ fe = fe->prev;
+ }
+ else
+ {
+ (void)fprintf(stderr, " Detected near end of file\n");
+ }
+ }
+ }
+
+if (ec == ec_warning)
+ {
+ warning_count++;
+ if (warning_count > 40)
+ {
+ (void)fprintf(stderr, "** Too many warnings - subsequent ones suppressed\n");
+ suppress_warnings = TRUE;
+ }
+ }
+
+else if (ec > ec_warning)
+ {
+ return_code = EXIT_FAILURE;
+ error_count++;
+ if (error_count > 40)
+ {
+ (void)fprintf(stderr, "** Too many errors\n");
+ ec = ec_failed;
+ }
+ }
+
+if (ec >= ec_failed)
+ {
+ (void)fprintf(stderr, "** xfpt abandoned\n");
+ exit(EXIT_FAILURE);
+ }
+
+(void)fprintf(stderr, "\n"); /* blank before next output */
+}
+
+/* End of error.c */
diff --git a/3rd-party/xfpt/src/functions.h b/3rd-party/xfpt/src/functions.h
new file mode 100644
index 000000000..696ba4604
--- /dev/null
+++ b/3rd-party/xfpt/src/functions.h
@@ -0,0 +1,28 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2007 */
+/* Written by Philip Hazel. */
+
+/* This header defines all the global functions. */
+
+extern void dot_process(uschar *);
+extern void error(int, ...);
+extern void literal_process(uschar *);
+extern uschar *misc_copystring(uschar *, int);
+extern void misc_detrail(uschar *);
+extern void *misc_malloc(int);
+extern uschar *misc_readitem(uschar *, uschar *, int *, uschar *, int);
+extern uschar *misc_readstring(uschar *, int *, uschar *, int);
+
+extern void para_process(uschar *);
+
+extern uschar *read_nextline(void);
+extern uschar *read_paragraph(uschar *, int *);
+extern void read_process_macroline(uschar *, uschar *);
+
+extern int tree_insertnode(tree_node **, tree_node *);
+extern tree_node *tree_search(tree_node *, uschar *);
+
+/* End of functions.h */
diff --git a/3rd-party/xfpt/src/globals.c b/3rd-party/xfpt/src/globals.c
new file mode 100644
index 000000000..2ea12003c
--- /dev/null
+++ b/3rd-party/xfpt/src/globals.c
@@ -0,0 +1,50 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2012 */
+/* Written by Philip Hazel. */
+
+/* Allocate storage and initialize global variables */
+
+#include "xfpt.h"
+
+
+uschar *xfpt_share = US DATADIR;
+uschar *xfpt_version = US "0.09 16-May-2012";
+
+tree_node *entities = NULL;
+
+flagstr *flaglist = NULL;
+int from_type[FROM_TYPE_STACKSIZE];
+int from_type_ptr = 0;
+
+uschar *inbuffer = NULL;
+istackstr *istack = NULL;
+istackstr *istackbase = NULL;
+
+int literal_state = LITERAL_OFF;
+
+int nest_level = 0;
+int nest_literal_stack[MAXNEST+1];
+uschar *next_line = NULL;
+
+macroexe *macrocurrent = NULL;
+macrodef *macrolist = NULL;
+
+argstr *macro_argbase = NULL;
+argstr *macro_starteach = NULL;
+
+FILE *outfile = NULL;
+
+int para_inline_macro = 0;
+uschar *parabuffer = NULL;
+int popto = -1;
+pushstr *pushed = NULL;
+
+int return_code = 0;
+uschar *revision = NULL;
+
+BOOL suppress_warnings = FALSE;
+
+/* End of globals.c */
diff --git a/3rd-party/xfpt/src/globals.h b/3rd-party/xfpt/src/globals.h
new file mode 100644
index 000000000..50f4850b3
--- /dev/null
+++ b/3rd-party/xfpt/src/globals.h
@@ -0,0 +1,52 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2012 */
+/* Written by Philip Hazel. */
+
+/* Header file for all the global variables */
+
+
+/*************************************************
+* General global variables *
+*************************************************/
+
+extern uschar *xfpt_share;
+extern uschar *xfpt_version;
+
+extern tree_node *entities;
+
+extern flagstr *flaglist;
+extern int from_type[];
+extern int from_type_ptr;
+
+extern uschar *inbuffer;
+extern istackstr *istack;
+extern istackstr *istackbase;
+
+extern int literal_state;
+
+extern int nest_level;
+extern int nest_literal_stack[];
+extern uschar *next_line;
+
+extern macroexe *macrocurrent;
+extern macrodef *macrolist;
+
+extern argstr *macro_argbase;
+extern argstr *macro_starteach;
+
+extern FILE *outfile;
+
+extern int para_inline_macro;
+extern uschar *parabuffer;
+extern int popto;
+extern pushstr *pushed;
+
+extern int return_code;
+extern uschar *revision;
+
+extern BOOL suppress_warnings;
+
+/* End of globals.h */
diff --git a/3rd-party/xfpt/src/literal.c b/3rd-party/xfpt/src/literal.c
new file mode 100644
index 000000000..74b90663f
--- /dev/null
+++ b/3rd-party/xfpt/src/literal.c
@@ -0,0 +1,39 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2006 */
+/* Written by Philip Hazel. */
+
+/* This module contains code for processing lines of literal text. */
+
+#include "xfpt.h"
+
+
+
+/*************************************************
+* Process a line of literal text *
+*************************************************/
+
+/* All we need to do is make sure that any & < and > characters are correctly
+escaped.
+
+Argument: the line to be processed
+Returns: nothing
+*/
+
+void
+literal_process(uschar *p)
+{
+while (*p != 0)
+ {
+ int c = *p++;
+ if (c == '&') (void)fprintf(outfile, "&amp;");
+ else if (c == '<') (void)fprintf(outfile, "&lt;");
+ else if (c == '>') (void)fprintf(outfile, "&gt;");
+ else (void)fputc(c, outfile);
+ }
+}
+
+
+/* End of literal.c */
diff --git a/3rd-party/xfpt/src/misc.c b/3rd-party/xfpt/src/misc.c
new file mode 100644
index 000000000..71f370611
--- /dev/null
+++ b/3rd-party/xfpt/src/misc.c
@@ -0,0 +1,198 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2006 */
+/* Written by Philip Hazel. */
+
+/* This module contains a number of miscellaneous small utility functions. */
+
+
+#include "xfpt.h"
+
+
+
+/*************************************************
+* Detrail a line *
+*************************************************/
+
+/* This removes all white space, including newlines, at the end of a string.
+
+Argument: the string
+Returns: nothing
+*/
+
+void
+misc_detrail(uschar *p)
+{
+uschar *q = p + Ustrlen(p);
+while (q > p && isspace(q[-1])) q--;
+*q = 0;
+}
+
+
+/*************************************************
+* Malloc with check *
+*************************************************/
+
+/* The program dies if the memory is not available.
+
+Argument: size required
+Returns: pointer
+*/
+
+void *
+misc_malloc(int size)
+{
+void *yield = malloc(size);
+if (yield == NULL) error(1, size); /* Fatal error */
+return yield;
+}
+
+
+/*************************************************
+* Copy a string into malloc memory *
+*************************************************/
+
+/*
+Arguments:
+ p pointer to start
+ length length
+
+Returns: pointer to the copied string
+*/
+
+uschar *
+misc_copystring(uschar *p, int length)
+{
+uschar *yield = misc_malloc(length + 1);
+memcpy(yield, p, length);
+yield[length] = 0;
+return yield;
+}
+
+
+
+
+/*************************************************
+* Read string in quotes *
+*************************************************/
+
+/* Enter pointing to the opening quote, either single or double. Use
+quote-doubling to include the quote. The string is copied into a given buffer
+or to heap memory.
+
+Arguments:
+ p points to the opening quote
+ lptr if non-NULL, where to return number of characters consumed,
+ including the quotes
+ buffer NULL => get heap memory, else pointer to buffer
+ blength size of buffer
+
+Returns: pointer to the copied string
+*/
+
+uschar *
+misc_readstring(uschar *p, int *lptr, uschar *buffer, int blength)
+{
+int term = *p;
+int length;
+uschar *pp, *yield;
+
+for (pp = p + 1;; pp++)
+ {
+ if (*pp == 0) break;
+ if (*pp == term) { if (pp[1] != term) break; pp++; }
+ }
+
+length = pp - p; /* stringlength, over-estimate if any doubled */
+if (lptr != NULL) *lptr = length + 1;
+
+if (buffer == NULL)
+ {
+ yield = pp = misc_malloc(length + 1);
+ }
+else
+ {
+ if (length + 1 > blength) error(20, length + 1, blength); /* Hard */
+ yield = pp = buffer;
+ }
+
+for (++p;; p++)
+ {
+ if (*p == 0) break;
+ if (*p == term) { if (p[1] != term) break; p++; }
+ *pp++ = *p;
+ }
+
+*pp = 0;
+
+return yield;
+}
+
+
+
+/*************************************************
+* Read a possibly quoted item *
+*************************************************/
+
+/* If the item is not in quotes, it is terminated by one of a list of
+terminators, or alternatively, by white space. The number of characters
+consumed includes any trailing spaces, but not a terminator character.
+
+Arguments:
+ p pointer to the first significant character in the input
+ term if non-NULL, contains the possible terminators
+ lptr if non-NULL, where to return the number of characters consumed
+ buffer NULL => get heap memory, else pointer to buffer
+ blength size of buffer
+
+Returns: pointer to the string, in heap memory
+*/
+
+uschar *
+misc_readitem(uschar *p, uschar *term, int *lptr, uschar *buffer, int blength)
+{
+uschar *yield;
+int length;
+
+if (*p == '\"' || *p == '\'')
+ {
+ yield = misc_readstring(p, &length, buffer, blength);
+ p += length;
+ }
+
+else
+ {
+ uschar *pp = p;
+ if (term == NULL)
+ while (*p != 0 && !isspace(*p)) p++;
+ else
+ while (Ustrchr(term, *p) == NULL) p++; /* NB zero will match */
+
+ length = p - pp;
+ if (buffer == NULL)
+ {
+ yield = misc_malloc(length + 1);
+ }
+ else
+ {
+ if (length + 1 > blength) error(20, length + 1, blength); /* Hard */
+ yield = buffer;
+ }
+ memcpy(yield, pp, length);
+ yield[length] = 0;
+ }
+
+while (isspace(*p))
+ {
+ p++;
+ length++;
+ }
+
+if (lptr != NULL) *lptr = length;
+return yield;
+}
+
+
+/* End of misc.c */
diff --git a/3rd-party/xfpt/src/mytypes.h b/3rd-party/xfpt/src/mytypes.h
new file mode 100644
index 000000000..35c29a324
--- /dev/null
+++ b/3rd-party/xfpt/src/mytypes.h
@@ -0,0 +1,96 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2006 */
+/* Written by Philip Hazel. */
+
+/* This header file contains type definitions and macros that I use as
+"standard" in the code of xfpt. */
+
+#ifndef MYTYPES_H
+#define MYTYPES_H
+
+#define FALSE 0
+#define TRUE 1
+
+
+/* If gcc is being used to compile xfpt, we can use its facility for checking
+the arguments of printf-like functions. This is done by a macro. */
+
+#ifdef __GNUC__
+#define PRINTF_FUNCTION __attribute__((format(printf,1,2)))
+#else
+#define PRINTF_FUNCTION
+#endif
+
+
+/* Some operating systems (naughtily, imo) include a definition for "uchar" in
+the standard header files, so we use "uschar". Solaris has u_char in
+sys/types.h. This is just a typing convenience, of course. */
+
+typedef int BOOL;
+typedef unsigned char uschar;
+
+
+/* These macros save typing for the casting that is needed to cope with the
+mess that is "char" in ISO/ANSI C. Having now been bitten enough times by
+systems where "char" is actually signed, I use entirely unsigned chars, except
+in a few special places such as arguments that are almost always literal
+strings. */
+
+#define CS (char *)
+#define CCS (const char *)
+#define CSS (char **)
+#define US (unsigned char *)
+#define CUS (const unsigned char *)
+#define USS (unsigned char **)
+
+/* The C library string functions expect "char *" arguments. Use macros to
+avoid having to write a cast each time. We do this for string and file
+functions that are called quite often; for other calls to external libraries
+(which are on the whole special-purpose) we just use individual casts. */
+
+#define Uatoi(s) atoi(CCS(s))
+#define Uatol(s) atol(CCS(s))
+#define Uchdir(s) chdir(CCS(s))
+#define Uchmod(s,n) chmod(CCS(s),n)
+#define Uchown(s,n,m) chown(CCS(s),n,m)
+#define Ufgets(b,n,f) US fgets(CS(b),n,f)
+#define Ufopen(s,t) fopen(CCS(s),CCS(t))
+#define Ulink(s,t) link(CCS(s),CCS(t))
+#define Ulstat(s,t) lstat(CCS(s),t)
+
+#ifdef O_BINARY /* This is for Cygwin, */
+#define Uopen(s,n,m) open(CCS(s),(n)|O_BINARY,m) /* where all files must */
+#else /* be opened as binary */
+#define Uopen(s,n,m) open(CCS(s),n,m) /* to avoid problems */
+#endif /* with CRLF endings. */
+#define Uread(f,b,l) read(f,CS(b),l)
+#define Urename(s,t) rename(CCS(s),CCS(t))
+#define Ustat(s,t) stat(CCS(s),t)
+#define Ustrcat(s,t) strcat(CS(s),CCS(t))
+#define Ustrchr(s,n) US strchr(CCS(s),n)
+#define CUstrchr(s,n) CUS strchr(CCS(s),n)
+#define CUstrerror(n) CUS strerror(n)
+#define Ustrcmp(s,t) strcmp(CCS(s),CCS(t))
+#define Ustrcpy(s,t) strcpy(CS(s),CCS(t))
+#define Ustrcspn(s,t) strcspn(CCS(s),CCS(t))
+#define Ustrftime(s,m,f,t) strftime(CS(s),m,f,t)
+#define Ustrlen(s) (int)strlen(CCS(s))
+#define Ustrncat(s,t,n) strncat(CS(s),CCS(t),n)
+#define Ustrncmp(s,t,n) strncmp(CCS(s),CCS(t),n)
+#define Ustrncpy(s,t,n) strncpy(CS(s),CCS(t),n)
+#define Ustrpbrk(s,t) strpbrk(CCS(s),CCS(t))
+#define Ustrrchr(s,n) US strrchr(CCS(s),n)
+#define CUstrrchr(s,n) CUS strrchr(CCS(s),n)
+#define Ustrspn(s,t) strspn(CCS(s),CCS(t))
+#define Ustrstr(s,t) US strstr(CCS(s),CCS(t))
+#define CUstrstr(s,t) CUS strstr(CCS(s),CCS(t))
+#define Ustrtod(s,t) strtod(CCS(s),CSS(t))
+#define Ustrtol(s,t,b) strtol(CCS(s),CSS(t),b)
+#define Ustrtoul(s,t,b) strtoul(CCS(s),CSS(t),b)
+#define Uunlink(s) unlink(CCS(s))
+#endif /* MYTYPES_H */
+
+/* End of mytypes.h */
diff --git a/3rd-party/xfpt/src/para.c b/3rd-party/xfpt/src/para.c
new file mode 100644
index 000000000..4f00a981d
--- /dev/null
+++ b/3rd-party/xfpt/src/para.c
@@ -0,0 +1,385 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2008 */
+/* Written by Philip Hazel. */
+
+/* This module contains code for processing a paragraph by looking for flag
+characters and also dealing with literals that must be escaped. */
+
+#include "xfpt.h"
+
+
+/*************************************************
+* Process an inline macro call *
+*************************************************/
+
+/* This function is called when we encounter & followed by a name and an
+opening parenthesis. This signifies an inline macro call.
+
+Arguments:
+ p points to the start of the macro name
+ q points to the opening parenthesis
+
+Returns: updated value for p to continue processing
+*/
+
+static uschar *
+para_macro_process(uschar *p, uschar *q)
+{
+int length = q - p;
+argstr **pp;
+macrodef *md;
+macroexe *me;
+
+for (md = macrolist; md != NULL; md = md->next)
+ {
+ if (length == md->namelength && Ustrncmp(p, md->name, length) == 0) break;
+ }
+
+if (md == NULL)
+ {
+ error(23, length, p);
+ (void)fprintf(outfile, "&");
+ return p;
+ }
+
+/* Set up the macro and its arguments on the input stack, just as we do for a
+macro called as a directive, though the arguments are comma-separated here. */
+
+me = misc_malloc(sizeof(macroexe));
+me->prev = macrocurrent;
+macrocurrent = me;
+me->macro = md;
+me->nextline = md->lines;
+from_type[++from_type_ptr] = FROM_MACRO;
+
+me->args = NULL;
+pp = &(me->args);
+
+while (isspace(*(++q)));
+while (*q != 0 && *q != ')')
+ {
+ argstr *as = misc_malloc(sizeof(argstr));
+ as->next = NULL;
+ *pp = as;
+ pp = &(as->next);
+ as->string = misc_readitem(q, US",)", &length, NULL, 0);
+ q += length;
+ if (*q == ',') while (isspace(*(++q)));
+ }
+
+if (*q != ')')
+ {
+ error(24, p);
+ (void)fprintf(outfile, "&");
+ return p;
+ }
+
+/* Bump the count indicating that we are in an inline macro, and then process
+the lines of the macro. It's a count rather than a flag, because the macro data
+may also reference inline macros. Each line is processed and output, but
+without the terminating newline. */
+
+para_inline_macro++;
+
+for (;;)
+ {
+ uschar buffer[INBUFFSIZE];
+
+ read_process_macroline(macrocurrent->nextline->string, buffer);
+
+ /* A directive such as .eacharg can skip to the end of the macro if there
+ is no .endeach. Detect this by looking for a change of macrocurrent value,
+ because there may be an enclosing macro. */
+
+ if (*buffer == '.')
+ {
+ dot_process(buffer);
+ if (macrocurrent != me) break;
+ }
+
+ /* Process a data line */
+
+ else
+ {
+ uschar *qq = buffer + Ustrlen(buffer);
+ while (qq > buffer && isspace(qq[-1])) qq--;
+ *qq = 0;
+ para_process(buffer);
+ }
+
+ /* Advance to the next macro line, exiting the loop when we hit the
+ end of the macro. */
+
+ macrocurrent->nextline = macrocurrent->nextline->next;
+ if (macrocurrent->nextline == NULL)
+ {
+ macroexe *temp = macrocurrent;
+ macrocurrent = macrocurrent->prev;
+ free(temp);
+ from_type_ptr--;
+ break;
+ }
+ }
+
+/* Unstack one level of inline macro, and return the position to carry on
+from in the original input. */
+
+para_inline_macro--;
+return q + 1;
+}
+
+
+
+
+/*************************************************
+* Check a flag string for literal *
+*************************************************/
+
+/* This function is called to scan flag replacement strings to check for
+<literal> and <literal/> so that we can avoid messing with single quotes in
+literal text.
+
+Arguments:
+ s the flag string
+ b a boolean that is set TRUE, FALSE, or left alone
+
+Returns: nothing
+*/
+
+static void
+check_literal(uschar *s, BOOL *b)
+{
+while (*s != 0)
+ {
+ s = Ustrchr(s, '<');
+ if (s == NULL) return;
+
+ if (Ustrncmp(s, "<literal", 8) == 0 && (s[8] == '>' || isspace(s[8])))
+ *b = TRUE;
+ else if (Ustrncmp(s, "</literal", 9) == 0 && (s[9] == '>' || isspace(s[9])))
+ *b = FALSE;
+
+ while (*s != 0 && *s != '>')
+ {
+ if (*s == '"' || *s == '\'')
+ {
+ int t = *s++;
+ while (*s != 0 && *s != t) s++;
+ if (*s == 0) return;
+ }
+ s++;
+ }
+
+ if (*s++ == 0) return;
+ }
+}
+
+
+
+/*************************************************
+* Process a paragraph *
+*************************************************/
+
+/* This is used both for a complete paragraph that may consist of many lines,
+and for literal layout lines that nevertheless need to be scanned for flags.
+However, it is not used for literal text.
+
+Argument: the text to be processed
+Returns: nothing
+*/
+
+void
+para_process(uschar *p)
+{
+flagstr *f;
+flagstr *fstack[FLAGSTACKSIZE];
+int fstackcount = 0;
+BOOL inliteraltext = FALSE;
+
+while (*p != 0)
+ {
+ int c, i;
+
+ /* Check for the closing flag sequence for any outstanding flag pairs. If we
+ find one that isn't at the top of the stack, there's a nesting error. */
+
+ for (i = fstackcount - 1; i >= 0; i--)
+ {
+ f = fstack[i];
+ if (Ustrncmp(f->flag2, p, f->length2) == 0)
+ {
+ int j;
+ for (j = i + 1; j < fstackcount; j++)
+ error(8, fstack[j]->flag2, f->flag2);
+ fstackcount = i;
+ (void)fprintf(outfile, "%s", CS f->rep2);
+ check_literal(f->rep2, &inliteraltext);
+ p += f->length2;
+ i = fstackcount; /* Reset in case another follows immediately */
+ continue;
+ }
+ }
+
+ /* We may be at the end of string if we've just passed a closing flag
+ sequence. */
+
+ if (*p == 0) break;
+
+ /* Otherwise, scan character by character. Angle brackets are escaped,
+ single quotes are mapped except in literal text, and then everything other
+ than ampersand is treated literally. */
+
+ c = *p++;
+ if (c == '<') { (void)fprintf(outfile, "&lt;"); continue; }
+ if (c == '>') { (void)fprintf(outfile, "&gt;"); continue; }
+
+ if (!inliteraltext)
+ {
+ if (c == '`')
+ {
+ (void)fprintf(outfile, "&#x2018;");
+ continue;
+ }
+
+ if (c == '\'')
+ {
+ (void)fprintf(outfile, "&#x2019;");
+ continue;
+ }
+ }
+
+ if (c != '&') { (void)fputc(c, outfile); continue; }
+
+ /* Ampersand must be followed by something. */
+
+ if (*p == 0 || *p == '\n')
+ {
+ error(25);
+ continue;
+ }
+
+ /* Handle all the fancy stuff that starts with ampersand. First, all the
+ cases where a letter is next. */
+
+ if (isalpha(*p))
+ {
+ int entlen;
+ uschar *q = p + 1;
+ while (isalnum(*q) || *q == '.') q++;
+
+ /* Check for an inline macro call; handle out-of line as the code is
+ non-trivial. */
+
+ if (*q == '(')
+ {
+ p = para_macro_process(p, q);
+ continue;
+ }
+
+ /* Otherwise, if it is not XML entity reference syntax there's an error. We
+ support some special entities that start with "&xfpt." for inserting local
+ data. We also allow local entities to be defined. If we don't recognize an
+ entity name, it is passed through untouched, assuming it is a defined XML
+ entity. */
+
+ entlen = q - p;
+
+ if (*q != ';')
+ {
+ error (3, entlen, p);
+ (void)fprintf(outfile, "&");
+ continue;
+ }
+
+ /* This special provides support for the .revision directive. */
+
+ if (Ustrncmp(p, "xfpt.rev", entlen) == 0)
+ {
+ if (revision != NULL && *revision != 0)
+ (void)fprintf(outfile, " revisionflag=\"%s\"", revision);
+ }
+
+ /* Search for a locally defined entitity */
+
+ else
+ {
+ tree_node *t;
+ *q = 0;
+ t = tree_search(entities, p);
+ *q = ';';
+ if (t != NULL)
+ (void)fprintf(outfile, "%s", CS t->data);
+ else
+ (void)fprintf(outfile, "&%.*s;", entlen, p);
+ }
+
+ if (*q == ';') q++;
+ p = q;
+ continue;
+ }
+
+ /* Ampersand followed by # might be an XML numerical entity. If not, we fall
+ through in case it's a flag. */
+
+ if (*p == '#')
+ {
+ uschar *q = p + 1;
+ if (isdigit(*q))
+ {
+ for (q++; isdigit(*q); q++);
+ if (*q == ';')
+ {
+ (void)fprintf(outfile, "&%.*s", q - p, p);
+ p = q;
+ continue;
+ }
+ }
+
+ else if (*q == 'x')
+ {
+ for (q++; isxdigit(*q); q++);
+ if (*q == ';')
+ {
+ (void)fprintf(outfile, "&%.*s", q - p, p);
+ p = q;
+ continue;
+ }
+ }
+ }
+
+ /* If not an XML entity, search out defined flag sequences */
+
+ for (f = flaglist; f != NULL; f = f->next)
+ { if (Ustrncmp(p, f->flag1, f->length1) == 0) break; }
+
+ if (f == NULL)
+ {
+ error(6, *p);
+ (void)fprintf(outfile, "&amp;");
+ continue;
+ }
+
+ /* If the flag is part of a pair, put it onto a stack. Then write out the
+ replacement for the first flag, and move past the flag characters. */
+
+ if (f->length2 != 0) fstack[fstackcount++] = f;
+ (void)fprintf(outfile, "%s", CS f->rep1);
+ check_literal(f->rep1, &inliteraltext);
+ p += f->length1;
+ }
+
+/* If there is anything left on the stack at the end of the string, there is a
+missing flag partner. */
+
+while (fstackcount > 0)
+ {
+ f = fstack[--fstackcount];
+ error(7, f->flag2);
+ }
+}
+
+
+/* End of para.c */
diff --git a/3rd-party/xfpt/src/read.c b/3rd-party/xfpt/src/read.c
new file mode 100644
index 000000000..4aa8757fa
--- /dev/null
+++ b/3rd-party/xfpt/src/read.c
@@ -0,0 +1,388 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2010 */
+/* Written by Philip Hazel. */
+
+/* This module contains code for reading the input. */
+
+#include "xfpt.h"
+
+
+
+
+/*************************************************
+* Process macro line *
+*************************************************/
+
+/* This is the place where macro arguments are substituted. In a section
+delimited by .eacharg/.endeach, the variable macro_argbase is set to the first
+of the relative arguments. This function is also called from para.c in order to
+handle inline macro calls.
+
+Arguments:
+ p the macro input line
+ b where to put the result
+
+Returns: nothing
+*/
+
+void
+read_process_macroline(uschar *p, uschar *b)
+{
+int optend = 0;
+
+while (*p != 0)
+ {
+ int i;
+ int argn = 0;
+ argstr *argbase, *arg;
+
+ /* If we are including an optional substring, when we get to the terminator,
+ just skip it. */
+
+ if (*p == optend)
+ {
+ optend = 0;
+ p++;
+ continue;
+ }
+
+ /* Until we hit a dollar, just copy verbatim */
+
+ if (*p != '$') { *b++ = *p++; continue; }
+
+ /* If the character after $ is another $, insert a literal $. */
+
+ if (p[1] == '$') { p++; *b++ = *p++; continue; }
+
+ /* If the character after $ is +, we are dealing with arguments
+ relative to macro_arg0 in a ".eacharg" section. Otherwise, we are dealing
+ with an absolute argument number. */
+
+ if (p[1] == '+')
+ {
+ p++;
+ if (macro_argbase == NULL) /* Not in a .eacharg section */
+ {
+ error(18);
+ *b++ = '+';
+ *b++ = *p++;
+ continue;
+ }
+ argbase = macro_argbase;
+ }
+ else argbase = macrocurrent->args;
+
+ /* $= introduces an optional substring */
+
+ if (p[1] == '=')
+ {
+ p++;
+ if (!isdigit(p[1]))
+ {
+ error(17, p[1], "$=");
+ *b++ = '$';
+ *b++ = *p++;
+ continue;
+ }
+ while (isdigit(*(++p))) argn = argn * 10 + *p - '0';
+
+ optend = *p++;
+
+ arg = argbase;
+ for (i = 1; i < argn; i++)
+ {
+ if (arg == NULL) break;
+ arg = arg->next;
+ }
+
+ if (arg == NULL || arg->string[0] == 0)
+ {
+ while (*p != 0 && *p != optend) p++;
+ if (*p == optend) p++;
+ }
+
+ continue;
+ }
+
+ /* Not '=' after $; this is an argument substitution */
+
+ if (!isdigit(p[1]))
+ {
+ error(17, p[1], "$");
+ *b++ = *p++;
+ continue;
+ }
+
+ while (isdigit(*(++p))) argn = argn * 10 + *p - '0';
+
+ /* Handle $0 - currently no meaning */
+
+ if (argn == 0)
+ {
+ continue;
+ }
+
+ /* Seek an argument in this invocation */
+
+ arg = argbase;
+ for (i = 1; i < argn; i++)
+ {
+ if (arg == NULL) break;
+ arg = arg->next;
+ }
+
+ /* If not found, seek a default argument for an absolute substitution, but
+ not for a relative one. */
+
+ if (arg == NULL && argbase == macrocurrent->args)
+ {
+ arg = macrocurrent->macro->args;
+ for (i = 1; i < argn; i++)
+ {
+ if (arg == NULL) break;
+ arg = arg->next;
+ }
+ }
+
+ /* If we have found an argument, substitute it. */
+
+ if (arg != NULL) b += sprintf(CS b, "%s", arg->string);
+ }
+
+*b = 0;
+}
+
+
+
+/*************************************************
+* Get the next line of input *
+*************************************************/
+
+/* There may be a saved line already in the buffer, following the reading of a
+paragraph or a .nonl directive. Otherwise, take the next line from one of three
+sources:
+
+ (1) If popto is not negative, get an appropropriate line off the stack.
+ (2) If we are in a macro, get the next macro line.
+ (3) If we are in a file, read a new line from a file and handle any
+ continuations.
+
+There can be arbitrary nesting of macros and files, because a .include
+directive may appear inside a macro. The current from_type vector is used to
+keep track of what is current.
+
+Arguments: none
+Returns: pointer to the next line or NULL
+*/
+
+uschar *
+read_nextline(void)
+{
+int len;
+uschar *p, *q;
+
+/* Handle a dot line that terminated a paragraph, or a .nonl line */
+
+if (next_line != NULL)
+ {
+ uschar *yield = next_line;
+ next_line = NULL;
+ return yield;
+ }
+
+/* Handle a line off the stack */
+
+if (popto == 0)
+ {
+ pushstr *ps = pushed;
+ if (ps == NULL) error(12); else
+ {
+ popto = -1;
+ (void)sprintf(CS inbuffer, "%s\n", ps->string);
+ pushed = ps->next;
+ free(ps);
+ return inbuffer;
+ }
+ }
+
+/* Handle a line off the stack when there is a matching line at the top or
+below for the given letter. When we reach the matching line, stop popping. The
+value of popto is set greater than zero only when it is known that there's a
+matching line. */
+
+if (popto > 0)
+ {
+ pushstr *ps = pushed;
+ if (ps->letter == popto) popto = -1;
+ (void)sprintf(CS inbuffer, "%s\n", ps->string);
+ pushed = ps->next;
+ free(ps);
+ return inbuffer;
+ }
+
+/* Get the next line from the current macro or the current file. We need a loop
+for handling the ends of macros and files. First check for having previously
+reached the end of the input. */
+
+if (from_type_ptr < 0) return NULL;
+
+for (;;)
+ {
+ if (from_type[from_type_ptr] == FROM_MACRO)
+ {
+ if (macrocurrent->nextline == NULL)
+ {
+ macroexe *temp = macrocurrent;
+ macrocurrent = macrocurrent->prev;
+ free(temp);
+ }
+ else
+ {
+ read_process_macroline(macrocurrent->nextline->string, inbuffer);
+ macrocurrent->nextline = macrocurrent->nextline->next;
+ break;
+ }
+ }
+
+ /* When reading from a file, handle continuation lines, but only within the
+ single file. */
+
+ else
+ {
+ if (Ufgets(inbuffer, INBUFFSIZE, istack->file) == NULL)
+ {
+ istackstr *prev = istack->prev;
+ fclose(istack->file);
+ free(istack);
+ istack = prev;
+ }
+ else
+ {
+ istack->linenumber++;
+
+ q = inbuffer;
+ len = Ustrlen(q);
+
+ for (;;)
+ {
+ p = q + len;
+ while (p > q && isspace(p[-1])) p--;
+
+ if (p - q < 3 || Ustrncmp(p - 3, "&&&", 3) != 0) break;
+
+ q = p - 3;
+ *q = 0;
+
+ if (istack == NULL ||
+ Ufgets(q, INBUFFSIZE - (q - inbuffer), istack->file) == NULL)
+ break;
+
+ istack->linenumber++;
+ p = q;
+ while (*p == ' ' || *p == '\t') p++;
+ len = Ustrlen(p);
+ if (p > q) memmove(q, p, len + 1);
+ }
+
+ break;
+ }
+ }
+
+ /* We get here if the end of a macro or a file was reached. The appropriate
+ chain has been popped. Back up the stack of input types before the loop
+ repeats. When we reach the end of the stack, we have reached the end of all
+ the input. */
+
+ if (--from_type_ptr < 0) return NULL;
+ }
+
+return inbuffer;
+}
+
+
+
+/*************************************************
+* Complete the reading of a paragraph *
+*************************************************/
+
+/* This function is called after a line has been identified as the start of a
+paragraph. We need to read the rest so that flags can be matched across the
+entire paragraph. (If there is nested material such as a footnote, this applies
+only to the separate parts, not across the nesting.) The text is copied into
+the paragraph buffer. Directives that are encountered in the paragraph are
+processed, with two exceptions.
+
+(1) For .literal, we set next_line so it is processed next, and exit. This is
+the end of the paragraph.
+
+(2) For .nest, we set *nest_info, according to whether it is the start or
+end of a nested section, and exit.
+
+Arguments:
+ p the first line
+ nest_info returns NEST_NO, NEST_START, or NEST_END
+
+Returns: the paragraph
+*/
+
+
+uschar *
+read_paragraph(uschar *p, int *nest_info)
+{
+uschar *q = parabuffer;
+int length = Ustrlen(p);
+
+memcpy(q, p, length);
+q += length;
+
+*nest_info = NEST_NO; /* Not hit .nest */
+
+for (;;)
+ {
+ uschar *s;
+
+ if ((p = read_nextline()) == NULL) break;
+
+ if (Ustrncmp(p, ".literal ", 9) == 0)
+ {
+ next_line = p;
+ break;
+ }
+
+ if (Ustrncmp(p, ".nest ", 6) == 0)
+ {
+ p += 6;
+ while (isspace(*p)) p++;
+ s = p + Ustrlen(p);
+ while (s > p && isspace(s[-1])) s--;
+ *s = 0;
+ if (Ustrcmp(p, "begin") == 0) *nest_info = NEST_BEGIN;
+ else if (Ustrcmp(p, "end") == 0) *nest_info = NEST_END;
+ else error(26, p);
+ break;
+ }
+
+ else if (*p == '.')
+ {
+ dot_process(p);
+ continue;
+ }
+
+ /* End paragraph on encountering a completely blank line */
+
+ for (s = p; *s == ' ' || *s == '\t'; s++);
+ if (*s == '\n') break;
+
+ length = Ustrlen(p);
+ memcpy(q, p, length);
+ q += length;
+ }
+
+*q = 0;
+return parabuffer;
+}
+
+/* End of read.c */
diff --git a/3rd-party/xfpt/src/structs.h b/3rd-party/xfpt/src/structs.h
new file mode 100644
index 000000000..ec2de8ba3
--- /dev/null
+++ b/3rd-party/xfpt/src/structs.h
@@ -0,0 +1,78 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2012 */
+/* Written by Philip Hazel. */
+
+/* This module contains definitions of structures that are used throughout the
+program. */
+
+/* Include file stack item */
+
+typedef struct istackstr {
+ struct istackstr *prev;
+ int linenumber;
+ FILE *file;
+ uschar filename[256];
+} istackstr;
+
+/* Flag stack item */
+
+typedef struct flagstr {
+ struct flagstr *next;
+ int length1;
+ uschar *flag1;
+ uschar *rep1;
+ int length2;
+ uschar *flag2;
+ uschar *rep2;
+} flagstr;
+
+/* Pushed string stack item */
+
+typedef struct pushstr {
+ struct pushstr *next;
+ int letter;
+ int check;
+ uschar *macname;
+ uschar string[1];
+} pushstr;
+
+/* Macro content and argument item */
+
+typedef struct argstr {
+ struct argstr *next;
+ uschar *string;
+} argstr;
+
+/* Macro definition item */
+
+typedef struct macrodef {
+ struct macrodef *next;
+ argstr *lines;
+ argstr *args;
+ uschar *name;
+ int namelength;
+} macrodef;
+
+/* Macro execution item */
+
+typedef struct macroexe {
+ struct macroexe *prev;
+ macrodef *macro;
+ argstr *args;
+ argstr *nextline;
+} macroexe;
+
+/* Structure for each node in a tree, used for defined entities. */
+
+typedef struct tree_node {
+ struct tree_node *left; /* pointer to left child */
+ struct tree_node *right; /* pointer to right child */
+ uschar *data; /* pointer to the value */
+ uschar balance; /* balancing factor */
+ uschar name[1]; /* node name - variable length */
+} tree_node;
+
+/* End of structs.h */
diff --git a/3rd-party/xfpt/src/tree.c b/3rd-party/xfpt/src/tree.c
new file mode 100644
index 000000000..e9825cbb3
--- /dev/null
+++ b/3rd-party/xfpt/src/tree.c
@@ -0,0 +1,216 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2006 */
+/* Written by Philip Hazel. */
+
+/* This module contains tree management routines. A tree is used for locally
+defined entity values. */
+
+#include "xfpt.h"
+
+
+/***********************************************************
+* Binary Balanced Tree Management Routines *
+***********************************************************/
+
+/* This set of routines maintains a balanced binary tree using
+the algorithm given in Knuth Vol 3 page 455.
+
+The routines make use of uschar * pointers as byte pointers,
+so as to be able to do arithmetic on them, since ANSI Standard
+C does not permit additions and subtractions on void pointers. */
+
+
+/*************************************************
+* Flags and Parameters *
+*************************************************/
+
+#define tree_lbal 1 /* left subtree is longer */
+#define tree_rbal 2 /* right subtree is longer */
+#define tree_bmask 3 /* mask for flipping bits */
+
+
+/*************************************************
+* Insert a new node into a tree *
+*************************************************/
+
+/* The node->name field must (obviously) be set, but the other
+fields need not be initialized.
+
+Arguments:
+ treebase pointer to the root of the tree
+ node the note to insert, with name field set
+
+Returns: TRUE if node inserted; FALSE if not (duplicate)
+*/
+
+int
+tree_insertnode(tree_node **treebase, tree_node *node)
+{
+tree_node *p = *treebase;
+tree_node **q, *r, *s, **t;
+int a;
+
+node->left = node->right = NULL;
+node->balance = 0;
+
+/* Deal with an empty tree */
+
+if (p == NULL)
+ {
+ *treebase = node;
+ return TRUE;
+ }
+
+/* The tree is not empty. While finding the insertion point,
+q points to the pointer to p, and t points to the pointer to
+the potential re-balancing point. */
+
+q = treebase;
+t = q;
+
+/* Loop to search tree for place to insert new node */
+
+for (;;)
+ {
+ int c = Ustrcmp(node->name, p->name);
+ if (c == 0) return FALSE; /* Duplicate node encountered */
+
+ /* Deal with climbing down the tree, exiting from the loop
+ when we reach a leaf. */
+
+ q = (c > 0)? &(p->right) : &(p->left);
+ p = *q;
+ if (p == NULL) break;
+
+ /* Save the address of the pointer to the last node en route
+ which has a non-zero balance factor. */
+
+ if (p->balance != 0) t = q;
+ }
+
+/* When the above loop completes, q points to the pointer to NULL;
+that is the place at which the new node must be inserted. */
+
+*q = node;
+
+/* Set up s as the potential re-balancing point, and r as the
+next node after it along the route. */
+
+s = *t;
+r = (Ustrcmp(node->name, s->name) > 0)? s->right : s->left;
+
+/* Adjust balance factors along the route from s to node. */
+
+p = r;
+
+while (p != node)
+ {
+ if (Ustrcmp(node->name, p->name) < 0)
+ {
+ p->balance = tree_lbal;
+ p = p->left;
+ }
+ else
+ {
+ p->balance = tree_rbal;
+ p = p->right;
+ }
+ }
+
+/* Now the World-Famous Balancing Act */
+
+a = (Ustrcmp(node->name, s->name) < 0)? tree_lbal : tree_rbal;
+
+if (s->balance == 0) s->balance = (uschar)a; /* The tree has grown higher */
+ else if (s->balance != (uschar)a) s->balance = 0; /* It's become more balanced */
+else /* It's got out of balance */
+ {
+ /* Perform a single rotation */
+
+ if (r->balance == (uschar)a)
+ {
+ p = r;
+ if (a == tree_rbal)
+ {
+ s->right = r->left;
+ r->left = s;
+ }
+ else
+ {
+ s->left = r->right;
+ r->right = s;
+ }
+ s->balance = 0;
+ r->balance = 0;
+ }
+
+ /* Perform a double rotation There was an occasion when the balancing
+ factors were screwed up by a bug in the code that reads a tree from
+ the spool. In case this ever happens again, check for changing p to NULL
+ and don't do it. It is better to have an unbalanced tree than a crash. */
+
+ else
+ {
+ if (a == tree_rbal)
+ {
+ if (r->left == NULL) return TRUE; /* Bail out if tree corrupt */
+ p = r->left;
+ r->left = p->right;
+ p->right = r;
+ s->right = p->left;
+ p->left = s;
+ }
+ else
+ {
+ if (r->right == NULL) return TRUE; /* Bail out if tree corrupt */
+ p = r->right;
+ r->right = p->left;
+ p->left = r;
+ s->left = p->right;
+ p->right = s;
+ }
+
+ s->balance = (p->balance == (uschar)a)? (uschar)(a^tree_bmask) : 0;
+ r->balance = (p->balance == (uschar)(a^tree_bmask))? (uschar)a : 0;
+ p->balance = 0;
+ }
+
+ /* Finishing touch */
+
+ *t = p;
+ }
+
+return TRUE; /* Successful insertion */
+}
+
+
+
+/*************************************************
+* Search tree for node by name *
+*************************************************/
+
+/*
+Arguments:
+ p root of tree
+ name key to search for
+
+Returns: pointer to node, or NULL if not found
+*/
+
+tree_node *
+tree_search(tree_node *p, uschar *name)
+{
+while (p != NULL)
+ {
+ int c = Ustrcmp(name, p->name);
+ if (c == 0) return p;
+ p = (c < 0)? p->left : p->right;
+ }
+return NULL;
+}
+
+
+/* End of tree.c */
diff --git a/3rd-party/xfpt/src/xfpt.c b/3rd-party/xfpt/src/xfpt.c
new file mode 100644
index 000000000..31c69081f
--- /dev/null
+++ b/3rd-party/xfpt/src/xfpt.c
@@ -0,0 +1,259 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2012 */
+/* Written by Philip Hazel. */
+
+/* This module contains the main program and initialization functions. */
+
+#include "xfpt.h"
+
+
+
+/*************************************************
+* Static variables *
+*************************************************/
+
+static uschar *xfpt_filename = NULL;
+static uschar *out_filename = NULL;
+
+
+
+
+/*************************************************
+* Usage *
+*************************************************/
+
+static void
+usage(void)
+{
+(void)fprintf(stderr,
+ "Usage: xfpt [-help]\n"
+ " [-o <output-file>]\n"
+ " [-S <share-directory>]\n"
+ " [-v]\n"
+ " [input-file]\n");
+}
+
+
+
+
+/*************************************************
+* Command line argument decoding *
+*************************************************/
+
+/* Arguments: as for main()
+ Returns: TRUE if OK
+*/
+
+static BOOL
+xfpt_decode_arg(int argc, char **argv)
+{
+int i;
+for (i = 1; i < argc; i++)
+ {
+ uschar *arg = US argv[i];
+ if (*arg != '-') break;
+ if (Ustrcmp(arg, "-o") == 0)
+ {
+ out_filename = US argv[++i];
+ if (out_filename == NULL) { usage(); return FALSE; }
+ }
+ else if (Ustrcmp(arg, "-S") == 0)
+ {
+ xfpt_share = US argv[++i];
+ if (xfpt_share == NULL) { usage(); return FALSE; }
+ }
+ else if (Ustrcmp(arg, "-help") == 0 || Ustrcmp(arg, "--help") == 0)
+ {
+ usage();
+ return FALSE;
+ }
+ else if (Ustrcmp(arg, "-v") == 0)
+ {
+ (void)fprintf(stdout, "xpft version %s\n", xfpt_version);
+ exit(0);
+ }
+ else
+ {
+ (void)fprintf(stderr, "xfpt: unknown option \"%s\"\n", arg);
+ usage();
+ return FALSE;
+ }
+ }
+
+/* Require there to be either 0 or 1 command line argument left. */
+
+if (argc > i + 1)
+ {
+ usage();
+ return FALSE;
+ }
+
+/* This will set NULL if there is no file name. If there is a file name and no
+output file is specified, default it to the input name with a .xml extension. */
+
+xfpt_filename = US argv[i];
+if (xfpt_filename != NULL && out_filename == NULL)
+ {
+ uschar *p;
+ int len = Ustrlen(xfpt_filename);
+ out_filename = misc_malloc(len + 5);
+ Ustrcpy(out_filename, xfpt_filename);
+ if ((p = Ustrrchr(out_filename, '.')) != NULL) len = p - out_filename;
+ Ustrcpy(out_filename + len, ".xml");
+ }
+
+return TRUE;
+}
+
+
+
+/*************************************************
+* Entry point and main program *
+*************************************************/
+
+int
+main(int argc, char **argv)
+{
+BOOL para_unfinished[MAXNEST+1];
+int warnpop = 0;
+uschar *p, *q;
+
+if (!xfpt_decode_arg(argc, argv)) return EXIT_FAILURE;
+
+inbuffer = misc_malloc(INBUFFSIZE);
+parabuffer = misc_malloc(PARABUFFSIZE);
+
+/* Set up the first file */
+
+istackbase = istack = misc_malloc(sizeof(istackstr));
+istack->prev = NULL;
+istack->linenumber = 0;
+
+from_type_ptr = 0;
+from_type[from_type_ptr] = FROM_FILE;
+
+if (xfpt_filename == NULL)
+ {
+ istack->file = stdin;
+ Ustrcpy(istack->filename, US"(stdin)");
+ }
+else
+ {
+ Ustrcpy(istack->filename, xfpt_filename);
+ istack->file = Ufopen(xfpt_filename, "rb");
+ if (istack->file == NULL)
+ error(0, istack->filename, strerror(errno)); /* Hard */
+ }
+
+/* Set up the output file. */
+
+if (out_filename == NULL || Ustrcmp(out_filename, "-") == 0)
+ {
+ outfile = stdout;
+ }
+else
+ {
+ outfile = Ufopen(out_filename, "wb");
+ if (outfile == NULL)
+ error(0, out_filename, strerror(errno)); /* Hard error */
+ }
+
+/* Process the input */
+
+nest_level = 0;
+para_unfinished[0] = FALSE;
+
+while ((p = read_nextline()) != NULL)
+ {
+ if (*p == '.') dot_process(p); else switch (literal_state)
+ {
+ case LITERAL_LAYOUT:
+ para_process(p);
+ break;
+
+ case LITERAL_TEXT:
+ literal_process(p);
+ break;
+
+ case LITERAL_XML:
+ (void)fprintf(outfile, "%s", CS p);
+ break;
+
+ default:
+ case LITERAL_OFF:
+ q = p;
+ while (isspace(*q)) q++;
+ if (*q != 0)
+ {
+ int nest_info;
+ p = read_paragraph(p, &nest_info);
+ if (!para_unfinished[nest_level])
+ {
+ (void)fprintf(outfile, "<");
+ para_process(US"para&xfpt.rev;");
+ (void)fprintf(outfile, ">\n");
+ }
+
+ para_process(p);
+ if (nest_info == NEST_BEGIN)
+ {
+ if (nest_level >= MAXNEST) error(27); else
+ {
+ nest_literal_stack[nest_level] = literal_state;
+ para_unfinished[nest_level++] = TRUE;
+ }
+ }
+ else (void)fprintf(outfile, "</para>\n");
+
+ para_unfinished[nest_level] = FALSE;
+
+ if (nest_info == NEST_END)
+ {
+ if (nest_level <= 0) error(28);
+ else literal_state = nest_literal_stack[--nest_level];
+ }
+ }
+ break;
+ }
+ }
+
+/* Empty the stack of pushed texts, close the output, and we are done. */
+
+while (pushed != NULL)
+ {
+ if (!suppress_warnings)
+ {
+ if (pushed->check != 0)
+ {
+ if (warnpop++ == 0)
+ fprintf(stderr,
+ "** Warning: one or more items were left unclosed at the end of processing.\n"
+ " The numbers are the lines in the original file %s from where\n"
+ " the items were generated:\n",
+ ((xfpt_filename == NULL)? "(stdin)" : (char *)xfpt_filename));
+ if (pushed->macname == NULL)
+ fprintf(stderr, "%d: %s\n", pushed->check, pushed->string);
+ else
+ fprintf(stderr, "%d: .%s\n", pushed->check, pushed->macname);
+
+ if (warnpop > 10)
+ {
+ fprintf(stderr, "... too many to list\n");
+ suppress_warnings = TRUE;
+ }
+ }
+ }
+ para_process(pushed->string);
+ (void)fprintf(outfile, "\n");
+ pushed = pushed->next;
+ }
+
+(void)fclose(outfile);
+
+return return_code;
+}
+
+/* End of xfpt.c */
diff --git a/3rd-party/xfpt/src/xfpt.h b/3rd-party/xfpt/src/xfpt.h
new file mode 100644
index 000000000..df19ed4fd
--- /dev/null
+++ b/3rd-party/xfpt/src/xfpt.h
@@ -0,0 +1,65 @@
+/*************************************************
+* xfpt - Simple ASCII->Docbook processor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge, 2008 */
+
+/* Written by Philip Hazel. I wrote this because I found AsciiDoc to be to slow
+for large documents, and also to have too many quirks and gotchas. */
+
+
+#ifndef INCLUDED_xfpt_H
+#define INCLUDED_xfpt_H
+
+/* General header file for all modules */
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+
+
+/* These are some parameters that specify sizes of things in the code. They
+must appear before including the local headers. */
+
+
+/* These values do not necessarily have to appear before including the local
+headers, but they might as well be together with those above. */
+
+#define INBUFFSIZE 1024
+#define PARABUFFSIZE 10000
+#define FLAGSTACKSIZE 40
+#define MAXNEST 3
+#define FROM_TYPE_STACKSIZE 20
+
+
+/* Type of current input */
+
+enum { FROM_FILE, FROM_MACRO };
+
+
+/* Nested block indicators for read_paragraph() */
+
+enum { NEST_NO, NEST_BEGIN, NEST_END };
+
+
+/* The literal states */
+
+enum { LITERAL_OFF, LITERAL_LAYOUT, LITERAL_TEXT, LITERAL_XML };
+
+
+/* More header files for xfpt */
+
+#include "mytypes.h"
+#include "structs.h"
+#include "globals.h"
+#include "functions.h"
+
+#endif /* INCLUDED_xfpt_H */
+
+/* End of xfpt.h */
diff --git a/3rd-party/xfpt/testing/infiles/01 b/3rd-party/xfpt/testing/infiles/01
new file mode 100644
index 000000000..afa804f2d
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/01
@@ -0,0 +1,431 @@
+.include stdflags
+.include stdmacs
+
+.set abcd "ABCD"
+
+.docbook
+.book
+
+.revision changed
+.chapter "First chapter" "" "abbrev"
+This is text before the first section.
+.revision off
+
+.section "First section"
+.index primary secondary
+.index-from "ID" "range"
+This is the text of the first section.
+We are going to have an index in the middle of a paragraph.
+.index "primary two" "secondary two"
+This is the rest of the paragraph.
+
+.section "Second section"
+This is the text of the second section. Here's a reference to
+chapter &<<CHAPsecond>>&. Here are some entities, both local and default:
+&&abcd; is &abcd;; &&amp is &amp;.
+
+.chapter "Second chapter" "CHAPsecond"
+This is the second chapter. Test a block quote:
+.index-see "sights" "visions"
+.index-seealso "sounds" "noises" "off"
+
+.revision "changed"
+.blockquote
+All the world's a stage, and all the men and women merely players. They have
+their exits and their entrances, and one man in his time plays many parts.
+.endblockquote
+
+.ilist
+This is the first item in an itemized list.
+
+There is more than one paragraph.
+.next
+This is the second item in an itemized list.
+.endlist
+
+.olist
+Now we have an ordered list.
+
+Again more than one paragraph.
+.next
+The second item.
+.next
+The third item
+.endlist
+.index-to "ID"
+
+.revision off
+
+.olist "lowerroman"
+Try lower case roman numerals.
+.ilist
+Try a nested list.
+.next
+next
+.endlist
+back in the first of the ordered.
+.next
+the next
+.endlist
+
+This is a normal text paragraph.
+.revision changed
+.display
+This is a display where the font
+should be normal
+even recognizing &'italic'& and stuff
+but the
+layout is literal
+.endd
+.revision off
+.code
+This, however is a code paragraph
+where &'italic'& everything except
+<angle> brackets is totally literal,
+and & is no longer a flag.
+.endd
+And now we are back to a &*normal*& paragraph again.
+
+.itable
+.row 1 2
+.row 3 4
+.endtable
+
+.itable all 1 1 3 1* left 2* center 3* right
+.row 1 2 3
+.row 4 5 6
+.endtable
+
+.vlist
+.vitem &*First*&
+This is a paragraph about the first item.
+
+In fact, here is a second paragraph.
+
+.vitem &*Second*&
+And now we have the second item.
+.endlist
+
+
+The quick brown fox
+jumps over the lazy dog.
+
+.literal xml
+<!--this should be--> &&&
+<para>
+completely untouched
+.not even dot lines
+.endxmliphant
+are touched
+</para>
+.literal off
+
+whereas this should &&&
+ note concats
+<and stuff>
+Test &copy; and &#1234; and &#x4dc4; for size.
+
+Check `quote' marks. And ``doublequote'' marks.
+
+This is a paragraph
+where things happen over multiple
+lines.
+
+Test some of the standard flags &'italic'& and &*bold*& text and
+&`literal`& text and &_filename_& in text and &"quoted"& text and
+we have && and &-- as single replacements.
+
+.push abcd
+.pop
+
+.push X the X line 1
+.pop
+
+.push X the X line 2
+.pop X
+
+.push X the X line 3
+.push B the B line
+.pop X
+.pop Z
+
+.macro abcd
+This is the first line of the macro abcd.
+This is the second line. Contains a dollar ($$) character.
+.endmacro
+
+This is text after the macro definition.
+.abcd
+
+.macro xyz "default 1" default-2
+First line.
+Insert args: 1="$1" 2="$2" 3="$3"
+.endmacro
+
+.xyz
+.xyz "set 1"
+.xyz set1 set2
+.xyz "set1" set2 "set 3"
+
+.macro pqr
+Always.
+.arg 1
+If arg1: $1
+.endarg
+.arg 2
+If arg2: $2
+.endarg
+.arg -2
+There is no second argument.
+.endmacro
+
+.pqr
+.pqr setarg1
+.pqr setarg1 setarg2
+
+.code
+Inside literal text, unknown directives
+.like this one
+should be passed as data
+.endd
+
+
+.macro m1 one two
+$1 $2
+.endmacro
+
+.macro m2 three
+$1
+.eacharg 2
+$+1
+.endeach
+.endmacro
+
+
+.display
+&`&&m1(1,2) `& |&m1(1,2)|
+&`&&m1(1) `& |&m1(1)|
+&`&&m1() `& |&m1()|
+&`&&m1("a(,b)") `& |&m1("a(,b)")|
+&`&&m1("a(,b)", c) `& |&m1("a(,b)", c)|
+
+&`&&m2() `& |&m2()|
+&`&&m2(a) `& |&m2(a)|
+&`&&m2(a,b) `& |&m2(a,b)|
+
+&`&&m2("&&m1(x,y)") `& |&m2("&m1(x,y)")|
+&`&&m2("&&m1(x,y)", 3, 4) `& |&m2("&m1(x,y)", 3, 4)|
+.endd
+
+URL &url(http://etc) and another &url(http://etc, text) and so on.
+
+.new
+This is a paragraph marked new with .new/.wen.
+.wen
+
+.display
+The first line in a display.
+.new
+This line is between .new/.wen.
+.wen
+Another line.
+.endd
+
+.code
+The first line in a code section.
+.new
+This line is between .new/.wen.
+.wen
+Another line.
+.endd
+
+.include stdflags
+.include stdmacs
+
+.display
+A
+.new
+B
+.wen
+C
+.endd
+
+.display
+A
+.new "ZZZ"
+C
+.endd
+
+.code
+A
+.new
+B
+.wen
+C
+.endd
+
+.code
+A
+.new "ZZZ"
+C
+.endd
+
+.display
+A
+B &new(BB) BBB
+C
+.endd
+
+.code
+A
+B &new(BB) BBB
+C
+.endd
+
+.macro nesttest
+.arg 4
+FOUR "$1" "$2" "$3" "$4"
+.endarg
+.arg -4
+NOT FOUR
+.arg 3
+THREE "$1" "$2" "$3"
+.endarg
+.arg -3
+NOT THREE "$1" "$2"
+.endarg
+END NOT FOUR
+.endarg
+.endmacro
+
+.display
+.nesttest 1 2 3 4
+------------
+.nesttest 1 2 3
+------------
+.nesttest 1 2
+------------
+.nesttest 1
+------------
+.nesttest
+.endd
+
+Test footnotes. The quick brown fox
+.footnote
+Note?
+.endnote
+jumps
+.footnote
+.display
+Display in footnote.
+.endd
+.endnote
+over the lazy
+.footnote
+.itable all 1 1 3 1* left 2* center 3* right
+.row 1 2
+.row 3 4
+.endtable
+.endnote
+dog.
+
+Another paragraph
+.footnote
+First para in footnote.
+
+Second para in footnote.
+.endnote
+with some footnotes
+.
+.footnote
+This foot note will have text
+.code
+and a display
+.endd
+.endnote
+.
+in various forms.
+
+.display
+How about a footnote in a display?
+.footnote
+This is the note.
+.endnote
+Back in the display.
+.endd
+
+.include stdflags
+.include stdmacs
+
+.literal xml
+<?sdop toc_sections="no" ?>
+.literal off
+
+.macro image
+.literal layout
+&<mediaobject>&&<imageobject>&
+&<imagedata fileref="$1" $=2+ scale="$2"+$=3+ align="$3"+&&&
+ $=4+ depth="$4"+$=5+ width="$5"+>&
+&</imagedata>&&</imageobject>&&</mediaobject>&
+.literal off
+.endmacro
+
+.macro figure
+.literal layout
+&<figure$=2+ id="$2"+&xfpt.rev;>&
+.arg 1
+&<title>&$1&</title>&
+.endarg
+.literal off
+.endmacro
+
+.macro endfigure
+.literal layout
+&</figure>&
+.literal off
+.endmacro
+
+Here is a reference to figure &<<FIGfirst>>&.
+
+.figure "This is the first figure" "FIGfirst"
+.image "eps1.eps"
+.endfigure
+
+Here is another reference to figure &<<FIGfirst>>&. We also have
+figure &<<FIGsecond>>& below.
+
+.figure "The second figure" "FIGsecond"
+.image eps1.eps 80 centre
+.endfigure
+
+.table "this is title" "TAB123" "" "" "" 2 1* left 1* left
+.row AAA BBB
+.row CCC DDD
+.endtable
+
+A ref to table &<<TAB123>>&. Now check quotes: `normal' should be changed
+to typographic ones. In &`literal text, `they' shouldn't be`& changed.
+.code
+Check `quoted' in literal monospaced block.
+.endd
+.display
+But in a literal block that is `not monospaced' ...
+&`Check it's ok`& when `in the same line'.
+.endd
+
+Extra checks on the use of .nonl.
+.nonl ABCD
+EFGH should be joined on
+.nonl NONL
+
+At the end of a paragraph? It just puts </para> on the same line.
+
+.nonl "At the start of a para"
+graph should work too.
+.display
+What about in a display?
+.nonl "Use NONL"
+WITH more stuff
+.endd
+
+.makeindex
diff --git a/3rd-party/xfpt/testing/infiles/02 b/3rd-party/xfpt/testing/infiles/02
new file mode 100644
index 000000000..e17267593
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/02
@@ -0,0 +1,66 @@
+.include stdflags
+.include "stdmacs"
+
+This input file tries to provoke errors &;.
+Non defined &&rhubarb is &rhubarb;
+Try &&abcd without semicolon: &abcd and at EOL &abcd
+
+.flag &:
+.flag &: "abc" "xyz"
+.flag :: "pqr"
+.flag &: :& &'
+
+.set abcd "abcd" xyz
+
+.arg
+.arg 3
+
+.endarg
+.endarg abcd
+
+.eacharg
+.eacharg 45
+
+.endeach
+.endeach 99
+
+.rhubarb and custard
+
+.literal xml stuff
+<abcd>
+.literal off more stuff
+
+.macro x
+.arg 4n
+.arg
+.endarg
+.endarg 99
+.eacharg 6 G
+.endmacro
+
+.x
+
+.nonl more than one argument
+
+.macro a
+.include infiles/02.inc
+.endmacro
+
+.macro b
+.arg 4n
+.endmacro
+
+.a
+
+Test unterminated things that should give warnings.
+
+.ilist
+.olist
+.vlist
+.footnote
+.display
+.code
+.blockquote
+.table
+.itable
+.figure
diff --git a/3rd-party/xfpt/testing/infiles/02.inc b/3rd-party/xfpt/testing/infiles/02.inc
new file mode 100644
index 000000000..76202b0e1
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/02.inc
@@ -0,0 +1,3 @@
+.b
+
+.arg 3
diff --git a/3rd-party/xfpt/testing/infiles/03 b/3rd-party/xfpt/testing/infiles/03
new file mode 100644
index 000000000..d4d2c65e2
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/03
@@ -0,0 +1,14 @@
+.include stdflags
+.include stdmacs
+
+.macro pic
+.code
+.include infiles/pic$1.aspic.inc
+.endd
+.figure
+.image infiles/pic$1.eps.inc
+.endfigure
+.endmacro
+
+.chapter "Testing"
+.pic 01
diff --git a/3rd-party/xfpt/testing/infiles/04 b/3rd-party/xfpt/testing/infiles/04
new file mode 100644
index 000000000..917b2cac5
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/04
@@ -0,0 +1,9 @@
+.include stdflags
+.include stdmacs
+
+.preface "A first preface"
+This is text in the preface.
+.endpreface
+.pi sdop 'toc_sections="no"'
+.chapter "A first chapter"
+This is text in a chapter
diff --git a/3rd-party/xfpt/testing/infiles/pic01.aspic.inc b/3rd-party/xfpt/testing/infiles/pic01.aspic.inc
new file mode 100644
index 000000000..52834896c
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/pic01.aspic.inc
@@ -0,0 +1 @@
+box "A"; line; circle "B";
diff --git a/3rd-party/xfpt/testing/infiles/pic01.eps.inc b/3rd-party/xfpt/testing/infiles/pic01.eps.inc
new file mode 100644
index 000000000..3f0e7122d
--- /dev/null
+++ b/3rd-party/xfpt/testing/infiles/pic01.eps.inc
@@ -0,0 +1,47 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: Unknown
+%%Creator: Unknown, using Aspic 1.04 (30-January-2008)
+%%CreationDate: Wed, 06 Feb 2008 12:05:35 +0000
+%%BoundingBox: 0 0 216.500 72.400
+%%EndComments
+
+/centreshow{dup stringwidth pop 2 div neg 0 rmoveto show}def
+/rightshow{dup stringwidth pop neg 0 rmoveto show}def
+/leftshow{show}def
+/mymove{
+{currentpoint} stopped {moveto}{
+ exch 4 1 roll sub 3 1 roll exch sub
+ dup abs 0.01 lt 3 -1 roll dup abs 0.01 lt
+ 3 -1 roll and {pop pop}{rmoveto} ifelse
+ } ifelse
+}def
+/fonts 64 array def
+/mybindfont{exch findfont exch scalefont fonts 3 1 roll put} def
+/myfont{fonts exch get setfont} def
+
+0 /Times-Roman 12 mybindfont
+0.480 18.360 mymove
+72 0 rlineto
+0 36 rlineto
+-72 0 rlineto
+closepath
+0.500 setlinewidth
+stroke
+0 myfont
+36.480 33.360 mymove
+(A) centreshow
+72.480 36.360 mymove
+72 0 rlineto
+0.400 setlinewidth
+stroke
+216.480 36.360 mymove
+0.480 18.840 -16.080 35.880 -34.920 36 rcurveto
+-18.840 1.080 -36.360 -14.880 -37.080 -33.720 rcurveto
+-1.680 -18.720 13.800 -36.840 32.520 -38.040 rcurveto
+18.720 -2.280 37.200 12.600 39.120 31.320 rcurveto
+0.240 1.440 0.240 3 0.240 4.560 rcurveto
+closepath
+stroke
+180.480 33.360 mymove
+(B) centreshow
+showpage
diff --git a/3rd-party/xfpt/testing/outfiles/01 b/3rd-party/xfpt/testing/outfiles/01
new file mode 100644
index 000000000..bb32e12d0
--- /dev/null
+++ b/3rd-party/xfpt/testing/outfiles/01
@@ -0,0 +1,479 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<book>
+<chapter revisionflag="changed">
+<title>First chapter</title>
+<titleabbrev>abbrev</titleabbrev>
+<para>
+This is text before the first section.
+</para>
+<section>
+<title>First section</title>
+<para>
+<indexterm>
+<primary>primary</primary>
+<secondary>secondary</secondary>
+</indexterm>
+<indexterm id="ID" class="startofrange">
+<primary>range</primary>
+</indexterm>
+This is the text of the first section.
+We are going to have an index in the middle of a paragraph.
+<indexterm>
+<primary>primary two</primary>
+<secondary>secondary two</secondary>
+</indexterm>
+This is the rest of the paragraph.
+</para>
+</section>
+<section>
+<title>Second section</title>
+<para>
+This is the text of the second section. Here&#x2019;s a reference to
+chapter <xref linkend="CHAPsecond"/>. Here are some entities, both local and default:
+&amp;abcd; is ABCD; &amp;amp is &amp;.
+</para>
+</section>
+</chapter>
+
+<chapter id="CHAPsecond">
+<title>Second chapter</title>
+<para>
+This is the second chapter. Test a block quote:
+<indexterm>
+<primary>visions</primary>
+<see>sights</see>
+</indexterm>
+<indexterm>
+<primary>noises</primary>
+<secondary>off</secondary>
+<seealso>sounds</seealso>
+</indexterm>
+</para>
+<blockquote revisionflag="changed">
+<para revisionflag="changed">
+All the world&#x2019;s a stage, and all the men and women merely players. They have
+their exits and their entrances, and one man in his time plays many parts.
+</para>
+</blockquote>
+<itemizedlist revisionflag="changed">
+<listitem>
+<para revisionflag="changed">
+This is the first item in an itemized list.
+</para>
+<para revisionflag="changed">
+There is more than one paragraph.
+</para>
+</listitem>
+<listitem>
+<para revisionflag="changed">
+This is the second item in an itemized list.
+</para>
+</listitem>
+</itemizedlist>
+<orderedlist numeration="arabic" revisionflag="changed">
+<listitem>
+<para revisionflag="changed">
+Now we have an ordered list.
+</para>
+<para revisionflag="changed">
+Again more than one paragraph.
+</para>
+</listitem>
+<listitem>
+<para revisionflag="changed">
+The second item.
+</para>
+</listitem>
+<listitem>
+<para revisionflag="changed">
+The third item
+</para>
+</listitem>
+</orderedlist>
+<para revisionflag="changed">
+<indexterm startref="ID" class="endofrange"/>
+</para>
+<orderedlist numeration="lowerroman">
+<listitem>
+<para>
+Try lower case roman numerals.
+</para>
+<itemizedlist>
+<listitem>
+<para>
+Try a nested list.
+</para>
+</listitem>
+<listitem>
+<para>
+next
+</para>
+</listitem>
+</itemizedlist>
+<para>
+back in the first of the ordered.
+</para>
+</listitem>
+<listitem>
+<para>
+the next
+</para>
+</listitem>
+</orderedlist>
+<para revisionflag="changed">
+This is a normal text paragraph.
+</para>
+<literallayout revisionflag="changed">
+This is a display where the font
+should be normal
+even recognizing <emphasis>italic</emphasis> and stuff
+but the
+layout is literal
+</literallayout>
+<literallayout class="monospaced">
+This, however is a code paragraph
+where &amp;'italic'&amp; everything except
+&lt;angle&gt; brackets is totally literal,
+and &amp; is no longer a flag.
+</literallayout>
+<para>
+And now we are back to a <emphasis role="bold">normal</emphasis> paragraph again.
+</para>
+<informaltable frame="none">
+<tgroup cols="2" colsep="0" rowsep="0">
+<tbody>
+<row>
+<entry>1</entry>
+<entry>2</entry>
+</row>
+<row>
+<entry>3</entry>
+<entry>4</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+<informaltable frame="all">
+<tgroup cols="3" colsep="1" rowsep="1">
+<colspec colwidth="1*" align="left"/>
+<colspec colwidth="2*" align="center"/>
+<colspec colwidth="3*" align="right"/>
+<tbody>
+<row>
+<entry>1</entry>
+<entry>2</entry>
+<entry>3</entry>
+</row>
+<row>
+<entry>4</entry>
+<entry>5</entry>
+<entry>6</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+<variablelist>
+<varlistentry>
+<term><emphasis role="bold">First</emphasis></term>
+<listitem>
+<para>
+This is a paragraph about the first item.
+</para>
+<para>
+In fact, here is a second paragraph.
+</para>
+</listitem></varlistentry>
+<varlistentry>
+<term><emphasis role="bold">Second</emphasis></term>
+<listitem>
+<para>
+And now we have the second item.
+</para>
+</listitem></varlistentry>
+</variablelist>
+<para>
+The quick brown fox
+jumps over the lazy dog.
+</para>
+<!--this should be--> <para>
+completely untouched
+.not even dot lines
+.endxmliphant
+are touched
+</para>
+<para>
+whereas this should note concats
+&lt;and stuff&gt;
+Test &copy; and &#1234; and &#x4dc4; for size.
+</para>
+<para>
+Check &#x2018;quote&#x2019; marks. And &#x2018;&#x2018;doublequote&#x2019;&#x2019; marks.
+</para>
+<para>
+This is a paragraph
+where things happen over multiple
+lines.
+</para>
+<para>
+Test some of the standard flags <emphasis>italic</emphasis> and <emphasis role="bold">bold</emphasis> text and
+<literal>literal</literal> text and <filename>filename</filename> in text and <quote>quoted</quote> text and
+we have &amp; and &ndash; as single replacements.
+</para>
+<para>
+abcd
+</para>
+<para>
+the X line 1
+</para>
+<para>
+the X line 2
+</para>
+<para>
+the B line
+the X line 3
+</para>
+<para>
+This is text after the macro definition.
+This is the first line of the macro abcd.
+This is the second line. Contains a dollar ($) character.
+</para>
+<para>
+First line.
+Insert args: 1="default 1" 2="default-2" 3=""
+First line.
+Insert args: 1="set 1" 2="default-2" 3=""
+First line.
+Insert args: 1="set1" 2="set2" 3=""
+First line.
+Insert args: 1="set1" 2="set2" 3="set 3"
+</para>
+<para>
+Always.
+There is no second argument.
+Always.
+If arg1: setarg1
+There is no second argument.
+Always.
+If arg1: setarg1
+If arg2: setarg2
+</para>
+<literallayout class="monospaced">
+Inside literal text, unknown directives
+.like this one
+should be passed as data
+</literallayout>
+<literallayout>
+<literal>&amp;m1(1,2) </literal> |1 2|
+<literal>&amp;m1(1) </literal> |1 two|
+<literal>&amp;m1() </literal> |one two|
+<literal>&amp;m1("a(,b)") </literal> |a(,b) two|
+<literal>&amp;m1("a(,b)", c) </literal> |a(,b) c|
+
+<literal>&amp;m2() </literal> |three|
+<literal>&amp;m2(a) </literal> |a|
+<literal>&amp;m2(a,b) </literal> |ab|
+
+<literal>&amp;m2("&amp;m1(x,y)") </literal> |x y|
+<literal>&amp;m2("&amp;m1(x,y)", 3, 4) </literal> |x y34|
+</literallayout>
+<para>
+URL <emphasis role="bold"><ulink url="http://etc">http://etc</ulink></emphasis> and another <emphasis role="bold"><ulink url="http://etc">text</ulink></emphasis> and so on.
+</para>
+<para revisionflag="changed">
+This is a paragraph marked new with .new/.wen.
+</para>
+<literallayout>
+The first line in a display.
+<phrase revisionflag="changed">This line is between .new/.wen.
+</phrase>Another line.
+</literallayout>
+<literallayout class="monospaced">
+The first line in a code section.
+<phrase revisionflag="changed">This line is between .new/.wen.
+</phrase>Another line.
+</literallayout>
+<literallayout>
+A
+<phrase revisionflag="changed">B
+</phrase>C
+</literallayout>
+<literallayout>
+A
+<phrase revisionflag="changed">ZZZ</phrase>
+C
+</literallayout>
+<literallayout class="monospaced">
+A
+<phrase revisionflag="changed">B
+</phrase>C
+</literallayout>
+<literallayout class="monospaced">
+A
+&amp;&lt;phrase revisionflag="changed"&gt;&amp;ZZZ&amp;&lt;/phrase&gt;&amp;
+C
+</literallayout>
+<literallayout>
+A
+B <phrase revisionflag="changed">BB</phrase> BBB
+C
+</literallayout>
+<literallayout class="monospaced">
+A
+B &amp;new(BB) BBB
+C
+</literallayout>
+<literallayout>
+FOUR "1" "2" "3" "4"
+END NOT FOUR
+------------
+NOT FOUR
+THREE "1" "2" "3"
+END NOT FOUR
+------------
+NOT FOUR
+NOT THREE "1" "2"
+END NOT FOUR
+------------
+NOT FOUR
+NOT THREE "1" ""
+END NOT FOUR
+------------
+NOT FOUR
+NOT THREE "" ""
+END NOT FOUR
+</literallayout>
+<para>
+Test footnotes. The quick brown fox
+<footnote>
+<para>
+Note?
+</para>
+</footnote>
+jumps
+<footnote>
+<literallayout>
+Display in footnote.
+</literallayout>
+</footnote>
+over the lazy
+<footnote>
+<informaltable frame="all">
+<tgroup cols="3" colsep="1" rowsep="1">
+<colspec colwidth="1*" align="left"/>
+<colspec colwidth="2*" align="center"/>
+<colspec colwidth="3*" align="right"/>
+<tbody>
+<row>
+<entry>1</entry>
+<entry>2</entry>
+</row>
+<row>
+<entry>3</entry>
+<entry>4</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+</footnote>
+dog.
+</para>
+<para>
+Another paragraph
+<footnote>
+<para>
+First para in footnote.
+</para>
+<para>
+Second para in footnote.
+</para>
+</footnote>
+with some footnotes
+<footnote>
+<para>
+This foot note will have text
+</para>
+<literallayout class="monospaced">
+and a display
+</literallayout>
+</footnote>
+in various forms.
+</para>
+<literallayout>
+How about a footnote in a display?
+<footnote>
+<para>
+This is the note.
+</para>
+</footnote>
+Back in the display.
+</literallayout>
+<?sdop toc_sections="no" ?>
+<para>
+Here is a reference to figure <xref linkend="FIGfirst"/>.
+</para>
+<figure id="FIGfirst">
+<title>This is the first figure</title>
+<mediaobject><imageobject>
+<imagedata fileref="eps1.eps" >
+</imagedata></imageobject></mediaobject>
+</figure>
+<para>
+Here is another reference to figure <xref linkend="FIGfirst"/>. We also have
+figure <xref linkend="FIGsecond"/> below.
+</para>
+<figure id="FIGsecond">
+<title>The second figure</title>
+<mediaobject><imageobject>
+<imagedata fileref="eps1.eps" scale="80" align="centre">
+</imagedata></imageobject></mediaobject>
+</figure>
+<table id="TAB123" >
+<title>this is title</title>
+<tgroup cols="2" colsep="" rowsep="">
+<colspec colwidth="1*" align="left"/>
+<colspec colwidth="1*" align="left"/>
+<tbody>
+<row>
+<entry>AAA</entry>
+<entry>BBB</entry>
+</row>
+<row>
+<entry>CCC</entry>
+<entry>DDD</entry>
+</row>
+</tbody>
+</tgroup>
+</table>
+<para>
+A ref to table <xref linkend="TAB123"/>. Now check quotes: &#x2018;normal&#x2019; should be changed
+to typographic ones. In <literal>literal text, `they' shouldn't be</literal> changed.
+</para>
+<literallayout class="monospaced">
+Check `quoted' in literal monospaced block.
+</literallayout>
+<literallayout>
+But in a literal block that is &#x2018;not monospaced&#x2019; ...
+<literal>Check it's ok</literal> when &#x2018;in the same line&#x2019;.
+</literallayout>
+<para>
+Extra checks on the use of .nonl.
+ABCDEFGH should be joined on
+NONL</para>
+<para>
+At the end of a paragraph? It just puts &lt;/para&gt; on the same line.
+</para>
+<para>
+At the start of a paragraph should work too.
+</para>
+<literallayout>
+What about in a display?
+Use NONLWITH more stuff
+</literallayout>
+</chapter>
+
+<index>
+<title>Index</title>
+</index>
+
+</book>
diff --git a/3rd-party/xfpt/testing/outfiles/01.err b/3rd-party/xfpt/testing/outfiles/01.err
new file mode 100644
index 000000000..d019e5c82
--- /dev/null
+++ b/3rd-party/xfpt/testing/outfiles/01.err
@@ -0,0 +1,6 @@
+** Error: missing semicolon after "&abcd"
+ Detected near line 27 of infiles/01
+
+** Error: missing semicolon after "&abcd"
+ Detected near line 27 of infiles/01
+
diff --git a/3rd-party/xfpt/testing/outfiles/02 b/3rd-party/xfpt/testing/outfiles/02
new file mode 100644
index 000000000..365242f3d
--- /dev/null
+++ b/3rd-party/xfpt/testing/outfiles/02
@@ -0,0 +1,40 @@
+<para>
+This input file tries to provoke errors &amp;;.
+Non defined &amp;rhubarb is &rhubarb;
+Try &amp;abcd without semicolon: &abcd and at EOL &abcd
+</para>
+<abcd>
+<para>
+more</para>
+<para>
+Test unterminated things that should give warnings.
+</para>
+<itemizedlist>
+<listitem>
+<orderedlist numeration="arabic">
+<listitem>
+<variablelist>
+<para>
+<footnote>
+<literallayout>
+<literallayout class="monospaced">
+<blockquote>
+<table >
+<tgroup cols="2" colsep="0" rowsep="0">
+<tbody>
+<informaltable frame="none">
+<tgroup cols="2" colsep="0" rowsep="0">
+<tbody>
+<figure>
+</figure>
+</informaltable>
+</table>
+</blockquote>
+</literallayout>
+</literallayout>
+</footnote>
+</variablelist>
+</listitem>
+</orderedlist>
+</listitem>
+</itemizedlist>
diff --git a/3rd-party/xfpt/testing/outfiles/02.err b/3rd-party/xfpt/testing/outfiles/02.err
new file mode 100644
index 000000000..67f67990e
--- /dev/null
+++ b/3rd-party/xfpt/testing/outfiles/02.err
@@ -0,0 +1,118 @@
+** Error: unknown flag "&;"
+ Detected near line 7 of infiles/02
+
+** Error: missing semicolon after "&abcd"
+ Detected near line 7 of infiles/02
+
+** Error: missing semicolon after "&abcd"
+ Detected near line 7 of infiles/02
+
+** Error: malformed directive
+ .flag &:
+ Detected near line 8 of infiles/02
+
+** Error: malformed directive
+ .flag &: "abc" "xyz"
+ Detected near line 9 of infiles/02
+
+** Error: a flag must begin with "&"
+ Detected near line 10 of infiles/02
+
+** Error: malformed directive
+ .flag &: :& &'
+ Detected near line 11 of infiles/02
+
+** Warning: extra characters at end of directive
+ .set abcd "abcd" xyz
+ ^^^
+ Detected near line 13 of infiles/02
+
+** Error: .arg is permitted only inside a macro
+ Detected near line 15 of infiles/02
+
+** Error: .arg is permitted only inside a macro
+ Detected near line 16 of infiles/02
+
+** Error: .endarg is permitted only inside a macro
+ Detected near line 18 of infiles/02
+
+** Error: .endarg is permitted only inside a macro
+ Detected near line 19 of infiles/02
+
+** Error: .eacharg is permitted only inside a macro
+ Detected near line 21 of infiles/02
+
+** Error: .eacharg is permitted only inside a macro
+ Detected near line 22 of infiles/02
+
+** Error: .endeach is permitted only inside a macro
+ Detected near line 24 of infiles/02
+
+** Error: .endeach is permitted only inside a macro
+ Detected near line 25 of infiles/02
+
+** Error: unknown directive line: .rhubarb and custard
+ Detected near line 27 of infiles/02
+
+** Warning: extra characters at end of directive
+ .literal xml stuff
+ ^^^^^
+ Detected near line 29 of infiles/02
+
+** Warning: extra characters at end of directive
+ .literal off more stuff
+ ^^^^^^^^^^
+ Detected near line 31 of infiles/02
+
+** Error: malformed directive
+ .arg 4n
+ Processing macro x
+ Detected near line 41 of infiles/02
+
+** Error: malformed directive
+ .arg
+ Processing macro x
+ Detected near line 41 of infiles/02
+
+** Warning: extra characters at end of directive
+ .endarg 99
+ ^^
+ Processing macro x
+ Detected near line 41 of infiles/02
+
+** Warning: extra characters at end of directive
+ .eacharg 6 G
+ ^
+ Processing macro x
+ Detected near line 41 of infiles/02
+
+** Warning: extra characters at end of directive
+ .nonl more than one argument
+ ^^^^^^^^^^^^^^^^^
+ Detected near line 43 of infiles/02
+
+** Error: malformed directive
+ .arg 4n
+ Processing macro b
+ Detected near line 1 of infiles/02.inc
+ Processing macro a
+ Detected near line 53 of infiles/02
+
+** Error: .arg is permitted only inside a macro
+ Detected near line 3 of infiles/02.inc
+ Processing macro a
+ Detected near line 53 of infiles/02
+
+** Warning: one or more items were left unclosed at the end of processing.
+ The numbers are the lines in the original file infiles/02 from where
+ the items were generated:
+66: .figure
+65: .itable
+64: .table
+63: .blockquote
+62: .code
+61: .display
+60: .footnote
+59: .vlist
+58: .olist
+57: .ilist
diff --git a/3rd-party/xfpt/testing/outfiles/03 b/3rd-party/xfpt/testing/outfiles/03
new file mode 100644
index 000000000..6c7486f46
--- /dev/null
+++ b/3rd-party/xfpt/testing/outfiles/03
@@ -0,0 +1,11 @@
+<chapter>
+<title>Testing</title>
+<literallayout class="monospaced">
+box "A"; line; circle "B";
+</literallayout>
+<figure>
+<mediaobject><imageobject>
+<imagedata fileref="infiles/pic01.eps.inc" ></imagedata></imageobject></mediaobject>
+</figure>
+</chapter>
+
diff --git a/3rd-party/xfpt/testing/outfiles/04 b/3rd-party/xfpt/testing/outfiles/04
new file mode 100644
index 000000000..5712bce99
--- /dev/null
+++ b/3rd-party/xfpt/testing/outfiles/04
@@ -0,0 +1,16 @@
+<preface>
+<title>A first preface</title>
+<para>
+This is text in the preface.
+</para>
+</preface>
+
+<?sdop toc_sections="no"?>
+
+<chapter>
+<title>A first chapter</title>
+<para>
+This is text in a chapter
+</para>
+</chapter>
+
diff --git a/3rd-party/xfpt/testing/runtest b/3rd-party/xfpt/testing/runtest
new file mode 100755
index 000000000..a125ce798
--- /dev/null
+++ b/3rd-party/xfpt/testing/runtest
@@ -0,0 +1,165 @@
+#!/usr/bin/perl -w
+
+# Controlling script for xfpt tests
+
+$xfpt = "../src/xfpt -S ../share";
+$cf = (-f "/usr/local/bin/cf")? "cf" : "diff";
+
+$force_update = 0;
+$starttest = undef;
+$endtest = undef;
+$started = 0;
+
+$cmd_options = "";
+while (defined $ARGV[0] && $ARGV[0] =~ /^-/)
+ {
+ my($arg) = shift @ARGV;
+ $cmd_options .= "$arg ";
+ }
+
+if (defined $ARGV[0])
+ {
+ $starttest = $endtest = $ARGV[0];
+ $endtest = $ARGV[1] if defined $ARGV[1];
+ $endtest = undef if $endtest eq "+";
+ }
+
+opendir(DIR, "./infiles") || die "Failed to opendir ./infiles: $!\n";
+@files = sort(readdir(DIR));
+closedir(DIR);
+
+while (scalar @files > 0)
+ {
+ my($copy) = 0;
+ my($file) = shift @files;
+ my($options) = $cmd_options;
+
+ # Skip . and .. and also skip any file ending in .opt because that
+ # contains options for any given test, and any file ending in .inc
+ # because that is an included file.
+
+ next if $file =~ /^\.\.?$|\.opt$|\.inc$/;
+
+ next if !$started && defined $starttest && $file !~ /^$starttest/;
+ $started = 1;
+
+ $options .= `cat infiles/$file.opt` if -e "infiles/$file.opt";
+ chomp $options;
+
+ my ($rc) = system("$xfpt $options -o test.xml infiles/$file " .
+ "2> test.err");
+
+# if (($rc >> 8) != 0)
+# {
+# printf("Test $file RC = 0x%x\n", $rc);
+# system("more test.err");
+# exit 1;
+# }
+
+ # Compare stderr output
+
+ if (! -z "test.err")
+ {
+ if (! -e "outfiles/$file.err")
+ {
+ printf("There is stderr output, but outfiles/$file.err does not exist.\n");
+ system("more test.err");
+ exit 1;
+ }
+
+ $rc = system("$cf test.err outfiles/$file.err >test.cf");
+
+ if ($rc != 0)
+ {
+ # printf("text cf RC=$rc\n");
+ system("more test.cf");
+
+ for (;;)
+ {
+ print "Continue, Update & retry, Quit? [Q] ";
+
+ if ($force_update)
+ {
+ $_ = "u";
+ print "... update forced\n";
+ }
+ else
+ {
+ open(T, "/dev/tty") || die "Failed to open /dev/tty: $!\n";
+ $_ = <T>;
+ close(T);
+ }
+
+ exit 1 if /^q?$/i;
+ goto CHECK_MAIN if /^c$/i;
+
+ if (/^u$/)
+ {
+ exit 1 if system("cp test.err outfiles/$file.err") != 0;
+ unshift @files, $file;
+ print (("#" x 79) . "\n");
+ last;
+ }
+ }
+
+ redo; # Repeats the test
+ }
+ }
+
+ # Compare the main output
+
+ CHECK_MAIN:
+
+ $rc = system("$cf test.xml outfiles/$file >test.cf");
+ if ($rc != 0)
+ {
+ # printf("cf RC=$rc\n");
+ system("more test.cf");
+
+ for (;;)
+ {
+ print "View, Continue, Update & retry, Quit? [Q] ";
+
+ if ($force_update)
+ {
+ $_ = "u";
+ print "... update forced\n";
+ }
+ else
+ {
+ open(T, "/dev/tty") || die "Failed to open /dev/tty: $!\n";
+ $_ = <T>;
+ close(T);
+ }
+
+ exit 1 if /^\s*q?$/i;
+ last if /^\s*c$/i;
+
+ if (/^\s*v$/)
+ {
+ system ("less -XF test.xml");
+ # Stay in loop to reprompt
+ }
+
+ elsif (/^\s*u$/)
+ {
+ exit 1 if system("cp test.xml outfiles/$file") != 0;
+ unshift @files, $file;
+ print (("#" x 79) . "\n");
+ last;
+ }
+ }
+ }
+ else
+ {
+ printf ("Test $file OK\n");
+# system("gzip outfiles/$file");
+ last if defined $endtest && $file =~ /^$endtest/;
+ }
+ }
+
+die "No selected test found\n" if !$started;
+
+system("/bin/rm -rf test.* test-*");
+
+# End