dcl2inc postprocessing declaration files output by
replacing unique COMMON block definitions by Fortran
INCLUDE statements. For each
.dcl file, a modified output
.dcn file is produced, together with include files named by the COMMON
block name, with filename extension
dcl2inc produces on
stdout a list of
Makefile dependencies for the UNIX
utility. These can be appended to the project
Makefile to ensure that any subsequent changes to
.inc files provoke recompilation of source files that include them.
dcl2inc warns about COMMONs which differ from their first occurrence, and
simply copies them to the output
.dcn file, instead of replacing them with an INCLUDE statement. Thus, any
COMMON statements that are found in the output
.dcn files should be examined carefully to determine why they differ: they
may well be in error.
Replication of identical data, and bugs arising from subsequent
modification of only part of it, is a significant reason why Fortran
programming projects should
require that COMMON declarations occur in separate include files, so that
there is only a
single point of definition of any global object.
Even though the Fortran
INCLUDE statement was tragically omitted from the 1977 Standard, it has long
been implemented by virtually all compiler vendors, and is part of the
1990 Standard. In practice, there is therefore no portability problem
associated with use of INCLUDE statements,
provided that one avoids nonportable file names. As long as the code obeys
Fortrans limit of six-character alphanumeric names, the filenames
dcl2inc will be acceptable on all current popular operating systems.
Fortrans default, or IMPLICIT, variable typing is deprecated in
modern programming languages, because it encourages sloppy
documentation, and worse, bugs due to misspelled variables, or
variables that have been truncated because they extend past column 72.
If all variables used are explicitly typed, and a compiler option is
used to reject all program units with untyped variables, variable
spelling and truncation errors can be eliminated.
Variable declarations that have been produced automatically by a tool
have a consistent format that facilitates application of stream
editors (e.g. to change array dimensions or rename variables), and
simple floating-point precision conversion tools like