Tutorial Developer Reference 1 Introduction 2 Interface 3 Scanner 4 Parser 5 Analyser 6 Tangle 7 Weave 8 Shell 9 Commands 10 Glossary 11 References SEARCH

3.10 Include Files

FunnelWeb provides an include file facility with a maximum depth of 10. When FunnelWeb sees a line of the form `@i <filename>`, it replaces the entire line (including the EOL) with the contents of the specified include file. FunnelWeb's include file facility is intended to operate at the line level. If the last line of the include file is not terminated by an EOL, FunnelWeb issues a warning and inserts one (in the copy in memory).

The `@i` construct is illegal if it appears anywhere except at the start of a line. The construct must be followed by a single blank. The file name is defined to be everything between the blank and the end of the line (no comments (`@!`) please!). Example: If the input file is

    "Uh Oh, It's the Fuzz. We're busted!" said Baby Bear.
    @i mr_plod.txt
    "Quick! Flush the stash down the dunny and split."
       said Father Bear.

and there is a file called `mr_plod.txt` containing

    "'Ello, 'Ello, 'Ello! What's all this 'ere then?"
       Mr Plod exclaimed.

then the scanner translates the input file into

    "Uh Oh, It's the Fuzz. We're busted!" said Baby Bear.
    "'Ello, 'Ello, 'Ello! What's all this 'ere then?"
       Mr Plod exclaimed.
    "Quick! Flush the stash down the dunny and split."
       said Father Bear.

As a point of terminology, FunnelWeb calls the original input file the input file and calls include files and their included files include files.

The include file construct operates at a very low level. An include line can appear anywhere in the input file regardless of the context of the surrounding lines.

FunnelWeb sets the special character to the default (`@`) at the start of each include file and restores it to its previous value at the end of the include file. This allows macro libraries to be constructed and included that are independent of the prevailing special character at the point of inclusion. The same goes for the input line length limit which is reset to the default value at the start of each include file and restored to its previous value afterwards.

Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved.