home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / c / gcc / gccdoc.lzh / DOC / OBSOLETE / TEXINFOP.TEX < prev   
Encoding:
Text File  |  1991-09-24  |  75.9 KB  |  2,451 lines

  1. %% TeX macros to handle texinfo files
  2.  
  3. %   Copyright (C) 1985, 1986, 1988, 1990 Free Software Foundation, Inc.
  4.  
  5. %This texinfo.tex file is free software; you can redistribute it and/or
  6. %modify it under the terms of the GNU General Public License as
  7. %published by the Free Software Foundation; either version 1, or (at
  8. %your option) any later version.
  9.  
  10. %This texinfo.tex file is distributed in the hope that it will be
  11. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  12. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. %General Public License for more details.
  14.  
  15. %You should have received a copy of the GNU General Public License
  16. %along with this texinfo.tex file; see the file COPYING.  If not, write
  17. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  18. %USA.
  19.  
  20.  
  21. %In other words, you are welcome to use, share and improve this program.
  22. %You are forbidden to forbid anyone else to use, share and improve
  23. %what you give them.   Help stamp out software-hoarding!
  24.  
  25. \def\texinfoversion{2.8}
  26. \message{Loading texinfo package [Version \texinfoversion]:}
  27. \message{}
  28.  
  29. % Print the version number if in a .fmt file.
  30. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  31.  
  32. % Save some parts of plain tex whose names we will redefine.
  33.  
  34. \let\ptexlbrace=\{
  35. \let\ptexrbrace=\}
  36. \let\ptexdot=\.
  37. \let\ptexstar=\*
  38. \let\ptexend=\end
  39. \let\ptexbullet=\bullet
  40. \let\ptexb=\b
  41. \let\ptexc=\c
  42. \let\ptexi=\i
  43. \let\ptext=\t
  44. \let\ptexl=\l
  45. \let\ptexL=\L
  46.  
  47. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  48.  
  49. \message{Basics,}
  50. \chardef\other=12
  51.  
  52. \hyphenation{ap-pen-dix}
  53. \hyphenation{mini-buf-fer mini-buf-fers}
  54. \hyphenation{eshell}
  55.  
  56. % Margin to add to right of even pages, to left of odd pages.
  57. \newdimen \bindingoffset  \bindingoffset=0pt
  58. \newdimen \normaloffset   \normaloffset=\hoffset
  59. \newdimen\pagewidth \newdimen\pageheight
  60. \pagewidth=\hsize \pageheight=\vsize
  61.  
  62. %---------------------Begin change-----------------------
  63. %
  64. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  65. %
  66. \newdimen\cornerlong \newdimen\cornerthick
  67. \newdimen \topandbottommargin
  68. \newdimen \outerhsize \newdimen \outervsize
  69. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  70. \outerhsize=7in
  71. \outervsize=9.5in
  72. \topandbottommargin=.75in
  73. %
  74. %---------------------End change-----------------------
  75.  
  76. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  77. % does insertions itself, but you have to call it yourself.
  78. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  79. \def\onepageout#1{\hoffset=\normaloffset
  80. \ifodd\pageno  \advance\hoffset by \bindingoffset
  81. \else \advance\hoffset by -\bindingoffset\fi
  82. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  83. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  84. {\let\hsize=\pagewidth \makefootline}}}%
  85. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  86.  
  87.  
  88. % Here is a modification of the main output routine for Near East Publications
  89. % This provides right-angle cropmarks at all four corners.
  90. % The contents of the page are centerlined into the cropmarks,
  91. % and any desired binding offset is added as an \hskip on either
  92. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  93. %
  94. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  95.          \shipout
  96.          \vbox to \outervsize{\hsize=\outerhsize
  97.                  \vbox{\line{\ewtop\hfill\ewtop}}
  98.                  \nointerlineskip
  99.                  \line{\vbox{\moveleft\cornerthick\nstop}
  100.                        \hfill
  101.                        \vbox{\moveright\cornerthick\nstop}}
  102.                  \vskip \topandbottommargin
  103.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  104.             \vbox{
  105.             {\let\hsize=\pagewidth \makeheadline}
  106.             \pagebody{#1}
  107.             {\let\hsize=\pagewidth \makefootline}}
  108.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  109.          \vskip \topandbottommargin plus1fill minus1fill
  110.                  \boxmaxdepth\cornerthick
  111.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  112.                        \hfill
  113.                        \vbox{\moveright\cornerthick\nsbot}}
  114.                  \nointerlineskip
  115.                  \vbox{\line{\ewbot\hfill\ewbot}}
  116.     }
  117.   \advancepageno 
  118.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  119. %
  120. % Do @cropmarks to get crop marks
  121. \def\cropmarks{\let\onepageout=\croppageout }
  122.  
  123. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  124. {\catcode`\@ =11
  125. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  126. \dimen@=\dp#1 \unvbox#1
  127. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  128. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  129. }
  130.  
  131. %
  132. % Here are the rules for the cropmarks.  Note that they are
  133. % offset so that the space between them is truly \outerhsize or \outervsize
  134. % (P. A. MacKay, 12 November, 1986)
  135. %
  136. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  137. \def\nstop{\vbox
  138.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  139. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  140. \def\nsbot{\vbox
  141.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  142.  
  143. % Parse an argument, then pass it to #1.
  144. % The argument can be delimited with [...] or with "..." or braces
  145. % or it can be a whole line.
  146. % #1 should be a macro which expects
  147. % an ordinary undelimited TeX argument.
  148.  
  149. \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
  150.  
  151. \def\parseargx{%
  152. \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
  153. \aftergroup \parseargline %
  154. \fi \endgroup}
  155.  
  156. {\obeyspaces %
  157. \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
  158.  
  159. \gdef\obeyedspace{\ }
  160.  
  161. \def\parseargline{\begingroup \obeylines \parsearglinex}
  162. {\obeylines %
  163. \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
  164.  
  165. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  166.  
  167. %% These are used to keep @begin/@end levels from running away
  168. %% Call \inENV within environments (after a \begingroup)
  169. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  170. \def\ENVcheck{%
  171. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  172. \endgroup\fi} % This is not perfect, but it should reduce lossage
  173.  
  174. % @begin foo  is the same as @foo, for now.
  175. \newhelp\EMsimple{Type <Return> to continue}
  176.  
  177. \outer\def\begin{\parsearg\beginxxx}
  178.  
  179. \def\beginxxx #1{%
  180. \expandafter\ifx\csname #1\endcsname\relax
  181. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  182. \csname #1\endcsname\fi}
  183.  
  184. %% @end foo executes the definition of \Efoo.
  185. %% foo can be delimited by doublequotes or brackets.
  186.  
  187. \def\end{\parsearg\endxxx}
  188.  
  189. \def\endxxx #1{%
  190. \expandafter\ifx\csname E#1\endcsname\relax
  191. \expandafter\ifx\csname #1\endcsname\relax
  192. \errmessage{Undefined command @end #1}\else
  193. \errorE{#1}\fi\fi
  194. \csname E#1\endcsname}
  195. \def\errorE#1{
  196. {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
  197.  
  198. % Single-spacing is done by various environments.
  199.  
  200. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  201. \def\singlespace{%
  202. {\advance \baselineskip by -\singlespaceskip
  203. \kern \baselineskip}%
  204. \baselineskip=\singlespaceskip
  205. }
  206.  
  207. %% Simple single-character @ commands
  208.  
  209. % @@ prints an @
  210. % Kludge this until the fonts are right (grr).
  211. \def\@{{\tt \char '100}}
  212.  
  213. % Define @` and @' to be the same as ` and '
  214. % but suppressing ligatures.
  215. \def\`{{`}}
  216. \def\'{{'}}
  217.  
  218. % Used to generate quoted braces.
  219.  
  220. \def\mylbrace {{\tt \char '173}}
  221. \def\myrbrace {{\tt \char '175}}
  222. \let\{=\mylbrace
  223. \let\}=\myrbrace
  224.  
  225. % @: forces normal size whitespace following.
  226. \def\:{\spacefactor=1000 }
  227.  
  228. % @* forces a line break.
  229. \def\*{\hfil\break}
  230.  
  231. % @. is an end-of-sentence period.
  232. \def\.{.\spacefactor=3000 }
  233.  
  234. % @w prevents a word break
  235. \def\w #1{\hbox{#1}}
  236.  
  237. % @group ... @end group  forces ... to be all on one page.
  238.  
  239. \def\group{\begingroup% \inENV ???
  240. \def \Egroup{\egroup\endgroup}
  241. \vbox\bgroup}
  242.  
  243. % @br   forces paragraph break
  244.  
  245. \let\br = \par
  246.  
  247. % @dots{}  output some dots
  248.  
  249. \def\dots{$\ldots$}
  250.  
  251. % @page    forces the start of a new page
  252.  
  253. \def\page{\par\vfill\supereject}
  254.  
  255. % @exdent text....
  256. % outputs text on separate line in roman font, starting at standard page margin
  257.  
  258. \def\exdent{\errmessage{@exdent in filled text}}
  259.   % @lisp, etc, define \exdent locally from \internalexdent
  260.  
  261. {\obeyspaces
  262. \gdef\internalexdent{\parsearg\exdentzzz}}
  263.  
  264. \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
  265. \advance \hsize by -\leftskip
  266. \advance \hsize by -\rightskip
  267. \leftline{{\rm#1}}}}
  268.  
  269. % @include file    insert text of that file as input.
  270.  
  271. \def\include{\parsearg\includezzz}
  272. \def\includezzz #1{{\def\thisfile{#1}\input #1
  273. }}
  274.  
  275. \def\thisfile{}
  276.  
  277. % @center line   outputs that line, centered
  278.  
  279. \def\center{\parsearg\centerzzz}
  280. \def\centerzzz #1{{\advance\hsize by -\leftskip
  281. \advance\hsize by -\rightskip
  282. \centerline{#1}}}
  283.  
  284. % @sp n   outputs n lines of vertical space
  285.  
  286. \def\sp{\parsearg\spxxx}
  287. \def\spxxx #1{\par \vskip #1\baselineskip}
  288.  
  289. % @comment ...line which is ignored...
  290. % @c is the same as @comment
  291. % @ignore ... @end ignore  is another way to write a comment
  292.  
  293. \def\comment{\parsearg \commentxxx}
  294.  
  295. \def\commentxxx #1{}
  296.  
  297. \let\c=\comment
  298.  
  299. % Prevent errors for section commands.
  300. % Used in @ignore and in failing conditionals.
  301. \def\ignoresections{%
  302. \let\chapter=\relax
  303. \let\unnumbered=\relax
  304. \let\unnumberedsec=\relax
  305. \let\unnumberedsection=\relax
  306. \let\unnumberedsubsec=\relax
  307. \let\unnumberedsubsection=\relax
  308. \let\unnumberedsubsubsec=\relax
  309. \let\unnumberedsubsubsection=\relax
  310. \let\section=\relax
  311. \let\subsec=\relax
  312. \let\subsubsec=\relax
  313. \let\subsection=\relax
  314. \let\subsubsection=\relax
  315. \let\appendix=\relax
  316. \let\appendixsec=\relax
  317. \let\appendixsection=\relax
  318. \let\appendixsubsec=\relax
  319. \let\appendixsubsection=\relax
  320. \let\appendixsubsubsec=\relax
  321. \let\appendixsubsubsection=\relax
  322. }
  323.  
  324. \def\ignore{\begingroup\ignoresections\ignorexxx}
  325. \long\def\ignorexxx #1\end ignore{\endgroup\ignorespaces}
  326.  
  327. % Conditionals to test whether a flag is set.
  328.  
  329. \outer\def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
  330.  
  331. \def\ifsetxxx #1{\endgroup
  332. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
  333. \else \let\temp=\relax \fi
  334. \temp}
  335. \def\Eifset{}
  336. \def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
  337. \long\def\ifsetfailxxx #1\end ifset{\endgroup\ignorespaces}
  338.  
  339. \outer\def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
  340.  
  341. \def\ifclearxxx #1{\endgroup
  342. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
  343. \else \let\temp=\ifclearfail \fi
  344. \temp}
  345. \def\Eifclear{}
  346. \def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
  347. \long\def\ifclearfailxxx #1\end ifclear{\endgroup\ignorespaces}
  348.  
  349. % Some texinfo constructs that are trivial in tex
  350.  
  351. \def\iftex{}
  352. \def\Eiftex{}
  353. \def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
  354. \long\def\ifinfoxxx #1\end ifinfo{\endgroup\ignorespaces}
  355.  
  356. \long\def\menu #1\end menu{}
  357. \def\asis#1{#1}
  358.  
  359. \def\node{\ENVcheck\parsearg\nodezzz}
  360. \def\nodezzz#1{\nodexxx [#1,]}
  361. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  362. \let\lastnode=\relax
  363.  
  364. \def\donoderef{\ifx\lastnode\relax\else
  365. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  366. \let\lastnode=\relax}
  367.  
  368. \def\unnumbnoderef{\ifx\lastnode\relax\else
  369. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  370. \let\lastnode=\relax}
  371.  
  372. \def\appendixnoderef{\ifx\lastnode\relax\else
  373. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  374. \let\lastnode=\relax}
  375.  
  376. \let\refill=\relax
  377.   
  378. % @setfilename is done at the beginning of every texinfo file.
  379. % So open here the files we need to have open while reading the input.
  380. % This makes it possible to make a .fmt file for texinfo.
  381. \def\setfilename{%
  382.    \readauxfile
  383.    \opencontents
  384.    \openindices
  385.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  386.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  387.    \comment % Ignore the actual filename.
  388. }
  389.  
  390. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  391.  
  392. \def\inforef #1{\inforefzzz #1,,,,**}
  393. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
  394. \def\losespace #1{#1}
  395.  
  396. \message{fonts,}
  397.  
  398. % Font-change commands.
  399.  
  400. %% Try out Computer Modern fonts at \magstephalf
  401. \font\tenrm=p-rom scaled \magstephalf
  402. \font\tentt=c-med scaled \magstephalf
  403. % Instead of p-bol, you many want to use cmbx10.
  404. % cmbx10 is a prettier font on its own, but cmb10
  405. % looks better when embedded in a line with cmr10.
  406. \font\tenbf=p-bol scaled \magstephalf 
  407. \font\tenit=p-ita scaled \magstephalf
  408. \font\tensl=p-obl scaled \magstephalf
  409. \font\tensf=h-med scaled \magstephalf
  410. \def\li{\sf}
  411. \font\tensc=p-romsc scaled \magstephalf
  412.  
  413. % Fonts for @defun, etc.
  414. \font\defbf=p-bol scaled \magstep1 %was 1314
  415. \font\deftt=c-med scaled \magstep1
  416. \def\df{\let\tt=\deftt \defbf}
  417.  
  418. % Font for title
  419. % There seems to have been a confusion: two definitions of this font.
  420. % It is not clear why, or which one is better.
  421. \font\titlerm = p-bol scaled \magstep5
  422. % this is too small -- rms, May 1990.
  423. %\font\titlerm = cmbx12 scaled \magstep2
  424.  
  425. % Fonts for indices
  426. \font\ninett=h-med
  427. \font\indit=p-ita \font\indrm=p-rom
  428. \let\indtt=\ninett
  429. \def\indbf{\indrm} \def\indsl{\indit}
  430. \def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm
  431. \let\tt=\indtt}
  432.  
  433. % Fonts for headings
  434. \font\chaprm=p-bol scaled \magstep3
  435. \font\chapit=p-ita scaled \magstep3
  436. \font\chapsl=p-obl scaled \magstep3
  437. \font\chaptt=c-med scaled \magstep3
  438. \font\chapsf=h-med scaled \magstep3
  439. \let\chapbf=\chaprm
  440.  
  441. \font\secrm=p-bol scaled \magstep2
  442. \font\secit=p-ita scaled \magstep2
  443. \font\secsl=p-obl scaled \magstep2
  444. \font\sectt=c-med scaled \magstep2
  445. \font\secsf=h-med scaled \magstep2
  446. \let\secbf=\secrm
  447.  
  448. % \font\ssecrm=p-bol scaled \magstep1    % This size an fontlooked bad.
  449. % \font\ssecit=p-ita scaled \magstep1    % The letters were too crowded.
  450. % \font\ssecsl=p-obl scaled \magstep1
  451. % \font\ssectt=c-med scaled \magstep1
  452. % \font\ssecsf=h-med scaled \magstep1
  453.  
  454. \font\ssecrm=p-bol scaled 1315    % Note the use of cmb rather than cmbx.
  455. \font\ssecit=p-ita scaled 1315    % Also, the size is a little larger than
  456. \font\ssecsl=p-obl scaled 1315    % being scaled magstep1.
  457. \font\ssectt=c-med scaled 1315
  458. \font\ssecsf=h-med scaled 1315
  459.  
  460. \let\ssecbf=\ssecrm
  461.  
  462. \def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
  463. \let\smallcaps=\tensc\let\sf=\tensf}
  464. \def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf}
  465. \def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf}
  466. \def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf}
  467. % Count depth in font-changes, for error checks
  468. \newcount\fontdepth \fontdepth=0
  469.  
  470. % Font for table of contents.
  471. \font\truesecrm=p-rom
  472.  
  473. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  474. %% serif) and @ii for TeX italic
  475.  
  476. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  477. % unless the following character is such as not to need one.
  478. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  479. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  480.  
  481. \let\i=\smartitalic
  482. \let\var=\smartitalic
  483. \let\dfn=\smartitalic
  484. \let\emph=\smartitalic
  485. \let\cite=\smartitalic
  486.  
  487. \def\b#1{{\bf #1}}
  488. \let\strong=\b
  489.  
  490. \def\t#1{{\tt \rawbackslash \frenchspacing #1}\null}
  491. \let\ttfont = \t
  492. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  493. \def\samp #1{`\tclose{#1}'\null}
  494. \def\key #1{{\tt \uppercase{#1}}\null}
  495. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  496.  
  497. \let\file=\samp
  498.  
  499. % @code is a modification of @t,
  500. % which makes spaces the same size as normal in the surrounding text.
  501. \newdimen\tclosesave
  502. \newdimen\tcloserm
  503. \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
  504. \fontdimen2\font=\tcloserm
  505. \def\ {{\fontdimen2\font=\tclosesave{} }}%
  506.  \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
  507. \let\code=\tclose
  508. %\let\exp=\tclose  %Was temporary
  509.  
  510. % @kbd is like @code, except that if the argument is just one @key command, 
  511. % then @kbd has no effect.
  512.  
  513. \def\xkey{\key}
  514. \def\kbdfoo#1#2#3*{\def\one{#1}\def\three{#3}\def\threex{??}%
  515. \ifx\one\xkey\ifx\threex\three \key{#2}%
  516. \else\tclose{\look}\fi
  517. \else\tclose{\look}\fi}
  518.  
  519. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??*}
  520.  
  521. \def\l#1{{\li #1}\null}        % 
  522.  
  523. \def\r#1{{\rm #1}}        % roman font
  524. \def\sc#1{{\smallcaps #1}}    % smallcaps font
  525. \def\ii#1{{\it #1}}        % italic font
  526.  
  527. \message{page headings,}
  528.  
  529. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  530. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  531.  
  532. % First the title page.  Must do @settitle before @titlepage.
  533. \def\titlefont#1{{\titlerm #1}}
  534.  
  535. \newtoks\realeverypar
  536. \newif\ifseenauthor
  537. \newif\iffinishedtitlepage
  538.  
  539. \def\titlepage{\begingroup \parindent=0pt \textfonts
  540.    \let\subtitlerm=\tenrm
  541.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  542.    %
  543.    \font\authorrm = p-bol scaled \magstep1
  544.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  545.    %
  546.    % Leave some space at the very top of the page.
  547.    \vglue\titlepagetopglue
  548.    %
  549.    % Now you can print the title using @title.
  550.    \def\title{\parsearg\titlezzz}%
  551.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  552.             % print a rule at the page bottom also.
  553.             \finishedtitlepagefalse
  554.             \vskip4pt \hrule height 4pt \vskip4pt}%
  555.    % No rule at page bottom unless we print one at the top with @title.
  556.    \finishedtitlepagetrue
  557.    %
  558.    % Now you can put text using @subtitle.
  559.    \def\subtitle{\parsearg\subtitlezzz}%
  560.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  561.    %
  562.    % @author should come last, but may come many times.
  563.    \def\author{\parsearg\authorzzz}%
  564.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  565.       {\authorfont \leftline{##1}}}%
  566.    %  
  567.    % Most title ``pages'' are actually two pages long, with space
  568.    % at the top of the second.  We don't want the ragged left on the second.
  569.    \let\oldpage = \page
  570.    \def\page{%
  571.       \finishtitlepage
  572.       \oldpage
  573.       \let\page = \oldpage
  574.       \hbox{}}%
  575. %   \def\page{\oldpage \hbox{}}
  576. }
  577.  
  578. \def\Etitlepage{%
  579.    \iffinishedtitlepage\else
  580.       \finishtitlepage
  581.    \fi
  582.    \endgroup\page\HEADINGSon
  583. }
  584.  
  585. \def\finishtitlepage{%
  586.    \vskip4pt \hrule height 2pt
  587.    \vskip\titlepagebottomglue
  588.    \finishedtitlepagetrue
  589. }
  590.  
  591. %%% Set up page headings and footings.
  592.  
  593. \let\thispage=\folio
  594.  
  595. \newtoks \evenheadline    % Token sequence for heading line of even pages
  596. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  597. \newtoks \evenfootline    % Token sequence for footing line of even pages
  598. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  599.  
  600. % Now make Tex use those variables
  601. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
  602. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
  603.  
  604. % Commands to set those variables.
  605. % For example, this is what  @headings on  does
  606. % @evenheading @thistitle|@thispage|@thischapter
  607. % @oddheading @thischapter|@thispage|@thistitle
  608. % @evenfooting @thisfile||
  609. % @oddfooting ||@thisfile
  610.  
  611. \def\evenheading{\parsearg\evenheadingxxx}
  612. \def\oddheading{\parsearg\oddheadingxxx}
  613. \def\everyheading{\parsearg\everyheadingxxx}
  614.  
  615. \def\evenfooting{\parsearg\evenfootingxxx}
  616. \def\oddfooting{\parsearg\oddfootingxxx}
  617. \def\everyfooting{\parsearg\everyfootingxxx}
  618.  
  619. {\catcode`\@=0 %
  620.  
  621. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  622. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  623. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  624.  
  625. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  626. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  627. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  628.  
  629. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  630. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  631. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  632. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  633.  
  634. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  635. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  636. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  637.  
  638. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  639. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  640. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  641.  
  642. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  643. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  644. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  645. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  646. %
  647. }% unbind the catcode of @.
  648.  
  649. % @headings double    turns headings on for double-sided printing.
  650. % @headings single    turns headings on for single-sided printing.
  651. % @headings off        turns them off.
  652. % @headings on        same as @headings double, retained for compatibility.
  653. % By default, they are off.
  654.  
  655. \def\headings #1 {\csname HEADINGS#1\endcsname}
  656.  
  657. \def\HEADINGSoff{
  658. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  659. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  660. \HEADINGSoff
  661. % When we turn headings on, set the page number to 1.
  662. % For double-sided printing, put current file name in lower left corner,
  663. % chapter name on inside top of right hand pages, document
  664. % title on inside top of left hand pages, and page numbers on outside top
  665. % edge of all pages.
  666. \def\HEADINGSdouble{
  667. %\pagealignmacro
  668. \global\pageno=1
  669. \global\evenfootline={\hfil}
  670. \global\oddfootline={\hfil}
  671. \global\evenheadline={\line{\folio\hfil\thistitle}}
  672. \global\oddheadline={\line{\thischapter\hfil\folio}}
  673. }
  674. % For single-sided printing, chapter title goes across top left of page,
  675. % page number on top right.
  676. \def\HEADINGSsingle{
  677. %\pagealignmacro
  678. \global\pageno=1
  679. \global\evenfootline={\hfil}
  680. \global\oddfootline={\hfil}
  681. \global\evenheadline={\line{\thischapter\hfil\folio}}
  682. \global\oddheadline={\line{\thischapter\hfil\folio}}
  683. }
  684. \def\HEADINGSon{\HEADINGSdouble}
  685.  
  686. % Subroutines used in generating headings
  687. % Produces Day Month Year style of output.
  688. \def\today{\number\day\space
  689. \ifcase\month\or
  690. January\or February\or March\or April\or May\or June\or
  691. July\or August\or September\or October\or November\or December\fi
  692. \space\number\year}
  693.  
  694. % Use this if you want the Month Day, Year style of output.
  695. %\def\today{\ifcase\month\or
  696. %January\or February\or March\or April\or May\or June\or
  697. %July\or August\or September\or October\or November\or December\fi
  698. %\space\number\day, \number\year}
  699.  
  700. % @settitle line...  specifies the title of the document, for headings
  701. % It generates no output of its own
  702.  
  703. \def\thistitle{No Title}
  704. \def\settitle{\parsearg\settitlezzz}
  705. \def\settitlezzz #1{\gdef\thistitle{#1}}
  706.  
  707. \message{tables,}
  708.  
  709. % @tabs -- simple alignment
  710.  
  711. % These don't work.  For one thing, \+ is defined as outer.
  712. % So these macros cannot even be defined.
  713.  
  714. %\def\tabs{\parsearg\tabszzz}
  715. %\def\tabszzz #1{\settabs\+#1\cr}
  716. %\def\tabline{\parsearg\tablinezzz}
  717. %\def\tablinezzz #1{\+#1\cr}
  718. %\def\&{&}
  719.  
  720. % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
  721.  
  722. % default indentation of table text
  723. \newdimen\tableindent \tableindent=.8in
  724. % default indentation of @itemize and @enumerate text
  725. \newdimen\itemindent  \itemindent=.3in
  726. % margin between end of table item and start of table text.
  727. \newdimen\itemmargin  \itemmargin=.1in
  728.  
  729. % used internally for \itemindent minus \itemmargin
  730. \newdimen\itemmax
  731.  
  732. % Note @table and @ftable define @item, @itemx, etc., with these defs.
  733. % They also define \itemindex
  734. % to index the item name in whatever manner is desired (perhaps none).
  735.  
  736. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  737. \def\internalBitemx{\par \parsearg\itemzzz}
  738.  
  739. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  740. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  741.  
  742. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  743. \def\internalBkitemx{\par \parsearg\kitemzzz}
  744.  
  745. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}}
  746.  
  747. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
  748.  
  749. \def\itemzzz #1{\begingroup %
  750. \advance \hsize by -\rightskip %
  751. \advance \hsize by -\leftskip %
  752. \setbox0=\hbox{\itemfont{#1}}%
  753. \itemindex{#1}%
  754. \parskip=0in %
  755. \noindent %
  756. \ifdim \wd0>\itemmax %
  757. \vadjust{\penalty 10000}%
  758. \hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
  759. \else %
  760. \hbox to 0pt{\hskip -\tableindent\box0\hss}%
  761. \fi %
  762. \endgroup %
  763. }
  764.  
  765. \def\item{\errmessage{@item while not in a table}}
  766. \def\itemx{\errmessage{@itemx while not in a table}}
  767. \def\kitem{\errmessage{@kitem while not in a table}}
  768. \def\kitemx{\errmessage{@kitemx while not in a table}}
  769. \def\xitem{\errmessage{@xitem while not in a table}}
  770. \def\xitemx{\errmessage{@xitemx while not in a table}}
  771.  
  772. %% Contains a kludge to get @end[description] to work
  773. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  774.  
  775. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  776. {\obeylines\obeyspaces%
  777. \gdef\tablex #1^^M{%
  778. \tabley\dontindex#1        \endtabley}}
  779.  
  780. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  781. {\obeylines\obeyspaces%
  782. \gdef\ftablex #1^^M{%
  783. \tabley\fnitemindex#1        \endtabley}}
  784.  
  785. \def\dontindex #1{}
  786. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  787.  
  788. {\obeyspaces %
  789. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  790. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  791.  
  792. \def\tablez #1#2#3#4#5#6{%
  793. \aboveenvbreak %
  794. \begingroup %
  795. \def\Edescription{\Etable}% Neccessary kludge.
  796. \let\itemindex=#1%
  797. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  798. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  799. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  800. \def\itemfont{#2}%
  801. \itemmax=\tableindent %
  802. \advance \itemmax by -\itemmargin %
  803. \advance \leftskip by \tableindent %
  804. \parindent = 0pt
  805. \parskip = \smallskipamount
  806. \ifdim \parskip=0pt \parskip=2pt \fi%
  807. \def\Etable{\endgraf\endgroup\afterenvbreak}%
  808. \let\item = \internalBitem %
  809. \let\itemx = \internalBitemx %
  810. \let\kitem = \internalBkitem %
  811. \let\kitemx = \internalBkitemx %
  812. \let\xitem = \internalBxitem %
  813. \let\xitemx = \internalBxitemx %
  814. }
  815.  
  816. % This is the counter used by @enumerate, which is really @itemize
  817.  
  818. \newcount \itemno
  819.  
  820. \def\itemize{\parsearg\itemizezzz}
  821.  
  822. \def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
  823.  
  824. \def\itemizey #1#2{%
  825. \aboveenvbreak %
  826. \begingroup %
  827. \itemno = 0 %
  828. \itemmax=\itemindent %
  829. \advance \itemmax by -\itemmargin %
  830. \advance \leftskip by \itemindent %
  831. \parindent = 0pt
  832. \parskip = \smallskipamount
  833. \ifdim \parskip=0pt \parskip=2pt \fi%
  834. \def#2{\endgraf\endgroup\afterenvbreak}%
  835. \def\itemcontents{#1}%
  836. \let\item=\itemizeitem}
  837.  
  838. \def\bullet{$\ptexbullet$}
  839. \def\minus{$-$}
  840.  
  841. % Set sfcode to normal for the chars that usually have another value.
  842. % These are `.?!:;,'
  843. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  844.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  845.  
  846. \def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
  847.  
  848. % Definition of @item while inside @itemize.
  849.  
  850. \def\itemizeitem{%
  851. \advance\itemno by 1
  852. {\let\par=\endgraf \smallbreak}%
  853. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  854. {\parskip=0in \hskip 0pt
  855. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  856. \vadjust{\penalty 300}}%
  857. \flushcr}
  858.  
  859. \message{indexing,}
  860. % Index generation facilities
  861.  
  862. % Define \newwrite to be identical to plain tex's \newwrite
  863. % except not \outer, so it can be used within \newindex.
  864. {\catcode`\@=11
  865. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  866.  
  867. % \newindex {foo} defines an index named foo.
  868. % It automatically defines \fooindex such that
  869. % \fooindex ...rest of line... puts an entry in the index foo.
  870. % It also defines \fooindfile to be the number of the output channel for
  871. % the file that    accumulates this index.  The file's extension is foo.
  872. % The name of an index should be no more than 2 characters long
  873. % for the sake of vms.
  874.  
  875. \def\newindex #1{
  876. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  877. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  878. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  879. \noexpand\doindex {#1}}
  880. }
  881.  
  882. % @defindex foo  ==  \newindex{foo}
  883.  
  884. \def\defindex{\parsearg\newindex}
  885.  
  886. % Define @defcodeindex, like @defindex except put all entries in @code.
  887.  
  888. \def\newcodeindex #1{
  889. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  890. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  891. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  892. \noexpand\docodeindex {#1}}
  893. }
  894.  
  895. \def\defcodeindex{\parsearg\newcodeindex}
  896.  
  897. % @synindex foo bar    makes index foo feed into index bar.
  898. % Do this instead of @defindex foo if you don't want it as a separate index.
  899. \def\synindex #1 #2 {%
  900. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  901. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  902. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  903. \noexpand\doindex {#2}}%
  904. }
  905.  
  906. % @syncodeindex foo bar   similar, but put all entries made for index foo
  907. % inside @code.
  908. \def\syncodeindex #1 #2 {%
  909. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  910. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  911. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  912. \noexpand\docodeindex {#2}}%
  913. }
  914.  
  915. % Define \doindex, the driver for all \fooindex macros.
  916. % Argument #1 is generated by the calling \fooindex macro,
  917. %  and it is "foo", the name of the index.
  918.  
  919. % \doindex just uses \parsearg; it calls \doind for the actual work.
  920. % This is because \doind is more useful to call from other macros.
  921.  
  922. % There is also \dosubind {index}{topic}{subtopic}
  923. % which makes an entry in a two-level index such as the operation index.
  924.  
  925. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  926. \def\singleindexer #1{\doind{\indexname}{#1}}
  927.  
  928. % like the previous two, but they put @code around the argument.
  929. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  930. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  931.  
  932. \def\indexdummies{%
  933. \def\w{\realbackslash w }%
  934. \def\bf{\realbackslash bf }%
  935. \def\rm{\realbackslash rm }%
  936. \def\sl{\realbackslash sl }%
  937. \def\sf{\realbackslash sf}%
  938. \def\tt{\realbackslash tt}%
  939. \def\gtr{\realbackslash gtr}%
  940. \def\less{\realbackslash less}%
  941. \def\hat{\realbackslash hat}%
  942. \def\char{\realbackslash char}%
  943. \def\TeX{\realbackslash TeX}%
  944. \def\dots{\realbackslash dots }%
  945. \def\copyright{\realbackslash copyright }%
  946. \def\tclose##1{\realbackslash tclose {##1}}%
  947. \def\code##1{\realbackslash code {##1}}%
  948. \def\samp##1{\realbackslash samp {##1}}%
  949. \def\r##1{\realbackslash r {##1}}%
  950. \def\i##1{\realbackslash i {##1}}%
  951. \def\b##1{\realbackslash b {##1}}%
  952. \def\cite##1{\realbackslash cite {##1}}%
  953. \def\key##1{\realbackslash key {##1}}%
  954. \def\file##1{\realbackslash file {##1}}%
  955. \def\var##1{\realbackslash var {##1}}%
  956. \def\kbd##1{\realbackslash kbd {##1}}%
  957. }
  958.  
  959. % \indexnofonts no-ops all font-change commands.
  960. % This is used when outputting the strings to sort the index by.
  961. \def\indexdummyfont#1{#1}
  962. \def\indexnofonts{%
  963. \let\w=\indexdummyfont
  964. \let\r=\indexdummyfont
  965. \let\i=\indexdummyfont
  966. \let\b=\indexdummyfont
  967. \let\emph=\indexdummyfont
  968. \let\strong=\indexdummyfont
  969. \let\cite=\indexdummyfont
  970. \let\sc=\indexdummyfont
  971. %Don't no-op \tt, since it isn't a user-level command
  972. % and is used in the definitions of the actuve chars like <, >, |...
  973. %\let\tt=\indexdummyfont
  974. \let\tclose=\indexdummyfont
  975. \let\code=\indexdummyfont
  976. \let\file=\indexdummyfont
  977. \let\samp=\indexdummyfont
  978. \let\kbd=\indexdummyfont
  979. \let\key=\indexdummyfont
  980. \let\var=\indexdummyfont
  981. }
  982.  
  983. % To define \realbackslash, we must make \ not be an escape.
  984. % We must first make another character (@) an escape
  985. % so we do not become unable to do a definition.
  986.  
  987. {\catcode`\@=0 \catcode`\\=\other
  988. @gdef@realbackslash{\}}
  989.  
  990. \let\indexbackslash=0  %overridden during \printindex.
  991.  
  992. \def\doind #1#2{%
  993. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  994. \count10=\lastpenalty %
  995. \escapechar=`\\%
  996. {\let\folio=0% Expand all macros now EXCEPT \folio
  997. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  998. % so it will be output as is; and it will print as backslash in the indx.
  999. %
  1000. % Now process the index-string once, with all font commands turned off,
  1001. % to get the string to sort the index by.
  1002. {\indexnofonts
  1003. \xdef\temp1{#2}%
  1004. }%
  1005. % Now produce the complete index entry.  We process the index-string again,
  1006. % this time with font commands expanded, to get what to print in the index.
  1007. \edef\temp{%
  1008. \write \csname#1indfile\endcsname{%
  1009. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1010. \temp }%
  1011. \penalty\count10}}
  1012.  
  1013. \def\dosubind #1#2#3{%
  1014. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1015. \count10=\lastpenalty %
  1016. \escapechar=`\\%
  1017. {\let\folio=0%
  1018. \def\rawbackslashxx{\indexbackslash}%
  1019. %
  1020. % Now process the index-string once, with all font commands turned off,
  1021. % to get the string to sort the index by.
  1022. {\indexnofonts
  1023. \xdef\temp1{#2 #3}%
  1024. }%
  1025. % Now produce the complete index entry.  We process the index-string again,
  1026. % this time with font commands expanded, to get what to print in the index.
  1027. \edef\temp{%
  1028. \write \csname#1indfile\endcsname{%
  1029. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1030. \temp }%
  1031. \penalty\count10}}
  1032.  
  1033. % The index entry written in the file actually looks like
  1034. %  \entry {sortstring}{page}{topic}
  1035. % or
  1036. %  \entry {sortstring}{page}{topic}{subtopic}
  1037. % The texindex program reads in these files and writes files
  1038. % containing these kinds of lines:
  1039. %  \initial {c}
  1040. %     before the first topic whose initial is c
  1041. %  \entry {topic}{pagelist}
  1042. %     for a topic that is used without subtopics
  1043. %  \primary {topic}
  1044. %     for the beginning of a topic that is used with subtopics
  1045. %  \secondary {subtopic}{pagelist}
  1046. %     for each subtopic.
  1047.  
  1048. % Define the user-accessible indexing commands 
  1049. % @findex, @vindex, @kindex, @cindex.
  1050.  
  1051. \def\findex {\fnindex}
  1052. \def\kindex {\kyindex}
  1053. \def\cindex {\cpindex}
  1054. \def\vindex {\vrindex}
  1055. \def\tindex {\tpindex}
  1056. \def\pindex {\pgindex}
  1057.  
  1058. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1059. {\obeylines %
  1060. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1061. \dosubind{cp}{#2}{#1}}}
  1062.  
  1063. % Define the macros used in formatting output of the sorted index material.
  1064.  
  1065. % This is what you call to cause a particular index to get printed.
  1066. % Write
  1067. % @unnumbered Function Index
  1068. % @printindex fn
  1069.  
  1070. \def\printindex{\parsearg\doprintindex}
  1071.  
  1072. \def\doprintindex#1{\tex %
  1073. \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1074. \catcode`\$=\other\catcode`\_=\other
  1075. \catcode`\~=\other
  1076. % The following don't help, since the chars were translated
  1077. % when the raw index was written, and their fonts were discarded
  1078. % due to \indexnofonts.
  1079. %\catcode`\"=\active
  1080. %\catcode`\^=\active
  1081. %\catcode`\_=\active
  1082. %\catcode`\|=\active
  1083. %\catcode`\<=\active
  1084. %\catcode`\>=\active
  1085. \def\indexbackslash{\rawbackslashxx}
  1086. \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1087. \begindoublecolumns
  1088. \openin 1 \jobname.#1s
  1089. \ifeof 1 \else \closein 1 \input \jobname.#1s
  1090. \fi
  1091. \enddoublecolumns
  1092. \Etex}
  1093.  
  1094. % These macros are used by the sorted index file itself.
  1095. % Change them to control the appearance of the index.
  1096.  
  1097. % Same as \bigskipamount except no shrink.
  1098. % \balancecolumns gets confused if there is any shrink.
  1099. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1100.  
  1101. \outer\def\initial #1{%
  1102. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1103. \ifdim\lastskip<\initialskipamount
  1104. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1105. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1106.  
  1107. \outer\def\entry #1#2{
  1108. {\parfillskip=0in \parskip=0in \parindent=0in
  1109. \hangindent=1in \hangafter=1%
  1110. \noindent\hbox{#1}\dotfill #2\par
  1111. }}
  1112.  
  1113. \def\primary #1{\line{#1\hfil}}
  1114.  
  1115. \newskip\secondaryindent \secondaryindent=0.5cm
  1116.  
  1117. \def\secondary #1#2{
  1118. {\parfillskip=0in \parskip=0in
  1119. \hangindent =1in \hangafter=1
  1120. \noindent\hskip\secondaryindent\hbox{#1}\dotfill #2\par
  1121. }}
  1122.  
  1123. %% Define two-column mode, which is used in indexes.
  1124. %% Adapted from the TeXBook, page 416
  1125. \catcode `\@=11
  1126.  
  1127. \newbox\partialpage
  1128.  
  1129. \newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
  1130. \newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
  1131. \newdimen\availdimen@
  1132.  
  1133. \def\begindoublecolumns{\begingroup
  1134.   \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
  1135.   \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
  1136. \def\enddoublecolumns{\output={\balancecolumns}\eject
  1137.   \endgroup \pagegoal=\vsize}
  1138.  
  1139. \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1140.   \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1141.   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1142.   \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
  1143. \def\pagesofar{\unvbox\partialpage %
  1144.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1145. %          changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
  1146.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1147. \def\balancecolumns{%
  1148. % Unset the glue.
  1149.   \setbox255=\vbox{\unvbox255}
  1150.   \dimen@=\ht255
  1151.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1152.   \divide\dimen@ by2
  1153.   \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
  1154. % If the remaining data is too big for one page,
  1155. % output one page normally, then work with what remains.
  1156.   \ifdim \dimen@>\availdimen@
  1157.    {
  1158.      \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1159.      \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1160.      \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1161.      \onepageout\pagesofar
  1162.    }
  1163. % Recompute size of what remains, in case we just output some of it.
  1164.   \dimen@=\ht255
  1165.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1166.   \divide\dimen@ by2
  1167.   \fi
  1168.   \setbox0=\vbox{\unvbox255}
  1169.   \splittopskip=\topskip
  1170.   {\vbadness=10000 \loop \global\setbox3=\copy0
  1171.     \global\setbox1=\vsplit3 to\dimen@
  1172.     \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  1173.   \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
  1174.   \pagesofar}
  1175.  
  1176. \catcode `\@=\other
  1177. \message{sectioning,}
  1178. % Define chapters, sections, etc.
  1179.  
  1180. \newcount \chapno
  1181. \newcount \secno
  1182. \newcount \subsecno
  1183. \newcount \subsubsecno
  1184.  
  1185. % This counter is funny since it counts through charcodes of letters A, B, ...
  1186. \newcount \appendixno  \appendixno = `\@
  1187. \def\appendixletter{\char\the\appendixno}
  1188.  
  1189. \newwrite \contentsfile
  1190. % This is called from \setfilename.
  1191. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1192.  
  1193. % Each @chapter defines this as the name of the chapter.
  1194. % page headings and footings can use it.  @section does likewise
  1195.  
  1196. \def\thischapter{} \def\thissection{}
  1197. \def\seccheck#1{\if \pageno<0 %
  1198. \errmessage{@#1 not allowed after generating table of contents}\fi
  1199. %
  1200. }
  1201.  
  1202. \def\chapternofonts{%
  1203. \let\rawbackslash=\relax%
  1204. \let\frenchspacing=\relax%
  1205. \def\TeX{\realbackslash TeX}
  1206. \def\dots{\realbackslash dots}
  1207. \def\copyright{\realbackslash copyright}
  1208. \def\tt{\realbackslash tt}
  1209. \def\bf{\realbackslash bf }
  1210. \def\w{\realbackslash w}
  1211. \def\less{\realbackslash less}
  1212. \def\gtr{\realbackslash gtr}
  1213. \def\hat{\realbackslash hat}
  1214. \def\char{\realbackslash char}
  1215. \def\tclose##1{\realbackslash tclose {##1}}
  1216. \def\code##1{\realbackslash code {##1}}
  1217. \def\samp##1{\realbackslash samp {##1}}
  1218. \def\r##1{\realbackslash r {##1}}
  1219. \def\b##1{\realbackslash b {##1}}
  1220. \def\key##1{\realbackslash key {##1}}
  1221. \def\file##1{\realbackslash file {##1}}
  1222. \def\kbd##1{\realbackslash kbd {##1}}
  1223. % These are redefined because @smartitalic wouldn't work inside xdef.
  1224. \def\i##1{\realbackslash i {##1}}
  1225. \def\cite##1{\realbackslash cite {##1}}
  1226. \def\var##1{\realbackslash var {##1}}
  1227. \def\emph##1{\realbackslash emph {##1}}
  1228. \def\dfn##1{\realbackslash dfn {##1}}
  1229. }
  1230.  
  1231. \outer\def\chapter{\parsearg\chapterzzz}
  1232. \def\chapterzzz #1{\seccheck{chapter}%
  1233. \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1234. \chapmacro {#1}{\the\chapno}%
  1235. \gdef\thissection{#1}%
  1236. \gdef\thischaptername{#1}%
  1237. % We don't substitute the actual chapter name into \thischapter
  1238. % because we don't want its macros evaluated now.
  1239. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1240. {\chapternofonts%
  1241. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1242. \escapechar=`\\%
  1243. \write \contentsfile \temp  %
  1244. \donoderef %
  1245. }}
  1246.  
  1247. \outer\def\appendix{\parsearg\appendixzzz}
  1248. \def\appendixzzz #1{\seccheck{appendix}%
  1249. \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1250. \chapmacro {#1}{Appendix \appendixletter}%
  1251. \gdef\thissection{#1}%
  1252. \gdef\thischaptername{#1}%
  1253. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1254. {\chapternofonts%
  1255. \edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1256. \escapechar=`\\%
  1257. \write \contentsfile \temp  %
  1258. \appendixnoderef %
  1259. }}
  1260.  
  1261. \outer\def\unnumbered{\parsearg\unnumberedzzz}
  1262. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1263. \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
  1264. \unnumbchapmacro {#1}%
  1265. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1266. {\chapternofonts%
  1267. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1268. \escapechar=`\\%
  1269. \write \contentsfile \temp  %
  1270. \unnumbnoderef %
  1271. }}
  1272.  
  1273. \outer\def\section{\parsearg\sectionzzz}
  1274. \def\sectionzzz #1{\seccheck{section}%
  1275. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1276. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1277. {\chapternofonts%
  1278. \edef\temp{{\realbackslash secentry %
  1279. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1280. \escapechar=`\\%
  1281. \write \contentsfile \temp %
  1282. \donoderef %
  1283. \penalty 10000 %
  1284. }}
  1285.  
  1286. \outer\def\appendixsection{\parsearg\appendixsectionzzz}
  1287. \outer\def\appendixsec{\parsearg\appendixsectionzzz}
  1288. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1289. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1290. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1291. {\chapternofonts%
  1292. \edef\temp{{\realbackslash secentry %
  1293. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1294. \escapechar=`\\%
  1295. \write \contentsfile \temp %
  1296. \appendixnoderef %
  1297. \penalty 10000 %
  1298. }}
  1299.  
  1300. \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
  1301. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1302. \plainsecheading {#1}\gdef\thissection{#1}%
  1303. {\chapternofonts%
  1304. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1305. \escapechar=`\\%
  1306. \write \contentsfile \temp %
  1307. \unnumbnoderef %
  1308. \penalty 10000 %
  1309. }}
  1310.  
  1311. \outer\def\subsection{\parsearg\subsectionzzz}
  1312. \def\subsectionzzz #1{\seccheck{subsection}%
  1313. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1314. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1315. {\chapternofonts%
  1316. \edef\temp{{\realbackslash subsecentry %
  1317. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1318. \escapechar=`\\%
  1319. \write \contentsfile \temp %
  1320. \donoderef %
  1321. \penalty 10000 %
  1322. }}
  1323.  
  1324. \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
  1325. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1326. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1327. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1328. {\chapternofonts%
  1329. \edef\temp{{\realbackslash subsecentry %
  1330. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1331. \escapechar=`\\%
  1332. \write \contentsfile \temp %
  1333. \appendixnoderef %
  1334. \penalty 10000 %
  1335. }}
  1336.  
  1337. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1338. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1339. \plainsecheading {#1}\gdef\thissection{#1}%
  1340. {\chapternofonts%
  1341. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1342. \escapechar=`\\%
  1343. \write \contentsfile \temp %
  1344. \unnumbnoderef %
  1345. \penalty 10000 %
  1346. }}
  1347.  
  1348. \outer\def\subsubsection{\parsearg\subsubsectionzzz}
  1349. \def\subsubsectionzzz #1{\seccheck{subsubsection}%
  1350. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1351. \subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1352. {\chapternofonts%
  1353. \edef\temp{{\realbackslash subsubsecentry %
  1354. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
  1355. \escapechar=`\\%
  1356. \write \contentsfile \temp %
  1357. \donoderef %
  1358. \penalty 10000 %
  1359. }}
  1360.  
  1361. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1362. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1363. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1364. \subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1365. {\chapternofonts%
  1366. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1367. {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
  1368. \escapechar=`\\%
  1369. \write \contentsfile \temp %
  1370. \appendixnoderef %
  1371. \penalty 10000 %
  1372. }}
  1373.  
  1374. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1375. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1376. \plainsecheading {#1}\gdef\thissection{#1}%
  1377. {\chapternofonts%
  1378. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1379. \escapechar=`\\%
  1380. \write \contentsfile \temp %
  1381. \unnumbnoderef %
  1382. \penalty 10000 %
  1383. }}
  1384.  
  1385. % These are variants which are not "outer", so they can appear in @ifinfo.
  1386. \def\infounnumbered{\parsearg\unnumberedzzz}
  1387. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1388. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1389. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1390.  
  1391. \def\infoappendix{\parsearg\appendixzzz}
  1392. \def\infoappendixsec{\parsearg\appendixseczzz}
  1393. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1394. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1395.  
  1396. \def\infochapter{\parsearg\chapterzzz}
  1397. \def\infosection{\parsearg\sectionzzz}
  1398. \def\infosubsection{\parsearg\subsectionzzz}
  1399. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1400.  
  1401. % Define @majorheading, @heading and @subheading
  1402.  
  1403. \def\majorheading #1{%
  1404. {\advance\chapheadingskip by 10pt \chapbreak }%
  1405. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1406.  
  1407. \def\chapheading #1{\chapbreak %
  1408. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1409.  
  1410. \def\heading{\parsearg\secheadingi}
  1411.  
  1412. % These macros generate a chapter, section, etc. heading only
  1413. % (including whitespace, linebreaking, etc. around it),
  1414. % given all the information in convenient, parsed form.
  1415.  
  1416. %%% Args are the skip and penalty (usually negative)
  1417. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1418.  
  1419. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1420.  
  1421. %%% Define plain chapter starts, and page on/off switching for it
  1422. % Parameter controlling skip before chapter headings (if needed)
  1423.  
  1424. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1425.  
  1426. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1427. \def\chappager{\par\vfill\supereject}
  1428. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1429.  
  1430. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1431.  
  1432. \def\CHAPPAGoff{
  1433. \global\let\pchapsepmacro=\chapbreak
  1434. \global\let\pagealignmacro=\chappager}
  1435.  
  1436. \def\CHAPPAGon{
  1437. \global\let\pchapsepmacro=\chappager
  1438. \global\let\pagealignmacro=\chappager
  1439. \global\def\HEADINGSon{\HEADINGSsingle}}
  1440.  
  1441. \def\CHAPPAGodd{
  1442. \global\let\pchapsepmacro=\chapoddpage
  1443. \global\let\pagealignmacro=\chapoddpage
  1444. \global\def\HEADINGSon{\HEADINGSdouble}}
  1445.  
  1446. \CHAPPAGon
  1447.  
  1448. \def\CHAPFplain{
  1449. \global\let\chapmacro=\chfplain
  1450. \global\let\unnumbchapmacro=\unnchfplain}
  1451.  
  1452. \def\chfplain #1#2{%
  1453. \pchapsepmacro %
  1454. {\chapfonts \line{\rm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 %
  1455. }
  1456.  
  1457. \def\unnchfplain #1{%
  1458. \pchapsepmacro %
  1459. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1460. }
  1461. \CHAPFplain % The default
  1462.  
  1463. \def\unnchfopen #1{%
  1464. \chapoddpage {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1465. }
  1466.  
  1467. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1468. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1469. \par\penalty 5000 %
  1470. }
  1471.  
  1472. \def\CHAPFopen{
  1473. \global\let\chapmacro=\chfopen
  1474. \global\let\unnumbchapmacro=\unnchfopen}
  1475.  
  1476. % Parameter controlling skip before section headings.
  1477.  
  1478. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1479. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1480.  
  1481. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1482. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1483.  
  1484.  
  1485. % Section fonts are the base font at magstep2, which produces
  1486. % a size a bit more than 14 points in the default situation.    
  1487.  
  1488. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1489. \def\plainsecheading #1{\secheadingi {#1}}
  1490. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1491. \secheadingbreak}%
  1492. {\secfonts \line{\rm #1\hfill}}%
  1493. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1494.  
  1495.  
  1496. % Subsection fonts are the base font at magstep1, 
  1497. % which produces a size of 12 points.
  1498.  
  1499. \def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip %
  1500. \subsecheadingbreak}%
  1501. {\subsecfonts \line{\rm#2.#3.#4\enspace #1\hfill}}%
  1502. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1503.  
  1504. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1505.                   % Perhaps make sssec fonts scaled
  1506.                   % magstep half
  1507. \def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip %
  1508. \subsecheadingbreak}%
  1509. {\subsubsecfonts \line{\rm#2.#3.#4.#5\enspace #1\hfill}}%
  1510. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1511.  
  1512.  
  1513. \message{toc printing,}
  1514.  
  1515. % Finish up the main text and prepare to read what we've written
  1516. % to \contentsfile.
  1517.  
  1518. \def\startcontents#1{%
  1519.    \ifnum \pageno>0
  1520.       \pagealignmacro
  1521.       \immediate\closeout \contentsfile
  1522.       \pageno = -1        % Request roman numbered pages.
  1523.    \fi
  1524.    % Don't need to put `Contents' or `Short Contents' in the headline. 
  1525.    % It is abundantly clear what they are.
  1526.    \unnumbchapmacro{#1}\def\thischapter{}%
  1527.    \begingroup           % Set up to handle contents files properly.
  1528.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1529.       \raggedbottom             % Worry more about breakpoints than the bottom.
  1530.       \advance\hsize by -1in    % Don't use the full line length.
  1531. }
  1532.  
  1533.   
  1534. % Normal (long) toc.
  1535. \outer\def\contents{%
  1536.    \startcontents{Table of Contents}%
  1537.       \input \jobname.toc
  1538.    \endgroup
  1539.    \vfill \eject
  1540. }
  1541.  
  1542. % And just the chapters.
  1543. \outer\def\summarycontents{%
  1544.    \startcontents{Short Contents}%
  1545.       %
  1546.       \let\chapentry = \shortchapentry
  1547.       \let\unnumbchapentry = \shortunnumberedentry
  1548.       % We want a true roman here for the page numbers.
  1549.       \secfonts \let\rm = \truesecrm \rm
  1550.       \advance\baselineskip by 1pt % Open it up a little.
  1551.       \def\secentry ##1##2##3##4{}
  1552.       \def\unnumbsecentry ##1##2{}
  1553.       \def\subsecentry ##1##2##3##4##5{}
  1554.       \def\unnumbsubsecentry ##1##2{}
  1555.       \def\subsubsecentry ##1##2##3##4##5##6{}
  1556.       \def\unnumbsubsubsecentry ##1##2{}
  1557.       \input \jobname.toc
  1558.    \endgroup
  1559.    \vfill \eject
  1560. }
  1561. \let\shortcontents = \summarycontents
  1562.  
  1563. % These macros generate individual entries in the table of contents.
  1564. % The first argument is the chapter or section name.
  1565. % The last argument is the page number.
  1566. % The arguments in between are the chapter number, section number, ...
  1567.  
  1568. % Chapter-level things, for both the long and short contents.
  1569. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  1570. \def\shortchapentry#1#2#3{%
  1571.    \line{{#2\labelspace #1}\dotfill\doshortpageno{#3}}%
  1572. }
  1573.  
  1574. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  1575. \def\shortunnumberedentry#1#2{%
  1576.    \line{#1\dotfill\doshortpageno{#2}}%
  1577. }
  1578.  
  1579. % Sections.
  1580. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  1581. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  1582.  
  1583. % Subsections.
  1584. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  1585. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  1586.  
  1587. % And subsubsections.
  1588. \def\subsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  1589. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  1590.  
  1591.  
  1592. % This parameter controls the indentation of the various levels.
  1593. \newdimen\tocindent \tocindent = 3pc
  1594.  
  1595. % Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  1596. % page number.
  1597. %
  1598. % If the toc has to be broken over pages, we would want to be at chapters 
  1599. % if at all possible; hence the \penalty.
  1600. \def\dochapentry#1#2{%
  1601.    \penalty-300 \vskip\baselineskip
  1602.    \line{\chapentryfonts #1\dotfill \dopageno{#2}}%
  1603.    \nobreak\vskip .25\baselineskip
  1604. }
  1605.  
  1606. \def\dosecentry#1#2{%
  1607.    \line{\secentryfonts \hskip\tocindent #1\dotfill \dopageno{#2}}%
  1608. }
  1609.  
  1610. \def\dosubsecentry#1#2{%
  1611.    \line{\subsecentryfonts \hskip2\tocindent #1\dotfill \dopageno{#2}}%
  1612. }
  1613.  
  1614. \def\dosubsubsecentry#1#2{%
  1615.    \line{\subsubsecentryfonts \hskip3\tocindent #1\dotfill \dopageno{#2}}%
  1616. }
  1617.  
  1618. % Space between chapter (or whatever) number and the title.
  1619. \def\labelspace{\hskip1em \relax}
  1620.  
  1621. \def\dopageno#1{{\rm #1}}
  1622. \def\doshortpageno#1{{\rm #1}}
  1623.  
  1624. \def\chapentryfonts{\secfonts \rm}
  1625. \def\secentryfonts{\textfonts}
  1626. \let\subsecentryfonts = \textfonts
  1627. \let\subsubsecentryfonts = \textfonts
  1628.  
  1629.  
  1630. \message{environments,}
  1631.  
  1632. % Since these characters are used in examples, it should be an even number of 
  1633. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  1634. % Furthermore, these definitions must come after we define our fonts.
  1635. \newbox\dblarrowbox    \newbox\longdblarrowbox
  1636. \newbox\pushcharbox    \newbox\bullbox
  1637. \newbox\equivbox       \newbox\errorbox
  1638.  
  1639. \let\ptexequiv = \equiv
  1640.  
  1641. {\tentt
  1642. \global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  1643. \global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  1644. \global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  1645. \global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  1646. % Adapted from the manmac format (p.420 of TeXbook)
  1647. \global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  1648.                                       depth .1ex\hfil}
  1649. }
  1650.  
  1651. \def\point{$\star$}
  1652.  
  1653. \def\result{\leavevmode\raise.15ex\copy\dblarrowbox}
  1654. \def\expansion{\leavevmode\raise.1ex\copy\longdblarrowbox}
  1655. \def\print{\leavevmode\lower.1ex\copy\pushcharbox}
  1656.  
  1657. \def\equiv{\leavevmode\lower.1ex\copy\equivbox}
  1658.  
  1659. % Does anyone really want this?
  1660. % \def\bull{\leavevmode\copy\bullbox}
  1661.  
  1662. % Adapted from the TeXbook's \boxit.
  1663. {\tentt \global\dimen0 = 3em}% Width of the box.
  1664. \dimen2 = .55pt % Thickness of rules
  1665. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  1666. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  1667.  
  1668. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  1669.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  1670.    \advance\hsize by -2\dimen2 % Rules.
  1671.    \vbox{
  1672.       \hrule height\dimen2
  1673.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  1674.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  1675.          \kern3pt\vrule width\dimen2}% Space to right.
  1676.       \hrule height\dimen2}
  1677.     \hfil}
  1678.  
  1679. % The @error{} command.
  1680. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  1681.  
  1682. % @tex ... @end tex    escapes into raw Tex temporarily.
  1683. % One exception: @ is still an escape character, so that @end tex works.
  1684. % But \@ or @@ will get a plain tex @ character.
  1685.  
  1686. \def\tex{\begingroup
  1687. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  1688. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  1689. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  1690. \catcode `\%=14
  1691. \catcode`\"=12
  1692. \catcode`\==12
  1693. \catcode`\|=12
  1694. \catcode`\<=12
  1695. \catcode`\>=12
  1696. \escapechar=`\\
  1697. %
  1698. \let\{=\ptexlbrace
  1699. \let\}=\ptexrbrace
  1700. \let\.=\ptexdot
  1701. \let\*=\ptexstar
  1702. \def\@={@}%
  1703. \let\bullet=\ptexbullet
  1704. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  1705. \let\L=\ptexL
  1706. %
  1707. \let\Etex=\endgroup}
  1708.  
  1709. % Define @lisp ... @endlisp.
  1710. % @lisp does a \begingroup so it can rebind things,
  1711. % including the definition of @endlisp (which normally is erroneous).
  1712.  
  1713. % Amount to narrow the margins by for @lisp.
  1714. \newskip\lispnarrowing \lispnarrowing=0.4in
  1715.  
  1716. % This is the definition that ^M gets inside @lisp
  1717. % phr: changed space to \null, to avoid overfull hbox problems.
  1718. {\obeyspaces%
  1719. \gdef\lisppar{\null\endgraf}}
  1720.  
  1721. % Cause \obeyspaces to make each Space cause a word-separation
  1722. % rather than the default which is that it acts punctuation.
  1723. % This is because space in tt font looks funny.
  1724. {\obeyspaces %
  1725. \gdef\sepspaces{\def {\ }}}
  1726.  
  1727. \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
  1728. \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
  1729. \endgraf \ifdim\lastskip<\aboveenvskipamount
  1730. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
  1731.  
  1732. \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
  1733. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
  1734.  
  1735. \def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body
  1736. \hfuzz=12truept % Don't be fussy
  1737. % Make spaces be word-separators rather than space tokens.
  1738. \sepspaces %
  1739. % Single space lines
  1740. \singlespace %
  1741. % The following causes blank lines not to be ignored
  1742. % by adding a space to the end of each line.
  1743. \let\par=\lisppar
  1744. \def\Elisp{\endgroup\afterenvbreak}%
  1745. \parskip=0pt
  1746. \advance \leftskip by \lispnarrowing
  1747. \parindent=0pt
  1748. \let\exdent=\internalexdent
  1749. \obeyspaces \obeylines \tt \rawbackslash
  1750. \def\next##1{}\next}
  1751.  
  1752.  
  1753. \let\example=\lisp
  1754. \def\Eexample{\Elisp}
  1755.  
  1756. \let\smallexample=\lisp
  1757. \def\Esmallexample{\Elisp}
  1758.  
  1759. % Macro for 9 pt. examples, necessary to print with 5" lines.
  1760. % From Pavel@xerox.  This is not really used unless the
  1761. % @smallbook command is given.
  1762.  
  1763. \def\smalllispx{\aboveenvbreak\begingroup\inENV
  1764. %            This group ends at the end of the @lisp body
  1765. \hfuzz=12truept % Don't be fussy
  1766. % Make spaces be word-separators rather than space tokens.
  1767. \sepspaces %
  1768. % Single space lines
  1769. \singlespace %
  1770. % The following causes blank lines not to be ignored
  1771. % by adding a space to the end of each line.
  1772. \let\par=\lisppar
  1773. \def\Esmalllisp{\endgroup\afterenvbreak}%
  1774. \parskip=0pt
  1775. \advance \leftskip by \lispnarrowing
  1776. \parindent=0pt
  1777. \let\exdent=\internalexdent
  1778. \obeyspaces \obeylines \ninett \rawbackslash
  1779. \def\next##1{}\next}
  1780.  
  1781. % This is @display; same as @lisp except use roman font.
  1782.  
  1783. \def\display{\begingroup\inENV %This group ends at the end of the @display body
  1784. \aboveenvbreak
  1785. % Make spaces be word-separators rather than space tokens.
  1786. \sepspaces %
  1787. % Single space lines
  1788. \singlespace %
  1789. % The following causes blank lines not to be ignored
  1790. % by adding a space to the end of each line.
  1791. \let\par=\lisppar
  1792. \def\Edisplay{\endgroup\afterenvbreak}%
  1793. \parskip=0pt
  1794. \advance \leftskip by \lispnarrowing
  1795. \parindent=0pt
  1796. \let\exdent=\internalexdent
  1797. \obeyspaces \obeylines
  1798. \def\next##1{}\next}
  1799.  
  1800. % This is @format; same as @lisp except use roman font and don't narrow margins
  1801.  
  1802. \def\format{\begingroup\inENV %This group ends at the end of the @format body
  1803. \aboveenvbreak
  1804. % Make spaces be word-separators rather than space tokens.
  1805. \sepspaces %
  1806. \singlespace %
  1807. % The following causes blank lines not to be ignored
  1808. % by adding a space to the end of each line.
  1809. \let\par=\lisppar
  1810. \def\Eformat{\endgroup\afterenvbreak}
  1811. \parskip=0pt \parindent=0pt
  1812. \obeyspaces \obeylines
  1813. \def\next##1{}\next}
  1814.  
  1815. % @flushleft and @flushright
  1816.  
  1817. \def\flushleft{\begingroup\inENV %This group ends at the end of the @format body
  1818. \aboveenvbreak
  1819. % Make spaces be word-separators rather than space tokens.
  1820. \sepspaces %
  1821. % The following causes blank lines not to be ignored
  1822. % by adding a space to the end of each line.
  1823. % This also causes @ to work when the directive name
  1824. % is terminated by end of line.
  1825. \let\par=\lisppar
  1826. \def\Eflushleft{\endgroup\afterenvbreak}%
  1827. \parskip=0pt \parindent=0pt
  1828. \obeyspaces \obeylines
  1829. \def\next##1{}\next}
  1830.  
  1831. \def\flushright{\begingroup\inENV %This group ends at the end of the @format body
  1832. \aboveenvbreak
  1833. % Make spaces be word-separators rather than space tokens.
  1834. \sepspaces %
  1835. % The following causes blank lines not to be ignored
  1836. % by adding a space to the end of each line.
  1837. % This also causes @ to work when the directive name
  1838. % is terminated by end of line.
  1839. \let\par=\lisppar
  1840. \def\Eflushright{\endgroup\afterenvbreak}%
  1841. \parskip=0pt \parindent=0pt
  1842. \advance \leftskip by 0pt plus 1fill
  1843. \obeyspaces \obeylines
  1844. \def\next##1{}\next}
  1845.  
  1846. % @quotation - narrow the margins.
  1847.  
  1848. \def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body
  1849. {\parskip=0pt  % because we will skip by \parskip too, later
  1850. \aboveenvbreak}%
  1851. \singlespace
  1852. \parindent=0pt
  1853. \def\Equotation{\par\endgroup\afterenvbreak}%
  1854. \advance \rightskip by \lispnarrowing 
  1855. \advance \leftskip by \lispnarrowing}
  1856.  
  1857. \message{defuns,}
  1858. % Define formatter for defuns
  1859. % First, allow user to change definition object font (\df) internally
  1860. \def\setdeffont #1 {\csname DEF#1\endcsname}
  1861.  
  1862. \newskip\defbodyindent \defbodyindent=.4in
  1863. \newskip\defargsindent \defargsindent=50pt
  1864. \newskip\deftypemargin \deftypemargin=12pt
  1865. \newskip\deflastargmargin \deflastargmargin=18pt
  1866.  
  1867. \newcount\parencount
  1868. % define \functionparens, which makes ( and ) and & do special things.
  1869. % \functionparens affects the group it is contained in.
  1870. \def\activeparens{%
  1871. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  1872. \catcode`\[=\active \catcode`\]=\active}
  1873. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  1874. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  1875. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  1876.  
  1877. % Definitions of (, ) and & used in args for functions.
  1878. % This is the definition of ( outside of all parentheses.
  1879. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  1880. \global\advance\parencount by 1 }
  1881. %
  1882. % This is the definition of ( when already inside a level of parens.
  1883. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  1884. %
  1885. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  1886. % also in that case restore the outer-level definition of (.
  1887. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  1888. \global\advance \parencount by -1 }
  1889. % If we encounter &foo, then turn on ()-hacking afterwards
  1890. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  1891. %
  1892. \gdef\normalparens{\boldbrax\let&=\ampnr}
  1893. } % End of definition inside \activeparens
  1894. %% These parens (in \boldbrax) actually are a little bolder than the
  1895. %% contained text.  This is especially needed for [ and ]
  1896. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  1897. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  1898.  
  1899. % First, defname, which formats the header line itself.
  1900. % #1 should be the function name.
  1901. % #2 should be the type of definition, such as "Function".
  1902.  
  1903. \def\defname #1#2{%
  1904. \leftskip = 0in  %
  1905. \noindent        %
  1906. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  1907. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  1908. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  1909. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  1910. % Now output arg 2 ("Function" or some such)
  1911. % ending at \deftypemargin from the right margin,
  1912. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  1913. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}%
  1914. \tolerance=10000 \hbadness=10000    % Make all lines underfull and no complaints
  1915. {\df #1}\enskip        % Generate function name
  1916. }
  1917.  
  1918. % Actually process the body of a definition
  1919. % #1 should be the terminating control sequence, such as \Edefun.
  1920. % #2 should be the "another name" control sequence, such as \defunx.
  1921. % #3 should be the control sequence that actually processes the header,
  1922. %    such as \defunheader.
  1923.  
  1924. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  1925. \medbreak %
  1926. % Define the end token that this defining construct specifies
  1927. % so that it will exit this group.
  1928. \def#1{\endgraf\endgroup\medbreak}%
  1929. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  1930. \parindent=0in \leftskip=\defbodyindent \rightskip=\defbodyindent %
  1931. \begingroup %
  1932. \catcode 61=\active %
  1933. \obeylines\activeparens\spacesplit#3}
  1934.  
  1935. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  1936. \medbreak %
  1937. % Define the end token that this defining construct specifies
  1938. % so that it will exit this group.
  1939. \def#1{\endgraf\endgroup\medbreak}%
  1940. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  1941. \parindent=0in \leftskip=\defbodyindent \rightskip=\defbodyindent %
  1942. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  1943.  
  1944. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  1945. \medbreak %
  1946. % Define the end token that this defining construct specifies
  1947. % so that it will exit this group.
  1948. \def#1{\endgraf\endgroup\medbreak}%
  1949. \def#2##1 ##2 {\def#4{##1}%
  1950. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  1951. \parindent=0in \leftskip=\defbodyindent %
  1952. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  1953.  
  1954. % Split up #2 at the first space token.
  1955. % call #1 with two arguments:
  1956. %  the first is all of #2 before the space token,
  1957. %  the second is all of #2 after that space token.
  1958. % If #2 contains no space token, all of it is passed as the first arg
  1959. % and the second is passed as empty.
  1960.  
  1961. {\obeylines
  1962. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  1963. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  1964. \ifx\relax #3%
  1965. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  1966.  
  1967. % So much for the things common to all kinds of definitions.
  1968.  
  1969. % Define @defun.
  1970.  
  1971. % First, define the processing that is wanted for arguments of \defun
  1972. % Use this to expand the args and terminate the paragraph they make up
  1973.  
  1974. \def\defunargs #1{\functionparens \sl
  1975. % Expand, preventing hyphenation at `-' chars.
  1976. % Note that groups don't affect changes in \hyphenchar.
  1977. \hyphenchar\sl=0
  1978. #1%
  1979. \hyphenchar\sl=45
  1980. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  1981. \interlinepenalty=10000
  1982. \advance\rightskip by 0pt plus 1fil
  1983. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  1984. }
  1985.  
  1986. % Do complete processing of one @defun or @defunx line already parsed.
  1987.  
  1988. % @deffn Command forward-char nchars
  1989.  
  1990. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  1991.  
  1992. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  1993. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  1994. \catcode 61=\other % Turn off change made in \defparsebody
  1995. }
  1996.  
  1997. % @defun == @deffn Function
  1998.  
  1999. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2000.  
  2001. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2002. \begingroup\defname {#1}{Function}%
  2003. \defunargs {#2}\endgroup %
  2004. \catcode 61=\other % Turn off change made in \defparsebody
  2005. }
  2006.  
  2007. % @defmac == @deffn Macro
  2008.  
  2009. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2010.  
  2011. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2012. \begingroup\defname {#1}{Macro}%
  2013. \defunargs {#2}\endgroup %
  2014. \catcode 61=\other % Turn off change made in \defparsebody
  2015. }
  2016.  
  2017. % @defspec == @deffn Special Form
  2018.  
  2019. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2020.  
  2021. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2022. \begingroup\defname {#1}{Special form}%
  2023. \defunargs {#2}\endgroup %
  2024. \catcode 61=\other % Turn off change made in \defparsebody
  2025. }
  2026.  
  2027. % This definition is run if you use @defunx
  2028. % anywhere other than immediately after a @defun or @defunx.
  2029.  
  2030. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2031. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2032. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2033. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2034.  
  2035. % @defmethod, and so on
  2036.  
  2037. % @defop {Funny Method} foo-class frobnicate argument
  2038.  
  2039. \def\defop #1 {\def\defoptype{#1}%
  2040. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2041.  
  2042. \def\defopheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2043. \begingroup\defname {#2}{\defoptype{} on #1}%
  2044. \defunargs {#3}\endgroup %
  2045. }
  2046.  
  2047. % @defmethod == @defop Method
  2048.  
  2049. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2050.  
  2051. \def\defmethodheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2052. \begingroup\defname {#2}{Operation on #1}%
  2053. \defunargs {#3}\endgroup %
  2054. }
  2055.  
  2056. % @defcv {Class Option} foo-class foo-flag
  2057.  
  2058. \def\defcv #1 {\def\defcvtype{#1}%
  2059. \defopparsebody\Edefcv\defcvx\defcvheader\defcvtype}
  2060.  
  2061. \def\defcvarheader #1#2#3{%
  2062. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2063. \begingroup\defname {#2}{\defcvtype of #1}%
  2064. \defvarargs {#3}\endgroup %
  2065. }
  2066.  
  2067. % @defivar == @defcv {Instance Variable}
  2068.  
  2069. \def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
  2070.  
  2071. \def\defivarheader #1#2#3{%
  2072. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2073. \begingroup\defname {#2}{Instance variable of #1}%
  2074. \defvarargs {#3}\endgroup %
  2075. }
  2076.  
  2077. % These definitions are run if you use @defmethodx, etc.,
  2078. % anywhere other than immediately after a @defmethod, etc.
  2079.  
  2080. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2081. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2082. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2083. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2084.  
  2085. % Now @defvar
  2086.  
  2087. % First, define the processing that is wanted for arguments of @defvar.
  2088. % This is actually simple: just print them in roman.
  2089. % This must expand the args and terminate the paragraph they make up
  2090. \def\defvarargs #1{\normalparens #1%
  2091. \interlinepenalty=10000
  2092. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2093.  
  2094. % @defvr Counter foo-count
  2095.  
  2096. \def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
  2097.  
  2098. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2099. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2100.  
  2101. % @defvar == @defvr Variable
  2102.  
  2103. \def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
  2104.  
  2105. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2106. \begingroup\defname {#1}{Variable}%
  2107. \defvarargs {#2}\endgroup %
  2108. }
  2109.  
  2110. % @defopt == @defvr {User Option}
  2111.  
  2112. \def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
  2113.  
  2114. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2115. \begingroup\defname {#1}{User Option}%
  2116. \defvarargs {#2}\endgroup %
  2117. }
  2118.  
  2119. % This definition is run if you use @defvarx
  2120. % anywhere other than immediately after a @defvar or @defvarx.
  2121.  
  2122. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2123. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2124. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2125.  
  2126. % Now define @deftp
  2127. % Args are printed in bold, a slight difference from @defvar.
  2128.  
  2129. \def\deftpargs #1{\bf \defvarargs{#1}}
  2130.  
  2131. % @deftp Class window height width ...
  2132.  
  2133. \def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
  2134.  
  2135. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2136. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2137.  
  2138. % This definition is run if you use @deftpx, etc
  2139. % anywhere other than immediately after a @deftp, etc.
  2140.  
  2141. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2142.  
  2143. \message{cross reference,}
  2144. % Define cross-reference macros
  2145. \newwrite \auxfile
  2146.  
  2147. \newif\ifhavexrefs  % True if xref values are known.
  2148. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2149.  
  2150. % \setref{foo} defines a cross-reference point named foo.
  2151.  
  2152. \def\setref#1{%
  2153. \dosetq{#1-pg}{Ypagenumber}%
  2154. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2155.  
  2156. \def\unnumbsetref#1{%
  2157. \dosetq{#1-pg}{Ypagenumber}%
  2158. \dosetq{#1-snt}{Ynothing}}
  2159.  
  2160. \def\appendixsetref#1{%
  2161. \dosetq{#1-pg}{Ypagenumber}%
  2162. \dosetq{#1-snt}{Yappendixletterandtype}}
  2163.  
  2164. % \xref and \pxref generate cross references to specified points.
  2165.  
  2166. \def\pxref #1{see \xrefX [#1,,,,,,,]}
  2167. \def\xref #1{See \xrefX [#1,,,,,,,]}
  2168. \def\ref #1{\xrefX [#1,,,,,,,]}
  2169. \def\xrefX [#1,#2,#3,#4,#5,#6]{%
  2170. \setbox1=\hbox{\i{\losespace#5{}}}%
  2171. \setbox0=\hbox{\losespace#3{}}%
  2172. \ifdim \wd0 =0pt \setbox0=\hbox{\losespace#1{}}\fi%
  2173. \ifdim \wd1 >0pt%
  2174. section `\unhbox0' in \unhbox1%
  2175. \else%
  2176. \refx{#1-snt}{} [\unhbox0], page\tie \refx{#1-pg}{}%
  2177. \fi }
  2178.  
  2179. % \dosetq is the interface for calls from other macros
  2180.  
  2181. \def\dosetq #1#2{{\let\folio=0%
  2182. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2183. \next}}
  2184.  
  2185. % \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2186. % When the aux file is read, ' is the escape character
  2187.  
  2188. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2189.  
  2190. % Things to be expanded by \internalsetq
  2191.  
  2192. \def\Ypagenumber{\folio}
  2193.  
  2194. \def\Ynothing{}
  2195.  
  2196. \def\Ysectionnumberandtype{%
  2197. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2198. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2199. \else \ifnum \subsubsecno=0 %
  2200. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2201. \else %
  2202. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2203. \fi \fi \fi }
  2204.  
  2205. \def\Yappendixletterandtype{%
  2206. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno %
  2207. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2208. \else \ifnum \subsubsecno=0 %
  2209. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2210. \else %
  2211. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2212. \fi \fi \fi }
  2213.  
  2214. \gdef\xreftie{'tie}
  2215.  
  2216. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2217. % If its value is nonempty, SUFFIX is output afterward.
  2218.  
  2219. \def\refx#1#2{%
  2220. {%
  2221. \expandafter\ifx\csname X#1\endcsname\relax
  2222. % If not defined, say something at least.
  2223. {$\langle$un\-def\-in\-ed$\rangle$}#2%
  2224. \ifhavexrefs
  2225. \message {WARNING: undefined cross-reference "#1"}%
  2226. \message {}%
  2227. \else
  2228. \ifwarnedxrefs
  2229. \else
  2230. \global\warnedxrefstrue
  2231. \message {WARNING: cross-references values are not known; you must run TeX a second time}%
  2232. \message {}%
  2233. \fi
  2234. \fi
  2235. \fi
  2236. \setbox0=\hbox{\csname X#1\endcsname}%It's defined, so just use it.
  2237. \ifdim\wd0>0pt \unhbox0{}#2\fi
  2238. }}
  2239.  
  2240. % Read the last existing aux file, if any.  No error if none exists.
  2241.  
  2242. % This is the macro invoked by entries in the aux file.
  2243. \def\xrdef #1#2{
  2244. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2245.  
  2246. \def\readauxfile{%
  2247. \begingroup
  2248. \catcode `\^^@=\other
  2249. \catcode `\⇧=\other
  2250. \catcode `\⇩=\other
  2251. \catcode `\^^C=\other
  2252. \catcode `\^^D=\other
  2253. \catcode `\^^E=\other
  2254. \catcode `\^^F=\other
  2255. \catcode `\^^G=\other
  2256. \catcode `\^^H=\other
  2257. \catcode `\♪=\other
  2258. \catcode `\^^L=\other
  2259. \catcode `\=\other
  2260. \catcode `\=\other
  2261. \catcode `\⓪=\other
  2262. \catcode `\①=\other
  2263. \catcode `\②=\other
  2264. \catcode `\③=\other
  2265. \catcode `\④=\other
  2266. \catcode `\⑤=\other
  2267. \catcode `\⑥=\other
  2268. \catcode `\⑦=\other
  2269. \catcode `\⑧=\other
  2270. \catcode `\⑨=\other
  2271. \catcode `\ə=\other
  2272. \catcode `\^^[=\other
  2273. \catcode `\^^\=\other
  2274. \catcode `\^^]=\other
  2275. \catcode `\^^^=\other
  2276. \catcode `\^^_=\other
  2277. \catcode `\@=\other
  2278. \catcode `\^=\other
  2279. \catcode `\~=\other
  2280. \catcode `\[=\other
  2281. \catcode `\]=\other
  2282. \catcode`\"=\other
  2283. \catcode`\_=\other
  2284. \catcode`\|=\other
  2285. \catcode`\<=\other
  2286. \catcode`\>=\other
  2287. \catcode `\$=\other
  2288. \catcode `\#=\other
  2289. \catcode `\&=\other
  2290. % the aux file uses ' as the escape.
  2291. % Turn off \ as an escape so we do not lose on
  2292. % entries which were dumped with control sequences in their names.
  2293. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2294. % Reference to such entries still does not work the way one would wish,
  2295. % but at least they do not bomb out when the aux file is read in.
  2296. \catcode `\{=1 \catcode `\}=2
  2297. \catcode `\%=\other
  2298. \catcode `\'=0
  2299. \catcode `\\=\other
  2300. \openin 1 \jobname.aux
  2301. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2302. \fi
  2303. % Open the new aux file.  Tex will close it automatically at exit.
  2304. \openout \auxfile=\jobname.aux
  2305. \endgroup}
  2306.  
  2307.  
  2308. % Footnotes.
  2309.  
  2310. \newcount \footnoteno
  2311.  
  2312. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2313.  
  2314. \let\ptexfootnote=\footnote
  2315.  
  2316. {\catcode `\@=11
  2317. \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
  2318. \edef\thisfootno{$^{\the\footnoteno}$}%
  2319. \let\@sf\empty
  2320. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2321. \thisfootno\@sf \footnotezzz{#1}}
  2322. % \parsearg\footnotezzz}
  2323.  
  2324. \long\gdef\footnotezzz #1{\insert\footins{
  2325. \interlinepenalty\interfootnotelinepenalty
  2326. \splittopskip\ht\strutbox % top baseline for broken footnotes
  2327. \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  2328. \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  2329. \footstrut\hang\textindent{\thisfootno}#1\strut}}
  2330.  
  2331. }%end \catcode `\@=11
  2332.  
  2333. % End of control word definitions.
  2334.  
  2335. \message{and turning on texinfo input format.}
  2336.  
  2337. \def\openindices{%
  2338.    \newindex{cp}%
  2339.    \newcodeindex{fn}%
  2340.    \newcodeindex{vr}%
  2341.    \newcodeindex{tp}%
  2342.    \newcodeindex{ky}%
  2343.    \newcodeindex{pg}%
  2344. }
  2345.  
  2346. % Set some numeric style parameters, for 8.5 x 11 format.
  2347.  
  2348. %\hsize = 6.5in
  2349. \parindent 15pt
  2350. \parskip 18pt plus 1pt
  2351. \baselineskip 15pt
  2352. \advance\topskip by 1.2cm
  2353.  
  2354. % Prevent underfull vbox error messages.
  2355. \vbadness=10000
  2356.  
  2357. % Use @smallbook to reset parameters for 7x9.5 format
  2358. \def\smallbook{
  2359. \global\lispnarrowing = 0.3in
  2360. \global\baselineskip 12pt
  2361. \global\parskip 3pt plus 1pt
  2362. \global\hsize = 5in
  2363. \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
  2364. \global\vsize=7.5in
  2365. \global\tolerance=700
  2366. \global\hfuzz=1pt
  2367.  
  2368. \global\pagewidth=\hsize
  2369. \global\pageheight=\vsize
  2370.  
  2371. \global\let\smalllisp=\smalllispx
  2372. \global\let\smallexample=\smalllispx
  2373. \global\def\Esmallexample{\Esmalllisp}
  2374. }
  2375.  
  2376. %% For a final copy, take out the rectangles
  2377. %% that mark overfull boxes (in case you have decided
  2378. %% that the text looks ok even though it passes the margin).
  2379. \def\finalout{\overfullrule=0pt}
  2380.  
  2381. % Turn off all special characters except @
  2382. % (and those which the user can use as if they were ordinary)
  2383. % Define certain chars to be always in tt font.
  2384.  
  2385. \catcode`\"=\active
  2386. \def\activedoublequote{{\tt \char '042}}
  2387. \let"=\activedoublequote
  2388. \catcode`\~=\active
  2389. \def~{{\tt \char '176}}
  2390. \chardef\hat=`\^
  2391. \catcode`\^=\active
  2392. \def^{{\tt \hat}}
  2393. \catcode`\_=\active
  2394. \def_{{\tt \char '137}}
  2395. \catcode`\|=\active
  2396. \def|{{\tt \char '174}}
  2397. \chardef \less=`\<
  2398. \catcode`\<=\active
  2399. \def<{{\tt \less}}
  2400. \chardef \gtr=`\>
  2401. \catcode`\>=\active
  2402. \def>{{\tt \gtr}}
  2403. \catcode`\+=\active
  2404. \def+{{\tt \char 43}}
  2405. %\catcode 27=\active
  2406. %\def^^[{$\diamondsuit$}
  2407.  
  2408. % Set up an active definition for =, but don't enable it most of the time.
  2409. {\catcode`\==\active
  2410. \global\def={{\tt \char 61}}}
  2411.  
  2412. \catcode`\@=0
  2413.  
  2414. % \rawbackslashxx output one backslash character in current font
  2415. \global\chardef\rawbackslashxx=`\\
  2416. %{\catcode`\\=\other
  2417. %@gdef@rawbackslashxx{\}}
  2418.  
  2419. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  2420. {\catcode`\\=\active
  2421. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  2422.  
  2423. % \normalbackslash outputs one backslash in fixed width font.
  2424. \def\normalbackslash{{\tt\rawbackslashxx}}
  2425.  
  2426. % Say @foo, not \foo, in error messages.
  2427. \escapechar=`\@
  2428.  
  2429. @c \catcode 17=0   @c Define control-q
  2430. \catcode`\\=\active
  2431.  
  2432. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  2433. % That is what \eatinput is for; after that, the `\' should revert to printing 
  2434. % a backslash.
  2435. %
  2436. @gdef@eatinput input texinfo{@fixbackslash}
  2437. @global@let\ = @eatinput
  2438.  
  2439. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  2440. % the first `\{ in the file would cause an error. This macro tries to fix 
  2441. % that, assuming it is called before the first `\' could plausibly occur.
  2442. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  2443.  
  2444. %% These look ok in all fonts, so just make them not special.  The @rm below
  2445. %% makes sure that the current font starts out as the newly loaded cmr10
  2446. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  2447.  
  2448. @textfonts
  2449. @rm
  2450.