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

6 Tangle

If the scanner, parser, and analyser have successfully (i.e. with no errors, severe errors, or fatal errors) completed, and the Tangle option (`+O`) is turned on (it is by default), then the Tangle component of FunnelWeb is invoked to generate the product files specified in the `@O` macros of the input file.

The operation of Tangle is very simple. Each `@O` macro is expanded and written to a file of the same name. As there are a finite number of macros, and the analyser guarantees that the macro structure is non-recursive, Tangle is guaranteed to terminate.

Three remaining points are worth mentioning.

- Tangle expands macros using blank indentation unless the user has specified otherwise in an indentation pragma in the input file.
- Tangle keeps track of the length of the lines that it is writing and issues an error if any line of any product file that it generates is longer than the maximum. The maximum is the minimum of a value defaulted or specified in the input file, and the value (if any) provided by the `+w` command line argument.
- If there is more than one macro definition of the same name, then each such definition must have a different library level (`@L`). Tangle uses the macro definition that has the lowest library level and ignores the others completely.

Memory Use During Tangling

When FunnelWeb executes, it reads each input file (the main input file and any include files) into memory where they are kept for the duration of the run. This means that there must be room in memory for all of the input files. This approach is necessary to support FunnelWeb's unrestricted forward referencing.

In contrast, there is no requirement that there be enough memory to hold the product files, as these are written to disk sequentially during their expansion. Furthermore, FunnelWeb does not expand the values of actual parameters in memory.

This means that, so long as the input files fit in memory, your product files can be arbitrarily large. You can also pass arbitrary large arguments to FunnelWeb macros.

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