From 7dc539a3ed0e403a7f219f5c2b0f21e99752a8b5 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Fri, 20 Jan 2006 16:15:53 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.00.tar.bz2. --- INSTALL | 184 +++ LICENCE | 340 ++++ Makefile.in | 63 + NOTICE | 21 + README | 30 + configure | 4016 +++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 29 + doc/xfpt.1 | 45 + doc/xfpt.html | 1193 ++++++++++++++ doc/xfpt.pdf | 1678 ++++++++++++++++++++ doc/xfpt.xfpt | 964 ++++++++++++ install-sh | 251 +++ mkinstalldirs | 40 + share/stdflags | 21 + share/stdmacs | 235 +++ src/Makefile | 51 + src/dot.c | 772 +++++++++ src/error.c | 173 ++ src/functions.h | 28 + src/globals.c | 41 + src/globals.h | 43 + src/literal.c | 39 + src/misc.c | 198 +++ src/mytypes.h | 96 ++ src/para.c | 332 ++++ src/read.c | 364 +++++ src/structs.h | 76 + src/tree.c | 216 +++ src/xfpt.c | 201 +++ src/xfpt.h | 53 + testing/infiles/01 | 225 +++ testing/infiles/02 | 40 + testing/outfiles/01 | 271 ++++ testing/outfiles/01.err | 6 + testing/outfiles/02 | 5 + testing/outfiles/02.err | 88 ++ testing/runtest | 164 ++ 37 files changed, 12592 insertions(+) create mode 100644 INSTALL create mode 100644 LICENCE create mode 100644 Makefile.in create mode 100644 NOTICE create mode 100644 README create mode 100755 configure create mode 100644 configure.ac create mode 100644 doc/xfpt.1 create mode 100644 doc/xfpt.html create mode 100644 doc/xfpt.pdf create mode 100644 doc/xfpt.xfpt create mode 100755 install-sh create mode 100755 mkinstalldirs create mode 100644 share/stdflags create mode 100644 share/stdmacs create mode 100644 src/Makefile create mode 100644 src/dot.c create mode 100644 src/error.c create mode 100644 src/functions.h create mode 100644 src/globals.c create mode 100644 src/globals.h create mode 100644 src/literal.c create mode 100644 src/misc.c create mode 100644 src/mytypes.h create mode 100644 src/para.c create mode 100644 src/read.c create mode 100644 src/structs.h create mode 100644 src/tree.c create mode 100644 src/xfpt.c create mode 100644 src/xfpt.h create mode 100644 testing/infiles/01 create mode 100644 testing/infiles/02 create mode 100644 testing/outfiles/01 create mode 100644 testing/outfiles/01.err create mode 100644 testing/outfiles/02 create mode 100644 testing/outfiles/02.err create mode 100755 testing/runtest diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..d9f8acd21 --- /dev/null +++ b/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/LICENCE b/LICENCE new file mode 100644 index 000000000..31d076d96 --- /dev/null +++ b/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. + + + Copyright (C) + + 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. + + , 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/Makefile.in b/Makefile.in new file mode 100644 index 000000000..2c3835e79 --- /dev/null +++ b/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/NOTICE b/NOTICE new file mode 100644 index 000000000..5e206b514 --- /dev/null +++ b/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/README b/README new file mode 100644 index 000000000..f09bb1c75 --- /dev/null +++ b/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: cus.cam.ac.uk +Local part: ph10 diff --git a/configure b/configure new file mode 100755 index 000000000..55bf78a87 --- /dev/null +++ b/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 +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#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 if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &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 +#include +#include +#include +/* 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 +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 to if __STDC__ is defined, since + # 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 +#else +# include +#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 +_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 to if __STDC__ is defined, since + # 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 +#else +# include +#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 +_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 +#include +#include +#include + +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 + +_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 + +_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 +#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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 ." +_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/configure.ac b/configure.ac new file mode 100644 index 000000000..ae510b372 --- /dev/null +++ b/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/doc/xfpt.1 b/doc/xfpt.1 new file mode 100644 index 000000000..8089911df --- /dev/null +++ b/doc/xfpt.1 @@ -0,0 +1,45 @@ +.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. +. +.SH AUTHOR +.rs +.sp +Philip Hazel +.br +University Computing Service +.br +Cambridge CB2 3QG, England. +.P +.in 0 +Last updated: 17 January 2006 +.br +Copyright (c) 2006 University of Cambridge. diff --git a/doc/xfpt.html b/doc/xfpt.html new file mode 100644 index 000000000..49d6e1db7 --- /dev/null +++ b/doc/xfpt.html @@ -0,0 +1,1193 @@ + + + + +The xfpt plain text to XML processor + + + +
+
+
+
+

+ + +The xfpt plain text to XML processor

+
+
+
+

+ +Philip + +Hazel +

+
+
+
+ +
+
+
+ + + + + + + + + +
+ +Revision History +
+Revision 0.00 +16 January 2006 +PH
+
+
+
+
+
+
+

+ +Table of Contents +

+
+
+ + +1. Introduction + +
+
+
+
+ + +1.1. The + +xfpt + +command line + +
+
+ + +1.2. A short + +xfpt + +example + +
+
+ + +1.3. Literal and non-literal processing + +
+
+ + +1.4. Format of directive lines + +
+
+ + +1.5. Calling macros + +
+
+
+
+ + +2. Flag sequences + +
+
+
+
+ + +2.1. Flag sequences for XML entities and + +xfpt + +variables + +
+
+ + +2.2. Flag sequences for calling macros + +
+
+ + +2.3. Other flag sequences + +
+
+ + +2.4. Unrecognized flag sequences + +
+
+ + +2.5. Standard flag sequences + +
+
+
+
+ + +3. Built-in directive processing + +
+
+
+
+ + +3.1. The + +.arg + +directive + +
+
+ + +3.2. The + +.eacharg + +directive + +
+
+ + +3.3. The + +.echo + +directive + +
+
+ + +3.4. The + +.endarg + +directive + +
+
+ + +3.5. The + +.endeach + +directive + +
+
+ + +3.6. The + +.flag + +directive + +
+
+ + +3.7. The + +.include + +directive + +
+
+ + +3.8. The + +.literal + +directive + +
+
+ + +3.9. The + +.macro + +directive + +
+
+ + +3.10. The + +.pop + +directive + +
+
+ + +3.11. The + +.push + +directive + +
+
+ + +3.12. The + +.revision + +directive + +
+
+ + +3.13. The + +.set + +directive + +
+
+
+
+ + +4. The standard macros for DocBook + +
+
+
+
+ + +4.1. Overall setup + +
+
+ + +4.2. Chapters, sections, and subsections + +
+
+ + +4.3. URL references + +
+
+ + +4.4. Itemized lists + +
+
+ + +4.5. Ordered lists + +
+
+ + +4.6. Variable lists + +
+
+ + +4.7. Nested lists + +
+
+ + +4.8. Displayed text + +
+
+ + +4.9. Block quotes + +
+
+ + +4.10. Revision markings + +
+
+ + +4.11. Informal tables + +
+
+ + +4.12. Indexes + +
+
+
+
+
+

