gcompris r3476 - in branches/gcomprixogoo: . boards/dataset docs/C src src/gcompris



Author: bcoudoin
Date: Wed Jul 30 23:37:49 2008
New Revision: 3476
URL: http://svn.gnome.org/viewvc/gcompris?rev=3476&view=rev

Log:
improved image selector


Modified:
   branches/gcomprixogoo/boards/dataset/misc.xml
   branches/gcomprixogoo/docs/C/texinfo.tex
   branches/gcomprixogoo/install-sh
   branches/gcomprixogoo/src/gcompris/file_selector.c
   branches/gcomprixogoo/src/gcompris/images_selector.c
   branches/gcomprixogoo/src/runit.sh

Modified: branches/gcomprixogoo/boards/dataset/misc.xml
==============================================================================
--- branches/gcomprixogoo/boards/dataset/misc.xml	(original)
+++ branches/gcomprixogoo/boards/dataset/misc.xml	Wed Jul 30 23:37:49 2008
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ImageSetRoot>
-  <ImageSet filename="gcompris/misc/car.png">
-    <Image filename="gcompris/misc/car.png"/>
+  <ImageSet filename="imageid/car.png">
+    <Image filename="babymatch/car.png"/>
     <Image filename="imageid/car.png"/>
-    <Image filename="gcompris/misc/minivan.png"/>
-    <Image filename="gcompris/misc/truck.png"/>
-    <Image filename="gcompris/misc/bicycle.png"/>
-    <Image filename="gcompris/misc/tuxboat.png"/>
-    <Image filename="gcompris/misc/fishingboat.png"/>
-    <Image filename="gcompris/misc/sailingboat.png"/>
-    <Image filename="gcompris/misc/fusee.png"/>
-    <Image filename="gcompris/misc/tuxhelico.png"/>
-    <Image filename="gcompris/misc/tuxballoon.png"/>
-    <Image filename="gcompris/misc/tuxloco.png"/>
-    <Image filename="gcompris/misc/tuxplane.png"/>
+    <Image filename="babymatch/minivan.png"/>
+    <Image filename="babymatch/truck.png"/>
+    <Image filename="babymatch/bicycle.png"/>
+    <Image filename="canal_lock/tuxboat.png"/>
+    <Image filename="babymatch/fishingboat.png"/>
+    <Image filename="babymatch/sailingboat.png"/>
+    <Image filename="babymatch/fusee.png"/>
+    <Image filename="babymatch/tuxhelico.png"/>
+    <Image filename="babymatch/tuxballoon.png"/>
+    <Image filename="babymatch/tuxloco.png"/>
+    <Image filename="babymatch/tuxplane.png"/>
     <Image filename="imageid/avion.png"/>
     <Image filename="railroad/loco5.png"/>
     <Image filename="railroad/wagon14.png"/>
@@ -40,66 +40,66 @@
     <Image filename="railroad/wagon6.png"/>
     <Image filename="images/wagon-green.png"/>
     <Image filename="images/wagon-yellow.png"/>
-    <Image filename="chronos/images/helico_cornu.png"/>
-    <Image filename="chronos/images/wright_flyer.png"/>
-    <Image filename="chronos/images/lindbergh.png"/>
-    <Image filename="chronos/images/bell_X1.png"/>
-    <Image filename="chronos/images/mongolfiere.png"/>
-    <Image filename="chronos/images/bleriot.png"/>
-    <Image filename="chronos/images/rafale.png"/>
-    <Image filename="chronos/images/Eole.png"/>
-    <Image filename="chronos/images/celerifere.png"/>
-    <Image filename="chronos/images/fardier.png"/>
-    <Image filename="chronos/images/st_rocket.png"/>
-    <Image filename="chronos/images/1955ds19.png"/>
-    <Image filename="chronos/images/benz1885.png"/>
-    <Image filename="chronos/images/bolle1878.png"/>
-    <Image filename="chronos/images/lancia1923.png"/>
-    <Image filename="chronos/images/renault1899.png"/>
+    <Image filename="chronos/helico_cornu.png"/>
+    <Image filename="chronos/wright_flyer.png"/>
+    <Image filename="chronos/lindbergh.png"/>
+    <Image filename="chronos/bell_X1.png"/>
+    <Image filename="chronos/mongolfiere.png"/>
+    <Image filename="chronos/bleriot.png"/>
+    <Image filename="chronos/rafale.png"/>
+    <Image filename="chronos/Eole.png"/>
+    <Image filename="chronos/celerifere.png"/>
+    <Image filename="chronos/fardier.png"/>
+    <Image filename="chronos/st_rocket.png"/>
+    <Image filename="chronos/1955ds19.png"/>
+    <Image filename="chronos/benz1885.png"/>
+    <Image filename="chronos/bolle1878.png"/>
+    <Image filename="chronos/lancia1923.png"/>
+    <Image filename="chronos/renault1899.png"/>
   </ImageSet>
 
-  <ImageSet filename="gcompris/misc/house.png">
-    <Image filename="gcompris/misc/house.png"/>
+  <ImageSet filename="babymatch/house.png">
+    <Image filename="babymatch/house.png"/>
     <Image filename="imageid/maison.png"/>
-    <Image filename="gcompris/misc/lighthouse.png"/>
-    <Image filename="gcompris/misc/castle.png"/>
-    <Image filename="gcompris/misc/crown.png"/>
-    <Image filename="gcompris/misc/flowerpot.png"/>
+    <Image filename="babymatch/lighthouse.png"/>
+    <Image filename="babymatch/castle.png"/>
+    <Image filename="babymatch/crown.png"/>
+    <Image filename="babymatch/flowerpot.png"/>
     <Image filename="imageid/bed.png"/>
-    <Image filename="gcompris/misc/eggpot.png"/>
-    <Image filename="gcompris/misc/football.png"/>
+    <Image filename="babymatch/eggpot.png"/>
+    <Image filename="babymatch/football.png"/>
     <Image filename="imageid/ballon.png"/>
-    <Image filename="gcompris/misc/glass.png"/>
-    <Image filename="gcompris/misc/lamp.png"/>
-    <Image filename="gcompris/misc/light.png"/>
-    <Image filename="gcompris/misc/pencil.png"/>
-    <Image filename="gcompris/misc/postcard.png"/>
-    <Image filename="gcompris/misc/postpoint.png"/>
-    <Image filename="gcompris/misc/rape.png"/>
-    <Image filename="gcompris/misc/raquette.png"/>
-    <Image filename="gcompris/misc/sofa.png"/>
-    <Image filename="gcompris/misc/bottle.png"/>
+    <Image filename="babymatch/glass.png"/>
+    <Image filename="babymatch/lamp.png"/>
+    <Image filename="babymatch/light.png"/>
+    <Image filename="babymatch/pencil.png"/>
+    <Image filename="babymatch/postcard.png"/>
+    <Image filename="babymatch/postpoint.png"/>
+    <Image filename="babymatch/rape.png"/>
+    <Image filename="babymatch/raquette.png"/>
+    <Image filename="babymatch/sofa.png"/>
+    <Image filename="babymatch/bottle.png"/>
     <Image filename="imageid/bottle.png"/>
   </ImageSet>
-  <ImageSet filename="gcompris/misc/tree.png">
-    <Image filename="gcompris/misc/cocotier.png"/>
-    <Image filename="gcompris/misc/cloud.png"/>
-    <Image filename="gcompris/misc/star.png"/>
-    <Image filename="gcompris/misc/egg.png"/>
-    <Image filename="gcompris/misc/flower.png"/>
-    <Image filename="gcompris/misc/sapin.png"/>
-    <Image filename="gcompris/misc/tree.png"/>
+  <ImageSet filename="babymatch/tree.png">
+    <Image filename="babymatch/cocotier.png"/>
+    <Image filename="babymatch/cloud.png"/>
+    <Image filename="babymatch/star.png"/>
+    <Image filename="babymatch/egg.png"/>
+    <Image filename="babymatch/flower.png"/>
+    <Image filename="babymatch/sapin.png"/>
+    <Image filename="babymatch/tree.png"/>
     <Image filename="imageid/chien.png"/>
     <Image filename="imageid/fish.png"/>
     <Image filename="images/water_spot.png"/>
   </ImageSet>
   <ImageSet filename="gcompris/food/grapefruit.png">
-    <Image filename="gcompris/misc/apple.png"/>
+    <Image filename="babymatch/apple.png"/>
     <Image filename="imageid/pomme.png"/>
-    <Image filename="gcompris/misc/peer.png"/>
-    <Image filename="gcompris/misc/carot.png"/>
-    <Image filename="gcompris/misc/cerise.png"/>
-    <Image filename="gcompris/misc/strawberry.png"/>
+    <Image filename="babymatch/peer.png"/>
+    <Image filename="babymatch/carot.png"/>
+    <Image filename="babymatch/cerise.png"/>
+    <Image filename="babymatch/strawberry.png"/>
     <Image filename="gcompris/food/baby_bottle.png"/>
     <Image filename="gcompris/food/banana.png"/>
     <Image filename="imageid/banana.png"/>
@@ -120,17 +120,17 @@
     <Image filename="gcompris/food/suggar_box.png"/>
     <Image filename="gcompris/food/yahourt.png"/>
   </ImageSet>
-  <ImageSet filename="gcompris/misc/tux.png">
-    <Image filename="gcompris/misc/tuxboat.png"/>
-    <Image filename="gcompris/misc/sailingboat.png"/>
-    <Image filename="gcompris/misc/tuxhelico.png"/>
-    <Image filename="gcompris/misc/tuxballoon.png"/>
-    <Image filename="gcompris/misc/tuxloco.png"/>
-    <Image filename="gcompris/misc/tuxplane.png"/>
-    <Image filename="gcompris/misc/Tux_mute.png"/>
-    <Image filename="gcompris/misc/Tux_play.png"/>
-    <Image filename="gcompris/misc/tux_top_north.png"/>
-    <Image filename="gcompris/misc/tux_top_south.png"/>
+  <ImageSet filename="babymatch/tux.png">
+    <Image filename="babymatch/tuxboat.png"/>
+    <Image filename="babymatch/sailingboat.png"/>
+    <Image filename="babymatch/tuxhelico.png"/>
+    <Image filename="babymatch/tuxballoon.png"/>
+    <Image filename="babymatch/tuxloco.png"/>
+    <Image filename="babymatch/tuxplane.png"/>
+    <Image filename="babymatch/Tux_mute.png"/>
+    <Image filename="babymatch/Tux_play.png"/>
+    <Image filename="babymatch/tux_top_north.png"/>
+    <Image filename="babymatch/tux_top_south.png"/>
     <Image filename="images/tux_albert.png"/>
     <Image filename="images/tux_graduate.png"/>
     <Image filename="images/tux-teacher.png"/>

Modified: branches/gcomprixogoo/docs/C/texinfo.tex
==============================================================================
--- branches/gcomprixogoo/docs/C/texinfo.tex	(original)
+++ branches/gcomprixogoo/docs/C/texinfo.tex	Wed Jul 30 23:37:49 2008
@@ -3,16 +3,15 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2007-12-02.17}
+\def\texinfoversion{2003-10-06.08}
 %
-% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 2007,
-% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007 Free Software Foundation, Inc.
+% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 %
-% This texinfo.tex file is free software: you can redistribute it and/or
+% 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
-% published by the Free Software Foundation, either version 3 of the
-% License, or (at your option) any later version.
+% published by the Free Software Foundation; either version 2, or (at
+% your option) any later version.
 %
 % This texinfo.tex file is distributed in the hope that it will be
 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
@@ -20,18 +19,25 @@
 % General Public License for more details.
 %
 % You should have received a copy of the GNU General Public License
-% along with this program.  If not, see <http://www.gnu.org/licenses/>.
-%
-% 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.)
+% along with this texinfo.tex file; see the file COPYING.  If not, write
+% 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!
 %
 % Please try the latest version of texinfo.tex before submitting bug
 % reports; you can get the latest version from:
-%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
+%   ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
+%     (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
 %   ftp://tug.org/tex/texinfo.tex
-%     (and all CTAN mirrors, see http://www.ctan.org).
-% The texinfo.tex in any given distribution could well be out
+%     (and all CTAN mirrors, see http://www.ctan.org),
+%   and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
+%
+% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
+%
+% The texinfo.tex in any given Texinfo distribution could well be out
 % of date, so if that's what you're using, please check.
 %
 % Send bug reports to bug-texinfo gnu org   Please include including a
@@ -53,9 +59,6 @@
 % 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]:}
 
@@ -65,7 +68,7 @@
 \everyjob{\message{[Texinfo version \texinfoversion]}%
   \catcode`+=\active \catcode`\_=\active}
 
-
+\message{Basics,}
 \chardef\other=12
 
 % We never want plain's \outer definition of \+ in Texinfo.
@@ -82,16 +85,13 @@
 \let\ptexend=\end
 \let\ptexequiv=\equiv
 \let\ptexexclam=\!
-\let\ptexfootnote=\footnote
 \let\ptexgtr=>
 \let\ptexhat=^
 \let\ptexi=\i
 \let\ptexindent=\indent
-\let\ptexinsert=\insert
+\let\ptexnoindent=\noindent
 \let\ptexlbrace=\{
 \let\ptexless=<
-\let\ptexnewwrite\newwrite
-\let\ptexnoindent=\noindent
 \let\ptexplus=+
 \let\ptexrbrace=\}
 \let\ptexslash=\/
@@ -102,15 +102,6 @@
 % 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
@@ -149,83 +140,43 @@
 \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
 
-% Since the category of space is not known, we have to be careful.
-\chardef\spacecat = 10
-\def\spaceisspace{\catcode`\ =\spacecat}
-
-% sometimes characters are active, so we need control sequences.
+% In some macros, we cannot use the `\? notation---the left quote is
+% in some cases the escape char.
 \chardef\colonChar = `\:
 \chardef\commaChar = `\,
-\chardef\dashChar  = `\-
 \chardef\dotChar   = `\.
+\chardef\equalChar = `\=
 \chardef\exclamChar= `\!
-\chardef\lquoteChar= `\`
 \chardef\questChar = `\?
-\chardef\rquoteChar= `\'
 \chardef\semiChar  = `\;
+\chardef\spaceChar = `\ %
 \chardef\underChar = `\_
 
 % Ignore a token.
 %
 \def\gobble#1{}
 
-% The following is used inside several \edef's.
-\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
+% True if #1 is the empty string, i.e., called like `\ifempty{}'.
+%
+\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
+\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
 
 % 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
-}
+\hyphenation{ap-pen-dix}
+\hyphenation{eshell}
+\hyphenation{mini-buf-fer mini-buf-fers}
+\hyphenation{time-stamp}
+\hyphenation{white-space}
 
 % Margin to add to right of even pages, to left of odd pages.
 \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.  We also make
@@ -250,7 +201,7 @@
     \tracingassigns1
   \fi
   \tracingcommands3  % 3 gives us more in etex
-  \errorcontextlines16
+  \errorcontextlines\maxdimen
 }%
 
 % add check for \lastpenalty to plain's definitions.  If the last thing
@@ -277,50 +228,6 @@
 \newdimen\cornerthick \cornerthick=.3pt
 \newdimen\topandbottommargin \topandbottommargin=.75in
 
-% Output a mark which sets \thischapter, \thissection and \thiscolor.
-% We dump everything together because we only have one kind of mark.
-% This works because we only use \botmark / \topmark, not \firstmark.
-%
-% A mark contains a subexpression of the \ifcase ... \fi construct.
-% \get*marks macros below extract the needed part using \ifcase.
-%
-% Another complication is to let the user choose whether \thischapter
-% (\thissection) refers to the chapter (section) in effect at the top
-% of a page, or that at the bottom of a page.  The solution is
-% described on page 260 of The TeXbook.  It involves outputting two
-% marks for the sectioning macros, one before the section break, and
-% one after.  I won't pretend I can describe this better than DEK...
-\def\domark{%
-  \toks0=\expandafter{\lastchapterdefs}%
-  \toks2=\expandafter{\lastsectiondefs}%
-  \toks4=\expandafter{\prevchapterdefs}%
-  \toks6=\expandafter{\prevsectiondefs}%
-  \toks8=\expandafter{\lastcolordefs}%
-  \mark{%
-                   \the\toks0 \the\toks2
-      \noexpand\or \the\toks4 \the\toks6
-    \noexpand\else \the\toks8
-  }%
-}
-% \topmark doesn't work for the very first chapter (after the title
-% page or the contents), so we use \firstmark there -- this gets us
-% the mark with the chapter defs, unless the user sneaks in, e.g.,
-% @setcolor (or @url, or @link, etc.) between @contents and the very
-% first @chapter.
-\def\gettopheadingmarks{%
-  \ifcase0\topmark\fi
-  \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
-}
-\def\getbottomheadingmarks{\ifcase1\botmark\fi}
-\def\getcolormarks{\ifcase2\topmark\fi}
-
-% Avoid "undefined control sequence" errors.
-\def\lastchapterdefs{}
-\def\lastsectiondefs{}
-\def\prevchapterdefs{}
-\def\prevsectiondefs{}
-\def\lastcolordefs{}
-
 % Main output routine.
 \chardef\PAGE = 255
 \output = {\onepageout{\pagecontents\PAGE}}
@@ -338,9 +245,7 @@
   %
   % Do this outside of the \shipout so @code etc. will be expanded in
   % the headline as they should be, not taken literally (outputting ''code).
-  \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
   \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
-  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
   \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
   %
   {%
@@ -348,17 +253,13 @@
     % take effect in \write's, yet the group defined by the \vbox ends
     % before the \shipout runs.
     %
+    \escapechar = `\\     % use backslash in output files.
     \indexdummies         % don't expand commands in the output.
     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
-               % the page break happens to be in the middle of an example.
-               % We don't want .vr (or whatever) entries like this:
-               % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
-               % "\acronym" won't work when it's read back in;
-               % it needs to be 
-               % {\code {{\tt \backslashcurfont }acronym}
+                   % 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 \pdfdest name{\the\pageno} xyz\fi
+      \ifpdfmakepagedest \pdfmkdest{\the\pageno}\fi
       %
       \ifcropmarks \vbox to \outervsize\bgroup
         \hsize = \outerhsize
@@ -383,9 +284,9 @@
       \pagebody{#1}%
       \ifdim\ht\footlinebox > 0pt
         % Only leave this space if the footline is nonempty.
-        % (We lessened \vsize for it in \oddfootingyyy.)
+        % (We lessened \vsize for it in \oddfootingxxx.)
         % The \baselineskip=24pt in plain's \makefootline has no effect.
-        \vskip 24pt
+        \vskip 2\baselineskip
         \unvbox\footlinebox
       \fi
       %
@@ -406,7 +307,7 @@
       \egroup % \vbox from first cropmarks clause
       \fi
     }% end of \shipout\vbox
-  }% end of group with \indexdummies
+  }% end of group with \normalturnoffactive
   \advancepageno
   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
 }
@@ -419,7 +320,7 @@
 % marginal hacks, juha viisa uucp (Juha Takala)
 \ifvoid\margin\else % marginal info is present
   \rlap{\kern\hsize\vbox to\z {\kern1pt\box\margin \vss}}\fi
-\dimen =\dp#1\relax \unvbox#1\relax
+\dimen =\dp#1 \unvbox#1
 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
 \ifr ggedbottom \kern-\dimen@ \vfil \fi}
 }
@@ -439,161 +340,132 @@
 % the input line (except we remove a trailing comment).  #1 should be a
 % macro which expects an ordinary undelimited TeX argument.
 %
-\def\parsearg{\parseargusing{}}
-\def\parseargusing#1#2{%
-  \def\argtorun{#2}%
+\def\parsearg#1{%
+  \let\next = #1%
   \begingroup
     \obeylines
-    \spaceisspace
-    #1%
-    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
+    \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
 }
 
+% 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.
-    \argremovecomment #1\comment\ArgTerm%
+    %
+    % 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}%
   }%
 }
 
-% 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}
+% 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}}
 
-% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
-%
-% \argremovec might leave us with trailing space, e.g.,
+% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
 %    @end itemize  @c foo
-% This space token undergoes the same procedure and is eventually removed
-% by \finishparsearg.
+% 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\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
-    % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
-    \let\temp\finishparsearg
-  \else
-    \let\temp\argcheckspaces
-  \fi
-  % Put the space token in:
-  \temp#1 #3\ArgTerm
+\def\removeactivespaces#1{%
+  \begingroup
+    \ignoreactivespaces
+    \edef\temp{#1}%
+    \global\toks0 = \expandafter{\temp}%
+  \endgroup
 }
 
-% 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 \argtorun.
-% (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.
-%
-% But first, we have to remove the trailing space token.
+% Change the active space to expand to nothing.
 %
-\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
+\begingroup
+  \obeyspaces
+  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
+\endgroup
 
-% \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%
-}
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
 
-% Several utility definitions with active space:
-{
-  \obeyspaces
-  \gdef\obeyedspace{ }
+%% 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
 
-  % 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}
-}
+% @begin foo  is the same as @foo, for now.
+\newhelp\EMsimple{Press RETURN to continue.}
 
+\outer\def\begin{\parsearg\beginxxx}
 
-\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+\def\beginxxx #1{%
+\expandafter\ifx\csname #1\endcsname\relax
+{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
+\csname #1\endcsname\fi}
 
-% Define the framework for environments in texinfo.tex.  It's used like this:
-%
-%   \envdef\foo{...}
-%   \def\Efoo{...}
+% @end foo executes the definition of \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.)
-
-
-% At runtime, environments start with this:
-\def\startenvironment#1{\begingroup\def\thisenv{#1}}
-% initialize
-\let\thisenv\empty
-
-% ... 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}}
-
-% Check whether we're in the right environment:
-\def\checkenv#1{%
-  \def\temp{#1}%
-  \ifx\thisenv\temp
+\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
   \else
-    \badenverr
+    % Everything's ok; the right environment has been started.
+    \csname E\endthing\endcsname
   \fi
 }
 
-% Evironment mismatch, #1 expected:
-\def\badenverr{%
+% There is an environment #1, but it hasn't been started.  Give an error.
+%
+\def\unmatchedenderror#1{%
   \errhelp = \EMsimple
-  \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
+  \errmessage{This ` end #1' doesn't have a matching ` #1'}%
 }
 
-% @end foo executes the definition of \Efoo.
-% But first, it executes a specialized version of \checkenv
+% Define the control sequence \E#1 to give an unmatched @end error.
 %
-\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
+\def\defineunmatchedend#1{%
+  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
 }
 
-\newhelp\EMsimple{Press RETURN to continue.}
-
 
 %% Simple single-character @ commands
 
@@ -615,7 +487,7 @@
 \let\}=\myrbrace
 \begingroup
   % Definitions to produce \{ and \} commands for indices,
-  % and @{ and @} for the aux/toc files.
+  % and @{ and @} for the aux file.
   \catcode`\{ = \other \catcode`\} = \other
   \catcode`\[ = 1 \catcode`\] = 2
   \catcode`\! = 0 \catcode`\\ = \other
@@ -625,9 +497,6 @@
   !gdef!rbraceatcmd[ }]%
 !endgroup
 
-% @comma{} to avoid , parsing problems.
-\let\comma = ,
-
 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 \let\, = \c
@@ -637,12 +506,10 @@
 \let\ubaraccent = \b
 \let\udotaccent = \d
 
-% Other special characters: @questiondown @exclamdown @ordf @ordm
+% Other special characters: @questiondown @exclamdown
 % 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}
@@ -655,25 +522,6 @@
   \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
@@ -696,28 +544,13 @@
 \let\/=\allowbreak
 
 % @. is an end-of-sentence period.
-\def\.{.\spacefactor=\endofsentencespacefactor\space}
+\def\.{.\spacefactor=3000 }
 
 % @! is an end-of-sentence bang.
-\def\!{!\spacefactor=\endofsentencespacefactor\space}
+\def\!{!\spacefactor=3000 }
 
 % @? is an end-of-sentence query.
-\def\?{?\spacefactor=\endofsentencespacefactor\space}
-
-% @frenchspacing on|off  says whether to put extra space after punctuation.
-% 
-\def\onword{on}
-\def\offword{off}
-%
-\parseargdef\frenchspacing{%
-  \def\temp{#1}%
-  \ifx\temp\onword \plainfrenchspacing
-  \else\ifx\temp\offword \plainnonfrenchspacing
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
-  \fi\fi
-}
+\def\?{?\spacefactor=3000 }
 
 % @w prevents a word break.  Without the \leavevmode, @w at the
 % beginning of a paragraph, when TeX is still in vertical mode, would
@@ -742,14 +575,59 @@
 \newbox\groupbox
 \def\vfilllimit{0.7}
 %
-\envdef\group{%
-  \ifnum\catcode`\^^M=\active \else
+\def\group{\begingroup
+  \ifnum\catcode13=\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.
+    % \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
+    \copy\groupbox
+    \endgroup         % End the \group.
+  }%
   %
   \setbox\groupbox = \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
+    %
     % 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
@@ -759,32 +637,6 @@
     \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 ...'.
 %
@@ -797,8 +649,10 @@
 
 \newdimen\mil  \mil=0.001in
 
+\def\need{\parsearg\needx}
+
 % Old definition--didn't work.
-%\parseargdef\need{\par %
+%\def\needx #1{\par %
 %% This method tries to make TeX break the page naturally
 %% if the depth of the box does not fit.
 %{\baselineskip=0pt%
@@ -806,7 +660,7 @@
 %\prevdepth=-1000pt
 %}}
 
-\parseargdef\need{%
+\def\needx#1{%
   % Ensure vertical mode, so we don't make a big box in the middle of a
   % paragraph.
   \par
@@ -845,10 +699,35 @@
   \fi
 }
 
-% @br   forces paragraph break (and is undocumented).
+% @br   forces paragraph break
 
 \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.
 %
 \def\page{\par\vfill\supereject}
@@ -861,11 +740,13 @@
 \newskip\exdentamount
 
 % This defn is used inside fill environments such as @defun.
-\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
+\def\exdent{\parsearg\exdentyyy}
+\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
 
 % This defn is used inside nofill environments such as @example.
-\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
-  \leftline{\hskip\leftskip{\rm#1}}}}
+\def\nofillexdent{\parsearg\nofillexdentyyy}
+\def\nofillexdentyyy #1{{\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
@@ -917,19 +798,8 @@
 }
 
 % @include file    insert text of that file as input.
-%
-\def\include{\parseargusing\filenamecatcodes\includezzz}
-\def\includezzz#1{%
-  \pushthisfilestack
-  \def\thisfile{#1}%
-  {%
-    \makevalueexpandable
-    \def\temp{\input #1 }%
-    \expandafter
-  }\temp
-  \popthisfilestack
-}
-\def\filenamecatcodes{%
+% Allow normal characters that  we make active in the argument (a file name).
+\def\include{\begingroup
   \catcode`\\=\other
   \catcode`~=\other
   \catcode`^=\other
@@ -938,50 +808,33 @@
   \catcode`<=\other
   \catcode`>=\other
   \catcode`+=\other
-  \catcode`-=\other
-}
-
-\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}}%
-}
-
-\def\popthisfilestack{\errthisfilestackempty}
-\def\errthisfilestackempty{\errmessage{Internal error:
-  the stack of filenames is empty.}}
+  \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\thisfile{#1}%
+  \let\value=\expandablevalue
+  \input\thisfile
+\endgroup}
 
 \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}}
+\def\center{\parsearg\docenter}
+\def\docenter#1{{%
+  \ifhmode \hfil\break \fi
+  \advance\hsize by -\leftskip
+  \advance\hsize by -\rightskip
+  \line{\hfil \ignorespaces#1\unskip \hfil}%
+  \ifhmode \break \fi
+}}
 
 % @sp n   outputs n lines of vertical space
 
-\parseargdef\sp{\vskip #1\baselineskip}
+\def\sp{\parsearg\spxxx}
+\def\spxxx #1{\vskip #1\baselineskip}
 
 % @comment ...line which is ignored...
 % @c is the same as @comment
@@ -1002,7 +855,8 @@
 \def\asisword{asis} % no translation, these are keywords
 \def\noneword{none}
 %
-\parseargdef\paragraphindent{%
+\def\paragraphindent{\parsearg\doparagraphindent}
+\def\doparagraphindent#1{%
   \def\temp{#1}%
   \ifx\temp\asisword
   \else
@@ -1019,7 +873,8 @@
 % 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.
-\parseargdef\exampleindent{%
+\def\exampleindent{\parsearg\doexampleindent}
+\def\doexampleindent#1{%
   \def\temp{#1}%
   \ifx\temp\asisword
   \else
@@ -1042,9 +897,12 @@
 % By default, we suppress indentation.
 %
 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
+\newdimen\currentparindent
+%
 \def\insertword{insert}
 %
-\parseargdef\firstparagraphindent{%
+\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
+\def\dofirstparagraphindent#1{%
   \def\temp{#1}%
   \ifx\temp\noneword
     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
@@ -1089,18 +947,23 @@
 \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.
+%
+\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
-% _ active, and distinguish by seeing if the current family is \slfam,
-% which is what @var uses.
-{
-  \catcode`\_ = \active
-  \gdef\mathunderscore{%
-    \catcode`\_=\active
-    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
-  }
-}
+% _ within @math be active (mathcode "8000), 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
@@ -1111,16 +974,15 @@
 %
 \def\math{%
   \tex
-  \mathunderscore
+  \mathcode`\_="8000 \mathunderscore
   \let\\ = \mathbackslash
   \mathactive
-  $\finishmath
-}
-\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
+  \implicitmath\finishmath}
+\def\finishmath#1{#1\implicitmath\Etex}
 
 % 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).
+% We have to reset their definitions in case the @math was an
+% argument to a command which set the catcodes (such as @item or @section).
 %
 {
   \catcode`^ = \active
@@ -1136,42 +998,8 @@
 }
 
 % @bullet and @minus need the same treatment as @math, just above.
-\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 the cm
-% typewriter fonts as three actual period characters; on the other hand,
-% in other typewriter fonts three periods are wider than 1.5em.  So do
-% whichever is larger.
-%
-\def\dots{%
-  \leavevmode
-  \setbox0=\hbox{...}% get width of three periods
-  \ifdim\wd0 > 1.5em
-    \dimen0 = \wd0
-  \else
-    \dimen0 = 1.5em
-  \fi
-  \hbox to \dimen0{%
-    \hskip 0pt plus.25fil
-    .\hskip 0pt plus1fil
-    .\hskip 0pt plus1fil
-    .\hskip 0pt plus.5fil
-  }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
-  \dots
-  \spacefactor=\endofsentencespacefactor
-}
-
-% @comma{} is so commas can be inserted into text without messing up
-% Texinfo's parsing.
-%
-\let\comma = ,
+\def\bullet{\implicitmath\ptexbullet\implicitmath}
+\def\minus{\implicitmath-\implicitmath}
 
 % @refill is a no-op.
 \let\refill=\relax
@@ -1187,20 +1015,20 @@
 % 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
-     \tryauxfile
-     % Open the new aux file.  TeX will close it automatically at exit.
-     \immediate\openout\auxfile=\jobname.aux
+     \readauxfile
    \fi % \openindices needs to do some work in any case.
    \openindices
-   \let\setfilename=\comment % Ignore extra @setfilename cmds.
+   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
+   \global\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
-   \ifeof 1 \else \input texinfo.cnf \fi
-   \closein 1
+   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
+   \closein1
+   \temp
    %
    \comment % Ignore the actual filename.
 }
@@ -1236,147 +1064,21 @@
 \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
-  \ifx\pdfoutput\relax
-  \else
-    \ifcase\pdfoutput
-    \else
-      \pdftrue
-    \fi
-  \fi
-\fi
-
-% PDF uses PostScript string constants for the names of xref targets,
-% for display in the outlines, and in other places.  Thus, we have to
-% double any backslashes.  Otherwise, a name like "\node" will be
-% interpreted as a newline (\n), followed by o, d, e.  Not good.
-% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
-% (and related messages, the final outcome is that it is up to the TeX
-% user to double the backslashes and otherwise make the string valid, so
-% that's what we do).
-
-% double active backslashes.
-% 
-{\catcode`\ =0 \catcode`\\=\active
- @gdef activebackslashdouble{%
-   @catcode` \=@active
-   @let\= doublebackslash}
-}
-
-% To handle parens, we must adopt a different approach, since parens are
-% not active characters.  hyperref.dtx (which has the same problem as
-% us) handles it with this amazing macro to replace tokens, with minor
-% changes for Texinfo.  It is included here under the GPL by permission
-% from the author, Heiko Oberdiek.
-% 
-% #1 is the tokens to replace.
-% #2 is the replacement.
-% #3 is the control sequence with the string.
-% 
-\def\HyPsdSubst#1#2#3{%
-  \def\HyPsdReplace##1#1##2\END{%
-    ##1%
-    \ifx\\##2\\%
-    \else
-      #2%
-      \HyReturnAfterFi{%
-        \HyPsdReplace##2\END
-      }%
-    \fi
-  }%
-  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
-}
-\long\def\HyReturnAfterFi#1\fi{\fi#1}
-
-% #1 is a control sequence in which to do the replacements.
-\def\backslashparens#1{%
-  \xdef#1{#1}% redefine it as its expansion; the definition is simply
-             % \lastnode when called from \setref -> \pdfmkdest.
-  \HyPsdSubst{(}{\realbackslash(}{#1}%
-  \HyPsdSubst{)}{\realbackslash)}{#1}%
-}
-
-\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
-with PDF output, and none of those formats could be found.  (.eps cannot
-be supported due to the design of the PDF format; use regular TeX (DVI
-output) for that.)}
-
-\ifpdf
-  %
-  % Color manipulation macros based on pdfcolor.tex.
-  \def\cmykDarkRed{0.28 1 1 0.35}
-  \def\cmykBlack{0 0 0 1}
-  %
-  \def\pdfsetcolor#1{\pdfliteral{#1 k}}
-  % Set color, and create a mark which defines \thiscolor accordingly,
-  % so that \makeheadline knows which color to restore.
-  \def\setcolor#1{%
-    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
-    \domark
-    \pdfsetcolor{#1}%
-  }
-  %
-  \def\maincolor{\cmykBlack}
-  \pdfsetcolor{\maincolor}
-  \edef\thiscolor{\maincolor}
-  \def\lastcolordefs{}
-  %
-  \def\makefootline{%
-    \baselineskip24pt
-    \line{\pdfsetcolor{\maincolor}\the\footline}%
-  }
-  %
-  \def\makeheadline{%
-    \vbox to 0pt{%
-      \vskip-22.5pt
-      \line{%
-        \vbox to8.5pt{}%
-        % Extract \thiscolor definition from the marks.
-        \getcolormarks
-        % Typeset the headline with \maincolor, then restore the color.
-        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
-      }%
-      \vss
-    }%
-    \nointerlineskip
-  }
-  %
-  %
-  \pdfcatalog{/PageMode /UseOutlines}
-  %
-  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
+  \pdftrue
+  \pdfoutput = 1
+  \input pdfcolor
+  \pdfcatalog{/PageMode /UseOutlines}%
   \def\dopdfimage#1#2#3{%
-    \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
-    \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
-    %
-    % pdftex (and the PDF format) support .png, .jpg, .pdf (among
-    % others).  Let's try in that order.
-    \let\pdfimgext=\empty
-    \begingroup
-      \openin 1 #1.png \ifeof 1
-        \openin 1 #1.jpg \ifeof 1
-          \openin 1 #1.jpeg \ifeof 1
-            \openin 1 #1.JPG \ifeof 1
-              \openin 1 #1.pdf \ifeof 1
-                \errhelp = \nopdfimagehelp
-                \errmessage{Could not find image file #1 for pdf}%
-              \else \gdef\pdfimgext{pdf}%
-              \fi
-            \else \gdef\pdfimgext{JPG}%
-            \fi
-          \else \gdef\pdfimgext{jpeg}%
-          \fi
-        \else \gdef\pdfimgext{jpg}%
-        \fi
-      \else \gdef\pdfimgext{png}%
-      \fi
-      \closein 1
-    \endgroup
-    %
+    \def\imagewidth{#2}%
+    \def\imageheight{#3}%
     % without \immediate, pdftex seg faults when the same image is
     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
     \ifnum\pdftexversion < 14
@@ -1384,38 +1086,20 @@
     \else
       \immediate\pdfximage
     \fi
-      \ifdim \wd0 >0pt width \imagewidth \fi
-      \ifdim \wd2 >0pt height \imageheight \fi
+      \ifx\empty\imagewidth\else width \imagewidth \fi
+      \ifx\empty\imageheight\else height \imageheight \fi
       \ifnum\pdftexversion<13
-         #1.\pdfimgext
+         #1.pdf%
        \else
-         {#1.\pdfimgext}%
+         {#1.pdf}%
        \fi
     \ifnum\pdftexversion < 14 \else
       \pdfrefximage \pdflastximage
     \fi}
-  %
-  \def\pdfmkdest#1{{%
-    % We have to set dummies so commands such as @code, and characters
-    % such as \, aren't expanded when present in a section title.
-    \indexnofonts
-    \turnoffactive
-    \activebackslashdouble
-    \makevalueexpandable
-    \def\pdfdestname{#1}%
-    \backslashparens\pdfdestname
-    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
-  }}
-  %
-  % used to mark target names; must be expandable.
+  \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
   \def\pdfmkpgn#1{#1}
-  %
-  % by default, use a color that is dark enough to print on paper as
-  % nearly black, but still distinguishable for online viewing.
-  \def\urlcolor{\cmykDarkRed}
-  \def\linkcolor{\cmykDarkRed}
-  \def\endlink{\setcolor{\maincolor}\pdfendlink}
-  %
+  \let\linkcolor = \Blue  % was Cyan, but that seems light?
+  \def\endlink{\Black\pdfendlink}
   % Adding outlines to PDF; macros for calculating structure of outlines
   % come from Petr Olsak
   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
@@ -1424,60 +1108,39 @@
     \advance\tempnum by 1
     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
   %
-  % #1 is the section text, which is what will be displayed in the
-  % outline by the pdf viewer.  #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
-  %
+  % #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 worth the trouble, since most documents are normally structured.
+    % seem worthwhile, since most documents are normally structured.
     \def\pdfoutlinedest{#3}%
-    \ifx\pdfoutlinedest\empty
-      \def\pdfoutlinedest{#4}%
-    \else
-      % Doubled backslashes in the name.
-      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
-       \backslashparens\pdfoutlinedest}%
-    \fi
+    \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi
     %
-    % Also double the backslashes in the display string.
-    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
-     \backslashparens\pdfoutlinetext}%
-    %
-    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
+    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}%
   }
   %
   \def\pdfmakeoutlines{%
-    \begingroup
+    \openin 1 \jobname.toc
+    \ifeof 1\else\begingroup
+      \closein 1
       % Thanh's hack / proper braces in bookmarks
       \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
       \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
       %
       % Read toc silently, to get counts of subentries for \pdfoutline.
-      \def\numchapentry##1##2##3##4{%
-	\def\thischapnum{##2}%
-	\def\thissecnum{0}%
-	\def\thissubsecnum{0}%
-      }%
+      \def\numchapentry##1##2##3##4{\def\thischapnum{##2}}%
       \def\numsecentry##1##2##3##4{%
-	\advancenumber{chap\thischapnum}%
-	\def\thissecnum{##2}%
-	\def\thissubsecnum{0}%
-      }%
+        \def\thissecnum{##2}%
+        \advancenumber{chap\thischapnum}}%
       \def\numsubsecentry##1##2##3##4{%
-	\advancenumber{sec\thissecnum}%
-	\def\thissubsecnum{##2}%
-      }%
-      \def\numsubsubsecentry##1##2##3##4{%
-	\advancenumber{subsec\thissubsecnum}%
-      }%
-      \def\thischapnum{0}%
-      \def\thissecnum{0}%
-      \def\thissubsecnum{0}%
+        \def\thissubsecnum{##2}%
+        \advancenumber{sec\thissecnum}}%
+      \def\numsubsubsecentry##1##2##3##4{\advancenumber{subsec\thissubsecnum}}%
       %
       % use \def rather than \let here because we redefine \chapentry et
       % al. a second time, below.
@@ -1489,12 +1152,12 @@
       \def\unnsecentry{\numsecentry}%
       \def\unnsubsecentry{\numsubsecentry}%
       \def\unnsubsubsecentry{\numsubsubsecentry}%
-      \readdatafile{toc}%
+      \input \jobname.toc
       %
       % 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}}%
@@ -1505,22 +1168,44 @@
       \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.
+      % Make special characters normal for writing to the pdf file.
       \indexnofonts
-      \setupdatafile
-      \catcode`\\=\active \otherbackslash
-      \input \tocreadfilename
-    \endgroup
+      \turnoffactive
+      \input \jobname.toc
+    \endgroup\fi
   }
   %
+  \def\makelinks #1,{%
+    \def\params{#1}\def\E{END}%
+    \ifx\params\E
+      \let\nextmakelinks=\relax
+    \else
+      \let\nextmakelinks=\makelinks
+      \ifnum\lnkcount>0,\fi
+      \picknum{#1}%
+      \startlink attr{/Border [0 0 0]}
+        goto name{\pdfmkpgn{\the\pgn}}%
+      \linkcolor #1%
+      \advance\lnkcount by 1%
+      \endlink
+    \fi
+    \nextmakelinks
+  }
+  \def\picknum#1{\expandafter\pn#1}
+  \def\pn#1{%
+    \def\p{#1}%
+    \ifx\p\lbrace
+      \let\nextpn=\ppn
+    \else
+      \let\nextpn=\ppnn
+      \def\first{#1}
+    \fi
+    \nextpn
+  }
+  \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
@@ -1535,28 +1220,21 @@
   \else
     \let \startlink \pdfstartlink
   \fi
-  % make a live url in pdf output.
   \def\pdfurl#1{%
     \begingroup
-      % it seems we really need yet another set of dummies; have not
-      % tried to figure out what each command should do in the context
-      % of @url.  for now, just make @/ a no-op, that's the only one
-      % people have actually reported a problem with.
-      % 
-      \normalturnoffactive
-      \def\ {@}%
-      \let\/=\empty
-      \makevalueexpandable
-      \leavevmode\setcolor{\urlcolor}%
+      \normalturnoffactive\def\ {@}%
+      \let\value=\expandablevalue
+      \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|\relax
+    \expandafter\poptoks\the\toksA|ENDTOKS|
     \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
@@ -1574,48 +1252,22 @@
     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
   \def\pdflink#1{%
     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
-    \setcolor{\linkcolor}#1\endlink}
+    \linkcolor #1\endlink}
   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\else
-  \let\pdfmkdest = \gobble
-  \let\pdfurl = \gobble
-  \let\endlink = \relax
-  \let\setcolor = \gobble
-  \let\pdfsetcolor = \gobble
-  \let\pdfmakeoutlines = \relax
-\fi  % \ifx\pdfoutput
+\fi % \ifx\pdfoutput
 
 
 \message{fonts,}
-
-% 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\bfstylename{bf}
-\def\tt{\fam=\ttfam \setfontstyle{tt}}
+% Font-change commands.
 
 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf.
+% So we set up a \sf analogous to plain's \rm, etc.
 \newfam\sffam
-\def\sf{\fam=\sffam \setfontstyle{sf}}
+\def\sf{\fam=\sffam \tensf}
 \let\li = \sf % Sometimes we call it \li, not \sf.
 
-% We don't need math for this font style.
-\def\ttsl{\setfontstyle{ttsl}}
-
+% We don't need math for this one.
+\def\ttsl{\tenttsl}
 
 % Default leading.
 \newdimen\textleading  \textleading = 13.2pt
@@ -1628,12 +1280,8 @@
 \def\strutheightpercent{.70833}
 \def\strutdepthpercent {.29167}
 %
-% can get a sort of poor man's double spacing by redefining this.
-\def\baselinefactor{1}
-%
 \def\setleading#1{%
-  \dimen0 = #1\relax
-  \normalbaselineskip = \baselinefactor\dimen0
+  \normalbaselineskip = #1\relax
   \normallineskip = \lineskipfactor\normalbaselineskip
   \normalbaselines
   \setbox\strutbox =\hbox{%
@@ -1642,279 +1290,10 @@
   }%
 }
 
-% PDF CMaps.  See also LaTeX's t1.cmap.
-%
-% do nothing with this by default.
-\expandafter\let\csname cmapOT1\endcsname\gobble
-\expandafter\let\csname cmapOT1IT\endcsname\gobble
-\expandafter\let\csname cmapOT1TT\endcsname\gobble
-
-% if we are producing pdf, and we have \pdffontattr, then define cmaps.
-% (\pdffontattr was introduced many years ago, but people still run
-% older pdftex's; it's easy to conditionalize, so we do.)
-\ifpdf \ifx\pdffontattr\undefined \else
-  \begingroup
-    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
-    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
-%%DocumentNeededResources: ProcSet (CIDInit)
-%%IncludeResource: ProcSet (CIDInit)
-%%BeginResource: CMap (TeX-OT1-0)
-%%Title: (TeX-OT1-0 TeX OT1 0)
-%%Version: 1.000
-%%EndComments
-/CIDInit /ProcSet findresource begin
-12 dict begin
-begincmap
-/CIDSystemInfo
-<< /Registry (TeX)
-/Ordering (OT1)
-/Supplement 0
->> def
-/CMapName /TeX-OT1-0 def
-/CMapType 2 def
-1 begincodespacerange
-<00> <7F>
-endcodespacerange
-8 beginbfrange
-<00> <01> <0393>
-<09> <0A> <03A8>
-<23> <26> <0023>
-<28> <3B> <0028>
-<3F> <5B> <003F>
-<5D> <5E> <005D>
-<61> <7A> <0061>
-<7B> <7C> <2013>
-endbfrange
-40 beginbfchar
-<02> <0398>
-<03> <039B>
-<04> <039E>
-<05> <03A0>
-<06> <03A3>
-<07> <03D2>
-<08> <03A6>
-<0B> <00660066>
-<0C> <00660069>
-<0D> <0066006C>
-<0E> <006600660069>
-<0F> <00660066006C>
-<10> <0131>
-<11> <0237>
-<12> <0060>
-<13> <00B4>
-<14> <02C7>
-<15> <02D8>
-<16> <00AF>
-<17> <02DA>
-<18> <00B8>
-<19> <00DF>
-<1A> <00E6>
-<1B> <0153>
-<1C> <00F8>
-<1D> <00C6>
-<1E> <0152>
-<1F> <00D8>
-<21> <0021>
-<22> <201D>
-<27> <2019>
-<3C> <00A1>
-<3D> <003D>
-<3E> <00BF>
-<5C> <201C>
-<5F> <02D9>
-<60> <2018>
-<7D> <02DD>
-<7E> <007E>
-<7F> <00A8>
-endbfchar
-endcmap
-CMapName currentdict /CMap defineresource pop
-end
-end
-%%EndResource
-%%EOF
-    }\endgroup
-  \expandafter\edef\csname cmapOT1\endcsname#1{%
-    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
-  }%
-%
-% \cmapOT1IT
-  \begingroup
-    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
-    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
-%%DocumentNeededResources: ProcSet (CIDInit)
-%%IncludeResource: ProcSet (CIDInit)
-%%BeginResource: CMap (TeX-OT1IT-0)
-%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
-%%Version: 1.000
-%%EndComments
-/CIDInit /ProcSet findresource begin
-12 dict begin
-begincmap
-/CIDSystemInfo
-<< /Registry (TeX)
-/Ordering (OT1IT)
-/Supplement 0
->> def
-/CMapName /TeX-OT1IT-0 def
-/CMapType 2 def
-1 begincodespacerange
-<00> <7F>
-endcodespacerange
-8 beginbfrange
-<00> <01> <0393>
-<09> <0A> <03A8>
-<25> <26> <0025>
-<28> <3B> <0028>
-<3F> <5B> <003F>
-<5D> <5E> <005D>
-<61> <7A> <0061>
-<7B> <7C> <2013>
-endbfrange
-42 beginbfchar
-<02> <0398>
-<03> <039B>
-<04> <039E>
-<05> <03A0>
-<06> <03A3>
-<07> <03D2>
-<08> <03A6>
-<0B> <00660066>
-<0C> <00660069>
-<0D> <0066006C>
-<0E> <006600660069>
-<0F> <00660066006C>
-<10> <0131>
-<11> <0237>
-<12> <0060>
-<13> <00B4>
-<14> <02C7>
-<15> <02D8>
-<16> <00AF>
-<17> <02DA>
-<18> <00B8>
-<19> <00DF>
-<1A> <00E6>
-<1B> <0153>
-<1C> <00F8>
-<1D> <00C6>
-<1E> <0152>
-<1F> <00D8>
-<21> <0021>
-<22> <201D>
-<23> <0023>
-<24> <00A3>
-<27> <2019>
-<3C> <00A1>
-<3D> <003D>
-<3E> <00BF>
-<5C> <201C>
-<5F> <02D9>
-<60> <2018>
-<7D> <02DD>
-<7E> <007E>
-<7F> <00A8>
-endbfchar
-endcmap
-CMapName currentdict /CMap defineresource pop
-end
-end
-%%EndResource
-%%EOF
-    }\endgroup
-  \expandafter\edef\csname cmapOT1IT\endcsname#1{%
-    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
-  }%
-%
-% \cmapOT1TT
-  \begingroup
-    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
-    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
-%%DocumentNeededResources: ProcSet (CIDInit)
-%%IncludeResource: ProcSet (CIDInit)
-%%BeginResource: CMap (TeX-OT1TT-0)
-%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
-%%Version: 1.000
-%%EndComments
-/CIDInit /ProcSet findresource begin
-12 dict begin
-begincmap
-/CIDSystemInfo
-<< /Registry (TeX)
-/Ordering (OT1TT)
-/Supplement 0
->> def
-/CMapName /TeX-OT1TT-0 def
-/CMapType 2 def
-1 begincodespacerange
-<00> <7F>
-endcodespacerange
-5 beginbfrange
-<00> <01> <0393>
-<09> <0A> <03A8>
-<21> <26> <0021>
-<28> <5F> <0028>
-<61> <7E> <0061>
-endbfrange
-32 beginbfchar
-<02> <0398>
-<03> <039B>
-<04> <039E>
-<05> <03A0>
-<06> <03A3>
-<07> <03D2>
-<08> <03A6>
-<0B> <2191>
-<0C> <2193>
-<0D> <0027>
-<0E> <00A1>
-<0F> <00BF>
-<10> <0131>
-<11> <0237>
-<12> <0060>
-<13> <00B4>
-<14> <02C7>
-<15> <02D8>
-<16> <00AF>
-<17> <02DA>
-<18> <00B8>
-<19> <00DF>
-<1A> <00E6>
-<1B> <0153>
-<1C> <00F8>
-<1D> <00C6>
-<1E> <0152>
-<1F> <00D8>
-<20> <2423>
-<27> <2019>
-<60> <2018>
-<7F> <00A8>
-endbfchar
-endcmap
-CMapName currentdict /CMap defineresource pop
-end
-end
-%%EndResource
-%%EOF
-    }\endgroup
-  \expandafter\edef\csname cmapOT1TT\endcsname#1{%
-    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
-  }%
-\fi\fi
-
-
 % Set the font macro #1 to the font named #2, adding on the
 % specified font prefix (normally `cm').
-% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
-% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
-% empty to omit).
-\def\setfont#1#2#3#4#5{%
-  \font#1=\fontprefix#2#3 scaled #4
-  \csname cmap#5\endcsname#1%
-}
-% This is what gets called when #5 of \setfont is empty.
-\let\cmap\gobble
-% emacs-page end of cmaps
+% #3 is the font's design size, #4 is a scale factor
+\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
 
 % Use cm as the default font prefix.
 % To specify the font prefix, you must define \fontprefix
@@ -1939,297 +1318,110 @@
 \def\scshape{csc}
 \def\scbshape{csc}
 
-% Definitions for a main text size of 11pt.  This is the default in
-% Texinfo.
-% 
-\def\definetextfontsizexi{%
-% Text fonts (11.2pt, magstep1).
-\def\textnominalsize{11pt}
-\edef\mainmagstep{\magstephalf}
-\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
-\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
-\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
-\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
-\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
-\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
-\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
+\newcount\mainmagstep
+\ifx\bigger\relax
+  % not really supported.
+  \mainmagstep=\magstep1
+  \setfont\textrm\rmshape{12}{1000}
+  \setfont\texttt\ttshape{12}{1000}
+\else
+  \mainmagstep=\magstephalf
+  \setfont\textrm\rmshape{10}{\mainmagstep}
+  \setfont\texttt\ttshape{10}{\mainmagstep}
+\fi
+% Instead of cmb10, you may want to use cmbx10.
+% cmbx10 is a prettier font on its own, but cmb10
+% looks better when embedded in a line with cmr10
+% (in Bob's opinion).
+\setfont\textbf\bfshape{10}{\mainmagstep}
+\setfont\textit\itshape{10}{\mainmagstep}
+\setfont\textsl\slshape{10}{\mainmagstep}
+\setfont\textsf\sfshape{10}{\mainmagstep}
+\setfont\textsc\scshape{10}{\mainmagstep}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}
 \font\texti=cmmi10 scaled \mainmagstep
 \font\textsy=cmsy10 scaled \mainmagstep
-\def\textecsize{1095}
 
-% A few fonts for @defun names and args.
-\setfont\defbf\bfshape{10}{\magstep1}{OT1}
-\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
-\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+% A few fonts for @defun, etc.
+\setfont\defbf\bxshape{10}{\magstep1} %was 1314
+\setfont\deftt\ttshape{10}{\magstep1}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
 
 % Fonts for indices, footnotes, small examples (9pt).
-\def\smallnominalsize{9pt}
-\setfont\smallrm\rmshape{9}{1000}{OT1}
-\setfont\smalltt\ttshape{9}{1000}{OT1TT}
-\setfont\smallbf\bfshape{10}{900}{OT1}
-\setfont\smallit\itshape{9}{1000}{OT1IT}
-\setfont\smallsl\slshape{9}{1000}{OT1}
-\setfont\smallsf\sfshape{9}{1000}{OT1}
-\setfont\smallsc\scshape{10}{900}{OT1}
-\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
+\setfont\smallrm\rmshape{9}{1000}
+\setfont\smalltt\ttshape{9}{1000}
+\setfont\smallbf\bfshape{10}{900}
+\setfont\smallit\itshape{9}{1000}
+\setfont\smallsl\slshape{9}{1000}
+\setfont\smallsf\sfshape{9}{1000}
+\setfont\smallsc\scshape{10}{900}
+\setfont\smallttsl\ttslshape{10}{900}
 \font\smalli=cmmi9
 \font\smallsy=cmsy9
-\def\smallecsize{0900}
 
 % Fonts for small examples (8pt).
-\def\smallernominalsize{8pt}
-\setfont\smallerrm\rmshape{8}{1000}{OT1}
-\setfont\smallertt\ttshape{8}{1000}{OT1TT}
-\setfont\smallerbf\bfshape{10}{800}{OT1}
-\setfont\smallerit\itshape{8}{1000}{OT1IT}
-\setfont\smallersl\slshape{8}{1000}{OT1}
-\setfont\smallersf\sfshape{8}{1000}{OT1}
-\setfont\smallersc\scshape{10}{800}{OT1}
-\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
+\setfont\smallerrm\rmshape{8}{1000}
+\setfont\smallertt\ttshape{8}{1000}
+\setfont\smallerbf\bfshape{10}{800}
+\setfont\smallerit\itshape{8}{1000}
+\setfont\smallersl\slshape{8}{1000}
+\setfont\smallersf\sfshape{8}{1000}
+\setfont\smallersc\scshape{10}{800}
+\setfont\smallerttsl\ttslshape{10}{800}
 \font\smalleri=cmmi8
 \font\smallersy=cmsy8
-\def\smallerecsize{0800}
 
-% Fonts for title page (20.4pt):
-\def\titlenominalsize{20pt}
-\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
-\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
-\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
-\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
-\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
-\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
+% Fonts for title page:
+\setfont\titlerm\rmbshape{12}{\magstep3}
+\setfont\titleit\itbshape{10}{\magstep4}
+\setfont\titlesl\slbshape{10}{\magstep4}
+\setfont\titlett\ttbshape{12}{\magstep3}
+\setfont\titlettsl\ttslshape{10}{\magstep4}
+\setfont\titlesf\sfbshape{17}{\magstep1}
 \let\titlebf=\titlerm
-\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
+\setfont\titlesc\scbshape{10}{\magstep4}
 \font\titlei=cmmi12 scaled \magstep3
 \font\titlesy=cmsy10 scaled \magstep4
 \def\authorrm{\secrm}
 \def\authortt{\sectt}
-\def\titleecsize{2074}
 
 % Chapter (and unnumbered) fonts (17.28pt).
-\def\chapnominalsize{17pt}
-\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
-\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
-\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
-\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
-\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
-\setfont\chapsf\sfbshape{17}{1000}{OT1}
+\setfont\chaprm\rmbshape{12}{\magstep2}
+\setfont\chapit\itbshape{10}{\magstep3}
+\setfont\chapsl\slbshape{10}{\magstep3}
+\setfont\chaptt\ttbshape{12}{\magstep2}
+\setfont\chapttsl\ttslshape{10}{\magstep3}
+\setfont\chapsf\sfbshape{17}{1000}
 \let\chapbf=\chaprm
-\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
+\setfont\chapsc\scbshape{10}{\magstep3}
 \font\chapi=cmmi12 scaled \magstep2
 \font\chapsy=cmsy10 scaled \magstep3
-\def\chapecsize{1728}
 
 % Section fonts (14.4pt).
-\def\secnominalsize{14pt}
-\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
-\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
-\setfont\secsl\slbshape{10}{\magstep2}{OT1}
-\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
-\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
-\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
+\setfont\secrm\rmbshape{12}{\magstep1}
+\setfont\secit\itbshape{10}{\magstep2}
+\setfont\secsl\slbshape{10}{\magstep2}
+\setfont\sectt\ttbshape{12}{\magstep1}
+\setfont\secttsl\ttslshape{10}{\magstep2}
+\setfont\secsf\sfbshape{12}{\magstep1}
 \let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep2}{OT1}
+\setfont\secsc\scbshape{10}{\magstep2}
 \font\seci=cmmi12 scaled \magstep1
 \font\secsy=cmsy10 scaled \magstep2
-\def\sececsize{1440}
 
 % Subsection fonts (13.15pt).
-\def\ssecnominalsize{13pt}
-\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
-\setfont\ssecit\itbshape{10}{1315}{OT1IT}
-\setfont\ssecsl\slbshape{10}{1315}{OT1}
-\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
-\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
-\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
+\setfont\ssecrm\rmbshape{12}{\magstephalf}
+\setfont\ssecit\itbshape{10}{1315}
+\setfont\ssecsl\slbshape{10}{1315}
+\setfont\ssectt\ttbshape{12}{\magstephalf}
+\setfont\ssecttsl\ttslshape{10}{1315}
+\setfont\ssecsf\sfbshape{12}{\magstephalf}
 \let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{1315}{OT1}
+\setfont\ssecsc\scbshape{10}{\magstep1}
 \font\sseci=cmmi12 scaled \magstephalf
 \font\ssecsy=cmsy10 scaled 1315
-\def\ssececsize{1200}
-
-% Reduced fonts for @acro in text (10pt).
-\def\reducednominalsize{10pt}
-\setfont\reducedrm\rmshape{10}{1000}{OT1}
-\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
-\setfont\reducedbf\bfshape{10}{1000}{OT1}
-\setfont\reducedit\itshape{10}{1000}{OT1IT}
-\setfont\reducedsl\slshape{10}{1000}{OT1}
-\setfont\reducedsf\sfshape{10}{1000}{OT1}
-\setfont\reducedsc\scshape{10}{1000}{OT1}
-\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
-\font\reducedi=cmmi10
-\font\reducedsy=cmsy10
-\def\reducedecsize{1000}
-
-% reset the current fonts
-\textfonts
-\rm
-} % end of 11pt text font size definitions
-
-
-% Definitions to make the main text be 10pt Computer Modern, with
-% section, chapter, etc., sizes following suit.  This is for the GNU
-% Press printing of the Emacs 22 manual.  Maybe other manuals in the
-% future.  Used with @smallbook, which sets the leading to 12pt.
-% 
-\def\definetextfontsizex{%
-% Text fonts (10pt).
-\def\textnominalsize{10pt}
-\edef\mainmagstep{1000}
-\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
-\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
-\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
-\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
-\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
-\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
-\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
-\font\texti=cmmi10 scaled \mainmagstep
-\font\textsy=cmsy10 scaled \mainmagstep
-\def\textecsize{1000}
-
-% A few fonts for @defun names and args.
-\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
-\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
-\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
-
-% Fonts for indices, footnotes, small examples (9pt).
-\def\smallnominalsize{9pt}
-\setfont\smallrm\rmshape{9}{1000}{OT1}
-\setfont\smalltt\ttshape{9}{1000}{OT1TT}
-\setfont\smallbf\bfshape{10}{900}{OT1}
-\setfont\smallit\itshape{9}{1000}{OT1IT}
-\setfont\smallsl\slshape{9}{1000}{OT1}
-\setfont\smallsf\sfshape{9}{1000}{OT1}
-\setfont\smallsc\scshape{10}{900}{OT1}
-\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
-\font\smalli=cmmi9
-\font\smallsy=cmsy9
-\def\smallecsize{0900}
-
-% Fonts for small examples (8pt).
-\def\smallernominalsize{8pt}
-\setfont\smallerrm\rmshape{8}{1000}{OT1}
-\setfont\smallertt\ttshape{8}{1000}{OT1TT}
-\setfont\smallerbf\bfshape{10}{800}{OT1}
-\setfont\smallerit\itshape{8}{1000}{OT1IT}
-\setfont\smallersl\slshape{8}{1000}{OT1}
-\setfont\smallersf\sfshape{8}{1000}{OT1}
-\setfont\smallersc\scshape{10}{800}{OT1}
-\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
-\font\smalleri=cmmi8
-\font\smallersy=cmsy8
-\def\smallerecsize{0800}
-
-% Fonts for title page (20.4pt):
-\def\titlenominalsize{20pt}
-\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
-\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
-\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
-\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
-\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
-\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
-\let\titlebf=\titlerm
-\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
-\font\titlei=cmmi12 scaled \magstep3
-\font\titlesy=cmsy10 scaled \magstep4
-\def\authorrm{\secrm}
-\def\authortt{\sectt}
-\def\titleecsize{2074}
-
-% Chapter fonts (14.4pt).
-\def\chapnominalsize{14pt}
-\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
-\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
-\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
-\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
-\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
-\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
-\let\chapbf\chaprm
-\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
-\font\chapi=cmmi12 scaled \magstep1
-\font\chapsy=cmsy10 scaled \magstep2
-\def\chapecsize{1440}
-
-% Section fonts (12pt).
-\def\secnominalsize{12pt}
-\setfont\secrm\rmbshape{12}{1000}{OT1}
-\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
-\setfont\secsl\slbshape{10}{\magstep1}{OT1}
-\setfont\sectt\ttbshape{12}{1000}{OT1TT}
-\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
-\setfont\secsf\sfbshape{12}{1000}{OT1}
-\let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep1}{OT1}
-\font\seci=cmmi12 
-\font\secsy=cmsy10 scaled \magstep1
-\def\sececsize{1200}
-
-% Subsection fonts (10pt).
-\def\ssecnominalsize{10pt}
-\setfont\ssecrm\rmbshape{10}{1000}{OT1}
-\setfont\ssecit\itbshape{10}{1000}{OT1IT}
-\setfont\ssecsl\slbshape{10}{1000}{OT1}
-\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
-\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
-\setfont\ssecsf\sfbshape{10}{1000}{OT1}
-\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{1000}{OT1}
-\font\sseci=cmmi10
-\font\ssecsy=cmsy10
-\def\ssececsize{1000}
-
-% Reduced fonts for @acro in text (9pt).
-\def\reducednominalsize{9pt}
-\setfont\reducedrm\rmshape{9}{1000}{OT1}
-\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
-\setfont\reducedbf\bfshape{10}{900}{OT1}
-\setfont\reducedit\itshape{9}{1000}{OT1IT}
-\setfont\reducedsl\slshape{9}{1000}{OT1}
-\setfont\reducedsf\sfshape{9}{1000}{OT1}
-\setfont\reducedsc\scshape{10}{900}{OT1}
-\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
-\font\reducedi=cmmi9
-\font\reducedsy=cmsy9
-\def\reducedecsize{0900}
-
-% reduce space between paragraphs
-\divide\parskip by 2
-
-% reset the current fonts
-\textfonts
-\rm
-} % end of 10pt text font size definitions
-
-
-% We provide the user-level command
-%   @fonttextsize 10
-% (or 11) to redefine the text font size.  pt is assumed.
-% 
-\def\xword{10}
-\def\xiword{11}
-%
-\parseargdef\fonttextsize{%
-  \def\textsizearg{#1}%
-  \wlog{doing @fonttextsize \textsizearg}%
-  %
-  % Set \globaldefs so that documents can use this inside @tex, since
-  % makeinfo 4.8 does not support it, but we need it nonetheless.
-  % 
- \begingroup \globaldefs=1
-  \ifx\textsizearg\xword \definetextfontsizex
-  \else \ifx\textsizearg\xiword \definetextfontsizexi
-  \else
-    \errhelp=\EMsimple
-    \errmessage{ fonttextsize only supports `10' or `11', not `\textsizearg'}
-  \fi\fi
- \endgroup
-}
-
+% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
+% but that is not a standard magnification.
 
 % In order for the font changes to affect most math symbols and letters,
 % we have to define the \textfont of the standard families.  Since
@@ -2244,81 +1436,50 @@
 }
 
 % The font-changing commands redefine the meanings of \tenSTYLE, instead
-% 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.
-%
+% 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.
 \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
-  \def\curfontsize{text}%
-  \def\lsize{reduced}\def\lllsize{smaller}%
+  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
   \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\curfontsize{title}%
-  \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\curfontsize{chap}%
-  \def\lsize{sec}\def\lllsize{text}%
+  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
   \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
-  \def\curfontsize{sec}%
-  \def\lsize{subsec}\def\lllsize{reduced}%
+  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
   \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
-  \def\curfontsize{ssec}%
-  \def\lsize{text}\def\lllsize{small}%
+  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
   \resetmathfonts \setleading{15pt}}
-\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\curfontsize{reduced}%
-  \def\lsize{small}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{10.5pt}}
+\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
 \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\curfontsize{small}%
-  \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\curfontsize{smaller}%
-  \def\lsize{smaller}\def\lllsize{smaller}%
   \resetmathfonts \setleading{9.5pt}}
 
 % Set the fonts to use with the @small... environments.
@@ -2327,7 +1488,7 @@
 % 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:
+% If we use \smallerfonts (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.
@@ -2335,13 +1496,14 @@
 % 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.
+% I wish we used A4 paper on this side of the Atlantic.
+%
 % --karl, 24jan03.
 
 
 % Set up the default fonts, so we can use them for creating boxes.
 %
-\definetextfontsizexi
+\textfonts
 
 % Define these so they can be easily changed for other fonts.
 \def\angleleft{$\langle$}
@@ -2351,10 +1513,10 @@
 \newcount\fontdepth \fontdepth=0
 
 % Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}{OT1}
-\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
-\setfont\shortcontsl\slshape{12}{1000}{OT1}
-\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+\setfont\shortcontrm\rmshape{12}{1000}
+\setfont\shortcontbf\bxshape{12}{1000}
+\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
@@ -2366,27 +1528,15 @@
 \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
 
-% @b, explicit bold.
 \def\b#1{{\bf #1}}
 \let\strong=\b
 
-% @sansserif, explicit sans.
-\def\sansserif#1{{\sf #1}}
-
 % We can't just use \exhyphenpenalty, because that only has effect at
 % the end of a paragraph.  Restore normal hyphenation at the end of the
 % group within which \nohyphenation is presumably called.
@@ -2399,25 +1549,19 @@
 % sometimes \x has an active definition that messes things up.
 %
 \catcode` =11
-  \def\plainfrenchspacing{%
+  \def\frenchspacing{%
     \sfcode\dotChar  =\ m \sfcode\questChar=\ m \sfcode\exclamChar=\ m
     \sfcode\colonChar=\ m \sfcode\semiChar =\ m \sfcode\commaChar =\ m
-    \def\endofsentencespacefactor{1000}% for @. and friends
-  }
-  \def\plainnonfrenchspacing{%
-    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
-    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
-    \def\endofsentencespacefactor{3000}% for @. and friends
   }
 \catcode` =\other
-\def\endofsentencespacefactor{3000}% default
 
 \def\t#1{%
-  {\tt \rawbackslash \plainfrenchspacing #1}%
+  {\tt \rawbackslash \frenchspacing #1}%
   \null
 }
+\let\ttfont=\t
 \def\samp#1{`\tclose{#1}'\null}
-\setfont\keyrm\rmshape{8}{1000}{OT1}
+\setfont\keyrm\rmshape{8}{1000}
 \font\keysy=cmsy9
 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
   \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
@@ -2425,7 +1569,6 @@
      \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
     \kern-0.4pt\hrule}%
   \kern-.06em\raise0.4pt\hbox{\angleright}}}}
-\def\key #1{{\nohyphenation \uppercase{#1}}\null}
 % The old definition, with no lozenge:
 %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
@@ -2451,13 +1594,13 @@
     \nohyphenation
     %
     \rawbackslash
-    \plainfrenchspacing
+    \frenchspacing
     #1%
   }%
   \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.
 
@@ -2467,23 +1610,18 @@
 % and arrange explicitly to hyphenate at a dash.
 %  -- rms.
 {
-  \catcode`\-=\active \catcode`\_=\active
-  \catcode`\'=\active \catcode`\`=\active
+  \catcode`\-=\active
+  \catcode`\_=\active
   %
   \global\def\code{\begingroup
-    \catcode\rquoteChar=\active \catcode\lquoteChar=\active
-    \let'\codequoteright \let`\codequoteleft
-    %
-    \catcode\dashChar=\active  \catcode\underChar=\active
-    \ifallowcodebreaks
-     \let-\codedash
-     \let_\codeunder
-    \else
-     \let-\realdash
-     \let_\realunder
-    \fi
+    \catcode`\-=\active \let-\codedash
+    \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{-}
@@ -2501,45 +1639,24 @@
 }
 \def\codex #1{\tclose{#1}\endgroup}
 
-% An additional complication: the above will allow breaks after, e.g.,
-% each of the four underscores in __typeof__.  This is undesirable in
-% some manuals, especially if they don't have long identifiers in
-% general.  @allowcodebreaks provides a way to control this.
-% 
-\newif\ifallowcodebreaks  \allowcodebreakstrue
-
-\def\keywordtrue{true}
-\def\keywordfalse{false}
-
-\parseargdef\allowcodebreaks{%
-  \def\txiarg{#1}%
-  \ifx\txiarg\keywordtrue
-    \allowcodebreakstrue
-  \else\ifx\txiarg\keywordfalse
-    \allowcodebreaksfalse
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
-  \fi\fi
-}
-
 % @kbd is like @code, except that if the argument is just one @key command,
 % then @kbd has no effect.
 
 % @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).
-\parseargdef\kbdinputstyle{%
-  \def\txiarg{#1}%
-  \ifx\txiarg\worddistinct
+\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
+\def\kbdinputstylexxx#1{%
+  \def\arg{#1}%
+  \ifx\arg\worddistinct
     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
-  \else\ifx\txiarg\wordexample
+  \else\ifx\arg\wordexample
     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
-  \else\ifx\txiarg\wordcode
+  \else\ifx\arg\wordcode
     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
   \else
     \errhelp = \EMsimple
-    \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
+    \errmessage{Unknown @kbdinputstyle option `\arg'}%
   \fi\fi\fi
 }
 \def\worddistinct{distinct}
@@ -2555,8 +1672,8 @@
 \else{\tclose{\kbdfont\look}}\fi
 \else{\tclose{\kbdfont\look}}\fi}
 
-% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
-\let\indicateurl=\code
+% For @url, @env, @command quotes seem unnecessary, so use \code.
+\let\url=\code
 \let\env=\code
 \let\command=\code
 
@@ -2588,10 +1705,6 @@
   \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.
 %
@@ -2633,140 +1746,22 @@
 \def\sc#1{{\smallcaps#1}}       % smallcaps font
 \def\ii#1{{\it #1}}             % italic font
 
-% @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{%
-  {\plainfrenchspacing #1}%
-  \def\temp{#2}%
-  \ifx\temp\empty \else
-    \space ({\unsepspaces \ignorespaces \temp \unskip})%
-  \fi
-}
+% @acronym downcases the argument and prints in smallcaps.
+\def\acronym#1{{\smallcaps \lowercase{#1}}}
 
-% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
-%
+% @pounds{} is a sterling sign.
 \def\pounds{{\it\$}}
 
-% @euro{} comes from a separate font, depending on the current style.
-% We use the free feym* fonts from the eurosym package by Henrik
-% Theiling, which support regular, slanted, bold and bold slanted (and
-% "outlined" (blackboard board, sort of) versions, which we don't need).
-% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
-% 
-% Although only regular is the truly official Euro symbol, we ignore
-% that.  The Euro is designed to be slightly taller than the regular
-% font height.
-% 
-% feymr - regular
-% feymo - slanted
-% feybr - bold
-% feybo - bold slanted
-% 
-% There is no good (free) typewriter version, to my knowledge.
-% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
-% Hmm.
-% 
-% Also doesn't work in math.  Do we need to do math with euro symbols?
-% Hope not.
-% 
-% 
-\def\euro{{\eurofont e}}
-\def\eurofont{%
-  % We set the font at each command, rather than predefining it in
-  % \textfonts and the other font-switching commands, so that
-  % installations which never need the symbol don't have to have the
-  % font installed.
-  % 
-  % There is only one designed size (nominal 10pt), so we always scale
-  % that to the current nominal size.
-  % 
-  % By the way, simply using "at 1em" works for cmr10 and the like, but
-  % does not work for cmbx10 and other extended/shrunken fonts.
-  % 
-  \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
-  %
-  \ifx\curfontstyle\bfstylename 
-    % bold:
-    \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
-  \else 
-    % regular:
-    \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
-  \fi
-  \thiseurofont
-}
-
-% Hacks for glyphs from the EC fonts similar to \euro.  We don't
-% use \let for the aliases, because sometimes we redefine the original
-% macro, and the alias should reflect the redefinition.
-\def\guillemetleft{{\ecfont \char"13}}
-\def\guillemotleft{\guillemetleft}
-\def\guillemetright{{\ecfont \char"14}}
-\def\guillemotright{\guillemetright}
-\def\guilsinglleft{{\ecfont \char"0E}}
-\def\guilsinglright{{\ecfont \char"0F}}
-\def\quotedblbase{{\ecfont \char"12}}
-\def\quotesinglbase{{\ecfont \char"0D}}
-%
-\def\ecfont{%
-  % We can't distinguish serif/sanserif and italic/slanted, but this
-  % is used for crude hacks anyway (like adding French and German
-  % quotes to documents typeset with CM, where we lose kerning), so
-  % hopefully nobody will notice/care.
-  \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
-  \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
-  \ifx\curfontstyle\bfstylename
-    % bold:
-    \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
-  \else
-    % regular:
-    \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
-  \fi
-  \thisecfont
-}
-
-% @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.
+% @registeredsymbol - R in a circle.  For now, only works in text size;
+% we'd have to redo the font mechanism to change the \scriptstyle and
+% \scriptscriptstyle font sizes to make it look right in headings.
 % Adapted from the plain.tex definition of \copyright.
 %
 \def\registeredsymbol{%
-  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
-               \hfil\crcr\Orb}}%
+  $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
     }$%
 }
 
-% @textdegree - the normal degrees sign.
-%
-\def\textdegree{$^\circ$}
-
-% 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
-
-% Quotes.
-\chardef\quotedblleft="5C
-\chardef\quotedblright=`\"
-\chardef\quoteleft=`\`
-\chardef\quoteright=`\'
-
 
 \message{page headings,}
 
@@ -2785,103 +1780,87 @@
 \newif\ifsetshortcontentsaftertitlepage
  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
 
-\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+\def\shorttitlepage{\parsearg\shorttitlepagezzz}
+\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
         \endgroup\page\hbox{}\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{%
+\def\titlepage{\begingroup \parindent=0pt \textfonts
+   \let\subtitlerm=\tenrm
+   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
+   %
+   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
+                   \let\tt=\authortt}%
+   %
+   % 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{%
       \iffinishedtitlepage\else
-	 \finishtitlepage
+         \finishtitlepage
       \fi
+      \oldpage
       \let\page = \oldpage
-      \page
-      \null
-    }%
+      \hbox{}}%
+%   \def\page{\oldpage \hbox{}}
 }
 
 \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
-}
-
-%%% 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
+   \vskip4pt \hrule height 2pt width \hsize
+   \vskip\titlepagebottomglue
+   \finishedtitlepagetrue
 }
 
-
 %%% Set up page headings and footings.
 
 \let\thispage=\folio
@@ -2891,7 +1870,7 @@
 \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
@@ -2905,64 +1884,43 @@
 % @evenfooting @thisfile||
 % @oddfooting ||@thisfile
 
-
 \def\evenheading{\parsearg\evenheadingxxx}
-\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
-\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
+\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{%
 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 
-\def\oddheading{\parsearg\oddheadingxxx}
-\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
-\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
+\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
+\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 
-\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
 
-\def\evenfooting{\parsearg\evenfootingxxx}
-\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
-\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
+\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
+\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 
-\def\oddfooting{\parsearg\oddfootingxxx}
-\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
-\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
+\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
+\gdef\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
   % @evenfooting will not be used by itself.
-  \global\advance\pageheight by -12pt
-  \global\advance\vsize by -12pt
+  \global\advance\pageheight by -\baselineskip
+  \global\advance\vsize by -\baselineskip
 }
 
-\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
-
-% @evenheadingmarks top     \thischapter <- chapter at the top of a page
-% @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
+\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
 %
-% The same set of arguments for:
-%
-% @oddheadingmarks
-% @evenfootingmarks
-% @oddfootingmarks
-% @everyheadingmarks
-% @everyfootingmarks
-
-\def\evenheadingmarks{\headingmarks{even}{heading}}
-\def\oddheadingmarks{\headingmarks{odd}{heading}}
-\def\evenfootingmarks{\headingmarks{even}{footing}}
-\def\oddfootingmarks{\headingmarks{odd}{footing}}
-\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
-                          \headingmarks{odd}{heading}{#1} }
-\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
-                          \headingmarks{odd}{footing}{#1} }
-% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
-\def\headingmarks#1#2#3 {%
-  \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
-  \global\expandafter\let\csname get#1#2marks\endcsname \temp
-}
-
-\everyheadingmarks bottom
-\everyfootingmarks bottom
+}% unbind the catcode of @.
 
 % @headings double      turns headings on for double-sided printing.
 % @headings single      turns headings on for single-sided printing.
@@ -2976,7 +1934,7 @@
 
 \def\headings #1 {\csname HEADINGS#1\endcsname}
 
-\def\HEADINGSoff{%
+\def\HEADINGSoff{
 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
 \HEADINGSoff
@@ -2985,7 +1943,7 @@
 % 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}
@@ -2997,7 +1955,7 @@
 
 % 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}
@@ -3044,11 +2002,12 @@
 % @settitle line...  specifies the title of the document, for headings.
 % It generates no output of its own.
 \def\thistitle{\putwordNoTitle}
-\def\settitle{\parsearg{\gdef\thistitle}}
+\def\settitle{\parsearg\settitlezzz}
+\def\settitlezzz #1{\gdef\thistitle{#1}}
 
 
 \message{tables,}
-% Tables -- @table, @ftable, @vtable, @item(x).
+% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
 
 % default indentation of table text
 \newdimen\tableindent \tableindent=.8in
@@ -3060,7 +2019,7 @@
 % used internally for \itemindent minus \itemmargin
 \newdimen\itemmax
 
-% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
+% Note @table, @vtable, 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).
@@ -3072,10 +2031,22 @@
 \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{\itemindicate{#1}}%
+  \setbox0=\hbox{\itemfont{#1}}%
   \itemindex{#1}%
   \nobreak % This prevents a break before @itemx.
   %
@@ -3099,13 +2070,17 @@
     % \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.  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.
-    % 
+    % Stop a page break at the \parskip glue coming up.  (Unfortunately
+    % we can't prevent a possible page break at the following
+    % \baselineskip glue.)  However, if what follows is an environment
+    % such as @example, there will be no \parskip glue; then
+    % the negative vskip we just 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.
+    % (Possibly there are other commands that could be followed by
+    % @example which need the same treatment, but not section titles; or
+    % maybe section titles are the only special case and they should be
+    % penalty 10001...)
     \penalty 10001
     \endgroup
     \itemxneedsnegativevskipfalse
@@ -3125,72 +2100,81 @@
   \fi
 }
 
-\def\item{\errmessage{ item while not in a list environment}}
-\def\itemx{\errmessage{ itemx while not in a list environment}}
+\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}{}{}{}{}}
 
 % @table, @ftable, @vtable.
-\envdef\table{%
-  \let\itemindex\gobble
-  \tablecheck{table}%
-}
-\envdef\ftable{%
-  \def\itemindex ##1{\doind {fn}{\code{##1}}}%
-  \tablecheck{ftable}%
-}
-\envdef\vtable{%
-  \def\itemindex ##1{\doind {vr}{\code{##1}}}%
-  \tablecheck{vtable}%
-}
-\def\tablecheck#1{%
-  \ifnum \the\catcode`\^^M=\active
-    \endgroup
-    \errmessage{This command won't work in this context; perhaps the problem is
-      that we are \inenvironment\thisenv}%
-    \def\next{\doignore{#1}}%
-  \else
-    \let\next\tablex
-  \fi
-  \next
-}
-\def\tablex#1{%
-  \def\itemindicate{#1}%
-  \parsearg\tabley
-}
-\def\tabley#1{%
-  {%
-    \makevalueexpandable
-    \edef\temp{\noexpand\tablez #1\space\space\space}%
-    \expandafter
-  }\temp \endtablez
+\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 %
 }
-\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
 
-\envdef\itemize{\parsearg\doitemize}
+\def\itemize{\parsearg\itemizezzz}
+
+\def\itemizezzz #1{%
+  \begingroup % ended by the @end itemize
+  \itemizey {#1}{\Eitemize}
+}
 
-\def\doitemize#1{%
+\def\itemizey#1#2{%
   \aboveenvbreak
   \itemmax=\itemindent
   \advance\itemmax by -\itemmargin
@@ -3199,33 +2183,13 @@
   \parindent=0pt
   \parskip=\smallskipamount
   \ifdim\parskip=0pt \parskip=2pt \fi
+  \def#2{\endgraf\afterenvbreak\endgroup}%
   \def\itemcontents{#1}%
   % @itemize with no arg is equivalent to @itemize @bullet.
   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
   \let\item=\itemizeitem
 }
 
-% 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.
 %
@@ -3235,8 +2199,11 @@
 % or number, to specify the first label in the enumerated list.  No
 % argument is the same as `1'.
 %
-\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
+\def\enumerate{\parsearg\enumeratezzz}
+\def\enumeratezzz #1{\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
@@ -3307,13 +2274,13 @@
   }%
 }
 
-% Call \doitemize, adding a period to the first argument and supplying the
+% Call itemizey, 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
-  \doitemize{#1.}\flushcr
+  \itemizey{#1.}\Eenumerate\flushcr
 }
 
 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
@@ -3324,6 +2291,16 @@
 \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
@@ -3350,14 +2327,24 @@
 %   @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 do not need to be on their own lines, but it will not hurt
-% if they are.
+% @item, @tab, @multitable or @end multitable do not need to be on their
+% own lines, but it will not hurt if they are.
 
 % Sample multitable:
 
@@ -3401,12 +2388,13 @@
 \def\xcolumnfractions{\columnfractions}
 \newif\ifsetpercent
 
-% #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 {%
+% #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 {%
   \global\advance\colcount by 1
-  \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
+  \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
   \setuptable
 }
 
@@ -3439,33 +2427,18 @@
   \go
 }
 
-% 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:
 %
-\newtoks\everytab  % insert after every tab.
-%
-\envdef\multitable{%
+\def\multitable{\parsearg\dotable}
+\def\dotable#1{\bgroup
   \vskip\parskip
-  \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}%
-  %
+  \let\item=\crcrwithfootnotes
+  % 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.
+  \let\tab=&%
+  \let\startfootins=\startsavedfootnote
   \tolerance=9500
   \hbadness=9500
   \setmultitablespacing
@@ -3473,93 +2446,85 @@
   \parindent=\multitableparindent
   \overfullrule=0pt
   \global\colcount=0
-  %
-  \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.
-    }%
+  \def\Emultitable{%
+    \global\setpercentfalse
+    \crcrwithfootnotes\crcr
+    \egroup\egroup
   }%
   %
-  \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
-    \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{%
-  \def\multistrut{\strut}% just use the standard line spacing
+  \halign\bgroup&\global\advance\colcount by 1\relax
+    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
   %
-  % Compute \multitablelinespace (if not defined by user) for use in
-  % \multitableparskip calculation.  We used define \multistrut based on
-  % this, but (ironically) that caused the spacing to be off.
-  % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
+  % 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\setmultitablespacing{% test to see if user has set \multitablelinespace.
+% If so, do nothing. If not, give it an appropriate dimension based on
+% current baselineskip.
 \ifdim\multitablelinespace=0pt
 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
 \global\advance\multitablelinespace by-\ht0
-\fi
+%% strut to put in table in case some entry doesn't have descenders,
+%% to keep lines equally spaced
+\let\multistrut = \strut
+\else
+%% FIXME: what is \box0 supposed to be?
+\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
+width0pt\relax} \fi
 %% Test to see if parskip is larger than space between lines of
 %% table. If not, do nothing.
 %%        If so, set to same dimension as multitablelinespace.
@@ -3574,33 +2539,65 @@
                                       %% than skip between lines in the table.
 \fi}
 
+% In case 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.  Otherwise, the insertion is lost, it never migrates to the
+% main vertical list.  --kasal, 22jan03.
+%
+\newbox\savedfootnotes
+%
+% \dotable \let's \startfootins to this, so that \dofootnote will call
+% it instead of starting the insertion right away.
+\def\startsavedfootnote{%
+  \global\setbox\savedfootnotes = \vbox\bgroup
+    \unvbox\savedfootnotes
+}
+\def\crcrwithfootnotes{%
+  \crcr
+  \ifvoid\savedfootnotes \else
+    \noalign{\insert\footins{\box\savedfootnotes}}%
+  \fi
+}
 
 \message{conditionals,}
-
-% @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\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}
+% Prevent errors for section commands.
+% Used in @ignore and in failing conditionals.
+\def\ignoresections{%
+  \let\appendix=\relax
+  \let\appendixsec=\relax
+  \let\appendixsection=\relax
+  \let\appendixsubsec=\relax
+  \let\appendixsubsection=\relax
+  \let\appendixsubsubsec=\relax
+  \let\appendixsubsubsection=\relax
+  %\let\begin=\relax
+  %\let\bye=\relax
+  \let\centerchap=\relax
+  \let\chapter=\relax
+  \let\contents=\relax
+  \let\section=\relax
+  \let\smallbook=\relax
+  \let\subsec=\relax
+  \let\subsection=\relax
+  \let\subsubsec=\relax
+  \let\subsubsection=\relax
+  \let\titlepage=\relax
+  \let\top=\relax
+  \let\unnumbered=\relax
+  \let\unnumberedsec=\relax
+  \let\unnumberedsection=\relax
+  \let\unnumberedsubsec=\relax
+  \let\unnumberedsubsection=\relax
+  \let\unnumberedsubsubsec=\relax
+  \let\unnumberedsubsubsection=\relax
+}
 
 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
 %
 \def\direntry{\doignore{direntry}}
+\def\documentdescriptionword{documentdescription}
 \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\ifnottex{\doignore{ifnottex}}
@@ -3610,44 +2607,50 @@
 \def\menu{\doignore{menu}}
 \def\xml{\doignore{xml}}
 
+% @dircategory CATEGORY  -- specify a category of the dir file
+% which this file should belong to.  Ignore this in TeX.
+\let\dircategory = \comment
+
 % 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
-  % Scan in ``verbatim'' mode:
-  \obeylines
-  \catcode`\@ = \other
-  \catcode`\{ = \other
-  \catcode`\} = \other
+  % Don't complain about control sequences we have declared \outer.
+  \ignoresections
   %
   % Make sure that spaces turn into tokens that match what \doignoretext wants.
-  \spaceisspace
+  \catcode\spaceChar = 10
+  %
+  % Ignore braces, so mismatched braces don't cause trouble.
+  \catcode`\{ = 9
+  \catcode`\} = 9
   %
   % Count number of #1's that we've seen.
   \doignorecount = 0
   %
   % Swallow text until we reach the matching ` end #1'.
-  \dodoignore{#1}%
+  \expandafter \dodoignore \csname#1\endcsname {#1}%
 }
 
-{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
+{ \catcode` =11 % We want to use \ST P which cannot appear in texinfo source.
   \obeylines %
   %
-  \gdef\dodoignore#1{%
-    % #1 contains the command name as a string, e.g., `ifinfo'.
-    %
-    % Define a command to find the next ` end #1'.
-    \long\def\doignoretext##1^^M end #1{%
-      \doignoretextyyy##1^^M #1\_STOP_}%
-    %
+  \gdef\dodoignore#1#2{%
+    % #1 contains, e.g., \ifinfo, a.k.a. @ifinfo.
+    % #2 contains the string `ifinfo'.
+    %
+    % Define a command to find the next ` end #2', which must be on a line
+    % by itself.
+    \long\def\doignoretext##1^^M\end #2{\doignoretextyyy##1^^M#1\ST P}%
     % 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_}%
+    \long\def\doignoretextyyy##1^^M#1##2\ST P{\doignoreyyy{##2}\ST@P}%
     %
     % And now expand that command.
+    \obeylines %
     \doignoretext ^^M%
   }%
 }
@@ -3661,11 +2664,11 @@
     \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.
+  \next #1% the token \ST P is present just after this macro.
 }
 
-% We have to swallow the remaining "\_STOP_".
-%
+% We have to swallow the remaining "\ST P".
+% 
 \def\doignoretextzzz#1{%
   \ifnum\doignorecount = 0	% We have just found the outermost @end.
     \let\next\enddoignore
@@ -3677,12 +2680,7 @@
 }
 
 % Finish off ignored text.
-{ \obeylines%
-  % Ignore anything after the last ` end #1'; this matters in verbatim
-  % environments, where otherwise the newline after an ignored conditional
-  % would result in a blank line in the output.
-  \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
-}
+\def\enddoignore{\endgroup\ignorespaces}
 
 
 % @set VAR sets the variable VAR to an empty value.
@@ -3691,58 +2689,53 @@
 % 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.
-% We rely on the fact that \parsearg sets \catcode`\ =10.
+% didn't need it.  Make sure the catcode of space is correct to avoid
+% losing inside @example, for instance.
 %
-\parseargdef\set{\setyyy#1 \endsetyyy}
+\def\set{\begingroup\catcode` =10
+  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
+  \parsearg\setxxx}
+\def\setxxx#1{\setyyy#1 \endsetyyy}
 \def\setyyy#1 #2\endsetyyy{%
-  {%
-    \makevalueexpandable
-    \def\temp{#2}%
-    \edef\next{\gdef\makecsname{SET#1}}%
-    \ifx\temp\empty
-      \next{}%
-    \else
-      \setzzz#2\endsetzzz
-    \fi
-  }%
+  \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
 }
-% Remove the trailing space \setxxx inserted.
-\def\setzzz#1 \endsetzzz{\next{#1}}
+% 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}}
 
 % @clear VAR clears (i.e., unsets) the variable VAR.
 %
-\parseargdef\clear{%
-  {%
-    \makevalueexpandable
-    \global\expandafter\let\csname SET#1\endcsname=\relax
-  }%
-}
+\def\clear{\parsearg\clearxxx}
+\def\clearxxx#1{\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
   %
-  \gdef\makevalueexpandable{%
-    \let\value = \expandablevalue
-    % We don't want these characters 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`\-=\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
-  }
+    \indexbreaks \let_\normalunderscore
+    \valuexxx}
 }
+\def\valuexxx#1{\expandablevalue{#1}\endgroup}
 
 % We have this subroutine so that we can handle at least some @value's
-% 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).
+% 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 (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
@@ -3756,36 +2749,55 @@
 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
 % with @set.
 %
-% 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\ifset{\parsearg\doifset}
+\def\doifset#1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \let\next=\ifsetfail
+  \else
+    \let\next=\ifsetsucceed
+  \fi
+  \next
 }
+\def\ifsetsucceed{\conditionalsucceed{ifset}}
 \def\ifsetfail{\doignore{ifset}}
+\defineunmatchedend{ifset}
 
 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
 % defined with @set, or has been undefined with @clear.
 %
-% 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.
-%
-\makecond{ifclear}
-\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
+\def\ifclear{\parsearg\doifclear}
+\def\doifclear#1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \let\next=\ifclearsucceed
+  \else
+    \let\next=\ifclearfail
+  \fi
+  \next
+}
+\def\ifclearsucceed{\conditionalsucceed{ifclear}}
 \def\ifclearfail{\doignore{ifclear}}
+\defineunmatchedend{ifclear}
 
-% @dircategory CATEGORY  -- specify a category of the dir file
-% which this file should belong to.  Ignore this in TeX.
-\let\dircategory=\comment
+% @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}
+
+% True conditional.  Since \set globally defines its variables, we can
+% just start and end a group (to keep the @end definition undefined at
+% the outer level).
+%
+\def\conditionalsucceed#1{\begingroup
+  \expandafter\def\csname E#1\endcsname{\endgroup}%
+}
 
 % @defininfoenclose.
 \let\definfoenclose=\comment
@@ -3795,8 +2807,9 @@
 % Index generation facilities
 
 % Define \newwrite to be identical to plain tex's \newwrite
-% except not \outer, so it can be used within macros and \if's.
-\edef\newwrite{\makecsname{ptexnewwrite}}
+% except not \outer, so it can be used within \newindex.
+{\catcode`\ =11
+\gdef\newwrite{\alloc 7\write\chardef\sixt@@n}}
 
 % \newindex {foo} defines an index named foo.
 % It automatically defines \fooindex such that
@@ -3882,50 +2895,41 @@
 % we have to laboriously prevent expansion for those that we don't.
 %
 \def\indexdummies{%
-  \escapechar = `\\     % use backslash in output files.
   \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
   %
-  % I don't entirely understand this, but when an index entry is
-  % generated from a macro call, the \endinput which \scanmacro inserts
-  % causes processing to be prematurely terminated.  This is,
-  % apparently, because \indexsorttmp is fully expanded, and \endinput
-  % is an expandable command.  The redefinition below makes \endinput
-  % disappear altogether for that purpose -- although logging shows that
-  % processing continues to some further point.  On the other hand, it
-  % seems \endinput does not hurt in the printed index arg, since that
-  % is still getting written without apparent harm.
-  % 
-  % Sample source (mac-idx3.tex, reported by Graham Percival to
-  % help-texinfo, 22may06):
-  % @macro funindex {WORD}
-  % @findex xyz
-  % @end macro
-  % ...
-  % @funindex commtest
-  % 
-  % The above is not enough to reproduce the bug, but it gives the flavor.
-  % 
-  % Sample whatsit resulting:
-  %   write3{\entry{xyz}{@folio }{ code {xyz endinput }}}
-  % 
-  % So:
-  \let\endinput = \empty
+  % \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}%
+  }%
   %
   % Do the redefinitions.
   \commondummies
 }
 
