Table of Contents
Previous: -list
Option: makedcls
-makedcls=num
Prepare a neatly-formatted file of declarations
of variables, common blocks, and namelist lists, for possible merging
into the source code. The declarations are stored in a file of the same
name as the source code, but with the extension changed to .dcl. If no declarations
are written to the file, it is deleted to reduce clutter from empty files.
If input comes from standard input, instead of a named file, then declarations
are written to standard output.
Variables are declared in alphabetical
order within each declaration class and type, with integer variables first,
because of their later possible use in array dimensions.
PARAMETER statements
are an exception to the alphabetical order rule, because the Fortran 77
Standard requires that the expressions defining parameter values refer
only to constants and already-defined parameter names. This forces the
original source file order of such statements to be preserved in the declaration
files.
Explicit declaration of all variables is considered good modern
programming practice. By using compiler options to reject undeclared variables,
misspelled variable names (or names extending past column 72) can be caught
at compile time. Explicit declarations also greatly facilitate changing
floating-point precision with filters such as dtoq(1L)
, dtos(1L)
, fd2s(1L)
,
fs2d(1L)
, qtod(1L)
, and stod(1L)
. These programs are capable of changing
types of explicit floating-point type declarations, intrinsic functions,
and constants, but because they do not carry out rigorous lexical and
grammatical analysis of the Fortran source code, they cannot provide modified
type declarations for undeclared variables. Default setting = 0, turn-on
= 1.
The setting values are given by the sum of selected option values
from the following list:
- 0:
- Do not write a declaration file.
- 1:
- Write
a declaration file.
- 2:
- Normally, all variables are included in the declaration
file. With this option, include only undeclared variables. This setting
is useful if you want to check for undeclared variables, since Fortran
source files with all variables properly declared will not result in a
.dcl file. With this option, common blocks and namelist lists will not be
included in the declaration file, since by their nature they cannot be
undeclared.
- 4:
- The declarations are normally prettyprinted to line up
neatly in common columns, as in the declaration files output by the Extended
PFORT Verifier, pfort(1L)
. This option value selects instead compact output,
without column alignment.
- 8:
- Causes continuation lines to be used where
permissible. The default is to begin a new declaration on each line. This
option is appropriate to use with the option for compact output.
- 16:
- Output
Fortran keywords in lowercase, instead of the default uppercase.
- 32:
- Output
variables and constants in lowercase, instead of the default uppercase.
Character string constants are not affected by this option.
- 64:
- Omit
declarations of internal integer variables produced by the SFTRAN3 preprocessor,
xsf3(1L)
, as part of the translation of structured Fortran statements
to ordinary Fortran. These variables have six-character names of the form
NPRddd, NXdddd, N2dddd, and N3dddd, where d is a decimal digit. Because
they are invisible in the SFTRAN3 source code, and will change if the
SFTRAN3 code is modified, such variables should not be explicitly declared.
Instead, they should just assume the default Fortran INTEGER data type
based on their initial letter, N.
- 128:
- Use an asterisk as the comment
character; the default is otherwise 'C'.
- 256:
- Use 'c' instead of 'C' or '*' as
the comment character.
- 512:
- Suppress dimensioning of arrays in the generated
declarations. This option is for use with code lacking type declarations,
to allow the declaration files to be inserted without change into the
code. Since the code will have dimension statements already, dimensioning
the array variables in the type statements of the declaration file is
redundant. This option should be used only in conjunction with option 2
= undeclared-only because otherwise any arrays that were dimensioned in
a type statement will lose their dimensioning.
If any non-zero value is
specified, then declaration output is selected, even if the value 1 was
not included in the sum.
The declaration files contain distinctive comments
that mark the start and end of declarations for each program unit, to
facilitate using text editor macros for merging the declarations back
into the source code.
The ftnchek distribution includes a program, dcl2inc
, which processes declaration files to produce files containing declarations
of all COMMON blocks, in a form suitable for use as INCLUDE files. See
the dcl2inc(1L)
man page for the details of its use.
Next: -novice