-
FTANGLE will translate into unsigned decimal numbers the binary
notation ‘0b...’, the octal notation ‘0...’, and the
hexadecimal notation ‘0x...’. Thus, ‘0b101’ expands to 5,
‘0101’ expands to 65, and ‘0x101’ expands to 257.
- Don’t use the column 1 ‘C’ commenting convention. Use ‘/*
... */’ or ‘// ...’.
- For compiler directives, use ‘@?’ (see AT?), not a ‘C’ in
column 1.
- If you are going to use the recommended ‘// ...’ convention for
short comments, you must say ‘@n/’ (see -n/) or
‘@n9[-n/]’ as your language command. Otherwise, \FWEB\ will treat
the ‘//’ as \FORTRAN’S standard token for concatenation. (You
may always use ‘\/’ for concatenation.)
-
If you want to completely comment out a whole block of code,
use the preprocessor construction ‘@#if 0...@#endif’
(see Preprocessing). Don’t put a comment character at the beginning
of each line; that prevents FWEAVE from formatting the code
sensibly and can be annoying to undo. With the preprocessor form, one
can also implement conditional comments by using FWEB preprocessor
macros: e.g., ‘@#if(DEBUG)...@#endif’.
Pre-FWEB codes may have such blocks commented out with a ‘C’
in column 1. Those should be converted to the preprocessor
construction. However, if you’re in a real hurry, temporarily use the
‘-nC’ option (see -nC) to kill those lines very early in the
processing, before they can give you all kinds of trouble.
-
An unfortunate byproduct of using ‘//’ for short comments is that,
in general, format constructions like
format(//)
won’t work. (It
will work if one uses ‘-nC’; see -nC.) Alternatively, one
can say format(/ /)
.
- Consecutive lines commented out with a ‘C’, ‘c’, ‘*’, or
‘!’ in column 1 are converted into a single comment before
processing by FWEB. Large blocks of such lines (common in
pre-FWEB code) may overflow FWEB’s tables. To avoid that,
insert blank lines between some of the comments. Better, however, is to
move most such blocks out of the code part to the TeX part of the
section. It’s most readable to have only a few very short comments
interspersed in the code.
To help with conversion of existing codes, the command-line option
‘-nC’ can be used to completely ignore comment lines.
- ‘@’ commands should, by and large, start in column 1. That’s not
necessary for short module names that fit on one line. However, a long
module name that must be broken across lines must begin in column 1, as
in
@n
@
@a
@<This is a module name
broken across lines@>@;
Failure to do this results in a spurious semicolon being inserted in the
middle of the name. This happens because the FORTRAN-77 input driver
does various low-level manipulations of the source before it presents it
to the innards of FWEB; it’s not tokenizing the source at that time
and doesn’t understand all of the FWEB syntax such as module names.
- Define symbolic statement labels with ‘#:0’
(see Tokens). Such names should be followed by a colon. Thus,
@n
@
@m EXIT #:0
@m ABORT #:0
@a
.
.
ABORT: continue
.
.
EXIT: continue
.
.
- By default, statement labels are
\llap
’d from the body of the
statement. With this convention, long labels can extend too far into
the left margin. Instead, try the command-line option ‘-n:’
(see -ncolon), which puts them on a separate line. Alternatively, one
can redefine the macro \Wlbl
, found with some discussion in
fwebmac.sty.
-
As a suggestion, use upper case for I/O keywords such as
IOSTAT
.
However, by default the lower-case forms are also recognized. To permit
only upper case, use ‘-k’ (see -k). Note that although there
is a command ‘-nk’, it is unfortunately not related to ‘-k’.
-
One may use ‘^’ as an alternative for the exponentiation operator
‘**’.
-
FWEB attempts to be helpful and tries to expand the operators
‘++’, ‘--’, ‘+=’, ‘-=’, ‘*=’, and ‘/=’
in a way compatible with the usage in C and C++. For example, it
expands ‘x += y’ into ‘x = x + (y)’. This feature can be a
great time-saver and also makes the code substantially more legible; it
is strongly recommended. To turn off this feature, use the option
‘-+’. See -plus.
Notice that in FORTRAN-90 ‘/=’ is a token for “not equal,”
so if you want to use that you must use the ‘-+’ option. However,
a better solution is to use ‘!=’, FWEB’s preferred operator
for “not equal.”
-
By default, the operators
.true.
and .false.
will weave as
caligraphic T and F. That appearance be changed by redefining the macros
\WTRUE
and \WFALSE
in fwebmac.sty or in the limbo
section of your source file.
-
If FTANGLE messes up and outputs incorrect FORTRAN code, try
tangling with the command-line option ‘-#’ (see -#) (and then
report the problem.)