-% For the aux and toc files, @ is the escape character.  So we want to
-% redefine everything using @ as the escape character (instead of
-% \realbackslash, still used for index files).  When everything uses @,
-% this will be simpler.
+% 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\ {@@}%
@@ -3933,190 +2937,161 @@
   \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}%
+  }%
+  %
   % Do the redefinitions.
   \commondummies
-  \otherbackslash
 }
 
-% Called from \indexdummies and \atdummies.
+% Called from \indexdummies and \atdummies.  \definedummyword and
+% \definedummyletter must be defined first.
 %
 \def\commondummies{%
   %
-  % \definedummyword defines \#1 as \string\#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).
+  \normalturnoffactive
   %
-  \def\definedummyword  ##1{\def##1{\string##1\space}}%
-  \def\definedummyletter##1{\def##1{\string##1}}%
-  \let\definedummyaccent\definedummyletter
-  %
-  \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
+  % Control letters and accents.
+  \definedummyletter{_}%
+  \definedummyletter{,}%
+  \definedummyletter{"}%
+  \definedummyletter{`}%
+  \definedummyletter{'}%
+  \definedummyletter{^}%
+  \definedummyletter{~}%
+  \definedummyletter{=}%
+  \definedummyword{u}%
+  \definedummyword{v}%
+  \definedummyword{H}%
+  \definedummyword{dotaccent}%
+  \definedummyword{ringaccent}%
+  \definedummyword{tieaccent}%
+  \definedummyword{ubaraccent}%
+  \definedummyword{udotaccent}%
+  \definedummyword{dotless}%
+  %
+  % Other 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}%
   %
   % 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{bf}%
+  \definedummyword{gtr}%
+  \definedummyword{hat}%
+  \definedummyword{less}%
+  \definedummyword{sf}%
+  \definedummyword{sl}%
+  \definedummyword{tclose}%
+  \definedummyword{tt}%
   %
-  \definedummyword\LaTeX
-  \definedummyword\TeX
+  % Texinfo font commands.
+  \definedummyword{b}%
+  \definedummyword{i}%
+  \definedummyword{r}%
+  \definedummyword{sc}%
+  \definedummyword{t}%
+  %
+  \definedummyword{TeX}%
+  \definedummyword{acronym}%
+  \definedummyword{cite}%
+  \definedummyword{code}%
+  \definedummyword{command}%
+  \definedummyword{dfn}%
+  \definedummyword{dots}%
+  \definedummyword{emph}%
+  \definedummyword{env}%
+  \definedummyword{file}%
+  \definedummyword{kbd}%
+  \definedummyword{key}%
+  \definedummyword{math}%
+  \definedummyword{option}%
+  \definedummyword{samp}%
+  \definedummyword{strong}%
+  \definedummyword{uref}%
+  \definedummyword{url}%
+  \definedummyword{var}%
+  \definedummyword{verb}%
+  \definedummyword{w}%
   %
   % Assorted special characters.
-  \definedummyword\bullet
-  \definedummyword\comma
-  \definedummyword\copyright
-  \definedummyword\registeredsymbol
-  \definedummyword\dots
-  \definedummyword\enddots
-  \definedummyword\equiv
-  \definedummyword\error
-  \definedummyword\euro
-  \definedummyword\guillemetleft
-  \definedummyword\guillemetright
-  \definedummyword\guilsinglleft
-  \definedummyword\guilsinglright
-  \definedummyword\expansion
-  \definedummyword\minus
-  \definedummyword\pounds
-  \definedummyword\point
-  \definedummyword\print
-  \definedummyword\quotedblbase
-  \definedummyword\quotedblleft
-  \definedummyword\quotedblright
-  \definedummyword\quoteleft
-  \definedummyword\quoteright
-  \definedummyword\quotesinglbase
-  \definedummyword\result
-  \definedummyword\textdegree
+  \definedummyword{bullet}%
+  \definedummyword{copyright}%
+  \definedummyword{dots}%
+  \definedummyword{enddots}%
+  \definedummyword{equiv}%
+  \definedummyword{error}%
+  \definedummyword{expansion}%
+  \definedummyword{minus}%
+  \definedummyword{pounds}%
+  \definedummyword{point}%
+  \definedummyword{print}%
+  \definedummyword{result}%
   %
-  % We want to disable all macros so that they are not expanded by \write.
-  \macrolist
+  % 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
   %
-  \normalturnoffactive
+  % Normal spaces, not active ones.
+  \unsepspaces
   %
-  % Handle some cases of @value -- where it does not contain any
-  % (non-fully-expandable) commands.
-  \makevalueexpandable
+  % No macro expansion.
+  \turnoffmacros
 }
 
-% \commondummiesnofonts: common to \commondummies and \indexnofonts.
-%
-\def\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\pxref
-  \definedummyword\ref
-  \definedummyword\samp
-  \definedummyword\strong
-  \definedummyword\tie
-  \definedummyword\uref
-  \definedummyword\url
-  \definedummyword\var
-  \definedummyword\verb
-  \definedummyword\w
-  \definedummyword\xref
-}
+% 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 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\indexdummytex{TeX}
+\def\indexdummydots{...}
+%
 \def\indexnofonts{%
-  % Accent commands should become @asis.
-  \def\definedummyaccent##1{\let##1\asis}%
-  % We can just ignore other control letters.
-  \def\definedummyletter##1{\let##1\empty}%
-  % 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.
+  \let\,=\asis
+  \let\"=\asis
+  \let\`=\asis
+  \let\'=\asis
+  \let\^=\asis
+  \let\~=\asis
+  \let\==\asis
+  \let\u=\asis
+  \let\v=\asis
+  \let\H=\asis
+  \let\dotaccent=\asis
+  \let\ringaccent=\asis
+  \let\tieaccent=\asis
+  \let\ubaraccent=\asis
+  \let\udotaccent=\asis
+  \let\dotless=\asis
+  %
+  % Other non-English letters.
   \def\AA{AA}%
   \def\AE{AE}%
   \def\L{L}%
@@ -4130,72 +3105,60 @@
   \def\ss{ss}%
   \def\exclamdown{!}%
   \def\questiondown{?}%
-  \def\ordf{a}%
-  \def\ordm{o}%
   %
-  \def\LaTeX{LaTeX}%
-  \def\TeX{TeX}%
+  % 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
   %
-  % 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\euro{euro}%
-  \def\guillemetleft{<<}%
-  \def\guillemetright{>>}%
-  \def\guilsinglleft{<}%
-  \def\guilsinglright{>}%
-  \def\expansion{==>}%
-  \def\minus{-}%
-  \def\pounds{pounds}%
-  \def\point{.}%
-  \def\print{-|}%
-  \def\quotedblbase{"}%
-  \def\quotedblleft{"}%
-  \def\quotedblright{"}%
-  \def\quoteleft{`}%
-  \def\quoteright{'}%
-  \def\quotesinglbase{,}%
-  \def\result{=>}%
-  \def\textdegree{degrees}%
-  %
-  % 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.
-  % 
-  \macrolist
+  % Texinfo font commands.
+  \let\b=\asis
+  \let\i=\asis
+  \let\r=\asis
+  \let\sc=\asis
+  \let\t=\asis
+  %
+  \let\TeX=\indexdummytex
+  \let\acronym=\asis
+  \let\cite=\asis
+  \let\code=\asis
+  \let\command=\asis
+  \let\dfn=\asis
+  \let\dots=\indexdummydots
+  \let\emph=\asis
+  \let\env=\asis
+  \let\file=\asis
+  \let\kbd=\asis
+  \let\key=\asis
+  \let\math=\asis
+  \let\option=\asis
+  \let\samp=\asis
+  \let\strong=\asis
+  \let\uref=\asis
+  \let\url=\asis
+  \let\var=\asis
+  \let\verb=\asis
+  \let\w=\asis
 }
 
 \let\indexbackslash=0  %overridden during \printindex.
 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
 
 % Most index entries go through here, but \dosubind is the general case.
-% #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 most defuns, which call us directly).
+% \empty if called from \doind, as we usually are.  The main exception
+% is with 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.
+    % If third arg is present, precede it with space.
     \def\thirdarg{#3}%
     \ifx\thirdarg\empty \else
       \toks0 = \expandafter{\the\toks0 \space #3}%
@@ -4203,12 +3166,16 @@
     %
     \edef\writeto{\csname#1indfile\endcsname}%
     %
-    \safewhatsit\dosubindwrite
+    \ifvmode
+      \dosubindsanitize
+    \else
+      \dosubindwrite
+    \fi
   }%
   \fi
 }
 
-% Write the entry in \toks0 to the index file:
+% Write the entry to the index file:
 %
 \def\dosubindwrite{%
   % Put the index entry in the margin if desired.
@@ -4218,7 +3185,8 @@
   %
   % Remember, we are within a group.
   \indexdummies % Must do this here, since \bf, etc expand at this stage
-  \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
+  \escapechar=`\\
+  \def\rawbackslashxx{\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
@@ -4240,13 +3208,13 @@
   \temp
 }
 
-% Take care of unwanted page breaks/skips around a whatsit:
+%  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 or \pdfdest will make \lastskip zero.  The result is that
-% sequences like this:
+% \write will make \lastskip zero.  The result is that sequences
+% like this:
 % @end defun
 % @tindex whatever
 % @defun ...
@@ -4259,63 +3227,38 @@
 %
 % 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}
-%
-\newskip\whatsitskip
-\newcount\whatsitpenalty
-%
-% ..., ready, GO:
-%
-\def\safewhatsit#1{%
-\ifhmode
-  #1%
-\else
+\def\dosubindsanitize{%
   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
-  \whatsitskip = \lastskip
-  \edef\lastskipmacro{\the\lastskip}%
-  \whatsitpenalty = \lastpenalty
+  \skip0 = \lastskip
+  \count255 = \lastpenalty
   %
   % If \lastskip is nonzero, that means the last item was a
   % skip.  And since a skip is discardable, that means this
-  % -\whatsitskip glue we're inserting is preceded by a
+  % -\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-\whatsitskip
-  \fi
+  \ifdim\lastskip = 0pt \else \vskip-\skip0 \fi
   %
-  #1%
+  \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:
-    % 
+  \ifdim\skip0 = 0pt
+    % 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 penalty; 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\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
+    \ifnum\count255>9999 \nobreak \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\whatsitskip
+    \nobreak\vskip\skip0
   \fi
-\fi
 }
 
 % The index entry written in the file actually looks like
@@ -4353,13 +3296,14 @@
 % @printindex causes a particular index (the ??s file) to get printed.
 % It does not print any chapter heading (usually an @unnumbered).
 %
-\parseargdef\printindex{\begingroup
+\def\printindex{\parsearg\doprintindex}
+\def\doprintindex#1{\begingroup
   \dobreak \chapheadingskip{10000}%
   %
   \smallfonts \rm
   \tolerance = 9500
-  \plainfrenchspacing
   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
+  \indexbreaks
   %
   % See if the index file exists and is nonempty.
   % Change catcode of @ here so that if the index file contains
@@ -4386,7 +3330,7 @@
       % 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{\backslashcurfont}%
+      \def\indexbackslash{\rawbackslashxx}%
       \catcode`\\ = 0
       \escapechar = `\\
       \begindoublecolumns
@@ -4408,10 +3352,7 @@
   \removelastskip
   %
   % We like breaks before the index initials, so insert a bonus.
-  \nobreak
-  \vskip 0pt plus 3\baselineskip
-  \penalty 0
-  \vskip 0pt plus -3\baselineskip
+  \penalty -300
   %
   % Typeset the initial.  Making this add up to a whole number of
   % baselineskips increases the chance of the dots lining up from column
@@ -4421,101 +3362,84 @@
   % 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
 }}
 
-% \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.
-%
-% 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
-    %
-    % \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
-    %
-    % 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.
-    \setbox\boxA = \hbox{#1}%
-    \ifdim\wd\boxA = 0pt
-      \ %
+% 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.
+%
+\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%
+    %
+    % 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#2.\ \the\toksA % The page number ends the paragraph.
     \else
-      %
-      % 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
+      \ #2% The page number ends the paragraph.
     \fi
-    \par
-  \endgroup
-}
+  \fi%
+  \par
+\endgroup}
 
-% Like plain.tex's \dotfill, except uses up at least 1 em.
+% Like \dotfill except takes at least 1 em.
 \def\indexdotfill{\cleaders
-  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
+  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
 
 \def\primary #1{\line{#1\hfil}}
 
@@ -4625,34 +3549,6 @@
 %
 % All done with double columns.
 \def\enddoublecolumns{%
-  % The following penalty ensures that the page builder is exercised
-  % _before_ we change the output routine.  This is necessary in the
-  % following situation:
-  %
-  % The last section of the index consists only of a single entry.
-  % Before this section, \pagetotal is less than \pagegoal, so no
-  % break occurs before the last section starts.  However, the last
-  % section, consisting of \initial and the single \entry, does not
-  % fit on the page and has to be broken off.  Without the following
-  % penalty the page builder will not be exercised until \eject
-  % below, and by that time we'll already have changed the output
-  % routine to the \balancecolumns version, so the next-to-last
-  % double-column page will be processed with \balancecolumns, which
-  % is wrong:  The two columns will go to the main vertical list, with
-  % the broken-off section in the recent contributions.  As soon as
-  % the output routine finishes, TeX starts reconsidering the page
-  % break.  The two columns and the broken-off section both fit on the
-  % page, because the two columns now take up only half of the page
-  % goal.  When TeX sees \eject from below which follows the final
-  % section, it invokes the new output routine that we've set after
-  % \balancecolumns below; \onepageout will try to fit the two columns
-  % and the final section into the vbox of \pageheight (see
-  % \pagebody), causing an overfull box.
-  %
-  % Note that glue won't work here, because glue does not exercise the
-  % page builder, unlike penalties (see The TeXbook, pp. 280-281).
-  \penalty0
-  %
   \output = {%
     % Split the last of the double-column material.  Leave it on the
     % current page, no automatic page break.
@@ -4726,7 +3622,7 @@
 % 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%
@@ -4762,15 +3658,11 @@
   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
 
-% Each @chapter defines these (using marks) as the number+name, number
-% and name of the chapter.  Page headings and footings can use
-% these.  @section does likewise.
+% 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\thischapternum{}
-\def\thischaptername{}
 \def\thissection{}
-\def\thissectionnum{}
-\def\thissectionname{}
 
 \newcount\absseclevel % used to calculate proper heading level
 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
@@ -4783,106 +3675,59 @@
 \def\lowersections{\global\advance\secbase by 1}
 \let\down=\lowersections % original BFox name
 
-% 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
+% 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 > 3
-      \absseclevel = 3
+    \ifnum \absseclevel<0 \chapterzzz{#2}%
+    \else \numberedsubsubseczzz{#2}%
     \fi
   \fi
-  % The heading type:
-  \def\headtype{#1}%
-  \if \headtype U%
-    \ifnum \absseclevel < \unmlevel
-      \chardef\unmlevel = \absseclevel
-    \fi
+  \suppressfirstparagraphindent
+}
+
+% 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
-    % 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
+    \ifnum \absseclevel<0 \appendixzzz{#2}%
+    \else \appendixsubsubseczzz{#2}%
     \fi
   \fi
-  % Now print the heading:
-  \if \headtype U%
-    \ifcase\absseclevel
-	\unnumberedzzz{#3}%
-    \or \unnumberedseczzz{#3}%
-    \or \unnumberedsubseczzz{#3}%
-    \or \unnumberedsubsubseczzz{#3}%
-    \fi
+  \suppressfirstparagraphindent
+}
+
+% 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
-    \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
+    \ifnum \absseclevel<0 \unnumberedzzz{#2}%
+    \else \unnumberedsubsubseczzz{#2}%
     \fi
   \fi
   \suppressfirstparagraphindent
 }
 
-% 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
+% @chapter, @appendix, @unnumbered.
 %
-\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\outer\def\chapter{\parsearg\chapteryyy}
+\def\chapteryyy#1{\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
-  %
+  \secno=0 \subsecno=0 \subsubsecno=0  \advance\chapno by 1
   \message{\putwordChapter\space \the\chapno}%
   %
   % Write the actual heading.
@@ -4894,31 +3739,29 @@
   \global\let\subsubsection = \numberedsubsubsec
 }
 
-\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
+\outer\def\appendix{\parsearg\appendixyyy}
+\def\appendixyyy#1{\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
-  %
+  \secno=0 \subsecno=0 \subsubsecno=0  \advance\appendixno by 1
   \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
+% @centerchap is like @unnumbered, but the heading is centered.
+\outer\def\centerchap{\parsearg\centerchapyyy}
+\def\centerchapyyy#1{{\unnumberedyyy{#1}}}
+
+% @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{%
-  \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
+  \secno=0 \subsecno=0 \subsubsecno=0  \advance\unnumberedno by 1
   %
   % This used to be simply \message{#1}, but TeX fully expands the
   % argument to \message.  Therefore, if #1 contained @-commands, TeX
@@ -4931,8 +3774,7 @@
   % \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)}%
+  \toks0 = {#1}\message{(\the\toks0)}%
   %
   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
   %
@@ -4941,82 +3783,96 @@
   \global\let\subsubsection = \unnumberedsubsubsec
 }
 
-% @centerchap is like @unnumbered, but the heading is centered.
-\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.
-\let\top\unnumbered
-
 % Sections.
-\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
+\outer\def\numberedsec{\parsearg\secyyy}
+\def\secyyy#1{\numhead1{#1}} % normally calls seczzz
 \def\seczzz#1{%
-  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
+  \subsecno=0 \subsubsecno=0  \advance\secno by 1
   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
 }
 
-\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
+\outer\def\appendixsection{\parsearg\appendixsecyyy}
+\outer\def\appendixsec{\parsearg\appendixsecyyy}
+\def\appendixsecyyy#1{\apphead1{#1}} % normally calls appendixsectionzzz
 \def\appendixsectionzzz#1{%
-  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
+  \subsecno=0 \subsubsecno=0  \advance\secno by 1
   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
 }
-\let\appendixsec\appendixsection
 
-\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
+\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
+\def\unnumberedsecyyy#1{\unnmhead1{#1}} % normally calls unnumberedseczzz
 \def\unnumberedseczzz#1{%
-  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
+  \subsecno=0 \subsubsecno=0  \advance\secno by 1
   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
 }
 
 % Subsections.
-\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
+\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
+\def\numberedsubsecyyy#1{\numhead2{#1}} % normally calls numberedsubseczzz
 \def\numberedsubseczzz#1{%
-  \global\subsubsecno=0  \global\advance\subsecno by 1
+  \subsubsecno=0  \advance\subsecno by 1
   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
 }
 
-\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
+\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
+\def\appendixsubsecyyy#1{\apphead2{#1}} % normally calls appendixsubseczzz
 \def\appendixsubseczzz#1{%
-  \global\subsubsecno=0  \global\advance\subsecno by 1
+  \subsubsecno=0  \advance\subsecno by 1
   \sectionheading{#1}{subsec}{Yappendix}%
                  {\appendixletter.\the\secno.\the\subsecno}%
 }
 
-\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
+\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
+\def\unnumberedsubsecyyy#1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
 \def\unnumberedsubseczzz#1{%
-  \global\subsubsecno=0  \global\advance\subsecno by 1
+  \subsubsecno=0  \advance\subsecno by 1
   \sectionheading{#1}{subsec}{Ynothing}%
                  {\the\unnumberedno.\the\secno.\the\subsecno}%
 }
 
 % Subsubsections.
-\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
+\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
+\def\numberedsubsubsecyyy#1{\numhead3{#1}} % normally numberedsubsubseczzz
 \def\numberedsubsubseczzz#1{%
-  \global\advance\subsubsecno by 1
+  \advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Ynumbered}%
                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
-\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
+\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
+\def\appendixsubsubsecyyy#1{\apphead3{#1}} % normally appendixsubsubseczzz
 \def\appendixsubsubseczzz#1{%
-  \global\advance\subsubsecno by 1
+  \advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Yappendix}%
                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
-\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
+\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
+\def\unnumberedsubsubsecyyy#1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
 \def\unnumberedsubsubseczzz#1{%
-  \global\advance\subsubsecno by 1
+  \advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Ynothing}%
                  {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
+% These are variants which are not "outer", so they can appear in @ifinfo.
+% Actually, they are 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}
+
 % 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.
@@ -5050,11 +3906,14 @@
 }
 
 % @heading, @subheading, @subsubheading.
-\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
+\def\heading{\parsearg\doheading}
+\def\subheading{\parsearg\dosubheading}
+\def\subsubheading{\parsearg\dosubsubheading}
+\def\doheading#1{\sectionheading{#1}{sec}{Yomitfromtoc}{}
   \suppressfirstparagraphindent}
-\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
+\def\dosubheading#1{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
   \suppressfirstparagraphindent}
-\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
+\def\dosubsubheading#1{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
   \suppressfirstparagraphindent}
 
 % These macros generate a chapter, section, etc. heading only
@@ -5064,6 +3923,8 @@
 %%% 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)
 
@@ -5071,20 +3932,7 @@
 
 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
 \def\chappager{\par\vfill\supereject}
-% Because \domark is called before \chapoddpage, the filler page will
-% get the headings for the next chapter, which is wrong.  But we don't
-% care -- we just disable all headings on the filler page.
-\def\chapoddpage{%
-  \chappager
-  \ifodd\pageno \else
-    \begingroup
-      \evenheadline={\hfil}\evenfootline={\hfil}%
-      \oddheadline={\hfil}\oddfootline={\hfil}%
-      \hbox to 0pt{}%
-      \chappager
-    \endgroup
-  \fi
-}
+\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
 
 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
 
@@ -5107,83 +3955,57 @@
 
 \CHAPPAGon
 
-% Chapter opening.
-%
+\def\CHAPFplain{%
+\global\let\chapmacro=\chfplain
+\global\let\centerchapmacro=\centerchfplain}
+
+% Normal 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{%
-  % Insert the first mark before the heading break (see notes for \domark).
-  \let\prevchapterdefs=\lastchapterdefs
-  \let\prevsectiondefs=\lastsectiondefs
-  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
-                        \gdef\thissection{}}%
-  %
-  \def\temptype{#2}%
-  \ifx\temptype\Ynothingkeyword
-    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
-                          \gdef\thischapter{\thischaptername}}%
-  \else\ifx\temptype\Yomitfromtockeyword
-    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
-                          \gdef\thischapter{}}%
-  \else\ifx\temptype\Yappendixkeyword
-    \toks0={#1}%
-    \xdef\lastchapterdefs{%
-      \gdef\noexpand\thischaptername{\the\toks0}%
-      \gdef\noexpand\thischapternum{\appendixletter}%
-      \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum:
-                                 \noexpand\thischaptername}%
-    }%
-  \else
-    \toks0={#1}%
-    \xdef\lastchapterdefs{%
-      \gdef\noexpand\thischaptername{\the\toks0}%
-      \gdef\noexpand\thischapternum{\the\chapno}%
-      \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum:
-                                 \noexpand\thischaptername}%
-    }%
-  \fi\fi\fi
-  %
-  % Output the mark.  Pass it through \safewhatsit, to take care of
-  % the preceding space.
-  \safewhatsit\domark
-  %
-  % Insert the chapter heading break.
+\def\chfplain#1#2#3{%
   \pchapsepmacro
-  %
-  % Now the second mark, after the heading break.  No break points
-  % between here and the heading.
-  \let\prevchapterdefs=\lastchapterdefs
-  \let\prevsectiondefs=\lastsectiondefs
-  \domark
-  %
   {%
     \chapfonts \rm
     %
-    % Have to define \lastsection 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\lastsection{#1}%
+    % Have to define \thissection before calling \donoderef, because the
+    % xref code eventually uses it, as \Ytitle.  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
@@ -5199,7 +4021,6 @@
     \donoderef{#2}%
     %
     % Typeset the actual heading.
-    \nobreak % Avoid page breaks at the interline glue.
     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
           \hangindent=\wd0 \centerparametersmaybe
           \unhbox0 #1\par}%
@@ -5210,40 +4031,45 @@
 
 % @centerchap -- centered and unnumbered.
 \let\centerparametersmaybe = \relax
-\def\centerparameters{%
-  \advance\rightskip by 3\rightskip
-  \leftskip = \rightskip
-  \parfillskip = 0pt
-}
+\def\centerchfplain#1{{%
+  \def\centerparametersmaybe{%
+    \advance\rightskip by 3\rightskip
+    \leftskip = \rightskip
+    \parfillskip = 0pt
+  }%
+  \chfplain{#1}{Ynothing}{}%
+}}
 
+\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}
+\global\let\chapmacro=\chfopen
+\global\let\centerchapmacro=\centerchfopen}
 
 
 % 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}}
 
@@ -5257,100 +4083,50 @@
 
 
 % Print any size, any type, section title.
-%
+% 
 % #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\seckeyword{sec}
-%
+% 
 \def\sectionheading#1#2#3#4{%
   {%
     % Switch to the right set of fonts.
     \csname #2fonts\endcsname \rm
     %
-    \def\sectionlevel{#2}%
-    \def\temptype{#3}%
-    %
-    % Insert first mark before the heading break (see notes for \domark).
-    \let\prevsectiondefs=\lastsectiondefs
-    \ifx\temptype\Ynothingkeyword
-      \ifx\sectionlevel\seckeyword
-        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
-                              \gdef\thissection{\thissectionname}}%
-      \fi
-    \else\ifx\temptype\Yomitfromtockeyword
-      % Don't redefine \thissection.
-    \else\ifx\temptype\Yappendixkeyword
-      \ifx\sectionlevel\seckeyword
-        \toks0={#1}%
-        \xdef\lastsectiondefs{%
-          \gdef\noexpand\thissectionname{\the\toks0}%
-          \gdef\noexpand\thissectionnum{#4}%
-          \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
-                                     \noexpand\thissectionname}%
-        }%
-      \fi
-    \else
-      \ifx\sectionlevel\seckeyword
-        \toks0={#1}%
-        \xdef\lastsectiondefs{%
-          \gdef\noexpand\thissectionname{\the\toks0}%
-          \gdef\noexpand\thissectionnum{#4}%
-          \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
-                                     \noexpand\thissectionname}%
-        }%
-      \fi
-    \fi\fi\fi
-    %
-    % Output the mark.  Pass it through \safewhatsit, to take care of
-    % the preceding space.
-    \safewhatsit\domark
-    %
     % Insert space above the heading.
     \csname #2headingbreak\endcsname
     %
-    % Now the second mark, after the heading break.  No break points
-    % between here and the heading.
-    \let\prevsectiondefs=\lastsectiondefs
-    \domark
-    %
     % Only insert the space after the number if we have a section number.
+    \def\sectionlevel{#2}%
+    \def\temptype{#3}%
+    %
     \ifx\temptype\Ynothingkeyword
       \setbox0 = \hbox{}%
       \def\toctype{unn}%
-      \gdef\lastsection{#1}%
+      \gdef\thissection{#1}%
     \else\ifx\temptype\Yomitfromtockeyword
       % for @headings -- no section number, don't include in toc,
-      % and don't redefine \lastsection.
+      % 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\lastsection{#1}%
+      \gdef\thissection{#1}%
     \else
       \setbox0 = \hbox{#4\enspace}%
       \def\toctype{num}%
-      \gdef\lastsection{#1}%
+      \gdef\thissection{#1}%
     \fi\fi\fi
     %
-    % Write the toc entry (before \donoderef).  See comments in \chapmacro.
+    % 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 \chapmacro.
+    % Again, see comments in \chfplain.
     \donoderef{#3}%
     %
-    % Interline glue will be inserted when the vbox is completed.
-    % That glue will be a valid breakpoint for the page, since it'll be
-    % preceded by a whatsit (usually from the \donoderef, or from the
-    % \writetocentry if there was no node).  We don't want to allow that
-    % break, since then the whatsits could end up on page n while the
-    % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
-    \nobreak
-    %
     % Output the actual section heading.
     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
           \hangindent=\wd0  % zero if no section number
@@ -5368,14 +4144,14 @@
   % 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:
-  % 
+  %
+  % This \nobreak is purely so the last item on the list is a \penalty
+  % of 10000.  This is so other code, for instance \parsebodycommon, can
+  % check for and avoid allowing breakpoints.  Otherwise, it would
+  % insert a valid breakpoint between:
   %   @section sec-whatever
   %   @deffn def-whatever
-  \penalty 10001
+  \nobreak
 }
 
 
@@ -5384,14 +4160,14 @@
 \newwrite\tocfile
 
 % Write an entry to the toc file, opening it if necessary.
-% Called from @chapter, etc.
-%
+% Called from @chapter, etc.  
+% 
 % 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
@@ -5409,11 +4185,11 @@
     \fi
     %
     \iflinks
-      {\atdummies
-       \edef\temp{%
-         \write\tocfile{ #1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
-       \temp
-      }%
+      \toks0 = {#2}%
+      \toks2 = \expandafter{\lastnode}%
+      \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}%
+                               {\the\toks2}{\noexpand\folio}}}%
+      \temp
     \fi
   \fi
   %
@@ -5426,31 +4202,6 @@
   \ifpdf \global\pdfmakepagedesttrue \fi
 }
 
-
-% These characters do not print properly in the Computer Modern roman
-% fonts, so we must take special care.  This is more or less redundant
-% with the Texinfo input format setup at the end of this file.
-% 
-\def\activecatcodes{%
-  \catcode`\"=\active
-  \catcode`\$=\active
-  \catcode`\<=\active
-  \catcode`\>=\active
-  \catcode`\\=\active
-  \catcode`\^=\active
-  \catcode`\_=\active
-  \catcode`\|=\active
-  \catcode`\~=\active
-}
-
-
-% Read the toc file, which is essentially Texinfo input.
-\def\readtocfile{%
-  \setupdatafile
-  \activecatcodes
-  \input \tocreadfilename
-}
-
 \newskip\contentsrightmargin \contentsrightmargin=1in
 \newcount\savepageno
 \newcount\lastnegativepageno \lastnegativepageno = -1
@@ -5458,83 +4209,81 @@
 % 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.
-  \chapmacro{#1}{Yomitfromtoc}{}%
-  %
-  \savepageno = \pageno
-  \begingroup                  % Set up to handle contents files properly.
-    \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
+   % 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
 }
 
-% redefined for the two-volume lispref.  We always output on
-% \jobname.toc even if this is redefined.
-% 
-\def\tocreadfilename{\jobname.toc}
 
 % Normal (long) toc.
-%
 \def\contents{%
-  \startcontents{\putwordTOC}%
-    \openin 1 \tocreadfilename\space
-    \ifeof 1 \else
-      \readtocfile
-    \fi
-    \vfill \eject
-    \contentsalignmacro % in case @setchapternewpage odd is in effect
-    \ifeof 1 \else
-      \pdfmakeoutlines
-    \fi
-    \closein 1
-  \endgroup
-  \lastnegativepageno = \pageno
-  \global\pageno = \savepageno
+   \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
+   \global\pageno = \savepageno
 }
 
 % And just the chapters.
 \def\summarycontents{%
-  \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 \tocreadfilename\space
-    \ifeof 1 \else
-      \readtocfile
-    \fi
-    \closein 1
-    \vfill \eject
-    \contentsalignmacro % in case @setchapternewpage odd is in effect
-  \endgroup
-  \lastnegativepageno = \pageno
-  \global\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
+        \closein 1
+        \input \jobname.toc
+      \fi
+     \vfill \eject
+     \contentsalignmacro % in case @setchapternewpage odd is in effect
+   \endgroup
+   \lastnegativepageno = \pageno
+   \global\pageno = \savepageno
 }
 \let\shortcontents = \summarycontents
 
@@ -5547,7 +4296,7 @@
   % 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
@@ -5572,7 +4321,7 @@
 
 % Appendices, in the main contents.
 % Need the word Appendix, and a fixed-size box.
-%
+% 
 \def\appendixbox#1{%
   % We use M since it's probably the widest letter.
   \setbox0 = \hbox{\putwordAppendix{} M}%
@@ -5600,8 +4349,7 @@
 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
 
 % This parameter controls the indentation of the various levels.
-% Same as \defaultparindent.
-\newdimen\tocindent \tocindent = 15pt
+\newdimen\tocindent \tocindent = 2pc
 
 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
 % page number.
@@ -5632,8 +4380,17 @@
   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 \endgroup}
 
-% We use the same \entry macro as for the index entries.
-\let\tocentry = \entry
+% 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}
 
 % Space between chapter (or whatever) number and the title.
 \def\labelspace{\hskip1em \relax}
@@ -5669,12 +4426,12 @@
 {\tentt \global\dimen0 = 3em}% Width of the box.
 \dimen2 = .55pt % Thickness of rules
 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
+\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
 %
-\setbox\errorbox=\hbox to \dimen0{\hfil
+\global\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.
@@ -5688,13 +4445,14 @@
 % One exception: @ is still an escape character, so that @end tex works.
 % But \@ or @@ will get a plain tex @ character.
 
-\envdef\tex{%
+\def\tex{\begingroup
   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
   \catcode `\%=14
   \catcode `\+=\other
   \catcode `\"=\other
+  \catcode `\==\other
   \catcode `\|=\other
   \catcode `\<=\other
   \catcode `\>=\other
@@ -5717,16 +4475,14 @@
   \let\/=\ptexslash
   \let\*=\ptexstar
   \let\t=\ptext
-  \let\frenchspacing=\plainfrenchspacing
   %
   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
   \def\ {@}%
-}
-% There is no need to define \Etex.
+\let\Etex=\endgroup}
 
 % Define @lisp ... @end lisp.
-% @lisp environment forms a group so it can rebind things,
+% @lisp does a \begingroup so it can rebind things,
 % including the definition of @end lisp (which normally is erroneous).
 
 % Amount to narrow the margins by for @lisp.
@@ -5737,6 +4493,19 @@
 % 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
 
@@ -5746,8 +4515,7 @@
 % start of the next paragraph will insert \parskip.
 %
 \def\aboveenvbreak{{%
-  % =10000 instead of <10000 because of a special case in \itemzzz and
-  % \sectionheading, q.v.
+  % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
   \ifnum \lastpenalty=10000 \else
     \advance\envskipamount by \parskip
     \endgraf
@@ -5755,7 +4523,7 @@
       \removelastskip
       % it's not a good place to break if the last penalty was \nobreak
       % or better ...
-      \ifnum\lastpenalty<10000 \penalty-50 \fi
+      \ifnum\lastpenalty>10000 \else \penalty-50 \fi
       \vskip\envskipamount
     \fi
   \fi
@@ -5763,8 +4531,7 @@
 
 \let\afterenvbreak = \aboveenvbreak
 
-% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
-% also clear it, so that its embedded environments do the narrowing again.
+% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
 \let\nonarrowing=\relax
 
 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
@@ -5788,52 +4555,52 @@
 %
 \newskip\lskip\newskip\rskip
 
-\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 = t%
-  \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\cartouche{%
+\par  % can't be in the midst of a paragraph.
+\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
 \def\Ecartouche{%
-              \ifhmode\par\fi
-	      \kern3pt
-	  \egroup
-	  \kern3pt\vrule
-	  \hskip\rskip
-      \egroup
-      \cartbot
-  \egroup
-  \checkinserts
-}
+                                \endgroup
+                                \kern3pt
+                        \egroup
+                        \kern3pt\vrule
+                        \hskip\rskip
+                \egroup
+                \cartbot
+        \egroup
+\endgroup
+}}
 
 
 % 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.
   \let\par = \lisppar % don't ignore blank lines
@@ -5841,139 +4608,116 @@
   \parskip = 0pt
   \parindent = 0pt
   \emergencystretch = 0pt % don't try to avoid overfull boxes
+  % @cartouche defines \nonarrowing to inhibit narrowing
+  % at next level down.
   \ifx\nonarrowing\relax
     \advance \leftskip by \lispnarrowing
     \exdentamount=\lispnarrowing
-  \else
-    \let\nonarrowing = \relax
+    \let\exdent=\nofillexdent
+    \let\nonarrowing=\relax
   \fi
-  \let\exdent=\nofillexdent
 }
 
-% 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
-%
-\def\smallword{small}
-\def\nosmallword{nosmall}
-\let\SETdispenvsize\relax
-\def\setnormaldispenv{%
-  \ifx\SETdispenvsize\smallword
-    % end paragraph for sake of leading, in case document has no blank
-    % line.  This is redundant with what happens in \aboveenvbreak, but
-    % we need to do it before changing the fonts, and it's inconvenient
-    % to change the fonts afterward.
-    \ifnum \lastpenalty=10000 \else \endgraf \fi
-    \smallexamplefonts \rm
-  \fi
-}
-\def\setsmalldispenv{%
-  \ifx\SETdispenvsize\nosmallword
-  \else
-    \ifnum \lastpenalty=10000 \else \endgraf \fi
-    \smallexamplefonts \rm
-  \fi
-}
+% Define the \E... control sequence only if we are inside the particular
+% environment, so the error checking in \end will work.
+%
+% 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}
 
-% 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
+% @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
 }
 
-% Define two synonyms:
-\def\maketwodispenvs #1#2#3{
-  \makedispenv{#1}{#3}
-  \makedispenv{#2}{#3}
-}
+% @example: Same as @lisp.
+\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
 
-% @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
-%
 % @smallexample and @smalllisp: use smaller fonts.
 % Originally contributed by Pavel xerox 
+\def\smalllisp{\begingroup
+  \def\Esmalllisp{\nonfillfinish\endgroup}%
+  \def\Esmallexample{\nonfillfinish\endgroup}%
+  \smallexamplefonts
+  \lisp
+}
+\let\smallexample = \smalllisp
+
+
+% @display: same as @lisp except keep current font.
 %
-\maketwodispenvs {lisp}{example}{%
+\def\display{\begingroup
   \nonfillstart
-  \tt\quoteexpand
-  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
-  \gobble       % eat return
+  \let\Edisplay = \nonfillfinish
+  \gobble
 }
-% @display/@smalldisplay: same as @lisp except keep current font.
 %
-\makedispenv {display}{%
-  \nonfillstart
-  \gobble
+% @smalldisplay: @display plus smaller fonts.
+%
+\def\smalldisplay{\begingroup
+  \def\Esmalldisplay{\nonfillfinish\endgroup}%
+  \smallexamplefonts \rm
+  \display
 }
 
-% @format/@smallformat: same as @display except don't narrow margins.
+% @format: same as @display except don't narrow margins.
 %
-\makedispenv{format}{%
-  \let\nonarrowing = t%
+\def\format{\begingroup
+  \let\nonarrowing = t
   \nonfillstart
+  \let\Eformat = \nonfillfinish
   \gobble
 }
-
-% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
-\envdef\flushleft{%
-  \let\nonarrowing = t%
-  \nonfillstart
-  \gobble
+%
+% @smallformat: @format plus smaller fonts.
+%
+\def\smallformat{\begingroup
+  \def\Esmallformat{\nonfillfinish\endgroup}%
+  \smallexamplefonts \rm
+  \format
 }
-\let\Eflushleft = \afterenvbreak
+
+% @flushleft (same as @format).
+%
+\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
 
 % @flushright.
 %
-\envdef\flushright{%
-  \let\nonarrowing = t%
+\def\flushright{\begingroup
+  \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.  We keep \parskip nonzero in general, since
-% we're doing normal filling.  So, when using \aboveenvbreak and
-% \afterenvbreak, temporarily make \parskip 0.
+% and narrows the margins.
 %
-\envdef\quotation{%
+\def\quotation{%
+  \begingroup\inENV %This group ends at the end of the @quotation body
   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
   \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
     \advance\leftskip by \lispnarrowing
     \advance\rightskip by \lispnarrowing
     \exdentamount = \lispnarrowing
-  \else
     \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
 }
 
 
@@ -5995,7 +4739,7 @@
 %
 % [Knuth] p. 380
 \def\uncatcodespecials{%
-  \def\do##1{\catcode`##1=\other}\dospecials}
+  \def\do##1{\catcode`##1=12}\dospecials}
 %
 % [Knuth] pp. 380,381,391
 % Disable Spanish ligatures ?` and !` of \tt font
@@ -6029,34 +4773,6 @@
 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
 %
 \def\starttabbox{\setbox0=\hbox\bgroup}
-
-% Allow an option to not replace quotes with a regular directed right
-% quote/apostrophe (char 0x27), but instead use the undirected quote
-% from cmtt (char 0x0d).  The undirected quote is ugly, so don't make it
-% the default, but it works for pasting with more pdf viewers (at least
-% evince), the lilypond developers report.  xpdf does work with the
-% regular 0x27.  
-% 
-\def\codequoteright{%
-  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
-    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
-      '%
-    \else \char'15 \fi
-  \else \char'15 \fi
-}
-%
-% and a similar option for the left quote char vs. a grave accent.
-% Modern fonts display ASCII 0x60 as a grave accent, so some people like
-% the code environments to do likewise.
-% 
-\def\codequoteleft{%
-  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
-    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
-      `%
-    \else \char'22 \fi
-  \else \char'22 \fi
-}
-%
 \begingroup
   \catcode`\^^I=\active
   \gdef\tabexpand{%
@@ -6069,25 +4785,13 @@
       \wd0=\dimen0 \box0 \starttabbox
     }%
   }
-  \catcode`\'=\active
-  \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}%
-  %
-  \catcode`\`=\active
-  \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}%
-  %
-  \gdef\quoteexpand{\rquoteexpand \lquoteexpand}%
 \endgroup
-
-% start the verbatim environment.
 \def\setupverbatim{%
-  \let\nonarrowing = t%
-  \nonfillstart
   % Easiest (and conventionally used) font for verbatim
   \tt
   \def\par{\leavevmode\egroup\box0\endgraf}%
   \catcode`\`=\active
   \tabexpand
-  \quoteexpand
   % Respect line breaks,
   % print special symbols as themselves, and
   % make each space count
@@ -6104,7 +4808,7 @@
 %
 % [Knuth] p. 382; only eat outer {}
 \begingroup
-  \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
+  \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
 \endgroup
 %
@@ -6121,6 +4825,13 @@
 % 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
@@ -6128,32 +4839,54 @@
   % 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.
+  \gdef\doverbatim#1^^M#2 end verbatim{#2\end{verbatim}}%
 \endgroup
 %
-\envdef\verbatim{%
-    \setupverbatim\doverbatim
+\def\verbatim{%
+  \def\Everbatim{\nonfillfinish\endgroup}%
+  \begingroup
+    \nonfillstart
+    \advance\leftskip by -\defbodyindent
+    \begingroup\setupverbatim\doverbatim
 }
-\let\Everbatim = \afterenvbreak
-
 
 % @verbatiminclude FILE - insert text of file in verbatim environment.
 %
-\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
+% Allow normal characters that we make active in the argument (a file name).
+\def\verbatiminclude{%
+  \begingroup
+    \catcode`\\=\other
+    \catcode`~=\other
+    \catcode`^=\other
+    \catcode`_=\other
+    \catcode`|=\other
+    \catcode`<=\other
+    \catcode`>=\other
+    \catcode`+=\other
+    \parsearg\doverbatiminclude
+}
+\def\setupverbatiminclude{%
+  \begingroup
+    \nonfillstart
+    \advance\leftskip by -\defbodyindent
+    \begingroup\setupverbatim
+}
 %
 \def\doverbatiminclude#1{%
-  {%
-    \makevalueexpandable
-    \setupverbatim
-    \input #1
-    \afterenvbreak
-  }%
+     % Restore active chars for included file.
+  \endgroup
+  \begingroup
+    \let\value=\expandablevalue
+    \def\thisfile{#1}%
+    \expandafter\expandafter\setupverbatiminclude\input\thisfile
+  \endgroup
+  \nonfillfinish
+  \endgroup
 }
 
 % @copying ... @end copying.
-% Save the text away for @insertcopying later.
+% Save the text away for @insertcopying later.  Many commands won't be
+% allowed in this context, but that's ok.
 %
 % We save the uninterpreted tokens, rather than creating a box.
 % Saving the text in a box would be much easier, but then all the
@@ -6162,360 +4895,644 @@
 % 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
+\def\copying{\begingroup
+  % Define a command to swallow text until we reach ` end copying'.
+  % \ is the escape char in this texinfo.tex file, so it is the
+  % delimiter for the command; @ will be the escape char when we read
+  % it, but that doesn't matter.
+  \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
+  %
+  % We must preserve ^^M's in the input file; see \insertcopying below.
+  \catcode`\^^M = \active
+  \docopying
+}
+
+% What we do to finish off the copying text.
+%
+\def\enddocopying{\endgroup\ignorespaces}
+
+% @insertcopying.  Here we must play games with ^^M's.  On the one hand,
+% we need them to delimit commands such as ` end quotation', so they
+% must be active.  On the other hand, we certainly don't want every
+% end-of-line to be a \par, as would happen with the normal active
+% definition of ^^M.  On the third hand, two ^^M's in a row should still
+% generate a \par.
+%
+% Our approach is to make ^^M insert a space and a penalty1 normally;
+% then it can also check if \lastpenalty=1.  If it does, then manually
+% do \par.
+%
+% This messes up the normal definitions of @c[omment], so we redefine
+% it.  Similarly for @ignore.  (These commands are used in the gcc
+% manual for man page generation.)
+%
+% Seems pretty fragile, most line-oriented commands will presumably
+% fail, but for the limited use of getting the copying text (which
+% should be quite simple) inserted, we can hope it's ok.
+%
+{\catcode`\^^M=\active %
+\gdef\insertcopying{\begingroup %
+  \parindent = 0pt  % looks wrong on title page
+  \def^^M{%
+    \ifnum \lastpenalty=1 %
+      \par %
+    \else %
+      \space \penalty 1 %
+    \fi %
+  }%
+  %
+  % Fix @c[omment] for catcode 13 ^^M's.
+  \def\c##1^^M{\ignorespaces}%
+  \let\comment = \c %
+  %
+  % Don't bother jumping through all the hoops that \doignore does, it
+  % would be very hard since the catcodes are already set.
+  \long\def\ignore##1\end ignore{\ignorespaces}%
+  %
+  \copyingtext %
+\endgroup}%
 }
 
-
 \message{defuns,}
 % @defun etc.
 
 \newskip\defbodyindent \defbodyindent=.4in
 \newskip\defargsindent \defargsindent=50pt
 \newskip\deflastargmargin \deflastargmargin=18pt
-\newcount\defunpenalty
 
-% Start the processing of @deffn:
-\def\startdefun{%
-  \ifnum\lastpenalty<10000
-    \medbreak
-    \defunpenalty=10003 % Will keep this @deffn together with the
-                        % following @def command, see below.
+\newcount\parencount
+
+% We want ()&[] to print specially on the defun line.
+%
+\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`& = \active
+  \global\let& = \ampnr
+}
+
+% \defname, which formats the name of the @def (not the args).
+% #1 is the function name.
+% #2 is the type of definition, such as "Function".
+%
+\def\defname#1#2{%
+  % How we'll output 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.
+  \ifempty{#2}%
+    \def\defnametype{}%
   \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 \printdefunline, 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.
-    %
-    % As a minor refinement, we avoid "club" headers by signalling
-    % with penalty of 10003 after the very first @deffn in the
-    % sequence (see above), and penalty of 10002 after any following
-    % @def command.
-    \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \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
+    \def\defnametype{[\rm #2]}%
   \fi
   %
+  % Get the values of \leftskip and \rightskip as they were outside the @def...
+  \dimen2=\leftskip
+  \advance\dimen2 by -\defbodyindent
+  %
+  % Figure out values for the paragraph shape.
+  \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
+  \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
+  %
+  % Output arg 2 ("Function" or some such) but stuck inside a box of
+  % width 0 so it does not interfere with linebreaking.
+  \noindent
+  %
+  {% Adjust \hsize to exclude the ambient margins,
+   % so that \rightline will obey them.
+   \advance \hsize by -\dimen2
+   \dimen3 = 0pt  % was -1.25pc
+   \rlap{\rightline{\defnametype\kern\dimen3}}%
+  }%
+  %
+  % Allow all lines to be underfull without complaint:
+  \tolerance=10000 \hbadness=10000
+  \advance\leftskip by -\defbodyindent
+  \exdentamount=\defbodyindent
+  {\df #1}\enskip        % output function name
+  % \defunargs will be called next to output the arguments, if any.
+}
+
+% 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 need to allow a
+  % break somewhere.  Check for penalty 10002 (inserted by
+  % \defargscommonending) instead of 10000, since the sectioning
+  % commands insert a \penalty10000, 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.
+  \ifnum\lastpenalty<10000 \medbreak
+  \else \medskip  % preceded by discardable penalty, so not a breakpoint
+  \fi
+  %
+  % Define the \E... end token that this defining construct specifies
+  % so that it will exit this group.
+  \def#1{\endgraf\endgroup\medbreak}%
+  %
   \parindent=0in
   \advance\leftskip by \defbodyindent
   \exdentamount=\defbodyindent
 }
 
-\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 \else \defunpenalty=10002 \fi
+% Common part of the \...x definitions.
+%
+\def\defxbodycommon{%
+  % As with \parsebodycommon above, allow line break if we have multiple
+  % x headers in a row.  It's not a great place, though.
+  \ifnum\lastpenalty=10002 \penalty2000 \fi
   %
-  % And now, it's time to reuse the body of the original defun:
-  \expandafter\gobbledefun#1%
+  \begingroup\obeylines
 }
-\def\gobbledefun#1\startdefun{}
 
-% \printdefunline \deffnheader{text}
+% Process body of @defun, @deffn, @defmac, etc.
 %
-\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\defunpenalty  % 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
+\def\defparsebody#1#2#3{%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2{\defxbodycommon \activeparens \spacesplit#3}%
+  \catcode\equalChar=\active
+  \begingroup\obeylines\activeparens
+  \spacesplit#3%
 }
 
-\def\Edefun{\endgraf\medbreak}
-
-% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
-% the only thing remainnig is to define \deffnheader.
+% #1, #2, #3 are the common arguments (see \parsebodycommon above).
+% #4, delimited by the space, is the class name.
 %
-\def\makedefun#1{%
-  \expandafter\let\csname E#1\endcsname = \Edefun
-  \edef\temp{\noexpand\domakedefun
-    \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
-  \temp
+\def\defmethparsebody#1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
+  \begingroup\obeylines\activeparens
+  % The \empty here prevents misinterpretation of a construct such as
+  %   @deffn {whatever} {Enharmonic comma}
+  % See comments at \deftpparsebody, although in our case we don't have
+  % to remove the \empty afterwards, since it is empty.
+  \spacesplit{#3{#4}}\empty
 }
 
-% \domakedefun \deffn \deffnx \deffnheader
+% 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.
 %
-% Define \deffn and \deffnx, without parameters.
-% \deffnheader has to be defined explicitly.
+\def\deftypemethparsebody#1#2#3#4 #5 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 {\defxbodycommon \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\domakedefun#1#2#3{%
-  \envdef#1{%
-    \startdefun
-    \parseargusing\activeparens{\printdefunline#3}%
-  }%
-  \def#2{\dodefunx#1}%
-  \def#3%
+\def\deftypeopparsebody#1#2#3#4#5 #6 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 ##3 {\def#4{##1}%
+    \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
+  \begingroup\obeylines\activeparens
+  \spacesplit{#3{#5}{#6}}%
 }
 
-%%% Untyped functions:
+% For @defop.
+\def\defopparsebody #1#2#3#4#5 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 {\def#4{##1}%
+    \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
+  \begingroup\obeylines\activeparens
+  \spacesplit{#3{#5}}%
+}
 
-% @deffn category name args
-\makedefun{deffn}{\deffngeneral{}}
+% 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.
+%
+\def\defvarparsebody #1#2#3{%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2{\defxbodycommon \spacesplit#3}%
+  \catcode\equalChar=\active
+  \begingroup\obeylines
+  \spacesplit#3%
+}
 
-% @deffn category class name args
-\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
+% @defopvar.
+\def\defopvarparsebody #1#2#3#4#5 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 ##2 {\def#4{##1}%
+    \defxbodycommon \spacesplit{#3{##2}}}%
+  \begingroup\obeylines
+  \spacesplit{#3{#5}}%
+}
 
-% \defopon {category on}class name args
-\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+\def\defvrparsebody#1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
+  \begingroup\obeylines
+  \spacesplit{#3{#4}}%
+}
 
-% \deffngeneral {subind}category name args
+% 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
+%
+% 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.
 %
-\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\deftpparsebody #1#2#3#4 {%
+  \parsebodycommon{#1}{#2}{#3}%
+  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
+  \begingroup\obeylines
+  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
 }
 
-%%% Typed functions:
+% 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}
 
-% @deftypefn category type name args
-\makedefun{deftypefn}{\deftypefngeneral{}}
+% 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}%
+}%
 
-% @deftypeop category class type name args
-\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
+% Split up #2 (the rest of the input line) 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\spacesplitx{#1}#2 \relax\spacesplitx}%
+ \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
+   \ifx\relax #3%
+     #1{#2}{}%
+   \else %
+     #1{#2}{#3#4}%
+   \fi}%
+}
 
-% \deftypeopon {category on}class type name args
-\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+% Define @defun.
 
-% \deftypefngeneral {subind}category type name args
+% This is called to end the arguments processing for all the @def... commands.
 %
-\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
-  \dosubind{fn}{\code{#4}}{#1}%
-  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+\def\defargscommonending{%
+  \interlinepenalty = 10000
+  \advance\rightskip by 0pt plus 1fil
+  \endgraf
+  \nobreak\vskip -\parskip
+  \penalty 10002  % signal to \parsebodycommon and \defxbodycommon.
 }
 
-%%% Typed variables:
+% This expands the args and terminates the paragraph they comprise.
+%
+\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%
+  \defargscommonending
+}
 
-% @deftypevr category type var args
-\makedefun{deftypevr}{\deftypecvgeneral{}}
+\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
+  \defargscommonending
+}
 
-% @deftypecv category class type var args
-\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
+% Do complete processing of one @defun or @defunx line already parsed.
 
-% \deftypecvof {category of}class type var args
-\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
+% @deffn Command forward-char nchars
 
-% \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}%
+\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
+
+\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
+\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
+\catcode\equalChar=\other % Turn off change made in \defparsebody
 }
 