xfpt 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 (http://www.methods.co.nz/asciidoc/), +xfpt does not try to produce XML from a document that is also usable as a +freestanding ASCII document. The input for xfpt is very definitely “marked +up”. This makes it less ambiguous for large and/or complicated documents. xfpt +is also much faster than AsciiDoc because it is written in C and does not +rely on pattern matching. +

+xfpt 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. xfpt +restricts itself to two special characters that trigger all its processing. +

+xfpt 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 +xfpt. 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, xfpt converts grave accents and +apostrophes that appear in non-literal text into typographic opening and +closing quotes, as follows: +

 `      becomes  ‘
 '      becomes  ’
+

+Within normal input text, ampersand, grave accent, and apostrophe are the only +characters that cause xfpt to change the input text, and 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, xfpt 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. +

The format of the xfpt command line is: +

xfpt [options] [input source]
+

+If no input is specified, the standard input is read. There are three options: +

-help
+

+This option causes xfpt to output its “usage” message, and exit. +

-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. +

+  -S <directory path>
+

+This option overrides the path to xfpt’s library directory that is built into +the program. This makes it possible to use or test alternate libraries. +

Here is a very short example of a complete xfpt input file that uses some of the +standard macros and flags: +

+ .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
+ and tables.
+

xfpt processes non-directive input lines in one of four ways (known as +“modes”): +

  • +In the default mode, text is processed paragraph by paragraph. 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 xfpt 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. +

  • +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 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. +

  • +In the “literal text” mode, text is also processed line by line, but no flags +are recognized. The only modification xfpt 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. +

  • +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. +

+The .literal directive switches between the modes. It is not normally used +directly, but instead is incorported into appropriate macro definitions. +

+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: +

+ &#x2e;start with a dot
+ &''&.start with a dot
+

+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. +

If an input line starts with a dot followed by a space, it is ignored by xfpt. +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: +

+ .literal layout
+ .set version 0.00
+ .row "Jack's house" 'Jill''s house'
+

+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. +

Macros are defined by the .macro directive, which is described in section +3.9. 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: +

+ .chapter "Chapter title" chapter-reference
+

+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: +

+ Refer to a URL via &url(http://x.example,this text).
+

+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. +

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: +

The quick &&&
    brown &&&
      fox.
+

+produces exactly the same output as: +

+ The quick brown fox.
+

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: +

+ This is an Ohm sign: &#x2126;.
+ This is a degree sign: &#176;.
+

+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: +

  • +The name of an inbuilt xfpt variable. At present, there is only one of these, +called xfpt.rev. Its use is described with the .revision directive +below. +

  • +The name of a user variable that has been set by the .set directive, also +described below. +

  • +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: +

    + This is an Ohm sign: &Ohm;.
    +

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 1.5 for more details. +

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. When the first sequence of a paired flag is encountered, its +partner is expected to be found within the same paragraph (or line, in literal +layout mode). Furthermore, multiple occurrences of paired flags must be +correctly nested. For example, in the standard definitions, &' and +'& are defined as a flag pair for enclosing text in an <emphasis> +element. Each member of the pair is replaced by its replacement text. +

+Note that, though xfpt 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>. +

If an ampersand is not followed by a character sequence in one of the forms +described in the preceding sections, an error occurs. +

These are the standalone flag sequences that are defined in the stdflags +file in the xfpt library: +

&&         becomes  &amp; (ampersand)
&--        becomes  &ndash; (en-dash)
&~         becomes  &nbsp; (‘hard’ space)
+

+These are the flag pairs that are defined in the stdflags file in the xfpt +library: +

&"..."&    becomes <quote>...</quote>
&'...'&    becomes <emphasis>...</emphasis>
&*...*&    becomes <emphasis role="bold">...</emphasis>
&`...`&    becomes <literal>...</literal>
&_..._&    becomes <filename>...</filename>
&(...)&    becomes <command>...</command>
&[...]&    becomes <function>...</function>
&%...%&    becomes <option>...</option>
&$...$&    becomes <varname>...</varname>
&<...>&    becomes <...>
&<<...>>&  becomes <xref linkend="..."/>
+

+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. +

The directives that are built into the code of xfpt are now described in +alphabetical order. You can see more examples of their use in the definitions +of the standard macros in chapter 4. +

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: +

+ .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
+

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. +

+The number given with .eacharg defines which argument to start with. While +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: +

+ .eacharg
+ &<entry>&$+1&</entry>&
+ .endeach
+

+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: +

+ .eacharg 5
+ &<colspec colwidth="$+1" align="$+2"/>&
+ .endeach 2
+

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. +

See the description of .arg above. +

See the description of .eacharg above. +

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: +

+ .flag && "&amp;"
+ .flag &" "&  "<quote>"  "</quote>"
+

+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. +

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 xfpt +library is prepended. Otherwise, the path is used unaltered. +

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 1.3 describes how input lines are processed in +the four modes. +

This directive is used to define macros. It must be followed by a macro name, +and then, optionally, by any number of arguments. These 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 1.5). +

+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: +

+$=<digits><delimiter><text><delimiter>
+

+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: +

+&<chapter$=2+ id="$2"+>&
+

+If this appears in a macro that is called with only one argument, the result +is: +

+<chapter>
+

+but if the second argument is, say abcd, the result is: +

+<chapter id="abcd">
+

+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: +

+  .macro price
+  The price is $$1.
+  .endmacro
+

+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 xfpt 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. +

xfpt 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. +

+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. +

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, that letter is +associated with the string that is pushed, which consists of the rest of the +line. For example, the .chapter macro contains this line: +

+ .push C &</chapter>&
+

+Earlier in the macro there is the line: +

+ .pop C
+

+This arrangement ensures that any previous chapter is terminated before +starting a new one, and also when the end of the input is reached. +

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 xfpt +generates. In addition, a number of the standard macros contain references to +xfpt.rev in appropriate places. Thus, setting: +

+ .revision changed
+

+should cause all subsequent text to be marked up with revisionflag +attributes, until +

+ .revision off
+

+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 +4.10). +

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: +

+ .set version 4.99
+

+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. +

A set of simple macros for commonly needed DocBook features is provided in +xfpt’s library. This may be extended as experience with xfpt accumulates. The +standard macros assume that the standard flags are defined, so a document that +is going to use these features should start with: +

+ .include stdflags
+ .include stdmacs
+

+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. +

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: +

+<?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">
+

+The .book macro has no arguments. It generates <book> and pushes +</book> onto the stack so that it will be output at the end. +

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: +

+ .chapter "Introduction"
+

+sets no ID, but +

+ .section "A section title" "SECTdemo"
+

+can be referenced from elsewhere in the document by a phrase such as: +

+ see section &<<SECTdemo>>&
+

+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: +

+  .chapter "This chapter has quite a long title" "" "Long title"
+

+Where and when the abbreviation is used in place of the full title is +controlled by the stylesheet when the XML is processed. +

+These three macros use the stack to ensure that each chapter, section, and +subsection is terminated at the correct point. For example, starting a new +section automatically terminates an open subsection and a previous section. +

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: +

+ More details are &url(http://x.example, here).
+

+This generates the following XML: +

+ More details are <ulink url="http://x.example">here</ulink>.
+

+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. +

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: +

+ .ilist
+ This is the first item.
+ .next
+ This is the next item.
+ .endlist
+

+There may be more than one paragraph in an item. +

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: +

+arabic        arabic numerals
+loweralpha    lower case letters
+lowerroman    lower case roman numerals
+upperalpha    upper case letters
+upperroman    upper case roman numerals
+

+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: +

+ .olist lowerroman
+ This is the first item.
+ .next
+ This is the next item.
+ .endlist
+

+There may be more than one paragraph in an item. +

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: +

+ .vlist "Font filename extensions"
+ .vitem "TTF"
+ TrueType fonts.
+ .vitem "PFA" "PFB"
+ PostScript fonts.
+ .endlist
+

+As for the other lists, there may be more than one paragraph in an item. +

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. +

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: +

+ .display
+ &`-o`&   set output destination
+ &`-S`&   set library path
+ .endd
+

+The output is as follows: +

-o   set output destination
-S   set library path
+

+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
+ z = sqrt(x*x + y*y);
+ .endd
+

+As the examples illustrate, both kinds of display are terminated by the +.endd macro. +

The macro pair .blockquote and .endblockquote are used to wrap the +lines between them in a <blockquote> element. +

Two macros are provided to simplify setting and unsetting the “changed” +revision marking (see section 3.12). 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: +

+  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.
+

+When called like this, without an argument, .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: +

+  This is a paragraph that has 
+  .new "a few marked words" 
+  within it. Here are &new(some more) marked words.
+

+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. +

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: +

  1. +The frame requirement for the table, which may be one of the words “all”, +“bottom”, “none” (the default), “sides”, “top”, or “topbot”. +

  2. +The “colsep” value for the table. The default is “0”, meaning no vertical +separator lines between columns. The value “1” requests vertical separator +lines. +

  3. +The “rowsep” value for the table. The default is “0”, meaning no horizontal +lines between rows. The value “1” requests horizontal separator lines. +

  4. +The number of columns. +

+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: +

+ .itable all 1 1 2 1in left 2in center
+ .row "cell 11" "cell 12"
+ .row "cell 21" "cell 22"
+ .endtable
+

+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 output looks like this: +

cell 11cell 12
cell 21cell 22

+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. +

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: +

+ .index goose "wild chase"
+ The chasing of wild geese...
+

+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: +

+ .macro cindex
+ &<indexterm role="concept">&
+ &<primary>&$1&</primary>&
+ .arg 2
+ &<secondary>&$2&</secondary>&
+ .endarg
+ &</indexterm>&
+ .endmacro
+

+This defines a .cindex macro for the “concept” index. At the end of the +document you might have: +

+ .makeindex "Concept index" "concept"
+ .makeindex
+

+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. +

diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf new file mode 100644 index 000000000..57a7c3d78 --- /dev/null +++ b/doc/xfpt.pdf @@ -0,0 +1,1678 @@ +%PDF-1.3 +% +4 0 obj +<< /Type /Info +/Producer (FOP 0.20.5) >> +endobj +5 0 obj +<< /Length 210 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gar'"]*cD?&4QKpMCFb+E?F6/VA0dW"cFf4Ym=cJ!muZH7I]VkVF\5I]j)%[c!n4@TF&:j^q#OTJMSJ.-5=OF'R5V'/3%Fm3s*.6-/p,eYgC[(ialRB)Y0bt/kqUsO6P/L@ +endstream +endobj +6 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 5 0 R +>> +endobj +7 0 obj +<< /Length 247 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gaqco5mr90&;BTPME0CaD9(/VCJdJ6FP%_7%T]V_==`\Mg94:D>*c_CHd$j./\!`DcN-BG!ma":Knhqj6!s_e^s\;e!e8)?kG=Q]1gl9<8W;T:H#4OrXtofn*$\Y]`$e-Ip,f`LX1N$`V'g3c^?sSt5h^;OCbAe@,`."ULJh0Y*dXR>eDFdY;2k`sLs^]cWTm7%U,4cP#pQ`+TJX+Bpl]Qh)ehA!WSHpbm!7(N;2Fc2ML/^d-;cr~> +endstream +endobj +8 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 7 0 R +>> +endobj +9 0 obj +<< /Length 21 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Garg^iGoCd!WWA\!CQ~> +endstream +endobj +10 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 9 0 R +>> +endobj +11 0 obj +<< /Length 2207 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gb"/l?#SIU'Sc)J.s.0\.k?(+]Nj.oaO%%SRgoOT?)S7(#dks[Q@j"gIZb\?Ua&P+YV&Q=_Ea2Q(6<854tf.G3BXo9H#q7URLl?kbNVS"U$DP(e0'CV(VjHY7R=,g`Ak>=JU`qiOV?+C_o#g+Fnl>:*3+d7aic8#S#m:<\cOrCC?sQs0N$QDW"o#C`I9,#VS[f-E&3_c:C;H"eYFFe8PK]jS&BmTbQoqIa7nWp^H$!eJ%V;0I4SBoG\h@mSbaV^frpddeNaa=/L];b-N:JNt>s4P8VPpBCXhS[an>J*#X*Q-H>\=miG7`:Eb]$%$kK(cAo9)Gt,JJO&-l6-m*BcCoD*>ilp]>F+9B*,Nbq"9qD#p:9lDmRq4,[L%&MI\Zo/HrOAW"9O.iA$n`[QNYB^OGa4K`A^%u3k6-TQR&R!k@$GZ?R02WW?^bU!eEVpJ)f_XpCl`QrFMZ)rOd'!fZ?k8>MY)JdnCt`7_Y)L$t4BG+:pL>*7PM%>p:C%!auSg&)RAlbm&1f1k?=JgFQ/4.1o;W"9O/SQO#;,'%M4F-n`(Y'Dh+q,5C9i/2;q5_NInFLNnaE/fQ.5uJ\Z9aTU`sEA]&PO*%r\R!KuQ.g$6`Rc5W3>o9-=`\B-9.[NC#b+RiatOP:QuG0.(\kbHs_@"<(>;!?SUeg-qtZS9?a[&<2^C+^&'"?sOh,hf(,F(10]#i>Vrl[8A#$t:Ek$\/%M/mKIO?,b"Ju#!Af;aD$6jA_L&q`n;(R#@%D5ss$JGW0bY/Q])`ju_"9O.iQ[kZ6kYAgQ4NNRI,!gOM(VU'Y==nlPP+#AtcGE'01)"GiR8DB=#Qt2N?QoXGe"#Y7H-R@cn1BaMhIas4aSTL7F2GJlR@e+E3"d+X_V0W=#*(m,J=2ceEcs&*dG=O.5DqSEaB73@fujIH=I_fmWXO3Y2Q"^.b?qM#/6-gc644V9@@'6*8QG[nZY[bk%=4=tNq=m5'9S8cAO9!ATDPJ4_%(R6S=5PTgcWNm`B0=@]9Dr4oMg"b"^e;3Dk!eJC<,u%ZKWgfSW$=mIBFrm4f43Nr?H3fC!5p-^EHs,\!$164URCEZ*&_,P4:gV]$M@MWYM8V_A&-rEQ-leNd+^K8l#V(0"QBk\MA`a0'D"ND$)L;Gf!eE!3L\6Vq/*)A^H=-Np+)k\X94Cq/TEe]BWC;5+'.]?pGhGpq1QJ0OjEiF%&o)oP@Q%^,l2#.]RW5QJs;%%0Q``0+%s7K[kRc,iG=8l,RW]+IDq/Ia.HL<`:D6JcQDg"?r.Cefr1*p(NTBnnCtH;_KB+CA,JJf52dJZN5VBi:t]d!T#7-$1mbEKDM2Vq3AY*?Na!Zomo@N&GY(Wl-6bb=S'dVU6LOGX\McsKds]O$tpr$P;s\ThG"fUd\K*5T)8[5%NM)~> +endstream +endobj +12 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 11 0 R +/Annots 13 0 R +>> +endobj +13 0 obj +[ +14 0 R +16 0 R +18 0 R +20 0 R +22 0 R +24 0 R +26 0 R +28 0 R +30 0 R +32 0 R +34 0 R +36 0 R +38 0 R +40 0 R +42 0 R +44 0 R +46 0 R +48 0 R +50 0 R +52 0 R +54 0 R +56 0 R +58 0 R +60 0 R +62 0 R +64 0 R +66 0 R +68 0 R +70 0 R +72 0 R +74 0 R +76 0 R +78 0 R +80 0 R +82 0 R +84 0 R +86 0 R +88 0 R +90 0 R +] +endobj +14 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 739.79 142.895 728.79 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 15 0 R +/H /I +>> +endobj +16 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 727.69 216.989 716.69 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 17 0 R +/H /I +>> +endobj +18 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 715.59 207.21 704.59 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 19 0 R +/H /I +>> +endobj +20 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 703.49 261.583 692.49 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 21 0 R +/H /I +>> +endobj +22 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 691.39 223.71 680.39 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 23 0 R +/H /I +>> +endobj +24 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 679.29 182.163 668.29 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 25 0 R +/H /I +>> +endobj +26 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 667.19 152.971 656.19 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 27 0 R +/H /I +>> +endobj +28 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 655.09 339.793 644.09 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 29 0 R +/H /I +>> +endobj +30 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 642.99 264.938 631.99 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 31 0 R +/H /I +>> +endobj +32 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 630.89 207.496 619.89 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 33 0 R +/H /I +>> +endobj +34 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 618.79 244.148 607.79 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 35 0 R +/H /I +>> +endobj +36 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 606.69 221.554 595.69 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 37 0 R +/H /I +>> +endobj +38 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 594.59 215.0 583.59 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 39 0 R +/H /I +>> +endobj +40 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 582.49 194.978 571.49 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 41 0 R +/H /I +>> +endobj +42 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 570.39 216.362 559.39 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 43 0 R +/H /I +>> +endobj +44 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 558.29 200.478 547.29 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 45 0 R +/H /I +>> +endobj +46 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 546.19 212.094 535.19 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 47 0 R +/H /I +>> +endobj +48 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 534.09 217.594 523.09 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 49 0 R +/H /I +>> +endobj +50 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 521.99 196.815 510.99 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 51 0 R +/H /I +>> +endobj +52 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 509.89 213.326 498.89 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 53 0 R +/H /I +>> +endobj +54 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 497.79 207.199 486.79 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 55 0 R +/H /I +>> +endobj +56 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 485.69 209.025 474.69 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 57 0 R +/H /I +>> +endobj +58 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 473.59 202.326 462.59 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 59 0 R +/H /I +>> +endobj +60 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 461.49 207.221 450.49 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 61 0 R +/H /I +>> +endobj +62 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 449.39 221.873 438.39 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 63 0 R +/H /I +>> +endobj +64 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 437.29 197.42 426.29 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 65 0 R +/H /I +>> +endobj +66 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 425.19 245.547 414.19 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 67 0 R +/H /I +>> +endobj +68 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 413.09 174.21 402.09 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 69 0 R +/H /I +>> +endobj +70 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 400.99 270.152 389.99 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 71 0 R +/H /I +>> +endobj +72 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 388.89 185.188 377.89 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 73 0 R +/H /I +>> +endobj +74 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 376.79 174.221 365.79 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 75 0 R +/H /I +>> +endobj +76 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 364.69 171.768 353.69 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 77 0 R +/H /I +>> +endobj +78 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 352.59 173.605 341.59 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 79 0 R +/H /I +>> +endobj +80 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 340.49 166.279 329.49 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 81 0 R +/H /I +>> +endobj +82 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 328.39 179.105 317.39 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 83 0 R +/H /I +>> +endobj +84 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 316.29 173.0 305.29 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 85 0 R +/H /I +>> +endobj +86 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 304.19 203.558 293.19 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 87 0 R +/H /I +>> +endobj +88 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 292.09 187.652 281.09 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 89 0 R +/H /I +>> +endobj +90 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 96.0 279.99 154.96 268.99 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 91 0 R +/H /I +>> +endobj +92 0 obj +<< /Length 4043 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +GatU7l]:)9%KF.l76\,k5XlF%mCbr>\[rn:733X1L(/!WVrINkO)9X0EH-Vq%uOVnYJekpcs<8$nI*B2K;?:;6,-d4utK$q7u&+J^R]!96NfBN]0BI.ab?ACl`,?_/Z**m9Zi4YM$&*M(@PRIBRh*JGSaro*C06A%8l'rT]uDYVrO^YMb['($(q7rKY"\&Fh\%a\U4F0,Vdd-PRfAjrshU)4W;\g;1?L%%dS8k.*@T*E1O$ANeHQese#3-B.D@(TggYJ;@g[du"Wh^VG1C2.=$$dTeNW=FR'3^>bhYSm"")YC=(VpCHcaKgFq1A=[H,tk&V?2)]Wk&BX/L[leEYPjq0R`n5RqL?t':,L-AN5][p\FgfEk/Cf+-0kiYY).np\Rhu^D#/r_Y@OZYTulT.=>;P/2^*f(4]3eb7.Yb@@_]&9me>`UkuXH_8fT8NYqXp6jWP!Rp68DJC6ANm!E_m<9\j`'[A)_iXrQJ.n]Yt)=7snIkt<2LN4\DQpjpCb&,$&1g(S<$+94^+%@sV\il,c`bRQP9U?@`kt"=FgMX;;1k\j,2`E@H,F6>0?.P!pMpdCb5#4n>$%D0):7q"@[N9]]iNHZ,.E>$AfYN?q?g8RlZ7/maVK")X-O#A8:rkaQma7.++6`Ii[&jjOEMf[X(lk`b&"N3u]6g_Y,u.`E=66BnO2]Ap%;]`+ns&6E7[J1+-fRkGZ8eL>[C8?e.kP^$=%BjQEYpfB$!>'hF#bg-QN%J5/I2ut!OkDj[_+*+>K`"$2Nu[NkkF"agB5QH7)+4j5LlI,$11GDV7_X3HEE$]&u`.>KRnFPSBA)tJq5QASruX1^3f1AW2#`cW(85g0X.cqe'#<]3HN-_[o")iHlN_3^S_kYhMYuLqW?5$WThJf7!\@Sf2o8_-WL,=m\U,CkUqQcNV,F67S*6`H>CPqUb7g96g1_%je7T@]da!a%s)&W1.?.kPUCNda08$L*;Oqr09[p3s@Yq4$H:Cfrg?WS^`7*?GQhWu\gV<[9MWVC0uA=&Je?*7KX\*Uc("J!`;9rAd;6r*%"N%bAA0a#*@f\!FLE4I[:@1_7PC*a[-aZP\#M-?O^9dPDU[7V7]^A*jQ8jlBY@:gC?Qc"FIn%*C&T3.(L!t0;UnFV6I&B=d"P^M7^@^OEeJ.-%1Ze^cXfk6q55rd<+Kp#nduomi#OUSqJ`Xl\uZ`cnh+)'MajVgIs@,9Mo9LL$okt+"0.>Pf=lF4eK1*qAhJj!JoUk2'ZB'5mPmN$ugLY.j'd8[$9-jQn6%KUkieAgZ9`Pb,Q6lg6YeK^@-2FMVr2H5B;nf(RT3*R^:YoSH'mVnZ>8N6"u.,[b;WrUE^jC80-WKIOY.tKjb5i*>t/uRfZ6dCU-G9=&Bt>NqEG.rE[gC,_8HJJ=N47tj,kgQ!tZh$YWPhEt"gOX^b9u_cubSm28POm3ku$;:oG=GGoEoBV5B*Z]KG``Vd_!Q%p/jh0j2^:)$p.S.BX1)"8B@?F$o5fEb5>N@096lF<8e4\$L'POp.dfVW'&"?cKVcP]kFg!d->R&0"=e9\F%L8l=[Y*3C$2)sB'o[Gg"4Da;]s^e+0)8)Tt6;Hq_q.tfMFL9nJieeI4nr$J7q]V4U^i@75b`D@V^7B&oDITidRA-H_aB"O+#3E2D@PU?n;=r,9a\-&#Dfn"cmE(=>ZfK'oSL(8=AYJXPkhOu(IIF)H@LoJ;)3N>7%.D1(7#_q=e#%NOh1i=Vl+PFWp@\Vp&%0(PJG2&=S`Ap.]h*>n$Y?1N0=j(b[9]E52eIa[WD@Vj#c`qq@[:$.URLc6F/SUYl5P/HfEQYIEdF#*mq)$rmKO=F674IEC`**"mqPc^DHP:uP9N.qI].OCAoL(asgk.XZ>/l*UL]-Ot"l].36B%sku%@eS"2_,u:V[f#&Z>Vc53+m3?+\(fMK':#Y47kN^7gn[$%HeZ+ddZH6g8nhQqYOclOa%L'c7Nh!PahUXRNGhEa$T/24t:'l&S>e/lnEMmUBg5.8FY:G3_NjlTeqrRs[7LXa8hp):tMDaLb4Y5S4(&R^!BuFTX]F]Yt)gMliXPu'V3R`JD*((^MfOk2*'W4O\a_!SN^4p(cSl(]mjVWJpc`!4>DU`W+-kRp\r6$'E1B03Nh4N1<>KCCG3SO-`6*T;j=R._[39dQcXSlISV7.0,.6W"79k\;C;Kfm(-!cQ)T?@D%38?K5h^Y#/JJ$t-AMT/\dW(cB[&Qr?+gi@])nD^Z>4)ktU;MDXWjZ]iFcAGH*2Wmn\EM_HZ.%YL5os5s^;[JQf@eW=k2?h/pEP(+o2C'[ac)(heW))>S(+)9)poEUoGd#miJTH&It1ck2j.AMfI7Yn2O*88muiCO6HS902H56R)^g]Q;rOA*m_.!0q4]SgI*R_^PbrY1\aSLLg=/O;kWIPM^]Mee5Y+f0`]HZt!\=QII8M`gma(ojSk"2;nE"CWNXbXtRL?%>m<69Z`Om@/2FMU4S;"rf/%8>_bcEYm+Y3!snJ0V8roPLb#@q;X>^)nZ,NUEH.(b_igERlj[[D1a&Rp7@&6%*gR%q?Gbkk"85uG8QiuK?GCr035-*8V%Ru*'WltCKi_\X"DEp0js=1RqoE0n.S6.F,.`F%We2DsL*WXE&79E?BFktr'4d=tQCbGa]+pe$VM*7Ss\4]i?s3&h/U1?kO#eT;t1A[0FVE'SR;mp&j3Fn_f^ur,)KNb[,htQ79_Dl):PeB#,)d3703B!u]d71UD#j=td>K[_'lta=>HTGUTTY#oI]u^MAb`P[^0JZX#9T7#`,>rI,Hdj7`=D1`_GN;JB;b!8+8Q`O*s\(6YmapNT075O+V&,/kASnhnpB-kBRsIW@,Q^_0&i7dQ+aX%.>;R#lp(^^=!k/NcQia$#G9rlfR+!kYn*6=%1GR'n;3"1OD;>BJ*mmu2j)Gi.+7:)bBoS`h*OQfhuQ0KUjU4ueIgmE8R[=sItlS^EbhTZn\/0%U'KXQKWnH()e+R8#(btd$85ap(*S8>j?mD(]/:&`>G$r_J`,M/Pd)-Df"4#K[^&*HfU'pN?/L($3jn!^O;mlf&KmXYFIe\cX^%*b;]mjW,%<8>FX?g-)]%XF_C/5\<3-caj,aM"iulA=KJCUa!53^@@;YO%qk\jLk5DS4i\I["TC3I$YGSHAT^:H&bLCHHH]=:"U-J0B<]XG?b";7U_5q]&tmeYq]ZD-pA)a.(pC.p24"f-oG,4*fjl0o"I6Jp"fg!'.^DAEi"X_iU^fs*-l>P%k:&"-5kdH+fWVf*hr'nfk,2<@s"$,2&RR`c%UOC19aOl>Zg!kdA4n]11 +endstream +endobj +93 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 92 0 R +/Annots 94 0 R +>> +endobj +94 0 obj +[ +95 0 R +] +endobj +95 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 77.115 741.664 243.028 730.664 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A << /URI (http://www.methods.co.nz/asciidoc/) +/S /URI >> +/H /I +>> +endobj +96 0 obj +<< /Length 3540 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gatm>95in$&\cSpB^B/NB&I+iIOmAXG*)pn?krbE#76L:JM"._K[jO!;VU70q@l@rXC=ii#nZl>eL),8X;?ekrqYO/n,AjGig<0HLVp`;p\6At7IV,^aonrS/m2'f]8+l'?Q[R.*9FmJ+*X?@4G($a-KUjQ,C6$f1e[)F;Li+d3;G-b*^_%@`4++U?8amlMfc<;fcc0LQ#T4]]N9#L7Y(pjLqW+'=9-6TH2.Es=;/;@5`f_o5lOT^=%E-(#.BpQl!?X/G['K&OiK'n/&l?^WFi2/O`IJ)-!R1^9noTp<+)7\Xa^$r]'n]m(^9gIiLm.Y%qDK+"q]Q`FRkJQW?a[7'l?C;`dbi/@]XhTZ*_@_$q@9@P6r'V,_8u>Li)*HJ09APq5_uk1Hee7F%pWmADu81W6VdkduTpP4'NK3VG%=7t8!*27Q7agW_o%kCBe,pj'_,9]@R+@!7.0@I&M!O4\\^=cW7Uq>L&.igjo"J%rCF/7W[;=Dd26=L63J:U62EKXWp2,T;]7+%7geF*+K#7o&%hs!*Vgp!c3B8IkdD@YlX!FCShkRB0.]kEak/V$0+`^ThFbe<1K^/@4>Gf&d1u]]co^+59V)^&@Y:Ju#S.OM4%#]-^p&aQ@*Ih'*Up,9FRO:4!UN"5dHN!TQIIY5u%Nnm2#WtHIXn_0Qd8.@)fodr4=;4oMP)M,8.)"IiOYZFWe9Om7;Ha`^EJhT*=U"o?l9BK.,L;!o]oA*bDH%!5$sb!pCIQcrWDGr.QW"C+d!Y37.T$T(b!@DRB2h")P%(C:Hd"<.]W4VN>bE/9o0HYY\ba0Md0.44GjBK'0/"?j'F>l0kO1M)'VrYSPr=amlirr-=&qmar=m*[1O)LK10W0tMOP!$$Gnj%fRBd`+#,3G61ZDRPAeB]A9%fMT@oS&pJdB3TQD%`!1H%l5)!I^0B(IkM<\bJX],UX)+csi'R*(c6S,8(/J2/_Z&O+Y9>=Id_9bah`$Z(IE.(X&<1%Daj:=,O!`D&XUO,:X.7n2Gl7"+W`cH,/V3=K>)G3*D@H9.e-Ip8'Qr/_3@pacCn'i-9F'b_LtHC;aP$cJ4]s__(O?RsEn(+?.52/*t!X@S8V12:841,U6W<'NGU66I"b'PZ[FhOc2[RFVOJO["[&RMuE`8VB4De)a9._k9bCYX)S8^b_-]\[.HITE]Ir24pdF3O:[;t94D8UFq!Q7fCj%J]U4b5rd2pW;(<@h]RP*P]g9t4J?<)=%U("EM(j`guDhC:>0-t9/cErES7:I;d&\(rAa@:YtW.=\]rg*l(o[gKi)AlTPLMb]daosK*r,\?@%]Qt[O;j+2T#Nu2?8&D65Nt6p?5Tg.X@\[S0D.a8#j9G']GFj-!>VPDu@"!*h+J95\o9mQj1^*,0?)\llh.pTo`C$RXPP),30I]WT5me7>^@1+AI\fSeUHcq3b553K>#_T%!hSNC88HgE;3WoRjCr*\&'3MlQ_>c,ghk"aRPl*OYNX#eY.Gd#o-EPJE8L^2>`agCLCk9\T>,hXF:A`Yhos&@e1:#_@\\5+_2ZGB2jk@Doc5U,q>t[?C:!+DRVQtVN560j&-\Z-_S3tKc.R9.89b+kHDFR&%GpAg+'SLQH-C$#pf8HWp-l"<9*$-:T@LVR5^kR+]SkNcm[s^c_a:ne[^u?dla>$7KC]1kQUaa9r820\&@:8W($oTu?$f9&kuA#KAB*g`)aO`9l&?$4JI9i;#9Tf<7>:_C"L0!_F46QZo7dhD591u1;mJDik,p%_k)pM-hHU>V;[m"`&EXf\Cp_;4pf"uiJ'Z\Wgs.fSI/c113)5qi&nhT.1O_Tp/RcR\DQ+A`8F&*62F(]\*Yhg/##VhlWO-n60T&u8RiZ($3=TVKCu2>VQF/6AB06VW"n4HSN2>d1a`H.NCU$<+6!AT*Qn1UrK3t*_s.Tj2$Z>8N=LVh7_ZB!AD8erAY,??7ipdI)oiVSK[$li=)<3]4/3BERm?ABmUmHq))8nT4l20p/5PP%>1R82o?`"):CKuE\Ya9F=MOVSdHP.2/P%O%ftGJ6dXpW?`ana!ubuA!W1+R+cFSWp5=5/cXOBl71,@L[tJs,=HAhI@RZ8rm7fP6\"1B@Nj&t/O)R_"k*(W,(*-N2F]K7XSc*5d4juQgL2UHUB+P.",oXl=lt@:?pSN&%$3mncif$4uDs^3NY@E,?iuQ+oV\c)T(!B"As)(8PW";,Mkn\9URCsTOO`_08toR@YuI-+1V\;O)R^+,uVZA-CWH_l>Ju^iXo'!`LI`^0;X8'N#1K=([jZJdXgr@;K(F=NVShQ!eb[(pXj^+NBFiX@SJe!\k/HtW[`5'r\9i>iJmi=/*,;+!G +endstream +endobj +97 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 96 0 R +>> +endobj +98 0 obj +<< /Length 3661 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gatm>=cXN4&UsJX&2o'Z#%Unc9C&Lt,"?D8,/@Z>,`)%WWMpK7XerOfR8JE]Wd.WB/WCPP"rO;QmNRQXf#dp__jc^ZMa`f5e`($;B!ll2P:Tc(QRo-NY\Lj`GuZI1"lS>^HGhU%X$DIWIQTK^%g_XN]3C!PIc??gIsf$+cf3n6BP-9^j0XuN<\2p?(0+MC,gDRGLN;/'jd-$GkbFB_+nr(BMl"@>2)@3mbY664so,]\s6F7-]*ns!3aM,)la%(0I%u>0k3fDBA@s_r/4;9PThK;`Ga@;f+$-RKg=/PoY00cdG's,i&XM.BN9Ii)9S(2-@Y*%WbGXJ]$]F4os?K*:BbY@;rWl:,DP)a65lcE2Ta!]F3EiVto&kio.^n9h3:8jTl4Hd=9`]J-#X0uRhQudZ,-Agg?X/:G(p,!NTBTT;&\Qq$78(!e^EP`ZYs[eIej@(3Y_Wl,<%cllrT]g`<,cNl,QNAo43B.^jN3^PC9]YXXnHGh.h+<:)G+cNh!B"O]=4r>V&/UF0pRmEErf3d*SQmo>/#`$gYA0;gM3hH1l%#6o*DV,cd^+JNFodRJp5Vs8d8?PY?Ybg=_$[-fIF_4P/cm)RXR_M08&UOcu%RXApO2`HfJ>BupOCn7f1XJkDjp8;,/<.re(Qp(up'N.53![C3+%LG3pJH(s$1AqC>OGY0mN!&cRmqWL1kJ?WdE!Pc9dK$?8I6PR^gg)>(!*W`s52.;@U6:fB`b_F+3@6o+@/SHC#s%0Vbc!%k!9[14P@Ur)TlZDR3uc-DPK.>+4VL@l2kRT)T65E?rLRX8e=nE#*`%H[j#"pA6@7--6F'VO3_RGb$!]1W!,Lb-ViiEJC:G?:Z[+"%Y8D";WuQ7g;WjUWHARSqe9)6Ihkp:>C3q=Es1$Z$/s0^.o5G?rS_`!5nUn+6/@m!7HFkPAFN(9(iY#F.(MB,$gM,5(03hMALnqf5MbLC2nK).S(FIdT#f^gOE3^ldMH;F+:n2jP5Cng+8.VC4`&"2`/EGRRiM^5!ei5GJ:5koj[I"_fCcqo=;FF99#"ZOn,m(1.MT7H<_3dVS[l?(#2mnO[T_iGN'nI7W]O0miA+[TiX+kM*d.S09Yl#K_2PoarVa&L0k#T4fS"?Gq#&IFNe!E=S)EM85#"n?#gWBUFEPa@cNU][CP7`jkQ[,75?%IOA+sU7fS$J6K7CYpAO=:-ip$=b_N5Tkt(U$^uZ^H6`&sg+WTj@p"LTM]H(:*TRA4E;jh.Pf2>U.dCgi+&?O6i2iisEJsBdR'Lq-:Xkf\s5c[Ngo1Z-+`e*sZ4*+nn1Fr:D3Pdb7l"KsP%_lj/_"RpcNnY&-#?bjYmC=KK3\^Fn]RAY[)hDd/bO_KF!QC!,UsYpPGS;/J*sAiM%0V.+S,k7i:(/i1E,$_hWlMr'?$>k>o:jsGdkAjM5:9b*1Bd86ur=AiD4PR`Z^$WtkJaE,!R*uIl*Ki^.SB(up57+rCWrW[NiAji(b3;D+D.K%\P-OIm60t0^bhqfT)r/<;#CngeiGqSk"[U.W6%>1D5A<*HY1k1CF5n4@L1bHn+:@'-sZode]+O;/g'P3m]UrglN,t]D-tC$UP#bJ^_`rR\Qg>F&!E&;FN3/2ZbAU*?geMfp%;7pjY@]G\mZ2H=,1J(6A4#oM\$tGYKpeG#_\SnFrAOh6iu#6EC3,14Rh.oLa+.#(&86bUe8MX4"46q1(b:1lgcJfACP"I_2eE.0>I#&a<]=f-,7En%]/O>@(L78*cYkI*C*E3G]1C#d+W;o2u27`MXs^o>d%iBJ/X7l#+0(>a,"K;3C'ac6qJ=?aU=Xg@ZdU?uJ:BU;Qf'7[";"GGeppIE6bP^sJtC4H%Va!"V-SOT/FOBi8/P]S+]=Vns$BH$T]Dq33o6D)fVJ'R0q`X&n@,624<]")0i^Y2La19g!^ENfFuSQ-Ed$*IrZ)RE`&RO*ECkrY9!)m^fj%,T8Yf?mq+\>o;8e!NUB4-%(_+a8[-hp2'Ve7rtX/ZkG_5j7:QI[*GsC4A;"XU[RN%-6t`NH>7lZ*"j2cB?%N1M+@m'N;#5jKRHIg7_I +endstream +endobj +99 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 98 0 R +/Annots 100 0 R +>> +endobj +100 0 obj +[ +101 0 R +] +endobj +101 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 408.465 462.969 422.215 451.969 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 57 0 R +/H /I +>> +endobj +102 0 obj +<< /Length 3377 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gatm>=c_=Y&UsJX&7AmR"60m[A"=Dh&-ED#n3[CNJkR46Yr1et`R^4%*;f&#m'E]\;%=3U(ooj*\rQ3iRelj=h&jA.S%*"Vk$e9Bg-!',2\GtG2e<%m=[fEpd`o[Lo?RpRqmcHdPSN*u^37bbVag[?RJ/d,Ibaj:oC-Bp1Z--U?B_OY="MU+^#&LtH\42]/7WskBA)F"lo>7C=q!a!.#NnEdbD+lVGEqY,fQZK^poSF\CTb'-/UZsf_qVMobD(2?B-Dh^@\I2C!Q"3X%ZZ)\b>TZh+E\rSp3!Jp%GIBWjS2.2S5qUcLN>p:;P0e;=Zi;E%t*ooi)?s`&24u7P'8nDn7Ff!AP(a8]m2hj!*u$RG1=HX.V"H%8!]fjhr=@UgP%"0EqITQX;/VqajI*jAT^ABUE(=QmN![du5dP\j&n>l>rFHJb9=7]1MDQ)rT3Q,6IY)\9(6n]MuqalZ`\(i'[A2=U.,aK*RY<&e1'c=kLS_p.]LMf-9W\I%NKJ)=&W.!RB(P/\akPo9KfL(H\9ThAL[6\6kRjg/0mJo6DCEQ4LXE\<.ch;V-t$,nDZT"kB9'D9m[M@WlK45h!bNL3q>NKeD6.o/*Rn2"j?6,dNNGbcRVc4,A?^:^;(WDVXV)]s-5*sm^SfXe3N'SeFITJWtn0RC$tYoMCCn*$Xsd(q;8rU([?H+r:@=H@2H#@2SO+P6'BC0U_CR%FerME#lQ=;I3K\*5^m7+YfW/qHYmC*r%tlYpm18\_U?dBH%=dI_IhnV`D[q?.cDGYrh`qNqIJ$YSWT84>sf;hAiZH1hSP2XljuG>&HR"`lC>j1=MjmDefoLVC](RL`0ftQ9Sp:ol+6*%9U$mN+'?u`kF!YS/(,WdN?sB]DF(WlnQp!_^_:g5rERp-C9l5GqT'n3R"se7Nc^7"D[]LK]toL]$s8;(;)a2KW(u0N,]-K)V:h-Lrh4)+%P*G%^N+^+2qK..nl3hR:[E'&3;Q9PRT*TJ4kcWc1etFee`CuRjcmugLN`V)4DbK5XV],:m;tI'[^uGZ(U=@Gsm^2d??0>]A*#^FVpR,2a%dep+Eo3Ht3g'q)G:l12YE=pLFSPTQrto>kc(Im"`,[^1-o>j5of*EYq.1P1,=gB0K==biS?Ndu[c0[cqo,24+iN<#7C<856f&pfXWHA#QqONh4bgp%6$q?*iQ]#X5$d<)9loWCDWZT:>8FGsc[$+:t%11O=@Nk#=LbJmYgJe^cDM>oj>7Qje<]iZut-n^M!\gRSRl0/tS-IEARF(%f]IDIVa^NOBLohEqeri?$bbnjnn'mjF"V#/eoBGWGtg]Gu$CN>;_.DJ?K>VSmcd,sk)9;3_i2ALC!d*"(3+!!1-BGWM<[ISK^Y]A-rBf^?i8r[_&n1%BY:m>Fc$RD-qnc=4_h\)j3U2W$Rrioc/ZJOjuor+`qf5j4-i9nV`(q<_0);bZN"TB%s=4)m:QdFKbmfAEf$B7usa1?R$PE=LZ3hZVM)Yq5R\?]m$Sg#">!%\GP=?:`NIdK.`L0i3tcUf?=P3hm*TCX@gTE8DJcXd9EHAle^*g5s>Z^T2JS0%.tsnT'6!VWeuOYC&2PsQb!RDCEgge`@rLMjXLjDKt:^E+`lR3TASiI7^KNn8\p9FTo6$u02A3!AH@F!$Q$-`>iabjs3TV[')M;'!WJ=/b[rs?fhLsllE_q8*O50u,)$\6;%Us!.mn&K=QR]c?^&80S]FAi.:BXLC8b,[rkP<0p3l/@1+6DPU'B/97?Qkbs:]f)fDq.*,Y+,d+tn8;MO3gnP9'=1Vock'c2'X#e+O&,\0>JFI)+ugKc!ohjIkhotglI@X/Z,cjT-Pkc[^`BI'GEYgi9>?dn6?LHrjq&*VEXOkuoUCZm!TkUOGnQ`AO+YeC--P&9%K$T5]i@-N3^r3ut`,)>3ID@L/)'-Qh]K!&24==#guZW4QX1NfOs*1[*pSBmpAH%msLln&IU628pH]DhlGR.G"~> +endstream +endobj +103 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 102 0 R +/Annots 104 0 R +>> +endobj +104 0 obj +[ +105 0 R +] +endobj +105 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 282.166 318.444 295.916 307.444 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 25 0 R +/H /I +>> +endobj +106 0 obj +<< /Length 2416 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gau0EhiHMM%"@YP&JSGr*UZm2rk5.V(tJdMCjXhE)mBaO&hAf97nRWr^$])DUi&T^W'1s@f'u*fnnnuhKut:`^NE!q*r+DZ)![18h=jYiPF)M@,]gLKPT_*U0<[c\T:;si67"ht&#:n14S%UFW9VB[[JY!*C*f9JrOS9Z1@T:i_ERBV;.2]?V:\nL5[M9GqOh4gAU]WQB_1:UYi:c7+]s)Y4s_]Z71eW1N/"Q@;;UafUe=IIN@*X_&oe@skkApl'T*C*V4_#YVujJc9dTL;U0V#<9"0K,^8;Agk6$O!.&fshem5jkeP>:JnU_bj)$JG26?[^SJ9nWP!K:tGRpo_sWn"0#TrQfaYFQJF.Za1\FR>UMY*CW/OCm`Z>\UFOCpj<(K#*!L0!StT4b2!^(dW^:j/;hBCod,nC*[81'>ob^?WDMqYuas=uJ[0FLtE(dM'm5X3udJFpq4F0Lqmo`DK0]^0g>uF*ZSZDI,piGp,(ag.qXS3a0_X&t7lWt\*9.YWL2$&US,PgiG2MMB9aFt&jq!YSiNGuUO.n1GWr28)*uNOq>)3lk(*`-iHM+Dkn#Z1%jYLUc+b7L>HReG%I;$Jj!q*D=:RkShRCT-Xe\S9LP*&BA84?2ou[uVo=kLR(M+q)XZ"N)*53YRs)"mZd\6[,E7IS7Pu5Q1a`LJk<)[=P[jOM2B7Afo:gn!;E&mYD4b.[:s?TqUUYGDb'uc&$p9>.Vh7.\$\U2fpDck0/1XSGrq]:lbFjOpJN$PUDh'u4fBE'N`4X;[/>;Lu:jO+\PWi^tCtI/J3$s\!pCarK7?\e$mRCoN#5I9qY[E\/'Cir[CBCZmR-*]iBKg_HOjufkU\;4IUiO:\X:a\d<22`GL>?qLO0Wp4/HOS`V'@.EW9JRBE'VE;;B+OMW71?eY,)4c'Y[cqkKJ(Xh)S;-qGQ&g1OV,)TeF&B1lahHQHIo5TpZGA80iIK=sPVN<(-kp-ROr_ZWQ4U9pKc0iY6d$t3tod#tCFob;Gl\qBBQ$?t$RWi+6j+W%#nA;F*I3mLRI[5\603/"OgCmpXH8!tn3^sq1KXirZ(#=p+#d.4i+dYSELh(uQZ+AhAr.-URL\jt3Z:g.&UCYWKcs32S^CkXMg`bQ79]&c=RVboolX!9+K*5g[n&kHR#t#J,+RALA':s/&-C`a%.iZNjU7W6tkp?VVG%Qh6:_=2[)d-#Y^AY9>m1?S0MNffsf2T*1$FR.R*LreVhj,6"rF%2unAocB-BEmsI\!6_G:1`@r=Zll\6!$Oohha+r-WIp/VaCoVJqh3R3+l;G'a8LLL-LU-j7]%Vf!B`6/UH\q$0m0:o+~> +endstream +endobj +107 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 106 0 R +>> +endobj +108 0 obj +<< /Length 3125 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +GauHN991#P%_h+-(r7>^`cRFpeU'6eLB2RKRDW@.#Jjk*#MGD[+lt1l4jrSE^T>kAPcO/B!HsSmR\*$*U.C0;lGoe]++?g?EP\Boe)=$.3PL>/&c@PG"UD+W,?C)Ok39PSp\+u@fY$B9$2F6ZNiF/WX2ZB2e]HX?^.JoA\ooIu?8]cYc0q."?XU!P'?>DN\kZ;3,`D=V:FA:1-e%c1)bsl3Pj$K`m3J#G\i^Y0:e:E]XC8g>idH^Za.KfcbI\h':0j>V(me6;/VR8d_s##2,CP@KY5[G5Yi-hd,()E"J%=eF4Xr?.QBkk6&XMd=s.b7!]4i\F%M;YmVcs(CbY^s!J3Y>((1MYSEoieYDg'e+8J"JVb]ZMHO\Zh-MG/'D8FP%NZKf;)Q8kIQ,/fW`C3)51H@JfXh,_Z$;;`==$B>S6Yb#>#6kD%V22+dL@+n6+:]s+)*A09r>p/8pkursn#iu?t3?(8O]:nG>j9=T35e?!#L81>/kCp>%Al!*HI7GAF[ghFQo+4aG=dsR?<["8$?\TAKoKrj)bQp,=b.;+i%BECJUG/k1_9^Ccd-BO.Mu(UP(0g`'4Qp5.g4th2!f2m+`/,$hHP(t=A!%%:(5X_TOU*tgk?4cpIF2:C_.MM3+Df"DdtC.k2Yi0sHur.'q$\RrQ#9=;jTF>/86Yk?B-E[q2/#(LOaq`@-d6?]S\M\E<*dP@-t70rD0!]4o#sKXHU`:6V[4's32;@r;/03U%Ug4M$;4EbOCFHCjgR7f1*!N&9Nj5/jD8(MA;[A7$.#leNb%kq@s_ocju[`%]bOHD+JT'%Y1]EbW06:AtR78%p@C+,>;+rGG?H-&X\;#)/@0fpt(tqq!L2p:HThSeBKW,_SRha:bW(=/-^+?F#$\Rc'.%RYHX!W7ErH66i;FiJ4"9Q,oQ&'>(C)D%jkQ9m_N*H>rIeO_Jde=l+[Ei17N%`>MW'*;qaOX=Fu-*ruKk!>BZj:J-Y`RT$[;MfD'@E;V9g9.pNGRd#(TmUq!8n[oiJ?KjJc79jB?RNu]PAsCc_:OD>Y=bhh%0%h>;h&^[]ne)_3#u+^@FV`iC+1?O2i1`nu-(]alnoFrP3>SC_F"I$s6Q,C?2j8OaQ8Er>88X2N,kNjFp[tm*)Lo3JBp>8N:$r_8Jp]P-gm0Zq1ThQj1hDTg_-5^]Re%ShqSGQs^Cj\P=@jE>5:fC(U^g@_/bMZT*3&_ShCpT2)]&FZgO>$]+gkojoj_.o6lj4r%\lqCJ?$5_]d?l>Vi=X^_KY1IiPpKNZs(V:^0n@(P#WTE3X>:pQ`E9EYrcdk_?VSL#b8-UV;ETH@-=;eU!e3?_PP=dmQ8IFWSKrq'3h>&7u2I#N.u!HfN&#XmPOqq'W4cc#O))OCsZWZ#4jp]V/?NP+n[5o,[a"fCu8$K9!7"*@,?M<^_#h1.n5aNH.eGqZu??^&7isSI*$j:0uNB9Wg_1ZSMp`_E4D7Nb!S(2%@.]eWm&_U2O:rKl*]LH/!d\p@f'fJp/;$(h/I\cWQPKYBGh,1H_4UWX)r2Egs0SA+j:ia;M=>X>-J9VdL9Yb_St4o*qj()0,R$X5>HE6tOtpq,]a2$3f'2gV-%+%.r6./kbe(;)cOK;acT+4,>O1laRe!*]U_dqBoI@J.+%k.Qp<=o4)U$\?3J.'CYNt"7OFO:g4hY2)Ne='j/`n\MDJH,PAB_pD8:JV[F<&#Um"hJ.*pp"`'Ut6;Z09IW*u4mHLr#O0b7Q)Z.$7Ga0oJ3UOMe-F??==_*$p#,E/[2]tJ;-j2jV2:Vd&2@YmA%D=o]KNiRfWpGZc0M_20tah+p+Kk0d/egpLV?>dgDOT^m;M\u#h#0'%8n(MiEUTRXU+@gYM_jRN8Y2>f,F\^D*s&8>G4b>%.\G[o/,-q3$l=-mAV\SOBU&rbCLer?q4$C3cMHKs]5@tM^p8diN>53QJ9':-/Z4sH7_j#e4J>JHPd*Lt#DQm-'gt?morpfXC^R@\tR/~> +endstream +endobj +109 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 108 0 R +/Annots 110 0 R +>> +endobj +110 0 obj +[ +111 0 R +] +endobj +111 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 420.271 753.764 425.771 742.764 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 67 0 R +/H /I +>> +endobj +112 0 obj +<< /Length 3137 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gatm>>Hcd>&q8010FeSE;q,B$QaKNh[(mHu^?e2td"cH[BT#&$+A7SE3H9QINl9Z\-/3-W&KiblOi-.>o?D6!IX-D6j0.u"N*3N55/%=]05n^%!<9o1*jK+:(F]_!pibNlk:($-GFK\K4D.*OUtOnpq'7B(6sU.K3)R&ISN%&K1N`V;oDC8/1#7L+8;A)ICbR2oE])Ti@MYO>nDS(@TggL-6RUVS2RNXVUQqE(Uka62i]O(OYXqdM^"gsa!lK[_8B:7Ko3!b/b#se.-&l#s`5ZiN4j+irrpm1'M\EPBGA=/@PO'YW],aO0:/'_Vf^C`lU85lWG_3k2et*SN[R5B2Bb^5+oShdUa`mD=O8V>+]g$..GHiSJ26Y'UXTL9[3ng/ALSq#oV8b*Rh&U?ff4Ib3rbL"p'`@nT#Ckti5HL>8$s7+8h2@SC*!?oKmh#SNi3PINWr;7")Vks3ppmNF5HNHN90*=[()Fk9K;/uJRAL('YUl0\]RB*p5J./^5:JL9a_kD*!u:sQ_al`Cbr5Ig5d2=^Gh_2`1hTZpr*=E.C#U8@]BTL]`^dCuHA^#FMVc93O/%tOil4cP+n/Jk)Dd]7o.X2)(Eo=914$P[D,&]&'E;4$+DFb/rsP/Ud4n$`jL'1dDsl>"eX,8lX]6#=nKBWd;_$JAkk-#O)BTKkqRB5;a0E'V?M@'>3tKe/eUfU$:9Cipju(F^?)o:dN\"3-Z)FrYX`T%VZlDbU>AjafUutmNS`KKI=?K]\+ZBo9h1e%5+7AMYF#/N3DS6^4Y?0pHUgB3Z-Ir>J!b@$u0e-ia"ksIlXsT%G)!:$u"!,;osI.42a:LTR]qo.ETVXp?sI#HBl1r?K337,V74dS[qhmC&i-&mugTVfl[nfL7EG]aJjcUU#XZ^P#E9s/4h$X:3l3RO9H=-fdfB5Jh.SE1s,ACo`YjL&>/#a/26r@3/Lm8)?9"'XrKD9KK9633J5KjEKmJ#^I:&Pq)n8[r`g)U;r9Z:St'K*:N@Qi=ieQ8I^Y#=!O32XNo/rt$Di1?g)nYP:5BhNGkV!Z!O?IZq-"^BpldH!cme.h.Sj`!0c:Xi\ZYJTb^Fq**&f8om@!.rHr;HR5deI'hgVqYmk:oONX4-4]\O_k;'P9Jro!9l1&tb#nI4GV\6Q*q&N[<3hE(#;>PJCf9eQ_K%uo-HFBqOMZZpjBUbO!k*9as#BX+V?pF)V5n9ZljOc*j:A*:=Fo#,YjADpfeod]:Sd"kahGh&hhrc$1iWR[-0MI/-@_uF=p>'":',?OPmBtdH&ZY&69>RAQ,PHtsA9f0C&aChY-T]Cni[?j>/36bce>+X/@jjW#q)G$^RT>c?SG6%7N%ZOh'5'drT9i18=,?X]jZ&5dYb1tIZTi5EuskH"R:8Gl;FY#m](jCrY[BFmIX"f#VR5tSpMHjEbFU][pD[aR&*6VM8PkFf!F5jW^6k,o^kVc/*2[/q@E$e;9AE/MYZaZ\fYD>hX+acPSo%XmR=&!!D3LnUs`R8/L$7"L1&K(@GX[=EUee7jm>qAeDh.JD%Eb$<./e6B-r^f>3*tgWQO&?]p5"O4qRgtg+?8]YKYL1?oLMs,Z##NK//>%PRjFq^5G'@XTc*E3B>JH?")fX/q_oe4\u8=-+]&$kcu$Q,]5[?$=G$AO<@Mbk)/9Ys3+TjP`o1IO127LLaB31mADQ4+5T)e(Jb-`k`f7hhnbab=OH1+#XYA5V3L*=LWAW;q[[W63b03aLndSr7m\n_1$:E#U[5$Q\;j'dOcmIO>[4-t^FH:1[!8]FXb$qPoP87]!7)sFjuI;,]4;[DcBJNZe/fEYj>EfhX%%a%l&t+=O&jj'bH7j'Jg<0HW?-G:-uUE7ac>K^R/a3=_^oA-RT!G=UH.T6E8Sn.G]cAjaR<2OQ7tp5?ri+)&>r@eDIjTgk)gLpD%t'qYPdATlQC^(6E+,^@<$Ad\j57jPk)XbePEQfNHj;EA>P+f\ZRUHjosZ1ue(X(&?D6e2#(%$FoQknkGR']4gl8kBXk+WFiG]qIPoAn,qMf;I1ZWjZ.=JkPFB5S,WO:rc'%~> +endstream +endobj +113 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 112 0 R +/Annots 114 0 R +>> +endobj +114 0 obj +[ +115 0 R +116 0 R +] +endobj +115 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 72.0 506.655 85.75 495.655 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 21 0 R +/H /I +>> +endobj +116 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 306.916 427.606 320.666 416.606 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 25 0 R +/H /I +>> +endobj +117 0 obj +<< /Length 3580 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gat=.=c_UQ&Up?ZiMXX'i8s1.NaT1(PO&8i,fiU`$'<72/^nR1A^Sm[T)SIg'X&uiZ9(>S1TjM'(0R`&e/T>0ePEQk0%oC52TH2/"i,5@'T706RgQ7OQWc1?5PmuL8b:Re!*U]UJSS")UgMhWjg&gPh+[j2pban!eqH8c;L\j4e""J=W,-7k2QULC#h*Ie?=kZ#IC!6X`YY)"u8.aB,+A/HBLY2eF@U11r1GUehZ$bn4,%=;WRB9jS)U%N^#JYU8IO@-!&KMVAJpXI%N>W/#gAsE,F2.8MJUlTh9gAKOUdknTsgM*j7J(dNa)V"C,*Kmh]%/@Lb5X`Im.n"m9reC,tOg9Ecbe"-/<:LE0:1hNLFW]/)L4udhH;pr5bK!*@Cd]0n)[1.e]jRdJe=PX>@[r2;gqd<1^BaE;%%p-bX7<^i<@$:K3F;E]BW84uS]?lH\`5\sO2a5n`0(bRhU)TtTNqV._O.I8e4bWKJ;?718E8m5-4@_bK(*+8$d5N^+oW3a+gG3F7km!)/_,`eH56lB]X$k8uAT=LM-jj#BZ<]X!HO@!8]MJ`bN)ce*U*-7E8b"EoXCAW=.*&A"QWYnO`2]bn[IJKV(jZ'PO?"_8EYLaXJ>7lN9#n;Cie?S*F7blEc"1Yc-k6C;^BNYBI2'-k-];,1Ui_1S1(C..;6#FSRSb-_*U\b5/!e1X-qE4=^(^?o)%>c;#Ot6)a*W[(ejhT9*c\.pnGko#\a%WE3nV:KgW.:XMV/h1QFGji#"mLMO[.4rF/sP+g&7+r!g$:jq7'\VCABBk\6eYb[a]:Teh2Q#,>F&J:pfDI'=,Nj23#*`],HbD1G,p"r!J6Q[0"hHjGIF"XpWg'NC@[W]Of1\78N8eNIrn!m6q4U-.0+^!rfn>Bpt,3tDY?mJPhljH/$b*U5*_m2#+5]5WhpKl8EmN0GA+6%_Z;'KsNQ+ON+dQI37*K<4&/Bnn7QmtM6_2u0$j>t*YPN)@qZBe(^9H"Ul!1ui2e%ASNo0(*jK.5?aD\W7[-mt7,FB.+T;lD>B[Oh\e;qJ.mgnUjCVIM6,U1D=!tKZug#&h5qMnT$r@lO)GZVD$>M&$9^]o3U0qAK^DA3BO1L,%on@h+e3gXc&=@>HO[GHrQE@(q"NUju;5$Z^(p@nrbajnC9M@=Tl,HiG!C^iJP_naJ']/Pc\[P,EPi%]=?7DLV5>bYR-%>k("#<4V'Lg_Clpj'X5\"ES6Mu:V/[kMmMPfB7b0L0c52I(#9,3Q!tOf3)@1!):--"ZXQ]$9"(\>7PBY5T*(/qUTUMDGZ\):d[V%Tl3ckP@:;<#J+kJZ>FX*IZOQ&e^2Gs_amqlECm@%$NF/1[';JH@f5])ikrnIQm]XXV\MGkq9k.;^q(H_P;Hh^aiU&T%B]ENoBR>Ag^"dNN5MBjR_j3N!-O7=Uto;>qZRsG&1e"\mc6'm[u\ZP,n[Ll&cc!'TF(?f58@2nY$f=Mfe_Z/!XU(iR;q-ZW'(gWDhaI#F7V!4gUrE7IY(ST/u&?a>nke"8roZXnWF>Q%Bp7O2ZKE[Qia60>+D2NuE@A/>9Y\#@j57KrIZ[PE6)ACGcMW*s,GlA2$$7i4;Xs^K_pHlp[#Hhc&p]Zj8Sbpj1e-WMOVb+).(aC1-+5ZGU%t_NVUY;h?V,>H[BgEPJ'r=Y=m[ZP,.4aD.Q]I4fppA1bf+>2aN*lB6D*Ijek[>=8pJSK0[`Q.&X^k_\VkPJ[Vq(@NST=QWuO(dN,$@#%hWeH`n,mETLKk?M^d5EYeD.j,]Mi+KL3IEE(UeRo-6qmcFNe3N)3kj-`fMgL[RfQS[8/#X/NG1YN_;;aNS-UAoTdQ`H$l8slrBl*#IICeG&q7:JM`sZE9*@0$m\)HEE7UJ3ZhFjX^/2p2cZIRKY1:Fg20On6`;*KD$k2l&a=mB+Kf-0UnIL7eRc`%3:qLKZ`b9/^.m2HKYf^Y\c"jkp![*9pGZYVWBSu-j[-fNUd=o2/e'8TQa-)2"'pDJH-JLAZ`;ZDi$JOD6ltf!8Xu%sc8.N>400]^%4I-fo'&4:,?CFWM$$6FDtTgBgDpr!8hc64pg5YdkJ,k0h%X=6)H/7%\%QIGW7LnO!d%FA[i0O6YnXFTLedRl9enBu$#'BkhY]OW(.!j_%2$mRH8hDh\8PNP8g-QG#Mp\td+@J?]c+%SQZ%-#2&5N@mo[X>h\0G((a;XGq=%)Q"mX9(YF9kM?d;fR,K;./GhH,2s(MoGYW2.W-QkbH=3.TkfQBMZcEra0Trm=%'3DQS)e^nX$fj)?;g=u`PTK*75r]80Ml:`&=0GmpLU0pRhZG?XW"@o,qd*R1q_?Y?+Y9qtt\,"e<\T,8\-TAR`F.Hl,p\O*q+Qo:.ZD!I^-1:f1UiiQOtQkT`Wd?p4[u<<.mZk.]&nonES^+jS7s_cY4TR'l9\gX*YdeeW7gpl.!UNMZGUV`V9bi8!K89q8%Amj=$ZU%MutTt]3)m3-uO4i`\Sk +endstream +endobj +118 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 117 0 R +/Annots 119 0 R +>> +endobj +119 0 obj +[ +120 0 R +] +endobj +120 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 208.851 117.874 228.101 106.874 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 87 0 R +/H /I +>> +endobj +121 0 obj +<< /Length 770 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +GasJQ997gM&:j6F'qD:'g1?7r?gXgC2:>Omc%enk%j].$.P[(%al_Is^L@DN*9E@Z4Nr_OiAFuUCa2=R%T$K7!d%NV'\FKn8SD7iVO/\bb"q6I3^3uM)*Mn/L>u"@8^Y*\2;]?mi=MV"D'7MW)PrTp?$YCCh4Vub=L"'&L/l4P$,bZ65d[LZFheR&GtJ5n7E+qoksk7_Ope;ogW;r/*c/ALe&'=6rC-MmmjaJ;DoShk9@5(P8Vfr1dL`Oq6*]PuYBdP=&0'`Q7o*PAZ9q%Qi.s9Mkoj%nR<^]>s8!$&YDb.oaS*gn=[.#b?KcEm49&!\e(.f7Gk(E7WFLh'Z.)i`NiHf3.#\6)EEtK1NM<#[\Q4'[p!?bBgaYgH^U)Blnh5X%QYgmf\^<,.)6s[2?q;+]7*n*dHA-l"`(qT`(AFO^bkV,VJkT@aio3:HJ!_$`5*U7:oc=$lRhcpX.L;>%UGO:g^)qtCA@m<8(;[ik2+m"KM(h>TEX&,d5:Y5lF&WJ^/'SHg*JPYV4+*X&n>oVr:02V.-U"YVCn$`NeLnAmL/0VLVS?VEKBW$`TN`=Y5mV+M*1HUM-mhg@#AR>UZXjj*eBn'"&^icLf<"R7cSjA4l[-AB&";e?Yl~> +endstream +endobj +122 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 121 0 R +>> +endobj +123 0 obj +<< /Length 3425 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gasas=c_;s&q801nFjaB!?>;;1!!me'Bhl.1Y=[6@'^BN9t,htP"28#h>_ps+t6R?C:TI^W'7PfasK);s#[_q\S,KmY/FFi1IbT"2N@/@sJhBf#PaZ?UjD4icU>pJA5>2KI'gDWuZ,%(-1r&;n&(Lf8V(?f%]qArU\S!IuEu,6%?Q:IANS$N\_Hj^=)rifY]OTIcb:9:e3q)Hhqf'4I(L`j+JtZk%*^nI6?(\q+/:nLn301BUh8P-+N:[5nt)u4>le[ija`cP&tZcM8(&Hi-*9Nc0MhE3OpXq1Jq#LRW@U4`\>er^IYo(jG7DM7s(%oQAQI1"pbrq.P*6<%1-EA$<\B)+`[Z7r*.YH0pD;s)+$jl+s2GO.pS7E_cQFb2K%:9[4SJMCqS]-Hk`gW\bUGNB=^OuGpE^TkP6gQZ&]POEe@cgsR45G[fK?k$.9gToT,H4s(Ih.[N76]TskJ+"FSF2K?5f>:2_+YNGqP]p]lY9JaQ\X/e6[5=5R00[4K*]7#;i...rh.BgL1**c7$kV:'ZF_5GmHKnBcqN,tZ1`+M(C$eclnW;jq8K9*-T9CW[NcTpIGtE*0J'N*;-SN%SdjC-ledbEeKk_nbLpm>=ALAT:NA8oVEd;HO3V7F=g)F-:&b)>B16`DcaE-`I]>EWgBVF%)X3d_e_oGJnED2>6Kr-paVcG2'EA;54.2;:]An%8On\bDoj2<=n(RC.0@O(R0q>SNe]&GOj6DZM$^9Y-?kIN`H5l,T;O\Tc@_Q?90QNB,INl/R>>I4eF%?V#UGK(R.*lhC+GW&&f;EHI:#Lauj2hUq/P1=m-)_pm^._Nht!Ai/YL7s)nLG2\q-GX7!mFD`?S*T3l4i^V=o'D+);,U*S-\s75^GL\6/rpgiKbj(,)Q^;'\gqn^]>Y?.d.n%RV,>HL)l5?chXaVmtkdDS6o(9CQ/rdOIWPbCXj6)cX*IpVYNqCN=P_c7oN>OP2-.CU9g>kQgtfWVjoTO0?"RRtRdi5U!ZC')beUA@R3-Z)8OL@)gan7KQE.Beg^F4K1OutQ_J^`smmI=F=c.Cb-j)XOQ6L==kCN,^V<;FK-9/*!)O!9$9RH*)>7hiF/`N6OJT36i[@QhIe5rPZ'u14&(0GO>DAs;l;':4Venk6AXkB&nE^O^lq()pEPLh#o1=cC,=ur&"IY^$<"`"f-U33c90E]@!^/]']i./L?XC9ZGcQ>_$A63$Tjft"#JQ+!)&KeetL5>/M?ip5nQudFZIG+8iY"E1=SU)LW:B,ZFr5>PA*m%?Sq.\1lD,[*4%ULY3/NBJN#=.]qokm5sQSd_'jK=V_k:s=MInQ!tBOAp/<2>(pnC0?"#?iJ=l@]0(g-F6WT:)Yb^X]pgB^9%oQm;(nrTd>;^6YH;TVpFY,kp5i8qjYjn>cgBp2"GAK`f76@]<,UBn%-?_DQY;h04[YQKn0t9P?X_B,],0InkMAYRR:YJV/Fd#VtnVe?i2mRD,g&^I/EPE]bAH_l?^;McmZT5?fQU.?/%=2&a`*AMR2_\YIla]IG3/%s)emjC=T`+`(pHPhH4f3Jb:t2TCuA^N3b=j5_0sj2F?;W.+5Vkf$I0,CV$Mi>^]t8FJF-JCDE$Ion0tcBJ9;RC5M)-L8u9aEM?A4UVH@,N>Z<`qbUY]lMIK*R%sm2rI$mYZh1[i_Yb\:%/1PRf53F/1[L4"q)pB'@&%C^inGVf=NGZ,(=USImAu%*h\KcHl+E68d57d-F`K*O(-o\J(n:'?V@iP+f-_j1lN!LGC.bNS$;7iUYq>['IYW33D(!ihJ49,/*9K9F-Q^TG^`(FBA/)`5;jq'LBq3kLI#Cg&gKeePY,i\%)$eg+b(m%s$$/HIi#?a<$"eIt!!P5S)FRR$RpjXnQHh@@6'SZ#asaRrHg@o9e>idNIB.=i^.j[$@hu\Y&>.\$ED`i?Ou8Y'>9E+%:i3"i@lI]?oi8%OT&=YQ9#E2%-`Xr+6fA[VXR;=*]EA)19sLBOWOaq-l[G=;u::4K=/XU3hL-t6GYiBg%4+^6K'0*(%0Fu*$O\rBj#W,F"V(&*]gg#D1Z4j!2V'SJ26]^X%K7m1i1o&=k9+eslY]0`79amH!dcqi18q"r7qd.nq+pqn-AQt03Fd5U1F[*_uQ>MuRrYsiai7Q`M8U0mPl+)-p3d0PNf<:[.9?7#"WrVK>qTqER+7!O#-Duu_*26StT=-_6n[T5SXU-/c^n@OFD3,VRN#0,YuCa1mLpam5n'IrcVlm@(/+*MGGL:W"789?OfAC[r%!3rf`('55T)0ipXGK@(7qO,?qkY*f0;Q5P?6h6brJOrkLu02JI.Bqe?#gs627rf)~> +endstream +endobj +124 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 123 0 R +>> +endobj +125 0 obj +<< /Length 2806 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gb"/)>Hcd>&q8010_2G=J5\q5W*>B"fE)L?M["U.;&!^;J[XfQ+gU0dno:mCtY`B@U!7!(XHa>KgTnCUZ??Z0Aa@B()WfWZ/!&a(6:-<,(U82i$:UuWYS$'TX%ZNpPYYNIHZ"VHLXE65:)4h)a:L;&Ir4JYQ$TUc,Wnt@5rZ1k07PW5I:<^i=BhANq`J3C\2rCT>gBY&4U9L0Hh,5jJ"&!Sgsc`>qOlpCc(Y&>Mc];HdK"W:=s_ae",dtd6U!Fq!Lf@YaRPYF3ZO/MXpS,IX>nrp61[`#@G0'F7Aa93VBk"`j&n.:-b8A,h9`Dhoa%T#qAJ3E][\7#eo`\9o-(Rn[RcL&>CY>hPc]i0b650KCo8"7CqNFr#GF$L]Um=1"HO>qY3Z&@m`pp8B->e`!InfGkr\t_ST@0'3):CLRbuO'/lEYhKFMb:95I@"\9Fh7:]9snhNR87[7bHkd]LW<2k-"%t%aaWct.*Rp$6["hXHYgu9YV@u(Fn2?l9ahA"J''V^T`VQ(Q'U:#Gm5X()6tr7T6oO]i4#R0J;:THQXIGX\r!qjceK^T3kdbQ3hP_AsVX8ZsUS-9e)SkKm1W`KlA76D;(AV^R1)#ma7B".ZTs%Pt]&dZJc&F7Te9^NZp9RgC>UKS7^b@o\GrD0b+%ia3/IVEg'qa`,J%P16%gr:7YE3r+l,e4!uI8iUt3OKV[Uo,=DstW7OJgbh\p%P-M1eFV>3HF_X((1f=AQ?$(Fs/[,$=,^:uhV>4],>Do0OI?EN*gqYZor::IDWZLt'@NE@,4\5#*fSmJ/L`<4-QZS=jXserM;;4S)+P">@>d]c`:4o^EGjBNOYN&g0C:U@/J#2'+D8aHZo+kLAsX(%ti#P0KpYR#3tWd)\=tiJX.UWH"r.g\K#jU5-5;KPU.3'GGmHt#JjS\u2B&>4$<_Z,70A,HF:O&f^5;d")i4c"Of<>H;9\$Sqf/qCY99%NH4QmCH?V*aBo37]@r^GmHKu<%TWP0:b)=bS-&6hj#).s^(!;J@ZVK,u;F(nk=0tfZ.Fog\"f@L`=d5D?'\V,N(cRSBVkAMPj!Hbe3a+_.E>,i6i3N9M0Q+EOX2I2^cU2aO,O9-R;XXg]8\$!oY\c7_s5urC9(Q*JaYW6ZF-[f?*cX2CB>PV7L9`&)(?0.^ZpT>7GI6f3LJC(Zo%\.NR>%Bn_u0:$q!-p$g$Acq5dT69Z0@G5"-G-&\#r`ISTZbn(3$>*la#JYh:LZhnZc:D`'.?h+)9Isc4;)$4+[_$#X(_n7W?/:Y?P<4*N7h?H!6miL3"$?;U5>+AC!GZ0aVe@>>cpATM@Ydo=`13-56&mFYU(=FX8B&lo.8PAGg*AAFm/q')ZsCtPHN#MlC#?sC$k<3(0t$UsN?H)No9IUpnu?*e^YC=Z.ODq8WfUP+^_-g9eaoqXu=AdPh\_tKVT(KV+#Z"P3==hCn1E6lJB[WrPIPtug4o%NDVYP%d25>7&Zh`#pe\,II/Qrh]$_10A6om?Cc:gAC`MkR9*XF.(,>*bX^ZRoo%dXNpTZANQ6Ju_G!bq(@t/#Y0Z$jAdC#'c]R&.J:m&o)\Sbdp"*3mGtAp^)M-iFn`QT`\h*66Tt@E-!m(MJhbNo)Ss20qg@GU44lLE39a)s/+;3Y$:%.PAo=s^,gb><+^bl7_h`CYUfoCje7/dtO&q6"KrEEbA,^:&%fYWCVJ37-[H'flS"WM2B-[at@sq +endstream +endobj +126 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 125 0 R +>> +endobj +127 0 obj +<< /Length 2937 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +GatU6D3*_c&cR6o_RL,mDX(dY;6O\3i"#"F.FKF(0$j[U!hgpo(06`KP.Y,af68L'iX@En>8.Gb4:fQmE(E/K6f$q'&)VfW(;A,-`RF[9\(H)t(EWMM$fCQCT4Np+93@W6Sp$$Ahm(e=Qb3.66O\t2ipPj1?Trl`ib&i&ZZu?4\XG?`?4\SL^G]BtR()1k[tE:,h0856kTjbhP%lLX>uYCelb;8)M5CHDECg.N&k+A3HI/Q"V@"M1@tOZGHr-1q6c)'fDGS7SS6WMG5Vp>76^p0-3&sSkVl?$_Oc`I*(/REMU8fZ=FfD,V4kj-sk^-?$D\lU+)`d;BFUWNJ(05Lh,*p[X;i"tiP5[hEbMZHO/qDQ9]sN[BGtK5j1>m"HZGm=$;\9#MosH?HUV(b]fO[%WNJ"E'?<1WeEpOl2K+W8!#k0%o5n6`Bqnp(!i<6!s_,>A$-GmL%^CPGfB=A\"@Bnin,-%XO6YI7QA>h-.9d5K?T>b,ILb,Buoi'Q2.rfU?9HC"r<#5(eq3iFU*rXB8!&?3%#GSG;&T#ak7AS#6'WISuT`@R*qsmb8-LGd]g;mI+E'-2h2f?Cmd*HH:'Z+CCSN.l&65IKOn\l#Xi4spOedlj"l)#C%pfA!6>g<4lYTO#YA+aO?93H7A03cI8kO82f-NepD4GDs>L%@D?a7hANa_3T`>SL0GkU@eRN])9Y?7\DtHu/V3jfWJ([eo-j`7=e[6621Y8`%E^W\(NLP0j=.e+A@6UPYL1cHc)/1';Cd\n90$L`\/:T\3,>dk&g^6?_3ICM`t@pUKFCfBa%ib2J.B:,Wj]jg_sMCI)CDkJhJEYaFMh*BHCeej`cYbR+@kB-,TLUbVVR*ORGR"Yh=n6;!aKTfcFOW-'odU\@h.,EXMt\WO%_\)qRC7KIr6/21r/Q,Srh`'/0@NVka$DV1=U]3Fg#]f3R#OQb\Q_52j5'>&Z=^V<+SVSJ&*J;%\uHU#gPEeo]`T_a-/gI(Se2__/%W]I/DW2Q0%KpE+&^1FEFNd9`;a-&!FPWrJT?BqQlZmQ7J7DHO3G$qr'VPV86!#*5g:OGhsL(j[KOe1j3\OK2?!kt?1PXd@YG4+d6Aji/C`f.t4R"5GQ1[N+TA`h[c-n"Uo>)9ms5,?k0RK,K@l$_b'IN>P`5OjWDa]UEl%om&kNG^m`Xe"IVQk33"q8SmTqPK$hdfSF(Eh.W4YS3*&W*#.V)E<8;tAqa`iEB^722%IGa$f^bJ8WoQY:S?jUWX`1mXEDD^O62$)M'iFnFK2I=VArWO/JM4N=-$f3c"i6WaoS-`Eb!F;g3TVqcK6FB/7*>]WsZ,fQ27le:&O\n1APdF`OM?1W/HY*jSf_&V3=!&&(85@9'c*''%@fSM`P&YO]I?0u5J&p6I;\+6]h2)n"lfRo/j<b"fX,]0Z+%UR`M)la#LRZ0s+&?rr0W#K(#PcM-anW#Ci\6k1/p3b1;r_NJrW?b3N8f19#4K)KW.uBEgZ(ZVjLXkn.e!FR-UVUU7ECl"Ua-RPRp1N4jD*=>9.f7VD?EAqa:$'Q$GPD`8N&tuheZO238&:rg'gn"r1uU)j0GOoOe"+1r76G%nT2Afp/W\L30?RB"`<7'"KCY0>,&lU:F$unM9ToKOV?n8q4G(aHqSn8Jb]dVInQ;L\.9(%RCgtPcAZD$_QTkrSD4_@]J'YLBGtQq@-fs4RJ!?W5lICR'O*YTcQa*]`h^tmp\s_4dO$4H;11T,%KoUh`rGeV2O[HX%N%bas+`W>#OQdp073oL-X^22]id$=,?rUE_$_GS[[f193@:qAB9uKGHU2U>4P&8RP,Zp8;NcekSg@QE<8R<8km&qBd!V5,bV1QePViQD@t3r(L4nB70NEYU`\]Q8GV38iJD0V%sO)`V[NC:*E9a-Wr;P +endstream +endobj +128 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 127 0 R +/Annots 129 0 R +>> +endobj +129 0 obj +[ +130 0 R +] +endobj +130 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 106.837 229.741 126.087 218.741 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 63 0 R +/H /I +>> +endobj +131 0 obj +<< /Length 3847 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +GatU6991=,&\d_;&:=aqJI0e9^R[fD(pRKSaW^-n&nH$U,\kh3WE\e.X`j:$;g_YD/^68k*(KTY=Y/-^`Q*0u++ErO\`0,jX/Fd/D"[@MY;5n5X',L([l"hA[bF7AOTnOBsM&N6D*h[:K+L'.;>D_]Jg2)jAhb0Em[Li3D(FtZu'Iu\K8I1\cobZH;n7_8Sr/\olYFF;<'P\j.?"A3ujo[-o:YhT_`LNcDUHLlf2n$J"G^L?Uf=p7qgPK?Lrh6>^@0bkD+Nqk=BK$s1$9_1RuKWToZ,C]I]Cn%7b`Zn1>6u=$6,OS+c4Ej.`EN,$NqQbodf+CU9M%m#[(.2ca_[d">1Ca.A@Uj\d54;-#@.FMV"KJpPsVfsfZME5CE&lbq+KhaE)gMr)?M0_$(nll"BP,JoJF(?k8%.i#\VKZ:L$VIiOQ]Wt9(A@Z(3FuqB,JP6E/jD<'SJV:DP,EORY=//D0!L.eU6AQW*_l9#q:A[m`l48+$-CTm5T$r.JXWo&[+C0o7.X>@cLe"WdD?4,E2CU)g"C.mc*:Io)*IpkAH#"D;sHH:(C&\8+m&;eD[@6S@VE?Fo"5#=cM6ej:$L\i[7YE\DMJ_oFcmFP\O--XS%d1%.q*r?X3,%j]1/&!pM-c.=$GD9MoIbCsG4>,O.p^LmTHKJYVR=P>9CL0]jT$ZVDd5j=rrPb,33^R%1e?'7bZjO%W$Xnr1JA_(b3MHd$YU$SHR8.MGm>T(3V9604eOiAgm5m\`Ai8#s4X$5GRL@h$8Si`Yk3Rn9IJBV%q0$a5f+&f+K]Ogm(.HSXXte6+\1:dB]F$L`_oK>u$3K3QT"AX)Wk7idmgX9h:[n3f1)/NR1kR(DZ3JC0SNLD*`C/@mAf'm0".ngMsE1$gH;qjG^qqMsaIZ()uYUQ]7X-B`*7opeX48;9%RH$ubYYYpGsW/MU`>dEn1+gl[.>@#Z+\NeXqY19(MZ61+.>!(F`NcW2D/$T>>%Ya5Uegf"(fo+au`jRrPn=B)[-_-FSN%d#5VbiPkYo5Tc!^[r)XqqqPQU1PCiG-[7O=Y8nYXVq=*g2iG`XD+loE&\7B>?T!)YCrE!_`L?Yq8Cb)<[89]F(5@Ekp.tI`^F.Begif6SFj/#(U]Qqd3t?!47>mp"^>.YM^lDE1e2fsE"uFW-FF`>7eXb1ZT3+\a53AQ+T.:boR^Pr8b*uQ;",IfZ<^g!mCtWD$T4Q)pDiOZaSeD8qi(0B<)s'*SZd[]K4:?E*hKpdFn-7>Mg*;P#,!;Sq^,2.,8Rq5=!AZcLt@'JtY(/a?JSN]u\ZK?UTV&h2s&(0k,[-ab)47!g>g9Yhga%T9hoOT2@6g3#@dmRN.B!#CPPSmaus,HY>s+'i&n=4W`ob_reR>5UXRcr\g6-,"[/-ihkSA%`mM?O_Ztd'Yh4^;]K;'i;NUI&u\]#LFi..aXnhY;-"9*=/Sa[4d^H%gnamuJi3i\ZlDI-Ak-,-i]7o<8m&PrO*^dKNDXi"V`T3aq,'J>3]rd`quA?-LLaZDRRI6a#':1qA$^pidRZCD4udlqBYq"m"IV6stQ6ThXQNF#]OZ\QBk]%A#dfLmd-?r9<.`4PKWg,V/F^rLR/B#h'@1JUV)A)>d\Thg>F.KNKHp8q'#BV8t]/(tTS6s))Xp?Ok^n"n_:J5`*:.Z^LF)cm[jj"3q+QI5i#!IE$&NpP#uOX'Y\:Ou>i&YO1ZC5"n*gidhPhuj*QX.mO=*3LqQMTE]M\c#6-hd/;An6b'^]Zjg=i@f*>(OBdEIt^r@D\c?rC*(r/GBCjP>,MoWj%ja5ZAirc,B7fb$T&Q6oFVg26-$E(N3$X($tpI:+MSqeIC'\P?_)OGSWl"4]Mjle,R.i.T]KB[Ma]e?F;'$KRK>&rkA-^)3U0i^JEC>ABS8a>i3SI[@aXAoB&bJKjA58UaV1XCYtNaBRk.U1s7fKR&285Dgbjj'XcO^$hI2ekf]"*cD`U*;!&oMC*cL+aId?J_Ung8(i4;&X,Q"rC^+Pf+:)&*U0,]W+JKLQGn:B-#2[_dG?BJhDPc^Rr\G&1WJao)s78R`C3A1\JsZ;O"HK#]#BFu]EWBc(]EN$!M%NVF;I5#TnDBL8KH?"4#?PTUdgQ,"ZHofBL!;+rnhoB(pYj!PNPGL$lbqlbNp!W.beV$#P'"iMS:S$J\m_DP:434p.qQqV2RT8C2e)t`n,1V+A0!^`SsW.=>]I??J853K:[Hu5!>m>_1#cIZ(5kae-XR_@d`nK$"-MOQ7.\>WeLCVrdI?*KNZ#$^cnm7.="niZ*S]/"HQ3#'0(#OD"9GB7iI.\1Bp0CLp3?:.aQESSjPR:(/7;*LVrk^'"JpOu>tZFhc&=-W0D'[I;-/fnsn@e4WV6,pCiDc[`Y_H';\!^Fr.V>RFA5d$]$7(Q_\0If7^d&$:$m!u5Dkn; +endstream +endobj +132 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 131 0 R +>> +endobj +133 0 obj +<< /Length 1696 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gat%$h/D=3%"I_Q@2))V"*1DQ8X;Np$J^@Vd(M&MgH?sn&f^F4?n9Lp^RqS<960%!LHa4`6rKhZ+3FGp]mKTF+p^ISD>/6oFLZs#/H9*G'?R"0"URnuD&`HFf_2(RhEFB#',&Kra+?/X0-/;,n(W8VotUr4^[dAn/DR_5\0FJZ#&gX$?WB,UL;1%>gN[623t1IX!QY)g&!#R4=F4lZYFhQXdIo6XFZt.h4bdqb@%KlQ@ZVs>3t:JXj?KH31feo4I6VaBhOj,2FC\7ROl%)s(OB!g@[_#EgPUbqFa%d5jgY$q/K?_l3<3I\K3\2FD[n"R+lA[?:G;G)#p:o4,s]ZQj2Ual6Z%-krG(mSk9WVeqrB@Gdic2@Cmg_p;O#mS_3k9V.3kVM`p6\%uX_3rFrNl/YuRY8.L&N#Qe`cBG1kAR4`cTbN&3qBjt_s"7Q$#"><'VILuT`9U7iQ@]uJoe+&_uE=Q\@*)n'$d-.nFQ1!sH%*qe3U#(KRW("$hTjI9#KF6>nVT?'4@1H0SGCr7cDPTn=B;\3%4EYs?rgP1sA[3sR0F3uQ$Z.+AqQAV,g@bPm*9>T"\`oIb4,lA0b&1T(JlH2\)L==6%KGh84%9>T(b^Q0&4=,mM9l]s(671(X/mjp6!2kp47>3eLS7m(qjOZ/gPr*sGi.B7*?Vs0N>hXt_Jn=VB94/FNp=r]B5e3aVc;7K6Z=s6JA;iEi7j@r8#f(/,ru`lA:>^ED^\PSJLjIWc:TI:mJZsA\r];tLeT8ni81f(9mqo@Of;9!$d,P0141d2eOXUg]+2O0/\4NnSI@mBA6S/L=rJ6'CjfAfm9O=MdL9+84;8!H=n9V!/UF)N&ej3aRP#%Xl/`K;"#Yp3UdkK==L_mY6gZ=uP63#L\?:5^MJFX@HWgkpYr!C@+AsDq/(I?*+uHp)_Qb+m>Z)lmq2MK8?YE*lC_W*_RU'd5$i]BqPmF;_G]Zp;Lkn^'XV:>A0,/+B[GOXS&.\D8YCi8rrgA)],ClC-F7=g#@*d2(`-k*[S,d=[p_#P+D?"Mmtde6VIO#H)U68a>,*I_\K-)m;@)&CG/09*iomJeMlb":53!_WTt:F8n.nMlH\Jm@W.FrrK&WE;9~> +endstream +endobj +134 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 595 842 ] +/Resources 3 0 R +/Contents 133 0 R +>> +endobj +137 0 obj +<< + /Title (\376\377\0\124\0\150\0\145\0\40\0\170\0\146\0\160\0\164\0\40\0\160\0\154\0\141\0\151\0\156\0\40\0\164\0\145\0\170\0\164\0\40\0\164\0\157\0\40\0\130\0\115\0\114\0\40\0\160\0\162\0\157\0\143\0\145\0\163\0\163\0\157\0\162) + /Parent 135 0 R + /Next 139 0 R + /A 136 0 R +>> endobj +139 0 obj +<< + /Title (\376\377\0\124\0\141\0\142\0\154\0\145\0\40\0\157\0\146\0\40\0\103\0\157\0\156\0\164\0\145\0\156\0\164\0\163) + /Parent 135 0 R + /Prev 137 0 R + /Next 140 0 R + /A 138 0 R +>> endobj +140 0 obj +<< + /Title (\376\377\0\61\0\56\0\240\0\111\0\156\0\164\0\162\0\157\0\144\0\165\0\143\0\164\0\151\0\157\0\156) + /Parent 135 0 R + /First 141 0 R + /Last 145 0 R + /Prev 139 0 R + /Next 146 0 R + /Count -5 + /A 15 0 R +>> endobj +141 0 obj +<< + /Title (\376\377\0\61\0\56\0\61\0\240\0\124\0\150\0\145\0\40\0\170\0\146\0\160\0\164\0\40\0\143\0\157\0\155\0\155\0\141\0\156\0\144\0\40\0\154\0\151\0\156\0\145) + /Parent 140 0 R + /Next 142 0 R + /A 17 0 R +>> endobj +142 0 obj +<< + /Title (\376\377\0\61\0\56\0\62\0\240\0\101\0\40\0\163\0\150\0\157\0\162\0\164\0\40\0\170\0\146\0\160\0\164\0\40\0\145\0\170\0\141\0\155\0\160\0\154\0\145) + /Parent 140 0 R + /Prev 141 0 R + /Next 143 0 R + /A 19 0 R +>> endobj +143 0 obj +<< + /Title (\376\377\0\61\0\56\0\63\0\240\0\114\0\151\0\164\0\145\0\162\0\141\0\154\0\40\0\141\0\156\0\144\0\40\0\156\0\157\0\156\0\55\0\154\0\151\0\164\0\145\0\162\0\141\0\154\0\40\0\160\0\162\0\157\0\143\0\145\0\163\0\163\0\151\0\156\0\147) + /Parent 140 0 R + /Prev 142 0 R + /Next 144 0 R + /A 21 0 R +>> endobj +144 0 obj +<< + /Title (\376\377\0\61\0\56\0\64\0\240\0\106\0\157\0\162\0\155\0\141\0\164\0\40\0\157\0\146\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145\0\40\0\154\0\151\0\156\0\145\0\163) + /Parent 140 0 R + /Prev 143 0 R + /Next 145 0 R + /A 23 0 R +>> endobj +145 0 obj +<< + /Title (\376\377\0\61\0\56\0\65\0\240\0\103\0\141\0\154\0\154\0\151\0\156\0\147\0\40\0\155\0\141\0\143\0\162\0\157\0\163) + /Parent 140 0 R + /Prev 144 0 R + /A 25 0 R +>> endobj +146 0 obj +<< + /Title (\376\377\0\62\0\56\0\240\0\106\0\154\0\141\0\147\0\40\0\163\0\145\0\161\0\165\0\145\0\156\0\143\0\145\0\163) + /Parent 135 0 R + /First 147 0 R + /Last 151 0 R + /Prev 140 0 R + /Next 152 0 R + /Count -5 + /A 27 0 R +>> endobj +147 0 obj +<< + /Title (\376\377\0\62\0\56\0\61\0\240\0\106\0\154\0\141\0\147\0\40\0\163\0\145\0\161\0\165\0\145\0\156\0\143\0\145\0\163\0\40\0\146\0\157\0\162\0\40\0\130\0\115\0\114\0\40\0\145\0\156\0\164\0\151\0\164\0\151\0\145\0\163\0\40\0\141\0\156\0\144\0\40\0\170\0\146\0\160\0\164\0\40\0\166\0\141\0\162\0\151\0\141\0\142\0\154\0\145\0\163) + /Parent 146 0 R + /Next 148 0 R + /A 29 0 R +>> endobj +148 0 obj +<< + /Title (\376\377\0\62\0\56\0\62\0\240\0\106\0\154\0\141\0\147\0\40\0\163\0\145\0\161\0\165\0\145\0\156\0\143\0\145\0\163\0\40\0\146\0\157\0\162\0\40\0\143\0\141\0\154\0\154\0\151\0\156\0\147\0\40\0\155\0\141\0\143\0\162\0\157\0\163) + /Parent 146 0 R + /Prev 147 0 R + /Next 149 0 R + /A 31 0 R +>> endobj +149 0 obj +<< + /Title (\376\377\0\62\0\56\0\63\0\240\0\117\0\164\0\150\0\145\0\162\0\40\0\146\0\154\0\141\0\147\0\40\0\163\0\145\0\161\0\165\0\145\0\156\0\143\0\145\0\163) + /Parent 146 0 R + /Prev 148 0 R + /Next 150 0 R + /A 33 0 R +>> endobj +150 0 obj +<< + /Title (\376\377\0\62\0\56\0\64\0\240\0\125\0\156\0\162\0\145\0\143\0\157\0\147\0\156\0\151\0\172\0\145\0\144\0\40\0\146\0\154\0\141\0\147\0\40\0\163\0\145\0\161\0\165\0\145\0\156\0\143\0\145\0\163) + /Parent 146 0 R + /Prev 149 0 R + /Next 151 0 R + /A 35 0 R +>> endobj +151 0 obj +<< + /Title (\376\377\0\62\0\56\0\65\0\240\0\123\0\164\0\141\0\156\0\144\0\141\0\162\0\144\0\40\0\146\0\154\0\141\0\147\0\40\0\163\0\145\0\161\0\165\0\145\0\156\0\143\0\145\0\163) + /Parent 146 0 R + /Prev 150 0 R + /A 37 0 R +>> endobj +152 0 obj +<< + /Title (\376\377\0\63\0\56\0\240\0\102\0\165\0\151\0\154\0\164\0\55\0\151\0\156\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145\0\40\0\160\0\162\0\157\0\143\0\145\0\163\0\163\0\151\0\156\0\147) + /Parent 135 0 R + /First 153 0 R + /Last 165 0 R + /Prev 146 0 R + /Next 166 0 R + /Count -13 + /A 39 0 R +>> endobj +153 0 obj +<< + /Title (\376\377\0\63\0\56\0\61\0\240\0\124\0\150\0\145\0\40\0\56\0\141\0\162\0\147\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Next 154 0 R + /A 41 0 R +>> endobj +154 0 obj +<< + /Title (\376\377\0\63\0\56\0\62\0\240\0\124\0\150\0\145\0\40\0\56\0\145\0\141\0\143\0\150\0\141\0\162\0\147\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 153 0 R + /Next 155 0 R + /A 43 0 R +>> endobj +155 0 obj +<< + /Title (\376\377\0\63\0\56\0\63\0\240\0\124\0\150\0\145\0\40\0\56\0\145\0\143\0\150\0\157\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 154 0 R + /Next 156 0 R + /A 45 0 R +>> endobj +156 0 obj +<< + /Title (\376\377\0\63\0\56\0\64\0\240\0\124\0\150\0\145\0\40\0\56\0\145\0\156\0\144\0\141\0\162\0\147\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 155 0 R + /Next 157 0 R + /A 47 0 R +>> endobj +157 0 obj +<< + /Title (\376\377\0\63\0\56\0\65\0\240\0\124\0\150\0\145\0\40\0\56\0\145\0\156\0\144\0\145\0\141\0\143\0\150\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 156 0 R + /Next 158 0 R + /A 49 0 R +>> endobj +158 0 obj +<< + /Title (\376\377\0\63\0\56\0\66\0\240\0\124\0\150\0\145\0\40\0\56\0\146\0\154\0\141\0\147\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 157 0 R + /Next 159 0 R + /A 51 0 R +>> endobj +159 0 obj +<< + /Title (\376\377\0\63\0\56\0\67\0\240\0\124\0\150\0\145\0\40\0\56\0\151\0\156\0\143\0\154\0\165\0\144\0\145\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 158 0 R + /Next 160 0 R + /A 53 0 R +>> endobj +160 0 obj +<< + /Title (\376\377\0\63\0\56\0\70\0\240\0\124\0\150\0\145\0\40\0\56\0\154\0\151\0\164\0\145\0\162\0\141\0\154\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 159 0 R + /Next 161 0 R + /A 55 0 R +>> endobj +161 0 obj +<< + /Title (\376\377\0\63\0\56\0\71\0\240\0\124\0\150\0\145\0\40\0\56\0\155\0\141\0\143\0\162\0\157\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 160 0 R + /Next 162 0 R + /A 57 0 R +>> endobj +162 0 obj +<< + /Title (\376\377\0\63\0\56\0\61\0\60\0\240\0\124\0\150\0\145\0\40\0\56\0\160\0\157\0\160\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 161 0 R + /Next 163 0 R + /A 59 0 R +>> endobj +163 0 obj +<< + /Title (\376\377\0\63\0\56\0\61\0\61\0\240\0\124\0\150\0\145\0\40\0\56\0\160\0\165\0\163\0\150\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 162 0 R + /Next 164 0 R + /A 61 0 R +>> endobj +164 0 obj +<< + /Title (\376\377\0\63\0\56\0\61\0\62\0\240\0\124\0\150\0\145\0\40\0\56\0\162\0\145\0\166\0\151\0\163\0\151\0\157\0\156\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 163 0 R + /Next 165 0 R + /A 63 0 R +>> endobj +165 0 obj +<< + /Title (\376\377\0\63\0\56\0\61\0\63\0\240\0\124\0\150\0\145\0\40\0\56\0\163\0\145\0\164\0\40\0\144\0\151\0\162\0\145\0\143\0\164\0\151\0\166\0\145) + /Parent 152 0 R + /Prev 164 0 R + /A 65 0 R +>> endobj +166 0 obj +<< + /Title (\376\377\0\64\0\56\0\240\0\124\0\150\0\145\0\40\0\163\0\164\0\141\0\156\0\144\0\141\0\162\0\144\0\40\0\155\0\141\0\143\0\162\0\157\0\163\0\40\0\146\0\157\0\162\0\40\0\104\0\157\0\143\0\102\0\157\0\157\0\153) + /Parent 135 0 R + /First 167 0 R + /Last 178 0 R + /Prev 152 0 R + /Count -12 + /A 67 0 R +>> endobj +167 0 obj +<< + /Title (\376\377\0\64\0\56\0\61\0\240\0\117\0\166\0\145\0\162\0\141\0\154\0\154\0\40\0\163\0\145\0\164\0\165\0\160) + /Parent 166 0 R + /Next 168 0 R + /A 69 0 R +>> endobj +168 0 obj +<< + /Title (\376\377\0\64\0\56\0\62\0\240\0\103\0\150\0\141\0\160\0\164\0\145\0\162\0\163\0\54\0\40\0\163\0\145\0\143\0\164\0\151\0\157\0\156\0\163\0\54\0\40\0\141\0\156\0\144\0\40\0\163\0\165\0\142\0\163\0\145\0\143\0\164\0\151\0\157\0\156\0\163) + /Parent 166 0 R + /Prev 167 0 R + /Next 169 0 R + /A 71 0 R +>> endobj +169 0 obj +<< + /Title (\376\377\0\64\0\56\0\63\0\240\0\125\0\122\0\114\0\40\0\162\0\145\0\146\0\145\0\162\0\145\0\156\0\143\0\145\0\163) + /Parent 166 0 R + /Prev 168 0 R + /Next 170 0 R + /A 73 0 R +>> endobj +170 0 obj +<< + /Title (\376\377\0\64\0\56\0\64\0\240\0\111\0\164\0\145\0\155\0\151\0\172\0\145\0\144\0\40\0\154\0\151\0\163\0\164\0\163) + /Parent 166 0 R + /Prev 169 0 R + /Next 171 0 R + /A 75 0 R +>> endobj +171 0 obj +<< + /Title (\376\377\0\64\0\56\0\65\0\240\0\117\0\162\0\144\0\145\0\162\0\145\0\144\0\40\0\154\0\151\0\163\0\164\0\163) + /Parent 166 0 R + /Prev 170 0 R + /Next 172 0 R + /A 77 0 R +>> endobj +172 0 obj +<< + /Title (\376\377\0\64\0\56\0\66\0\240\0\126\0\141\0\162\0\151\0\141\0\142\0\154\0\145\0\40\0\154\0\151\0\163\0\164\0\163) + /Parent 166 0 R + /Prev 171 0 R + /Next 173 0 R + /A 79 0 R +>> endobj +173 0 obj +<< + /Title (\376\377\0\64\0\56\0\67\0\240\0\116\0\145\0\163\0\164\0\145\0\144\0\40\0\154\0\151\0\163\0\164\0\163) + /Parent 166 0 R + /Prev 172 0 R + /Next 174 0 R + /A 81 0 R +>> endobj +174 0 obj +<< + /Title (\376\377\0\64\0\56\0\70\0\240\0\104\0\151\0\163\0\160\0\154\0\141\0\171\0\145\0\144\0\40\0\164\0\145\0\170\0\164) + /Parent 166 0 R + /Prev 173 0 R + /Next 175 0 R + /A 83 0 R +>> endobj +175 0 obj +<< + /Title (\376\377\0\64\0\56\0\71\0\240\0\102\0\154\0\157\0\143\0\153\0\40\0\161\0\165\0\157\0\164\0\145\0\163) + /Parent 166 0 R + /Prev 174 0 R + /Next 176 0 R + /A 85 0 R +>> endobj +176 0 obj +<< + /Title (\376\377\0\64\0\56\0\61\0\60\0\240\0\122\0\145\0\166\0\151\0\163\0\151\0\157\0\156\0\40\0\155\0\141\0\162\0\153\0\151\0\156\0\147\0\163) + /Parent 166 0 R + /Prev 175 0 R + /Next 177 0 R + /A 87 0 R +>> endobj +177 0 obj +<< + /Title (\376\377\0\64\0\56\0\61\0\61\0\240\0\111\0\156\0\146\0\157\0\162\0\155\0\141\0\154\0\40\0\164\0\141\0\142\0\154\0\145\0\163) + /Parent 166 0 R + /Prev 176 0 R + /Next 178 0 R + /A 89 0 R +>> endobj +178 0 obj +<< + /Title (\376\377\0\64\0\56\0\61\0\62\0\240\0\111\0\156\0\144\0\145\0\170\0\145\0\163) + /Parent 166 0 R + /Prev 177 0 R + /A 91 0 R +>> endobj +179 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F3 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding >> +endobj +180 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F5 +/BaseFont /Times-Roman +/Encoding /WinAnsiEncoding >> +endobj +181 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding >> +endobj +182 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F6 +/BaseFont /Times-Italic +/Encoding /WinAnsiEncoding >> +endobj +183 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F4 +/BaseFont /Helvetica-BoldOblique +/Encoding /WinAnsiEncoding >> +endobj +184 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F9 +/BaseFont /Courier +/Encoding /WinAnsiEncoding >> +endobj +185 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F7 +/BaseFont /Times-Bold +/Encoding /WinAnsiEncoding >> +endobj +1 0 obj +<< /Type /Pages +/Count 18 +/Kids [6 0 R 8 0 R 10 0 R 12 0 R 93 0 R 97 0 R 99 0 R 103 0 R 107 0 R 109 0 R 113 0 R 118 0 R 122 0 R 124 0 R 126 0 R 128 0 R 132 0 R 134 0 R ] >> +endobj +2 0 obj +<< /Type /Catalog +/Pages 1 0 R + /Outlines 135 0 R + /PageMode /UseOutlines + >> +endobj +3 0 obj +<< +/Font << /F3 179 0 R /F5 180 0 R /F6 182 0 R /F1 181 0 R /F4 183 0 R /F9 184 0 R /F7 185 0 R >> +/ProcSet [ /PDF /ImageC /Text ] >> +endobj +15 0 obj +<< +/S /GoTo +/D [93 0 R /XYZ 67.0 810.889 null] +>> +endobj +17 0 obj +<< +/S /GoTo +/D [93 0 R /XYZ 67.0 340.764 null] +>> +endobj +19 0 obj +<< +/S /GoTo +/D [97 0 R /XYZ 67.0 798.789 null] +>> +endobj +21 0 obj +<< +/S /GoTo +/D [97 0 R /XYZ 67.0 516.174 null] +>> +endobj +23 0 obj +<< +/S /GoTo +/D [99 0 R /XYZ 67.0 667.251 null] +>> +endobj +25 0 obj +<< +/S /GoTo +/D [99 0 R /XYZ 67.0 499.718 null] +>> +endobj +27 0 obj +<< +/S /GoTo +/D [103 0 R /XYZ 67.0 810.889 null] +>> +endobj +29 0 obj +<< +/S /GoTo +/D [103 0 R /XYZ 67.0 632.572 null] +>> +endobj +31 0 obj +<< +/S /GoTo +/D [103 0 R /XYZ 67.0 379.393 null] +>> +endobj +33 0 obj +<< +/S /GoTo +/D [103 0 R /XYZ 67.0 312.444 null] +>> +endobj +35 0 obj +<< +/S /GoTo +/D [107 0 R /XYZ 67.0 684.389 null] +>> +endobj +37 0 obj +<< +/S /GoTo +/D [107 0 R /XYZ 67.0 629.54 null] +>> +endobj +39 0 obj +<< +/S /GoTo +/D [109 0 R /XYZ 67.0 810.889 null] +>> +endobj +41 0 obj +<< +/S /GoTo +/D [109 0 R /XYZ 67.0 747.764 null] +>> +endobj +43 0 obj +<< +/S /GoTo +/D [109 0 R /XYZ 67.0 514.363 null] +>> +endobj +45 0 obj +<< +/S /GoTo +/D [109 0 R /XYZ 67.0 192.346 null] +>> +endobj +47 0 obj +<< +/S /GoTo +/D [109 0 R /XYZ 67.0 125.397 null] +>> +endobj +49 0 obj +<< +/S /GoTo +/D [113 0 R /XYZ 67.0 810.889 null] +>> +endobj +51 0 obj +<< +/S /GoTo +/D [113 0 R /XYZ 67.0 779.14 null] +>> +endobj +53 0 obj +<< +/S /GoTo +/D [113 0 R /XYZ 67.0 646.653 null] +>> +endobj +55 0 obj +<< +/S /GoTo +/D [113 0 R /XYZ 67.0 579.704 null] +>> +endobj +57 0 obj +<< +/S /GoTo +/D [113 0 R /XYZ 67.0 500.655 null] +>> +endobj +59 0 obj +<< +/S /GoTo +/D [118 0 R /XYZ 67.0 720.689 null] +>> +endobj +61 0 obj +<< +/S /GoTo +/D [118 0 R /XYZ 67.0 563.54 null] +>> +endobj +63 0 obj +<< +/S /GoTo +/D [118 0 R /XYZ 67.0 399.307 null] +>> +endobj +65 0 obj +<< +/S /GoTo +/D [118 0 R /XYZ 67.0 111.874 null] +>> +endobj +67 0 obj +<< +/S /GoTo +/D [124 0 R /XYZ 67.0 810.889 null] +>> +endobj +69 0 obj +<< +/S /GoTo +/D [124 0 R /XYZ 67.0 670.126 null] +>> +endobj +71 0 obj +<< +/S /GoTo +/D [124 0 R /XYZ 67.0 526.793 null] +>> +endobj +73 0 obj +<< +/S /GoTo +/D [124 0 R /XYZ 67.0 159.676 null] +>> +endobj +75 0 obj +<< +/S /GoTo +/D [126 0 R /XYZ 67.0 712.351 null] +>> +endobj +77 0 obj +<< +/S /GoTo +/D [126 0 R /XYZ 67.0 502.226 null] +>> +endobj +79 0 obj +<< +/S /GoTo +/D [126 0 R /XYZ 67.0 243.701 null] +>> +endobj +81 0 obj +<< +/S /GoTo +/D [128 0 R /XYZ 67.0 757.451 null] +>> +endobj +83 0 obj +<< +/S /GoTo +/D [128 0 R /XYZ 67.0 678.402 null] +>> +endobj +85 0 obj +<< +/S /GoTo +/D [128 0 R /XYZ 67.0 333.439 null] +>> +endobj +87 0 obj +<< +/S /GoTo +/D [128 0 R /XYZ 67.0 278.59 null] +>> +endobj +89 0 obj +<< +/S /GoTo +/D [132 0 R /XYZ 67.0 677.305 null] +>> +endobj +91 0 obj +<< +/S /GoTo +/D [132 0 R /XYZ 67.0 153.376 null] +>> +endobj +135 0 obj +<< + /First 137 0 R + /Last 166 0 R +>> endobj +136 0 obj +<< +/S /GoTo +/D [10 0 R /XYZ 67.0 810.889 null] +>> +endobj +138 0 obj +<< +/S /GoTo +/D [12 0 R /XYZ 67.0 799.889 null] +>> +endobj +xref +0 186 +0000000000 65535 f +0000066494 00000 n +0000066682 00000 n +0000066775 00000 n +0000000015 00000 n +0000000071 00000 n +0000000372 00000 n +0000000478 00000 n +0000000816 00000 n +0000000922 00000 n +0000001033 00000 n +0000001140 00000 n +0000003440 00000 n +0000003563 00000 n +0000003856 00000 n +0000066927 00000 n +0000003990 00000 n +0000066993 00000 n +0000004124 00000 n +0000067059 00000 n +0000004257 00000 n +0000067125 00000 n +0000004391 00000 n +0000067191 00000 n +0000004524 00000 n +0000067257 00000 n +0000004658 00000 n +0000067323 00000 n +0000004792 00000 n +0000067390 00000 n +0000004926 00000 n +0000067457 00000 n +0000005060 00000 n +0000067524 00000 n +0000005194 00000 n +0000067591 00000 n +0000005328 00000 n +0000067658 00000 n +0000005462 00000 n +0000067724 00000 n +0000005594 00000 n +0000067791 00000 n +0000005728 00000 n +0000067858 00000 n +0000005862 00000 n +0000067925 00000 n +0000005996 00000 n +0000067992 00000 n +0000006130 00000 n +0000068059 00000 n +0000006264 00000 n +0000068126 00000 n +0000006398 00000 n +0000068192 00000 n +0000006532 00000 n +0000068259 00000 n +0000006666 00000 n +0000068326 00000 n +0000006800 00000 n +0000068393 00000 n +0000006934 00000 n +0000068460 00000 n +0000007068 00000 n +0000068526 00000 n +0000007202 00000 n +0000068593 00000 n +0000007335 00000 n +0000068660 00000 n +0000007469 00000 n +0000068727 00000 n +0000007602 00000 n +0000068794 00000 n +0000007736 00000 n +0000068861 00000 n +0000007870 00000 n +0000068928 00000 n +0000008004 00000 n +0000068995 00000 n +0000008138 00000 n +0000069062 00000 n +0000008272 00000 n +0000069129 00000 n +0000008406 00000 n +0000069196 00000 n +0000008540 00000 n +0000069263 00000 n +0000008672 00000 n +0000069330 00000 n +0000008806 00000 n +0000069396 00000 n +0000008940 00000 n +0000069463 00000 n +0000009073 00000 n +0000013209 00000 n +0000013332 00000 n +0000013359 00000 n +0000013546 00000 n +0000017179 00000 n +0000017287 00000 n +0000021041 00000 n +0000021165 00000 n +0000021194 00000 n +0000021334 00000 n +0000024805 00000 n +0000024931 00000 n +0000024960 00000 n +0000025100 00000 n +0000027610 00000 n +0000027720 00000 n +0000030939 00000 n +0000031065 00000 n +0000031094 00000 n +0000031234 00000 n +0000034465 00000 n +0000034591 00000 n +0000034628 00000 n +0000034763 00000 n +0000034903 00000 n +0000038577 00000 n +0000038703 00000 n +0000038732 00000 n +0000038872 00000 n +0000039735 00000 n +0000039845 00000 n +0000043364 00000 n +0000043474 00000 n +0000046374 00000 n +0000046484 00000 n +0000049515 00000 n +0000049641 00000 n +0000049670 00000 n +0000049810 00000 n +0000053751 00000 n +0000053861 00000 n +0000055651 00000 n +0000069530 00000 n +0000069584 00000 n +0000055761 00000 n +0000069651 00000 n +0000056057 00000 n +0000056258 00000 n +0000056488 00000 n +0000056717 00000 n +0000056955 00000 n +0000057276 00000 n +0000057544 00000 n +0000057733 00000 n +0000057974 00000 n +0000058373 00000 n +0000058688 00000 n +0000058927 00000 n +0000059208 00000 n +0000059450 00000 n +0000059780 00000 n +0000059991 00000 n +0000060241 00000 n +0000060473 00000 n +0000060717 00000 n +0000060967 00000 n +0000061199 00000 n +0000061449 00000 n +0000061699 00000 n +0000061937 00000 n +0000062168 00000 n +0000062405 00000 n +0000062666 00000 n +0000062882 00000 n +0000063208 00000 n +0000063391 00000 n +0000063717 00000 n +0000063921 00000 n +0000064125 00000 n +0000064323 00000 n +0000064527 00000 n +0000064719 00000 n +0000064923 00000 n +0000065115 00000 n +0000065342 00000 n +0000065557 00000 n +0000065710 00000 n +0000065824 00000 n +0000065935 00000 n +0000066044 00000 n +0000066156 00000 n +0000066277 00000 n +0000066384 00000 n +trailer +<< +/Size 186 +/Root 2 0 R +/Info 4 0 R +>> +startxref +69718 +%%EOF diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt new file mode 100644 index 000000000..d8f3c842f --- /dev/null +++ b/doc/xfpt.xfpt @@ -0,0 +1,964 @@ +.include stdflags +.include stdmacs + +. We are going to type the name xfpt rather a lot. Make it easier: +.set X "xfpt" + + +. ---------------------------------------------------------------------------- +.docbook +.book + +.literal xml + +The xfpt plain text to XML processor +xfpt +16 January 2006 + + Philip + Hazel + +PH +0.0016 January 2006PH +2006University of Cambridge + +.literal off + + + +. ---------------------------------------------------------------------------- +.chapter "Introduction" +&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 &``&; 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 + &` ` `& becomes  ` + &` ' `& becomes  ' +.endd + +Within normal input text, ampersand, grave accent, and apostrophe are the only +characters that cause &X; to change the input text, and 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 (&`&&`&, &`&<`&, or +&`&>`&, respectively) is generated. + + +.section "The &X; command line" +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 three options: +.display + &`-help`& +.endd +This option causes &X; to output its &"usage"& message, and exit. + +.display + &`-o `&&''& +.endd +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. +.display + &`-S `&&''& +.endd +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. + + +.section "A short &X; example" +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 + and tables. +.endd + + + +.section "Literal and non-literal processing" "SECTliteralprocessing" +&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. 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 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 &``& 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 &``& 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 &``& 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. + +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 + .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" +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" +Macros are defined by the &*.macro*& directive, which is described in section +&<>&. 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" +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 &&&`& + &` brown &&&`& + &` fox.`& +.endd + +produces exactly the same output as: + +.code + The quick brown fox. +.endd + + +.section "Flag sequences for XML entities and &X; variables" +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: Ω. + This is a degree sign: °. +.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" +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 &<>& for more details. + + + +.section "Other flag sequences" +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 &`&&`&. + +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. When the first sequence of a paired flag is encountered, its +partner is expected to be found within the same paragraph (or line, in literal +layout mode). Furthermore, multiple occurrences of paired flags must be +correctly nested. For example, in the standard definitions, &`&&'`& and +&`'&&`& are defined as a flag pair for enclosing text in an &``& +element. Each member of the pair is replaced by its replacement text. + +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 &``& within &``&, though it does allow &``& +within &``&. + +.section "Unrecognized flag sequences" +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" +These are the standalone flag sequences that are defined in the &_stdflags_& +file in the &X; library: +.display + &`&&&& `& becomes &` &&`& (ampersand) + &`&&-- `& becomes &` &–`& (en-dash) + &`&&~ `& becomes &` & `& (`hard' space) +.endd +These are the flag pairs that are defined in the &_stdflags_& file in the &X; +library: +.display + &`&&"..."&& `& becomes &`...`& + &`&&'...'&& `& becomes &`...`& + &`&&*...*&& `& becomes &`...`& + &`&&`...`&& `& becomes &`...`& + &`&&_..._&& `& becomes &`...`& + &`&&(...)&& `& becomes &`...`& + &`&&[...]&& `& becomes &`...`& + &`&&%...%&& `& becomes &``& + &`&&$...$&& `& becomes &`...`& + &`&&<...>&& `& becomes &`<...>`& + &`&&<<...>>&& `& becomes &``& +.endd +For example, if you want to include a literal XML element in your output, you +can do it like this: &`&&&&`&. 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" +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 definitions +of the standard macros in chapter &<>&. + + +.section "The &*.arg*& directive" +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 + + +.section "The &*.eacharg*& directive" +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. + +The number given with &*.eacharg*& defines which argument to start with. While +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 &``& element for each of its arguments: +.code + .eacharg + &&$+1&& + .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 + && + .endeach 2 +.endd + + +.section "The &*.echo*& directive" +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" +See the description of &*.arg*& above. + + +.section "The &*.endeach*& directive" +See the description of &*.eacharg*& above. + + +.section "The &*.flag*& directive" +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 && "&" + .flag &" "& "" "" +.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" +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. + + +.section "The &*.literal*& directive" +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 &<>& describes how input lines are processed in +the four modes. + + +.section "The &*.macro*& directive" "SECTmacro" +This directive is used to define macros. It must be followed by a macro name, +and then, optionally, by any number of arguments. These 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 &<>&). + +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 +&`$=`&&''& +.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 +&& +.endd +If this appears in a macro that is called with only one argument, the result +is: +.code + +.endd +but if the second argument is, say &`abcd`&, the result is: +.code + +.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 &*.pop*& directive" +&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. + +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" +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, that letter is +associated with the string that is pushed, which consists of the rest of the +line. For example, the &*.chapter*& macro contains this line: +.code + .push C && +.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. + + +.section "The &*.revision*& directive" "SECTrevision" +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 &``& 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 +&<>&). + + +.section "The &*.set*& directive" +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" +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" +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 + + +.endd +The &*.book*& macro has no arguments. It generates &``& and pushes +&``& onto the stack so that it will be output at the end. + + +.section "Chapters, sections, and subsections" +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 &<>& +.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 &``& 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. + +These three macros use the stack to ensure that each chapter, section, and +subsection is terminated at the correct point. For example, starting a new +section automatically terminates an open subsection and a previous section. + + + +.section "URL references" +The &*url*& macro generates URL references, and is intended to be called inline +within the text that is being processed. It generates a &``& 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 here. +.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 &``&, which in most cases (such as the example above), you +do not want. + + + +.section "Itemized lists" +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 +&``& 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" +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" +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" +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" +In displayed text each non-directive input line generates one output line. The +&``& 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 &``& 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" +The macro pair &*.blockquote*& and &*.endblockquote*& are used to wrap the +lines between them in a &`
`& element. + + +.section "Revision markings" "SECTrevmacs" +Two macros are provided to simplify setting and unsetting the &"changed"& +revision marking (see section &<>&). 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, &*.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 &``& XML element with the +&`revisionflag`& attribute set. The &*.wen*& macro is not used in this case. + + +.section "Informal tables" +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 output 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 +&``& 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 &``& element with &`revisionflag`& +set. + + +.section "Indexes" +The &*.index*& macro generates &``& 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 + +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 &``& element that is generated. For this to be useful, you need to +generate &``& 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 + && + &&$1&& + .arg 2 + &&$2&& + .endarg + && + .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/install-sh b/install-sh new file mode 100755 index 000000000..e9de23842 --- /dev/null +++ b/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/mkinstalldirs b/mkinstalldirs new file mode 100755 index 000000000..70f983f5c --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# 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/share/stdflags b/share/stdflags new file mode 100644 index 000000000..577330cfe --- /dev/null +++ b/share/stdflags @@ -0,0 +1,21 @@ +. These are the standard flag definitions for xfpt. +. +.flag &~ " " +.flag && "&" +.flag &-- "–" +. +.flag &' '& "" "" +.flag &* *& "" "" +. +.flag &( )& "" "" +.flag &_ _& "" "" +.flag &[ ]& "" "" +.flag &` `& "" "" +.flag &% %& "" +.flag &" "& "" "" +.flag &$ $& "" "" +. +.flag &< >& "<" ">" +.flag &<< >>& "" +. +. End diff --git a/share/stdmacs b/share/stdmacs new file mode 100644 index 000000000..965f5911a --- /dev/null +++ b/share/stdmacs @@ -0,0 +1,235 @@ +. Standard macros for xfpt + +. =============== Standard boilerplate =============== + +.macro docbook +.literal layout +&& +&& +.endmacro + +. =============== Large text items =============== + +.macro book +.literal layout +.push && +&& +.literal off +.endmacro + +.macro chapter +.literal layout +.pop C +.push C +.push && +&& +.arg 1 +&&$1&& +.endarg +.arg 3 +&&$3&& +.endarg +.literal off +.endmacro + +.macro section +.literal layout +.pop S +.push S && +&& +.arg 1 +&&$1&& +.endarg +.arg 3 +&&$3&& +.endarg +.literal off +.endmacro + +.macro subsection +.literal layout +.pop U +.push U && +&& +.arg 1 +&&$1&& +.endarg +.arg 3 +&&$3&& +.endarg +.literal off +.endmacro + +. =============== Lists =============== + +.macro ilist +.literal layout +.push L && +.push I && +&& +&& +.literal off +.endmacro + +.macro olist "arabic" +.literal layout +.push L && +.push I && +&& +&& +.literal off +.endmacro + +.macro next +.literal layout +.pop I +.push I && +&& +.literal off +.endmacro + +.macro endlist +.literal layout +.pop L +.literal off +.endmacro + +.macro vlist +.literal layout +.push L && +&& +.arg 1 +&&$1&& +.endarg +.endmacro + +.macro vitem +.literal layout +.pop I +.push I &&&& +&& +.eacharg +&&$+1&& +.endeach +&& +.literal off +.endmacro + +. =============== Displayed text =============== + +.macro display +.literal layout +&& +.endmacro + +.macro code +.literal layout +&& +.literal text +.endmacro + +.macro endd +.literal layout +&& +.literal off +.endmacro + +. =============== Block quotes =============== + +.macro blockquote +.literal layout +&& +.literal off +.endmacro + +.macro endblockquote +.literal layout +&
& +.literal off +.endmacro + +. =============== Tables =============== + +.macro itable "none" "0" "0" "2" "1*" "left" "1*" "left" +.literal layout +&& +&& +.eacharg 5 +&& +.endeach 2 +&& +.endmacro + +.macro row +.literal layout +&& +.eacharg +&&$+1&& +.endeach +&& +.endmacro + +.macro endtable +.literal layout +&& +&& +&& +.literal off +.endmacro + +. =============== Indexing =============== + +.macro index +&& +&&$1&& +.arg 2 +&&$2&& +.endarg +&& +.endmacro + +.macro makeindex "Index" +.literal layout +.pop C +.push C +.push && +.arg -2 +&& +.endarg +.arg 2 +&& +.endarg +&&$1&& +.literal off +.endmacro + +. =============== URL =============== + +.macro url +.arg -2 +&*&&$1&&*& +.endarg +.arg 2 +&*&&$2&&*& +.endarg +.endmacro + +. =============== Change flags =============== + +.macro new +.arg -1 +.literal layout +.revision changed +.literal off +.endarg +.arg 1 +&&$1&& +.endmacro + +.macro wen +.literal layout +.revision off +.literal off +.endmacro + +. End diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 000000000..b34184d9e --- /dev/null +++ b/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/src/dot.c b/src/dot.c new file mode 100644 index 000000000..2e9949652 --- /dev/null +++ b/src/dot.c @@ -0,0 +1,772 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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. + +Argument: the terminator directive +Returns: nothing +*/ + +static void +skipto(uschar *s) +{ +int length = Ustrlen(s); +BOOL done = macrocurrent->nextline == NULL; +while (!done) + { + uschar *p = macrocurrent->nextline->string; + done = Ustrncmp(p, s, length) == 0 && (p[length] == 0 || isspace(p[length])); + macrocurrent->nextline = macrocurrent->nextline->next; + if (macrocurrent->nextline == NULL) + { + macroexe *temp = macrocurrent; + macrocurrent = macrocurrent->prev; + free(temp); + 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 (macrocurrent == NULL) { 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".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 (macrocurrent == NULL) { 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".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 (macrocurrent == NULL) { 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 (macrocurrent == NULL) { 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 .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 * +*************************************************/ + +/* We set up a stack of included files so that the input is treated as one big +file. + +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 */ +} + + + + +/************************************************* +* 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 .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. + +Argument: the rest of the line +Returns: nothing +*/ + +static void +do_push(uschar *p) +{ +int length; +int letter = 0; +pushstr *ps; +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 (*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; +memcpy(ps->string, p, length); +ps->string[length] = 0; +ps->next = pushed; +pushed = ps; +} + + + + +/************************************************* +* Handle .revision * +*************************************************/ + +/* Set or unset a text for 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".flag", 5, do_flag, FALSE, FALSE }, + { US".include", 8, do_include, TRUE, FALSE }, + { US".literal", 8, do_literal, TRUE, FALSE }, + { US".macro", 6, do_macro, FALSE, 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 */ + +me = misc_malloc(sizeof(macroexe)); +me->prev = macrocurrent; +macrocurrent = me; +me->macro = md; +me->nextline = md->lines; + +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/src/error.c b/src/error.c new file mode 100644 index 000000000..9c9a42549 --- /dev/null +++ b/src/error.c @@ -0,0 +1,173 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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; +static BOOL suppress_warnings = FALSE; + + + +/************************************************* +* 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\", 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" } +}; + +#define error_maxerror 25 + + + +/************************************************* +* 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; +macroexe *me; +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); + +for (me = macrocurrent; me != NULL; me = me->prev) + { + (void)fprintf(stderr, " Processing macro %s\n", me->macro->name); + } + +if (istack != NULL) + { + (void)fprintf(stderr, " Detected near line %d of %s\n", + istack->linenumber, istack->filename); + } +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/src/functions.h b/src/functions.h new file mode 100644 index 000000000..53de12acc --- /dev/null +++ b/src/functions.h @@ -0,0 +1,28 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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 *); +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/src/globals.c b/src/globals.c new file mode 100644 index 000000000..1e1a8ed3d --- /dev/null +++ b/src/globals.c @@ -0,0 +1,41 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* Written by Philip Hazel. */ + +/* Allocate storage and initialize global variables */ + +#include "xfpt.h" + + +uschar *xfpt_share = US DATADIR; +uschar *xfpt_version = US "0.00"; + +tree_node *entities = NULL; + +flagstr *flaglist = NULL; + +uschar *inbuffer = NULL; +istackstr *istack = NULL; + +int literal_state = LITERAL_OFF; + +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; + +/* End of globals.c */ diff --git a/src/globals.h b/src/globals.h new file mode 100644 index 000000000..c8045105a --- /dev/null +++ b/src/globals.h @@ -0,0 +1,43 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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 uschar *inbuffer; +extern istackstr *istack; + +extern int literal_state; + +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; + +/* End of globals.h */ diff --git a/src/literal.c b/src/literal.c new file mode 100644 index 000000000..74b90663f --- /dev/null +++ b/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, "&"); + else if (c == '<') (void)fprintf(outfile, "<"); + else if (c == '>') (void)fprintf(outfile, ">"); + else (void)fputc(c, outfile); + } +} + + +/* End of literal.c */ diff --git a/src/misc.c b/src/misc.c new file mode 100644 index 000000000..71f370611 --- /dev/null +++ b/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/src/mytypes.h b/src/mytypes.h new file mode 100644 index 000000000..35c29a324 --- /dev/null +++ b/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/src/para.c b/src/para.c new file mode 100644 index 000000000..5b4ec4380 --- /dev/null +++ b/src/para.c @@ -0,0 +1,332 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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 significies 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; + +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); + 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; +} + + + + +/************************************************* +* 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; + +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); + 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, and then everything other than ampersand is treated + literally. */ + + c = *p++; + if (c == '<') { (void)fprintf(outfile, "<"); continue; } + if (c == '>') { (void)fprintf(outfile, ">"); continue; } + + if (c == '`') + { + (void)fprintf(outfile, "‘"); + continue; + } + + if (c == '\'') + { + (void)fprintf(outfile, "’"); + 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, "&"); + 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); + 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/src/read.c b/src/read.c new file mode 100644 index 000000000..7a06eec4a --- /dev/null +++ b/src/read.c @@ -0,0 +1,364 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* Written by Philip Hazel. */ + +/* This module contains code for reading the input. */ + +#include "xfpt.h" + + + +/************************************************* +* Static variables * +*************************************************/ + +static uschar *next_line = NULL; + + + +/************************************************* +* 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 from the current file * +*************************************************/ + +/* There may be a stack of included files. This function makes them look like a +single source of input. + +Arguments: + buffer where to read + size size of buffer + +Returns: buffer pointer or NULL +*/ + +static uschar * +read_nextfileline(uschar *buffer, int size) +{ +if (istack == NULL) return NULL; +if (Ufgets(buffer, size, istack->file) == NULL) + { + istackstr *prev = istack->prev; + fclose(istack->file); + free(istack); + istack = prev; + return (istack == NULL)? NULL : read_nextfileline(buffer, size); + } + +istack->linenumber++; +return buffer; +} + + + +/************************************************* +* Get the next line of input * +*************************************************/ + +/* There may be a saved line already in the buffer, following the reading of a +paragraph. Otherwise, take the next line from one of three sources, in order: + + (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) Read a new line from a file and handle any continuations. + +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 */ + +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; + } + +/* Handle the next macro line. */ + +while (macrocurrent != NULL) + { + 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; + return inbuffer; + } + } + +/* Get a line from an input file */ + +if (read_nextfileline(inbuffer, INBUFFSIZE) == NULL) return NULL; + +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 (read_nextfileline(q, INBUFFSIZE - (q - inbuffer)) == NULL) break; + + p = q; + while (*p == ' ' || *p == '\t') p++; + len = Ustrlen(p); + if (p > q) memmove(q, p, len + 1); + } + +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. The whole is copied into the paragraph buffer. Directives +that are encountered in the paragraph are processed, with the exception of +.literal, which terminates it. We leave a .literal directive in the input +buffer and set next_line to point to it, so that it is processed later. + +Arguments: the first line +Returns: the paragraph +*/ + + +uschar * +read_paragraph(uschar *p) +{ +uschar *q = parabuffer; +int length = Ustrlen(p); + +memcpy(q, p, length); +q += length; + +for (;;) + { + uschar *s; + + if ((p = read_nextline()) == NULL) break; + + if (Ustrncmp(p, ".literal ", 9) == 0) + { + next_line = 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/src/structs.h b/src/structs.h new file mode 100644 index 000000000..7298b8ddf --- /dev/null +++ b/src/structs.h @@ -0,0 +1,76 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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; + 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/src/tree.c b/src/tree.c new file mode 100644 index 000000000..e9825cbb3 --- /dev/null +++ b/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/src/xfpt.c b/src/xfpt.c new file mode 100644 index 000000000..7fbb18e25 --- /dev/null +++ b/src/xfpt.c @@ -0,0 +1,201 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ +/* 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 ]\n" + " [-S ]\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 + { + (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) +{ +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 */ + +istack = misc_malloc(sizeof(istackstr)); +istack->prev = NULL; +istack->linenumber = 0; + +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 */ + +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) + { + p = read_paragraph(p); + (void)fprintf(outfile, "<"); + para_process(US"para&xfpt.rev;"); + (void)fprintf(outfile, ">\n"); + para_process(p); + (void)fprintf(outfile, "
\n"); + } + break; + } + } + +/* Empty the pushed stack, close the output, and we are done */ + +while (pushed != 0) + { + para_process(pushed->string); + (void)fprintf(outfile, "\n"); + pushed = pushed->next; + } + +(void)fclose(outfile); + +return return_code; +} + +/* End of xfpt.c */ diff --git a/src/xfpt.h b/src/xfpt.h new file mode 100644 index 000000000..4ae812267 --- /dev/null +++ b/src/xfpt.h @@ -0,0 +1,53 @@ +/************************************************* +* xfpt - Simple ASCII->Docbook processor * +*************************************************/ + +/* Copyright (c) University of Cambridge, 2006 */ + +/* 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 +#include +#include +#include +#include +#include +#include +#include +#include + + +/* 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 + + +/* 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/testing/infiles/01 b/testing/infiles/01 new file mode 100644 index 000000000..b24312336 --- /dev/null +++ b/testing/infiles/01 @@ -0,0 +1,225 @@ +.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 +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 &<>&. Here are some entities, both local and default: +&&abcd; is &abcd;; &&rhubarb; is &rhubarb;. + +.chapter "Second chapter" "CHAPsecond" +This is the second chapter. Test a block quote: + +.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 + +.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 + 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 + &&& + +completely untouched +.not even dot lines +.endxmliphant +are touched + +.literal off + +whereas this should &&& + note concats + +Test © and Ӓ and ䷄ 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 + +.literal text +Inside literal text, unknown directives +.like this one +should be passed as data +.literal off + + +.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. + + +.literal layout +.pop C +.literal xml + +Index + +.literal off diff --git a/testing/infiles/02 b/testing/infiles/02 new file mode 100644 index 000000000..b7c07d21d --- /dev/null +++ b/testing/infiles/02 @@ -0,0 +1,40 @@ +.include stdflags +.include "stdmacs" + +This input file tries to provoke errors &;. +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 + +.literal off more stuff + +.macro x +.arg 4n +.arg +.endarg +.endarg 99 +.eacharg 6 G +.endmacro + +.x diff --git a/testing/outfiles/01 b/testing/outfiles/01 new file mode 100644 index 000000000..a3adced5c --- /dev/null +++ b/testing/outfiles/01 @@ -0,0 +1,271 @@ + + + + +First chapter +abbrev + +This is text before the first section. + +
+First section + + +primary +secondary + +This is the text of the first section. +We are going to have an index in the middle of a paragraph. + +primary two +secondary two + +This is the rest of the paragraph. + +
+
+Second section + +This is the text of the second section. Here’s a reference to +chapter . Here are some entities, both local and default: +&abcd; is ABCD; &rhubarb; is &rhubarb;. + +
+
+ + +Second chapter + +This is the second chapter. Test a block quote: + +
+ +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. + +
+ + + +This is the first item in an itemized list. + + +There is more than one paragraph. + + + + +This is the second item in an itemized list. + + + + + + +Now we have an ordered list. + + +Again more than one paragraph. + + + + +The second item. + + + + +The third item + + + + + + +Try lower case roman numerals. + + + + +Try a nested list. + + + + +next + + + + +back in the first of the ordered. + + + + +the next + + + + +This is a normal text paragraph. + + +This is a display where the font +should be normal +even recognizing italic and stuff +but the +layout is literal + + +This, however is a code paragraph +where &'italic'& everything except +<angle> brackets is totally literal, +and & is no longer a flag. + + +And now we are back to a normal paragraph again. + + + + + +1 +2 + + +3 +4 + + + + + + + + + + + +1 +2 +3 + + +4 +5 +6 + + + + + + +First + + +This is a paragraph about the first item. + + +In fact, here is a second paragraph. + + + +Second + + +And now we have the second item. + + + + +The quick brown fox +jumps over the lazy dog. + + +completely untouched +.not even dot lines +.endxmliphant +are touched + + +whereas this should note concats +<and stuff> +Test © and Ӓ and ䷄ 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. + + +abcd + + +the X line 1 + + +the X line 2 + + +the B line +the X line 3 + + +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. + + +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" + + +Always. +There is no second argument. +Always. +If arg1: setarg1 +There is no second argument. +Always. +If arg1: setarg1 +If arg2: setarg2 + +Inside literal text, unknown directives +.like this one +should be passed as data + +&m1(1,2) |1 2| +&m1(1) |1 two| +&m1() |one two| +&m1("a(,b)") |a(,b) two| +&m1("a(,b)", c) |a(,b) c| + +&m2() |three| +&m2(a) |a| +&m2(a,b) |ab| + +&m2("&m1(x,y)") |x y| +&m2("&m1(x,y)", 3, 4) |x y34| + + +URL http://etc and another text and so on. + +
+ + +Index + +
diff --git a/testing/outfiles/01.err b/testing/outfiles/01.err new file mode 100644 index 000000000..d019e5c82 --- /dev/null +++ b/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/testing/outfiles/02 b/testing/outfiles/02 new file mode 100644 index 000000000..a25d20ad5 --- /dev/null +++ b/testing/outfiles/02 @@ -0,0 +1,5 @@ + +This input file tries to provoke errors &;. +Try &abcd without semicolon: &abcd and at EOL &abcd + + diff --git a/testing/outfiles/02.err b/testing/outfiles/02.err new file mode 100644 index 000000000..4ae503194 --- /dev/null +++ b/testing/outfiles/02.err @@ -0,0 +1,88 @@ +** Error: unknown flag "&;" + Detected near line 6 of infiles/02 + +** Error: missing semicolon after "&abcd" + Detected near line 6 of infiles/02 + +** Error: missing semicolon after "&abcd" + Detected near line 6 of infiles/02 + +** Error: malformed directive + .flag &: + Detected near line 7 of infiles/02 + +** Error: malformed directive + .flag &: "abc" "xyz" + Detected near line 8 of infiles/02 + +** Error: a flag must begin with "&" + Detected near line 9 of infiles/02 + +** Error: malformed directive + .flag &: :& &' + Detected near line 10 of infiles/02 + +** Warning: extra characters at end of directive + .set abcd "abcd" xyz + ^^^ + Detected near line 12 of infiles/02 + +** Error: .arg is permitted only inside a macro + Detected near line 14 of infiles/02 + +** Error: .arg is permitted only inside a macro + Detected near line 15 of infiles/02 + +** Error: .endarg is permitted only inside a macro + Detected near line 17 of infiles/02 + +** Error: .endarg is permitted only inside a macro + Detected near line 18 of infiles/02 + +** Error: .eacharg is permitted only inside a macro + Detected near line 20 of infiles/02 + +** Error: .eacharg is permitted only inside a macro + Detected near line 21 of infiles/02 + +** Error: .endeach is permitted only inside a macro + Detected near line 23 of infiles/02 + +** Error: .endeach is permitted only inside a macro + Detected near line 24 of infiles/02 + +** Error: unknown directive line: .rhubarb and custard + Detected near line 26 of infiles/02 + +** Warning: extra characters at end of directive + .literal xml stuff + ^^^^^ + Detected near line 28 of infiles/02 + +** Warning: extra characters at end of directive + .literal off more stuff + ^^^^^^^^^^ + Detected near line 30 of infiles/02 + +** Error: malformed directive + .arg 4n + Processing macro x + Detected near line 40 of infiles/02 + +** Error: malformed directive + .arg + Processing macro x + Detected near line 40 of infiles/02 + +** Warning: extra characters at end of directive + .endarg 99 + ^^ + Processing macro x + Detected near line 40 of infiles/02 + +** Warning: extra characters at end of directive + .eacharg 6 G + ^ + Processing macro x + Detected near line 40 of infiles/02 + diff --git a/testing/runtest b/testing/runtest new file mode 100755 index 000000000..efe165c5e --- /dev/null +++ b/testing/runtest @@ -0,0 +1,164 @@ +#!/usr/bin/perl -w + +# Controlling script for xfpt tests + +$xfpt = "../src/xfpt -S ../share"; +$cf = "cf"; + +$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. + + next if $file =~ /^\.\.?$|\.opt$/; + + 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"; + $_ = ; + 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"; + $_ = ; + 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 -- cgit v1.2.1 From 44bd711f68c13d22f580012249b458f2ce2168d4 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 22 Mar 2007 12:05:50 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.01.tar.bz2. --- doc/xfpt.1 | 7 ++- doc/xfpt.html | 163 ++++++++++++++++++++++++++++------------------------ doc/xfpt.pdf | Bin 73519 -> 56783 bytes doc/xfpt.xfpt | 41 ++++++++++--- share/stdmacs | 33 +++++++++++ src/globals.c | 4 +- src/xfpt.c | 8 ++- testing/infiles/01 | 13 ++--- testing/outfiles/01 | 16 ++++++ 9 files changed, 190 insertions(+), 95 deletions(-) diff --git a/doc/xfpt.1 b/doc/xfpt.1 index 8089911df..756c231fe 100644 --- a/doc/xfpt.1 +++ b/doc/xfpt.1 @@ -29,6 +29,9 @@ file is given, and the source file name with a \fI.xml\fP extension otherwise. \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 @@ -40,6 +43,6 @@ University Computing Service Cambridge CB2 3QG, England. .P .in 0 -Last updated: 17 January 2006 +Last updated: 22 March 2007 .br -Copyright (c) 2006 University of Cambridge. +Copyright (c) 2007 University of Cambridge. diff --git a/doc/xfpt.html b/doc/xfpt.html index 49d6e1db7..f8d0825bd 100644 --- a/doc/xfpt.html +++ b/doc/xfpt.html @@ -46,7 +46,7 @@ div[class=changed] div.literallayout { The xfpt plain text to XML processor - +
@@ -54,7 +54,7 @@ The xfpt plain text to XML processor

