fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
Replicate Files
Fortran Input Files
fpt reads the primary files specified on the command line or in the user's Fortran Specification (fsp) files. Include files are identified by analysing the INCLUDE statements in the code. Each file is read only once.
Processing by fpt
Initially the input files are read as a token stream. Alphanumeric strings are represnted internally simply as names. fpt then identifies the Fortran keywords used in each statement and then the user-defined symbols. These symbols may represent sub-programs, variables, construct tags, argument labels and so on. The name tokens in the token stream are replaced by the Fortran keyword and symbol tokens. The same name may be used as a local variable in two or more sub-programs and these uses are different symbols. In a later analysis pass, fpt identifies the symbol lives and replaces the symbol tokens by life tokens. A symbol life starts with an assignment and ends when the last occurrence of the value assigned has been used. The same symbol may therefore be used in two or more lives. This analysis is important in detecting uninitialised variables and conflicts in units and dimensions.
Replication
Replication is carried out only for INCLUDE files. The replacement of names by symbols and of symbols by lives is unambiguous in the primary files. In INCLUDE files variables local to the sub-program which includes the file will be different in each use of the INCLUDE file, and if the INCLUDE file contains executable code the lives of the variable will almost certainly be different. fpt therefore makes multiple replicate copies of INCLUDE files where this occurs. The replication is initially internal to fpt processing.
Writing Replicate INCLUDE files
When fpt writes the output files it checks every replicate file to find whether the text is now different from the original copy. Differences may arise because of different diagnostics issued as a result of the different environments in which the INCLUDE file is referenced, from differences in cpp or DEC$ macro expansion, and as a result of the SYMBOL and SEPARATE LIVES commands. If differences occur the different INCLUDE files are renamed by adding _00, _01 etc. to the file names. The INCLUDE statements are changed to match.
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.