-%%% Untyped variables:
+% @defun == @deffn Function
 
-% @defvr category var args
-\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
+\def\defun{\defparsebody\Edefun\defunx\defunheader}
+
+\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{\putwordDeffunc}%
+\defunargs {#2}\endgroup %
+\catcode\equalChar=\other % Turn off change made in \defparsebody
+}
 
-% @defcv category class var args
-\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
+% @deftypefun int foobar (int @var{foo}, float @var{bar})
 
-% \defcvof {category of}class var args
-\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
+\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
 
-%%% Type:
-% @deftp category name args
-\makedefun{deftp}#1 #2 #3\endheader{%
-  \doind{tp}{\code{#2}}%
-  \defname{#1}{}{#2}\defunargs{#3\unskip}%
+% #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\equalChar=\other % Turn off change made in \defparsebody
 }
 
-% 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}
+% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
 
-% \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\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
+
+% \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}
+
+% #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\equalChar=\other % Turn off change made in \defparsebody
+}
+
+% @defmac == @deffn Macro
+
+\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\equalChar=\other % Turn off change made in \defparsebody
+}
+
+% @defspec == @deffn Special Form
+
+\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
+
+\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
+\begingroup\defname {#1}{\putwordDefspec}%
+\defunargs {#2}\endgroup %
+\catcode\equalChar=\other % Turn off change made in \defparsebody
+}
+
+% @defop CATEGORY CLASS OPERATION ARG...
 %
-% We are followed by (but not passed) the arguments, if any.
+\def\defop #1 {\def\defoptype{#1}%
+\defopparsebody\Edefop\defopx\defopheader\defoptype}
 %
