Next: Structure, Previous: Processors, Up: Concepts [Contents][Index]
The FWEB processors perform their work in several distinct phases. (The following is somewhat technical. Scan it, then use it for reference later if necessary.)
FTANGLE has two phases. In phase 1, the source file is read; in phase 2, compilable code is written out in the order specified by the web.
More specifically, phase 1
- discards TeX documentation;
- tokenizes the source;
- expands FWEB preprocessor commands such as ‘@#if’ (see Preprocessing);
- expands ‘@'...'’ (see ATquote), ‘@"..."’ (see ATdquote), and the binary notation ‘0b...’ (see C) [in FORTRAN, also the octal notation ‘0...’ and the hexadecimal notation ‘0x...’];
- stores code text in appropriate modules;
- memorizes macro definitions (‘@d’ and ‘@m’) (see ATd and ATm).
Phase 2
- outputs outer macro definitions (‘@d’);
- outputs the unnamed module (‘@a’);
- expands FWEB macros (‘@m’);
- expands built-in macros such as ‘$IF’ or ‘$PI’ (see Built-in functions);
- translates RATFOR statements (see Ratfor).
FWEAVE has three phases. In phase 1, the source file is read and cross-reference information is collected. In phase 2, the source file is read again, then pretty-printed with some cross-reference information. (For discussion of pretty-printing, see Pretty-printing.) In phase 3, an automatically-generated Index, List of Modules, and Table of Contents are written.
More specifically, phase 1
- tokenizes and stores identifiers and module names;
- collects cross-reference information (including, in C and C++, the scanning of ‘#include’ files for ‘typedef’ and/or ‘class’ declarations (see -H_);
- stores limbo text definitions made with ‘@l’ (see ATl);
- collects information about overloaded operators (‘@v’) and identifiers (‘@W’). See ATv and ATW_.
Phase 2
- outputs limbo text;
- outputs special TeX macros for overloaded operators;
- copies TeX material directly to output;
- treats material between vertical bars (‘|...|’) as code to be typeset;
- tokenizes and stores contents of each code section;
- analyzes code syntax and converts it to appropriate TeX macros.
Phase 3 writes out cross-reference information. (To eliminate some of that, see -x.) Specifically, it
- writes out the Index (INDEX.tex by default, but see Output files and Index params);
- writes out a list of named modules (MODULES.tex by default, but see Output files and Module params);
- writes out macros to generate the Table of Contents. (Table of Contents information is actually processed by LaTeX, not FWEAVE. The information is written to the aux file.)
Next: Structure, Previous: Processors, Up: Concepts [Contents][Index]