Description:
This
application analyses a sequence of Fortran 77 source code files, divides their contents into program
units, and produces statistics about the number and distribution of code and comment lines in each
unit. These statistics are compared with typical values expected for well-crafted Fortran 77 code and
obvious deviations from the expected values are flagged.
It is intended as a quick-look tool for assessing the size and likely quality of a Fortran 77 software
system and is based on the observation that adequate commenting is one of the first things to be
sacrificed if corners are cut during code development. A relatively simple analysis of comment and
code lines can therefore reveal if this has occurred and can highlight potential trouble spots for visual
inspection.
Usage:
FORSTATS IN [OUT]
Parameters:
IN() = LITERAL (Read)
A list of
(optionally wild-carded) file specifications which identify the Fortran 77 source code files to
be used for input. Up to 10 values may be given, but only a single specification such as
’.FOR’
is normally required. There is no limit to the number of program units which may be held in each
input file.
KEY = _LOGICAL (Read)
If KEY is set to TRUE, then a explanatory key will be appended
to the output statistics file to describe how to interpret the values it contains. If KEY is set to FALSE,
no such key will be appended. This parameter behaves as a latch and remains set to the
value previously used until a new value is specified on the command line. [TRUE]
OUT
= FILE (Write)
The file to which the statistics derived from the input source code will
be written. This file is intended for printing. [FORSTATS.LIS]
Examples:
FORSTATS
.FOR
Analyses the source
code held in the files .FOR
and writes a summary of the derived statistics to the default output file FORSTATS.LIS. This file may
then be printed. FORSTATS SOFTWARE.FOR SOFTWARE.LIS NOKEY
Analyses the source code
held in the file SOFTWARE.FOR and writes the derived statistics to the file SOFTWARE.LIS. No
explanatory key is written to the output file on this or subsequent invocations of FORSTATS
until a TRUE value is given for the KEY parameter on the command line. FORSTATS
IN=["A.FOR","B.FOR"]
OUT=ANALYSIS.LIS
In this example, a sequence of input file specifications is given and each will be
analysed in turn. The combined statistics will be written to the file ANALYSIS.LIS. Notes:
This is a
general-purpose tool and may be used on any Fortran 77 software system, since it does not depend on
any particular layout or format. However, the analysis performed does include a test for the
existence of prologue information. For this purpose, prologues are taken to be delimited by
’’ or
’-’ characters appearing in the second column of a comment line. Note that unlike some other SST
applications, both these characters are considered as equivalent by FORSTATS; i.e. the first
occurrence begins a prologue and the second occurrence ends it, regardless of which character is
used.
Timing
The execution time is approximately proportional to the total number of
source code lines supplied for analysis. The time will be increased somewhat if the code
resides in a large number of separate files, due to the need to open and close each file.
Copyright © 2000 Council for the Central Laboratory of the Research Councils