Whamcloud - gitweb
libext2fs: create the block bitmap checksum
[tools/e2fsprogs.git] / lib / et / texinfo.tex
1 %% TeX macros to handle texinfo files
2
3 %   Copyright (C) 1985, 1986, 1988 Richard M. Stallman
4
5 %                      NO WARRANTY
6
7 %  BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
8 %NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
9 %WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
10 %RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
11 %WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
12 %BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
13 %FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
14 %AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
15 %DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
16 %CORRECTION.
17
18 % IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
19 %STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
20 %WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
21 %LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
22 %OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
23 %USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
24 %DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
25 %A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
26 %PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
27 %DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
28
29 %               GENERAL PUBLIC LICENSE TO COPY
30
31 %  1. You may copy and distribute verbatim copies of this source file
32 %as you receive it, in any medium, provided that you conspicuously
33 %and appropriately publish on each copy a valid copyright notice
34 %"Copyright (C) 1986 Richard M. Stallman"; and include
35 %following the copyright notice a verbatim copy of the above disclaimer
36 %of warranty and of this License.
37
38 %  2. You may modify your copy or copies of this source file or
39 %any portion of it, and copy and distribute such modifications under
40 %the terms of Paragraph 1 above, provided that you also do the following:
41
42 %    a) cause the modified files to carry prominent notices stating
43 %    that you changed the files and the date of any change; and
44
45 %    b) cause the whole of any work that you distribute or publish,
46 %    that in whole or in part contains or is a derivative of this
47 %    program or any part thereof, to be licensed at no charge to all
48 %    third parties on terms identical to those contained in this
49 %    License Agreement (except that you may choose to grant more extensive
50 %    warranty protection to some or all third parties, at your option).
51
52 %    c) You may charge a distribution fee for the physical act of
53 %    transferring a copy, and you may at your option offer warranty
54 %    protection in exchange for a fee.
55
56 %Mere aggregation of another unrelated program with this program (or its
57 %derivative) on a volume of a storage or distribution medium does not bring
58 %the other program under the scope of these terms.
59
60 %  3. You may copy and distribute this program (or a portion or derivative
61 %of it, under Paragraph 2) in object code or executable form under the terms
62 %of Paragraphs 1 and 2 above provided that you also do one of the following:
63
64 %    a) accompany it with the complete corresponding machine-readable
65 %    source code, which must be distributed under the terms of
66 %    Paragraphs 1 and 2 above; or,
67
68 %    b) accompany it with a written offer, valid for at least three
69 %    years, to give any third party free (except for a nominal
70 %    shipping charge) a complete machine-readable copy of the
71 %    corresponding source code, to be distributed under the terms of
72 %    Paragraphs 1 and 2 above; or,
73
74 %    c) accompany it with the information you received as to where the
75 %    corresponding source code may be obtained.  (This alternative is
76 %    allowed only for noncommercial distribution and only if you
77 %    received the program in object code or executable form alone.)
78
79 %For an executable file, complete source code means all the source code for
80 %all modules it contains; but, as a special exception, it need not include
81 %source code for modules which are standard libraries that accompany the
82 %operating system on which the executable file runs.
83
84 %  4. You may not copy, sublicense, distribute or transfer this program
85 %except as expressly provided under this License Agreement.  Any attempt
86 %otherwise to copy, sublicense, distribute or transfer this program is void and
87 %your rights to use the program under this License agreement shall be
88 %automatically terminated.  However, parties who have received computer
89 %software programs from you with this License Agreement will not have
90 %their licenses terminated so long as such parties remain in full compliance.
91
92 %  5. If you wish to incorporate parts of this program into other free
93 %programs whose distribution conditions are different, write to the Free
94 %Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
95 %worked out a simple rule that can be stated here, but we will often permit
96 %this.  We will be guided by the two goals of preserving the free status of
97 %all derivatives of our free software and of promoting the sharing and reuse of
98 %software.
99
100 %In other words, you are welcome to use, share and improve this program.
101 %You are forbidden to forbid anyone else to use, share and improve
102 %what you give them.   Help stamp out software-hoarding!
103
104 \def\texinfoversion{1.18}
105 \message{Loading texinfo package [Version \texinfoversion]:}
106 \message{}
107
108 % Save some parts of plain tex whose names we will redefine.
109
110 \let\ptexlbrace=\{
111 \let\ptexrbrace=\}
112 \let\ptexdot=\.
113 \let\ptexstar=\*
114 \let\ptexend=\end
115 \let\ptexbullet=\bullet
116 \let\ptexb=\b
117 \let\ptexc=\c
118 \let\ptexi=\i
119 \let\ptext=\t
120 \let\ptexl=\l
121 \let\ptexL=\L
122
123 \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
124
125 \message{Basics,}
126 \chardef\other=12
127
128 \hyphenation{ap-pen-dix}
129 \hyphenation{mini-buf-fer mini-buf-fers}
130 \hyphenation{eshell}
131
132 % Margin to add to right of even pages, to left of odd pages.
133 \newdimen \bindingoffset  \bindingoffset=0pt
134 \newdimen \normaloffset   \normaloffset=\hoffset
135 \newdimen\pagewidth \newdimen\pageheight
136 \pagewidth=\hsize \pageheight=\vsize
137
138 %---------------------Begin change-----------------------
139 %
140 % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
141 %
142 \newdimen\cornerlong \newdimen\cornerthick
143 \newdimen \topandbottommargin
144 \newdimen \outerhsize \newdimen \outervsize
145 \cornerlong=1pc\cornerthick=.3pt        % These set size of cropmarks
146 \outerhsize=7in
147 \outervsize=9.5in
148 \topandbottommargin=.75in
149 %
150 %---------------------End change-----------------------
151
152 % \onepageout takes a vbox as an argument.  Note that \pagecontents
153 % does insertions itself, but you have to call it yourself.
154 \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
155 \def\onepageout#1{\hoffset=\normaloffset
156 \ifodd\pageno  \advance\hoffset by \bindingoffset
157 \else \advance\hoffset by -\bindingoffset\fi
158 \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
159  {\let\hsize=\pagewidth \makefootline}}
160 \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
161
162
163 % Here is a modification of the main output routine for Near East Publications
164 % This provides right-angle cropmarks at all four corners.
165 % The contents of the page are centerlined into the cropmarks,
166 % and any desired binding offset is added as an \hskip on either
167 % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
168 %
169 \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
170                  \shipout
171                  \vbox to \outervsize{\hsize=\outerhsize
172                  \vbox{\line{\ewtop\hfill\ewtop}}
173                  \nointerlineskip
174                  \line{\vbox{\moveleft\cornerthick\nstop}
175                        \hfill
176                        \vbox{\moveright\cornerthick\nstop}}
177                  \vskip \topandbottommargin
178                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
179                         \vbox{
180                         {\let\hsize=\pagewidth \makeheadline}
181                         \pagebody{#1}
182                         {\let\hsize=\pagewidth \makefootline}}
183                         \ifodd\pageno\else\hskip\bindingoffset\fi}
184                  \vskip \topandbottommargin plus1fill minus1fill
185                  \boxmaxdepth\cornerthick
186                  \line{\vbox{\moveleft\cornerthick\nsbot}
187                        \hfill
188                        \vbox{\moveright\cornerthick\nsbot}}
189                  \nointerlineskip
190                  \vbox{\line{\ewbot\hfill\ewbot}}
191         }
192   \advancepageno 
193   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
194 %
195 % Do @cropmarks to get crop marks
196 \def\cropmarks{\let\onepageout=\croppageout }
197
198 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
199 {\catcode`\@ =11
200 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
201 \dimen@=\dp#1 \unvbox#1
202 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
203 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
204 }
205
206 %
207 % Here are the rules for the cropmarks.  Note that they are
208 % offset so that the space between them is truly \outerhsize or \outervsize
209 % (P. A. MacKay, 12 November, 1986)
210 %
211 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
212 \def\nstop{\vbox
213   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
214 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
215 \def\nsbot{\vbox
216   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
217
218 % Parse an argument, then pass it to #1.
219 % The argument can be delimited with [...] or with "..." or braces
220 % or it can be a whole line.
221 % #1 should be a macro which expects
222 % an ordinary undelimited TeX argument.
223
224 \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
225
226 \def\parseargx{%
227 \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
228 \aftergroup \parseargline %
229 \fi \endgroup}
230
231 {\obeyspaces %
232 \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
233
234 \gdef\obeyedspace{\ }
235
236 \def\parseargline{\begingroup \obeylines \parsearglinex}
237 {\obeylines %
238 \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
239
240 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
241
242 %% These are used to keep @begin/@end levels from running away
243 %% Call \inENV within environments (after a \begingroup)
244 \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
245 \def\ENVcheck{%
246 \ifENV\errmessage{Still within an environment.  Type Return to continue.}
247 \endgroup\fi} % This is not perfect, but it should reduce lossage
248
249 % @begin foo  is the same as @foo, for now.
250 \newhelp\EMsimple{Type <Return> to continue}
251
252 \outer\def\begin{\parsearg\beginxxx}
253
254 \def\beginxxx #1{%
255 \expandafter\ifx\csname #1\endcsname\relax
256 {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
257 \csname #1\endcsname\fi}
258
259 %% @end foo executes the definition of \Efoo.
260 %% foo can be delimited by doublequotes or brackets.
261
262 \def\end{\parsearg\endxxx}
263
264 \def\endxxx #1{%
265 \expandafter\ifx\csname E#1\endcsname\relax
266 \expandafter\ifx\csname #1\endcsname\relax
267 \errmessage{Undefined command @end #1}\else
268 \errorE{#1}\fi\fi
269 \csname E#1\endcsname}
270 \def\errorE#1{
271 {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
272
273 % Single-spacing is done by various environments.
274
275 \newskip\singlespaceskip \singlespaceskip = \baselineskip
276 \def\singlespace{%
277 {\advance \baselineskip by -\singlespaceskip
278 \kern \baselineskip}%
279 \baselineskip=\singlespaceskip
280 }
281
282 %% Simple single-character @ commands
283
284 % @@ prints an @
285 % Kludge this until the fonts are right (grr).
286 \def\@{{\sf \char '100}}
287
288 % Define @` and @' to be the same as ` and '
289 % but suppressing ligatures.
290 \def\`{{`}}
291 \def\'{{'}}
292
293 % Used to generate quoted braces.
294
295 \def\mylbrace {{\tt \char '173}}
296 \def\myrbrace {{\tt \char '175}}
297 \let\{=\mylbrace
298 \let\}=\myrbrace
299
300 % @: forces normal size whitespace following.
301 \def\:{\spacefactor=1000 }
302
303 % @* forces a line break.
304 \def\*{\hfil\break}
305
306 % @. is an end-of-sentence period.
307 \def\.{.\spacefactor=3000 }
308
309 % @w prevents a word break
310 \def\w #1{\hbox{#1}}
311
312 % @group ... @end group  forces ... to be all on one page.
313
314 \def\group{\begingroup% \inENV ???
315 \def \Egroup{\egroup\endgroup}
316 \vbox\bgroup}
317
318 % @br   forces paragraph break
319
320 \let\br = \par
321
322 % @dots{}  output some dots
323
324 \def\dots{$\ldots$}
325
326 % @page    forces the start of a new page
327
328 \def\page{\par\vfill\supereject}
329
330 % @exdent text....
331 % outputs text on separate line in roman font, starting at standard page margin
332
333 \def\exdent{\errmessage{@exdent in filled text}}
334   % @lisp, etc, define \exdent locally from \internalexdent
335
336 {\obeyspaces
337 \gdef\internalexdent{\parsearg\exdentzzz}}
338
339 \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
340 \advance \hsize by -\leftskip
341 \advance \hsize by -\rightskip
342 \leftline{{\rm#1}}}}
343
344 % @include file    insert text of that file as input.
345
346 \def\include{\parsearg\includezzz}
347 \def\includezzz #1{{\def\thisfile{#1}\input #1
348 }}
349
350 \def\thisfile{}
351
352 % @center line   outputs that line, centered
353
354 \def\center{\parsearg\centerzzz}
355 \def\centerzzz #1{{\advance\hsize by -\leftskip
356 \advance\hsize by -\rightskip
357 \centerline{#1}}}
358
359 % @sp n   outputs n lines of vertical space
360
361 \def\sp{\parsearg\spxxx}
362 \def\spxxx #1{\par \vskip #1\baselineskip}
363
364 % @comment ...line which is ignored...
365 % @c is the same as @comment
366 % @ignore ... @end ignore  is another way to write a comment
367
368 \def\comment{\parsearg \commentxxx}
369
370 \def\commentxxx #1{}
371
372 \let\c=\comment
373
374 \long\def\ignore #1\end ignore{}
375
376 \outer\def\ifset{\parsearg\ifsetxxx}
377
378 \def\ifsetxxx #1#2\end ifset{%
379 \expandafter\ifx\csname IF#1\endcsname\relax \else #2\fi}
380
381 \outer\def\ifclear{\parsearg\ifclearxxx}
382
383 \def\ifclearxxx #1#2\end ifclear{%
384 \expandafter\ifx\csname IF#1\endcsname\relax #2\fi}
385
386 % Some texinfo constructs that are trivial in tex
387
388 \def\iftex{}
389 \def\Eiftex{}
390 \long\def\ifinfo #1\end ifinfo{}
391 \long\def\menu #1\end menu{}
392 \def\asis#1{#1}
393
394 \def\node{\parsearg\nodezzz}
395 \def\nodezzz#1{\nodexxx [#1,]}
396 \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
397 \let\lastnode=\relax
398
399 \def\donoderef{\ifx\lastnode\relax\else
400 \expandafter\expandafter\expandafter\setref{\lastnode}\fi
401 \let\lastnode=\relax}
402
403 \def\unnumbnoderef{\ifx\lastnode\relax\else
404 \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
405 \let\lastnode=\relax}
406
407 \let\refill=\relax
408
409 \let\setfilename=\comment
410
411 \def\inforef #1{\inforefzzz #1,,,,**}
412 \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}}, node `\losespace#1{}'}
413 \def\losespace #1{#1}
414
415 \message{fonts,}
416
417 % Font-change commands.
418
419 %% Try out Computer Modern fonts at \magstephalf
420 \font\tenrm=cmr10 scaled \magstephalf
421 \font\tentt=cmtt10 scaled \magstephalf
422 % Instead of cmb10, you many want to use cmbx10.
423 % cmbx10 is a prettier font on its own, but cmb10
424 % looks better when embedded in a line with cmr10.
425 \font\tenbf=cmb10 scaled \magstephalf 
426 \font\tenit=cmti10 scaled \magstephalf
427 \font\tensl=cmsl10 scaled \magstephalf
428 \font\tensf=cmss10 scaled \magstephalf
429 \def\li{\sf}
430 \font\tensc=cmcsc10 scaled \magstephalf
431
432 % Fonts for @defun, etc.
433 \font\defbf=cmbx10 scaled \magstep1 %was 1314
434 \let\deftt=\tentt
435 \def\df{\let\tt=\deftt \defbf}
436
437 % Font for title
438 \font\titlerm = cmbx10 scaled \magstep5
439
440 % Fonts for indices
441 \font\indit=cmti9 \font\indrm=cmr9
442 \def\indbf{\indrm} \def\indsl{\indit}
443 \def\indexfonts{\let\it=\indit \let\sl=\indsl \let\bf=\indbf \let\rm=\indrm}
444
445 % Fonts for headings
446 \font\chaprm=cmbx10 scaled \magstep3
447 \font\chapit=cmti10 scaled \magstep3
448 \font\chapsl=cmsl10 scaled \magstep3
449 \font\chaptt=cmtt10 scaled \magstep3
450 \font\chapsf=cmss10 scaled \magstep3
451 \let\chapbf=\chaprm
452
453 \font\secrm=cmbx10 scaled \magstep2
454 \font\secit=cmti10 scaled \magstep2
455 \font\secsl=cmsl10 scaled \magstep2
456 \font\sectt=cmtt10 scaled \magstep2
457 \font\secsf=cmss10 scaled \magstep2
458 \let\secbf=\secrm
459
460 \font\ssecrm=cmbx10 scaled \magstep1
461 \font\ssecit=cmti10 scaled \magstep1
462 \font\ssecsl=cmsl10 scaled \magstep1
463 \font\ssectt=cmtt10 scaled \magstep1
464 \font\ssecsf=cmss10 scaled \magstep1
465 \let\ssecbf=\ssecrm
466
467 \def\textfonts{\let\rm=\tenrm\let\it=\tenit\let\sl=\tensl\let\bf=\tenbf%
468 \let\sc=\tensc\let\sf=\tensf}
469 \def\chapfonts{\let\rm=\chaprm\let\it=\chapit\let\sl=\chapsl\let\bf=\chapbf\let\tt=\chaptt\let\sf=\chapsf}
470 \def\secfonts{\let\rm=\secrm\let\it=\secit\let\sl=\secsl\let\bf=\secbf\let\tt=\sectt\let\sf=\secsf}
471 \def\subsecfonts{\let\rm=\ssecrm\let\it=\ssecit\let\sl=\ssecsl\let\bf=\ssecbf\let\tt=\ssectt\let\sf=\ssecsf}
472 % Count depth in font-changes, for error checks
473 \newcount\fontdepth \fontdepth=0
474
475 %% Add scribe-like font environments, plus @l for inline lisp (usually sans
476 %% serif) and @ii for TeX italic
477
478 \def\i#1{{\sl #1}}
479 \let\var=\i
480 \let\dfn=\i
481 \let\emph=\i
482 \let\cite=\i
483
484 \def\b#1{{\bf #1}}
485 \let\strong=\b
486
487 \def\t#1{{\tt \rawbackslash \frenchspacing #1}\null}
488 \let\ttfont = \t
489 \let\kbd=\t
490 \let\code=\t
491 \def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
492 \def\key #1{{\tt \uppercase{#1}}\null}
493 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
494
495 \let\file=\samp
496
497 \def\l#1{{\li #1}\null}
498
499 \def\r#1{{\rm #1}}
500 \def\s#1{{\sc #1}}
501 \def\ii#1{{\it #1}}
502
503 \def\titlefont#1{{\titlerm #1}}
504
505 \def\titlepage{\begingroup \parindent=0pt \hbox{}%
506 \let\oldpage=\page
507 \def\page{\oldpage \hbox{}}}
508
509 \def\Etitlepage{\endgroup\page\HEADINGSon}
510
511 % Make altmode in file print out right
512
513 \catcode `\^^[=\active \def^^[{$\diamondsuit$}
514
515 \message{page headings,}
516
517 %%% Set up page headings and footings.
518
519 \let\thispage=\folio
520
521 \newtoks \evenheadline    % Token sequence for heading line of even pages
522 \newtoks \oddheadline     % Token sequence for heading line of odd pages
523 \newtoks \evenfootline    % Token sequence for footing line of even pages
524 \newtoks \oddfootline     % Token sequence for footing line of odd pages
525
526 % Now make Tex use those variables
527 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}}
528 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}}
529
530 % Commands to set those variables.
531 % For example, this is what  @headings on  does
532 % @evenheading @thistitle|@thispage|@thischapter
533 % @oddheading @thischapter|@thispage|@thistitle
534 % @evenfooting @thisfile||
535 % @oddfooting ||@thisfile
536
537 \def\evenheading{\parsearg\evenheadingxxx}
538 \def\oddheading{\parsearg\oddheadingxxx}
539 \def\everyheading{\parsearg\everyheadingxxx}
540
541 \def\evenfooting{\parsearg\evenfootingxxx}
542 \def\oddfooting{\parsearg\oddfootingxxx}
543 \def\everyfooting{\parsearg\everyfootingxxx}
544
545 {\catcode`\@=0 %
546
547 \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
548 \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
549 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
550
551 \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
552 \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
553 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
554
555 \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
556 \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
557 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
558 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
559
560 \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
561 \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
562 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
563
564 \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
565 \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
566 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
567
568 \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
569 \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
570 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
571 \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
572 %
573 }% unbind the catcode of @.
574
575 % @headings on   turns them on.
576 % @headings off  turns them off.
577 % By default, they are off.
578
579 \def\headings #1 {\csname HEADINGS#1\endcsname}
580
581 \def\HEADINGSoff{
582 \global\evenheadline={\hfil} \global\evenfootline={\hfil}
583 \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
584 \HEADINGSoff
585 % When we turn headings on, set the page number to 1,
586 % Put current file name in lower left corner,
587 % Put chapter name on inside top of right hand pages, document
588 % title on inside top of left hand pages, and page numbers on outside top
589 % edge of all pages.
590 \def\HEADINGSon{
591 \pagealignmacro
592 \global\pageno=1
593 \global\evenfootline={\hfil}
594 \global\oddfootline={\hfil}
595 \global\evenheadline={\line{\folio\hfil\thistitle}}
596 \global\oddheadline={\line{\thischapter\hfil\folio}}
597 }
598
599 % Subroutines used in generating headings
600 % Produces Day Month Year style of output.
601 \def\today{\number\day\space
602 \ifcase\month\or
603 January\or February\or March\or April\or May\or June\or
604 July\or August\or September\or October\or November\or December\fi
605 \space\number\year}
606
607 % Use this if you want the Month Day, Year style of output.
608 %\def\today{\ifcase\month\or
609 %January\or February\or March\or April\or May\or June\or
610 %July\or August\or September\or October\or November\or December\fi
611 %\space\number\day, \number\year}
612
613 % @settitle line...  specifies the title of the document, for headings
614 % It generates no output of its own
615
616 \def\thistitle{No Title}
617 \def\settitle{\parsearg\settitlezzz}
618 \def\settitlezzz #1{\gdef\thistitle{#1}}
619
620 \message{tables,}
621
622 % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
623
624 % default indentation of table text
625 \newdimen\tableindent \tableindent=.8in
626 % default indentation of @itemize and @enumerate text
627 \newdimen\itemindent  \itemindent=.3in
628 % margin between end of table item and start of table text.
629 \newdimen\itemmargin  \itemmargin=.1in
630
631 % used internally for \itemindent minus \itemmargin
632 \newdimen\itemmax
633
634 % Note @table and @ftable define @item, @itemx, etc., with these defs.
635 % They also define \itemindex
636 % to index the item name in whatever manner is desired (perhaps none).
637
638 \def\internalBitem{\smallbreak \parsearg\itemzzz}
639 \def\internalBitemx{\par \parsearg\itemzzz}
640
641 \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
642 \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
643
644 \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
645 \def\internalBkitemx{\par \parsearg\kitemzzz}
646
647 \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}\itemzzz {#1}}
648
649 \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}\itemzzz {#1}}
650
651 \def\itemzzz #1{\begingroup %
652 \advance \hsize by -\rightskip %
653 \advance \hsize by -\leftskip %
654 \setbox0=\hbox{\itemfont{#1}}%
655 \itemindex{#1}%
656 \parskip=0in %
657 \noindent %
658 \ifdim \wd0>\itemmax %
659 \vadjust{\penalty 10000}%
660 \hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
661 \else %
662 \hbox to 0pt{\hskip -\tableindent\box0\hss}%
663 \fi %
664 \endgroup %
665 }
666
667 \def\item{\errmessage{@item while not in a table}}
668 \def\itemx{\errmessage{@itemx while not in a table}}
669 \def\kitem{\errmessage{@kitem while not in a table}}
670 \def\kitemx{\errmessage{@kitemx while not in a table}}
671 \def\xitem{\errmessage{@xitem while not in a table}}
672 \def\xitemx{\errmessage{@xitemx while not in a table}}
673
674 %% Contains a kludge to get @end[description] to work
675 \def\description{\tablez{\dontindex}{1}{}{}{}{}}
676
677 \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
678 {\obeylines\obeyspaces%
679 \gdef\tablex #1^^M{%
680 \tabley\dontindex#1        \endtabley}}
681
682 \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
683 {\obeylines\obeyspaces%
684 \gdef\ftablex #1^^M{%
685 \tabley\fnitemindex#1        \endtabley}}
686
687 \def\dontindex #1{}
688 \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
689
690 {\obeyspaces %
691 \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
692 \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
693
694 \def\tablez #1#2#3#4#5#6{%
695 \aboveenvbreak %
696 \begingroup %
697 \def\Edescription{\Etable}% Neccessary kludge.
698 \let\itemindex=#1%
699 \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
700 \ifnum 0#4>0 \tableindent=#4\mil \fi %
701 \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
702 \def\itemfont{#2}%
703 \itemmax=\tableindent %
704 \advance \itemmax by -\itemmargin %
705 \advance \leftskip by \tableindent %
706 \parindent = 0pt
707 \parskip = \smallskipamount
708 \ifdim \parskip=0pt \parskip=2pt \fi%
709 \def\Etable{\endgraf\endgroup\afterenvbreak}%
710 \let\item = \internalBitem %
711 \let\itemx = \internalBitemx %
712 \let\kitem = \internalBkitem %
713 \let\kitemx = \internalBkitemx %
714 \let\xitem = \internalBxitem %
715 \let\xitemx = \internalBxitemx %
716 }
717
718 % This is the counter used by @enumerate, which is really @itemize
719
720 \newcount \itemno
721
722 \def\itemize{\parsearg\itemizezzz}
723
724 \def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
725
726 \def\itemizey #1#2{%
727 \aboveenvbreak %
728 \begingroup %
729 \itemno = 0 %
730 \itemmax=\itemindent %
731 \advance \itemmax by -\itemmargin %
732 \advance \leftskip by \itemindent %
733 \parindent = 0pt
734 \parskip = \smallskipamount
735 \ifdim \parskip=0pt \parskip=2pt \fi%
736 \def#2{\endgraf\endgroup\afterenvbreak}%
737 \def\itemcontents{#1}%
738 \let\item=\itemizeitem}
739
740 \def\bullet{$\ptexbullet$}
741 \def\minus{$-$}
742
743 \def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
744
745 % Definition of @item while inside @itemize.
746
747 \def\itemizeitem{%
748 \advance\itemno by 1
749 {\let\par=\endgraf \smallbreak}%
750 \ifhmode \errmessage{\in hmode at itemizeitem}\fi
751 {\parskip=0in \hskip 0pt
752 \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
753 \vadjust{\penalty 300}}%
754 \flushcr}
755
756 \message{indexing,}
757 % Index generation facilities
758
759 % Define \newwrite to be identical to plain tex's \newwrite
760 % except not \outer, so it can be used within \newindex.
761 {\catcode`\@=11
762 \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
763
764 % \newindex {foo} defines an index named foo.
765 % It automatically defines \fooindex such that
766 % \fooindex ...rest of line... puts an entry in the index foo.
767 % It also defines \fooindfile to be the number of the output channel for
768 % the file that accumulates this index.  The file's extension is foo.
769 % The name of an index should be no more than 2 characters long
770 % for the sake of vms.
771
772 \def\newindex #1{
773 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
774 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
775 \expandafter\xdef\csname#1index\endcsname{%     % Define \xxxindex
776 \noexpand\doindex {#1}}
777 }
778
779 % @defindex foo  ==  \newindex{foo}
780
781 \def\defindex{\parsearg\newindex}
782
783 % Define @defcodeindex, like @defindex except put all entries in @code.
784
785 \def\newcodeindex #1{
786 \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
787 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
788 \expandafter\xdef\csname#1index\endcsname{%     % Define \xxxindex
789 \noexpand\docodeindex {#1}}
790 }
791
792 \def\defcodeindex{\parsearg\newcodeindex}
793
794 % @synindex foo bar    makes index foo feed into index bar.
795 % Do this instead of @defindex foo if you don't want it as a separate index.
796 \def\synindex #1 #2 {%
797 \expandafter\xdef\csname#1index\endcsname{%     % Define \xxxindex
798 \noexpand\doindex {#2}}%
799 }
800
801 % @syncodeindex foo bar   similar, but put all entries made for index foo
802 % inside @code.
803 \def\syncodeindex #1 #2 {%
804 \expandafter\xdef\csname#1index\endcsname{%     % Define \xxxindex
805 \noexpand\docodeindex {#2}}%
806 }
807
808 % Define \doindex, the driver for all \fooindex macros.
809 % Argument #1 is generated by the calling \fooindex macro,
810 %  and it is "foo", the name of the index.
811
812 % \doindex just uses \parsearg; it calls \doind for the actual work.
813 % This is because \doind is more useful to call from other macros.
814
815 % There is also \dosubind {index}{topic}{subtopic}
816 % which makes an entry in a two-level index such as the operation index.
817
818 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
819 \def\singleindexer #1{\doind{\indexname}{#1}}
820
821 % like the previous two, but they put @code around the argument.
822 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
823 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
824
825 \def\indexdummies{%
826 \def\bf{\realbackslash bf }%
827 \def\rm{\realbackslash rm }%
828 \def\sl{\realbackslash sl }%
829 \def\dots{\realbackslash dots }%
830 \def\copyright{\realbackslash copyright }%
831 }
832
833 % \indexnofonts no-ops all font-change commands.
834 % This is used when outputting the strings to sort the index by.
835 \def\indexdummyfont#1{#1}
836 \def\indexnofonts{%
837 \let\code=\indexdummyfont
838 \let\samp=\indexdummyfont
839 \let\kbd=\indexdummyfont
840 \let\key=\indexdummyfont
841 \let\var=\indexdummyfont
842 }
843
844 % To define \realbackslash, we must make \ not be an escape.
845 % We must first make another character (@) an escape
846 % so we do not become unable to do a definition.
847
848 {\catcode`\@=0 \catcode`\\=\other
849 @gdef@realbackslash{\}}
850
851 \let\indexbackslash=0  %overridden during \printindex.
852
853 \def\doind #1#2{%
854 {\indexdummies % Must do this here, since \bf, etc expand at this stage
855 \count10=\lastpenalty %
856 \escapechar=`\\%
857 {\let\folio=0% Expand all macros now EXCEPT \folio
858 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
859 % so it will be output as is; and it will print as backslash in the indx.
860 %
861 % Now process the index-string once, with all font commands turned off,
862 % to get the string to sort the index by.
863 {\indexnofonts
864 \xdef\temp1{#2}%
865 }%
866 % Now produce the complete index entry.  We process the index-string again,
867 % this time with font commands expanded, to get what to print in the index.
868 \edef\temp{%
869 \write \csname#1indfile\endcsname{%
870 \realbackslash entry {\temp1}{\folio}{#2}}}%
871 \temp }%
872 \penalty\count10}}
873
874 \def\dosubind #1#2#3{%
875 {\indexdummies % Must do this here, since \bf, etc expand at this stage
876 \count10=\lastpenalty %
877 \escapechar=`\\%
878 {\let\folio=0%
879 \def\rawbackslashxx{\indexbackslash}%
880 %
881 % Now process the index-string once, with all font commands turned off,
882 % to get the string to sort the index by.
883 {\indexnofonts
884 \xdef\temp1{#2 #3}%
885 }%
886 % Now produce the complete index entry.  We process the index-string again,
887 % this time with font commands expanded, to get what to print in the index.
888 \edef\temp{%
889 \write \csname#1indfile\endcsname{%
890 \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
891 \temp }%
892 \penalty\count10}}
893
894 % The index entry written in the file actually looks like
895 %  \entry {sortstring}{page}{topic}
896 % or
897 %  \entry {sortstring}{page}{topic}{subtopic}
898 % The texindex program reads in these files and writes files
899 % containing these kinds of lines:
900 %  \initial {c}
901 %     before the first topic whose initial is c
902 %  \entry {topic}{pagelist}
903 %     for a topic that is used without subtopics
904 %  \primary {topic}
905 %     for the beginning of a topic that is used with subtopics
906 %  \secondary {subtopic}{pagelist}
907 %     for each subtopic.
908
909 % Define the user-accessible indexing commands 
910 % @findex, @vindex, @kindex, @cindex.
911
912 \def\findex {\fnindex}
913 \def\kindex {\kyindex}
914 \def\cindex {\cpindex}
915 \def\vindex {\vrindex}
916 \def\tindex {\tpindex}
917 \def\pindex {\pgindex}
918
919 \def\cindexsub {\begingroup\obeylines\cindexsub}
920 {\obeylines %
921 \gdef\cindexsub "#1" #2^^M{\endgroup %
922 \dosubind{cp}{#2}{#1}}}
923
924 % Define the macros used in formatting output of the sorted index material.
925
926 % This is what you call to cause a particular index to get printed.
927 % Write
928 % @unnumbered Function Index
929 % @printindex fn
930
931 \def\printindex{\parsearg\doprintindex}
932
933 \def\doprintindex#1{\tex %
934 \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
935 \catcode`\$=\other\catcode`\_=\other
936 \catcode`\~=\other
937 \def\indexbackslash{\rawbackslashxx}
938 \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
939 \begindoublecolumns
940 \openin 1 \jobname.#1s
941 \ifeof 1 \else \closein 1 \input \jobname.#1s
942 \fi
943 \enddoublecolumns
944 \Etex}
945
946 % These macros are used by the sorted index file itself.
947 % Change them to control the appearance of the index.
948
949 % Same as \bigskipamount except no shrink.
950 % \balancecolumns gets confused if there is any shrink.
951 \newskip\initialskipamount \initialskipamount 12pt plus4pt
952
953 \outer\def\initial #1{%
954 {\let\tentt=\sectt \let\sf=\sectt
955 \ifdim\lastskip<\initialskipamount
956 \removelastskip \penalty-200 \vskip \initialskipamount\fi
957 \line{\secbf#1\hfill}\kern 2pt\penalty3000}}
958
959 \outer\def\entry #1#2{
960 {\parfillskip=0in \parskip=0in \parindent=0in
961 \hangindent=1in \hangafter=1%
962 \noindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll #2\par
963 }}
964
965 \def\primary #1{\line{#1\hfil}}
966
967 \newskip\secondaryindent \secondaryindent=0.5cm
968
969 \def\secondary #1#2{
970 {\parfillskip=0in \parskip=0in
971 \hangindent =1in \hangafter=1
972 \noindent\hskip\secondaryindent\hbox{#1}\leaders\Dotsbox\hskip 0pt plus 1filll#2\par
973 }}
974
975 %% Define two-column mode, which is used in indexes.
976 %% Adapted from the TeXBook, page 416
977 \catcode `\@=11
978
979 \newbox\partialpage
980
981 \newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
982 \newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
983
984 \def\begindoublecolumns{\begingroup
985   \output={\global\setbox\partialpage=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
986   \output={\doublecolumnout} \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
987 \def\enddoublecolumns{\output={\balancecolumns}\eject
988   \endgroup \pagegoal=\vsize}
989
990 \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
991   \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
992   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
993   \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
994 \def\pagesofar{\unvbox\partialpage %
995   \hsize=\doublecolumnhsize % have to restore this since output routine
996 %             changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
997   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
998 \def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen@=\ht0
999   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
1000   \divide\dimen@ by2 \splittopskip=\topskip
1001   {\vbadness=10000 \loop \global\setbox3=\copy0
1002     \global\setbox1=\vsplit3 to\dimen@
1003     \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
1004   \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
1005   \pagesofar}
1006
1007 \catcode `\@=\other
1008 \message{sectioning,}
1009 % Define chapters, sections, etc.
1010
1011 \newcount \chapno
1012 \newcount \secno
1013 \newcount \subsecno
1014 \newcount \subsubsecno
1015
1016 % This counter is funny since it counts through charcodes of letters A, B, ...
1017 \newcount \appendixno  \appendixno = `\@
1018 \def\appendixletter{\char\the\appendixno}
1019
1020 \newwrite \contentsfile
1021 \openout \contentsfile = \jobname.toc
1022
1023 % Each @chapter defines this as the name of the chapter.
1024 % page headings and footings can use it.  @section does likewise
1025
1026 \def\thischapter{} \def\thissection{}
1027 \def\seccheck#1{\if \pageno<0 %
1028 \errmessage{@#1 not allowed after generating table of contents}\fi
1029 %
1030 }
1031
1032 \outer\def\chapter{\parsearg\chapterzzz}
1033 \def\chapterzzz #1{\seccheck{chapter}%
1034 \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \chapno by 1 \message{Chapter \the\chapno}%
1035 \chapmacro {#1}{\the\chapno}%
1036 \gdef\thissection{#1}\gdef\thischapter{#1}%
1037 \let\rawbackslash=\relax%
1038 \let\frenchspacing=\relax%
1039 \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
1040 \escapechar=`\\%
1041 \write \contentsfile \temp  %
1042 \donoderef %
1043 }
1044
1045 \outer\def\appendix{\parsearg\appendixzzz}
1046 \def\appendixzzz #1{\seccheck{appendix}%
1047 \secno=0 \subsecno=0 \subsubsecno=0 \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
1048 \chapmacro {#1}{Appendix \appendixletter}%
1049 \gdef\thischapter{#1}\gdef\thissection{#1}%
1050 \let\rawbackslash=\relax%
1051 \let\frenchspacing=\relax%
1052 \edef\temp{{\realbackslash chapentry {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
1053 \escapechar=`\\%
1054 \write \contentsfile \temp  %
1055 \unnumbnoderef %
1056 }
1057
1058 \outer\def\unnumbered{\parsearg\unnumberedzzz}
1059 \def\unnumberedzzz #1{\seccheck{unnumbered}%
1060 \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
1061 \unnumbchapmacro {#1}%
1062 \gdef\thischapter{#1}\gdef\thissection{#1}%
1063 \let\rawbackslash=\relax%
1064 \let\frenchspacing=\relax%
1065 \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
1066 \escapechar=`\\%
1067 \write \contentsfile \temp  %
1068 \unnumbnoderef %
1069 }
1070
1071 \outer\def\section{\parsearg\sectionzzz}
1072 \def\sectionzzz #1{\seccheck{section}%
1073 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1074 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
1075 \let\rawbackslash=\relax%
1076 \let\frenchspacing=\relax%
1077 \edef\temp{{\realbackslash secentry %
1078 {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
1079 \escapechar=`\\%
1080 \write \contentsfile \temp %
1081 \donoderef %
1082 \penalty 10000 %
1083 }
1084
1085 \outer\def\appendixsection{\parsearg\appendixsectionzzz}
1086 \outer\def\appendixsec{\parsearg\appendixsectionzzz}
1087 \def\appendixsectionzzz #1{\seccheck{appendixsection}%
1088 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
1089 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
1090 \let\rawbackslash=\relax%
1091 \let\frenchspacing=\relax%
1092 \edef\temp{{\realbackslash secentry %
1093 {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
1094 \escapechar=`\\%
1095 \write \contentsfile \temp %
1096 \unnumbnoderef %
1097 \penalty 10000 %
1098 }
1099
1100 \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
1101 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
1102 \plainsecheading {#1}\gdef\thissection{#1}%
1103 \let\rawbackslash=\relax%
1104 \let\frenchspacing=\relax%
1105 \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
1106 \escapechar=`\\%
1107 \write \contentsfile \temp %
1108 \unnumbnoderef %
1109 \penalty 10000 %
1110 }
1111
1112 \outer\def\subsection{\parsearg\subsectionzzz}
1113 \def\subsectionzzz #1{\seccheck{subsection}%
1114 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1115 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
1116 \let\rawbackslash=\relax%
1117 \let\frenchspacing=\relax%
1118 \edef\temp{{\realbackslash subsecentry %
1119 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1120 \escapechar=`\\%
1121 \write \contentsfile \temp %
1122 \donoderef %
1123 \penalty 10000 %
1124 }
1125
1126 \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
1127 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
1128 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
1129 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
1130 \let\rawbackslash=\relax%
1131 \let\frenchspacing=\relax%
1132 \edef\temp{{\realbackslash subsecentry %
1133 {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
1134 \escapechar=`\\%
1135 \write \contentsfile \temp %
1136 \unnumbnoderef %
1137 \penalty 10000 %
1138 }
1139
1140 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
1141 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
1142 \plainsecheading {#1}\gdef\thissection{#1}%
1143 \let\rawbackslash=\relax%
1144 \let\frenchspacing=\relax%
1145 \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
1146 \escapechar=`\\%
1147 \write \contentsfile \temp %
1148 \unnumbnoderef %
1149 \penalty 10000 %
1150 }
1151
1152 \outer\def\subsubsection{\parsearg\subsubsectionzzz}
1153 \def\subsubsectionzzz #1{\seccheck{subsubsection}%
1154 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
1155 \subsubsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
1156 \let\rawbackslash=\relax%
1157 \let\frenchspacing=\relax%
1158 \edef\temp{{\realbackslash subsubsecentry %
1159 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
1160 \escapechar=`\\%
1161 \write \contentsfile \temp %
1162 \donoderef %
1163 \penalty 10000 %
1164 }
1165
1166 \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
1167 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
1168 \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
1169 \subsubsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
1170 \let\rawbackslash=\relax%
1171 \let\frenchspacing=\relax%
1172 \edef\temp{{\realbackslash subsubsecentry{#1}%
1173 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%\
1174 \escapechar=`\\%
1175 \write \contentsfile \temp %
1176 \unnumbnoderef %
1177 \penalty 10000 %
1178 }
1179
1180 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
1181 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
1182 \plainsecheading {#1}\gdef\thissection{#1}%
1183 \let\rawbackslash=\relax%
1184 \let\frenchspacing=\relax%
1185 \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
1186 \escapechar=`\\%
1187 \write \contentsfile \temp %
1188 \unnumbnoderef %
1189 \penalty 10000 %
1190 }
1191
1192 % Define @majorheading, @heading and @subheading
1193
1194 \outer\def\majorheading #1{%
1195 {\advance\chapheadingskip by 10pt \chapbreak }%
1196 {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
1197
1198 \outer\def\chapheading #1{\chapbreak %
1199 {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 200}
1200
1201 \let\heading=\secheadingi
1202 \let\subheading=\subsecheadingi
1203 \let\subsubheading=\subsubsecheadingi
1204
1205 % These macros generate a chapter, section, etc. heading only
1206 % (including whitespace, linebreaking, etc. around it),
1207 % given all the information in convenient, parsed form.
1208
1209 %%% Args are the skip and penalty (usually negative)
1210 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
1211
1212 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
1213
1214 %%% Define plain chapter starts, and page on/off switching for it
1215 % Parameter controlling skip before chapter headings (if needed)
1216
1217 \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
1218
1219 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
1220 \def\chappager{\par\vfill\supereject}
1221 \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
1222
1223 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
1224
1225 \def\CHAPPAGoff{
1226 \global\let\pchapsepmacro=\chapbreak
1227 \global\let\pagealignmacro=\chappager}
1228
1229 \def\CHAPPAGon{
1230 \global\let\pchapsepmacro=\chappager
1231 \global\let\pagealignmacro=\chappager}
1232
1233 \def\CHAPPAGodd{
1234 \global\let\pchapsepmacro=\chapoddpage
1235 \global\let\pagealignmacro=\chapoddpage}
1236
1237 \CHAPPAGon
1238
1239 \def\CHAPFplain{
1240 \global\let\chapmacro=\chfplain
1241 \global\let\unnumbchapmacro=\unnchfplain}
1242
1243 \def\chfplain #1#2{%
1244 \pchapsepmacro %
1245 {\chapfonts \line{\chaprm #2.\enspace #1\hfill}}\bigskip \par\penalty 5000 %
1246 }
1247
1248 \def\unnchfplain #1{%
1249 \pchapsepmacro %
1250 {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
1251 }
1252 \CHAPFplain % The default
1253
1254 \def\unnchfopen #1{%
1255 \chapoddpage {\chapfonts \line{\chaprm #1\hfill}}\bigskip \par\penalty 10000 %
1256 }
1257
1258 \def\chfopen #1#2{\chapoddpage {\chapfonts
1259 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
1260 \par\penalty 5000 %
1261 }
1262
1263 \def\CHAPFopen{
1264 \global\let\chapmacro=\chfopen
1265 \global\let\unnumbchapmacro=\unnchfopen}
1266
1267 % Parameter controlling skip before section headings.
1268
1269 \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
1270 \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
1271
1272 \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
1273 \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
1274
1275 \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
1276 \def\plainsecheading #1{\secheadingi {#1}}
1277 \def\secheadingi #1{{\advance \secheadingskip by \parskip %
1278 \secheadingbreak}%
1279 {\secfonts \line{\secrm #1\hfill}}%
1280 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1281
1282 \def\subsecheading #1#2#3#4{{\advance \subsecheadingskip by \parskip %
1283 \subsecheadingbreak}%
1284 {\secfonts \line{\secrm#2.#3.#4\enspace #1\hfill}}%
1285 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
1286
1287 \def\subsubsecfonts{\subsecfonts} % Maybe this should change
1288
1289 \def\subsubsecheading #1#2#3#4#5{{\advance \subsecheadingskip by \parskip %
1290 \subsecheadingbreak}%
1291 {\secfonts \line{\secrm#2.#3.#4.#5\enspace #1\hfill}}%
1292 \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
1293
1294 \message{toc printing,}
1295
1296 \def\Dotsbox{\hbox to 1em{\hss.\hss}} % Used by index macros
1297
1298 \def\finishcontents{%
1299 \ifnum\pageno>0 %
1300 \pagealignmacro %
1301 \immediate\closeout \contentsfile%
1302 \pageno=-1              % Request roman numbered pages
1303 \fi}
1304
1305 \outer\def\contents{%
1306 \finishcontents %
1307 \unnumbchapmacro{Table of Contents}
1308 \def\thischapter{Table of Contents}
1309 {\catcode`\\=0
1310 \catcode`\{=1           % Set up to handle contents files properly
1311 \catcode`\}=2
1312 \catcode`\@=11
1313 \input \jobname.toc
1314 }
1315 \vfill \eject}
1316
1317 \outer\def\summarycontents{%
1318 \finishcontents %
1319 \unnumbchapmacro{Summary Table of Contents}
1320 \def\thischapter{Summary Table of Contents}
1321 {\catcode`\\=0
1322 \catcode`\{=1           % Set up to handle contents files properly
1323 \catcode`\}=2
1324 \catcode`\@=11
1325 \def\smallbreak{}
1326 \def\secentry ##1##2##3##4{}
1327 \def\subsecentry ##1##2##3##4##5{}
1328 \def\subsubsecentry ##1##2##3##4##5##6{}
1329 \def\unnumbsecentry ##1##2{}
1330 \def\unnumbsubsecentry ##1##2{}
1331 \def\unnumbsubsubsecentry ##1##2{}
1332 \let\medbreak=\smallbreak
1333 \input \jobname.toc
1334 }
1335 \vfill \eject}
1336
1337 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1338
1339 % These macros generate individual entries in the table of contents
1340 % The first argument is the chapter or section name.
1341 % The last argument is the page number.
1342 % The arguments in between are the chapter number, section number, ...
1343
1344 \def\chapentry #1#2#3{%
1345 \medbreak
1346 \line{#2.\space#1\leaders\hbox to 1em{\hss.\hss}\hfill #3}
1347 }
1348
1349 \def\unnumbchapentry #1#2{%
1350 \medbreak
1351 \line{#1\leaders\Dotsbox\hfill #2}
1352 }
1353
1354 \def\secentry #1#2#3#4{%
1355 \line{\enspace\enspace#2.#3\space#1\leaders\Dotsbox\hfill#4}
1356 }
1357
1358 \def\unnumbsecentry #1#2{%
1359 \line{\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1360 }
1361
1362 \def\subsecentry #1#2#3#4#5{%
1363 \line{\enspace\enspace\enspace\enspace
1364 #2.#3.#4\space#1\leaders\Dotsbox\hfill #5}
1365 }
1366
1367 \def\unnumbsubsecentry #1#2{%
1368 \line{\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1369 }
1370
1371 \def\subsubsecentry #1#2#3#4#5#6{%
1372 \line{\enspace\enspace\enspace\enspace\enspace\enspace
1373 #2.#3.#4.#5\space#1\leaders\Dotsbox\hfill #6}
1374 }
1375
1376 \def\unnumbsubsubsecentry #1#2{%
1377 \line{\enspace\enspace\enspace\enspace\enspace\enspace#1\leaders\Dotsbox\hfill #2}
1378 }
1379
1380 \message{environments,}
1381
1382 % @tex ... @end tex    escapes into raw Tex temporarily.
1383 % One exception: @ is still an escape character, so that @end tex works.
1384 % But \@ or @@ will get a plain tex @ character.
1385
1386 \def\tex{\begingroup
1387 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
1388 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
1389 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
1390 \catcode `\%=14
1391 \catcode`\"=12
1392 \catcode`\|=12
1393 \catcode`\<=12
1394 \catcode`\>=12
1395 \escapechar=`\\
1396 %
1397 \let\{=\ptexlbrace
1398 \let\}=\ptexrbrace
1399 \let\.=\ptexdot
1400 \let\*=\ptexstar
1401 \def\@={@}%
1402 \let\bullet=\ptexbullet
1403 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
1404 \let\L=\ptexL
1405 %
1406 \let\Etex=\endgroup}
1407
1408 % Define @lisp ... @endlisp.
1409 % @lisp does a \begingroup so it can rebind things,
1410 % including the definition of @endlisp (which normally is erroneous).
1411
1412 % Amount to narrow the margins by for @lisp.
1413 \newskip\lispnarrowing \lispnarrowing=0.4in
1414
1415 % This is the definition that ^M gets inside @lisp
1416 % phr: changed space to \null, to avoid overfull hbox problems.
1417 {\obeyspaces%
1418 \gdef\lisppar{\null\endgraf}}
1419
1420 % Cause \obeyspaces to make each Space cause a word-separation
1421 % rather than the default which is that it acts punctuation.
1422 % This is because space in tt font looks funny.
1423 {\obeyspaces %
1424 \gdef\sepspaces{\def {\ }}}
1425
1426 \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
1427 \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
1428 \endgraf \ifdim\lastskip<\aboveenvskipamount
1429 \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
1430
1431 \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
1432 \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
1433
1434 \def\lisp{\aboveenvbreak\begingroup\inENV %This group ends at the end of the @lisp body
1435 \hfuzz=12truept % Don't be fussy
1436 % Make spaces be word-separators rather than space tokens.
1437 \sepspaces %
1438 % Single space lines
1439 \singlespace %
1440 % The following causes blank lines not to be ignored
1441 % by adding a space to the end of each line.
1442 \let\par=\lisppar
1443 \def\Elisp{\endgroup\afterenvbreak}%
1444 \parskip=0pt \advance \rightskip by \lispnarrowing 
1445 \advance \leftskip by \lispnarrowing
1446 \parindent=0pt
1447 \let\exdent=\internalexdent
1448 \obeyspaces \obeylines \tt \rawbackslash
1449 \def\next##1{}\next}
1450
1451
1452 \let\example=\lisp
1453 \def\Eexample{\Elisp}
1454
1455 \let\smallexample=\lisp
1456 \def\Esmallexample{\Elisp}
1457
1458 % Macro for 9 pt. examples, necessary to print with 5" lines.
1459 % From Pavel@xerox.  This is not really used unless the
1460 % @smallbook command is given.
1461
1462 \def\smalllispx{\aboveenvbreak\begingroup\inENV
1463 %                       This group ends at the end of the @lisp body
1464 \hfuzz=12truept % Don't be fussy
1465 % Make spaces be word-separators rather than space tokens.
1466 \sepspaces %
1467 % Single space lines
1468 \singlespace %
1469 % The following causes blank lines not to be ignored
1470 % by adding a space to the end of each line.
1471 \let\par=\lisppar
1472 \def\Esmalllisp{\endgroup\afterenvbreak}%
1473 \parskip=0pt \advance \rightskip by \lispnarrowing 
1474 \advance \leftskip by \lispnarrowing
1475 \parindent=0pt
1476 \let\exdent=\internalexdent
1477 \obeyspaces \obeylines \ninett \rawbackslash
1478 \def\next##1{}\next}
1479
1480 % This is @display; same as @lisp except use roman font.
1481
1482 \def\display{\begingroup\inENV %This group ends at the end of the @display body
1483 \aboveenvbreak
1484 % Make spaces be word-separators rather than space tokens.
1485 \sepspaces %
1486 % Single space lines
1487 \singlespace %
1488 % The following causes blank lines not to be ignored
1489 % by adding a space to the end of each line.
1490 \let\par=\lisppar
1491 \def\Edisplay{\endgroup\afterenvbreak}%
1492 \parskip=0pt \advance \rightskip by \lispnarrowing 
1493 \advance \leftskip by \lispnarrowing
1494 \parindent=0pt
1495 \let\exdent=\internalexdent
1496 \obeyspaces \obeylines
1497 \def\next##1{}\next}
1498
1499 % This is @format; same as @lisp except use roman font and don't narrow margins
1500
1501 \def\format{\begingroup\inENV %This group ends at the end of the @format body
1502 \aboveenvbreak
1503 % Make spaces be word-separators rather than space tokens.
1504 \sepspaces %
1505 \singlespace %
1506 % The following causes blank lines not to be ignored
1507 % by adding a space to the end of each line.
1508 \let\par=\lisppar
1509 \def\Eformat{\endgroup\afterenvbreak}
1510 \parskip=0pt \parindent=0pt
1511 \obeyspaces \obeylines
1512 \def\next##1{}\next}
1513
1514 % @flushleft and @flushright
1515
1516 \def\flushleft{\begingroup\inENV %This group ends at the end of the @format body
1517 \aboveenvbreak
1518 % Make spaces be word-separators rather than space tokens.
1519 \sepspaces %
1520 % The following causes blank lines not to be ignored
1521 % by adding a space to the end of each line.
1522 % This also causes @ to work when the directive name
1523 % is terminated by end of line.
1524 \let\par=\lisppar
1525 \def\Eflushleft{\endgroup\afterenvbreak}%
1526 \parskip=0pt \parindent=0pt
1527 \obeyspaces \obeylines
1528 \def\next##1{}\next}
1529
1530 \def\flushright{\begingroup\inENV %This group ends at the end of the @format body
1531 \aboveenvbreak
1532 % Make spaces be word-separators rather than space tokens.
1533 \sepspaces %
1534 % The following causes blank lines not to be ignored
1535 % by adding a space to the end of each line.
1536 % This also causes @ to work when the directive name
1537 % is terminated by end of line.
1538 \let\par=\lisppar
1539 \def\Eflushright{\endgroup\afterenvbreak}%
1540 \parskip=0pt \parindent=0pt
1541 \advance \leftskip by 0pt plus 1fill
1542 \obeyspaces \obeylines
1543 \def\next##1{}\next}
1544
1545 % @quotation - narrow the margins.
1546
1547 \def\quotation{\begingroup\inENV %This group ends at the end of the @quotation body
1548 {\parskip=0pt  % because we will skip by \parskip too, later
1549 \aboveenvbreak}%
1550 \singlespace
1551 \parindent=0pt
1552 \def\Equotation{\par\endgroup\afterenvbreak}%
1553 \advance \rightskip by \lispnarrowing 
1554 \advance \leftskip by \lispnarrowing}
1555
1556 \message{defuns,}
1557 % Define formatter for defuns
1558 % First, allow user to change definition object font (\df) internally
1559 \def\setdeffont #1 {\csname DEF#1\endcsname}
1560
1561 \newskip\defbodyindent \defbodyindent=36pt
1562 \newskip\defargsindent \defargsindent=50pt
1563 \newskip\deftypemargin \deftypemargin=12pt
1564 \newskip\deflastargmargin \deflastargmargin=18pt
1565
1566 \newcount\parencount
1567 % define \functionparens, which makes ( and ) and & do special things.
1568 % \functionparens affects the group it is contained in.
1569 \def\activeparens{%
1570 \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
1571 \catcode`\[=\active \catcode`\]=\active}
1572 {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
1573 \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
1574 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
1575
1576 % Definitions of (, ) and & used in args for functions.
1577 % This is the definition of ( outside of all parentheses.
1578 \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
1579 \global\advance\parencount by 1 }
1580 %
1581 % This is the definition of ( when already inside a level of parens.
1582 \gdef\opnested{\char`\(\global\advance\parencount by 1 }
1583 %
1584 \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
1585 % also in that case restore the outer-level definition of (.
1586 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
1587 \global\advance \parencount by -1 }
1588 % If we encounter &foo, then turn on ()-hacking afterwards
1589 \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
1590 %
1591 \gdef\normalparens{\boldbrax\let&=\ampnr}
1592 } % End of definition inside \activeparens
1593 %% These parens (in \boldbrax) actually are a little bolder than the
1594 %% contained text.  This is especially needed for [ and ]
1595 \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
1596 \def\lbrb{{\tt\char`\[}} \def\rbrb{{\tt\char`\]}}
1597
1598 % First, defname, which formats the header line itself.
1599 % #1 should be the function name.
1600 % #2 should be the type of definition, such as "Function".
1601
1602 \def\defname #1#2{%
1603 \leftskip = 0in  %
1604 \noindent        %
1605 \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
1606 \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
1607 \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
1608 \parshape 2 0in \dimen0 \defargsindent \dimen1     %
1609 % Now output arg 2 ("Function" or some such)
1610 % ending at \deftypemargin from the right margin,
1611 % but stuck inside a box of width 0 so it does not interfere with linebreaking
1612 \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}%
1613 \tolerance=10000 \hbadness=10000    % Make all lines underfull and no complaints
1614 {\df #1}\enskip        % Generate function name
1615 }
1616
1617 % Actually process the body of a definition
1618 % #1 should be the terminating control sequence, such as \Edefun.
1619 % #2 should be the "another name" control sequence, such as \defunx.
1620 % #3 should be the control sequence that actually processes the header,
1621 %    such as \defunheader.
1622
1623 \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
1624 \medbreak %
1625 % Define the end token that this defining construct specifies
1626 % so that it will exit this group.
1627 \def#1{\endgraf\endgroup\medbreak}%
1628 \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
1629 \parindent=0in \leftskip=\defbodyindent %
1630 \begingroup\obeylines\activeparens\spacesplit#3}
1631
1632 \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
1633 \medbreak %
1634 % Define the end token that this defining construct specifies
1635 % so that it will exit this group.
1636 \def#1{\endgraf\endgroup\medbreak}%
1637 \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
1638 \parindent=0in \leftskip=\defbodyindent %
1639 \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
1640
1641 % Split up #2 at the first space token.
1642 % call #1 with two arguments:
1643 %  the first is all of #2 before the space token,
1644 %  the second is all of #2 after that space token.
1645 % If #2 contains no space token, all of it is passed as the first arg
1646 % and the second is passed as empty.
1647
1648 {\obeylines
1649 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
1650 \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
1651 \ifx\relax #3%
1652 #1{#2}{}\else #1{#2}{#3#4}\fi}}
1653
1654 % So much for the things common to all kinds of definitions.
1655
1656 % Define @defun.
1657
1658 % First, define the processing that is wanted for arguments of \defun
1659 % Use this to expand the args and terminate the paragraph they make up
1660
1661 \def\defunargs #1{\functionparens \sl #1%
1662 \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
1663 \interlinepenalty=10000
1664 \endgraf\vskip -\parskip \penalty 10000}
1665
1666 % Do complete processing of one @defun or @defunx line already parsed.
1667
1668 % @deffn Command forward-char nchars
1669
1670 \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
1671
1672 \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
1673 \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup}
1674
1675 % @defun == @deffn Function
1676
1677 \def\defun{\defparsebody\Edefun\defunx\defunheader}
1678
1679 \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
1680 \begingroup\defname {#1}{Function}%
1681 \defunargs {#2}\endgroup %
1682 }
1683
1684 % @defmac == @deffn Macro
1685
1686 \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
1687
1688 \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
1689 \begingroup\defname {#1}{Macro}%
1690 \defunargs {#2}\endgroup %
1691 }
1692
1693 % @defspec == @deffn Special Form
1694
1695 \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
1696
1697 \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
1698 \begingroup\defname {#1}{Special form}%
1699 \defunargs {#2}\endgroup %
1700 }
1701
1702 % This definition is run if you use @defunx
1703 % anywhere other than immediately after a @defun or @defunx.
1704
1705 \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
1706 \def\defunx #1 {\errmessage{@defunx in invalid context}}
1707 \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
1708 \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
1709
1710 % @defmethod, and so on
1711
1712 % @defop {Funny Method} foo-class frobnicate argument
1713
1714 \def\defop #1 {\def\defoptype{#1}%
1715 \defmethparsebody\Edefop\defopx\defopheader}
1716
1717 \def\defopheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
1718 \begingroup\defname {#2}{\defoptype{} on #1}%
1719 \defunargs {#3}\endgroup %
1720 }
1721
1722 % @defmethod == @defop Method
1723
1724 \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
1725
1726 \def\defmethodheader #1#2#3{\dosubind {fn}{\code{#2}}{on #1}% entry in function index
1727 \begingroup\defname {#2}{Operation on #1}%
1728 \defunargs {#3}\endgroup %
1729 }
1730
1731 % @defcv {Class Option} foo-class foo-flag
1732
1733 \def\defcv #1 {\def\defcvtype{#1}%
1734 \defmethparsebody\Edefcv\defcvx\defcvheader}
1735
1736 \def\defcvarheader #1#2#3{%
1737 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
1738 \begingroup\defname {#2}{\defcvtype of #1}%
1739 \defvarargs {#3}\endgroup %
1740 }
1741
1742 % @defivar == @defcv {Instance Variable}
1743
1744 \def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
1745
1746 \def\defivarheader #1#2#3{%
1747 \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
1748 \begingroup\defname {#2}{Instance variable of #1}%
1749 \defvarargs {#3}\endgroup %
1750 }
1751
1752 % These definitions are run if you use @defmethodx, etc.,
1753 % anywhere other than immediately after a @defmethod, etc.
1754
1755 \def\defopx #1 {\errmessage{@defopx in invalid context}}
1756 \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
1757 \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
1758 \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
1759
1760 % Now @defvar
1761
1762 % First, define the processing that is wanted for arguments of @defvar.
1763 % This is actually simple: just print them in roman.
1764 % This must expand the args and terminate the paragraph they make up
1765 \def\defvarargs #1{\normalparens #1%
1766 \interlinepenalty=10000
1767 \endgraf\vskip -\parskip \penalty 10000}
1768
1769 % @defvr Counter foo-count
1770
1771 \def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
1772
1773 \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
1774 \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
1775
1776 % @defvar == @defvr Variable
1777
1778 \def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
1779
1780 \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
1781 \begingroup\defname {#1}{Variable}%
1782 \defvarargs {#2}\endgroup %
1783 }
1784
1785 % @defopt == @defvr {User Option}
1786
1787 \def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
1788
1789 \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
1790 \begingroup\defname {#1}{User Option}%
1791 \defvarargs {#2}\endgroup %
1792 }
1793
1794 % This definition is run if you use @defvarx
1795 % anywhere other than immediately after a @defvar or @defvarx.
1796
1797 \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
1798 \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
1799 \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
1800
1801 % Now define @deftp
1802 % Args are printed in bold, a slight difference from @defvar.
1803
1804 \def\deftpargs #1{\bf \defvarargs{#1}}
1805
1806 % @deftp Class window height width ...
1807
1808 \def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
1809
1810 \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
1811 \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
1812
1813 % This definition is run if you use @deftpx, etc
1814 % anywhere other than immediately after a @deftp, etc.
1815
1816 \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
1817
1818 \message{cross reference,}
1819 % Define cross-reference macros
1820 \newwrite \auxfile
1821
1822 % \setref{foo} defines a cross-reference point named foo.
1823
1824 \def\setref#1{%
1825 \dosetq{#1-pg}{Ypagenumber}%
1826 \dosetq{#1-snt}{Ysectionnumberandtype}}
1827
1828 \def\unnumbsetref#1{%
1829 \dosetq{#1-pg}{Ypagenumber}%
1830 \dosetq{#1-snt}{Ynothing}}
1831
1832 % \xref and \pxref generate cross references to specified points.
1833
1834 \def\pxref #1{see \xrefX [#1,,,,,,,]}
1835 \def\xref #1{See \xrefX [#1,,,,,,,]}
1836 \def\xrefX [#1,#2,#3,#4,#5,#6]{%
1837 \setbox1=\hbox{\i{\losespace#5{}}}%
1838 \setbox0=\hbox{\losespace#3{}}%
1839 \ifdim \wd0 =0pt \setbox0=\hbox{\losespace#1{}}\fi%
1840 \ifdim \wd1 >0pt%
1841 section \unhbox0{} in \unhbox1%
1842 \else%
1843 \refx{#1-snt} [\unhbox0], page\tie \refx{#1-pg}%
1844 \fi }
1845
1846 % \dosetq is the interface for calls from other macros
1847
1848 \def\dosetq #1#2{{\let\folio=0%
1849 \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
1850 \next}}
1851
1852 % \internalsetq {foo}{page} expands into CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
1853 % When the aux file is read, ' is the escape character
1854
1855 \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
1856
1857 % Things to be expanded by \internalsetq
1858
1859 \def\Ypagenumber{\folio}
1860
1861 \def\Ynothing{}
1862
1863 \def\Ysectionnumberandtype{%
1864 \ifnum\secno=0 chapter\xreftie\the\chapno %
1865 \else \ifnum \subsecno=0 section\xreftie\the\chapno.\the\secno %
1866 \else \ifnum \subsubsecno=0 %
1867 section\xreftie\the\chapno.\the\secno.\the\subsecno %
1868 \else %
1869 section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
1870 \fi \fi \fi }
1871
1872 \gdef\xreftie{'tie}
1873
1874 % Define @refx to reference a specific cross-reference string.
1875
1876 \def\refx#1{%
1877 {%
1878 \expandafter\ifx\csname X#1\endcsname\relax
1879 % If not defined, say something at least.
1880 \expandafter\gdef\csname X#1\endcsname {$<$undefined$>$}%
1881 \message {WARNING: Cross-reference "#1" used but not yet defined}%
1882 \message {}%
1883 \fi %
1884 \csname X#1\endcsname %It's defined, so just use it.
1885 }}
1886
1887 % Read the last existing aux file, if any.  No error if none exists.
1888
1889 % This is the macro invoked by entries in the aux file.
1890 \def\xrdef #1#2{
1891 {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
1892
1893 {
1894 \catcode `\^^@=\other
1895 \catcode `\\ 1=\other
1896 \catcode `\\ 2=\other
1897 \catcode `\^^C=\other
1898 \catcode `\^^D=\other
1899 \catcode `\^^E=\other
1900 \catcode `\^^F=\other
1901 \catcode `\^^G=\other
1902 \catcode `\^^H=\other
1903 \catcode `\\v=\other
1904 \catcode `\^^L=\other
1905 \catcode `\\ e=\other
1906 \catcode `\\ f=\other
1907 \catcode `\\10=\other
1908 \catcode `\\11=\other
1909 \catcode `\\12=\other
1910 \catcode `\\13=\other
1911 \catcode `\\14=\other
1912 \catcode `\\15=\other
1913 \catcode `\\16=\other
1914 \catcode `\\17=\other
1915 \catcode `\\18=\other
1916 \catcode `\\19=\other
1917 \catcode `\\1a=\other
1918 \catcode `\^^[=\other
1919 \catcode `\^^\=\other
1920 \catcode `\^^]=\other
1921 \catcode `\^^^=\other
1922 \catcode `\^^_=\other
1923 \catcode `\@=\other
1924 \catcode `\^=\other
1925 \catcode `\~=\other
1926 \catcode `\[=\other
1927 \catcode `\]=\other
1928 \catcode`\"=\other
1929 \catcode`\_=\other
1930 \catcode`\|=\other
1931 \catcode`\<=\other
1932 \catcode`\>=\other
1933 \catcode `\$=\other
1934 \catcode `\#=\other
1935 \catcode `\&=\other
1936
1937 % the aux file uses ' as the escape.
1938 % Turn off \ as an escape so we do not lose on
1939 % entries which were dumped with control sequences in their names.
1940 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
1941 % Reference to such entries still does not work the way one would wish,
1942 % but at least they do not bomb out when the aux file is read in.
1943
1944 \catcode `\{=1 \catcode `\}=2
1945 \catcode `\%=\other
1946 \catcode `\'=0
1947 \catcode `\\=\other
1948
1949 'openin 1 'jobname.aux
1950 'ifeof 1 'else 'closein 1 'input 'jobname.aux
1951 'fi
1952 }
1953
1954 % Open the new aux file.  Tex will close it automatically at exit.
1955
1956 \openout \auxfile=\jobname.aux
1957
1958 % Footnotes.
1959
1960 \newcount \footnoteno
1961
1962 \def\supereject{\par\penalty -20000\footnoteno =0 }
1963
1964 \let\ptexfootnote=\footnote
1965
1966 {\catcode `\@=11
1967 \gdef\footnote{\global\advance \footnoteno by \@ne
1968 \edef\thisfootno{$^{\the\footnoteno}$}%
1969 \let\@sf\empty
1970 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
1971 \thisfootno\@sf\parsearg\footnotezzz}
1972
1973 \gdef\footnotezzz #1{\insert\footins{
1974 \interlinepenalty\interfootnotelinepenalty
1975 \splittopskip\ht\strutbox % top baseline for broken footnotes
1976 \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
1977 \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
1978 \footstrut\hang\textindent{\thisfootno}#1\strut}}
1979
1980 }%end \catcode `\@=11
1981
1982 % End of control word definitions.
1983
1984 \message{and turning on texinfo input format.}
1985
1986 \newindex{cp}
1987 \newcodeindex{fn}
1988 \newcodeindex{vr}
1989 \newcodeindex{tp}
1990 \newcodeindex{ky}
1991 \newcodeindex{pg}
1992
1993 % Set some numeric style parameters, for 8.5 x 11 format.
1994
1995 \hsize = 6.5in
1996 \parindent 15pt
1997 \parskip 18pt plus 1pt
1998 \baselineskip 15pt
1999 \advance\topskip by 1.2cm
2000
2001 % Prevent underfull vbox error messages.
2002 \vbadness=10000
2003
2004 % Use @smallbook to reset parameters for 7x9.5 format
2005 \def\smallbook{
2006 \global\lispnarrowing = 0.3in
2007 \global\baselineskip 12pt
2008 \global\parskip 3pt plus 1pt
2009 \global\hsize = 5in
2010 \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
2011 \global\vsize=7.5in
2012 \global\tolerance=700
2013 \global\hfuzz=1pt
2014
2015 \global\pagewidth=\hsize
2016 \global\pageheight=\vsize
2017 \global\font\ninett=cmtt9
2018
2019 \global\let\smalllisp=\smalllispx
2020 \global\let\smallexample=\smalllispx
2021 \global\def\Esmallexample{\Esmalllisp}
2022 }
2023
2024 %% For a final copy, take out the rectangles
2025 %% that mark overfull boxes (in case you have decided
2026 %% that the text looks ok even though it passes the margin).
2027 \def\finalout{\overfullrule=0pt}
2028
2029 % Turn off all special characters except @
2030 % (and those which the user can use as if they were ordinary)
2031 % Define certain chars to be always in tt font.
2032
2033 \catcode`\"=\active
2034 \def\activedoublequote{{\tt \char '042}}
2035 \let"=\activedoublequote
2036 \catcode`\~=\active
2037 \def~{{\tt \char '176}}
2038 \chardef\hat=`\^
2039 \catcode`\^=\active
2040 \def^{{\tt \hat}}
2041 \catcode`\_=\active
2042 \def_{{\tt \char '137}}
2043 \catcode`\|=\active
2044 \def|{{\tt \char '174}}
2045 \chardef \less=`\<
2046 \catcode`\<=\active
2047 \def<{{\tt \less}}
2048 \chardef \gtr=`\>
2049 \catcode`\>=\active
2050 \def>{{\tt \gtr}}
2051
2052 \catcode`\@=0
2053
2054 % \rawbackslashxx output one backslash character in current font
2055 {\catcode`\\=\other
2056 @gdef@rawbackslashxx{\}}
2057
2058 % \rawbackslash redefines \ as input to do \rawbackslashxx.
2059 {\catcode`\\=\active
2060 @gdef@rawbackslash{@let\=@rawbackslashxx }}
2061
2062 % \normalbackslash outputs one backslash in fixed width font.
2063 \def\normalbackslash{{\tt\rawbackslashxx}}
2064
2065 % Say @foo, not \foo, in error messages.
2066 \escapechar=`\@
2067
2068 %% These look ok in all fonts, so just make them not special.  The @rm below
2069 %% makes sure that the current font starts out as the newly loaded cmr10
2070 \catcode`\$=\other \catcode`\%=\other \catcode`\&=\other \catcode`\#=\other
2071
2072 \catcode 17=0   @c Define control-q
2073 \catcode`\\=\active
2074 @let\=@normalbackslash
2075
2076 @textfonts
2077 @rm