- + The xfpt plain text to XML processor

@@ -70,7 +70,7 @@ Hazel
+Copyright © 2007 University of Cambridge

@@ -83,9 +83,9 @@ Revision History -Revision 0.00 +Revision 0.01 -16 January 2006 +22 March 2007 PH @@ -103,7 +103,7 @@ Table of Contents
- + 1. Introduction
@@ -111,7 +111,7 @@ Table of Contents
- + 1.1. The xfpt @@ -121,7 +121,7 @@ command line
- + 1.2. A short xfpt @@ -137,7 +137,7 @@ example
- + 1.4. Format of directive lines
@@ -151,7 +151,7 @@ example
- + 2. Flag sequences
@@ -159,7 +159,7 @@ example
- + 2.1. Flag sequences for XML entities and xfpt @@ -169,25 +169,25 @@ variables
- + 2.2. Flag sequences for calling macros
- + 2.3. Other flag sequences
- + 2.4. Unrecognized flag sequences
- + 2.5. Standard flag sequences
@@ -195,7 +195,7 @@ variables
- + 3. Built-in directive processing
@@ -203,7 +203,7 @@ variables
- + 3.1. The .arg @@ -213,7 +213,7 @@ directive
- + 3.2. The .eacharg @@ -223,7 +223,7 @@ directive
- + 3.3. The .echo @@ -233,7 +233,7 @@ directive
- + 3.4. The .endarg @@ -243,7 +243,7 @@ directive
- + 3.5. The .endeach @@ -253,7 +253,7 @@ directive
- + 3.6. The .flag @@ -263,7 +263,7 @@ directive
- + 3.7. The .include @@ -273,7 +273,7 @@ directive
- + 3.8. The .literal @@ -293,7 +293,7 @@ directive
- + 3.10. The .pop @@ -303,7 +303,7 @@ directive
- + 3.11. The .push @@ -323,7 +323,7 @@ directive
- + 3.13. The .set @@ -343,55 +343,55 @@ directive
- + 4.1. Overall setup
- + 4.2. Chapters, sections, and subsections
- + 4.3. URL references
- + 4.4. Itemized lists
- + 4.5. Ordered lists
- + 4.6. Variable lists
- + 4.7. Nested lists
- + 4.8. Displayed text
- + 4.9. Block quotes
@@ -403,13 +403,13 @@ directive
- + 4.11. Informal tables
- + 4.12. Indexes
@@ -417,7 +417,7 @@ directive
-

