summaryrefslogtreecommitdiffstats
path: root/contrib/amd/doc
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2007-12-05 15:48:03 +0000
committerobrien <obrien@FreeBSD.org>2007-12-05 15:48:03 +0000
commitea691ecd980d2860f0b39e9e504de4da404806fd (patch)
treefa83b3bb0660890a21b550fa1f334b151bf098f9 /contrib/amd/doc
parentc06a2e613662fc6ce10145b41762be8f8ab22ba4 (diff)
downloadFreeBSD-src-ea691ecd980d2860f0b39e9e504de4da404806fd.zip
FreeBSD-src-ea691ecd980d2860f0b39e9e504de4da404806fd.tar.gz
Virgin import of AMD (am-utils) v6.1.5
Sponsored by: Juniper Networks
Diffstat (limited to 'contrib/amd/doc')
-rw-r--r--contrib/amd/doc/am-utils.texi1762
-rw-r--r--contrib/amd/doc/stamp-vti7
-rw-r--r--contrib/amd/doc/texinfo.tex6327
-rw-r--r--contrib/amd/doc/version.texi7
4 files changed, 4509 insertions, 3594 deletions
diff --git a/contrib/amd/doc/am-utils.texi b/contrib/amd/doc/am-utils.texi
index 65d1af3..1cc46b6 100644
--- a/contrib/amd/doc/am-utils.texi
+++ b/contrib/amd/doc/am-utils.texi
@@ -1,6 +1,6 @@
\input texinfo @c -*-texinfo-*-
@c
-@c Copyright (c) 1997-2004 Erez Zadok
+@c Copyright (c) 1997-2006 Erez Zadok
@c Copyright (c) 1989 Jan-Simon Pendry
@c Copyright (c) 1989 Imperial College of Science, Technology & Medicine
@c Copyright (c) 1989 The Regents of the University of California.
@@ -36,15 +36,15 @@
@c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
@c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
@c
-@c %W% (Berkeley) %G%
@c
-@c $Id: am-utils.texi,v 1.21.2.32 2004/01/21 04:04:58 ib42 Exp $
+@c File: am-utils/doc/am-utils.texi
@c
@setfilename am-utils.info
@include version.texi
@c info directory entry
+@dircategory Administration
@direntry
* Am-utils: (am-utils). The Amd automounter suite of utilities
@end direntry
@@ -60,7 +60,7 @@
(Originally by Jan-Simon Pendry and Nick Williams)
@page
-Copyright @copyright{} 1997-2004 Erez Zadok
+Copyright @copyright{} 1997-2006 Erez Zadok
@*
Copyright @copyright{} 1989 Jan-Simon Pendry
@*
@@ -93,7 +93,7 @@ For version @value{VERSION}, @value{UPDATED}
@*
(Originally by Jan-Simon Pendry and Nick Williams)
-Copyright @copyright{} 1997-2004 Erez Zadok
+Copyright @copyright{} 1997-2006 Erez Zadok
@*
Copyright @copyright{} 1989 Jan-Simon Pendry
@*
@@ -117,12 +117,13 @@ tools within Am-utils.
* License:: Explains the terms and conditions for using
and distributing Am-utils.
* Distrib:: How to get the latest Am-utils distribution.
+* AddInfo:: How to get additional information.
* Intro:: An introduction to Automounting concepts.
* History:: History of am-utils' development.
* Overview:: An overview of Amd.
* Supported Platforms:: Machines and Systems supported by Amd.
-* Mount Maps:: Details of mount maps
-* Amd Command Line Options:: All the Amd command line options explained.
+* Mount Maps:: Details of mount maps.
+* Amd Command Line Options:: All the Amd command line options explained.
* Filesystem Types:: The different mount types supported by Amd.
* Amd Configuration File:: The amd.conf file syntax and meaning.
* Run-time Administration:: How to start, stop and control Amd.
@@ -131,7 +132,7 @@ tools within Am-utils.
* Assorted Tools:: Other tools which come with am-utils.
* Examples:: Some examples showing how Amd might be used.
* Internals:: Implementation details.
-* Acknowledgments & Trademarks:: Legal Notes
+* Acknowledgments & Trademarks:: Legal Notes.
Indexes
* Index:: An item for each concept.
@@ -207,7 +208,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
@c ################################################################
-@node Distrib, Intro, License, Top
+@node Distrib, AddInfo, License, Top
@unnumbered Source Distribution
@cindex Source code distribution
@cindex Obtaining the source code
@@ -236,29 +237,40 @@ Revision 6.0 was made independently by
@email{ezk@@cs.columbia.edu,Erez Zadok} at the Computer Science
Department of @uref{http://www.cs.columbia.edu/,Columbia University},
as part of his
-@uref{http://www.cs.columbia.edu/~ezk/research/tp/thesis_proposal.html,PhD
+@uref{http://www.fsl.cs.sunysb.edu/docs/zadok-thesis-proposal/,PhD
thesis work}. Am-utils (especially version 6.1) continues to be
developed and maintained at the
@uref{http://www.cs.sunysb.edu/,Computer Science Department} of
@uref{http://www.stonybrook.edu/,Stony Brook University}, as a service
to the user community.
+
@xref{History}, for more details.
+@c ################################################################
+@node AddInfo, Intro, Distrib, Top
+@unnumbered Getting Additional Information
+@cindex Getting Additional Information
+
@unnumberedsec Bug Reports
@cindex Bug reports
Before reporting a bug, see if it is a known one in the
-@uref{http://www.am-utils.org/BUGS.txt,bugs} file.
-Send all bug reports to @email{am-utils@@am-utils.org}
-quoting the details of the release and your configuration. These can be
-obtained by running the command @samp{amd -v}. It would greatly help if
-you could provide a reproducible procedure for detecting the bug you are
+@uref{http://www.am-utils.org/docs/am-utils/BUGS.txt,bugs} file.
+
+If you find a problem and hopefully you can reproduce it, please
+describe it in detail and
+@uref{https://bugzilla.filesystems.org/,submit a bug report} via
+@uref{http://www.bugzilla.org/,Bugzilla}. Alternatively, you can send
+your bug report to @email{am-utils@@am-utils.org} quoting the details
+of the release and your configuration. These details can be obtained
+by running the command @samp{amd -v}. It would greatly help if you
+could provide a reproducible procedure for detecting the bug you are
reporting.
Providing working patches is highly encouraged. Every patch
incorporated, however small, will get its author an honorable mention in
-the @uref{http://www.am-utils.org/AUTHORS.txt,authors
+the @uref{http://www.am-utils.org/docs/am-utils/AUTHORS.txt,authors
file}.
@unnumberedsec Mailing Lists
@@ -343,7 +355,7 @@ geared toward Linux users, it is general enough for any Unix
administrator and contains specific sections for non-Linux systems.
@c ################################################################
-@node Intro, History, Distrib, Top
+@node Intro, History, AddInfo, Top
@unnumbered Introduction
@cindex Introduction
@@ -377,7 +389,7 @@ numerous flavors of Unix.
The @i{Amd} package has been without an official maintainer since 1992.
Several people have stepped in to maintain it unofficially. Most
notable were the `upl' (Unofficial Patch Level) releases of @i{Amd},
-created by me (@email{ezk@@cs.columbia.edu,Erez Zadok}), and available from
+created by me (@email{ezk@@cs.sunysb.edu,Erez Zadok}), and available from
@url{ftp://ftp.am-utils.org/pub/amd/}. The last such unofficial
release was `upl102'.
@@ -409,6 +421,15 @@ necessary to remove old or unused features, change various syntax files,
etc. However, great care was taken to ensure the maximum possible
backwards compatibility.
+Am-utils version 6.1 has autofs support for Linux and Solaris 2.5+ as
+@i{the} major new feature, in addition to several other minor new
+features. The autofs support is completely transparent to the
+end-user, aside from the fact that @code{/bin/pwd} now always returns
+the correct amd-ified path. The administrator can easily switch
+between NFS and autofs mounts by changing one parameter in
+@code{amd.conf}. Autofs support and maintenance was developed in
+conjunction with @email{ionut@@badula.org,Ion Badulescu}.
+
@c ################################################################
@node Overview, Supported Platforms, History, Top
@chapter Overview
@@ -426,12 +447,12 @@ is loaded with additional features which have little practical use. At
some point the infrequently used components may be removed to streamline
the production system.
-@c @i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
-@c each member of a list of possible filesystem locations in parallel.
-@c @i{Amd} checks that each cached mapping remains valid. Should a mapping be
-@c lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
-@c selects a replacement should one be available.
-@c
+@i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
+each member of a list of possible filesystem locations one by one.
+@i{Amd} checks that each cached mapping remains valid. Should a mapping be
+lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
+selects a replacement should one be available.
+
@menu
* Fundamentals::
* Filesystems and Volumes::
@@ -635,7 +656,11 @@ Option, -w}) or the @i{amd.conf} parameter @samp{dismount_interval}
value on a per-mount basis (@pxref{opts Option, opts, opts}).
Filesystems can be forcefully timed out using the @i{Amq} command.
-@xref{Run-time Administration}.
+@xref{Run-time Administration}. Note that on new enough systems that
+support forced unmounts, such as Linux, @i{Amd} can try to use the
+@b{umount2}(2) system call to force the unmount, if the regular
+@b{umount}(2) system call failed in a way that indicates that the
+mount point is hung or stale. @xref{forced_unmounts Parameter}.
@node Keep-alives, Non-blocking Operation, Automatic Unmounting, Overview
@comment node-name, next, previous, up
@@ -667,7 +692,8 @@ While the server state is uncertain the requests are re-transmitted at
three second intervals and if no reply is received after four attempts
the server is marked down. If a reply is received the fileserver is
marked up and stays in that state for 30 seconds at which time another
-NFS ping is sent.
+NFS ping is sent. This interval is configurable and can even be
+turned off using the @i{ping} option. @xref{opts Option}.
Once a fileserver is marked down, requests continue to be sent every 30
seconds in order to determine when the fileserver comes back up. During
@@ -738,457 +764,6 @@ machines, as well as 32 bit and 64 bit architectures. Furthermore, when
readily portable to the same Operating System on all platforms on which
it is available.
-The table below lists those platforms supported by the latest release.
-The listing is based on the standard output from GNU's
-@code{config.guess} script. Since significant changes have been made to
-am-utils, not all systems listed here have been verified working for all
-features.
-
-@multitable {Auto-Configured System Name} {Config} {Compile} {Amd} {NFS3} {Shlib} {Hlfsd}
-@c @multitable @columnfractions .5 .1 .1 .1 .1 .1
-
-@item @b{Auto-Configured System Name}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab @b{Config} @tab @b{Compile} @tab @b{Amd} @tab @b{NFS3} @tab @b{Shlib} @tab @b{Hlfsd}
-
-@item @b{alpha-dec-osf2.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab ? @tab no @tab ?
-
-@item @b{alpha-dec-osf4.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{alpha-dec-osf4.0f}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{alpha-dec-osf5.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{alphaev5-unknown-linux-gnu}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{alphaev5-unknown-linux-gnu-rh5.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{alphaev6-dec-osf5.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{hppa1.0-hp-hpux11.00}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab no @tab yes @tab yes
-
-@item @b{hppa1.1-hp-hpux10.10}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no @tab ?
-
-@item @b{hppa1.1-hp-hpux10.20}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab no @tab no @tab ?
-
-@item @b{hppa1.1-hp-hpux11.00}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab UDP @tab yes @tab yes
-
-@item @b{hppa1.1-hp-hpux9.01}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{hppa1.1-hp-hpux9.05}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{hppa1.1-hp-hpux9.07}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{hppa2.0w-hp-hpux11.00}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i386-pc-bsdi2.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no @tab ?
-
-@item @b{i386-pc-bsdi3.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab no @tab ?
-
-@item @b{i386-pc-bsdi3.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab no @tab ?
-
-@item @b{i386-pc-bsdi4.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-pc-bsdi4.0.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-pc-bsdi4.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-pc-linux-rh7.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{i386-pc-solaris2.5.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{i386-pc-solaris2.6}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{i386-pc-solaris2.7}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{i386-unknown-freebsd2.1.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab ? @tab ?
-
-@item @b{i386-unknown-freebsd2.2.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd2.2.6}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd2.2.7}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd2.2.8}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd3.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd4.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd4.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsd5.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsdelf3.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsdelf3.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsdelf3.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsdelf3.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsdelf3.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-freebsdelf4.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.2.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.3.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.3.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.3.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-netbsd1.4.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-openbsd2.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-openbsd2.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-openbsd2.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-openbsd2.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i386-unknown-openbsd2.5}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{i486-ncr-sysv4.3.03}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab ? @tab yes @tab yes @tab ?
-
-@item @b{i486-pc-linux-gnu-rh6.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i486-pc-linux-gnulibc1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i486-pc-linux-gnulibc1-rh4.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i486-pc-linux-gnuoldld}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnu}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnu-rh5.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnu-rh6.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnu-rh6.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnu-rh6.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnulibc1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i586-pc-linux-gnulibc1-rh4.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i686-pc-linux-gnu}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i686-pc-linux-gnu-rh5.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i686-pc-linux-gnu-rh6.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i686-pc-linux-gnu-rh6.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab yes
-
-@item @b{i686-pc-linux-gnulibc}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{i686-pc-linux-gnulibc1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{ia64-hp-hpux11.20}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{ia64-unknown-linux-rh2.1AS}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{ia64-unknown-linux-rh2.1AW}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{ia64-unknown-linux-rh7.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{ia64-unknown-linux-rh7.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{m68k-hp-hpux9.00}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab ? @tab ?
-
-@item @b{m68k-sun-sunos4.1.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no @tab ?
-
-@item @b{m68k-next-nextstep3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no @tab ?
-
-@item @b{mips-dec-ultrix4.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab ? @tab ?
-
-@item @b{mips-sgi-irix5.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab ? @tab ? @tab ? @tab ? @tab ? @tab ?
-
-@item @b{mips-sgi-irix5.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{mips-sgi-irix6.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{mips-sgi-irix6.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{mips-sgi-irix6.5}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{powerpc-ibm-aix4.1.5.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no/broken @tab ?
-
-@item @b{powerpc-ibm-aix4.2.1.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab no/broken @tab ?
-
-@item @b{powerpc-ibm-aix4.3.1.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab ? @tab yes @tab ? @tab ?
-
-@item @b{powerpc-unknown-linux-gnu}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{rs6000-ibm-aix3.2}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab ? @tab ?
-
-@item @b{rs6000-ibm-aix3.2.5}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab ? @tab ?
-
-@item @b{rs6000-ibm-aix4.1.4.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no/broken @tab ?
-
-@item @b{rs6000-ibm-aix4.1.5.0}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab no/broken @tab ?
-
-@item @b{sparc-sun-solaris2.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-sun-solaris2.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-sun-solaris2.5}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@item @b{sparc-sun-solaris2.5.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{sparc-sun-solaris2.6}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{sparc-sun-solaris2.7}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{sparc-sun-solaris2.8}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab yes
-
-@item @b{sparc-sun-sunos4.1.1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-sun-sunos4.1.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-sun-sunos4.1.3C}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-sun-sunos4.1.3_U1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-sun-sunos4.1.4}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-unknown-linux-gnulibc1}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc-unknown-netbsd1.2E}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab ? @tab ? @tab ?
-
-@item @b{sparc-unknown-netbsd1.2G}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab ? @tab ? @tab ?
-
-@item @b{sparc64-unknown-linux-gnu}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab n/a @tab yes @tab ?
-
-@item @b{sparc64-unknown-linux-suse7.3}
-@c {Config} {Compile} {Amd} {NFS V.3} {Shlib} {Hlfsd}
-@tab yes @tab yes @tab yes @tab yes @tab yes @tab ?
-
-@end multitable
-
See the @file{INSTALL} in the distribution for more specific details on
building and/or configuring for some systems.
@@ -1265,8 +840,10 @@ list of map types configured on your machine.
* Password maps::
* Union maps::
* LDAP maps::
+* Executable maps::
@end menu
+@c ----------------------------------------------------------------
@node File maps, ndbm maps, Map Types, Map Types
@comment node-name, next, previous, up
@subsection File maps
@@ -1321,6 +898,7 @@ file maps, or ndbm maps built with the @code{mk-amd-map} program.
When caching is enabled, file maps have a default cache mode of
@code{all} (@pxref{Automount Filesystem}).
+@c ----------------------------------------------------------------
@node ndbm maps, NIS maps, File maps, Map Types
@comment node-name, next, previous, up
@subsection ndbm maps
@@ -1334,8 +912,10 @@ be sharable across machine architectures. The notion of speed generally
only applies to large maps; a small map, less than a single disk block,
is almost certainly better implemented as a file map.
-ndbm maps have a default cache mode of @samp{all} (@pxref{Automount Filesystem}).
+ndbm maps have a default cache mode of @samp{all}
+(@pxref{Automount Filesystem}).
+@c ----------------------------------------------------------------
@node NIS maps, NIS+ maps, ndbm maps, Map Types
@comment node-name, next, previous, up
@subsection NIS maps
@@ -1376,9 +956,10 @@ $(YPTSDIR)/amd.home.time: $(ETCDIR)/amd.home
fi
@end example
-Here @code{$(YPTSDIR)} contains the time stamp files, and @code{$(YPDBDIR)} contains
-the dbm format NIS files.
+Here @code{$(YPTSDIR)} contains the time stamp files, and
+@code{$(YPDBDIR)} contains the dbm format NIS files.
+@c ----------------------------------------------------------------
@node NIS+ maps, Hesiod maps, NIS maps, Map Types
@comment node-name, next, previous, up
@subsection NIS+ maps
@@ -1389,6 +970,7 @@ enabled, have a default cache mode of @samp{inc}.
XXX: FILL IN WITH AN EXAMPLE.
+@c ----------------------------------------------------------------
@node Hesiod maps, Password maps, NIS+ maps, Map Types
@comment node-name, next, previous, up
@subsection Hesiod maps
@@ -1414,6 +996,7 @@ jsp.homes.automount HS TXT "rfs:=/home/charm;rhost:=charm;sublink:=jsp"
njw.homes.automount HS TXT "rfs:=/home/dylan/dk2;rhost:=dylan;sublink:=njw"
@end example
+@c ----------------------------------------------------------------
@node Password maps, Union maps, Hesiod maps, Map Types
@comment node-name, next, previous, up
@subsection Password maps
@@ -1454,13 +1037,14 @@ Similarly, if the password file entry was
/home/cc/sugar/mjh
@end example
-the map entry used by @i{Amd} would be
+the map entry used by @i{Amd} would be
@example
rfs:=/home/sugar;rhost:=sugar.cc;sublink:=jsp
@end example
-@node Union maps, LDAP maps , Password maps, Map Types
+@c ----------------------------------------------------------------
+@node Union maps, LDAP maps, Password maps, Map Types
@comment node-name, next, previous, up
@subsection Union maps
@cindex Union file maps
@@ -1475,7 +1059,8 @@ directories take precedence over earlier ones. The union filesystem
type then uses the map cache to determine the union of the names in all
the directories.
-@node LDAP maps, , Union maps, Map Types
+@c ----------------------------------------------------------------
+@node LDAP maps, Executable maps, Union maps, Map Types
@comment node-name, next, previous, up
@subsection LDAP maps
@cindex LDAP maps
@@ -1515,8 +1100,8 @@ dn: cn=amdmap amd.home[], CUCS
cn : amdmap amd.home[]
objectClass : amdmap
amdmapName : amd.home
-amdmapKey :
-amdmapValue :
+amdmapKey :
+amdmapValue :
dn: cn=amdmap amd.home[zing], CUCS
cn : amdmap amd.home[zing]
@@ -1526,8 +1111,42 @@ amdmapKey : zing
amdmapValue : -rhost:=shekel host==shekel host!=shekel;type:=nfs
@end example
-@c subsection Gdbm
+@c ----------------------------------------------------------------
+@node Executable maps, , LDAP maps, Map Types
+@comment node-name, next, previous, up
+@subsection Executable maps
+@cindex Executable maps
+An executable map is a dynamic map in which the keys and values for
+the maps are generated on the fly by a program or script. The program
+is expected to take a single parameter argument which is the key to
+lookup. If the key is found, the program should print on stdout the
+key-value pair that were found; if the key was not found, nothing
+should be printed out. Below is an sample of such a map script:
+
+@example
+#!/bin/sh
+# executable map example
+case "$1" in
+ "/defaults" )
+ echo "/defaults type:=nfs;rfs:=filer"
+ ;;
+ "a" )
+ echo "a type:=nfs;fs:=/tmp"
+ ;;
+ "b" )
+ echo "b type:=link;fs:=/usr/local"
+ ;;
+ * ) # no match, echo nothing
+ ;;
+esac
+@end example
+
+@xref{exec_map_timeout Parameter}.
+
+@c ----------------------------------------------------------------
+@c subsection Gdbm
+@c ----------------------------------------------------------------
@node Key Lookup, Location Format, Map Types, Mount Maps
@comment node-name, next, previous, up
@section How keys are looked up
@@ -1611,10 +1230,17 @@ White space is only allowed, and is mandatory, where shown with non-terminal
@i{white-space}.
A @dfn{location-selection} is a list of possible volumes with which to
-satisfy the request. @dfn{location-selection}s are separated by the
-@samp{||} operator. The effect of this operator is to prevent use of
+satisfy the request. Each @dfn{location-selection} is tried
+sequentially, until either one succeeds or all fail. This, by the
+way, is different from the historically documented behavior, which
+claimed (falsely, at least for last 3 years) that @i{Amd} would
+attempt to mount all @dfn{location-selection}s in parallel and the
+first one to succeed would be used.
+
+@dfn{location-selection}s are optionally separated by the @samp{||}
+operator. The effect of this operator is to prevent use of
location-selections to its right if any of the location-selections on
-its left were selected whether or not any of them were successfully
+its left were selected, whether or not any of them were successfully
mounted (@pxref{Selectors}).@refill
The location-selection, and singleton @dfn{location-list},
@@ -1798,6 +1424,7 @@ The following selectors are currently implemented.
* netgrpd Selector Function::
* in_network Selector Function::
* true Selector Function::
+* xhost Selector Function::
@end menu
@c ----------------------------------------------------------------
@@ -1811,7 +1438,8 @@ The following selectors are currently implemented.
The machine architecture which was automatically determined at compile
time. The architecture type can be displayed by running the command
-@samp{amd -v}. @xref{Supported Platforms}.@refill
+@samp{amd -v}. You can override this value also using the @code{-A}
+command line option. @xref{Supported Platforms}.@refill
@c ----------------------------------------------------------------
@node autodir Selector Variable, byte Selector Variable, arch Selector Variable, Selectors
@@ -2164,20 +1792,43 @@ Always evaluates to false. @i{ARG} is ignored.
@cindex Mount selector; netgrp
@cindex Selector; netgrp
-If the current host as determined by the value of @code{$@{host@}}
-(e.g., short host name) is a member of the netgroup @i{ARG}, this
-selector evaluates to true. Otherwise it evaluates to false.
+The argument @i{ARG} of this selector is a netgroup name followed
+optionally by a comma and a host name. If the host name is not
+specified, it defaults to @code{$@{host@}}. If the host name (short
+name) is a member of the netgroup, this selector evaluates to
+true. Otherwise it evaluates to false.
For example, suppose you have a netgroup @samp{ppp-hosts}, and for
-reasons of performance, these have a local @file{/home} partition, while
-all other clients on the faster network can access a shared home
-directory. A common map to use for both might look like the following:
+reasons of performance, these have a local @file{/home} partition,
+while all other clients on the faster network can access a shared home
+directory. A common map to use for both might look like the
+following:
@example
home/* netgrp(ppp-hosts);type:=link;fs:=/local/$@{key@} \
!netgrp(ppp-hosts);type:=nfs;rhost:=serv1;rfs:=/remote/$@{key@}
@end example
+A more complex example that takes advantage of the two argument netgrp
+mount selector is given in the following scenario. Suppose one wants
+to mount the local scratch space from a each host under
+@file{scratch/<hostname>} and some hosts have their scratch space in a
+different path than others. Hosts in the netgroup @samp{apple-hosts}
+have their scratch space in the @file{/apple} path, where hosts in the
+netgroup @samp{cherry-hosts} have their scratch space in the
+@file{/cherry} path. For hosts that are neither in the
+@samp{apple-hosts} or @samp{cherry-hosts} netgroups we want to make a
+symlink pointing to nowhere but provide a descriptive error message in
+the link destination:
+
+@example
+scratch/* netgrp(apple-hosts,$@{/key@});type:=nfs;rhost:=$@{/key@};\
+ rfs:="/apple" \
+ netgrp(cherry-hosts,$@{/key@});type:=nfs;rhost:=$@{/key@};\
+ rfs:="/cherry" \
+ type:=link;rfs:="no local partition for $@{/key@}"
+@end example
+
@c ----------------------------------------------------------------
@node netgrpd Selector Function, in_network Selector Function, netgrp Selector Function, Selectors
@comment node-name, next, previous, up
@@ -2188,14 +1839,15 @@ home/* netgrp(ppp-hosts);type:=link;fs:=/local/$@{key@} \
@cindex Mount selector; netgrpd
@cindex Selector; netgrpd
-If the current host as determined by the value of @code{$@{hostd@}} is a
-member of the netgroup @i{ARG}, this selector evaluates to true.
-Otherwise it evaluates to false.
+The argument @i{ARG} of this selector is a netgroup name followed
+optionally by a comma and a host name. If the host name is not
+specified, it defaults to @code{$@{hostd@}}. If the host name
+(fully-qualified name) is a member of the netgroup, this selector
+evaluates to true. Otherwise it evaluates to false.
-The @samp{netgrpd} function uses fully-qualified host names
-(@code{$@{hostd@}}) to match netgroup names, while the @samp{netgrp}
-function (@pxref{netgrp Selector Function}) uses short host names
-(@code{$@{host@}}).
+The @samp{netgrpd} function uses fully-qualified host names to match
+netgroup names, while the @samp{netgrp} function (@pxref{netgrp
+Selector Function}) uses short host names.
@c ----------------------------------------------------------------
@node in_network Selector Function, true Selector Function, netgrpd Selector Function, Selectors
@@ -2210,7 +1862,7 @@ function (@pxref{netgrp Selector Function}) uses short host names
This selector matches against any network name or number with an
optional netmask. First, if the current host has any network interface that is
locally attached to the network specified in @i{ARG} (either via name or
-number), this selector evaluates to true.
+number), this selector evaluates to true.
Second, @samp{in_network} supports a network/netmask syntax such as
@samp{128.59.16.0/255.255.255.0}, @samp{128.59.16.0/24},
@@ -2233,7 +1885,7 @@ opt in_network(foo-net.site.com);rhost:=serv1;rfs:=/opt \
@end example
@c ----------------------------------------------------------------
-@node true Selector Function, , in_network Selector Function, Selectors
+@node true Selector Function, xhost Selector Function, in_network Selector Function, Selectors
@comment node-name, next, previous, up
@subsubsection true Selector Function
@cindex true Selector Function
@@ -2244,6 +1896,22 @@ opt in_network(foo-net.site.com);rhost:=serv1;rfs:=/opt \
Always evaluates to true. @i{ARG} is ignored.
+@c ----------------------------------------------------------------
+@node xhost Selector Function, , true Selector Function, Selectors
+@comment node-name, next, previous, up
+@subsubsection xhost Selector Function
+@cindex xhost Selector Function
+@cindex xhost, boolean mount selector
+@cindex !xhost, boolean mount selector
+@cindex Mount selector; xhost
+@cindex Selector; xhost
+@cindex CNAMEs
+
+This function compares @i{ARG} against the current hostname, similarly
+to the @ref{host Selector Variable}. However, this function will
+also match if @i{ARG} is a CNAME (DNS Canonical Name, or alias) for
+the current host's name.
+
@c ================================================================
@node Map Options, , Selectors, Location Format
@comment node-name, next, previous, up
@@ -2443,6 +2111,13 @@ UID 0, and GID 0. Useful for CD-ROMs formatted as ISO-9660.
@cindex Mount flags; dev
Allow local special devices on this filesystem.
+@item dirmask=@var{n}
+@cindex Mount flags; dirmask
+For PCFS mounts, specify the maximum file permissions for directories
+in the file system. See the @samp{mask} option's description for more
+details. The mask value of @var{n} can be specified in decimal,
+octal, or hexadecimal.
+
@item dumbtimr
@cindex Mount flags; dumbtimr
Turn off the dynamic retransmit timeout estimator. This may be useful
@@ -2462,6 +2137,13 @@ Set ID of filesystem.
Enable generations in ISO-9660 file systems. Generations allow you to
see all versions of a given file.
+@item group=@var{n}
+@cindex Mount flags; group
+For PCFS mounts, set the group of the files in the file system to
+@var{n} (which can either be a group name or a GID number). The
+default group is the group of the directory on which the file system
+is being mounted.
+
@item grpid
@cindex Mount flags; grpid
Use BSD directory group-id semantics.
@@ -2476,6 +2158,20 @@ Allow keyboard interrupts on hard mounts.
@cindex Mount flags; lock
Use the NFS locking protocol (default)
+@item longname
+@cindex Mount Flags; longname
+For PCFS mounts, force Win95 long names.
+
+@item mask=@var{n}
+@cindex Mount flags; mask
+For PCFS mounts, specify the maximum file permissions for files in the
+file system. For example, a mask of 755 specifies that, by default,
+the owner should have read, write, and execute permissions for files,
+but others should only have read and execute permissions. Only the
+nine low-order bits of mask are used. The default mask is taken from
+the directory on which the file system is being mounted. The mask
+value of @var{n} can be specified in decimal, octal, or hexadecimal.
+
@item multi
@cindex Mount flags; multi
Perform multi-component lookup on files.
@@ -2557,6 +2253,10 @@ Don't allow set-uid or set-gid executables on this filesystem.
Strip the extension @samp{;#} from the version string of files recorded
on an ISO-9660 CD-ROM.
+@item nowin95
+@cindex Mount Flags; nowin95
+For PCFS mounts, completely ignore Win95 entries.
+
@item optionstr
@cindex Mount flags; optionstr
Under Solaris 8, provide the kernel a string of options to parse and
@@ -2578,9 +2278,14 @@ Set the NFS port to @var{n}.
@cindex Mount flags; posix
Turn on POSIX static pathconf for mounts.
+@item private
+@cindex Mount flags; private
+Use local locking instead of the NLM protocol, useful for IRIX 6 only.
+
@item proplist
@cindex Mount flags; proplist
-Support property lists (ACLs) for this mount, useful primarily for DU-4.0.
+Support property lists (ACLs) for this mount, useful primarily for Tru64
+UNIX.
@item proto=@var{s}
@cindex Mount flags; proto
@@ -2628,6 +2333,10 @@ NFS/UDP through a gateway or a slow link.
@cindex Mount flags; rw
Allow reads and writes on this filesystem.
+@item shortname
+@cindex Mount Flags; longname
+For PCFS mounts, force old DOS short names only.
+
@item soft
@cindex Mount flags; soft
Give up after @dfn{retrans} retransmissions.
@@ -2657,9 +2366,16 @@ support TCP/IP mounts.
@cindex Mount flags; timeo
The NFS timeout, in tenth-seconds, before a request is retransmitted.
+@item user=@var{n}
+@cindex Mount flags; user
+For PCFS mounts, set the owner of the files in the file system to
+@var{n} (which can either be a user name or a UID number). The
+default owner is the owner of the directory on which the file system
+is being mounted.
+
@item vers=@var{n}
@cindex Mount flags; vers
- Use NFS protocol version number @var{n} (can be 2 or 3).
+Use NFS protocol version number @var{n} (can be 2 or 3).
@item wsize=@var{n}
@cindex Mount flags; wsize
@@ -2686,14 +2402,50 @@ mounting local disks, floppies, and CD-ROMs). See also the related
@cindex Mount flags; ping
The interval, in seconds, between keep-alive pings. When four
consecutive pings have failed the mount point is marked as hung. This
-interval defaults to 30 seconds. If the ping interval is less than zero,
-no pings are sent and the host is assumed to be always
-up. By default, pings are not sent for an NFS/TCP mount.
+interval defaults to 30 seconds; if the ping interval is set to zero,
+@i{Amd} will use the default 30-second interval. If the interval is
+set to -1 (or any other negative value), no pings are sent and the
+host is assumed to be always up, which can cause unmounts to hang See
+the @i{softlookup} option for a better alternative. Turning pings off
+can be useful in NFS-HA (High-Availability) sites where the NFS
+service rarely goes down. Setting the ping value to a large value can
+reduce the amount of NFS_NULL chatter on your network considerably,
+especially in large sites.
+
+Note that if you have multiple @i{Amd} entries using the same file
+server, and each entry sets a different value of N, then each time Amd
+mounts a new entry, the ping value will be re-evaluated (and updated,
+turned off, or turned back on as needed). Finally, note that NFS_NULL
+pings are sent for both UDP and TCP mounts, because even a hung TCP
+mount can cause user processes to hang.
+
+@item public
+@cindex Mount flags; public
+Use WebNFS multi-component lookup on the public file handle instead of
+the mount protocol to obtain NFS file handles, as documented in the
+WebNFS Client Specification, RFC 2054. This means that @i{Amd} will not
+attempt to contact the remote portmapper or remote mountd daemon, and
+will only connect to the well-known NFS port 2049 or the port specified
+with the @i{port} mount option, thus making it easier to use NFS through
+a firewall.
@item retry=@var{n}
@cindex Mount flags; retry=@var{n}
The number of times to retry the mount system call.
+@item softlookup
+@cindex Mount flags; softlookup
+Configures @i{Amd}'s behavior with respect to already-mounted shares from
+NFS fileservers that are unreachable. If softlookup is specified,
+trying to access such a share will result in an error (EIO, which is
+changed from the ENOENT 6.0 used to return). If it is not specified, a
+regular symlink is provided and the access will probably hang
+in the NFS filesystem.
+
+The default behavior depends on whether the mount is 'soft' or 'hard';
+softlookup can be used to change this default. This is changed from 6.0
+which always behaved as if softlookup was specified.
+
@item unmount
@cindex Mount flags; unmount
Configures the mount so that its time-to-live will indeed expire (and
@@ -2706,11 +2458,18 @@ option.
@item utimeout=@var{n}
@cindex Mount flags; utimeout=@var{n}
-The interval, in seconds, by which the mount's
-time-to-live is extended after an unmount attempt
-has failed. In fact the interval is extended before the unmount is
-attempted to avoid thrashing. The default value is 120 seconds (two
-minutes) or as set by the @code{-w} command line option.
+The interval, in seconds, that looked up and mounted map entries are
+cached. After that period of time, @i{Amd} will attempt to unmount
+the entries. If, however, the unmount fails (with EBUSY), then
+@i{Amd} will extend the mount's time-to-live by the @i{utimeout} value
+before the next unmount attempt is made. In fact the interval is
+extended before the unmount is attempted, to avoid thrashing. The
+default value is 120 seconds (two minutes) or as set by the @code{-w}
+command line option.
+
+@item xlatecookie
+@cindex Mount flags; xlatecookie
+Translate directory cookies between 32-long and 64-long lengths.
@end table
@@ -2797,7 +2556,7 @@ forks into the background.
Note: Even if @i{Amd} has been built with @samp{-DDEBUG} (via
@code{configure --enable-debug}), it will still background itself and
disassociate itself from the controlling terminal. To use a debugger it
-is necessary to specify @samp{-D nodaemon} on the command line.
+is necessary to specify @samp{-D daemon} on the command line.
However, even with all of this, mounts and unmounts are performed in the
background, and @i{Amd} will always fork before doing them. Therefore,
debugging what happens closely during un/mounts is more challenging.
@@ -2823,13 +2582,14 @@ exists.
* -w Option:: Wait interval after failed unmount.
* -x Option:: Log options.
* -y Option:: NIS domain.
-* -C-Option:: Cluster name.
-* -D-Option:: Debug flags.
+* -A Option:: Operating system Architecture.
+* -C Option:: Cluster name.
+* -D Option:: Debug flags.
* -F Option:: Amd configuration file.
* -H Option:: Show brief help.
-* -O-Option:: Operating system name.
+* -O Option:: Operating system name.
* -S Option:: Lock executable pages in memory.
-* -T-Option:: Set tag for configuration file.
+* -T Option:: Set tag for configuration file.
@end menu
@c ----------------------------------------------------------------
@@ -3017,7 +2777,7 @@ amd -p > /var/run/amd.pid ...
@end example
This option only has an affect if @i{Amd} is running in daemon mode.
-If @i{Amd} is started with the @code{-D nodaemon} debug flag, this
+If @i{Amd} is started with the @code{-D daemon} debug flag, this
option is ignored.
@c ----------------------------------------------------------------
@@ -3068,9 +2828,9 @@ Built by ezk@@cs.columbia.edu on date Wed Oct 22 15:21:03 EDT 1997.
cpu=sparc (big-endian), arch=sun4, karch=sun4u.
full_os=solaris2.5.1, os=sos5, osver=5.5.1, vendor=sun.
Map support for: root, passwd, union, nisplus, nis, ndbm, file, error.
-AMFS: nfs, link, nfsx, nfsl, host, linkx, program, union, inherit,
+AMFS: nfs, link, nfsx, nfsl, host, linkx, program, union, inherit,
ufs, lofs, hsfs, pcfs, auto, direct, toplvl, error.
-FS: cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, ufs.
+FS: autofs, cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, ufs.
Network 1: wire="mcl-lab-net.cs.columbia.edu" (netnumber=128.59.13).
Network 2: wire="14-net.cs.columbia.edu" (netnumber=128.59.14).
Network 3: wire="old-net.cs.columbia.edu" (netnumber=128.59.16).
@@ -3181,7 +2941,7 @@ If @i{Amd} was built with debugging enabled the @code{debug} option is
automatically enabled regardless of the command line options.
@c ----------------------------------------------------------------
-@node -y Option, -C-Option, -x Option, Amd Command Line Options
+@node -y Option, -A Option, -x Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-y} @var{NIS-domain}
@cindex NIS (YP) domain name
@@ -3196,7 +2956,22 @@ immediately attempts to bind to a server for this domain.
@c is specified, and whenever required in a mount map.
@c ----------------------------------------------------------------
-@node -C-Option, -D-Option, -y Option, Amd Command Line Options
+@node -A Option, -C Option, -y Option, Amd Command Line Options
+@comment node-name, next, previous, up
+@section @code{-A} @var{architecture}
+@cindex Setting the operating system architecture
+
+Specifies the OS architecture of the system.
+The only effect of this option is to set the variable @code{$@{arch@}}.
+
+This option would be used as follows:
+
+@example
+amd -A i386 ...
+@end example
+
+@c ----------------------------------------------------------------
+@node -C Option, -D Option, -A Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-C} @var{cluster-name}
@cindex Cluster names
@@ -3216,7 +2991,7 @@ amd -C `clustername` ...
@end example
@c ----------------------------------------------------------------
-@node -D-Option, -F Option, -C-Option, Amd Command Line Options
+@node -D Option, -F Option, -C Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-D} @var{opts}
@cindex Debug options
@@ -3236,13 +3011,13 @@ can be prefixed with @samp{no} to turn it off.
@table @code
@item all
-all options
+all ``reasonable'' options (currently trace|str|full|mem|info|readdir)
@item amq
-register for amq
+do not register for amq
@item daemon
-enter daemon mode
+do not enter daemon mode
@item fork
-fork server
+do not fork child worker (hlfsd only)
@item full
program trace
@item hrtime
@@ -3253,7 +3028,8 @@ print high resolution time stamps (only if @b{syslog}(3) is not used)
info service specific debugging (hesiod, nis, etc.) In the case of
hesiod maps, turns on the hesiod RES_DEBUG internal debugging option.
@item mem
-trace memory allocations
+trace memory allocations. Needs to be explicitly enabled at compile
+time with --enable-debug=mem.
@item mtab
use local @file{./mtab} file
@item readdir
@@ -3272,7 +3048,7 @@ You may also refer to the program source for a more detailed explanation
of the available options.
@c ----------------------------------------------------------------
-@node -F Option, -H Option, -D-Option, Amd Command Line Options
+@node -F Option, -H Option, -D Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-F} @var{conf-file}
@cindex Amd configuration file; specifying name
@@ -3290,7 +3066,7 @@ options had been processed, regardless of the actual location of this
option on the command line.
@c ----------------------------------------------------------------
-@node -H Option, -O-Option, -F Option, Amd Command Line Options
+@node -H Option, -O Option, -F Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-H}
@cindex Displaying brief help
@@ -3299,7 +3075,7 @@ option on the command line.
Print a brief help and usage string.
@c ----------------------------------------------------------------
-@node -O-Option, -S Option, -H Option, Amd Command Line Options
+@node -O Option, -S Option, -H Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-O} @var{op-sys-name}
@cindex Operating System name
@@ -3312,14 +3088,16 @@ backward compatibility reasons. For example, if the build in name is
older maps which were written with the latter in mind.
@c ----------------------------------------------------------------
-@node -S Option, -T-Option, -O-Option, Amd Command Line Options
+@node -S Option, -T Option, -O Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-S}
@cindex plock; using
+@cindex mlockall; using
@cindex locking executable pages in memory
Do @emph{not} lock the running executable pages of @i{Amd} into memory.
To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
+or @b{mlockall}(2)
call lock the @i{Amd} process into memory. This way there is less
chance the operating system will schedule, page out, and swap the
@i{Amd} process as needed. This tends to improve @i{Amd}'s performance,
@@ -3328,12 +3106,12 @@ it unavailable for other processes). If this behavior is not desired,
use the @code{-S} option.
@c ----------------------------------------------------------------
-@node -T-Option, , -S Option, Amd Command Line Options
+@node -T Option, , -S Option, Amd Command Line Options
@comment node-name, next, previous, up
@section @code{-T} @var{tag}
@cindex Tags for Amd configuration file
@cindex Configuration file; tags
-
+
Specify a tag to use with @file{amd.conf}. All map entries tagged with
@var{tag} will be processed. Map entries that are not tagged are always
processed. Map entries that are tagged with a tag other than @var{tag}
@@ -3431,16 +3209,24 @@ of file handles for remote file systems. The cache entries have a
lifetime of a few minutes.
If a required file handle is not in the cache, @i{Amd} sends a request
-to the remote server to obtain it. @i{Amd} @dfn{does not} wait for
-a response; it notes that one of the locations needs retrying, but
-continues with any remaining locations. When the file handle becomes
-available, and assuming none of the other locations was successfully
-mounted, @i{Amd} will retry the mount. This mechanism allows several
-NFS filesystems to be mounted in parallel.
+to the remote server to obtain it.
+@c @i{Amd} @dfn{does not} wait for
+@c a response; it notes that one of the locations needs retrying, but
+@c continues with any remaining locations. When the file handle becomes
+@c available, and assuming none of the other locations was successfully
+@c mounted, @i{Amd} will retry the mount. This mechanism allows several
+@c NFS filesystems to be mounted in parallel.
@c @footnote{The mechanism
@c is general, however NFS is the only filesystem
@c for which the required hooks have been written.}
-The first one which responds with a valid file handle will be used.
+@c The first one which responds with a valid file handle will be used.
+
+Historically, this documentation has maintained that @i{Amd} will try
+all the locations in parallel and use the first one which responds
+with a valid file handle. This has not been the case for quite some
+time, however. Instead, @i{Amd} will go through each location, one by
+one, and will only skip to the next one if the previous one either
+fails or times out.
@noindent
An NFS entry might be:
@@ -3536,8 +3322,12 @@ The @dfn{nfsx} (@samp{type:=nfsx}) filesystem allows a group of filesystems to b
from a single NFS server. The implementation is layered above the
@samp{nfs} implementation so keep-alives work in the same way.
+@emph{WARNING}: @samp{nfsx} is meant to be a ``last resort'' kind of
+solution. It is racy and poorly supported. The authors @emph{highly}
+recommend that other solutions be considered before relying on it.
+
The options are the same as for the @samp{nfs} filesystem with one
-difference.
+difference for @samp{rfs}, as explained below.
@noindent
The following options should be specified:
@@ -3563,7 +3353,7 @@ pub type:=nfsx;rhost:=gould;\
The first string defines the root of the tree, and is applied as a
prefix to the remaining members of the list which define the individual
filesystems. The first string is @emph{not} used as a filesystem name.
-A parallel operation is used to determine the local mount points to
+A serial operation is used to determine the local mount points to
ensure a consistent layout of a tree of mounts.
Here, the @emph{three} filesystems, @samp{/public},
@@ -3623,6 +3413,11 @@ ez1 type:=efs;dev:=/dev/xd0a
ez2 type:=xfs;dev:=/dev/sd3c
@end example
+The UFS/XFS/EFS filesystems are never timed out by default, i.e. they
+will never be unmounted by @i{Amd}. If automatic unmounting is
+desired, the ``unmount'' option should be added to the mount options
+for the entry.
+
@c ----------------------------------------------------------------
@node Caching Filesystem, CD-ROM Filesystem, Unix Filesystem, Filesystem Types
@comment node-name, next, previous, up
@@ -3662,6 +3457,10 @@ Access to the pathname @file{/import/copt} will follow a symbolic link
to @file{/n/import/copt}. The latter is the mount point for a caching
file system, that caches from @file{/import/opt} to @file{/cache}.
+The cachefs filesystem is never timed out by default, i.e. it will
+never be unmounted by @i{Amd}. If automatic unmounting is desired, the
+``unmount'' option should be added to the mount options for the entry.
+
@b{Caveats}:
@enumerate
@item This file system is currently only implemented for Solaris 2.x!
@@ -3851,7 +3650,7 @@ Remote Virtual Disk (RVD) which has a programmatic interface via the
commands @samp{rvdmount} and @samp{rvdunmount}.
@noindent
-The following options must be specified:
+Both of the following options must be specified:
@table @code
@cindex mount, mount option
@@ -3860,29 +3659,47 @@ The following options must be specified:
the program which will perform the mount.
@cindex unmount, mount option
+@cindex umount, mount option
@cindex Mount option; unmount
+@cindex Mount option; umount
@item unmount
-the program which will perform the unmount.
+@item umount
+the program which will perform the unmount. For convenience, you may
+use either @samp{unmount} or @samp{umount} but not both. If neither
+is defined, @i{Amd} will default to @samp{umount $@{fs@}} (the actual
+unmount program pathname will be automatically determined at the time
+GNU @code{configure} runs.)
@end table
The exit code from these two programs is interpreted as a Unix error
code. As usual, exit code zero indicates success. To execute the
-program @i{Amd} splits the string on whitespace to create an array of
+program, @i{Amd} splits the string on whitespace to create an array of
substrings. Single quotes @samp{'} can be used to quote whitespace
if that is required in an argument. There is no way to escape or change
-the quote character.
+the single quote character.
-To run the program @samp{rvdmount} with a host name and filesystem as
-arguments would be specified by
-@samp{fs:=$@{autodir@}$@{path@};mount:="/etc/rvdmount rvdmount fserver
-$@{fs@}"}.
+To run e.g. the program @samp{rvdmount} with a host name and filesystem as
+arguments, it would be specified by
+@samp{fs:=$@{autodir@}$@{path@};type:=program;mount:="/etc/rvdmount
+rvdmount fserver $@{fs@}";unmount:="/etc/rdvumount rvdumount $@{fs@}"}.
The first element in the array is taken as the pathname of the program
-to execute. The other members of the array form the argument vector to
-be passed to the program, @dfn{including argument zero}. This means
-that the split string must have at least two elements. The program is
-directly executed by @i{Amd}, not via a shell. This means that scripts
-must begin with a @code{#!} interpreter specification.
+to execute. The other members of the array form the argument vector
+to be passed to the program, @dfn{including argument zero}. The array
+is exactly the same as the array passed to the execv() system call
+(man execv for details). The split string must have at least two
+elements. The programs are directly executed by @i{Amd}, not via a
+shell. Therefore, if a script is to be used as a mount/umount
+program, it @dfn{must} begin with a @code{#!} interpreter specification.
+
+Often, this program mount type is used for Samba mounts, where you
+need a double slash in pathnames. However, @i{Amd} normalizes
+sequences of slashes into one slash. Therefore, you must use an
+escaped slash, preceded by an escaped backslash. So to get a double
+slash in the mount command, you need the eight character sequence
+@samp{\\\/\\\/} in your map. For example:
+
+@samp{mount="/sbin/mount mount -r -t smbfs -o-N,-Ihostname \\\/\\\/guest@@venus/mp3"}
If a filesystem type is to be heavily used, it may be worthwhile adding
a new filesystem type into @i{Amd}, but for most uses the program
@@ -3893,6 +3710,10 @@ from the current values used by @i{Amd}. Standard output is a
duplicate of standard error. The value specified with the @code{-l}
command line option has no effect on standard error.
+@i{Amd} guarantees that the mountpoint will be created before calling
+the mount program, and that it will be removed after the umount
+program returns success.
+
@c ----------------------------------------------------------------
@node Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
@comment node-name, next, previous, up
@@ -3970,7 +3791,7 @@ entries. In this case, a list of possible targets can be given and
The @dfn{nfsl} (@samp{type:=nfsl}) filesystem type is a combination of two others:
@samp{link} and @samp{nfs}. If the local host name is equal to the
-value of @code{$@{rhost@}}, or if the target pathname listed in
+value of @code{$@{rhost@}} @emph{and} the target pathname listed in
@code{$@{fs@}} exists, @samp{nfsl} will behave exactly as
@samp{type:=link}, and refer to the target as a symbolic link. If the
local host name is not equal to the value of @code{$@{rhost@}}, or if
@@ -4103,13 +3924,17 @@ we are now stuck with it due to historical accident.
@item pref
alters the name that is looked up in the mount map. If
-@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended to
-the name requested by the kernel @dfn{before} the map is searched.
+@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended
+to the name requested by the kernel @dfn{before} the map is
+searched. The default prefix is the prefix of the parent map (if any)
+with name of the auto node appended to it. That means if you want no
+prefix you must say so in the map: @samp{pref:=null}.
@item opts
Normally, @samp{auto} style maps are not browsable even if you turn on
directory browsability (@pxref{browsable_dirs Parameter}). To enable
-browsing entries in @samp{auto} maps, specify @samp{opts:=browsable} in
+browsing entries in @samp{auto} maps, specify @samp{opts:=browsable}
+or @samp{opts:=fullybrowsable} in
the description of this map.
@end table
@@ -4160,6 +3985,18 @@ servers which export copies of the manual pages. Note that the key
which is looked up is the name of the automount point without the
leading @samp{/}.
+Note that the implementation of the traditional @dfn{direct} filesystem is
+essentially a hack (pretending that the root of an NFS filesystem is a
+symlink) and many modern operating systems get very unhappy about
+it. For example, Linux kernel 2.4+ completely disallows it, and Solaris
+2.8 fails to unmount it when @i{Amd} shuts down. Therefore, the use of
+the traditional @dfn{direct} filesystem is strongly discouraged; it is
+only semi-supported, at best.
+
+The autofs implementations that permit direct mounts are fully
+supported, however. That currently includes all versions of
+Solaris. Linux autofs does NOT support direct mounts at all.
+
@c ----------------------------------------------------------------
@node Union Filesystem, Error Filesystem, Direct Automount Filesystem, Filesystem Types
@comment node-name, next, previous, up
@@ -4358,15 +4195,43 @@ specified only in the global section, it is applicable to all regular map
sections that follow.
@menu
+* autofs_use_lofs Parameter::
* browsable_dirs Parameter::
+* map_defaults Parameter::
* map_options Parameter::
* map_type Parameter::
* mount_type Parameter::
* search_path Parameter::
+* selectors_in_defaults Parameter::
@end menu
@c ----------------------------------------------------------------
-@node browsable_dirs Parameter, map_options Parameter, Common Parameters, Common Parameters
+@node autofs_use_lofs Parameter, browsable_dirs Parameter, Common Parameters, Common Parameters
+@comment node-name, next, previous, up
+@subsection @t{autofs_use_lofs} Parameter
+@cindex autofs_use_lofs Parameter
+
+(type=string, default=@samp{yes}).
+When set to @samp{yes}, @i{Amd}'s autofs code will use lofs-type
+(loopback) mounts for @code{type:=link} mounts, as well as several
+other cases that require local references. This has the advantage
+that @i{Amd} does not use a secondary mount point and users do not see
+external pathnames (the infamous @code{/bin/pwd} problem, where it
+reports a different path than the user chdir'ed into). One of the
+disadvantages of using this option is that the autofs code is
+relatively new and the in-place mounts have not been throughly tested.
+
+If this option is set to @samp{no}, then @i{Amd}'s autofs code will
+use symlinks instead of lofs-type mounts for local references. This
+has the advantage of using simpler (more stable) code, but at the
+expense of negating one of autofs's big advantages: the hiding of
+@i{Amd}'s internal paths. Note that symlinks are not supported in all
+autofs implementations, especially those derived from Solaris Autofs
+v1. Also, on Solaris 2.6 and newer, autofs symlinks are not cached,
+resulting in repeated up-call requests to @i{Amd}.
+
+@c ----------------------------------------------------------------
+@node browsable_dirs Parameter, map_defaults Parameter, autofs_use_lofs Parameter, Common Parameters
@comment node-name, next, previous, up
@subsection @t{browsable_dirs} Parameter
@cindex browsable_dirs Parameter
@@ -4382,8 +4247,23 @@ a command which will attempt to @b{stat}(2) the entries, such as often
done by @samp{ls -l} or @samp{ls -F}, @i{Amd} will attempt to mount
@i{every} entry in that map. This is often called a ``mount storm''.
+Note that mount storms are mostly avoided by using autofs mounts
+(@samp{mount_type = autofs}).
+
+@c ----------------------------------------------------------------
+@node map_defaults Parameter, map_options Parameter, browsable_dirs Parameter, Common Parameters
+@comment node-name, next, previous, up
+@subsection @t{map_defaults} Parameter
+@cindex map_defaults Parameter
+
+(type=string, default to empty). This option sets a string to be used
+as the map's @code{/defaults} entry, overriding any @code{/defaults}
+specified in the map. This allows local users to override a given
+map's defaults without modifying maps globally (which is impossible in
+sites where the maps are managed by a different administrative group).
+
@c ----------------------------------------------------------------
-@node map_options Parameter, map_type Parameter, browsable_dirs Parameter, Common Parameters
+@node map_options Parameter, map_type Parameter, map_defaults Parameter, Common Parameters
@comment node-name, next, previous, up
@subsection @t{map_options} Parameter
@cindex map_options Parameter
@@ -4429,13 +4309,13 @@ union maps
@subsection @t{mount_type} Parameter
@cindex mount_type Parameter
-(type=string, default=@samp{nfs}). All @i{Amd} mount types must be NFS.
+(type=string, default=@samp{nfs}). All @i{Amd} mount types default to NFS.
That is, @i{Amd} is an NFS server on the map mount points, for the local
-host it is running on. If @samp{autofs} is specified, @i{Amd} will log
-an error message and forcibly convert it to NFS.
+host it is running on. If @samp{autofs} is specified, @i{Amd} will be
+an autofs server for those mount points.
@c ----------------------------------------------------------------
-@node search_path Parameter, , mount_type Parameter, Common Parameters
+@node search_path Parameter, selectors_in_defaults Parameter, mount_type Parameter, Common Parameters
@comment node-name, next, previous, up
@subsection @t{search_path} Parameter
@cindex search_path Parameter
@@ -4445,6 +4325,28 @@ an error message and forcibly convert it to NFS.
sites can allow for local map customizations and overrides, and can
distributed maps in several locations as needed.
+@c ----------------------------------------------------------------
+@node selectors_in_defaults Parameter, , search_path Parameter, Common Parameters
+@comment node-name, next, previous, up
+@subsection @t{selectors_in_defaults} Parameter
+@cindex selectors_in_defaults Parameter
+
+(type=boolean, default=@samp{no}). If @samp{yes}, then the
+@samp{/defaults} entry of maps will search for and process any
+selectors before setting defaults for all other keys in that map.
+Useful when you want to set different options for a complete map based
+on some parameters. For example, you may want to better the NFS
+performance over slow slip-based networks as follows:
+
+@example
+/defaults \
+ wire==slip-net;opts:=intr,rsize=1024,wsize=1024 \
+ wire!=slip-net;opts:=intr,rsize=8192,wsize=8192
+@end example
+
+Deprecated form: selectors_on_default.
+
+
@c ================================================================
@node Global Parameters, Regular Map Parameters, Common Parameters, Amd Configuration File
@comment node-name, next, previous, up
@@ -4454,55 +4356,150 @@ distributed maps in several locations as needed.
The following parameters are applicable to the @samp{[global]} section only.
@menu
-* arch Parameter::
+* arch Parameter::
+* auto_attrcache Parameter::
* auto_dir Parameter::
* cache_duration Parameter::
-* cluster Parameter::
+* cluster Parameter::
+* debug_mtab_file Parameter::
* debug_options Parameter::
* dismount_interval Parameter::
+* domain_strip Parameter::
+* exec_map_timeout Parameter::
+* forced_unmounts Parameter::
* full_os Parameter::
* fully_qualified_hosts Parameter::
-* hesiod_base Parameter::
-* karch Parameter::
+* hesiod_base Parameter::
+* karch Parameter::
* ldap_base Parameter::
* ldap_cache_maxmem Parameter::
* ldap_cache_seconds Parameter::
* ldap_hostports Parameter::
+* ldap_proto_version Parameter::
* local_domain Parameter::
+* localhost_address Parameter::
* log_file Parameter::
* log_options Parameter::
+* map_reload_interval Parameter::
+* nfs_allow_any_interface Parameter::
* nfs_allow_insecure_port Parameter::
* nfs_proto Parameter::
* nfs_retransmit_counter Parameter::
+* nfs_retransmit_counter_udp Parameter::
+* nfs_retransmit_counter_tcp Parameter::
+* nfs_retransmit_counter_toplvl Parameter::
* nfs_retry_interval Parameter::
+* nfs_retry_interval_udp Parameter::
+* nfs_retry_interval_tcp Parameter::
+* nfs_retry_interval_toplvl Parameter::
* nfs_vers Parameter::
* nis_domain Parameter::
* normalize_hostnames Parameter::
-* os Parameter::
-* osver Parameter::
+* normalize_slashes Parameter::
+* os Parameter::
+* osver Parameter::
* pid_file Parameter::
-* plock Parameter::
+* plock Parameter::
* portmap_program Parameter::
+* preferred_amq_port Parameter::
* print_pid Parameter::
* print_version Parameter::
* restart_mounts Parameter::
-* selectors_in_defaults Parameter::
* show_statfs_entries Parameter::
+* truncate_log Parameter::
* unmount_on_exit Parameter::
+* use_tcpwrappers Parameter::
* vendor Parameter::
@end menu
@c ----------------------------------------------------------------
-@node arch Parameter, auto_dir Parameter, Global Parameters, Global Parameters
+@node arch Parameter, auto_attrcache Parameter, Global Parameters, Global Parameters
@comment node-name, next, previous, up
@subsection @t{arch} Parameter
@cindex arch Parameter
-(type=string, default to compiled in value). Allows you to override the
-value of the @i{arch} @i{Amd} variable.
+(type=string, default to compiled in value). Same as the @code{-A}
+option to @i{Amd}. Allows you to override the value of the @i{arch}
+@i{Amd} variable.
+
+@c ----------------------------------------------------------------
+@node auto_attrcache Parameter, auto_dir Parameter, arch Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{auto_attrcache} Parameter
+@cindex auto_attrcache Parameter
+
+(type=numeric, default=0). Specify in seconds (or units of 0.1
+seconds, depending on the OS), what is the (kernel-side) NFS attribute
+cache timeout for @i{Amd}'s own automount points. A value of 0 is
+supposed to turn off attribute caching, meaning that @i{Amd} will be
+consulted via a kernel-RPC each time someone stat()'s the mount point
+(which could be abused as a denial-of-service attack).
+
+@emph{WARNING}: @i{Amd} depends on being able to turn off the NFS
+attribute cache of the client OS. If it cannot be turned off, then
+users may get ESTALE errors or symlinks that point to the wrong
+places. This is more likely under heavy use of @i{Amd}, for example
+if your system is experiencing frequent map changes or frequent
+mounts/unmounts. Therefore, under normal circumstances, this
+parameter should remain set to 0, to ensure that the attribute cache
+is indeed off.
+
+Unfortunately, some kernels (e.g., certain BSDs) don't have a way to
+turn off the NFS attribute cache. Setting this parameter to 0 is
+supposed to turn off attribute caching entirely, but unfortunately it
+does not; instead, the attribute cache is set to some internal
+hard-coded default (usually anywhere from 5-30 seconds). If you
+suspect that your OS doesn't have a reliable way of turning off the
+attribute cache, then it is better to set this parameter to the
+smallest possible non-zero value (set @samp{auto_attrcache=1} in your
+@code{amd.conf}). This will not eliminate the problem, but reduce the
+risk window somewhat. The best solutions are (1) to use @i{Amd} in
+Autofs mode, if it's supported in your OS, and (2) talk to your OS
+vendor to support a true @samp{noac} flag. See the
+@uref{http://www.am-utils.org/docs/am-utils/attrcache.txt,README.attrcache}
+document for more details.
+
+If you are able to turn off the attribute cache on your OS, alas,
+@i{Amd}'s performance may degrade (when not using Autofs) because
+every traversal of an automounter-controlled pathname will result in a
+lookup request from the kernel to @i{Amd}. Under heavy loads, for
+example when using recursive tools like @samp{find}, @samp{rdist}, or
+@samp{rsync}, this performance degradation can be noticeable. There
+are two possible solutions that some administrators have chosen to
+improve performance:
+
+@enumerate
+
+@item
+First, you can turn off unmounting using the @samp{nounmount} mount
+option. This will ensure that no @i{Amd} symlink could ever change,
+thereby the kernel's attribute cache and @i{Amd} will always be in
+sync. However, this method will cause the number of mounts to keep
+growing, even if some are no longer in use; this has the disadvantage
+that your system could be more susceptible to hangs if even one of
+those accumulating mounts hangs due to a downed server.
+
+@item
+Second, you can turn on attribute caching carefully by setting a small
+automounter attribute cache value (say, one second), and a relatively
+large dismount interval (say, one hour). (@xref{dismount_interval
+Parameter}.) For example, you can set this in your @code{amd.conf}:
+
+@example
+[global]
+auto_attrcache = 1
+dismount_interval = 3600
+@end example
+
+This has the benefit of using the kernel's attribute cache and thus
+improving performance. The disadvantage with this option is that the
+window of vulnerability is not eliminated entirely: it is only made
+smaller.
+
+@end enumerate
@c ----------------------------------------------------------------
-@node auto_dir Parameter, cache_duration Parameter, arch Parameter, Global Parameters
+@node auto_dir Parameter, cache_duration Parameter, auto_attrcache Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{auto_dir} Parameter
@cindex auto_dir Parameter
@@ -4517,12 +4514,12 @@ sub-directories for its real mount points.
@subsection @t{cache_duration} Parameter
@cindex cache_duration Parameter
-(type=numeric, default=300). Same as the @code{-c} option to
-@i{Amd}. Sets the duration in seconds that looked up map entries remain
-in the cache.
+(type=numeric, default=300). Same as the @code{-c} option to @i{Amd}.
+Sets the duration in seconds that looked-up or mounted map entries
+remain in the cache.
@c ----------------------------------------------------------------
-@node cluster Parameter, debug_options Parameter, cache_duration Parameter, Global Parameters
+@node cluster Parameter, debug_mtab_file Parameter, cache_duration Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{cluster} Parameter
@cindex cluster Parameter
@@ -4530,8 +4527,18 @@ in the cache.
(type=string, default no cluster). Same as the @code{-C} option to
@i{Amd}. Specifies the alternate HP-UX cluster to use.
+@c ----------------------------------------------------------------
+@node debug_mtab_file Parameter, debug_options Parameter, cluster Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{debug_mtab_file} Parameter
+@cindex debug_mtab_file Parameter
+
+(type=string, default="/tmp/mnttab"). Path to mtab file that is used
+by @i{Amd} to store a list of mounted file systems during debug-mtab mode.
+This option only applies to systems that store mtab information on disk.
+
@c ----------------------------------------------------------------
-@node debug_options Parameter, dismount_interval Parameter, cluster Parameter, Global Parameters
+@node debug_options Parameter, dismount_interval Parameter, debug_mtab_file Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{debug_options} Parameter
@cindex debug_options Parameter
@@ -4539,38 +4546,15 @@ in the cache.
(type=string, default no debug options). Same as the @code{-D} option
to @i{Amd}. Specify any debugging options for @i{Amd}. Works only if
am-utils was configured for debugging using the @code{--enable-debug}
-option. The @samp{mem} option, as well as all other options, can be
-turned on via @code{--enable-debug=mem}. Otherwise debugging options
-are ignored. Options are comma delimited, and can be preceded by the
-string @samp{no} to negate their meaning. You can get the list of
-supported debugging and logging options by running @code{amd -H}.
-Possible values are:
-
-@table @samp
-@item all
-all options
-@item amq
-register for amq
-@item daemon
-enter daemon mode
-@item fork
-fork server
-@item full
-program trace
-@item mem
-trace memory allocations
-@item mtab
-use local @file{./mtab} file
-@item str
-debug string munging
-@item test
-full debug but no daemon
-@item trace
-trace RPC protocol and NFS mount arguments
-@end table
+option. The additional @samp{mem} option can be turned on via
+@code{--enable-debug=mem}. Otherwise debugging options are ignored.
+Options are comma delimited, and can be preceded by the string
+@samp{no} to negate their meaning. You can get the list of supported
+debugging and logging options by running @code{amd -H}. Possible
+values those listed for the -D option. @xref{-D Option}.
@c ----------------------------------------------------------------
-@node dismount_interval Parameter, full_os Parameter, debug_options Parameter, Global Parameters
+@node dismount_interval Parameter, domain_strip Parameter, debug_options Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{dismount_interval} Parameter
@cindex dismount_interval Parameter
@@ -4580,7 +4564,70 @@ trace RPC protocol and NFS mount arguments
systems that have exceeded their cached times.
@c ----------------------------------------------------------------
-@node full_os Parameter, fully_qualified_hosts Parameter, dismount_interval Parameter, Global Parameters
+@node domain_strip Parameter, exec_map_timeout Parameter, dismount_interval Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{domain_strip} Parameter
+@cindex domain_strip Parameter
+
+(type=boolean, default=@samp{yes}). If @samp{yes}, then the domain
+name part referred to by @code{$@{rhost@}} is stripped off. This is
+useful to keep logs and smaller. If @samp{no}, then the domain name
+part is left changed. This is useful when using multiple domains with
+the same maps (as you may have hosts whose domain-stripped name is
+identical).
+
+@c ----------------------------------------------------------------
+@node exec_map_timeout Parameter, forced_unmounts Parameter, domain_strip Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{exec_map_timeout} Parameter
+@cindex exec_map_timeout Parameter
+
+(type=numeric, default=10). The timeout in seconds that @i{Amd} will
+wait for an executable map program before an answer is returned from
+that program (or script). This value should be set to as small as
+possible while still allowing normal replies to be returned before the
+timer expires, because during the time that the executable map program
+is queried, @i{Amd} is essentially waiting and is thus not responding
+to any other queries. @xref{Executable maps}.
+
+@c ----------------------------------------------------------------
+@node forced_unmounts Parameter, full_os Parameter, exec_map_timeout Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{forced_unmounts} Parameter
+@cindex forced_unmounts Parameter
+
+(type=boolean, default=@samp{no}).
+Sometimes, mount points are hung due to unrecoverable conditions, such
+as when NFS servers migrate, change their IP address, are down
+permanently, or due to hardware failures, and more. In this case,
+attempting to unmount an existing mount point, or even just to
+@b{stat}(2) it, results in one of three fatal errors: EIO, ESTALE, or
+EBUSY. At that point, @i{Amd} can do little to recover that hung
+point (in fact, the OS cannot automatically recover either). For that
+reason, some OSs support special kinds of forced unmounts, which must
+be used very carefully: they will force an unmount immediately (or
+lazily on Linux), which could result in application data loss.
+However, that may be the only way to recover the entire host (without
+rebooting). Once a hung mount point is forced out, @i{Amd} can then
+re-mount a replacement one (if available), bringing a mostly-hung
+system back to operation and avoiding a potentially costly reboot.
+
+If the @samp{forced_unmounts} option is set to @samp{yes}, and the
+client OS supports forced or lazy unmounts, then @i{Amd} will attempt
+to use them if it gets any of the three serious error conditions
+listed above. Note that @i{Amd} will force the unmount of mount
+points that returned EBUSY only for @samp{type:=toplvl} mounts
+(@pxref{Top-level Filesystem}): that is, @i{Amd}'s own mount points.
+This is useful to recover from a previously hung @i{Amd}, and to
+ensure that an existing @i{Amd} can shutdown cleanly even if some
+processes are keeping its mount points busy (i.e., when a user's shell
+process uses @code{cd} to set its CWD to @i{Amd}'s own mount point).
+
+If this option is set to @samp{no} (the default), then @i{Amd} will
+not attempt this special recovery procedure.
+
+@c ----------------------------------------------------------------
+@node full_os Parameter, fully_qualified_hosts Parameter, forced_unmounts Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{full_os} Parameter
@cindex full_os Parameter
@@ -4656,7 +4703,7 @@ should use to cache LDAP entries.
entries in the cache.
@c ----------------------------------------------------------------
-@node ldap_hostports Parameter, local_domain Parameter, ldap_cache_seconds Parameter, Global Parameters
+@node ldap_hostports Parameter, ldap_proto_version Parameter, ldap_cache_seconds Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{ldap_hostports} Parameter
@cindex ldap_hostports Parameter
@@ -4665,7 +4712,16 @@ entries in the cache.
Specify the LDAP host and port values.
@c ----------------------------------------------------------------
-@node local_domain Parameter, log_file Parameter, ldap_hostports Parameter, Global Parameters
+@node ldap_proto_version Parameter, local_domain Parameter, ldap_hostports Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{ldap_proto_version} Parameter
+@cindex ldap_proto_version Parameter
+
+(type=numeric, default=2). Specify the LDAP protocol version to use.
+With a value of 3 will use LDAPv3 protocol.
+
+@c ----------------------------------------------------------------
+@node local_domain Parameter, localhost_address Parameter, ldap_proto_version Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{local_domain} Parameter
@cindex local_domain Parameter
@@ -4676,7 +4732,20 @@ the domain name is determined from the hostname, by removing the first
component of the fully-qualified host name.
@c ----------------------------------------------------------------
-@node log_file Parameter, log_options Parameter, local_domain Parameter, Global Parameters
+@node localhost_address Parameter, log_file Parameter, local_domain Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{localhost_address} Parameter
+@cindex localhost_address Parameter
+
+(type=string, default to localhost or 127.0.0.1). Specify the name or
+IP address for @i{Amd} to use when connecting the sockets for the
+local NFS server and the RPC server. This defaults to 127.0.0.1 or
+whatever the host reports as its local address. This parameter is
+useful on hosts with multiple addresses where you want to force
+@i{Amd} to connect to a specific address.
+
+@c ----------------------------------------------------------------
+@node log_file Parameter, log_options Parameter, localhost_address Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{log_file} Parameter
@cindex log_file Parameter
@@ -4700,7 +4769,7 @@ is generally a bad idea to use those reserved for other services such as
@samp{kern}, @samp{lpr}, @samp{cron}, etc.
@c ----------------------------------------------------------------
-@node log_options Parameter, nfs_allow_insecure_port Parameter, log_file Parameter, Global Parameters
+@node log_options Parameter, map_reload_interval Parameter, log_file Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{log_options} Parameter
@cindex log_options Parameter
@@ -4737,21 +4806,45 @@ warnings
@end table
@c ----------------------------------------------------------------
-@node nfs_allow_insecure_port Parameter, nfs_proto Parameter, log_options Parameter, Global Parameters
+@node map_reload_interval Parameter, nfs_allow_any_interface Parameter, log_options Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{map_reload_interval} Parameter
+@cindex map_reload_interval Parameter
+
+(type=numeric, default=3600). The number of seconds that @i{Amd} will
+wait before it checks to see if any maps have changed at their source
+(NIS servers, LDAP servers, files, etc.). @i{Amd} will reload only
+those maps that have changed.
+
+@c ----------------------------------------------------------------
+@node nfs_allow_any_interface Parameter, nfs_allow_insecure_port Parameter, map_reload_interval Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_allow_any_interface} Parameter
+@cindex nfs_allow_any_interface Parameter
+
+(type=string, default=@samp{no}). Normally @i{Amd} accepts local NFS
+packets only from 127.0.0.1. If this parameter is set to @samp{yes},
+then @i{amd} will accept local NFS packets from any local interface;
+this is useful on hosts that may have multiple interfaces where the
+system is forced to send all outgoing packets (even those bound to the
+same host) via an address other than 127.0.0.1.
+
+@c ----------------------------------------------------------------
+@node nfs_allow_insecure_port Parameter, nfs_proto Parameter, nfs_allow_any_interface Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{nfs_allow_insecure_port} Parameter
@cindex nfs_allow_insecure_port Parameter
-(type=string, default=@samp{no}). Normally amd will refuse requests
-coming from unprivileged ports (i.e. ports >= 1024 on Unix systems),
+(type=string, default=@samp{no}). Normally @i{Amd} will refuse requests
+coming from unprivileged ports (i.e., ports >= 1024 on Unix systems),
so that only privileged users and the kernel can send NFS requests to
-it. However, some kernels (certain versions of Darwin, MacOS X, and
+it. However, some kernels (certain versions of Darwin, MacOS X, and
Linux) have bugs that cause them to use unprivileged ports in certain
-situations, which causes amd to stop dead in its tracks. This
-parameter allows amd to operate normally even on such systems, at the
-expense of a slight decrease in the security of its operations. If you
-see messages like ``ignoring request from foo:1234, port not
-reserved'' in your amd log, try enabling this parameter and give it
+situations, which causes @i{Amd} to stop dead in its tracks. This
+parameter allows @i{Amd} to operate normally even on such systems, at the
+expense of a slight decrease in the security of its operations. If
+you see messages like ``ignoring request from foo:1234, port not
+reserved'' in your @i{Amd} log, try enabling this parameter and give it
another go.
@c ----------------------------------------------------------------
@@ -4763,13 +4856,14 @@ another go.
(type=string, default to trying version tcp then udp). By default,
@i{Amd} tries @code{tcp} and then @code{udp}. This option forces the
overall NFS protocol used to TCP or UDP. It overrides what is in the
-@i{Amd} maps, and is useful when @i{Amd} is compiled with NFSv3 support
-that may not be stable. With this option you can turn off the complete
-usage of NFSv3 dynamically (without having to recompile @i{Amd}) until
-such time as NFSv3 support is desired again.
+@i{Amd} maps, and is useful when @i{Amd} is compiled with TCP support
+in NFSv2/NFSv3 that may not be stable. With this option you can turn
+off the complete usage of TCP for NFS dynamically (without having to
+recompile @i{Amd}), and use UDP only, until such time as TCP support
+is desired again.
@c ----------------------------------------------------------------
-@node nfs_retransmit_counter Parameter, nfs_retry_interval Parameter, nfs_proto Parameter, Global Parameters
+@node nfs_retransmit_counter Parameter, nfs_retransmit_counter_udp Parameter, nfs_proto Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{nfs_retransmit_counter} Parameter
@cindex nfs_retransmit_counter Parameter
@@ -4777,10 +4871,48 @@ such time as NFSv3 support is desired again.
(type=numeric, default=11). Same as the @i{retransmit} part of the
@code{-t} @i{timeout.retransmit} option to @i{Amd}. Specifies the
number of NFS retransmissions that the kernel will use to communicate
-with @i{Amd}. @xref{-t Option}.
+with @i{Amd} using either UDP or TCP mounts. @xref{-t Option}.
+
+@c ----------------------------------------------------------------
+@node nfs_retransmit_counter_udp Parameter, nfs_retransmit_counter_tcp Parameter, nfs_retransmit_counter Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_retransmit_counter_udp} Parameter
+@cindex nfs_retransmit_counter_udp Parameter
+@cindex nfs_retransmit_counter Parameter
+@cindex UDP
+
+(type=numeric, default=11). Same as the @i{nfs_retransmit_counter}
+parameter, but applied globally only to UDP mounts.
+@xref{nfs_retransmit_counter Parameter}.
+
+@c ----------------------------------------------------------------
+@node nfs_retransmit_counter_tcp Parameter, nfs_retransmit_counter_toplvl Parameter, nfs_retransmit_counter_udp Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_retransmit_counter_tcp} Parameter
+@cindex nfs_retransmit_counter_tcp Parameter
+@cindex nfs_retransmit_counter Parameter
+@cindex TCP
+
+(type=numeric, default=11). Same as the @i{nfs_retransmit_counter}
+parameter, but applied globally only to TCP mounts.
+@xref{nfs_retransmit_counter Parameter}.
+
+@c ----------------------------------------------------------------
+@node nfs_retransmit_counter_toplvl Parameter, nfs_retry_interval Parameter, nfs_retransmit_counter_tcp Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_retransmit_counter_toplvl} Parameter
+@cindex nfs_retransmit_counter_toplvl Parameter
+@cindex nfs_retransmit_counter Parameter
+@cindex UDP
+
+(type=numeric, default=11). Same as the @i{nfs_retransmit_counter}
+parameter, applied only for @i{Amd}'s top-level UDP mounts. On some
+systems it is useful to set this differently than the OS default, so
+as to better tune @i{Amd}'s responsiveness under heavy scheduler
+loads. @xref{nfs_retransmit_counter Parameter}.
@c ----------------------------------------------------------------
-@node nfs_retry_interval Parameter, nfs_vers Parameter, nfs_retransmit_counter Parameter, Global Parameters
+@node nfs_retry_interval Parameter, nfs_retry_interval_udp Parameter, nfs_retransmit_counter_toplvl Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{nfs_retry_interval} Parameter
@cindex nfs_retry_interval Parameter
@@ -4788,7 +4920,7 @@ with @i{Amd}. @xref{-t Option}.
(type=numeric, default=8). Same as the @i{timeout} part of the
@code{-t} @i{timeout.retransmit} option to @i{Amd}. Specifies the NFS
timeout interval, in @emph{tenths} of seconds, between NFS/RPC retries
-(for UDP only). This is the value that the kernel will use to
+(for UDP or TCP). This is the value that the kernel will use to
communicate with @i{Amd}. @xref{-t Option}.
@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
@@ -4798,18 +4930,57 @@ Too long an interval gives poor interactive response; too short an
interval causes excessive retries.
@c ----------------------------------------------------------------
-@node nfs_vers Parameter, nis_domain Parameter, nfs_retry_interval Parameter, Global Parameters
+@node nfs_retry_interval_udp Parameter, nfs_retry_interval_tcp Parameter, nfs_retry_interval Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_retry_interval_udp} Parameter
+@cindex nfs_retry_interval_udp Parameter
+@cindex nfs_retry_interval Parameter
+@cindex UDP
+
+(type=numeric, default=8). Same as the @i{nfs_retry_interval}
+parameter, but applied globally only to UDP mounts.
+@xref{nfs_retry_interval Parameter}.
+
+@c ----------------------------------------------------------------
+@node nfs_retry_interval_tcp Parameter, nfs_retry_interval_toplvl Parameter, nfs_retry_interval_udp Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_retry_interval_tcp} Parameter
+@cindex nfs_retry_interval_tcp Parameter
+@cindex nfs_retry_interval Parameter
+@cindex TCP
+
+(type=numeric, default=8). Same as the @i{nfs_retry_interval}
+parameter, but applied globally only to TCP mounts.
+@xref{nfs_retry_interval Parameter}.
+
+@c ----------------------------------------------------------------
+@node nfs_retry_interval_toplvl Parameter, nfs_vers Parameter, nfs_retry_interval_tcp Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{nfs_retry_interval_toplvl} Parameter
+@cindex nfs_retry_interval_toplvl Parameter
+@cindex nfs_retry_interval Parameter
+@cindex UDP
+
+(type=numeric, default=8). Same as the @i{nfs_retry_interval}
+parameter, applied only for @i{Amd}'s top-level UDP mounts. On some
+systems it is useful to set this differently than the OS default, so
+as to better tune @i{Amd}'s responsiveness under heavy scheduler
+loads. @xref{nfs_retry_interval Parameter}.
+
+@c ----------------------------------------------------------------
+@node nfs_vers Parameter, nis_domain Parameter, nfs_retry_interval_toplvl Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{nfs_vers} Parameter
@cindex nfs_vers Parameter
-(type=numeric, default to trying version 3 then 2). By default, @i{Amd}
-tries version 3 and then version 2. This option forces the overall NFS
-protocol used to version 3 or 2. It overrides what is in the @i{Amd}
-maps, and is useful when @i{Amd} is compiled with NFSv3 support that may not
-be stable. With this option you can turn off the complete usage of
-NFSv3 dynamically (without having to recompile @i{Amd}) until such time as
-NFSv3 support is desired again.
+(type=numeric, default to trying version 3 then 2). By default,
+@i{Amd} tries version 3 and then version 2. This option forces the
+overall NFS protocol used to version 3 or 2. It overrides what is in
+the @i{Amd} maps, and is useful when @i{Amd} is compiled with NFSv3
+support that may not be stable. With this option you can turn off the
+complete usage of NFSv3 dynamically (without having to recompile
+@i{Amd}), and use NFSv2 only, until such time as NFSv3 support is
+desired again.
@c ----------------------------------------------------------------
@node nis_domain Parameter, normalize_hostnames Parameter, nfs_vers Parameter, Global Parameters
@@ -4823,7 +4994,7 @@ which to fetch the NIS maps. The default is the system domain name.
This option is ignored if NIS support is not available.
@c ----------------------------------------------------------------
-@node normalize_hostnames Parameter, os Parameter, nis_domain Parameter, Global Parameters
+@node normalize_hostnames Parameter, normalize_slashes Parameter, nis_domain Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{normalize_hostnames} Parameter
@cindex normalize_hostnames Parameter
@@ -4834,7 +5005,20 @@ relative to the host database before being used. The effect is to
translate aliases into ``official'' names.
@c ----------------------------------------------------------------
-@node os Parameter, osver Parameter, normalize_hostnames Parameter, Global Parameters
+@node normalize_slashes Parameter, os Parameter, normalize_hostnames Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{normalize_slashes} Parameter
+@cindex normalize_slashes Parameter
+
+(type=boolean, default=@samp{yes}). If @samp{yes} then amd will
+condense all multiple @code{/} (slash) characters into one and remove
+all trailing slashes. If @samp{no}, then amd will not touch strings
+that may contain repeated or trailing slashes. The latter is
+sometimes useful with SMB mounts, which often require multiple slash
+characters in pathnames.
+
+@c ----------------------------------------------------------------
+@node os Parameter, osver Parameter, normalize_slashes Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{os} Parameter
@cindex os Parameter
@@ -4884,6 +5068,7 @@ This file is used only if the @samp{print_pid} option is on
(type=boolean, default=@samp{yes}). Same as the @code{-S} option to @i{Amd}.
If @samp{yes}, lock the running executable pages of @i{Amd} into memory.
To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
+or @b{mlockall}(2)
call can lock the @i{Amd} process into memory. This way there is less
chance the operating system will schedule, page out, and swap the
@i{Amd} process as needed. This improves @i{Amd}'s performance, at the
@@ -4891,7 +5076,7 @@ cost of reserving the memory used by the @i{Amd} process (making it
unavailable for other processes).
@c ----------------------------------------------------------------
-@node portmap_program Parameter, print_pid Parameter, plock Parameter, Global Parameters
+@node portmap_program Parameter, preferred_amq_port Parameter, plock Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{portmap_program} Parameter
@cindex portmap_program Parameter
@@ -4907,7 +5092,21 @@ number of an @i{Amd} to contact. In this way, amq can fully control any
number of @i{Amd} processes running on the same host.
@c ----------------------------------------------------------------
-@node print_pid Parameter, print_version Parameter, portmap_program Parameter, Global Parameters
+@node preferred_amq_port Parameter, print_pid Parameter, portmap_program Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{preferred_amq_port} Parameter
+@cindex preferred_amq_port Parameter
+
+(type=numeric, default=0). Specify an alternate Port-mapper RPC port
+number for @i{Amd}'s @i{Amq} service. This is used for both UDP and
+TCP. Setting this value to 0 (or not defining it) will cause @i{Amd}
+to select an arbitrary port number. Setting the @i{Amq} RPC service
+port to a specific number is useful in firewalled or NAT'ed
+environments, where you need to know which port @i{Amd} will listen
+on.
+
+@c ----------------------------------------------------------------
+@node print_pid Parameter, print_version Parameter, preferred_amq_port Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{print_pid} Parameter
@cindex print_pid Parameter
@@ -4927,7 +5126,7 @@ will print its version information string, which includes some
configuration and compilation values.
@c ----------------------------------------------------------------
-@node restart_mounts Parameter, selectors_in_defaults Parameter, print_version Parameter, Global Parameters
+@node restart_mounts Parameter, show_statfs_entries Parameter, print_version Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{restart_mounts} Parameter
@cindex restart_mounts Parameter
@@ -4938,28 +5137,7 @@ systems are currently mounted. Whenever one of these would have been
auto-mounted, @i{Amd} inherits it.
@c ----------------------------------------------------------------
-@node selectors_in_defaults Parameter, show_statfs_entries Parameter, restart_mounts Parameter, Global Parameters
-@comment node-name, next, previous, up
-@subsection @t{selectors_in_defaults} Parameter
-@cindex selectors_in_defaults Parameter
-
-(type=boolean, default=@samp{no}). If @samp{yes}, then the @samp{/defaults} entry of
-maps will search for and process any selectors before setting defaults
-for all other keys in that map. Useful when you want to set different
-options for a complete map based on some parameters. For example, you
-may want to better the NFS performance over slow slip-based networks as
-follows:
-
-@example
-/defaults \
- wire==slip-net;opts:=intr,rsize=1024,wsize=1024 \
- wire!=slip-net;opts:=intr,rsize=8192,wsize=8192
-@end example
-
-Deprecated form: selectors_on_default.
-
-@c ----------------------------------------------------------------
-@node show_statfs_entries Parameter, unmount_on_exit Parameter, selectors_in_defaults Parameter, Global Parameters
+@node show_statfs_entries Parameter, truncate_log Parameter, restart_mounts Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{show_statfs_entries} Parameter
@cindex show_statfs_entries Parameter
@@ -4970,19 +5148,65 @@ browsable will also show the number of entries (keys) they have when
the @b{statfs}(2) system call).
@c ----------------------------------------------------------------
-@node unmount_on_exit Parameter, vendor Parameter, show_statfs_entries Parameter, Global Parameters
+@node truncate_log Parameter, unmount_on_exit Parameter, show_statfs_entries Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{truncate_log} Parameter
+@cindex truncate_log Parameter
+
+(type=boolean), default=@samp{no}). If @samp{yes}, then @i{Amd} will
+truncate the log file (if it's a regular file) on startup. This could
+be useful when conducting extensive testing on @i{Amd} maps (or
+@i{Amd} itself) and you don't want to see log data from a previous run
+in the same file.
+
+@c ----------------------------------------------------------------
+@node unmount_on_exit Parameter, use_tcpwrappers Parameter, truncate_log Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{unmount_on_exit} Parameter
@cindex unmount_on_exit Parameter
-(type=boolean), default=@samp{no}). If @samp{yes}, then @i{Amd} will attempt
+(type=boolean, default=@samp{no}). If @samp{yes}, then @i{Amd} will attempt
to unmount all file systems which it knows about. Normally it leaves
all (esp. NFS) mounted file systems intact. Note that @i{Amd} does not
know about file systems mounted before it starts up, unless the
@samp{restart_mounts} option is used (@pxref{restart_mounts Parameter}).
@c ----------------------------------------------------------------
-@node vendor Parameter, , unmount_on_exit Parameter, Global Parameters
+@node use_tcpwrappers Parameter, vendor Parameter, unmount_on_exit Parameter, Global Parameters
+@comment node-name, next, previous, up
+@subsection @t{use_tcpwrappers} Parameter
+@cindex use_tcpwrappers Parameter
+
+(type=boolean), default=@samp{yes}). If @samp{yes}, then amd will use
+the tcpwrappers (tcpd/librwap) library (if available) to control
+access to @i{Amd} via the @code{/etc/hosts.allow} and
+@code{/etc/hosts.deny} files. @i{Amd} will verify that the host
+running @i{Amq} is authorized to connect. The @code{amd} service name
+must used in the @code{/etc/hosts.allow} and @code{/etc/hosts.deny}
+files. For example, to allow only localhost to connect to @i{Amd},
+add this line to @code{/etc/hosts.allow}:
+
+@example
+amd: localhost
+@end example
+
+and this line to @code{/etc/hosts.deny}:
+
+@example
+amd: ALL
+@end example
+
+Consult the man pages for @b{hosts_access}(5) for more information on using
+the tcpwrappers access-control library.
+
+Note that in particular, you should not configure your @code{hosts.allow}
+file to spawn a command for @i{Amd}: that will cause @i{Amd} to not be able
+to @code{waitpid} on the child process ID of any background un/mount that
+@i{Amd} issued, resulting in a confused @i{Amd} that does not know what
+happened to those background un/mount requests.
+
+@c ----------------------------------------------------------------
+@node vendor Parameter, , use_tcpwrappers Parameter, Global Parameters
@comment node-name, next, previous, up
@subsection @t{vendor} Parameter
@cindex vendor Parameter
@@ -5003,7 +5227,7 @@ The following parameters are applicable only to regular map sections.
@menu
* map_name Parameter::
-* tag Parameter::
+* tag Parameter::
@end menu
@c ----------------------------------------------------------------
@@ -5033,7 +5257,7 @@ command-line option matches that in the map section.
@section amd.conf Examples
@cindex amd.conf examples
-The following is the actual @code{amd.conf} file I use at the
+The following is the actual @code{amd.conf} file I used at the
Computer Science Department of Columbia University.
@example
@@ -5062,20 +5286,20 @@ fully_qualified_hosts = no
# DEFINE AN AMD MOUNT POINT
[ /u ]
map_name = amd.u
-
-[ /proj ]
+
+[ /proj ]
map_name = amd.proj
-
-[ /src ]
+
+[ /src ]
map_name = amd.src
-
-[ /misc ]
+
+[ /misc ]
map_name = amd.misc
-
-[ /import ]
+
+[ /import ]
map_name = amd.import
-
-[ /tftpboot/.amd ]
+
+[ /tftpboot/.amd ]
tag = tftpboot
map_name = amd.tftpboot
@end example
@@ -5207,14 +5431,14 @@ mount point.
* Amq default:: Default command behavior.
* Amq -f option:: Flushing the map cache.
* Amq -h option:: Controlling a non-local host.
-* Amq -H-option:: Print help message.
+* Amq -H option:: Print help message.
* Amq -l option:: Controlling the log file.
* Amq -m option:: Obtaining mount statistics.
* Amq -p option:: Getting Amd's process ID.
-* Amq -P-option:: Contacting alternate Amd processes.
+* Amq -P option:: Contacting alternate Amd processes.
* Amq -s option:: Obtaining global statistics.
* Amq -T option:: Use TCP transport.
-* Amq -U-option:: Use UDP transport.
+* Amq -U option:: Use UDP transport.
* Amq -u option:: Forcing volumes to time out.
* Amq -v option:: Version information.
* Amq -w option:: Print Amd current working directory.
@@ -5310,7 +5534,7 @@ also be synchronized with the map source by using the @samp{sync} option
(@pxref{Automount Filesystem}).@refill
@c ----------------------------------------------------------------
-@node Amq -h option, Amq -H-option, Amq -f option, Controlling Amd
+@node Amq -h option, Amq -H option, Amq -f option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-h} option
@cindex Querying an alternate host
@@ -5321,7 +5545,7 @@ be running. To query @i{Amd} on another host the @code{-h} option should
be used.
@c ----------------------------------------------------------------
-@node Amq -H-option, Amq -l option, Amq -h option, Controlling Amd
+@node Amq -H option, Amq -l option, Amq -h option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-H} option
@cindex Displaying brief help
@@ -5330,7 +5554,7 @@ be used.
Print a brief help and usage string.
@c ----------------------------------------------------------------
-@node Amq -l option, Amq -m option, Amq -H-option, Controlling Amd
+@node Amq -l option, Amq -m option, Amq -H option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-l} option
@cindex Resetting the Amd log file
@@ -5403,7 +5627,7 @@ filesystem mount list.
@end ignore
@c ----------------------------------------------------------------
-@node Amq -p option, Amq -P-option, Amq -m option, Controlling Amd
+@node Amq -p option, Amq -P option, Amq -m option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-p} option
@cindex Process ID; Amd
@@ -5417,7 +5641,7 @@ rather not have to search through the process table. This option is
used in the @file{ctl-amd} script.
@c ----------------------------------------------------------------
-@node Amq -P-option, Amq -s option, Amq -p option, Controlling Amd
+@node Amq -P option, Amq -s option, Amq -p option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-P} option
@cindex Multiple Amd processes
@@ -5440,7 +5664,7 @@ kill `amq -p -P 300020`
@end example
@c ----------------------------------------------------------------
-@node Amq -s option, Amq -T option, Amq -P-option, Controlling Amd
+@node Amq -s option, Amq -T option, Amq -P option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-s} option
@cindex Global statistics
@@ -5477,7 +5701,7 @@ should be increased.
@end table
@c ----------------------------------------------------------------
-@node Amq -T option, Amq -U-option, Amq -s option, Controlling Amd
+@node Amq -T option, Amq -U option, Amq -s option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-T} option
@cindex Forcing Amq to use a TCP transport
@@ -5488,7 +5712,7 @@ transport only (connection oriented). Normally, @i{Amq} will use TCP
first, and if that failed, will try UDP.
@c ----------------------------------------------------------------
-@node Amq -U-option, Amq -u option, Amq -T option, Controlling Amd
+@node Amq -U option, Amq -u option, Amq -T option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-U} option
@cindex Forcing Amq to use a UDP transport
@@ -5499,7 +5723,7 @@ transport only (connectionless). Normally, @i{Amq} will use TCP first,
and if that failed, will try UDP.
@c ----------------------------------------------------------------
-@node Amq -u option, Amq -v option, Amq -U-option, Controlling Amd
+@node Amq -u option, Amq -v option, Amq -U option, Controlling Amd
@comment node-name, next, previous, up
@subsection @i{Amq} @code{-u} option
@cindex Forcing filesystem to time out
@@ -5566,7 +5790,7 @@ fsinfo.
* Using FSinfo:: Basic concepts.
* FSinfo Grammar:: Language syntax, semantics and examples.
* FSinfo host definitions:: Defining a new host.
-* FSinfo host attributes:: Definable host attributes.
+* FSinfo host attributes:: Definable host attributes.
* FSinfo filesystems:: Defining locally attached filesystems.
* FSinfo static mounts:: Defining additional static mounts.
* FSinfo automount definitions::
@@ -5587,7 +5811,7 @@ The purpose of @i{FSinfo} is to generate all the important standard
filesystem data files from a single set of input data. Starting with a
single data source guarantees that all the generated files are
self-consistent. One of the possible output data formats is a set of
-@i{Amd} maps which can be used amongst the set of hosts described in the
+@i{Amd} maps which can be used among the set of hosts described in the
input data.
@i{FSinfo} implements a declarative language. This language is
@@ -5768,14 +5992,14 @@ host @{
The options that can be given as host attributes are shown below.
@menu
-* netif Option: FSinfo host netif:
-* config Option: FSinfo host config:
-* arch Option: FSinfo host arch:
-* os Option: FSinfo host os:
-* cluster Option: FSinfo host cluster:
+* FSinfo netif Option:: FSinfo host netif.
+* FSinfo config Option:: FSinfo host config.
+* FSinfo arch Option:: FSinfo host arch.
+* FSinfo os Option:: FSinfo host os.
+* FSinfo cluster Option:: FSinfo host cluster.
@end menu
-@node FSinfo host netif, FSinfo host config, , FSinfo host attributes
+@node FSinfo netif Option, FSinfo config Option, , FSinfo host attributes
@comment node-name, next, previous, up
@subsection netif Option
@@ -5806,7 +6030,7 @@ netif ie0 @{
netif ec0 @{ @}
@end example
-@node FSinfo host config, FSinfo host arch, FSinfo host netif, FSinfo host attributes
+@node FSinfo config Option, FSinfo arch Option, FSinfo netif Option, FSinfo host attributes
@comment node-name, next, previous, up
@subsection config Option
@cindex FSinfo config host attribute
@@ -5825,7 +6049,7 @@ config "ZEPHYR=true"
This option is currently unsupported.
-@node FSinfo host arch, FSinfo host os, FSinfo host config, FSinfo host attributes
+@node FSinfo arch Option, FSinfo os Option, FSinfo config Option, FSinfo host attributes
@comment node-name, next, previous, up
@subsection arch Option
@cindex FSinfo arch host attribute
@@ -5840,7 +6064,7 @@ arch = hp300
This is intended to be of use when building architecture specific
mountmaps, however, the option is currently unsupported.
-@node FSinfo host os, FSinfo host cluster, FSinfo host arch, FSinfo host attributes
+@node FSinfo os Option, FSinfo cluster Option, FSinfo arch Option, FSinfo host attributes
@comment node-name, next, previous, up
@subsection os Option
@cindex FSinfo os host attribute
@@ -5856,7 +6080,7 @@ This information is used when creating the @file{fstab} files, for
example in choosing which format to use for the @file{fstab} entries
within the file.
-@node FSinfo host cluster, , FSinfo host os, FSinfo host attributes
+@node FSinfo cluster Option, , FSinfo os Option, FSinfo host attributes
@comment node-name, next, previous, up
@subsection cluster Option
@cindex FSinfo cluster host attribute
@@ -5967,16 +6191,16 @@ fs /dev/dsk/5s0 @{
@end example
@menu
-* fstype Option: FSinfo filesystems fstype:
-* opts Option: FSinfo filesystems opts:
-* passno Option: FSinfo filesystems passno:
-* freq Option: FSinfo filesystems freq:
-* mount Option: FSinfo filesystems mount:
-* dumpset Option: FSinfo filesystems dumpset:
-* log Option: FSinfo filesystems log:
+* FSinfo fstype Option:: FSinfo filesystems fstype.
+* FSinfo opts Option:: FSinfo filesystems opts.
+* FSinfo passno Option:: FSinfo filesystems passno.
+* FSinfo freq Option:: FSinfo filesystems freq.
+* FSinfo mount Option:: FSinfo filesystems mount.
+* FSinfo dumpset Option:: FSinfo filesystems dumpset.
+* FSinfo log Option:: FSinfo filesystems log.
@end menu
-@node FSinfo filesystems fstype, FSinfo filesystems opts, , FSinfo filesystems
+@node FSinfo fstype Option, FSinfo opts Option, , FSinfo filesystems
@comment node-name, next, previous, up
@subsection fstype Option
@cindex FSinfo fstype filesystems option
@@ -6001,7 +6225,7 @@ Example:
fstype = swap
@end example
-@node FSinfo filesystems opts, FSinfo filesystems passno, FSinfo filesystems fstype, FSinfo filesystems
+@node FSinfo opts Option, FSinfo passno Option, FSinfo fstype Option, FSinfo filesystems
@comment node-name, next, previous, up
@subsection opts Option
@cindex FSinfo opts filesystems option
@@ -6014,7 +6238,7 @@ This defines any options that should be given to @b{mount}(8) in the
opts = rw,nosuid,grpid
@end example
-@node FSinfo filesystems passno, FSinfo filesystems freq, FSinfo filesystems opts, FSinfo filesystems
+@node FSinfo passno Option, FSinfo freq Option, FSinfo opts Option, FSinfo filesystems
@comment node-name, next, previous, up
@subsection passno Option
@cindex FSinfo passno filesystems option
@@ -6029,7 +6253,7 @@ Example:
passno = 1
@end example
-@node FSinfo filesystems freq, FSinfo filesystems mount, FSinfo filesystems passno, FSinfo filesystems
+@node FSinfo freq Option, FSinfo mount Option, FSinfo passno Option, FSinfo filesystems
@comment node-name, next, previous, up
@subsection freq Option
@cindex FSinfo freq filesystems option
@@ -6044,7 +6268,7 @@ Example:
freq = 3
@end example
-@node FSinfo filesystems mount, FSinfo filesystems dumpset, FSinfo filesystems freq, FSinfo filesystems
+@node FSinfo mount Option, FSinfo dumpset Option, FSinfo freq Option, FSinfo filesystems
@comment node-name, next, previous, up
@subsection mount Option
@cindex FSinfo mount filesystems option
@@ -6114,7 +6338,7 @@ filesystem.@refill
@end table
-@node FSinfo filesystems dumpset, FSinfo filesystems log, FSinfo filesystems mount, FSinfo filesystems
+@node FSinfo dumpset Option, FSinfo log Option, FSinfo mount Option, FSinfo filesystems
@comment node-name, next, previous, up
@subsection dumpset Option
@cindex FSinfo dumpset filesystems option
@@ -6123,7 +6347,7 @@ filesystem.@refill
This provides support for Imperial College's local file backup tools and
is not documented further here.
-@node FSinfo filesystems log, , FSinfo filesystems dumpset, FSinfo filesystems
+@node FSinfo log Option, , FSinfo dumpset Option, FSinfo filesystems
@comment node-name, next, previous, up
@subsection log Option
@cindex FSinfo log filesystems option
@@ -6619,8 +6843,8 @@ each level.
@item pass number for @var{host}:@var{device} is non-zero
Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
-or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices should not be
-fsck'd. @xref{FSinfo filesystems fstype}.
+or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices
+should not be fsck'd. @xref{FSinfo fstype Option}.
@item sub-directory @var{directory} of @var{directory-tree} starts with '/'
Within the filesystem specification for a host, if an element
@@ -6684,7 +6908,7 @@ from anywhere. It was designed and implemented by
@email{dupuy@@cs.columbia.edu,Alexander Dupuy}, at the
@uref{http://www.cs.columbia.edu/,Computer Science Department} of
@uref{http://www.columbia.edu/,Columbia University}. A
-@uref{http://www.cs.columbia.edu/~ezk/research/hlfsd/hlfsd.html,paper}
+@uref{http://www.fsl.cs.sunysb.edu/docs/hlfsd/hlfsd.html,paper}
on @i{Hlfsd} was presented at the Usenix LISA VII conference in 1993.
@i{Hlfsd} operates by mounting itself as an NFS server for the directory
@@ -6705,8 +6929,8 @@ dump its internal table of user IDs and home directories to the file
@menu
* Introduction to Hlfsd::
-* Background to Mail Delivery::
-* Using Hlfsd::
+* Background to Mail Delivery::
+* Using Hlfsd::
@end menu
@c ================================================================
@@ -7068,9 +7292,9 @@ discussed.
@cindex Hlfsd; using
@menu
-* Controlling Hlfsd::
-* Hlfsd Options::
-* Hlfsd Files::
+* Controlling Hlfsd::
+* Hlfsd Options::
+* Hlfsd Files::
@end menu
@c ----------------------------------------------------------------
@@ -7128,6 +7352,16 @@ mv /var/mail /var/alt_mail
ln -s /mail/home /var/mail
@end example
+@i{Hlfsd} also responds to the following signals:
+
+A @samp{SIGHUP} signal sent to @i{Hlfsd} will force it to reload the
+password map immediately.
+
+A @samp{SIGUSR1} signal sent to @i{Hlfsd} will cause it to dump its
+internal password map to the file @file{/usr/tmp/hlfsd.dump.XXXXXX},
+where @samp{XXXXXX} will be replaced by a random string generated by
+@b{mktemp}(3) or (the more secure) @b{mkstemp}(3).
+
@c ----------------------------------------------------------------
@node Hlfsd Options, Hlfsd Files, Controlling Hlfsd, Using Hlfsd
@comment node-name, next, previous, up
@@ -7221,11 +7455,7 @@ Select from a variety of debugging options. Prefixing an option with
the string @samp{no} reverses the effect of that option. Options are
cumulative. The most useful option is @samp{all}. Since this option is
only used for debugging other options are not documented here. A fuller
-description is available in the program source. A @samp{SIGUSR1} sent
-to @i{Hlfsd} will cause it to dump its internal password map to the file
-@file{/usr/tmp/hlfsd.dump.XXXXXX}, where @samp{XXXXXX} will be replaced
-by a random string generated by @b{mktemp}(3) or (the more secure)
-@b{mkstemp}(3).
+description is available in the program source.
@item -P @var{password-file}
Read the user-name, user-id, and home directory information from the
@@ -7264,6 +7494,12 @@ directory to which @file{home} symbolic link returned by @i{Hlfsd}
points if it is unable to verify the that user's home directory is
accessible.
+@item /usr/tmp/hlfsd.dump.XXXXXX
+file to which @i{Hlfsd} will dump its internal password map when it
+receives the @samp{SIGUSR1} signal. @samp{XXXXXX} will be replaced by
+a random string generated by @b{mktemp}(3) or (the more secure)
+@b{mkstemp}(3).
+
@end table
For discussion on other files used by @i{Hlfsd}, see @xref{lostaltmail}, and
@@ -7279,25 +7515,25 @@ The following are additional utilities and scripts included with
am-utils, and get installed.
@menu
-* am-eject::
-* amd.conf-sample::
-* amd2ldif::
-* amd2sun::
-* automount2amd::
-* ctl-amd::
-* ctl-hlfsd::
-* expn::
-* fix-amd-map::
-* fixmount::
-* fixrmtab::
-* lostaltmail::
+* am-eject::
+* amd.conf-sample::
+* amd2ldif::
+* amd2sun::
+* automount2amd::
+* ctl-amd::
+* ctl-hlfsd::
+* expn::
+* fix-amd-map::
+* fixmount::
+* fixrmtab::
+* lostaltmail::
* lostaltmail.conf-sample::
-* mk-amd-map::
-* pawd::
-* redhat-ctl-amd::
-* wait4amd::
-* wait4amd2die::
-* wire-test::
+* mk-amd-map::
+* pawd::
+* redhat-ctl-amd::
+* wait4amd::
+* wait4amd2die::
+* wire-test::
@end menu
@c ----------------------------------------------------------------
@@ -7315,7 +7551,7 @@ then attempts to eject the removable device.
@section amd.conf-sample
@pindex amd.conf-sample
-A sample @i{Amd} configuration file. @xref{Amd Configuration File}.
+A sample @i{Amd} configuration file. @xref{Amd Configuration File}.
@c ----------------------------------------------------------------
@node amd2ldif, amd2sun, amd.conf-sample, Assorted Tools
@@ -7514,7 +7750,7 @@ an alternate directory. This is useful to continue delivering mail,
even if the user's file system was unavailable, full, or over quota.
But, the mail which gets delivered to the alternate directory needs to
be resent to its respective users. This is what the @samp{lostaltmail}
-script does.
+script does.
Use it as follows:
@@ -8295,7 +8531,7 @@ The mount daemon refused to return a file handle for the requested filesystem.
The mount daemon gave some other error for the requested filesystem.
@item Finishing with status @i{exit-status}
-@i{Amd} is about to exit with the given exit status.
+@i{Amd} is about to exit with the given exit status.
@item Re-synchronizing cache for map @t{$@{@i{map}@}}
The named map has been modified and the internal cache is being re-synchronized.
@@ -8349,7 +8585,7 @@ Many thanks to the @email{am-utils@@am-utils.org,Am-Utils Users}
mailing list through the months developing am-utils. These members
have contributed to the discussions, ideas, code and documentation,
and subjected their systems to alpha quality code. Special thanks go
-to those @uref{http://www.am-utils.org/AUTHORS.txt,authors} who have
+to those @uref{http://www.am-utils.org/docs/am-utils/AUTHORS.txt,authors} who have
submitted patches, and especially to the maintainers:
@itemize @bullet
@@ -8444,3 +8680,7 @@ All other registered trademarks are owned by their respective owners.
@c LocalWords: freebsdelf gnuoldld ifhtml defperm nodefperm norrip RRIP rrip
@c LocalWords: noversion attr XXXXXX netgrpd rh mkstemp uid gid noexec mntfs
@c LocalWords: nomnttab optionstr hrtime xdrtrace getpwd proplist redhat ctl
+@c LocalWords: texinfo texi ib sp cartouche ified xlatecookie dircategory sc
+@c LocalWords: AddInfo suse Novell softlookup ENOENT USB fullybrowsable LDAPv
+@c LocalWords: amy ie xfffffe zebedee andrew diskfull hdmail searchable si
+@c LocalWords: Orth ESTALE
diff --git a/contrib/amd/doc/stamp-vti b/contrib/amd/doc/stamp-vti
index 3705a9f..41b19a3 100644
--- a/contrib/amd/doc/stamp-vti
+++ b/contrib/amd/doc/stamp-vti
@@ -1,3 +1,4 @@
-@set UPDATED 3 July 2001
-@set EDITION 6.0.7
-@set VERSION 6.0.7
+@set UPDATED 20 April 2006
+@set UPDATED-MONTH April 2006
+@set EDITION 6.1.5
+@set VERSION 6.1.5
diff --git a/contrib/amd/doc/texinfo.tex b/contrib/amd/doc/texinfo.tex
index b0a1cfc..e758ced 100644
--- a/contrib/amd/doc/texinfo.tex
+++ b/contrib/amd/doc/texinfo.tex
@@ -3,10 +3,11 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2002-06-04.06}
+\def\texinfoversion{2004-09-06.16}
%
-% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
-% 2000, 01, 02 Free Software Foundation, Inc.
+% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+% Foundation, Inc.
%
% This texinfo.tex file is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
@@ -23,24 +24,17 @@
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
%
-% In other words, you are welcome to use, share and improve this program.
-% You are forbidden to forbid anyone else to use, share and improve
-% what you give them. Help stamp out software-hoarding!
+% As a special exception, when this file is read by TeX when processing
+% a Texinfo source document, you may use the result without
+% restriction. (This has been our intent since Texinfo was invented.)
%
% Please try the latest version of texinfo.tex before submitting bug
% reports; you can get the latest version from:
-% ftp://ftp.gnu.org/gnu/texinfo.tex
-% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
-% ftp://texinfo.org/texinfo/texinfo.tex
+% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
% ftp://tug.org/tex/texinfo.tex
-% (and all CTAN mirrors, see http://www.ctan.org),
-% and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
-%
-% The texinfo.tex in any given Texinfo distribution could well be out
+% (and all CTAN mirrors, see http://www.ctan.org).
+% The texinfo.tex in any given distribution could well be out
% of date, so if that's what you're using, please check.
-%
-% Texinfo has a small home page at http://texinfo.org/ and also
-% http://www.gnu.org/software/texinfo.
%
% Send bug reports to bug-texinfo@gnu.org. Please include including a
% complete document in each bug report with which we can reproduce the
@@ -58,8 +52,12 @@
% Sometimes one run after texindex suffices, and sometimes you need more
% than two; texi2dvi does it as many times as necessary.
%
-% It is possible to adapt texinfo.tex for other languages. You can get
-% the existing language-specific files from the full Texinfo distribution.
+% It is possible to adapt texinfo.tex for other languages, to some
+% extent. You can get the existing language-specific files from the
+% full Texinfo distribution.
+%
+% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
+
\message{Loading texinfo [version \texinfoversion]:}
@@ -69,7 +67,14 @@
\everyjob{\message{[Texinfo version \texinfoversion]}%
\catcode`+=\active \catcode`\_=\active}
-% Save some parts of plain tex whose names we will redefine.
+\message{Basics,}
+\chardef\other=12
+
+% We never want plain's \outer definition of \+ in Texinfo.
+% For @tex, we can use \tabalign.
+\let\+ = \relax
+
+% Save some plain tex macros whose names we will redefine.
\let\ptexb=\b
\let\ptexbullet=\bullet
\let\ptexc=\c
@@ -79,23 +84,34 @@
\let\ptexend=\end
\let\ptexequiv=\equiv
\let\ptexexclam=\!
+\let\ptexfootnote=\footnote
+\let\ptexgtr=>
+\let\ptexhat=^
\let\ptexi=\i
+\let\ptexindent=\indent
+\let\ptexnoindent=\noindent
+\let\ptexinsert=\insert
\let\ptexlbrace=\{
+\let\ptexless=<
+\let\ptexplus=+
\let\ptexrbrace=\}
+\let\ptexslash=\/
\let\ptexstar=\*
\let\ptext=\t
-% We never want plain's outer \+ definition in Texinfo.
-% For @tex, we can use \tabalign.
-\let\+ = \relax
-
-\message{Basics,}
-\chardef\other=12
-
% If this character appears in an error message or help string, it
% starts a new line in the output.
\newlinechar = `^^J
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+ \let\linenumber = \empty % Pre-3.0.
+\else
+ \def\linenumber{l.\the\inputlineno:\space}
+\fi
+
% Set up fixed words for English if not already set.
\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
@@ -134,48 +150,111 @@
\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
-\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
-\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
+
+% In some macros, we cannot use the `\? notation---the left quote is
+% in some cases the escape char.
+\chardef\colonChar = `\:
+\chardef\commaChar = `\,
+\chardef\dotChar = `\.
+\chardef\exclamChar= `\!
+\chardef\questChar = `\?
+\chardef\semiChar = `\;
+\chardef\underChar = `\_
+
+\chardef\spaceChar = `\ %
+\chardef\spacecat = 10
+\def\spaceisspace{\catcode\spaceChar=\spacecat}
% Ignore a token.
%
\def\gobble#1{}
-\hyphenation{ap-pen-dix}
-\hyphenation{mini-buf-fer mini-buf-fers}
-\hyphenation{eshell}
-\hyphenation{white-space}
+% The following is used inside several \edef's.
+\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
+
+% Hyphenation fixes.
+\hyphenation{
+ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
+ ap-pen-dix bit-map bit-maps
+ data-base data-bases eshell fall-ing half-way long-est man-u-script
+ man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
+ par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
+ spell-ing spell-ings
+ stand-alone strong-est time-stamp time-stamps which-ever white-space
+ wide-spread wrap-around
+}
% Margin to add to right of even pages, to left of odd pages.
-\newdimen \bindingoffset
-\newdimen \normaloffset
+\newdimen\bindingoffset
+\newdimen\normaloffset
\newdimen\pagewidth \newdimen\pageheight
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt}
+
+% @| inserts a changebar to the left of the current line. It should
+% surround any changed text. This approach does *not* work if the
+% change spans more than two lines of output. To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change).
+%
+\def\|{%
+ % \vadjust can only be used in horizontal mode.
+ \leavevmode
+ %
+ % Append this vertical mode material after the current line in the output.
+ \vadjust{%
+ % We want to insert a rule with the height and depth of the current
+ % leading; that is exactly what \strutbox is supposed to record.
+ \vskip-\baselineskip
+ %
+ % \vadjust-items are inserted at the left edge of the type. So
+ % the \llap here moves out into the left-hand margin.
+ \llap{%
+ %
+ % For a thicker or thinner bar, change the `1pt'.
+ \vrule height\baselineskip width1pt
+ %
+ % This is the space between the bar and the text.
+ \hskip 12pt
+ }%
+ }%
+}
+
% Sometimes it is convenient to have everything in the transcript file
% and nothing on the terminal. We don't just call \tracingall here,
-% since that produces some useless output on the terminal.
+% since that produces some useless output on the terminal. We also make
+% some effort to order the tracing commands to reduce output in the log
+% file; cf. trace.sty in LaTeX.
%
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
-\ifx\eTeXversion\undefined
-\def\loggingall{\tracingcommands2 \tracingstats2
- \tracingpages1 \tracingoutput1 \tracinglostchars1
- \tracingmacros2 \tracingparagraphs1 \tracingrestores1
- \showboxbreadth\maxdimen\showboxdepth\maxdimen
-}%
-\else
-\def\loggingall{\tracingcommands3 \tracingstats2
- \tracingpages1 \tracingoutput1 \tracinglostchars1
- \tracingmacros2 \tracingparagraphs1 \tracingrestores1
- \tracingscantokens1 \tracingassigns1 \tracingifs1
- \tracinggroups1 \tracingnesting2
- \showboxbreadth\maxdimen\showboxdepth\maxdimen
+\def\loggingall{%
+ \tracingstats2
+ \tracingpages1
+ \tracinglostchars2 % 2 gives us more in etex
+ \tracingparagraphs1
+ \tracingoutput1
+ \tracingmacros2
+ \tracingrestores1
+ \showboxbreadth\maxdimen \showboxdepth\maxdimen
+ \ifx\eTeXversion\undefined\else % etex gives us more logging
+ \tracingscantokens1
+ \tracingifs1
+ \tracinggroups1
+ \tracingnesting2
+ \tracingassigns1
+ \fi
+ \tracingcommands3 % 3 gives us more in etex
+ \errorcontextlines16
}%
-\fi
% add check for \lastpenalty to plain's definitions. If the last thing
% we did was a \nobreak, we don't want to insert more space.
-%
+%
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
\removelastskip\penalty-50\smallskip\fi\fi}
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
@@ -228,7 +307,7 @@
% the page break happens to be in the middle of an example.
\shipout\vbox{%
% Do this early so pdf references go to the beginning of the page.
- \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
+ \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
%
\ifcropmarks \vbox to \outervsize\bgroup
\hsize = \outerhsize
@@ -276,7 +355,7 @@
\egroup % \vbox from first cropmarks clause
\fi
}% end of \shipout\vbox
- }% end of group with \turnoffactive
+ }% end of group with \normalturnoffactive
\advancepageno
\ifnum\outputpenalty>-20000 \else\dosupereject\fi
}
@@ -309,143 +388,162 @@
% the input line (except we remove a trailing comment). #1 should be a
% macro which expects an ordinary undelimited TeX argument.
%
-\def\parsearg#1{%
- \let\next = #1%
+\def\parsearg{\parseargusing{}}
+\def\parseargusing#1#2{%
+ \def\next{#2}%
\begingroup
\obeylines
- \futurelet\temp\parseargx
-}
-
-% If the next token is an obeyed space (from an @example environment or
-% the like), remove it and recurse. Otherwise, we're done.
-\def\parseargx{%
- % \obeyedspace is defined far below, after the definition of \sepspaces.
- \ifx\obeyedspace\temp
- \expandafter\parseargdiscardspace
- \else
- \expandafter\parseargline
- \fi
+ \spaceisspace
+ #1%
+ \parseargline\empty% Insert the \empty token, see \finishparsearg below.
}
-% Remove a single space (as the delimiter token to the macro call).
-{\obeyspaces %
- \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
-
{\obeylines %
\gdef\parseargline#1^^M{%
\endgroup % End of the group started in \parsearg.
- %
- % First remove any @c comment, then any @comment.
- % Result of each macro is put in \toks0.
- \argremovec #1\c\relax %
- \expandafter\argremovecomment \the\toks0 \comment\relax %
- %
- % Call the caller's macro, saved as \next in \parsearg.
- \expandafter\next\expandafter{\the\toks0}%
+ \argremovecomment #1\comment\ArgTerm%
}%
}
-% Since all \c{,omment} does is throw away the argument, we can let TeX
-% do that for us. The \relax here is matched by the \relax in the call
-% in \parseargline; it could be more or less anything, its purpose is
-% just to delimit the argument to the \c.
-\def\argremovec#1\c#2\relax{\toks0 = {#1}}
-\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
+% First remove any @comment, then any @c comment.
+\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
-% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
+% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
+%
+% \argremovec might leave us with trailing space, e.g.,
% @end itemize @c foo
-% will have two active spaces as part of the argument with the
-% `itemize'. Here we remove all active spaces from #1, and assign the
-% result to \toks0.
-%
-% This loses if there are any *other* active characters besides spaces
-% in the argument -- _ ^ +, for example -- since they get expanded.
-% Fortunately, Texinfo does not define any such commands. (If it ever
-% does, the catcode of the characters in questionwill have to be changed
-% here.) But this means we cannot call \removeactivespaces as part of
-% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
-% that \parsearg gets might well have any character at all in it.
-%
-\def\removeactivespaces#1{%
- \begingroup
- \ignoreactivespaces
- \edef\temp{#1}%
- \global\toks0 = \expandafter{\temp}%
- \endgroup
+% This space token undergoes the same procedure and is eventually removed
+% by \finishparsearg.
+%
+\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
+\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
+\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
+ \def\temp{#3}%
+ \ifx\temp\empty
+ % We cannot use \next here, as it holds the macro to run;
+ % thus we reuse \temp.
+ \let\temp\finishparsearg
+ \else
+ \let\temp\argcheckspaces
+ \fi
+ % Put the space token in:
+ \temp#1 #3\ArgTerm
}
-% Change the active space to expand to nothing.
+% If a _delimited_ argument is enclosed in braces, they get stripped; so
+% to get _exactly_ the rest of the line, we had to prevent such situation.
+% We prepended an \empty token at the very beginning and we expand it now,
+% just before passing the control to \next.
+% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
+% either the null string, or it ends with \^^M---thus there is no danger
+% that a pair of braces would be stripped.
%
-\begingroup
+% But first, we have to remove the trailing space token.
+%
+\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
+
+% \parseargdef\foo{...}
+% is roughly equivalent to
+% \def\foo{\parsearg\Xfoo}
+% \def\Xfoo#1{...}
+%
+% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
+% favourite TeX trick. --kasal, 16nov03
+
+\def\parseargdef#1{%
+ \expandafter \doparseargdef \csname\string#1\endcsname #1%
+}
+\def\doparseargdef#1#2{%
+ \def#2{\parsearg#1}%
+ \def#1##1%
+}
+
+% Several utility definitions with active space:
+{
\obeyspaces
- \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
-\endgroup
+ \gdef\obeyedspace{ }
+
+ % Make each space character in the input produce a normal interword
+ % space in the output. Don't allow a line break at this space, as this
+ % is used only in environments like @example, where each line of input
+ % should produce a line of output anyway.
+ %
+ \gdef\sepspaces{\obeyspaces\let =\tie}
+
+ % If an index command is used in an @example environment, any spaces
+ % therein should become regular spaces in the raw index file, not the
+ % expansion of \tie (\leavevmode \penalty \@M \ ).
+ \gdef\unsepspaces{\let =\space}
+}
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
-%% These are used to keep @begin/@end levels from running away
-%% Call \inENV within environments (after a \begingroup)
-\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
-\def\ENVcheck{%
-\ifENV\errmessage{Still within an environment; press RETURN to continue}
-\endgroup\fi} % This is not perfect, but it should reduce lossage
+% Define the framework for environments in texinfo.tex. It's used like this:
+%
+% \envdef\foo{...}
+% \def\Efoo{...}
+%
+% It's the responsibility of \envdef to insert \begingroup before the
+% actual body; @end closes the group after calling \Efoo. \envdef also
+% defines \thisenv, so the current environment is known; @end checks
+% whether the environment name matches. The \checkenv macro can also be
+% used to check whether the current environment is the one expected.
+%
+% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
+% are not treated as enviroments; they don't open a group. (The
+% implementation of @end takes care not to call \endgroup in this
+% special case.)
-% @begin foo is the same as @foo, for now.
-\newhelp\EMsimple{Press RETURN to continue.}
-\outer\def\begin{\parsearg\beginxxx}
+% At runtime, environments start with this:
+\def\startenvironment#1{\begingroup\def\thisenv{#1}}
+% initialize
+\let\thisenv\empty
-\def\beginxxx #1{%
-\expandafter\ifx\csname #1\endcsname\relax
-{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
-\csname #1\endcsname\fi}
+% ... but they get defined via ``\envdef\foo{...}'':
+\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
+\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
-% @end foo executes the definition of \Efoo.
-%
-\def\end{\parsearg\endxxx}
-\def\endxxx #1{%
- \removeactivespaces{#1}%
- \edef\endthing{\the\toks0}%
- %
- \expandafter\ifx\csname E\endthing\endcsname\relax
- \expandafter\ifx\csname \endthing\endcsname\relax
- % There's no \foo, i.e., no ``environment'' foo.
- \errhelp = \EMsimple
- \errmessage{Undefined command `@end \endthing'}%
- \else
- \unmatchedenderror\endthing
- \fi
+% Check whether we're in the right environment:
+\def\checkenv#1{%
+ \def\temp{#1}%
+ \ifx\thisenv\temp
\else
- % Everything's ok; the right environment has been started.
- \csname E\endthing\endcsname
+ \badenverr
\fi
}
-% There is an environment #1, but it hasn't been started. Give an error.
-%
-\def\unmatchedenderror#1{%
+% Evironment mismatch, #1 expected:
+\def\badenverr{%
\errhelp = \EMsimple
- \errmessage{This `@end #1' doesn't have a matching `@#1'}%
+ \errmessage{This command can appear only \inenvironment\temp,
+ not \inenvironment\thisenv}%
+}
+\def\inenvironment#1{%
+ \ifx#1\empty
+ out of any environment%
+ \else
+ in environment \expandafter\string#1%
+ \fi
}
-% Define the control sequence \E#1 to give an unmatched @end error.
+% @end foo executes the definition of \Efoo.
+% But first, it executes a specialized version of \checkenv
%
-\def\defineunmatchedend#1{%
- \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
+\parseargdef\end{%
+ \if 1\csname iscond.#1\endcsname
+ \else
+ % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
+ \expandafter\checkenv\csname#1\endcsname
+ \csname E#1\endcsname
+ \endgroup
+ \fi
}
+\newhelp\EMsimple{Press RETURN to continue.}
-% Single-spacing is done by various environments (specifically, in
-% \nonfillstart and \quotations).
-\newskip\singlespaceskip \singlespaceskip = 12.5pt
-\def\singlespace{%
- % Why was this kern here? It messes up equalizing space above and below
- % environments. --karl, 6may93
- %{\advance \baselineskip by -\singlespaceskip
- %\kern \baselineskip}%
- \setleading\singlespaceskip
-}
%% Simple single-character @ commands
@@ -466,16 +564,22 @@
\let\{=\mylbrace
\let\}=\myrbrace
\begingroup
- % Definitions to produce actual \{ & \} command in an index.
- \catcode`\{ = 12 \catcode`\} = 12
+ % Definitions to produce \{ and \} commands for indices,
+ % and @{ and @} for the aux file.
+ \catcode`\{ = \other \catcode`\} = \other
\catcode`\[ = 1 \catcode`\] = 2
- \catcode`\@ = 0 \catcode`\\ = 12
- @gdef@lbracecmd[\{]%
- @gdef@rbracecmd[\}]%
-@endgroup
+ \catcode`\! = 0 \catcode`\\ = \other
+ !gdef!lbracecmd[\{]%
+ !gdef!rbracecmd[\}]%
+ !gdef!lbraceatcmd[@{]%
+ !gdef!rbraceatcmd[@}]%
+!endgroup
+
+% @comma{} to avoid , parsing problems.
+\let\comma = ,
% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
\let\, = \c
\let\dotaccent = \.
\def\ringaccent#1{{\accent23 #1}}
@@ -483,10 +587,12 @@
\let\ubaraccent = \b
\let\udotaccent = \d
-% Other special characters: @questiondown @exclamdown
-% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
+% Other special characters: @questiondown @exclamdown @ordf @ordm
+% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
\def\questiondown{?`}
\def\exclamdown{!`}
+\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
% Dotless i and dotless j, used for accents.
\def\imacro{i}
@@ -499,6 +605,25 @@
\fi\fi
}
+% The \TeX{} logo, as in plain, but resetting the spacing so that a
+% period following counts as ending a sentence. (Idea found in latex.)
+%
+\edef\TeX{\TeX \spacefactor=1000 }
+
+% @LaTeX{} logo. Not quite the same results as the definition in
+% latex.ltx, since we use a different font for the raised A; it's most
+% convenient for us to use an explicitly smaller font, rather than using
+% the \scriptstyle font (since we don't reset \scriptstyle and
+% \scriptscriptstyle).
+%
+\def\LaTeX{%
+ L\kern-.36em
+ {\setbox0=\hbox{T}%
+ \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
+ \kern-.15em
+ \TeX
+}
+
% Be sure we're in horizontal mode when doing a tie, since we make space
% equivalent to this in @example-like environments. Otherwise, a space
% at the beginning of a line will start with \penalty -- and
@@ -517,6 +642,9 @@
% @* forces a line break.
\def\*{\hfil\break\hbox{}\ignorespaces}
+% @/ allows a line break.
+\let\/=\allowbreak
+
% @. is an end-of-sentence period.
\def\.{.\spacefactor=3000 }
@@ -539,47 +667,24 @@
% therefore, no glue is inserted, and the space between the headline and
% the text is small, which looks bad.
%
-\def\group{\begingroup
- \ifnum\catcode13=\active \else
+% Another complication is that the group might be very large. This can
+% cause the glue on the previous page to be unduly stretched, because it
+% does not have much material. In this case, it's better to add an
+% explicit \vfill so that the extra space is at the bottom. The
+% threshold for doing this is if the group is more than \vfilllimit
+% percent of a page (\vfilllimit can be changed inside of @tex).
+%
+\newbox\groupbox
+\def\vfilllimit{0.7}
+%
+\envdef\group{%
+ \ifnum\catcode`\^^M=\active \else
\errhelp = \groupinvalidhelp
\errmessage{@group invalid in context where filling is enabled}%
\fi
+ \startsavinginserts
%
- % The \vtop we start below produces a box with normal height and large
- % depth; thus, TeX puts \baselineskip glue before it, and (when the
- % next line of text is done) \lineskip glue after it. (See p.82 of
- % the TeXbook.) Thus, space below is not quite equal to space
- % above. But it's pretty close.
- \def\Egroup{%
- \egroup % End the \vtop.
- \endgroup % End the \group.
- }%
- %
- \vtop\bgroup
- % We have to put a strut on the last line in case the @group is in
- % the midst of an example, rather than completely enclosing it.
- % Otherwise, the interline space between the last line of the group
- % and the first line afterwards is too small. But we can't put the
- % strut in \Egroup, since there it would be on a line by itself.
- % Hence this just inserts a strut at the beginning of each line.
- \everypar = {\strut}%
- %
- % Since we have a strut on every line, we don't need any of TeX's
- % normal interline spacing.
- \offinterlineskip
- %
- % OK, but now we have to do something about blank
- % lines in the input in @example-like environments, which normally
- % just turn into \lisppar, which will insert no space now that we've
- % turned off the interline space. Simplest is to make them be an
- % empty paragraph.
- \ifx\par\lisppar
- \edef\par{\leavevmode \par}%
- %
- % Reset ^^M's definition to new definition of \par.
- \obeylines
- \fi
- %
+ \setbox\groupbox = \vtop\bgroup
% Do @comment since we are called inside an environment such as
% @example, where each end-of-line in the input causes an
% end-of-line in the output. We don't want the end-of-line after
@@ -589,6 +694,32 @@
\comment
}
%
+% The \vtop produces a box with normal height and large depth; thus, TeX puts
+% \baselineskip glue before it, and (when the next line of text is done)
+% \lineskip glue after it. Thus, space below is not quite equal to space
+% above. But it's pretty close.
+\def\Egroup{%
+ % To get correct interline space between the last line of the group
+ % and the first line afterwards, we have to propagate \prevdepth.
+ \endgraf % Not \par, as it may have been set to \lisppar.
+ \global\dimen1 = \prevdepth
+ \egroup % End the \vtop.
+ % \dimen0 is the vertical size of the group's box.
+ \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
+ % \dimen2 is how much space is left on the page (more or less).
+ \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
+ % if the group doesn't fit on the current page, and it's a big big
+ % group, force a page break.
+ \ifdim \dimen0 > \dimen2
+ \ifdim \pagetotal < \vfilllimit\pageheight
+ \page
+ \fi
+ \fi
+ \box\groupbox
+ \prevdepth = \dimen1
+ \checkinserts
+}
+%
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
% message, so this ends up printing `@group can only ...'.
%
@@ -601,10 +732,8 @@ where each line of input produces a line of output.}
\newdimen\mil \mil=0.001in
-\def\need{\parsearg\needx}
-
% Old definition--didn't work.
-%\def\needx #1{\par %
+%\parseargdef\need{\par %
%% This method tries to make TeX break the page naturally
%% if the depth of the box does not fit.
%{\baselineskip=0pt%
@@ -612,7 +741,7 @@ where each line of input produces a line of output.}
%\prevdepth=-1000pt
%}}
-\def\needx#1{%
+\parseargdef\need{%
% Ensure vertical mode, so we don't make a big box in the middle of a
% paragraph.
\par
@@ -651,37 +780,11 @@ where each line of input produces a line of output.}
\fi
}
-% @br forces paragraph break
+% @br forces paragraph break (and is undocumented).
\let\br = \par
-% @dots{} output an ellipsis using the current font.
-% We do .5em per period so that it has the same spacing in a typewriter
-% font as three actual period characters.
-%
-\def\dots{%
- \leavevmode
- \hbox to 1.5em{%
- \hskip 0pt plus 0.25fil minus 0.25fil
- .\hss.\hss.%
- \hskip 0pt plus 0.5fil minus 0.5fil
- }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
- \leavevmode
- \hbox to 2em{%
- \hskip 0pt plus 0.25fil minus 0.25fil
- .\hss.\hss.\hss.%
- \hskip 0pt plus 0.5fil minus 0.5fil
- }%
- \spacefactor=3000
-}
-
-
-% @page forces the start of a new page
+% @page forces the start of a new page.
%
\def\page{\par\vfill\supereject}
@@ -693,13 +796,11 @@ where each line of input produces a line of output.}
\newskip\exdentamount
% This defn is used inside fill environments such as @defun.
-\def\exdent{\parsearg\exdentyyy}
-\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
+\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
% This defn is used inside nofill environments such as @example.
-\def\nofillexdent{\parsearg\nofillexdentyyy}
-\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
-\leftline{\hskip\leftskip{\rm#1}}}}
+\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
+ \leftline{\hskip\leftskip{\rm#1}}}}
% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
% paragraph. For more general purposes, use the \margin insertion
@@ -730,10 +831,10 @@ where each line of input produces a line of output.}
% @inmargin{TEXT [, RIGHT-TEXT]}
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
% else use TEXT for both).
-%
+%
\def\inmargin#1{\parseinmargin #1,,\finish}
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
- \setbox0 = \hbox{\ignorespaces #2}%
+ \setbox0 = \hbox{\ignorespaces #2}%
\ifdim\wd0 > 0pt
\def\lefttext{#1}% have both texts
\def\righttext{#2}%
@@ -751,37 +852,71 @@ where each line of input produces a line of output.}
}
% @include file insert text of that file as input.
-% Allow normal characters that we make active in the argument (a file name).
-\def\include{\begingroup
- \catcode`\\=12
- \catcode`~=12
- \catcode`^=12
- \catcode`_=12
- \catcode`|=12
- \catcode`<=12
- \catcode`>=12
- \catcode`+=12
- \parsearg\includezzz}
-% Restore active chars for included file.
-\def\includezzz#1{\endgroup\begingroup
- % Read the included file in a group so nested @include's work.
+%
+\def\include{\parseargusing\filenamecatcodes\includezzz}
+\def\includezzz#1{%
+ \pushthisfilestack
\def\thisfile{#1}%
- \input\thisfile
-\endgroup}
+ {%
+ \makevalueexpandable
+ \def\temp{\input #1 }%
+ \expandafter
+ }\temp
+ \popthisfilestack
+}
+\def\filenamecatcodes{%
+ \catcode`\\=\other
+ \catcode`~=\other
+ \catcode`^=\other
+ \catcode`_=\other
+ \catcode`|=\other
+ \catcode`<=\other
+ \catcode`>=\other
+ \catcode`+=\other
+ \catcode`-=\other
+}
-\def\thisfile{}
+\def\pushthisfilestack{%
+ \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
+}
+\def\pushthisfilestackX{%
+ \expandafter\pushthisfilestackY\thisfile\StackTerm
+}
+\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
+ \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
+}
-% @center line outputs that line, centered
+\def\popthisfilestack{\errthisfilestackempty}
+\def\errthisfilestackempty{\errmessage{Internal error:
+ the stack of filenames is empty.}}
-\def\center{\parsearg\centerzzz}
-\def\centerzzz #1{{\advance\hsize by -\leftskip
-\advance\hsize by -\rightskip
-\centerline{#1}}}
+\def\thisfile{}
+
+% @center line
+% outputs that line, centered.
+%
+\parseargdef\center{%
+ \ifhmode
+ \let\next\centerH
+ \else
+ \let\next\centerV
+ \fi
+ \next{\hfil \ignorespaces#1\unskip \hfil}%
+}
+\def\centerH#1{%
+ {%
+ \hfil\break
+ \advance\hsize by -\leftskip
+ \advance\hsize by -\rightskip
+ \line{#1}%
+ \break
+ }%
+}
+\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
% @sp n outputs n lines of vertical space
-\def\sp{\parsearg\spxxx}
-\def\spxxx #1{\vskip #1\baselineskip}
+\parseargdef\sp{\vskip #1\baselineskip}
% @comment ...line which is ignored...
% @c is the same as @comment
@@ -796,13 +931,13 @@ where each line of input produces a line of output.}
% @paragraphindent NCHARS
% We'll use ems for NCHARS, close enough.
-% We cannot implement @paragraphindent asis, though.
-%
+% NCHARS can also be the word `asis' or `none'.
+% We cannot feasibly implement @paragraphindent asis, though.
+%
\def\asisword{asis} % no translation, these are keywords
\def\noneword{none}
%
-\def\paragraphindent{\parsearg\doparagraphindent}
-\def\doparagraphindent#1{%
+\parseargdef\paragraphindent{%
\def\temp{#1}%
\ifx\temp\asisword
\else
@@ -819,8 +954,7 @@ where each line of input produces a line of output.}
% We'll use ems for NCHARS like @paragraphindent.
% It seems @exampleindent asis isn't necessary, but
% I preserve it to make it similar to @paragraphindent.
-\def\exampleindent{\parsearg\doexampleindent}
-\def\doexampleindent#1{%
+\parseargdef\exampleindent{%
\def\temp{#1}%
\ifx\temp\asisword
\else
@@ -832,51 +966,138 @@ where each line of input produces a line of output.}
\fi
}
+% @firstparagraphindent WORD
+% If WORD is `none', then suppress indentation of the first paragraph
+% after a section heading. If WORD is `insert', then do indent at such
+% paragraphs.
+%
+% The paragraph indentation is suppressed or not by calling
+% \suppressfirstparagraphindent, which the sectioning commands do.
+% We switch the definition of this back and forth according to WORD.
+% By default, we suppress indentation.
+%
+\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
+\def\insertword{insert}
+%
+\parseargdef\firstparagraphindent{%
+ \def\temp{#1}%
+ \ifx\temp\noneword
+ \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
+ \else\ifx\temp\insertword
+ \let\suppressfirstparagraphindent = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @firstparagraphindent option `\temp'}%
+ \fi\fi
+}
+
+% Here is how we actually suppress indentation. Redefine \everypar to
+% \kern backwards by \parindent, and then reset itself to empty.
+%
+% We also make \indent itself not actually do anything until the next
+% paragraph.
+%
+\gdef\dosuppressfirstparagraphindent{%
+ \gdef\indent{%
+ \restorefirstparagraphindent
+ \indent
+ }%
+ \gdef\noindent{%
+ \restorefirstparagraphindent
+ \noindent
+ }%
+ \global\everypar = {%
+ \kern -\parindent
+ \restorefirstparagraphindent
+ }%
+}
+
+\gdef\restorefirstparagraphindent{%
+ \global \let \indent = \ptexindent
+ \global \let \noindent = \ptexnoindent
+ \global \everypar = {}%
+}
+
+
% @asis just yields its argument. Used with @table, for example.
%
\def\asis#1{#1}
% @math outputs its argument in math mode.
-% We don't use $'s directly in the definition of \math because we need
-% to set catcodes according to plain TeX first, to allow for subscripts,
-% superscripts, special math chars, etc.
-%
-% @math does not do math typesetting in section titles, index
-% entries, and other such contexts where the catcodes are set before
-% @math gets a chance to work. This could perhaps be fixed, but for now
-% at least we can have real math in the main text, where it's needed most.
-%
-\let\implicitmath = $%$ font-lock fix
%
% One complication: _ usually means subscripts, but it could also mean
% an actual _ character, as in @math{@var{some_variable} + 1}. So make
-% _ within @math be active (mathcode "8000), and distinguish by seeing
-% if the current family is \slfam, which is what @var uses.
-%
-{\catcode95 = \active % 95 = _
-\gdef\mathunderscore{%
- \catcode95=\active
- \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
-}}
-%
+% _ active, and distinguish by seeing if the current family is \slfam,
+% which is what @var uses.
+{
+ \catcode\underChar = \active
+ \gdef\mathunderscore{%
+ \catcode\underChar=\active
+ \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
+ }
+}
% Another complication: we want \\ (and @\) to output a \ character.
% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
% this is not advertised and we don't care. Texinfo does not
% otherwise define @\.
-%
+%
% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
%
\def\math{%
\tex
- \mathcode`\_="8000 \mathunderscore
+ \mathunderscore
\let\\ = \mathbackslash
- \implicitmath\finishmath}
-\def\finishmath#1{#1\implicitmath\Etex}
+ \mathactive
+ $\finishmath
+}
+\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
+
+% Some active characters (such as <) are spaced differently in math.
+% We have to reset their definitions in case the @math was an argument
+% to a command which sets the catcodes (such as @item or @section).
+%
+{
+ \catcode`^ = \active
+ \catcode`< = \active
+ \catcode`> = \active
+ \catcode`+ = \active
+ \gdef\mathactive{%
+ \let^ = \ptexhat
+ \let< = \ptexless
+ \let> = \ptexgtr
+ \let+ = \ptexplus
+ }
+}
% @bullet and @minus need the same treatment as @math, just above.
-\def\bullet{\implicitmath\ptexbullet\implicitmath}
-\def\minus{\implicitmath-\implicitmath}
+\def\bullet{$\ptexbullet$}
+\def\minus{$-$}
+
+% @dots{} outputs an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in a typewriter
+% font as three actual period characters.
+%
+\def\dots{%
+ \leavevmode
+ \hbox to 1.5em{%
+ \hskip 0pt plus 0.25fil
+ .\hfil.\hfil.%
+ \hskip 0pt plus 0.5fil
+ }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+ \dots
+ \spacefactor=3000
+}
+
+% @comma{} is so commas can be inserted into text without messing up
+% Texinfo's parsing.
+%
+\let\comma = ,
% @refill is a no-op.
\let\refill=\relax
@@ -892,20 +1113,20 @@ where each line of input produces a line of output.}
% So open here the files we need to have open while reading the input.
% This makes it possible to make a .fmt file for texinfo.
\def\setfilename{%
+ \fixbackslash % Turn off hack to swallow `\input texinfo'.
\iflinks
- \readauxfile
+ \tryauxfile
+ % Open the new aux file. TeX will close it automatically at exit.
+ \immediate\openout\auxfile=\jobname.aux
\fi % \openindices needs to do some work in any case.
\openindices
- \fixbackslash % Turn off hack to swallow `\input texinfo'.
- \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
+ \let\setfilename=\comment % Ignore extra @setfilename cmds.
%
% If texinfo.cnf is present on the system, read it.
% Useful for site-wide @afourpaper, etc.
- % Just to be on the safe side, close the input stream before the \input.
\openin 1 texinfo.cnf
- \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
- \closein1
- \temp
+ \ifeof 1 \else \input texinfo.cnf \fi
+ \closein 1
%
\comment % Ignore the actual filename.
}
@@ -941,17 +1162,23 @@ where each line of input produces a line of output.}
\newif\ifpdf
\newif\ifpdfmakepagedest
+% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
+% can be set). So we test for \relax and 0 as well as \undefined,
+% borrowed from ifpdf.sty.
\ifx\pdfoutput\undefined
- \pdffalse
- \let\pdfmkdest = \gobble
- \let\pdfurl = \gobble
- \let\endlink = \relax
- \let\linkcolor = \relax
- \let\pdfmakeoutlines = \relax
\else
- \pdftrue
- \pdfoutput = 1
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+\fi
+%
+\ifpdf
\input pdfcolor
+ \pdfcatalog{/PageMode /UseOutlines}%
\def\dopdfimage#1#2#3{%
\def\imagewidth{#2}%
\def\imageheight{#3}%
@@ -965,14 +1192,20 @@ where each line of input produces a line of output.}
\ifx\empty\imagewidth\else width \imagewidth \fi
\ifx\empty\imageheight\else height \imageheight \fi
\ifnum\pdftexversion<13
- #1.pdf%
+ #1.pdf%
\else
{#1.pdf}%
\fi
\ifnum\pdftexversion < 14 \else
\pdfrefximage \pdflastximage
\fi}
- \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
+ \def\pdfmkdest#1{{%
+ % We have to set dummies so commands such as @code in a section title
+ % aren't expanded.
+ \atdummies
+ \normalturnoffactive
+ \pdfdest name{#1} xyz%
+ }}
\def\pdfmkpgn#1{#1}
\let\linkcolor = \Blue % was Cyan, but that seems light?
\def\endlink{\Black\pdfendlink}
@@ -981,49 +1214,94 @@ where each line of input produces a line of output.}
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
\else \csname#1\endcsname \fi}
\def\advancenumber#1{\tempnum=\expnumber{#1}\relax
- \advance\tempnum by1
+ \advance\tempnum by 1
\expandafter\xdef\csname#1\endcsname{\the\tempnum}}
- \def\pdfmakeoutlines{{%
- \openin 1 \jobname.toc
- \ifeof 1\else\begingroup
- \closein 1
- \indexnofonts
- \def\tt{}
- \let\_ = \normalunderscore
- % Thanh's hack / proper braces in bookmarks
+ %
+ % #1 is the section text. #2 is the pdf expression for the number
+ % of subentries (or empty, for subsubsections). #3 is the node
+ % text, which might be empty if this toc entry had no
+ % corresponding node. #4 is the page number.
+ %
+ \def\dopdfoutline#1#2#3#4{%
+ % Generate a link to the node text if that exists; else, use the
+ % page number. We could generate a destination for the section
+ % text in the case where a section has no node, but it doesn't
+ % seem worthwhile, since most documents are normally structured.
+ \def\pdfoutlinedest{#3}%
+ \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi
+ %
+ \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}%
+ }
+ %
+ \def\pdfmakeoutlines{%
+ \begingroup
+ % Thanh's hack / proper braces in bookmarks
\edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
\edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
%
- \def\chapentry ##1##2##3{}
- \let\appendixentry = \chapentry
- \def\unnumbchapentry ##1##2{}
- \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
- \def\unnumbsecentry ##1##2##3{\advancenumber{chap##2}}
- \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
- \def\unnumbsubsecentry ##1##2##3##4{\advancenumber{sec##2.##3}}
- \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
- \def\unnumbsubsubsecentry ##1##2##3##4##5{\advancenumber{subsec##2.##3.##4}}
+ % Read toc silently, to get counts of subentries for \pdfoutline.
+ \def\numchapentry##1##2##3##4{%
+ \def\thischapnum{##2}%
+ \let\thissecnum\empty
+ \let\thissubsecnum\empty
+ }%
+ \def\numsecentry##1##2##3##4{%
+ \advancenumber{chap\thischapnum}%
+ \def\thissecnum{##2}%
+ \let\thissubsecnum\empty
+ }%
+ \def\numsubsecentry##1##2##3##4{%
+ \advancenumber{sec\thissecnum}%
+ \def\thissubsecnum{##2}%
+ }%
+ \def\numsubsubsecentry##1##2##3##4{%
+ \advancenumber{subsec\thissubsecnum}%
+ }%
+ \let\thischapnum\empty
+ \let\thissecnum\empty
+ \let\thissubsecnum\empty
+ %
+ % use \def rather than \let here because we redefine \chapentry et
+ % al. a second time, below.
+ \def\appentry{\numchapentry}%
+ \def\appsecentry{\numsecentry}%
+ \def\appsubsecentry{\numsubsecentry}%
+ \def\appsubsubsecentry{\numsubsubsecentry}%
+ \def\unnchapentry{\numchapentry}%
+ \def\unnsecentry{\numsecentry}%
+ \def\unnsubsecentry{\numsubsecentry}%
+ \def\unnsubsubsecentry{\numsubsubsecentry}%
\input \jobname.toc
- \def\chapentry ##1##2##3{%
- \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
- \let\appendixentry = \chapentry
- \def\unnumbchapentry ##1##2{%
- \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
- \def\secentry ##1##2##3##4{%
- \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
- \def\unnumbsecentry ##1##2##3{%
- \pdfoutline goto name{\pdfmkpgn{##3}}{##1}}
- \def\subsecentry ##1##2##3##4##5{%
- \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
- \def\unnumbsubsecentry ##1##2##3##4{%
- \pdfoutline goto name{\pdfmkpgn{##4}}{##1}}
- \def\subsubsecentry ##1##2##3##4##5##6{%
- \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
- \def\unnumbsubsubsecentry ##1##2##3##4##5{%
- \pdfoutline goto name{\pdfmkpgn{##5}}{##1}}
+ %
+ % Read toc second time, this time actually producing the outlines.
+ % The `-' means take the \expnumber as the absolute number of
+ % subentries, which we calculated on our first read of the .toc above.
+ %
+ % We use the node names as the destinations.
+ \def\numchapentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
+ \def\numsecentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
+ \def\numsubsecentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
+ \def\numsubsubsecentry##1##2##3##4{% count is always zero
+ \dopdfoutline{##1}{}{##3}{##4}}%
+ %
+ % PDF outlines are displayed using system fonts, instead of
+ % document fonts. Therefore we cannot use special characters,
+ % since the encoding is unknown. For example, the eogonek from
+ % Latin 2 (0xea) gets translated to a | character. Info from
+ % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
+ %
+ % xx to do this right, we have to translate 8-bit characters to
+ % their "best" equivalent, based on the @documentencoding. Right
+ % now, I guess we'll just let the pdf reader have its way.
+ \indexnofonts
+ \turnoffactive
\input \jobname.toc
- \endgroup\fi
- }}
+ \endgroup
+ }
+ %
\def\makelinks #1,{%
\def\params{#1}\def\E{END}%
\ifx\params\E
@@ -1032,7 +1310,7 @@ where each line of input produces a line of output.}
\let\nextmakelinks=\makelinks
\ifnum\lnkcount>0,\fi
\picknum{#1}%
- \startlink attr{/Border [0 0 0]}
+ \startlink attr{/Border [0 0 0]}
goto name{\pdfmkpgn{\the\pgn}}%
\linkcolor #1%
\advance\lnkcount by 1%
@@ -1054,7 +1332,6 @@ where each line of input produces a line of output.}
\def\ppn#1{\pgn=#1\gobble}
\def\ppnn{\pgn=\first}
\def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
- \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
\def\skipspaces#1{\def\PP{#1}\def\D{|}%
\ifx\PP\D\let\nextsp\relax
\else\let\nextsp\skipspaces
@@ -1072,22 +1349,21 @@ where each line of input produces a line of output.}
\def\pdfurl#1{%
\begingroup
\normalturnoffactive\def\@{@}%
- \let\value=\expandablevalue
+ \makevalueexpandable
\leavevmode\Red
\startlink attr{/Border [0 0 0]}%
user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
- % #1
\endgroup}
\def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
\def\maketoks{%
- \expandafter\poptoks\the\toksA|ENDTOKS|
+ \expandafter\poptoks\the\toksA|ENDTOKS|\relax
\ifx\first0\adn0
\else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
\else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
- \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
+ \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
\else
\ifnum0=\countA\else\makelink\fi
\ifx\first.\let\next=\done\else
@@ -1103,20 +1379,44 @@ where each line of input produces a line of output.}
\startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
\linkcolor #1\endlink}
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\fi % \ifx\pdfoutput
+\else
+ \let\pdfmkdest = \gobble
+ \let\pdfurl = \gobble
+ \let\endlink = \relax
+ \let\linkcolor = \relax
+ \let\pdfmakeoutlines = \relax
+\fi % \ifx\pdfoutput
\message{fonts,}
-% Font-change commands.
+
+% Change the current font style to #1, remembering it in \curfontstyle.
+% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
+% italics, not bold italics.
+%
+\def\setfontstyle#1{%
+ \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
+ \csname ten#1\endcsname % change the current font
+}
+
+% Select #1 fonts with the current style.
+%
+\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
+
+\def\rm{\fam=0 \setfontstyle{rm}}
+\def\it{\fam=\itfam \setfontstyle{it}}
+\def\sl{\fam=\slfam \setfontstyle{sl}}
+\def\bf{\fam=\bffam \setfontstyle{bf}}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf analogous to plain's \rm, etc.
+% So we set up a \sf.
\newfam\sffam
-\def\sf{\fam=\sffam \tensf}
+\def\sf{\fam=\sffam \setfontstyle{sf}}
\let\li = \sf % Sometimes we call it \li, not \sf.
-% We don't need math for this one.
-\def\ttsl{\tenttsl}
+% We don't need math for this font style.
+\def\ttsl{\setfontstyle{ttsl}}
% Default leading.
\newdimen\textleading \textleading = 13.2pt
@@ -1167,10 +1467,11 @@ where each line of input produces a line of output.}
\def\scshape{csc}
\def\scbshape{csc}
+% Text fonts (11.2pt, magstep1).
\newcount\mainmagstep
\ifx\bigger\relax
% not really supported.
- \let\mainmagstep=\magstep1
+ \mainmagstep=\magstep1
\setfont\textrm\rmshape{12}{1000}
\setfont\texttt\ttshape{12}{1000}
\else
@@ -1178,9 +1479,6 @@ where each line of input produces a line of output.}
\setfont\textrm\rmshape{10}{\mainmagstep}
\setfont\texttt\ttshape{10}{\mainmagstep}
\fi
-% Instead of cmb10, you many want to use cmbx10.
-% cmbx10 is a prettier font on its own, but cmb10
-% looks better when embedded in a line with cmr10.
\setfont\textbf\bfshape{10}{\mainmagstep}
\setfont\textit\itshape{10}{\mainmagstep}
\setfont\textsl\slshape{10}{\mainmagstep}
@@ -1190,10 +1488,11 @@ where each line of input produces a line of output.}
\font\texti=cmmi10 scaled \mainmagstep
\font\textsy=cmsy10 scaled \mainmagstep
-% A few fonts for @defun, etc.
-\setfont\defbf\bxshape{10}{\magstep1} %was 1314
+% A few fonts for @defun names and args.
+\setfont\defbf\bfshape{10}{\magstep1}
\setfont\deftt\ttshape{10}{\magstep1}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
+\setfont\defttsl\ttslshape{10}{\magstep1}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
% Fonts for indices, footnotes, small examples (9pt).
\setfont\smallrm\rmshape{9}{1000}
@@ -1219,7 +1518,7 @@ where each line of input produces a line of output.}
\font\smalleri=cmmi8
\font\smallersy=cmsy8
-% Fonts for title page:
+% Fonts for title page (20.4pt):
\setfont\titlerm\rmbshape{12}{\magstep3}
\setfont\titleit\itbshape{10}{\magstep4}
\setfont\titlesl\slbshape{10}{\magstep4}
@@ -1231,6 +1530,7 @@ where each line of input produces a line of output.}
\font\titlei=cmmi12 scaled \magstep3
\font\titlesy=cmsy10 scaled \magstep4
\def\authorrm{\secrm}
+\def\authortt{\sectt}
% Chapter (and unnumbered) fonts (17.28pt).
\setfont\chaprm\rmbshape{12}{\magstep2}
@@ -1264,11 +1564,21 @@ where each line of input produces a line of output.}
\setfont\ssecttsl\ttslshape{10}{1315}
\setfont\ssecsf\sfbshape{12}{\magstephalf}
\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{\magstep1}
+\setfont\ssecsc\scbshape{10}{1315}
\font\sseci=cmmi12 scaled \magstephalf
\font\ssecsy=cmsy10 scaled 1315
-% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
-% but that is not a standard magnification.
+
+% Reduced fonts for @acro in text (10pt).
+\setfont\reducedrm\rmshape{10}{1000}
+\setfont\reducedtt\ttshape{10}{1000}
+\setfont\reducedbf\bfshape{10}{1000}
+\setfont\reducedit\itshape{10}{1000}
+\setfont\reducedsl\slshape{10}{1000}
+\setfont\reducedsf\sfshape{10}{1000}
+\setfont\reducedsc\scshape{10}{1000}
+\setfont\reducedttsl\ttslshape{10}{1000}
+\font\reducedi=cmmi10
+\font\reducedsy=cmsy10
% In order for the font changes to affect most math symbols and letters,
% we have to define the \textfont of the standard families. Since
@@ -1283,56 +1593,95 @@ where each line of input produces a line of output.}
}
% The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE. We do this so that font changes will continue to work
-% in math mode, where it is the current \fam that is relevant in most
-% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
-% \tenbf}, for example. By redefining \tenbf, we obviate the need to
-% redefine \bf itself.
+% of just \STYLE. We do this because \STYLE needs to also set the
+% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
+% \tenSTYLE to set the current font.
+%
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower). These relative commands are used in
+% the LaTeX logo and acronyms.
+%
+% This all needs generalizing, badly.
+%
\def\textfonts{%
\let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
\let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
- \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
+ \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
+ \let\tenttsl=\textttsl
+ \def\lsize{reduced}\def\lllsize{smaller}%
\resetmathfonts \setleading{\textleading}}
\def\titlefonts{%
\let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
\let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
\let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
\let\tenttsl=\titlettsl
+ \def\lsize{chap}\def\lllsize{subsec}%
\resetmathfonts \setleading{25pt}}
\def\titlefont#1{{\titlefonts\rm #1}}
\def\chapfonts{%
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
\let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
+ \def\lsize{sec}\def\lllsize{text}%
\resetmathfonts \setleading{19pt}}
\def\secfonts{%
\let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
\let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
- \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
+ \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
+ \let\tenttsl=\secttsl
+ \def\lsize{subsec}\def\lllsize{reduced}%
\resetmathfonts \setleading{16pt}}
\def\subsecfonts{%
\let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
\let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
- \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
+ \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
+ \let\tenttsl=\ssecttsl
+ \def\lsize{text}\def\lllsize{small}%
\resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
+\let\subsubsecfonts = \subsecfonts
+\def\reducedfonts{%
+ \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
+ \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
+ \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
+ \let\tenttsl=\reducedttsl
+ \def\lsize{small}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{10.5pt}}
\def\smallfonts{%
\let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
\let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
\let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
\let\tenttsl=\smallttsl
+ \def\lsize{smaller}\def\lllsize{smaller}%
\resetmathfonts \setleading{10.5pt}}
\def\smallerfonts{%
\let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
\let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
\let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
\let\tenttsl=\smallerttsl
+ \def\lsize{smaller}\def\lllsize{smaller}%
\resetmathfonts \setleading{9.5pt}}
-\let\smallexamplefonts = \smallerfonts
+
+% Set the fonts to use with the @small... environments.
+\let\smallexamplefonts = \smallfonts
+
+% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
+% can fit this many characters:
+% 8.5x11=86 smallbook=72 a4=90 a5=69
+% If we use \scriptfonts (8pt), then we can fit this many characters:
+% 8.5x11=90+ smallbook=80 a4=90+ a5=77
+% For me, subjectively, the few extra characters that fit aren't worth
+% the additional smallness of 8pt. So I'm making the default 9pt.
+%
+% By the way, for comparison, here's what fits with @example (10pt):
+% 8.5x11=71 smallbook=60 a4=75 a5=58
+%
+% I wish the USA used A4 paper.
+% --karl, 24jan03.
+
% Set up the default fonts, so we can use them for creating boxes.
%
-\textfonts
+\textfonts \rm
% Define these so they can be easily changed for other fonts.
\def\angleleft{$\langle$}
@@ -1343,23 +1692,33 @@ where each line of input produces a line of output.}
% Fonts for short table of contents.
\setfont\shortcontrm\rmshape{12}{1000}
-\setfont\shortcontbf\bxshape{12}{1000}
+\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12
\setfont\shortcontsl\slshape{12}{1000}
+\setfont\shortconttt\ttshape{12}{1000}
%% Add scribe-like font environments, plus @l for inline lisp (usually sans
%% serif) and @ii for TeX italic
% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
% unless the following character is such as not to need one.
-\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
-\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx}
-\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx}
+\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
+ \ptexslash\fi\fi\fi}
+\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
+\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
+
+% like \smartslanted except unconditionally uses \ttsl.
+% @var is set to this for defun arguments.
+\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
+
+% like \smartslanted except unconditionally use \sl. We never want
+% ttsl for book titles, do we?
+\def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
\let\i=\smartitalic
+\let\slanted=\smartslanted
\let\var=\smartslanted
\let\dfn=\smartslanted
\let\emph=\smartitalic
-\let\cite=\smartslanted
\def\b#1{{\bf #1}}
\let\strong=\b
@@ -1371,11 +1730,21 @@ where each line of input produces a line of output.}
\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
\def\restorehyphenation{\hyphenchar\font = `- }
+% Set sfcode to normal for the chars that usually have another value.
+% Can't use plain's \frenchspacing because it uses the `\x notation, and
+% sometimes \x has an active definition that messes things up.
+%
+\catcode`@=11
+ \def\frenchspacing{%
+ \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
+ \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
+ }
+\catcode`@=\other
+
\def\t#1{%
{\tt \rawbackslash \frenchspacing #1}%
\null
}
-\let\ttfont=\t
\def\samp#1{`\tclose{#1}'\null}
\setfont\keyrm\rmshape{8}{1000}
\font\keysy=cmsy9
@@ -1416,7 +1785,7 @@ where each line of input produces a line of output.}
\null
}
-% We *must* turn on hyphenation at `-' and `_' in \code.
+% We *must* turn on hyphenation at `-' and `_' in @code.
% Otherwise, it is too hard to avoid overfull hboxes
% in the Emacs manual, the Library manual, etc.
@@ -1434,10 +1803,6 @@ where each line of input produces a line of output.}
\catcode`\_=\active \let_\codeunder
\codex
}
- %
- % If we end up with any active - characters when handling the index,
- % just treat them as a normal -.
- \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
}
\def\realdash{-}
@@ -1461,8 +1826,7 @@ where each line of input produces a line of output.}
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
% `example' (@kbd uses ttsl only inside of @example and friends),
% or `code' (@kbd uses normal tty font always).
-\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
-\def\kbdinputstylexxx#1{%
+\parseargdef\kbdinputstyle{%
\def\arg{#1}%
\ifx\arg\worddistinct
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
@@ -1470,15 +1834,17 @@ where each line of input produces a line of output.}
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
\else\ifx\arg\wordcode
\gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @kbdinputstyle option `\arg'}%
\fi\fi\fi
}
\def\worddistinct{distinct}
\def\wordexample{example}
\def\wordcode{code}
-% Default is kbdinputdistinct. (Too much of a hassle to call the macro,
-% the catcodes are wrong for parsearg to work.)
-\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
+% Default is `distinct.'
+\kbdinputstyle distinct
\def\xkey{\key}
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
@@ -1486,8 +1852,8 @@ where each line of input produces a line of output.}
\else{\tclose{\kbdfont\look}}\fi
\else{\tclose{\kbdfont\look}}\fi}
-% For @url, @env, @command quotes seem unnecessary, so use \code.
-\let\url=\code
+% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
+\let\indicateurl=\code
\let\env=\code
\let\command=\code
@@ -1519,9 +1885,13 @@ where each line of input produces a line of output.}
\endlink
\endgroup}
+% @url synonym for @uref, since that's how everyone uses it.
+%
+\let\url=\uref
+
% rms does not like angle brackets --karl, 17may97.
% So now @email is just like @uref, unless we are pdf.
-%
+%
%\def\email#1{\angleleft{\tt #1}\angleright}
\ifpdf
\def\email#1{\doemail#1,,\finish}
@@ -1560,12 +1930,53 @@ where each line of input produces a line of output.}
\def\sc#1{{\smallcaps#1}} % smallcaps font
\def\ii#1{{\it #1}} % italic font
-% @acronym downcases the argument and prints in smallcaps.
-\def\acronym#1{{\smallcaps \lowercase{#1}}}
+% @acronym for "FBI", "NATO", and the like.
+% We print this one point size smaller, since it's intended for
+% all-uppercase.
+%
+\def\acronym#1{\doacronym #1,,\finish}
+\def\doacronym#1,#2,#3\finish{%
+ {\selectfonts\lsize #1}%
+ \def\temp{#2}%
+ \ifx\temp\empty \else
+ \space ({\unsepspaces \ignorespaces \temp \unskip})%
+ \fi
+}
+
+% @abbr for "Comput. J." and the like.
+% No font change, but don't do end-of-sentence spacing.
+%
+\def\abbr#1{\doabbr #1,,\finish}
+\def\doabbr#1,#2,#3\finish{%
+ {\frenchspacing #1}%
+ \def\temp{#2}%
+ \ifx\temp\empty \else
+ \space ({\unsepspaces \ignorespaces \temp \unskip})%
+ \fi
+}
-% @pounds{} is a sterling sign.
+% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
+%
\def\pounds{{\it\$}}
+% @registeredsymbol - R in a circle. The font for the R should really
+% be smaller yet, but lllsize is the best we can do for now.
+% Adapted from the plain.tex definition of \copyright.
+%
+\def\registeredsymbol{%
+ $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
+ \hfil\crcr\Orb}}%
+ }$%
+}
+
+% Laurent Siebenmann reports \Orb undefined with:
+% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
+% so we'll define it if necessary.
+%
+\ifx\Orb\undefined
+\def\Orb{\mathhexbox20D}
+\fi
+
\message{page headings,}
@@ -1584,86 +1995,103 @@ where each line of input produces a line of output.}
\newif\ifsetshortcontentsaftertitlepage
\let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
-\def\shorttitlepage{\parsearg\shorttitlepagezzz}
-\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
\endgroup\page\hbox{}\page}
-\def\titlepage{\begingroup \parindent=0pt \textfonts
- \let\subtitlerm=\tenrm
- \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
- %
- \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
- %
- % Leave some space at the very top of the page.
- \vglue\titlepagetopglue
- %
- % Now you can print the title using @title.
- \def\title{\parsearg\titlezzz}%
- \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
- % print a rule at the page bottom also.
- \finishedtitlepagefalse
- \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
- % No rule at page bottom unless we print one at the top with @title.
- \finishedtitlepagetrue
- %
- % Now you can put text using @subtitle.
- \def\subtitle{\parsearg\subtitlezzz}%
- \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
- %
- % @author should come last, but may come many times.
- \def\author{\parsearg\authorzzz}%
- \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
- {\authorfont \leftline{##1}}}%
- %
- % Most title ``pages'' are actually two pages long, with space
- % at the top of the second. We don't want the ragged left on the second.
- \let\oldpage = \page
- \def\page{%
+\envdef\titlepage{%
+ % Open one extra group, as we want to close it in the middle of \Etitlepage.
+ \begingroup
+ \parindent=0pt \textfonts
+ % Leave some space at the very top of the page.
+ \vglue\titlepagetopglue
+ % No rule at page bottom unless we print one at the top with @title.
+ \finishedtitlepagetrue
+ %
+ % Most title ``pages'' are actually two pages long, with space
+ % at the top of the second. We don't want the ragged left on the second.
+ \let\oldpage = \page
+ \def\page{%
\iffinishedtitlepage\else
- \finishtitlepage
+ \finishtitlepage
\fi
- \oldpage
\let\page = \oldpage
- \hbox{}}%
-% \def\page{\oldpage \hbox{}}
+ \page
+ \null
+ }%
}
\def\Etitlepage{%
- \iffinishedtitlepage\else
- \finishtitlepage
- \fi
- % It is important to do the page break before ending the group,
- % because the headline and footline are only empty inside the group.
- % If we use the new definition of \page, we always get a blank page
- % after the title page, which we certainly don't want.
- \oldpage
- \endgroup
- %
- % Need this before the \...aftertitlepage checks so that if they are
- % in effect the toc pages will come out with page numbers.
- \HEADINGSon
- %
- % If they want short, they certainly want long too.
- \ifsetshortcontentsaftertitlepage
- \shortcontents
- \contents
- \global\let\shortcontents = \relax
- \global\let\contents = \relax
- \fi
- %
- \ifsetcontentsaftertitlepage
- \contents
- \global\let\contents = \relax
- \global\let\shortcontents = \relax
- \fi
+ \iffinishedtitlepage\else
+ \finishtitlepage
+ \fi
+ % It is important to do the page break before ending the group,
+ % because the headline and footline are only empty inside the group.
+ % If we use the new definition of \page, we always get a blank page
+ % after the title page, which we certainly don't want.
+ \oldpage
+ \endgroup
+ %
+ % Need this before the \...aftertitlepage checks so that if they are
+ % in effect the toc pages will come out with page numbers.
+ \HEADINGSon
+ %
+ % If they want short, they certainly want long too.
+ \ifsetshortcontentsaftertitlepage
+ \shortcontents
+ \contents
+ \global\let\shortcontents = \relax
+ \global\let\contents = \relax
+ \fi
+ %
+ \ifsetcontentsaftertitlepage
+ \contents
+ \global\let\contents = \relax
+ \global\let\shortcontents = \relax
+ \fi
}
\def\finishtitlepage{%
- \vskip4pt \hrule height 2pt width \hsize
- \vskip\titlepagebottomglue
- \finishedtitlepagetrue
+ \vskip4pt \hrule height 2pt width \hsize
+ \vskip\titlepagebottomglue
+ \finishedtitlepagetrue
}
+%%% Macros to be used within @titlepage:
+
+\let\subtitlerm=\tenrm
+\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
+
+\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
+ \let\tt=\authortt}
+
+\parseargdef\title{%
+ \checkenv\titlepage
+ \leftline{\titlefonts\rm #1}
+ % print a rule at the page bottom also.
+ \finishedtitlepagefalse
+ \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+}
+
+\parseargdef\subtitle{%
+ \checkenv\titlepage
+ {\subtitlefont \rightline{#1}}%
+}
+
+% @author should come last, but may come many times.
+% It can also be used inside @quotation.
+%
+\parseargdef\author{%
+ \def\temp{\quotation}%
+ \ifx\thisenv\temp
+ \def\quotationauthor{#1}% printed in \Equotation.
+ \else
+ \checkenv\titlepage
+ \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
+ {\authorfont \leftline{#1}}%
+ \fi
+}
+
+
%%% Set up page headings and footings.
\let\thispage=\folio
@@ -1673,7 +2101,7 @@ where each line of input produces a line of output.}
\newtoks\evenfootline % footline on even pages
\newtoks\oddfootline % footline on odd pages
-% Now make Tex use those variables
+% Now make TeX use those variables
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
\else \the\evenheadline \fi}}
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
@@ -1687,32 +2115,27 @@ where each line of input produces a line of output.}
% @evenfooting @thisfile||
% @oddfooting ||@thisfile
-\def\evenheading{\parsearg\evenheadingxxx}
-\def\oddheading{\parsearg\oddheadingxxx}
-\def\everyheading{\parsearg\everyheadingxxx}
-
-\def\evenfooting{\parsearg\evenfootingxxx}
-\def\oddfooting{\parsearg\oddfootingxxx}
-\def\everyfooting{\parsearg\everyfootingxxx}
-
-{\catcode`\@=0 %
-\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
-\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
+\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
-\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
+\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
-\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
-\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
+\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
-\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
+\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
\global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
%
% Leave some space for the footline. Hopefully ok to assume
@@ -1721,9 +2144,8 @@ where each line of input produces a line of output.}
\global\advance\vsize by -\baselineskip
}
-\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
-%
-}% unbind the catcode of @.
+\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
+
% @headings double turns headings on for double-sided printing.
% @headings single turns headings on for single-sided printing.
@@ -1737,7 +2159,7 @@ where each line of input produces a line of output.}
\def\headings #1 {\csname HEADINGS#1\endcsname}
-\def\HEADINGSoff{
+\def\HEADINGSoff{%
\global\evenheadline={\hfil} \global\evenfootline={\hfil}
\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
\HEADINGSoff
@@ -1746,7 +2168,7 @@ where each line of input produces a line of output.}
% chapter name on inside top of right hand pages, document
% title on inside top of left hand pages, and page numbers on outside top
% edge of all pages.
-\def\HEADINGSdouble{
+\def\HEADINGSdouble{%
\global\pageno=1
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
@@ -1758,7 +2180,7 @@ where each line of input produces a line of output.}
% For single-sided printing, chapter title goes across top left of page,
% page number on top right.
-\def\HEADINGSsingle{
+\def\HEADINGSsingle{%
\global\pageno=1
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
@@ -1805,12 +2227,11 @@ where each line of input produces a line of output.}
% @settitle line... specifies the title of the document, for headings.
% It generates no output of its own.
\def\thistitle{\putwordNoTitle}
-\def\settitle{\parsearg\settitlezzz}
-\def\settitlezzz #1{\gdef\thistitle{#1}}
+\def\settitle{\parsearg{\gdef\thistitle}}
\message{tables,}
-% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
+% Tables -- @table, @ftable, @vtable, @item(x).
% default indentation of table text
\newdimen\tableindent \tableindent=.8in
@@ -1822,7 +2243,7 @@ where each line of input produces a line of output.}
% used internally for \itemindent minus \itemmargin
\newdimen\itemmax
-% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
+% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
% these defs.
% They also define \itemindex
% to index the item name in whatever manner is desired (perhaps none).
@@ -1834,22 +2255,10 @@ where each line of input produces a line of output.}
\def\internalBitem{\smallbreak \parsearg\itemzzz}
\def\internalBitemx{\itemxpar \parsearg\itemzzz}
-\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
-\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
-
-\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
-\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
-
-\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
- \itemzzz {#1}}
-
-\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
- \itemzzz {#1}}
-
\def\itemzzz #1{\begingroup %
\advance\hsize by -\rightskip
\advance\hsize by -\tableindent
- \setbox0=\hbox{\itemfont{#1}}%
+ \setbox0=\hbox{\itemindicate{#1}}%
\itemindex{#1}%
\nobreak % This prevents a break before @itemx.
%
@@ -1873,10 +2282,14 @@ where each line of input produces a line of output.}
% \parskip glue -- logically it's part of the @item we just started.
\nobreak \vskip-\parskip
%
- % Stop a page break at the \parskip glue coming up. Unfortunately
- % we can't prevent a possible page break at the following
- % \baselineskip glue.
- \nobreak
+ % Stop a page break at the \parskip glue coming up. However, if
+ % what follows is an environment such as @example, there will be no
+ % \parskip glue; then the negative vskip we just inserted would
+ % cause the example and the item to crash together. So we use this
+ % bizarre value of 10001 as a signal to \aboveenvbreak to insert
+ % \parskip glue after all. Section titles are handled this way also.
+ %
+ \penalty 10001
\endgroup
\itemxneedsnegativevskipfalse
\else
@@ -1895,97 +2308,95 @@ where each line of input produces a line of output.}
\fi
}
-\def\item{\errmessage{@item while not in a table}}
-\def\itemx{\errmessage{@itemx while not in a table}}
-\def\kitem{\errmessage{@kitem while not in a table}}
-\def\kitemx{\errmessage{@kitemx while not in a table}}
-\def\xitem{\errmessage{@xitem while not in a table}}
-\def\xitemx{\errmessage{@xitemx while not in a table}}
-
-% Contains a kludge to get @end[description] to work.
-\def\description{\tablez{\dontindex}{1}{}{}{}{}}
+\def\item{\errmessage{@item while not in a list environment}}
+\def\itemx{\errmessage{@itemx while not in a list environment}}
% @table, @ftable, @vtable.
-\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
-{\obeylines\obeyspaces%
-\gdef\tablex #1^^M{%
-\tabley\dontindex#1 \endtabley}}
-
-\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
-{\obeylines\obeyspaces%
-\gdef\ftablex #1^^M{%
-\tabley\fnitemindex#1 \endtabley
-\def\Eftable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
-{\obeylines\obeyspaces%
-\gdef\vtablex #1^^M{%
-\tabley\vritemindex#1 \endtabley
-\def\Evtable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\dontindex #1{}
-\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
-\def\vritemindex #1{\doind {vr}{\code{#1}}}%
-
-{\obeyspaces %
-\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
-\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
-
-\def\tablez #1#2#3#4#5#6{%
-\aboveenvbreak %
-\begingroup %
-\def\Edescription{\Etable}% Necessary kludge.
-\let\itemindex=#1%
-\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
-\ifnum 0#4>0 \tableindent=#4\mil \fi %
-\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
-\def\itemfont{#2}%
-\itemmax=\tableindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \tableindent %
-\exdentamount=\tableindent
-\parindent = 0pt
-\parskip = \smallskipamount
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def\Etable{\endgraf\afterenvbreak\endgroup}%
-\let\item = \internalBitem %
-\let\itemx = \internalBitemx %
-\let\kitem = \internalBkitem %
-\let\kitemx = \internalBkitemx %
-\let\xitem = \internalBxitem %
-\let\xitemx = \internalBxitemx %
+\envdef\table{%
+ \let\itemindex\gobble
+ \tablex
+}
+\envdef\ftable{%
+ \def\itemindex ##1{\doind {fn}{\code{##1}}}%
+ \tablex
+}
+\envdef\vtable{%
+ \def\itemindex ##1{\doind {vr}{\code{##1}}}%
+ \tablex
+}
+\def\tablex#1{%
+ \def\itemindicate{#1}%
+ \parsearg\tabley
}
+\def\tabley#1{%
+ {%
+ \makevalueexpandable
+ \edef\temp{\noexpand\tablez #1\space\space\space}%
+ \expandafter
+ }\temp \endtablez
+}
+\def\tablez #1 #2 #3 #4\endtablez{%
+ \aboveenvbreak
+ \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
+ \ifnum 0#2>0 \tableindent=#2\mil \fi
+ \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
+ \itemmax=\tableindent
+ \advance \itemmax by -\itemmargin
+ \advance \leftskip by \tableindent
+ \exdentamount=\tableindent
+ \parindent = 0pt
+ \parskip = \smallskipamount
+ \ifdim \parskip=0pt \parskip=2pt \fi
+ \let\item = \internalBitem
+ \let\itemx = \internalBitemx
+}
+\def\Etable{\endgraf\afterenvbreak}
+\let\Eftable\Etable
+\let\Evtable\Etable
+\let\Eitemize\Etable
+\let\Eenumerate\Etable
% This is the counter used by @enumerate, which is really @itemize
\newcount \itemno
-\def\itemize{\parsearg\itemizezzz}
+\envdef\itemize{\parsearg\doitemize}
-\def\itemizezzz #1{%
- \begingroup % ended by the @end itemize
- \itemizey {#1}{\Eitemize}
+\def\doitemize#1{%
+ \aboveenvbreak
+ \itemmax=\itemindent
+ \advance\itemmax by -\itemmargin
+ \advance\leftskip by \itemindent
+ \exdentamount=\itemindent
+ \parindent=0pt
+ \parskip=\smallskipamount
+ \ifdim\parskip=0pt \parskip=2pt \fi
+ \def\itemcontents{#1}%
+ % @itemize with no arg is equivalent to @itemize @bullet.
+ \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
+ \let\item=\itemizeitem
}
-\def\itemizey #1#2{%
-\aboveenvbreak %
-\itemmax=\itemindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \itemindent %
-\exdentamount=\itemindent
-\parindent = 0pt %
-\parskip = \smallskipamount %
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def#2{\endgraf\afterenvbreak\endgroup}%
-\def\itemcontents{#1}%
-\let\item=\itemizeitem}
-
-% Set sfcode to normal for the chars that usually have another value.
-% These are `.?!:;,'
-\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
- \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
+% Definition of @item while inside @itemize and @enumerate.
+%
+\def\itemizeitem{%
+ \advance\itemno by 1 % for enumerations
+ {\let\par=\endgraf \smallbreak}% reasonable place to break
+ {%
+ % If the document has an @itemize directly after a section title, a
+ % \nobreak will be last on the list, and \sectionheading will have
+ % done a \vskip-\parskip. In that case, we don't want to zero
+ % parskip, or the item text will crash with the heading. On the
+ % other hand, when there is normal text preceding the item (as there
+ % usually is), we do want to zero parskip, or there would be too much
+ % space. In that case, we won't have a \nobreak before. At least
+ % that's the theory.
+ \ifnum\lastpenalty<10000 \parskip=0in \fi
+ \noindent
+ \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
+ \vadjust{\penalty 1200}}% not good to break after first line of item.
+ \flushcr
+}
% \splitoff TOKENS\endmark defines \first to be the first token in
% TOKENS, and \rest to be the remainder.
@@ -1996,11 +2407,8 @@ where each line of input produces a line of output.}
% or number, to specify the first label in the enumerated list. No
% argument is the same as `1'.
%
-\def\enumerate{\parsearg\enumeratezzz}
-\def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
+\envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
\def\enumeratey #1 #2\endenumeratey{%
- \begingroup % ended by the @end enumerate
- %
% If we were given no argument, pretend we were given `1'.
\def\thearg{#1}%
\ifx\thearg\empty \def\thearg{1}\fi
@@ -2071,13 +2479,13 @@ where each line of input produces a line of output.}
}%
}
-% Call itemizey, adding a period to the first argument and supplying the
+% Call \doitemize, adding a period to the first argument and supplying the
% common last two arguments. Also subtract one from the initial value in
% \itemno, since @item increments \itemno.
%
\def\startenumeration#1{%
\advance\itemno by -1
- \itemizey{#1.}\Eenumerate\flushcr
+ \doitemize{#1.}\flushcr
}
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
@@ -2088,16 +2496,6 @@ where each line of input produces a line of output.}
\def\Ealphaenumerate{\Eenumerate}
\def\Ecapsenumerate{\Eenumerate}
-% Definition of @item while inside @itemize.
-
-\def\itemizeitem{%
-\advance\itemno by 1
-{\let\par=\endgraf \smallbreak}%
-\ifhmode \errmessage{In hmode at itemizeitem}\fi
-{\parskip=0in \hskip 0pt
-\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
-\vadjust{\penalty 1200}}%
-\flushcr}
% @multitable macros
% Amy Hendrickson, 8/18/94, 3/6/96
@@ -2124,24 +2522,14 @@ where each line of input produces a line of output.}
% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
% @item ...
% using the widest term desired in each column.
-%
-% For those who want to use more than one line's worth of words in
-% the preamble, break the line within one argument and it
-% will parse correctly, i.e.,
-%
-% @multitable {Column 1 template} {Column 2 template} {Column 3
-% template}
-% Not:
-% @multitable {Column 1 template} {Column 2 template}
-% {Column 3 template}
% Each new table line starts with @item, each subsequent new column
% starts with @tab. Empty columns may be produced by supplying @tab's
% with nothing between them for as many times as empty columns are needed,
% ie, @tab@tab@tab will produce two empty columns.
-% @item, @tab, @multitable or @end multitable do not need to be on their
-% own lines, but it will not hurt if they are.
+% @item, @tab do not need to be on their own lines, but it will not hurt
+% if they are.
% Sample multitable:
@@ -2185,13 +2573,12 @@ where each line of input produces a line of output.}
\def\xcolumnfractions{\columnfractions}
\newif\ifsetpercent
-% #1 is the part of the @columnfraction before the decimal point, which
-% is presumably either 0 or the empty string (but we don't check, we
-% just throw it away). #2 is the decimal part, which we use as the
-% percent of \hsize for this column.
-\def\pickupwholefraction#1.#2 {%
+% #1 is the @columnfraction, usually a decimal number like .5, but might
+% be just 1. We just use it, whatever it is.
+%
+\def\pickupwholefraction#1 {%
\global\advance\colcount by 1
- \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
+ \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
\setuptable
}
@@ -2208,8 +2595,8 @@ where each line of input produces a line of output.}
\let\go\pickupwholefraction
\else
\global\advance\colcount by 1
- \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
- % typically that is always in the input, anyway.
+ \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
+ % separator; typically that is always in the input, anyway.
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
\fi
\fi
@@ -2224,18 +2611,33 @@ where each line of input produces a line of output.}
\go
}
-% This used to have \hskip1sp. But then the space in a template line is
-% not enough. That is bad. So let's go back to just & until we
-% encounter the problem it was intended to solve again.
-% --karl, nathan@acm.org, 20apr99.
-\def\tab{&}
+% multitable-only commands.
+%
+% @headitem starts a heading row, which we typeset in bold.
+% Assignments have to be global since we are inside the implicit group
+% of an alignment entry. Note that \everycr resets \everytab.
+\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
+%
+% A \tab used to include \hskip1sp. But then the space in a template
+% line is not enough. That is bad. So let's go back to just `&' until
+% we encounter the problem it was intended to solve again.
+% --karl, nathan@acm.org, 20apr99.
+\def\tab{\checkenv\multitable &\the\everytab}%
% @multitable ... @end multitable definitions:
%
-\def\multitable{\parsearg\dotable}
-\def\dotable#1{\bgroup
+\newtoks\everytab % insert after every tab.
+%
+\envdef\multitable{%
\vskip\parskip
- \let\item\crcr
+ \startsavinginserts
+ %
+ % @item within a multitable starts a normal row.
+ % We use \def instead of \let so that if one of the multitable entries
+ % contains an @itemize, we don't choke on the \item (seen as \crcr aka
+ % \endtemplate) expanding \doitemize.
+ \def\item{\crcr}%
+ %
\tolerance=9500
\hbadness=9500
\setmultitablespacing
@@ -2243,66 +2645,80 @@ where each line of input produces a line of output.}
\parindent=\multitableparindent
\overfullrule=0pt
\global\colcount=0
- \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
%
+ \everycr = {%
+ \noalign{%
+ \global\everytab={}%
+ \global\colcount=0 % Reset the column counter.
+ % Check for saved footnotes, etc.
+ \checkinserts
+ % Keeps underfull box messages off when table breaks over pages.
+ %\filbreak
+ % Maybe so, but it also creates really weird page breaks when the
+ % table breaks over pages. Wouldn't \vfil be better? Wait until the
+ % problem manifests itself, so it can be fixed for real --karl.
+ }%
+ }%
+ %
+ \parsearg\domultitable
+}
+\def\domultitable#1{%
% To parse everything between @multitable and @item:
\setuptable#1 \endsetuptable
%
- % \everycr will reset column counter, \colcount, at the end of
- % each line. Every column entry will cause \colcount to advance by one.
- % The table preamble
- % looks at the current \colcount to find the correct column width.
- \everycr{\noalign{%
- %
- % \filbreak%% keeps underfull box messages off when table breaks over pages.
- % Maybe so, but it also creates really weird page breaks when the table
- % breaks over pages. Wouldn't \vfil be better? Wait until the problem
- % manifests itself, so it can be fixed for real --karl.
- \global\colcount=0\relax}}%
- %
% This preamble sets up a generic column definition, which will
% be used as many times as user calls for columns.
% \vtop will set a single line and will also let text wrap and
% continue for many paragraphs if desired.
- \halign\bgroup&\global\advance\colcount by 1\relax
- \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
- %
- % In order to keep entries from bumping into each other
- % we will add a \leftskip of \multitablecolspace to all columns after
- % the first one.
- %
- % If a template has been used, we will add \multitablecolspace
- % to the width of each template entry.
- %
- % If the user has set preamble in terms of percent of \hsize we will
- % use that dimension as the width of the column, and the \leftskip
- % will keep entries from bumping into each other. Table will start at
- % left margin and final column will justify at right margin.
- %
- % Make sure we don't inherit \rightskip from the outer environment.
- \rightskip=0pt
- \ifnum\colcount=1
- % The first column will be indented with the surrounding text.
- \advance\hsize by\leftskip
- \else
- \ifsetpercent \else
- % If user has not set preamble in terms of percent of \hsize
- % we will advance \hsize by \multitablecolspace.
- \advance\hsize by \multitablecolspace
- \fi
- % In either case we will make \leftskip=\multitablecolspace:
- \leftskip=\multitablecolspace
- \fi
- % Ignoring space at the beginning and end avoids an occasional spurious
- % blank line, when TeX decides to break the line at the space before the
- % box from the multistrut, so the strut ends up on a line by itself.
- % For example:
- % @multitable @columnfractions .11 .89
- % @item @code{#}
- % @tab Legal holiday which is valid in major parts of the whole country.
- % Is automatically provided with highlighting sequences respectively marking
- % characters.
- \noindent\ignorespaces##\unskip\multistrut}\cr
+ \halign\bgroup &%
+ \global\advance\colcount by 1
+ \multistrut
+ \vtop{%
+ % Use the current \colcount to find the correct column width:
+ \hsize=\expandafter\csname col\the\colcount\endcsname
+ %
+ % In order to keep entries from bumping into each other
+ % we will add a \leftskip of \multitablecolspace to all columns after
+ % the first one.
+ %
+ % If a template has been used, we will add \multitablecolspace
+ % to the width of each template entry.
+ %
+ % If the user has set preamble in terms of percent of \hsize we will
+ % use that dimension as the width of the column, and the \leftskip
+ % will keep entries from bumping into each other. Table will start at
+ % left margin and final column will justify at right margin.
+ %
+ % Make sure we don't inherit \rightskip from the outer environment.
+ \rightskip=0pt
+ \ifnum\colcount=1
+ % The first column will be indented with the surrounding text.
+ \advance\hsize by\leftskip
+ \else
+ \ifsetpercent \else
+ % If user has not set preamble in terms of percent of \hsize
+ % we will advance \hsize by \multitablecolspace.
+ \advance\hsize by \multitablecolspace
+ \fi
+ % In either case we will make \leftskip=\multitablecolspace:
+ \leftskip=\multitablecolspace
+ \fi
+ % Ignoring space at the beginning and end avoids an occasional spurious
+ % blank line, when TeX decides to break the line at the space before the
+ % box from the multistrut, so the strut ends up on a line by itself.
+ % For example:
+ % @multitable @columnfractions .11 .89
+ % @item @code{#}
+ % @tab Legal holiday which is valid in major parts of the whole country.
+ % Is automatically provided with highlighting sequences respectively
+ % marking characters.
+ \noindent\ignorespaces##\unskip\multistrut
+ }\cr
+}
+\def\Emultitable{%
+ \crcr
+ \egroup % end the \halign
+ \global\setpercentfalse
}
\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
@@ -2334,294 +2750,172 @@ width0pt\relax} \fi
\message{conditionals,}
-% Prevent errors for section commands.
-% Used in @ignore and in failing conditionals.
-\def\ignoresections{%
- \let\chapter=\relax
- \let\unnumbered=\relax
- \let\top=\relax
- \let\unnumberedsec=\relax
- \let\unnumberedsection=\relax
- \let\unnumberedsubsec=\relax
- \let\unnumberedsubsection=\relax
- \let\unnumberedsubsubsec=\relax
- \let\unnumberedsubsubsection=\relax
- \let\section=\relax
- \let\subsec=\relax
- \let\subsubsec=\relax
- \let\subsection=\relax
- \let\subsubsection=\relax
- \let\appendix=\relax
- \let\appendixsec=\relax
- \let\appendixsection=\relax
- \let\appendixsubsec=\relax
- \let\appendixsubsection=\relax
- \let\appendixsubsubsec=\relax
- \let\appendixsubsubsection=\relax
- \let\contents=\relax
- \let\smallbook=\relax
- \let\titlepage=\relax
-}
-
-% Used in nested conditionals, where we have to parse the Texinfo source
-% and so want to turn off most commands, in case they are used
-% incorrectly.
-%
-\def\ignoremorecommands{%
- \let\defcodeindex = \relax
- \let\defcv = \relax
- \let\deffn = \relax
- \let\deffnx = \relax
- \let\defindex = \relax
- \let\defivar = \relax
- \let\defmac = \relax
- \let\defmethod = \relax
- \let\defop = \relax
- \let\defopt = \relax
- \let\defspec = \relax
- \let\deftp = \relax
- \let\deftypefn = \relax
- \let\deftypefun = \relax
- \let\deftypeivar = \relax
- \let\deftypeop = \relax
- \let\deftypevar = \relax
- \let\deftypevr = \relax
- \let\defun = \relax
- \let\defvar = \relax
- \let\defvr = \relax
- \let\ref = \relax
- \let\xref = \relax
- \let\printindex = \relax
- \let\pxref = \relax
- \let\settitle = \relax
- \let\setchapternewpage = \relax
- \let\setchapterstyle = \relax
- \let\everyheading = \relax
- \let\evenheading = \relax
- \let\oddheading = \relax
- \let\everyfooting = \relax
- \let\evenfooting = \relax
- \let\oddfooting = \relax
- \let\headings = \relax
- \let\include = \relax
- \let\lowersections = \relax
- \let\down = \relax
- \let\raisesections = \relax
- \let\up = \relax
- \let\set = \relax
- \let\clear = \relax
- \let\item = \relax
-}
-
-% Ignore @ignore, @ifhtml, @ifinfo, @ifplaintext, @ifnottex, @html, @menu,
-% @direntry, and @documentdescription.
+
+% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
+% @ifnotxml always succeed. They currently do nothing; we don't
+% attempt to check whether the conditionals are properly nested. But we
+% have to remember that they are conditionals, so that @end doesn't
+% attempt to close an environment group.
%
-\def\ignore{\doignore{ignore}}
+\def\makecond#1{%
+ \expandafter\let\csname #1\endcsname = \relax
+ \expandafter\let\csname iscond.#1\endcsname = 1
+}
+\makecond{iftex}
+\makecond{ifnotdocbook}
+\makecond{ifnothtml}
+\makecond{ifnotinfo}
+\makecond{ifnotplaintext}
+\makecond{ifnotxml}
+
+% Ignore @ignore, @ifhtml, @ifinfo, and the like.
+%
+\def\direntry{\doignore{direntry}}
+\def\documentdescription{\doignore{documentdescription}}
+\def\docbook{\doignore{docbook}}
+\def\html{\doignore{html}}
+\def\ifdocbook{\doignore{ifdocbook}}
\def\ifhtml{\doignore{ifhtml}}
\def\ifinfo{\doignore{ifinfo}}
-\def\ifplaintext{\doignore{ifplaintext}}
\def\ifnottex{\doignore{ifnottex}}
-\def\html{\doignore{html}}
+\def\ifplaintext{\doignore{ifplaintext}}
+\def\ifxml{\doignore{ifxml}}
+\def\ignore{\doignore{ignore}}
\def\menu{\doignore{menu}}
-\def\direntry{\doignore{direntry}}
-\def\documentdescription{\doignore{documentdescription}}
-\def\documentdescriptionword{documentdescription}
-
-% @dircategory CATEGORY -- specify a category of the dir file
-% which this file should belong to. Ignore this in TeX.
-\let\dircategory = \comment
+\def\xml{\doignore{xml}}
-% Ignore text until a line `@end #1'.
+% Ignore text until a line `@end #1', keeping track of nested conditionals.
%
+% A count to remember the depth of nesting.
+\newcount\doignorecount
+
\def\doignore#1{\begingroup
- % Don't complain about control sequences we have declared \outer.
- \ignoresections
- %
- % Define a command to swallow text until we reach `@end #1'.
- % This @ is a catcode 12 token (that is the normal catcode of @ in
- % this texinfo.tex file). We change the catcode of @ below to match.
- \long\def\doignoretext##1@end #1{\enddoignore}%
+ % Scan in ``verbatim'' mode:
+ \catcode`\@ = \other
+ \catcode`\{ = \other
+ \catcode`\} = \other
%
% Make sure that spaces turn into tokens that match what \doignoretext wants.
- \catcode32 = 10
- %
- % Ignore braces, too, so mismatched braces don't cause trouble.
- \catcode`\{ = 9
- \catcode`\} = 9
+ \spaceisspace
%
- % We must not have @c interpreted as a control sequence.
- \catcode`\@ = 12
- %
- \def\ignoreword{#1}%
- \ifx\ignoreword\documentdescriptionword
- % The c kludge breaks documentdescription, since
- % `documentdescription' contains a `c'. Means not everything will
- % be ignored inside @documentdescription, but oh well...
- \else
- % Make the letter c a comment character so that the rest of the line
- % will be ignored. This way, the document can have (for example)
- % @c @end ifinfo
- % and the @end ifinfo will be properly ignored.
- % (We've just changed @ to catcode 12.)
- \catcode`\c = 14
- \fi
+ % Count number of #1's that we've seen.
+ \doignorecount = 0
%
- % And now expand the command defined above.
- \doignoretext
-}
-
-% What we do to finish off ignored text.
-%
-\def\enddoignore{\endgroup\ignorespaces}%
-
-\newif\ifwarnedobs\warnedobsfalse
-\def\obstexwarn{%
- \ifwarnedobs\relax\else
- % We need to warn folks that they may have trouble with TeX 3.0.
- % This uses \immediate\write16 rather than \message to get newlines.
- \immediate\write16{}
- \immediate\write16{WARNING: for users of Unix TeX 3.0!}
- \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
- \immediate\write16{If you are running another version of TeX, relax.}
- \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
- \immediate\write16{ Then upgrade your TeX installation if you can.}
- \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
- \immediate\write16{If you are stuck with version 3.0, run the}
- \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
- \immediate\write16{ to use a workaround.}
- \immediate\write16{}
- \global\warnedobstrue
- \fi
+ % Swallow text until we reach the matching `@end #1'.
+ \dodoignore{#1}%
}
-% **In TeX 3.0, setting text in \nullfont hangs tex. For a
-% workaround (which requires the file ``dummy.tfm'' to be installed),
-% uncomment the following line:
-%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
-
-% Ignore text, except that we keep track of conditional commands for
-% purposes of nesting, up to an `@end #1' command.
-%
-\def\nestedignore#1{%
- \obstexwarn
- % We must actually expand the ignored text to look for the @end
- % command, so that nested ignore constructs work. Thus, we put the
- % text into a \vbox and then do nothing with the result. To minimize
- % the change of memory overflow, we follow the approach outlined on
- % page 401 of the TeXbook: make the current font be a dummy font.
+{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
+ \obeylines %
%
- \setbox0 = \vbox\bgroup
- % Don't complain about control sequences we have declared \outer.
- \ignoresections
- %
- % Define `@end #1' to end the box, which will in turn undefine the
- % @end command again.
- \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
+ \gdef\dodoignore#1{%
+ % #1 contains the command name as a string, e.g., `ifinfo'.
%
- % We are going to be parsing Texinfo commands. Most cause no
- % trouble when they are used incorrectly, but some commands do
- % complicated argument parsing or otherwise get confused, so we
- % undefine them.
+ % Define a command to find the next `@end #1', which must be on a line
+ % by itself.
+ \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}%
+ % And this command to find another #1 command, at the beginning of a
+ % line. (Otherwise, we would consider a line `@c @ifset', for
+ % example, to count as an @ifset for nesting.)
+ \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
%
- % We can't do anything about stray @-signs, unfortunately;
- % they'll produce `undefined control sequence' errors.
- \ignoremorecommands
- %
- % Set the current font to be \nullfont, a TeX primitive, and define
- % all the font commands to also use \nullfont. We don't use
- % dummy.tfm, as suggested in the TeXbook, because not all sites
- % might have that installed. Therefore, math mode will still
- % produce output, but that should be an extremely small amount of
- % stuff compared to the main input.
- %
- \nullfont
- \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
- \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
- \let\tensf=\nullfont
- % Similarly for index fonts.
- \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
- \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
- \let\smallsf=\nullfont
- % Similarly for smallexample fonts.
- \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont
- \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont
- \let\smallersf=\nullfont
- %
- % Don't complain when characters are missing from the fonts.
- \tracinglostchars = 0
- %
- % Don't bother to do space factor calculations.
- \frenchspacing
- %
- % Don't report underfull hboxes.
- \hbadness = 10000
- %
- % Do minimal line-breaking.
- \pretolerance = 10000
- %
- % Do not execute instructions in @tex
- \def\tex{\doignore{tex}}%
- % Do not execute macro definitions.
- % `c' is a comment character, so the word `macro' will get cut off.
- \def\macro{\doignore{ma}}%
+ % And now expand that command.
+ \obeylines %
+ \doignoretext ^^M%
+ }%
+}
+
+\def\doignoreyyy#1{%
+ \def\temp{#1}%
+ \ifx\temp\empty % Nothing found.
+ \let\next\doignoretextzzz
+ \else % Found a nested condition, ...
+ \advance\doignorecount by 1
+ \let\next\doignoretextyyy % ..., look for another.
+ % If we're here, #1 ends with ^^M\ifinfo (for example).
+ \fi
+ \next #1% the token \_STOP_ is present just after this macro.
+}
+
+% We have to swallow the remaining "\_STOP_".
+%
+\def\doignoretextzzz#1{%
+ \ifnum\doignorecount = 0 % We have just found the outermost @end.
+ \let\next\enddoignore
+ \else % Still inside a nested condition.
+ \advance\doignorecount by -1
+ \let\next\doignoretext % Look for the next @end.
+ \fi
+ \next
}
+% Finish off ignored text.
+\def\enddoignore{\endgroup\ignorespaces}
+
+
% @set VAR sets the variable VAR to an empty value.
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
%
% Since we want to separate VAR from REST-OF-LINE (which might be
% empty), we can't just use \parsearg; we have to insert a space of our
% own to delimit the rest of the line, and then take it out again if we
-% didn't need it. Make sure the catcode of space is correct to avoid
-% losing inside @example, for instance.
+% didn't need it.
+% We rely on the fact that \parsearg sets \catcode`\ =10.
%
-\def\set{\begingroup\catcode` =10
- \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
- \parsearg\setxxx}
-\def\setxxx#1{\setyyy#1 \endsetyyy}
+\parseargdef\set{\setyyy#1 \endsetyyy}
\def\setyyy#1 #2\endsetyyy{%
- \def\temp{#2}%
- \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
- \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
- \fi
- \endgroup
+ {%
+ \makevalueexpandable
+ \def\temp{#2}%
+ \edef\next{\gdef\makecsname{SET#1}}%
+ \ifx\temp\empty
+ \next{}%
+ \else
+ \setzzz#2\endsetzzz
+ \fi
+ }%
}
-% Can't use \xdef to pre-expand #2 and save some time, since \temp or
-% \next or other control sequences that we've defined might get us into
-% an infinite loop. Consider `@set foo @cite{bar}'.
-\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
+% Remove the trailing space \setxxx inserted.
+\def\setzzz#1 \endsetzzz{\next{#1}}
% @clear VAR clears (i.e., unsets) the variable VAR.
%
-\def\clear{\parsearg\clearxxx}
-\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
+\parseargdef\clear{%
+ {%
+ \makevalueexpandable
+ \global\expandafter\let\csname SET#1\endcsname=\relax
+ }%
+}
% @value{foo} gets the text saved in variable foo.
+\def\value{\begingroup\makevalueexpandable\valuexxx}
+\def\valuexxx#1{\expandablevalue{#1}\endgroup}
{
- \catcode`\_ = \active
+ \catcode`\- = \active \catcode`\_ = \active
%
- % We might end up with active _ or - characters in the argument if
- % we're called from @code, as @code{@value{foo-bar_}}. So \let any
- % such active characters to their normal equivalents.
- \gdef\value{\begingroup
- \catcode`\-=12 \catcode`\_=12
- \indexbreaks \let_\normalunderscore
- \valuexxx}
+ \gdef\makevalueexpandable{%
+ \let\value = \expandablevalue
+ % We don't want these characters active, ...
+ \catcode`\-=\other \catcode`\_=\other
+ % ..., but we might end up with active ones in the argument if
+ % we're called from @code, as @code{@value{foo-bar_}}, though.
+ % So \let them to their normal equivalents.
+ \let-\realdash \let_\normalunderscore
+ }
}
-\def\valuexxx#1{\expandablevalue{#1}\endgroup}
% We have this subroutine so that we can handle at least some @value's
-% properly in indexes (we \let\value to this in \indexdummies). Ones
-% whose names contain - or _ still won't work, but we can't do anything
-% about that. The command has to be fully expandable, since the result
-% winds up in the index file. This means that if the variable's value
-% contains other Texinfo commands, it's almost certain it will fail
-% (although perhaps we could fix that with sufficient work to do a
-% one-level expansion on the result, instead of complete).
+% properly in indexes (we call \makevalueexpandable in \indexdummies).
+% The command has to be fully expandable (if the variable is set), since
+% the result winds up in the index file. This means that if the
+% variable's value contains other Texinfo commands, it's almost certain
+% it will fail (although perhaps we could fix that with sufficient work
+% to do a one-level expansion on the result, instead of complete).
%
\def\expandablevalue#1{%
\expandafter\ifx\csname SET#1\endcsname\relax
{[No value for ``#1'']}%
+ \message{Variable `#1', used in @value, is not set.}%
\else
\csname SET#1\endcsname
\fi
@@ -2630,68 +2924,36 @@ width0pt\relax} \fi
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
% with @set.
%
-\def\ifset{\parsearg\ifsetxxx}
-\def\ifsetxxx #1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- \expandafter\ifsetfail
- \else
- \expandafter\ifsetsucceed
- \fi
+% To get special treatment of `@end ifset,' call \makeond and the redefine.
+%
+\makecond{ifset}
+\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
+\def\doifset#1#2{%
+ {%
+ \makevalueexpandable
+ \let\next=\empty
+ \expandafter\ifx\csname SET#2\endcsname\relax
+ #1% If not set, redefine \next.
+ \fi
+ \expandafter
+ }\next
}
-\def\ifsetsucceed{\conditionalsucceed{ifset}}
-\def\ifsetfail{\nestedignore{ifset}}
-\defineunmatchedend{ifset}
+\def\ifsetfail{\doignore{ifset}}
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
% defined with @set, or has been undefined with @clear.
%
-\def\ifclear{\parsearg\ifclearxxx}
-\def\ifclearxxx #1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- \expandafter\ifclearsucceed
- \else
- \expandafter\ifclearfail
- \fi
-}
-\def\ifclearsucceed{\conditionalsucceed{ifclear}}
-\def\ifclearfail{\nestedignore{ifclear}}
-\defineunmatchedend{ifclear}
-
-% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
-% read the text following, through the first @end iftex (etc.). Make
-% `@end iftex' (etc.) valid only after an @iftex.
-%
-\def\iftex{\conditionalsucceed{iftex}}
-\def\ifnothtml{\conditionalsucceed{ifnothtml}}
-\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
-\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
-\defineunmatchedend{iftex}
-\defineunmatchedend{ifnothtml}
-\defineunmatchedend{ifnotinfo}
-\defineunmatchedend{ifnotplaintext}
-
-% We can't just want to start a group at @iftex (etc.) and end it at
-% @end iftex, since then @set commands inside the conditional have no
-% effect (they'd get reverted at the end of the group). So we must
-% define \Eiftex to redefine itself to be its previous value. (We can't
-% just define it to fail again with an ``unmatched end'' error, since
-% the @ifset might be nested.)
-%
-\def\conditionalsucceed#1{%
- \edef\temp{%
- % Remember the current value of \E#1.
- \let\nece{prevE#1} = \nece{E#1}%
- %
- % At the `@end #1', redefine \E#1 to be its previous value.
- \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
- }%
- \temp
-}
-
-% We need to expand lots of \csname's, but we don't want to expand the
-% control sequences after we've constructed them.
+% The `\else' inside the `\doifset' parameter is a trick to reuse the
+% above code: if the variable is not set, do nothing, if it is set,
+% then redefine \next to \ifclearfail.
%
-\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
+\makecond{ifclear}
+\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
+\def\ifclearfail{\doignore{ifclear}}
+
+% @dircategory CATEGORY -- specify a category of the dir file
+% which this file should belong to. Ignore this in TeX.
+\let\dircategory=\comment
% @defininfoenclose.
\let\definfoenclose=\comment
@@ -2742,10 +3004,10 @@ width0pt\relax} \fi
% @synindex foo bar makes index foo feed into index bar.
% Do this instead of @defindex foo if you don't want it as a separate index.
-%
+%
% @syncodeindex foo bar similar, but put all entries made for index foo
% inside @code.
-%
+%
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
@@ -2784,284 +3046,402 @@ width0pt\relax} \fi
\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
-% Take care of texinfo commands likely to appear in an index entry.
-% (Must be a way to avoid doing expansion at all, and thus not have to
-% laboriously list every single command here.)
-%
+% Take care of Texinfo commands that can appear in an index entry.
+% Since there are some commands we want to expand, and others we don't,
+% we have to laboriously prevent expansion for those that we don't.
+%
\def\indexdummies{%
-\def\ { }%
-\def\@{@}% change to @@ when we switch to @ as escape char in aux files.
-% Need these in case \tex is in effect and \{ is a \delimiter again.
-% But can't use \lbracecmd and \rbracecmd because texindex assumes
-% braces and backslashes are used only as delimiters.
-\let\{ = \mylbrace
-\let\} = \myrbrace
-\def\_{{\realbackslash _}}%
-\normalturnoffactive
-%
-% Take care of the plain tex accent commands.
-\def\,##1{\realbackslash ,{##1}}%
-\def\"{\realbackslash "}%
-\def\`{\realbackslash `}%
-\def\'{\realbackslash '}%
-\def\^{\realbackslash ^}%
-\def\~{\realbackslash ~}%
-\def\={\realbackslash =}%
-\def\b{\realbackslash b}%
-\def\c{\realbackslash c}%
-\def\d{\realbackslash d}%
-\def\u{\realbackslash u}%
-\def\v{\realbackslash v}%
-\def\H{\realbackslash H}%
-\def\dotless##1{\realbackslash dotless {##1}}%
-% Take care of the plain tex special European modified letters.
-\def\AA{\realbackslash AA}%
-\def\AE{\realbackslash AE}%
-\def\L{\realbackslash L}%
-\def\OE{\realbackslash OE}%
-\def\O{\realbackslash O}%
-\def\aa{\realbackslash aa}%
-\def\ae{\realbackslash ae}%
-\def\l{\realbackslash l}%
-\def\oe{\realbackslash oe}%
-\def\o{\realbackslash o}%
-\def\ss{\realbackslash ss}%
-%
-% Although these internals commands shouldn't show up, sometimes they do.
-\def\bf{\realbackslash bf }%
-\def\gtr{\realbackslash gtr}%
-\def\hat{\realbackslash hat}%
-\def\less{\realbackslash less}%
-%\def\rm{\realbackslash rm }%
-\def\sf{\realbackslash sf}%
-\def\sl{\realbackslash sl }%
-\def\tclose##1{\realbackslash tclose {##1}}%
-\def\tt{\realbackslash tt}%
-%
-\def\b##1{\realbackslash b {##1}}%
-\def\i##1{\realbackslash i {##1}}%
-\def\sc##1{\realbackslash sc {##1}}%
-\def\t##1{\realbackslash t {##1}}%
-\def\r##1{\realbackslash r {##1}}%
-%
-\def\TeX{\realbackslash TeX}%
-\def\acronym##1{\realbackslash acronym {##1}}%
-\def\cite##1{\realbackslash cite {##1}}%
-\def\code##1{\realbackslash code {##1}}%
-\def\command##1{\realbackslash command {##1}}%
-\def\dfn##1{\realbackslash dfn {##1}}%
-\def\dots{\realbackslash dots }%
-\def\emph##1{\realbackslash emph {##1}}%
-\def\env##1{\realbackslash env {##1}}%
-\def\file##1{\realbackslash file {##1}}%
-\def\kbd##1{\realbackslash kbd {##1}}%
-\def\key##1{\realbackslash key {##1}}%
-\def\math##1{\realbackslash math {##1}}%
-\def\option##1{\realbackslash option {##1}}%
-\def\samp##1{\realbackslash samp {##1}}%
-\def\strong##1{\realbackslash strong {##1}}%
-\def\uref##1{\realbackslash uref {##1}}%
-\def\url##1{\realbackslash url {##1}}%
-\def\var##1{\realbackslash var {##1}}%
-\def\w{\realbackslash w }%
-%
-% These math commands don't seem likely to be used in index entries.
-\def\copyright{\realbackslash copyright}%
-\def\equiv{\realbackslash equiv}%
-\def\error{\realbackslash error}%
-\def\expansion{\realbackslash expansion}%
-\def\point{\realbackslash point}%
-\def\print{\realbackslash print}%
-\def\result{\realbackslash result}%
-%
-% Handle some cases of @value -- where the variable name does not
-% contain - or _, and the value does not contain any
-% (non-fully-expandable) commands.
-\let\value = \expandablevalue
-%
-\unsepspaces
-% Turn off macro expansion
-\turnoffmacros
-}
-
-% If an index command is used in an @example environment, any spaces
-% therein should become regular spaces in the raw index file, not the
-% expansion of \tie (\leavevmode \penalty \@M \ ).
-{\obeyspaces
- \gdef\unsepspaces{\obeyspaces\let =\space}}
-
-% \indexnofonts no-ops all font-change commands.
-% This is used when outputting the strings to sort the index by.
-\def\indexdummyfont#1{#1}
-\def\indexdummytex{TeX}
-\def\indexdummydots{...}
+ \def\@{@}% change to @@ when we switch to @ as escape char in index files.
+ \def\ {\realbackslash\space }%
+ % Need these in case \tex is in effect and \{ is a \delimiter again.
+ % But can't use \lbracecmd and \rbracecmd because texindex assumes
+ % braces and backslashes are used only as delimiters.
+ \let\{ = \mylbrace
+ \let\} = \myrbrace
+ %
+ % \definedummyword defines \#1 as \realbackslash #1\space, thus
+ % effectively preventing its expansion. This is used only for control
+ % words, not control letters, because the \space would be incorrect
+ % for control characters, but is needed to separate the control word
+ % from whatever follows.
+ %
+ % For control letters, we have \definedummyletter, which omits the
+ % space.
+ %
+ % These can be used both for control words that take an argument and
+ % those that do not. If it is followed by {arg} in the input, then
+ % that will dutifully get written to the index (or wherever).
+ %
+ \def\definedummyword##1{%
+ \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
+ }%
+ \def\definedummyletter##1{%
+ \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
+ }%
+ \let\definedummyaccent\definedummyletter
+ %
+ % Do the redefinitions.
+ \commondummies
+}
+
+% For the aux file, @ is the escape character. So we want to redefine
+% everything using @ instead of \realbackslash. When everything uses
+% @, this will be simpler.
+%
+\def\atdummies{%
+ \def\@{@@}%
+ \def\ {@ }%
+ \let\{ = \lbraceatcmd
+ \let\} = \rbraceatcmd
+ %
+ % (See comments in \indexdummies.)
+ \def\definedummyword##1{%
+ \expandafter\def\csname ##1\endcsname{@##1\space}%
+ }%
+ \def\definedummyletter##1{%
+ \expandafter\def\csname ##1\endcsname{@##1}%
+ }%
+ \let\definedummyaccent\definedummyletter
+ %
+ % Do the redefinitions.
+ \commondummies
+}
+
+% Called from \indexdummies and \atdummies. \definedummyword and
+% \definedummyletter must be defined first.
+%
+\def\commondummies{%
+ %
+ \normalturnoffactive
+ %
+ \commondummiesnofonts
+ %
+ \definedummyletter{_}%
+ %
+ % Non-English letters.
+ \definedummyword{AA}%
+ \definedummyword{AE}%
+ \definedummyword{L}%
+ \definedummyword{OE}%
+ \definedummyword{O}%
+ \definedummyword{aa}%
+ \definedummyword{ae}%
+ \definedummyword{l}%
+ \definedummyword{oe}%
+ \definedummyword{o}%
+ \definedummyword{ss}%
+ \definedummyword{exclamdown}%
+ \definedummyword{questiondown}%
+ \definedummyword{ordf}%
+ \definedummyword{ordm}%
+ %
+ % Although these internal commands shouldn't show up, sometimes they do.
+ \definedummyword{bf}%
+ \definedummyword{gtr}%
+ \definedummyword{hat}%
+ \definedummyword{less}%
+ \definedummyword{sf}%
+ \definedummyword{sl}%
+ \definedummyword{tclose}%
+ \definedummyword{tt}%
+ %
+ \definedummyword{LaTeX}%
+ \definedummyword{TeX}%
+ %
+ % Assorted special characters.
+ \definedummyword{bullet}%
+ \definedummyword{comma}%
+ \definedummyword{copyright}%
+ \definedummyword{registeredsymbol}%
+ \definedummyword{dots}%
+ \definedummyword{enddots}%
+ \definedummyword{equiv}%
+ \definedummyword{error}%
+ \definedummyword{expansion}%
+ \definedummyword{minus}%
+ \definedummyword{pounds}%
+ \definedummyword{point}%
+ \definedummyword{print}%
+ \definedummyword{result}%
+ %
+ % Handle some cases of @value -- where it does not contain any
+ % (non-fully-expandable) commands.
+ \makevalueexpandable
+ %
+ % Normal spaces, not active ones.
+ \unsepspaces
+ %
+ % No macro expansion.
+ \turnoffmacros
+}
+% \commondummiesnofonts: common to \commondummies and \indexnofonts.
+%
+% Better have this without active chars.
+{
+ \catcode`\~=\other
+ \gdef\commondummiesnofonts{%
+ % Control letters and accents.
+ \definedummyletter{!}%
+ \definedummyaccent{"}%
+ \definedummyaccent{'}%
+ \definedummyletter{*}%
+ \definedummyaccent{,}%
+ \definedummyletter{.}%
+ \definedummyletter{/}%
+ \definedummyletter{:}%
+ \definedummyaccent{=}%
+ \definedummyletter{?}%
+ \definedummyaccent{^}%
+ \definedummyaccent{`}%
+ \definedummyaccent{~}%
+ \definedummyword{u}%
+ \definedummyword{v}%
+ \definedummyword{H}%
+ \definedummyword{dotaccent}%
+ \definedummyword{ringaccent}%
+ \definedummyword{tieaccent}%
+ \definedummyword{ubaraccent}%
+ \definedummyword{udotaccent}%
+ \definedummyword{dotless}%
+ %
+ % Texinfo font commands.
+ \definedummyword{b}%
+ \definedummyword{i}%
+ \definedummyword{r}%
+ \definedummyword{sc}%
+ \definedummyword{t}%
+ %
+ % Commands that take arguments.
+ \definedummyword{acronym}%
+ \definedummyword{cite}%
+ \definedummyword{code}%
+ \definedummyword{command}%
+ \definedummyword{dfn}%
+ \definedummyword{emph}%
+ \definedummyword{env}%
+ \definedummyword{file}%
+ \definedummyword{kbd}%
+ \definedummyword{key}%
+ \definedummyword{math}%
+ \definedummyword{option}%
+ \definedummyword{samp}%
+ \definedummyword{strong}%
+ \definedummyword{tie}%
+ \definedummyword{uref}%
+ \definedummyword{url}%
+ \definedummyword{var}%
+ \definedummyword{verb}%
+ \definedummyword{w}%
+ }
+}
+
+% \indexnofonts is used when outputting the strings to sort the index
+% by, and when constructing control sequence names. It eliminates all
+% control sequences and just writes whatever the best ASCII sort string
+% would be for a given command (usually its argument).
+%
\def\indexnofonts{%
-\def\@{@}%
-% how to handle braces?
-\def\_{\normalunderscore}%
-%
-\let\,=\indexdummyfont
-\let\"=\indexdummyfont
-\let\`=\indexdummyfont
-\let\'=\indexdummyfont
-\let\^=\indexdummyfont
-\let\~=\indexdummyfont
-\let\==\indexdummyfont
-\let\b=\indexdummyfont
-\let\c=\indexdummyfont
-\let\d=\indexdummyfont
-\let\u=\indexdummyfont
-\let\v=\indexdummyfont
-\let\H=\indexdummyfont
-\let\dotless=\indexdummyfont
-% Take care of the plain tex special European modified letters.
-\def\AA{AA}%
-\def\AE{AE}%
-\def\L{L}%
-\def\OE{OE}%
-\def\O{O}%
-\def\aa{aa}%
-\def\ae{ae}%
-\def\l{l}%
-\def\oe{oe}%
-\def\o{o}%
-\def\ss{ss}%
-%
-% Don't no-op \tt, since it isn't a user-level command
-% and is used in the definitions of the active chars like <, >, |, etc.
-% Likewise with the other plain tex font commands.
-%\let\tt=\indexdummyfont
-%
-\let\b=\indexdummyfont
-\let\i=\indexdummyfont
-\let\r=\indexdummyfont
-\let\sc=\indexdummyfont
-\let\t=\indexdummyfont
-%
-\let\TeX=\indexdummytex
-\let\acronym=\indexdummyfont
-\let\cite=\indexdummyfont
-\let\code=\indexdummyfont
-\let\command=\indexdummyfont
-\let\dfn=\indexdummyfont
-\let\dots=\indexdummydots
-\let\emph=\indexdummyfont
-\let\env=\indexdummyfont
-\let\file=\indexdummyfont
-\let\kbd=\indexdummyfont
-\let\key=\indexdummyfont
-\let\math=\indexdummyfont
-\let\option=\indexdummyfont
-\let\samp=\indexdummyfont
-\let\strong=\indexdummyfont
-\let\uref=\indexdummyfont
-\let\url=\indexdummyfont
-\let\var=\indexdummyfont
-\let\w=\indexdummyfont
-}
-
-% To define \realbackslash, we must make \ not be an escape.
-% We must first make another character (@) an escape
-% so we do not become unable to do a definition.
-
-{\catcode`\@=0 \catcode`\\=\other
- @gdef@realbackslash{\}}
+ % Accent commands should become @asis.
+ \def\definedummyaccent##1{%
+ \expandafter\let\csname ##1\endcsname\asis
+ }%
+ % We can just ignore other control letters.
+ \def\definedummyletter##1{%
+ \expandafter\def\csname ##1\endcsname{}%
+ }%
+ % Hopefully, all control words can become @asis.
+ \let\definedummyword\definedummyaccent
+ %
+ \commondummiesnofonts
+ %
+ % Don't no-op \tt, since it isn't a user-level command
+ % and is used in the definitions of the active chars like <, >, |, etc.
+ % Likewise with the other plain tex font commands.
+ %\let\tt=\asis
+ %
+ \def\ { }%
+ \def\@{@}%
+ % how to handle braces?
+ \def\_{\normalunderscore}%
+ %
+ % Non-English letters.
+ \def\AA{AA}%
+ \def\AE{AE}%
+ \def\L{L}%
+ \def\OE{OE}%
+ \def\O{O}%
+ \def\aa{aa}%
+ \def\ae{ae}%
+ \def\l{l}%
+ \def\oe{oe}%
+ \def\o{o}%
+ \def\ss{ss}%
+ \def\exclamdown{!}%
+ \def\questiondown{?}%
+ \def\ordf{a}%
+ \def\ordm{o}%
+ %
+ \def\LaTeX{LaTeX}%
+ \def\TeX{TeX}%
+ %
+ % Assorted special characters.
+ % (The following {} will end up in the sort string, but that's ok.)
+ \def\bullet{bullet}%
+ \def\comma{,}%
+ \def\copyright{copyright}%
+ \def\registeredsymbol{R}%
+ \def\dots{...}%
+ \def\enddots{...}%
+ \def\equiv{==}%
+ \def\error{error}%
+ \def\expansion{==>}%
+ \def\minus{-}%
+ \def\pounds{pounds}%
+ \def\point{.}%
+ \def\print{-|}%
+ \def\result{=>}%
+ %
+ % Don't write macro names.
+ \emptyusermacros
+}
\let\indexbackslash=0 %overridden during \printindex.
\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
-% For \ifx comparisons.
-\def\emptymacro{\empty}
-
% Most index entries go through here, but \dosubind is the general case.
-%
-\def\doind#1#2{\dosubind{#1}{#2}\empty}
+% #1 is the index name, #2 is the entry text.
+\def\doind#1#2{\dosubind{#1}{#2}{}}
% Workhorse for all \fooindexes.
% #1 is name of index, #2 is stuff to put there, #3 is subentry --
-% \empty if called from \doind, as we usually are. The main exception
-% is with defuns, which call us directly.
+% empty if called from \doind, as we usually are (the main exception
+% is with most defuns, which call us directly).
%
\def\dosubind#1#2#3{%
+ \iflinks
+ {%
+ % Store the main index entry text (including the third arg).
+ \toks0 = {#2}%
+ % If third arg is present, precede it with a space.
+ \def\thirdarg{#3}%
+ \ifx\thirdarg\empty \else
+ \toks0 = \expandafter{\the\toks0 \space #3}%
+ \fi
+ %
+ \edef\writeto{\csname#1indfile\endcsname}%
+ %
+ \ifvmode
+ \dosubindsanitize
+ \else
+ \dosubindwrite
+ \fi
+ }%
+ \fi
+}
+
+% Write the entry in \toks0 to the index file:
+%
+\def\dosubindwrite{%
% Put the index entry in the margin if desired.
\ifx\SETmarginindex\relax\else
- \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
+ \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
\fi
- {%
- \count255=\lastpenalty
- {%
- \indexdummies % Must do this here, since \bf, etc expand at this stage
- \escapechar=`\\
- {%
- \let\folio = 0% We will expand all macros now EXCEPT \folio.
- \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
- % so it will be output as is; and it will print as backslash.
- %
- \def\thirdarg{#3}%
- %
- % If third arg is present, precede it with space in sort key.
- \ifx\thirdarg\emptymacro
- \let\subentry = \empty
- \else
- \def\subentry{ #3}%
- \fi
- %
- % First process the index entry with all font commands turned
- % off to get the string to sort by.
- {\indexnofonts \xdef\indexsorttmp{#2\subentry}}%
- %
- % Now the real index entry with the fonts.
- \toks0 = {#2}%
- %
- % If the third (subentry) arg is present, add it to the index
- % line to write.
- \ifx\thirdarg\emptymacro \else
- \toks0 = \expandafter{\the\toks0{#3}}%
- \fi
- %
- % Set up the complete index entry, with both the sort key and
- % the original text, including any font commands. We write
- % three arguments to \entry to the .?? file (four in the
- % subentry case), texindex reduces to two when writing the .??s
- % sorted result.
- \edef\temp{%
- \write\csname#1indfile\endcsname{%
- \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
- }%
- %
- % If a skip is the last thing on the list now, preserve it
- % by backing up by \lastskip, doing the \write, then inserting
- % the skip again. Otherwise, the whatsit generated by the
- % \write will make \lastskip zero. The result is that sequences
- % like this:
- % @end defun
- % @tindex whatever
- % @defun ...
- % will have extra space inserted, because the \medbreak in the
- % start of the @defun won't see the skip inserted by the @end of
- % the previous defun.
- %
- % But don't do any of this if we're not in vertical mode. We
- % don't want to do a \vskip and prematurely end a paragraph.
- %
- % Avoid page breaks due to these extra skips, too.
- %
- \iflinks
- \ifvmode
- \skip0 = \lastskip
- \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi
- \fi
- %
- \temp % do the write
- %
- %
- \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
- \fi
- }%
- }%
- \penalty\count255
+ %
+ % Remember, we are within a group.
+ \indexdummies % Must do this here, since \bf, etc expand at this stage
+ \escapechar=`\\
+ \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
+ % so it will be output as is; and it will print as backslash.
+ %
+ % Process the index entry with all font commands turned off, to
+ % get the string to sort by.
+ {\indexnofonts
+ \edef\temp{\the\toks0}% need full expansion
+ \xdef\indexsorttmp{\temp}%
}%
+ %
+ % Set up the complete index entry, with both the sort key and
+ % the original text, including any font commands. We write
+ % three arguments to \entry to the .?? file (four in the
+ % subentry case), texindex reduces to two when writing the .??s
+ % sorted result.
+ \edef\temp{%
+ \write\writeto{%
+ \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
+ }%
+ \temp
+}
+
+% Take care of unwanted page breaks:
+%
+% If a skip is the last thing on the list now, preserve it
+% by backing up by \lastskip, doing the \write, then inserting
+% the skip again. Otherwise, the whatsit generated by the
+% \write will make \lastskip zero. The result is that sequences
+% like this:
+% @end defun
+% @tindex whatever
+% @defun ...
+% will have extra space inserted, because the \medbreak in the
+% start of the @defun won't see the skip inserted by the @end of
+% the previous defun.
+%
+% But don't do any of this if we're not in vertical mode. We
+% don't want to do a \vskip and prematurely end a paragraph.
+%
+% Avoid page breaks due to these extra skips, too.
+%
+% But wait, there is a catch there:
+% We'll have to check whether \lastskip is zero skip. \ifdim is not
+% sufficient for this purpose, as it ignores stretch and shrink parts
+% of the skip. The only way seems to be to check the textual
+% representation of the skip.
+%
+% The following is almost like \def\zeroskipmacro{0.0pt} except that
+% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
+%
+\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
+%
+% ..., ready, GO:
+%
+\def\dosubindsanitize{%
+ % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
+ \skip0 = \lastskip
+ \edef\lastskipmacro{\the\lastskip}%
+ \count255 = \lastpenalty
+ %
+ % If \lastskip is nonzero, that means the last item was a
+ % skip. And since a skip is discardable, that means this
+ % -\skip0 glue we're inserting is preceded by a
+ % non-discardable item, therefore it is not a potential
+ % breakpoint, therefore no \nobreak needed.
+ \ifx\lastskipmacro\zeroskipmacro
+ \else
+ \vskip-\skip0
+ \fi
+ %
+ \dosubindwrite
+ %
+ \ifx\lastskipmacro\zeroskipmacro
+ % If \lastskip was zero, perhaps the last item was a penalty, and
+ % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
+ % to re-insert the same penalty (values >10000 are used for various
+ % signals); since we just inserted a non-discardable item, any
+ % following glue (such as a \parskip) would be a breakpoint. For example:
+ %
+ % @deffn deffn-whatever
+ % @vindex index-whatever
+ % Description.
+ % would allow a break between the index-whatever whatsit
+ % and the "Description." paragraph.
+ \ifnum\count255>9999 \penalty\count255 \fi
+ \else
+ % On the other hand, if we had a nonzero \lastskip,
+ % this make-up glue would be preceded by a non-discardable item
+ % (the whatsit from the \write), so we must insert a \nobreak.
+ \nobreak\vskip\skip0
+ \fi
}
% The index entry written in the file actually looks like
@@ -3099,13 +3479,12 @@ width0pt\relax} \fi
% @printindex causes a particular index (the ??s file) to get printed.
% It does not print any chapter heading (usually an @unnumbered).
%
-\def\printindex{\parsearg\doprintindex}
-\def\doprintindex#1{\begingroup
+\parseargdef\printindex{\begingroup
\dobreak \chapheadingskip{10000}%
%
\smallfonts \rm
\tolerance = 9500
- \indexbreaks
+ \everypar = {}% don't want the \kern\-parindent from indentation suppression.
%
% See if the index file exists and is nonempty.
% Change catcode of @ here so that if the index file contains
@@ -3132,7 +3511,7 @@ width0pt\relax} \fi
% Index files are almost Texinfo source, but we use \ as the escape
% character. It would be better to use @, but that's too big a change
% to make right now.
- \def\indexbackslash{\rawbackslashxx}%
+ \def\indexbackslash{\backslashcurfont}%
\catcode`\\ = 0
\escapechar = `\\
\begindoublecolumns
@@ -3154,7 +3533,10 @@ width0pt\relax} \fi
\removelastskip
%
% We like breaks before the index initials, so insert a bonus.
- \penalty -300
+ \nobreak
+ \vskip 0pt plus 3\baselineskip
+ \penalty 0
+ \vskip 0pt plus -3\baselineskip
%
% Typeset the initial. Making this add up to a whole number of
% baselineskips increases the chance of the dots lining up from column
@@ -3164,80 +3546,100 @@ width0pt\relax} \fi
% No shrink because it confuses \balancecolumns.
\vskip 1.67\baselineskip plus .5\baselineskip
\leftline{\secbf #1}%
- \vskip .33\baselineskip plus .1\baselineskip
- %
% Do our best not to break after the initial.
\nobreak
+ \vskip .33\baselineskip plus .1\baselineskip
}}
-% This typesets a paragraph consisting of #1, dot leaders, and then #2
-% flush to the right margin. It is used for index and table of contents
-% entries. The paragraph is indented by \leftskip.
+% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
+% then page number (#2) flushed to the right margin. It is used for index
+% and table of contents entries. The paragraph is indented by \leftskip.
%
-\def\entry#1#2{\begingroup
- %
- % Start a new paragraph if necessary, so our assignments below can't
- % affect previous text.
- \par
- %
- % Do not fill out the last line with white space.
- \parfillskip = 0in
- %
- % No extra space above this paragraph.
- \parskip = 0in
- %
- % Do not prefer a separate line ending with a hyphen to fewer lines.
- \finalhyphendemerits = 0
- %
- % \hangindent is only relevant when the entry text and page number
- % don't both fit on one line. In that case, bob suggests starting the
- % dots pretty far over on the line. Unfortunately, a large
- % indentation looks wrong when the entry text itself is broken across
- % lines. So we use a small indentation and put up with long leaders.
- %
- % \hangafter is reset to 1 (which is the value we want) at the start
- % of each paragraph, so we need not do anything with that.
- \hangindent = 2em
- %
- % When the entry text needs to be broken, just fill out the first line
- % with blank space.
- \rightskip = 0pt plus1fil
- %
- % A bit of stretch before each entry for the benefit of balancing columns.
- \vskip 0pt plus1pt
- %
- % Start a ``paragraph'' for the index entry so the line breaking
- % parameters we've set above will have an effect.
- \noindent
- %
- % Insert the text of the index entry. TeX will do line-breaking on it.
- #1%
- % The following is kludged to not output a line of dots in the index if
- % there are no page numbers. The next person who breaks this will be
- % cursed by a Unix daemon.
- \def\tempa{{\rm }}%
- \def\tempb{#2}%
- \edef\tempc{\tempa}%
- \edef\tempd{\tempb}%
- \ifx\tempc\tempd\ \else%
+% A straightforward implementation would start like this:
+% \def\entry#1#2{...
+% But this frozes the catcodes in the argument, and can cause problems to
+% @code, which sets - active. This problem was fixed by a kludge---
+% ``-'' was active throughout whole index, but this isn't really right.
+%
+% The right solution is to prevent \entry from swallowing the whole text.
+% --kasal, 21nov03
+\def\entry{%
+ \begingroup
+ %
+ % Start a new paragraph if necessary, so our assignments below can't
+ % affect previous text.
+ \par
+ %
+ % Do not fill out the last line with white space.
+ \parfillskip = 0in
+ %
+ % No extra space above this paragraph.
+ \parskip = 0in
+ %
+ % Do not prefer a separate line ending with a hyphen to fewer lines.
+ \finalhyphendemerits = 0
%
- % If we must, put the page number on a line of its own, and fill out
- % this line with blank space. (The \hfil is overwhelmed with the
- % fill leaders glue in \indexdotfill if the page number does fit.)
- \hfil\penalty50
- \null\nobreak\indexdotfill % Have leaders before the page number.
+ % \hangindent is only relevant when the entry text and page number
+ % don't both fit on one line. In that case, bob suggests starting the
+ % dots pretty far over on the line. Unfortunately, a large
+ % indentation looks wrong when the entry text itself is broken across
+ % lines. So we use a small indentation and put up with long leaders.
%
- % The `\ ' here is removed by the implicit \unskip that TeX does as
- % part of (the primitive) \par. Without it, a spurious underfull
- % \hbox ensues.
- \ifpdf
- \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+ % \hangafter is reset to 1 (which is the value we want) at the start
+ % of each paragraph, so we need not do anything with that.
+ \hangindent = 2em
+ %
+ % When the entry text needs to be broken, just fill out the first line
+ % with blank space.
+ \rightskip = 0pt plus1fil
+ %
+ % A bit of stretch before each entry for the benefit of balancing
+ % columns.
+ \vskip 0pt plus1pt
+ %
+ % Swallow the left brace of the text (first parameter):
+ \afterassignment\doentry
+ \let\temp =
+}
+\def\doentry{%
+ \bgroup % Instead of the swallowed brace.
+ \noindent
+ \aftergroup\finishentry
+ % And now comes the text of the entry.
+}
+\def\finishentry#1{%
+ % #1 is the page number.
+ %
+ % The following is kludged to not output a line of dots in the index if
+ % there are no page numbers. The next person who breaks this will be
+ % cursed by a Unix daemon.
+ \def\tempa{{\rm }}%
+ \def\tempb{#1}%
+ \edef\tempc{\tempa}%
+ \edef\tempd{\tempb}%
+ \ifx\tempc\tempd
+ \ %
\else
- \ #2% The page number ends the paragraph.
+ %
+ % If we must, put the page number on a line of its own, and fill out
+ % this line with blank space. (The \hfil is overwhelmed with the
+ % fill leaders glue in \indexdotfill if the page number does fit.)
+ \hfil\penalty50
+ \null\nobreak\indexdotfill % Have leaders before the page number.
+ %
+ % The `\ ' here is removed by the implicit \unskip that TeX does as
+ % part of (the primitive) \par. Without it, a spurious underfull
+ % \hbox ensues.
+ \ifpdf
+ \pdfgettoks#1.%
+ \ \the\toksA
+ \else
+ \ #1%
+ \fi
\fi
- \fi%
- \par
-\endgroup}
+ \par
+ \endgroup
+}
% Like \dotfill except takes at least 1 em.
\def\indexdotfill{\cleaders
@@ -3348,7 +3750,7 @@ width0pt\relax} \fi
\wd0=\hsize \wd2=\hsize
\hbox to\pagewidth{\box0\hfil\box2}%
}
-%
+%
% All done with double columns.
\def\enddoublecolumns{%
\output = {%
@@ -3406,6 +3808,12 @@ width0pt\relax} \fi
\message{sectioning,}
% Chapters, sections, etc.
+% \unnumberedno is an oxymoron, of course. But we count the unnumbered
+% sections so that we can refer to them unambiguously in the pdf
+% outlines by their "section number". We avoid collisions with chapter
+% numbers by starting them at 10000. (If a document ever has 10000
+% chapters, we're in trouble anyway, I'm sure.)
+\newcount\unnumberedno \unnumberedno = 10000
\newcount\chapno
\newcount\secno \secno=0
\newcount\subsecno \subsecno=0
@@ -3413,9 +3821,12 @@ width0pt\relax} \fi
% This counter is funny since it counts through charcodes of letters A, B, ...
\newcount\appendixno \appendixno = `\@
+%
% \def\appendixletter{\char\the\appendixno}
-% We do the following for the sake of pdftex, which needs the actual
+% We do the following ugly conditional instead of the above simple
+% construct for the sake of pdftex, which needs the actual
% letter in the expansion, not just typeset.
+%
\def\appendixletter{%
\ifnum\appendixno=`A A%
\else\ifnum\appendixno=`B B%
@@ -3453,11 +3864,12 @@ width0pt\relax} \fi
% Each @chapter defines this as the name of the chapter.
% page headings and footings can use it. @section does likewise.
+% However, they are not reliable, because we don't use marks.
\def\thischapter{}
\def\thissection{}
\newcount\absseclevel % used to calculate proper heading level
-\newcount\secbase\secbase=0 % @raise/lowersections modify this count
+\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
% @raisesections: treat @section as chapter, @subsection as section, etc.
\def\raisesections{\global\advance\secbase by -1}
@@ -3467,288 +3879,246 @@ width0pt\relax} \fi
\def\lowersections{\global\advance\secbase by 1}
\let\down=\lowersections % original BFox name
-% Choose a numbered-heading macro
-% #1 is heading level if unmodified by @raisesections or @lowersections
-% #2 is text for heading
-\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \chapterzzz{#2}
-\or
- \seczzz{#2}
-\or
- \numberedsubseczzz{#2}
-\or
- \numberedsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \chapterzzz{#2}
+% we only have subsub.
+\chardef\maxseclevel = 3
+%
+% A numbered section within an unnumbered changes to unnumbered too.
+% To achive this, remember the "biggest" unnum. sec. we are currently in:
+\chardef\unmlevel = \maxseclevel
+%
+% Trace whether the current chapter is an appendix or not:
+% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
+\def\chapheadtype{N}
+
+% Choose a heading macro
+% #1 is heading type
+% #2 is heading level
+% #3 is text for heading
+\def\genhead#1#2#3{%
+ % Compute the abs. sec. level:
+ \absseclevel=#2
+ \advance\absseclevel by \secbase
+ % Make sure \absseclevel doesn't fall outside the range:
+ \ifnum \absseclevel < 0
+ \absseclevel = 0
\else
- \numberedsubsubseczzz{#2}
+ \ifnum \absseclevel > 3
+ \absseclevel = 3
+ \fi
\fi
-\fi
-}
-
-% like \numhead, but chooses appendix heading levels
-\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \appendixzzz{#2}
-\or
- \appendixsectionzzz{#2}
-\or
- \appendixsubseczzz{#2}
-\or
- \appendixsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \appendixzzz{#2}
+ % The heading type:
+ \def\headtype{#1}%
+ \if \headtype U%
+ \ifnum \absseclevel < \unmlevel
+ \chardef\unmlevel = \absseclevel
+ \fi
\else
- \appendixsubsubseczzz{#2}
+ % Check for appendix sections:
+ \ifnum \absseclevel = 0
+ \edef\chapheadtype{\headtype}%
+ \else
+ \if \headtype A\if \chapheadtype N%
+ \errmessage{@appendix... within a non-appendix chapter}%
+ \fi\fi
+ \fi
+ % Check for numbered within unnumbered:
+ \ifnum \absseclevel > \unmlevel
+ \def\headtype{U}%
+ \else
+ \chardef\unmlevel = 3
+ \fi
\fi
-\fi
-}
-
-% like \numhead, but chooses numberless heading levels
-\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \unnumberedzzz{#2}
-\or
- \unnumberedseczzz{#2}
-\or
- \unnumberedsubseczzz{#2}
-\or
- \unnumberedsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \unnumberedzzz{#2}
+ % Now print the heading:
+ \if \headtype U%
+ \ifcase\absseclevel
+ \unnumberedzzz{#3}%
+ \or \unnumberedseczzz{#3}%
+ \or \unnumberedsubseczzz{#3}%
+ \or \unnumberedsubsubseczzz{#3}%
+ \fi
\else
- \unnumberedsubsubseczzz{#2}
+ \if \headtype A%
+ \ifcase\absseclevel
+ \appendixzzz{#3}%
+ \or \appendixsectionzzz{#3}%
+ \or \appendixsubseczzz{#3}%
+ \or \appendixsubsubseczzz{#3}%
+ \fi
+ \else
+ \ifcase\absseclevel
+ \chapterzzz{#3}%
+ \or \seczzz{#3}%
+ \or \numberedsubseczzz{#3}%
+ \or \numberedsubsubseczzz{#3}%
+ \fi
+ \fi
\fi
-\fi
+ \suppressfirstparagraphindent
}
-% @chapter, @appendix, @unnumbered.
-\def\thischaptername{No Chapter Title}
-\outer\def\chapter{\parsearg\chapteryyy}
-\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
-\def\chapterzzz #1{%
-\secno=0 \subsecno=0 \subsubsecno=0
-\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
-\chapmacro {#1}{\the\chapno}%
-\gdef\thissection{#1}%
-\gdef\thischaptername{#1}%
-% We don't substitute the actual chapter name into \thischapter
-% because we don't want its macros evaluated now.
-\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}%
- {\the\chapno}}}%
-\temp
-\donoderef
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
-}
-
-\outer\def\appendix{\parsearg\appendixyyy}
-\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
-\def\appendixzzz #1{%
-\secno=0 \subsecno=0 \subsubsecno=0
-\global\advance \appendixno by 1
-\message{\putwordAppendix\space \appendixletter}%
-\chapmacro {#1}{\putwordAppendix{} \appendixletter}%
-\gdef\thissection{#1}%
-\gdef\thischaptername{#1}%
-\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash appendixentry{\the\toks0}%
- {\appendixletter}}}%
-\temp
-\appendixnoderef
-\global\let\section = \appendixsec
-\global\let\subsection = \appendixsubsec
-\global\let\subsubsection = \appendixsubsubsec
+% an interface:
+\def\numhead{\genhead N}
+\def\apphead{\genhead A}
+\def\unnmhead{\genhead U}
+
+% @chapter, @appendix, @unnumbered. Increment top-level counter, reset
+% all lower-level sectioning counters to zero.
+%
+% Also set \chaplevelprefix, which we prepend to @float sequence numbers
+% (e.g., figures), q.v. By default (before any chapter), that is empty.
+\let\chaplevelprefix = \empty
+%
+\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\def\chapterzzz#1{%
+ % section resetting is \global in case the chapter is in a group, such
+ % as an @include file.
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\chapno by 1
+ %
+ % Used for \float.
+ \gdef\chaplevelprefix{\the\chapno.}%
+ \resetallfloatnos
+ %
+ \message{\putwordChapter\space \the\chapno}%
+ %
+ % Write the actual heading.
+ \chapmacro{#1}{Ynumbered}{\the\chapno}%
+ %
+ % So @section and the like are numbered underneath this chapter.
+ \global\let\section = \numberedsec
+ \global\let\subsection = \numberedsubsec
+ \global\let\subsubsection = \numberedsubsubsec
+}
+
+\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
+\def\appendixzzz#1{%
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\appendixno by 1
+ \gdef\chaplevelprefix{\appendixletter.}%
+ \resetallfloatnos
+ %
+ \def\appendixnum{\putwordAppendix\space \appendixletter}%
+ \message{\appendixnum}%
+ %
+ \chapmacro{#1}{Yappendix}{\appendixletter}%
+ %
+ \global\let\section = \appendixsec
+ \global\let\subsection = \appendixsubsec
+ \global\let\subsubsection = \appendixsubsubsec
+}
+
+\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
+\def\unnumberedzzz#1{%
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\unnumberedno by 1
+ %
+ % Since an unnumbered has no number, no prefix for figures.
+ \global\let\chaplevelprefix = \empty
+ \resetallfloatnos
+ %
+ % This used to be simply \message{#1}, but TeX fully expands the
+ % argument to \message. Therefore, if #1 contained @-commands, TeX
+ % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
+ % expanded @cite (which turns out to cause errors because \cite is meant
+ % to be executed, not expanded).
+ %
+ % Anyway, we don't want the fully-expanded definition of @cite to appear
+ % as a result of the \message, we just want `@cite' itself. We use
+ % \the<toks register> to achieve this: TeX expands \the<toks> only once,
+ % simply yielding the contents of <toks register>. (We also do this for
+ % the toc entries.)
+ \toks0 = {#1}%
+ \message{(\the\toks0)}%
+ %
+ \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
+ %
+ \global\let\section = \unnumberedsec
+ \global\let\subsection = \unnumberedsubsec
+ \global\let\subsubsection = \unnumberedsubsubsec
}
% @centerchap is like @unnumbered, but the heading is centered.
-\outer\def\centerchap{\parsearg\centerchapyyy}
-\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
+\outer\parseargdef\centerchap{%
+ % Well, we could do the following in a group, but that would break
+ % an assumption that \chapmacro is called at the outermost level.
+ % Thus we are safer this way: --kasal, 24feb04
+ \let\centerparametersmaybe = \centerparameters
+ \unnmhead0{#1}%
+ \let\centerparametersmaybe = \relax
+}
% @top is like @unnumbered.
-\outer\def\top{\parsearg\unnumberedyyy}
-
-\outer\def\unnumbered{\parsearg\unnumberedyyy}
-\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
-\def\unnumberedzzz #1{%
-\secno=0 \subsecno=0 \subsubsecno=0
-%
-% This used to be simply \message{#1}, but TeX fully expands the
-% argument to \message. Therefore, if #1 contained @-commands, TeX
-% expanded them. For example, in `@unnumbered The @cite{Book}', TeX
-% expanded @cite (which turns out to cause errors because \cite is meant
-% to be executed, not expanded).
-%
-% Anyway, we don't want the fully-expanded definition of @cite to appear
-% as a result of the \message, we just want `@cite' itself. We use
-% \the<toks register> to achieve this: TeX expands \the<toks> only once,
-% simply yielding the contents of <toks register>. (We also do this for
-% the toc entries.)
-\toks0 = {#1}\message{(\the\toks0)}%
-%
-\unnumbchapmacro {#1}%
-\gdef\thischapter{#1}\gdef\thissection{#1}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}%
-\temp
-\unnumbnoderef
-\global\let\section = \unnumberedsec
-\global\let\subsection = \unnumberedsubsec
-\global\let\subsubsection = \unnumberedsubsubsec
-}
+\let\top\unnumbered
% Sections.
-\outer\def\numberedsec{\parsearg\secyyy}
-\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
-\def\seczzz #1{%
-\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
- {\the\chapno}{\the\secno}}}%
-\temp
-\donoderef
-\nobreak
-}
-
-\outer\def\appendixsection{\parsearg\appendixsecyyy}
-\outer\def\appendixsec{\parsearg\appendixsecyyy}
-\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
-\def\appendixsectionzzz #1{%
-\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}%
- {\appendixletter}{\the\secno}}}%
-\temp
-\appendixnoderef
-\nobreak
-}
-
-\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
-\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
-\def\unnumberedseczzz #1{%
-\plainsecheading {#1}\gdef\thissection{#1}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry%
- {\the\toks0}{\the\chapno}}}%
-\temp
-\unnumbnoderef
-\nobreak
+\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
+\def\seczzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
+}
+
+\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
+\def\appendixsectionzzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
+}
+\let\appendixsec\appendixsection
+
+\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
+\def\unnumberedseczzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
}
% Subsections.
-\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
-\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
-\def\numberedsubseczzz #1{%
-\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
- {\the\chapno}{\the\secno}{\the\subsecno}}}%
-\temp
-\donoderef
-\nobreak
-}
-
-\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
-\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
-\def\appendixsubseczzz #1{%
-\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}%
- {\appendixletter}{\the\secno}{\the\subsecno}}}%
-\temp
-\appendixnoderef
-\nobreak
-}
-
-\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
-\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
-\def\unnumberedsubseczzz #1{%
-\plainsubsecheading {#1}\gdef\thissection{#1}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
- {\the\toks0}{\the\chapno}{\the\secno}}}%
-\temp
-\unnumbnoderef
-\nobreak
+\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
+\def\numberedsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
+}
+
+\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
+\def\appendixsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Yappendix}%
+ {\appendixletter.\the\secno.\the\subsecno}%
+}
+
+\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
+\def\unnumberedsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Ynothing}%
+ {\the\unnumberedno.\the\secno.\the\subsecno}%
}
% Subsubsections.
-\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
-\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
-\def\numberedsubsubseczzz #1{%
-\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-\subsubsecheading {#1}
- {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
- {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
-\temp
-\donoderef
-\nobreak
-}
-
-\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
-\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
-\def\appendixsubsubseczzz #1{%
-\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-\subsubsecheading {#1}
- {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}%
- {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
-\temp
-\appendixnoderef
-\nobreak
-}
-
-\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
-\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
-\def\unnumberedsubsubseczzz #1{%
-\plainsubsubsecheading {#1}\gdef\thissection{#1}%
-\toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
- {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}%
-\temp
-\unnumbnoderef
-\nobreak
-}
-
-% These are variants which are not "outer", so they can appear in @ifinfo.
-% Actually, they should now be obsolete; ordinary section commands should work.
-\def\infotop{\parsearg\unnumberedzzz}
-\def\infounnumbered{\parsearg\unnumberedzzz}
-\def\infounnumberedsec{\parsearg\unnumberedseczzz}
-\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
-\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
-
-\def\infoappendix{\parsearg\appendixzzz}
-\def\infoappendixsec{\parsearg\appendixseczzz}
-\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
-\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
-
-\def\infochapter{\parsearg\chapterzzz}
-\def\infosection{\parsearg\sectionzzz}
-\def\infosubsection{\parsearg\subsectionzzz}
-\def\infosubsubsection{\parsearg\subsubsectionzzz}
+\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
+\def\numberedsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Ynumbered}%
+ {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
+\def\appendixsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Yappendix}%
+ {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
+\def\unnumberedsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Ynothing}%
+ {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
% These macros control what the section commands do, according
% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
% Define them by default for a numbered chapter.
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
+\let\section = \numberedsec
+\let\subsection = \numberedsubsec
+\let\subsubsection = \numberedsubsubsec
% Define @majorheading, @heading and @subheading
@@ -3761,23 +4131,27 @@ width0pt\relax} \fi
% if justification is not attempted. Hence \raggedright.
-\def\majorheading{\parsearg\majorheadingzzz}
-\def\majorheadingzzz #1{%
-{\advance\chapheadingskip by 10pt \chapbreak }%
-{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 200}
+\def\majorheading{%
+ {\advance\chapheadingskip by 10pt \chapbreak }%
+ \parsearg\chapheadingzzz
+}
-\def\chapheading{\parsearg\chapheadingzzz}
-\def\chapheadingzzz #1{\chapbreak %
-{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 200}
+\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
+\def\chapheadingzzz#1{%
+ {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\raggedright
+ \rm #1\hfill}}%
+ \bigskip \par\penalty 200\relax
+ \suppressfirstparagraphindent
+}
% @heading, @subheading, @subsubheading.
-\def\heading{\parsearg\plainsecheading}
-\def\subheading{\parsearg\plainsubsecheading}
-\def\subsubheading{\parsearg\plainsubsubsecheading}
+\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
% These macros generate a chapter, section, etc. heading only
% (including whitespace, linebreaking, etc. around it),
@@ -3786,8 +4160,6 @@ width0pt\relax} \fi
%%% Args are the skip and penalty (usually negative)
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
-\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
-
%%% Define plain chapter starts, and page on/off switching for it
% Parameter controlling skip before chapter headings (if needed)
@@ -3810,7 +4182,7 @@ width0pt\relax} \fi
\global\let\pagealignmacro=\chappager
\global\def\HEADINGSon{\HEADINGSsingle}}
-\def\CHAPPAGodd{
+\def\CHAPPAGodd{%
\global\let\contentsalignmacro = \chapoddpage
\global\let\pchapsepmacro=\chapoddpage
\global\let\pagealignmacro=\chapoddpage
@@ -3818,107 +4190,193 @@ width0pt\relax} \fi
\CHAPPAGon
-\def\CHAPFplain{
-\global\let\chapmacro=\chfplain
-\global\let\unnumbchapmacro=\unnchfplain
-\global\let\centerchapmacro=\centerchfplain}
-
-% Plain chapter opening.
-% #1 is the text, #2 the chapter number or empty if unnumbered.
-\def\chfplain#1#2{%
+% Chapter opening.
+%
+% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
+% Yappendix, Yomitfromtoc), #3 the chapter number.
+%
+% To test against our argument.
+\def\Ynothingkeyword{Ynothing}
+\def\Yomitfromtockeyword{Yomitfromtoc}
+\def\Yappendixkeyword{Yappendix}
+%
+\def\chapmacro#1#2#3{%
\pchapsepmacro
{%
\chapfonts \rm
- \def\chapnum{#2}%
- \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
+ %
+ % Have to define \thissection before calling \donoderef, because the
+ % xref code eventually uses it. On the other hand, it has to be called
+ % after \pchapsepmacro, or the headline will change too soon.
+ \gdef\thissection{#1}%
+ \gdef\thischaptername{#1}%
+ %
+ % Only insert the separating space if we have a chapter/appendix
+ % number, and don't print the unnumbered ``number''.
+ \def\temptype{#2}%
+ \ifx\temptype\Ynothingkeyword
+ \setbox0 = \hbox{}%
+ \def\toctype{unnchap}%
+ \def\thischapter{#1}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
+ \def\toctype{omit}%
+ \xdef\thischapter{}%
+ \else\ifx\temptype\Yappendixkeyword
+ \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
+ \def\toctype{app}%
+ % We don't substitute the actual chapter name into \thischapter
+ % because we don't want its macros evaluated now. And we don't
+ % use \thissection because that changes with each section.
+ %
+ \xdef\thischapter{\putwordAppendix{} \appendixletter:
+ \noexpand\thischaptername}%
+ \else
+ \setbox0 = \hbox{#3\enspace}%
+ \def\toctype{numchap}%
+ \xdef\thischapter{\putwordChapter{} \the\chapno:
+ \noexpand\thischaptername}%
+ \fi\fi\fi
+ %
+ % Write the toc entry for this chapter. Must come before the
+ % \donoderef, because we include the current node name in the toc
+ % entry, and \donoderef resets it to empty.
+ \writetocentry{\toctype}{#1}{#3}%
+ %
+ % For pdftex, we have to write out the node definition (aka, make
+ % the pdfdest) after any page break, but before the actual text has
+ % been typeset. If the destination for the pdf outline is after the
+ % text, then jumping from the outline may wind up with the text not
+ % being visible, for instance under high magnification.
+ \donoderef{#2}%
+ %
+ % Typeset the actual heading.
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
- \hangindent = \wd0 \centerparametersmaybe
+ \hangindent=\wd0 \centerparametersmaybe
\unhbox0 #1\par}%
}%
\nobreak\bigskip % no page break after a chapter title
\nobreak
}
-% Plain opening for unnumbered.
-\def\unnchfplain#1{\chfplain{#1}{}}
-
% @centerchap -- centered and unnumbered.
\let\centerparametersmaybe = \relax
-\def\centerchfplain#1{{%
- \def\centerparametersmaybe{%
- \advance\rightskip by 3\rightskip
- \leftskip = \rightskip
- \parfillskip = 0pt
- }%
- \chfplain{#1}{}%
-}}
+\def\centerparameters{%
+ \advance\rightskip by 3\rightskip
+ \leftskip = \rightskip
+ \parfillskip = 0pt
+}
-\CHAPFplain % The default
+% I don't think this chapter style is supported any more, so I'm not
+% updating it with the new noderef stuff. We'll see. --karl, 11aug03.
+%
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+%
\def\unnchfopen #1{%
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
\parindent=0pt\raggedright
\rm #1\hfill}}\bigskip \par\nobreak
}
-
\def\chfopen #1#2{\chapoddpage {\chapfonts
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
\par\penalty 5000 %
}
-
\def\centerchfopen #1{%
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
\parindent=0pt
\hfill {\rm #1}\hfill}}\bigskip \par\nobreak
}
+\def\CHAPFopen{%
+ \global\let\chapmacro=\chfopen
+ \global\let\centerchapmacro=\centerchfopen}
-\def\CHAPFopen{
-\global\let\chapmacro=\chfopen
-\global\let\unnumbchapmacro=\unnchfopen
-\global\let\centerchapmacro=\centerchfopen}
-
-% Section titles.
+% Section titles. These macros combine the section number parts and
+% call the generic \sectionheading to do the printing.
+%
\newskip\secheadingskip
-\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
-\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
-\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
+\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
% Subsection titles.
-\newskip \subsecheadingskip
-\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
-\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
-\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
+\newskip\subsecheadingskip
+\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
% Subsubsection titles.
-\let\subsubsecheadingskip = \subsecheadingskip
-\let\subsubsecheadingbreak = \subsecheadingbreak
-\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
-\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
+\def\subsubsecheadingskip{\subsecheadingskip}
+\def\subsubsecheadingbreak{\subsecheadingbreak}
-% Print any size section title.
+% Print any size, any type, section title.
%
-% #1 is the section type (sec/subsec/subsubsec), #2 is the section
-% number (maybe empty), #3 the text.
-\def\sectionheading#1#2#3{%
- {%
- \expandafter\advance\csname #1headingskip\endcsname by \parskip
- \csname #1headingbreak\endcsname
- }%
+% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
+% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
+% section number.
+%
+\def\sectionheading#1#2#3#4{%
{%
% Switch to the right set of fonts.
- \csname #1fonts\endcsname \rm
+ \csname #2fonts\endcsname \rm
+ %
+ % Insert space above the heading.
+ \csname #2headingbreak\endcsname
+ %
+ % Only insert the space after the number if we have a section number.
+ \def\sectionlevel{#2}%
+ \def\temptype{#3}%
%
- % Only insert the separating space if we have a section number.
- \def\secnum{#2}%
- \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
+ \ifx\temptype\Ynothingkeyword
+ \setbox0 = \hbox{}%
+ \def\toctype{unn}%
+ \gdef\thissection{#1}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ % for @headings -- no section number, don't include in toc,
+ % and don't redefine \thissection.
+ \setbox0 = \hbox{}%
+ \def\toctype{omit}%
+ \let\sectionlevel=\empty
+ \else\ifx\temptype\Yappendixkeyword
+ \setbox0 = \hbox{#4\enspace}%
+ \def\toctype{app}%
+ \gdef\thissection{#1}%
+ \else
+ \setbox0 = \hbox{#4\enspace}%
+ \def\toctype{num}%
+ \gdef\thissection{#1}%
+ \fi\fi\fi
+ %
+ % Write the toc entry (before \donoderef). See comments in \chfplain.
+ \writetocentry{\toctype\sectionlevel}{#1}{#4}%
+ %
+ % Write the node reference (= pdf destination for pdftex).
+ % Again, see comments in \chfplain.
+ \donoderef{#3}%
%
+ % Output the actual section heading.
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
- \hangindent = \wd0 % zero if no section number
- \unhbox0 #3}%
+ \hangindent=\wd0 % zero if no section number
+ \unhbox0 #1}%
}%
- \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
+ % Add extra space after the heading -- half of whatever came above it.
+ % Don't allow stretch, though.
+ \kern .5 \csname #2headingskip\endcsname
+ %
+ % Do not let the kern be a potential breakpoint, as it would be if it
+ % was followed by glue.
+ \nobreak
+ %
+ % We'll almost certainly start a paragraph next, so don't let that
+ % glue accumulate. (Not a breakpoint because it's preceded by a
+ % discardable item.)
+ \vskip-\parskip
+ %
+ % This is purely so the last item on the list is a known \penalty >
+ % 10000. This is so \startdefun can avoid allowing breakpoints after
+ % section headings. Otherwise, it would insert a valid breakpoint between:
+ %
+ % @section sec-whatever
+ % @deffn def-whatever
+ \penalty 10001
}
@@ -3927,112 +4385,152 @@ width0pt\relax} \fi
\newwrite\tocfile
% Write an entry to the toc file, opening it if necessary.
-% Called from @chapter, etc. We supply {\folio} at the end of the
-% argument, which will end up as the last argument to the \...entry macro.
+% Called from @chapter, etc.
%
-% We open the .toc file here instead of at @setfilename or any other
-% fixed time so that @contents can be put in the document anywhere.
+% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
+% We append the current node name (if any) and page number as additional
+% arguments for the \{chap,sec,...}entry macros which will eventually
+% read this. The node name is used in the pdf outlines as the
+% destination to jump to.
+%
+% We open the .toc file for writing here instead of at @setfilename (or
+% any other fixed time) so that @contents can be anywhere in the document.
+% But if #1 is `omit', then we don't do anything. This is used for the
+% table of contents chapter openings themselves.
%
\newif\iftocfileopened
-\def\writetocentry#1{%
- \iftocfileopened\else
- \immediate\openout\tocfile = \jobname.toc
- \global\tocfileopenedtrue
+\def\omitkeyword{omit}%
+%
+\def\writetocentry#1#2#3{%
+ \edef\writetoctype{#1}%
+ \ifx\writetoctype\omitkeyword \else
+ \iftocfileopened\else
+ \immediate\openout\tocfile = \jobname.toc
+ \global\tocfileopenedtrue
+ \fi
+ %
+ \iflinks
+ \toks0 = {#2}%
+ \toks2 = \expandafter{\lastnode}%
+ \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}%
+ {\the\toks2}{\noexpand\folio}}}%
+ \temp
+ \fi
\fi
- \iflinks \write\tocfile{#1{\folio}}\fi
%
- % Tell \shipout to create a page destination if we're doing pdf, which
- % will be the target of the links in the table of contents. We can't
- % just do it on every page because the title pages are numbered 1 and
- % 2 (the page numbers aren't printed), and so are the first two pages
- % of the document. Thus, we'd have two destinations named `1', and
- % two named `2'.
- \ifpdf \pdfmakepagedesttrue \fi
+ % Tell \shipout to create a pdf destination on each page, if we're
+ % writing pdf. These are used in the table of contents. We can't
+ % just write one on every page because the title pages are numbered
+ % 1 and 2 (the page numbers aren't printed), and so are the first
+ % two pages of the document. Thus, we'd have two destinations named
+ % `1', and two named `2'.
+ \ifpdf \global\pdfmakepagedesttrue \fi
}
\newskip\contentsrightmargin \contentsrightmargin=1in
\newcount\savepageno
\newcount\lastnegativepageno \lastnegativepageno = -1
-% Finish up the main text and prepare to read what we've written
-% to \tocfile.
+% Prepare to read what we've written to \tocfile.
%
\def\startcontents#1{%
- % If @setchapternewpage on, and @headings double, the contents should
- % start on an odd page, unlike chapters. Thus, we maintain
- % \contentsalignmacro in parallel with \pagealignmacro.
- % From: Torbjorn Granlund <tege@matematik.su.se>
- \contentsalignmacro
- \immediate\closeout\tocfile
- %
- % Don't need to put `Contents' or `Short Contents' in the headline.
- % It is abundantly clear what they are.
- \unnumbchapmacro{#1}\def\thischapter{}%
- \savepageno = \pageno
- \begingroup % Set up to handle contents files properly.
- \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
- % We can't do this, because then an actual ^ in a section
- % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
- %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
- \raggedbottom % Worry more about breakpoints than the bottom.
- \advance\hsize by -\contentsrightmargin % Don't use the full line length.
- %
- % Roman numerals for page numbers.
- \ifnum \pageno>0 \pageno = \lastnegativepageno \fi
+ % If @setchapternewpage on, and @headings double, the contents should
+ % start on an odd page, unlike chapters. Thus, we maintain
+ % \contentsalignmacro in parallel with \pagealignmacro.
+ % From: Torbjorn Granlund <tege@matematik.su.se>
+ \contentsalignmacro
+ \immediate\closeout\tocfile
+ %
+ % Don't need to put `Contents' or `Short Contents' in the headline.
+ % It is abundantly clear what they are.
+ \def\thischapter{}%
+ \chapmacro{#1}{Yomitfromtoc}{}%
+ %
+ \savepageno = \pageno
+ \begingroup % Set up to handle contents files properly.
+ \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
+ % We can't do this, because then an actual ^ in a section
+ % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
+ %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
+ \raggedbottom % Worry more about breakpoints than the bottom.
+ \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+ %
+ % Roman numerals for page numbers.
+ \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
}
% Normal (long) toc.
\def\contents{%
- \startcontents{\putwordTOC}%
- \openin 1 \jobname.toc
- \ifeof 1 \else
- \closein 1
- \input \jobname.toc
- \fi
- \vfill \eject
- \contentsalignmacro % in case @setchapternewpage odd is in effect
- \pdfmakeoutlines
- \endgroup
- \lastnegativepageno = \pageno
- \pageno = \savepageno
+ \startcontents{\putwordTOC}%
+ \openin 1 \jobname.toc
+ \ifeof 1 \else
+ \input \jobname.toc
+ \fi
+ \vfill \eject
+ \contentsalignmacro % in case @setchapternewpage odd is in effect
+ \ifeof 1 \else
+ \pdfmakeoutlines
+ \fi
+ \closein 1
+ \endgroup
+ \lastnegativepageno = \pageno
+ \global\pageno = \savepageno
}
% And just the chapters.
\def\summarycontents{%
- \startcontents{\putwordShortTOC}%
- %
- \let\chapentry = \shortchapentry
- \let\appendixentry = \shortappendixentry
- \let\unnumbchapentry = \shortunnumberedentry
- % We want a true roman here for the page numbers.
- \secfonts
- \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
- \rm
- \hyphenpenalty = 10000
- \advance\baselineskip by 1pt % Open it up a little.
- \def\secentry ##1##2##3##4{}
- \def\unnumbsecentry ##1##2##3{}
- \def\subsecentry ##1##2##3##4##5{}
- \def\unnumbsubsecentry ##1##2##3##4{}
- \def\subsubsecentry ##1##2##3##4##5##6{}
- \def\unnumbsubsubsecentry ##1##2##3##4##5{}
- \openin 1 \jobname.toc
- \ifeof 1 \else
- \closein 1
- \input \jobname.toc
- \fi
- \vfill \eject
- \contentsalignmacro % in case @setchapternewpage odd is in effect
- \endgroup
- \lastnegativepageno = \pageno
- \pageno = \savepageno
+ \startcontents{\putwordShortTOC}%
+ %
+ \let\numchapentry = \shortchapentry
+ \let\appentry = \shortchapentry
+ \let\unnchapentry = \shortunnchapentry
+ % We want a true roman here for the page numbers.
+ \secfonts
+ \let\rm=\shortcontrm \let\bf=\shortcontbf
+ \let\sl=\shortcontsl \let\tt=\shortconttt
+ \rm
+ \hyphenpenalty = 10000
+ \advance\baselineskip by 1pt % Open it up a little.
+ \def\numsecentry##1##2##3##4{}
+ \let\appsecentry = \numsecentry
+ \let\unnsecentry = \numsecentry
+ \let\numsubsecentry = \numsecentry
+ \let\appsubsecentry = \numsecentry
+ \let\unnsubsecentry = \numsecentry
+ \let\numsubsubsecentry = \numsecentry
+ \let\appsubsubsecentry = \numsecentry
+ \let\unnsubsubsecentry = \numsecentry
+ \openin 1 \jobname.toc
+ \ifeof 1 \else
+ \input \jobname.toc
+ \fi
+ \closein 1
+ \vfill \eject
+ \contentsalignmacro % in case @setchapternewpage odd is in effect
+ \endgroup
+ \lastnegativepageno = \pageno
+ \global\pageno = \savepageno
}
\let\shortcontents = \summarycontents
-\ifpdf
- \pdfcatalog{/PageMode /UseOutlines}%
-\fi
+% Typeset the label for a chapter or appendix for the short contents.
+% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
+%
+\def\shortchaplabel#1{%
+ % This space should be enough, since a single number is .5em, and the
+ % widest letter (M) is 1em, at least in the Computer Modern fonts.
+ % But use \hss just in case.
+ % (This space doesn't include the extra space that gets added after
+ % the label; that gets put in by \shortchapentry above.)
+ %
+ % We'd like to right-justify chapter numbers, but that looks strange
+ % with appendix letters. And right-justifying numbers and
+ % left-justifying letters looks strange when there is less than 10
+ % chapters. Have to read the whole toc once to know how many chapters
+ % there are before deciding ...
+ \hbox to 1em{#1\hss}%
+}
% These macros generate individual entries in the table of contents.
% The first argument is the chapter or section name.
@@ -4040,57 +4538,46 @@ width0pt\relax} \fi
% The arguments in between are the chapter number, section number, ...
% Chapters, in the main contents.
-\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
+\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
%
% Chapters, in the short toc.
% See comments in \dochapentry re vbox and related settings.
-\def\shortchapentry#1#2#3{%
- \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
+\def\shortchapentry#1#2#3#4{%
+ \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
}
% Appendices, in the main contents.
-\def\appendixentry#1#2#3{\dochapentry{\putwordAppendix{} #2\labelspace#1}{#3}}
+% Need the word Appendix, and a fixed-size box.
%
-% Appendices, in the short toc.
-\let\shortappendixentry = \shortchapentry
-
-% Typeset the label for a chapter or appendix for the short contents.
-% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
-% We could simplify the code here by writing out an \appendixentry
-% command in the toc file for appendices, instead of using \chapentry
-% for both, but it doesn't seem worth it.
-%
-\newdimen\shortappendixwidth
+\def\appendixbox#1{%
+ % We use M since it's probably the widest letter.
+ \setbox0 = \hbox{\putwordAppendix{} M}%
+ \hbox to \wd0{\putwordAppendix{} #1\hss}}
%
-\def\shortchaplabel#1{%
- % This space should be enough, since a single number is .5em, and the
- % widest letter (M) is 1em, at least in the Computer Modern fonts.
- % But use \hss just in case.
- % (This space doesn't include the extra space that gets added after
- % the label; that gets put in by \shortchapentry above.)
- \dimen0 = 1em
- \hbox to \dimen0{#1\hss}%
-}
+\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
% Unnumbered chapters.
-\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
-\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}}
+\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
+\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
% Sections.
-\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
-\def\unnumbsecentry#1#2#3{\dosecentry{#1}{#3}}
+\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
+\let\appsecentry=\numsecentry
+\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
% Subsections.
-\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
-\def\unnumbsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
+\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
+\let\appsubsecentry=\numsubsecentry
+\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
% And subsubsections.
-\def\subsubsecentry#1#2#3#4#5#6{%
- \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
-\def\unnumbsubsubsecentry#1#2#3#4#5{\dosubsubsecentry{#1}{#5}}
+\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
+\let\appsubsubsecentry=\numsubsubsecentry
+\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
% This parameter controls the indentation of the various levels.
-\newdimen\tocindent \tocindent = 3pc
+% Same as \defaultparindent.
+\newdimen\tocindent \tocindent = 15pt
% Now for the actual typesetting. In all these, #1 is the text and #2 is the
% page number.
@@ -4121,17 +4608,8 @@ width0pt\relax} \fi
\tocentry{#1}{\dopageno\bgroup#2\egroup}%
\endgroup}
-% Final typesetting of a toc entry; we use the same \entry macro as for
-% the index entries, but we want to suppress hyphenation here. (We
-% can't do that in the \entry macro, since index entries might consist
-% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
-\def\tocentry#1#2{\begingroup
- \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
- % Do not use \turnoffactive in these arguments. Since the toc is
- % typeset in cmr, characters such as _ would come out wrong; we
- % have to do the usual translation tricks.
- \entry{#1}{#2}%
-\endgroup}
+% We use the same \entry macro as for the index entries.
+\let\tocentry = \entry
% Space between chapter (or whatever) number and the title.
\def\labelspace{\hskip1em \relax}
@@ -4141,15 +4619,15 @@ width0pt\relax} \fi
\def\chapentryfonts{\secfonts \rm}
\def\secentryfonts{\textfonts}
-\let\subsecentryfonts = \textfonts
-\let\subsubsecentryfonts = \textfonts
+\def\subsecentryfonts{\textfonts}
+\def\subsubsecentryfonts{\textfonts}
\message{environments,}
% @foo ... @end foo.
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
-%
+%
% Since these characters are used in examples, it should be an even number of
% \tt widths. Each \tt character is 1en, so two makes it 1em.
%
@@ -4161,7 +4639,7 @@ width0pt\relax} \fi
% The @error{} command.
% Adapted from the TeXbook's \boxit.
-%
+%
\newbox\errorbox
%
{\tentt \global\dimen0 = 3em}% Width of the box.
@@ -4169,10 +4647,10 @@ width0pt\relax} \fi
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
%
-\global\setbox\errorbox=\hbox to \dimen0{\hfil
+\setbox\errorbox=\hbox to \dimen0{\hfil
\hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
\advance\hsize by -2\dimen2 % Rules.
- \vbox{
+ \vbox{%
\hrule height\dimen2
\hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
\vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
@@ -4186,17 +4664,16 @@ width0pt\relax} \fi
% One exception: @ is still an escape character, so that @end tex works.
% But \@ or @@ will get a plain tex @ character.
-\def\tex{\begingroup
+\envdef\tex{%
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
- \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
+ \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
\catcode `\%=14
- \catcode 43=12 % plus
- \catcode`\"=12
- \catcode`\==12
- \catcode`\|=12
- \catcode`\<=12
- \catcode`\>=12
+ \catcode `\+=\other
+ \catcode `\"=\other
+ \catcode `\|=\other
+ \catcode `\<=\other
+ \catcode `\>=\other
\escapechar=`\\
%
\let\b=\ptexb
@@ -4208,19 +4685,23 @@ width0pt\relax} \fi
\let\equiv=\ptexequiv
\let\!=\ptexexclam
\let\i=\ptexi
+ \let\indent=\ptexindent
+ \let\noindent=\ptexnoindent
\let\{=\ptexlbrace
\let\+=\tabalign
\let\}=\ptexrbrace
+ \let\/=\ptexslash
\let\*=\ptexstar
\let\t=\ptext
%
\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
\def\@{@}%
-\let\Etex=\endgroup}
+}
+% There is no need to define \Etex.
% Define @lisp ... @end lisp.
-% @lisp does a \begingroup so it can rebind things,
+% @lisp environment forms a group so it can rebind things,
% including the definition of @end lisp (which normally is erroneous).
% Amount to narrow the margins by for @lisp.
@@ -4231,34 +4712,25 @@ width0pt\relax} \fi
% have any width.
\def\lisppar{\null\endgraf}
-% Make each space character in the input produce a normal interword
-% space in the output. Don't allow a line break at this space, as this
-% is used only in environments like @example, where each line of input
-% should produce a line of output anyway.
-%
-{\obeyspaces %
-\gdef\sepspaces{\obeyspaces\let =\tie}}
-
-% Define \obeyedspace to be our active space, whatever it is. This is
-% for use in \parsearg.
-{\sepspaces%
-\global\let\obeyedspace= }
-
% This space is always present above and below environments.
\newskip\envskipamount \envskipamount = 0pt
% Make spacing and below environment symmetrical. We use \parskip here
% to help in doing that, since in @example-like environments \parskip
% is reset to zero; thus the \afterenvbreak inserts no space -- but the
-% start of the next paragraph will insert \parskip
+% start of the next paragraph will insert \parskip.
%
\def\aboveenvbreak{{%
- \ifnum\lastpenalty < 10000
+ % =10000 instead of <10000 because of a special case in \itemzzz and
+ % \sectionheading, q.v.
+ \ifnum \lastpenalty=10000 \else
\advance\envskipamount by \parskip
\endgraf
\ifdim\lastskip<\envskipamount
\removelastskip
- \penalty-50
+ % it's not a good place to break if the last penalty was \nobreak
+ % or better ...
+ \ifnum\lastpenalty<10000 \penalty-50 \fi
\vskip\envskipamount
\fi
\fi
@@ -4290,54 +4762,54 @@ width0pt\relax} \fi
%
\newskip\lskip\newskip\rskip
-\long\def\cartouche{%
-\begingroup
- \lskip=\leftskip \rskip=\rightskip
- \leftskip=0pt\rightskip=0pt %we want these *outside*.
- \cartinner=\hsize \advance\cartinner by-\lskip
- \advance\cartinner by-\rskip
- \cartouter=\hsize
- \advance\cartouter by 18.4pt % allow for 3pt kerns on either
-% side, and for 6pt waste from
-% each corner char, and rule thickness
- \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
- % Flag to tell @lisp, etc., not to narrow margin.
- \let\nonarrowing=\comment
- \vbox\bgroup
- \baselineskip=0pt\parskip=0pt\lineskip=0pt
- \carttop
- \hbox\bgroup
- \hskip\lskip
- \vrule\kern3pt
- \vbox\bgroup
- \hsize=\cartinner
- \kern3pt
- \begingroup
- \baselineskip=\normbskip
- \lineskip=\normlskip
- \parskip=\normpskip
- \vskip -\parskip
+\envdef\cartouche{%
+ \ifhmode\par\fi % can't be in the midst of a paragraph.
+ \startsavinginserts
+ \lskip=\leftskip \rskip=\rightskip
+ \leftskip=0pt\rightskip=0pt % we want these *outside*.
+ \cartinner=\hsize \advance\cartinner by-\lskip
+ \advance\cartinner by-\rskip
+ \cartouter=\hsize
+ \advance\cartouter by 18.4pt % allow for 3pt kerns on either
+ % side, and for 6pt waste from
+ % each corner char, and rule thickness
+ \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
+ % Flag to tell @lisp, etc., not to narrow margin.
+ \let\nonarrowing=\comment
+ \vbox\bgroup
+ \baselineskip=0pt\parskip=0pt\lineskip=0pt
+ \carttop
+ \hbox\bgroup
+ \hskip\lskip
+ \vrule\kern3pt
+ \vbox\bgroup
+ \kern3pt
+ \hsize=\cartinner
+ \baselineskip=\normbskip
+ \lineskip=\normlskip
+ \parskip=\normpskip
+ \vskip -\parskip
+ \comment % For explanation, see the end of \def\group.
+}
\def\Ecartouche{%
- \endgroup
- \kern3pt
- \egroup
- \kern3pt\vrule
- \hskip\rskip
- \egroup
- \cartbot
- \egroup
-\endgroup
-}}
+ \ifhmode\par\fi
+ \kern3pt
+ \egroup
+ \kern3pt\vrule
+ \hskip\rskip
+ \egroup
+ \cartbot
+ \egroup
+ \checkinserts
+}
% This macro is called at the beginning of all the @example variants,
% inside a group.
\def\nonfillstart{%
\aboveenvbreak
- \inENV % This group ends at the end of the body
\hfuzz = 12pt % Don't be fussy
\sepspaces % Make spaces be word-separators rather than space tokens.
- \singlespace
\let\par = \lisppar % don't ignore blank lines
\obeylines % each line of input is a line of output
\parskip = 0pt
@@ -4348,115 +4820,99 @@ width0pt\relax} \fi
\ifx\nonarrowing\relax
\advance \leftskip by \lispnarrowing
\exdentamount=\lispnarrowing
- \let\exdent=\nofillexdent
- \let\nonarrowing=\relax
\fi
+ \let\exdent=\nofillexdent
}
-% Define the \E... control sequence only if we are inside the particular
-% environment, so the error checking in \end will work.
+% If you want all examples etc. small: @set dispenvsize small.
+% If you want even small examples the full size: @set dispenvsize nosmall.
+% This affects the following displayed environments:
+% @example, @display, @format, @lisp
%
-% To end an @example-like environment, we first end the paragraph (via
-% \afterenvbreak's vertical glue), and then the group. That way we keep
-% the zero \parskip that the environments set -- \parskip glue will be
-% inserted at the beginning of the next paragraph in the document, after
-% the environment.
-%
-\def\nonfillfinish{\afterenvbreak\endgroup}
+\def\smallword{small}
+\def\nosmallword{nosmall}
+\let\SETdispenvsize\relax
+\def\setnormaldispenv{%
+ \ifx\SETdispenvsize\smallword
+ \smallexamplefonts \rm
+ \fi
+}
+\def\setsmalldispenv{%
+ \ifx\SETdispenvsize\nosmallword
+ \else
+ \smallexamplefonts \rm
+ \fi
+}
-% @lisp: indented, narrowed, typewriter font.
-\def\lisp{\begingroup
- \nonfillstart
- \let\Elisp = \nonfillfinish
- \tt
- \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
- \gobble % eat return
+% We often define two environments, @foo and @smallfoo.
+% Let's do it by one command:
+\def\makedispenv #1#2{
+ \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}
+ \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}
+ \expandafter\let\csname E#1\endcsname \afterenvbreak
+ \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
}
-% @example: Same as @lisp.
-\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
+% Define two synonyms:
+\def\maketwodispenvs #1#2#3{
+ \makedispenv{#1}{#3}
+ \makedispenv{#2}{#3}
+}
-% @small... is usually equivalent to the non-small (@smallbook
-% redefines). We must call \example (or whatever) last in the
-% definition, since it reads the return following the @example (or
-% whatever) command.
-%
-% This actually allows (for example) @end display inside an
-% @smalldisplay. Too bad, but makeinfo will catch the error anyway.
+% @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
%
-\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display}
-\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp}
-\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format}
-\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
-
-% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
+% @smallexample and @smalllisp: use smaller fonts.
% Originally contributed by Pavel@xerox.
-\def\smalllispx{\begingroup
- \def\Esmalllisp{\nonfillfinish\endgroup}%
- \def\Esmallexample{\nonfillfinish\endgroup}%
- \smallexamplefonts
- \lisp
+%
+\maketwodispenvs {lisp}{example}{%
+ \nonfillstart
+ \tt
+ \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
+ \gobble % eat return
}
-% @display: same as @lisp except keep current font.
+% @display/@smalldisplay: same as @lisp except keep current font.
%
-\def\display{\begingroup
+\makedispenv {display}{%
\nonfillstart
- \let\Edisplay = \nonfillfinish
\gobble
}
-%
-% @smalldisplay (when @smallbook): @display plus smaller fonts.
-%
-\def\smalldisplayx{\begingroup
- \def\Esmalldisplay{\nonfillfinish\endgroup}%
- \smallexamplefonts \rm
- \display
-}
-% @format: same as @display except don't narrow margins.
+% @format/@smallformat: same as @display except don't narrow margins.
%
-\def\format{\begingroup
- \let\nonarrowing = t
+\makedispenv{format}{%
+ \let\nonarrowing = t%
\nonfillstart
- \let\Eformat = \nonfillfinish
\gobble
}
-%
-% @smallformat (when @smallbook): @format plus smaller fonts.
-%
-\def\smallformatx{\begingroup
- \def\Esmallformat{\nonfillfinish\endgroup}%
- \smallexamplefonts \rm
- \format
-}
-% @flushleft (same as @format).
-%
-\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
+% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
+\envdef\flushleft{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \gobble
+}
+\let\Eflushleft = \afterenvbreak
% @flushright.
%
-\def\flushright{\begingroup
- \let\nonarrowing = t
+\envdef\flushright{%
+ \let\nonarrowing = t%
\nonfillstart
- \let\Eflushright = \nonfillfinish
\advance\leftskip by 0pt plus 1fill
\gobble
}
+\let\Eflushright = \afterenvbreak
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
-% and narrows the margins.
+% and narrows the margins. We keep \parskip nonzero in general, since
+% we're doing normal filling. So, when using \aboveenvbreak and
+% \afterenvbreak, temporarily make \parskip 0.
%
-\def\quotation{%
- \begingroup\inENV %This group ends at the end of the @quotation body
+\envdef\quotation{%
{\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
- \singlespace
\parindent=0pt
- % We have retained a nonzero parskip for the environment, since we're
- % doing normal filling. So to avoid extra space below the environment...
- \def\Equotation{\parskip = 0pt \nonfillfinish}%
%
% @cartouche defines \nonarrowing to inhibit narrowing at next level down.
\ifx\nonarrowing\relax
@@ -4465,24 +4921,49 @@ width0pt\relax} \fi
\exdentamount = \lispnarrowing
\let\nonarrowing = \relax
\fi
+ \parsearg\quotationlabel
+}
+
+% We have retained a nonzero parskip for the environment, since we're
+% doing normal filling.
+%
+\def\Equotation{%
+ \par
+ \ifx\quotationauthor\undefined\else
+ % indent a bit.
+ \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
+ \fi
+ {\parskip=0pt \afterenvbreak}%
+}
+
+% If we're given an argument, typeset it in bold with a colon after.
+\def\quotationlabel#1{%
+ \def\temp{#1}%
+ \ifx\temp\empty \else
+ {\bf #1: }%
+ \fi
}
% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
-% If we want to allow any <char> as delimiter,
+% If we want to allow any <char> as delimiter,
% we need the curly braces so that makeinfo sees the @verb command, eg:
% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
%
% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
%
-% [Knuth] p. 344; only we need to do '@' too
+% [Knuth] p.344; only we need to do the other characters Texinfo sets
+% active too. Otherwise, they get lost as the first character on a
+% verbatim line.
\def\dospecials{%
- \do\ \do\\\do\@\do\{\do\}\do\$\do\&%
- \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
+ \do\ \do\\\do\{\do\}\do\$\do\&%
+ \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
+ \do\<\do\>\do\|\do\@\do+\do\"%
+}
%
% [Knuth] p. 380
\def\uncatcodespecials{%
- \def\do##1{\catcode`##1=12}\dospecials}
+ \def\do##1{\catcode`##1=\other}\dospecials}
%
% [Knuth] pp. 380,381,391
% Disable Spanish ligatures ?` and !` of \tt font
@@ -4530,6 +5011,8 @@ width0pt\relax} \fi
}
\endgroup
\def\setupverbatim{%
+ \nonfillstart
+ \advance\leftskip by -\defbodyindent
% Easiest (and conventionally used) font for verbatim
\tt
\def\par{\leavevmode\egroup\box0\endgraf}%
@@ -4543,15 +5026,15 @@ width0pt\relax} \fi
\everypar{\starttabbox}%
}
-% Do the @verb magic: verbatim text is quoted by unique
-% delimiter characters. Before first delimiter expect a
+% Do the @verb magic: verbatim text is quoted by unique
+% delimiter characters. Before first delimiter expect a
% right brace, after last delimiter expect closing brace:
%
% \def\doverb'{'<char>#1<char>'}'{#1}
%
% [Knuth] p. 382; only eat outer {}
\begingroup
- \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
+ \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
\gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
\endgroup
%
@@ -4563,611 +5046,395 @@ width0pt\relax} \fi
%
% \def\doverbatim#1@end verbatim{#1}
%
-% For Texinfo it's a lot easier than for LaTeX,
+% For Texinfo it's a lot easier than for LaTeX,
% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
-% we need not redefine '\', '{' and '}'
+% we need not redefine '\', '{' and '}'.
%
% Inspired by LaTeX's verbatim command set [latex.ltx]
-%% Include LaTeX hack for completeness -- never know
-%% \begingroup
-%% \catcode`|=0 \catcode`[=1
-%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
-%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
-%% #1|endgroup|def|Everbatim[]|end[verbatim]]
-%% |endgroup
+%
\begingroup
\catcode`\ =\active
- \gdef\doverbatim#1@end verbatim{#1\end{verbatim}}
+ \obeylines %
+ % ignore everything up to the first ^^M, that's the newline at the end
+ % of the @verbatim input line itself. Otherwise we get an extra blank
+ % line in the output.
+ \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
+ % We really want {...\end verbatim} in the body of the macro, but
+ % without the active space; thus we have to use \xdef and \gobble.
\endgroup
%
-\def\verbatim{%
- \def\Everbatim{\nonfillfinish\endgroup}%
- \begingroup
- \nonfillstart
- \advance\leftskip by -\defbodyindent
- \begingroup\setupverbatim\doverbatim
+\envdef\verbatim{%
+ \setupverbatim\doverbatim
}
+\let\Everbatim = \afterenvbreak
+
% @verbatiminclude FILE - insert text of file in verbatim environment.
%
-% Allow normal characters that we make active in the argument (a file name).
-\def\verbatiminclude{%
- \begingroup
- \catcode`\\=12
- \catcode`~=12
- \catcode`^=12
- \catcode`_=12
- \catcode`|=12
- \catcode`<=12
- \catcode`>=12
- \catcode`+=12
- \parsearg\doverbatiminclude
-}
-\def\setupverbatiminclude{%
- \begingroup
- \nonfillstart
- \advance\leftskip by -\defbodyindent
- \begingroup\setupverbatim
-}
+\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
%
\def\doverbatiminclude#1{%
- % Restore active chars for included file.
- \endgroup
- \begingroup
- \def\thisfile{#1}%
- \expandafter\expandafter\setupverbatiminclude\input\thisfile
- \endgroup\nonfillfinish\endgroup
+ {%
+ \makevalueexpandable
+ \setupverbatim
+ \input #1
+ \afterenvbreak
+ }%
}
% @copying ... @end copying.
% Save the text away for @insertcopying later.
-%
-\newbox\copyingbox
%
-\def\copying{\begingroup
- \parindent = 0pt % looks wrong on title page
- \def\Ecopying{\egroup\endgroup}%
- \global\setbox\copyingbox = \vbox\bgroup
+% We save the uninterpreted tokens, rather than creating a box.
+% Saving the text in a box would be much easier, but then all the
+% typesetting commands (@smallbook, font changes, etc.) have to be done
+% beforehand -- and a) we want @copying to be done first in the source
+% file; b) letting users define the frontmatter in as flexible order as
+% possible is very desirable.
+%
+\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
+\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
+%
+\def\insertcopying{%
+ \begingroup
+ \parindent = 0pt % paragraph indentation looks wrong on title page
+ \scanexp\copyingtext
+ \endgroup
}
-% @insertcopying.
-%
-\def\insertcopying{\unvcopy\copyingbox}
-
-
\message{defuns,}
% @defun etc.
-% Allow user to change definition object font (\df) internally
-\def\setdeffont #1 {\csname DEF#1\endcsname}
-
\newskip\defbodyindent \defbodyindent=.4in
\newskip\defargsindent \defargsindent=50pt
-\newskip\deftypemargin \deftypemargin=12pt
\newskip\deflastargmargin \deflastargmargin=18pt
-\newcount\parencount
-% define \functionparens, which makes ( and ) and & do special things.
-% \functionparens affects the group it is contained in.
-\def\activeparens{%
-\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
-\catcode`\[=\active \catcode`\]=\active}
-
-% Make control sequences which act like normal parenthesis chars.
-\let\lparen = ( \let\rparen = )
-
-{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
-
-% Be sure that we always have a definition for `(', etc. For example,
-% if the fn name has parens in it, \boldbrax will not be in effect yet,
-% so TeX would otherwise complain about undefined control sequence.
-\global\let(=\lparen \global\let)=\rparen
-\global\let[=\lbrack \global\let]=\rbrack
-
-\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
-\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
-% This is used to turn on special parens
-% but make & act ordinary (given that it's active).
-\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
-
-% Definitions of (, ) and & used in args for functions.
-% This is the definition of ( outside of all parentheses.
-\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
- \global\advance\parencount by 1
-}
-%
-% This is the definition of ( when already inside a level of parens.
-\gdef\opnested{\char`\(\global\advance\parencount by 1 }
-%
-\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
- % also in that case restore the outer-level definition of (.
- \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
- \global\advance \parencount by -1 }
-% If we encounter &foo, then turn on ()-hacking afterwards
-\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
-%
-\gdef\normalparens{\boldbrax\let&=\ampnr}
-} % End of definition inside \activeparens
-%% These parens (in \boldbrax) actually are a little bolder than the
-%% contained text. This is especially needed for [ and ]
-\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
-\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
-\let\ampnr = \&
-\def\lbrb{{\bf\char`\[}}
-\def\rbrb{{\bf\char`\]}}
-
-% Active &'s sneak into the index arguments, so make sure it's defined.
-{
- \catcode`& = 13
- \global\let& = \ampnr
-}
-
-% First, defname, which formats the header line itself.
-% #1 should be the function name.
-% #2 should be the type of definition, such as "Function".
-
-\def\defname #1#2{%
-% Get the values of \leftskip and \rightskip as they were
-% outside the @def...
-\dimen2=\leftskip
-\advance\dimen2 by -\defbodyindent
-\noindent
-\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
-\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
-\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
-\parshape 2 0in \dimen0 \defargsindent \dimen1
-% Now output arg 2 ("Function" or some such)
-% ending at \deftypemargin from the right margin,
-% but stuck inside a box of width 0 so it does not interfere with linebreaking
-{% Adjust \hsize to exclude the ambient margins,
-% so that \rightline will obey them.
-\advance \hsize by -\dimen2
-\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}%
-% Make all lines underfull and no complaints:
-\tolerance=10000 \hbadness=10000
-\advance\leftskip by -\defbodyindent
-\exdentamount=\defbodyindent
-{\df #1}\enskip % Generate function name
-}
-
-% Common pieces to start any @def...
-% #1 is the \E... control sequence to end the definition (which we define).
-% #2 is the \...x control sequence (which our caller defines).
-% #3 is the control sequence to process the header, such as \defunheader.
-%
-\def\parsebodycommon#1#2#3{%
- \begingroup\inENV
- % If there are two @def commands in a row, we'll have a \nobreak,
- % which is there to keep the function description together with its
- % header. But if there's nothing but headers, we want to allow a
- % break after all.
- \ifnum\lastpenalty = 10000 \penalty0 \fi
- \medbreak
- %
- % Define the \E... end token that this defining construct specifies
- % so that it will exit this group.
- \def#1{\endgraf\endgroup\medbreak}%
+% Start the processing of @deffn:
+\def\startdefun{%
+ \ifnum\lastpenalty<10000
+ \medbreak
+ \else
+ % If there are two @def commands in a row, we'll have a \nobreak,
+ % which is there to keep the function description together with its
+ % header. But if there's nothing but headers, we need to allow a
+ % break somewhere. Check specifically for penalty 10002, inserted
+ % by \defargscommonending, instead of 10000, since the sectioning
+ % commands also insert a nobreak penalty, and we don't want to allow
+ % a break between a section heading and a defun.
+ %
+ \ifnum\lastpenalty=10002 \penalty2000 \fi
+ %
+ % Similarly, after a section heading, do not allow a break.
+ % But do insert the glue.
+ \medskip % preceded by discardable penalty, so not a breakpoint
+ \fi
%
\parindent=0in
\advance\leftskip by \defbodyindent
\exdentamount=\defbodyindent
}
-% Process body of @defun, @deffn, @defmac, etc.
-%
-\def\defparsebody#1#2#3{%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
- \catcode61=\active % 61 is `='
- \begingroup\obeylines\activeparens
- \spacesplit#3%
-}
-
-% #1, #2, #3 are the common arguments (see \defparsebody).
-% #4, delimited by the space, is the class name.
-%
-\def\defmethparsebody#1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
- \begingroup\obeylines\activeparens
- \spacesplit{#3{#4}}%
+\def\dodefunx#1{%
+ % First, check whether we are in the right environment:
+ \checkenv#1%
+ %
+ % As above, allow line break if we have multiple x headers in a row.
+ % It's not a great place, though.
+ \ifnum\lastpenalty=10002 \penalty3000 \fi
+ %
+ % And now, it's time to reuse the body of the original defun:
+ \expandafter\gobbledefun#1%
}
+\def\gobbledefun#1\startdefun{}
-% Used for @deftypemethod and @deftypeivar.
-% #1, #2, #3 are the common arguments (see \defparsebody).
-% #4, delimited by a space, is the class name.
-% #5 is the method's return type.
+% \printdefunline \deffnheader{text}
%
-\def\deftypemethparsebody#1#2#3#4 #5 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
- \begingroup\obeylines\activeparens
- \spacesplit{#3{#4}{#5}}%
-}
-
-% Used for @deftypeop. The change from \deftypemethparsebody is an
-% extra argument at the beginning which is the `category', instead of it
-% being the hardwired string `Method' or `Instance Variable'. We have
-% to account for this both in the \...x definition and in parsing the
-% input at hand. Thus also need a control sequence (passed as #5) for
-% the \E... definition to assign the category name to.
-%
-\def\deftypeopparsebody#1#2#3#4#5 #6 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 ##2 ##3 {%
- \def#4{##1}%
- \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}%
- \begingroup\obeylines\activeparens
- \spacesplit{#3{#5}{#6}}%
+\def\printdefunline#1#2{%
+ \begingroup
+ % call \deffnheader:
+ #1#2 \endheader
+ % common ending:
+ \interlinepenalty = 10000
+ \advance\rightskip by 0pt plus 1fil
+ \endgraf
+ \nobreak\vskip -\parskip
+ \penalty 10002 % signal to \startdefun and \dodefunx
+ % Some of the @defun-type tags do not enable magic parentheses,
+ % rendering the following check redundant. But we don't optimize.
+ \checkparencounts
+ \endgroup
}
-% For @defop.
-\def\defopparsebody #1#2#3#4#5 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 ##2 {\def#4{##1}%
- \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
- \begingroup\obeylines\activeparens
- \spacesplit{#3{#5}}%
-}
+\def\Edefun{\endgraf\medbreak}
-% These parsing functions are similar to the preceding ones
-% except that they do not make parens into active characters.
-% These are used for "variables" since they have no arguments.
+% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
+% the only thing remainnig is to define \deffnheader.
%
-\def\defvarparsebody #1#2#3{%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2{\begingroup\obeylines\spacesplit#3}%
- \catcode61=\active %
- \begingroup\obeylines
- \spacesplit#3%
-}
-
-% @defopvar.
-\def\defopvarparsebody #1#2#3#4#5 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 ##2 {\def#4{##1}%
- \begingroup\obeylines\spacesplit{#3{##2}}}%
- \begingroup\obeylines
- \spacesplit{#3{#5}}%
-}
-
-\def\defvrparsebody#1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
- \begingroup\obeylines
- \spacesplit{#3{#4}}%
+\def\makedefun#1{%
+ \expandafter\let\csname E#1\endcsname = \Edefun
+ \edef\temp{\noexpand\domakedefun
+ \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
+ \temp
}
-% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
-% type is just `struct', because we lose the braces in `{struct
-% termios}' when \spacesplit reads its undelimited argument. Sigh.
-% \let\deftpparsebody=\defvrparsebody
+% \domakedefun \deffn \deffnx \deffnheader
%
-% So, to get around this, we put \empty in with the type name. That
-% way, TeX won't find exactly `{...}' as an undelimited argument, and
-% won't strip off the braces.
+% Define \deffn and \deffnx, without parameters.
+% \deffnheader has to be defined explicitly.
%
-\def\deftpparsebody #1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
- \begingroup\obeylines
- \spacesplit{\parsetpheaderline{#3{#4}}}\empty
+\def\domakedefun#1#2#3{%
+ \envdef#1{%
+ \startdefun
+ \parseargusing\activeparens{\printdefunline#3}%
+ }%
+ \def#2{\dodefunx#1}%
+ \def#3%
}
-% Fine, but then we have to eventually remove the \empty *and* the
-% braces (if any). That's what this does.
-%
-\def\removeemptybraces\empty#1\relax{#1}
+%%% Untyped functions:
-% After \spacesplit has done its work, this is called -- #1 is the final
-% thing to call, #2 the type name (which starts with \empty), and #3
-% (which might be empty) the arguments.
-%
-\def\parsetpheaderline#1#2#3{%
- #1{\removeemptybraces#2\relax}{#3}%
-}%
+% @deffn category name args
+\makedefun{deffn}{\deffngeneral{}}
-% Split up #2 at the first space token.
-% call #1 with two arguments:
-% the first is all of #2 before the space token,
-% the second is all of #2 after that space token.
-% If #2 contains no space token, all of it is passed as the first arg
-% and the second is passed as empty.
-%
-{\obeylines
-\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
-\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
-\ifx\relax #3%
-#1{#2}{}\else #1{#2}{#3#4}\fi}}
+% @deffn category class name args
+\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
-% Define @defun.
+% \defopon {category on}class name args
+\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
-% First, define the processing that is wanted for arguments of \defun
-% Use this to expand the args and terminate the paragraph they make up
-
-\def\defunargs#1{\functionparens \sl
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-% Set the font temporarily and use \font in case \setfont made \tensl a macro.
-{\tensl\hyphenchar\font=0}%
-#1%
-{\tensl\hyphenchar\font=45}%
-\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
-\interlinepenalty=10000
-\advance\rightskip by 0pt plus 1fil
-\endgraf\nobreak\vskip -\parskip\nobreak
+% \deffngeneral {subind}category name args
+%
+\def\deffngeneral#1#2 #3 #4\endheader{%
+ % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
+ \dosubind{fn}{\code{#3}}{#1}%
+ \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
}
-\def\deftypefunargs #1{%
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-% Use \boldbraxnoamp, not \functionparens, so that & is not special.
-\boldbraxnoamp
-\tclose{#1}% avoid \code because of side effects on active chars
-\interlinepenalty=10000
-\advance\rightskip by 0pt plus 1fil
-\endgraf\nobreak\vskip -\parskip\nobreak
-}
+%%% Typed functions:
-% Do complete processing of one @defun or @defunx line already parsed.
+% @deftypefn category type name args
+\makedefun{deftypefn}{\deftypefngeneral{}}
-% @deffn Command forward-char nchars
+% @deftypeop category class type name args
+\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
-\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
+% \deftypeopon {category on}class type name args
+\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
-\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
+% \deftypefngeneral {subind}category type name args
+%
+\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
+ \dosubind{fn}{\code{#4}}{#1}%
+ \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
}
-% @defun == @deffn Function
-
-\def\defun{\defparsebody\Edefun\defunx\defunheader}
+%%% Typed variables:
-\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{\putwordDeffunc}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
+% @deftypevr category type var args
+\makedefun{deftypevr}{\deftypecvgeneral{}}
-% @deftypefun int foobar (int @var{foo}, float @var{bar})
+% @deftypecv category class type var args
+\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
-\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
+% \deftypecvof {category of}class type var args
+\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
-% #1 is the data type. #2 is the name and args.
-\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
-% #1 is the data type, #2 the name, #3 the args.
-\def\deftypefunheaderx #1#2 #3\relax{%
-\doind {fn}{\code{#2}}% Make entry in function index
-\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
-\deftypefunargs {#3}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
+% \deftypecvgeneral {subind}category type var args
+%
+\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
+ \dosubind{vr}{\code{#4}}{#1}%
+ \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
}
-% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
+%%% Untyped variables:
-% \defheaderxcond#1\relax$.$
-% puts #1 in @code, followed by a space, but does nothing if #1 is null.
-\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
+% @defvr category var args
+\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
-% #1 is the classification. #2 is the data type. #3 is the name and args.
-\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
-% #1 is the classification, #2 the data type, #3 the name, #4 the args.
-\def\deftypefnheaderx #1#2#3 #4\relax{%
-\doind {fn}{\code{#3}}% Make entry in function index
-\begingroup
-\normalparens % notably, turn off `&' magic, which prevents
-% at least some C++ text from working
-\defname {\defheaderxcond#2\relax$.$#3}{#1}%
-\deftypefunargs {#4}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
+% @defcv category class var args
+\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
-% @defmac == @deffn Macro
+% \defcvof {category of}class var args
+\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
-\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
-
-\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{\putwordDefmac}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
+%%% Type:
+% @deftp category name args
+\makedefun{deftp}#1 #2 #3\endheader{%
+ \doind{tp}{\code{#2}}%
+ \defname{#1}{}{#2}\defunargs{#3\unskip}%
}
-% @defspec == @deffn Special Form
-
-\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
+% Remaining @defun-like shortcuts:
+\makedefun{defun}{\deffnheader{\putwordDeffunc} }
+\makedefun{defmac}{\deffnheader{\putwordDefmac} }
+\makedefun{defspec}{\deffnheader{\putwordDefspec} }
+\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
+\makedefun{defvar}{\defvrheader{\putwordDefvar} }
+\makedefun{defopt}{\defvrheader{\putwordDefopt} }
+\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
+\makedefun{defmethod}{\defopon\putwordMethodon}
+\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
+\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
+\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
-\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{\putwordDefspec}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defop CATEGORY CLASS OPERATION ARG...
+% \defname, which formats the name of the @def (not the args).
+% #1 is the category, such as "Function".
+% #2 is the return type, if any.
+% #3 is the function name.
%
-\def\defop #1 {\def\defoptype{#1}%
-\defopparsebody\Edefop\defopx\defopheader\defoptype}
+% We are followed by (but not passed) the arguments, if any.
%
-\def\defopheader#1#2#3{%
-\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index
-\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}%
-\defunargs {#3}\endgroup %
+\def\defname#1#2#3{%
+ % Get the values of \leftskip and \rightskip as they were outside the @def...
+ \advance\leftskip by -\defbodyindent
+ %
+ % How we'll format the type name. Putting it in brackets helps
+ % distinguish it from the body text that may end up on the next line
+ % just below it.
+ \def\temp{#1}%
+ \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
+ %
+ % Figure out line sizes for the paragraph shape.
+ % The first line needs space for \box0; but if \rightskip is nonzero,
+ % we need only space for the part of \box0 which exceeds it:
+ \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
+ % The continuations:
+ \dimen2=\hsize \advance\dimen2 by -\defargsindent
+ % (plain.tex says that \dimen1 should be used only as global.)
+ \parshape 2 0in \dimen0 \defargsindent \dimen2
+ %
+ % Put the type name to the right margin.
+ \noindent
+ \hbox to 0pt{%
+ \hfil\box0 \kern-\hsize
+ % \hsize has to be shortened this way:
+ \kern\leftskip
+ % Intentionally do not respect \rightskip, since we need the space.
+ }%
+ %
+ % Allow all lines to be underfull without complaint:
+ \tolerance=10000 \hbadness=10000
+ \exdentamount=\defbodyindent
+ {%
+ % defun fonts. We use typewriter by default (used to be bold) because:
+ % . we're printing identifiers, they should be in tt in principle.
+ % . in languages with many accents, such as Czech or French, it's
+ % common to leave accents off identifiers. The result looks ok in
+ % tt, but exceedingly strange in rm.
+ % . we don't want -- and --- to be treated as ligatures.
+ % . this still does not fix the ?` and !` ligatures, but so far no
+ % one has made identifiers using them :).
+ \df \tt
+ \def\temp{#2}% return value type
+ \ifx\temp\empty\else \tclose{\temp} \fi
+ #3% output function name
+ }%
+ {\rm\enskip}% hskip 0.5 em of \tenrm
+ %
+ \boldbrax
+ % arguments will be output next, if any.
}
-% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
+% Print arguments in slanted roman (not ttsl), inconsistently with using
+% tt for the name. This is because literal text is sometimes needed in
+% the argument list (groff manual), and ttsl and tt are not very
+% distinguishable. Prevent hyphenation at `-' chars.
%
-\def\deftypeop #1 {\def\deftypeopcategory{#1}%
- \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
- \deftypeopcategory}
-%
-% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
-\def\deftypeopheader#1#2#3#4{%
- \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
- \begingroup
- \defname{\defheaderxcond#2\relax$.$#3}
- {\deftypeopcategory\ \putwordon\ \code{#1}}%
- \deftypefunargs{#4}%
- \endgroup
+\def\defunargs#1{%
+ % use sl by default (not ttsl),
+ % tt for the names.
+ \df \sl \hyphenchar\font=0
+ %
+ % On the other hand, if an argument has two dashes (for instance), we
+ % want a way to get ttsl. Let's try @var for that.
+ \let\var=\ttslanted
+ #1%
+ \sl\hyphenchar\font=45
}
-% @deftypemethod CLASS TYPE METHOD ARG...
+% We want ()&[] to print specially on the defun line.
%
-\def\deftypemethod{%
- \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
-%
-% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
-\def\deftypemethodheader#1#2#3#4{%
- \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
- \begingroup
- \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
- \deftypefunargs{#4}%
- \endgroup
+\def\activeparens{%
+ \catcode`\(=\active \catcode`\)=\active
+ \catcode`\[=\active \catcode`\]=\active
+ \catcode`\&=\active
}
-% @deftypeivar CLASS TYPE VARNAME
-%
-\def\deftypeivar{%
- \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
-%
-% #1 is the class name, #2 the data type, #3 the variable name.
-\def\deftypeivarheader#1#2#3{%
- \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
- \begingroup
- \defname{\defheaderxcond#2\relax$.$#3}
- {\putwordInstanceVariableof\ \code{#1}}%
- \defvarargs{#3}%
- \endgroup
-}
+% Make control sequences which act like normal parenthesis chars.
+\let\lparen = ( \let\rparen = )
-% @defmethod == @defop Method
-%
-\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
-%
-% #1 is the class name, #2 the method name, #3 the args.
-\def\defmethodheader#1#2#3{%
- \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
- \begingroup
- \defname{#2}{\putwordMethodon\ \code{#1}}%
- \defunargs{#3}%
- \endgroup
-}
+% Be sure that we always have a definition for `(', etc. For example,
+% if the fn name has parens in it, \boldbrax will not be in effect yet,
+% so TeX would otherwise complain about undefined control sequence.
+{
+ \activeparens
+ \global\let(=\lparen \global\let)=\rparen
+ \global\let[=\lbrack \global\let]=\rbrack
+ \global\let& = \&
-% @defcv {Class Option} foo-class foo-flag
+ \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+ \gdef\magicamp{\let&=\amprm}
+}
-\def\defcv #1 {\def\defcvtype{#1}%
-\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
+\newcount\parencount
-\def\defcvarheader #1#2#3{%
-\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index
-\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}%
-\defvarargs {#3}\endgroup %
+% If we encounter &foo, then turn on ()-hacking afterwards
+\newif\ifampseen
+\def\amprm#1 {\ampseentrue{\bf\&#1 }}
+
+\def\parenfont{%
+ \ifampseen
+ % At the first level, print parens in roman,
+ % otherwise use the default font.
+ \ifnum \parencount=1 \rm \fi
+ \else
+ % The \sf parens (in \boldbrax) actually are a little bolder than
+ % the contained text. This is especially needed for [ and ] .
+ \sf
+ \fi
}
-
-% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
-%
-\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
-%
-\def\defivarheader#1#2#3{%
- \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index
- \begingroup
- \defname{#2}{\putwordInstanceVariableof\ #1}%
- \defvarargs{#3}%
- \endgroup
+\def\infirstlevel#1{%
+ \ifampseen
+ \ifnum\parencount=1
+ #1%
+ \fi
+ \fi
}
+\def\bfafterword#1 {#1 \bf}
-% @defvar
-% First, define the processing that is wanted for arguments of @defvar.
-% This is actually simple: just print them in roman.
-% This must expand the args and terminate the paragraph they make up
-\def\defvarargs #1{\normalparens #1%
-\interlinepenalty=10000
-\endgraf\nobreak\vskip -\parskip\nobreak}
-
-% @defvr Counter foo-count
-
-\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
-
-\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
-
-% @defvar == @defvr Variable
-
-\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
-
-\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{\putwordDefvar}%
-\defvarargs {#2}\endgroup %
+\def\opnr{%
+ \global\advance\parencount by 1
+ {\parenfont(}%
+ \infirstlevel \bfafterword
}
-
-% @defopt == @defvr {User Option}
-
-\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
-
-\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{\putwordDefopt}%
-\defvarargs {#2}\endgroup %
+\def\clnr{%
+ {\parenfont)}%
+ \infirstlevel \sl
+ \global\advance\parencount by -1
}
-% @deftypevar int foobar
-
-\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
-
-% #1 is the data type. #2 is the name, perhaps followed by text that
-% is actually part of the data type, which should not be put into the index.
-\def\deftypevarheader #1#2{%
-\dovarind#2 \relax% Make entry in variables index
-\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
-\interlinepenalty=10000
-\endgraf\nobreak\vskip -\parskip\nobreak
-\endgroup}
-\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
-
-% @deftypevr {Global Flag} int enable
-
-\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
-
-\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
-\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
-\interlinepenalty=10000
-\endgraf\nobreak\vskip -\parskip\nobreak
-\endgroup}
-
-% Now define @deftp
-% Args are printed in bold, a slight difference from @defvar.
-
-\def\deftpargs #1{\bf \defvarargs{#1}}
-
-% @deftp Class window height width ...
-
-\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
-
-\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
-\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
+\newcount\brackcount
+\def\lbrb{%
+ \global\advance\brackcount by 1
+ {\bf[}%
+}
+\def\rbrb{%
+ {\bf]}%
+ \global\advance\brackcount by -1
+}
-% These definitions are used if you use @defunx (etc.)
-% anywhere other than immediately after a @defun or @defunx.
-%
-\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
-\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
-\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
-\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
-\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
-\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
-\def\defopx#1 {\errmessage{@defopx in invalid context}}
-\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
-\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
-\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
-\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
-\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
-\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
-\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
-\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
-\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
-\def\defunx#1 {\errmessage{@defunx in invalid context}}
-\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
-\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
+\def\checkparencounts{%
+ \ifnum\parencount=0 \else \badparencount \fi
+ \ifnum\brackcount=0 \else \badbrackcount \fi
+}
+\def\badparencount{%
+ \errmessage{Unbalanced parentheses in @def}%
+ \global\parencount=0
+}
+\def\badbrackcount{%
+ \errmessage{Unbalanced square braces in @def}%
+ \global\brackcount=0
+}
\message{macros,}
@@ -5176,28 +5443,42 @@ width0pt\relax} \fi
% To do this right we need a feature of e-TeX, \scantokens,
% which we arrange to emulate with a temporary file in ordinary TeX.
\ifx\eTeXversion\undefined
- \newwrite\macscribble
- \def\scanmacro#1{%
- \begingroup \newlinechar`\^^M
- % Undo catcode changes of \startcontents and \doprintindex
- \catcode`\@=0 \catcode`\\=12 \escapechar=`\@
- % Append \endinput to make sure that TeX does not see the ending newline.
- \toks0={#1\endinput}%
- \immediate\openout\macscribble=\jobname.tmp
- \immediate\write\macscribble{\the\toks0}%
- \immediate\closeout\macscribble
- \let\xeatspaces\eatspaces
- \input \jobname.tmp
- \endgroup
-}
-\else
-\def\scanmacro#1{%
-\begingroup \newlinechar`\^^M
-% Undo catcode changes of \startcontents and \doprintindex
-\catcode`\@=0 \catcode`\\=12 \escapechar=`\@
-\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
+ \newwrite\macscribble
+ \def\scantokens#1{%
+ \toks0={#1}%
+ \immediate\openout\macscribble=\jobname.tmp
+ \immediate\write\macscribble{\the\toks0}%
+ \immediate\closeout\macscribble
+ \input \jobname.tmp
+ }
\fi
+\def\scanmacro#1{%
+ \begingroup
+ \newlinechar`\^^M
+ \let\xeatspaces\eatspaces
+ % Undo catcode changes of \startcontents and \doprintindex
+ % When called from @insertcopying or (short)caption, we need active
+ % backslash to get it printed correctly. Previously, we had
+ % \catcode`\\=\other instead. We'll see whether a problem appears
+ % with macro expansion. --kasal, 19aug04
+ \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
+ % ... and \example
+ \spaceisspace
+ %
+ % Append \endinput to make sure that TeX does not see the ending newline.
+ %
+ % I've verified that it is necessary both for e-TeX and for ordinary TeX
+ % --kasal, 29nov03
+ \scantokens{#1\endinput}%
+ \endgroup
+}
+
+\def\scanexp#1{%
+ \edef\temp{\noexpand\scanmacro{#1}}%
+ \temp
+}
+
\newcount\paramno % Count of parameters
\newtoks\macname % Macro name
\newif\ifrecursive % Is it recursive?
@@ -5205,13 +5486,15 @@ width0pt\relax} \fi
% \do\macro1\do\macro2...
% Utility routines.
-% Thisdoes \let #1 = #2, except with \csnames.
+% This does \let #1 = #2, with \csnames; that is,
+% \let \csname#1\endcsname = \csname#2\endcsname
+% (except of course we have to play expansion games).
+%
\def\cslet#1#2{%
-\expandafter\expandafter
-\expandafter\let
-\expandafter\expandafter
-\csname#1\endcsname
-\csname#2\endcsname}
+ \expandafter\let
+ \csname#1\expandafter\endcsname
+ \csname#2\endcsname
+}
% Trim leading and trailing spaces off a string.
% Concepts from aro-bend problem 15 (see CTAN).
@@ -5224,7 +5507,7 @@ width0pt\relax} \fi
}
% Trim a single trailing ^^M off a string.
-{\catcode`\^^M=12\catcode`\Q=3%
+{\catcode`\^^M=\other \catcode`\Q=3%
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
\gdef\eatcrb#1Q#2Q{#1}%
@@ -5238,30 +5521,36 @@ width0pt\relax} \fi
% done by making ^^M (\endlinechar) catcode 12 when reading the macro
% body, and then making it the \newlinechar in \scanmacro.
+\def\scanctxt{%
+ \catcode`\"=\other
+ \catcode`\+=\other
+ \catcode`\<=\other
+ \catcode`\>=\other
+ \catcode`\@=\other
+ \catcode`\^=\other
+ \catcode`\_=\other
+ \catcode`\|=\other
+ \catcode`\~=\other
+}
+
+\def\scanargctxt{%
+ \scanctxt
+ \catcode`\\=\other
+ \catcode`\^^M=\other
+}
+
\def\macrobodyctxt{%
- \catcode`\~=12
- \catcode`\^=12
- \catcode`\_=12
- \catcode`\|=12
- \catcode`\<=12
- \catcode`\>=12
- \catcode`\+=12
- \catcode`\{=12
- \catcode`\}=12
- \catcode`\@=12
- \catcode`\^^M=12
- \usembodybackslash}
+ \scanctxt
+ \catcode`\{=\other
+ \catcode`\}=\other
+ \catcode`\^^M=\other
+ \usembodybackslash
+}
\def\macroargctxt{%
- \catcode`\~=12
- \catcode`\^=12
- \catcode`\_=12
- \catcode`\|=12
- \catcode`\<=12
- \catcode`\>=12
- \catcode`\+=12
- \catcode`\@=12
- \catcode`\\=12}
+ \scanctxt
+ \catcode`\\=\other
+}
% \mbodybackslash is the definition of \ in @macro bodies.
% It maps \foo\ => \csname macarg.foo\endcsname => #N
@@ -5302,32 +5591,32 @@ width0pt\relax} \fi
\else \expandafter\parsemacbody
\fi}
-\def\unmacro{\parsearg\unmacroxxx}
-\def\unmacroxxx#1{%
+\parseargdef\unmacro{%
\if1\csname ismacro.#1\endcsname
\global\cslet{#1}{macsave.#1}%
\global\expandafter\let \csname ismacro.#1\endcsname=0%
- % Remove the macro name from \macrolist
+ % Remove the macro name from \macrolist:
\begingroup
- \edef\tempa{\expandafter\noexpand\csname#1\endcsname}%
- \def\do##1{%
- \def\tempb{##1}%
- \ifx\tempa\tempb
- % remove this
- \else
- \toks0 = \expandafter{\newmacrolist\do}%
- \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}%
- \fi}%
- \def\newmacrolist{}%
- % Execute macro list to define \newmacrolist
- \macrolist
- \global\let\macrolist\newmacrolist
+ \expandafter\let\csname#1\endcsname \relax
+ \let\do\unmacrodo
+ \xdef\macrolist{\macrolist}%
\endgroup
\else
\errmessage{Macro #1 not defined}%
\fi
}
+% Called by \do from \dounmacro on each macro. The idea is to omit any
+% macro definitions that have been changed to \relax.
+%
+\def\unmacrodo#1{%
+ \ifx#1\relax
+ % remove this
+ \else
+ \noexpand\do \noexpand #1%
+ \fi
+}
+
% This makes use of the obscure feature that if the last token of a
% <parameter list> is #, then the preceding argument is delimited by
% an opening brace, and that opening brace is not consumed.
@@ -5443,25 +5732,41 @@ width0pt\relax} \fi
\expandafter\parsearg
\fi \next}
-% We mant to disable all macros during \shipout so that they are not
+% We want to disable all macros during \shipout so that they are not
% expanded by \write.
\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
\edef\next{\macrolist}\expandafter\endgroup\next}
+% For \indexnofonts, we need to get rid of all macros, leaving only the
+% arguments (if present). Of course this is not nearly correct, but it
+% is the best we can do for now. makeinfo does not expand macros in the
+% argument to @deffn, which ends up writing an index entry, and texindex
+% isn't prepared for an index sort entry that starts with \.
+%
+% Since macro invocations are followed by braces, we can just redefine them
+% to take a single TeX argument. The case of a macro invocation that
+% goes to end-of-line is not handled.
+%
+\def\emptyusermacros{\begingroup
+ \def\do##1{\let\noexpand##1=\noexpand\asis}%
+ \edef\next{\macrolist}\expandafter\endgroup\next}
+
% @alias.
% We need some trickery to remove the optional spaces around the equal
% sign. Just make them active and then expand them all to nothing.
-\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
+\def\alias{\parseargusing\obeyspaces\aliasxxx}
\def\aliasxxx #1{\aliasyyy#1\relax}
-\def\aliasyyy #1=#2\relax{\ignoreactivespaces
-\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
- \expandafter\noexpand\csname#2\endcsname}%
-\expandafter\endgroup\next}
+\def\aliasyyy #1=#2\relax{%
+ {%
+ \expandafter\let\obeyedspace=\empty
+ \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
+ }%
+ \next
+}
\message{cross references,}
-% @xref etc.
\newwrite\auxfile
@@ -5473,56 +5778,70 @@ width0pt\relax} \fi
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
node \samp{\ignorespaces#1{}}}
-% @node's job is to define \lastnode.
-\def\node{\ENVcheck\parsearg\nodezzz}
-\def\nodezzz#1{\nodexxx [#1,]}
-\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
+% @node's only job in TeX is to define \lastnode, which is used in
+% cross-references. The @node line might or might not have commas, and
+% might or might not have spaces before the first comma, like:
+% @node foo , bar , ...
+% We don't want such trailing spaces in the node name.
+%
+\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
+%
+% also remove a trailing comma, in case of something like this:
+% @node Help-Cross, , , Cross-refs
+\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
+\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
+
\let\nwnode=\node
-\let\lastnode=\relax
-
-% The sectioning commands (@chapter, etc.) call these.
-\def\donoderef{%
- \ifx\lastnode\relax\else
- \expandafter\expandafter\expandafter\setref{\lastnode}%
- {Ysectionnumberandtype}%
- \global\let\lastnode=\relax
- \fi
-}
-\def\unnumbnoderef{%
- \ifx\lastnode\relax\else
- \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
- \global\let\lastnode=\relax
- \fi
-}
-\def\appendixnoderef{%
- \ifx\lastnode\relax\else
- \expandafter\expandafter\expandafter\setref{\lastnode}%
- {Yappendixletterandtype}%
- \global\let\lastnode=\relax
+\let\lastnode=\empty
+
+% Write a cross-reference definition for the current node. #1 is the
+% type (Ynumbered, Yappendix, Ynothing).
+%
+\def\donoderef#1{%
+ \ifx\lastnode\empty\else
+ \setref{\lastnode}{#1}%
+ \global\let\lastnode=\empty
\fi
}
-
% @anchor{NAME} -- define xref target at arbitrary point.
%
\newcount\savesfregister
-\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
-\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
-
-% \setref{NAME}{SNT} defines a cross-reference point NAME, namely
-% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have
-% to set \indexdummies so commands such as @code in a section title
-% aren't expanded. It would be nicer not to expand the titles in the
-% first place, but there's so many layers that that is hard to do.
-%
-\def\setref#1#2{{%
- \indexdummies
+%
+\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
+\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
+\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
+
+% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
+% anchor), which consists of three parts:
+% 1) NAME-title - the current sectioning name taken from \thissection,
+% or the anchor name.
+% 2) NAME-snt - section number and type, passed as the SNT arg, or
+% empty for anchors.
+% 3) NAME-pg - the page number.
+%
+% This is called from \donoderef, \anchor, and \dofloat. In the case of
+% floats, there is an additional part, which is not written here:
+% 4) NAME-lof - the text as it should appear in a @listoffloats.
+%
+\def\setref#1#2{%
\pdfmkdest{#1}%
- \dosetq{#1-title}{Ytitle}%
- \dosetq{#1-pg}{Ypagenumber}%
- \dosetq{#1-snt}{#2}%
-}}
+ \iflinks
+ {%
+ \atdummies % preserve commands, but don't expand them
+ \turnoffactive
+ \otherbackslash
+ \edef\writexrdef##1##2{%
+ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
+ ##1}{##2}}% these are parameters of \writexrdef
+ }%
+ \toks0 = \expandafter{\thissection}%
+ \immediate \writexrdef{title}{\the\toks0 }%
+ \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
+ \writexrdef{pg}{\folio}% will be written later, during \shipout
+ }%
+ \fi
+}
% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
% the node name, #2 the name of the Info cross-reference, #3 the printed
@@ -5535,137 +5854,156 @@ width0pt\relax} \fi
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
\unsepspaces
\def\printedmanual{\ignorespaces #5}%
- \def\printednodename{\ignorespaces #3}%
- \setbox1=\hbox{\printedmanual}%
- \setbox0=\hbox{\printednodename}%
+ \def\printedrefname{\ignorespaces #3}%
+ \setbox1=\hbox{\printedmanual\unskip}%
+ \setbox0=\hbox{\printedrefname\unskip}%
\ifdim \wd0 = 0pt
% No printed node name was explicitly given.
\expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
% Use the node name inside the square brackets.
- \def\printednodename{\ignorespaces #1}%
+ \def\printedrefname{\ignorespaces #1}%
\else
% Use the actual chapter/section title appear inside
% the square brackets. Use the real section title if we have it.
\ifdim \wd1 > 0pt
% It is in another manual, so we don't have it.
- \def\printednodename{\ignorespaces #1}%
+ \def\printedrefname{\ignorespaces #1}%
\else
\ifhavexrefs
% We know the real title if we have the xref values.
- \def\printednodename{\refx{#1-title}{}}%
+ \def\printedrefname{\refx{#1-title}{}}%
\else
% Otherwise just copy the Info node name.
- \def\printednodename{\ignorespaces #1}%
+ \def\printedrefname{\ignorespaces #1}%
\fi%
\fi
\fi
\fi
%
- % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
- % insert empty discretionaries after hyphens, which means that it will
- % not find a line break at a hyphen in a node names. Since some manuals
- % are best written with fairly long node names, containing hyphens, this
- % is a loss. Therefore, we give the text of the node name again, so it
- % is as if TeX is seeing it for the first time.
+ % Make link in pdf output.
\ifpdf
\leavevmode
\getfilename{#4}%
- {\normalturnoffactive
+ {\turnoffactive \otherbackslash
\ifnum\filenamelength>0
\startlink attr{/Border [0 0 0]}%
goto file{\the\filename.pdf} name{#1}%
\else
\startlink attr{/Border [0 0 0]}%
- goto name{#1}%
+ goto name{\pdfmkpgn{#1}}%
\fi
}%
\linkcolor
\fi
%
- \ifdim \wd1 > 0pt
- \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
+ % Float references are printed completely differently: "Figure 1.2"
+ % instead of "[somenode], p.3". We distinguish them by the
+ % LABEL-title being set to a magic string.
+ {%
+ % Have to otherify everything special to allow the \csname to
+ % include an _ in the xref name, etc.
+ \indexnofonts
+ \turnoffactive
+ \otherbackslash
+ \expandafter\global\expandafter\let\expandafter\Xthisreftitle
+ \csname XR#1-title\endcsname
+ }%
+ \iffloat\Xthisreftitle
+ % If the user specified the print name (third arg) to the ref,
+ % print it instead of our usual "Figure 1.2".
+ \ifdim\wd0 = 0pt
+ \refx{#1-snt}%
+ \else
+ \printedrefname
+ \fi
+ %
+ % if the user also gave the printed manual name (fifth arg), append
+ % "in MANUALNAME".
+ \ifdim \wd1 > 0pt
+ \space \putwordin{} \cite{\printedmanual}%
+ \fi
\else
- % _ (for example) has to be the character _ for the purposes of the
- % control sequence corresponding to the node, but it has to expand
- % into the usual \leavevmode...\vrule stuff for purposes of
- % printing. So we \turnoffactive for the \refx-snt, back on for the
- % printing, back off for the \refx-pg.
- {\normalturnoffactive
- % Only output a following space if the -snt ref is nonempty; for
- % @unnumbered and @anchor, it won't be.
- \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
- \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
- }%
- % [mynode],
- [\printednodename],\space
- % page 3
- \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+ % node/anchor (non-float) references.
+ %
+ % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
+ % insert empty discretionaries after hyphens, which means that it will
+ % not find a line break at a hyphen in a node names. Since some manuals
+ % are best written with fairly long node names, containing hyphens, this
+ % is a loss. Therefore, we give the text of the node name again, so it
+ % is as if TeX is seeing it for the first time.
+ \ifdim \wd1 > 0pt
+ \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
+ \else
+ % _ (for example) has to be the character _ for the purposes of the
+ % control sequence corresponding to the node, but it has to expand
+ % into the usual \leavevmode...\vrule stuff for purposes of
+ % printing. So we \turnoffactive for the \refx-snt, back on for the
+ % printing, back off for the \refx-pg.
+ {\turnoffactive \otherbackslash
+ % Only output a following space if the -snt ref is nonempty; for
+ % @unnumbered and @anchor, it won't be.
+ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+ \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+ }%
+ % output the `[mynode]' via a macro so it can be overridden.
+ \xrefprintnodename\printedrefname
+ %
+ % But we always want a comma and a space:
+ ,\space
+ %
+ % output the `page 3'.
+ \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
+ \fi
\fi
\endlink
\endgroup}
-% \dosetq is the interface for calls from other macros
-
-% Use \normalturnoffactive so that punctuation chars such as underscore
-% and backslash work in node names. (\turnoffactive doesn't do \.)
-\def\dosetq#1#2{%
- {\let\folio=0%
- \normalturnoffactive
- \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
- \iflinks
- \next
- \fi
- }%
-}
-
-% \internalsetq {foo}{page} expands into
-% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
-% When the aux file is read, ' is the escape character
-
-\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
-
-% Things to be expanded by \internalsetq
-
-\def\Ypagenumber{\folio}
-
-\def\Ytitle{\thissection}
-
-\def\Ynothing{}
-
-\def\Ysectionnumberandtype{%
-\ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
-\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
-\else \ifnum \subsubsecno=0 %
-\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
-\else %
-\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
-\fi \fi \fi }
-
-\def\Yappendixletterandtype{%
-\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
-\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
-\else \ifnum \subsubsecno=0 %
-\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
-\else %
-\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
-\fi \fi \fi }
-
-\gdef\xreftie{'tie}
+% This macro is called from \xrefX for the `[nodename]' part of xref
+% output. It's a separate macro only so it can be changed more easily,
+% since square brackets don't work well in some documents. Particularly
+% one that Bob is working on :).
+%
+\def\xrefprintnodename#1{[#1]}
-% Use TeX 3.0's \inputlineno to get the line number, for better error
-% messages, but if we're using an old version of TeX, don't do anything.
+% Things referred to by \setref.
%
-\ifx\inputlineno\thisisundefined
- \let\linenumber = \empty % Non-3.0.
-\else
- \def\linenumber{\the\inputlineno:\space}
-\fi
+\def\Ynothing{}
+\def\Yomitfromtoc{}
+\def\Ynumbered{%
+ \ifnum\secno=0
+ \putwordChapter@tie \the\chapno
+ \else \ifnum\subsecno=0
+ \putwordSection@tie \the\chapno.\the\secno
+ \else \ifnum\subsubsecno=0
+ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
+ \else
+ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
+ \fi\fi\fi
+}
+\def\Yappendix{%
+ \ifnum\secno=0
+ \putwordAppendix@tie @char\the\appendixno{}%
+ \else \ifnum\subsecno=0
+ \putwordSection@tie @char\the\appendixno.\the\secno
+ \else \ifnum\subsubsecno=0
+ \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
+ \else
+ \putwordSection@tie
+ @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
+ \fi\fi\fi
+}
% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
% If its value is nonempty, SUFFIX is output afterward.
-
+%
\def\refx#1#2{%
- \expandafter\ifx\csname X#1\endcsname\relax
+ {%
+ \indexnofonts
+ \otherbackslash
+ \expandafter\global\expandafter\let\expandafter\thisrefX
+ \csname XR#1\endcsname
+ }%
+ \ifx\thisrefX\relax
% If not defined, say something at least.
\angleleft un\-de\-fined\angleright
\iflinks
@@ -5680,21 +6018,49 @@ width0pt\relax} \fi
\fi
\else
% It's defined, so just use it.
- \csname X#1\endcsname
+ \thisrefX
\fi
#2% Output the suffix in any case.
}
-% This is the macro invoked by entries in the aux file.
+% This is the macro invoked by entries in the aux file. Usually it's
+% just a \def (we prepend XR to the control sequence name to avoid
+% collisions). But if this is a float type, we have more work to do.
%
-\def\xrdef#1{\begingroup
- % Reenable \ as an escape while reading the second argument.
- \catcode`\\ = 0
- \afterassignment\endgroup
- \expandafter\gdef\csname X#1\endcsname
+\def\xrdef#1#2{%
+ \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value.
+ %
+ % Was that xref control sequence that we just defined for a float?
+ \expandafter\iffloat\csname XR#1\endcsname
+ % it was a float, and we have the (safe) float type in \iffloattype.
+ \expandafter\let\expandafter\floatlist
+ \csname floatlist\iffloattype\endcsname
+ %
+ % Is this the first time we've seen this float type?
+ \expandafter\ifx\floatlist\relax
+ \toks0 = {\do}% yes, so just \do
+ \else
+ % had it before, so preserve previous elements in list.
+ \toks0 = \expandafter{\floatlist\do}%
+ \fi
+ %
+ % Remember this xref in the control sequence \floatlistFLOATTYPE,
+ % for later use in \listoffloats.
+ \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}%
+ \fi
}
% Read the last existing aux file, if any. No error if none exists.
+%
+\def\tryauxfile{%
+ \openin 1 \jobname.aux
+ \ifeof 1 \else
+ \readauxfile
+ \global\havexrefstrue
+ \fi
+ \closein 1
+}
+
\def\readauxfile{\begingroup
\catcode`\^^@=\other
\catcode`\^^A=\other
@@ -5723,9 +6089,7 @@ width0pt\relax} \fi
\catcode`\^^]=\other
\catcode`\^^^=\other
\catcode`\^^_=\other
- \catcode`\@=\other
- \catcode`\^=\other
- % It was suggested to define this as 7, which would allow ^^e4 etc.
+ % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
% in xref tags, i.e., node names. But since ^^e4 notation isn't
% supported in the main text, it doesn't seem desirable. Furthermore,
% that is not enough: for node names that actually contain a ^
@@ -5738,6 +6102,9 @@ width0pt\relax} \fi
% \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
% and then to call \auxhat in \setq.
%
+ \catcode`\^=\other
+ %
+ % Special characters. Should be turned off anyway, but...
\catcode`\~=\other
\catcode`\[=\other
\catcode`\]=\other
@@ -5749,8 +6116,19 @@ width0pt\relax} \fi
\catcode`\$=\other
\catcode`\#=\other
\catcode`\&=\other
+ \catcode`\%=\other
\catcode`+=\other % avoid \+ for paranoia even though we've turned it off
- % Make the characters 128-255 be printing characters
+ %
+ % This is to support \ in node names and titles, since the \
+ % characters end up in a \csname. It's easier than
+ % leaving it active and making its active definition an actual \
+ % character. What I don't understand is why it works in the *value*
+ % of the xrdef. Seems like it should be a catcode12 \, and that
+ % should not typeset properly. But it works, so I'm moving on for
+ % now. --karl, 15jan04.
+ \catcode`\\=\other
+ %
+ % Make the characters 128-255 be printing characters.
{%
\count 1=128
\def\loop{%
@@ -5759,31 +6137,18 @@ width0pt\relax} \fi
\ifnum \count 1<256 \loop \fi
}%
}%
- % The aux file uses ' as the escape (for now).
- % Turn off \ as an escape so we do not lose on
- % entries which were dumped with control sequences in their names.
- % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
- % Reference to such entries still does not work the way one would wish,
- % but at least they do not bomb out when the aux file is read in.
+ %
+ % @ is our escape character in .aux files, and we need braces.
\catcode`\{=1
\catcode`\}=2
- \catcode`\%=\other
- \catcode`\'=0
- \catcode`\\=\other
+ \catcode`\@=0
%
- \openin 1 \jobname.aux
- \ifeof 1 \else
- \closein 1
- \input \jobname.aux
- \global\havexrefstrue
- \global\warnedobstrue
- \fi
- % Open the new aux file. TeX will close it automatically at exit.
- \openout\auxfile=\jobname.aux
+ \input \jobname.aux
\endgroup}
-% Footnotes.
+\message{insertions,}
+% including footnotes.
\newcount \footnoteno
@@ -5797,37 +6162,39 @@ width0pt\relax} \fi
% @footnotestyle is meaningful for info output only.
\let\footnotestyle=\comment
-\let\ptexfootnote=\footnote
-
{\catcode `\@=11
%
% Auto-number footnotes. Otherwise like plain.
\gdef\footnote{%
+ \let\indent=\ptexindent
+ \let\noindent=\ptexnoindent
\global\advance\footnoteno by \@ne
\edef\thisfootno{$^{\the\footnoteno}$}%
%
% In case the footnote comes at the end of a sentence, preserve the
% extra spacing after we do the footnote number.
\let\@sf\empty
- \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+ \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
%
% Remove inadvertent blank space before typesetting the footnote number.
\unskip
\thisfootno\@sf
- \footnotezzz
+ \dofootnote
}%
% Don't bother with the trickery in plain.tex to not require the
% footnote text as a parameter. Our footnotes don't need to be so general.
%
-% Oh yes, they do; otherwise, @ifset and anything else that uses
-% \parseargline fail inside footnotes because the tokens are fixed when
+% Oh yes, they do; otherwise, @ifset (and anything else that uses
+% \parseargline) fails inside footnotes because the tokens are fixed when
% the footnote is read. --karl, 16nov96.
%
-\long\gdef\footnotezzz{\insert\footins\bgroup
+\gdef\dofootnote{%
+ \insert\footins\bgroup
% We want to typeset this text as a normal paragraph, even if the
% footnote reference occurs in (for example) a display environment.
% So reset some parameters.
+ \hsize=\pagewidth
\interlinepenalty\interfootnotelinepenalty
\splittopskip\ht\strutbox % top baseline for broken footnotes
\splitmaxdepth\dp\strutbox
@@ -5857,48 +6224,68 @@ width0pt\relax} \fi
\footstrut
\futurelet\next\fo@t
}
-\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
- \else\let\next\f@t\fi \next}
-\def\f@@t{\bgroup\aftergroup\@foot\let\next}
-\def\f@t#1{#1\@foot}
-\def\@foot{\strut\par\egroup}
-
}%end \catcode `\@=11
-% @| inserts a changebar to the left of the current line. It should
-% surround any changed text. This approach does *not* work if the
-% change spans more than two lines of output. To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).
+% In case a @footnote appears in a vbox, save the footnote text and create
+% the real \insert just after the vbox finished. Otherwise, the insertion
+% would be lost.
+% Similarily, if a @footnote appears inside an alignment, save the footnote
+% text to a box and make the \insert when a row of the table is finished.
+% And the same can be done for other insert classes. --kasal, 16nov03.
+
+% Replace the \insert primitive by a cheating macro.
+% Deeper inside, just make sure that the saved insertions are not spilled
+% out prematurely.
%
-\def\|{%
- % \vadjust can only be used in horizontal mode.
- \leavevmode
- %
- % Append this vertical mode material after the current line in the output.
- \vadjust{%
- % We want to insert a rule with the height and depth of the current
- % leading; that is exactly what \strutbox is supposed to record.
- \vskip-\baselineskip
- %
- % \vadjust-items are inserted at the left edge of the type. So
- % the \llap here moves out into the left-hand margin.
- \llap{%
- %
- % For a thicker or thinner bar, change the `1pt'.
- \vrule height\baselineskip width1pt
- %
- % This is the space between the bar and the text.
- \hskip 12pt
- }%
- }%
+\def\startsavinginserts{%
+ \ifx \insert\ptexinsert
+ \let\insert\saveinsert
+ \else
+ \let\checkinserts\relax
+ \fi
}
-% For a final copy, take out the rectangles
-% that mark overfull boxes (in case you have decided
-% that the text looks ok even though it passes the margin).
+% This \insert replacement works for both \insert\footins{foo} and
+% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
%
-\def\finalout{\overfullrule=0pt}
+\def\saveinsert#1{%
+ \edef\next{\noexpand\savetobox \makeSAVEname#1}%
+ \afterassignment\next
+ % swallow the left brace
+ \let\temp =
+}
+\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
+\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
+
+\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
+
+\def\placesaveins#1{%
+ \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
+ {\box#1}%
+}
+
+% eat @SAVE -- beware, all of them have catcode \other:
+{
+ \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
+ \gdef\gobblesave @SAVE{}
+}
+
+% initialization:
+\def\newsaveins #1{%
+ \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
+ \next
+}
+\def\newsaveinsX #1{%
+ \csname newbox\endcsname #1%
+ \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
+ \checksaveins #1}%
+}
+
+% initialize:
+\let\checkinserts\empty
+\newsaveins\footins
+\newsaveins\margin
+
% @image. We use the macros from epsf.tex to support this.
% If epsf.tex is not installed and @image is used, we complain.
@@ -5908,12 +6295,12 @@ width0pt\relax} \fi
% undone and the next image would fail.
\openin 1 = epsf.tex
\ifeof 1 \else
- \closein 1
- % Do not bother showing banner with post-v2.7 epsf.tex (available in
- % doc/epsf.tex until it shows up on ctan).
+ % Do not bother showing banner with epsf.tex v2.7k (available in
+ % doc/epsf.tex and on ctan).
\def\epsfannounce{\toks0 = }%
\input epsf.tex
\fi
+\closein 1
%
% We will only complain once about lack of epsf.tex.
\newif\ifwarnednoepsf
@@ -5949,7 +6336,7 @@ width0pt\relax} \fi
\nobreak\bigskip
% Usually we'll have text after the image which will insert
% \parskip glue, so insert it here too to equalize the space
- % above and below.
+ % above and below.
\nobreak\vskip\parskip
\nobreak
\line\bgroup\hss
@@ -5969,6 +6356,269 @@ width0pt\relax} \fi
\endgroup}
+% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
+% etc. We don't actually implement floating yet, we always include the
+% float "here". But it seemed the best name for the future.
+%
+\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
+
+% There may be a space before second and/or third parameter; delete it.
+\def\eatcommaspace#1, {#1,}
+
+% #1 is the optional FLOATTYPE, the text label for this float, typically
+% "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
+% this float will not be numbered and cannot be referred to.
+%
+% #2 is the optional xref label. Also must be present for the float to
+% be referable.
+%
+% #3 is the optional positioning argument; for now, it is ignored. It
+% will somehow specify the positions allowed to float to (here, top, bottom).
+%
+% We keep a separate counter for each FLOATTYPE, which we reset at each
+% chapter-level command.
+\let\resetallfloatnos=\empty
+%
+\def\dofloat#1,#2,#3,#4\finish{%
+ \let\thiscaption=\empty
+ \let\thisshortcaption=\empty
+ %
+ % don't lose footnotes inside @float.
+ %
+ % BEWARE: when the floats start float, we have to issue warning whenever an
+ % insert appears inside a float which could possibly float. --kasal, 26may04
+ %
+ \startsavinginserts
+ %
+ % We can't be used inside a paragraph.
+ \par
+ %
+ \vtop\bgroup
+ \def\floattype{#1}%
+ \def\floatlabel{#2}%
+ \def\floatloc{#3}% we do nothing with this yet.
+ %
+ \ifx\floattype\empty
+ \let\safefloattype=\empty
+ \else
+ {%
+ % the floattype might have accents or other special characters,
+ % but we need to use it in a control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safefloattype{\floattype}%
+ }%
+ \fi
+ %
+ % If label is given but no type, we handle that as the empty type.
+ \ifx\floatlabel\empty \else
+ % We want each FLOATTYPE to be numbered separately (Figure 1,
+ % Table 1, Figure 2, ...). (And if no label, no number.)
+ %
+ \expandafter\getfloatno\csname\safefloattype floatno\endcsname
+ \global\advance\floatno by 1
+ %
+ {%
+ % This magic value for \thissection is output by \setref as the
+ % XREFLABEL-title value. \xrefX uses it to distinguish float
+ % labels (which have a completely different output format) from
+ % node and anchor labels. And \xrdef uses it to construct the
+ % lists of floats.
+ %
+ \edef\thissection{\floatmagic=\safefloattype}%
+ \setref{\floatlabel}{Yfloat}%
+ }%
+ \fi
+ %
+ % start with \parskip glue, I guess.
+ \vskip\parskip
+ %
+ % Don't suppress indentation if a float happens to start a section.
+ \restorefirstparagraphindent
+}
+
+% we have these possibilities:
+% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
+% @float Foo,lbl & no caption: Foo 1.1
+% @float Foo & @caption{Cap}: Foo: Cap
+% @float Foo & no caption: Foo
+% @float ,lbl & Caption{Cap}: 1.1: Cap
+% @float ,lbl & no caption: 1.1
+% @float & @caption{Cap}: Cap
+% @float & no caption:
+%
+\def\Efloat{%
+ \let\floatident = \empty
+ %
+ % In all cases, if we have a float type, it comes first.
+ \ifx\floattype\empty \else \def\floatident{\floattype}\fi
+ %
+ % If we have an xref label, the number comes next.
+ \ifx\floatlabel\empty \else
+ \ifx\floattype\empty \else % if also had float type, need tie first.
+ \appendtomacro\floatident{\tie}%
+ \fi
+ % the number.
+ \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
+ \fi
+ %
+ % Start the printed caption with what we've constructed in
+ % \floatident, but keep it separate; we need \floatident again.
+ \let\captionline = \floatident
+ %
+ \ifx\thiscaption\empty \else
+ \ifx\floatident\empty \else
+ \appendtomacro\captionline{: }% had ident, so need a colon between
+ \fi
+ %
+ % caption text.
+ \appendtomacro\captionline{\scanexp\thiscaption}%
+ \fi
+ %
+ % If we have anything to print, print it, with space before.
+ % Eventually this needs to become an \insert.
+ \ifx\captionline\empty \else
+ \vskip.5\parskip
+ \captionline
+ %
+ % Space below caption.
+ \vskip\parskip
+ \fi
+ %
+ % If have an xref label, write the list of floats info. Do this
+ % after the caption, to avoid chance of it being a breakpoint.
+ \ifx\floatlabel\empty \else
+ % Write the text that goes in the lof to the aux file as
+ % \floatlabel-lof. Besides \floatident, we include the short
+ % caption if specified, else the full caption if specified, else nothing.
+ {%
+ \atdummies \turnoffactive \otherbackslash
+ % since we read the caption text in the macro world, where ^^M
+ % is turned into a normal character, we have to scan it back, so
+ % we don't write the literal three characters "^^M" into the aux file.
+ \scanexp{%
+ \xdef\noexpand\gtemp{%
+ \ifx\thisshortcaption\empty
+ \thiscaption
+ \else
+ \thisshortcaption
+ \fi
+ }%
+ }%
+ \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
+ \ifx\gtemp\empty \else : \gtemp \fi}}%
+ }%
+ \fi
+ \egroup % end of \vtop
+ %
+ % place the captured inserts
+ %
+ % BEWARE: when the floats start float, we have to issue warning whenever an
+ % insert appears inside a float which could possibly float. --kasal, 26may04
+ %
+ \checkinserts
+}
+
+% Append the tokens #2 to the definition of macro #1, not expanding either.
+%
+\def\appendtomacro#1#2{%
+ \expandafter\def\expandafter#1\expandafter{#1#2}%
+}
+
+% @caption, @shortcaption
+%
+\def\caption{\docaption\thiscaption}
+\def\shortcaption{\docaption\thisshortcaption}
+\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
+\def\defcaption#1#2{\egroup \def#1{#2}}
+
+% The parameter is the control sequence identifying the counter we are
+% going to use. Create it if it doesn't exist and assign it to \floatno.
+\def\getfloatno#1{%
+ \ifx#1\relax
+ % Haven't seen this figure type before.
+ \csname newcount\endcsname #1%
+ %
+ % Remember to reset this floatno at the next chap.
+ \expandafter\gdef\expandafter\resetallfloatnos
+ \expandafter{\resetallfloatnos #1=0 }%
+ \fi
+ \let\floatno#1%
+}
+
+% \setref calls this to get the XREFLABEL-snt value. We want an @xref
+% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
+% first read the @float command.
+%
+\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
+
+% Magic string used for the XREFLABEL-title value, so \xrefX can
+% distinguish floats from other xref types.
+\def\floatmagic{!!float!!}
+
+% #1 is the control sequence we are passed; we expand into a conditional
+% which is true if #1 represents a float ref. That is, the magic
+% \thissection value which we \setref above.
+%
+\def\iffloat#1{\expandafter\doiffloat#1==\finish}
+%
+% #1 is (maybe) the \floatmagic string. If so, #2 will be the
+% (safe) float type for this float. We set \iffloattype to #2.
+%
+\def\doiffloat#1=#2=#3\finish{%
+ \def\temp{#1}%
+ \def\iffloattype{#2}%
+ \ifx\temp\floatmagic
+}
+
+% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
+%
+\parseargdef\listoffloats{%
+ \def\floattype{#1}% floattype
+ {%
+ % the floattype might have accents or other special characters,
+ % but we need to use it in a control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safefloattype{\floattype}%
+ }%
+ %
+ % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
+ \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
+ \ifhavexrefs
+ % if the user said @listoffloats foo but never @float foo.
+ \message{\linenumber No `\safefloattype' floats to list.}%
+ \fi
+ \else
+ \begingroup
+ \leftskip=\tocindent % indent these entries like a toc
+ \let\do=\listoffloatsdo
+ \csname floatlist\safefloattype\endcsname
+ \endgroup
+ \fi
+}
+
+% This is called on each entry in a list of floats. We're passed the
+% xref label, in the form LABEL-title, which is how we save it in the
+% aux file. We strip off the -title and look up \XRLABEL-lof, which
+% has the text we're supposed to typeset here.
+%
+% Figures without xref labels will not be included in the list (since
+% they won't appear in the aux file).
+%
+\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
+\def\listoffloatsdoentry#1-title\finish{{%
+ % Can't fully expand XR#1-lof because it can contain anything. Just
+ % pass the control sequence. On the other hand, XR#1-pg is just the
+ % page number, and we want to fully expand that so we can get a link
+ % in pdf output.
+ \toksA = \expandafter{\csname XR#1-lof\endcsname}%
+ %
+ % use the same \entry macro we use to generate the TOC and index.
+ \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
+ \writeentry
+}}
+
\message{localization,}
% and i18n.
@@ -5977,19 +6627,17 @@ width0pt\relax} \fi
% properly. Single argument is the language abbreviation.
% It would be nice if we could set up a hyphenation file here.
%
-\def\documentlanguage{\parsearg\dodocumentlanguage}
-\def\dodocumentlanguage#1{%
+\parseargdef\documentlanguage{%
\tex % read txi-??.tex file in plain TeX.
- % Read the file if it exists.
- \openin 1 txi-#1.tex
- \ifeof1
- \errhelp = \nolanghelp
- \errmessage{Cannot read language file txi-#1.tex}%
- \let\temp = \relax
- \else
- \def\temp{\input txi-#1.tex }%
- \fi
- \temp
+ % Read the file if it exists.
+ \openin 1 txi-#1.tex
+ \ifeof 1
+ \errhelp = \nolanghelp
+ \errmessage{Cannot read language file txi-#1.tex}%
+ \else
+ \input txi-#1.tex
+ \fi
+ \closein 1
\endgroup
}
\newhelp\nolanghelp{The given language definition file cannot be found or
@@ -6035,11 +6683,13 @@ should work if nowhere else does.}
}
% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
-% 4) hoffset; 5) binding offset; 6) topskip. We also call
-% \setleading{\textleading}, so the caller should define \textleading.
-% The caller should also set \parskip.
+% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
+% physical page width.
+%
+% We also call \setleading{\textleading}, so the caller should define
+% \textleading. The caller should also set \parskip.
%
-\def\internalpagesizes#1#2#3#4#5#6{%
+\def\internalpagesizes#1#2#3#4#5#6#7#8{%
\voffset = #3\relax
\topskip = #6\relax
\splittopskip = \topskip
@@ -6058,28 +6708,27 @@ should work if nowhere else does.}
\normaloffset = #4\relax
\bindingoffset = #5\relax
%
+ \ifpdf
+ \pdfpageheight #7\relax
+ \pdfpagewidth #8\relax
+ \fi
+ %
\setleading{\textleading}
%
\parindent = \defaultparindent
\setemergencystretch
}
-% Use `small' versions.
-%
-\def\smallenvironments{%
- \let\smalldisplay = \smalldisplayx
- \let\smallexample = \smalllispx
- \let\smallformat = \smallformatx
- \let\smalllisp = \smalllispx
-}
-
% @letterpaper (the default).
\def\letterpaper{{\globaldefs = 1
\parskip = 3pt plus 2pt minus 1pt
\textleading = 13.2pt
%
% If page is nothing but text, make it come out even.
- \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}%
+ \internalpagesizes{46\baselineskip}{6in}%
+ {\voffset}{.25in}%
+ {\bindingoffset}{36pt}%
+ {11in}{8.5in}%
}}
% Use @smallbook to reset parameters for 7x9.5 (or so) format.
@@ -6087,26 +6736,42 @@ should work if nowhere else does.}
\parskip = 2pt plus 1pt
\textleading = 12pt
%
- \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}%
+ \internalpagesizes{7.5in}{5in}%
+ {\voffset}{.25in}%
+ {\bindingoffset}{16pt}%
+ {9.25in}{7in}%
%
\lispnarrowing = 0.3in
\tolerance = 700
\hfuzz = 1pt
\contentsrightmargin = 0pt
- \deftypemargin = 0pt
\defbodyindent = .5cm
- \smallenvironments
}}
% Use @afourpaper to print on European A4 paper.
\def\afourpaper{{\globaldefs = 1
\parskip = 3pt plus 2pt minus 1pt
- \textleading = 12pt
+ \textleading = 13.2pt
%
- \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}%
+ % Double-side printing via postscript on Laserjet 4050
+ % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
+ % To change the settings for a different printer or situation, adjust
+ % \normaloffset until the front-side and back-side texts align. Then
+ % do the same for \bindingoffset. You can set these for testing in
+ % your texinfo source file like this:
+ % @tex
+ % \global\normaloffset = -6mm
+ % \global\bindingoffset = 10mm
+ % @end tex
+ \internalpagesizes{51\baselineskip}{160mm}
+ {\voffset}{\hoffset}%
+ {\bindingoffset}{44pt}%
+ {297mm}{210mm}%
%
\tolerance = 700
\hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = 5mm
}}
% Use @afivepaper to print on European A5 paper.
@@ -6116,44 +6781,46 @@ should work if nowhere else does.}
\parskip = 2pt plus 1pt minus 0.1pt
\textleading = 12.5pt
%
- \internalpagesizes{166mm}{120mm}{\voffset}{-8mm}{\bindingoffset}{8pt}%
+ \internalpagesizes{160mm}{120mm}%
+ {\voffset}{\hoffset}%
+ {\bindingoffset}{8pt}%
+ {210mm}{148mm}%
%
\lispnarrowing = 0.2in
\tolerance = 800
\hfuzz = 1.2pt
- \contentsrightmargin = 0mm
- \deftypemargin = 0pt
+ \contentsrightmargin = 0pt
\defbodyindent = 2mm
\tableindent = 12mm
- %
- \smallenvironments
}}
-% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
-% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
+% A specific text layout, 24x15cm overall, intended for A4 paper.
\def\afourlatex{{\globaldefs = 1
- \textleading = 13.6pt
- %
\afourpaper
- \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
+ \internalpagesizes{237mm}{150mm}%
+ {\voffset}{4.6mm}%
+ {\bindingoffset}{7mm}%
+ {297mm}{210mm}%
%
- % Must explicitly reset to 0 because we call \afourpaper, apparently,
- % although this does not entirely make sense.
+ % Must explicitly reset to 0 because we call \afourpaper.
\globaldefs = 0
}}
-% Use @afourwide to print on European A4 paper in wide format.
-\def\afourwide{%
+% Use @afourwide to print on A4 paper in landscape format.
+\def\afourwide{{\globaldefs = 1
\afourpaper
- \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
-}
+ \internalpagesizes{241mm}{165mm}%
+ {\voffset}{-2.95mm}%
+ {\bindingoffset}{7mm}%
+ {297mm}{210mm}%
+ \globaldefs = 0
+}}
% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
% Perhaps we should allow setting the margins, \topskip, \parskip,
% and/or leading, also. Or perhaps we should compute them somehow.
%
-\def\pagesizes{\parsearg\pagesizesxxx}
-\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
+\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
\def\pagesizesyyy#1,#2,#3\finish{{%
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
\globaldefs = 1
@@ -6161,7 +6828,16 @@ should work if nowhere else does.}
\parskip = 3pt plus 2pt minus 1pt
\setleading{\textleading}%
%
- \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}%
+ \dimen0 = #1
+ \advance\dimen0 by \voffset
+ %
+ \dimen2 = \hsize
+ \advance\dimen2 by \normaloffset
+ %
+ \internalpagesizes{#1}{\hsize}%
+ {\voffset}{\normaloffset}%
+ {\bindingoffset}{44pt}%
+ {\dimen0}{\dimen2}%
}}
% Set default to letter.
@@ -6191,8 +6867,8 @@ should work if nowhere else does.}
\def\normalplus{+}
\def\normaldollar{$}%$ font-lock fix
-% This macro is used to make a character print one way in ttfont
-% where it can probably just be output, and another way in other fonts,
+% This macro is used to make a character print one way in \tt
+% (where it can probably be output as-is), and another way in other fonts,
% where something hairier probably needs to be done.
%
% #1 is what to print if we are indeed using \tt; #2 is what to print
@@ -6225,7 +6901,7 @@ should work if nowhere else does.}
\catcode`\_=\active
\def_{\ifusingtt\normalunderscore\_}
% Subroutine for the previous macro.
-\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
+\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
\catcode`\|=\active
\def|{{\tt\char124}}
@@ -6239,15 +6915,6 @@ should work if nowhere else does.}
\def+{{\tt \char 43}}
\catcode`\$=\active
\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
-%\catcode 27=\active
-%\def^^[{$\diamondsuit$}
-
-% Set up an active definition for =, but don't enable it most of the time.
-{\catcode`\==\active
-\global\def={{\tt \char 61}}}
-
-\catcode`+=\active
-\catcode`\_=\active
% If a .fmt file is being used, characters that might appear in a file
% name cannot be active until we have parsed the command line.
@@ -6257,44 +6924,48 @@ should work if nowhere else does.}
\catcode`\@=0
-% \rawbackslashxx output one backslash character in current font
-\global\chardef\rawbackslashxx=`\\
-%{\catcode`\\=\other
-%@gdef@rawbackslashxx{\}}
+% \backslashcurfont outputs one backslash character in current font,
+% as in \char`\\.
+\global\chardef\backslashcurfont=`\\
+\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
-% \rawbackslash redefines \ as input to do \rawbackslashxx.
+% \rawbackslash defines an active \ to do \backslashcurfont.
+% \otherbackslash defines an active \ to be a literal `\' character with
+% catcode other.
{\catcode`\\=\active
-@gdef@rawbackslash{@let\=@rawbackslashxx }}
+ @gdef@rawbackslash{@let\=@backslashcurfont}
+ @gdef@otherbackslash{@let\=@realbackslash}
+}
+
+% \realbackslash is an actual character `\' with catcode other.
+{\catcode`\\=\other @gdef@realbackslash{\}}
% \normalbackslash outputs one backslash in fixed width font.
-\def\normalbackslash{{\tt\rawbackslashxx}}
+\def\normalbackslash{{\tt\backslashcurfont}}
-% \catcode 17=0 % Define control-q
\catcode`\\=\active
% Used sometimes to turn off (effectively) the active characters
% even after parsing them.
-@def@turnoffactive{@let"=@normaldoublequote
-@let\=@realbackslash
-@let~=@normaltilde
-@let^=@normalcaret
-@let_=@normalunderscore
-@let|=@normalverticalbar
-@let<=@normalless
-@let>=@normalgreater
-@let+=@normalplus
-@let$=@normaldollar}%$ font-lock fix
-
-@def@normalturnoffactive{@let"=@normaldoublequote
-@let\=@normalbackslash
-@let~=@normaltilde
-@let^=@normalcaret
-@let_=@normalunderscore
-@let|=@normalverticalbar
-@let<=@normalless
-@let>=@normalgreater
-@let+=@normalplus
-@let$=@normaldollar}%$ font-lock fix
+@def@turnoffactive{%
+ @let"=@normaldoublequote
+ @let\=@realbackslash
+ @let~=@normaltilde
+ @let^=@normalcaret
+ @let_=@normalunderscore
+ @let|=@normalverticalbar
+ @let<=@normalless
+ @let>=@normalgreater
+ @let+=@normalplus
+ @let$=@normaldollar %$ font-lock fix
+ @unsepspaces
+}
+
+% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
+% the literal character `\'. (Thus, \ is not expandable when this is in
+% effect.)
+%
+@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
% Make _ and + \other characters, temporarily.
% This is canceled by @fixbackslash.
@@ -6322,15 +6993,11 @@ should work if nowhere else does.}
% Say @foo, not \foo, in error messages.
@escapechar = `@@
-% These look ok in all fonts, so just make them not special.
+% These look ok in all fonts, so just make them not special.
@catcode`@& = @other
@catcode`@# = @other
@catcode`@% = @other
-@c Set initial fonts.
-@textfonts
-@rm
-
@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
@@ -6339,3 +7006,9 @@ should work if nowhere else does.}
@c time-stamp-format: "%:y-%02m-%02d.%02H"
@c time-stamp-end: "}"
@c End:
+
+@c vim:sw=2:
+
+@ignore
+ arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
+@end ignore
diff --git a/contrib/amd/doc/version.texi b/contrib/amd/doc/version.texi
index afd06b1..41b19a3 100644
--- a/contrib/amd/doc/version.texi
+++ b/contrib/amd/doc/version.texi
@@ -1,3 +1,4 @@
-@set UPDATED 28 August 2003
-@set EDITION 6.0.9
-@set VERSION 6.0.9
+@set UPDATED 20 April 2006
+@set UPDATED-MONTH April 2006
+@set EDITION 6.1.5
+@set VERSION 6.1.5
OpenPOWER on IntegriCloud