Tab-Formatted Code
In Tab-formatted code, a leading tab character may be used to represent the
label field of the Fortran line. Continuation lines may be written with a
leading tab followed by a numeric continuation character. The continuation
characters then line up vertically under the first character of the statement
field. For example:
REAL
1 PHI, ! Roll
1 THETA, ! Pitch
1 PSI, ! Yaw
1 P, ! Roll rate
1 Q, ! Pitch rate
1 R ! Yaw rate
Tab-format is widely used under VMS and is acccepted by many systems,
including DEC (Compaq) Visual Fortran, HP-UX Fortran and SGI Fortran. It is not
accepted by several important systems, including IBM AIX Fortran, GNU gfortran and g77 and
Salford FTN77. These systems typically generate an error message for every
continuation line which starts with a tab.
How Wide is a Tab?
By default, Fortran compilers accept 72 significant characters in a fixed format
Fortran line. Text beyond column 72 is ignored and treated as a comment. Most
but not all systems have options or compiler switches to accept longer lines.
Compilers differ in the way in which they treat leading and embedded tabs
when counting the line length. Under VMS, tabs are always treated as 1 character
wide. Under Lahey FTN77, for example, a leading tab is counted as 5 or 6 spaces,
depending on whether the line has a continuation character. If tabs are expanded
to spaces, this pushes code into the comment field at the end of the line.
Sometimes this generates a compilation error, sometimes a run-time error and sometimes
simply an incorrect result.
Treatment of Tabs by FPT
FPT reads tab-formatted code in the same way as VMS, with the assumption that
tabs are one character wide. If the code has come from a non-VMS system, this
may have the effect of including an undelimited trailing comment in the code
line. If this occurs, it will usually cause a syntax error. If the last token on
the line is a symbol, there are usually spaces between the token and the
comment, and FPT then reports spaces in names or numbers. Comments delimited by
exclamation marks do not cause a problem.
FPT can write code in free format,
in tab-format or in
fixed format. It
may be instructed to keep embedded tabs,
to convert them to spaces, or
to remove them completely. When code
is written, tabs are counted as occupying the number of characters required to reach the next
tab stop, and the tab stops are set at 8 character intervals. A continuation line is generated
automatically if the line would otherwise extend past column 72. The spacing of the output code should
compile safely on all systems.
|