xfpt is a program that reads a marked-up ASCII source file, and converts it into +

xfpt 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 (http://www.methods.co.nz/asciidoc/), xfpt does not try to produce XML from a document that is also usable as a @@ -461,7 +461,7 @@ Notwithstanding the previous paragraph, xfpt&amp;, &lt;, or &gt;, respectively) is generated. -

The format of the xfpt command line is: +

The format of the xfpt command line is:

 xfpt [options] [input source]

@@ -483,7 +483,7 @@ be given as an output destination to refer to the standard output.

This option overrides the path to xfpt’s library directory that is built into the program. This makes it possible to use or test alternate libraries. -

Here is a very short example of a complete xfpt input file that uses some of the +

Here is a very short example of a complete xfpt input file that uses some of the standard macros and flags:

  .include stdflags
@@ -562,7 +562,7 @@ 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.
-

If an input line starts with a dot followed by a space, it is ignored by xfpt. +

If an input line starts with a dot followed by a space, it is ignored by xfpt. 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 @@ -611,7 +611,7 @@ 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. -

Only one flag sequence is built-into the code itself. If an input line ends +

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 @@ -624,7 +624,7 @@ involve any number of lines. Thus: produces exactly the same output as:

  The quick brown fox.
-

If an ampersand is followed by a # character, a number, and a semicolon, it is +

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: @@ -648,11 +648,11 @@ of the previous types. In this case, the input text is passed to the output without modification. For example:

  This is an Ohm sign: &Ohm;.
-

If an ampersand is followed by a sequence of alphanumeric characters starting +

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 1.5 for more details. -

Any other flag sequences that are needed must be defined by means of the +

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. @@ -685,9 +685,9 @@ Note that, though xfpt diagnoses an error not prevent you from generating invalid XML. For example, DocBook does not allow <emphasis> within <literal>, though it does allow <literal> within <emphasis>. -

If an ampersand is not followed by a character sequence in one of the forms +

If an ampersand is not followed by a character sequence in one of the forms described in the preceding sections, an error occurs. -

These are the standalone flag sequences that are defined in the stdflags +

These are the standalone flag sequences that are defined in the stdflags file in the xfpt library:

 &&         becomes  &amp; (ampersand)
@@ -713,10 +713,10 @@ 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. -

The directives that are built into the code of xfpt are now described in +

The directives that are built into the code of xfpt are now described in alphabetical order. You can see more examples of their use in the definitions of the standard macros in chapter 4. -

This directive may appear only within the body of a macro. It must be followed +

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 @@ -736,7 +736,7 @@ for the given argument. For example: and the second one is not empty. .endarg .endmacro -

This directive may appear only within the body of a macro. It may optionally be +

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 @@ -766,13 +766,13 @@ fifth argument: .eacharg 5 &<colspec colwidth="$+1" align="$+2"/>& .endeach 2 -

This directive takes a single string argument. It writes it to the standard +

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. -

See the description of .arg above. -

See the description of .eacharg above. -

This directive is used to define flag sequences. The directive must be followed +

See the description of .arg above. +

See the description of .eacharg above. +

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:

@@ -782,21 +782,22 @@ pair and two strings in quotes. White space separates these items. For example:
 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.
-

This directive must be followed by a single string argument that is the path to +

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 xfpt library is prepended. Otherwise, the path is used unaltered. -

This must be followed by one of the words “layout”, “text”, “off”, or +

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 1.3 describes how input lines are processed in the four modes.

This directive is used to define macros. It must be followed by a macro name, -and then, optionally, by any number of arguments. These 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 1.5). +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 1.5).

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 @@ -843,7 +844,7 @@ call it, because xfpt looks for built-in 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. -