-\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.
+\def\defopheader#1#2#3{%
+  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
+  \begingroup
+    \defname{#2}{\defoptype\ \putwordon\ #1}%
+    \defunargs{#3}%
+  \endgroup
 }
 
-% 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.
+% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
 %
-\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
+\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
 }
 
-% We want ()&[] to print specially on the defun line.
+% @deftypemethod CLASS TYPE METHOD ARG...
 %
-\def\activeparens{%
-  \catcode`\(=\active \catcode`\)=\active
-  \catcode`\[=\active \catcode`\]=\active
-  \catcode`\&=\active
+\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
 }
 
-% Make control sequences which act like normal parenthesis chars.
-\let\lparen = ( \let\rparen = )
-
-% 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& = \&
+% @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
+}
 
-  \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
-  \gdef\magicamp{\let&=\amprm}
+% @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
 }
 
-\newcount\parencount
+% @defcv {Class Option} foo-class foo-flag
 
-% If we encounter &foo, then turn on ()-hacking afterwards
-\newif\ifampseen
-\def\amprm#1 {\ampseentrue{\bf\&#1 }}
+\def\defcv #1 {\def\defcvtype{#1}%
+\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
 
-\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
+\def\defcvarheader #1#2#3{%
+  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
+  \begingroup
+    \defname{#2}{\defcvtype\ \putwordof\ #1}%
+    \defvarargs{#3}%
+  \endgroup
 }
-\def\infirstlevel#1{%
-  \ifampseen
-    \ifnum\parencount=1
-      #1%
-    \fi
-  \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\ \code{#1}}% entry in var index
+  \begingroup
+    \defname{#2}{\putwordInstanceVariableof\ #1}%
+    \defvarargs{#3}%
+  \endgroup
 }
-\def\bfafterword#1 {#1 \bf}
 
-\def\opnr{%
-  \global\advance\parencount by 1
-  {\parenfont(}%
-  \infirstlevel \bfafterword
+% @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%
+  \defargscommonending
 }
-\def\clnr{%
-  {\parenfont)}%
-  \infirstlevel \sl
-  \global\advance\parencount by -1
-}
-
-\newcount\brackcount
-\def\lbrb{%
-  \global\advance\brackcount by 1
-  {\bf[}%
-}
-\def\rbrb{%
-  {\bf]}%
-  \global\advance\brackcount by -1
-}
-
-\def\checkparencounts{%
-  \ifnum\parencount=0 \else \badparencount \fi
-  \ifnum\brackcount=0 \else \badbrackcount \fi
-}
-% these should not use \errmessage; the glibc manual, at least, actually
-% has such constructs (when documenting function pointers).
-\def\badparencount{%
-  \message{Warning: unbalanced parentheses in @def...}%
-  \global\parencount=0
-}
-\def\badbrackcount{%
-  \message{Warning: unbalanced square brackets in @def...}%
-  \global\brackcount=0
+
+% @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 %
 }
 
+% @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 %
+}
+
+% @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}%
+  \defargscommonending
+\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}
+  \defargscommonending
+\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}
+
+% 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}}
+
 
 \message{macros,}
 % @macro.
@@ -6523,68 +5540,42 @@
 % 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\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
+ \newwrite\macscribble
+ \def\scanmacro#1{%
+   \begingroup \newlinechar`\^^M
+   % Undo catcode changes of \startcontents and \doprintindex
+   \catcode`\ =0 \catcode`\\=\other \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`\\=\other \escapechar=`\@
+\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
+\fi
 
 \newcount\paramno   % Count of parameters
 \newtoks\macname    % Macro name
 \newif\ifrecursive  % Is it recursive?
-
-% List of all defined macros in the form
-%    \definedummyword\macro1\definedummyword\macro2...
-% Currently is also contains all @aliases; the list can be split
-% if there is a need.
-\def\macrolist{}
-
-% Add the macro to \macrolist
-\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
-\def\addtomacrolistxxx#1{%
-     \toks0 = \expandafter{\macrolist\definedummyword#1}%
-     \xdef\macrolist{\the\toks0}%
-}
+\def\macrolist{}    % List of all defined macros in the form
+                    % \do\macro1\do\macro2...
 
 % Utility routines.
-% 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).
-% 
+% Thisdoes \let #1 = #2, except with \csnames.
 \def\cslet#1#2{%
-  \expandafter\let
-  \csname#1\expandafter\endcsname
-  \csname#2\endcsname
-}
+\expandafter\expandafter
+\expandafter\let
+\expandafter\expandafter
+\csname#1\endcsname
+\csname#2\endcsname}
 
 % Trim leading and trailing spaces off a string.
 % Concepts from aro-bend problem 15 (see CTAN).
@@ -6607,45 +5598,34 @@
 % all characters are catcode 10, 11 or 12, except \ which is active
 % (as in normal texinfo). It is necessary to change the definition of \.
 
-% Non-ASCII encodings make 8-bit characters active, so un-activate
-% them to avoid their expansion.  Must do this non-globally, to
-% confine the change to the current group.
-
 % It's necessary to have hard CRs when the macro is executed. This is
 % 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
+\def\macrobodyctxt{%
+  \catcode`\~=\other
   \catcode`\^=\other
   \catcode`\_=\other
   \catcode`\|=\other
-  \catcode`\~=\other
-  \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
-}
-
-\def\scanargctxt{%
-  \scanctxt
-  \catcode`\\=\other
-  \catcode`\^^M=\other
-}
-
-\def\macrobodyctxt{%
-  \scanctxt
+  \catcode`\<=\other
+  \catcode`\>=\other
+  \catcode`\+=\other
   \catcode`\{=\other
   \catcode`\}=\other
+  \catcode`\ =\other
   \catcode`\^^M=\other
-  \usembodybackslash
-}
+  \usembodybackslash}
 
 \def\macroargctxt{%
-  \scanctxt
-  \catcode`\\=\other
-}
+  \catcode`\~=\other
+  \catcode`\^=\other
+  \catcode`\_=\other
+  \catcode`\|=\other
+  \catcode`\<=\other
+  \catcode`\>=\other
+  \catcode`\+=\other
+  \catcode`\ =\other
+  \catcode`\\=\other}
 
 % \mbodybackslash is the definition of \ in @macro bodies.
 % It maps \foo\ => \csname macarg.foo\endcsname => #N
@@ -6676,21 +5656,25 @@
      \else \errmessage{Macro name \the\macname\space already defined}\fi
      \global\cslet{macsave.\the\macname}{\the\macname}%
      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
-     \addtomacrolist{\the\macname}%
+     % Add the macroname to \macrolist
+     \toks0 = \expandafter{\macrolist\do}%
+     \xdef\macrolist{\the\toks0
+       \expandafter\noexpand\csname\the\macname\endcsname}%
   \fi
   \begingroup \macrobodyctxt
   \ifrecursive \expandafter\parsermacbody
   \else \expandafter\parsemacbody
   \fi}
 
-\parseargdef\unmacro{%
+\def\unmacro{\parsearg\dounmacro}
+\def\dounmacro#1{%
   \if1\csname ismacro.#1\endcsname
     \global\cslet{#1}{macsave.#1}%
     \global\expandafter\let \csname ismacro.#1\endcsname=0%
     % Remove the macro name from \macrolist:
     \begingroup
       \expandafter\let\csname#1\endcsname \relax
-      \let\definedummyword\unmacrodo
+      \let\do\unmacrodo
       \xdef\macrolist{\macrolist}%
     \endgroup
   \else
@@ -6702,10 +5686,10 @@
 % macro definitions that have been changed to \relax.
 %
 \def\unmacrodo#1{%
-  \ifx #1\relax
+  \ifx#1\relax
     % remove this
   \else
-    \noexpand\definedummyword \noexpand#1%
+    \noexpand\do \noexpand #1%
   \fi
 }
 
@@ -6818,31 +5802,33 @@
 % {.  If so it reads up to the closing }, if not, it reads the whole
 % line.  Whatever was read is then fed to the next control sequence
 % as an argument (by \parsebrace or \parsearg)
-\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
+\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
 \def\braceorlinexxx{%
   \ifx\nchar\bgroup\else
     \expandafter\parsearg
-  \fi \macnamexxx}
+  \fi \next}
+
+% We mant 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}
 
 
 % @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{\parseargusing\obeyspaces\aliasxxx}
+\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
 \def\aliasxxx #1{\aliasyyy#1\relax}
-\def\aliasyyy #1=#2\relax{%
-  {%
-    \expandafter\let\obeyedspace=\empty
-    \addtomacrolist{#1}%
-    \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
-  }%
-  \next
-}
+\def\aliasyyy #1=#2\relax{\ignoreactivespaces
+\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
+           \expandafter\noexpand\csname#2\endcsname}%
+\expandafter\endgroup\next}
 
 
 \message{cross references,}
 
 \newwrite\auxfile
+
 \newif\ifhavexrefs    % True if xref values are known.
 \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
 
@@ -6852,27 +5838,19 @@
   node \samp{\ignorespaces#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}}
-
+% cross-references.
+\def\node{\ENVcheck\parsearg\nodezzz}
+\def\nodezzz#1{\nodexxx #1,\finishnodeparse}
+\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
 \let\nwnode=\node
 \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}%
+    \expandafter\expandafter\expandafter\setref{\lastnode}{#1}%
     \global\let\lastnode=\empty
   \fi
 }
@@ -6881,38 +5859,33 @@
 %
 \newcount\savesfregister
 %
-\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
-\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
+\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 (a node or an
-% anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \lastsection,
-%                 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.
+% anchor), namely NAME-title (the corresponding @chapter/etc. name),
+% NAME-pg (the page number), and NAME-snt (section number and type).
+% Called from \foonoderef.
+% 
+% We have to set dummies 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 that is hard to do.
+%
+% Likewise, use \turnoffactive so that punctuation chars such as underscore
+% and backslash work in node names.
 %
