Commit | Line | Data |
---|---|---|
5bd13011 BJ |
1 | .if \n(xx .bp |
2 | .if !\n(xx \{\ | |
3 | .so tmac.p \} | |
4 | .ND | |
5 | .nr H1 4 | |
6 | .NH | |
7 | Details on the components of the system | |
8 | .NH 2 | |
9 | Options | |
10 | .PP | |
11 | The programs | |
12 | .PI | |
13 | and | |
14 | .XP | |
15 | take a number of options.\*(dg | |
16 | .FS | |
17 | \*(dgAs | |
18 | .IX | |
19 | uses | |
20 | .PI | |
21 | to translate Pascal programs, | |
22 | it takes the options of | |
23 | .PI | |
24 | also. | |
25 | We refer to them here, however, as | |
26 | .PI | |
27 | options. | |
28 | .FE | |
29 | There is a standard | |
30 | .UX | |
31 | convention for passing options to programs on the command line, | |
32 | and this convention is followed by the | |
33 | .UP | |
34 | system programs. | |
35 | As we saw in the examples above, | |
36 | option related arguments consisted of the character `\-' followed | |
37 | by a single character option name. | |
38 | In fact, it is possible to place more than one option letter after | |
39 | a single `\-', thus | |
40 | .LS | |
41 | % \*bpi -lz foo.p\fR | |
42 | .LE | |
43 | and | |
44 | .LS | |
45 | % \*bpi -l -z foo.p\fR | |
46 | .LE | |
47 | are equivalent. | |
48 | .PP | |
49 | There are 26 options, one corresponding to each lower case letter. | |
50 | Except for the | |
51 | .B b | |
52 | option | |
53 | which takes a single digit value, | |
54 | each option may be set on (enabled) | |
55 | or off (disabled.) | |
56 | When an on/off valued option appears on the command line of | |
57 | .PI | |
58 | or | |
59 | .PX | |
60 | it inverts the default setting of that option. | |
61 | Thus | |
62 | .LS | |
63 | % \*bpi -l foo.p\fR | |
64 | .LE | |
65 | enables the listing option | |
66 | .B l , | |
67 | since it defaults off, while | |
68 | .LS | |
69 | % \*bpi -t foo.p\fR | |
70 | .LE | |
71 | disables the run time tests option | |
72 | .B t , | |
73 | since it defaults on. | |
74 | .PP | |
75 | In additon to inverting the default settings of | |
76 | .PI | |
77 | options on the command line, it is also possible to control the | |
78 | .PI | |
79 | options | |
80 | within the body of the program by using comments of a special | |
81 | form illustrated by | |
82 | .LS | |
83 | {$l-} | |
84 | .LE | |
85 | .PP | |
86 | Here we see that the opening comment delimiter (which could also be a `(*') | |
87 | is immediately followed by the character `$'. | |
88 | After this `$', which signals the start of the option list, | |
89 | we can place a sequence of letters and option controls, separated by `,' | |
90 | characters\*(dd. | |
91 | .FS | |
92 | \*(ddThis format was chosen because it is used by Pascal 6000-3.4. | |
93 | In general the options common to both implementations are controlled | |
94 | in the same way so that comment control in options is mostly | |
95 | portable. | |
96 | It is recommended, however, that only one control be put per comment for | |
97 | maximum portability, as the Pascal 6000-3.4 | |
98 | implementation will ignore controls | |
99 | after the first one which it does not recognize. | |
100 | .FE | |
101 | The most basic actions for options are to set them, thus | |
102 | .LS | |
103 | {$l+ Enable listing} | |
104 | .LE | |
105 | or to clear them | |
106 | .LS | |
107 | {$t-,p- No run-time tests, no post mortem analysis} | |
108 | .LE | |
109 | Notice that `+' always enables an option and `\-' always disables it, | |
110 | no matter what the default is. | |
111 | Thus `\-' has a different meaning in an option comment than it has on the | |
112 | command line. | |
113 | As shown in the examples, | |
114 | normal comment text may follow the option list. | |
115 | .NH 2 | |
116 | Pi (and pix) | |
117 | .PP | |
118 | We now summarize the options of | |
119 | .PI . | |
120 | These options may also be specified on the command line to | |
121 | .IX | |
122 | before the name of the file to be translated. | |
123 | Arguments to | |
124 | .IX | |
125 | after the name of the file to be translated are passed to | |
126 | the executed program run by | |
127 | .X . | |
128 | With each option we give its default setting, | |
129 | the setting it would have if it appeared on the command line, | |
130 | and a sample command using the option. | |
131 | Most options are on/off valued, | |
132 | with the | |
133 | .B b | |
134 | option | |
135 | taking a single digit value. | |
136 | .SH | |
137 | Buffering of the file output \- b | |
138 | .PP | |
139 | The | |
140 | .B b | |
141 | option controls the buffering of the file | |
142 | .I output . | |
143 | The default is line buffering, with flushing at | |
144 | each reference to the file | |
145 | .I input | |
146 | and under certain other circumstances detailed in section 5 | |
147 | below. | |
148 | Mentioning | |
149 | .B b | |
150 | on the command line, e.g. | |
151 | .LS | |
152 | % \*bpi -b assembler.p\fR | |
153 | .LE | |
154 | causes standard output to be block buffered, | |
155 | where a block is 512 characters. | |
156 | The | |
157 | .B b | |
158 | option may also be controlled in comments. | |
159 | It, unique among the | |
160 | .UP | |
161 | options, | |
162 | takes a single digit value rather than an on or off setting. | |
163 | A value of 0, e.g. | |
164 | .LS | |
165 | {$b0} | |
166 | .LE | |
167 | causes the file | |
168 | .I output | |
169 | to be unbuffered. | |
170 | Any value 2 or greater causes block buffering and is equivalent | |
171 | to the flag on the command line. | |
172 | The option control comment setting | |
173 | .B b | |
174 | must precede the | |
175 | .B program | |
176 | statement. | |
177 | .SH | |
178 | Include file listing \- i | |
179 | .PP | |
180 | The | |
181 | .B i | |
182 | option takes a list of | |
183 | .B include | |
184 | files, | |
185 | .B procedure | |
186 | and | |
187 | .B function | |
188 | names and causes these portions of the | |
189 | program to be listed while translating\*(dg. | |
190 | .FS | |
191 | \*(dg\*bInclude\fR files are discussed in section 5.9. | |
192 | .FE | |
193 | All arguments after the | |
194 | .B \-i | |
195 | flag up to the name of the file being translated, | |
196 | which ends in `.p', are in this list. | |
197 | Typical uses would be | |
198 | .LS | |
199 | % \*bpix -i scanner.i compiler.p\fR | |
200 | .LE | |
201 | to make a listing of the routines in the file scanner.i, and | |
202 | .LS | |
203 | % \*bpix -i scanner compiler.p\fR | |
204 | .LE | |
205 | to make a listing of only the routine | |
206 | .I scanner . | |
207 | This option is especially useful for conservation-minded programmers making | |
208 | partial program listings. | |
209 | .SH | |
210 | Make a listing \- l | |
211 | .PP | |
212 | The | |
213 | .B l | |
214 | option enables a listing of the program. | |
215 | The | |
216 | .B l | |
217 | option defaults off. | |
218 | When specified on the command line, it causes | |
219 | a header line identifying the version of the translator in use | |
220 | and a line giving the modification time of the file being translated | |
221 | to appear before the actual program listing. | |
222 | The | |
223 | .B l | |
224 | option is pushed and popped by the | |
225 | .B i | |
226 | option at appropriate points in the program. | |
227 | .SH | |
228 | Eject new pages for include files \- n | |
229 | .PP | |
230 | The | |
231 | .B n | |
232 | option causes | |
233 | .PI | |
234 | to eject a new page in the listing and print a header line at | |
235 | .B include | |
236 | file boundaries, providing automatic pagination control. | |
237 | To have effect, either the | |
238 | .B l | |
239 | or | |
240 | .B i | |
241 | option should also be specified, | |
242 | or the input should contain listing control in comments. | |
243 | An example would be | |
244 | .LS | |
245 | % \*bpi -in scan.i c.p\fR | |
246 | .LE | |
247 | .SH | |
248 | Post-mortem dump \- p | |
249 | .PP | |
250 | The | |
251 | .B p | |
252 | option defaults on, | |
253 | and causes the runtime system to initiate a post-mortem | |
254 | backtrace when an error occurs. | |
255 | It also cause | |
256 | .X | |
257 | to count statements in the executing program, | |
258 | enforcing a statement limit to prevent infinite loops. | |
259 | Specifying | |
260 | .B p | |
261 | on the command line disables these checks and the ability | |
262 | to give this post-mortem analysis. | |
263 | It does make smaller and faster programs, however. | |
264 | It is also possible to control the | |
265 | .B p | |
266 | option in comments. | |
267 | To prevent the post-mortem backtrace on error, | |
268 | .B p | |
269 | must be off at the end of the | |
270 | .B program | |
271 | statement. | |
272 | Thus, the Pascal cross-reference program was translated with | |
273 | .LS | |
274 | % \*bpi -pbt pxref.p\fR | |
275 | .LE | |
276 | .SH | |
277 | Standard Pascal only \- s | |
278 | .PP | |
279 | The | |
280 | .B s | |
281 | option causes many of the features of the | |
282 | .SM UNIX | |
283 | implementation which are not found in standard Pascal | |
284 | to be diagnosed as `s' warning errors. | |
285 | This option defaults off and is enabled when mentioned on the command line. | |
286 | Some of the features which are diagnosed are: | |
287 | non-standard | |
288 | .B procedure s | |
289 | and | |
290 | .B function s, | |
291 | extensions to the | |
292 | .B procedure | |
293 | .I write , | |
294 | and the padding of constant strings with blanks. | |
295 | In addition, all letters are mapped to lower case except in | |
296 | strings and characters so that the case of keywords and identifiers | |
297 | is effectively ignored. | |
298 | The | |
299 | .B s | |
300 | option is most useful when a program is to be transported, thus | |
301 | .LS | |
302 | % \*bpi -s isitstd.p\fR | |
303 | .LE | |
304 | .SH | |
305 | Runtime tests \- t | |
306 | .PP | |
307 | The | |
308 | .B t | |
309 | option controls the generation of tests that subrange variable | |
310 | values are within bounds at run time. | |
311 | By default these tests are generated. | |
312 | If the | |
313 | .B t | |
314 | option is specified on the command line, | |
315 | or in a comment which turns it off, | |
316 | then the tests are not generated. | |
317 | Thus the first line of a program to run without tests might be | |
318 | .LS | |
319 | {$t- No runtime tests} | |
320 | .LE | |
321 | Disabling runtime tests also causes | |
322 | .B assert | |
323 | statements to be treated as comments.\*(dg | |
324 | .FS | |
325 | \*(dgSee section A.1 for a description of | |
326 | .B assert | |
327 | statements. | |
328 | .FE | |
329 | .SH | |
330 | Card image, 72 column input \- u | |
331 | .PP | |
332 | Turning the | |
333 | .B u | |
334 | option on, either on the command line | |
335 | or in a comment causes the input to be treated as | |
336 | card images with sequence numbers and truncated to 72 columns. | |
337 | Thus | |
338 | .LS | |
339 | % \*bpix -u cards.p\fR | |
340 | .LE | |
341 | .SH | |
342 | Suppress warning diagnostics \- w | |
343 | .PP | |
344 | The | |
345 | .B w | |
346 | option, which defaults on, | |
347 | allows the translator to print a number of warnings about inconsistencies | |
348 | it finds in the input program. | |
349 | Turning this option off with a comment of the form | |
350 | .LS | |
351 | {$w-} | |
352 | .LE | |
353 | or on the command line | |
354 | .LS | |
355 | % \*bpi -w tryme.p\fR | |
356 | .LE | |
357 | suppresses these usually useful diagnostics. | |
358 | .SH | |
359 | Generate counters for an execution profile \- z | |
360 | .PP | |
361 | The | |
362 | .B z | |
363 | option, which defaults off, | |
364 | enables the production of execution profiles. | |
365 | By specifying | |
366 | .B z | |
367 | on the command line, i.e. | |
368 | .LS | |
369 | % \*bpi -z foo.p\fR | |
370 | .LE | |
371 | or by enabling it in a comment before the | |
372 | .B program | |
373 | statement we cause | |
374 | .PI | |
375 | to insert operations in the interpreter code to | |
376 | count the number of times each statement was executed. | |
377 | An example of using | |
378 | .XP | |
379 | was given in section 2.6; | |
380 | its options are described in section 5.5. | |
381 | .NH 2 | |
382 | Px | |
383 | .PP | |
384 | The first argument to | |
385 | .X | |
386 | is the name of the file containing the program to be interpreted. | |
387 | If no arguments are given, then the file | |
388 | .I obj | |
389 | is executed. | |
390 | If more arguments are given, they are available to the Pascal | |
391 | program by using the built-ins | |
392 | .I argc | |
393 | and | |
394 | .I argv | |
395 | as described in section 4.6. | |
396 | .ne 7 | |
397 | .PP | |
398 | .I Px | |
399 | may also be invoked automatically by the shell\*(dg. | |
400 | .FS | |
401 | \*(dgThis requires a modified shell. | |
402 | Such a shell is standard at Berkeley. | |
403 | .FE | |
404 | In this case, whenever a Pascal object file name is given as a command, | |
405 | the command will be executed with | |
406 | .X | |
407 | prepended to it; that is | |
408 | .LS | |
409 | % \*bobj primes\fR | |
410 | .LE | |
411 | will be converted by the shell to read | |
412 | .LS | |
413 | % \*bpx obj primes\fR | |
414 | .LE | |
415 | This feature makes using Pascal programs much more convenient. | |
416 | .NH 2 | |
417 | Pxp | |
418 | .PP | |
419 | .I Pxp | |
420 | takes, on its command line, a list of options followed by the program file | |
421 | name, which must end in `.p' as it must for | |
422 | .PI | |
423 | and | |
424 | .IX . | |
425 | .XP | |
426 | will produce an execution profile if any of the | |
427 | .B z | |
428 | .B t | |
429 | or | |
430 | .B c | |
431 | options are specified on the command line. | |
432 | If none of these options are specified, then | |
433 | .XP | |
434 | functions as a program reformatter. | |
435 | See section 5.5 for more details. | |
436 | .PP | |
437 | It is important to note that only the | |
438 | .B z | |
439 | option of | |
440 | .XP , | |
441 | and the | |
442 | .B n , | |
443 | .B u , | |
444 | and | |
445 | .B w , | |
446 | options, which are common to | |
447 | .PI | |
448 | and | |
449 | .XP | |
450 | can be controlled in comments. | |
451 | All other options must be specified on the command line to have any effect. | |
452 | .PP | |
453 | The following options are relevant to profiling with | |
454 | .XP : | |
455 | .SH | |
456 | Include the bodies of all routines in the profile \- a | |
457 | .PP | |
458 | .I Pxp | |
459 | normally suppresses printing the bodies of routines | |
460 | which were never executed, to make the profile more compact. | |
461 | This option forces all routine bodies to be printed. | |
462 | .SH | |
463 | Extract profile data from the file core \- c | |
464 | .PP | |
465 | This option causes | |
466 | .XP | |
467 | to extract the data from the file | |
468 | .I core | |
469 | in the current directory. | |
470 | This is used in debugging the Pascal system, and should not | |
471 | normally be needed. | |
472 | When an abnormal termination occurs in | |
473 | .X | |
474 | it writes the data to the file | |
475 | .I pmon.out . | |
476 | The | |
477 | .B z | |
478 | option enables profiling with data from this file. | |
479 | .SH | |
480 | Suppress declaration parts from a profile \- d | |
481 | .PP | |
482 | Normally a profile includes declaration parts. | |
483 | Specifying | |
484 | .B d | |
485 | on the command line suppresses declaration parts. | |
486 | .SH | |
487 | Eliminate include directives \- e | |
488 | .PP | |
489 | Normally, | |
490 | .XP | |
491 | preserves | |
492 | .B include | |
493 | directives to the output when reformatting a program, | |
494 | as though they were comments. | |
495 | Specifying | |
496 | .B \-e | |
497 | causes the contents of the specified files to be reformatted | |
498 | into the output stream instead. | |
499 | This is an easy way to eliminate | |
500 | .B include | |
501 | directives, e.g. before transporting a program. | |
502 | .SH | |
503 | Fully parenthesize expressions \- f | |
504 | .PP | |
505 | Normally | |
506 | .XP | |
507 | prints expressions with the minimal parenthesization necessary to | |
508 | preserve the structure of the input. | |
509 | This option causes | |
510 | .I pxp | |
511 | to fully parenthesize expressions. | |
512 | Thus the statement which prints as | |
513 | .LS | |
514 | d := a + b mod c / e | |
515 | .LE | |
516 | with minimal parenthesization, the default, will print as | |
517 | .LS | |
518 | d := a + ((b mod c) / e) | |
519 | .LE | |
520 | with the | |
521 | .B f | |
522 | option specified on the command line. | |
523 | .SH | |
524 | Left justify all procedures and functions \- j | |
525 | .PP | |
526 | Normally, each | |
527 | .B procedure | |
528 | and | |
529 | .B function | |
530 | body is indented to reflect its static nesting depth. | |
531 | This option prevents this nesting and can be used if the indented | |
532 | output would be too wide. | |
533 | .SH | |
534 | Print a table summarizing procedure and function calls \- t | |
535 | .PP | |
536 | The | |
537 | .B t | |
538 | option causes | |
539 | .XP | |
540 | to print a table summarizing the number of calls to each | |
541 | .B procedure | |
542 | and | |
543 | .B function | |
544 | in the program. | |
545 | It may be specified in combination with the | |
546 | .B z | |
547 | option, or separately. | |
548 | .SH | |
549 | Enable and control the profile \- z | |
550 | .PP | |
551 | The | |
552 | .B z | |
553 | profile option is very similar to the | |
554 | .B i | |
555 | listing control option of | |
556 | .PI . | |
557 | If | |
558 | .B z | |
559 | is specified on the command line, then all arguments up to the | |
560 | source file argument which ends in `.p' are taken to be the names of | |
561 | .B procedure s | |
562 | and | |
563 | .B function s | |
564 | or | |
565 | .B include | |
566 | files which are to be profiled. | |
567 | If this list is null, then the whole file is to be profiled. | |
568 | A typical command for extracting a profile of part of a large program | |
569 | would be | |
570 | .LS | |
571 | % \*bpxp -z test parser.i compiler.p\fR | |
572 | .LE | |
573 | This specifies that profiles of the routines in the file | |
574 | .I parser.i | |
575 | and the routine | |
576 | .I test | |
577 | are to be made. | |
578 | .NH 2 | |
579 | Formatting programs using pxp | |
580 | .PP | |
581 | The program | |
582 | .XP | |
583 | can be used to reformat programs, by using a command of the form | |
584 | .LS | |
585 | % \*bpxp dirty.p > clean.p\fR | |
586 | .LE | |
587 | Note that since the shell creates the output file `clean.p' before | |
588 | .XP | |
589 | executes, so `clean.p' and `dirty.p' must not be the same file. | |
590 | .PP | |
591 | .I Pxp | |
592 | automatically paragraphs the program, performing housekeeping | |
593 | chores such as comment alignment, and | |
594 | treating blank lines, lines containing exactly one blank | |
595 | and lines containing only a form-feed character as though they | |
596 | were comments, preserving their vertical spacing effect in the output. | |
597 | .I Pxp | |
598 | distinguishes between four kinds of comments: | |
599 | .HP | |
600 | .RS | |
601 | .IP 1) | |
602 | Left marginal comments, which begin in the first column of the | |
603 | input line and are placed in the first column of an output line. | |
604 | .IP 2) | |
605 | Aligned comments, which are preceded by no input tokens on the | |
606 | input line. | |
607 | These are aligned in the output with the running program text. | |
608 | .IP 3) | |
609 | Trailing comments, which are preceded in the input line by a token with | |
610 | no more than two spaces separating the token from the comment. | |
611 | .IP 4) | |
612 | Right marginal comments, which are preceded in the input line | |
613 | by a token from which they are separated by at least three spaces or a tab. | |
614 | These are aligned down the right margin of the output, | |
615 | currently to the first tab stop after the 40th column from the current | |
616 | ``left margin''. | |
617 | .RE | |
618 | .LP | |
619 | Consider the following program. | |
620 | .LS .ID | |
621 | % \*bcat comments.p\fR | |
622 | .so comments1.p | |
623 | .LE | |
624 | When formatted by | |
625 | .XP | |
626 | the following output is produced. | |
627 | .LS .ID | |
628 | % \*bpxp comments.p\fR | |
629 | .so commentsout | |
630 | % | |
631 | .LE | |
632 | The following formatting related options are currently available in | |
633 | .XP . | |
634 | The options | |
635 | .B f | |
636 | and | |
637 | .B j | |
638 | described in the previous section may also be of interest. | |
639 | .SH | |
640 | Strip comments \-s | |
641 | .PP | |
642 | The | |
643 | .B s | |
644 | option causes | |
645 | .XP | |
646 | to remove all comments from the input text. | |
647 | .SH | |
648 | Underline keywords \- \_ | |
649 | .PP | |
650 | A command line argument of the form | |
651 | .B \-\_ | |
652 | as in | |
653 | .LS | |
654 | % \*bpxp -_ dirty.p\fR | |
655 | .LE | |
656 | can be used to cause | |
657 | .XP | |
658 | to underline all keywords in the output for enhanced readability. | |
659 | .SH | |
660 | Specify indenting unit \- [23456789] | |
661 | .PP | |
662 | The normal unit which | |
663 | .XP | |
664 | uses to indent a structure statement level is 4 spaces. | |
665 | By giving an argument of the form | |
666 | \fB\-\fId\fR | |
667 | with | |
668 | .I d | |
669 | a digit, | |
670 | 2 \(<= | |
671 | .I d | |
672 | \(<= 9 | |
673 | you can specify that | |
674 | .I d | |
675 | spaces are to be used per level instead. | |
676 | .NH 2 | |
677 | Pcc and carriage control | |
678 | .PP | |
679 | The | |
680 | .UX | |
681 | system printer driver does not implement | |
682 | .SM FORTRAN | |
683 | style carriage control. | |
684 | Thus the function | |
685 | .I page | |
686 | on | |
687 | .UX | |
688 | does not output a character `1' | |
689 | in column 1 of a line, but rather puts out a form-feed | |
690 | character. | |
691 | For those who wish to use carriage control, the filter | |
692 | .I pcc | |
693 | is available which interprets this control. | |
694 | A sample usage is: | |
695 | .LS | |
696 | % \*bpx | pcc\fR | |
697 | .LE | |
698 | or | |
699 | .LS | |
700 | % \*bpix prog.p | pcc | lpr\fR | |
701 | .LE | |
702 | for printer copy. | |
703 | .I Pcc | |
704 | is fully described by its manual documentation | |
705 | .I pcc | |
706 | (VI). | |
707 | .NH 2 | |
708 | Pxref | |
709 | .PP | |
710 | The cross-reference program | |
711 | .I pxref | |
712 | may be used to make cross-referenced listings of Pascal | |
713 | programs. | |
714 | To produce a cross-reference of the program in the file | |
715 | `foo.p' | |
716 | one can execute the command: | |
717 | .LS | |
718 | % \*bpxref foo.p\fR | |
719 | .LE | |
720 | The cross-reference is, unfortunately, not block structured. | |
721 | Full details on | |
722 | .I pxref | |
723 | are given in its manual section | |
724 | .I pxref | |
725 | (VI). | |
726 | .NH 2 | |
727 | Pascals | |
728 | .PP | |
729 | A version of Wirth's subset Pascal translator | |
730 | .I pascals | |
731 | is available on | |
732 | .UX . | |
733 | It was translated to interpreter code by | |
734 | .PI | |
735 | and is invoked by a command of the form: | |
736 | .LS | |
737 | % \*bpascals prog.p\fR | |
738 | .LE | |
739 | The program in the file given is translated to interpretive code | |
740 | which is then immediately executed. | |
741 | .I Pascals | |
742 | is thus similar to | |
743 | .I pix . | |
744 | Only small programs can be handled. | |
745 | .I Pascals | |
746 | is most interesting to those wishing to study its error recovery techniques, | |
747 | which are described in Wirth's book | |
748 | .I "Algorithms + Data Structures = Programs" . | |
749 | .NH 2 | |
750 | Multi-file programs | |
751 | .PP | |
752 | A text inclusion facility is available with | |
753 | .UP . | |
754 | This facility allows the interpolation of source text from other | |
755 | files into the source stream of the translator. | |
756 | It can be used to divide large programs into more manageable pieces | |
757 | for ease in editing, listing, and maintenance. | |
758 | .PP | |
759 | The | |
760 | .B include | |
761 | facility is based on that of the | |
762 | .SM | |
763 | UNIX | |
764 | .NL | |
765 | C compiler. | |
766 | To trigger it you can place the character `#' in the first portion of | |
767 | a line and then, after an arbitrary number of blanks or tabs, | |
768 | the word | |
769 | `include' | |
770 | followed by a filename enclosed in single `\(aa' or double `"' quotation | |
771 | marks. | |
772 | The file name may be followed by a semicolon `;' if you wish to treat | |
773 | this as a pseudo-Pascal statement. | |
774 | The filenames of included files must end in `.i'. | |
775 | An example of the use of included files in a main program would be: | |
776 | .LS | |
777 | \*bprogram\fR compiler(input, output, obj); | |
778 | ||
779 | #\*binclude\fR "globals.i" | |
780 | #\*binclude\fR "scanner.i" | |
781 | #\*binclude\fR "parser.i" | |
782 | #\*binclude\fR "semantics.i" | |
783 | ||
784 | \*bbegin\fR | |
785 | { main program } | |
786 | \*bend\fR. | |
787 | .LE | |
788 | .PP | |
789 | At the point the | |
790 | .B include | |
791 | pseudo-statement is encountered in the input, the lines from | |
792 | the included file are interpolated into the input stream. | |
793 | For the purposes of translate- and run-time diagnostics and | |
794 | statement numbers in the listings and post-mortem backtraces, | |
795 | the lines in the included file are numbered from 1. | |
796 | Nested includes are possible up to 10 deep. | |
797 | .PP | |
798 | See the descriptions of the | |
799 | .B i | |
800 | and | |
801 | .B n | |
802 | options of | |
803 | .PI | |
804 | in section 5.2 | |
805 | above; | |
806 | these can be used to control listing when | |
807 | .B include | |
808 | files are present. | |
809 | .PP | |
810 | .I Include | |
811 | control lines are never printed in a listing. | |
812 | If the | |
813 | .B n | |
814 | option is not set, they are replaced by a line containing | |
815 | the file name and a `:' character. | |
816 | This is the default setting. | |
817 | If the | |
818 | .B n | |
819 | new page option is enabled then the | |
820 | .B include | |
821 | line is replaced with a banner line similar to the first line | |
822 | of a listing. | |
823 | This line is placed on a new page in the listing. | |
824 | .PP | |
825 | When a non-trivial line is encountered in the source text after an | |
826 | .B include | |
827 | finishes, the | |
828 | `popped' filename is printed, in the same manner as above. | |
829 | .PP | |
830 | For the purposes of error diagnostics when not making a listing, the filename | |
831 | will be printed before each diagnostic if the current | |
832 | filename has changed since the last | |
833 | filename was printed. |