xfpt keeps a stack of text strings that are manipulated by the .push and +

xfpt 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. @@ -856,7 +857,7 @@ 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. -

This directive pushes a string onto the stack. If the rest of the command line +

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, that letter is associated with the string that is pushed, which consists of the rest of the line. For example, the .chapter macro contains this line: @@ -899,7 +900,7 @@ 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 4.10). -

This directive must be followed by a name and a text string. It defines a user +

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: @@ -921,7 +922,7 @@ is going to use these features should start with: 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. -

There are two macros that should be used only once, at the start of the +

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:

@@ -931,7 +932,7 @@ file the standard header material for a DocBook XML file, which is:
 

The .book macro has no arguments. It generates <book> and pushes </book> onto the stack so that it will be output at the end. -

Chapters, sections, and subsections are supported by three macros that all +

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 @@ -963,7 +964,7 @@ controlled by the stylesheet when the XML is processed. These three macros use the stack to ensure that each chapter, section, and subsection is terminated at the correct point. For example, starting a new section automatically terminates an open subsection and a previous section. -

The url macro generates URL references, and is intended to be called inline +

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: @@ -978,7 +979,7 @@ 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. -

The .ilist macro marks the start of an itemized list, the items of which +

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 @@ -997,7 +998,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

The .olist macro marks the start of an ordered list, the items of which are +

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:

@@ -1018,7 +1019,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

A variable list is one in which each entry is composed of a set of one or more +

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 @@ -1036,12 +1037,12 @@ This is followed by the body of the entry. The list is terminated by the .endlist

As for the other lists, there may be more than one paragraph in an item. -

Lists may be nested as required. Some DocBook processors automatically choose +

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. -

In displayed text each non-directive input line generates one output line. The +

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. @@ -1072,7 +1073,7 @@ monospaced font. For example:

As the examples illustrate, both kinds of display are terminated by the .endd macro. -

The macro pair .blockquote and .endblockquote are used to wrap the +

The macro pair .blockquote and .endblockquote are used to wrap the lines between them in a <blockquote> element.

Two macros are provided to simplify setting and unsetting the “changed” revision marking (see section 3.12). When the revised text is @@ -1104,7 +1105,7 @@ a directive or inline:

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. -

The .itable macro starts an informal (untitled) table with some basic +

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. @@ -1151,7 +1152,7 @@ The .row macro does not set the new macro within an entry to generate a <phrase> element with revisionflag set. -

The .index macro generates <indexterm> elements (index entries) in the +

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 @@ -1161,6 +1162,18 @@ example: .index goose "wild chase" The chasing of wild geese...

+You can generate “see” and “see also” index entries by using .index-see +and .index-seealso instead of .index. +

+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: +

+ .index-from "ID5" "indexes" "handling ranges"
+ ... <lines of text> ...
+ .index-to "ID5"
+

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 diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf index 57a7c3d78..dce5c18a4 100644 Binary files a/doc/xfpt.pdf and b/doc/xfpt.pdf differ diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt index d8f3c842f..552846cff 100644 --- a/doc/xfpt.xfpt +++ b/doc/xfpt.xfpt @@ -13,17 +13,31 @@ The xfpt plain text to XML processor xfpt -16 January 2006 +22 March 2007 Philip Hazel PH -0.0016 January 2006PH -2006University of Cambridge +0.0122 March 2007PH +2007University of Cambridge .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 + +.literal off + . ---------------------------------------------------------------------------- @@ -494,10 +508,11 @@ the four modes. .section "The &*.macro*& directive" "SECTmacro" This directive is used to define macros. It must be followed by a macro name, -and then, optionally, by any number of arguments. These 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 &<>&). +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 &<>&). 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 @@ -928,6 +943,18 @@ example: .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*&. + +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" + ... ... + .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 diff --git a/share/stdmacs b/share/stdmacs index 965f5911a..36e3c4ddd 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -188,6 +188,39 @@ && .endmacro +.macro index-from +&& +&&$2&& +.arg 3 +&&$3&& +.endarg +&& +.endmacro + +.macro index-to +&& +.endmacro + +.macro index-see +&& +&&$2&& +.arg 3 +&&$3&& +.endarg +&&$1&& +&& +.endmacro + +.macro index-seealso +&& +&&$2&& +.arg 3 +&&$3&& +.endarg +&&$1&& +&& +.endmacro + .macro makeindex "Index" .literal layout .pop C diff --git a/src/globals.c b/src/globals.c index 1e1a8ed3d..5082c105c 100644 --- a/src/globals.c +++ b/src/globals.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* Allocate storage and initialize global variables */ @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.00"; +uschar *xfpt_version = US "0.01 22-Mar-2007"; tree_node *entities = NULL; diff --git a/src/xfpt.c b/src/xfpt.c index 7fbb18e25..7c5b59744 100644 --- a/src/xfpt.c +++ b/src/xfpt.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* This module contains the main program and initialization functions. */ @@ -30,6 +30,7 @@ usage(void) "Usage: xfpt [-help]\n" " [-o ]\n" " [-S ]\n" + " [-v]\n" " [input-file]\n"); } @@ -67,6 +68,11 @@ for (i = 1; i < argc; i++) 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); diff --git a/testing/infiles/01 b/testing/infiles/01 index b24312336..9dbf963b4 100644 --- a/testing/infiles/01 +++ b/testing/infiles/01 @@ -13,6 +13,7 @@ This is text before the first section. .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" @@ -25,6 +26,8 @@ chapter &<>&. Here are some entities, both local and default: .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 @@ -49,6 +52,7 @@ The second item. .next The third item .endlist +.index-to "ID" .revision off @@ -215,11 +219,4 @@ $+1 URL &url(http://etc) and another &url(http://etc, text) and so on. - -.literal layout -.pop C -.literal xml - -Index - -.literal off +.makeindex diff --git a/testing/outfiles/01 b/testing/outfiles/01 index a3adced5c..6199c7225 100644 --- a/testing/outfiles/01 +++ b/testing/outfiles/01 @@ -14,6 +14,9 @@ This is text before the first section. primary secondary + +range + This is the text of the first section. We are going to have an index in the middle of a paragraph. @@ -37,6 +40,15 @@ chapter . Here are some entities, both local and def Second chapter This is the second chapter. Test a block quote: + +visions +sights + + +noises +off +sounds +

@@ -79,6 +91,9 @@ The third item + + + @@ -268,4 +283,5 @@ URL http://etc Index + -- cgit v1.2.1 From 4f307ce2d96bae1c86f9d3d9e6de73caae10f1b9 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 10 Apr 2007 11:30:34 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.02.tar.bz2. --- doc/xfpt.html | 251 ++++++++++++++++++++++++++++++------------------ doc/xfpt.pdf | Bin 56783 -> 58771 bytes doc/xfpt.xfpt | 62 +++++++++--- share/stdmacs | 20 ++++ src/dot.c | 118 +++++++++++++++++++---- src/error.c | 2 +- src/globals.c | 2 +- testing/infiles/01 | 111 +++++++++++++++++++-- testing/infiles/02 | 1 + testing/outfiles/01 | 77 +++++++++++++-- testing/outfiles/02 | 1 + testing/outfiles/02.err | 46 ++++----- 12 files changed, 525 insertions(+), 166 deletions(-) diff --git a/doc/xfpt.html b/doc/xfpt.html index f8d0825bd..ad3069017 100644 --- a/doc/xfpt.html +++ b/doc/xfpt.html @@ -54,7 +54,7 @@ The xfpt plain text to XML processor

- + The xfpt plain text to XML processor

@@ -83,9 +83,9 @@ Revision History -Revision 0.01 +Revision 0.02 -22 March 2007 +10 April 2007 PH @@ -103,7 +103,7 @@ Table of Contents
- + 1. Introduction
@@ -111,7 +111,7 @@ Table of Contents
- + 1.1. The xfpt @@ -121,7 +121,7 @@ command line
- + 1.2. A short xfpt @@ -137,7 +137,7 @@ example
- + 1.4. Format of directive lines
@@ -151,7 +151,7 @@ example
- + 2. Flag sequences
@@ -159,7 +159,7 @@ example
- + 2.1. Flag sequences for XML entities and xfpt @@ -169,25 +169,25 @@ variables
- + 2.2. Flag sequences for calling macros
- + 2.3. Other flag sequences
- + 2.4. Unrecognized flag sequences
- + 2.5. Standard flag sequences
@@ -195,7 +195,7 @@ variables
- + 3. Built-in directive processing
@@ -203,7 +203,7 @@ variables
- + 3.1. The .arg @@ -213,7 +213,7 @@ directive
- + 3.2. The .eacharg @@ -223,7 +223,7 @@ directive
- + 3.3. The .echo @@ -233,7 +233,7 @@ directive
- + 3.4. The .endarg @@ -243,7 +243,7 @@ directive
- + 3.5. The .endeach @@ -253,79 +253,109 @@ directive
- + 3.6. The -.flag +.endinliteral directive
- + 3.7. The -.include +.flag directive
- + 3.8. The -.literal +.include directive
- + 3.9. The -.macro +.inliteral directive
- + 3.10. The -.pop +.literal directive
- + 3.11. The -.push +.macro directive
- + 3.12. The -.revision +.nonl directive
- + 3.13. The +.pop + +directive + +
+
+ + +3.14. The + +.push + +directive + +
+
+ + +3.15. The + +.revision + +directive + +
+
+ + +3.16. The + .set directive @@ -335,7 +365,7 @@ directive
- + 4. The standard macros for DocBook
@@ -343,73 +373,73 @@ directive
- + 4.1. Overall setup
- + 4.2. Chapters, sections, and subsections
- + 4.3. URL references
- + 4.4. Itemized lists
- + 4.5. Ordered lists
- + 4.6. Variable lists
- + 4.7. Nested lists
- + 4.8. Displayed text
- + 4.9. Block quotes
- + 4.10. Revision markings
- + 4.11. Informal tables
- + 4.12. Indexes
@@ -417,7 +447,7 @@ directive
-

xfpt is a program that reads a marked-up ASCII source file, and converts it into +

xfpt 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 (http://www.methods.co.nz/asciidoc/), xfpt does not try to produce XML from a document that is also usable as a @@ -461,7 +491,7 @@ Notwithstanding the previous paragraph, xfpt&amp;, &lt;, or &gt;, respectively) is generated. -

The format of the xfpt command line is: +

The format of the xfpt command line is:

 xfpt [options] [input source]

@@ -483,7 +513,7 @@ be given as an output destination to refer to the standard output.

This option overrides the path to xfpt’s library directory that is built into the program. This makes it possible to use or test alternate libraries. -

Here is a very short example of a complete xfpt input file that uses some of the +

Here is a very short example of a complete xfpt input file that uses some of the standard macros and flags:

  .include stdflags
@@ -539,7 +569,8 @@ output. An example might be the <bookinfo> el
 in a document. It is not worth setting up a macro for a one-off item like this.
 

The .literal directive switches between the modes. It is not normally used -directly, but instead is incorported into appropriate macro definitions. +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 @@ -562,7 +593,7 @@ 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. -

If an input line starts with a dot followed by a space, it is ignored by xfpt. +

If an input line starts with a dot followed by a space, it is ignored by xfpt. 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 @@ -577,7 +608,7 @@ 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.

Macros are defined by the .macro directive, which is described in section -3.9. There are two ways of calling a macro. It can be called in the +3.11. 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”.

@@ -611,7 +642,7 @@ 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. -

Only one flag sequence is built-into the code itself. If an input line ends +

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 @@ -624,7 +655,7 @@ involve any number of lines. Thus: produces exactly the same output as:

  The quick brown fox.
-

If an ampersand is followed by a # character, a number, and a semicolon, it is +

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: @@ -648,11 +679,11 @@ of the previous types. In this case, the input text is passed to the output without modification. For example:

  This is an Ohm sign: &Ohm;.
-

If an ampersand is followed by a sequence of alphanumeric characters starting +

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 1.5 for more details. -

Any other flag sequences that are needed must be defined by means of the +

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. @@ -685,9 +716,9 @@ Note that, though xfpt diagnoses an error not prevent you from generating invalid XML. For example, DocBook does not allow <emphasis> within <literal>, though it does allow <literal> within <emphasis>. -

If an ampersand is not followed by a character sequence in one of the forms +

If an ampersand is not followed by a character sequence in one of the forms described in the preceding sections, an error occurs. -

These are the standalone flag sequences that are defined in the stdflags +

These are the standalone flag sequences that are defined in the stdflags file in the xfpt library:

 &&         becomes  &amp; (ampersand)
@@ -713,10 +744,10 @@ 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. -

The directives that are built into the code of xfpt are now described in +

The directives that are built into the code of xfpt are now described in alphabetical order. You can see more examples of their use in the definitions of the standard macros in chapter 4. -

This directive may appear only within the body of a macro. It must be followed +

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 @@ -736,16 +767,20 @@ for the given argument. For example: and the second one is not empty. .endarg .endmacro -

This directive may appear only within the body of a macro. It may optionally be +

+The .arg directive may be nested. +

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.

-The number given with .eacharg defines which argument to start with. While -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 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 @@ -766,13 +801,17 @@ fifth argument: .eacharg 5 &<colspec colwidth="$+1" align="$+2"/>& .endeach 2 -

This directive takes a single string argument. It writes it to the standard +

+The .eacharg directive may in principle be nested, though this does not +seem useful in practice. +

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. -

See the description of .arg above. -

See the description of .eacharg above. -

This directive is used to define flag sequences. The directive must be followed +

See the description of .arg above. +

See the description of .eacharg above. +

See the description of .inliteral below. +

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:

@@ -782,17 +821,22 @@ pair and two strings in quotes. White space separates these items. For example:
 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.
-

This directive must be followed by a single string argument that is the path to +

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 xfpt library is prepended. Otherwise, the path is used unaltered. -

This must be followed by one of the words “layout”, “text”, “off”, or +

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. +

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 1.3 describes how input lines are processed in the four modes. -

This directive is used to define macros. It must be followed by a macro name, +

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 @@ -844,7 +888,11 @@ call it, because xfpt looks for built-in 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. -

xfpt keeps a stack of text strings that are manipulated by the .push and +

This directive must be followed by a single string argument. It is processed +as normal text, but 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. +

xfpt 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. @@ -857,7 +905,7 @@ 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. -

This directive pushes a string onto the stack. If the rest of the command line +

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, that letter is associated with the string that is pushed, which consists of the rest of the line. For example, the .chapter macro contains this line: @@ -870,7 +918,7 @@ Earlier in the macro there is the line:

This arrangement ensures that any previous chapter is terminated before starting a new one, and also when the end of the input is reached. -

This directive is provided to make it easy to set the revisionflag +

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. @@ -900,7 +948,7 @@ 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 4.10). -

This directive must be followed by a name and a text string. It defines a user +

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: @@ -922,7 +970,7 @@ is going to use these features should start with: 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. -

There are two macros that should be used only once, at the start of the +

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:

@@ -932,7 +980,7 @@ file the standard header material for a DocBook XML file, which is:
 

The .book macro has no arguments. It generates <book> and pushes </book> onto the stack so that it will be output at the end. -

Chapters, sections, and subsections are supported by three macros that all +

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 @@ -964,7 +1012,7 @@ controlled by the stylesheet when the XML is processed. These three macros use the stack to ensure that each chapter, section, and subsection is terminated at the correct point. For example, starting a new section automatically terminates an open subsection and a previous section. -

The url macro generates URL references, and is intended to be called inline +

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: @@ -979,7 +1027,7 @@ 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. -

The .ilist macro marks the start of an itemized list, the items of which +

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 @@ -998,7 +1046,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

The .olist macro marks the start of an ordered list, the items of which are +

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:

@@ -1019,7 +1067,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

A variable list is one in which each entry is composed of a set of one or more +

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 @@ -1037,12 +1085,12 @@ This is followed by the body of the entry. The list is terminated by the .endlist

As for the other lists, there may be more than one paragraph in an item. -

Lists may be nested as required. Some DocBook processors automatically choose +

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. -

In displayed text each non-directive input line generates one output line. The +

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. @@ -1073,10 +1121,10 @@ monospaced font. For example:

As the examples illustrate, both kinds of display are terminated by the .endd macro. -

The macro pair .blockquote and .endblockquote are used to wrap the +

The macro pair .blockquote and .endblockquote are used to wrap the lines between them in a <blockquote> element.

Two macros are provided to simplify setting and unsetting the “changed” -revision marking (see section 3.12). When the revised text is +revision marking (see section 3.15). 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:

@@ -1090,10 +1138,11 @@ can be placed between .new and 

-When called like this, without an argument, .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.) +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 @@ -1105,7 +1154,23 @@ a directive or inline:

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. -

The .itable macro starts an informal (untitled) table with some basic +

+You can use the .new/.wen macro pair to generate a <phrase> element +inside a section of displayed text. For example: +

+  .display
+  This line is not flagged as changed.
+  .new
+  This line is flagged as changed.
+  .wen
+  This line is not flagged as changed.
+  .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. +

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. @@ -1152,7 +1217,7 @@ The .row macro does not set the new macro within an entry to generate a <phrase> element with revisionflag set. -

The .index macro generates <indexterm> elements (index entries) in the +

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 diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf index dce5c18a4..8e2dc330c 100644 Binary files a/doc/xfpt.pdf and b/doc/xfpt.pdf differ diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt index 552846cff..b2e5d3cb0 100644 --- a/doc/xfpt.xfpt +++ b/doc/xfpt.xfpt @@ -13,13 +13,13 @@ The xfpt plain text to XML processor xfpt -22 March 2007 +10 April 2007 Philip Hazel PH -0.0122 March 2007PH +0.0210 April 2007PH 2007University of Cambridge .literal off @@ -183,7 +183,8 @@ 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. +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 @@ -426,6 +427,7 @@ for the given argument. For example: .endarg .endmacro .endd +The &*.arg*& directive may be nested. .section "The &*.eacharg*& directive" @@ -435,10 +437,12 @@ 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. -The number given with &*.eacharg*& defines which argument to start with. While -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 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 @@ -460,6 +464,8 @@ fifth argument: && .endeach 2 .endd +The &*.eacharg*& directive may in principle be nested, though this does not +seem useful in practice. .section "The &*.echo*& directive" @@ -476,6 +482,9 @@ See the description of &*.arg*& above. .section "The &*.endeach*& directive" See the description of &*.eacharg*& above. +.section "The &*.endinliteral*& directive" +See the description of &*.inliteral*& below. + .section "The &*.flag*& directive" This directive is used to define flag sequences. The directive must be followed @@ -496,6 +505,13 @@ 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. +.section "The &*.inliteral*& directive" +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" This must be followed by one of the words &"layout"&, &"text"&, &"off"&, or @@ -562,6 +578,13 @@ taken with argument references to ensure that substitutions happen at the right level. +.section "The &*.nonl*& directive" +This directive must be followed by a single string argument. It is processed +as normal text, but 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" &X; keeps a stack of text strings that are manipulated by the &*.push*& and @@ -858,10 +881,11 @@ can be placed between &*.new*& and &*.wen*&, as in this example: .wen Here is the next, unmarked, paragraph. .endd -When called like this, without an argument, &*.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.) +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 @@ -874,6 +898,22 @@ a directive or inline: The effect of this is to generate a &``& 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 &``& 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. + .section "Informal tables" The &*.itable*& macro starts an informal (untitled) table with some basic diff --git a/share/stdmacs b/share/stdmacs index 36e3c4ddd..662dae6cc 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -251,18 +251,38 @@ .macro new .arg -1 +.inliteral off .literal layout .revision changed .literal off +.endinliteral +.inliteral layout +.nonl '&&' +.endinliteral +.inliteral text +.literal layout +.nonl '&&' +.literal text +.endinliteral .endarg .arg 1 &&$1&& .endmacro .macro wen +.inliteral off .literal layout .revision off .literal off +.endinliteral +.inliteral layout +.nonl && +.endinliteral +.inliteral text +.literal layout +.nonl && +.literal text +.endinliteral .endmacro . End diff --git a/src/dot.c b/src/dot.c index 2e9949652..3c87166e3 100644 --- a/src/dot.c +++ b/src/dot.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* This module contains code for processing a line that starts with a dot. */ @@ -51,21 +51,30 @@ return n; *************************************************/ /* 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. +terminator line. It is called only when we know we are in a macro. The current +macro line is the conditional directive. -Argument: the terminator directive +Arguments: + s the conditional directive + t the terminator directive Returns: nothing */ static void -skipto(uschar *s) +skipto(uschar *s, uschar *t) { -int length = Ustrlen(s); +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, s, length) == 0 && (p[length] == 0 || isspace(p[length])); + 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) { @@ -116,7 +125,7 @@ arg = macrocurrent->args; for (i = 1; arg != NULL && i < argn; i++) arg = arg->next; if (mustexist != (arg != NULL && arg->string[0] != 0)) - skipto(US".endarg"); + skipto(US".arg", US".endarg"); } @@ -149,7 +158,7 @@ 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".endeach"); else +if (arg == NULL) skipto(US"eacharg", US".endeach"); else { macro_argbase = arg; macro_starteach = macrocurrent->nextline; @@ -228,6 +237,26 @@ if (macro_argbase == NULL) macro_starteach = NULL; +/************************************************* +* 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 (macrocurrent == NULL) { error(15, US".endinliteral"); return; } +if (*p != 0) error(19, ".endinliteral", p, 8, spaces, Ustrlen(p), circumflexes); +} + + + /************************************************* * Handle .flag * *************************************************/ @@ -347,6 +376,33 @@ if (ist->file == NULL) error(0, ist->filename, strerror(errno)); /* Hard */ +/************************************************* +* 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 (macrocurrent == NULL) { 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 * @@ -446,6 +502,23 @@ if (md->lines == NULL) +/************************************************* +* Handle .nonl * +*************************************************/ + +/* Output the argument as normal text, but without a newline on the end. + +Argument: the rest of the line +Returns: nothing +*/ + +static void +do_nonl(uschar *p) +{ +para_process(p); +} + + /************************************************* * Handle .pop * *************************************************/ @@ -616,19 +689,22 @@ typedef struct 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".flag", 5, do_flag, FALSE, FALSE }, - { US".include", 8, do_include, TRUE, FALSE }, - { US".literal", 8, do_literal, TRUE, FALSE }, - { US".macro", 6, do_macro, FALSE, 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 }, + { 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".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); diff --git a/src/error.c b/src/error.c index 9c9a42549..3aa800742 100644 --- a/src/error.c +++ b/src/error.c @@ -48,7 +48,7 @@ static error_struct error_data[] = { { ec_serious, "missing semicolon after \"&%.*s\"" }, { ec_serious, "unexpected character \"%c\" after \"&#\"" }, /* 5-9 */ -{ ec_serious, "\"layout\", \"text\", or \"off\" expected, but \"%s\" found" }, +{ 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\"" }, diff --git a/src/globals.c b/src/globals.c index 5082c105c..697335d9b 100644 --- a/src/globals.c +++ b/src/globals.c @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.01 22-Mar-2007"; +uschar *xfpt_version = US "0.02 05-Apr-2007"; tree_node *entities = NULL; diff --git a/testing/infiles/01 b/testing/infiles/01 index 9dbf963b4..61d02eec8 100644 --- a/testing/infiles/01 +++ b/testing/infiles/01 @@ -20,9 +20,9 @@ We are going to have an index in the middle of a paragraph. This is the rest of the paragraph. .section "Second section" -This is the text of the second section. Here's a reference to +This is the text of the second section. Here's a reference to chapter &<>&. Here are some entities, both local and default: -&&abcd; is &abcd;; &&rhubarb; is &rhubarb;. +&&abcd; is &abcd;; && is &. .chapter "Second chapter" "CHAPsecond" This is the second chapter. Test a block quote: @@ -31,7 +31,7 @@ This is the second chapter. Test a block quote: .revision "changed" .blockquote -All the world's a stage, and all the men and women merely players. They have +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 @@ -120,10 +120,10 @@ are touched .literal off -whereas this should &&& +whereas this should &&& note concats - -Test © and Ӓ and ䷄ for size. + +Test © and Ӓ and ䷄ for size. Check `quote' marks. And ``doublequote'' marks. @@ -131,7 +131,7 @@ This is a paragraph where things happen over multiple lines. -Test some of the standard flags &'italic'& and &*bold*& text and +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. @@ -181,13 +181,13 @@ There is no second argument. .pqr .pqr setarg1 -.pqr setarg1 setarg2 +.pqr setarg1 setarg2 -.literal text +.code Inside literal text, unknown directives .like this one should be passed as data -.literal off +.endd .macro m1 one two @@ -219,4 +219,95 @@ $+1 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 + .makeindex diff --git a/testing/infiles/02 b/testing/infiles/02 index b7c07d21d..b256fafc1 100644 --- a/testing/infiles/02 +++ b/testing/infiles/02 @@ -2,6 +2,7 @@ .include "stdmacs" This input file tries to provoke errors &;. +Non defined &&rhubarb is &rhubarb; Try &&abcd without semicolon: &abcd and at EOL &abcd .flag &: diff --git a/testing/outfiles/01 b/testing/outfiles/01 index 6199c7225..3af3114e6 100644 --- a/testing/outfiles/01 +++ b/testing/outfiles/01 @@ -29,9 +29,9 @@ This is the rest of the paragraph.

