PageRenderTime 67ms CodeModel.GetById 23ms app.highlight 17ms RepoModel.GetById 2ms app.codeStats 1ms

/js/src/ctypes/libffi/texinfo.tex

http://github.com/zpao/v8monkey
LaTeX | 7210 lines | 4102 code | 606 blank | 2502 comment | 0 complexity | 330cc83e650cc581dc85ffaa9cabb184 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1% texinfo.tex -- TeX macros to handle Texinfo files.
   2%
   3% Load plain if necessary, i.e., if running under initex.
   4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
   5%
   6\def\texinfoversion{2005-07-05.19}
   7%
   8% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
   9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
  10% Foundation, Inc.
  11%
  12% This texinfo.tex file is free software; you can redistribute it and/or
  13% modify it under the terms of the GNU General Public License as
  14% published by the Free Software Foundation; either version 2, or (at
  15% your option) any later version.
  16%
  17% This texinfo.tex file is distributed in the hope that it will be
  18% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  19% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20% General Public License for more details.
  21%
  22% You should have received a copy of the GNU General Public License
  23% along with this texinfo.tex file; see the file COPYING.  If not, write
  24% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  25% Boston, MA 02110-1301, USA.
  26%
  27% As a special exception, when this file is read by TeX when processing
  28% a Texinfo source document, you may use the result without
  29% restriction.  (This has been our intent since Texinfo was invented.)
  30%
  31% Please try the latest version of texinfo.tex before submitting bug
  32% reports; you can get the latest version from:
  33%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
  34%   ftp://tug.org/tex/texinfo.tex
  35%     (and all CTAN mirrors, see http://www.ctan.org).
  36% The texinfo.tex in any given distribution could well be out
  37% of date, so if that's what you're using, please check.
  38%
  39% Send bug reports to bug-texinfo@gnu.org.  Please include including a
  40% complete document in each bug report with which we can reproduce the
  41% problem.  Patches are, of course, greatly appreciated.
  42%
  43% To process a Texinfo manual with TeX, it's most reliable to use the
  44% texi2dvi shell script that comes with the distribution.  For a simple
  45% manual foo.texi, however, you can get away with this:
  46%   tex foo.texi
  47%   texindex foo.??
  48%   tex foo.texi
  49%   tex foo.texi
  50%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
  51% The extra TeX runs get the cross-reference information correct.
  52% Sometimes one run after texindex suffices, and sometimes you need more
  53% than two; texi2dvi does it as many times as necessary.
  54%
  55% It is possible to adapt texinfo.tex for other languages, to some
  56% extent.  You can get the existing language-specific files from the
  57% full Texinfo distribution.
  58%
  59% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  60
  61
  62\message{Loading texinfo [version \texinfoversion]:}
  63
  64% If in a .fmt file, print the version number
  65% and turn on active characters that we couldn't do earlier because
  66% they might have appeared in the input file name.
  67\everyjob{\message{[Texinfo version \texinfoversion]}%
  68  \catcode`+=\active \catcode`\_=\active}
  69
  70\message{Basics,}
  71\chardef\other=12
  72
  73% We never want plain's \outer definition of \+ in Texinfo.
  74% For @tex, we can use \tabalign.
  75\let\+ = \relax
  76
  77% Save some plain tex macros whose names we will redefine.
  78\let\ptexb=\b
  79\let\ptexbullet=\bullet
  80\let\ptexc=\c
  81\let\ptexcomma=\,
  82\let\ptexdot=\.
  83\let\ptexdots=\dots
  84\let\ptexend=\end
  85\let\ptexequiv=\equiv
  86\let\ptexexclam=\!
  87\let\ptexfootnote=\footnote
  88\let\ptexgtr=>
  89\let\ptexhat=^
  90\let\ptexi=\i
  91\let\ptexindent=\indent
  92\let\ptexinsert=\insert
  93\let\ptexlbrace=\{
  94\let\ptexless=<
  95\let\ptexnewwrite\newwrite
  96\let\ptexnoindent=\noindent
  97\let\ptexplus=+
  98\let\ptexrbrace=\}
  99\let\ptexslash=\/
 100\let\ptexstar=\*
 101\let\ptext=\t
 102
 103% If this character appears in an error message or help string, it
 104% starts a new line in the output.
 105\newlinechar = `^^J
 106
 107% Use TeX 3.0's \inputlineno to get the line number, for better error
 108% messages, but if we're using an old version of TeX, don't do anything.
 109%
 110\ifx\inputlineno\thisisundefined
 111  \let\linenumber = \empty % Pre-3.0.
 112\else
 113  \def\linenumber{l.\the\inputlineno:\space}
 114\fi
 115
 116% Set up fixed words for English if not already set.
 117\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 118\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
 119\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
 120\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
 121\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
 122\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
 123\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
 124\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
 125\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
 126\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
 127\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
 128\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
 129\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
 130\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
 131\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
 132\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
 133\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
 134\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
 135\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
 136%
 137\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
 138\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
 139\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
 140\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
 141\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
 142\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
 143\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
 144\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
 145\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
 146\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
 147\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
 148\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
 149%
 150\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
 151\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
 152\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
 153\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
 154\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
 155
 156% In some macros, we cannot use the `\? notation---the left quote is
 157% in some cases the escape char.
 158\chardef\backChar  = `\\
 159\chardef\colonChar = `\:
 160\chardef\commaChar = `\,
 161\chardef\dotChar   = `\.
 162\chardef\exclamChar= `\!
 163\chardef\plusChar  = `\+
 164\chardef\questChar = `\?
 165\chardef\semiChar  = `\;
 166\chardef\underChar = `\_
 167
 168\chardef\spaceChar = `\ %
 169\chardef\spacecat = 10
 170\def\spaceisspace{\catcode\spaceChar=\spacecat}
 171
 172{% for help with debugging.
 173 % example usage: \expandafter\show\activebackslash
 174 \catcode`\! = 0 \catcode`\\ = \active
 175 !global!def!activebackslash{\}
 176}
 177
 178% Ignore a token.
 179%
 180\def\gobble#1{}
 181
 182% The following is used inside several \edef's.
 183\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
 184
 185% Hyphenation fixes.
 186\hyphenation{
 187  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
 188  ap-pen-dix bit-map bit-maps
 189  data-base data-bases eshell fall-ing half-way long-est man-u-script
 190  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
 191  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
 192  spell-ing spell-ings
 193  stand-alone strong-est time-stamp time-stamps which-ever white-space
 194  wide-spread wrap-around
 195}
 196
 197% Margin to add to right of even pages, to left of odd pages.
 198\newdimen\bindingoffset
 199\newdimen\normaloffset
 200\newdimen\pagewidth \newdimen\pageheight
 201
 202% For a final copy, take out the rectangles
 203% that mark overfull boxes (in case you have decided
 204% that the text looks ok even though it passes the margin).
 205%
 206\def\finalout{\overfullrule=0pt}
 207
 208% @| inserts a changebar to the left of the current line.  It should
 209% surround any changed text.  This approach does *not* work if the
 210% change spans more than two lines of output.  To handle that, we would
 211% have adopt a much more difficult approach (putting marks into the main
 212% vertical list for the beginning and end of each change).
 213%
 214\def\|{%
 215  % \vadjust can only be used in horizontal mode.
 216  \leavevmode
 217  %
 218  % Append this vertical mode material after the current line in the output.
 219  \vadjust{%
 220    % We want to insert a rule with the height and depth of the current
 221    % leading; that is exactly what \strutbox is supposed to record.
 222    \vskip-\baselineskip
 223    %
 224    % \vadjust-items are inserted at the left edge of the type.  So
 225    % the \llap here moves out into the left-hand margin.
 226    \llap{%
 227      %
 228      % For a thicker or thinner bar, change the `1pt'.
 229      \vrule height\baselineskip width1pt
 230      %
 231      % This is the space between the bar and the text.
 232      \hskip 12pt
 233    }%
 234  }%
 235}
 236
 237% Sometimes it is convenient to have everything in the transcript file
 238% and nothing on the terminal.  We don't just call \tracingall here,
 239% since that produces some useless output on the terminal.  We also make
 240% some effort to order the tracing commands to reduce output in the log
 241% file; cf. trace.sty in LaTeX.
 242%
 243\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
 244\def\loggingall{%
 245  \tracingstats2
 246  \tracingpages1
 247  \tracinglostchars2  % 2 gives us more in etex
 248  \tracingparagraphs1
 249  \tracingoutput1
 250  \tracingmacros2
 251  \tracingrestores1
 252  \showboxbreadth\maxdimen \showboxdepth\maxdimen
 253  \ifx\eTeXversion\undefined\else % etex gives us more logging
 254    \tracingscantokens1
 255    \tracingifs1
 256    \tracinggroups1
 257    \tracingnesting2
 258    \tracingassigns1
 259  \fi
 260  \tracingcommands3  % 3 gives us more in etex
 261  \errorcontextlines16
 262}%
 263
 264% add check for \lastpenalty to plain's definitions.  If the last thing
 265% we did was a \nobreak, we don't want to insert more space.
 266%
 267\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
 268  \removelastskip\penalty-50\smallskip\fi\fi}
 269\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
 270  \removelastskip\penalty-100\medskip\fi\fi}
 271\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
 272  \removelastskip\penalty-200\bigskip\fi\fi}
 273
 274% For @cropmarks command.
 275% Do @cropmarks to get crop marks.
 276%
 277\newif\ifcropmarks
 278\let\cropmarks = \cropmarkstrue
 279%
 280% Dimensions to add cropmarks at corners.
 281% Added by P. A. MacKay, 12 Nov. 1986
 282%
 283\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
 284\newdimen\cornerlong  \cornerlong=1pc
 285\newdimen\cornerthick \cornerthick=.3pt
 286\newdimen\topandbottommargin \topandbottommargin=.75in
 287
 288% Main output routine.
 289\chardef\PAGE = 255
 290\output = {\onepageout{\pagecontents\PAGE}}
 291
 292\newbox\headlinebox
 293\newbox\footlinebox
 294
 295% \onepageout takes a vbox as an argument.  Note that \pagecontents
 296% does insertions, but you have to call it yourself.
 297\def\onepageout#1{%
 298  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
 299  %
 300  \ifodd\pageno  \advance\hoffset by \bindingoffset
 301  \else \advance\hoffset by -\bindingoffset\fi
 302  %
 303  % Do this outside of the \shipout so @code etc. will be expanded in
 304  % the headline as they should be, not taken literally (outputting ''code).
 305  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
 306  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
 307  %
 308  {%
 309    % Have to do this stuff outside the \shipout because we want it to
 310    % take effect in \write's, yet the group defined by the \vbox ends
 311    % before the \shipout runs.
 312    %
 313    \indexdummies         % don't expand commands in the output.
 314    \shipout\vbox{%
 315      % Do this early so pdf references go to the beginning of the page.
 316      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
 317      %
 318      \ifcropmarks \vbox to \outervsize\bgroup
 319        \hsize = \outerhsize
 320        \vskip-\topandbottommargin
 321        \vtop to0pt{%
 322          \line{\ewtop\hfil\ewtop}%
 323          \nointerlineskip
 324          \line{%
 325            \vbox{\moveleft\cornerthick\nstop}%
 326            \hfill
 327            \vbox{\moveright\cornerthick\nstop}%
 328          }%
 329          \vss}%
 330        \vskip\topandbottommargin
 331        \line\bgroup
 332          \hfil % center the page within the outer (page) hsize.
 333          \ifodd\pageno\hskip\bindingoffset\fi
 334          \vbox\bgroup
 335      \fi
 336      %
 337      \unvbox\headlinebox
 338      \pagebody{#1}%
 339      \ifdim\ht\footlinebox > 0pt
 340        % Only leave this space if the footline is nonempty.
 341        % (We lessened \vsize for it in \oddfootingxxx.)
 342        % The \baselineskip=24pt in plain's \makefootline has no effect.
 343        \vskip 2\baselineskip
 344        \unvbox\footlinebox
 345      \fi
 346      %
 347      \ifcropmarks
 348          \egroup % end of \vbox\bgroup
 349        \hfil\egroup % end of (centering) \line\bgroup
 350        \vskip\topandbottommargin plus1fill minus1fill
 351        \boxmaxdepth = \cornerthick
 352        \vbox to0pt{\vss
 353          \line{%
 354            \vbox{\moveleft\cornerthick\nsbot}%
 355            \hfill
 356            \vbox{\moveright\cornerthick\nsbot}%
 357          }%
 358          \nointerlineskip
 359          \line{\ewbot\hfil\ewbot}%
 360        }%
 361      \egroup % \vbox from first cropmarks clause
 362      \fi
 363    }% end of \shipout\vbox
 364  }% end of group with \indexdummies
 365  \advancepageno
 366  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
 367}
 368
 369\newinsert\margin \dimen\margin=\maxdimen
 370
 371\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
 372{\catcode`\@ =11
 373\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
 374% marginal hacks, juha@viisa.uucp (Juha Takala)
 375\ifvoid\margin\else % marginal info is present
 376  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
 377\dimen@=\dp#1 \unvbox#1
 378\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
 379\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
 380}
 381
 382% Here are the rules for the cropmarks.  Note that they are
 383% offset so that the space between them is truly \outerhsize or \outervsize
 384% (P. A. MacKay, 12 November, 1986)
 385%
 386\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
 387\def\nstop{\vbox
 388  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
 389\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
 390\def\nsbot{\vbox
 391  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
 392
 393% Parse an argument, then pass it to #1.  The argument is the rest of
 394% the input line (except we remove a trailing comment).  #1 should be a
 395% macro which expects an ordinary undelimited TeX argument.
 396%
 397\def\parsearg{\parseargusing{}}
 398\def\parseargusing#1#2{%
 399  \def\next{#2}%
 400  \begingroup
 401    \obeylines
 402    \spaceisspace
 403    #1%
 404    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
 405}
 406
 407{\obeylines %
 408  \gdef\parseargline#1^^M{%
 409    \endgroup % End of the group started in \parsearg.
 410    \argremovecomment #1\comment\ArgTerm%
 411  }%
 412}
 413
 414% First remove any @comment, then any @c comment.
 415\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
 416\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
 417
 418% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
 419%
 420% \argremovec might leave us with trailing space, e.g.,
 421%    @end itemize  @c foo
 422% This space token undergoes the same procedure and is eventually removed
 423% by \finishparsearg.
 424%
 425\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
 426\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
 427\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
 428  \def\temp{#3}%
 429  \ifx\temp\empty
 430    % We cannot use \next here, as it holds the macro to run;
 431    % thus we reuse \temp.
 432    \let\temp\finishparsearg
 433  \else
 434    \let\temp\argcheckspaces
 435  \fi
 436  % Put the space token in:
 437  \temp#1 #3\ArgTerm
 438}
 439
 440% If a _delimited_ argument is enclosed in braces, they get stripped; so
 441% to get _exactly_ the rest of the line, we had to prevent such situation.
 442% We prepended an \empty token at the very beginning and we expand it now,
 443% just before passing the control to \next.
 444% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
 445% either the null string, or it ends with \^^M---thus there is no danger
 446% that a pair of braces would be stripped.
 447%
 448% But first, we have to remove the trailing space token.
 449%
 450\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
 451
 452% \parseargdef\foo{...}
 453%	is roughly equivalent to
 454% \def\foo{\parsearg\Xfoo}
 455% \def\Xfoo#1{...}
 456%
 457% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
 458% favourite TeX trick.  --kasal, 16nov03
 459
 460\def\parseargdef#1{%
 461  \expandafter \doparseargdef \csname\string#1\endcsname #1%
 462}
 463\def\doparseargdef#1#2{%
 464  \def#2{\parsearg#1}%
 465  \def#1##1%
 466}
 467
 468% Several utility definitions with active space:
 469{
 470  \obeyspaces
 471  \gdef\obeyedspace{ }
 472
 473  % Make each space character in the input produce a normal interword
 474  % space in the output.  Don't allow a line break at this space, as this
 475  % is used only in environments like @example, where each line of input
 476  % should produce a line of output anyway.
 477  %
 478  \gdef\sepspaces{\obeyspaces\let =\tie}
 479
 480  % If an index command is used in an @example environment, any spaces
 481  % therein should become regular spaces in the raw index file, not the
 482  % expansion of \tie (\leavevmode \penalty \@M \ ).
 483  \gdef\unsepspaces{\let =\space}
 484}
 485
 486
 487\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
 488
 489% Define the framework for environments in texinfo.tex.  It's used like this:
 490%
 491%   \envdef\foo{...}
 492%   \def\Efoo{...}
 493%
 494% It's the responsibility of \envdef to insert \begingroup before the
 495% actual body; @end closes the group after calling \Efoo.  \envdef also
 496% defines \thisenv, so the current environment is known; @end checks
 497% whether the environment name matches.  The \checkenv macro can also be
 498% used to check whether the current environment is the one expected.
 499%
 500% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
 501% are not treated as enviroments; they don't open a group.  (The
 502% implementation of @end takes care not to call \endgroup in this
 503% special case.)
 504
 505
 506% At runtime, environments start with this:
 507\def\startenvironment#1{\begingroup\def\thisenv{#1}}
 508% initialize
 509\let\thisenv\empty
 510
 511% ... but they get defined via ``\envdef\foo{...}'':
 512\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
 513\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
 514
 515% Check whether we're in the right environment:
 516\def\checkenv#1{%
 517  \def\temp{#1}%
 518  \ifx\thisenv\temp
 519  \else
 520    \badenverr
 521  \fi
 522}
 523
 524% Evironment mismatch, #1 expected:
 525\def\badenverr{%
 526  \errhelp = \EMsimple
 527  \errmessage{This command can appear only \inenvironment\temp,
 528    not \inenvironment\thisenv}%
 529}
 530\def\inenvironment#1{%
 531  \ifx#1\empty
 532    out of any environment%
 533  \else
 534    in environment \expandafter\string#1%
 535  \fi
 536}
 537
 538% @end foo executes the definition of \Efoo.
 539% But first, it executes a specialized version of \checkenv
 540%
 541\parseargdef\end{%
 542  \if 1\csname iscond.#1\endcsname
 543  \else
 544    % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
 545    \expandafter\checkenv\csname#1\endcsname
 546    \csname E#1\endcsname
 547    \endgroup
 548  \fi
 549}
 550
 551\newhelp\EMsimple{Press RETURN to continue.}
 552
 553
 554%% Simple single-character @ commands
 555
 556% @@ prints an @
 557% Kludge this until the fonts are right (grr).
 558\def\@{{\tt\char64}}
 559
 560% This is turned off because it was never documented
 561% and you can use @w{...} around a quote to suppress ligatures.
 562%% Define @` and @' to be the same as ` and '
 563%% but suppressing ligatures.
 564%\def\`{{`}}
 565%\def\'{{'}}
 566
 567% Used to generate quoted braces.
 568\def\mylbrace {{\tt\char123}}
 569\def\myrbrace {{\tt\char125}}
 570\let\{=\mylbrace
 571\let\}=\myrbrace
 572\begingroup
 573  % Definitions to produce \{ and \} commands for indices,
 574  % and @{ and @} for the aux/toc files.
 575  \catcode`\{ = \other \catcode`\} = \other
 576  \catcode`\[ = 1 \catcode`\] = 2
 577  \catcode`\! = 0 \catcode`\\ = \other
 578  !gdef!lbracecmd[\{]%
 579  !gdef!rbracecmd[\}]%
 580  !gdef!lbraceatcmd[@{]%
 581  !gdef!rbraceatcmd[@}]%
 582!endgroup
 583
 584% @comma{} to avoid , parsing problems.
 585\let\comma = ,
 586
 587% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
 588% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 589\let\, = \c
 590\let\dotaccent = \.
 591\def\ringaccent#1{{\accent23 #1}}
 592\let\tieaccent = \t
 593\let\ubaraccent = \b
 594\let\udotaccent = \d
 595
 596% Other special characters: @questiondown @exclamdown @ordf @ordm
 597% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 598\def\questiondown{?`}
 599\def\exclamdown{!`}
 600\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
 601\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
 602
 603% Dotless i and dotless j, used for accents.
 604\def\imacro{i}
 605\def\jmacro{j}
 606\def\dotless#1{%
 607  \def\temp{#1}%
 608  \ifx\temp\imacro \ptexi
 609  \else\ifx\temp\jmacro \j
 610  \else \errmessage{@dotless can be used only with i or j}%
 611  \fi\fi
 612}
 613
 614% The \TeX{} logo, as in plain, but resetting the spacing so that a
 615% period following counts as ending a sentence.  (Idea found in latex.)
 616%
 617\edef\TeX{\TeX \spacefactor=1000 }
 618
 619% @LaTeX{} logo.  Not quite the same results as the definition in
 620% latex.ltx, since we use a different font for the raised A; it's most
 621% convenient for us to use an explicitly smaller font, rather than using
 622% the \scriptstyle font (since we don't reset \scriptstyle and
 623% \scriptscriptstyle).
 624%
 625\def\LaTeX{%
 626  L\kern-.36em
 627  {\setbox0=\hbox{T}%
 628   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
 629  \kern-.15em
 630  \TeX
 631}
 632
 633% Be sure we're in horizontal mode when doing a tie, since we make space
 634% equivalent to this in @example-like environments. Otherwise, a space
 635% at the beginning of a line will start with \penalty -- and
 636% since \penalty is valid in vertical mode, we'd end up putting the
 637% penalty on the vertical list instead of in the new paragraph.
 638{\catcode`@ = 11
 639 % Avoid using \@M directly, because that causes trouble
 640 % if the definition is written into an index file.
 641 \global\let\tiepenalty = \@M
 642 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
 643}
 644
 645% @: forces normal size whitespace following.
 646\def\:{\spacefactor=1000 }
 647
 648% @* forces a line break.
 649\def\*{\hfil\break\hbox{}\ignorespaces}
 650
 651% @/ allows a line break.
 652\let\/=\allowbreak
 653
 654% @. is an end-of-sentence period.
 655\def\.{.\spacefactor=\endofsentencespacefactor\space}
 656
 657% @! is an end-of-sentence bang.
 658\def\!{!\spacefactor=\endofsentencespacefactor\space}
 659
 660% @? is an end-of-sentence query.
 661\def\?{?\spacefactor=\endofsentencespacefactor\space}
 662
 663% @frenchspacing on|off  says whether to put extra space after punctuation.
 664% 
 665\def\onword{on}
 666\def\offword{off}
 667%
 668\parseargdef\frenchspacing{%
 669  \def\temp{#1}%
 670  \ifx\temp\onword \plainfrenchspacing
 671  \else\ifx\temp\offword \plainnonfrenchspacing
 672  \else
 673    \errhelp = \EMsimple
 674    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
 675  \fi\fi
 676}
 677
 678% @w prevents a word break.  Without the \leavevmode, @w at the
 679% beginning of a paragraph, when TeX is still in vertical mode, would
 680% produce a whole line of output instead of starting the paragraph.
 681\def\w#1{\leavevmode\hbox{#1}}
 682
 683% @group ... @end group forces ... to be all on one page, by enclosing
 684% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
 685% to keep its height that of a normal line.  According to the rules for
 686% \topskip (p.114 of the TeXbook), the glue inserted is
 687% max (\topskip - \ht (first item), 0).  If that height is large,
 688% therefore, no glue is inserted, and the space between the headline and
 689% the text is small, which looks bad.
 690%
 691% Another complication is that the group might be very large.  This can
 692% cause the glue on the previous page to be unduly stretched, because it
 693% does not have much material.  In this case, it's better to add an
 694% explicit \vfill so that the extra space is at the bottom.  The
 695% threshold for doing this is if the group is more than \vfilllimit
 696% percent of a page (\vfilllimit can be changed inside of @tex).
 697%
 698\newbox\groupbox
 699\def\vfilllimit{0.7}
 700%
 701\envdef\group{%
 702  \ifnum\catcode`\^^M=\active \else
 703    \errhelp = \groupinvalidhelp
 704    \errmessage{@group invalid in context where filling is enabled}%
 705  \fi
 706  \startsavinginserts
 707  %
 708  \setbox\groupbox = \vtop\bgroup
 709    % Do @comment since we are called inside an environment such as
 710    % @example, where each end-of-line in the input causes an
 711    % end-of-line in the output.  We don't want the end-of-line after
 712    % the `@group' to put extra space in the output.  Since @group
 713    % should appear on a line by itself (according to the Texinfo
 714    % manual), we don't worry about eating any user text.
 715    \comment
 716}
 717%
 718% The \vtop produces a box with normal height and large depth; thus, TeX puts
 719% \baselineskip glue before it, and (when the next line of text is done)
 720% \lineskip glue after it.  Thus, space below is not quite equal to space
 721% above.  But it's pretty close.
 722\def\Egroup{%
 723    % To get correct interline space between the last line of the group
 724    % and the first line afterwards, we have to propagate \prevdepth.
 725    \endgraf % Not \par, as it may have been set to \lisppar.
 726    \global\dimen1 = \prevdepth
 727  \egroup           % End the \vtop.
 728  % \dimen0 is the vertical size of the group's box.
 729  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
 730  % \dimen2 is how much space is left on the page (more or less).
 731  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
 732  % if the group doesn't fit on the current page, and it's a big big
 733  % group, force a page break.
 734  \ifdim \dimen0 > \dimen2
 735    \ifdim \pagetotal < \vfilllimit\pageheight
 736      \page
 737    \fi
 738  \fi
 739  \box\groupbox
 740  \prevdepth = \dimen1
 741  \checkinserts
 742}
 743%
 744% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
 745% message, so this ends up printing `@group can only ...'.
 746%
 747\newhelp\groupinvalidhelp{%
 748group can only be used in environments such as @example,^^J%
 749where each line of input produces a line of output.}
 750
 751% @need space-in-mils
 752% forces a page break if there is not space-in-mils remaining.
 753
 754\newdimen\mil  \mil=0.001in
 755
 756% Old definition--didn't work.
 757%\parseargdef\need{\par %
 758%% This method tries to make TeX break the page naturally
 759%% if the depth of the box does not fit.
 760%{\baselineskip=0pt%
 761%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
 762%\prevdepth=-1000pt
 763%}}
 764
 765\parseargdef\need{%
 766  % Ensure vertical mode, so we don't make a big box in the middle of a
 767  % paragraph.
 768  \par
 769  %
 770  % If the @need value is less than one line space, it's useless.
 771  \dimen0 = #1\mil
 772  \dimen2 = \ht\strutbox
 773  \advance\dimen2 by \dp\strutbox
 774  \ifdim\dimen0 > \dimen2
 775    %
 776    % Do a \strut just to make the height of this box be normal, so the
 777    % normal leading is inserted relative to the preceding line.
 778    % And a page break here is fine.
 779    \vtop to #1\mil{\strut\vfil}%
 780    %
 781    % TeX does not even consider page breaks if a penalty added to the
 782    % main vertical list is 10000 or more.  But in order to see if the
 783    % empty box we just added fits on the page, we must make it consider
 784    % page breaks.  On the other hand, we don't want to actually break the
 785    % page after the empty box.  So we use a penalty of 9999.
 786    %
 787    % There is an extremely small chance that TeX will actually break the
 788    % page at this \penalty, if there are no other feasible breakpoints in
 789    % sight.  (If the user is using lots of big @group commands, which
 790    % almost-but-not-quite fill up a page, TeX will have a hard time doing
 791    % good page breaking, for example.)  However, I could not construct an
 792    % example where a page broke at this \penalty; if it happens in a real
 793    % document, then we can reconsider our strategy.
 794    \penalty9999
 795    %
 796    % Back up by the size of the box, whether we did a page break or not.
 797    \kern -#1\mil
 798    %
 799    % Do not allow a page break right after this kern.
 800    \nobreak
 801  \fi
 802}
 803
 804% @br   forces paragraph break (and is undocumented).
 805
 806\let\br = \par
 807
 808% @page forces the start of a new page.
 809%
 810\def\page{\par\vfill\supereject}
 811
 812% @exdent text....
 813% outputs text on separate line in roman font, starting at standard page margin
 814
 815% This records the amount of indent in the innermost environment.
 816% That's how much \exdent should take out.
 817\newskip\exdentamount
 818
 819% This defn is used inside fill environments such as @defun.
 820\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
 821
 822% This defn is used inside nofill environments such as @example.
 823\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
 824  \leftline{\hskip\leftskip{\rm#1}}}}
 825
 826% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
 827% paragraph.  For more general purposes, use the \margin insertion
 828% class.  WHICH is `l' or `r'.
 829%
 830\newskip\inmarginspacing \inmarginspacing=1cm
 831\def\strutdepth{\dp\strutbox}
 832%
 833\def\doinmargin#1#2{\strut\vadjust{%
 834  \nobreak
 835  \kern-\strutdepth
 836  \vtop to \strutdepth{%
 837    \baselineskip=\strutdepth
 838    \vss
 839    % if you have multiple lines of stuff to put here, you'll need to
 840    % make the vbox yourself of the appropriate size.
 841    \ifx#1l%
 842      \llap{\ignorespaces #2\hskip\inmarginspacing}%
 843    \else
 844      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
 845    \fi
 846    \null
 847  }%
 848}}
 849\def\inleftmargin{\doinmargin l}
 850\def\inrightmargin{\doinmargin r}
 851%
 852% @inmargin{TEXT [, RIGHT-TEXT]}
 853% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
 854% else use TEXT for both).
 855%
 856\def\inmargin#1{\parseinmargin #1,,\finish}
 857\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
 858  \setbox0 = \hbox{\ignorespaces #2}%
 859  \ifdim\wd0 > 0pt
 860    \def\lefttext{#1}%  have both texts
 861    \def\righttext{#2}%
 862  \else
 863    \def\lefttext{#1}%  have only one text
 864    \def\righttext{#1}%
 865  \fi
 866  %
 867  \ifodd\pageno
 868    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
 869  \else
 870    \def\temp{\inleftmargin\lefttext}%
 871  \fi
 872  \temp
 873}
 874
 875% @include file    insert text of that file as input.
 876%
 877\def\include{\parseargusing\filenamecatcodes\includezzz}
 878\def\includezzz#1{%
 879  \pushthisfilestack
 880  \def\thisfile{#1}%
 881  {%
 882    \makevalueexpandable
 883    \def\temp{\input #1 }%
 884    \expandafter
 885  }\temp
 886  \popthisfilestack
 887}
 888\def\filenamecatcodes{%
 889  \catcode`\\=\other
 890  \catcode`~=\other
 891  \catcode`^=\other
 892  \catcode`_=\other
 893  \catcode`|=\other
 894  \catcode`<=\other
 895  \catcode`>=\other
 896  \catcode`+=\other
 897  \catcode`-=\other
 898}
 899
 900\def\pushthisfilestack{%
 901  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
 902}
 903\def\pushthisfilestackX{%
 904  \expandafter\pushthisfilestackY\thisfile\StackTerm
 905}
 906\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
 907  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
 908}
 909
 910\def\popthisfilestack{\errthisfilestackempty}
 911\def\errthisfilestackempty{\errmessage{Internal error:
 912  the stack of filenames is empty.}}
 913
 914\def\thisfile{}
 915
 916% @center line
 917% outputs that line, centered.
 918%
 919\parseargdef\center{%
 920  \ifhmode
 921    \let\next\centerH
 922  \else
 923    \let\next\centerV
 924  \fi
 925  \next{\hfil \ignorespaces#1\unskip \hfil}%
 926}
 927\def\centerH#1{%
 928  {%
 929    \hfil\break
 930    \advance\hsize by -\leftskip
 931    \advance\hsize by -\rightskip
 932    \line{#1}%
 933    \break
 934  }%
 935}
 936\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
 937
 938% @sp n   outputs n lines of vertical space
 939
 940\parseargdef\sp{\vskip #1\baselineskip}
 941
 942% @comment ...line which is ignored...
 943% @c is the same as @comment
 944% @ignore ... @end ignore  is another way to write a comment
 945
 946\def\comment{\begingroup \catcode`\^^M=\other%
 947\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
 948\commentxxx}
 949{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
 950
 951\let\c=\comment
 952
 953% @paragraphindent NCHARS
 954% We'll use ems for NCHARS, close enough.
 955% NCHARS can also be the word `asis' or `none'.
 956% We cannot feasibly implement @paragraphindent asis, though.
 957%
 958\def\asisword{asis} % no translation, these are keywords
 959\def\noneword{none}
 960%
 961\parseargdef\paragraphindent{%
 962  \def\temp{#1}%
 963  \ifx\temp\asisword
 964  \else
 965    \ifx\temp\noneword
 966      \defaultparindent = 0pt
 967    \else
 968      \defaultparindent = #1em
 969    \fi
 970  \fi
 971  \parindent = \defaultparindent
 972}
 973
 974% @exampleindent NCHARS
 975% We'll use ems for NCHARS like @paragraphindent.
 976% It seems @exampleindent asis isn't necessary, but
 977% I preserve it to make it similar to @paragraphindent.
 978\parseargdef\exampleindent{%
 979  \def\temp{#1}%
 980  \ifx\temp\asisword
 981  \else
 982    \ifx\temp\noneword
 983      \lispnarrowing = 0pt
 984    \else
 985      \lispnarrowing = #1em
 986    \fi
 987  \fi
 988}
 989
 990% @firstparagraphindent WORD
 991% If WORD is `none', then suppress indentation of the first paragraph
 992% after a section heading.  If WORD is `insert', then do indent at such
 993% paragraphs.
 994%
 995% The paragraph indentation is suppressed or not by calling
 996% \suppressfirstparagraphindent, which the sectioning commands do.
 997% We switch the definition of this back and forth according to WORD.
 998% By default, we suppress indentation.
 999%
1000\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1001\def\insertword{insert}
1002%
1003\parseargdef\firstparagraphindent{%
1004  \def\temp{#1}%
1005  \ifx\temp\noneword
1006    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1007  \else\ifx\temp\insertword
1008    \let\suppressfirstparagraphindent = \relax
1009  \else
1010    \errhelp = \EMsimple
1011    \errmessage{Unknown @firstparagraphindent option `\temp'}%
1012  \fi\fi
1013}
1014
1015% Here is how we actually suppress indentation.  Redefine \everypar to
1016% \kern backwards by \parindent, and then reset itself to empty.
1017%
1018% We also make \indent itself not actually do anything until the next
1019% paragraph.
1020%
1021\gdef\dosuppressfirstparagraphindent{%
1022  \gdef\indent{%
1023    \restorefirstparagraphindent
1024    \indent
1025  }%
1026  \gdef\noindent{%
1027    \restorefirstparagraphindent
1028    \noindent
1029  }%
1030  \global\everypar = {%
1031    \kern -\parindent
1032    \restorefirstparagraphindent
1033  }%
1034}
1035
1036\gdef\restorefirstparagraphindent{%
1037  \global \let \indent = \ptexindent
1038  \global \let \noindent = \ptexnoindent
1039  \global \everypar = {}%
1040}
1041
1042
1043% @asis just yields its argument.  Used with @table, for example.
1044%
1045\def\asis#1{#1}
1046
1047% @math outputs its argument in math mode.
1048%
1049% One complication: _ usually means subscripts, but it could also mean
1050% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
1051% _ active, and distinguish by seeing if the current family is \slfam,
1052% which is what @var uses.
1053{
1054  \catcode\underChar = \active
1055  \gdef\mathunderscore{%
1056    \catcode\underChar=\active
1057    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1058  }
1059}
1060% Another complication: we want \\ (and @\) to output a \ character.
1061% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
1062% this is not advertised and we don't care.  Texinfo does not
1063% otherwise define @\.
1064%
1065% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
1066\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
1067%
1068\def\math{%
1069  \tex
1070  \mathunderscore
1071  \let\\ = \mathbackslash
1072  \mathactive
1073  $\finishmath
1074}
1075\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
1076
1077% Some active characters (such as <) are spaced differently in math.
1078% We have to reset their definitions in case the @math was an argument
1079% to a command which sets the catcodes (such as @item or @section).
1080%
1081{
1082  \catcode`^ = \active
1083  \catcode`< = \active
1084  \catcode`> = \active
1085  \catcode`+ = \active
1086  \gdef\mathactive{%
1087    \let^ = \ptexhat
1088    \let< = \ptexless
1089    \let> = \ptexgtr
1090    \let+ = \ptexplus
1091  }
1092}
1093
1094% @bullet and @minus need the same treatment as @math, just above.
1095\def\bullet{$\ptexbullet$}
1096\def\minus{$-$}
1097
1098% @dots{} outputs an ellipsis using the current font.
1099% We do .5em per period so that it has the same spacing in a typewriter
1100% font as three actual period characters.
1101%
1102\def\dots{%
1103  \leavevmode
1104  \hbox to 1.5em{%
1105    \hskip 0pt plus 0.25fil
1106    .\hfil.\hfil.%
1107    \hskip 0pt plus 0.5fil
1108  }%
1109}
1110
1111% @enddots{} is an end-of-sentence ellipsis.
1112%
1113\def\enddots{%
1114  \dots
1115  \spacefactor=\endofsentencespacefactor
1116}
1117
1118% @comma{} is so commas can be inserted into text without messing up
1119% Texinfo's parsing.
1120%
1121\let\comma = ,
1122
1123% @refill is a no-op.
1124\let\refill=\relax
1125
1126% If working on a large document in chapters, it is convenient to
1127% be able to disable indexing, cross-referencing, and contents, for test runs.
1128% This is done with @novalidate (before @setfilename).
1129%
1130\newif\iflinks \linkstrue % by default we want the aux files.
1131\let\novalidate = \linksfalse
1132
1133% @setfilename is done at the beginning of every texinfo file.
1134% So open here the files we need to have open while reading the input.
1135% This makes it possible to make a .fmt file for texinfo.
1136\def\setfilename{%
1137   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
1138   \iflinks
1139     \tryauxfile
1140     % Open the new aux file.  TeX will close it automatically at exit.
1141     \immediate\openout\auxfile=\jobname.aux
1142   \fi % \openindices needs to do some work in any case.
1143   \openindices
1144   \let\setfilename=\comment % Ignore extra @setfilename cmds.
1145   %
1146   % If texinfo.cnf is present on the system, read it.
1147   % Useful for site-wide @afourpaper, etc.
1148   \openin 1 texinfo.cnf
1149   \ifeof 1 \else \input texinfo.cnf \fi
1150   \closein 1
1151   %
1152   \comment % Ignore the actual filename.
1153}
1154
1155% Called from \setfilename.
1156%
1157\def\openindices{%
1158  \newindex{cp}%
1159  \newcodeindex{fn}%
1160  \newcodeindex{vr}%
1161  \newcodeindex{tp}%
1162  \newcodeindex{ky}%
1163  \newcodeindex{pg}%
1164}
1165
1166% @bye.
1167\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1168
1169
1170\message{pdf,}
1171% adobe `portable' document format
1172\newcount\tempnum
1173\newcount\lnkcount
1174\newtoks\filename
1175\newcount\filenamelength
1176\newcount\pgn
1177\newtoks\toksA
1178\newtoks\toksB
1179\newtoks\toksC
1180\newtoks\toksD
1181\newbox\boxA
1182\newcount\countA
1183\newif\ifpdf
1184\newif\ifpdfmakepagedest
1185
1186% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1187% can be set).  So we test for \relax and 0 as well as \undefined,
1188% borrowed from ifpdf.sty.
1189\ifx\pdfoutput\undefined
1190\else
1191  \ifx\pdfoutput\relax
1192  \else
1193    \ifcase\pdfoutput
1194    \else
1195      \pdftrue
1196    \fi
1197  \fi
1198\fi
1199
1200% PDF uses PostScript string constants for the names of xref targets, to
1201% for display in the outlines, and in other places.  Thus, we have to
1202% double any backslashes.  Otherwise, a name like "\node" will be
1203% interpreted as a newline (\n), followed by o, d, e.  Not good.
1204% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
1205% (and related messages, the final outcome is that it is up to the TeX
1206% user to double the backslashes and otherwise make the string valid, so
1207% that's we do).
1208
1209% double active backslashes.
1210% 
1211{\catcode`\@=0 \catcode`\\=\active
1212 @gdef@activebackslash{@catcode`@\=@active @otherbackslash}
1213 @gdef@activebackslashdouble{%
1214   @catcode@backChar=@active
1215   @let\=@doublebackslash}
1216}
1217
1218% To handle parens, we must adopt a different approach, since parens are
1219% not active characters.  hyperref.dtx (which has the same problem as
1220% us) handles it with this amazing macro to replace tokens.  I've
1221% tinkered with it a little for texinfo, but it's definitely from there.
1222% 
1223% #1 is the tokens to replace.
1224% #2 is the replacement.
1225% #3 is the control sequence with the string.
1226% 
1227\def\HyPsdSubst#1#2#3{%
1228  \def\HyPsdReplace##1#1##2\END{%
1229    ##1%
1230    \ifx\\##2\\%
1231    \else
1232      #2%
1233      \HyReturnAfterFi{%
1234        \HyPsdReplace##2\END
1235      }%
1236    \fi
1237  }%
1238  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
1239}
1240\long\def\HyReturnAfterFi#1\fi{\fi#1}
1241
1242% #1 is a control sequence in which to do the replacements.
1243\def\backslashparens#1{%
1244  \xdef#1{#1}% redefine it as its expansion; the definition is simply
1245             % \lastnode when called from \setref -> \pdfmkdest.
1246  \HyPsdSubst{(}{\backslashlparen}{#1}%
1247  \HyPsdSubst{)}{\backslashrparen}{#1}%
1248}
1249
1250{\catcode\exclamChar = 0 \catcode\backChar = \other
1251 !gdef!backslashlparen{\(}%
1252 !gdef!backslashrparen{\)}%
1253}
1254
1255\ifpdf
1256  \input pdfcolor
1257  \pdfcatalog{/PageMode /UseOutlines}%
1258  \def\dopdfimage#1#2#3{%
1259    \def\imagewidth{#2}%
1260    \def\imageheight{#3}%
1261    % without \immediate, pdftex seg faults when the same image is
1262    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
1263    \ifnum\pdftexversion < 14
1264      \immediate\pdfimage
1265    \else
1266      \immediate\pdfximage
1267    \fi
1268      \ifx\empty\imagewidth\else width \imagewidth \fi
1269      \ifx\empty\imageheight\else height \imageheight \fi
1270      \ifnum\pdftexversion<13
1271         #1.pdf%
1272       \else
1273         {#1.pdf}%
1274       \fi
1275    \ifnum\pdftexversion < 14 \else
1276      \pdfrefximage \pdflastximage
1277    \fi}
1278  \def\pdfmkdest#1{{%
1279    % We have to set dummies so commands such as @code, and characters
1280    % such as \, aren't expanded when present in a section title.
1281    \atdummies
1282    \activebackslashdouble
1283    \def\pdfdestname{#1}%
1284    \backslashparens\pdfdestname
1285    \pdfdest name{\pdfdestname} xyz%
1286  }}%
1287  %
1288  % used to mark target names; must be expandable.
1289  \def\pdfmkpgn#1{#1}%
1290  %
1291  \let\linkcolor = \Blue  % was Cyan, but that seems light?
1292  \def\endlink{\Black\pdfendlink}
1293  % Adding outlines to PDF; macros for calculating structure of outlines
1294  % come from Petr Olsak
1295  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1296    \else \csname#1\endcsname \fi}
1297  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1298    \advance\tempnum by 1
1299    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1300  %
1301  % #1 is the section text, which is what will be displayed in the
1302  % outline by the pdf viewer.  #2 is the pdf expression for the number
1303  % of subentries (or empty, for subsubsections).  #3 is the node text,
1304  % which might be empty if this toc entry had no corresponding node.
1305  % #4 is the page number
1306  %
1307  \def\dopdfoutline#1#2#3#4{%
1308    % Generate a link to the node text if that exists; else, use the
1309    % page number.  We could generate a destination for the section
1310    % text in the case where a section has no node, but it doesn't
1311    % seem worth the trouble, since most documents are normally structured.
1312    \def\pdfoutlinedest{#3}%
1313    \ifx\pdfoutlinedest\empty
1314      \def\pdfoutlinedest{#4}%
1315    \else
1316      % Doubled backslashes in the name.
1317      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
1318       \backslashparens\pdfoutlinedest}%
1319    \fi
1320    %
1321    % Also double the backslashes in the display string.
1322    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
1323     \backslashparens\pdfoutlinetext}%
1324    %
1325    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1326  }
1327  %
1328  \def\pdfmakeoutlines{%
1329    \begingroup
1330      % Thanh's hack / proper braces in bookmarks
1331      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
1332      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
1333      %
1334      % Read toc silently, to get counts of subentries for \pdfoutline.
1335      \def\numchapentry##1##2##3##4{%
1336	\def\thischapnum{##2}%
1337	\def\thissecnum{0}%
1338	\def\thissubsecnum{0}%
1339      }%
1340      \def\numsecentry##1##2##3##4{%
1341	\advancenumber{chap\thischapnum}%
1342	\def\thissecnum{##2}%
1343	\def\thissubsecnum{0}%
1344      }%
1345      \def\numsubsecentry##1##2##3##4{%
1346	\advancenumber{sec\thissecnum}%
1347	\def\thissubsecnum{##2}%
1348      }%
1349      \def\numsubsubsecentry##1##2##3##4{%
1350	\advancenumber{subsec\thissubsecnum}%
1351      }%
1352      \def\thischapnum{0}%
1353      \def\thissecnum{0}%
1354      \def\thissubsecnum{0}%
1355      %
1356      % use \def rather than \let here because we redefine \chapentry et
1357      % al. a second time, below.
1358      \def\appentry{\numchapentry}%
1359      \def\appsecentry{\numsecentry}%
1360      \def\appsubsecentry{\numsubsecentry}%
1361      \def\appsubsubsecentry{\numsubsubsecentry}%
1362      \def\unnchapentry{\numchapentry}%
1363      \def\unnsecentry{\numsecentry}%
1364      \def\unnsubsecentry{\numsubsecentry}%
1365      \def\unnsubsubsecentry{\numsubsubsecentry}%
1366      \readdatafile{toc}%
1367      %
1368      % Read toc second time, this time actually producing the outlines.
1369      % The `-' means take the \expnumber as the absolute number of
1370      % subentries, which we calculated on our first read of the .toc above.
1371      %
1372      % We use the node names as the destinations.
1373      \def\numchapentry##1##2##3##4{%
1374        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1375      \def\numsecentry##1##2##3##4{%
1376        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1377      \def\numsubsecentry##1##2##3##4{%
1378        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1379      \def\numsubsubsecentry##1##2##3##4{% count is always zero
1380        \dopdfoutline{##1}{}{##3}{##4}}%
1381      %
1382      % PDF outlines are displayed using system fonts, instead of
1383      % document fonts.  Therefore we cannot use special characters,
1384      % since the encoding is unknown.  For example, the eogonek from
1385      % Latin 2 (0xea) gets translated to a | character.  Info from
1386      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1387      %
1388      % xx to do this right, we have to translate 8-bit characters to
1389      % their "best" equivalent, based on the @documentencoding.  Right
1390      % now, I guess we'll just let the pdf reader have its way.
1391      \indexnofonts
1392      \setupdatafile
1393      \activebackslash
1394      \input \jobname.toc
1395    \endgroup
1396  }
1397  %
1398  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1399    \ifx\PP\D\let\nextsp\relax
1400    \else\let\nextsp\skipspaces
1401      \ifx\p\space\else\addtokens{\filename}{\PP}%
1402        \advance\filenamelength by 1
1403      \fi
1404    \fi
1405    \nextsp}
1406  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1407  \ifnum\pdftexversion < 14
1408    \let \startlink \pdfannotlink
1409  \else
1410    \let \startlink \pdfstartlink
1411  \fi
1412  \def\pdfurl#1{%
1413    \begingroup
1414      \normalturnoffactive\def\@{@}%
1415      \makevalueexpandable
1416      \leavevmode\Red
1417      \startlink attr{/Border [0 0 0]}%
1418        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1419    \endgroup}
1420  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1421  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1422  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1423  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1424  \def\maketoks{%
1425    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1426    \ifx\first0\adn0
1427    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1428    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1429    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1430    \else
1431      \ifnum0=\countA\else\makelink\fi
1432      \ifx\first.\let\next=\done\else
1433        \let\next=\maketoks
1434        \addtokens{\toksB}{\the\toksD}
1435        \ifx\first,\addtokens{\toksB}{\space}\fi
1436      \fi
1437    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1438    \next}
1439  \def\makelink{\addtokens{\toksB}%
1440    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1441  \def\pdflink#1{%
1442    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1443    \linkcolor #1\endlink}
1444  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1445\else
1446  \let\pdfmkdest = \gobble
1447  \let\pdfurl = \gobble
1448  \let\endlink = \relax
1449  \let\linkcolor = \relax
1450  \let\pdfmakeoutlines = \relax
1451\fi  % \ifx\pdfoutput
1452
1453
1454\message{fonts,}
1455
1456% Change the current font style to #1, remembering it in \curfontstyle.
1457% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1458% italics, not bold italics.
1459%
1460\def\setfontstyle#1{%
1461  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1462  \csname ten#1\endcsname  % change the current font
1463}
1464
1465% Select #1 fonts with the current style.
1466%
1467\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1468
1469\def\rm{\fam=0 \setfontstyle{rm}}
1470\def\it{\fam=\itfam \setfontstyle{it}}
1471\def\sl{\fam=\slfam \setfontstyle{sl}}
1472\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1473\def\tt{\fam=\ttfam \setfontstyle{tt}}
1474
1475% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1476% So we set up a \sf.
1477\newfam\sffam
1478\def\sf{\fam=\sffam \setfontstyle{sf}}
1479\let\li = \sf % Sometimes we call it \li, not \sf.
1480
1481% We don't need math for this font style.
1482\def\ttsl{\setfontstyle{ttsl}}
1483
1484% Default leading.
1485\newdimen\textleading  \textleading = 13.2pt
1486
1487% Set the baselineskip to #1, and the lineskip and strut size
1488% correspondingly.  There is no deep meaning behind these magic numbers
1489% used as factors; they just match (closely enough) what Knuth defined.
1490%
1491\def\lineskipfactor{.08333}
1492\def\strutheightpercent{.70833}
1493\def\strutdepthpercent {.29167}
1494%
1495\def\setleading#1{%
1496  \normalbaselineskip = #1\relax
1497  \normallineskip = \lineskipfactor\normalbaselineskip
1498  \normalbaselines
1499  \setbox\strutbox =\hbox{%
1500    \vrule width0pt height\strutheightpercent\baselineskip
1501                    depth \strutdepthpercent \baselineskip
1502  }%
1503}
1504
1505% Set the font macro #1 to the font named #2, adding on the
1506% specified font prefix (normally `cm').
1507% #3 is the font's design size, #4 is a scale factor
1508\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1509
1510% Use cm as the default font prefix.
1511% To specify the font prefix, you must define \fontprefix
1512% before you read in texinfo.tex.
1513\ifx\fontprefix\undefined
1514\def\fontprefix{cm}
1515\fi
1516% Support font families that don't use the same naming scheme as CM.
1517\def\rmshape{r}
1518\def\rmbshape{bx}               %where the normal face is bold
1519\def\bfshape{b}
1520\def\bxshape{bx}
1521\def\ttshape{tt}
1522\def\ttbshape{tt}
1523\def\ttslshape{sltt}
1524\def\itshape{ti}
1525\def\itbshape{bxti}
1526\def\slshape{sl}
1527\def\slbshape{bxsl}
1528\def\sfshape{ss}
1529\def\sfbshape{ss}
1530\def\scshape{csc}
1531\def\scbshape{csc}
1532
1533% Text fonts (11.2pt, magstep1).
1534\def\textnominalsize{11pt}
1535\edef\mainmagstep{\magstephalf}
1536\setfont\textrm\rmshape{10}{\mainmagstep}
1537\setfont\texttt\ttshape{10}{\mainmagstep}
1538\setfont\textbf\bfshape{10}{\mainmagstep}
1539\setfont\textit\itshape{10}{\mainmagstep}
1540\setfont\textsl\slshape{10}{\mainmagstep}
1541\setfont\textsf\sfshape{10}{\mainmagstep}
1542\setfont\textsc\scshape{10}{\mainmagstep}
1543\setfont\textttsl\ttslshape{10}{\mainmagstep}
1544\font\texti=cmmi10 scaled \mainmagstep
1545\font\textsy=cmsy10 scaled \mainmagstep
1546
1547% A few fonts for @defun names and args.
1548\setfont\defbf\bfshape{10}{\magstep1}
1549\setfont\deftt\ttshape{10}{\magstep1}
1550\setfont\defttsl\ttslshape{10}{\magstep1…

Large files files are truncated, but you can click here to view the full file