Debian Codegraph @

reference/0fw_ref.fw

raw ◀ ▶
1 Debian patch touch this file
1 @!345678901234567890123456789012345678901234567890123456789012345678901234567890
2 @!******************************************************************************
3
4 @t vskip 50 mm
5 @t title titlefont centre "FunnelWeb Reference Manual Web"
6 @t vskip 10 mm
7 @t title smalltitlefont centre "by Ross N. Williams"
8 @t title smalltitlefont centre "15 April 1999"
9 @t vskip 10 mm
10 @t title smalltitlefont centre "Copyright (c) Ross N. Williams, 1992."
11 @t new_page
12 @t vskip 20 mm
13 @t title titlefont centre "Contents"
14 @t vskip 10 mm
15 @t table_of_contents
16 @t new_page
17
18 @!******************************************************************************
19 @!******************************************************************************
20
21 @A@<FunnelWeb Reference Manual Web@>
22
23 This document contains the FunnelWeb source for the
24 FunnelWeb reference manual web. When processed by the
25 FunnelWeb macro preprocessor, this file will generate all
26 the text files in the web.
27
28 @!******************************************************************************
29
30 @B@<Copyright Notice@>
31
32 This FunnelWeb source file and all works derived from it
33 (including, but not limited to, the output files and printed
34 documentation that can be extracted using the FunnelWeb
35 preprocessor) are copyright as shown below, and the
36 copyright message in the copyright macro applies to all of
37 these works. The enclosing macro is called at the start of
38 each FunnelWeb output file so that the copyright message
39 appears in each output file as well as in this FunnelWeb
40 source file.
41
42 @$@<Copyright notice/HTML@>@M@{@-
43 Copyright @<(C)@> Ross N. Williams 1992,1999. All rights reserved.@}
44
45 Permission is granted to redistribute and use this manual in
46 any medium, with or without modification, provided that all
47 notices (including, without limitation, the copyright
48 notice, this permission notice, any record of modification,
49 and all legal notices) are preserved on all copies, that all
50 modifications are clearly marked, and that modified versions
51 are not represented as the original version unless all the
52 modifications since the manual's original release by Ross N.
53 Williams (www.ross.net) consist of translations or other
54 transformations that alter only the manual's form, not its
55 content. THIS MANUAL IS PROVIDED "AS IS" AND WITHOUT ANY
56 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
57 LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
58 FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY
59 LAW THERE IS ABSOLUTELY NO WARRANTY.
60
61 @!******************************************************************************
62
63 @p maximum_input_line_length = 500
64 @p maximum_output_line_length = 500
65
66 @!******************************************************************************
67
68 @B@<Change Log@>
69
70 @$@<Change log@>@Z@{
71 15-Apr-1999: Converted the original 1992 FunnelWeb manual to this web.
72 08-May-1999: Documented new +u (HTML) option.
73 11-May-1999: Documented new fwinit.fws semantics.
74 12-May-1999: Documented library macro feature.
75 29-Dec-1999 RNW Added sidebar image strut to stop it collapsing.
76 30-Dec-1999 RNW Changed manual version number scheme.
77 03-Jan-2000 RNW Changed copyright permission notice.
78 06-Jan-2000 RNW Added black background table to sidebar to cope with no-images.
79 09-Jan-2000 RNW Moved main version notice into a macro in the fw include file.
80 @}
81
82 @!******************************************************************************
83
84 @B@<General Notes@>
85
86 @$@<General Information@>@Z@{
87 Checking Procedure
88 ------------------
89 * Spelling check.
90 * WebLint check.
91
92 Shipping Procedure
93 ------------------
94 * Use FunnelWeb to ENEO *.html
95 * Run FunnelWeb. Eliminate all warnings.
96 * Nuke the old web.
97 * Upload the new web.
98 * Briefly surf to check.
99 @}
100
101 FORMATTING NOTE: Experimentation has shown that any page containing a
102 VERBATIM wider than 55 characters must be set to /wide.
103
104 @!******************************************************************************
105
106 @B@<Things To Do@>
107
108 @$@<Things to do@>@Z@{
109 TTDList
110 -------
111
112 @}
113
114 @!******************************************************************************
115
116 @B@<Conversion Of Printed Manual@>
117
118 The FunnelWeb documentation used to be embodied in a single printed manual
119 called The FunnelWeb User's Manual. Here's a record of how the material
120 in the manual ended up in the FunnelWeb documentation webs:
121
122 @$@<Printed Manual Conversion@>@Z@{
123 Printed User Manual Section Where It Ended Up
124 --------------------------- -----------------
125 Preface DELETED
126 Acknowledgements Copyright page of all FunnelWeb webs.
127 Presentation Notes DELETED
128 1. A Tutorial Introduction Tut: Chapters 1..4.
129 2. FunnelWeb Hints. Tut: Chapter 5..6.
130 3. FunnelWeb Definition. Ref: Most of the reference manual.
131 4. FunnelWeb Installation. Mainweb,Dev
132 5. FunnelWeb Administration. DELETED, but 5.2 => Main: stability
133 Glossary Ref: Glossary.
134 References Ref: References.
135
136 Printed Hacker Manual Section Where It Ended Up
137 ----------------------------- -----------------
138 Preface Dev: Home page intro.
139 Acknowledgements Copyright page of all FunnelWeb webs.
140 Presentation Notes DELETED
141 1. FunnelWeb Design Dev: Chapter 2.
142 2. FunnelWeb Implementation Dev: Chapter 3.
143 3. FunnelWeb Modification Dev: Chapter 4.
144 4. FunnelWeb Future Dev: Chapter 5.
145 A. GNU Licence V2 Dev: Chapter 6.
146 References Ref: References.
147 @}
148
149 @!******************************************************************************
150
151 @B@<Graphic Design Notes@>
152
153 These notes record the details of how the graphics in this web were created.
154 This will enable the graphics to be easily recreated, duplicated, or modified
155 if necessary.
156
157 @$@<Graphic Design Notes@>@Z@{
158 Sidebar is 50x1200 colour=(0,51,102).
159
160 Title
161 Bookman Black SSi, 20pt, Antialias
162
163 @}
164
165 @!******************************************************************************
166 @!******************************************************************************
167
168 @B@<Parameter Macros@>
169
170 @$@<Body@>@M@{@-
171 <BODY BACKGROUND="@<Bin@>background.gif"
172 BGCOLOR=@<White@>
173 TEXT="#000000"
174 VLINK="#660000"
175 LINK="#FF0000"
176 ALINK="#CC0000">@}
177
178 @$@<FunnelWeb WWW@>@Z@M@{../@}
179 @$@<FunnelWeb Reference WWW@>@Z@M@{@}
180 @$@<FunnelWeb Tutorial WWW@>@Z@M@{../tutorial/@}
181 @$@<FunnelWeb Developer WWW@>@Z@M@{../developer/@}
182
183 @!******************************************************************************
184
185 @B@<Page Macros@>
186
187 The following macros provide macros to set up the top and bottom of pages.
188
189 @!------------------------------------------------------------------------------
190
191 @$@<SideLink@>@(@2@)@Z@M@{<A HREF="@1"><FONT COLOR="#FFFFFF">@2</FONT></A>@<BR@>@}
192 @$@<SideLink/bold/target@>@(@3@)@M@{@<WindowLink@>@(@1@,@2@,<FONT COLOR="#FFFFFF"><B>@3</B></FONT>@)@<BR@>@}
193 @$@<SideLink/bold@>@(@2@)@M@{<A HREF="@1"><FONT COLOR="#FFFFFF"><B>@2</B></FONT></A>@<BR@>@}
194
195 @$@<Begin FWRefMan margin@>@M@{
196 <TABLE WIDTH="490">
197 <TR>
198 <TD WIDTH="130" VALIGN="top">
199 @<HStrut@>@(130@)@<BR@>
200
201 @<Sidebar menu@>
202
203 </TD>
204 <TD WIDTH="360" VALIGN="top">
205 @<Begin size3@>
206 @}
207
208 @$@<Begin FWRefMan margin/wide@>@M@{
209 <TABLE WIDTH="590">
210 <TR>
211 <TD WIDTH="130" VALIGN="top">
212 @<HStrut@>@(130@)@<BR@>
213
214 @<Sidebar menu@>
215
216 </TD>
217 <TD WIDTH="460" VALIGN="top">
218 @<Begin size3@>
219 @}
220
221 @$@<End FWRefMan margin@>@M@{
222 @<End size3@>
223 </TD>
224 </TR>
225 @<End table@>
226 @}
227
228 The tablecolour macro is needed so that people can read the white text
229 in the sidebar if the user has images turned off. The tablecolour is
230 macro is not applied to the images because Netscape writes their ALT tags
231 in black regardless of the background.
232
233 @$@<Sidebar menu@>@M@{@-
234 @<Begin size2@>
235 @<BR@>
236 @<RossNet linklogo IMAGE@>@<BR@>
237 @<BR@>
238 @<FunnelWeb linklogo IMAGE@>@<BR@>
239 @<BR@>
240 @<Begin tablecolour@>@(#000000@)
241 @<SideLink/bold/target@>@(@<FunnelWeb Tutorial WWW@>index.html@,@<FunnelWeb Tutorial WINDOWNAME@>@,Tutorial@)
242 @<BR@>
243 @<SideLink/bold/target@>@(@<FunnelWeb Developer WWW@>index.html@,@<FunnelWeb Developer WINDOWNAME@>@,Developer@)
244 @<BR@>
245 @<SideLink/bold@>@(@<FunnelWeb Reference WWW@>index.html@,Reference@)
246 @<SideLink@>@(@<Intro FILE@>@,@<Intro HEADING/short@>@)
247 @<SideLink@>@(@<Interface FILE@>@,@<Interface HEADING/short@>@)
248 @<SideLink@>@(@<Scanner FILE@>@,@<Scanner HEADING/short@>@)
249 @<SideLink@>@(@<Parser FILE@>@,@<Parser HEADING/short@>@)
250 @<SideLink@>@(@<Analyser FILE@>@,@<Analyser HEADING/short@>@)
251 @<SideLink@>@(@<Tangle FILE@>@,@<Tangle HEADING/short@>@)
252 @<SideLink@>@(@<Weave FILE@>@,@<Weave HEADING/short@>@)
253 @<SideLink@>@(@<Shell FILE@>@,@<Shell HEADING/short@>@)
254 @<SideLink@>@(@<Commands FILE@>@,@<Commands HEADING/short@>@)
255 @<SideLink@>@(@<Glossary FILE@>@,@<Glossary HEADING/short@>@)
256 @<SideLink@>@(@<References FILE@>@,@<References HEADING/short@>@)
257
258 @<BR@>
259 @<SideLink/bold@>@(@<FunnelWeb_search FILE@>@,SEARCH@)
260 @<End size2@>
261 @<End tablecolour@>
262 @}
263
264 @!------------------------------------------------------------------------------
265
266 @$@<Begin FWRefMan page/H1@>@(@1@)@Z@M@{
267 <HTML>
268 @<Header comment@>
269 <HEAD>
270 <TITLE>@1</TITLE>
271 @<Suppress hyperlink underlining@>
272 </HEAD>
273 @<Body@>
274 @<Begin FWRefMan margin@>
275 @<RunningHeader IMAGE@>
276 @<FWRefMan heading@>@(@1@)
277 @}
278
279 @$@<Begin FWRefMan page/wide/H1@>@(@1@)@Z@M@{
280 <HTML>
281 @<Header comment@>
282 <HEAD>
283 <TITLE>@1</TITLE>
284 @<Suppress hyperlink underlining@>
285 </HEAD>
286 @<Body@>
287 @<Begin FWRefMan margin/wide@>
288 @<RunningHeader IMAGE@>
289 @<FWRefMan heading@>@(@1@)
290 @}
291
292 @!------------------------------------------------------------------------------
293
294 @$@<End FWRefMan page@>@Z@M@{
295 @<P@>
296 @<HR@>
297 @<Begin size2@>
298 @<Link@>@(mailto:@<Ross webmaster EMAIL@>@,Webmaster@)@<_@>@<_@>@<_@>
299 <A HREF="@<Copyright FILE@>">@<Copyright notice/HTML@></A><BR>
300 @<End size2@>
301 @<End FWRefMan margin@>
302
303 @<End NormalSize@>
304 </BODY>
305
306 @<Trailer comment@>
307 </HTML>@}
308
309 @!******************************************************************************
310
311 @B@<Images@>
312
313 @$@<RunningHeader IMAGE@>@M@{
314 <A HREF="@<FunnelWeb Reference WWW@>index.html"><IMG SRC="@<Bin@>title.gif"
315 WIDTH="316" HEIGHT="24"
316 BORDER="0" ALT="FunnelWeb Reference Manual"
317 HSPACE="0" VSPACE="0"></A>@}
318
319 @!******************************************************************************
320
321 @B@<General Macros@>
322
323 @$@<FWRefMan heading@>@(@1@)@M@{@-
324 @<P@>@<Size5@>@(@1@)@<BR@>@}
325
326 @$@<FWRefMan subheading@>@(@1@)@M@{@-
327 @<P@>@<BR@>@<Size4@>@(@<B@>@(@1@)@)@<BR@>@}
328
329 @$@<FWRefMan subsubheading@>@(@1@)@Z@M@{@-
330 @<P@>@<BR@>@<Size3@>@(@<B@>@(@1@)@)@<BR@>@}
331
332 @$@<FWRefMan subsubsubheading@>@(@1@)@Z@M@{@-
333 @<P@>@<BR@>@<Size3@>@(@<U@>@(@1@)@)@<BR@>@}
334
335 @$@<FWRefMan heading/nospace@>@(@1@)@Z@M@{@-
336 @<Size4@>@(@<B@>@(@1@)@)@<BR@>@}
337
338 @$@<FWRefMan heading/center@>@(@1@)@Z@M@{@-
339 @<P@>@<BR@>
340 @<Begin center@>
341 @<Size5@>@(@<B@>@(@1@)@)@<BR@>
342 @<End center@>@}
343
344 @!******************************************************************************
345
346 @$@<FWRefMan keywords and decription@>@{
347 <META NAME="description"
348 CONTENT="The FunnelWeb Reference Manual. FunnelWeb is a portable
349 free literate programming tool.">
350
351 <META NAME="keywords"
352 CONTENT="funnelweb,FunnelWeb,funnel,web,
353 reference manual,reference,manual,
354 literate programming,literate,programming,literate-programming,
355 documentation,
356 macro,macros,preprocessor,macro preprocessor,
357 software,free,freeware,
358 open source,open,source,gnu,gpl,copyleft,
359 web,development,tool,web tool">
360 @}
361
362 @!******************************************************************************
363 @!******************************************************************************
364
365 @A@<HTML Pages@>
366
367 This section contains the HTML pages of the web.
368
369 @!******************************************************************************
370
371 @$@<Index HEADING@>@M@{FunnelWeb Reference Manual@}
372 @$@<Index FILE@>@M@{index.html@}
373 @O@<index.html@>@{@-
374 <HTML>
375
376 <HEAD>
377 @<FWRefMan keywords and decription@>
378 @<Suppress hyperlink underlining@>
379 <TITLE>@<Index HEADING@></TITLE>
380 </HEAD>
381
382 @<Body@>
383
384 @<Begin FWRefMan margin@>
385
386 @<RunningHeader IMAGE@>
387
388 @<FunnelWeb manual version notice@>
389
390 @<P@>@<Bigger@>@(T@)HIS REFERENCE MANUAL provides a concise
391 and precise definition of the functionality of the FunnelWeb
392 literate programming preprocessor. You should refer to this
393 manual when you have specific technical questions about
394 FunnelWeb. The SEARCH facility in the margin provides a
395 quick way to find what you need quickly. If you are not
396 already familiar with FunnelWeb, you may wish to refer to
397 the @<FunnelWeb Tutorial Manual@> which provides a
398 structured introduction to FunnelWeb, along with lots of
399 examples and application-specific information. If you want
400 to compile FunnelWeb, refer to the
401 @<FunnelWeb Developer Manual@>
402
403 @<P@>
404 @<Begin size4@>
405 @<Begin indent@>
406
407 @<HeadStyle@>@(@<Intro FILE@>@,@<Intro HEADING@>@)
408 @<Intro index@>
409
410 @<HeadStyle@>@(@<Interface FILE@>@,@<Interface HEADING@>@)
411 @<Interface index@>
412
413 @<HeadStyle@>@(@<Scanner FILE@>@,@<Scanner HEADING@>@)
414 @<Scanner index@>
415
416 @<HeadStyle@>@(@<Parser FILE@>@,@<Parser HEADING@>@)
417 @<Parser index@>
418
419 @<HeadStyle@>@(@<Analyser FILE@>@,@<Analyser HEADING@>@)
420 @! No index.
421
422 @<HeadStyle@>@(@<Tangle FILE@>@,@<Tangle HEADING@>@)
423 @! No index.
424
425 @<HeadStyle@>@(@<Weave FILE@>@,@<Weave HEADING@>@)
426 @! No index.
427
428 @<HeadStyle@>@(@<Shell FILE@>@,@<Shell HEADING@>@)
429 @<Shell index@>
430
431 @<HeadStyle@>@(@<Commands FILE@>@,@<Commands HEADING@>@)
432 @<Commands index@>
433
434 @<HeadStyle@>@(@<Glossary FILE@>@,@<Glossary HEADING@>@)
435
436 @<HeadStyle@>@(@<References FILE@>@,@<References HEADING@>@)
437
438 @<End indent@>
439 @<End size4@>
440
441 @<End FWRefMan page@>
442 @}
443
444 @$@<HeadStyle@>@(@2@)@M@{@<P@><A HREF="@1"><B>@2</B></A><BR>@}
445
446 @!******************************************************************************
447
448 @$@<Intro HEADING@>@M@{@<SH@>@(1@)Introduction@}
449 @$@<Intro HEADING/short@>@M@{@<SH@>@(1@)Introduction@}
450 @$@<Intro FILE@>@M@{intro.html@}
451 @O@<intro.html@>@{@-
452 @<Begin FWRefMan page/H1@>@(@<Intro HEADING@>@)
453
454 @<P@>
455
456 @<Intro index@>
457
458 @<Nav/first@>@(@<Index FILE@>@,@<Index FILE@>@,@<Interface FILE@>@)
459
460 @<End FWRefMan page@>
461 @}
462
463 @$@<Intro index@>@M@{
464 @<Begin size3@>
465 @<Begin indent/narrow@>
466 <A HREF="@<Intro_notation FILE@>">@<Intro_notation HEADING@></A>@<BR@>
467 <A HREF="@<Intro_terminology FILE@>">@<Intro_terminology HEADING@></A>@<BR@>
468 <A HREF="@<Intro_arch FILE@>">@<Intro_arch HEADING@></A>@<BR@>
469 <A HREF="@<Intro_diagnostics FILE@>">@<Intro_diagnostics HEADING@></A>@<BR@>
470 <A HREF="@<Intro_typesetter FILE@>">@<Intro_typesetter HEADING@></A>@<BR@>
471 @<End indent/narrow@>
472 @<End size3@>
473 @}
474
475 @!==============================================================================
476
477 @$@<Intro_notation HEADING@>@M@{@<SH@>@(1.1@)Notation@}
478 @$@<Intro_notation FILE@>@M@{intro_notation.html@}
479 @O@<intro_notation.html@>@{@-
480 @<Begin FWRefMan page/H1@>@(@<Intro_notation HEADING@>@)
481
482 @<P@>A particular variant of EBNF@<XX@>@(EBNF@,syntax@)
483 (Extended Bachus Naur Form) will be used to
484 describe the FunnelWeb syntax. In this variant, literal strings are
485 delimited by double quotes (@<eg@>@<TT@>@("string"@)), optional constructs by
486 square brackets (@<eg@>@<TT@>@([optional]@)), and constructs repeated zero or
487 more times by braces (@<eg@>@<TT@>@({zeroormore}@)). Constructs to be repeated
488 a fixed number of times are enclosed in braces followed by a decimal
489 number indicating the number of times to be repeated
490 (@<eg@>@<TT@>@({sixtimes}6@)). Constructs to be
491 repeated one or more times are
492 enclosed in braces and followed by a @<TT@>@(+@) (@<eg@>@<TT@>@({oneormore}+@)).
493 The traditional BNF @<DQP@>@(::=@)
494 is replaced by the visually simpler @<DQP@>@(=@). The traditional BNF angle
495 brackets are abandoned.
496
497 @<P@>Although FunnelWeb allows the special character to be changed using the
498 construct @<DQ@>@(@<<@>special@<>@>=@), use of @<DQ@>@(@<<@>special@<>@>@) to refer to
499 FunnelWeb's special character is cumbersome and abstract. To simplify
500 the presentation, the default special character @<DQP@>@(@@@) is used throughout
501 this chapter to represent the special character.
502
503 @<Nav/first@>@(@<Intro FILE@>@,@<Intro FILE@>@,@<Intro_terminology FILE@>@)
504
505 @<End FWRefMan page@>
506 @}
507
508 @!==============================================================================
509
510 @$@<Intro_terminology HEADING@>@M@{@<SH@>@(1.2@)Terminology@}
511 @$@<Intro_terminology FILE@>@M@{intro_terminology.html@}
512 @O@<intro_terminology.html@>@{@-
513 @<Begin FWRefMan page/H1@>@(@<Intro_terminology HEADING@>@)
514
515 @<P@>A specific terminology has arisen for dealing with FunnelWeb. Some
516 particularly useful examples are:
517
518 @<NarrowThing@>@(Journal file:@,An output file containing
519 a copy of the output sent to
520 the user's console during an invocation of FunnelWeb. In other systems,
521 this file is sometimes called a @<DQ@>@(log file@).@)
522
523 @<NarrowThing@>@(Product file:@,An output file, generated by the Tangle
524 component of
525 FunnelWeb, that contains the expansion of the macros in the input
526 file. (Other names considered for this were:
527 generated file, expanded file, result file, program file, and tangle file.)@)
528
529 @<P@>A complete list of all the special FunnelWeb terminology appears in the
530 @<glossary@>. Be sure to refer to it if any of the terms used are unclear.
531
532 @<Nav@>@(@<Intro_notation FILE@>@,@<Intro FILE@>@,@<Intro_arch FILE@>@)
533
534 @<End FWRefMan page@>
535 @}
536
537 @!==============================================================================
538
539 @$@<Intro_arch HEADING@>@M@{@<SH@>@(1.3@)An Architectural Overview@}
540 @$@<Intro_arch FILE@>@M@{intro_arch.html@}
541 @O@<intro_arch.html@>@{@-
542 @<Begin FWRefMan page/H1@>@(@<Intro_arch HEADING@>@)
543
544 @<P@>An understanding of the internals of FunnelWeb assists
545 with understanding its operation. During a single run,
546 FunnelWeb reads and processes a single input file called the
547 @<NewTerm@>@(input file@) (also called the
548 @<NewTerm@>@(FunnelWeb file@)). The file is processed by
549 passing it through a series of stages called
550 @<NewTerm@>@(phases@). The result is that some
551 @<NewTerm@>@(output files@) are generated. A
552 @<NewTerm@>@(journal file@) is generated containing a copy
553 of the messages that appear on the console during the
554 FunnelWeb run. A @<NewTerm@>@(listing file@) is created
555 containing a summary of the run, including any error
556 messages. A @<NewTerm@>@(documentation@) file is generated
557 containing typesetter commands that when fed into a
558 typesetter program will result in printed documentation.
559 Finally, one or more @<NewTerm@>@(product files@) are
560 generated containing the result of unscrambling the macro
561 definitions of the input file.
562
563 @<P@>
564 @<Begin verbatim@>
565
566 .fw Input File
567 (FunnelWeb file)
568 V
569 +---------+ \
570 | Scanner | |
571 +---------+ |
572 V |
573 +--------+ |
574 | Parser | |
575 +--------+ |
576 V |
577 +----------+ >----+--------+
578 | Analyser | | | |
579 +----------+ | | |
580 V | | |
581 +-------+-------+ | V V
582 V V | | |
583 +--------+ +-------+ | | |
584 | Tangle | | Weave | | | |
585 +--------+ +-------+ / | |
586 | | | |
587 V V V V
588 Product Documentation Listing Journal
589 Files File File File
590 @<End verbatim@>
591 @<CaptionTitle@>@(FunnelWeb's processing phases@)
592
593 @<P@>These files need not all be generated on any particular FunnelWeb run.
594 Whether each output file appears, is controlled by command line options.
595
596 @<P@>FunnelWeb processes each input file in a sequence of phases.
597 If an error occurs during a phase, no subsequent phases are executed.
598
599 @<P@>The phases are briefly described below.
600
601 @<NarrowThing@>@(The
602 Scanner@,reads@<X@>@(scanner@) the input file,
603 expands and reads in include files, scans the
604 input stream, processes pragmas and typesetter
605 directives, and parses all the FunnelWeb special
606 sequences. The result is a list of tokens that is
607 handed to the parser.@)
608
609 @<NarrowThing@>@(The Parser@,reads@<X@>@(parser@)
610 the scanner's token list and parses it, constructing a
611 document list@<XX@>@(document@,list@) and a macro
612 table.@<XX@>@(macro@,table@) which are passed to later phases.@)
613
614 @<NarrowThing@>@(The Analyser@,examines@<X@>@(analyser@)
615 the macro table generated by the parser
616 and performs a number of checks of the macro structures
617 that the parser could not make on its single pass.
618 For example, the
619 analyser detects and flags unused macros and recursive macros. The
620 analyser forms the final stage of FunnelWeb's front-end processing.@)
621
622 @<NarrowThing@>@(Tangle@,expands certain macros in the macro table
623 to generate@<X@>@(tangle@) one or more product files.@)
624
625 @<NarrowThing@>@(Weave@,uses the document list to generate@<X@>@(weave@)
626 a documentation file.@)
627
628 @<P@>A single run through these phases constitutes a single invocation of
629 @<NewTerm@>@(FunnelWeb proper@). Most invocations of the
630 @<NewTerm@>@(FunnelWeb program@)
631 will consist only of a single execution of FunnelWeb proper. However,
632 FunnelWeb also provides a command shell that provides many useful commands,
633 including a command to invoke FunnelWeb proper. Discussion of the command
634 shell is deferred until later.
635
636 @<Nav@>@(@<Intro_terminology FILE@>@,@<Intro FILE@>@,@<Intro_diagnostics FILE@>@)
637
638 @<End FWRefMan page@>
639 @}
640
641 @!==============================================================================
642
643 @$@<Intro_diagnostics HEADING@>@M@{@<SH@>@(1.4@)Diagnostics@}
644 @$@<Intro_diagnostics FILE@>@M@{intro_diagnostics.html@}
645 @O@<intro_diagnostics.html@>@{@-
646 @<Begin FWRefMan page/H1@>@(@<Intro_diagnostics HEADING@>@)
647
648 @<P@>During execution, FunnelWeb proceeds cautiously with
649 each of its phases, only proceeding with the next phase if
650 the previous phase has been successful. This means that,
651 when debugging a FunnelWeb file, you may find that the
652 number of errors @<I@>@(increases@) after you fix some of
653 them, as you will be exposing yourself to the next FunnelWeb
654 phase.
655
656 @<P@>FunnelWeb employs five levels of
657 diagnostics@<XX@>@(diagnostics@,levels of@) at different
658 levels of severity.@<X@>@(severity@) Severity is defined in
659 terms of the level of activity at which the diagnostic
660 causes FunnelWeb to abort.
661
662 @<NarrowThing@>@(Warning:@,A
663 warning@<XX@>@(warning@,severity@) does not cause FunnelWeb
664 to terminate or curtail its operation in any way, but serves
665 merely to warn the user of particular conditions that might
666 be symptomatic of deeper problems.@)
667
668 @<NarrowThing@>@(Error:@,An@<XX@>@(error@,severity@) error
669 causes FunnelWeb to terminate processing of the current
670 input file at the end of the current phase. For example, if
671 an error occurs during scanning, FunnelWeb will continue
672 scanning (and possibly generate further scanning
673 diagnostics), but will not invoke the parser.@)
674
675 @<NarrowThing@>@(Severe Error:@,A@<XX@>@(severe@,severity@)
676 severe error (or @<DQ@>@(severe@) for short) is the same as
677 an error except that FunnelWeb terminates the current phase
678 immediately.@)
679
680 @<NarrowThing@>@(Fatal Error:@,A@<XX@>@(fatal@,severity@)
681 fatal error causes FunnelWeb not only to terminate the
682 current phase and run immediately, but also to terminate
683 total FunnelWeb processing immediately. A severe error will
684 not cause a FunnelWeb script to terminate, but a fatal error
685 will. A fatal error causes FunnelWeb to return control to
686 the operating system.@)
687
688 @<NarrowThing@>@(Assertion
689 Error:@,An@<XX@>@(assertion@,severity@) assertion error
690 occurs if FunnelWeb detects an internal inconsistency, in
691 which case FunnelWeb terminates immediately and
692 ungracefully. Such an error can occur only if there are
693 bugs in FunnelWeb. With luck, such errors will be extremely
694 rare.@)
695
696 @<P@>FunnelWeb indicates the level of severity of each
697 diagnostic that it issues by starting each diagnostic either
698 with the full name of the severity level or with just the
699 first letter of the severity level followed by a colon.
700
701 @<P@>FunnelWeb conveys the presence or absence of
702 diagnostics at the operating system level by returning
703 @<TT@>@(EXIT_SUCCESS@)@<XX@>@(return@,status@) status if no
704 diagnostics occurred during the run and
705 @<TT@>@(EXIT_FAILURE@) status if one or more diagnostics
706 (including warnings) occurred during the run. (From
707 the symbols of the ANSI standard C library
708 @<TT@>@(stdlib.h@). See @<Paper@>@(Kernighan88@), p.252.)
709
710 @<Nav@>@(@<Intro_arch FILE@>@,@<Intro FILE@>@,@<Intro_typesetter FILE@>@)
711
712 @<End FWRefMan page@>
713 @}
714
715 @!==============================================================================
716
717 @$@<Intro_typesetter HEADING@>@M@{@<SH@>@(1.5@)Typesetter Independence@}
718 @$@<Intro_typesetter FILE@>@M@{intro_typesetter.html@}
719 @O@<intro_typesetter.html@>@{@-
720 @<Begin FWRefMan page/H1@>@(@<Intro_typesetter HEADING@>@)
721
722 @<P@>One of the design goals of FunnelWeb was to provide a
723 @<I@>@(target-language independent@) literate programming
724 system. This goal has been achieved simply by treating the
725 text written to the product file as homogeneous and
726 typesetting it in @<TT@>@(tt font@). A secondary goal was to
727 provide a @<I@>@(typesetter independent@) literate
728 programming system. By this is meant that it be possible to
729 create FunnelWeb input files that do not contain
730 typesetter-specific commands. To a lesser extent this goal
731 has also been achieved.
732
733 @<P@>The difficulty with providing typesetter-independent
734 typesetting is that each desired typesetting feature must be
735 recreated in a typesetter-independent FunnelWeb typesetting
736 construct that FunnelWeb can translate into whatever
737 typesetting language is being targeted by Weave. Taken to
738 the extreme, this would result in FunnelWeb providing the
739 full syntactic and semantic power of TeX, but with a more
740 generic, FunnelWeb-specific syntax. This was unfeasible in
741 the time available, and undesirable as well.
742
743 @<P@>The compromise struck in the FunnelWeb design is to
744 provide a set of primitive typesetter-independent
745 typesetting features that are implemented by FunnelWeb.
746 These are the @<NewTerm@>@(typesetter directives@). If the
747 user is prepared to restrict to these directives, then the
748 user's FunnelWeb document will be both target-language and
749 typesetter independent. However, if the user wishes to use
750 the more sophisticated features of the target typesetting
751 system, the user can specify the typesetter in a
752 @<DQP@>@(typesetter@) pragma and then place typesetter
753 commands in the free text of the FunnelWeb document where
754 they will be passed verbatim to the documentation file. The
755 choice of the trade-off between typesetter independence and
756 typesetting power is left to the user.
757
758 @<P@>This said, experience with FunnelWeb, over more than a
759 decade, indicates that the typesetting facilities provided by
760 FunnelWeb are sufficient for most documentation.
761
762 @<Nav/last@>@(@<Intro_diagnostics FILE@>@,@<Intro FILE@>@,@<Intro FILE@>@)
763
764 @<End FWRefMan page@>
765 @}
766
767 @!******************************************************************************
768
769 @$@<Interface HEADING@>@M@{@<SH@>@(2@)Command Line Interface@}
770 @$@<Interface HEADING/short@>@M@{@<SH@>@(2@)Interface@}
771 @$@<Interface FILE@>@M@{interface.html@}
772 @O@<interface.html@>@{@-
773 @<Begin FWRefMan page/H1@>@(@<Interface HEADING@>@)
774
775 @<P@>
776
777 @<Interface index@>
778
779 @<Nav@>@(@<Intro FILE@>@,@<Index FILE@>@,@<Scanner FILE@>@)
780
781 @<End FWRefMan page@>
782 @}
783
784 @$@<Interface index@>@M@{
785 @<Begin size3@>
786 @<Begin indent/narrow@>
787 <A HREF="@<Interface_invoking FILE@>">@<Interface_invoking HEADING@></A>@<BR@>
788 <A HREF="@<Interface_arguments FILE@>">@<Interface_arguments HEADING@></A>@<BR@>
789 <A HREF="@<Interface_options FILE@>">@<Interface_options HEADING@></A>@<BR@>
790 <A HREF="@<Interface_inheritance FILE@>">@<Interface_inheritance HEADING@></A>@<BR@>
791 <A HREF="@<Interface_startup FILE@>">@<Interface_startup HEADING@></A>@<BR@>
792 @<End indent/narrow@>
793 @<End size3@>
794 @}
795
796 @!==============================================================================
797
798 @$@<Interface_invoking HEADING@>@M@{@<SH@>@(2.1@)Invoking FunnelWeb@}
799 @$@<Interface_invoking FILE@>@M@{interface_invoking.html@}
800 @O@<interface_invoking.html@>@{@-
801 @<Begin FWRefMan page/H1@>@(@<Interface_invoking HEADING@>@)
802 @<XX@>@(FunnelWeb@,invoking@)@<XX@>@(FunnelWeb@,running@)
803
804 @<P@>When a user invokes FunnelWeb at the operating system
805 command level, the user must provide a command line
806 instructing FunnelWeb what to do. Typically an operating
807 system command line consists of a @<I@>@(verb@) indicating
808 that a particular program should be run, followed by a list
809 of options. For example:
810
811 @<P@>
812 @<Begin verbatim@>
813 rename file1 file2
814 @<End verbatim@>
815
816 @<P@>In this case, the verb is @<TT@>@(rename@) and the
817 command line options are @<TT@>@(file1 file2@).
818
819 @<P@>Operating systems differ greatly in the depth with
820 which they process their command@<XX@>@(command
821 line@,processing@) lines, ranging from systems that simply
822 pass the entire command line string to the invoked program
823 (@<eg@>MSDOS) through to systems that perform complete
824 command line parsing (@<eg@>OpenVMS). Syntax conventions vary
825 considerably.
826
827 @<P@>So as to achieve maximum portability and consistency of
828 invocation across different platforms, FunnelWeb reads its
829 command line as a raw string and performs all its own
830 parsing.@<XX@>@(command line@,parsing@) This is portable
831 because, at the very least, all operating systems allow
832 invoked programs access to the raw command line.
833
834 @<P@>The command verb used to invoke FunnelWeb should be
835 @<DQP@>@(fw@).@<XX@>@(fw@,command verb@)
836
837 @<P@>
838 @<Begin verbatim@>
839 FunnelWeb_verb = "fw"
840 @<End verbatim@>
841
842 @<P@>If this verb is not available, some alternatives are
843 @<DQP@>@(funweb@), @<DQP@>@(fun@), and @<DQP@>@(funnelweb@).
844 The verbs @<TT@>@(web@) or @<TT@>@(fweb@) should be avoided
845 as they are the names of other literate programming tools.
846
847 @<Nav/first@>@(@<Interface FILE@>@,@<Interface FILE@>@,@<Interface_arguments FILE@>@)
848
849 @<End FWRefMan page@>
850 @}
851
852 @!==============================================================================
853
854 @$@<Interface_arguments HEADING@>@M@{@<SH@>@(2.2@)Command Line Arguments@}
855 @$@<Interface_arguments FILE@>@M@{interface_arguments.html@}
856 @O@<interface_arguments.html@>@{@-
857 @<Begin FWRefMan page/H1@>@(@<Interface_arguments HEADING@>@)
858 @<XX@>@(command line@,argument@)@<XX@>@(syntax@,command line@)
859
860 @<P@>Following the verb is the body of the command line
861 which FunnelWeb parses into zero or more
862 @<NewTerm@>@(arguments@) separated by runs of one or more
863 blanks.
864
865 @<P@>
866 @<Begin verbatim@>
867 FunnelWeb_command_line =
868 FunnelWeb_verb { {" "}+ argument }
869 @<End verbatim@>
870
871 @<P@>Because some operating systems convert their command
872 line to upper case before handing it to the invoked program,
873 FunnelWeb has been constructed so as to be
874 @<I@>@(insensitive@) to the case of its command line
875 arguments.@<XX@>@(case@,dependence@) However, when dealing
876 internally with arguments, FunnelWeb @<I@>@(preserves@) the
877 case of its command line arguments so that it will be able
878 to operate with operating systems (such as
879 Unix@<X@>@(Unix@)) whose file names are case dependent.
880
881 @<P@>A valid FunnelWeb argument consists of a
882 @<NewTerm@>@(sign@), an identifying @<NewTerm@>@(letter@),
883 and an optional @<NewTerm@>@(string@) with no spaces
884 separating them.@<XX@>@(command line
885 options@,syntax@)@<XX@>@(options@,syntax@)
886
887 @<P@>
888 @<Begin verbatim@>
889 argument = sign id_letter [non_blank_string]
890 sign = "+" | "-" | "="
891 id_letter = "B" | "C" | "D" | "F" | "H" | "I" |
892 "J" | "K" | "L" | "O" | "Q" | "S" |
893 "T" | "W" | "X"
894 @<End verbatim@>
895
896 @<P@>In addition there is a special form of argument that
897 does not begin with a sign.
898
899 @<P@>
900 @<Begin verbatim@>
901 argument = non_blank_string_not_starting_with_+_=_or_-
902 @<End verbatim@>
903
904 @<P@>This form is exactly equivalent to the same string with
905 @<DQP@>@(+F@) prepended to it.
906
907 @<P@>The semantic effect of these arguments is defined in
908 terms of @<NewTerm@>@(options@) which are the internal
909 parameters of FunnelWeb and which correspond closely with
910 the set of legal command line arguments. FunnelWeb has a
911 predefined set of options each identified by an identifying
912 letter having two attributes: a @<I@>@(string@), and a
913 @<I@>@(boolean@). The boolean determines whether an option
914 is turned @<I@>@(on@) or @<I@>@(off@). The string contains
915 additional information depending on the option.
916
917 @<P@>When FunnelWeb starts up, its options have predefined
918 default values. FunnelWeb then parses its command line
919 sequentially from left to right executing the effect of each
920 argument on the argument's corresponding option. The sign
921 and the string components of the argument are processed
922 @<I@>@(independently@). A sign of @<TT@>@(+@) turns the
923 option on. A sign of @<TT@>@(-@) turns the option off. A
924 sign of @<TT@>@(=@) leaves the option's boolean attribute
925 unchanged. The argument string replaces the string of the
926 corresponding option, unless the argument string is empty,
927 in which case the option string is not changed.
928
929 @<P@>Because FunnelWeb processes its command line arguments
930 from left to right, a later argument can cancel the effect
931 of an earlier one. For example @<TT@>@(fw +t -t@) will
932 result in the @<TT@>@(t@) option ending up @<I@>@(off@).
933 This allows users to set up their own default arguments by
934 defining a symbol in their operating system's command
935 language. For example, a Unix user who wants FunnelWeb to
936 delete all identical output files and create a documentation
937 file on each run with a default @<TT@>@(.typ@) extension
938 could simply place the following definition in their
939 @<DQP@>@(.login@) file.
940
941 @<P@>
942 @<Begin verbatim@>
943 alias fw fw +d +t.typ
944 @<End verbatim@>
945
946 @<P@>These default options can then later be easily
947 overridden on the command line.
948
949 @<Nav@>@(@<Interface_invoking FILE@>@,@<Interface FILE@>@,@<Interface_options FILE@>@)
950
951 @<End FWRefMan page@>
952 @}
953
954 @!==============================================================================
955
956 @$@<Interface_options HEADING@>@M@{@<SH@>@(2.3@)Options@}
957 @$@<Interface_options FILE@>@M@{interface_options.html@}
958 @O@<interface_options.html@>@{@-
959 @<Begin FWRefMan page/H1@>@(@<Interface_options HEADING@>@)
960 @<X@>@(options@)@<XX@>@(list@,options@)
961
962 @<P@>FunnelWeb's options are internal parameters which can
963 be modified by corresponding arguments on FunnelWeb's
964 command line. A description of each argument and option
965 follows.
966
967 @<NarrowThing@>@(B1@<LDots@>B6:
968 Tracedumps:@,These@<XX@>@(B@,option@)
969 six@<XX@>@(tracedump@,options@)@<XX@>@(dump@,option@)
970 options have been provided to assist in the debugging and
971 testing of FunnelWeb. They determine which of six possible
972 trace dumps are to be written to the listing file. Only the
973 boolean attributes of these options are ever used. The six
974 dumps are identified by the digits @<TT@>@(1..6@) as
975 follows:@<XX@>@(dump@,mapped file@) @<XX@>@(dump@,global
976 line list@)@<XX@>@(dump@,token list@) @<XX@>@(dump@,macro
977 table@)@<XX@>@(dump@,document list@)@<XX@>@(dump@,times@)@)
978
979 @<P@>
980 @<Begin list/ordered@>
981 @<Item@>Dump a hexdump of each mapped input and include file.
982 @<Item@>Dump the global line list created by the scanner.
983 @<Item@>Dump the token list created by the scanner.
984 @<Item@>Dump the macro table created by the parser.
985 @<Item@>Dump the document list created by the parser.
986 @<Item@>Dump a table summarizing CPU and real time usage.
987 @<End list/ordered@>
988
989 @<P@>Because these options are so closely related, a hack
990 has been pulled to enable them to all to be controlled by
991 the @<TT@>@(B@) argument. The string argument to the
992 @<TT@>@(B@) argument determines which of the six options are
993 to be affected by the sign. Examples: @<TT@>@(+B134@) turns
994 on options @<TT@>@(B1@), @<TT@>@(B3@), and @<TT@>@(B4@).
995 @<TT@>@(-B1@) turns off option @<TT@>@(B1@).
996 @<TT@>@(Default:@<_@>-B123456@).
997
998 @<NarrowThing@>@(B7: Determinism:@,If the @<TT@>@(B7@)
999 option is turned on, FunnelWeb suppresses the output of
1000 anything non-deterministic,@<X@>@(non-determinism@) or
1001 machine dependent. This assists in regression testing. Only
1002 the boolean attribute is used in this option. This option is
1003 controlled by the @<TT@>@(B7@) argument which falls under
1004 the same argument syntax as the other @<TT@>@(B@) options.
1005 Examples: @<TT@>@(+B7@), @<TT@>@(-B7@).
1006 @<TT@>@(Default:@<_@>-B7@).@)
1007
1008 @<NarrowThing@>@(C: Listing File
1009 Context:@,The@<XX@>@(C@,option@) @<TT@>@(C@)@<XX@>@(listing
1010 file@,context@) option is always turned on and cannot be
1011 turned off. Its only attribute is a number which determines
1012 the number of lines of context that the lister will place
1013 around lines flagged with diagnostics in the listing file
1014 (if a listing file is written). A value of 100 indicates
1015 infinite context@<XX@>@(infinite@,context@) which means that
1016 the entire listing file will be written out if a single
1017 diagnostic occurs. The value of this number can be specified
1018 by specifying it as a string of decimal digits to the
1019 @<TT@>@(+C@) argument. Examples: @<TT@>@(+C100@),
1020 @<TT@>@(+C10@). @<TT@>@(Default:@<_@>+C2@).@)
1021
1022 @<NarrowThing@>@(D: Delete Identical Output Files:@,Only the
1023 boolean attribute of this option is
1024 used.@<XX@>@(D@,option@)@<XX@>@(delete output@,option@) When
1025 turned on, the option causes the suppression (deletion) of
1026 product files and documentation files (but not listing or
1027 journal files) that are identical to the currently existing
1028 files of the same name. For example, if FunnelWeb is
1029 instructed to generate @<TT@>@(stack.h@) as an product file,
1030 and the text to be written to @<TT@>@(stack.h@) is identical
1031 to the currently existing @<TT@>@(stack.h@), then FunnelWeb
1032 will simply not write any product file, leaving the
1033 currently existing @<TT@>@(stack.h@) as it is (and in
1034 particular leaving the file's date attribute the same). This
1035 prevents unnecessary @<TT@>@(make@) propagations. For
1036 example, in a C program, if @<TT@>@(stack.fw@) is a
1037 FunnelWeb input file that generates @<TT@>@(stack.h@) and
1038 @<TT@>@(stack.c@), a modification to @<TT@>@(stack.fw@) that
1039 affects @<TT@>@(stack.c@) but does not affect
1040 @<TT@>@(stack.h@) will not provoke the recompilation of
1041 modules that @<TT@>@(#include stack.h@), so long as the
1042 intervening FunnelWeb run has @<TT@>@(+D@) set. Examples:
1043 @<TT@>@(-D@), @<TT@>@(+D@). @<TT@>@(Default:@<_@>-D@).@)
1044
1045 @<NarrowThing@>@(F: FunnelWeb Input
1046 File:@,If@<XX@>@(F@,option@) this option is turned on,
1047 FunnelWeb@<XX@>@(input file@,option@) processes the input
1048 file whose name is specified by the option string. Examples:
1049 @<TT@>@(+Fsloth.fw@), @<TT@>@(+Fwalrus@), @<TT@>@(-F@).
1050 @<TT@>@(Default:@<_@>-F@).@)
1051
1052 @<NarrowThing@>@(H: Display Help
1053 Message:@,If@<XX@>@(H@,option@) this
1054 option@<XX@>@(help@,option@) is turned on, FunnelWeb
1055 displays the message specified by the argument string. Each
1056 message has a name. The main help message is called
1057 @<DQP@>@(menu@) and contains a list of the other help
1058 messages. Examples: @<TT@>@(+Hregistration@),
1059 @<TT@>@(+Hoptions@). @<TT@>@(Default:@<_@>-Hmenu@).@)
1060
1061 @<NarrowThing@>@(I: Include default file
1062 specification:@,This@<XX@>@(I@,option@)
1063 option@<XX@>@(include file@,option@)@<XX@>@(include@,file@)
1064 is always turned on and cannot be turned off. Its string
1065 attribute is used as the default file specification for
1066 include files. Usually this option is used to specify a
1067 directory from which include files should be obtained.
1068 Examples: @<TT@>@(=I/usr/dave/includes/@).
1069 @<TT@>@(Default:@<_@>+I@).@)
1070
1071 @<NarrowThing@>@(J: Journal File:@,If@<XX@>@(J@,option@)
1072 this option is turned on, FunnelWeb generates
1073 a@<XX@>@(journal file@,option@)@<XX@>@(journal@,file@)
1074 journal file. A journal file contains a log of all the
1075 console input and output to FunnelWeb during a single
1076 invocation of the FunnelWeb program (Note: The @<TT@>@(Q@)
1077 option does not affect this.). The journal file is
1078 particularly useful for examining what happened during a
1079 FunnelWeb shell run. The string attribute is the name of the
1080 journal file. Examples: @<TT@>@(+Jjournfile@), @<TT@>@(-J@).
1081 @<TT@>@(Default:@<_@>-J@).@)
1082
1083 @<NarrowThing@>@(K: Keyboard:@,If@<XX@>@(K@,option@) this
1084 option@<XX@>@(keyboard@,option@)@<XX@>@(interactive@,option@)
1085 is turned on, FunnelWeb enters an interactive mode in which
1086 the user can enter FunnelWeb shell commands interactively.
1087 The string attribute is unused. Examples: @<TT@>@(+K@),
1088 @<TT@>@(-K@). @<TT@>@(Default:@<_@>-K@).@)
1089
1090 @<NarrowThing@>@(L: Listing File:@,If@<XX@>@(L@,option@)
1091 this option is turned on, FunnelWeb generates
1092 a@<XX@>@(listing file@,option@)@<XX@>@(listing@,file@)
1093 listing file containing a summary of a run on FunnelWeb
1094 proper. The string argument is the name of the listing file
1095 to be created. Examples: @<TT@>@(+L@), @<TT@>@(-L@),
1096 @<TT@>@(+Llisting.lis@). @<TT@>@(Default:@<_@>-L@).@)
1097
1098 @<NarrowThing@>@(O: Product Files:@,If this option is turned
1099 on, FunnelWeb generates a product file for each macro in the
1100 input file that is bound to an output file. The string
1101 attribute contributes to the name of the product files. This
1102 option is controlled by the @<TT@>@(O@) argument because
1103 product files used to be called @<DQ@>@(@<B@>@(O@)utput
1104 files@)). Examples: @<TT@>@(-O@),
1105 @<TT@>@(+O/usr/dave/product/@). @<TT@>@(Default:@<_@>+O@).@)
1106
1107 @<NarrowThing@>@(Q: Quiet:@,If@<XX@>@(Q@,option@) this
1108 option is turned on, FunnelWeb suppresses
1109 all@<XX@>@(quiet@,option@)@<XX@>@(suppress@,console output@)
1110 output to the screen (standard output) unless one or more
1111 errors occur, in which case a single line summarizing the
1112 errors is sent to standard output at the end of the run. If
1113 this option is turned off, FunnelWeb writes to the console
1114 in its normal garrulous way. The string attribute is unused
1115 in this option. Examples: @<TT@>@(-Q@), @<TT@>@(+Q@).
1116 @<TT@>@(Default:@<_@>-Q@).@)
1117
1118 @<NarrowThing@>@(S: Screen:@,If@<XX@>@(S@,option@) this
1119 option is turned on, FunnelWeb writes
1120 all@<XX@>@(screen@,option@) diagnostics to the screen
1121 (standard output) as well as to the listing file. By
1122 default, they are sent only to the listing file. This option
1123 has a single numerical attribute that can be specified as a
1124 decimal string in the string component of the @<TT@>@(S@)
1125 argument. The number is the number of lines of context that
1126 should surround each diagnostic sent to the
1127 screen.@<X@>@(context@) Examples: @<TT@>@(-S@),
1128 @<TT@>@(+S6@), @<TT@>@(+S0@). @<TT@>@(Default:@<_@>-S@).@)
1129
1130 @<NarrowThing@>@(T: TeX Documentation
1131 file:@,If@<XX@>@(T@,option@) this option is turned on,
1132 FunnelWeb@<XX@>@(typeset@,option@)@<XX@>@(typeset@,file@)
1133 generates a documentation file in TeX format. The string
1134 argument contributes to the name of the documentation file
1135 to be created. By default this option is turned off, as
1136 experience has shown that most FunnelWeb runs are made
1137 during program development; documentation runs occur far
1138 more rarely. This option is controlled by the @<TT@>@(T@)
1139 command line argument because documentation files used to be
1140 called typesetter files. Examples: @<TT@>@(-T@),
1141 @<TT@>@(+Tsloth.tex@). @<TT@>@(Default:@<_@>-T@).@)
1142
1143 @<NarrowThing@>@(U: HTML Documentation
1144 file:@,If@<XX@>@(U@,option@) this option is turned on,
1145 FunnelWeb@<XX@>@(typeset@,option@)@<XX@>@(typeset@,file@)
1146 generates a documentation file in HTML format. The string
1147 argument contributes to the name of the documentation file
1148 to be created. By default this option is turned off, as
1149 experience has shown that most FunnelWeb runs are made
1150 during program development; documentation runs occur far
1151 more rarely. @<TT@>@(U@) was chosen for this feature
1152 because it follows @<TT@>@(T@), and @<TT@>@(H@) and
1153 @<TT@>@(W@) were already allocated to other functions.
1154 Examples: @<TT@>@(-U@),
1155 @<TT@>@(+Usloth.html@). @<TT@>@(Default:@<_@>-U@).@)
1156
1157 @<NarrowThing@>@(W: Width of Product
1158 Files:@,If@<XX@>@(W@,option@) this
1159 option@<XX@>@(width@,option@)@<XX@>@(product file@,width@)
1160 is turned on, a limit is placed on the length of lines in
1161 product files generated during the run. Lines that breach
1162 the limit are flagged with error messages. This option has a
1163 single numerical attribute that can be specified as a
1164 decimal string in the string component of the @<TT@>@(W@)
1165 argument. The number is the specified maximum width. This
1166 option is one of two limits that are placed on the width of
1167 product files. The other limit is an attribute of the input
1168 file that defaults to 80 characters, but can be raised or
1169 lowered using an output line length pragma. The width that
1170 is enforced is the lower of this value and the value of the
1171 @<TT@>@(W@) option (if turned on). Examples: @<TT@>@(-W@),
1172 @<TT@>@(+W100@). @<TT@>@(Default:@<_@>-W80@).@)
1173
1174 @<NarrowThing@>@(X: Execute:@,If@<XX@>@(X@,option@) this
1175 option@<XX@>@(execute script@,option@) is turned on,
1176 FunnelWeb executes the FunnelWeb shell script file specified
1177 by the string attribute. Examples: @<TT@>@(+Xmaster@),
1178 @<TT@>@(-X@). @<TT@>@(Default:@<_@>-X@).@)
1179
1180 @<Nav@>@(@<Interface_arguments FILE@>@,@<Interface FILE@>@,@<Interface_inheritance FILE@>@)
1181
1182 @<End FWRefMan page@>
1183 @}
1184
1185 @!==============================================================================
1186
1187 @$@<Interface_inheritance HEADING@>@M@{@<SH@>@(2.4@)File Name Inheritance@}
1188 @$@<Interface_inheritance FILE@>@M@{interface_inheritance.html@}
1189 @O@<interface_inheritance.html@>@{@-
1190 @<Begin FWRefMan page/H1@>@(@<Interface_inheritance HEADING@>@)
1191 @<XX@>@(filename@,inheritance@)
1192
1193 @<P@>During a single run of FunnelWeb, FunnelWeb can produce
1194 many different output files. As it would be very tedious to
1195 have to specify the name of each of these files explicitly
1196 each time FunnelWeb is run, FunnelWeb provides a system of
1197 defaults that allows the user to specify the minimum
1198 required to successfully complete the run. To do this,
1199 FunnelWeb allows file specifications to inherit fields from
1200 one another.
1201
1202 @<P@>FunnelWeb structures filenames into three
1203 fields@<XX@>@(filename@,fields@) which are inherited
1204 independently. The fields are: @<NewTerm@>@(directory@),
1205 @<NewTerm@>@(name@), and @<NewTerm@>@(extension@). On
1206 systems having other fields (@<eg@>@<I@>@(network node@),
1207 @<I@>@(device name@)), the extra fields are considered to be
1208 part of the directory field. Version numbers are ignored. A
1209 field can inherit a value if its current value is the empty
1210 string.
1211
1212 @<P@>The following table gives the full inheritance scheme
1213 used in FunnelWeb.
1214
1215 @<P@>
1216 @<Begin table/border@>
1217 @<Row8@>@(@<B@>@(Script@) @, @<B@>@(Input@) @, @<B@>@(Include@)@, @<B@>@(Journal@)@, @<B@>@(List@) @, @<B@>@(TeX@) @, @<B@>@(HTML@) @, @<B@>@(Prod@) @)
1218 @<Row8@>@(@<_@> @, @<_@> @, @<TT@>@(@@i@) @, @<_@> @, @<_@> @, @<_@> @, @<_@> @, @<TT@>@(@@o@) @)
1219 @<Row8@>@(@<TT@>@(+x@) @, @<TT@>@(+f@) @, @<TT@>@(+i@) @, @<TT@>@(+j@) @, @<TT@>@(+l@) @, @<TT@>@(+t@) @, @<TT@>@(+u@) @, @<TT@>@(+o@) @)
1220 @<Row8@>@(@<DQP@>@(.fws@) @, @<DQP@>@(.fw@) @, @<DQP@>@(.fwi@) @, @<DQP@>@(.jrn@) @, @<DQP@>@(.lis@) @, @<DQP@>@(.tex@) @, @<DQP@>@(.html@) @, @<_@> @)
1221 @<Row8@>@(@<_@> @, @<_@> @, @<TT@>@(+f@) @, @<TT@>@(+f@) @, @<TT@>@(+f@) @, @<TT@>@(+f@) @, @<TT@>@(+f@) @, @<_@> @)
1222 @<Row8@>@(DefDir @, Defdir @, Defdir @, Defdir @, Defdir @, Defdir @, Defdir @, Defdir @)
1223 @<End table@>
1224
1225 @<P@>The table is arranged with items of highest priority at
1226 the top. The @<DQP@>@(+<letter>@) cells refer to the file
1227 specification supplied in the given command line argument.
1228 @<DQP@>@(+F@) is the name of the input file.
1229 @<DQ@>@(Defdir@) refers to the default directory
1230 specification provided by the operating system. Empty cells
1231 do not contribute.
1232
1233 @<P@>The following example shows how the table is used.
1234 Suppose that the user invoked FunnelWeb as
1235 follows:@<XX@>@(filename inheritance@,example@)
1236
1237 @<P@>
1238 @<Begin verbatim@>
1239 fw /usr/ross/work/sloth.fw +twalrus
1240 @<End verbatim@>
1241
1242 @<P@>To work out what the documentation file should be
1243 called, FunnelWeb starts with the empty string and then
1244 works down the Document column of the table. The top entry
1245 is empty so we ignore it and proceed to the second entry
1246 which consists of @<DQP@>@(+T@). The user specified the
1247 string @<DQP@>@(walrus@) as the value of this option, and as
1248 our current (empty) string does not have a name field, we
1249 insert the string @<DQP@>@(walrus@) into the name field,
1250 resulting in the string @<DQP@>@(walrus@). Moving down to
1251 the next row, we encounter the constant string
1252 @<DQP@>@(.tex@). This string consists of an empty directory
1253 and name field, but a @<DQP@>@(.tex@) file extension. As our
1254 current string @<DQP@>@(walrus@), does not already have a
1255 file extension (@<ie@>the file extension field of our
1256 current string is empty), we add in @<DQP@>@(.tex@),
1257 resulting in the string @<DQP@>@(walrus.tex@). Next we
1258 encounter the @<DQP@>@(+F@) field which is the input
1259 filename @<DQP@>@(/usr/ross/work/sloth.fw@) consisting of a
1260 directory field @<DQP@>@(/usr/ross/work/@), a name field
1261 @<DQP@>@(sloth@), and a file extension field @<DQP@>@(.fw@).
1262 Our @<DQP@>@(walrus.tex@) string already has name and file
1263 extension fields, but its directory field is empty, and so
1264 we add in the directory field from the input file
1265 specification, resulting in the string
1266 @<DQP@>@(/usr/ross/work/walrus.tex@). Finally, we hit the
1267 default directory specification, which is (say)
1268 @<DQP@>@(/usr/ross/play/@). However, as the directory field
1269 of our walrus string is already full, it has no effect.
1270
1271 @<P@>In general, there is no need to remember the exact
1272 details of FunnelWeb's filename inheritance. The important
1273 thing is to know that it exists, and to use it.
1274
1275 @<Nav@>@(@<Interface_options FILE@>@,@<Interface FILE@>@,@<Interface_startup FILE@>@)
1276
1277 @<End FWRefMan page@>
1278 @}
1279
1280 @!==============================================================================
1281
1282 @$@<Interface_startup HEADING@>@M@{@<SH@>@(2.5@)FunnelWeb Startup@}
1283 @$@<Interface_startup FILE@>@M@{interface_startup.html@}
1284 @O@<interface_startup.html@>@{@-
1285 @<Begin FWRefMan page/H1@>@(@<Interface_startup HEADING@>@)
1286 @<XX@>@(FunnelWeb@,startup@)@<XX@>@(FunnelWeb@,initialization@)
1287
1288 @<P@>FunnelWeb's command line options can be divided into
1289 two groups. @<NewTerm@>@(Action options@) instruct FunnelWeb
1290 to performs some sort of independent action such as
1291 processing a file. @<NewTerm@>@(Ordinary options@) merely
1292 modify the way in which FunnelWeb executes the actions.
1293
1294 @<P@>The four action options are: @<TT@>@(+F@),
1295 @<TT@>@(+K@), @<TT@>@(+X@), and @<TT@>@(+H@).
1296
1297 @<P@>When FunnelWeb is invoked, if no action options are
1298 specified, and there is a file called @<TT@>@(fwinit.fws@) in the
1299 current directory, then FunnelWeb executes the FunnelWeb script
1300 file (@<TT@>@(.fws@)) and terminates. If there isn't such a file,
1301 FunnelWeb issues a help message and terminates.
1302
1303 @<P@>If, when FunnelWeb is invoked, one or more action options
1304 are specified, FunnelWeb performs the actions in a predefined
1305 order as follows:@<XX@>@(action execution@,order@)
1306
1307 @<NarrowThing@>@(Initialization
1308 script:@,FunnelWeb@<XX@>@(initialization@,script@) starts by
1309 looking in the current directory for a file called
1310 @<DQP@>@(fwinit.fws@).@<X@>@(fwinit.fws@) If it doesn't find
1311 one, it doesn't raise any error. If it does find one, it
1312 executes it as a FunnelWeb shellscript. Initialization
1313 scripts are useful for setting up FunnelWeb options
1314 (@<eg@>using the @<DQP@>@(set@) command without having to
1315 type them each time).@)
1316
1317 @<NarrowThing@>@(Execute argument script:@,If a shellscript
1318 has been specified using the @<DQP@>@(+X@) option, FunnelWeb
1319 executes it.@)
1320
1321 @<NarrowThing@>@(Process input file:@,If the user has
1322 specified an input file using the @<DQP@>@(+F@) option, then
1323 this is processed next (by FunnelWeb proper).@)
1324
1325 @<NarrowThing@>@(Display help message:@,If the user
1326 requested, using the @<DQP@>@(+H@) option, that a help
1327 message be displayed, the message is displayed at this
1328 time.@)
1329
1330 @<NarrowThing@>@(Interactive mode:@,If the user specified
1331 the @<DQP@>@(+K@) option, FunnelWeb enters interactive
1332 (keyboard) mode.@)
1333
1334 @<P@>FunnelWeb processes these actions in the above order
1335 regardless of the order in which they appear on the command
1336 line.
1337
1338 @<P@>It may be hard to see how some of these actions might
1339 be combined. Nevertheless, FunnelWeb allows this. For
1340 example, a user might wish to process a batch of files as
1341 specified in a script (@<DQP@>@(+Xscript.fws@)), be reminded
1342 of the interactive commands available
1343 (@<DQP@>@(+Hcommand@)), and then enter interactive mode so
1344 as to be able to reprocess files for which FunnelWeb
1345 reported errors (after correcting the errors in a different
1346 workstation window).
1347
1348 @<Nav/last@>@(@<Interface_inheritance FILE@>@,@<Interface FILE@>@,@<Interface FILE@>@)
1349
1350 @<End FWRefMan page@>
1351 @}
1352
1353 @!******************************************************************************
1354
1355 @$@<Scanner HEADING@>@M@{@<SH@>@(3@)Scanner@}
1356 @$@<Scanner HEADING/short@>@M@{@<SH@>@(3@)Scanner@}
1357 @$@<Scanner FILE@>@M@{scanner.html@}
1358 @O@<scanner.html@>@{@-
1359 @<Begin FWRefMan page/H1@>@(@<Scanner HEADING@>@)
1360
1361 @<P@> The scanner reads in the input file and produces a
1362 list of tokens which it hands onto the parser. In addition,
1363 some input constructs may cause the scanner to modify some
1364 of FunnelWeb's options.
1365
1366 @<Scanner index@>
1367
1368 @<Nav@>@(@<Interface FILE@>@,@<Index FILE@>@,@<Parser FILE@>@)
1369
1370 @<End FWRefMan page@>
1371 @}
1372
1373 @$@<Scanner index@>@M@{
1374 @<Begin size3@>
1375 @<Begin indent/narrow@>
1376 <A HREF="@<Scanner_basic FILE@>">@<Scanner_basic HEADING@></A>@<BR@>
1377 <A HREF="@<Scanner_special FILE@>">@<Scanner_special HEADING@></A>@<BR@>
1378 <A HREF="@<Scanner_special_set FILE@>">@<Scanner_special_set HEADING@></A>@<BR@>
1379 <A HREF="@<Scanner_special_ins FILE@>">@<Scanner_special_ins HEADING@></A>@<BR@>
1380 <A HREF="@<Scanner_arbitrary FILE@>">@<Scanner_arbitrary HEADING@></A>@<BR@>
1381 <A HREF="@<Scanner_comments FILE@>">@<Scanner_comments HEADING@></A>@<BR@>
1382 <A HREF="@<Scanner_quicknames FILE@>">@<Scanner_quicknames HEADING@></A>@<BR@>
1383 <A HREF="@<Scanner_eol_ins FILE@>">@<Scanner_eol_ins HEADING@></A>@<BR@>
1384 <A HREF="@<Scanner_eol_supp FILE@>">@<Scanner_eol_supp HEADING@></A>@<BR@>
1385 <A HREF="@<Scanner_include FILE@>">@<Scanner_include HEADING@></A>@<BR@>
1386 <A HREF="@<Scanner_prag FILE@>">@<Scanner_prag HEADING@></A>@<BR@>
1387 <A HREF="@<Scanner_prag_ind FILE@>">@<Scanner_prag_ind HEADING@></A>@<BR@>
1388 <A HREF="@<Scanner_prag_maxin FILE@>">@<Scanner_prag_maxin HEADING@></A>@<BR@>
1389 <A HREF="@<Scanner_prag_maxout FILE@>">@<Scanner_prag_maxout HEADING@></A>@<BR@>
1390 <A HREF="@<Scanner_prag_type FILE@>">@<Scanner_prag_type HEADING@></A>@<BR@>
1391 <A HREF="@<Scanner_type FILE@>">@<Scanner_type HEADING@></A>@<BR@>
1392 <A HREF="@<Scanner_type_newpage FILE@>">@<Scanner_type_newpage HEADING@></A>@<BR@>
1393 <A HREF="@<Scanner_type_contents FILE@>">@<Scanner_type_contents HEADING@></A>@<BR@>
1394 <A HREF="@<Scanner_type_vskip FILE@>">@<Scanner_type_vskip HEADING@></A>@<BR@>
1395 <A HREF="@<Scanner_type_title FILE@>">@<Scanner_type_title HEADING@></A>@<BR@>
1396 <A HREF="@<Scanner_parser FILE@>">@<Scanner_parser HEADING@></A>@<BR@>
1397
1398 @<End indent/narrow@>
1399 @<End size3@>
1400 @}
1401
1402 @!==============================================================================
1403
1404 @$@<Scanner_basic HEADING@>@M@{@<SH@>@(3.1@)Basic Input File Processing@}
1405 @$@<Scanner_basic FILE@>@M@{scanner_basic.html@}
1406 @O@<scanner_basic.html@>@{@-
1407 @<Begin FWRefMan page/H1@>@(@<Scanner_basic HEADING@>@)
1408
1409 @<P@>In order to read in an input file or include file, the
1410 scanner calls a submodule called the @<NewTerm@>@(mapper@)
1411 that reads a file in and creates a contiguous copy of it in
1412 memory. The scanner then performs three checks on the file,
1413 the first (file termination) of which is performed before
1414 scanning commences, and the other two of which take place
1415 during scanning before each line is scanned.
1416
1417 @<NarrowThing@>@(File
1418 Termination:@,The@<XX@>@(file@,termination@) first check the
1419 scanner makes@<XX@>@(line@,termination@) is whether the file
1420 is terminated properly. A file is considered to be properly
1421 terminated if it either contains no lines, or if the last
1422 line in the file is terminated by an end-of-line marker. If
1423 the scanner detects that an input file is not properly
1424 terminated, it adds an end-of-line marker itself (to the
1425 copy in memory only).@)
1426
1427 @<NarrowThing@>@(Unprintable Characters:@,The second check
1428 the scanner makes is for@<XX@>@(unprintable@,characters@)
1429 unprintable characters (ASCII 0--31 and 127--255 (except for
1430 EOL(10))) which it flags as errors and replaces by question
1431 marks.@)
1432
1433 @<NarrowThing@>@(Line Lengths:@,The third check the scanner
1434 makes is input line length.@<XX@>@(line@,length@) When
1435 FunnelWeb starts up, a default maximum input line length of
1436 80 is set. This can be changed dynamically during scanning
1437 using a @<TT@>@(@@p maximum_input_line_length@) pragma. If
1438 the number of characters on a line (not including the end of
1439 line marker) exceeds this limit, FunnelWeb generates an
1440 error.@)
1441
1442 @<Nav/first@>@(@<Scanner FILE@>@,@<Scanner FILE@>@,@<Scanner_special FILE@>@)
1443
1444 @<End FWRefMan page@>
1445 @}
1446
1447 @!==============================================================================
1448
1449 @$@<Scanner_special HEADING@>@M@{@<SH@>@(3.2@)Special Sequences@}
1450 @$@<Scanner_special FILE@>@M@{scanner_special.html@}
1451 @O@<scanner_special.html@>@{@-
1452 @<Begin FWRefMan page/H1@>@(@<Scanner_special HEADING@>@)
1453
1454 @<P@>The scanner scans the input file from top to bottom,
1455 left to right, treating the input as ordinary text (to be
1456 handed directly to the parser as a text token) unless it
1457 encounters the @<NewTerm@>@(special character@) which
1458 introduces a @<NewTerm@>@(special sequence@). Thus, the
1459 scanner partitions the input file into ordinary text and
1460 special sequences. (Note: This sort of character is often
1461 referred to as the @<DQ@>@(escape character@) or the
1462 @<DQ@>@(control character@) in other systems. However, as
1463 there is great potential to confuse these names with the
1464 @<DQ@>@(escape@) character (ASCII 27) and ASCII
1465 @<DQ@>@(control@) characters, the term @<DQ@>@(special@) has
1466 been chosen instead. This results in the terms
1467 @<I@>@(special character@) and @<I@>@(special sequence@).
1468
1469 @<P@>
1470 @<Begin verbatim@>
1471 input_file = { ordinary_text | special_sequence }
1472 @<End verbatim@>
1473
1474 @<P@>Upon startup, the special
1475 character@<XX@>@(default@,special character@) is
1476 @<TT@>@(@@@), but it can be changed using the
1477 @<<@>special@<>@>@<TT@>@(=@)@<<@>new_special@<>@> special sequence.
1478 Rather than using @<<@>special@<>@> whenever the special
1479 character appears, this document uses the default special
1480 character @<DQP@>@(@@@) to represent the current special
1481 character. More importantly, FunnelWeb's error messages all
1482 use the default special character in examples,
1483 even if the special character has been changed.
1484
1485 @<P@>An occurrence of the special character in the input
1486 file introduces a special sequence. The kind of special
1487 sequence is determined by the character following the
1488 special character. Only printable characters can follow the
1489 special character.
1490
1491 @<P@>The following list gives all the possible characters
1492 that can follow the special character, and the legality of
1493 each sequence. The first column gives the ASCII number of
1494 each ASCII character. The second column gives the special
1495 sequence for that character. The next column contains one of
1496 three characters: @<DQP@>@(-@) means that the sequence is
1497 illegal. @<DQP@>@(S@) indicates that the sequence is a
1498 @<NewTerm@>@(simple sequence@) (with no attributes or side
1499 effects) that appears exactly as shown and is converted
1500 directly into a token and fed to the parser. Finally,
1501 @<DQP@>@(C@) indicates that the special sequence is complex,
1502 possibly having a following syntax or producing funny side
1503 effects.
1504
1505 @<P@>
1506 @<Begin verbatim@>
1507 ASC SEQ COMMENT
1508 -----------------
1509 000 \
1510 016 | Unprintable chars (illegal specials).
1511 031 /
1512 032 @@ - Illegal (space).
1513 033 @@! C Comment.
1514 034 @@" S Parameter delimeter.
1515 035 @@# C Short name sequence.
1516 036 @@$ S Start of macro definition.
1517 037 @@% - Illegal.
1518 038 @@& - Illegal.
1519 039 @@' - Illegal.
1520 040 @@( S Open parameter list.
1521 041 @@) S Close parameter list.
1522 042 @@* - Illegal.
1523 043 @@+ C Insert newline.
1524 044 @@, S Parameter separator.
1525 045 @@- C Suppress end of line marker.
1526 046 @@. - Illegal.
1527 047 @@/ S Open or close emphasised text.
1528 048 @@0 - Illegal.
1529 049 @@1 S Formal parameter 1.
1530 050 @@2 S Formal parameter 2.
1531 051 @@3 S Formal parameter 3.
1532 052 @@4 S Formal parameter 4.
1533 053 @@5 S Formal parameter 5.
1534 054 @@6 S Formal parameter 6.
1535 055 @@7 S Formal parameter 7.
1536 056 @@8 S Formal parameter 8.
1537 057 @@9 S Formal parameter 9.
1538 058 @@: - Illegal.
1539 059 @@; - Illegal.
1540 060 @@< S Open macro name.
1541 061 @@= C Set special character.
1542 062 @@> S Close macro name.
1543 063 @@? - Illegal. Reserved for future use.
1544 064 @@@@ C Insert special character into text.
1545 065 @@A S New section (level 1).
1546 066 @@B S New section (level 2).
1547 067 @@C S New section (level 3).
1548 068 @@D S New section (level 4).
1549 069 @@E S New section (level 5).
1550 070 @@F - Illegal.
1551 071 @@G - Illegal.
1552 072 @@H - Illegal.
1553 073 @@I C Include file.
1554 074 @@J - Illegal.
1555 075 @@K - Illegal.
1556 076 @@L S Macro is library macro.
1557 077 @@M S Macro may be called many times.
1558 078 @@N - Illegal.
1559 079 @@O S Macro is attached to product file.
1560 080 @@P C Pragma.
1561 081 @@Q - Illegal.
1562 082 @@R - Illegal.
1563 083 @@S - Illegal.
1564 084 @@T C Typesetter directive.
1565 085 @@U - Illegal.
1566 086 @@V - Illegal.
1567 087 @@W - Illegal.
1568 088 @@X - Illegal.
1569 089 @@Y - Illegal.
1570 090 @@Z S Macro may be called zero times.
1571 091 @@[ - Illegal. Reserved for future use.
1572 092 @@\ - Illegal.
1573 093 @@] - Illegal. Reserved for future use.
1574 094 @@^ C Insert control character into text
1575 095 @@_ - Illegal.
1576 096 @@` - Illegal.
1577 097 @@a \
1578 109 @@m | Identical to @@A..@@Z.
1579 122 @@z /
1580 123 @@{ S Open macro body/Open literal directive.
1581 124 @@| - Illegal.
1582 125 @@} S Close macro body/Close literal directive.
1583 126 @@~ - Illegal.
1584 127 to 255 - Illegal specials (as non-standard ASCII).
1585 @<End verbatim@>
1586
1587 @<P@>The most important thing to remember about the scanner
1588 is that @<I@>@(nothing happens unless the special character
1589 is seen.@) There are no funny sequences that will cause
1590 strange things to happen. The best way to view a FunnelWeb
1591 document at the scanner level is as a body of text
1592 punctuated by special sequences that serve to structure the
1593 text at a higher level.
1594
1595 @<P@>The remaining description of the scanner consists of a
1596 detailed description of the effect of each complex special
1597 sequence.
1598
1599 @<Nav@>@(@<Scanner_basic FILE@>@,@<Scanner FILE@>@,@<Scanner_special_set FILE@>@)
1600
1601 @<End FWRefMan page@>
1602 @}
1603
1604 @!==============================================================================
1605
1606 @$@<Scanner_special_set HEADING@>@M@{@<SH@>@(3.3@)Setting the Special Character@}
1607 @$@<Scanner_special_set FILE@>@M@{scanner_special_set.html@}
1608 @O@<scanner_special_set.html@>@{@-
1609 @<Begin FWRefMan page/H1@>@(@<Scanner_special_set HEADING@>@)
1610
1611 @<P@>The special character can be set using the sequence
1612 @<<@>special@<>@>@<TT@>@(=@)@<<@>newspecialchar@<>@>. For example,
1613 @<TT@>@(@@=#@) would change the special character to a hash
1614 (@<TT@>@(#@)) character. The special character may be set
1615 to any printable ASCII character except the blank character
1616 (@<ie@>any character in the ASCII range [33,126]). In
1617 normal use, it should not be necessary to change the special
1618 character of FunnelWeb, and it is probably best to avoid
1619 changing the special character so as not to confuse
1620 FunnelWeb readers conditioned to the @<TT@>@(@@@) character.
1621 However, the feature is very useful where the text being
1622 prepared contains many @<TT@>@(@@@) characters (@<eg@>a list
1623 of internet electronic mail addresses).
1624
1625 @<Nav@>@(@<Scanner_special FILE@>@,@<Scanner FILE@>@,@<Scanner_special_ins FILE@>@)
1626
1627 @<End FWRefMan page@>
1628 @}
1629
1630 @!==============================================================================
1631
1632 @$@<Scanner_special_ins HEADING@>@M@{@<SH@>@(3.4@)Inserting the Special Character into the Text@}
1633 @$@<Scanner_special_ins FILE@>@M@{scanner_special_ins.html@}
1634 @O@<scanner_special_ins.html@>@{@-
1635 @<Begin FWRefMan page/H1@>@(@<Scanner_special_ins HEADING@>@)
1636 @<XX@>@(special character@,inserting into text@)
1637
1638 @<P@>The special sequence @<<@>special@<>@>@<TT@>@(@@@) inserts
1639 the special character into the text as if it were not
1640 special at all. The @<TT@>@(@@@) of this sequence has nothing
1641 to do with the current special character. If the current
1642 special character is @<TT@>@(P@) then the sequence
1643 @<TT@>@(P@@@) will insert a @<TT@>@(P@) into the text.
1644 Example: @<TT@>@(@@@@#@@=#@@#@@#=@@@@@@@) translates to
1645 @<TT@>@(@@#@@#@@@).
1646
1647 @<Nav@>@(@<Scanner_special_set FILE@>@,@<Scanner FILE@>@,@<Scanner_arbitrary FILE@>@)
1648
1649 @<End FWRefMan page@>
1650 @}
1651
1652 @!==============================================================================
1653
1654 @$@<Scanner_arbitrary HEADING@>@M@{@<SH@>@(3.5@)Inserting Arbitrary Characters into the Text@}
1655 @$@<Scanner_arbitrary FILE@>@M@{scanner_arbitrary.html@}
1656 @O@<scanner_arbitrary.html@>@{@-
1657 @<Begin FWRefMan page/H1@>@(@<Scanner_arbitrary HEADING@>@)
1658 @<XX@>@(arbitrary characters@,inserting into text@)
1659 @<XX@>@(control characters@,inserting into text@)@<X@>@(@@circumflex@)
1660
1661 @<P@>While FunnelWeb does not tolerate unprintable
1662 characters in the input file (except for the end of line
1663 character), it does allow the user to specify that
1664 unprintable characters appear in the product file. The
1665 @<TT@>@(@@^@) sequence inserts a single
1666 character of the user's choosing into the text. The
1667 character can be specified by giving its ASCII number in one
1668 of four bases: binary, octal, decimal, and hexadecimal. Here
1669 is the syntax:
1670
1671 @<P@>
1672 @<Begin verbatim@>
1673 control_sequence = "@@^" char_spec
1674 char_spec = binary | octal |
1675 decimal | hexadecimal
1676 binary = ("b" | "B")
1677 "(" {binary_digit}8 ")"
1678 octal = ("o" | "O" | "q" | "Q")
1679 "(" {octal_digit}3 ")"
1680 decimal = ("d" | "D")
1681 "(" {decimal_digit}3 ")"
1682 hexadecimal = ("h" | "H" | "x" | "X")
1683 "(" {hex_digit}2 ")"
1684 binary_digit = "0" | "1"
1685 octal_digit = binary_digit | "2" | "3" |
1686 "4" | "5" | "6" | "7"
1687 decimal_digit = octal_digit | "8" | "9"
1688 hex_digit = decimal_digit |
1689 "A" | "B" | "C" | "D" | "E" | "F" |
1690 "a" | "b" | "c" | "d" | "e" | "f"
1691 @<End verbatim@>
1692
1693 @<P@>Example:
1694
1695 @<Begin verbatim@>
1696 @@! Unix Make requires that productions
1697 @@! commence with tab characters.
1698 @@^D(009)prog.o <- prog.c
1699 @<End verbatim@>
1700
1701 @<P@>Note that the decimal @<DQP@>@(9@) is expressed with
1702 leading zeros as @<DQP@>@(009@). FunnelWeb requires a fixed
1703 number of digits for each base. Eight digits for base two,
1704 three digits for base ten, three digits for base eight and
1705 two digits for base sixteen.
1706
1707 @<P@>FunnelWeb treats the character resulting from a
1708 @<TT@>@(@@^@) sequence as ordinary text in every
1709 sense. If your input file contains many instances of a
1710 particular control character, you can package it up in a
1711 macro like any other text. In particular, quick names can be
1712 used to great effect:
1713
1714 @<P@>
1715 @<Begin verbatim@>
1716 @@! Unix "Make" requires that productions
1717 @@! commence with tab characters.
1718 @@! So we define a macro with a quick name
1719 @@! as a tab character.
1720 $@@#T@@{@@^D(009)@@}
1721 @@! And use it in our productions.
1722 @@#Tprog.o <- prog.c
1723 @@#Ta.out <- prog.o
1724 @<End verbatim@>
1725
1726 @<P@>Warning: If you insert a Unix@<X@>@(Unix newline@)
1727 newline character (decimal 10) into the text, FunnelWeb will
1728 treat this as an end of line sequence regardless of what the
1729 character sequence for end of line is on the machine upon
1730 which it is running. Unix EOL is FunnelWeb's internal
1731 representation for end of line. Thus, in the current version
1732 of FunnelWeb, inserting character 10 into the text is
1733 impossible unless this also happens to be the character used
1734 by the operating system to mark the end of line.
1735
1736 @<Nav@>@(@<Scanner_special_ins FILE@>@,@<Scanner FILE@>@,@<Scanner_comments FILE@>@)
1737
1738 @<End FWRefMan page@>
1739 @}
1740
1741 @!==============================================================================
1742
1743 @$@<Scanner_comments HEADING@>@M@{@<SH@>@(3.6@)Comments@}
1744 @$@<Scanner_comments FILE@>@M@{scanner_comments.html@}
1745 @O@<scanner_comments.html@>@{@-
1746 @<Begin FWRefMan page/H1@>@(@<Scanner_comments HEADING@>@)
1747 @<XX@>@(comments@,FunnelWeb@)
1748
1749 @<P@>When FunnelWeb encounters the @<TT@>@(@@!@)@<X@>@(@@!@)
1750 sequence during its left-to-right scan of the line, it
1751 throws away the rest of the line (including the EOL) without
1752 analysing it further. Comments can appear in any line except
1753 @<DQP@>@(@@i@), @<DQP@>@(@@t@), and @<DQP@>@(@@p@) lines.
1754
1755 @<P@>FunnelWeb comments can be used to insert comments into
1756 your input file that will neither appear in the product
1757 files nor in the documentation file, but will be solely for
1758 the benefit of those reading and editing the input file
1759 directly. Example:
1760
1761 @<P@>@<Begin verbatim@>
1762 @@! I have used a quick macro for this definition
1763 @@! as it will be used often.
1764 @@$@@#C@@{--@@}
1765 @<End verbatim@>
1766
1767 @<P@>Because comments are defined to include the end-of-line
1768 marker, care must be taken when they are being added or
1769 removed within the text of macro bodies. For example the
1770 text fragment
1771
1772 @<P@>
1773 @<Begin verbatim@>
1774 for (i=0;i@<<@>MAXVAL;i++) @@! Print out a[0..MAXVAL-1].
1775 printf("%u\n",a[i]);
1776 @<End verbatim@>
1777
1778 @<P@>will expand to
1779
1780 @<P@>
1781 @<Begin verbatim@>
1782 for (i=0;i@<<@>MAXVAL;i++) printf("%u\n",a[i]);
1783 @<End verbatim@>
1784
1785 @<P@>This problem really has no solution; if FunnelWeb
1786 comments were defined to omit the end of line marker, the
1787 expanded text would contain trailing blanks! As it is,
1788 FunnelWeb comments are designed to support single line
1789 comments which can be inserted and removed as a line without
1790 causing trouble. For example:
1791
1792 @<P@>
1793 @<Begin verbatim@>
1794 @@! Print out a[0..MAXVAL-1].
1795 for (i=0;i@<<@>MAXVAL;i++)
1796 printf("%u\n",a[i]);
1797 @<End verbatim@>
1798
1799 @<P@>If you want a comment construct that does not enclose
1800 the end of line marker, combine the insert end of line
1801 construct @<TT@>@(@@+@) with the comment construct
1802 @<TT@>@(@@!@) as in
1803
1804 @<P@>
1805 @<Begin verbatim@>
1806 for (i=0;i@<<@>MAXVAL;i++) @@+@@! Print out a[0..MAXVAL-1].
1807 printf("%u\n",a[i]);
1808 @<End verbatim@>
1809
1810 @<P@>FunnelWeb comments should really only be used to
1811 comment the FunnelWeb constructs being used in the input
1812 file. Comments on the target code are best placed in
1813 comments in the target language or in the documenting text
1814 surrounding the macro definitions. In the example above, a C
1815 comment would have been more appropriate.
1816
1817 @<Nav@>@(@<Scanner_arbitrary FILE@>@,@<Scanner FILE@>@,@<Scanner_quicknames FILE@>@)
1818
1819 @<End FWRefMan page@>
1820 @}
1821
1822 @!==============================================================================
1823
1824 @$@<Scanner_quicknames HEADING@>@M@{@<SH@>@(3.7@)Quick Names@}
1825 @$@<Scanner_quicknames FILE@>@M@{scanner_quicknames.html@}
1826 @O@<scanner_quicknames.html@>@{@-
1827 @<Begin FWRefMan page/H1@>@(@<Scanner_quicknames HEADING@>@)
1828 @<XX@>@(quick@,names@)
1829
1830 @<P@>FunnelWeb provides a @<NewTerm@>@(quick name@) syntax
1831 as an alternative, for macros whose name consists of a
1832 single character, to the angle bracket syntax usually used
1833 (@<eg@>@<TT@>@(@@@<<@>Sloth@@@<>@>@)). A quick name sequence
1834 consists of @<TT@>@(@@#@)x@<X@>@(@@hash@) where x, the name
1835 of the macro, can be any printable character except space.
1836
1837 @<P@>@<Begin verbatim@>
1838 quick_name = "@@#" non_space_printable
1839 @<End verbatim@>
1840
1841 @<P@>The result is identical to the equivalent ordinary name
1842 syntax, but is shorter. For example, @<TT@>@(@@#X@) is
1843 equivalent to @<TT@>@(@@@<<@>X@@@<>@>@). This shorter way of
1844 writing one-character macro names is more convenient where a
1845 macro must be used very often. For example, the macro calls
1846 in the following fragment of an Ada program are a little
1847 clumsy.
1848
1849 @<P@>
1850 @<Begin verbatim@>
1851 @@! Define @@@<<@>D@@@<>@> as "" to turn on debug code
1852 @@! and "--" to turn it off.
1853 @@$@@@<<@>D@@>@@{--@@@@)
1854 @@@<<@>D@@@<>@>assert(b>3);
1855 @@@<<@>D@@@<>@>if x@<>@>7 then write("error") end if
1856 @<End verbatim@>
1857
1858 @<P@>The calls can be shortened using the alternative syntax.
1859
1860 @<Begin verbatim@>
1861 @@! Define @@#| as "" to turn on debug code
1862 @@! and "--" to turn it off.
1863 @@$@@#|@@{--@@@@)
1864 @@#|assert(b@<>@>3);
1865 @@#|if x@<>@>7 then write("error") end if
1866 @<End verbatim@>
1867
1868 @<Nav@>@(@<Scanner_comments FILE@>@,@<Scanner FILE@>@,@<Scanner_eol_ins FILE@>@)
1869
1870 @<End FWRefMan page@>
1871 @}
1872
1873 @!==============================================================================
1874
1875 @$@<Scanner_eol_ins HEADING@>@M@{@<SH@>@(3.8@)Inserting End of Line Markers@}
1876 @$@<Scanner_eol_ins FILE@>@M@{scanner_eol_ins.html@}
1877 @O@<scanner_eol_ins.html@>@{@-
1878 @<Begin FWRefMan page/H1@>@(@<Scanner_eol_ins HEADING@>@)
1879 @<XX@>@(EOL markers@,inserting@)
1880
1881 @<P@>An end of line marker/character can be inserted into
1882 the text using the @<TT@>@(@@+@)@<X@>@(@@+@) sequence. This
1883 is exactly equivalent to a real end of line in the text at
1884 the point where it occurs. While this feature may sound
1885 rather useless, it is very useful for laying out the input
1886 file. For example, the following input data for a database
1887 program
1888
1889 @<P@>
1890 @<Begin verbatim@>
1891 Animal = Kangaroo
1892 Size = Medium
1893 Speed = Fast
1894
1895 Animal = Sloth
1896 Size = Medium
1897 Speed = Slow
1898
1899 Animal = Walrus
1900 Size = Big
1901 Speed = Medium
1902 @<End verbatim@>
1903
1904 @<P@>can be converted into
1905
1906 @<P@>
1907 @<Begin verbatim@>
1908 Animal = Kangaroo @@+Size = Medium @@+Speed = Fast @@+
1909 Animal = Sloth @@+Size = Medium @@+Speed = Slow @@+
1910 Animal = Walrus @@+Size = Big @@+Speed = Medium @@+
1911 @<End verbatim@>
1912
1913 @<P@>which is easier to read, and more easily allows comparisons between
1914 records.
1915
1916 @<Nav@>@(@<Scanner_quicknames FILE@>@,@<Scanner FILE@>@,@<Scanner_eol_supp FILE@>@)
1917
1918 @<End FWRefMan page@>
1919 @}
1920
1921 @!==============================================================================
1922
1923 @$@<Scanner_eol_supp HEADING@>@M@{@<SH@>@(3.9@)Suppressing End of Line Markers@}
1924 @$@<Scanner_eol_supp FILE@>@M@{scanner_eol_supp.html@}
1925 @O@<scanner_eol_supp.html@>@{@-
1926 @<Begin FWRefMan page/H1@>@(@<Scanner_eol_supp HEADING@>@)
1927 @<XX@>@(EOL markers@,suppressing@)
1928
1929 @<P@>End of line markers can be suppressed by the
1930 @<TT@>@(@@-@)@<X@>@(@@-@) sequence. A single occurrence of a
1931 @<TT@>@(@@-@) sequence serves to suppress only the end of
1932 line marker following it and must appear @<I@>@(exactly@)
1933 before the end of line marker to be suppressed. No trailing
1934 spaces, @<TT@>@(@@!@) comments, or any other characters are
1935 permitted between a @<TT@>@(@@-@) sequence and the end of
1936 line that it is supposed to suppress. The @<TT@>@(@@-@)
1937 sequence is useful for constructing long output lines
1938 without them having to appear in the input. It can also be
1939 used in the same way as the @<TT@>@(@@+@) was used in the
1940 previous section to assist in exposing the structure of
1941 output text without affecting the output text itself.
1942 Finally, it is invaluable for suppressing the EOL after the
1943 opening macro text @<TT@>@(@@{@) construct. For example:
1944
1945 @<P@>
1946 @<Begin verbatim@>
1947 @@$@@@<<@>Walrus@@@<>@>@@{@@-
1948 I am the walrus!@@}
1949 @<End verbatim@>
1950
1951 @<P@>is equivalent to
1952
1953 @<P@>
1954 @<Begin verbatim@>
1955 @@$@@@<<@>Walrus@@@<>@>@@{I am the walrus!@@}
1956 @<End verbatim@>
1957
1958 @<P@>The comment construct (@<TT@>@(@@!@)) can also be used
1959 to suppress end of lines. However, the @<TT@>@(@@-@)
1960 construct should be preferred for this purpose as it makes
1961 explicit the programmer's intent to suppress the end of
1962 line.
1963
1964 @<Nav@>@(@<Scanner_eol_ins FILE@>@,@<Scanner FILE@>@,@<Scanner_include FILE@>@)
1965
1966 @<End FWRefMan page@>
1967 @}
1968
1969 @!==============================================================================
1970
1971 @$@<Scanner_include HEADING@>@M@{@<SH@>@(3.10@)Include Files@}
1972 @$@<Scanner_include FILE@>@M@{scanner_include.html@}
1973 @O@<scanner_include.html@>@{@-
1974 @<Begin FWRefMan page/H1@>@(@<Scanner_include HEADING@>@)
1975 @<XX@>@(include@,files@)
1976
1977 @<P@>FunnelWeb provides an include file facility with a
1978 maximum depth of 10. When FunnelWeb sees a line of the form
1979 @<TT@>@(@@i @<<@>filename@<>@>@),@<X@>@(@@i@) it replaces the entire
1980 line (including the EOL) with the contents of the specified
1981 include file. FunnelWeb's include file facility is intended
1982 to operate at the line level. If the last line of the
1983 include file is not terminated by an EOL, FunnelWeb issues a
1984 warning and inserts one (in the copy in memory).
1985
1986 @<P@>The
1987 @<TT@>@(@@i@) construct is illegal if it appears anywhere except
1988 at the start of a line.
1989 The construct must be followed by a single blank. The file
1990 name is defined to be everything
1991 between the blank and the end of the line (no
1992 comments (@<TT@>@(@@!@)) please!). Example: If the input file is
1993
1994 @<P@>
1995 @<Begin verbatim@>
1996 "Uh Oh, It's the Fuzz. We're busted!" said Baby Bear.
1997 @@i mr_plod.txt
1998 "Quick! Flush the stash down the dunny and split."
1999 said Father Bear.
2000 @<End verbatim@>
2001
2002 @<P@>and there is a file called @<TT@>@(mr_plod.txt@) containing
2003
2004 @<P@>
2005 @<Begin verbatim@>
2006 "'Ello, 'Ello, 'Ello! What's all this 'ere then?"
2007 Mr Plod exclaimed.
2008 @<End verbatim@>
2009
2010 @<P@>then the scanner translates the input file into
2011
2012 @<P@>
2013 @<Begin verbatim@>
2014 "Uh Oh, It's the Fuzz. We're busted!" said Baby Bear.
2015 "'Ello, 'Ello, 'Ello! What's all this 'ere then?"
2016 Mr Plod exclaimed.
2017 "Quick! Flush the stash down the dunny and split."
2018 said Father Bear.
2019 @<End verbatim@>
2020
2021 @<P@>As a point of terminology, FunnelWeb calls the original
2022 input file the @<NewTerm@>@(input file@) and calls include
2023 files and their included files @<NewTerm@>@(include files@).
2024
2025 @<P@>The include file construct operates at a very low
2026 level. An include line can appear anywhere in the input file
2027 regardless of the context of the surrounding lines.
2028
2029 @<P@>FunnelWeb sets the special character to the default
2030 (@<TT@>@(@@@)) at the start of each include file and restores
2031 it to its previous value at the end of the include file.
2032 This allows macro libraries to be constructed and included
2033 that are independent of the prevailing special character at
2034 the point of inclusion. The same goes for the input line
2035 length limit which is reset to the default value at the
2036 start of each include file and restored to its previous
2037 value afterwards.
2038
2039 @<Nav@>@(@<Scanner_eol_supp FILE@>@,@<Scanner FILE@>@,@<Scanner_prag FILE@>@)
2040
2041 @<End FWRefMan page@>
2042 @}
2043
2044 @!==============================================================================
2045
2046 @$@<Scanner_prag HEADING@>@M@{@<SH@>@(3.11@)Pragmas@}
2047 @$@<Scanner_prag FILE@>@M@{scanner_prag.html@}
2048 @O@<scanner_prag.html@>@{@-
2049 @<Begin FWRefMan page/H1@>@(@<Scanner_prag HEADING@>@)
2050 @<X@>@(pragmas@)@<XX@>@(pragmas@,visible@)@<XX@>@(pragmas@,invisible@)
2051
2052 @<P@>Most tools have to support some essential, but rather
2053 inelegant features. In FunnelWeb these messy bits have all
2054 been stuffed into the scanner's @<NewTerm@>@(pragma@) (for
2055 @<I@>@(pragma@)tic) construct.
2056
2057 @<P@>A pragma consists of a single line of input (including
2058 the EOL) commencing with @<TT@>@(@@p@). This must be followed
2059 by a single space, and then the pragma verb. This must be
2060 followed by a sequence of zero or more arguments separated
2061 by one or more spaces. Four pragmas are available
2062
2063 @<P@>
2064 @<Begin verbatim@>
2065 pragma = pragma_ident | pragma_mill |
2066 pragma_moll | pragma_typesetter
2067 @<End verbatim@>
2068 The following syntax definitions assist in defining the pragmas.
2069
2070 @<P@>
2071 @<Begin verbatim@>
2072 s = {" "}+
2073 ps = ("@@p" | "@@P") " "
2074 number = { decimal_digit }+
2075 numorinf = number | "infinity"
2076 @<End verbatim@>
2077
2078 @<P@>The arguments to pragmas are case-sensitive and must be
2079 specified in lower case.
2080
2081 @<P@>Pragmas are processed and consumed entirely by the
2082 scanner. The parser never sees them and so they can play no
2083 part in the parser level syntax. As a result, pragma lines
2084 can appear anywhere in the entire input file regardless of
2085 the surrounding context (@<eg@>even in the middle of a macro
2086 definition). The sole effect of a pragma is to modify some
2087 internal parameter of FunnelWeb.
2088
2089 @<P@>The following sections describe the four FunnelWeb pragmas.
2090
2091 @<Nav@>@(@<Scanner_include FILE@>@,@<Scanner FILE@>@,@<Scanner_prag_ind FILE@>@)
2092
2093 @<End FWRefMan page@>
2094 @}
2095
2096 @!==============================================================================
2097
2098 @$@<Scanner_prag_ind HEADING@>@M@{@<SH@>@(3.12@)Pragma: Indentation@}
2099 @$@<Scanner_prag_ind FILE@>@M@{scanner_prag_ind.html@}
2100 @O@<scanner_prag_ind.html@>@{@-
2101 @<Begin FWRefMan page/H1@>@(@<Scanner_prag_ind HEADING@>@)
2102 @<XX@>@(indentation@,macro expansion@)
2103
2104 @<P@>When FunnelWeb expands a macro, it can do so in two
2105 ways. First it can treat the text it is processing as a
2106 one-dimensional stream of text, and merely insert the body
2107 of the macro in place of the macro call. Second, it can
2108 treat the text of the macro as a two dimensional object and
2109 indent each line of the macro body by the amount that the
2110 macro call itself was indented. Consider the following
2111 macros.
2112
2113 @<P@>
2114 @<Begin verbatim@>
2115 @@$@@@<<@>Loop Structure@@@<>@>@@{@@-
2116 i=1;
2117 while (i@<<@>=N)
2118 @@@<<@>Loop body@@@<>@>
2119 endwhile
2120 @@}
2121
2122 @@$@@@<<@>Loop body@@@<>@>@@{@@-
2123 a[i]:=0;
2124 i:=i+1;@@}
2125 @<End verbatim@>
2126
2127 @<P@>Under the regime of @<NewTerm@>@(no
2128 indentation@)@<XX@>@(indentation@,none@) the loop structure
2129 macro expands to:
2130
2131 @<P@>
2132 @<Begin verbatim@>
2133 i=1;
2134 while (i@<<@>=N)
2135 a[i]:=0;
2136 i:=i+1;
2137 endwhile
2138 @<End verbatim@>
2139
2140 @<P@>Under the regime of @<NewTerm@>@(blank
2141 indentation@)@<XX@>@(indentation@,blank@) the loop structure
2142 macro expands to:
2143
2144 @<P@>
2145 @<Begin verbatim@>
2146 i=1;
2147 while (i@<<@>=N)
2148 a[i]:=0;
2149 i:=i+1;
2150 endwhile
2151 @<End verbatim@>
2152
2153 @<P@>The @<TT@>@(indentation@) pragma determines which of
2154 these two regimes will be used to expand the macros when
2155 constructing the product files. The syntax of the pragma is:
2156
2157 @<P@>
2158 @<Begin verbatim@>
2159 pragma_ident = ps "indentation" s "=" s
2160 ("blank" | "none")
2161 @<End verbatim@>
2162
2163 @<P@>Its two forms look like this:
2164
2165 @<P@>
2166 @<Begin verbatim@>
2167 @@p indentation = blank
2168 @@p indentation = none
2169 @<End verbatim@>
2170
2171 @<P@>In the current version of FunnelWeb, the indentation
2172 regime is an attribute that is attached to an entire run of
2173 Tangle; it is not possible to bind it to particular product
2174 files or to particular macros. As a result, it doesn't
2175 matter where indentation pragmas occur in the input file or
2176 how many there are so long as they are all the same. By
2177 default FunnelWeb uses blank indentation.
2178
2179 @<Nav@>@(@<Scanner_prag FILE@>@,@<Scanner FILE@>@,@<Scanner_prag_maxin FILE@>@)
2180
2181 @<End FWRefMan page@>
2182 @}
2183
2184 @!==============================================================================
2185
2186 @$@<Scanner_prag_maxin HEADING@>@M@{@<SH@>@(3.13@)Pragma: Maximum Input Line Length@}
2187 @$@<Scanner_prag_maxin FILE@>@M@{scanner_prag_maxin.html@}
2188 @O@<scanner_prag_maxin.html@>@{@-
2189 @<Begin FWRefMan page/H1@>@(@<Scanner_prag_maxin HEADING@>@)
2190 @<XX@>@(input@,line length@)@<XX@>@(maximum@,input line length@)
2191
2192 @<P@>FunnelWeb generates an error for each input line that
2193 exceeds a certain maximum number of characters. At the start
2194 of the processing of each input file and each include file,
2195 this maximum is set to a default value of 80. However, the
2196 maximum can be changed using a maximum input line length
2197 pragma.@<XX@>@(pragma@,input line length@)
2198
2199 @<P@>
2200 @<Begin verbatim@>
2201 pragma_mill = ps "maximum_input_line_length" s
2202 "=" s numorinf
2203 @<End verbatim@>
2204
2205 @<P@>The maximum input line length can be varied
2206 @<I@>@(dynamically@) throughout the input file. Each maximum
2207 input line length pragma's scope covers the line following
2208 the pragma through to and including the next maximum input
2209 line length pragma, but not covering any intervening include
2210 files. At the start of an include file, FunnelWeb resets
2211 the maximum input line length to the default value. It
2212 restores it to its previous value at the end of the include
2213 file.
2214
2215 @<P@>This pragma is useful for detecting text that has
2216 strayed off the right side of the screen when editing. If
2217 you use FunnelWeb, and set the maximum input line length to
2218 be the width of your editing window, you will never be
2219 caught by, for example, off-screen opening comment symbols.
2220 You can also be sure that your source text can be printed
2221 raw, if necessary, without lines wrapping around.
2222
2223 @<Nav@>@(@<Scanner_prag_ind FILE@>@,@<Scanner FILE@>@,@<Scanner_prag_maxout FILE@>@)
2224
2225 @<End FWRefMan page@>
2226 @}
2227
2228 @!==============================================================================
2229
2230 @$@<Scanner_prag_maxout HEADING@>@M@{@<SH@>@(3.14@)Pragma: Maximum Output File Line Length@}
2231 @$@<Scanner_prag_maxout FILE@>@M@{scanner_prag_maxout.html@}
2232 @O@<scanner_prag_maxout.html@>@{@-
2233 @<Begin FWRefMan page/H1@>@(@<Scanner_prag_maxout HEADING@>@)
2234 @<XX@>@(maximum@,product file line length@)
2235 @<XX@>@(pragma@,maximum product file line length@)
2236 @<XX@>@(maximum@,output file line length@)
2237 @<XX@>@(pragma@,maximum output file line length@)
2238
2239 @<P@>As well as keeping an eye on input line lengths,
2240 FunnelWeb also keeps an eye on the line lengths of product
2241 files and flags all lines longer than a certain limit with
2242 error messages. Unlike the maximum input line length, which
2243 can vary dynamically throughout the input file, the maximum
2244 product file line length remains fixed throughout the
2245 generation of all the product files. The maximum product
2246 file line length pragma allows this value to be set. If
2247 there is more than one such pragma in an input file, the
2248 pragmas must all specify the same value.
2249
2250 @<P@>
2251 @<Begin verbatim@>
2252 pragma_moll = ps "maximum_output_line_length"
2253 s "=" s numorinf
2254 @<End verbatim@>
2255
2256 @<P@>The default value is 80 characters.
2257
2258 @<P@>This pragma is only one of two constraints on the
2259 length of the lines of the product files. The @<TT@>@(+W@)
2260 command line option also contributes. The actual value that
2261 FunnelWeb uses is the minimum of the limits specified in the
2262 command line and pragmas.
2263
2264 @<P@>FunnelWeb does not monitor the length of the lines of
2265 its other output files (journal file, listing file,
2266 documentation file).
2267
2268 @<Nav@>@(@<Scanner_prag_maxin FILE@>@,@<Scanner FILE@>@,@<Scanner_prag_type FILE@>@)
2269
2270 @<End FWRefMan page@>
2271 @}
2272
2273 @!==============================================================================
2274
2275 @$@<Scanner_prag_type HEADING@>@M@{@<SH@>@(3.15@)Pragma: Typesetter@}
2276 @$@<Scanner_prag_type FILE@>@M@{scanner_prag_type.html@}
2277 @O@<scanner_prag_type.html@>@{@-
2278 @<Begin FWRefMan page/H1@>@(@<Scanner_prag_type HEADING@>@)
2279 @<XX@>@(typesetter@,pragma@)@<XX@>@(typesetter@,independence@)
2280
2281 @<P@>The @<TT@>@(typesetter@) pragma allows the user to
2282 specify whether the input file is supposed to be
2283 typesetter-independent, or whether it contains commands in a
2284 particular typesetter language. The pragma has the following
2285 syntax.
2286
2287 @<P@>
2288 @<Begin verbatim@>
2289 pragma_typesetter = ps "typesetter" s "="
2290 s ("none" | "tex" | "html")
2291 @<End verbatim@>
2292
2293 @<P@>The three forms of the pragma look like this.
2294
2295 @<P@>
2296 @<Begin verbatim@>
2297 @@p typesetter = none
2298 @@p typesetter = tex
2299 @@p typesetter = html
2300 @<End verbatim@>
2301
2302 @<P@>A source file can contain more than one typesetter
2303 pragma, but they must all specify the same value. The
2304 default is @<TT@>@(none@). The typesetter setting affects
2305 two things:
2306
2307 @<NarrowThing@>@(Handling of free text:@,If the typesetter
2308 is not @<TT@>@(none@), Weave writes the free text
2309 @<I@>@(directly@) to the documentation file without changing
2310 it whatsoever. This means that if (say) @<TT@>@(\centerline@)
2311 appears in the input file, it will copied
2312 directly to the documentation file. If the typesetter is
2313 @<TT@>@(none@), Weave intercepts any characters or sequences
2314 that might have a special meaning to the target typesetter
2315 and replaces them with typesetter commands to typeset the
2316 sequences so that they will appear as they do in the input.
2317 For example, if the typesetter is @<TT@>@(none@) and the
2318 target typesetter is TeX, then if @<TT@>@($@) (the TeX
2319 @<DQ@>@(mathematics mode@) character) appears in the input
2320 file, it will be be written to the documentation file as
2321 @<TT@>@(\$@).@)
2322
2323 @<NarrowThing@>@(Restrictions on the target typesetter:@,
2324 If you make your FunnelWeb input file depedent on one
2325 particular typesetter, it's important that no attempt be
2326 made to generate documentation for a different target format.
2327 FunnelWeb enforces this at the Weave stage.@)
2328
2329 @<P@>The aim of all this is to ensure that any typesetter
2330 dependency is correctly proclaimed. Because @<TT@>@(none@)
2331 is the default typesetter, a user who creates a source file
2332 without a @<TT@>@(typesetter = x@) pragma will soon find
2333 that the control sequences they are inserting into the
2334 source document are appearing verbatim in the printed
2335 documentation! In order to activate these sequences, they
2336 will be forced to add a @<TT@>@(typesetter@) pragma, thus
2337 making the dependency explicit.
2338
2339 @<P@>It may seem strange to place the @<TT@>@(typesetter@)
2340 setting facility within a pragma (@<TT@>@(@@p@)) when there
2341 is a separate typesetting construct (@<TT@>@(@@t@)). This has
2342 been done to sustain the rule of thumb that says that
2343 pragmas do not participate in the parser-level syntax, but
2344 typesetter directives do.
2345
2346 @<Nav@>@(@<Scanner_prag_maxout FILE@>@,@<Scanner FILE@>@,@<Scanner_type FILE@>@)
2347
2348 @<End FWRefMan page@>
2349 @}
2350
2351 @!==============================================================================
2352
2353 @$@<Scanner_type HEADING@>@M@{@<SH@>@(3.16@)Freestanding Typesetter Directives@}
2354 @$@<Scanner_type FILE@>@M@{scanner_type.html@}
2355 @O@<scanner_type.html@>@{@-
2356 @<Begin FWRefMan page/H1@>@(@<Scanner_type HEADING@>@)
2357 @<XX@>@(typesetter@,directives@)
2358
2359 @<P@>FunnelWeb provides two kinds of typesetter directive to
2360 assist the user to produce documentation. These are
2361 @<NewTerm@>@(inline@) and @<NewTerm@>@(freestanding@).
2362 Unlike pragmas, each of these categories of directive
2363 participates in the parser-level syntax and can appear only
2364 in certain contexts (see the parser section). Inline
2365 directives are designed to be used within paragraphs to
2366 alter the look of the enclosed text. Freestanding typesetter
2367 directives are designed to appear on lines of their own and
2368 have a bigger typographical impact.
2369
2370 @<P@>The syntax of freestanding typesetter directives is
2371 almost identical to that of pragmas. All the same syntax
2372 rules apply (except that the actual keywords are different).
2373 The following subsections describe the four typesetter
2374 directives available.
2375
2376 @<P@>
2377 @<Begin verbatim@>
2378 ftd = ftd_newpage | ftd_toc | ftd_vskip | ftd_title
2379 ts = "@@t "
2380 @<End verbatim@>
2381
2382 @<Nav@>@(@<Scanner_prag_type FILE@>@,@<Scanner FILE@>@,@<Scanner_type_newpage FILE@>@)
2383
2384 @<End FWRefMan page@>
2385 @}
2386
2387 @!==============================================================================
2388
2389 @$@<Scanner_type_newpage HEADING@>@M@{@<SH@>@(3.17@)New Page Directives@}
2390 @$@<Scanner_type_newpage FILE@>@M@{scanner_type_newpage.html@}
2391 @O@<scanner_type_newpage.html@>@{@-
2392 @<Begin FWRefMan page/H1@>@(@<Scanner_type_newpage HEADING@>@)
2393 @<X@>@(new page@)@<XX@>@(pragma@,new page@)
2394
2395 @<P@>The new page pragma is a typesetting pragma with the
2396 following syntax.
2397
2398 @<Begin verbatim@>
2399 ftd_newpage = ts "new_page"
2400 @<End verbatim@>
2401
2402 @<P@>It only form looks like this.
2403
2404 @<Begin verbatim@>
2405 @@t new_page
2406 @<End verbatim@>
2407
2408 @<P@>Its sole effect is to cause a @<DQ@>@(skip to a new
2409 page@) command to be inserted into the documentation file.
2410 The new page command is such that if the typesetter is
2411 already at the top of a page, it will skip to the top of the
2412 next page.
2413
2414 @<Nav@>@(@<Scanner_type FILE@>@,@<Scanner FILE@>@,@<Scanner_type_contents FILE@>@)
2415
2416 @<End FWRefMan page@>
2417 @}
2418
2419 @!==============================================================================
2420
2421 @$@<Scanner_type_contents HEADING@>@M@{@<SH@>@(3.18@)Table of Contents@}
2422 @$@<Scanner_type_contents FILE@>@M@{scanner_type_contents.html@}
2423 @O@<scanner_type_contents.html@>@{@-
2424 @<Begin FWRefMan page/H1@>@(@<Scanner_type_contents HEADING@>@)
2425 @<XX@>@(table of@,contents@)@<XX@>@(pragma@,table of contents@)
2426
2427 @<P@>The table of contents pragma is a typesetting pragma
2428 with the following syntax.
2429
2430 @<P@>
2431 @<Begin verbatim@>
2432 ftd_toc = ts "table_of_contents"
2433 @<End verbatim@>
2434
2435 @<P@>It only form looks like this.
2436
2437 @<P@>
2438 @<Begin verbatim@>
2439 @@t table_of_contents
2440 @<End verbatim@>
2441
2442 @<P@>Its sole effect is to instruct Weave to insert a table
2443 of contents at this point in the printed documentation. This
2444 pragma does not skip to a top of a new page first.
2445
2446 @<Nav@>@(@<Scanner_type_newpage FILE@>@,@<Scanner FILE@>@,@<Scanner_type_vskip FILE@>@)
2447
2448 @<End FWRefMan page@>
2449 @}
2450
2451 @!==============================================================================
2452
2453 @$@<Scanner_type_vskip HEADING@>@M@{@<SH@>@(3.19@)Vertical Skip@}
2454 @$@<Scanner_type_vskip FILE@>@M@{scanner_type_vskip.html@}
2455 @O@<scanner_type_vskip.html@>@{@-
2456 @<Begin FWRefMan page/H1@>@(@<Scanner_type_vskip HEADING@>@)
2457 @<XX@>@(vertical@,skip@)@<XX@>@(pragma@,vskip@)
2458
2459 @<P@>The vertical skip pragma is a typesetting pragma that
2460 instructs Weave to insert a specified amount of vertical
2461 space into the documentation. The pragma has the following
2462 syntax.
2463
2464 @<P@>
2465 @<Begin verbatim@>
2466 ftd_vskip = ts "vskip" s number s "mm"
2467 @<End verbatim@>
2468
2469 @<P@>For example:
2470
2471 @<P@>
2472 @<Begin verbatim@>
2473 @@t vskip 26 mm
2474 @<End verbatim@>
2475
2476 @<Nav@>@(@<Scanner_type_contents FILE@>@,@<Scanner FILE@>@,@<Scanner_type_title FILE@>@)
2477
2478 @<End FWRefMan page@>
2479 @}
2480
2481 @!==============================================================================
2482
2483 @$@<Scanner_type_title HEADING@>@M@{@<SH@>@(3.20@)Title@}
2484 @$@<Scanner_type_title FILE@>@M@{scanner_type_title.html@}
2485 @O@<scanner_type_title.html@>@{@-
2486 @<Begin FWRefMan page/H1@>@(@<Scanner_type_title HEADING@>@)
2487 @<X@>@(title@)@<XX@>@(pragma@,title@)
2488
2489 @<P@>The title pragma is a typesetting pragma with the following syntax.
2490
2491 @<P@>
2492 @<Begin verbatim@>
2493 ftd_title = ts "title" s font s alignment text
2494 font = "normalfont" | "titlefont" |
2495 "smalltitlefont"
2496 alignment = "left" | "centre" | "right"
2497 text = """" { printable_char } """"
2498 @<End verbatim@>
2499
2500 @<P@>It's effect is to instruct Weave to insert a single
2501 line into the printed documentation containing the specified
2502 text set in the specified font and aligned in the specified
2503 manner. The double quotes delimiting the text are for show
2504 only; if you want to put a double quote in the string, you
2505 don't need to double them.
2506
2507 @<P@>Here is an example of the pragma.
2508
2509 @<P@>
2510 @<Begin verbatim@>
2511 @@t title smalltitlefont centre "How to Flip a Bit"
2512 @<End verbatim@>
2513
2514 @<Nav@>@(@<Scanner_type_vskip FILE@>@,@<Scanner FILE@>@,@<Scanner_parser FILE@>@)
2515
2516 @<End FWRefMan page@>
2517 @}
2518
2519 @!==============================================================================
2520
2521 @$@<Scanner_parser HEADING@>@M@{@<SH@>@(3.21@)Scanner/Parser Interface@}
2522 @$@<Scanner_parser FILE@>@M@{scanner_parser.html@}
2523 @O@<scanner_parser.html@>@{@-
2524 @<Begin FWRefMan page/H1@>@(@<Scanner_parser HEADING@>@)
2525 @<X@>@(title@)@<XX@>@(pragma@,title@)
2526
2527 @<P@>If the scanner terminates without any errors, control
2528 is passed to the parser. The parser parses the token list
2529 generated by the scanner. The token list consists of text
2530 scraps, freestanding typesetter directives, and special
2531 sequence tokens.
2532
2533 @<P@>The user should bear in mind that @<I@>@(the scanner
2534 finishes running before the parser starts running.@) This
2535 means that the scanner cannot be influenced in any way by
2536 higher order structures such as the parser might parse. For
2537 example, it is impossible to write a FunnelWeb macro to
2538 include a file, or to write a macro that inserts a
2539 @<TT@>@(vskip@) pragma into the input text.
2540
2541 @<Nav/last@>@(@<Scanner_type_title FILE@>@,@<Scanner FILE@>@,@<Scanner FILE@>@)
2542
2543 @<End FWRefMan page@>
2544 @}
2545
2546 @!******************************************************************************
2547
2548 @$@<Parser HEADING@>@M@{@<SH@>@(4@)Parser@}
2549 @$@<Parser HEADING/short@>@M@{@<SH@>@(4@)Parser@}
2550 @$@<Parser FILE@>@M@{parser.html@}
2551 @O@<parser.html@>@{@-
2552 @<Begin FWRefMan page/H1@>@(@<Parser HEADING@>@)
2553
2554 @<P@>
2555 @<Parser index@>
2556
2557 @<Nav@>@(@<Scanner FILE@>@,@<Index FILE@>@,@<Analyser FILE@>@)
2558
2559 @<End FWRefMan page@>
2560 @}
2561
2562 @$@<Parser index@>@M@{
2563 @<Begin size3@>
2564 @<Begin indent/narrow@>
2565 @<Link@>@(@<Parser_introduction FILE@>@,@<Parser_introduction HEADING@>@)@<BR@>
2566 @<Link@>@(@<Parser_structure FILE@>@,@<Parser_structure HEADING@>@)@<BR@>
2567 @<Link@>@(@<Parser_freetext FILE@>@,@<Parser_freetext HEADING@>@)@<BR@>
2568 @<Link@>@(@<Parser_type FILE@>@,@<Parser_type HEADING@>@)@<BR@>
2569 @<Link@>@(@<Parser_type_section FILE@>@,@<Parser_type_section HEADING@>@)@<BR@>
2570 @<Link@>@(@<Parser_type_literal FILE@>@,@<Parser_type_literal HEADING@>@)@<BR@>
2571 @<Link@>@(@<Parser_type_emphasis FILE@>@,@<Parser_type_emphasis HEADING@>@)@<BR@>
2572 @<Link@>@(@<Parser_macros FILE@>@,@<Parser_macros HEADING@>@)@<BR@>
2573 @<Link@>@(@<Parser_macros_name FILE@>@,@<Parser_macros_name HEADING@>@)@<BR@>
2574 @<Link@>@(@<Parser_macros_params FILE@>@,@<Parser_macros_params HEADING@>@)@<BR@>
2575 @<Link@>@(@<Parser_expressions FILE@>@,@<Parser_expressions HEADING@>@)@<BR@>
2576 @<Link@>@(@<Parser_macro_calls FILE@>@,@<Parser_macro_calls HEADING@>@)@<BR@>
2577 @<Link@>@(@<Parser_parameters FILE@>@,@<Parser_parameters HEADING@>@)@<BR@>
2578 @<Link@>@(@<Parser_static FILE@>@,@<Parser_static HEADING@>@)@<BR@>
2579 @<End indent/narrow@>
2580 @<End size3@>
2581 @}
2582
2583 @!==============================================================================
2584
2585 @$@<Parser_introduction HEADING@>@M@{@<SH@>@(4.1@)Introduction@}
2586 @$@<Parser_introduction FILE@>@M@{parser_introduction.html@}
2587 @O@<parser_introduction.html@>@{@-
2588 @<Begin FWRefMan page/H1@>@(@<Parser_introduction HEADING@>@)
2589
2590 @<P@>By the time the parser starts, the scanner has
2591 completely terminated. At this point, it is not possible for
2592 any more files to be included, and special characters are
2593 no longer present to confuse things. All that remains is a
2594 list of @<NewTerm@>@(text tokens@), @<NewTerm@>@(special
2595 tokens@), and @<NewTerm@>@(typesetter directive tokens@).
2596 Text tokens consist entirely of sequences of printable
2597 characters and end of line markers. Special tokens
2598 represent the special sequences that the scanner found in
2599 the input file. Typesetter directive tokens represent the
2600 freestanding typesetter directives that the scanner
2601 encountered. The parser consumes the token list and builds a
2602 macro table that is later used to generate product files. It
2603 also constructs a document list that is used to generate the
2604 documentation file.
2605
2606 @<P@>The syntax rules appearing in the following sections
2607 refer to the token list.
2608
2609 @<Nav/first@>@(@<Parser FILE@>@,@<Parser FILE@>@,@<Parser_structure FILE@>@)
2610
2611 @<End FWRefMan page@>
2612 @}
2613
2614 @!==============================================================================
2615
2616 @$@<Parser_structure HEADING@>@M@{@<SH@>@(4.2@)High Level Structure@}
2617 @$@<Parser_structure FILE@>@M@{parser_structure.html@}
2618 @O@<parser_structure.html@>@{@-
2619 @<Begin FWRefMan page/H1@>@(@<Parser_structure HEADING@>@)
2620 @<XX@>@(syntax@,high level@)
2621
2622 @<P@>At the highest level, the FunnelWeb parser parses the
2623 input file (token list) into a sequence of text scraps,
2624 macro definitions, and typesetter directives.
2625
2626 @<P@>
2627 @<Begin verbatim@>
2628 input_file = { text | macro | directive }
2629 @<End verbatim@>
2630
2631 @<P@>All three of these kinds of components contribute to
2632 the documentation file, but only macro definitions
2633 contribute to the product files. If all the free text and
2634 directives were removed from a FunnelWeb input file, the
2635 product files would not be affected.
2636
2637 @<Nav@>@(@<Parser_introduction FILE@>@,@<Parser FILE@>@,@<Parser_freetext FILE@>@)
2638
2639 @<End FWRefMan page@>
2640 @}
2641
2642 @!==============================================================================
2643
2644 @$@<Parser_freetext HEADING@>@M@{@<SH@>@(4.3@)Free Text@}
2645 @$@<Parser_freetext FILE@>@M@{parser_freetext.html@}
2646 @O@<parser_freetext.html@>@{@-
2647 @<Begin FWRefMan page/H1@>@(@<Parser_freetext HEADING@>@)
2648 @<XX@>@(free@,text@)
2649
2650 @<P@>@<NewTerm@>@(Free text@) is any text that is not part
2651 of a macro definition or a directive. A scrap of free text
2652 consists of a sequence of items drawn from the following
2653 list: non-special printable characters, insert-eol special
2654 sequences, insert special character special sequences,
2655 insert arbitrary character special sequence.
2656
2657 @<P@>
2658 @<Begin verbatim@>
2659 free_text = ordinary_text
2660 ordinary_text = { ordinary_char | eol | text_special }+
2661 text_special = "@@+" | "@@@@" | "@@^" char_spec
2662 ordinary_char = " ".."~" - special
2663 @<End verbatim@>
2664
2665 @<P@>An example of some rather messy free text is as
2666 follows:
2667
2668 @<Begin verbatim@>
2669 This@@@@ is a very@@+ messy
2670 @@^D(009)chunk of text indeed.
2671 But FunnelWeb still views it as
2672 a single chunk of text.
2673 @<End verbatim@>
2674
2675 @<P@>FunnelWeb never sees two text chunks next to each other
2676 in the input; they are always merged into a single text
2677 token.
2678
2679 @<P@>The free text in an input file does not affect the
2680 product files. However, by default, it appears in the
2681 printed documentation exactly as it is given in the input
2682 file, except that it is filled and justified into
2683 paragraphs.
2684
2685 @<P@>Any printable character or particular sequence of
2686 characters may appear in the free text of a document.
2687 FunnelWeb ensures that they will appear exactly as given in
2688 the input file, even if they happen to be escape characters
2689 or commands in the target typesetter. However, FunnelWeb
2690 also provides a special mode that allows this censoring to
2691 be overridden.
2692
2693 @<Nav@>@(@<Parser_structure FILE@>@,@<Parser FILE@>@,@<Parser_type FILE@>@)
2694
2695 @<End FWRefMan page@>
2696 @}
2697
2698 @!==============================================================================
2699
2700 @$@<Parser_type HEADING@>@M@{@<SH@>@(4.4@)Typesetter Directives@}
2701 @$@<Parser_type FILE@>@M@{parser_type.html@}
2702 @O@<parser_type.html@>@{@-
2703 @<Begin FWRefMan page/H1@>@(@<Parser_type HEADING@>@)
2704
2705 @<P@>FunnelWeb provides a variety of typesetter directives
2706 to assist the user to typeset the document in a
2707 typesetter-independent way. These are divided into
2708 @<NewTerm@>@(freestanding typesetter directives@) (ftd) and
2709 @<NewTerm@>@(inline typesetter directives@) (itd). The
2710 internal syntax of the freestanding typesetter directives
2711 has already been discussed in the scanner section. The
2712 following syntax rule defines the context in which these
2713 constructs can appear.
2714
2715 @<P@>
2716 @<Begin verbatim@>
2717 directive = ftd | itd
2718 itd = section | literal | emphasis
2719 @<End verbatim@>
2720
2721 @<P@>The remainder of this section describes the inline
2722 typesetter directives.
2723
2724 @<Nav@>@(@<Parser_freetext FILE@>@,@<Parser FILE@>@,@<Parser_type_section FILE@>@)
2725
2726 @<End FWRefMan page@>
2727 @}
2728
2729 @!==============================================================================
2730
2731 @$@<Parser_type_section HEADING@>@M@{@<SH@>@(4.5@)Section Directive@}
2732 @$@<Parser_type_section FILE@>@M@{parser_type_section.html@}
2733 @O@<parser_type_section.html@>@{@-
2734 @<Begin FWRefMan page/H1@>@(@<Parser_type_section HEADING@>@)
2735 @<XX@>@(section@,constructs@)
2736
2737 @<P@>The section directive provides a way for the user to
2738 structure the program and documentation into a hierarchical
2739 tree structure,@<XX@>@(tree@,structure@) just as in most
2740 large documents. A section construct consists of a
2741 case-insensitive identifying letter, which determines the
2742 absolute level of the section in the document, and an
2743 optional section name, which has exactly the same syntax as
2744 a macro name.
2745
2746 @<P@>
2747 @<Begin verbatim@>
2748 section = "@@" levelchar [name]
2749 levelchar = "A" | "B" | "C" | "D" | "E" |
2750 "a" | "b" | "c" | "d" | "e"
2751 @<End verbatim@>
2752
2753 @<P@>The section construct is not quite @<DQ@>@(inline@), as
2754 it must appear only at the start of a line. However, unlike
2755 the @<DQP@>@(@@i@), @<DQP@>@(@@p@), and @<DQP@>@(@@t@)
2756 constructs, it does not consume the remainder of the line
2757 (although it would be silly to place anything on the same
2758 line anyway).
2759
2760 @<P@>FunnelWeb provides five levels of sections, ranging
2761 from the highest level of @<TT@>@(A@) (like a
2762 LaTeX@<X@>@(LaTeX@) chapter) to the lowest level of
2763 @<TT@>@(E@) (like a LaTeX subsubsubsection). FunnelWeb
2764 input files need not contain any sections at all, but if
2765 they do, the first section must be at level @<TT@>@(A@), and
2766 following sections must not skip hierarchical levels
2767 (@<eg@>an @<TT@>@(@@E@) cannot follow an @<TT@>@(@@C@)).
2768 FunnelWeb generates an error if a level is skipped.
2769
2770 @<P@>All section @<I@>@(must@) have names associated with
2771 them, but for convenience, the section name is optional if
2772 the section contains one or more macro definitions (@<ie@>at
2773 least one macro definition appears between the section
2774 construct in question and the next section construct in the
2775 input file.). In this case, the section @<I@>@(inherits@)
2776 the name of the first macro defined in the section. This
2777 feature streamlines the input file, avoiding duplicate name
2778 inconsistencies.
2779
2780 @<P@>Any sequence of printable characters can be used in the
2781 section name,@<XX@>@(section@,name@) even the target
2782 typesetter's escape sequence (@<eg@>in TeX,
2783 @<DQP@>@(\@)).
2784
2785 @<P@>The following example demonstrates the section
2786 construct.
2787
2788 @<P@>
2789 @<Begin verbatim@>
2790 @@A@@@<<@>Life Simulation@@@<>@>
2791
2792 This is the main simulation module for planet
2793 earth, simulated down to the molecular level. This
2794 is a REALLY big program. I mean really big. I
2795 mean, if you thought the X-Windows source code was
2796 big, you're in for a shock...
2797
2798 @@B We start by looking at the code for six legged
2799 stick insects as they form a good example of a
2800 typical object-oriented animal implementation.
2801
2802 @@$@@@<<@>Six Legged Stick Insects@@@<>@>@@{@@-
2803 slsi.creep; slsi.crawl; slsi.creep;@@}
2804 @<End verbatim@>
2805
2806 @<P@>In the above example, the name for the level A
2807 section is provided explicitly, while the name for
2808 the level B section will be inherited from the
2809 macro name.
2810
2811 @<Nav@>@(@<Parser_type FILE@>@,@<Parser FILE@>@,@<Parser_type_literal FILE@>@)
2812
2813 @<End FWRefMan page@>
2814 @}
2815
2816 @!==============================================================================
2817
2818 @$@<Parser_type_literal HEADING@>@M@{@<SH@>@(4.6@)Literal Directive@}
2819 @$@<Parser_type_literal FILE@>@M@{parser_type_literal.html@}
2820 @O@<parser_type_literal.html@>@{@-
2821 @<Begin FWRefMan page/H1@>@(@<Parser_type_literal HEADING@>@)
2822 @<XX@>@(literal@,directive@)
2823
2824 @<P@>Experience has shown that one of the most common
2825 typesetting requirements is that of being able to typeset
2826 small program fragments in the middle of the documenting
2827 free text. Typically there is a frequent need to refer to
2828 program identifiers, and it assists the reader to have such
2829 identifiers typeset in the same manner as the program text
2830 in the macro definition.
2831
2832 @<P@>To specify that some text be typeset in @<TT@>@(tt
2833 font@), enclose the text in curly brace special sequences as
2834 follows.
2835
2836 @<P@>
2837 @<Begin verbatim@>
2838 literal = "@@{" ordinary_text "@@}"
2839 @<End verbatim@>
2840
2841 @<P@>As in macro names, section names, and macro bodies, the
2842 text contained within the literal construct is protected by
2843 FunnelWeb from any non-literal interpretation by the
2844 typesetter and the user is free to enclose @<I@>@(any@) text
2845 covered by the definition @<TT@>@(ordinary_text@).
2846 FunnelWeb guarantees that, no matter what the text is, it
2847 will be typeset in @<TT@>@(tt font@) exactly as it appears.
2848 However, the text will be filled and justified into a
2849 paragraph as usual.
2850
2851 @<P@>Here is an example of the use of the construct:
2852
2853 @<P@>
2854 @<Begin verbatim@>
2855 @@C The @@{WOMBAT@@} (Waste Of Money, Brains, And
2856 Time) function calls the @@{kangaroo@@} input
2857 function which has been known to cause keybounce.
2858 This keybounce can be dampened using the
2859 @@{wet_sloth@@} subsystem.
2860 @<End verbatim@>
2861
2862 @<Nav@>@(@<Parser_type_section FILE@>@,@<Parser FILE@>@,@<Parser_type_emphasis FILE@>@)
2863
2864 @<End FWRefMan page@>
2865 @}
2866
2867 @!==============================================================================
2868
2869 @$@<Parser_type_emphasis HEADING@>@M@{@<SH@>@(4.7@)Emphasis Directive@}
2870 @$@<Parser_type_emphasis FILE@>@M@{parser_type_emphasis.html@}
2871 @O@<parser_type_emphasis.html@>@{@-
2872 @<Begin FWRefMan page/H1@>@(@<Parser_type_emphasis HEADING@>@)
2873 @<XX@>@(emphasis@,directive@)
2874
2875 @<P@>The emphasis directive is very similar to the literal
2876 directive except that it causes its argument to be typeset
2877 in an emphasised manner (@<eg@>italics). Like the literal
2878 directive, the emphasis directive protects its text
2879 argument.
2880
2881 @<P@>
2882 @<Begin verbatim@>
2883 emphasise = "@@/" ordinary_text "@@/"
2884 @<End verbatim@>
2885
2886 @<P@>Example:
2887
2888 @<P@>
2889 @<Begin verbatim@>
2890 @@C What you @@/really@@/ need, of course, is a
2891 @@/great@@/, @@/big@@/, network with packets just
2892 flying @@/everywhere@@/. This section implements an
2893 interface to such a @@/humungeous@@/ network.
2894 @<End verbatim@>
2895
2896 @<Nav@>@(@<Parser_type_literal FILE@>@,@<Parser FILE@>@,@<Parser_macros FILE@>@)
2897
2898 @<End FWRefMan page@>
2899 @}
2900
2901 @!==============================================================================
2902
2903 @$@<Parser_macros HEADING@>@M@{@<SH@>@(4.8@)Macros@}
2904 @$@<Parser_macros FILE@>@M@{parser_macros.html@}
2905 @O@<parser_macros.html@>@{@-
2906 @<Begin FWRefMan page/H1@>@(@<Parser_macros HEADING@>@)
2907
2908 @<P@>The third category of construct appearing at the
2909 highest syntactic level in a FunnelWeb input file is the
2910 macro definition. A macro definition binds a unique
2911 @<NewTerm@>@(macro name@) to a @<NewTerm@>@(macro body@)
2912 containing an @<NewTerm@>@(expression@) consisting of text,
2913 calls to other macros, and formal parameters. The syntax for
2914 a macro definition is as follows:
2915
2916 @<P@>
2917 @<Begin verbatim@>
2918 macro = ("@@O" | "@@$") name [formal_parameter_list]
2919 ["@@Z"] ["@@M"] { "@@L" } ["==" | "+="]
2920 "@@{" expression "@@}"
2921 @<End verbatim@>
2922
2923 @<P@>The complexity of the macro definition syntax is mostly
2924 to enable the user to attach various attributes to the
2925 macro.@<XX@>@(macro@,attributes@) If the user chooses
2926 @<TT@>@(@@O@), then the macro cannot be called, but is
2927 instead attached to a product file. If the user chooses
2928 @<TT@>@(@@$@), then the macro is an ordinary macro definition
2929 that is not attached to a file. Here are some example macro
2930 definitions.
2931
2932 @<P@>
2933 @<Begin verbatim@>
2934 @@O@@@<<@>example.txt@@@<>@>@@{This is an @@@<<@>ugly duckling@@@<>@>.@@}
2935
2936 @@$@@@<<@>ugly duckling@@@<>@>@@M@@{swan@@}
2937 @<End verbatim@>
2938
2939 @<FWRefMan subheading@>@(Number Of Invocations Constraint@)
2940
2941 @<P@>By default, a non-file macro must be invoked exactly
2942 once by one other macro. Macros that aren't are flagged with
2943 errors by the FunnelWeb analyser. However, if the user uses
2944 the @<TT@>@(@@Z@)@<X@>@(@@Z@) sequence in the macro
2945 definition, the macro is then permitted to be invoked zero
2946 times, as well as once. Similarly, if the user uses the
2947 @<TT@>@(@@M@)@<X@>@(@@M@) sequence in the macro definition,
2948 the macro is permitted to be called many times as well as
2949 once. If both @<TT@>@(@@Z@) and @<TT@>@(@@M@) are present then
2950 the macro is permitted to be invoked zero, one, or many
2951 times.
2952
2953 @<P@>The purpose of enforcing the default @<DQ@>@(exactly
2954 one call@) rule is to flag pieces of code that the user may
2955 have defined in a macro but not hooked into the rest of the
2956 program. Experience shows that this is a common error.
2957 Similarly, it can be dangerous to multiply invoke a macro
2958 intended to be invoked only once. For example, it may be
2959 dangerous to invoke a scrap of non-idempotent initialization
2960 code in two different parts of the main function of a
2961 program! However, FunnelWeb will not generate an error if a
2962 macro without @<TT@>@(@@M@) is called by another macro that
2963 is called more than once.
2964
2965 @<FWRefMan subheading@>@(Additive Macros@)
2966
2967 @<P@>If the text string @<TT@>@(==@)@<X@>@(==@) (or nothing)
2968 follows the macro name, the expression that follows is the
2969 entire text of the macro body. If the text string
2970 @<TT@>@(+=@)@<X@>@(+=@) follows the macro name, then more
2971 than one such definition is allowed (but not required) in
2972 the document and the body of the macro consists of the
2973 concatenation of all such expressions in the order in which
2974 they occur in the input file. Such a macro is said to be
2975 additive and is @<NewTerm@>@(additively defined@). Thus a
2976 macro body can either be defined in one place using one
2977 definition (using @<TT@>@(==@)) or it can be
2978 @<I@>@(distributed@) throughout the input file in a sequence
2979 of one or more macro definitions (using @<TT@>@(+=@)). If
2980 neither @<TT@>@(==@) and @<TT@>@(+=@) are present, FunnelWeb
2981 assumes a default of @<TT@>@(==@).
2982
2983 @<P@>Macros attached to product files cannot be additively
2984 defined. Additively defined macros can have parameter lists
2985 and @<TT@>@(@@Z@) and @<TT@>@(@@M@) attributes, but these must
2986 be specified only in the first definition of the macro.
2987 However, @<TT@>@(+=@) must appear in each definition.
2988
2989 @<FWRefMan subheading@>@(Library Macros@)
2990
2991 @<P@>An ordinary macro definition can have from zero to five
2992 @<TT@>@(@@L@) library level markers. These define the macro
2993 definition's library level. A macro having a particular name
2994 may be defined up to once at each library level, and each
2995 such definition may be multipart (additive). At tangle time,
2996 the definition having the lowest library level is used, with
2997 all other definitions of the same name being completely
2998 ignored. This feature allows the creation of general-purpose
2999 include files that contain macro definitions that can be
3000 overridden by definitions of the same name in the including
3001 file. Similarly, it allows the creation of include files
3002 containing macro definitions that override definitions in
3003 the including file. How you use the library macro feature
3004 is up to you.
3005
3006 @<P@>In the example below, the ugly duckling macro will
3007 be expanded to @<TT@>@(swan@) because the swan definition
3008 has the lowest library level.
3009
3010 @<P@>
3011 @<Begin verbatim@>
3012 @@$@@@<<@>ugly duckling@@@<>@>@@M@@L@@L@@{egg@@}
3013 @@$@@@<<@>ugly duckling@@@<>@>@@M@@{swan@@}
3014 @@$@@@<<@>ugly duckling@@@<>@>@@M@@L@@{signet@@}
3015 @<End verbatim@>
3016
3017 @<P@>Note that the library macro facility imposes no
3018 requirement on the order of appearance of the various macros
3019 of the same name; all that matters is the library level.
3020 This means that macros defined in an include file that is
3021 included at the @<I@>@(end@) of a main file can be
3022 overridden by macros appearing earlier in the main file.
3023
3024 @<Nav@>@(@<Parser_type_emphasis FILE@>@,@<Parser FILE@>@,@<Parser_macros_name FILE@>@)
3025
3026 @<End FWRefMan page@>
3027 @}
3028
3029 @!==============================================================================
3030
3031 @$@<Parser_macros_name HEADING@>@M@{@<SH@>@(4.9@)Macro Names@}
3032 @$@<Parser_macros_name FILE@>@M@{parser_macros_name.html@}
3033 @O@<parser_macros_name.html@>@{@-
3034 @<Begin FWRefMan page/H1@>@(@<Parser_macros_name HEADING@>@)
3035 @<X@>@(names@)@<XX@>@(macro@,names@)@<XX@>@(section@,names@)
3036
3037 @<P@>Names are used to identify macros and sections. A name
3038 consists of a sequence of from zero to 80 printable
3039 characters, including the blank character. End of line
3040 characters are not permitted in names. Names are case
3041 sensitive; two different macros are permitted to have names
3042 that differ in case only. Like free text, names are typeset
3043 by FunnelWeb and are safe from misinterpretation by the
3044 target typesetter. For example, it is quite acceptable to
3045 use the macro name @<TT@>@(@@<\medskip@@>@) even if the
3046 target typesetter is TeX.
3047
3048 @<P@>
3049 @<Begin verbatim@>
3050 name = "@@<" name_text "@@>"
3051 name_text = { ordinary_char | text_special }
3052 @<End verbatim@>
3053
3054 @<Nav@>@(@<Parser_macros FILE@>@,@<Parser FILE@>@,@<Parser_macros_params FILE@>@)
3055
3056 @<End FWRefMan page@>
3057 @}
3058
3059 @!==============================================================================
3060
3061 @$@<Parser_macros_params HEADING@>@M@{@<SH@>@(4.10@)Formal Parameter Lists@}
3062 @$@<Parser_macros_params FILE@>@M@{parser_macros_params.html@}
3063 @O@<parser_macros_params.html@>@{@-
3064 @<Begin FWRefMan page/H1@>@(@<Parser_macros_params HEADING@>@)
3065 @<XX@>@(parameter lists@,formal@)
3066
3067 @<P@>FunnelWeb allows macros to have up to nine macro
3068 parameters, named @<TT@>@(@@1@),@<X@>@(@@1...@) @<TT@>@(@@2@),
3069 @<LDots@>, @<TT@>@(@@9@). If a macro does not have a formal
3070 parameter list, it is defined to have no parameters, and an
3071 actual parameter list must not appear at the point of call.
3072 If a macro has a formal parameter list, it is defined to
3073 have one or more parameters, and a corresponding actual
3074 parameter must be supplied for each formal parameter, at the
3075 point of call.
3076
3077 @<P@>Because FunnelWeb parameters have predictable names,
3078 the only information that a formal parameter list need
3079 convey is @<I@>@(how many@) parameters a macro has. For this
3080 reason a formal parameter list takes the form of the highest
3081 numbered formal parameter desired, enclosed in parentheses
3082 sequences.
3083
3084 @<P@>
3085 @<Begin verbatim@>
3086 formal_parameter_list = "@@(" formal_parameter "@@)".
3087 formal_parameter = "@@1" | "@@2" | "@@3" | "@@4" | "@@5" |
3088 "@@6" | "@@7" | "@@8" | "@@9"
3089 @<End verbatim@>
3090
3091 @<Nav@>@(@<Parser_macros_name FILE@>@,@<Parser FILE@>@,@<Parser_expressions FILE@>@)
3092
3093 @<End FWRefMan page@>
3094 @}
3095
3096 @!==============================================================================
3097
3098 @$@<Parser_expressions HEADING@>@M@{@<SH@>@(4.11@)Expressions@}
3099 @$@<Parser_expressions FILE@>@M@{parser_expressions.html@}
3100 @O@<parser_expressions.html@>@{@-
3101 @<Begin FWRefMan page/H1@>@(@<Parser_expressions HEADING@>@)
3102 @<XX@>@(macro@,expressions@)
3103
3104 @<P@>Expressions are FunnelWeb's most powerful form of
3105 expressing a text string. Macro bodies are defined as
3106 expressions. Actual parameters consist of expressions.
3107
3108 @<P@>An expression consists of a sequence of zero or more
3109 expression elements. An expression element can be ordinary
3110 text, a macro call, or a formal parameter of the macro
3111 @<I@>@(definition@) in which the formal parameter occurs.
3112
3113 @<P@>
3114 @<Begin verbatim@>
3115 expression = { ordinary_text | macro_call |
3116 formal_parameter }
3117 @<End verbatim@>
3118
3119 @<Nav@>@(@<Parser_macros_params FILE@>@,@<Parser FILE@>@,@<Parser_macro_calls FILE@>@)
3120
3121 @<End FWRefMan page@>
3122 @}
3123
3124 @!==============================================================================
3125
3126 @$@<Parser_macro_calls HEADING@>@M@{@<SH@>@(4.12@)Macro Calls@}
3127 @$@<Parser_macro_calls FILE@>@M@{parser_macro_calls.html@}
3128 @O@<parser_macro_calls.html@>@{@-
3129 @<Begin FWRefMan page/H1@>@(@<Parser_macro_calls HEADING@>@)
3130 @<XX@>@(macro@,calls@)
3131
3132 @<P@>A macro call consists of a name optionally followed
3133 by an actual parameter list. The number of parameters in
3134 the actual parameter list must be the same as the number
3135 of formal parameters specified in the definition of the
3136 macro. If the macro has no formal parameter list, its call
3137 must have no actual parameter list.
3138
3139 @<P@>
3140 @<Begin verbatim@>
3141 macro_call = name [actual_parameter_list]
3142 actual_parameter_list =
3143 "@@(" actpar { "@@," actpar } "@@)"
3144 actpar = expression |
3145 ( whitespace "@@""" expression
3146 "@@""" whitespace )
3147 whitespace = {" " | eol }
3148 @<End verbatim@>
3149
3150 @<P@>FunnelWeb allows parameters to be passed directly, or
3151 delimited by special double quotes.@<XX@>@(macro
3152 parameter@,delimiting@) Each form is useful under different
3153 circumstances. Direct specification is useful where the
3154 parameters are short and can be all placed on one line.
3155 Double quoted parameters allow whitespace on either side
3156 (that is not considered part of the parameter) and are
3157 useful for laying out rather messy parameters. Here are
3158 examples of the two forms.
3159
3160 @<P@>
3161 @<Begin verbatim@>
3162 @@@<<@>Generic Loop@@@<>@>@@(
3163 @@"x:=1;@@" @@,
3164 @@"x<=10;@@" @@,
3165 @@"print "x=%u, x^2=%u",x,x*x;
3166 x:=x+1;@@+@@"
3167 @@)
3168
3169 @@@<<@>Colours@@@<>@>@@(red@@,green@@,blue@@,yellow@@)
3170 @<End verbatim@>
3171
3172 @<P@>The two forms may be mixed within the same
3173 parameter list.
3174
3175 @<P@>Experience has shown that, in most FunnelWeb files,
3176 the vast majority of macros have no parameters.
3177
3178 @<Nav@>@(@<Parser_expressions FILE@>@,@<Parser FILE@>@,@<Parser_parameters FILE@>@)
3179
3180 @<End FWRefMan page@>
3181 @}
3182
3183 @!==============================================================================
3184
3185 @$@<Parser_parameters HEADING@>@M@{@<SH@>@(4.13@)Macro Formal Parameters@}
3186 @$@<Parser_parameters FILE@>@M@{parser_parameters.html@}
3187 @O@<parser_parameters.html@>@{@-
3188 @<Begin FWRefMan page/H1@>@(@<Parser_parameters HEADING@>@)
3189 @<XX@>@(formal@,parameters@)
3190
3191 @<P@>Formal parameters can appear in the expressions forming
3192 macro bodies in accordance with the syntax rules defined
3193 above. A formal parameter expands to the text of the
3194 expansion of its corresponding actual parameter. There is
3195 nothing preventing a formal parameter being provided as part
3196 of an expression that forms an actual parameter. In that
3197 happens, the formal parameter is bound to the actual
3198 parameter of the calling macro, not the called macro. After
3199 the following definitions,
3200
3201 @<P@>
3202 @<Begin verbatim@>
3203 @@$@@@<<@>One@@@<>@>@@(@@1@@)=@@{A walrus in @@1 is a walrus in vain.@@}
3204 @@$@@@<<@>Two@@@<>@>@@(@@1@@)=@@{@@@<<@>One@@@<>@>@@(S@@1n@@)@@}
3205 @<End verbatim@>
3206
3207 @<P@>the call
3208
3209 @<P@>
3210 @<Begin verbatim@>
3211 @@@<<@>Two@@@<>@>@@(pai@@)
3212 @<End verbatim@>
3213
3214 @<P@>will result in the expansion
3215
3216 @<P@>
3217 @<Begin verbatim@>
3218 A walrus in Spain is a walrus in vain.
3219 @<End verbatim@>
3220
3221 @<Nav@>@(@<Parser_macro_calls FILE@>@,@<Parser FILE@>@,@<Parser_static FILE@>@)
3222
3223 @<End FWRefMan page@>
3224 @}
3225
3226 @!==============================================================================
3227
3228 @$@<Parser_static HEADING@>@M@{@<SH@>@(4.14@)Macros Are Static@}
3229 @$@<Parser_static FILE@>@M@{parser_static.html@}
3230 @O@<parser_static.html@>@{@-
3231 @<Begin FWRefMan page/H1@>@(@<Parser_static HEADING@>@)
3232 @<XX@>@(macro@,definition@)@<XX@>@(macro@,expansion@)@<XX@>@(macros@,static@)
3233
3234 @<P@>In FunnelWeb, the actions of @<I@>@(macro definition@)
3235 and @<I@>@(macro expansion@) occur during two separate
3236 phases (parser and tangle) and cannot be interleaved. As a
3237 result, the FunnelWeb macro facility is completely static.
3238 It is not possible for one macro to define another while the
3239 first macro is being expanded; each must be defined
3240 statically. It is not possible to define a macro to even
3241 assist in the definition of other macros. Because the
3242 scanner, parser, analyser, and tangler phases are all
3243 invoked sequentially, there is no room for feedback of
3244 definitions between different levels (@<eg@>the user cannot
3245 define a macro for the @<TT@>@(vskip@) pragma).
3246
3247 @<P@>This lack of power is fully intentional. By totally
3248 excluding the more incomprehensible ways in which a general
3249 purpose macro preprocessor can be used, FunnelWeb provides
3250 definite guarantees to the reader of its input files:
3251
3252 @<P@>
3253 @<Begin list@>
3254
3255 @<Item@>FunnelWeb guarantees that a piece of text does not
3256 contain a macro call unless it contains the special
3257 character followed by @<TT@>@(@<<@>@) or @<TT@>@(#@).
3258
3259 @<Item@>FunnelWeb allows calls to be made to macros that are
3260 defined later in the input file.
3261
3262 @<End list@>
3263
3264 @<Nav/last@>@(@<Parser_parameters FILE@>@,@<Parser FILE@>@,@<Parser FILE@>@)
3265
3266 @<End FWRefMan page@>
3267 @}
3268
3269 @!******************************************************************************
3270
3271 @$@<Analyser HEADING@>@M@{@<SH@>@(5@)Analyser@}
3272 @$@<Analyser HEADING/short@>@M@{@<SH@>@(5@)Analyser@}
3273 @$@<Analyser FILE@>@M@{analyser.html@}
3274 @O@<analyser.html@>@{@-
3275 @<Begin FWRefMan page/H1@>@(@<Analyser HEADING@>@)
3276 @<X@>@(analyser@)@<XX@>@(checks@,macro@)
3277
3278 @<P@>The effect of the parser is to construct a macro table
3279 containing a representation of all the macros defined within
3280 the document, and a document list which contains a complete
3281 representation of the entire document. If there are no error
3282 diagnostics (or worse) at the end of the parser run,
3283 FunnelWeb invokes the analyser which tests for the following
3284 conditions and flags them with errors if they arise.
3285
3286 @<P@>
3287 @<Begin list@>
3288 @<Item@>No macros defined in the input file.
3289 @<Item@>No macros connected to output files.
3290 @<Item@>Call of an undefined macro.
3291 @<Item@>Call having the wrong number of parameters.
3292 @<Item@>Call of a macro that is connected to an output file.
3293 @<Item@>No calls made to a macro without the @<TT@>@(@@Z@) option.
3294 @<Item@>More than one call made to a macro without the @<TT@>@(@@M@) option.
3295 @<Item@>Directly or indirectly recursively defined macros.
3296 @<Item@>Unnamed sections that contain no macro definitions.
3297 @<End list@>
3298
3299 @<P@>FunnelWeb performs a static
3300 analysis@<XX@>@(static@,analysis@) to detect
3301 recursion.@<XX@>@(macro@,recursion@) Unfortunately, the
3302 recursion detection algorithm flags all macros that have an
3303 infinite expansion rather than just all macros with a
3304 recursive definition. If A calls B, and B calls C, and C
3305 calls B, then FunnelWeb will flag A as well as B and C. It
3306 is hoped that this problem will be fixed in a later version.
3307
3308 @<P@>Because FunnelWeb does not provide any kind of
3309 conditional feature, the prevention of recursion does not
3310 represent a curtailment of expressive power.
3311
3312 @<P@>Macros may be invoked recursively, but may not be
3313 recursive. Thus:
3314
3315 @<P@>
3316 @<Begin verbatim@>
3317 @@! LEGAL recursive invocation.
3318 @@@<<@>Sloth@@@<>@>@@(@@@<<@>Sloth@@@<>@>@@(Walrus@@)@@)
3319
3320 @@! ILLEGAL recursive definition.
3321 @@$@@@<<@>Teapot@@@<>@>==@@{@@@<<@>Teapot@@@<>@>@@}
3322 @<End verbatim@>
3323
3324 @<Nav@>@(@<Parser FILE@>@,@<Index FILE@>@,@<Tangle FILE@>@)
3325
3326 @<End FWRefMan page@>
3327 @}
3328
3329 @!******************************************************************************
3330
3331 @$@<Tangle HEADING@>@M@{@<SH@>@(6@)Tangle@}
3332 @$@<Tangle HEADING/short@>@M@{@<SH@>@(6@)Tangle@}
3333 @$@<Tangle FILE@>@M@{tangle.html@}
3334 @O@<tangle.html@>@{@-
3335 @<Begin FWRefMan page/H1@>@(@<Tangle HEADING@>@)
3336 @<X@>@(tangle@)
3337
3338 @<P@>If the scanner, parser, and analyser have successfully
3339 (@<ie@>with no errors, severe errors, or fatal errors)
3340 completed, and the Tangle option (@<TT@>@(+O@)) is turned on
3341 (it is by default), then the Tangle component of FunnelWeb
3342 is invoked to generate the product files specified in the
3343 @<TT@>@(@@O@) macros of the input file.
3344
3345 @<P@>The operation of Tangle is very simple. Each
3346 @<TT@>@(@@O@) macro is expanded and written to a file of the
3347 same name. As there are a finite number of macros, and the
3348 analyser guarantees that the macro structure is
3349 non-recursive, Tangle is guaranteed to terminate.
3350
3351 @<P@>Three remaining points are worth mentioning.
3352
3353 @<P@>
3354 @<Begin list@>
3355
3356 @<Item@>Tangle expands macros using blank indentation unless
3357 the user has specified otherwise in an indentation pragma in
3358 the input file.
3359
3360 @<Item@>Tangle keeps track of the length of the lines that
3361 it is writing and issues an error if any line of any product
3362 file that it generates is longer than the maximum. The
3363 maximum is the minimum of a value defaulted or specified in
3364 the input file, and the value (if any) provided by the
3365 @<TT@>@(+w@) command line argument.
3366
3367 @<Item@>If there is more than one macro definition of the
3368 same name, then each such definition must have a different
3369 library level (@<TT@>@(@@L@)). Tangle uses the macro
3370 definition that has the lowest library level and ignores
3371 the others completely.
3372
3373 @<End list@>
3374
3375 @<FWRefMan subheading@>@(Memory Use During Tangling@)
3376
3377 @<P@>When FunnelWeb executes, it reads each input file (the
3378 main input file and any include files) into memory where
3379 they are kept for the duration of the run. This means that
3380 there must be room in memory for all of the input files.
3381 This approach is necessary to support FunnelWeb's
3382 unrestricted forward referencing.
3383
3384 @<P@>In contrast, there is no requirement that there be
3385 enough memory to hold the product files, as these are
3386 written to disk sequentially during their expansion.
3387 Furthermore, FunnelWeb does not expand the values of actual
3388 parameters in memory.
3389
3390 @<P@>This means that, so long as the input files fit in
3391 memory, your product files can be arbitrarily large. You can
3392 also pass arbitrary large arguments to FunnelWeb macros.
3393
3394 @<Nav@>@(@<Analyser FILE@>@,@<Index FILE@>@,@<Weave FILE@>@)
3395
3396 @<End FWRefMan page@>
3397 @}
3398
3399 @!******************************************************************************
3400
3401 @$@<Weave HEADING@>@M@{@<SH@>@(7@)Weave@}
3402 @$@<Weave HEADING/short@>@M@{@<SH@>@(7@)Weave@}
3403 @$@<Weave FILE@>@M@{weave.html@}
3404 @O@<weave.html@>@{@-
3405 @<Begin FWRefMan page/H1@>@(@<Weave HEADING@>@)
3406 @<X@>@(weave@)@<X@>@(typesetting@)
3407
3408 @<P@>If the scanner, parser, and analyser have successfully
3409 (@<ie@>with no errors, severe errors, or fatal errors)
3410 completed, and either or both of the two Weave options
3411 (@<TT@>@(+T@), @<TT@>@(U@)) is turned on
3412 (both are @<I@>@(off@) by default), then the Weave component of
3413 FunnelWeb is invoked to generate one or two documentation files.
3414
3415 @<FWRefMan subheading@>@(Target Typesetter@)
3416 @<XX@>@(target@,typesetter@)
3417
3418 @<P@>All versions of FunnelWeb up to V3.1 could generate only
3419 TeX documentation. This used the @<TT@>@(+t@) option. FunnelWeb
3420 V3.2 can now generate HTML documention using the @<TT@>@(+u@)
3421 option. You can generate both at once if you like.
3422
3423 @<FWRefMan subheading@>@(Cross Reference Numbering@)
3424 @<XX@>@(cross@,referencing@)@<XX@>@(cross reference@,numbering@)
3425 @<XX@>@(section@,numbering@)
3426
3427 @<P@>When FunnelWeb produces its typeset documentation, it
3428 @<I@>@(numbers@) each section and each macro definition and
3429 cross references the macro definitions. The exact scheme
3430 used has been carefully thought out. However, as it can be a
3431 little confusing to the beginner, it is explained here in
3432 full.
3433
3434 @<P@>The most important thing is that there is @<I@>@(no
3435 relation@) between the macro numbering and the section
3436 numbering. In Knuth's Web there are only section numbers. In
3437 FunnelWeb, the numbering of sections and macros is
3438 separated.
3439
3440 @<P@>In FunnelWeb, @<I@>@(sections@) are numbered
3441 hierarchically in ascending order. For example, the second
3442 level-C section of the third level-B section of the first
3443 level-A section is numbered @<DQ@>@(1.3.2@). In contrast,
3444 @<I@>@(macro definitions@) are numbered sequentially in
3445 ascending order. For example, the first macro definition is
3446 number 1, the second is number 2, and so on. Note that it is
3447 @<I@>@(macro definitions@) that are numbered, not
3448 @<I@>@(macros@). This distinction is necessary because
3449 additive macros (@<ie@>the ones with @<TT@>@(+=@)) can be
3450 defined by a collection of partial definitions scattered
3451 throughout the input file. A single additive macro may be
3452 defined in definitions 5, 67, 128, and 153.
3453
3454 @<Nav@>@(@<Tangle FILE@>@,@<Index FILE@>@,@<Shell FILE@>@)
3455
3456 @<End FWRefMan page@>
3457 @}
3458
3459 @!******************************************************************************
3460
3461 @$@<Shell HEADING@>@M@{@<SH@>@(8@)FunnelWeb Shell@}
3462 @$@<Shell HEADING/short@>@M@{@<SH@>@(8@)Shell@}
3463 @$@<Shell FILE@>@M@{shell.html@}
3464 @O@<shell.html@>@{@-
3465 @<Begin FWRefMan page/H1@>@(@<Shell HEADING@>@)
3466 @<XX@>@(FunnelWeb@,command shell@)@<XX@>@(commands@,FunnelWeb@)@<XX@>@(FunnelWeb@,shell@)
3467
3468 @<P@>
3469 @<Shell index@>
3470
3471 @<Nav@>@(@<Weave FILE@>@,@<Index FILE@>@,@<Commands FILE@>@)
3472
3473 @<End FWRefMan page@>
3474 @}
3475
3476 @$@<Shell index@>@M@{
3477 @<Begin size3@>
3478 @<Begin indent/narrow@>
3479 @<Link@>@(@<Shell_introduction FILE@>@,@<Shell_introduction HEADING@>@)@<BR@>
3480 @<Link@>@(@<Shell_statuses FILE@>@,@<Shell_statuses HEADING@>@)@<BR@>
3481 @<Link@>@(@<Shell_linelen FILE@>@,@<Shell_linelen HEADING@>@)@<BR@>
3482 @<Link@>@(@<Shell_strsubs FILE@>@,@<Shell_strsubs HEADING@>@)@<BR@>
3483 @<Link@>@(@<Shell_processing FILE@>@,@<Shell_processing HEADING@>@)@<BR@>
3484 @<Link@>@(@<Shell_options FILE@>@,@<Shell_options HEADING@>@)@<BR@>
3485 @<End indent/narrow@>
3486 @<End size3@>
3487 @}
3488
3489 @!==============================================================================
3490
3491 @$@<Shell_introduction HEADING@>@M@{@<SH@>@(8.1@)Introduction@}
3492 @$@<Shell_introduction FILE@>@M@{shell_introduction.html@}
3493 @O@<shell_introduction.html@>@{@-
3494 @<Begin FWRefMan page/H1@>@(@<Shell_introduction HEADING@>@)
3495
3496 @<P@>One of the goals of FunnelWeb is that it must be
3497 extremely portable, and a significant effort has gone into
3498 achieving this.
3499
3500 @<P@>An equally important goal was that of correctness and
3501 reliability. To this end, it was determined that a large
3502 automated suite of test programs be prepared to assist in
3503 regression testing. Preparing the test suite was tedious,
3504 but achievable. Automating it portably was more difficult.
3505
3506 @<P@>The difficulty faced was that if FunnelWeb was
3507 implemented in the form of a utility that could be invoked
3508 from the operating system command language, the only way to
3509 set up regression testing was in the command language of the
3510 operating system of the target machine (shellscripts for
3511 UNIX, DCL for OpenVMS, batch files for MSDOS, and
3512 @<I@>@(nothing@) on the Macintosh). The huge variation in
3513 these command languages led to the conclusion that either
3514 the automation of regression testing would have to be
3515 rewritten on each target machine, or a small command
3516 language would have to be created within FunnelWeb. In the
3517 end, the twin goals of portability and regression testing
3518 were considered so important that a small command shell was
3519 constructed inside FunnelWeb. This is called the
3520 @<NewTerm@>@(FunnelWeb command shell@), or just @<DQ@>@(the
3521 shell@) for short.
3522
3523 @<P@>By default, when FunnelWeb is invoked, it does not
3524 enter its shell. If just given the name of an input file, it
3525 will simple process the input file in the normal manner and
3526 then terminate. To instruct FunnelWeb to invoke its shell,
3527 the @<TT@>@(+K@) or @<TT@>@(+X@) command line option must be
3528 specified when FunnelWeb is invoked from the operating
3529 system. It is also invoked upon startup if the file
3530 @<TT@>@(fwinit.fws@) exists.
3531
3532 @<P@>Most FunnelWeb users will never need to use the shell
3533 and need not even know about it. There are four main uses of
3534 the shell:@<XX@>@(uses@,shell@)
3535
3536 @<Begin list/ordered@>
3537
3538 @<Item@>As a tool to support automated regression testing.
3539
3540 @<Item@>As a development tool on machines that do not have a
3541 built in shell (@<eg@>the Macintosh). The shell can be used
3542 to process whole groups of files automatically.
3543
3544 @<Item@>As a convenience. A user working on a multi-tasking,
3545 multi-window workstation@<X@>@(workstation@) may wish to
3546 keep an interactive session of FunnelWeb going in one window
3547 rather than having to run up the utility each time it is
3548 required.
3549
3550 @<Item@>As a convenient vehicle for enclosing utilities. The
3551 FunnelWeb shell contains useful general purpose commands
3552 such as the differences command @<TT@>@(diff@).
3553
3554 @<End list/ordered@>
3555
3556 @<Nav/first@>@(@<Shell FILE@>@,@<Shell FILE@>@,@<Shell_statuses FILE@>@)
3557
3558 @<End FWRefMan page@>
3559 @}
3560
3561 @!==============================================================================
3562
3563 @$@<Shell_statuses HEADING@>@M@{@<SH@>@(8.2@)Return Statuses@}
3564 @$@<Shell_statuses FILE@>@M@{shell_statuses.html@}
3565 @O@<shell_statuses.html@>@{@-
3566 @<Begin FWRefMan page/H1@>@(@<Shell_statuses HEADING@>@)
3567 @<XX@>@(errors@,shell@)@<XX@>@(status@,success@)
3568 @<XX@>@(status@,warning@)@<XX@>@(status@,error@)@<XX@>@(status@,severe@)@<XX@>@(status@,fatal@)
3569 @<XX@>@(status@,assertion@)
3570
3571 @<P@>The hierarchy of diagnostics is also used in the shell
3572 commands. Each shell command returns a status which can
3573 affect further processing.
3574
3575 @<NarrowThing@>@(Success@,status is the normal command
3576 return status.@)
3577
3578 @<NarrowThing@>@(Warning@,status is returned if some minor
3579 problem arose with the execution of the command.@)
3580
3581 @<NarrowThing@>@(Error@,status is returned if a significant
3582 problem arises during the execution of the command. However,
3583 unlike a severe error, it does @<I@>@(not@) cause
3584 termination of the enclosing shellscript.@)
3585
3586 @<NarrowThing@>@(Severe error@,status is returned if a
3587 problem arises during the execution of the command that
3588 prevents the command from delivering on its
3589 @<DQ@>@(promise@). A severe error causes FunnelWeb to abort
3590 the script (and any stacked scripts) to the interactive
3591 level. (However, the @<TT@>@(tolerate@) command allows this
3592 to be temporarily overridden).@)
3593
3594 @<NarrowThing@>@(Fatal error@,status is returned if a
3595 problem arises that is so serious that execution of
3596 FunnelWeb cannot continue. A fatal error causes FunnelWeb to
3597 abort to the operating system level.@)
3598
3599 @<NarrowThing@>@(Assertion error@,status is never returned.
3600 If an assertion error occurs, FunnelWeb bombs out
3601 ungracefully to the operating system. Assertion errors
3602 should never happen. If they do, then there is a bug in
3603 FunnelWeb.@)
3604
3605 @<P@>To be precise, the status returned by each command is a
3606 vector of numbers being the number of each of the different
3607 kinds of diagnostic generated by the command. Usually only
3608 one kind of diagnostic is generated. However, the
3609 @<TT@>@(fw@) command and a few of the other commands can
3610 generate more than one kind of diagnostic. These status
3611 vectors are summed internally where they may later be
3612 accessed using the @<TT@>@(status@) command. However, the
3613 current diagnostic state evaporates as soon as the next
3614 command is encountered.
3615
3616 @<Nav@>@(@<Shell_introduction FILE@>@,@<Shell FILE@>@,@<Shell_linelen FILE@>@)
3617
3618 @<End FWRefMan page@>
3619 @}
3620
3621 @!==============================================================================
3622
3623 @$@<Shell_linelen HEADING@>@M@{@<SH@>@(8.3@)Command Line Length@}
3624 @$@<Shell_linelen FILE@>@M@{shell_linelen.html@}
3625 @O@<shell_linelen.html@>@{@-
3626 @<Begin FWRefMan page/H1@>@(@<Shell_linelen HEADING@>@)
3627 @<XX@>@(command@,length@)
3628
3629 @<P@>The maximum length of a shell command line is
3630 guaranteed to be at least 300 characters.
3631
3632 @<Nav@>@(@<Shell_statuses FILE@>@,@<Shell FILE@>@,@<Shell_strsubs FILE@>@)
3633
3634 @<End FWRefMan page@>
3635 @}
3636
3637 @!==============================================================================
3638
3639 @$@<Shell_strsubs HEADING@>@M@{@<SH@>@(8.4@)String Substitution@}
3640 @$@<Shell_strsubs FILE@>@M@{shell_strsubs.html@}
3641 @O@<shell_strsubs.html@>@{@-
3642 @<Begin FWRefMan page/H1@>@(@<Shell_strsubs HEADING@>@)
3643
3644 @<P@>Most command shells provide some form of string
3645 substitution so as to provide some degree of
3646 parameterization. The FunnelWeb shell provides 36 different
3647 string variables named @<TT@>@($0..$9@) and @<TT@>@($A..$Z@)
3648 (case insensitive). Each variable can hold a string
3649 containing any sequence of printable characters and can be
3650 as long as a command line.
3651
3652 @<P@>The @<TT@>@(define@) command@<XX@>@(define@,command@)
3653 allows the user to assign a value to these variables. The
3654 @<TT@>@(define@) command takes two arguments. The first is
3655 the digit or letter of the variable to be defined. The
3656 second is a double quote delimited string being the string
3657 value to be assigned to the variable. If you want to include
3658 a double quote character within the string, you don't need
3659 to double it.
3660
3661 @<P@>Examples:
3662
3663 @<P@>
3664 @<Begin verbatim@>
3665 define 3 "/root/usr/dave/workdir/fwdir/testdir"
3666 define M "/user/local/rubbish/bin/fw"
3667 define Q "You don't need to double" double quotes"
3668 @<End verbatim@>
3669
3670 @<P@>Only the identifying character of the variable being
3671 assigned is used in the definition. This syntax is a simple
3672 way of preventing the variable from being substituted before
3673 it has a chance to be defined!
3674
3675 @<P@>The following points clean up the remaining semantic
3676 details:
3677
3678 @<Begin list@>
3679
3680 @<Item@>There is only one set of variables and they are
3681 global to all shellscripts. There are @<I@>@(no local
3682 variables@).
3683
3684 @<Item@>When a shellscript is invoked using the
3685 @<TT@>@(execute@) command, the substitution variables
3686 @<TT@>@(0@) through @<TT@>@(9@) are affected. See the
3687 EXECUTE command for more details.
3688
3689 @<Item@>If you want to include a dollar sign character in a
3690 command use @<DQP@>@($$@).
3691
3692 @<Item@>FunnelWeb also defines @<DQP@>@($/@) which
3693 translates to the character that separates directory and
3694 file name fields in file names on the host machine. For
3695 example: Sun=@<DQP@>@(/@), Vax=@<DQP@>@(]@),
3696 Mac=@<DQP@>@(:@), PC=@<DQP@>@(\@).
3697
3698 @<Item@>Substitution is not performed recursively.
3699
3700 @<End list@>
3701
3702 @<Nav@>@(@<Shell_linelen FILE@>@,@<Shell FILE@>@,@<Shell_processing FILE@>@)
3703
3704 @<End FWRefMan page@>
3705 @}
3706
3707 @!==============================================================================
3708
3709 @$@<Shell_processing HEADING@>@M@{@<SH@>@(8.5@)How a Command Line is Processed@}
3710 @$@<Shell_processing FILE@>@M@{shell_processing.html@}
3711 @O@<shell_processing.html@>@{@-
3712 @<Begin FWRefMan page/H1@>@(@<Shell_processing HEADING@>@)
3713 @<XX@>@(command line@,processing@)
3714
3715 @<P@>When FunnelWeb reads in a command line (from the
3716 console or a script file), it processes it in the following
3717 sequence:
3718
3719 @<Begin list/ordered@>
3720
3721 @<Item@>The command line is checked for non-printable
3722 characters. If there are any, they are flagged with a severe
3723 error.
3724
3725 @<Item@>All dollar string substitution variables in the
3726 command line are replaced by their corresponding string. The
3727 command line is processed from left to right. Substitutions
3728 are performed non recursively.
3729
3730 @<Item@>At this point, if the line is empty, or consists
3731 entirely of blanks, it is ignored and the interpreter moves
3732 to the next line.
3733
3734 @<Item@>A severe error is generated if the line at this
3735 stage begins with a blank.
3736
3737 @<Item@>If the first character of the line is @<DQP@>@(!@),
3738 the line is a comment line and is ignored.
3739
3740 @<Item@>The run of non-blanks commencing at the start of the
3741 line is compared case-insensitively to each of the legal
3742 command verbs. If the command is illegal, a severe error is
3743 generated, otherwise the command is processed.
3744
3745 @<End list/ordered@>
3746
3747 @<Nav@>@(@<Shell_strsubs FILE@>@,@<Shell FILE@>@,@<Shell_options FILE@>@)
3748
3749 @<End FWRefMan page@>
3750 @}
3751
3752 @!==============================================================================
3753
3754 @$@<Shell_options HEADING@>@M@{@<SH@>@(8.6@)Options@}
3755 @$@<Shell_options FILE@>@M@{shell_options.html@}
3756 @O@<shell_options.html@>@{@-
3757 @<Begin FWRefMan page/H1@>@(@<Shell_options HEADING@>@)
3758 @<XX@>@(command@,options@)@<XX@>@(default@,options@)
3759
3760 @<P@>The FunnelWeb shell maintains three sets of command
3761 line options.
3762
3763 @<P@> @<Begin list/ordered@>
3764
3765 @<Item@>The set of options resulting from applying the
3766 operating system level command line arguments to the default
3767 option settings.
3768
3769 @<Item@>A set of shell options that prevail during the shell
3770 invocation.
3771
3772 @<Item@>The set of option values active during a particular
3773 invocation of FunnelWeb proper.
3774
3775 @<End list/ordered@>
3776
3777 @<P@>When FunnelWeb is invoked from the operating system
3778 with just @<TT@>@(+F@), only the first of these three sets
3779 comes into existence. If the user invokes the FunnelWeb
3780 shell, the shell options come into existence and are
3781 initialized with the value of the first set. These shell
3782 options are used as the default for all subsequent
3783 @<TT@>@(fw@) commands. However, they can be altered using
3784 the script command @<TT@>@(set@). If a @<TT@>@(fw@) command
3785 executed in a shell contains additional command line
3786 options, these override the shell options for that run, but
3787 do not change the shell options. An example follows:
3788
3789 @<P@>
3790 @<Begin verbatim@>
3791 $ fw +k +t ! Original invocation from OS.
3792 ! Options default with "+t".
3793 FunnelWeb>fw sloth ! Equivalent to fw sloth +t.
3794 FunnelWeb>set -l ! Change the l shell option.
3795 FunnelWeb>fw sloth +q ! Equiv to fw sloth +t -l +q.
3796 FunnelWeb>fw sloth ! Equiv to fw sloth +t -l.
3797 @<End verbatim@>
3798
3799 @<P@>The existence of the shell option set means that the
3800 user can set up a set of defaults to be applied to all
3801 @<TT@>@(fw@) commands issued within the shell.
3802
3803 @<Nav/last@>@(@<Shell_processing FILE@>@,@<Shell FILE@>@,@<Shell FILE@>@)
3804
3805 @<End FWRefMan page@>
3806 @}
3807
3808 @!******************************************************************************
3809
3810 @$@<Commands HEADING@>@M@{@<SH@>@(9@)Shell Commands@}
3811 @$@<Commands HEADING/short@>@M@{@<SH@>@(9@)Commands@}
3812 @$@<Commands FILE@>@M@{commands.html@}
3813 @O@<commands.html@>@{@-
3814 @<Begin FWRefMan page/H1@>@(@<Commands HEADING@>@)
3815 @<XX@>@(shell commands@,list@)@<XX@>@(commands@,shell@)
3816
3817 @<Commands index@>
3818
3819 @<Nav@>@(@<Shell FILE@>@,@<Index FILE@>@,@<Glossary FILE@>@)
3820
3821 @<End FWRefMan page@>
3822 @}
3823
3824 @$@<Commands index@>@M@{
3825 @<Begin size3@>
3826 @<Begin indent/narrow@>
3827 @<Link@>@(@<Commands_introduction FILE@>@,@<Commands_introduction HEADING@>@)@<BR@>
3828 @<Link@>@(@<Commands_absent FILE@>@,@<Commands_absent HEADING@>@)@<BR@>
3829 @<Link@>@(@<Commands_codify FILE@>@,@<Commands_codify HEADING@>@)@<BR@>
3830 @<Link@>@(@<Commands_compare FILE@>@,@<Commands_compare HEADING@>@)@<BR@>
3831 @<Link@>@(@<Commands_define FILE@>@,@<Commands_define HEADING@>@)@<BR@>
3832 @<Link@>@(@<Commands_diff FILE@>@,@<Commands_diff HEADING@>@)@<BR@>
3833 @<Link@>@(@<Commands_diffsummary FILE@>@,@<Commands_diffsummary HEADING@>@)@<BR@>
3834 @<Link@>@(@<Commands_diffzero FILE@>@,@<Commands_diffzero HEADING@>@)@<BR@>
3835 @<Link@>@(@<Commands_eneo FILE@>@,@<Commands_eneo HEADING@>@)@<BR@>
3836 @<Link@>@(@<Commands_execute FILE@>@,@<Commands_execute HEADING@>@)@<BR@>
3837 @<Link@>@(@<Commands_exists FILE@>@,@<Commands_exists HEADING@>@)@<BR@>
3838 @<Link@>@(@<Commands_fixeols FILE@>@,@<Commands_fixeols HEADING@>@)@<BR@>
3839 @<Link@>@(@<Commands_fw FILE@>@,@<Commands_fw HEADING@>@)@<BR@>
3840 @<Link@>@(@<Commands_help FILE@>@,@<Commands_help HEADING@>@)@<BR@>
3841 @<Link@>@(@<Commands_here FILE@>@,@<Commands_here HEADING@>@)@<BR@>
3842 @<Link@>@(@<Commands_quit FILE@>@,@<Commands_quit HEADING@>@)@<BR@>
3843 @<Link@>@(@<Commands_set FILE@>@,@<Commands_set HEADING@>@)@<BR@>
3844 @<Link@>@(@<Commands_show FILE@>@,@<Commands_show HEADING@>@)@<BR@>
3845 @<Link@>@(@<Commands_skipto FILE@>@,@<Commands_skipto HEADING@>@)@<BR@>
3846 @<Link@>@(@<Commands_status FILE@>@,@<Commands_status HEADING@>@)@<BR@>
3847 @<Link@>@(@<Commands_tolerate FILE@>@,@<Commands_tolerate HEADING@>@)@<BR@>
3848 @<Link@>@(@<Commands_trace FILE@>@,@<Commands_trace HEADING@>@)@<BR@>
3849 @<Link@>@(@<Commands_write FILE@>@,@<Commands_write HEADING@>@)@<BR@>
3850 @<Link@>@(@<Commands_writeu FILE@>@,@<Commands_writeu HEADING@>@)@<BR@>
3851 @<End indent/narrow@>
3852 @<End size3@>
3853 @}
3854
3855 @!==============================================================================
3856
3857 @$@<Commands_introduction HEADING@>@M@{@<SH@>@(9.1@)Introduction@}
3858 @$@<Commands_introduction FILE@>@M@{commands_introduction.html@}
3859 @O@<commands_introduction.html@>@{@-
3860 @<Begin FWRefMan page/H1@>@(@<Commands_introduction HEADING@>@)
3861
3862 @<P@>This section describes each of the FunnelWeb shell
3863 commands. The syntax is:
3864
3865 @<P@>
3866 @<Begin verbatim@>
3867 shell_command = absent | codify | compare |
3868 define | diff | diffsummary |
3869 diffzero | eneo | execute |
3870 exists | fixeols | help |
3871 here | quit | set |
3872 show | skipto | status |
3873 tolerate | trace | write |
3874 writeu
3875 s = { " " }+
3876 @<End verbatim@>
3877
3878 @<P@>As a rule, FunnelWeb shell commands return severe
3879 status if their arguments are syntactically incorrect or if
3880 they are unable to successfully operate on argument files.
3881
3882 @<Nav/first@>@(@<Commands FILE@>@,@<Commands FILE@>@,@<Commands_absent FILE@>@)
3883
3884 @<End FWRefMan page@>
3885 @}
3886
3887 @!==============================================================================
3888
3889 @$@<Commands_absent HEADING@>@M@{@<SH@>@(9.2@)Absent@}
3890 @$@<Commands_absent FILE@>@M@{commands_absent.html@}
3891 @O@<commands_absent.html@>@{@-
3892 @<Begin FWRefMan page/H1@>@(@<Commands_absent HEADING@>@)
3893 @<XX@>@(command@,absent@)
3894
3895 @<P@>The @<TT@>@(absent@) command performs no action except
3896 to return a status. If the file specified in its argument
3897 doesn't exist it returns success status, otherwise it
3898 returns severe status.
3899
3900 @<P@>
3901 @<Begin verbatim@>
3902 Syntax : absent = "absent" s filename
3903 Example: absent result.out
3904 @<End verbatim@>
3905
3906 @<P@>This command is useful in regression testing for making
3907 sure that FunnelWeb @<I@>@(hasn't@) produced a particular
3908 output file.
3909
3910 @<Nav@>@(@<Commands_introduction FILE@>@,@<Commands FILE@>@,@<Commands_codify FILE@>@)
3911
3912 @<End FWRefMan page@>
3913 @}
3914
3915 @!==============================================================================
3916
3917 @$@<Commands_codify HEADING@>@M@{@<SH@>@(9.3@)Codify@}
3918 @$@<Commands_codify FILE@>@M@{commands_codify.html@}
3919 @O@<commands_codify.html@>@{@-
3920 @<Begin FWRefMan page/H1@>@(@<Commands_codify HEADING@>@)
3921 @<XX@>@(command@,codify@)
3922
3923 @<P@>The @<TT@>@(codify@) command takes two arguments: an
3924 input file and an output file. It reads each line of the
3925 input file and writes a corresponding line to the output
3926 file. The corresponding line consists of a C macro call
3927 containing a string containing the input line. The command
3928 converts all backslashes in input lines to double
3929 backslashes so as to avoid unwanted interpretations by the C
3930 compiler. It also converts double quotes in the line to
3931 backslashed double quotes.
3932
3933 @<P@>
3934 @<Begin verbatim@>
3935 Syntax : codify = "codify" s filename s filename
3936 Example: codify header.tex header.c
3937 @<End verbatim@>
3938
3939 @<P@>The following example demonstrates the transformation.
3940
3941 @<P@>
3942 @<Begin verbatim@>
3943 Input Line:
3944 \def\par{\leavevmode\endgraf}% A "hack".
3945 Output Line:
3946 WX("\\def\\par{\\leavevmode\\endgraf}% A \"hack\".");
3947 @<End verbatim@>
3948
3949 @<P@>The @<TT@>@(codify@) command was introduced to assist
3950 in the development of FunnelWeb. It is used to convert
3951 longish text files into C code to write them out. The C code
3952 is then included within the FunnelWeb C program. For
3953 example, the set of TeX definitions that appears at the top
3954 of every documentation file was @<TT@>@(codif@)ied and
3955 inserted into the FunnelWeb code so that FunnelWeb would not
3956 have to look for a file containing the definitions at run
3957 time.
3958
3959 @<Nav@>@(@<Commands_absent FILE@>@,@<Commands FILE@>@,@<Commands_compare FILE@>@)
3960
3961 @<End FWRefMan page@>
3962 @}
3963
3964 @!==============================================================================
3965
3966 @$@<Commands_compare HEADING@>@M@{@<SH@>@(9.4@)Compare@}
3967 @$@<Commands_compare FILE@>@M@{commands_compare.html@}
3968 @O@<commands_compare.html@>@{@-
3969 @<Begin FWRefMan page/H1@>@(@<Commands_compare HEADING@>@)
3970 @<XX@>@(command@,compare@)
3971
3972 @<P@>The @<TT@>@(compare@) command takes two filename
3973 arguments and performs a binary comparison of the two files.
3974 If the files are identical, success status is returned. If
3975 they are different, severe status is returned. No
3976 information about the manner in which the files differ is
3977 conveyed.
3978
3979 @<P@>
3980 @<Begin verbatim@>
3981 Syntax : compare = "compare" s filename s filename
3982 Example: compare result.txt answer.txt
3983 @<End verbatim@>
3984
3985 @<P@>The @<TT@>@(compare@) command was created as the main
3986 checking mechanism for regression testing. However, its
3987 binary output was soon found to be unworkable and the more
3988 sophisticated @<TT@>@(diff@) command was added so that the
3989 actual differences between the files could be examined.
3990
3991 @<Nav@>@(@<Commands_codify FILE@>@,@<Commands FILE@>@,@<Commands_define FILE@>@)
3992
3993 @<End FWRefMan page@>
3994 @}
3995
3996 @!==============================================================================
3997
3998 @$@<Commands_define HEADING@>@M@{@<SH@>@(9.5@)Define@}
3999 @$@<Commands_define FILE@>@M@{commands_define.html@}
4000 @O@<commands_define.html@>@{@-
4001 @<Begin FWRefMan page/H1@>@(@<Commands_define HEADING@>@)
4002 @<XX@>@(command@,define@)@<XX@>@(string@,substitution@)
4003
4004 @<P@>The @<TT@>@(define@) command assigns a value to a shell
4005 string substitution variable. The @<TT@>@(define@) command
4006 takes two arguments. The first is the digit or letter of the
4007 variable to be defined. The second is a double quote
4008 delimited string being the string value to be assigned to
4009 the variable. If you want to include a double quote
4010 character within the string, you don't need to double it.
4011
4012 @<P@>
4013 @<Begin verbatim@>
4014 Syntax :
4015 define = "define" s letter s """" text """"
4016 Examples:
4017 define 3 "/usr/usrs/thisuser/workdir/fwdir/testdir"
4018 define M "/user/local/rubbish/bin/fw"
4019 define Q "You don't need to double" double quotes"
4020 @<End verbatim@>
4021
4022 @<P@>The command interpreter expands the command line before
4023 it executes the @<TT@>@(define@) command. This means that
4024 you can define string substitution variables in terms of
4025 each other with static binding.
4026
4027 @<P@>The @<TT@>@(define@) command was introduced to allow
4028 the parameterization of the directories involved in
4029 regression testing.
4030
4031 @<P@>See the section on string substitution for more
4032 details.
4033
4034 @<Nav@>@(@<Commands_compare FILE@>@,@<Commands FILE@>@,@<Commands_diff FILE@>@)
4035
4036 @<End FWRefMan page@>
4037 @}
4038
4039 @!==============================================================================
4040
4041 @$@<Commands_diff HEADING@>@M@{@<SH@>@(9.6@)Diff@}
4042 @$@<Commands_diff FILE@>@M@{commands_diff.html@}
4043 @O@<commands_diff.html@>@{@-
4044 @<Begin FWRefMan page/H1@>@(@<Commands_diff HEADING@>@)
4045 @<XX@>@(command@,diff@)@<XX@>@(file@,differences@)
4046
4047 @<P@>The @<TT@>@(diff@) command reads in two text files and
4048 @<I@>@(appends@) a report to a log file containing a list of
4049 the differences between the two input files. If the log file
4050 does not already exist, an empty one is created first.
4051
4052 @<P@>
4053 @<Begin verbatim@>
4054 Syntax :
4055 diff = "diff" s filename s filename s
4056 filename s ["ABORT"]
4057 Examples:
4058 diff result.tex answer.tex diff.log
4059 diff $Otest23.out $Atest23.out $Ldiff.log ABORT
4060 @<End verbatim@>
4061
4062 @<P@>The @<TT@>@(diff@) command performs a full line-based
4063 differences operation. It will identify different sections
4064 in a file, even if they are of differing length.
4065
4066 @<P@>The implementation of the @<TT@>@(diff@) command is
4067 quite complicated. To be sure that it is at least getting
4068 its same/different proclamation right, the @<TT@>@(diff@)
4069 command performs a binary comparison as an extra check.
4070
4071 @<P@>The following points describe the rules for determining
4072 the result status.
4073
4074 @<P@> @<Begin list/ordered@>
4075
4076 @<Item@>@<TT@>@(diff@) aborts with a severe error if the log
4077 file cannot be opened or created for appending.
4078
4079 @<Item@>An ordinary error is generated if either or both of
4080 the input files cannot be opened.
4081
4082 @<Item@>If, at the end of the run, the two input files have
4083 not been proven to be identical, and the @<TT@>@(ABORT@)
4084 keyword is present, @<TT@>@(diff@) returns severe status.
4085
4086 @<Item@>@<TT@>@(diff@) returns success status if none of the
4087 above conditions (or similar conditions) occur, even if the
4088 two files are different.
4089
4090 @<End list/ordered@>
4091
4092 @<P@>The @<TT@>@(diff@) command @<I@>@(appends@) its
4093 differences report rather than merely writing it. This
4094 allows a regression test script to perform a series of
4095 regression tests and produce a report for the user.
4096
4097 @<P@>The @<TT@>@(diff@) command was added to the shell after
4098 it had become apparent that the simpler @<TT@>@(compare@)
4099 command was not yielding enough information. Whereas early
4100 on, regression testing was treated mainly as a tool to
4101 ensure that FunnelWeb was being ported to other machines
4102 correctly, it began to place an increasing role during
4103 development in identifying the effects of changes made to
4104 the code. The @<TT@>@(diff@) command supports this
4105 application of regression testing by pinpointing the
4106 differences between nearly-identical text files.
4107
4108 @<Nav@>@(@<Commands_define FILE@>@,@<Commands FILE@>@,@<Commands_diffsummary FILE@>@)
4109
4110 @<End FWRefMan page@>
4111 @}
4112
4113 @!==============================================================================
4114
4115 @$@<Commands_diffsummary HEADING@>@M@{@<SH@>@(9.7@)Diffsummary@}
4116 @$@<Commands_diffsummary FILE@>@M@{commands_diffsummary.html@}
4117 @O@<commands_diffsummary.html@>@{@-
4118 @<Begin FWRefMan page/H1@>@(@<Commands_diffsummary HEADING@>@)
4119 @<XX@>@(command@,diffsummary@)
4120
4121 @<P@>The @<TT@>@(diffsummary@) command writes a short report
4122 to the console giving the number of difference operations
4123 that have taken place and how many of the pairs of files
4124 compared were identical. Counting starts at the most recent
4125 execution of a @<TT@>@(diffzero@) command, or if there has
4126 been none, when FunnelWeb started up.
4127
4128 @<P@>
4129 @<Begin verbatim@>
4130 Syntax : diffsummary = "diffsummary"
4131 Examples: diffsummary
4132 @<End verbatim@>
4133
4134 @<P@>The @<TT@>@(diffsummary@) command was added so as to
4135 allow regression testing scripts to display a summary of the
4136 results of the test. If the summary indicates that no pair
4137 of files differed, then there is no need to look in the
4138 @<TT@>@(diff@) log file.
4139
4140 @<Nav@>@(@<Commands_diff FILE@>@,@<Commands FILE@>@,@<Commands_diffzero FILE@>@)
4141
4142 @<End FWRefMan page@>
4143 @}
4144
4145 @!==============================================================================
4146
4147 @$@<Commands_diffzero HEADING@>@M@{@<SH@>@(9.8@)Diffzero@}
4148 @$@<Commands_diffzero FILE@>@M@{commands_diffzero.html@}
4149 @O@<commands_diffzero.html@>@{@-
4150 @<Begin FWRefMan page/H1@>@(@<Commands_diffzero HEADING@>@)
4151 @<XX@>@(command@,diffzero@)
4152
4153 @<P@>The @<TT@>@(diffzero@) command zeros the different
4154 summary counters used by the @<TT@>@(diff@) and
4155 @<TT@>@(diffsummary@) commands.
4156
4157 @<P@>
4158 @<Begin verbatim@>
4159 Syntax : diffzero = "diffzero"
4160 Examples: diffzero
4161 @<End verbatim@>
4162
4163 @<P@>The @<TT@>@(diffzero@) command was added so as to allow
4164 regression testing shellscripts to zero their differences
4165 counters at the start of a run. This allows testers to
4166 invoke the same regression testing script twice in one
4167 interactive session without receiving an inflated
4168 differences summary.
4169
4170 @<Nav@>@(@<Commands_diffsummary FILE@>@,@<Commands FILE@>@,@<Commands_eneo FILE@>@)
4171
4172 @<End FWRefMan page@>
4173 @}
4174
4175 @!==============================================================================
4176
4177 @$@<Commands_eneo HEADING@>@M@{@<SH@>@(9.9@)Eneo@}
4178 @$@<Commands_eneo FILE@>@M@{commands_eneo.html@}
4179 @O@<commands_eneo.html@>@{@-
4180 @<Begin FWRefMan page/H1@>@(@<Commands_eneo HEADING@>@)
4181 @<XX@>@(command@,eneo@)
4182
4183 @<P@>The @<TT@>@(eneo@) command takes one filename argument.
4184 If the file does not exist, no action is taken. If the file
4185 does exist, it is deleted. In both cases success status is
4186 returned. However, if the file exists and cannot be deleted,
4187 @<TT@>@(eneo@) returns severe status.
4188
4189 @<P@>
4190 @<Begin verbatim@>
4191 Syntax : eneo = "eneo" s filename
4192 Examples: eneo result.out
4193 @<End verbatim@>
4194
4195 @<P@>The @<TT@>@(eneo@) command was added so as to allow
4196 regression testing scripts to ensure that existing output
4197 files were not present before proceeding with a test run. If
4198 FunnelWeb were to fail to generate an output file, it would
4199 be extremely undesirable for the old version to be used.
4200
4201 @<P@>ENEO stands for @<B@>@(E@)stablish the @<B@>@(N@)on
4202 @<B@>@(E@)xistence @<B@>@(O@)f. Most operating systems provide a
4203 command to delete files. Typically these commands are verbs
4204 such as @<DQ@>@(delete@), @<DQ@>@(remove@), and
4205 @<DQ@>@(kill@). As a consequence, the designers of delete
4206 commands usually consider the command to have failed if it
4207 fails to find the file to be deleted. However, in scripts,
4208 the delete command is very commonly used to
4209 @<I@>@(establish the non-existence of@) one or more files.
4210 Typically, a script is starting up and needs to clear the
4211 air before getting started. If the files are there, they
4212 should be deleted; if they are not, then that's OK
4213 too. (Note: As far as I know, the @<TT@>@(eneo@) command
4214 is original).
4215
4216 @<Nav@>@(@<Commands_diffzero FILE@>@,@<Commands FILE@>@,@<Commands_execute FILE@>@)
4217
4218 @<End FWRefMan page@>
4219 @}
4220
4221 @!==============================================================================
4222
4223 @$@<Commands_execute HEADING@>@M@{@<SH@>@(9.10@)Execute@}
4224 @$@<Commands_execute FILE@>@M@{commands_execute.html@}
4225 @O@<commands_execute.html@>@{@-
4226 @<Begin FWRefMan page/H1@>@(@<Commands_execute HEADING@>@)
4227 @<XX@>@(command@,execute@)
4228
4229 @<P@>The @<TT@>@(execute@) command causes a specified text
4230 file to be executed as a FunnelWeb shellscript. The first
4231 argument is the name of the script file. The remaining
4232 arguments are assigned to the substitution variables
4233 @<TT@>@($1@), @<TT@>@($2@), @<LDots@>, @<TT@>@($9@).
4234 Substitution variables in the range @<TT@>@($1@) to
4235 @<TT@>@($9@) that do not correspond to an argument are set
4236 to the empty string @<TT@>@(""@). @<TT@>@($0@) is set to the
4237 empty string regardless. The execute command can be used
4238 recursively, allowing shell scripts to invoke each other. A
4239 file extension default of @<DQP@>@(.fws@) (FunnelWeb Script)
4240 applies to script files.
4241
4242 @<P@>
4243 @<Begin verbatim@>
4244 Syntax :
4245 execute = "execute" s filename {argument_string}
4246 Examples:
4247 execute megatest.fws /usr/users/ross/fwtest !
4248 execute sloth
4249 @<End verbatim@>
4250
4251 @<P@>The first example above will result in the following
4252 substitution variable assignments.
4253
4254 @<P@>
4255 @<Begin verbatim@>
4256 $0 = ""
4257 $1 = "/usr/users/ross/fwtest"
4258 $2 = "!"
4259 $3 = ""
4260 ...
4261 $9 = ""
4262 @<End verbatim@>
4263
4264 @<P@>It should be stressed that there are no local variables
4265 in the FunnelWeb command language; the variables above are
4266 globally modified.
4267
4268 @<P@>The @<TT@>@(execute@) command was added to allow the
4269 creation of sub-scripts to test FunnelWeb in particular
4270 ways.
4271
4272 @<Nav@>@(@<Commands_eneo FILE@>@,@<Commands FILE@>@,@<Commands_exists FILE@>@)
4273
4274 @<End FWRefMan page@>
4275 @}
4276
4277 @!==============================================================================
4278
4279 @$@<Commands_exists HEADING@>@M@{@<SH@>@(9.11@)Exists@}
4280 @$@<Commands_exists FILE@>@M@{commands_exists.html@}
4281 @O@<commands_exists.html@>@{@-
4282 @<Begin FWRefMan page/H1@>@(@<Commands_exists HEADING@>@)
4283 @<XX@>@(command@,exists@)
4284
4285 @<P@>The @<TT@>@(exists@) command performs no action except
4286 to return a status. If the file specified in its argument
4287 exists it returns success status, otherwise it returns
4288 severe status.
4289
4290 @<P@>
4291 @<Begin verbatim@>
4292 Syntax : exists = "exists" s filename
4293 Example: exists test6.fw
4294 @<End verbatim@>
4295
4296 @<P@>This command is useful in regression testing for
4297 ensuring that FunnelWeb has produced a particular output
4298 file.
4299
4300 @<Nav@>@(@<Commands_execute FILE@>@,@<Commands FILE@>@,@<Commands_fixeols FILE@>@)
4301
4302 @<End FWRefMan page@>
4303 @}
4304
4305 @!==============================================================================
4306
4307 @$@<Commands_fixeols HEADING@>@M@{@<SH@>@(9.12@)Fixeols@}
4308 @$@<Commands_fixeols FILE@>@M@{commands_fixeols.html@}
4309 @O@<commands_fixeols.html@>@{@-
4310 @<Begin FWRefMan page/H1@>@(@<Commands_fixeols HEADING@>@)
4311 @<XX@>@(command@,fixeols@)
4312
4313 @<P@>The @<TT@>@(fixeols@) command takes two filename
4314 arguments: an input file and an output file. It reads in the
4315 input file and writes it to the output file changing all the
4316 end of line control character sequences to the local format.
4317 It can also take one filename argument, in which case it
4318 replaces the target file with its transformation.
4319
4320 @<P@>
4321 @<Begin verbatim@>
4322 Syntax : fixeols = "fixeols" s filename [s filename]
4323 Examples: fixeols imported.hak result.kln
4324 fixeols sloth.dat
4325 @<End verbatim@>
4326
4327 @<P@>The @<TT@>@(fixeols@) command works by parsing the
4328 input file into alternating runs of printable characters
4329 (ASCII 20 to ASCII 126) and runs of non-printable characters
4330 (all the others). It then@<XX@>@(non-printable@,characters@)
4331 parses each run of non-printable characters from left to
4332 right into subruns of non-printables not containing the same
4333 character twice. It then replaces each subrun with a native
4334 EOL. (Note: A native EOL can be inserted into a text
4335 file in a portable manner simply by writing
4336 @<DQP@>@(\n@) to the text output stream). For example,
4337 if a native EOL is @<TT@>@(X@), and @<TT@>@(ABCD@) are
4338 non-printable characters, and the file to be converted is
4339
4340 @<P@>
4341 @<Begin verbatim@>
4342 thisABisABCDanABABexampleABCCCof the conversion.
4343 @<End verbatim@>
4344
4345 @<P@>then @<TT@>@(fixeols@) would produce
4346
4347 @<P@>
4348 @<Begin verbatim@>
4349 thisXisXanXXexampleXXXof the conversion.
4350 @<End verbatim@>
4351
4352 @<P@>The @<TT@>@(fixeols@) command was devised to solve the
4353 problem created sometimes when text files are moved from one
4354 machine to another (@<eg@>with the Kermit program) using a
4355 binary transfer mode rather than a text transfer mode. If
4356 such a transfer is made, and the text file line termination
4357 conventions differ on the two machines, one can wind up with
4358 a set of text files with improperly terminated lines. This
4359 can cause problems on a number of fronts, but in particular
4360 affects regression testing which relies heavily on exact
4361 comparisons between files. The @<TT@>@(fixeols@) command
4362 provides a solution to this problem by providing a portable
4363 way to @<DQ@>@(purify@) text files whose end of lines have
4364 become incorrect. The regression testing scripts all apply
4365 @<TT@>@(fixeols@) to their input and output files before
4366 each test.
4367
4368 @<Nav@>@(@<Commands_exists FILE@>@,@<Commands FILE@>@,@<Commands_fw FILE@>@)
4369
4370 @<End FWRefMan page@>
4371 @}
4372
4373 @!==============================================================================
4374
4375 @$@<Commands_fw HEADING@>@M@{@<SH@>@(9.13@)Fw@}
4376 @$@<Commands_fw FILE@>@M@{commands_fw.html@}
4377 @O@<commands_fw.html@>@{@-
4378 @<Begin FWRefMan page/H1@>@(@<Commands_fw HEADING@>@)
4379 @<XX@>@(command@,fw@)
4380
4381 @<P@>The @<TT@>@(fw@) command allows FunnelWeb proper to be
4382 invoked from a shell script. The syntax is almost identical
4383 to the syntax with which FunnelWeb is invoked from the
4384 operating system.
4385
4386 @<P@>
4387 @<Begin verbatim@>
4388 Syntax : fw = "fw" s ordinary_funnelweb_command_line
4389 Examples: fw sloth +t +d
4390 fw -l walrus
4391 @<End verbatim@>
4392
4393 @<P@>Some important points about this @<TT@>@(fw@) command
4394 are:
4395
4396 @<P@>
4397 @<Begin list@>
4398 @<Item@>Options are inherited from the default shell options.
4399 @<Item@>The @<TT@>@(F@) (input file option) must be turned on.
4400 @<Item@>The @<TT@>@(K@), @<TT@>@(H@), and @<TT@>@(X@) options must be turned off.
4401 @<Item@>The @<TT@>@(J@) option must be turned off.
4402 @<Item@>The options specified in a @<TT@>@(fw@) command do not affect the default
4403 shell options.
4404 @<Item@>This command performs no action in the OpenVMS version of FunnelWeb.
4405 @<End list@>
4406
4407 @<Nav@>@(@<Commands_fixeols FILE@>@,@<Commands FILE@>@,@<Commands_help FILE@>@)
4408
4409 @<End FWRefMan page@>
4410 @}
4411
4412 @!==============================================================================
4413
4414 @$@<Commands_help HEADING@>@M@{@<SH@>@(9.14@)Help@}
4415 @$@<Commands_help FILE@>@M@{commands_help.html@}
4416 @O@<commands_help.html@>@{@-
4417 @<Begin FWRefMan page/H1@>@(@<Commands_help HEADING@>@)
4418 @<XX@>@(command@,help@)
4419
4420 @<P@>The @<TT@>@(help@) command provides online help from
4421 within the FunnelWeb shell. It provides access to all of the
4422 same messages that the @<TT@>@(+H@) command line option
4423 does.
4424
4425 @<P@>
4426 @<Begin verbatim@>
4427 Syntax : help = "help" [s help_message_name]
4428 Examples: help
4429 help commands
4430 @<End verbatim@>
4431
4432 @<P@>If no message name is given, the default message is
4433 displayed. It contains a list of the other help messages and
4434 their names. The actual messages themselves are not listed
4435 here.
4436
4437 @<Nav@>@(@<Commands_fw FILE@>@,@<Commands FILE@>@,@<Commands_here FILE@>@)
4438
4439 @<End FWRefMan page@>
4440 @}
4441
4442 @!==============================================================================
4443
4444 @$@<Commands_here HEADING@>@M@{@<SH@>@(9.15@)Here@}
4445 @$@<Commands_here FILE@>@M@{commands_here.html@}
4446 @O@<commands_here.html@>@{@-
4447 @<Begin FWRefMan page/H1@>@(@<Commands_here HEADING@>@)
4448 @<XX@>@(command@,here@)
4449
4450 @<P@>The @<TT@>@(here@) command acts as a target for the
4451 @<TT@>@(skipto@) command. When the shell interpreter
4452 encounters a @<TT@>@(skipto@) command, it ignores all the
4453 following commands until it encounters a @<TT@>@(here@)
4454 command.
4455
4456 @<P@>
4457 @<Begin verbatim@>
4458 Syntax : here = "here"
4459 Example: here
4460 @<End verbatim@>
4461
4462 @<P@>The @<TT@>@(skipto@)/@<TT@>@(here@) mechanism was
4463 created to allow groups of regression tests to be skipped
4464 during debugging without having to comment them out.
4465
4466 @<Nav@>@(@<Commands_help FILE@>@,@<Commands FILE@>@,@<Commands_quit FILE@>@)
4467
4468 @<End FWRefMan page@>
4469 @}
4470
4471 @!==============================================================================
4472
4473 @$@<Commands_quit HEADING@>@M@{@<SH@>@(9.16@)Quit@}
4474 @$@<Commands_quit FILE@>@M@{commands_quit.html@}
4475 @O@<commands_quit.html@>@{@-
4476 @<Begin FWRefMan page/H1@>@(@<Commands_quit HEADING@>@)
4477 @<XX@>@(command@,quit@)
4478
4479 @<P@>The @<TT@>@(quit@) command terminates FunnelWeb
4480 immediately and returns control to the operating system.
4481 This applies regardless of the depth of the script being
4482 executed.
4483
4484 @<P@>
4485 @<Begin verbatim@>
4486 Syntax : quit = "quit"
4487 Example: quit
4488 @<End verbatim@>
4489
4490 @<Nav@>@(@<Commands_here FILE@>@,@<Commands FILE@>@,@<Commands_set FILE@>@)
4491
4492 @<End FWRefMan page@>
4493 @}
4494
4495 @!==============================================================================
4496
4497 @$@<Commands_set HEADING@>@M@{@<SH@>@(9.17@)Set@}
4498 @$@<Commands_set FILE@>@M@{commands_set.html@}
4499 @O@<commands_set.html@>@{@-
4500 @<Begin FWRefMan page/H1@>@(@<Commands_set HEADING@>@)
4501 @<XX@>@(command@,set@)
4502
4503 @<P@>The @<TT@>@(set@) command modifies the default shell
4504 options. For example, @<TT@>@(set +t@) sets the @<TT@>@(+t@)
4505 option for all subsequent FunnelWeb runs within the shell
4506 until another set command sets @<TT@>@(-t@).
4507
4508 @<P@>
4509 @<Begin verbatim@>
4510 Syntax:
4511 set = "set" s ordinary_funnelweb_command_line
4512 Examples:
4513 set sloth +t +d
4514 set -lwalrus
4515 @<End verbatim@>
4516
4517 @<P@>The restrictions on the @<TT@>@(set@) command are
4518 identical to those on the @<TT@>@(fw@) command except that,
4519 in addition, the @<TT@>@(+F@) option cannot be turned on in
4520 the @<TT@>@(set@) command.
4521
4522 @<P@>The set command is useful for setting option defaults
4523 before a long run of regression tests. It could also be
4524 useful to set default options in a FunnelWeb shell kept by a
4525 user in a workstation window.
4526
4527 @<Nav@>@(@<Commands_quit FILE@>@,@<Commands FILE@>@,@<Commands_show FILE@>@)
4528
4529 @<End FWRefMan page@>
4530 @}
4531
4532 @!==============================================================================
4533
4534 @$@<Commands_show HEADING@>@M@{@<SH@>@(9.18@)Show@}
4535 @$@<Commands_show FILE@>@M@{commands_show.html@}
4536 @O@<commands_show.html@>@{@-
4537 @<Begin FWRefMan page/H1@>@(@<Commands_show HEADING@>@)
4538 @<XX@>@(command@,show@)
4539
4540 @<P@>The @<TT@>@(show@) command displays the current default shell options.
4541 These options are the options that subsequent @<TT@>@(fw@) commands will
4542 inherit.
4543
4544 @<P@>
4545 @<Begin verbatim@>
4546 Syntax : show = "show"
4547 Example: show
4548 @<End verbatim@>
4549
4550 @<Nav@>@(@<Commands_set FILE@>@,@<Commands FILE@>@,@<Commands_skipto FILE@>@)
4551
4552 @<End FWRefMan page@>
4553 @}
4554
4555 @!==============================================================================
4556
4557 @$@<Commands_skipto HEADING@>@M@{@<SH@>@(9.19@)Skipto@}
4558 @$@<Commands_skipto FILE@>@M@{commands_skipto.html@}
4559 @O@<commands_skipto.html@>@{@-
4560 @<Begin FWRefMan page/H1@>@(@<Commands_skipto HEADING@>@)
4561 @<XX@>@(command@,skipto@)
4562
4563 @<P@>The @<TT@>@(skipto@) command causes the shell to ignore
4564 all subsequent commands until a @<TT@>@(here@) command is
4565 encountered.
4566
4567 @<P@>
4568 @<Begin verbatim@>
4569 Syntax : skipto = "skipto"
4570 Examples: skipto
4571 @<End verbatim@>
4572
4573 @<P@>The @<TT@>@(skipto@)/@<TT@>@(here@) mechanism was
4574 created to allow groups of regression tests to be skipped
4575 during debugging without having to comment them out. It is
4576 like a cut price @<TT@>@(goto@). For example, supposing that
4577 there were eight tests and that you had debugged the first
4578 five. You might want to skip the first five tests so that
4579 you can concentrate on the next three. The following code
4580 shows how this can be done.
4581
4582 @<P@>
4583 @<Begin verbatim@>
4584 skipto
4585 execute test infile1
4586 execute test infile2
4587 execute test infile3
4588 execute test infile4
4589 execute test infile5
4590 here
4591 execute test infile6
4592 execute test infile7
4593 execute test infile8
4594 @<End verbatim@>
4595
4596 @<P@>It should be stressed that FunnelWeb performs full
4597 command line processing including the dollar substitutions
4598 before testing the line to see if it is @<TT@>@(here@). This
4599 can lead to non-obvious problems. For example.
4600
4601 @<P@>
4602 @<Begin verbatim@>
4603 skipto
4604 ! Test the Parser
4605 ! ---------------
4606 define X "execute parsertest.fws"
4607 $X infile1
4608 $X infile2
4609 $X infile3
4610 $X infile4
4611 $X infile5
4612 here
4613 @<End verbatim@>
4614
4615 @<P@>The above looks correct, but, because the
4616 @<TT@>@(define@) command isn't executed (and @<TT@>@($X@) is
4617 not defined) the subsequent @<TT@>@($X@) lines result in a
4618 leading blanks error. The problem can be corrected by
4619 defining @<TT@>@($X@) before the @<TT@>@(skipto@) command.
4620
4621 @<Nav@>@(@<Commands_show FILE@>@,@<Commands FILE@>@,@<Commands_status FILE@>@)
4622
4623 @<End FWRefMan page@>
4624 @}
4625
4626 @!==============================================================================
4627
4628 @$@<Commands_status HEADING@>@M@{@<SH@>@(9.20@)Status@}
4629 @$@<Commands_status FILE@>@M@{commands_status.html@}
4630 @O@<commands_status.html@>@{@-
4631 @<Begin FWRefMan page/H1@>@(@<Commands_status HEADING@>@)
4632 @<XX@>@(command@,status@)
4633
4634 @<P@>The @<TT@>@(status@) command takes two forms. In its
4635 first form in which no arguments are given, it writes out
4636 the number of warnings, errors and severe errors that 1)
4637 were generated by the previous command and 2) have been
4638 generated during the entire shell invocation. In its second
4639 form it takes from one to three arguments each of which
4640 specifies a diagnostic severity and a number. The
4641 @<TT@>@(status@) command compares each of these numbers with
4642 the number of that diagnostic generated by the previous
4643 command and generates a severe error if they differ.
4644
4645 @<P@>
4646 @<Begin verbatim@>
4647 Syntax : status = "status" {s ("w"|"e"|"s") num}0..3
4648 Examples: status
4649 status w1 e5 s1
4650 status w4
4651 status s1 e2
4652 @<End verbatim@>
4653
4654 @<P@>The @<TT@>@(status@) command was introduced to test the
4655 status results of commands during their debugging. It is
4656 also useful for checking to see that the right number of
4657 diagnostics have been generated at particular points in test
4658 scripts.
4659
4660 @<Nav@>@(@<Commands_skipto FILE@>@,@<Commands FILE@>@,@<Commands_tolerate FILE@>@)
4661
4662 @<End FWRefMan page@>
4663 @}
4664
4665 @!==============================================================================
4666
4667 @$@<Commands_tolerate HEADING@>@M@{@<SH@>@(9.21@)Tolerate@}
4668 @$@<Commands_tolerate FILE@>@M@{commands_tolerate.html@}
4669 @O@<commands_tolerate.html@>@{@-
4670 @<Begin FWRefMan page/H1@>@(@<Commands_tolerate HEADING@>@)
4671 @<XX@>@(command@,tolerate@)
4672
4673 @<P@>The @<TT@>@(tolerate@) command instructs the shell not
4674 to abort processing of the script if the next command
4675 generates one or more warnings, errors, or severe errors.
4676 For the purposes of this command, a blank line counts as a
4677 command, so be sure to place the @<TT@>@(tolerate@) command
4678 immediately above the command about which you wish to be
4679 tolerant.
4680
4681 @<P@>
4682 @<Begin verbatim@>
4683 Syntax : tolerate = "tolerate"
4684 Example: tolerate
4685 @<End verbatim@>
4686
4687 @<P@>The tolerate command was introduced to allow FunnelWeb
4688 (@<ie@>the @<TT@>@(fw@) command) to be tested in a script
4689 under conditions which would normally cause it to abort the
4690 script.
4691
4692 @<Nav@>@(@<Commands_status FILE@>@,@<Commands FILE@>@,@<Commands_trace FILE@>@)
4693
4694 @<End FWRefMan page@>
4695 @}
4696
4697 @!==============================================================================
4698
4699 @$@<Commands_trace HEADING@>@M@{@<SH@>@(9.22@)Trace@}
4700 @$@<Commands_trace FILE@>@M@{commands_trace.html@}
4701 @O@<commands_trace.html@>@{@-
4702 @<Begin FWRefMan page/H1@>@(@<Commands_trace HEADING@>@)
4703 @<XX@>@(command@,trace@)
4704
4705 @<P@>The @<TT@>@(trace@) command turns on or off command
4706 tracing during script execution. By default, tracing is
4707 turned off.
4708
4709 @<P@>
4710 @<Begin verbatim@>
4711 Syntax : trace = "trace" [s ("on" | "off")]
4712 Examples: trace on
4713 trace off
4714 @<End verbatim@>
4715
4716 @<P@>The @<TT@>@(trace@) command was introduced to assist in
4717 the debugging of regression test scripts.
4718
4719 @<Nav@>@(@<Commands_tolerate FILE@>@,@<Commands FILE@>@,@<Commands_write FILE@>@)
4720
4721 @<End FWRefMan page@>
4722 @}
4723
4724 @!==============================================================================
4725
4726 @$@<Commands_write HEADING@>@M@{@<SH@>@(9.23@)Write@}
4727 @$@<Commands_write FILE@>@M@{commands_write.html@}
4728 @O@<commands_write.html@>@{@-
4729 @<Begin FWRefMan page/H1@>@(@<Commands_write HEADING@>@)
4730 @<XX@>@(command@,write@)
4731
4732 @<P@>The @<TT@>@(write@) command accepts a double-quoted
4733 argument and writes it followed by an EOL to the console
4734 (standard output). There is no need to double any double
4735 quotes occurring within the string.
4736
4737 @<P@>
4738 @<Begin verbatim@>
4739 Syntax:
4740 write = "write" s string
4741 Examples:
4742 write "Now about to start the next test."
4743 write "No need to " double enclosed double quotes."
4744 @<End verbatim@>
4745
4746 @<P@>The @<TT@>@(write@) command was added so as to allow
4747 regression testing scripts to inform the user of their
4748 progress.
4749
4750 @<Nav@>@(@<Commands_trace FILE@>@,@<Commands FILE@>@,@<Commands_writeu FILE@>@)
4751
4752 @<End FWRefMan page@>
4753 @}
4754
4755 @!==============================================================================
4756
4757 @$@<Commands_writeu HEADING@>@M@{@<SH@>@(9.24@)Writeu@}
4758 @$@<Commands_writeu FILE@>@M@{commands_writeu.html@}
4759 @O@<commands_writeu.html@>@{@-
4760 @<Begin FWRefMan page/H1@>@(@<Commands_writeu HEADING@>@)
4761 @<XX@>@(command@,writeu@)
4762
4763 @<P@>The @<TT@>@(writeu@) command is identical to the
4764 @<TT@>@(write@) command except that it underlines the text
4765 on an additional following output line.
4766
4767 @<P@>
4768 @<Begin verbatim@>
4769 Syntax : writeu = "writeu" s string
4770 Examples: writeu "Test 6"
4771 @<End verbatim@>
4772
4773 @<Nav/last@>@(@<Commands_write FILE@>@,@<Commands FILE@>@,@<Commands FILE@>@)
4774
4775 @<End FWRefMan page@>
4776 @}
4777
4778 @!******************************************************************************
4779
4780 @$@<Gloss@>@(@1@)@M@{<P><B>@1:</B>@}
4781 @$@<glossary@>@M@{@<Link@>@(@<Glossary FILE@>@,glossary@)@}
4782
4783 @$@<Glossary HEADING@>@M@{@<SH@>@(10@)Glossary@}
4784 @$@<Glossary HEADING/short@>@M@{@<SH@>@(10@)Glossary@}
4785 @$@<Glossary FILE@>@M@{glossary.html@}
4786 @O@<glossary.html@>@{@-
4787 @<Begin FWRefMan page/H1@>@(@<Glossary HEADING@>@)
4788
4789 @<Gloss@>@(Analyser@) A component of the FunnelWeb program
4790 that checks the macro table created by the parser for errors.
4791 For example, the analyser checks to see if any macro without a @<TT@>@(@@Z@) has
4792 not been called.
4793
4794 @<Gloss@>@(Argument@) A string delimited by blanks appearing on the FunnelWeb
4795 command line. Arguments are used to control options.
4796
4797 @<Gloss@>@(Directive@) A FunnelWeb special sequence or
4798 cooperating group of special sequences that do not form part of
4799 a macro definition. A directive can take the form of a pragma.
4800
4801 @<Gloss@>@(Documentation@) Descriptive text.
4802
4803 @<Gloss@>@(Documentation file@) An output file, produced by the Weave
4804 component of FunnelWeb, that
4805 contains typesetter commands. When fed into the appropriate typesetter
4806 program, the result is a typeset image of the input file.
4807
4808 @<Gloss@>@(Free text@) The text in an input file that remains
4809 if one were to remove macro definitions and directives.
4810
4811 @<Gloss@>@(FunnelWeb@) This word has a number of different meanings all
4812 pertaining to the FunnelWeb system of programming. 1) The
4813 entire system of programming as in @<DQ@>@(Maybe FunnelWeb can help.@)
4814 2) The computer program that implements the
4815 system as in @<DQ@>@(Run it through FunnelWeb and see what comes out.@)
4816 3) The language implemented by the FunnelWeb program as in @<DQ@>@(I wrote the
4817 program in FunnelWeb.@) or @<DQ@>@(I wrote the program in Ada using FunnelWeb.@).
4818
4819 @<Gloss@>@(FunnelWeb file@) A file whose contents are written in the FunnelWeb
4820 language.
4821
4822 @<Gloss@>@(FunnelWeb language@) The language in which FunnelWeb input files are
4823 written.
4824
4825 @<Gloss@>@(FunnelWeb proper@) Usually, when FunnelWeb is invoked, it processes
4826 a single input file and then terminates. However, it also has a command
4827 language mode in which it is possible to invoke @<DQ@>@(FunnelWeb@) many times.
4828 This leads to confusion between @<DQ@>@(FunnelWeb@) the outer program and
4829 @<DQ@>@(FunnelWeb@) the inner program. To avoid this confusion, the inner
4830 FunnelWeb is sometimes referred to as @<DQ@>@(FunnelWeb proper@).
4831
4832 @<Gloss@>@(FW@) An abbreviation for @<DQ@>@(FunnelWeb@) that is
4833 used wherever appropriate.
4834
4835 @<Gloss@>@(Include file@) A file read in by FunnelWeb as the result of an
4836 include pragma (@<TT@>@(@@i filename@)).
4837
4838 @<Gloss@>@(Input file@) Any file read in by FunnelWeb. The phrase
4839 @<DQ@>@(the input file@) refers to the root input file
4840 (specified using the @<TT@>@(+F@) option).
4841
4842 @<Gloss@>@(Journal file@) An output file containing a copy of the output sent to
4843 the user's console during an invocation of FunnelWeb. In other systems,
4844 this file is sometimes called a @<DQ@>@(log file@).
4845
4846 @<Gloss@>@(Listing file@) An output file summarizing the result of processing
4847 an input file.
4848
4849 @<Gloss@>@(Macro@) A binding of a name to a string.
4850
4851 @<Gloss@>@(Macro definition@) A construct appearing in a FunnelWeb file that
4852 binds a name to a text string.
4853 A FunnelWeb file consists of a series of macro definitions surrounded by
4854 documentary text.
4855
4856 @<Gloss@>@(Mapper@) A component of the FunnelWeb program
4857 that reads in the input file and creates a copy of it in memory.
4858
4859 @<Gloss@>@(Option@) An parameter internal to the FunnelWeb program which can be
4860 controlled by command line arguments or pragmas.
4861
4862 @<Gloss@>@(Output file@) Any file written by FunnelWeb. This includes
4863 listing, journal, product, and documentation files. (Warning: During most
4864 of FunnelWeb's development the term @<DQ@>@(output file@) was also used to
4865 refer to what are now called @<DQ@>@(product files@). This turned out to be
4866 extremely confusing and so the term @<DQ@>@(product file@) was invented to
4867 distinguish the generic from the specific.
4868 However, as this was a late modification,
4869 you may find some occurrences of the old
4870 use of @<DQ@>@(output file@).).
4871
4872 @<Gloss@>@(Parser@) A component of the FunnelWeb program
4873 that processes the token list generated by the scanner and produces a
4874 macro table and a document list. The parser mainly
4875 analyses the input file at the syntactic level, but also does some lightweight
4876 semantic checking too.
4877
4878 @<Gloss@>@(Pragma@) Single-line directives that appears in
4879 FunnelWeb files. Pragmas control everything from maximum input line length
4880 to typesetter dependence. A pragma line starts with @<DQP@>@(@@p@)
4881
4882 @<Gloss@>@(Printed documentation@) Sheets of paper
4883 resulting from actually typesetting and printing a documentation file.
4884
4885 @<Gloss@>@(Product file@) An output file, generated by the Tangle component of
4886 FunnelWeb, that contains the expansion of the macros in the input
4887 file. Note: Other names considered for this were:
4888 generated file, expanded file, result file, program file, and tangle file.
4889
4890 @<Gloss@>@(Scanner@) A component of the FunnelWeb program
4891 that scans a copy of the input file in memory and generates a line list
4892 and a token list to be fed to the parser. The scanner processes the input
4893 at the lexical level.
4894
4895 @<Gloss@>@(Script@) A file containing FunnelWeb shell commands.
4896
4897 @<Gloss@>@(Shell@) A command language interpreter built into the FunnelWeb
4898 program. The interpreter allows the user to invoke FunnelWeb proper
4899 many times during a single invocation of the FunnelWeb program.
4900
4901 @<Gloss@>@(Special character@) A distinguished character
4902 in a FunnelWeb input file that introduces a special sequence.
4903 By default the special
4904 character is @<DQP@>@(@@@). However, it can be changed using the @<DQP@>@(@@=@)
4905 special sequence.
4906
4907 @<Gloss@>@(Special sequence@) A special sequence is a construct introduced by the
4908 special character. Special sequences are used to define a structure in a
4909 FunnelWeb input file that exists at a higher level to the surrounding text.
4910 A FunnelWeb input file may be considered to be a sequence of text and
4911 special sequences.
4912
4913 @<Gloss@>@(Tangle@) This is the name for the component of FunnelWeb that
4914 generates one or more product files containing the expansion of macros
4915 in the input file.
4916
4917 @<Gloss@>@(Typesetting directive@) A FunnelWeb directive whose
4918 sole effect is to modify the way in which the input file is represented
4919 in the documentation file.
4920
4921 @<Gloss@>@(Weave@) This is the name for the component of FunnelWeb that
4922 generates a documentation file containing typesetting commands representing
4923 the input file.
4924
4925 @<Nav@>@(@<Commands FILE@>@,@<Index FILE@>@,@<References FILE@>@)
4926
4927 @<End FWRefMan page@>
4928 @}
4929
4930 @!******************************************************************************
4931
4932 @$@<References HEADING@>@M@{@<SH@>@(11@)References@}
4933 @$@<References HEADING/short@>@M@{@<SH@>@(11@)References@}
4934 @$@<References FILE@>@M@{references.html@}
4935 @O@<references.html@>@{@-
4936 @<Begin FWRefMan page/H1@>@(@<References HEADING@>@)
4937
4938 @<P@>@<Paper@>@(ANSI@) Australian Standard AS@<_@>3955-1991,
4939 @<DQ@>@(Programming Languages --- C@), (ISBN:
4940 0-7262-6970-0), 12@<_@>July@<_@>1991. Identical to:
4941 International Standard ISO/IEC 9899: 1990 Programming
4942 Languages --- C.
4943
4944 @<P@>@<Paper@>@(ANZE@) @<DQ@>@(Australia, New Zealand
4945 Encyclopedia@), Entry: @<DQ@>@(Funnel-web spiders@),
4946 Vol@<_@>7, pp.@<_@>564--565, Bay Books, Sydney, (ISBN:
4947 85835--127--7), 1975.
4948
4949 @<P@>@<Paper@>@(BSI82@) British Standards Institute,
4950 @<DQ@>@(Specification for Computer Programming Language
4951 Pascal@), Publication BS6192:1982, British Standards
4952 Institute, P.O. Box 372, Milton Keynes, MK146LO, 1982.
4953
4954 @<P@>@<Paper@>@(Gries81@) Gries@<_@>D., @<DQ@>@(The Science of
4955 Programming@), Springer-Verlag, (ISBN: 0-387-90641-X), 1981.
4956
4957 @<P@>@<Paper@>@(Humphries91@) Humphries@<_@>B, @<DQ@>@(Neglected
4958 Poems and Other Creatures@), Angus and Robertson, Sydney,
4959 (ISBN: 0-207-17212-9), 1991.
4960
4961 @<P@>@<Paper@>@(Kernighan88@) Kernighan@<_@>B.W.,
4962 Ritchie@<_@>D.M., @<DQ@>@(The@<_@>C Programming Language@),
4963 (second edition,@<DQ@>@(ANSI@<_@>C@)), Prentice Hall, (ISBN:
4964 0-13-110362-8), 1988.
4965
4966 @<P@>@<Paper@>@(Knuth83@) Knuth@<_@>D.E., @<DQ@>@(The WEB System
4967 of Structured Documentation@), (Web User Manual,
4968 Version@<_@>2.5, November, 1983), Stanford University, 1983.
4969
4970 @<P@>@<Paper@>@(Knuth84@) Knuth@<_@>D.E., @<DQ@>@(The TeXbook@),
4971 Addison-Wesley, (ISBN: 0-201-13448-9), 1984.
4972
4973 @<P@>@<Paper@>@(Knuth84@) Knuth@<_@>D.E., @<DQ@>@(Literate
4974 Programming@), @<I@>@(The Computer Journal@), Vol.@<_@>27,
4975 No.@<_@>2, pp.@<_@>97-111, 1984. (Reference copied
4976 from SIGPLAN 26(1) p.16). Note: The author of this manual
4977 has not yet obtained this paper.
4978
4979 @<P@>@<Paper@>@(Lamport86@) Lamport@<_@>L., @<DQ@>@(LaTeX: A
4980 Document Preparation System@), Addison-Wesley, (ISBN:
4981 0-201-15790-X), 1986.
4982
4983 @<P@>@<Paper@>@(Rosovsky90@) Rosovsky@<_@>H., @<DQ@>@(The
4984 University: An Owner's Manual@), W.W.Norton @<&@> Company,
4985 Inc., (ISBN: 0-393-02782-1), 1990.
4986
4987 @<P@>@<Paper@>@(Smith91@) Smith@<_@>L.M.C., @<DQ@>@(An Annotated
4988 Bibliography of Literate Programming@), ACM SIGPLAN Notices,
4989 Vol.@<_@>26, No.@<_@>1, January 1991.
4990
4991 @<P@>@<Paper@>@(Strunk79@) Strunk@<_@>W., White@<_@>E.B.,
4992 @<DQ@>@(The Elements of Style@), Third Edition, MacMillan
4993 Publishing Company, New York, (ISBN: 0-02-418200-1), 1979.
4994
4995 @<P@>@<Paper@>@(USDOD83@) @<DQ@>@(The Programming Language Ada
4996 Reference Manual@), American National Standards Institute
4997 Inc, ANSI/MIL-STD-1815A-1983, 1983.
4998
4999 @<Nav/last@>@(@<Glossary FILE@>@,@<Index FILE@>@,@<Index FILE@>@)
5000
5001 @<End FWRefMan page@>
5002 @}
5003
5004 @!******************************************************************************
5005
5006 @$@<Copyright FILE@>@M@{copyright.html@}
5007 @O@<copyright.html@>@{@-
5008 @<Begin FWRefMan page/H1@>@(Copyright and Credits@)
5009
5010 @<FunnelWeb webs copyright page contents@>
5011
5012 @<End FWRefMan page@>
5013 @}
5014
5015 @!******************************************************************************
5016
5017 @B@<Search Form Section@>
5018
5019 The files in this section are all linked in with the FunnelWeb
5020 include file.
5021
5022 @O@<search.html@>@{@-
5023 @<Begin FWRefMan page/H1@>@(Search FunnelWeb Documentation@)
5024
5025 @<FunnelWeb search form@>@(@,checked@,@,@)
5026
5027 @<End FWRefMan page@>
5028 @}
5029
5030 @!==============================================================================
5031
5032 @O@<search_form.cgi@>@{@-
5033 @<FunnelWeb search CGICODE@>
5034 @}
5035
5036 @!==============================================================================
5037
5038 @O@<search_head.txt@>@{@-
5039 @<Begin FWRefMan page/H1@>@(Search Results@)
5040 @<P@>
5041 @}
5042
5043 @!==============================================================================
5044
5045 @O@<search_tail.txt@>@{@-
5046 @<BR@>
5047 @<P@>@<Back button@>@(Back To The Search Form@)
5048 @<BR@>
5049
5050 @<End FWRefMan page@>
5051 @}
5052
5053 @!==============================================================================
5054
5055 @O@<search_e_nokeywords.txt@>@{@-
5056 @<Begin FWRefMan page/H1@>@(Error: No Keywords Specified@)
5057
5058 @<P@>You must specify one or more keywords to perform a search.
5059
5060 @<P@>@<Back button@>@(Back To The Search Form@)
5061
5062 @<End FWRefMan page@>
5063 @}
5064
5065 @!==============================================================================
5066
5067 @O@<search_e_nomanual.txt@>@{@-
5068 @<Begin FWRefMan page/H1@>@(Error: No Manual Selected@)
5069
5070 @<P@>You must specify one or more manuals (using the checkboxes) to
5071 perform a search.
5072
5073 @<P@>@<Back button@>@(Back To The Search Form@)
5074
5075 @<End FWRefMan page@>
5076 @}
5077
5078 @!******************************************************************************
5079
5080 @O@<0cleanup.vxf@>@{@-
5081 eneo *.html
5082 eneo *.shtml
5083 eneo *.cgi
5084 eneo *.txt
5085 eneo *.lis
5086 eneo *.pl
5087 @}
5088
5089 @!******************************************************************************
5090 @!******************************************************************************
5091
5092 @! Include the FunnelWeb webs master include file.
5093 @! Specify a platform-specific relative (or absolute) path to the include file.
5094 @! Unix : @i ../0fw_inc.fwi
5095 @! MacOS : @i ::0fw_inc.fwi
5096 @! OpenVMS : @i [-]0fw_inc.fwi
5097
•5098 @i ../0fw_inc.fwi
5099 @i ../0www_style.fwi
5100 @i ../0www_links.fwi
5101 @i ../0www_ross.fwi
5102
5103 @!******************************************************************************
5104 @!******************************************************************************