-\def\setref#1#2{%
+\def\setref#1#2{{%
+  \atdummies
   \pdfmkdest{#1}%
+  %
   \iflinks
-    {%
-      \atdummies  % preserve commands, but don't expand them
-      \edef\writexrdef##1##2{%
-	\write\auxfile{ xrdef{#1-% #1 of \setref, expanded by the \edef
-	  ##1}{##2}}% these are parameters of \writexrdef
-      }%
-      \toks0 = \expandafter{\lastsection}%
-      \immediate \writexrdef{title}{\the\toks0 }%
-      \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
-      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout
-    }%
+    \turnoffactive
+    \dosetq{#1-title}{Ytitle}%
+    \dosetq{#1-pg}{Ypagenumber}%
+    \dosetq{#1-snt}{#2}%
   \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
@@ -6925,123 +5898,101 @@
 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   \unsepspaces
   \def\printedmanual{\ignorespaces #5}%
-  \def\printedrefname{\ignorespaces #3}%
-  \setbox1=\hbox{\printedmanual\unskip}%
-  \setbox0=\hbox{\printedrefname\unskip}%
+  \def\printednodename{\ignorespaces #3}%
+  \setbox1=\hbox{\printedmanual}%
+  \setbox0=\hbox{\printednodename}%
   \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\printedrefname{\ignorespaces #1}%
+      \def\printednodename{\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\printedrefname{\ignorespaces #1}%
+        \def\printednodename{\ignorespaces #1}%
       \else
         \ifhavexrefs
           % We know the real title if we have the xref values.
-          \def\printedrefname{\refx{#1-title}{}}%
+          \def\printednodename{\refx{#1-title}{}}%
         \else
           % Otherwise just copy the Info node name.
-          \def\printedrefname{\ignorespaces #1}%
+          \def\printednodename{\ignorespaces #1}%
         \fi%
       \fi
     \fi
   \fi
   %
-  % Make link in pdf output.
+  % 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.
   \ifpdf
     \leavevmode
     \getfilename{#4}%
-    {\indexnofonts
-     \turnoffactive
-     % See comments at \activebackslashdouble.
-     {\activebackslashdouble \xdef\pdfxrefdest{#1}%
-      \backslashparens\pdfxrefdest}%
-     %
+    {\turnoffactive \otherbackslash
      \ifnum\filenamelength>0
        \startlink attr{/Border [0 0 0]}%
-         goto file{\the\filename.pdf} name{\pdfxrefdest}%
+         goto file{\the\filename.pdf} name{#1}%
      \else
        \startlink attr{/Border [0 0 0]}%
-         goto name{\pdfmkpgn{\pdfxrefdest}}%
+         goto name{\pdfmkpgn{#1}}%
      \fi
     }%
-    \setcolor{\linkcolor}%
+    \linkcolor
   \fi
   %
-  % 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
-    \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
+  \ifdim \wd1 > 0pt
+    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
   \else
-    % node/anchor (non-float) references.
+    % _ (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.
+    \xrefprintnodename\printednodename
     %
-    % 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
-       % 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 \putwordpage\tie\refx{#1-pg}{}%
-    \fi
+    % But we always want a comma and a space:
+    ,\space
+    %
+    % output the `page 3'.
+    \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
   \fi
   \endlink
 \endgroup}
 
 % 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
+% since not square brackets don't work in some documents.  Particularly
 % one that Bob is working on :).
 %
 \def\xrefprintnodename#1{[#1]}
 
-% Things referred to by \setref.
+% \dosetq is called from \setref to do the actual \write (\iflinks).
+%
+\def\dosetq#1#2{%
+  \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
+  \next
+}
+
+% \internalsetq{foo}{page} expands into
+%   CHARACTERS @xrdef{foo}{...expansion of \page...}
+\def\internalsetq#1#2{ xrdef{#1}{\csname #2\endcsname}}
+
+% Things to be expanded by \internalsetq.
 %
+\def\Ypagenumber{\noexpand\folio}
+\def\Ytitle{\thissection}
 \def\Ynothing{}
 \def\Yomitfromtoc{}
 \def\Ynumbered{%
@@ -7068,6 +6019,15 @@
   \fi\fi\fi
 }
 
+% 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{\the\inputlineno:\space}
+\fi
+
 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
 % If its value is nonempty, SUFFIX is output afterward.
 %
@@ -7076,7 +6036,7 @@
     \indexnofonts
     \otherbackslash
     \expandafter\global\expandafter\let\expandafter\thisrefX
-      \csname XR#1\endcsname
+      \csname X#1\endcsname
   }%
   \ifx\thisrefX\relax
     % If not defined, say something at least.
@@ -7098,54 +6058,12 @@
   #2% Output the suffix in any case.
 }
 
-% 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#2{%
-  {% The node name might contain 8-bit characters, which in our current
-   % implementation are changed to commands like @'e.  Don't let these
-   % mess up the control sequence name.
-    \indexnofonts
-    \turnoffactive
-    \xdef\safexrefname{#1}%
-  }%
-  %
-  \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
-  %
-  % Was that xref control sequence that we just defined for a float?
-  \expandafter\iffloat\csname XR\safexrefname\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
-      {\safexrefname}}%
-  \fi
-}
-
-% Read the last existing aux file, if any.  No error if none exists.
+% This is the macro invoked by entries in the aux file.
 %
-\def\tryauxfile{%
-  \openin 1 \jobname.aux
-  \ifeof 1 \else
-    \readdatafile{aux}%
-    \global\havexrefstrue
-  \fi
-  \closein 1
-}
+\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
 
-\def\setupdatafile{%
+% Read the last existing aux file, if any.  No error if none exists.
+\def\readauxfile{\begingroup
   \catcode`\^^ =\other
   \catcode`\^^A=\other
   \catcode`\^^B=\other
@@ -7203,40 +6121,40 @@
   \catcode`\%=\other
   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
   %
-  % 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.
+  % Make the characters 128-255 be printing characters
   {%
-    \count1=128
+    \count 1=128
     \def\loop{%
-      \catcode\count1=\other
-      \advance\count1 by 1
-      \ifnum \count1<256 \loop \fi
+      \catcode\count 1=\other
+      \advance\count 1 by 1
+      \ifnum \count 1<256 \loop \fi
     }%
   }%
   %
-  % @ is our escape character in .aux files, and we need braces.
+  % 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.
+  \catcode`\\=\other
+  %
+  % @ is our escape character in .aux files.
   \catcode`\{=1
   \catcode`\}=2
   \catcode`\ =0
-}
-
-\def\readdatafile#1{%
-\begingroup
-  \setupdatafile
-  \input\jobname.#1
+  %
+  \openin 1 \jobname.aux
+  \ifeof 1 \else
+    \closein 1
+    \input \jobname.aux
+    \global\havexrefstrue
+  \fi
+  % Open the new aux file.  TeX will close it automatically at exit.
+  \openout\auxfile=\jobname.aux
 \endgroup}
 
 
-\message{insertions,}
-% including footnotes.
+% Footnotes.
 
 \newcount \footnoteno
 
@@ -7250,6 +6168,8 @@
 % @footnotestyle is meaningful for info output only.
 \let\footnotestyle=\comment
 
+\let\ptexfootnote=\footnote
+
 {\catcode `\ =11
 %
 % Auto-number footnotes.  Otherwise like plain.
@@ -7273,12 +6193,17 @@
 % 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) fails inside footnotes because the tokens are fixed when
+% Oh yes, they do; otherwise, @ifset and anything else that uses
+% \parseargline fail inside footnotes because the tokens are fixed when
 % the footnote is read.  --karl, 16nov96.
 %
+% The start of the footnote looks usually like this:
+\gdef\startfootins{\insert\footins\bgroup}
+%
+% ... but this macro is redefined inside @multitable.
+%
 \gdef\dofootnote{%
-  \insert\footins\bgroup
+  \startfootins
   % 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.
@@ -7314,66 +6239,40 @@
 }
 }%end \catcode `\ =11
 
-% 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\startsavinginserts{%
-  \ifx \insert\ptexinsert
-    \let\insert\saveinsert
-  \else
-    \let\checkinserts\relax
-  \fi
-}
-
-% This \insert replacement works for both \insert\footins{foo} and
-% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
+% @| 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\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}%
+\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
+    }%
+  }%
 }
 
-% initialize:
-\let\checkinserts\empty
-\newsaveins\footins
-\newsaveins\margin
-
+% 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}
 
 % @image.  We use the macros from epsf.tex to support this.
 % If epsf.tex is not installed and @image is used, we complain.
@@ -7383,12 +6282,12 @@
 % undone and the next image would fail.
 \openin 1 = epsf.tex
 \ifeof 1 \else
+  \closein 1
   % 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
@@ -7427,7 +6326,7 @@
     % above and below.
     \nobreak\vskip\parskip
     \nobreak
-    \line\bgroup
+    \line\bgroup\hss
   \fi
   %
   % Output the image.
@@ -7440,1140 +6339,45 @@
     \epsfbox{#1.eps}%
   \fi
   %
-  \ifimagevmode \egroup \bigbreak \fi  % space after the image
+  \ifimagevmode \hss \egroup \bigbreak \fi  % space after the image
 \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 \lastsection 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\lastsection{\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
-        %
-        % 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 floating, 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
-% \lastsection 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.
 
 % @documentlanguage is usually given very early, just after
 % @setfilename.  If done too late, it may not override everything
-% properly.  Single argument is the language (de) or locale (de_DE)
-% abbreviation.  It would be nice if we could set up a hyphenation file.
+% properly.  Single argument is the language abbreviation.
+% It would be nice if we could set up a hyphenation file here.
 %
-{
-  \catcode`\_ = \active
-  \globaldefs=1
-\parseargdef\documentlanguage{\begingroup
-  \let_=\normalunderscore  % normal _ character for filenames
+\def\documentlanguage{\parsearg\dodocumentlanguage}
+\def\dodocumentlanguage#1{%
   \tex % read txi-??.tex file in plain TeX.
-    % Read the file by the name they passed if it exists.
-    \openin 1 txi-#1.tex
-    \ifeof 1
-      \documentlanguagetrywithoutunderscore{#1_\finish}%
-    \else
-      \input txi-#1.tex
-    \fi
-    \closein 1
-  \endgroup
-\endgroup}
-}
-%
-% If they passed de_DE, and txi-de_DE.tex doesn't exist,
-% try txi-de.tex.
-% 
-\def\documentlanguagetrywithoutunderscore#1_#2\finish{%
+  % Read the file if it exists.
   \openin 1 txi-#1.tex
-  \ifeof 1
+  \ifeof1
     \errhelp = \nolanghelp
     \errmessage{Cannot read language file txi-#1.tex}%
+    \let\temp = \relax
   \else
-    \input txi-#1.tex
+    \def\temp{\input txi-#1.tex }%
   \fi
-  \closein 1
+  \temp
+  \endgroup
 }
-%
 \newhelp\nolanghelp{The given language definition file cannot be found or
 is empty.  Maybe you need to install it?  In the current directory
 should work if nowhere else does.}
 
-% Set the catcode of characters 128 through 255 to the specified number.
-%
-\def\setnonasciicharscatcode#1{%
-   \count255=128
-   \loop\ifnum\count255<256
-      \global\catcode\count255=#1\relax
-      \advance\count255 by 1
-   \repeat
-}
-
-\def\setnonasciicharscatcodenonglobal#1{%
-   \count255=128
-   \loop\ifnum\count255<256
-      \catcode\count255=#1\relax
-      \advance\count255 by 1
-   \repeat
-}
-
-% @documentencoding sets the definition of non-ASCII characters
-% according to the specified encoding.
-%
-\parseargdef\documentencoding{%
-  % Encoding being declared for the document.
-  \def\declaredencoding{\csname #1.enc\endcsname}%
-  %
-  % Supported encodings: names converted to tokens in order to be able
-  % to compare them with \ifx.
-  \def\ascii{\csname US-ASCII.enc\endcsname}%
-  \def\latnine{\csname ISO-8859-15.enc\endcsname}%
-  \def\latone{\csname ISO-8859-1.enc\endcsname}%
-  \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
-  \def\utfeight{\csname UTF-8.enc\endcsname}%
-  %
-  \ifx \declaredencoding \ascii
-     \asciichardefs
-  %
-  \else \ifx \declaredencoding \lattwo
-     \setnonasciicharscatcode\active
-     \lattwochardefs
-  %
-  \else \ifx \declaredencoding \latone 
-     \setnonasciicharscatcode\active
-     \latonechardefs
-  %
-  \else \ifx \declaredencoding \latnine
-     \setnonasciicharscatcode\active
-     \latninechardefs
-  %
-  \else \ifx \declaredencoding \utfeight
-     \setnonasciicharscatcode\active
-     \utfeightchardefs
-  %
-  \else 
-    \message{Unknown document encoding #1, ignoring.}%
-  %
-  \fi % utfeight
-  \fi % latnine
-  \fi % latone
-  \fi % lattwo
-  \fi % ascii
-}
-
-% A message to be logged when using a character that isn't available
-% the default font encoding (OT1).
-% 
-\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
-
-% Take account of \c (plain) vs. \, (Texinfo) difference.
-\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
-
-% First, make active non-ASCII characters in order for them to be
-% correctly categorized when TeX reads the replacement text of
-% macros containing the character definitions.
-\setnonasciicharscatcode\active
-%
-% Latin1 (ISO-8859-1) character definitions.
-\def\latonechardefs{%
-  \gdef^^a0{~} 
-  \gdef^^a1{\exclamdown}
-  \gdef^^a2{\missingcharmsg{CENT SIGN}} 
-  \gdef^^a3{{\pounds}}
-  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
-  \gdef^^a5{\missingcharmsg{YEN SIGN}}
-  \gdef^^a6{\missingcharmsg{BROKEN BAR}} 
-  \gdef^^a7{\S}
-  \gdef^^a8{\"{}} 
-  \gdef^^a9{\copyright} 
-  \gdef^^aa{\ordf}
-  \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} 
-  \gdef^^ac{$\lnot$}
-  \gdef^^ad{\-} 
-  \gdef^^ae{\registeredsymbol} 
-  \gdef^^af{\={}}
-  %
-  \gdef^^b0{\textdegree}
-  \gdef^^b1{$\pm$}
-  \gdef^^b2{$^2$}
-  \gdef^^b3{$^3$}
-  \gdef^^b4{\'{}}
-  \gdef^^b5{$\mu$}
-  \gdef^^b6{\P}
-  %
-  \gdef^^b7{$^.$}
-  \gdef^^b8{\cedilla\ }
-  \gdef^^b9{$^1$}
-  \gdef^^ba{\ordm}
-  %
-  \gdef^^bb{\missingcharmsg{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}}
-  \gdef^^bc{$1\over4$}
-  \gdef^^bd{$1\over2$}
-  \gdef^^be{$3\over4$}
-  \gdef^^bf{\questiondown}
-  %
-  \gdef^^c0{\`A}
-  \gdef^^c1{\'A}
-  \gdef^^c2{\^A}
-  \gdef^^c3{\~A}
-  \gdef^^c4{\"A}
-  \gdef^^c5{\ringaccent A} 
-  \gdef^^c6{\AE}
-  \gdef^^c7{\cedilla C}
-  \gdef^^c8{\`E}
-  \gdef^^c9{\'E}
-  \gdef^^ca{\^E}
-  \gdef^^cb{\"E}
-  \gdef^^cc{\`I}
-  \gdef^^cd{\'I}
-  \gdef^^ce{\^I}
-  \gdef^^cf{\"I}
-  %
-  \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}}
-  \gdef^^d1{\~N}
-  \gdef^^d2{\`O}
-  \gdef^^d3{\'O}
-  \gdef^^d4{\^O}
-  \gdef^^d5{\~O}
-  \gdef^^d6{\"O}
-  \gdef^^d7{$\times$}
-  \gdef^^d8{\O}
-  \gdef^^d9{\`U}
-  \gdef^^da{\'U}
-  \gdef^^db{\^U}
-  \gdef^^dc{\"U}
-  \gdef^^dd{\'Y}
-  \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}}
-  \gdef^^df{\ss}
-  %
-  \gdef^^e0{\`a}
-  \gdef^^e1{\'a}
-  \gdef^^e2{\^a}
-  \gdef^^e3{\~a}
-  \gdef^^e4{\"a}
-  \gdef^^e5{\ringaccent a}
-  \gdef^^e6{\ae}
-  \gdef^^e7{\cedilla c}
-  \gdef^^e8{\`e}
-  \gdef^^e9{\'e}
-  \gdef^^ea{\^e}
-  \gdef^^eb{\"e}
-  \gdef^^ec{\`{\dotless i}}
-  \gdef^^ed{\'{\dotless i}}
-  \gdef^^ee{\^{\dotless i}}
-  \gdef^^ef{\"{\dotless i}}
-  %
-  \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}}
-  \gdef^^f1{\~n}
-  \gdef^^f2{\`o}
-  \gdef^^f3{\'o}
-  \gdef^^f4{\^o}
-  \gdef^^f5{\~o}
-  \gdef^^f6{\"o}
-  \gdef^^f7{$\div$}
-  \gdef^^f8{\o}
-  \gdef^^f9{\`u}
-  \gdef^^fa{\'u}
-  \gdef^^fb{\^u}
-  \gdef^^fc{\"u}
-  \gdef^^fd{\'y}
-  \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}}
-  \gdef^^ff{\"y}
-}
-
-% Latin9 (ISO-8859-15) encoding character definitions.
-\def\latninechardefs{%
-  % Encoding is almost identical to Latin1.
-  \latonechardefs
-  %
-  \gdef^^a4{\euro}
-  \gdef^^a6{\v S}
-  \gdef^^a8{\v s}
-  \gdef^^b4{\v Z}
-  \gdef^^b8{\v z}
-  \gdef^^bc{\OE}
-  \gdef^^bd{\oe}
-  \gdef^^be{\"Y}
-}
-
-% Latin2 (ISO-8859-2) character definitions.
-\def\lattwochardefs{%
-  \gdef^^a0{~}
-  \gdef^^a1{\missingcharmsg{LATIN CAPITAL LETTER A WITH OGONEK}}
-  \gdef^^a2{\u{}}
-  \gdef^^a3{\L}
-  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
-  \gdef^^a5{\v L}
-  \gdef^^a6{\'S}
-  \gdef^^a7{\S}
-  \gdef^^a8{\"{}}
-  \gdef^^a9{\v S}
-  \gdef^^aa{\cedilla S}
-  \gdef^^ab{\v T}
-  \gdef^^ac{\'Z}
-  \gdef^^ad{\-}
-  \gdef^^ae{\v Z}
-  \gdef^^af{\dotaccent Z}
-  %
-  \gdef^^b0{\textdegree}
-  \gdef^^b1{\missingcharmsg{LATIN SMALL LETTER A WITH OGONEK}}
-  \gdef^^b2{\missingcharmsg{OGONEK}}
-  \gdef^^b3{\l}
-  \gdef^^b4{\'{}}
-  \gdef^^b5{\v l}
-  \gdef^^b6{\'s}
-  \gdef^^b7{\v{}}
-  \gdef^^b8{\cedilla\ }
-  \gdef^^b9{\v s}
-  \gdef^^ba{\cedilla s}
-  \gdef^^bb{\v t}
-  \gdef^^bc{\'z}
-  \gdef^^bd{\H{}}
-  \gdef^^be{\v z}
-  \gdef^^bf{\dotaccent z}
-  %
-  \gdef^^c0{\'R}
-  \gdef^^c1{\'A}
-  \gdef^^c2{\^A}
-  \gdef^^c3{\u A}
-  \gdef^^c4{\"A}
-  \gdef^^c5{\'L}
-  \gdef^^c6{\'C}
-  \gdef^^c7{\cedilla C}
-  \gdef^^c8{\v C}
-  \gdef^^c9{\'E}
-  \gdef^^ca{\missingcharmsg{LATIN CAPITAL LETTER E WITH OGONEK}}
-  \gdef^^cb{\"E}
-  \gdef^^cc{\v E}
-  \gdef^^cd{\'I}
-  \gdef^^ce{\^I}
-  \gdef^^cf{\v D}
-  %
-  \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}}
-  \gdef^^d1{\'N}
-  \gdef^^d2{\v N}
-  \gdef^^d3{\'O}
-  \gdef^^d4{\^O}
-  \gdef^^d5{\H O}
-  \gdef^^d6{\"O}
-  \gdef^^d7{$\times$}
-  \gdef^^d8{\v R}
-  \gdef^^d9{\ringaccent U} 
-  \gdef^^da{\'U}
-  \gdef^^db{\H U}
-  \gdef^^dc{\"U}
-  \gdef^^dd{\'Y}
-  \gdef^^de{\cedilla T}
-  \gdef^^df{\ss}
-  %
-  \gdef^^e0{\'r}
-  \gdef^^e1{\'a}
-  \gdef^^e2{\^a}
-  \gdef^^e3{\u a}
-  \gdef^^e4{\"a}
-  \gdef^^e5{\'l}
-  \gdef^^e6{\'c}
-  \gdef^^e7{\cedilla c}
-  \gdef^^e8{\v c}
-  \gdef^^e9{\'e}
-  \gdef^^ea{\missingcharmsg{LATIN SMALL LETTER E WITH OGONEK}}
-  \gdef^^eb{\"e}
-  \gdef^^ec{\v e}
-  \gdef^^ed{\'\i}
-  \gdef^^ee{\^\i}
-  \gdef^^ef{\v d}
-  %
-  \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}}
-  \gdef^^f1{\'n}
-  \gdef^^f2{\v n}
-  \gdef^^f3{\'o}
-  \gdef^^f4{\^o}
-  \gdef^^f5{\H o}
-  \gdef^^f6{\"o}
-  \gdef^^f7{$\div$}
-  \gdef^^f8{\v r}
-  \gdef^^f9{\ringaccent u}
-  \gdef^^fa{\'u}
-  \gdef^^fb{\H u}
-  \gdef^^fc{\"u}
-  \gdef^^fd{\'y}
-  \gdef^^fe{\cedilla t}
-  \gdef^^ff{\dotaccent{}}
-}
-
-% UTF-8 character definitions.
-% 
-% This code to support UTF-8 is based on LaTeX's utf8.def, with some
-% changes for Texinfo conventions.  It is included here under the GPL by
-% permission from Frank Mittelbach and the LaTeX team.
-% 
-\newcount\countUTFx
-\newcount\countUTFy
-\newcount\countUTFz
-
-\gdef\UTFviiiTwoOctets#1#2{\expandafter
-   \UTFviiiDefined\csname u8:#1\string #2\endcsname}
-%
-\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
-   \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
-%
-\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
-   \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
-
-\gdef\UTFviiiDefined#1{%
-  \ifx #1\relax
-    \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
-  \else
-    \expandafter #1%
-  \fi
-}
-
-\begingroup
-  \catcode`\~13
-  \catcode`\"12
-
-  \def\UTFviiiLoop{%
-    \global\catcode\countUTFx\active
-    \uccode`\~\countUTFx
-    \uppercase\expandafter{\UTFviiiTmp}%
-    \advance\countUTFx by 1
-    \ifnum\countUTFx < \countUTFy
-      \expandafter\UTFviiiLoop
-    \fi}
-
-  \countUTFx = "C2
-  \countUTFy = "E0
-  \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
-  \UTFviiiLoop
-
-  \countUTFx = "E0
-  \countUTFy = "F0
-  \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
-  \UTFviiiLoop
-
-  \countUTFx = "F0
-  \countUTFy = "F4
-  \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiFourOctets\string~}}
-  \UTFviiiLoop
-\endgroup
-
-\begingroup
-  \catcode`\"=12
-  \catcode`\<=12
-  \catcode`\.=12
-  \catcode`\,=12
-  \catcode`\;=12
-  \catcode`\!=12
-  \catcode`\~=13
-
-  \gdef\DeclareUnicodeCharacter#1#2{%
-    \countUTFz = "#1\relax
-    \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
-    \begingroup
-      \parseXMLCharref
-      \def\UTFviiiTwoOctets##1##2{%
-        \csname u8:##1\string ##2\endcsname}%
-      \def\UTFviiiThreeOctets##1##2##3{%
-        \csname u8:##1\string ##2\string ##3\endcsname}%
-      \def\UTFviiiFourOctets##1##2##3##4{%
-        \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
-      \expandafter\expandafter\expandafter\expandafter
-       \expandafter\expandafter\expandafter
-       \gdef\UTFviiiTmp{#2}%
-    \endgroup}
 
-  \gdef\parseXMLCharref{%
-    \ifnum\countUTFz < "A0\relax
-      \errhelp = \EMsimple
-      \errmessage{Cannot define Unicode char value < 00A0}%
-    \else\ifnum\countUTFz < "800\relax
-      \parseUTFviiiA,%
-      \parseUTFviiiB C\UTFviiiTwoOctets.,%
-    \else\ifnum\countUTFz < "10000\relax
-      \parseUTFviiiA;%
-      \parseUTFviiiA,%
-      \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
-    \else
-      \parseUTFviiiA;%
-      \parseUTFviiiA,%
-      \parseUTFviiiA!%
-      \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
-    \fi\fi\fi
-  }
+% @documentencoding should change something in TeX eventually, most
+% likely, but for now just recognize it.
+\let\documentencoding = \comment
 
-  \gdef\parseUTFviiiA#1{%
-    \countUTFx = \countUTFz
-    \divide\countUTFz by 64
-    \countUTFy = \countUTFz
-    \multiply\countUTFz by 64
-    \advance\countUTFx by -\countUTFz
-    \advance\countUTFx by 128
-    \uccode `#1\countUTFx
-    \countUTFz = \countUTFy}
-
-  \gdef\parseUTFviiiB#1#2#3#4{%
-    \advance\countUTFz by "#10\relax
-    \uccode `#3\countUTFz
-    \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
-\endgroup
 
-\def\utfeightchardefs{%
-  \DeclareUnicodeCharacter{00A0}{\tie}
-  \DeclareUnicodeCharacter{00A1}{\exclamdown}
-  \DeclareUnicodeCharacter{00A3}{\pounds}
-  \DeclareUnicodeCharacter{00A8}{\"{ }}
-  \DeclareUnicodeCharacter{00A9}{\copyright}
-  \DeclareUnicodeCharacter{00AA}{\ordf}
-  \DeclareUnicodeCharacter{00AB}{\guillemetleft}
-  \DeclareUnicodeCharacter{00AD}{\-}
-  \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
-  \DeclareUnicodeCharacter{00AF}{\={ }}
-
-  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
-  \DeclareUnicodeCharacter{00B4}{\'{ }}
-  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
-  \DeclareUnicodeCharacter{00BA}{\ordm}
-  \DeclareUnicodeCharacter{00BB}{\guillemetright}
-  \DeclareUnicodeCharacter{00BF}{\questiondown}
-
-  \DeclareUnicodeCharacter{00C0}{\`A}
-  \DeclareUnicodeCharacter{00C1}{\'A}
-  \DeclareUnicodeCharacter{00C2}{\^A}
-  \DeclareUnicodeCharacter{00C3}{\~A}
-  \DeclareUnicodeCharacter{00C4}{\"A}
-  \DeclareUnicodeCharacter{00C5}{\AA}
-  \DeclareUnicodeCharacter{00C6}{\AE}
-  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
-  \DeclareUnicodeCharacter{00C8}{\`E}
-  \DeclareUnicodeCharacter{00C9}{\'E}
-  \DeclareUnicodeCharacter{00CA}{\^E}
-  \DeclareUnicodeCharacter{00CB}{\"E}
-  \DeclareUnicodeCharacter{00CC}{\`I}
-  \DeclareUnicodeCharacter{00CD}{\'I}
-  \DeclareUnicodeCharacter{00CE}{\^I}
-  \DeclareUnicodeCharacter{00CF}{\"I}
-
-  \DeclareUnicodeCharacter{00D1}{\~N}
-  \DeclareUnicodeCharacter{00D2}{\`O}
-  \DeclareUnicodeCharacter{00D3}{\'O}
-  \DeclareUnicodeCharacter{00D4}{\^O}
-  \DeclareUnicodeCharacter{00D5}{\~O}
-  \DeclareUnicodeCharacter{00D6}{\"O}
-  \DeclareUnicodeCharacter{00D8}{\O}
-  \DeclareUnicodeCharacter{00D9}{\`U}
-  \DeclareUnicodeCharacter{00DA}{\'U}
-  \DeclareUnicodeCharacter{00DB}{\^U}
-  \DeclareUnicodeCharacter{00DC}{\"U}
-  \DeclareUnicodeCharacter{00DD}{\'Y}
-  \DeclareUnicodeCharacter{00DF}{\ss}
-
-  \DeclareUnicodeCharacter{00E0}{\`a}
-  \DeclareUnicodeCharacter{00E1}{\'a}
-  \DeclareUnicodeCharacter{00E2}{\^a}
-  \DeclareUnicodeCharacter{00E3}{\~a}
-  \DeclareUnicodeCharacter{00E4}{\"a}
-  \DeclareUnicodeCharacter{00E5}{\aa}
-  \DeclareUnicodeCharacter{00E6}{\ae}
-  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
-  \DeclareUnicodeCharacter{00E8}{\`e}
-  \DeclareUnicodeCharacter{00E9}{\'e}
-  \DeclareUnicodeCharacter{00EA}{\^e}
-  \DeclareUnicodeCharacter{00EB}{\"e}
-  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
-  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
-  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
-  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
-
-  \DeclareUnicodeCharacter{00F1}{\~n}
-  \DeclareUnicodeCharacter{00F2}{\`o}
-  \DeclareUnicodeCharacter{00F3}{\'o}
-  \DeclareUnicodeCharacter{00F4}{\^o}
-  \DeclareUnicodeCharacter{00F5}{\~o}
-  \DeclareUnicodeCharacter{00F6}{\"o}
-  \DeclareUnicodeCharacter{00F8}{\o}
-  \DeclareUnicodeCharacter{00F9}{\`u}
-  \DeclareUnicodeCharacter{00FA}{\'u}
-  \DeclareUnicodeCharacter{00FB}{\^u}
-  \DeclareUnicodeCharacter{00FC}{\"u}
-  \DeclareUnicodeCharacter{00FD}{\'y}
-  \DeclareUnicodeCharacter{00FF}{\"y}
-
-  \DeclareUnicodeCharacter{0100}{\=A}
-  \DeclareUnicodeCharacter{0101}{\=a}
-  \DeclareUnicodeCharacter{0102}{\u{A}}
-  \DeclareUnicodeCharacter{0103}{\u{a}}
-  \DeclareUnicodeCharacter{0106}{\'C}
-  \DeclareUnicodeCharacter{0107}{\'c}
-  \DeclareUnicodeCharacter{0108}{\^C}
-  \DeclareUnicodeCharacter{0109}{\^c}
-  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
-  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
-  \DeclareUnicodeCharacter{010C}{\v{C}}
-  \DeclareUnicodeCharacter{010D}{\v{c}}
-  \DeclareUnicodeCharacter{010E}{\v{D}}
-
-  \DeclareUnicodeCharacter{0112}{\=E}
-  \DeclareUnicodeCharacter{0113}{\=e}
-  \DeclareUnicodeCharacter{0114}{\u{E}}
-  \DeclareUnicodeCharacter{0115}{\u{e}}
-  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
-  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
-  \DeclareUnicodeCharacter{011A}{\v{E}}
-  \DeclareUnicodeCharacter{011B}{\v{e}}
-  \DeclareUnicodeCharacter{011C}{\^G}
-  \DeclareUnicodeCharacter{011D}{\^g}
-  \DeclareUnicodeCharacter{011E}{\u{G}}
-  \DeclareUnicodeCharacter{011F}{\u{g}}
-
-  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
-  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
-  \DeclareUnicodeCharacter{0124}{\^H}
-  \DeclareUnicodeCharacter{0125}{\^h}
-  \DeclareUnicodeCharacter{0128}{\~I}
-  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
-  \DeclareUnicodeCharacter{012A}{\=I}
-  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
-  \DeclareUnicodeCharacter{012C}{\u{I}}
-  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
-
-  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
-  \DeclareUnicodeCharacter{0131}{\dotless{i}}
-  \DeclareUnicodeCharacter{0132}{IJ}
-  \DeclareUnicodeCharacter{0133}{ij}
-  \DeclareUnicodeCharacter{0134}{\^J}
-  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
-  \DeclareUnicodeCharacter{0139}{\'L}
-  \DeclareUnicodeCharacter{013A}{\'l}
-
-  \DeclareUnicodeCharacter{0141}{\L}
-  \DeclareUnicodeCharacter{0142}{\l}
-  \DeclareUnicodeCharacter{0143}{\'N}
-  \DeclareUnicodeCharacter{0144}{\'n}
-  \DeclareUnicodeCharacter{0147}{\v{N}}
-  \DeclareUnicodeCharacter{0148}{\v{n}}
-  \DeclareUnicodeCharacter{014C}{\=O}
-  \DeclareUnicodeCharacter{014D}{\=o}
-  \DeclareUnicodeCharacter{014E}{\u{O}}
-  \DeclareUnicodeCharacter{014F}{\u{o}}
-
-  \DeclareUnicodeCharacter{0150}{\H{O}}
-  \DeclareUnicodeCharacter{0151}{\H{o}}
-  \DeclareUnicodeCharacter{0152}{\OE}
-  \DeclareUnicodeCharacter{0153}{\oe}
-  \DeclareUnicodeCharacter{0154}{\'R}
-  \DeclareUnicodeCharacter{0155}{\'r}
-  \DeclareUnicodeCharacter{0158}{\v{R}}
-  \DeclareUnicodeCharacter{0159}{\v{r}}
-  \DeclareUnicodeCharacter{015A}{\'S}
-  \DeclareUnicodeCharacter{015B}{\'s}
-  \DeclareUnicodeCharacter{015C}{\^S}
-  \DeclareUnicodeCharacter{015D}{\^s}
-  \DeclareUnicodeCharacter{015E}{\cedilla{S}}
-  \DeclareUnicodeCharacter{015F}{\cedilla{s}}
-
-  \DeclareUnicodeCharacter{0160}{\v{S}}
-  \DeclareUnicodeCharacter{0161}{\v{s}}
-  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
-  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
-  \DeclareUnicodeCharacter{0164}{\v{T}}
-
-  \DeclareUnicodeCharacter{0168}{\~U}
-  \DeclareUnicodeCharacter{0169}{\~u}
-  \DeclareUnicodeCharacter{016A}{\=U}
-  \DeclareUnicodeCharacter{016B}{\=u}
-  \DeclareUnicodeCharacter{016C}{\u{U}}
-  \DeclareUnicodeCharacter{016D}{\u{u}}
-  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
-  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
-
-  \DeclareUnicodeCharacter{0170}{\H{U}}
-  \DeclareUnicodeCharacter{0171}{\H{u}}
-  \DeclareUnicodeCharacter{0174}{\^W}
-  \DeclareUnicodeCharacter{0175}{\^w}
-  \DeclareUnicodeCharacter{0176}{\^Y}
-  \DeclareUnicodeCharacter{0177}{\^y}
-  \DeclareUnicodeCharacter{0178}{\"Y}
-  \DeclareUnicodeCharacter{0179}{\'Z}
-  \DeclareUnicodeCharacter{017A}{\'z}
-  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
-  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
-  \DeclareUnicodeCharacter{017D}{\v{Z}}
-  \DeclareUnicodeCharacter{017E}{\v{z}}
-
-  \DeclareUnicodeCharacter{01C4}{D\v{Z}}
-  \DeclareUnicodeCharacter{01C5}{D\v{z}}
-  \DeclareUnicodeCharacter{01C6}{d\v{z}}
-  \DeclareUnicodeCharacter{01C7}{LJ}
-  \DeclareUnicodeCharacter{01C8}{Lj}
-  \DeclareUnicodeCharacter{01C9}{lj}
-  \DeclareUnicodeCharacter{01CA}{NJ}
-  \DeclareUnicodeCharacter{01CB}{Nj}
-  \DeclareUnicodeCharacter{01CC}{nj}
-  \DeclareUnicodeCharacter{01CD}{\v{A}}
-  \DeclareUnicodeCharacter{01CE}{\v{a}}
-  \DeclareUnicodeCharacter{01CF}{\v{I}}
-
-  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
-  \DeclareUnicodeCharacter{01D1}{\v{O}}
-  \DeclareUnicodeCharacter{01D2}{\v{o}}
-  \DeclareUnicodeCharacter{01D3}{\v{U}}
-  \DeclareUnicodeCharacter{01D4}{\v{u}}
-
-  \DeclareUnicodeCharacter{01E2}{\={\AE}}
-  \DeclareUnicodeCharacter{01E3}{\={\ae}}
-  \DeclareUnicodeCharacter{01E6}{\v{G}}
-  \DeclareUnicodeCharacter{01E7}{\v{g}}
-  \DeclareUnicodeCharacter{01E8}{\v{K}}
-  \DeclareUnicodeCharacter{01E9}{\v{k}}
-
-  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
-  \DeclareUnicodeCharacter{01F1}{DZ}
-  \DeclareUnicodeCharacter{01F2}{Dz}
-  \DeclareUnicodeCharacter{01F3}{dz}
-  \DeclareUnicodeCharacter{01F4}{\'G}
-  \DeclareUnicodeCharacter{01F5}{\'g}
-  \DeclareUnicodeCharacter{01F8}{\`N}
-  \DeclareUnicodeCharacter{01F9}{\`n}
-  \DeclareUnicodeCharacter{01FC}{\'{\AE}}
-  \DeclareUnicodeCharacter{01FD}{\'{\ae}}
-  \DeclareUnicodeCharacter{01FE}{\'{\O}}
-  \DeclareUnicodeCharacter{01FF}{\'{\o}}
-
-  \DeclareUnicodeCharacter{021E}{\v{H}}
-  \DeclareUnicodeCharacter{021F}{\v{h}}
-
-  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
-  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
-  \DeclareUnicodeCharacter{0228}{\cedilla{E}}
-  \DeclareUnicodeCharacter{0229}{\cedilla{e}}
-  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
-  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
-
-  \DeclareUnicodeCharacter{0232}{\=Y}
-  \DeclareUnicodeCharacter{0233}{\=y}
-  \DeclareUnicodeCharacter{0237}{\dotless{j}}
-
-  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
-  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
-  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
-  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
-  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
-  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
-  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
-  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
-  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
-  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
-  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
-  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
-
-  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
-  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
-
-  \DeclareUnicodeCharacter{1E20}{\=G}
-  \DeclareUnicodeCharacter{1E21}{\=g}
-  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
-  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
-  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
-  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
-  \DeclareUnicodeCharacter{1E26}{\"H}
-  \DeclareUnicodeCharacter{1E27}{\"h}
-
-  \DeclareUnicodeCharacter{1E30}{\'K}
-  \DeclareUnicodeCharacter{1E31}{\'k}
-  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
-  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
-  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
-  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
-  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
-  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
-  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
-  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
-  \DeclareUnicodeCharacter{1E3E}{\'M}
-  \DeclareUnicodeCharacter{1E3F}{\'m}
-
-  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
-  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
-  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
-  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
-  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
-  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
-  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
-  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
-  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
-  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
-
-  \DeclareUnicodeCharacter{1E54}{\'P}
-  \DeclareUnicodeCharacter{1E55}{\'p}
-  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
-  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
-  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
-  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
-  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
-  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
-  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
-  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
-
-  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
-  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
-  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
-  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
-  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
-  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
-  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
-  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
-  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
-  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
-
-  \DeclareUnicodeCharacter{1E7C}{\~V}
-  \DeclareUnicodeCharacter{1E7D}{\~v}
-  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
-  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
-
-  \DeclareUnicodeCharacter{1E80}{\`W}
-  \DeclareUnicodeCharacter{1E81}{\`w}
-  \DeclareUnicodeCharacter{1E82}{\'W}
-  \DeclareUnicodeCharacter{1E83}{\'w}
-  \DeclareUnicodeCharacter{1E84}{\"W}
-  \DeclareUnicodeCharacter{1E85}{\"w}
-  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
-  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
-  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
-  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
-  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
-  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
-  \DeclareUnicodeCharacter{1E8C}{\"X}
-  \DeclareUnicodeCharacter{1E8D}{\"x}
-  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
-  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
-
-  \DeclareUnicodeCharacter{1E90}{\^Z}
-  \DeclareUnicodeCharacter{1E91}{\^z}
-  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
-  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
-  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
-  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
-  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
-  \DeclareUnicodeCharacter{1E97}{\"t}
-  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
-  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
-
-  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
-  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
-
-  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
-  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
-  \DeclareUnicodeCharacter{1EBC}{\~E}
-  \DeclareUnicodeCharacter{1EBD}{\~e}
-
-  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
-  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
-  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
-  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
-
-  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
-  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
-
-  \DeclareUnicodeCharacter{1EF2}{\`Y}
-  \DeclareUnicodeCharacter{1EF3}{\`y}
-  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
-
-  \DeclareUnicodeCharacter{1EF8}{\~Y}
-  \DeclareUnicodeCharacter{1EF9}{\~y}
-
-  \DeclareUnicodeCharacter{2013}{--}
-  \DeclareUnicodeCharacter{2014}{---}
-  \DeclareUnicodeCharacter{2018}{\quoteleft}
-  \DeclareUnicodeCharacter{2019}{\quoteright}
-  \DeclareUnicodeCharacter{201A}{\quotesinglbase}
-  \DeclareUnicodeCharacter{201C}{\quotedblleft}
-  \DeclareUnicodeCharacter{201D}{\quotedblright}
-  \DeclareUnicodeCharacter{201E}{\quotedblbase}
-  \DeclareUnicodeCharacter{2022}{\bullet}
-  \DeclareUnicodeCharacter{2026}{\dots}
-  \DeclareUnicodeCharacter{2039}{\guilsinglleft}
-  \DeclareUnicodeCharacter{203A}{\guilsinglright}
-  \DeclareUnicodeCharacter{20AC}{\euro}
-
-  \DeclareUnicodeCharacter{2192}{\expansion}
-  \DeclareUnicodeCharacter{21D2}{\result}
-
-  \DeclareUnicodeCharacter{2212}{\minus}
-  \DeclareUnicodeCharacter{2217}{\point}
-  \DeclareUnicodeCharacter{2261}{\equiv}
-}% end of \utfeightchardefs
-
-
-% US-ASCII character definitions.
-\def\asciichardefs{% nothing need be done
-   \relax
-}
-
-% Make non-ASCII characters printable again for compatibility with
-% existing Texinfo documents that may use them, even without declaring a
-% document encoding.
+% Page size parameters.
 %
-\setnonasciicharscatcode \other
-
-
-\message{formatting,}
-
 \newdimen\defaultparindent \defaultparindent = 15pt
 
 \chapheadingskip = 15pt plus 4pt minus 2pt
@@ -8586,7 +6390,7 @@
 % Don't be so finicky about underfull hboxes, either.
 \hbadness = 2000
 
-% Following George Bush, get rid of widows and orphans.
+% Following George Bush, just get rid of widows and orphans.
 \widowpenalty=10000
 \clubpenalty=10000
 
@@ -8604,9 +6408,9 @@
   \fi
 }
 
-% Parameters in order: 1) textheight; 2) textwidth;
-% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
-% 7) physical page height; 8) physical page width.
+% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
+% 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.
@@ -8633,10 +6437,6 @@
   \ifpdf
     \pdfpageheight #7\relax
     \pdfpagewidth #8\relax
-    % if we don't reset these, they will remain at "1 true in" of
-    % whatever layout pdftex was dumped with.
-    \pdfhorigin = 1 true in
-    \pdfvorigin = 1 true in
   \fi
   %
   \setleading{\textleading}
@@ -8651,19 +6451,19 @@
   \textleading = 13.2pt
   %
   % If page is nothing but text, make it come out even.
-  \internalpagesizes{607.2pt}{6in}% that's 46 lines
+  \internalpagesizes{46\baselineskip}{6in}%
                     {\voffset}{.25in}%
                     {\bindingoffset}{36pt}%
                     {11in}{8.5in}%
 }}
 
-% Use @smallbook to reset parameters for 7x9.25 trim size.
+% Use @smallbook to reset parameters for 7x9.5 (or so) format.
 \def\smallbook{{\globaldefs = 1
   \parskip = 2pt plus 1pt
   \textleading = 12pt
   %
   \internalpagesizes{7.5in}{5in}%
-                    {-.2in}{0in}%
+                    {\voffset}{.25in}%
                     {\bindingoffset}{16pt}%
                     {9.25in}{7in}%
   %
@@ -8674,24 +6474,6 @@
   \defbodyindent = .5cm
 }}
 
-% Use @smallerbook to reset parameters for 6x9 trim size.
-% (Just testing, parameters still in flux.)
-\def\smallerbook{{\globaldefs = 1
-  \parskip = 1.5pt plus 1pt
-  \textleading = 12pt
-  %
-  \internalpagesizes{7.4in}{4.8in}%
-                    {-.2in}{-.4in}%
-                    {0pt}{14pt}%
-                    {9in}{6in}%
-  %
-  \lispnarrowing = 0.25in
-  \tolerance = 700
-  \hfuzz = 1pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = .4cm
-}}
-
 % Use @afourpaper to print on European A4 paper.
 \def\afourpaper{{\globaldefs = 1
   \parskip = 3pt plus 2pt minus 1pt
@@ -8707,7 +6489,7 @@
   % \global\normaloffset = -6mm
   % \global\bindingoffset = 10mm
   % @end tex
-  \internalpagesizes{673.2pt}{160mm}% that's 51 lines
+  \internalpagesizes{51\baselineskip}{160mm}
                     {\voffset}{\hoffset}%
                     {\bindingoffset}{44pt}%
                     {297mm}{210mm}%
@@ -8764,7 +6546,8 @@
 % Perhaps we should allow setting the margins, \topskip, \parskip,
 % and/or leading, also. Or perhaps we should compute them somehow.
 %
-\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
+\def\pagesizes{\parsearg\pagesizesxxx}
+\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
 \def\pagesizesyyy#1,#2,#3\finish{{%
   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
   \globaldefs = 1
@@ -8772,7 +6555,7 @@
   \parskip = 3pt plus 2pt minus 1pt
   \setleading{\textleading}%
   %
-  \dimen0 = #1\relax
+  \dimen0 = #1
   \advance\dimen0 by \voffset
   %
   \dimen2 = \hsize
@@ -8811,8 +6594,8 @@
 \def\normalplus{+}
 \def\normaldollar{$}%$ font-lock fix
 
-% 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,
+% 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,
 % where something hairier probably needs to be done.
 %
 % #1 is what to print if we are indeed using \tt; #2 is what to print
@@ -8844,7 +6627,6 @@
 
 \catcode`\_=\active
 \def_{\ifusingtt\normalunderscore\_}
-\let\realunder=_
 % Subroutine for the previous macro.
 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
 
@@ -8861,49 +6643,46 @@
 \catcode`\$=\active
 \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
 
+% 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.
 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
 % \otherifyactive is called near the end of this file.
 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
 
-% Used sometimes to turn off (effectively) the active characters even after
-% parsing them.
-\def\turnoffactive{%
-  \normalturnoffactive
-  \otherbackslash
-}
-
 \catcode`\ =0
 
-% \backslashcurfont outputs one backslash character in current font,
+% \rawbackslashxx outputs one backslash character in current font,
 % as in \char`\\.
-\global\chardef\backslashcurfont=`\\
-\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
+\global\chardef\rawbackslashxx=`\\
 
-% \realbackslash is an actual character `\' with catcode other, and
-% \doublebackslash is two of them (for the pdf outlines).
-{\catcode`\\=\other @gdef realbackslash{\} @gdef doublebackslash{\\}}
-
-% In texinfo, backslash is an active character; it prints the backslash
-% in fixed width font.
-\catcode`\\=\active
- def@normalbackslash{{ tt@backslashcurfont}}
-% On startup, @fixbackslash assigns:
-%  @let \ = @normalbackslash
-
-% \rawbackslash defines an active \ to do \backslashcurfont.
+% \rawbackslash defines an active \ to do \rawbackslashxx.
 % \otherbackslash defines an active \ to be a literal `\' character with
 % catcode other.
- gdef@rawbackslash{ let\=@backslashcurfont}
- gdef@otherbackslash{ let\=@realbackslash}
+{\catcode`\\=\active
+ @gdef rawbackslash{@let\= rawbackslashxx}
+ @gdef otherbackslash{@let\= realbackslash}
+}
 
-% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% the literal character `\'.
-% 
- def@normalturnoffactive{%
-  @let\= normalbackslash
+% \realbackslash is an actual character `\' with catcode other.
+{\catcode`\\=\other @gdef realbackslash{\}}
+
+% \normalbackslash outputs one backslash in fixed width font.
+\def\normalbackslash{{\tt\rawbackslashxx}}
+
+\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
@@ -8912,9 +6691,14 @@
   @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.
 @otherifyactive
@@ -8927,9 +6711,9 @@
 @global let\ = @eatinput
 
 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
-% the first `\' in the file would cause an error. This macro tries to fix
+% the first `\{ in the file would cause an error. This macro tries to fix
 % that, assuming it is called before the first `\' could plausibly occur.
-% Also turn back on active characters that might appear in the input
+% Also back turn on active characters that might appear in the input
 % file name, in case not using a pre-dumped format.
 %
 @gdef fixbackslash{%
@@ -8946,6 +6730,10 @@
 @catcode` # = @other
 @catcode` % = @other
 
+ c Set initial fonts.
+ textfonts
+ rm
+
 
 @c Local variables:
 @c eval: (add-hook 'write-file-hooks 'time-stamp)
@@ -8954,9 +6742,3 @@
 @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

Modified: branches/gcomprixogoo/install-sh
==============================================================================
--- branches/gcomprixogoo/install-sh	(original)
+++ branches/gcomprixogoo/install-sh	Wed Jul 30 23:37:49 2008
@@ -1,8 +1,7 @@
 #!/bin/sh
+#
 # install - install a program, script, or datafile
-
-scriptversion=2006-12-25.00
-
+#
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
 # following copyright and license.
@@ -39,481 +38,257 @@
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
 
-nl='
-'
-IFS=" ""	$nl"
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
+doit="${DOITPROG-}"
 
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
 
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
 rmcmd="$rmprog -f"
-stripcmd=
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd=$cpprog
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd=$stripprog
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
 
-src=
-dst=
-dir_arg=
-dst_arg=
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
 
-copy_on_change=false
-no_target_directory=
+if [ x"$src" = x ]
+then
+	echo "$0: no input file specified" >&2
+	exit 1
+else
+	:
+fi
 
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+
+	if [ -d "$dst" ]; then
+		instcmd=:
+		chmodcmd=""
+	else
+		instcmd=$mkdirprog
+	fi
+else
 
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f "$src" ] || [ -d "$src" ]
+	then
+		:
+	else
+		echo "$0: $src does not exist" >&2
+		exit 1
+	fi
 
-Options:
-     --help     display this help and exit.
-     --version  display version info and exit.
+	if [ x"$dst" = x ]
+	then
+		echo "$0: no destination specified" >&2
+		exit 1
+	else
+		:
+	fi
 
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -d            create directories instead of installing files.
-  -g GROUP      $chgrpprog installed files to GROUP.
-  -m MODE       $chmodprog installed files to MODE.
-  -o USER       $chownprog installed files to USER.
-  -s            $stripprog installed files.
-  -t DIRECTORY  install into DIRECTORY.
-  -T            report an error if DSTFILE is a directory.
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
 
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
-"
+	if [ -d "$dst" ]
+	then
+		dst=$dst/`basename "$src"`
+	else
+		:
+	fi
+fi
 
-while test $# -ne 0; do
-  case $1 in
-    -c) ;;
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
 
-    -C) copy_on_change=true;;
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
 
-    -d) dir_arg=true;;
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+	'
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@% g' -e 's ^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp=$pathcomp$1
+	shift
+
+	if [ ! -d "$pathcomp" ] ;
+        then
+		$mkdirprog "$pathcomp"
+	else
+		:
+	fi
 
-    -g) chgrpcmd="$chgrpprog $2"
-	shift;;
+	pathcomp=$pathcomp/
+done
+fi
 
-    --help) echo "$usage"; exit $?;;
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd "$dst" &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
 
-    -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
+# If we're going to rename the final executable, determine the name now.
 
-    -o) chowncmd="$chownprog $2"
-	shift;;
+	if [ x"$transformarg" = x ]
+	then
+		dstfile=`basename "$dst"`
+	else
+		dstfile=`basename "$dst" $transformbasename |
+			sed $transformarg`$transformbasename
+	fi
 
-    -s) stripcmd=$stripprog;;
+# don't allow the sed command to completely eliminate the filename
 
-    -t) dst_arg=$2
-	shift;;
+	if [ x"$dstfile" = x ]
+	then
+		dstfile=`basename "$dst"`
+	else
+		:
+	fi
 
-    -T) no_target_directory=true;;
+# Make a couple of temp file names in the proper directory.
 
-    --version) echo "$0 $scriptversion"; exit $?;;
+	dsttmp=$dstdir/_inst.$$_
+	rmtmp=$dstdir/_rm.$$_
 
-    --)	shift
-	break;;
+# Trap to clean up temp files at exit.
 
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
+	trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+	trap '(exit $?); exit' 1 2 13 15
 
-    *)  break;;
-  esac
-  shift
-done
+# Move or copy the file name to the temp name
 
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $  
-  for arg
-  do
-    if test -n "$dst_arg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
-      shift # fnord
-    fi
-    shift # arg
-    dst_arg=$arg
-  done
-fi
+	$doit $instcmd "$src" "$dsttmp" &&
 
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
+# and set any options; do chmod last to preserve setuid bits
 
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
 
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
 
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dst_arg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-
-    dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
+# Now remove or move aside any old file at destination location.  We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons.  In this case, the final cleanup
+# might fail but the new file should still install successfully.
 
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
-	exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
+{
+	if [ -f "$dstdir/$dstfile" ]
+	then
+		$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+		$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+		{
+		  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		  (exit 1); exit
+		}
 	else
-	  mkdir_mode=
+		:
 	fi
+} &&
 
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
+# Now rename the file to the real destination.
 
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix='/';;
-	-*) prefix='./';;
-	*)  prefix='';;
-      esac
-
-      eval "$initialize_posix_glob"
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob set -f
-      set fnord $dstdir
-      shift
-      $posix_glob set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
-      done
+	$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
 
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
-    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
-    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # Rename the file to the real destination.
-      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
-      # The rename failed, perhaps because mv can't rename something else
-      # to itself, or perhaps because mv is so ancient that it does not
-      # support -f.
-      {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || exit 1
+fi &&
 
-    trap '' 0
-  fi
-done
+# The final little trick to "correctly" pass the exit status to the exit trap.
 
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+{
+	(exit 0); exit
+}

Modified: branches/gcomprixogoo/src/gcompris/file_selector.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/file_selector.c	(original)
+++ branches/gcomprixogoo/src/gcompris/file_selector.c	Wed Jul 30 23:37:49 2008
@@ -571,8 +571,6 @@
   g_dir_close(dir);
   g_list_free(file_list);
 
-  /* Warning: we don't scale the internal canvas dynamicaly */
-  goo_canvas_set_scale (GOO_CANVAS(canvas), gc_zoom_factor_get());
 }
 
 /* Callback when a directory is selected */

Modified: branches/gcomprixogoo/src/gcompris/images_selector.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/images_selector.c	(original)
+++ branches/gcomprixogoo/src/gcompris/images_selector.c	Wed Jul 30 23:37:49 2008
@@ -28,6 +28,7 @@
 #include <libxml/parser.h>
 
 #include "gcompris.h"
+#include "gc_core.h"
 
 #define SOUNDLISTFILE PACKAGE
 
@@ -40,7 +41,6 @@
 						      gpointer data);
 static void		 item_event_scroll(GtkAdjustment *adj,
 					   GooCanvas *canvas);
-static gboolean		 read_xml_file(gchar *fname);
 static gboolean		 read_dataset_directory(gchar *dataset_dir);
 static void		 display_image(gchar *imagename, GooCanvasItem *rootitem);
 static void		 free_stuff (GSList *data);
@@ -64,7 +64,7 @@
 #define	DRAWING_AREA_X1	111.0
 #define DRAWING_AREA_Y1	14.0
 #define DRAWING_AREA_X2	774.0
-#define DRAWING_AREA_Y2	500.0
+#define DRAWING_AREA_Y2	460.0
 
 /* Represent the limits of list area */
 #define	LIST_AREA_X1	18.0
@@ -112,7 +112,7 @@
   gint		 x_start = 0;
   gchar		*dataseturl = NULL;
 
-  GtkWidget	  *w;
+  GtkWidget	*w;
 
   if(rootitem)
     return;
@@ -163,8 +163,10 @@
   list_bg_item = goo_canvas_rect_new (goo_canvas_get_root_item(GOO_CANVAS(canvas_list_selector)),
 				      0,
 				      0,
-				      LIST_AREA_X2 - LIST_AREA_X1,
-				      LIST_AREA_Y2 - LIST_AREA_Y1,
+				      (LIST_AREA_X2 - LIST_AREA_X1)
+				      * gc_zoom_factor_get(),
+				      (LIST_AREA_Y2 - LIST_AREA_Y1)
+				      * gc_zoom_factor_get(),
 				      "fill-color-rgba", gc_skin_get_color("gcompris/imageselectbg"),
 				      "line-width", 0.0,
 				      NULL);
@@ -173,7 +175,8 @@
     GTK_ADJUSTMENT (gtk_adjustment_new (0.00, 0.00,
 					0.00,
 					10, IMAGE_HEIGHT,
-					LIST_AREA_Y2 - LIST_AREA_Y1)
+					(LIST_AREA_Y2 - LIST_AREA_Y1)
+					* gc_zoom_factor_get())
 		    );
 
   w = gtk_vscrollbar_new (list_adj);
@@ -203,7 +206,7 @@
 			 DRAWING_AREA_X1,
 			 DRAWING_AREA_Y1,
 			 DRAWING_AREA_X2 - DRAWING_AREA_X1,
-			 DRAWING_AREA_Y2 - DRAWING_AREA_Y1 - 35.0,
+			 DRAWING_AREA_Y2 - DRAWING_AREA_Y1,
 			 NULL);
 
   gtk_widget_show (canvas_image_selector);
@@ -213,8 +216,10 @@
     goo_canvas_rect_new (goo_canvas_get_root_item(GOO_CANVAS(canvas_image_selector)),
 			 0,
 			 0,
-			 DRAWING_AREA_X2 - DRAWING_AREA_X1,
-			 DRAWING_AREA_Y2 - DRAWING_AREA_Y1,
+			 (DRAWING_AREA_X2 - DRAWING_AREA_X1)
+			 * gc_zoom_factor_get(),
+			 (DRAWING_AREA_Y2 - DRAWING_AREA_Y1)
+			 * gc_zoom_factor_get(),
 			 "fill-color-rgba", gc_skin_get_color("gcompris/imageselectbg"),
 			 "line-width", 0.0,
 			 NULL);
@@ -223,7 +228,8 @@
     GTK_ADJUSTMENT (gtk_adjustment_new (0.00, 0.00,
 					0.00,
 					10, IMAGE_HEIGHT,
-					DRAWING_AREA_Y2 - DRAWING_AREA_Y1)
+					(DRAWING_AREA_Y2 - DRAWING_AREA_Y1)
+					* gc_zoom_factor_get())
 		    );
 
   w = gtk_vscrollbar_new (image_adj);
@@ -264,34 +270,6 @@
 
       read_dataset_directory(dataseturl);
     }
-  else if(dataseturl)
-    {
-      /* Read the given data set file, local or net */
-      read_xml_file(dataseturl);
-    }
-  else
-    {
-      /* Network code for dataset directory */
-      GSList *filelist = NULL;
-      GSList *i = NULL;
-
-      g_free(dataseturl);
-      dataseturl = g_strconcat("boards/", dataset, NULL);
-
-      filelist = gc_net_dir_read_name(dataseturl, ".xml");
-
-      for (i = filelist; i != NULL; i = g_slist_next (i))
-	{
-	  gchar *url = gc_file_find_absolute(i->data,
-					     NULL);
-	  g_warning("processing dataset=%s\n", (char *)i->data);
-	  read_xml_file(url);
-	  g_free(url);
-	}
-
-      g_slist_free(filelist);
-
-    }
   g_free(dataseturl);
 
   /*
@@ -374,8 +352,8 @@
   if(!pixmap)
     return;
 
-  iw = IMAGE_WIDTH;
-  ih = IMAGE_HEIGHT;
+  iw = IMAGE_WIDTH * gc_zoom_factor_get();
+  ih = IMAGE_HEIGHT * gc_zoom_factor_get();
 
   /* Calc the max to resize width or height */
   xratio = (double) ((iw/(double)gdk_pixbuf_get_width(pixmap)));
@@ -396,15 +374,16 @@
 		   imagename);
   gc_item_focus_init(item, NULL);
 
-  ix += IMAGE_WIDTH + IMAGE_GAP;
-  if(ix >= DRAWING_AREA_X2 - DRAWING_AREA_X1 - IMAGE_GAP)
+  ix += iw + IMAGE_GAP;
+  if(ix >= (DRAWING_AREA_X2 - DRAWING_AREA_X1)
+     * gc_zoom_factor_get() - IMAGE_GAP)
     {
       ix = 0;
-      iy += IMAGE_HEIGHT + IMAGE_GAP;
+      iy += ih + IMAGE_GAP;
     }
 
   /* Cannot use GINT_TO_POINTER with a constant calculation */
-  guint iy_calc = iy + (IMAGE_HEIGHT + IMAGE_GAP)*2;
+  guint iy_calc = iy + (ih + IMAGE_GAP)*2;
   g_object_set_data (G_OBJECT (root_item), "iy", GINT_TO_POINTER (iy_calc));
 }
 
@@ -426,8 +405,8 @@
 
   pixmap = gc_pixmap_load(imagename);
 
-  iw = LIST_IMAGE_WIDTH;
-  ih = LIST_IMAGE_HEIGHT;
+  iw = LIST_IMAGE_WIDTH * gc_zoom_factor_get();
+  ih = LIST_IMAGE_HEIGHT * gc_zoom_factor_get();
 
   /* Calc the max to resize width or height */
   xratio = (double) ((iw/(double)gdk_pixbuf_get_width(pixmap)));
@@ -449,14 +428,16 @@
 		     imagename);
   gc_item_focus_init(item, NULL);
 
-  isy += LIST_IMAGE_HEIGHT + IMAGE_GAP;
+  isy += ih + IMAGE_GAP;
 
-  gdouble upper = MAX(isy + LIST_IMAGE_HEIGHT + IMAGE_GAP,
-		      LIST_AREA_Y2 - LIST_AREA_Y1);
+  gdouble upper = MAX(isy + ih + IMAGE_GAP,
+		      (LIST_AREA_Y2 - LIST_AREA_Y1)
+		      * gc_zoom_factor_get());
 
   goo_canvas_set_bounds (GOO_CANVAS(canvas_list_selector),
 			 0, 0,
-			 LIST_AREA_X2 - LIST_AREA_X1,
+			 (LIST_AREA_X2 - LIST_AREA_X1)
+			 * gc_zoom_factor_get(),
 			 upper);
 
   g_object_set(list_bg_item,
@@ -536,11 +517,13 @@
   /* Set the image scrollbar back to its max position */
   last_iy = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (rootitem_set), "iy"));
   gdouble upper = MAX(last_iy,
-		      DRAWING_AREA_Y2 - DRAWING_AREA_Y1);
+		      (DRAWING_AREA_Y2 - DRAWING_AREA_Y1)
+		      * gc_zoom_factor_get());
 
   goo_canvas_set_bounds  (GOO_CANVAS(canvas_image_selector),
 			  0, 0,
-			  DRAWING_AREA_X2 - DRAWING_AREA_X1,
+			  (DRAWING_AREA_X2 - DRAWING_AREA_X1)
+			  * gc_zoom_factor_get(),
 			  upper);
 
   g_object_set(image_bg_item,
@@ -763,45 +746,6 @@
 }
 
 
