The most general form of a language command is
@[L]ltext[options]
where l is a language symbol, text is converted into the option ‘-ltext’, and options have the same syntax as on the command line.
The language symbols must be in lower case; they are
C c
C++ c++
Fortran-77 n
Fortran-90 n9
Ratfor-77 r
Ratfor-90 r9
TeX x
VERBATIM v
An example of a command with the optional text field is ‘@n/’. By definition, this is equivalent to ‘@n[-n/]’. Thus, it both sets the language and invokes a command-line option.
As another example, ‘@n9’ really means ‘@n[-n9]’. Thus the language is first set to FORTRAN, then reset to FORTRAN-90. One doesn’t need to worry about this detail.
@n9[-n&]
means set the language to FORTRAN–90 and use free-form syntax with the ampersand as the continuation character. (This construction is now FWEB’s default.)
The brackets may contain more than one space-delimited option.
A language command should appear somewhere in limbo, before the start of the first section. The language in effect at the beginning of the first section defines the global language. For historical reasons, the default language is FORTRAN-77, but do not rely on this; always include a language command.
Language commands may be used within sections, but the new language remains in force only for that section. The language of a named module is inherited from the language in effect at the time the name is first used. Thus, in the following example, the global language is FORTRAN–77, but an arbitrary number of C functions can be placed into a C-language module with just one ‘@c’ language-changing command.
@n @ @a program main end @c @<C@>@; @ @<C@>= int fcn() {}
FTANGLE will write two output files for this example—e.g., test.f and test.c. Particularly note that one did not need an ‘@c’ command in the last section because the language was C when ‘@<C@>’ was first encountered.
One important thing to keep in mind is that in FWEB an identifier may have, for each language, precisely one meaning throughout the document. This restriction is not necessarily in accord with the syntaxes of the various source languages. See, for example, the discussions in Cpp and Fortran.