Debian Codegraph @

answers/wv07.tex

raw
1
2 %*******************************************************************************
3 %* START OF AUTOMATICALLY GENERATED TEX FILE *
4 %*******************************************************************************
5 %* *
6 %* This TeX file was automatically generated by the FunnelWeb preprocessor. *
7 %* You can typeset this file to produce printed documentation by running it *
8 %* through the TeX typesetter using a command such as: *
9 %* tex thisfilename *
10 %* The resultant file thisfilename.dvi can be printed using a command such as: *
11 %* lpr -Plaser -d thisfilename.dvi *
12 %* *
13 %* FunnelWeb is a preprocessor that allows programmers to weave programs and *
14 %* their documentation together in a single document. The FunnelWeb program *
15 %* analyses such documents producing both program files and typeset *
16 %* documentation such as this TeX file. *
17 %* FunnelWeb was created by Ross N. Williams. *
18 %* *
19 %* For more information on FunnelWeb see http://www.ross.net/funnelweb/ *
20 %* *
21 %*******************************************************************************
22
23
24 %===================== Start of FunnelWeb TeX Definitions ======================
25
26
27 % Version
28 % -------
29 % This is FunnelWeb TeX Macro Library Version 1.0.
30
31
32 % Copyright
33 % ---------
34 % This set of FunnelWeb TeX definitions was written by Ross Williams and was
35 % originally Copyright (C) 1992 Ross N. Williams. However, I, Ross Williams,
36 % hereby forego any claim to Copyright in this set of FunnelWeb TeX definitions
37 % and hereby authorize that the set of TeX definitions pass into the public
38 % domain. -- Ross N. Williams, 3:41pm 07-May-1992, Adelaide, Australia.
39
40
41 % Modification
42 % ------------
43 % Please record all modifications to these TeX definitions here. Unless
44 % otherwise specified, all modified definitions fall in the public domain too.
45 %
46 % Programmers:
47 % RNW Ross N. Williams [email protected]
48 %
49 % Changes:
50 % 07-May-1992 RNW Prepared this work for public domain release.
51 % 10-May-1999 RNW Added \fwlib macro.
52
53
54 % General Comments
55 % ----------------
56 % This set of TeX definitions exists for two reasons:
57 %
58 % 1. To shorten and neaten the FunnelWeb TeX output.
59 % 2. To allow users to fiddle with the output format in their input files
60 % (by inserting redefining "\def"s) without having to resort to
61 % modifying the FunnelWeb code.
62 %
63 % The user is warned that these definitions may be changed from time to time
64 % (but probably not much). The user should not be too sneaky. In particular,
65 % users wishing to redefine some of these macros should do so in an explicitly
66 % defined section at the top of their input file. This will mean that in the
67 % event of problems, that section can simply be deleted or commented out to
68 % allow the document to at least be typeset in the default format. Users should
69 % limit themselves to redefining these macros in such a section and should
70 % refrain from using the macros throughout their documents.
71
72
73 % Environment Parameters
74 % ----------------------
75 % \tolerance tells TeX how tolerant it should be about making bad line and
76 % page breaks. Here we set it to it's maximum, as
77 % 1) Computer programs are likely to cause lots of bad breaks.
78 % 2) In most cases the user would probably rather get the TeX file through
79 % TeX without any errors than fiddle with spacings for perfection.
80 \tolerance=10000
81
82 % I don't like indentation as it makes the page look more busy. Instead,
83 % paragraphs are separated by a little space (see next).
84 \parindent=0pt
85
86 % In many cases, users will produce documents with long runs of paragraphs.
87 % In order to space out these paragraphs, it is convenient to maintain a
88 % prevailing non-zero \parskip (end-of-paragaph skip). The only trouble is
89 % that the skip becomes a problem in macro definitions which require no skip
90 % and so we have to turn the skip on and off. The following two macros
91 % simplify this process.
92 \def\fwparskipon{\parskip=\medskipamount}
93 \def\fwparskipoff{\parskip=0pt}
94 \fwparskipon
95
96 % Setting raggedbottom allows TeX to leave a bit of space at the bottom of the
97 % page in order to better vertically align the rest of the page (e.g. skips
98 % won't stretch as much). It also means that headings are less likely to be
99 % isolated at the bottom of the page without any following text.
100 \raggedbottom
101
102
103 % Fonts
104 % -----
105 % Most of the typeset output is set in 10pt roman and 10pt tt font.
106 % The major extra font needs spring from titles and headings.
107 % For portability's sake we use only the following fonts:
108 % cmr10
109 % cmbx10
110 % cmtt10
111 % and some enlargements of them. These fonts are all "standard" fonts
112 % in Plain TeX. See The TeXbook p.350.
113 \font\fwfontnote=cmr7
114
115 \font\fwfontnorm=cmr10
116 \font\fwfontnorma=cmr10 scaled \magstep1
117 \font\fwfontnormb=cmr10 scaled \magstep2
118
119 \font\fwfontbold=cmbx10
120 \font\fwfontbolda=cmbx10 scaled \magstep1
121 \font\fwfontboldb=cmbx10 scaled \magstep2
122 \font\fwfontboldc=cmbx10 scaled \magstep3
123 \font\fwfontboldd=cmbx10 scaled \magstep4
124
125
126 % Macros for Stylistic Details
127 % ----------------------------
128 % This section contains all the fiddly little macros for setting the details
129 % of each macro definition.
130
131 % Macro definitions are sandwiched by calls to these macros which can be used
132 % to sort out the spacing before and after the macro definition.
133 \def\fwbeginmacro{\fwparskipoff\bigskip}
134 \def\fwendmacro{\fwparskipon\par}
135
136 % These macros deal with the macro name and definition line.
137 \def\fwmacroname#1#2{{\sl #1\/}$\lbrack$#2$\rbrack$}
138 \def\fwfilename#1#2{{\bf #1}$\lbrack$#2$\rbrack$}
139 \def\fwzero#1{{\bf Z}}
140 \def\fwmany#1{{\bf M}}
141 \def\fwlib#1{{\bf L}}
142 \def\fwequals{ $\equiv$}
143 \def\fwplusequals{ $+\equiv$}
144
145 % Now for the actual body of the definition. It looks nice to have the tt
146 % code indented a little. Again, we use macros instead of writing direct TeX,
147 % so as to allow the user to fiddle this stuff to taste without having to
148 % modify the FunnelWeb C code.
149 \def\fwodef{\parindent=15pt\vskip0pt$\lbrace$\parindent=20pt}
150 \def\fwcdef{$\rbrace$\vskip0pt\parindent=0pt}
151 \def\fwoquote{`}
152 \def\fwcquote{'}
153 \def\fwoparen{$($}
154 \def\fwcomma{$,$}
155 \def\fwcparen{$)$}
156 \def\fwparam#1{$\diamond #1$}
157 \def\fwparams#1{$(\diamond #1)$}
158
159 % These macros deal with the notes that are appended at the end of each
160 % macro definition. Note that even though \fwisafile,\fwusedin, and \fwseealso
161 % have the same definition, they are given different names so as to allow the
162 % user to redefine these macros to typeset each kind of information differently
163 % if desired.
164 \def\fwbeginmacronotes{\begingroup\baselineskip=9pt\smallskip}
165 \def\fwnote#1{{\fwfontnote #1}\par}
166 \def\fwisafile#1{\fwnote{#1}}
167 \def\fwusedin#1{\fwnote{#1}}
168 \def\fwseealso#1{\fwnote{#1}}
169 \def\fwendmacronotes{\endgroup}
170
171
172 % Macros to Typeset Program Code Verbatim
173 % ---------------------------------------
174 % This is by far the hairiest and most difficult part of the typesetting task
175 % because we have to turn off most of TeX's natural instincts in order to
176 % typeset the program text exactly as it appears in the input file.
177 % Two macros are defined to pull this off: \fwbtx and \fwverbatimgobble.
178 % Their code was inspired by the following sections of "The TeXbook":
179 % Appendix D: Dirty Tricks, 3.Verbatim listing, p.380-382.
180 % Appendix E: Example Formats, p.421.
181 % The \fwbtx[ (for "FunnelWeb Begin TeXt") macro does most of the hard work.
182 % The liberal use of "%" is because I don't understand TeX well enough to
183 % understand when an end of line will cause trouble, and I am playing it safe.
184
185 % Before defining the main \fwbtx macro, we have to stash away some definitions
186 % in the hidden part of TeX's environment. Let's hope that these "hidden"
187 % definitions don't affect anything except what is desired to be affected.
188
189 % The tt font in which we wish to set the text has two Latin lurking ligatures!
190 % These are ?` and !`. To disable them, we define the left quote when ACTIVE
191 % to be defined in such a way as to prevent ligatures. The main TeX text will
192 % normally not be exposed to this definition because normally the leftquote
193 % character is not active. The \fwbtx macro temporarily makes the left quote
194 % character active thus activating the deactivation of left quote ligatures.
195 % See The TeXbook p.381.
196 {\catcode`\`=\active \gdef`{\relax\lq}}
197
198 % TeX is fairly carefree about spaces and so we have to make it more serious.
199 % To do so we pull the same trick as above, setting up a definition for active
200 % space, but only making space active during the span of the verbatim text.
201 % In Plain TeX the active space is defined to be simply a space, but here we
202 % define it to be a control space. This ensures that the space cannot
203 % be gobbled up by one of TeX's mysterious mechanisms when activated.
204 % See The TeXbook, p.381 and p.352.
205 {\obeyspaces\global\let =\ }
206
207 % Here is the main \fwbtx verbatim text macro.
208 % Note: The order in which all these pieces of business have to be done is
209 % still a partial mystery to me. Don't fiddle with this stuff unless you
210 % think you know what you are doing.
211 \def\fwbtx[{%
212 %
213 % The funnies involved in getting verbatim output are safely housed inside
214 % this \begingroup, and the \endgroup in \fwverbatimgobble. Groups are used
215 % instead of curly braces because we have to be able to signal the end of
216 % this macro with a curly brace.
217 \begingroup%
218 %
219 % \pars at the end of empty lines in the verbatim text won't come out normally
220 % because TeX is in vertical mode and they get gobbled up. To prevent this,
221 % we force \par to exit vertical mode first. See The TeXbook p.381.
222 \def\par{\leavevmode\endgraf}%
223 %
224 % Activate the leftquote character so as to avoid ligatures (see above).
225 \catcode`\`=\active%
226 %
227 % The \obeylines macro simply defines end of line (^M) to be \par. This ensures
228 % that TeX will treat each verbatim line as a new paragraph.
229 \obeylines%
230 %
231 % To get verbatim output, we have to desex all the special characters. This
232 % is explained in detail in The TeXbook p.380.
233 \def\do##1{\catcode`##1=12 }\dospecials%
234 %
235 % Activate the space character so as to make TeX treat blanks seriously.
236 % This activation invokes an eralier definition (see above).
237 \obeyspaces
238 %
239 % Interparagraph skips do not help the cause.
240 % Note: We have to preserve the indentation though, as the code is actually
241 % indented in the final output. See \fwodef in an earlier section.
242 \parskip=0pt%
243 %
244 % We typeset the verbatim text in tt font (courier on the Macintosh) for a
245 % number of reasons:
246 % - tt font has the same horizontal spacing for each character.
247 % - tt font covers the ASCII character set.
248 % - tt font doesn't have many surprises (e.g. ligatures).
249 % - tt font looks much what you might see on a computer terminal screen.
250 \tt%
251 %
252 % Having set up an environment for verbatim, we are ready to use it.
253 % By invoking \fwverbatimgobble, this \fwbtx macro gobbles up text verbatim (as
254 % part of the parameter of \fwverbatimgobble) until it sees the termination
255 % string "]fwetx=" (the "=" was thrown in to add obscurity as this sequence
256 % must never occur in the verbatim text).
257 \fwverbatimgobble}
258
259 % The \fwverbatimgobble macro exists to allow \fwbtx to bracket verbatim text.
260 \def\fwverbatimgobble#1]fwetx={#1\endgroup}
261
262
263 % Table of Contents
264 % -----------------
265 % The five levels of table of contents that FunnelWeb supports are identified
266 % by the five letters [A..E]. These are used throughout the following macros.
267
268 % The following macros are utilities to the TOC macros to follow.
269 \def\fwrule{\medskip\hrule\medskip}
270 \def\fwqh{\hskip1.5em\relax}
271 \def\fwbeforesec{\penalty-200\bigskip\medskip\par}
272
273 % The following macros are used to typeset the table of contents.
274 \def\fwtocstart#1{\fwrule\leftline{\fwfontbolda Table of Contents}\fwrule}
275 \def\fwtoca#1#2{\leftline{{\bf #1 #2}}}
276 \def\fwtocb#1#2{\leftline{\fwqh #1 #2}}
277 \def\fwtocc#1#2{\leftline{\fwqh\fwqh #1 #2}}
278 \def\fwtocd#1#2{\leftline{\fwqh\fwqh\fwqh #1 #2}}
279 \def\fwtoce#1#2{\leftline{\fwqh\fwqh\fwqh\fwqh #1 #2}}
280 \def\fwtocfinish#1{\fwrule}
281
282 % The following "library" macros define five different strengths of headings
283 % which can be used later in the section macros.
284 \def\fwliba#1#2{\vfill\eject{\fwfontboldc #1 #2}\penalty200\smallskip}
285 \def\fwlibb#1#2{\fwbeforesec{\fwfontboldb #1 #2}\penalty200\smallskip}
286 \def\fwlibc#1#2{\fwbeforesec{\fwfontnormb #1 #2}\penalty200\smallskip}
287 \def\fwlibd#1#2{\fwbeforesec{\bf #1 #2}\penalty200}
288 \def\fwlibe#1#2{\fwbeforesec{\bf #1 #2}}
289
290 % Here are the macros that actually typeset the section headings throughout
291 % the document. The fwlib system has been employed so as to easily allow the
292 % user to redefine the strengths of headings to taste. For example, the
293 % user could insert in the input document a similar set of definitions to these
294 % but with the b..e headings set to \fwlibc. This would tone down the output.
295 \def\fwseca#1#2{\fwliba{#1}{#2}}
296 \def\fwsecb#1#2{\fwlibb{#1}{#2}}
297 \def\fwsecc#1#2{\fwlibc{#1}{#2}}
298 \def\fwsecd#1#2{\fwlibd{#1}{#2}}
299 \def\fwsece#1#2{\fwlibe{#1}{#2}}
300
301
302 % Support for Explicit Typesetting
303 % --------------------------------
304 % FunnelWeb supports pragmas and other constructs that allow
305 % typesetter-independent typesetting commands to be given. The
306 % following macros support these features.
307
308 % The in-text literal @{sloth@} and emphasise @[walrus@] features.
309 \def\fwlit#1{{\tt #1}}
310 \def\fwemp#1{{\it #1}}
311
312 % The "@p new_page" pragma.
313 \def\fwnewpage{\vfill\eject}
314
315 % The "@p vskip Nmm" pragma.
316 \def\fwvskip#1{\null\vskip #1mm}
317
318 % The "@p title <font> <align> <text>" pragma.
319 \def\fwfontnormal#1{{\fwfontnorm {#1}}}
320 \def\fwfonttitle#1{{\fwfontboldd {#1}}}
321 \def\fwfontsmalltitle#1{{\fwfontboldb {#1}}}
322 \def\fwleftline#1{\leftline{#1}}
323 \def\fwcenterline#1{\centerline{#1}}
324 \def\fwrightline#1{\rightline{#1}}
325
326
327 % Support for Old FunnelWeb
328 % -------------------------
329 % The following macros were used extensively in the first version of
330 % FunnelWeb and are retained so that these older input files will still
331 % typeset cleanly.
332 \def\p#1{{\tt #1}} % P for Program text.
333 \def\flagpage#1#2{
334 \null
335 \vfill
336 \centerline{\fwfontboldd #1}
337 \vskip 1cm
338 \centerline{\fwfontboldd #2}
339 \vfill
340 \null
341 \vfill
342 }
343
344 %====================== End of FunnelWeb TeX Definitions =======================
345 WV07: Test the typesetting of library macros.
346
347 \fwseca{1}{1. Test an ordinary library macro.}
348
349 \fwbeginmacro
350 \fwmacroname{Sloth}{1}\fwzero{}\fwlib{}\fwequals \fwodef \fwbtx[I am the sloth]fwetx=%
351 \fwcdef
352 \fwbeginmacronotes
353 \fwusedin{This macro is NEVER invoked.}
354 \fwendmacronotes
355 \fwendmacro
356
357
358
359 \fwseca{2}{2. Test a library macro with two body parts.}
360
361 \fwbeginmacro
362 \fwmacroname{Two body parts}{2}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Sloth]fwetx=%
363 \fwcdef
364 \fwbeginmacronotes
365 \fwseealso{This macro is defined in definitions 2 and 3.}
366 \fwusedin{This macro is invoked in definition 11.}
367 \fwendmacronotes
368 \fwendmacro
369
370 \fwbeginmacro
371 \fwmacroname{Two body parts}{3}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Walrus]fwetx=%
372 \fwcdef
373 \fwbeginmacronotes
374 \fwseealso{This macro is defined in definitions 2 and 3.}
375 \fwusedin{This macro is invoked in definition 11.}
376 \fwendmacronotes
377 \fwendmacro
378
379
380
381 \fwseca{3}{3. Test a library macro with three body parts.}
382
383 \fwbeginmacro
384 \fwmacroname{Three body parts}{4}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Sloth]fwetx=%
385 \fwcdef
386 \fwbeginmacronotes
387 \fwseealso{This macro is defined in definitions 4, 5 and 6.}
388 \fwusedin{This macro is invoked in definition 9.}
389 \fwendmacronotes
390 \fwendmacro
391
392 \fwbeginmacro
393 \fwmacroname{Three body parts}{5}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Walrus]fwetx=%
394 \fwcdef
395 \fwbeginmacronotes
396 \fwseealso{This macro is defined in definitions 4, 5 and 6.}
397 \fwusedin{This macro is invoked in definition 9.}
398 \fwendmacronotes
399 \fwendmacro
400
401 \fwbeginmacro
402 \fwmacroname{Three body parts}{6}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Aardvaark]fwetx=%
403 \fwcdef
404 \fwbeginmacronotes
405 \fwseealso{This macro is defined in definitions 4, 5 and 6.}
406 \fwusedin{This macro is invoked in definition 9.}
407 \fwendmacronotes
408 \fwendmacro
409
410
411
412 \fwseca{4}{4. Test a library macro with five body parts.}
413
414 \fwbeginmacro
415 \fwmacroname{Five body parts}{7}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Sloth]fwetx=%
416 \fwcdef
417 \fwbeginmacronotes
418 \fwseealso{This macro is defined in definitions 7, 8, 9, 10 and 11.}
419 \fwusedin{This macro is NEVER invoked.}
420 \fwendmacronotes
421 \fwendmacro
422
423 \fwbeginmacro
424 \fwmacroname{Five body parts}{8}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Walrus]fwetx=%
425 \fwcdef
426 \fwbeginmacronotes
427 \fwseealso{This macro is defined in definitions 7, 8, 9, 10 and 11.}
428 \fwusedin{This macro is NEVER invoked.}
429 \fwendmacronotes
430 \fwendmacro
431
432 \fwbeginmacro
433 \fwmacroname{Five body parts}{9}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwmacroname{Three body parts}{4}\fwcdef
434 \fwbeginmacronotes
435 \fwseealso{This macro is defined in definitions 7, 8, 9, 10 and 11.}
436 \fwusedin{This macro is NEVER invoked.}
437 \fwendmacronotes
438 \fwendmacro
439
440 \fwbeginmacro
441 \fwmacroname{Five body parts}{10}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[Aardvaark]fwetx=%
442 \fwcdef
443 \fwbeginmacronotes
444 \fwseealso{This macro is defined in definitions 7, 8, 9, 10 and 11.}
445 \fwusedin{This macro is NEVER invoked.}
446 \fwendmacronotes
447 \fwendmacro
448
449 \fwbeginmacro
450 \fwmacroname{Five body parts}{11}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwmacroname{Two body parts}{2}\fwcdef
451 \fwbeginmacronotes
452 \fwseealso{This macro is defined in definitions 7, 8, 9, 10 and 11.}
453 \fwusedin{This macro is NEVER invoked.}
454 \fwendmacronotes
455 \fwendmacro
456
457
458
459 \fwseca{5}{5. Test a library macro that is overruled.}
460
461 \fwbeginmacro
462 \fwmacroname{Walrus}{13}\fwzero{}\fwlib{}\fwequals \fwodef \fwbtx[Walrus library]fwetx=%
463 \fwcdef
464 \fwbeginmacronotes
465 \fwusedin{This library macro was overruled by definition
466 13 and is not active.}
467 \fwendmacronotes
468 \fwendmacro
469
470 \fwbeginmacro
471 \fwmacroname{Walrus}{13}\fwzero{}\fwequals \fwodef \fwbtx[Walrus main]fwetx=%
472 \fwcdef
473 \fwbeginmacronotes
474 \fwusedin{This macro is NEVER invoked.}
475 \fwendmacronotes
476 \fwendmacro
477
478
479
480 \fwseca{6}{6. Test interlaced and overruled.}
481
482 \fwbeginmacro
483 \fwmacroname{Aardvark}{14}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[First aardvark level one text (correct)
484 ]fwetx=%
485 \fwcdef
486 \fwbeginmacronotes
487 \fwseealso{This macro is defined in definitions 14 and 16.}
488 \fwusedin{This macro is invoked in definition 18.}
489 \fwendmacronotes
490 \fwendmacro
491
492 \fwbeginmacro
493 \fwmacroname{Aardvark}{14}\fwlib{}\fwlib{}\fwplusequals \fwodef \fwbtx[Second aardvark level two text]fwetx=%
494 \fwcdef
495 \fwbeginmacronotes
496 \fwseealso{This macro is defined in definitions 15 and 17.}
497 \fwusedin{This library macro was overruled by definition
498 14 and is not active.}
499 \fwendmacronotes
500 \fwendmacro
501
502 \fwbeginmacro
503 \fwmacroname{Aardvark}{16}\fwzero{}\fwlib{}\fwplusequals \fwodef \fwbtx[First aardvark level one text (correct)
504 ]fwetx=%
505 \fwcdef
506 \fwbeginmacronotes
507 \fwseealso{This macro is defined in definitions 14 and 16.}
508 \fwusedin{This macro is invoked in definition 18.}
509 \fwendmacronotes
510 \fwendmacro
511
512 \fwbeginmacro
513 \fwmacroname{Aardvark}{16}\fwlib{}\fwlib{}\fwplusequals \fwodef \fwbtx[Second aardvark level two text]fwetx=%
514 \fwcdef
515 \fwbeginmacronotes
516 \fwseealso{This macro is defined in definitions 15 and 17.}
517 \fwusedin{This library macro was overruled by definition
518 14 and is not active.}
519 \fwendmacronotes
520 \fwendmacro
521
522
523 \fwbeginmacro
524 \fwfilename{wv07.out}{18}\fwequals \fwodef \fwmacroname{Aardvark}{14}\fwcdef
525 \fwbeginmacronotes
526 \fwisafile{This macro is attached to an output file.}
527 \fwendmacronotes
528 \fwendmacro
529
530
531 End of tests.
532 \bye
533
534
535 %*******************************************************************************
536 %* END OF AUTOMATICALLY GENERATED TEX FILE *
537 %*******************************************************************************
538