Second section -This is the text of the second section. Here’s a reference to +This is the text of the second section. Here’s a reference to chapter . Here are some entities, both local and default: -&abcd; is ABCD; &rhubarb; is &rhubarb;. +&abcd; is ABCD; &amp is &.
@@ -52,7 +52,7 @@ This is the second chapter. Test a block quote:
-All the world’s a stage, and all the men and women merely players. They have +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.
@@ -204,8 +204,8 @@ are touched whereas this should note concats -<and stuff> -Test © and Ӓ and ䷄ for size. +<and stuff> +Test © and Ӓ and ䷄ for size. Check ‘quote’ marks. And ‘‘doublequote’’ marks. @@ -216,7 +216,7 @@ where things happen over multiple lines. -Test some of the standard flags italic and bold text and +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. @@ -258,9 +258,11 @@ Always. If arg1: setarg1 If arg2: setarg2 + Inside literal text, unknown directives .like this one should be passed as data + &m1(1,2) |1 2| &m1(1) |1 two| @@ -278,6 +280,69 @@ should be passed as data URL http://etc and another text and so on. + +This is a paragraph marked new with .new/.wen. + + +The first line in a display. +This line is between .new/.wen. +Another line. + + +The first line in a code section. +This line is between .new/.wen. +Another line. + + +A +B +C + + +A +ZZZ +C + + +A +B +C + + +A +&<phrase revisionflag="changed">&ZZZ&</phrase>& +C + + +A +B BB BBB +C + + +A +B &new(BB) BBB +C + + +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 + diff --git a/testing/outfiles/02 b/testing/outfiles/02 index a25d20ad5..ca864bfc3 100644 --- a/testing/outfiles/02 +++ b/testing/outfiles/02 @@ -1,5 +1,6 @@ This input file tries to provoke errors &;. +Non defined &rhubarb is &rhubarb; Try &abcd without semicolon: &abcd and at EOL &abcd diff --git a/testing/outfiles/02.err b/testing/outfiles/02.err index 4ae503194..17746cb7b 100644 --- a/testing/outfiles/02.err +++ b/testing/outfiles/02.err @@ -1,88 +1,88 @@ ** Error: unknown flag "&;" - Detected near line 6 of infiles/02 + Detected near line 7 of infiles/02 ** Error: missing semicolon after "&abcd" - Detected near line 6 of infiles/02 + Detected near line 7 of infiles/02 ** Error: missing semicolon after "&abcd" - Detected near line 6 of infiles/02 + Detected near line 7 of infiles/02 ** Error: malformed directive .flag &: - Detected near line 7 of infiles/02 + Detected near line 8 of infiles/02 ** Error: malformed directive .flag &: "abc" "xyz" - Detected near line 8 of infiles/02 + Detected near line 9 of infiles/02 ** Error: a flag must begin with "&" - Detected near line 9 of infiles/02 + Detected near line 10 of infiles/02 ** Error: malformed directive .flag &: :& &' - Detected near line 10 of infiles/02 + Detected near line 11 of infiles/02 ** Warning: extra characters at end of directive .set abcd "abcd" xyz ^^^ - Detected near line 12 of infiles/02 + Detected near line 13 of infiles/02 ** Error: .arg is permitted only inside a macro - Detected near line 14 of infiles/02 + Detected near line 15 of infiles/02 ** Error: .arg is permitted only inside a macro - Detected near line 15 of infiles/02 + Detected near line 16 of infiles/02 ** Error: .endarg is permitted only inside a macro - Detected near line 17 of infiles/02 + Detected near line 18 of infiles/02 ** Error: .endarg is permitted only inside a macro - Detected near line 18 of infiles/02 + Detected near line 19 of infiles/02 ** Error: .eacharg is permitted only inside a macro - Detected near line 20 of infiles/02 + Detected near line 21 of infiles/02 ** Error: .eacharg is permitted only inside a macro - Detected near line 21 of infiles/02 + Detected near line 22 of infiles/02 ** Error: .endeach is permitted only inside a macro - Detected near line 23 of infiles/02 + Detected near line 24 of infiles/02 ** Error: .endeach is permitted only inside a macro - Detected near line 24 of infiles/02 + Detected near line 25 of infiles/02 ** Error: unknown directive line: .rhubarb and custard - Detected near line 26 of infiles/02 + Detected near line 27 of infiles/02 ** Warning: extra characters at end of directive .literal xml stuff ^^^^^ - Detected near line 28 of infiles/02 + Detected near line 29 of infiles/02 ** Warning: extra characters at end of directive .literal off more stuff ^^^^^^^^^^ - Detected near line 30 of infiles/02 + Detected near line 31 of infiles/02 ** Error: malformed directive .arg 4n Processing macro x - Detected near line 40 of infiles/02 + Detected near line 41 of infiles/02 ** Error: malformed directive .arg Processing macro x - Detected near line 40 of infiles/02 + Detected near line 41 of infiles/02 ** Warning: extra characters at end of directive .endarg 99 ^^ Processing macro x - Detected near line 40 of infiles/02 + Detected near line 41 of infiles/02 ** Warning: extra characters at end of directive .eacharg 6 G ^ Processing macro x - Detected near line 40 of infiles/02 + Detected near line 41 of infiles/02 -- cgit v1.2.1 From 383466003e800a06ed6d3de9ede2185d03cca488 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Wed, 4 Jul 2007 08:30:36 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.03.tar.bz2. --- doc/xfpt.html | 408 +++++++++++++++++++++++++++++++++++----------------- doc/xfpt.pdf | Bin 58771 -> 65447 bytes doc/xfpt.xfpt | 225 ++++++++++++++++++++++++----- share/stdmacs | 103 ++++++++++++- src/dot.c | 35 +++++ src/error.c | 7 +- src/functions.h | 4 +- src/globals.c | 5 +- src/globals.h | 3 + src/read.c | 38 ++++- src/xfpt.c | 40 +++++- src/xfpt.h | 6 + testing/infiles/01 | 95 ++++++++++++ testing/outfiles/01 | 105 ++++++++++++++ 14 files changed, 881 insertions(+), 193 deletions(-) diff --git a/doc/xfpt.html b/doc/xfpt.html index ad3069017..b86fb4e4a 100644 --- a/doc/xfpt.html +++ b/doc/xfpt.html @@ -54,7 +54,7 @@ The xfpt plain text to XML processor

- + The xfpt plain text to XML processor

@@ -83,9 +83,9 @@ Revision History -Revision 0.02 +Revision 0.03 -10 April 2007 +03 July 2007 PH @@ -103,7 +103,7 @@ Table of Contents
- + 1. Introduction
@@ -111,7 +111,7 @@ Table of Contents
- + 1.1. The xfpt @@ -121,7 +121,7 @@ command line
- + 1.2. A short xfpt @@ -137,7 +137,7 @@ example
- + 1.4. Format of directive lines
@@ -151,7 +151,7 @@ example
- + 2. Flag sequences
@@ -159,7 +159,7 @@ example
- + 2.1. Flag sequences for XML entities and xfpt @@ -169,25 +169,25 @@ variables
- + 2.2. Flag sequences for calling macros
- + 2.3. Other flag sequences
- + 2.4. Unrecognized flag sequences
- + 2.5. Standard flag sequences
@@ -195,7 +195,7 @@ variables
- + 3. Built-in directive processing
@@ -203,7 +203,7 @@ variables
- + 3.1. The .arg @@ -213,7 +213,7 @@ directive
- + 3.2. The .eacharg @@ -223,7 +223,7 @@ directive
- + 3.3. The .echo @@ -233,7 +233,7 @@ directive
- + 3.4. The .endarg @@ -243,7 +243,7 @@ directive
- + 3.5. The .endeach @@ -253,7 +253,7 @@ directive
- + 3.6. The .endinliteral @@ -263,7 +263,7 @@ directive
- + 3.7. The .flag @@ -273,7 +273,7 @@ directive
- + 3.8. The .include @@ -283,7 +283,7 @@ directive
- + 3.9. The .inliteral @@ -293,7 +293,7 @@ directive
- + 3.10. The .literal @@ -313,49 +313,59 @@ directive
- + 3.12. The -.nonl +.nest directive
- + 3.13. The -.pop +.nonl directive
- + 3.14. The -.push +.pop directive
- + 3.15. The -.revision +.push directive
- + 3.16. The +.revision + +directive + +
+
+ + +3.17. The + .set directive @@ -365,7 +375,7 @@ directive
- + 4. The standard macros for DocBook
@@ -373,81 +383,105 @@ directive
- + 4.1. Overall setup
- + 4.2. Chapters, sections, and subsections
- -4.3. URL references + +4.3. Prefaces, appendixes, and colophons + +
+
+ + +4.4. URL references + +
+
+ + +4.5. Itemized lists + +
+
+ + +4.6. Ordered lists + +
+
+ + +4.7. Variable lists
- -4.4. Itemized lists + +4.8. Nested lists
- -4.5. Ordered lists + +4.9. Displayed text
- -4.6. Variable lists + +4.10. Block quotes
- -4.7. Nested lists + +4.11. Revision markings
- -4.8. Displayed text + +4.12. Informal tables
- -4.9. Block quotes + +4.13. Formal tables
- -4.10. Revision markings + +4.14. Figures and images
- -4.11. Informal tables + +4.15. Footnotes
- -4.12. Indexes + +4.16. Indexes
-

xfpt is a program that reads a marked-up ASCII source file, and converts it into +

xfpt 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 (http://www.methods.co.nz/asciidoc/), xfpt does not try to produce XML from a document that is also usable as a @@ -481,7 +515,7 @@ closing quotes, as follows:   '      becomes  ’

Within normal input text, ampersand, grave accent, and apostrophe are the only -characters that cause xfpt to change the input text, and this applies only to +characters that cause xfpt 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 @@ -491,29 +525,25 @@ Notwithstanding the previous paragraph, xfpt&amp;, &lt;, or &gt;, respectively) is generated. -

The format of the xfpt command line is: +

The format of the xfpt command line is:

 xfpt [options] [input source]

-If no input is specified, the standard input is read. There are three options: -

-help
-

+If no input is specified, the standard input is read. There are four options: +

-help

This option causes xfpt to output its “usage” message, and exit. -

-o <output destination>
-

+

-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. -

-  -S <directory path>
-

+

-S <directory path>

This option overrides the path to xfpt’s library directory that is built into the program. This makes it possible to use or test alternate libraries. -

Here is a very short example of a complete xfpt input file that uses some of the +

-v

+This option causes xfpt to output its version number and exit. +

Here is a very short example of a complete xfpt input file that uses some of the standard macros and flags:

  .include stdflags
@@ -534,14 +564,15 @@ standard macros and flags:
  .endlist
 
  There are also standard macros for ordered lists, literal
- layout blocks, code blocks, URL references, index entries
- and tables.
+ layout blocks, code blocks, URL references, index entries,
+ tables, footnotes, figures, etc.
 

xfpt processes non-directive input lines in one of four ways (known as “modes”):

  • -In the default mode, text is processed paragraph by paragraph. 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, +In the default mode, text is processed paragraph by paragraph. +[1] +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. @@ -552,10 +583,11 @@ typically that of the last line of the paragraph.

  • 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 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. +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.

  • In the “literal text” mode, text is also processed line by line, but no flags are recognized. The only modification xfpt makes to the text is to turn @@ -593,7 +625,7 @@ 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. -

If an input line starts with a dot followed by a space, it is ignored by xfpt. +

If an input line starts with a dot followed by a space, it is ignored by xfpt. 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 @@ -642,7 +674,11 @@ 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. -

Only one flag sequence is built-into the code itself. If an input line ends +



[1] +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. +

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 @@ -655,7 +691,7 @@ involve any number of lines. Thus: produces exactly the same output as:

  The quick brown fox.
-

If an ampersand is followed by a # character, a number, and a semicolon, it is +

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: @@ -679,11 +715,11 @@ of the previous types. In this case, the input text is passed to the output without modification. For example:

  This is an Ohm sign: &Ohm;.
-

If an ampersand is followed by a sequence of alphanumeric characters starting +

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 1.5 for more details. -

Any other flag sequences that are needed must be defined by means of the +

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. @@ -701,24 +737,28 @@ 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. When the first sequence of a paired flag is encountered, its -partner is expected to be found within the same paragraph (or line, in literal -layout mode). Furthermore, multiple occurrences of paired flags must be -correctly nested. For example, in the standard definitions, &' and +first sequence. For example, in the standard definitions, &' and '& are defined as a flag pair for enclosing text in an <emphasis> -element. Each member of the pair is replaced by its replacement text. -

-Note that, though xfpt 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>. -

If an ampersand is not followed by a character sequence in one of the forms +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 xfpt 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>. +

If an ampersand is not followed by a character sequence in one of the forms described in the preceding sections, an error occurs. -

These are the standalone flag sequences that are defined in the stdflags +

These are the standalone flag sequences that are defined in the stdflags file in the xfpt library:

 &&         becomes  &amp; (ampersand)
@@ -744,10 +784,10 @@ 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. -

The directives that are built into the code of xfpt are now described in -alphabetical order. You can see more examples of their use in the definitions +

The directives that are built into the code of xfpt are now described in +alphabetical order. You can see more examples of their use in the descriptions of the standard macros in chapter 4. -

This directive may appear only within the body of a macro. It must be followed +

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 @@ -767,13 +807,19 @@ for the given argument. For example: and the second one is not empty. .endarg .endmacro -

+

+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. -

This directive may appear only within the body of a macro. It may optionally be +

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. +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, @@ -804,14 +850,14 @@ fifth argument:

The .eacharg directive may in principle be nested, though this does not seem useful in practice. -

This directive takes a single string argument. It writes it to the standard +

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. -

See the description of .arg above. -

See the description of .eacharg above. -

See the description of .inliteral below. -

This directive is used to define flag sequences. The directive must be followed +

See the description of .arg above. +

See the description of .eacharg above. +

See the description of .inliteral below. +

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:

@@ -821,16 +867,16 @@ pair and two strings in quotes. White space separates these items. For example:
 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.
-

This directive must be followed by a single string argument that is the path to +

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 xfpt library is prepended. Otherwise, the path is used unaltered. -

This directive may appear only within the body of a macro. It must be followed +

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. -

This must be followed by one of the words “layout”, “text”, “off”, or +

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. @@ -888,11 +934,26 @@ call it, because xfpt looks for built-in 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. -

This directive must be followed by a single string argument. It is processed +

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: +

+ .macro footnote
+ &<footnote>&
+ .nest begin
+ .endmacro
+

+At the start of a nested sequence, the current mode and paragraph state are +remembered and xfpt 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 xfpt reverts to the previous state. +

This directive must be followed by a single string argument. It is processed as normal text, but 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. -

xfpt keeps a stack of text strings that are manipulated by the .push and +

xfpt 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. @@ -905,7 +966,7 @@ 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. -

This directive pushes a string onto the stack. If the rest of the command line +

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, that letter is associated with the string that is pushed, which consists of the rest of the line. For example, the .chapter macro contains this line: @@ -918,7 +979,7 @@ Earlier in the macro there is the line:

This arrangement ensures that any previous chapter is terminated before starting a new one, and also when the end of the input is reached. -

This directive is provided to make it easy to set the revisionflag +

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. @@ -947,8 +1008,8 @@ 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 -4.10). -

This directive must be followed by a name and a text string. It defines a user +4.11). +

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: @@ -970,7 +1031,7 @@ is going to use these features should start with: 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. -

There are two macros that should be used only once, at the start of the +

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:

@@ -980,7 +1041,7 @@ file the standard header material for a DocBook XML file, which is:
 

The .book macro has no arguments. It generates <book> and pushes </book> onto the stack so that it will be output at the end. -

Chapters, sections, and subsections are supported by three macros that all +

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 @@ -1012,7 +1073,10 @@ controlled by the stylesheet when the XML is processed. These three macros use the stack to ensure that each chapter, section, and subsection is terminated at the correct point. For example, starting a new section automatically terminates an open subsection and a previous section. -

The url macro generates URL references, and is intended to be called inline +

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”. +

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: @@ -1027,7 +1091,7 @@ 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. -

The .ilist macro marks the start of an itemized list, the items of which +

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 @@ -1046,7 +1110,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

The .olist macro marks the start of an ordered list, the items of which are +

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:

@@ -1067,7 +1131,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

A variable list is one in which each entry is composed of a set of one or more +

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 @@ -1085,12 +1149,12 @@ This is followed by the body of the entry. The list is terminated by the .endlist

As for the other lists, there may be more than one paragraph in an item. -

Lists may be nested as required. Some DocBook processors automatically choose +

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. -

In displayed text each non-directive input line generates one output line. The +

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. @@ -1121,10 +1185,10 @@ monospaced font. For example:

As the examples illustrate, both kinds of display are terminated by the .endd macro. -

The macro pair .blockquote and .endblockquote are used to wrap the +

The macro pair .blockquote and .endblockquote are used to wrap the lines between them in a <blockquote> element. -

Two macros are provided to simplify setting and unsetting the “changed” -revision marking (see section 3.15). When the revised text is +

Two macros are provided to simplify setting and unsetting the “changed” +revision marking (see section 3.16). 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:

@@ -1170,7 +1234,11 @@ This usage works with both .display a
 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.
-

The .itable macro starts an informal (untitled) table with some basic +

+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. +

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. @@ -1210,14 +1278,76 @@ which has no arguments. For example:

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 output looks like this: +two inches wide and centred. There are two rows. The resulting table looks like +this:

cell 11cell 12
cell 21cell 22

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. -

The .index macro generates <indexterm> elements (index entries) in the +

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: +

+ .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
+

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; if any one is not needed, an empty +string must be supplied as a placeholder. +

  • +The second argument specifies a scaling factor for the image, as a percentage. +Thus, a value of 50 reduces the image to half size. +

  • +The third argument specifies an alignment for the image. It must be one of +left, right or center (or even centre if the DocBook processor +you are using can handle it). +

  • +The fourth and fifth arguments specify the depth and width, respectively. How +these values are handled depends on the processing software. +

+Here is an example of the input for a figure, with all the image options +defaulted: +

+ .figure "My figure's title" "FIGfirst"
+ .image figure01.eps
+ .endfigure
+

+Here is another example, where the figure is reduced to 80% and centred: +

+ .figure "A reduced figure"
+ .image figure02.eps 80 center
+ .endfigure  
+

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: +

+ The &'quick
+ .footnote
+ That's really fast.
+ .endf
+ brown'& fox.
+

+The correct markup for this example is: +

+ The &'quick'&
+ .footnote
+ That's really fast.
+ .endf
+ &'brown'& fox.
+

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 @@ -1226,10 +1356,20 @@ example:

  .index goose "wild chase"
  The chasing of wild geese...
-

+

You can generate “see” and “see also” index entries by using .index-see -and .index-seealso instead of .index. -

+and .index-seealso instead of .index. The first argument of these +macros is the text for the “see”. For example: +

+ .index-see "chase" "wild goose"
+

+This generates: +