-/* read an xml file into our memory structures and update our view,
- * dump any old data we have in memory if we can load a new set
- *
- * \param fname is an absolute file name
- *
- */
-static gboolean
-read_xml_file(gchar *fname)
-{
-  /* pointer to the new doc */
-  xmlDocPtr doc;
-
-  g_return_val_if_fail(fname!=NULL, FALSE);
-
-  doc = gc_net_load_xml(fname);
-
-  /* in case something went wrong */
-  if(!doc)
-    return FALSE;
-
-  if(/* if there is no root element */
-     !doc->children ||
-     /* if it doesn't have a name */
-     !doc->children->name ||
-     /* if it isn't the good node */
-     g_strcasecmp((gchar *)doc->children->name, "ImageSetRoot")!=0) {
-    xmlFreeDoc(doc);
-    return FALSE;
-  }
-
-  /* parse our document and replace old data */
-  parse_doc(doc);
-
-  xmlFreeDoc(doc);
-
-  return TRUE;
-}
-
-
 /** read an xml file into our memory structures and update our view,
  *   dump any old data we have in memory if we can load a new set
  *

Modified: branches/gcomprixogoo/src/runit.sh
==============================================================================
--- branches/gcomprixogoo/src/runit.sh	(original)
+++ branches/gcomprixogoo/src/runit.sh	Wed Jul 30 23:37:49 2008
@@ -33,5 +33,6 @@
     -S $menudir/../../boards/skins \
     -M $menudir \
     --locale_dir=$path/locale \
+    --reread-menu \
     -l $section/$activity $*
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]