+ <indexterm>
+ <primary>wild goose</primary>
+ <see>chase</see>
+ </indexterm>
+

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 diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf index 8e2dc330c..c585068d8 100644 Binary files a/doc/xfpt.pdf and b/doc/xfpt.pdf differ diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt index b2e5d3cb0..71d54bceb 100644 --- a/doc/xfpt.xfpt +++ b/doc/xfpt.xfpt @@ -13,13 +13,13 @@ The xfpt plain text to XML processor xfpt -10 April 2007 +03 July 2007 Philip Hazel PH -0.0210 April 2007PH +0.0303 July 2007PH 2007University of Cambridge .literal off @@ -78,7 +78,7 @@ closing quotes, as follows: .endd Within normal input text, ampersand, grave accent, and apostrophe are the only -characters that cause &X; to change the input text, and this applies only to +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 @@ -95,26 +95,29 @@ 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 three options: -.display - &`-help`& -.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. -.display - &`-o `&&''& -.endd +.vitem "&%-o%&&~&''&" 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. -.display - &`-S `&&''& -.endd + +.vitem "&%-S%&&~&''&" 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. +.new +.vitem &%-v%& +This option causes &X; to output its version number and exit. +.wen +.endlist + .section "A short &X; example" Here is a very short example of a complete &X; input file that uses some of the @@ -138,8 +141,8 @@ standard macros and flags: .endlist There are also standard macros for ordered lists, literal - layout blocks, code blocks, URL references, index entries - and tables. + layout blocks, code blocks, URL references, index entries, + tables, footnotes, figures, etc. .endd @@ -149,9 +152,14 @@ standard macros and flags: &"modes"&): .ilist -In the default mode, text is processed paragraph by paragraph. 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, +In the default mode, text is processed paragraph by paragraph. +.footnote +&new("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. @@ -160,13 +168,15 @@ 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 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 &``& elements. +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 &``& +elements. .next In the &"literal text"& mode, text is also processed line by line, but no flags @@ -347,20 +357,26 @@ 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 &`&&`&. +.new 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. When the first sequence of a paired flag is encountered, its -partner is expected to be found within the same paragraph (or line, in literal -layout mode). Furthermore, multiple occurrences of paired flags must be -correctly nested. For example, in the standard definitions, &`&&'`& and +first sequence. For example, in the standard definitions, &`&&'`& and &`'&&`& are defined as a flag pair for enclosing text in an &``& -element. Each member of the pair is replaced by its replacement text. +element. -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 &``& within &``&, though it does allow &``& -within &``&. +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. +.wen + +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 +&``& within &``&, though it does allow &``& within +&``&. .section "Unrecognized flag sequences" If an ampersand is not followed by a character sequence in one of the forms @@ -401,7 +417,7 @@ convenient. . ---------------------------------------------------------------------------- .chapter "Built-in directive processing" 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 definitions +alphabetical order. You can see more examples of their use in the descriptions of the standard macros in chapter &<>&. @@ -427,6 +443,12 @@ for the given argument. For example: .endarg .endmacro .endd +.new +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. +.wen + The &*.arg*& directive may be nested. @@ -435,7 +457,9 @@ 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. +is not treated specially. &new("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, @@ -482,6 +506,7 @@ See the description of &*.arg*& above. .section "The &*.endeach*& directive" See the description of &*.eacharg*& above. + .section "The &*.endinliteral*& directive" See the description of &*.inliteral*& below. @@ -505,6 +530,7 @@ 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. + .section "The &*.inliteral*& directive" 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 @@ -578,6 +604,26 @@ taken with argument references to ensure that substitutions happen at the right level. +.new +.section "The &*.nest*& directive" +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 + && + .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. +.wen + + .section "The &*.nonl*& directive" This directive must be followed by a single string argument. It is processed as normal text, but without a newline at the end. This facility is useful in @@ -585,7 +631,6 @@ 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" &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 @@ -728,6 +773,13 @@ subsection is terminated at the correct point. For example, starting a new section automatically terminates an open subsection and a previous section. +.new +.section "Prefaces, appendixes, and colophons" +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"&. +.wen + .section "URL references" The &*url*& macro generates URL references, and is intended to be called inline @@ -914,6 +966,12 @@ 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. +.new +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. +.wen + .section "Informal tables" The &*.itable*& macro starts an informal (untitled) table with some basic @@ -958,7 +1016,8 @@ which has no arguments. For example: 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 output looks like this: +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" @@ -972,6 +1031,85 @@ macro within an entry to generate a &``& element with &`revisionflag`& set. +.new +.section "Formal tables" +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" +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 &``& element containing an +&``&. The first argument is the name of the file containing the +image. The remaining arguments are optional; if any one is not needed, an empty +string must be supplied as a placeholder. + +.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`&, &`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" +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 +.wen + + .section "Indexes" The &*.index*& macro generates &``& elements (index entries) in the output. It takes one or two arguments. The first is the text for the primary @@ -983,8 +1121,21 @@ example: .index goose "wild chase" The chasing of wild geese... .endd +.new You can generate &"see"& and &"see also"& index entries by using &*.index-see*& -and &*.index-seealso*& instead of &*.index*&. +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 + + wild goose + chase + +.endd +.wen 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 @@ -1026,6 +1177,4 @@ 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/share/stdmacs b/share/stdmacs index 662dae6cc..6808f7d99 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -17,6 +17,19 @@ .literal off .endmacro +.macro preface "Preface" +.literal layout +.pop C +.push C +.push && +&& +&&$1&& +.arg 3 +&&$3&& +.endarg +.literal off +.endmacro + .macro chapter .literal layout .pop C @@ -32,6 +45,34 @@ .literal off .endmacro +.macro appendix +.literal layout +.pop C +.push C +.push && +&& +.arg 1 +&&$1&& +.endarg +.arg 3 +&&$3&& +.endarg +.literal off +.endmacro + +.macro colophon "Colophon" +.literal layout +.pop C +.push C +.push && +&& +&&$1&& +.arg 3 +&&$3&& +.endarg +.literal off +.endmacro + .macro section .literal layout .pop S @@ -150,8 +191,9 @@ . =============== Tables =============== -.macro itable "none" "0" "0" "2" "1*" "left" "1*" "left" +.macro itable "none" "0" "0" "2" .literal layout +.push && && && .eacharg 5 @@ -160,6 +202,20 @@ && .endmacro +.macro table "title" "ref" "none" "0" "0" "2" +.literal layout +.push && +&& +.arg 1 +&&$1&& +.endarg +&& +.eacharg 7 +&& +.endeach 2 +&& +.endmacro + .macro row .literal layout && @@ -173,7 +229,7 @@ .literal layout && && -&& +.pop .literal off .endmacro @@ -285,4 +341,47 @@ .endinliteral .endmacro +. =============== Footnotes =============== + +.macro footnote +&& +.push && +.nest begin +.endmacro + +.macro endnote +.nest end +.pop +.endmacro + +. =============== Figures =============== + +.macro figure +.literal layout +&& +.arg 1 +&&$1&& +.endarg +.literal off +.endmacro + +.macro endfigure +.literal layout +&& +.literal off +.endmacro + +. =============== Images =============== + +. This is a complete image wrapped inside a . +. +.macro image +.literal layout +&&&& +&& +&&&&&& +.literal off +.endmacro + . End diff --git a/src/dot.c b/src/dot.c index 3c87166e3..f30fab818 100644 --- a/src/dot.c +++ b/src/dot.c @@ -502,6 +502,40 @@ if (md->lines == NULL) +/************************************************* +* 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 * *************************************************/ @@ -700,6 +734,7 @@ static dirstr dirs[] = { { 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 }, diff --git a/src/error.c b/src/error.c index 3aa800742..b98715be0 100644 --- a/src/error.c +++ b/src/error.c @@ -73,10 +73,13 @@ static error_struct error_data[] = { { 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, "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 25 +#define error_maxerror 28 diff --git a/src/functions.h b/src/functions.h index 53de12acc..696ba4604 100644 --- a/src/functions.h +++ b/src/functions.h @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* This header defines all the global functions. */ @@ -19,7 +19,7 @@ extern uschar *misc_readstring(uschar *, int *, uschar *, int); extern void para_process(uschar *); extern uschar *read_nextline(void); -extern uschar *read_paragraph(uschar *); +extern uschar *read_paragraph(uschar *, int *); extern void read_process_macroline(uschar *, uschar *); extern int tree_insertnode(tree_node **, tree_node *); diff --git a/src/globals.c b/src/globals.c index 697335d9b..7140ea876 100644 --- a/src/globals.c +++ b/src/globals.c @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.02 05-Apr-2007"; +uschar *xfpt_version = US "0.03 02-July-2007"; tree_node *entities = NULL; @@ -22,6 +22,9 @@ istackstr *istack = NULL; int literal_state = LITERAL_OFF; +int nest_level = 0; +int nest_literal_stack[MAXNEST+1]; + macroexe *macrocurrent = NULL; macrodef *macrolist = NULL; diff --git a/src/globals.h b/src/globals.h index c8045105a..ce779b32b 100644 --- a/src/globals.h +++ b/src/globals.h @@ -24,6 +24,9 @@ extern istackstr *istack; extern int literal_state; +extern int nest_level; +extern int nest_literal_stack[]; + extern macroexe *macrocurrent; extern macrodef *macrolist; diff --git a/src/read.c b/src/read.c index 7a06eec4a..73b4fffc0 100644 --- a/src/read.c +++ b/src/read.c @@ -310,18 +310,27 @@ return inbuffer; /* 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. The whole is copied into the paragraph buffer. Directives -that are encountered in the paragraph are processed, with the exception of -.literal, which terminates it. We leave a .literal directive in the input -buffer and set next_line to point to it, so that it is processed later. +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. -Arguments: the first line -Returns: the paragraph +(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) +read_paragraph(uschar *p, int *nest_info) { uschar *q = parabuffer; int length = Ustrlen(p); @@ -329,6 +338,8 @@ int length = Ustrlen(p); memcpy(q, p, length); q += length; +*nest_info = NEST_NO; /* Not hit .nest */ + for (;;) { uschar *s; @@ -341,6 +352,19 @@ for (;;) 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); diff --git a/src/xfpt.c b/src/xfpt.c index 7c5b59744..8bdd0e8fa 100644 --- a/src/xfpt.c +++ b/src/xfpt.c @@ -19,6 +19,8 @@ static uschar *xfpt_filename = NULL; static uschar *out_filename = NULL; + + /************************************************* * Usage * *************************************************/ @@ -112,10 +114,10 @@ return TRUE; * Entry point and main program * *************************************************/ - int main(int argc, char **argv) { +BOOL para_unfinished[MAXNEST+1]; uschar *p, *q; if (!xfpt_decode_arg(argc, argv)) return EXIT_FAILURE; @@ -157,6 +159,9 @@ else /* Process the input */ +nest_level = 0; +para_unfinished[0] = FALSE; + while ((p = read_nextline()) != NULL) { if (*p == '.') dot_process(p); else switch (literal_state) @@ -179,18 +184,39 @@ while ((p = read_nextline()) != NULL) while (isspace(*q)) q++; if (*q != 0) { - p = read_paragraph(p); - (void)fprintf(outfile, "<"); - para_process(US"para&xfpt.rev;"); - (void)fprintf(outfile, ">\n"); + 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); - (void)fprintf(outfile, "\n"); + 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, "\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 pushed stack, close the output, and we are done */ +/* Empty the stack of pushed texts, close the output, and we are done. */ while (pushed != 0) { diff --git a/src/xfpt.h b/src/xfpt.h index 4ae812267..bdd2c5a74 100644 --- a/src/xfpt.h +++ b/src/xfpt.h @@ -34,6 +34,12 @@ headers, but they might as well be together with those above. */ #define INBUFFSIZE 1024 #define PARABUFFSIZE 10000 #define FLAGSTACKSIZE 40 +#define MAXNEST 3 + + +/* Nested block indicators for read_paragraph() */ + +enum { NEST_NO, NEST_BEGIN, NEST_END }; /* The literal states */ diff --git a/testing/infiles/01 b/testing/infiles/01 index 61d02eec8..e2e338484 100644 --- a/testing/infiles/01 +++ b/testing/infiles/01 @@ -310,4 +310,99 @@ END NOT FOUR .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 + +.literal off + +.macro image +.literal layout +&&&& +&& +&&&&&& +.literal off +.endmacro + +.macro figure +.literal layout +&& +.arg 1 +&&$1&& +.endarg +.literal off +.endmacro + +.macro endfigure +.literal layout +&& +.literal off +.endmacro + +Here is a reference to figure &<>&. + +.figure "This is the first figure" "FIGfirst" +.image "eps1.eps" +.endfigure + +Here is another reference to figure &<>&. We also have +figure &<>& 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 &<>&. + .makeindex diff --git a/testing/outfiles/01 b/testing/outfiles/01 index 3af3114e6..2bffb0a72 100644 --- a/testing/outfiles/01 +++ b/testing/outfiles/01 @@ -343,6 +343,111 @@ NOT FOUR NOT THREE "" "" END NOT FOUR + +Test footnotes. The quick brown fox + + +Note? + + +jumps + + +Display in footnote. + + +over the lazy + + + + + + + + +1 +2 + + +3 +4 + + + + + +dog. + + +Another paragraph + + +First para in footnote. + + +Second para in footnote. + + +with some footnotes + + +This foot note will have text + + +and a display + + +in various forms. + + +How about a footnote in a display? + + +This is the note. + + +Back in the display. + + + +Here is a reference to figure . + +

+This is the first figure + + + +
+ +Here is another reference to figure . We also have +figure below. + +
+The second figure + + + +
+ +this is title + + + + + +AAA +BBB + + +CCC +DDD + + + +
+ +A ref to table . + -- cgit v1.2.1 From abaf3d3690fae7bdc89335a5cf47d2e3a26c2da7 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 13 Sep 2007 15:02:22 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.04.tar.bz2. --- src/globals.c | 2 +- src/para.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-------- testing/infiles/01 | 10 +++++++- testing/outfiles/01 | 10 +++++++- 4 files changed, 81 insertions(+), 14 deletions(-) diff --git a/src/globals.c b/src/globals.c index 7140ea876..9aadfbf7a 100644 --- a/src/globals.c +++ b/src/globals.c @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.03 02-July-2007"; +uschar *xfpt_version = US "0.04 13-September-2007"; tree_node *entities = NULL; diff --git a/src/para.c b/src/para.c index 5b4ec4380..9de7f88bc 100644 --- a/src/para.c +++ b/src/para.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* This module contains code for processing a paragraph by looking for flag @@ -132,6 +132,51 @@ return q + 1; +/************************************************* +* Check a flag string for literal * +*************************************************/ + +/* This function is called to scan flag replacement strings to check for + and 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, "' || isspace(s[8]))) + *b = TRUE; + else if (Ustrncmp(s, "' || 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 * *************************************************/ @@ -150,6 +195,7 @@ para_process(uschar *p) flagstr *f; flagstr *fstack[FLAGSTACKSIZE]; int fstackcount = 0; +BOOL inliteraltext = FALSE; while (*p != 0) { @@ -168,6 +214,7 @@ while (*p != 0) 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; @@ -180,23 +227,26 @@ while (*p != 0) if (*p == 0) break; /* Otherwise, scan character by character. Angle brackets are escaped, - single quotes are mapped, and then everything other than ampersand is treated - literally. */ + single quotes are mapped except in literal text, and then everything other + than ampersand is treated literally. */ c = *p++; if (c == '<') { (void)fprintf(outfile, "<"); continue; } if (c == '>') { (void)fprintf(outfile, ">"); continue; } - if (c == '`') + if (!inliteraltext) { - (void)fprintf(outfile, "‘"); - continue; - } + if (c == '`') + { + (void)fprintf(outfile, "‘"); + continue; + } - if (c == '\'') - { - (void)fprintf(outfile, "’"); - continue; + if (c == '\'') + { + (void)fprintf(outfile, "’"); + continue; + } } if (c != '&') { (void)fputc(c, outfile); continue; } @@ -315,6 +365,7 @@ while (*p != 0) if (f->length2 != 0) fstack[fstackcount++] = f; (void)fprintf(outfile, "%s", CS f->rep1); + check_literal(f->rep1, &inliteraltext); p += f->length1; } diff --git a/testing/infiles/01 b/testing/infiles/01 index e2e338484..9c1b059a5 100644 --- a/testing/infiles/01 +++ b/testing/infiles/01 @@ -403,6 +403,14 @@ figure &<>& below. .row CCC DDD .endtable -A ref to table &<>&. +A ref to table &<>&. 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 .makeindex diff --git a/testing/outfiles/01 b/testing/outfiles/01 index 2bffb0a72..b30e1fcc7 100644 --- a/testing/outfiles/01 +++ b/testing/outfiles/01 @@ -446,8 +446,16 @@ figure below. -A ref to table . +A ref to table . Now check quotes: ‘normal’ should be changed +to typographic ones. In literal text, `they' shouldn't be changed. + +Check `quoted' in literal monospaced block. + + +But in a literal block that is ‘not monospaced’ ... +Check it's ok when ‘in the same line’. + -- cgit v1.2.1 From 254529d36aa7bc1877c028082ebc18dd112bc3dd Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Fri, 21 Sep 2007 09:32:19 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.05.tar.bz2. --- share/stdmacs | 1 + src/dot.c | 9 +++++++-- src/globals.c | 3 ++- src/globals.h | 3 ++- src/para.c | 2 +- src/read.c | 12 +++--------- testing/infiles/01 | 15 +++++++++++++++ testing/infiles/02 | 2 ++ testing/outfiles/01 | 14 ++++++++++++++ testing/outfiles/02 | 2 ++ testing/outfiles/02.err | 5 +++++ 11 files changed, 54 insertions(+), 14 deletions(-) diff --git a/share/stdmacs b/share/stdmacs index 6808f7d99..351d23fd7 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -142,6 +142,7 @@ .arg 1 &&$1&& .endarg +.literal off .endmacro .macro vitem diff --git a/src/dot.c b/src/dot.c index f30fab818..2721b15bc 100644 --- a/src/dot.c +++ b/src/dot.c @@ -540,7 +540,8 @@ else error(26, p); * Handle .nonl * *************************************************/ -/* Output the argument as normal text, but without a newline on the end. +/* 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 @@ -549,7 +550,11 @@ Returns: nothing static void do_nonl(uschar *p) { -para_process(p); +static uschar nonlbuffer[INBUFFSIZE]; +int len = Ustrlen(p) + 1; +if (len > INBUFFSIZE) len = INBUFFSIZE; +Ustrncpy(nonlbuffer, p, len); +next_line = nonlbuffer; } diff --git a/src/globals.c b/src/globals.c index 9aadfbf7a..2c664db62 100644 --- a/src/globals.c +++ b/src/globals.c @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.04 13-September-2007"; +uschar *xfpt_version = US "0.05 21-September-2007"; tree_node *entities = NULL; @@ -24,6 +24,7 @@ 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; diff --git a/src/globals.h b/src/globals.h index ce779b32b..45bd5ee98 100644 --- a/src/globals.h +++ b/src/globals.h @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* Header file for all the global variables */ @@ -26,6 +26,7 @@ extern int literal_state; extern int nest_level; extern int nest_literal_stack[]; +extern uschar *next_line; extern macroexe *macrocurrent; extern macrodef *macrolist; diff --git a/src/para.c b/src/para.c index 9de7f88bc..93eef3ef8 100644 --- a/src/para.c +++ b/src/para.c @@ -16,7 +16,7 @@ characters and also dealing with literals that must be escaped. */ *************************************************/ /* This function is called when we encounter & followed by a name and an -opening parenthesis. This significies an inline macro call. +opening parenthesis. This signifies an inline macro call. Arguments: p points to the start of the macro name diff --git a/src/read.c b/src/read.c index 73b4fffc0..8d7c56e41 100644 --- a/src/read.c +++ b/src/read.c @@ -11,13 +11,6 @@ -/************************************************* -* Static variables * -*************************************************/ - -static uschar *next_line = NULL; - - /************************************************* * Process macro line * @@ -201,7 +194,8 @@ return buffer; *************************************************/ /* There may be a saved line already in the buffer, following the reading of a -paragraph. Otherwise, take the next line from one of three sources, in order: +paragraph or a .nonl directive. Otherwise, take the next line from one of three +sources, in order: (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. @@ -217,7 +211,7 @@ read_nextline(void) int len; uschar *p, *q; -/* Handle a dot line that terminated a paragraph */ +/* Handle a dot line that terminated a paragraph, or a .nonl line */ if (next_line != NULL) { diff --git a/testing/infiles/01 b/testing/infiles/01 index 9c1b059a5..afa804f2d 100644 --- a/testing/infiles/01 +++ b/testing/infiles/01 @@ -413,4 +413,19 @@ 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 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/testing/infiles/02 b/testing/infiles/02 index b256fafc1..421294cc3 100644 --- a/testing/infiles/02 +++ b/testing/infiles/02 @@ -39,3 +39,5 @@ Try &&abcd without semicolon: &abcd and at EOL &abcd .endmacro .x + +.nonl more than one argument diff --git a/testing/outfiles/01 b/testing/outfiles/01 index b30e1fcc7..bb32e12d0 100644 --- a/testing/outfiles/01 +++ b/testing/outfiles/01 @@ -456,6 +456,20 @@ Check `quoted' in literal monospaced block. But in a literal block that is ‘not monospaced’ ... Check it's ok when ‘in the same line’. + +Extra checks on the use of .nonl. +ABCDEFGH should be joined on +NONL + +At the end of a paragraph? It just puts </para> on the same line. + + +At the start of a paragraph should work too. + + +What about in a display? +Use NONLWITH more stuff + diff --git a/testing/outfiles/02 b/testing/outfiles/02 index ca864bfc3..a2ea745ee 100644 --- a/testing/outfiles/02 +++ b/testing/outfiles/02 @@ -4,3 +4,5 @@ Non defined &rhubarb is &rhubarb; Try &abcd without semicolon: &abcd and at EOL &abcd + +more diff --git a/testing/outfiles/02.err b/testing/outfiles/02.err index 17746cb7b..bc5e33c3a 100644 --- a/testing/outfiles/02.err +++ b/testing/outfiles/02.err @@ -86,3 +86,8 @@ 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 + -- cgit v1.2.1 From 8c96bce3da514e576f4be2119eeb284c577f0f92 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Thu, 7 Feb 2008 10:34:23 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.06.tar.bz2. --- README | 2 +- doc/xfpt.html | 254 ++++++++++++++++++++-------------------- doc/xfpt.pdf | Bin 65447 -> 62566 bytes doc/xfpt.xfpt | 142 ++++++++++------------ src/dot.c | 24 ++-- src/error.c | 37 ++++-- src/globals.c | 6 +- src/globals.h | 2 + src/para.c | 4 +- src/read.c | 127 ++++++++++---------- src/xfpt.c | 5 +- src/xfpt.h | 16 ++- testing/infiles/02 | 10 ++ testing/infiles/02.inc | 3 + testing/infiles/03 | 14 +++ testing/infiles/pic01.aspic.inc | 1 + testing/infiles/pic01.eps.inc | 47 ++++++++ testing/outfiles/02.err | 12 ++ testing/outfiles/03 | 12 ++ testing/runtest | 7 +- 20 files changed, 423 insertions(+), 302 deletions(-) create mode 100644 testing/infiles/02.inc create mode 100644 testing/infiles/03 create mode 100644 testing/infiles/pic01.aspic.inc create mode 100644 testing/infiles/pic01.eps.inc create mode 100644 testing/outfiles/03 diff --git a/README b/README index f09bb1c75..688e1641c 100644 --- a/README +++ b/README @@ -26,5 +26,5 @@ to compile it on any system with a Standard C compiler and library. Philip Hazel January 2006 -Domain: cus.cam.ac.uk +Domain: cam.ac.uk Local part: ph10 diff --git a/doc/xfpt.html b/doc/xfpt.html index b86fb4e4a..062c0803e 100644 --- a/doc/xfpt.html +++ b/doc/xfpt.html @@ -54,7 +54,7 @@ The xfpt plain text to XML processor

- + The xfpt plain text to XML processor

@@ -70,7 +70,7 @@ Hazel
+Copyright © 2008 University of Cambridge

@@ -83,9 +83,9 @@ Revision History -Revision 0.03 +Revision 0.06 -03 July 2007 +06 February 2008 PH @@ -103,7 +103,7 @@ Table of Contents
- + 1. Introduction
@@ -111,7 +111,7 @@ Table of Contents
- + 1.1. The xfpt @@ -121,7 +121,7 @@ command line
- + 1.2. A short xfpt @@ -137,7 +137,7 @@ example
- + 1.4. Format of directive lines
@@ -151,7 +151,7 @@ example
- + 2. Flag sequences
@@ -159,7 +159,7 @@ example
- + 2.1. Flag sequences for XML entities and xfpt @@ -169,25 +169,25 @@ variables
- + 2.2. Flag sequences for calling macros
- + 2.3. Other flag sequences
- + 2.4. Unrecognized flag sequences
- + 2.5. Standard flag sequences
@@ -195,7 +195,7 @@ variables
- + 3. Built-in directive processing
@@ -203,7 +203,7 @@ variables
- + 3.1. The .arg @@ -213,7 +213,7 @@ directive
- + 3.2. The .eacharg @@ -223,7 +223,7 @@ directive
- + 3.3. The .echo @@ -233,7 +233,7 @@ directive
- + 3.4. The .endarg @@ -243,7 +243,7 @@ directive
- + 3.5. The .endeach @@ -253,7 +253,7 @@ directive
- + 3.6. The .endinliteral @@ -263,7 +263,7 @@ directive
- + 3.7. The .flag @@ -273,7 +273,7 @@ directive
- + 3.8. The .include @@ -283,7 +283,7 @@ directive
- + 3.9. The .inliteral @@ -293,7 +293,7 @@ directive
- + 3.10. The .literal @@ -313,7 +313,7 @@ directive
- + 3.12. The .nest @@ -323,7 +323,7 @@ directive
- + 3.13. The .nonl @@ -333,7 +333,7 @@ directive
- + 3.14. The .pop @@ -343,7 +343,7 @@ directive
- + 3.15. The .push @@ -363,7 +363,7 @@ directive
- + 3.17. The .set @@ -383,61 +383,61 @@ directive
- + 4.1. Overall setup
- + 4.2. Chapters, sections, and subsections
- + 4.3. Prefaces, appendixes, and colophons
- + 4.4. URL references
- + 4.5. Itemized lists
- + 4.6. Ordered lists
- + 4.7. Variable lists
- + 4.8. Nested lists
- + 4.9. Displayed text
- + 4.10. Block quotes
@@ -449,31 +449,31 @@ directive
- + 4.12. Informal tables
- + 4.13. Formal tables
- + 4.14. Figures and images
- + 4.15. Footnotes
- + 4.16. Indexes
@@ -481,7 +481,7 @@ directive
-

xfpt is a program that reads a marked-up ASCII source file, and converts it into +

xfpt 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 (http://www.methods.co.nz/asciidoc/), xfpt does not try to produce XML from a document that is also usable as a @@ -525,7 +525,7 @@ Notwithstanding the previous paragraph, xfpt&amp;, &lt;, or &gt;, respectively) is generated. -

The format of the xfpt command line is: +

The format of the xfpt command line is:

 xfpt [options] [input source]

@@ -541,9 +541,9 @@ be given as an output destination to refer to the standard output.

-S <directory path>

This option overrides the path to xfpt’s library directory that is built into the program. This makes it possible to use or test alternate libraries. -

-v

+

-v

This option causes xfpt to output its version number and exit. -

Here is a very short example of a complete xfpt input file that uses some of the +

Here is a very short example of a complete xfpt input file that uses some of the standard macros and flags:

  .include stdflags
@@ -570,7 +570,7 @@ standard macros and flags:
 “modes”):
 

  • In the default mode, text is processed paragraph by paragraph. -[1] +[1] 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 @@ -625,7 +625,7 @@ 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. -

If an input line starts with a dot followed by a space, it is ignored by xfpt. +

If an input line starts with a dot followed by a space, it is ignored by xfpt. 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 @@ -674,11 +674,11 @@ 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. -



[1] +



[1] 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. -

Only one flag sequence is built-into the code itself. If an input line ends +

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 @@ -691,7 +691,7 @@ involve any number of lines. Thus: produces exactly the same output as:

  The quick brown fox.
-

If an ampersand is followed by a # character, a number, and a semicolon, it is +

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: @@ -715,11 +715,11 @@ of the previous types. In this case, the input text is passed to the output without modification. For example:

  This is an Ohm sign: &Ohm;.
-

If an ampersand is followed by a sequence of alphanumeric characters starting +

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 1.5 for more details. -

Any other flag sequences that are needed must be defined by means of the +

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. @@ -737,28 +737,28 @@ 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, &' and '& 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 xfpt 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>. -

If an ampersand is not followed by a character sequence in one of the forms +

If an ampersand is not followed by a character sequence in one of the forms described in the preceding sections, an error occurs. -

These are the standalone flag sequences that are defined in the stdflags +

These are the standalone flag sequences that are defined in the stdflags file in the xfpt library:

 &&         becomes  &amp; (ampersand)
@@ -784,10 +784,10 @@ 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. -

The directives that are built into the code of xfpt are now described in +

The directives that are built into the code of xfpt are now described in alphabetical order. You can see more examples of their use in the descriptions of the standard macros in chapter 4. -

This directive may appear only within the body of a macro. It must be followed +

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 @@ -807,19 +807,18 @@ for the given argument. For example: and the second one is not empty. .endarg .endmacro -

+

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. -

This directive may appear only within the body of a macro. It may optionally be +

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. +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, @@ -850,14 +849,14 @@ fifth argument:

The .eacharg directive may in principle be nested, though this does not seem useful in practice. -

This directive takes a single string argument. It writes it to the standard +

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. -

See the description of .arg above. -

See the description of .eacharg above. -

See the description of .inliteral below. -

This directive is used to define flag sequences. The directive must be followed +

See the description of .arg above. +

See the description of .eacharg above. +

See the description of .inliteral below. +

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:

@@ -867,16 +866,18 @@ pair and two strings in quotes. White space separates these items. For example:
 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.
-

This directive must be followed by a single string argument that is the path to +

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 xfpt -library is prepended. Otherwise, the path is used unaltered. -

This directive may appear only within the body of a macro. It must be followed +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. +

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. -

This must be followed by one of the words “layout”, “text”, “off”, or +

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. @@ -934,26 +935,26 @@ call it, because xfpt looks for built-in 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. -

This directive must be followed by one of the words “begin” or “end”. It is +

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: -

+

  .macro footnote
  &<footnote>&
  .nest begin
  .endmacro
-

+

At the start of a nested sequence, the current mode and paragraph state are remembered and xfpt 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 xfpt reverts to the previous state. -

This directive must be followed by a single string argument. It is processed -as normal text, but without a newline at the end. This facility is useful in -macros when constructing a single data line from several text fragments. See +

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. -

xfpt keeps a stack of text strings that are manipulated by the .push and +

xfpt 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. @@ -966,7 +967,7 @@ 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. -

This directive pushes a string onto the stack. If the rest of the command line +

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, that letter is associated with the string that is pushed, which consists of the rest of the line. For example, the .chapter macro contains this line: @@ -1009,7 +1010,7 @@ 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 4.11). -

This directive must be followed by a name and a text string. It defines a user +

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: @@ -1031,7 +1032,7 @@ is going to use these features should start with: 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. -

There are two macros that should be used only once, at the start of the +

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:

@@ -1041,7 +1042,7 @@ file the standard header material for a DocBook XML file, which is:
 

The .book macro has no arguments. It generates <book> and pushes </book> onto the stack so that it will be output at the end. -

Chapters, sections, and subsections are supported by three macros that all +

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 @@ -1073,10 +1074,10 @@ controlled by the stylesheet when the XML is processed. These three macros use the stack to ensure that each chapter, section, and subsection is terminated at the correct point. For example, starting a new section automatically terminates an open subsection and a previous section. -

The macros .preface, .appendix, and .colophon operate in the same +

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”. -

The url macro generates URL references, and is intended to be called inline +

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: @@ -1091,7 +1092,7 @@ 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. -

The .ilist macro marks the start of an itemized list, the items of which +

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 @@ -1110,7 +1111,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

The .olist macro marks the start of an ordered list, the items of which are +

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:

@@ -1131,7 +1132,7 @@ For example: .endlist

There may be more than one paragraph in an item. -

A variable list is one in which each entry is composed of a set of one or more +

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 @@ -1149,12 +1150,12 @@ This is followed by the body of the entry. The list is terminated by the .endlist

As for the other lists, there may be more than one paragraph in an item. -

Lists may be nested as required. Some DocBook processors automatically choose +

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. -

In displayed text each non-directive input line generates one output line. The +

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. @@ -1185,7 +1186,7 @@ monospaced font. For example:

As the examples illustrate, both kinds of display are terminated by the .endd macro. -

The macro pair .blockquote and .endblockquote are used to wrap the +

The macro pair .blockquote and .endblockquote are used to wrap the lines between them in a <blockquote> element.

Two macros are provided to simplify setting and unsetting the “changed” revision marking (see section 3.16). When the revised text is @@ -1234,11 +1235,11 @@ This usage works with both .display a 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. -

The .itable macro starts an informal (untitled) table with some basic +

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. @@ -1286,68 +1287,69 @@ The .row macro does not set the new macro within an entry to generate a <phrase> element with revisionflag set. -

The .table macro starts a formal table, that is, a table that has a title, +

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: -

+

  .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
-

A figure is enclosed between .figure and .endfigure macros. The first +

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; if any one is not needed, an empty -string must be supplied as a placeholder. -

  • +<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. +

    • The second argument specifies a scaling factor for the image, as a percentage. Thus, a value of 50 reduces the image to half size. -

  • +

  • The third argument specifies an alignment for the image. It must be one of -left, right or center (or even centre if the DocBook processor -you are using can handle it). -

  • +left (default), right or center (or even centre if the +DocBook processor you are using can handle it). +

  • The fourth and fifth arguments specify the depth and width, respectively. How these values are handled depends on the processing software. -

  • +

    Here is an example of the input for a figure, with all the image options defaulted: -

    +

      .figure "My figure's title" "FIGfirst"
      .image figure01.eps
      .endfigure
    -

    +

    Here is another example, where the figure is reduced to 80% and centred: -

    +

      .figure "A reduced figure"
      .image figure02.eps 80 center
      .endfigure  
    -

    Footnotes can be specified between .footnote and .endnote macros. +

    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: -

    +

      The &'quick
      .footnote
      That's really fast.
      .endf
      brown'& fox.
    -

    +

    The correct markup for this example is: -

    +

      The &'quick'&
      .footnote
      That's really fast.
      .endf
      &'brown'& fox.
    -

    The .index macro generates <indexterm> elements (index entries) in the +

    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 @@ -1356,20 +1358,20 @@ example:

      .index goose "wild chase"
      The chasing of wild geese...
    -

    +

    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: -

    +

      .index-see "chase" "wild goose"
    -

    +

    This generates: -

    +

      <indexterm>
      <primary>wild goose</primary>
      <see>chase</see>
      </indexterm>
    -

    +

    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 diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf index c585068d8..caa54eadf 100644 Binary files a/doc/xfpt.pdf and b/doc/xfpt.pdf differ diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt index 71d54bceb..e23ac9d67 100644 --- a/doc/xfpt.xfpt +++ b/doc/xfpt.xfpt @@ -13,14 +13,14 @@ The xfpt plain text to XML processor xfpt -03 July 2007 +06 February 2008 Philip Hazel PH -0.0303 July 2007PH -2007University of Cambridge +0.0606 February 2008PH +2008University of Cambridge .literal off @@ -41,7 +41,7 @@ . ---------------------------------------------------------------------------- -.chapter "Introduction" +.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/)), @@ -90,7 +90,7 @@ output, the appropriate XML entity reference (&`&&`&, &`&<`&, or &`&>`&, respectively) is generated. -.section "The &X; command line" +.section "The &X; command line" ID01 The format of the &X; command line is: .display &`xfpt [`&&'options'&&`] [`&&'input source'&&`]`& @@ -112,14 +112,12 @@ be given as an output destination to refer to the standard output. 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. -.new .vitem &%-v%& This option causes &X; to output its version number and exit. -.wen .endlist -.section "A short &X; example" +.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 @@ -147,7 +145,7 @@ standard macros and flags: -.section "Literal and non-literal processing" "SECTliteralprocessing" +.section "Literal and non-literal processing" "SECTliteralprocessing" ID03 &X; processes non-directive input lines in one of four ways (known as &"modes"&): @@ -219,7 +217,7 @@ lines), is to indent every displayed line by one space, and thereby avoid the problem altogether. -.section "Format of directive lines" +.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 @@ -237,7 +235,7 @@ dot is treated as a data line. -.section "Calling macros" "SECTcallingmacro" +.section "Calling macros" "SECTcallingmacro" ID05 Macros are defined by the &*.macro*& directive, which is described in section &<>&. 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 @@ -280,7 +278,7 @@ standard library are examples of macros that are designed be called either way. . ---------------------------------------------------------------------------- -.chapter "Flag sequences" +.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 @@ -300,7 +298,7 @@ produces exactly the same output as: .endd -.section "Flag sequences for XML entities and &X; variables" +.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 @@ -329,7 +327,7 @@ without modification. For example: .endlist -.section "Flag sequences for calling macros" +.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 @@ -337,7 +335,7 @@ section &<>& for more details. -.section "Other flag sequences" +.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 @@ -357,7 +355,6 @@ 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 &`&&`&. -.new 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 @@ -370,7 +367,6 @@ 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. -.wen 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 @@ -378,12 +374,12 @@ you from generating invalid XML. For example, DocBook does not allow &``& within &``&, though it does allow &``& within &``&. -.section "Unrecognized flag sequences" +.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" +.section "Standard flag sequences" ID11 These are the standalone flag sequences that are defined in the &_stdflags_& file in the &X; library: .display @@ -415,13 +411,13 @@ convenient. . ---------------------------------------------------------------------------- -.chapter "Built-in directive processing" +.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 &<>&. -.section "The &*.arg*& directive" +.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 @@ -443,23 +439,20 @@ for the given argument. For example: .endarg .endmacro .endd -.new 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. -.wen The &*.arg*& directive may be nested. -.section "The &*.eacharg*& directive" +.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. &new("However, like &*.arg*&, only the actual -arguments of a macro call are considered. Default argument values do not -count.") +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, @@ -492,26 +485,26 @@ The &*.eacharg*& directive may in principle be nested, though this does not seem useful in practice. -.section "The &*.echo*& directive" +.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" +.section "The &*.endarg*& directive" ID16 See the description of &*.arg*& above. -.section "The &*.endeach*& directive" +.section "The &*.endeach*& directive" ID17 See the description of &*.eacharg*& above. -.section "The &*.endinliteral*& directive" +.section "The &*.endinliteral*& directive" ID18 See the description of &*.inliteral*& below. -.section "The &*.flag*& directive" +.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: @@ -524,14 +517,16 @@ redefine an existing flag, the new definition overrides the old. There is no way to revert to the previous definition. -.section "The &*.include*& directive" +.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. +library is prepended. Otherwise, the path is used unaltered. &new("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" +.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 @@ -539,7 +534,7 @@ literal mode does not correspond to the word, subsequent lines, up to a nested. -.section "The &*.literal*& directive" +.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 @@ -548,7 +543,7 @@ Section &<>& describes how input lines are processed in the four modes. -.section "The &*.macro*& directive" "SECTmacro" +.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 @@ -604,8 +599,7 @@ taken with argument references to ensure that substitutions happen at the right level. -.new -.section "The &*.nest*& directive" +.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 @@ -621,17 +615,16 @@ 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. -.wen -.section "The &*.nonl*& directive" +.section "The &*.nonl*& directive" ID25 This directive must be followed by a single string argument. It is processed -as normal text, but without a newline at the end. This facility is useful in -macros when constructing a single data line from several text fragments. See +as &new("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" +.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 @@ -647,7 +640,7 @@ 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" +.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, that letter is associated with the string that is pushed, which consists of the rest of the @@ -663,7 +656,7 @@ This arrangement ensures that any previous chapter is terminated before starting a new one, and also when the end of the input is reached. -.section "The &*.revision*& directive" "SECTrevision" +.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 @@ -696,7 +689,7 @@ standard macros &*.new*& and &*.wen*& are provided (see section &<>&). -.section "The &*.set*& directive" +.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 @@ -712,7 +705,7 @@ has been defined. . ---------------------------------------------------------------------------- -.chapter "The standard macros for DocBook" "CHAPstdmac" "Standard macros" +.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 @@ -725,7 +718,7 @@ 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" +.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: @@ -738,7 +731,7 @@ The &*.book*& macro has no arguments. It generates &``& and pushes &``& onto the stack so that it will be output at the end. -.section "Chapters, sections, and subsections" +.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 @@ -773,15 +766,13 @@ subsection is terminated at the correct point. For example, starting a new section automatically terminates an open subsection and a previous section. -.new -.section "Prefaces, appendixes, and colophons" +.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"&. -.wen -.section "URL references" +.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 &``& element, and has either one or two arguments. The first argument is the URL, and the @@ -800,7 +791,7 @@ do not want. -.section "Itemized lists" +.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 @@ -822,7 +813,7 @@ For example: There may be more than one paragraph in an item. -.section "Ordered lists" +.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: @@ -846,7 +837,7 @@ For example: There may be more than one paragraph in an item. -.section "Variable lists" +.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. @@ -867,7 +858,7 @@ This is followed by the body of the entry. The list is terminated by the As for the other lists, there may be more than one paragraph in an item. -.section "Nested lists" +.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 @@ -875,7 +866,7 @@ 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" +.section "Displayed text" ID39 In displayed text each non-directive input line generates one output line. The &``& DocBook element is used to achieve this. Two kinds of displayed text are supported by the standard macros. They differ in their @@ -912,12 +903,12 @@ As the examples illustrate, both kinds of display are terminated by the -.section "Block quotes" +.section "Block quotes" ID40 The macro pair &*.blockquote*& and &*.endblockquote*& are used to wrap the lines between them in a &`

    `& element. -.section "Revision markings" "SECTrevmacs" +.section "Revision markings" "SECTrevmacs" ID41 Two macros are provided to simplify setting and unsetting the &"changed"& revision marking (see section &<>&). When the revised text is substantial (for example, a complete paragraph, table, display, or section), it @@ -966,14 +957,12 @@ 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. -.new 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. -.wen -.section "Informal tables" +.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, @@ -1031,8 +1020,7 @@ macro within an entry to generate a &``& element with &`revisionflag`& set. -.new -.section "Formal tables" +.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 @@ -1048,24 +1036,25 @@ For example: .endd -.section "Figures and images" +.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 &``& element containing an -&``&. The first argument is the name of the file containing the -image. The remaining arguments are optional; if any one is not needed, an empty -string must be supplied as a placeholder. +&``&. The first argument is the name of the file containing the +image. The remaining arguments are optional; &new("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`&, &`right`& or &`center`& (or even &`centre`& if the DocBook processor -you are using can handle it). +&`left`& &new("(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. @@ -1087,7 +1076,7 @@ Here is another example, where the figure is reduced to 80% and centred: .endd -.section "Footnotes" +.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 @@ -1107,10 +1096,9 @@ The correct markup for this example is: .endf &'brown'& fox. .endd -.wen -.section "Indexes" +.section "Indexes" ID46 The &*.index*& macro generates &``& 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 @@ -1121,7 +1109,6 @@ example: .index goose "wild chase" The chasing of wild geese... .endd -.new 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: @@ -1135,7 +1122,6 @@ This generates: chase .endd -.wen 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 diff --git a/src/dot.c b/src/dot.c index 2721b15bc..7b6aabdfd 100644 --- a/src/dot.c +++ b/src/dot.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2007 */ +/* Copyright (c) University of Cambridge, 2008 */ /* Written by Philip Hazel. */ /* This module contains code for processing a line that starts with a dot. */ @@ -81,6 +81,7 @@ while (!done) macroexe *temp = macrocurrent; macrocurrent = macrocurrent->prev; free(temp); + from_type_ptr--; break; } } @@ -110,7 +111,7 @@ BOOL mustexist = TRUE; argstr *arg; int i, argn; -if (macrocurrent == NULL) { error(15, US".arg"); return; } +if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".arg"); return; } if (*p == '-') { @@ -147,7 +148,7 @@ do_eacharg(uschar *p) argstr *arg; int argn, i; -if (macrocurrent == NULL) { error(15, US".eacharg"); return; } +if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".eacharg"); return; } argn = (*p == 0)? 1 : readnumber(p); if (argn < 0) return; @@ -199,7 +200,7 @@ Returns: nothing static void do_endarg(uschar *p) { -if (macrocurrent == NULL) { error(15, US".endarg"); return; } +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); } @@ -222,7 +223,7 @@ do_endeach(uschar *p) { int count; -if (macrocurrent == NULL) { error(15, US".endeach"); return; } +if (from_type[from_type_ptr] != FROM_MACRO) { error(15, US".endeach"); return; } count = (*p == 0)? 1 : readnumber(p); if (count < 0) return; @@ -251,7 +252,7 @@ Returns: nothing static void do_endinliteral(uschar *p) { -if (macrocurrent == NULL) { error(15, US".endinliteral"); return; } +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); } @@ -350,8 +351,8 @@ f->next = *ff; * Handle .include * *************************************************/ -/* We set up a stack of included files so that the input is treated as one big -file. +/* 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 @@ -372,6 +373,8 @@ if (Ustrchr(p, '/') != NULL) Ustrcpy(ist->filename, 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; } @@ -392,7 +395,7 @@ static void do_inliteral(uschar *p) { int state = -1; -if (macrocurrent == NULL) { error(15, US".inliteral"); return; } +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; @@ -862,13 +865,14 @@ if (md == NULL) return; } -/* Found a macro */ +/* 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); diff --git a/src/error.c b/src/error.c index b98715be0..431d797fd 100644 --- a/src/error.c +++ b/src/error.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2008 */ /* Written by Philip Hazel. */ /* Error handling routines */ @@ -102,8 +102,9 @@ Returns: nothing, but some errors do not return void error(int n, ...) { -int ec; +int ec, i; macroexe *me; +istackstr *fe; va_list ap; va_start(ap, n); @@ -128,19 +129,29 @@ else va_end(ap); -for (me = macrocurrent; me != NULL; me = me->prev) - { - (void)fprintf(stderr, " Processing macro %s\n", me->macro->name); - } +me = macrocurrent; +fe = istack; -if (istack != NULL) - { - (void)fprintf(stderr, " Detected near line %d of %s\n", - istack->linenumber, istack->filename); - } -else +for (i = from_type_ptr; i >= 0; i--) { - (void)fprintf(stderr, " Detected near end of file\n"); + 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) diff --git a/src/globals.c b/src/globals.c index 2c664db62..44297f127 100644 --- a/src/globals.c +++ b/src/globals.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2007 */ +/* Copyright (c) University of Cambridge, 2008 */ /* Written by Philip Hazel. */ /* Allocate storage and initialize global variables */ @@ -11,11 +11,13 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.05 21-September-2007"; +uschar *xfpt_version = US "0.06 06-February-2008"; tree_node *entities = NULL; flagstr *flaglist = NULL; +int from_type[FROM_TYPE_STACKSIZE]; +int from_type_ptr = 0; uschar *inbuffer = NULL; istackstr *istack = NULL; diff --git a/src/globals.h b/src/globals.h index 45bd5ee98..84868fc67 100644 --- a/src/globals.h +++ b/src/globals.h @@ -18,6 +18,8 @@ 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; diff --git a/src/para.c b/src/para.c index 93eef3ef8..4f00a981d 100644 --- a/src/para.c +++ b/src/para.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2007 */ +/* Copyright (c) University of Cambridge, 2008 */ /* Written by Philip Hazel. */ /* This module contains code for processing a paragraph by looking for flag @@ -53,6 +53,7 @@ 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); @@ -118,6 +119,7 @@ for (;;) macroexe *temp = macrocurrent; macrocurrent = macrocurrent->prev; free(temp); + from_type_ptr--; break; } } diff --git a/src/read.c b/src/read.c index 8d7c56e41..cd384eeb7 100644 --- a/src/read.c +++ b/src/read.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2008 */ /* Written by Philip Hazel. */ /* This module contains code for reading the input. */ @@ -156,38 +156,6 @@ while (*p != 0) } -/************************************************* -* Get the next line from the current file * -*************************************************/ - -/* There may be a stack of included files. This function makes them look like a -single source of input. - -Arguments: - buffer where to read - size size of buffer - -Returns: buffer pointer or NULL -*/ - -static uschar * -read_nextfileline(uschar *buffer, int size) -{ -if (istack == NULL) return NULL; -if (Ufgets(buffer, size, istack->file) == NULL) - { - istackstr *prev = istack->prev; - fclose(istack->file); - free(istack); - istack = prev; - return (istack == NULL)? NULL : read_nextfileline(buffer, size); - } - -istack->linenumber++; -return buffer; -} - - /************************************************* * Get the next line of input * @@ -195,11 +163,16 @@ return buffer; /* 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, in order: +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) Read a new line from a file and handle any continuations. + (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 @@ -250,47 +223,77 @@ if (popto > 0) return inbuffer; } -/* Handle the next macro line. */ +/* Get the next line from the current macro or the current file. We need a loop +for handling the ends of macros and files. */ -while (macrocurrent != NULL) +for (;;) { - if (macrocurrent->nextline == NULL) + if (from_type[from_type_ptr] == FROM_MACRO) { - macroexe *temp = macrocurrent; - macrocurrent = macrocurrent->prev; - free(temp); + 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 { - read_process_macroline(macrocurrent->nextline->string, inbuffer); - macrocurrent->nextline = macrocurrent->nextline->next; - return inbuffer; - } - } + if (istack == NULL) return NULL; + if (Ufgets(inbuffer, INBUFFSIZE, istack->file) == NULL) + { + istackstr *prev = istack->prev; + fclose(istack->file); + free(istack); + istack = prev; + } + else + { + istack->linenumber++; -/* Get a line from an input file */ + q = inbuffer; + len = Ustrlen(q); -if (read_nextfileline(inbuffer, INBUFFSIZE) == NULL) return NULL; + for (;;) + { + p = q + len; + while (p > q && isspace(p[-1])) p--; -q = inbuffer; -len = Ustrlen(q); + if (p - q < 3 || Ustrncmp(p - 3, "&&&", 3) != 0) break; -for (;;) - { - p = q + len; - while (p > q && isspace(p[-1])) p--; + q = p - 3; + *q = 0; + + if (istack == NULL || + Ufgets(q, INBUFFSIZE - (q - inbuffer), istack->file) == NULL) + break; - if (p - q < 3 || Ustrncmp(p - 3, "&&&", 3) != 0) break; + istack->linenumber++; + p = q; + while (*p == ' ' || *p == '\t') p++; + len = Ustrlen(p); + if (p > q) memmove(q, p, len + 1); + } - q = p - 3; - *q = 0; + break; + } + } - if (read_nextfileline(q, INBUFFSIZE - (q - inbuffer)) == NULL) 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. */ - p = q; - while (*p == ' ' || *p == '\t') p++; - len = Ustrlen(p); - if (p > q) memmove(q, p, len + 1); + from_type_ptr--; } return inbuffer; diff --git a/src/xfpt.c b/src/xfpt.c index 8bdd0e8fa..bb8a74c99 100644 --- a/src/xfpt.c +++ b/src/xfpt.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2007 */ +/* Copyright (c) University of Cambridge, 2008 */ /* Written by Philip Hazel. */ /* This module contains the main program and initialization functions. */ @@ -131,6 +131,9 @@ 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; diff --git a/src/xfpt.h b/src/xfpt.h index bdd2c5a74..df19ed4fd 100644 --- a/src/xfpt.h +++ b/src/xfpt.h @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* 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. */ @@ -31,10 +31,16 @@ 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 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() */ diff --git a/testing/infiles/02 b/testing/infiles/02 index 421294cc3..c4c6e5142 100644 --- a/testing/infiles/02 +++ b/testing/infiles/02 @@ -41,3 +41,13 @@ Try &&abcd without semicolon: &abcd and at EOL &abcd .x .nonl more than one argument + +.macro a +.include infiles/02.inc +.endmacro + +.macro b +.arg 4n +.endmacro + +.a diff --git a/testing/infiles/02.inc b/testing/infiles/02.inc new file mode 100644 index 000000000..76202b0e1 --- /dev/null +++ b/testing/infiles/02.inc @@ -0,0 +1,3 @@ +.b + +.arg 3 diff --git a/testing/infiles/03 b/testing/infiles/03 new file mode 100644 index 000000000..d4d2c65e2 --- /dev/null +++ b/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/testing/infiles/pic01.aspic.inc b/testing/infiles/pic01.aspic.inc new file mode 100644 index 000000000..52834896c --- /dev/null +++ b/testing/infiles/pic01.aspic.inc @@ -0,0 +1 @@ +box "A"; line; circle "B"; diff --git a/testing/infiles/pic01.eps.inc b/testing/infiles/pic01.eps.inc new file mode 100644 index 000000000..3f0e7122d --- /dev/null +++ b/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/testing/outfiles/02.err b/testing/outfiles/02.err index bc5e33c3a..835b6c412 100644 --- a/testing/outfiles/02.err +++ b/testing/outfiles/02.err @@ -91,3 +91,15 @@ ^^^^^^^^^^^^^^^^^ 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 + diff --git a/testing/outfiles/03 b/testing/outfiles/03 new file mode 100644 index 000000000..0e3290abf --- /dev/null +++ b/testing/outfiles/03 @@ -0,0 +1,12 @@ + +Testing + +box "A"; line; circle "B"; + +
    + + + +
    +
    + diff --git a/testing/runtest b/testing/runtest index efe165c5e..1cd36a638 100755 --- a/testing/runtest +++ b/testing/runtest @@ -3,7 +3,7 @@ # Controlling script for xfpt tests $xfpt = "../src/xfpt -S ../share"; -$cf = "cf"; +$cf = (-f "/usr/local/bin/cf")? "cf" : "diff -u"; $force_update = 0; $starttest = undef; @@ -35,9 +35,10 @@ while (scalar @files > 0) my($options) = $cmd_options; # Skip . and .. and also skip any file ending in .opt because that - # contains options for any given test. + # contains options for any given test, and any file ending in .inc + # because that is an included file. - next if $file =~ /^\.\.?$|\.opt$/; + next if $file =~ /^\.\.?$|\.opt$|\.inc$/; next if !$started && defined $starttest && $file !~ /^$starttest/; $started = 1; -- cgit v1.2.1 From ee3cabe6c57323f807ef50baf6341231801d0396 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Fri, 24 Jul 2009 15:28:45 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.07.tar.bz2. --- doc/xfpt.html | 185 ++++++++++++++++++++++++++++++---------------------- doc/xfpt.pdf | Bin 62566 -> 64878 bytes doc/xfpt.xfpt | 58 +++++++++++----- share/stdmacs | 50 ++++++++++++++ src/globals.c | 4 +- testing/infiles/04 | 9 +++ testing/outfiles/04 | 16 +++++ testing/runtest | 2 +- 8 files changed, 229 insertions(+), 95 deletions(-) create mode 100644 testing/infiles/04 create mode 100644 testing/outfiles/04 diff --git a/doc/xfpt.html b/doc/xfpt.html index 062c0803e..b18242810 100644 --- a/doc/xfpt.html +++ b/doc/xfpt.html @@ -1,4 +1,3 @@ - The xfpt plain text to XML processor - +
    @@ -54,7 +53,7 @@ The xfpt plain text to XML processor

    - + The xfpt plain text to XML processor

    @@ -70,7 +69,7 @@ Hazel
    +Copyright © 2009 University of Cambridge

    xfpt 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 (http://www.methods.co.nz/asciidoc/), +forms of XML. Unlike AsciiDoc (http://www.methods.co.nz/asciidoc/), xfpt does not try to produce XML from a document that is also usable as a freestanding ASCII document. The input for xfpt is very definitely “marked up”. This makes it less ambiguous for large and/or complicated documents. xfpt @@ -530,18 +541,18 @@ output, the appropriate XML entity reference (&amp;xfpt [options] [input source]

    If no input is specified, the standard input is read. There are four options: -

    -help

    +

    -help

    This option causes xfpt to output its “usage” message, and exit. -

    -o <output destination>

    +

    -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. -

    -S <directory path>

    +

    -S <directory path>

    This option overrides the path to xfpt’s library directory that is built into the program. This makes it possible to use or test alternate libraries. -

    -v

    +

    -v

    This option causes xfpt to output its version number and exit.

    Here is a very short example of a complete xfpt input file that uses some of the standard macros and flags: @@ -570,7 +581,7 @@ standard macros and flags: “modes”):

    • In the default mode, text is processed paragraph by paragraph. -[1] +[1] 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 @@ -640,7 +651,7 @@ 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.

    Macros are defined by the .macro directive, which is described in section -3.11. There are two ways of calling a macro. It can be called in the +3.11. 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”.

    @@ -674,10 +685,10 @@ 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. -



    [1] -There is, however, a special case when a paragraph contains one or more +



    [1] +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. +independently.

    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 @@ -718,7 +729,7 @@ without modification. For example:

    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 1.5 for more details. +section 1.5 for more details.

    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 @@ -786,7 +797,7 @@ sequence of literal XML, changing to the literal XML mode may be more convenient.

    The directives that are built into the code of xfpt are now described in alphabetical order. You can see more examples of their use in the descriptions -of the standard macros in chapter 4. +of the standard macros in chapter 4.

    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 @@ -869,9 +880,9 @@ way to revert to the previous definition.

    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 xfpt -library is prepended. Otherwise, the path is used unaltered. If +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. +called, and thus can be used to include a different file on each occasion.

    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 @@ -881,14 +892,14 @@ nested. “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 1.3 describes how input lines are processed in +Section 1.3 describes how input lines are processed in the four modes.

    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 1.5). +processed only when the macro is called (see section 1.5).

    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 @@ -951,7 +962,7 @@ remembered and xfpt then reverts to the d At the end of a nested sequence, if a paragraph has been started, it is terminated, and then xfpt reverts to the previous state.

    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 +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.

    xfpt keeps a stack of text strings that are manipulated by the .push and @@ -1009,7 +1020,7 @@ 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 -4.11). +4.13).

    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 @@ -1042,7 +1053,18 @@ file the standard header material for a DocBook XML file, which is:

    The .book macro has no arguments. It generates <book> and pushes </book> onto the stack so that it will be output at the end. -

    Chapters, sections, and subsections are supported by three macros that all +

    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: +

    + .pi sdop 'toc_sections="yes,yes,no"'
    +

    +This generates <?sdop toc_sections="yes,yes,no"?>. +

    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 @@ -1070,14 +1092,23 @@ argument can be an empty string. For example:

    Where and when the abbreviation is used in place of the full title is controlled by the stylesheet when the XML is processed. -

    -These three macros use the stack to ensure that each chapter, section, and -subsection is terminated at the correct point. For example, starting a new -section automatically terminates an open subsection and a previous section. -

    The macros .preface, .appendix, and .colophon operate in the same +

    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”. -

    The url macro generates URL references, and is intended to be called inline +

    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. +

    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: @@ -1092,7 +1123,7 @@ 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. -

    The .ilist macro marks the start of an itemized list, the items of which +

    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 @@ -1111,7 +1142,7 @@ For example: .endlist

    There may be more than one paragraph in an item. -

    The .olist macro marks the start of an ordered list, the items of which are +

    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:

    @@ -1132,7 +1163,7 @@ For example: .endlist

    There may be more than one paragraph in an item. -

    A variable list is one in which each entry is composed of a set of one or more +

    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 @@ -1150,12 +1181,12 @@ This is followed by the body of the entry. The list is terminated by the .endlist

    As for the other lists, there may be more than one paragraph in an item. -

    Lists may be nested as required. Some DocBook processors automatically choose +

    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. -

    In displayed text each non-directive input line generates one output line. The +

    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. @@ -1186,10 +1217,10 @@ monospaced font. For example:

    As the examples illustrate, both kinds of display are terminated by the .endd macro. -

    The macro pair .blockquote and .endblockquote are used to wrap the +

    The macro pair .blockquote and .endblockquote are used to wrap the lines between them in a <blockquote> element. -

    Two macros are provided to simplify setting and unsetting the “changed” -revision marking (see section 3.16). When the revised text is +

    Two macros are provided to simplify setting and unsetting the “changed” +revision marking (see section 3.16). 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:

    @@ -1239,7 +1270,7 @@ 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.
    -

    The .itable macro starts an informal (untitled) table with some basic +

    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. @@ -1287,7 +1318,7 @@ The .row macro does not set the new macro within an entry to generate a <phrase> element with revisionflag set. -

    The .table macro starts a formal table, that is, a table that has a title, +

    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 @@ -1298,22 +1329,22 @@ For example: .row "cell 11" "cell 12" .row "cell 21" "cell 22" .endtable -

    A figure is enclosed between .figure and .endfigure macros. The first +

    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 +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. +is set.

    • The second argument specifies a scaling factor for the image, as a percentage. Thus, a value of 50 reduces the image to half size.

    • The third argument specifies an alignment for the image. It must be one of -left (default), right or center (or even centre if the +left (default), right or center (or even centre if the DocBook processor you are using can handle it).

    • The fourth and fifth arguments specify the depth and width, respectively. How @@ -1331,7 +1362,7 @@ Here is another example, where the figure is reduced to 80% and centred: .figure "A reduced figure" .image figure02.eps 80 center .endfigure -

    Footnotes can be specified between .footnote and .endnote macros. +

    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: @@ -1349,7 +1380,7 @@ The correct markup for this example is: That's really fast. .endf &'brown'& fox. -

    The .index macro generates <indexterm> elements (index entries) in the +

    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 diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf index caa54eadf..2cda4081a 100644 Binary files a/doc/xfpt.pdf and b/doc/xfpt.pdf differ diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt index e23ac9d67..093ccc330 100644 --- a/doc/xfpt.xfpt +++ b/doc/xfpt.xfpt @@ -13,14 +13,14 @@ The xfpt plain text to XML processor xfpt -06 February 2008 +22 July 2009 Philip Hazel PH -0.0606 February 2008PH -2008University of Cambridge +0.0722 July 2009PH +2009University of Cambridge .literal off @@ -152,9 +152,9 @@ standard macros and flags: .ilist In the default mode, text is processed paragraph by paragraph. .footnote -&new("There is, however, a special case when a paragraph contains one or more +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.") +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, @@ -374,6 +374,7 @@ you from generating invalid XML. For example, DocBook does not allow &``& within &``&, though it does allow &``& within &``&. + .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. @@ -521,9 +522,9 @@ way to revert to the previous definition. 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. &new("If +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.") +called, and thus can be used to include a different file on each occasion. .section "The &*.inliteral*& directive" ID21 @@ -619,7 +620,7 @@ 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 &new("an input line") without a newline at the end. This facility is useful +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. @@ -731,6 +732,20 @@ The &*.book*& macro has no arguments. It generates &``& and pushes &``& onto the stack so that it will be output at the end. +.section "Processing instructions" +XML processing instructions such as &``& 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 &``&. + + .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 @@ -761,10 +776,6 @@ argument can be an empty string. For example: Where and when the abbreviation is used in place of the full title is controlled by the stylesheet when the XML is processed. -These three macros use the stack to ensure that each chapter, section, and -subsection is terminated at the correct point. For example, starting a new -section automatically terminates an open subsection and a previous section. - .section "Prefaces, appendixes, and colophons" ID33 The macros &*.preface*&, &*.appendix*&, and &*.colophon*& operate in the same @@ -772,6 +783,23 @@ 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 &``& 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 &``& element, @@ -1044,16 +1072,16 @@ 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 &``& element containing an &``&. The first argument is the name of the file containing the -image. The remaining arguments are optional; &new("an empty string must be +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.") +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`& &new("(default)"), &`right`& or &`center`& (or even &`centre`& if the +&`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 diff --git a/share/stdmacs b/share/stdmacs index 351d23fd7..967c0c206 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -30,6 +30,13 @@ .literal off .endmacro +.macro endpreface +.literal layout +.pop C +.push C +.literal off +.endmacro + .macro chapter .literal layout .pop C @@ -45,6 +52,13 @@ .literal off .endmacro +.macro endchapter +.literal layout +.pop C +.push C +.literal off +.endmacro + .macro appendix .literal layout .pop C @@ -60,6 +74,13 @@ .literal off .endmacro +.macro endappendix +.literal layout +.pop C +.push C +.literal off +.endmacro + .macro colophon "Colophon" .literal layout .pop C @@ -73,6 +94,13 @@ .literal off .endmacro +.macro endcolophon +.literal layout +.pop C +.push C +.literal off +.endmacro + .macro section .literal layout .pop S @@ -87,6 +115,13 @@ .literal off .endmacro +.macro endsection +.literal layout +.pop S +.push S +.literal off +.endmacro + .macro subsection .literal layout .pop U @@ -101,6 +136,13 @@ .literal off .endmacro +.macro endsubsection +.literal layout +.pop U +.push U +.literal off +.endmacro + . =============== Lists =============== .macro ilist @@ -385,4 +427,12 @@ .literal off .endmacro +. =============== Processing instructions ============= + +.macro pi +.literal layout +&& +.literal off +.endmacro + . End diff --git a/src/globals.c b/src/globals.c index 44297f127..56d5a28fe 100644 --- a/src/globals.c +++ b/src/globals.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2008 */ +/* Copyright (c) University of Cambridge, 2009 */ /* Written by Philip Hazel. */ /* Allocate storage and initialize global variables */ @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.06 06-February-2008"; +uschar *xfpt_version = US "0.07 22-July-2009"; tree_node *entities = NULL; diff --git a/testing/infiles/04 b/testing/infiles/04 new file mode 100644 index 000000000..917b2cac5 --- /dev/null +++ b/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/testing/outfiles/04 b/testing/outfiles/04 new file mode 100644 index 000000000..5712bce99 --- /dev/null +++ b/testing/outfiles/04 @@ -0,0 +1,16 @@ + +A first preface + +This is text in the preface. + + + + + + +A first chapter + +This is text in a chapter + + + diff --git a/testing/runtest b/testing/runtest index 1cd36a638..a125ce798 100755 --- a/testing/runtest +++ b/testing/runtest @@ -3,7 +3,7 @@ # Controlling script for xfpt tests $xfpt = "../src/xfpt -S ../share"; -$cf = (-f "/usr/local/bin/cf")? "cf" : "diff -u"; +$cf = (-f "/usr/local/bin/cf")? "cf" : "diff"; $force_update = 0; $starttest = undef; -- cgit v1.2.1 From 3b938cc30a4c85027a60b6399539722b9ee61c9a Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 8 Jun 2010 14:25:58 +0000 Subject: Imported from /Users/nigel/Work/x/xfpt-0.08.tar.bz2. --- share/stdmacs | 2 +- src/globals.c | 4 ++-- src/read.c | 13 ++++++++----- testing/outfiles/03 | 3 +-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/share/stdmacs b/share/stdmacs index 967c0c206..ce22a05cd 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -422,7 +422,7 @@ .literal layout &&&& && + $=4+ depth="$4"+$=5+ width="$5"+>&&&& &&&&&& .literal off .endmacro diff --git a/src/globals.c b/src/globals.c index 56d5a28fe..2347150a4 100644 --- a/src/globals.c +++ b/src/globals.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2009 */ +/* Copyright (c) University of Cambridge, 2010 */ /* Written by Philip Hazel. */ /* Allocate storage and initialize global variables */ @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.07 22-July-2009"; +uschar *xfpt_version = US "0.08 08-June-2010"; tree_node *entities = NULL; diff --git a/src/read.c b/src/read.c index cd384eeb7..4aa8757fa 100644 --- a/src/read.c +++ b/src/read.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2008 */ +/* Copyright (c) University of Cambridge, 2010 */ /* Written by Philip Hazel. */ /* This module contains code for reading the input. */ @@ -224,7 +224,10 @@ if (popto > 0) } /* Get the next line from the current macro or the current file. We need a loop -for handling the ends of macros and files. */ +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 (;;) { @@ -249,7 +252,6 @@ for (;;) else { - if (istack == NULL) return NULL; if (Ufgets(inbuffer, INBUFFSIZE, istack->file) == NULL) { istackstr *prev = istack->prev; @@ -291,9 +293,10 @@ for (;;) /* 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. */ + repeats. When we reach the end of the stack, we have reached the end of all + the input. */ - from_type_ptr--; + if (--from_type_ptr < 0) return NULL; } return inbuffer; diff --git a/testing/outfiles/03 b/testing/outfiles/03 index 0e3290abf..6c7486f46 100644 --- a/testing/outfiles/03 +++ b/testing/outfiles/03 @@ -5,8 +5,7 @@ box "A"; line; circle "B";

    - - +
    -- cgit v1.2.1 From 20c4d4f6ae517d36419f83f71878b79c786b14d2 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Wed, 9 Jun 2010 13:45:39 +0100 Subject: Added .gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..ef0ad5fd8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +Makefile +config.log +config.status +src/*.o +src/xfpt -- cgit v1.2.1 From ee58cf4b2189248b8580c0562fd933acc010f2ec Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Fri, 18 May 2012 09:15:03 +0100 Subject: Imported from xfpt-0.09.tar.bz2 --- doc/xfpt.html | 267 ++++++++++++++++++++++++++---------------------- doc/xfpt.pdf | Bin 64878 -> 70341 bytes doc/xfpt.xfpt | 35 +++++-- share/stdmacs | 38 +++++-- src/dot.c | 16 ++- src/error.c | 3 +- src/globals.c | 7 +- src/globals.h | 5 +- src/structs.h | 4 +- src/xfpt.c | 29 +++++- testing/infiles/02 | 13 +++ testing/outfiles/02 | 32 ++++++ testing/outfiles/02.err | 13 +++ 13 files changed, 308 insertions(+), 154 deletions(-) diff --git a/doc/xfpt.html b/doc/xfpt.html index b18242810..344416c33 100644 --- a/doc/xfpt.html +++ b/doc/xfpt.html @@ -1,3 +1,4 @@ + The xfpt plain text to XML processor - + -
    +

    - + The xfpt plain text to XML processor

    @@ -69,22 +70,22 @@ Hazel
    +Copyright © 2012 University of Cambridge

    +Revision 0.09 +18 May 2012 @@ -96,8 +97,8 @@ PH

    - -Table of Contents + +Table of Contents

    @@ -388,7 +389,7 @@ directive
    - + 4.2. Processing instructions
    @@ -406,7 +407,7 @@ directive
    - + 4.5. Terminating chapters, etc.
    @@ -492,12 +493,12 @@ directive
    -

    xfpt is a program that reads a marked-up ASCII source file, and converts it into +

    xfpt 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 (http://www.methods.co.nz/asciidoc/), xfpt does not try to produce XML from a document that is also usable as a -freestanding ASCII document. The input for xfpt is very definitely “marked -up”. This makes it less ambiguous for large and/or complicated documents. xfpt +freestanding ASCII document. The input for xfpt is very definitely marked +up. This makes it less ambiguous for large and/or complicated documents. xfpt is also much faster than AsciiDoc because it is written in C and does not rely on pattern matching.

    @@ -536,13 +537,13 @@ Notwithstanding the previous paragraph, xfpt&amp;, &lt;, or &gt;, respectively) is generated. -

    The format of the xfpt command line is: +

    The format of the xfpt command line is:

     xfpt [options] [input source]

    If no input is specified, the standard input is read. There are four options:

    -help

    -This option causes xfpt to output its “usage” message, and exit. +This option causes xfpt to output its usage message, and exit.

    -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 @@ -554,7 +555,7 @@ This option overrides the path to xfpt’ the program. This makes it possible to use or test alternate libraries.

    -v

    This option causes xfpt to output its version number and exit. -

    Here is a very short example of a complete xfpt input file that uses some of the +

    Here is a very short example of a complete xfpt input file that uses some of the standard macros and flags:

      .include stdflags
    @@ -577,11 +578,11 @@ standard macros and flags:
      There are also standard macros for ordered lists, literal
      layout blocks, code blocks, URL references, index entries,
      tables, footnotes, figures, etc.
    -

    xfpt processes non-directive input lines in one of four ways (known as -“modes”): -

    • +

    xfpt processes non-directive input lines in one of four ways (known as +modes): +

    • In the default mode, text is processed paragraph by paragraph. -[1] +[1] 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 @@ -589,24 +590,24 @@ macros (such as .chapter and .literal directive.

      Because xfpt reads a whole paragraph before processing it, error messages -contain the phrase “detected near line nnn”, where the line number is +contain the phrase detected near line nnn, where the line number is typically that of the last line of the paragraph. -

    • -In the “literal layout” mode, text is processed line by line, but is +

    • +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. -

    • -In the “literal text” mode, text is also processed line by line, but no flags +

    • +In the literal text mode, text is also processed line by line, but no flags are recognized. The only modification xfpt 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. -

    • -In the “literal XML” mode, text lines are copied to the output without +

    • +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. @@ -636,7 +637,7 @@ 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. -

    If an input line starts with a dot followed by a space, it is ignored by xfpt. +

    If an input line starts with a dot followed by a space, it is ignored by xfpt. 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 @@ -650,10 +651,10 @@ included within a quoted string by doubling it. Here are some examples: 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. -

    Macros are defined by the .macro directive, which is described in section -3.11. There are two ways of calling a macro. It can be called in the +

    Macros are defined by the .macro directive, which is described in section +3.11. 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”. +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 @@ -685,11 +686,11 @@ 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. -



    [1] +



    [1] 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. -

    Only one flag sequence is built-into the code itself. If an input line ends +

    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 @@ -702,7 +703,7 @@ involve any number of lines. Thus: produces exactly the same output as:

      The quick brown fox.
    -

    If an ampersand is followed by a # character, a number, and a semicolon, it is +

    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: @@ -713,24 +714,24 @@ example: 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: -

    • +

      • The name of an inbuilt xfpt variable. At present, there is only one of these, called xfpt.rev. Its use is described with the .revision directive below. -

      • +

      • The name of a user variable that has been set by the .set directive, also described below. -

      • +

      • 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:

          This is an Ohm sign: &Ohm;.
        -

    If an ampersand is followed by a sequence of alphanumeric characters starting +

    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 1.5 for more details. -

    Any other flag sequences that are needed must be defined by means of the +section 1.5 for more details. +

    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. @@ -767,9 +768,9 @@ though xfpt diagnoses an error for badly you from generating invalid XML. For example, DocBook does not allow <emphasis> within <literal>, though it does allow <literal> within <emphasis>. -

    If an ampersand is not followed by a character sequence in one of the forms +

    If an ampersand is not followed by a character sequence in one of the forms described in the preceding sections, an error occurs. -

    These are the standalone flag sequences that are defined in the stdflags +

    These are the standalone flag sequences that are defined in the stdflags file in the xfpt library:

     &&         becomes  &amp; (ampersand)
    @@ -795,10 +796,10 @@ 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. -

    The directives that are built into the code of xfpt are now described in +

    The directives that are built into the code of xfpt are now described in alphabetical order. You can see more examples of their use in the descriptions -of the standard macros in chapter 4. -

    This directive may appear only within the body of a macro. It must be followed +of the standard macros in chapter 4. +

    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 @@ -824,7 +825,7 @@ are not counted by the .arg directive arguments in a particular macro call.

    The .arg directive may be nested. -

    This directive may appear only within the body of a macro. It may optionally be +

    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 @@ -860,14 +861,14 @@ fifth argument:

    The .eacharg directive may in principle be nested, though this does not seem useful in practice. -

    This directive takes a single string argument. It writes it to the standard +

    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. -

    See the description of .arg above. -

    See the description of .eacharg above. -

    See the description of .inliteral below. -

    This directive is used to define flag sequences. The directive must be followed +

    See the description of .arg above. +

    See the description of .eacharg above. +

    See the description of .inliteral below. +

    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:

    @@ -877,29 +878,29 @@ pair and two strings in quotes. White space separates these items. For example:
     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.
    -

    This directive must be followed by a single string argument that is the path to +

    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 xfpt 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. -

    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 +

    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. -

    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 +

    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 1.3 describes how input lines are processed in +Section 1.3 describes how input lines are processed in the four modes. -

    This directive is used to define macros. It must be followed by a macro name, +

    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 1.5). +processed only when the macro is called (see section 1.5).

    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 @@ -946,7 +947,7 @@ call it, because xfpt looks for built-in 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. -

    This directive must be followed by one of the words “begin” or “end”. It is +

    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 @@ -958,17 +959,18 @@ defined like this: .endmacro

    At the start of a nested sequence, the current mode and paragraph state are -remembered and xfpt then reverts to the default mode and “not in a paragraph”. +remembered and xfpt 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 xfpt reverts to the previous state. -

    This directive must be followed by a single string argument. It is processed +

    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. -

    xfpt keeps a stack of text strings that are manipulated by the .push and +

    xfpt 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. +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 @@ -978,10 +980,16 @@ 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. -

    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, that letter is -associated with the string that is pushed, which consists of the rest of the -line. For example, the .chapter macro contains this line: +

    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:

      .push C &</chapter>&
     

    @@ -990,16 +998,27 @@ Earlier in the macro there is the line: .pop C

    This arrangement ensures that any previous chapter is terminated before -starting a new one, and also when the end of the input is reached. -

    This directive is provided to make it easy to set the revisionflag +starting a new one, and also when the end of the input is reached. The +.ilist macro contains this line: +

    + .push L "&</itemizedlist>&" check
    +

    +Item lists are terminatated by .endlist, which contains: +

    + .pop L
    +

    +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. +

    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 .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 +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 xfpt @@ -1015,13 +1034,13 @@ attributes, until

    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, +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 +For handling the most common case (setting and unsetting changed), the standard macros .new and .wen are provided (see section -4.13). -

    This directive must be followed by a name and a text string. It defines a user +4.13). +

    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: @@ -1032,7 +1051,7 @@ This could be referenced as &version;. If a var 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. -

    A set of simple macros for commonly needed DocBook features is provided in +

    A set of simple macros for commonly needed DocBook features is provided in xfpt’s library. This may be extended as experience with xfpt accumulates. The standard macros assume that the standard flags are defined, so a document that is going to use these features should start with: @@ -1043,7 +1062,7 @@ is going to use these features should start with: 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. -

    There are two macros that should be used only once, at the start of the +

    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:

    @@ -1053,7 +1072,7 @@ file the standard header material for a DocBook XML file, which is:
     

    The .book macro has no arguments. It generates <book> and pushes </book> onto the stack so that it will be output at the end. -

    XML processing instructions such as <?sdop toc_sections="no"?> can, of +

    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 @@ -1064,7 +1083,7 @@ the contents of the instruction, for example: .pi sdop 'toc_sections="yes,yes,no"'

    This generates <?sdop toc_sections="yes,yes,no"?>. -

    Chapters, sections, and subsections are supported by three macros that all +

    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 @@ -1092,10 +1111,10 @@ argument can be an empty string. For example:

    Where and when the abbreviation is used in place of the full title is controlled by the stylesheet when the XML is processed. -

    The macros .preface, .appendix, and .colophon operate in the same +

    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”. -

    The macros for chapters, sections, appendixes, etc. use the stack to ensure +strings Preface and Colophon. +

    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. @@ -1108,7 +1127,7 @@ 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. -

    The url macro generates URL references, and is intended to be called inline +

    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: @@ -1123,13 +1142,13 @@ 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. -

    The .ilist macro marks the start of an itemized list, the items of which +

    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. +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. @@ -1142,7 +1161,7 @@ For example: .endlist

    There may be more than one paragraph in an item. -

    The .olist macro marks the start of an ordered list, the items of which are +

    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:

    @@ -1163,7 +1182,7 @@ For example: .endlist

    There may be more than one paragraph in an item. -

    A variable list is one in which each entry is composed of a set of one or more +

    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 @@ -1181,12 +1200,12 @@ This is followed by the body of the entry. The list is terminated by the .endlist

    As for the other lists, there may be more than one paragraph in an item. -

    Lists may be nested as required. Some DocBook processors automatically choose +

    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. -

    In displayed text each non-directive input line generates one output line. The +

    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. @@ -1217,10 +1236,10 @@ monospaced font. For example:

    As the examples illustrate, both kinds of display are terminated by the .endd macro. -

    The macro pair .blockquote and .endblockquote are used to wrap the +

    The macro pair .blockquote and .endblockquote are used to wrap the lines between them in a <blockquote> element. -

    Two macros are provided to simplify setting and unsetting the “changed” -revision marking (see section 3.16). When the revised text is +

    Two macros are provided to simplify setting and unsetting the changed +revision marking (see section 3.16). 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:

    @@ -1270,23 +1289,23 @@ 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.
    -

    The .itable macro starts an informal (untitled) table with some basic +

    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: -

    1. -The frame requirement for the table, which may be one of the words “all”, -“bottom”, “none” (the default), “sides”, “top”, or “topbot”. -

    2. -The “colsep” value for the table. The default is “0”, meaning no vertical -separator lines between columns. The value “1” requests vertical separator +

      1. +The frame requirement for the table, which may be one of the words all, +bottom, none (the default), sides, top, or topbot. +

      2. +The colsep value for the table. The default is 0, meaning no vertical +separator lines between columns. The value 1 requests vertical separator lines. -

      3. -The “rowsep” value for the table. The default is “0”, meaning no horizontal -lines between rows. The value “1” requests horizontal separator lines. -

      4. +

      5. +The rowsep value for the table. The default is 0, meaning no horizontal +lines between rows. The value 1 requests horizontal separator lines. +

      6. The number of columns.

      These arguments must be followed by two arguments for each column. The first @@ -1295,9 +1314,9 @@ 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”. +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, @@ -1312,13 +1331,13 @@ 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: -

    - -Revision History + +Revision History
    -Revision 0.07 -22 July 2009 PH
    cell 11cell 12
    cell 21cell 22

    +

    cell 11cell 12
    cell 21cell 22

    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. -

    The .table macro starts a formal table, that is, a table that has a title, +

    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 @@ -1329,7 +1348,7 @@ For example: .row "cell 11" "cell 12" .row "cell 21" "cell 22" .endtable -

    A figure is enclosed between .figure and .endfigure macros. The first +

    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.

    @@ -1339,14 +1358,14 @@ cases. It generates a <mediaobject> element c 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. -

    • +

      • The second argument specifies a scaling factor for the image, as a percentage. Thus, a value of 50 reduces the image to half size. -

      • +

      • 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). -

      • +

      • The fourth and fifth arguments specify the depth and width, respectively. How these values are handled depends on the processing software.

      @@ -1362,7 +1381,7 @@ Here is another example, where the figure is reduced to 80% and centred: .figure "A reduced figure" .image figure02.eps 80 center .endfigure -

    Footnotes can be specified between .footnote and .endnote macros. +

    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: @@ -1380,7 +1399,7 @@ The correct markup for this example is: That's really fast. .endf &'brown'& fox. -

    The .index macro generates <indexterm> elements (index entries) in the +

    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 @@ -1390,9 +1409,9 @@ example: .index goose "wild chase" The chasing of wild geese...

    -You can generate “see” and “see also” index entries by using .index-see +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: +macros is the text for the see. For example:

      .index-see "chase" "wild goose"
     

    @@ -1415,7 +1434,7 @@ an ID that ties them together. The second and third arguments of 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 +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 @@ -1431,14 +1450,14 @@ index type. For example: &</indexterm>& .endmacro

    -This defines a .cindex macro for the “concept” index. At the end of the +This defines a .cindex macro for the concept index. At the end of the document you might have:

      .makeindex "Concept index" "concept"
      .makeindex
     

    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 +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.

    diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf index 2cda4081a..5e68b1a7c 100644 Binary files a/doc/xfpt.pdf and b/doc/xfpt.pdf differ diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt index 093ccc330..58bbccd09 100644 --- a/doc/xfpt.xfpt +++ b/doc/xfpt.xfpt @@ -13,14 +13,14 @@ The xfpt plain text to XML processor xfpt -22 July 2009 +18 May 2012 Philip Hazel PH -0.0722 July 2009PH -2009University of Cambridge +0.0918 May 2012PH +2012University of Cambridge .literal off @@ -629,7 +629,8 @@ for example the &*.new*& macro in the standard macros. &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. +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 @@ -643,9 +644,15 @@ 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, that letter is -associated with the string that is pushed, which consists of the rest of the -line. For example, the &*.chapter*& macro contains this 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 && .endd @@ -654,8 +661,18 @@ Earlier in the macro there is the line: .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. - +starting a new one, and also when the end of the input is reached. The +&*.ilist*& macro contains this line: +.code + .push L "&&" 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`& diff --git a/share/stdmacs b/share/stdmacs index ce22a05cd..03f5e572c 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -1,5 +1,17 @@ . 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 @@ -147,7 +159,7 @@ .macro ilist .literal layout -.push L && +.push L "&&" check .push I && && && @@ -156,7 +168,7 @@ .macro olist "arabic" .literal layout -.push L && +.push L "&&" check .push I && && && @@ -179,7 +191,7 @@ .macro vlist .literal layout -.push L && +.push L "&&" check && .arg 1 &&$1&& @@ -203,18 +215,20 @@ .macro display .literal layout +.push D "&&" check && .endmacro .macro code .literal layout +.push D "&&" check && .literal text .endmacro .macro endd .literal layout -&& +.pop D .literal off .endmacro @@ -222,13 +236,14 @@ .macro blockquote .literal layout +.push B "&
    &" check && .literal off .endmacro .macro endblockquote .literal layout -&& +.pop B .literal off .endmacro @@ -236,7 +251,7 @@ .macro itable "none" "0" "0" "2" .literal layout -.push && +.push T "&&" check && && .eacharg 5 @@ -247,7 +262,7 @@ .macro table "title" "ref" "none" "0" "0" "2" .literal layout -.push && +.push T "&&" check && .arg 1 &&$1&& @@ -272,7 +287,7 @@ .literal layout && && -.pop +.pop T .literal off .endmacro @@ -388,19 +403,20 @@ .macro footnote && -.push && +.push F "&&" check .nest begin .endmacro .macro endnote .nest end -.pop +.pop F .endmacro . =============== Figures =============== .macro figure .literal layout +.push G "&&" check && .arg 1 &&$1&& @@ -410,7 +426,7 @@ .macro endfigure .literal layout -&& +.pop G .literal off .endmacro diff --git a/src/dot.c b/src/dot.c index 7b6aabdfd..6bad490bd 100644 --- a/src/dot.c +++ b/src/dot.c @@ -602,7 +602,9 @@ if (ps != NULL) popto = *p; /* 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. +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 @@ -613,7 +615,9 @@ do_push(uschar *p) { int length; int letter = 0; +int check = 0; pushstr *ps; +uschar *macname = NULL; uschar *porig = p; uschar buffer[INBUFFSIZE]; @@ -628,6 +632,14 @@ 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; @@ -636,6 +648,8 @@ if (*p == '"') 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; diff --git a/src/error.c b/src/error.c index 431d797fd..b82eea806 100644 --- a/src/error.c +++ b/src/error.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2008 */ +/* Copyright (c) University of Cambridge, 2012 */ /* Written by Philip Hazel. */ /* Error handling routines */ @@ -25,7 +25,6 @@ static int error_count = 0; static int warning_count = 0; -static BOOL suppress_warnings = FALSE; diff --git a/src/globals.c b/src/globals.c index 2347150a4..2ea12003c 100644 --- a/src/globals.c +++ b/src/globals.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2010 */ +/* Copyright (c) University of Cambridge, 2012 */ /* Written by Philip Hazel. */ /* Allocate storage and initialize global variables */ @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.08 08-June-2010"; +uschar *xfpt_version = US "0.09 16-May-2012"; tree_node *entities = NULL; @@ -21,6 +21,7 @@ int from_type_ptr = 0; uschar *inbuffer = NULL; istackstr *istack = NULL; +istackstr *istackbase = NULL; int literal_state = LITERAL_OFF; @@ -44,4 +45,6 @@ pushstr *pushed = NULL; int return_code = 0; uschar *revision = NULL; +BOOL suppress_warnings = FALSE; + /* End of globals.c */ diff --git a/src/globals.h b/src/globals.h index 84868fc67..50f4850b3 100644 --- a/src/globals.h +++ b/src/globals.h @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2007 */ +/* Copyright (c) University of Cambridge, 2012 */ /* Written by Philip Hazel. */ /* Header file for all the global variables */ @@ -23,6 +23,7 @@ extern int from_type_ptr; extern uschar *inbuffer; extern istackstr *istack; +extern istackstr *istackbase; extern int literal_state; @@ -46,4 +47,6 @@ extern pushstr *pushed; extern int return_code; extern uschar *revision; +extern BOOL suppress_warnings; + /* End of globals.h */ diff --git a/src/structs.h b/src/structs.h index 7298b8ddf..ec2de8ba3 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2012 */ /* Written by Philip Hazel. */ /* This module contains definitions of structures that are used throughout the @@ -34,6 +34,8 @@ typedef struct flagstr { typedef struct pushstr { struct pushstr *next; int letter; + int check; + uschar *macname; uschar string[1]; } pushstr; diff --git a/src/xfpt.c b/src/xfpt.c index bb8a74c99..31c69081f 100644 --- a/src/xfpt.c +++ b/src/xfpt.c @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2008 */ +/* Copyright (c) University of Cambridge, 2012 */ /* Written by Philip Hazel. */ /* This module contains the main program and initialization functions. */ @@ -118,6 +118,7 @@ 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; @@ -127,7 +128,7 @@ parabuffer = misc_malloc(PARABUFFSIZE); /* Set up the first file */ -istack = misc_malloc(sizeof(istackstr)); +istackbase = istack = misc_malloc(sizeof(istackstr)); istack->prev = NULL; istack->linenumber = 0; @@ -221,8 +222,30 @@ while ((p = read_nextline()) != NULL) /* Empty the stack of pushed texts, close the output, and we are done. */ -while (pushed != 0) +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; diff --git a/testing/infiles/02 b/testing/infiles/02 index c4c6e5142..e17267593 100644 --- a/testing/infiles/02 +++ b/testing/infiles/02 @@ -51,3 +51,16 @@ Try &&abcd without semicolon: &abcd and at EOL &abcd .endmacro .a + +Test unterminated things that should give warnings. + +.ilist +.olist +.vlist +.footnote +.display +.code +.blockquote +.table +.itable +.figure diff --git a/testing/outfiles/02 b/testing/outfiles/02 index a2ea745ee..365242f3d 100644 --- a/testing/outfiles/02 +++ b/testing/outfiles/02 @@ -6,3 +6,35 @@ Try &abcd without semicolon: &abcd and at EOL &abcd more + +Test unterminated things that should give warnings. + + + + + + + + + + +
    + + + + + + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/testing/outfiles/02.err b/testing/outfiles/02.err index 835b6c412..67f67990e 100644 --- a/testing/outfiles/02.err +++ b/testing/outfiles/02.err @@ -103,3 +103,16 @@ 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 -- cgit v1.2.1