FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


Systematic Code Changes

 

Changing Data Kinds and Sizes

CHANGE SIZE
 
Declarations and inserted or changed systematically throughout the code to change the kind and data size of the specified data type. Provision is made to specify that a type must be at least, or at most of a specified size. Thus it is possible to force all integers to be at least 4-bytes long without changing the declaration of 8-byte integers.
 

Changing the Way Declarations are Written

These commands systematically change declaration keywords and the style of declarations, but do not usually change the attributes of the variables declared or the behaviour of the code.

DECLARE ALL SYMBOLS
 
Declarations are inserted for all undeclared objects.
 
SPECIFY IMPLICIT NONE
 
Declarations are inserted for all undeclared objects. A leading IMPLICIT NONE declaration is inserted in all sub-programs where none is present. Other IMPLICIT declarations are removed.
 
SPECIFY GLOBAL SAVE
 
A global SAVE statement is inserted at the start of every sub-program. This emulates the behaviour of many legacy systems (In particular, VMS) and sometimes results in appreciable speed improvements.
 
SPECIFY NUMERIC SIZES
REMOVE NUMERIC SIZES
 
Declarations are modified systematically to insert the *n suffices to the data types or to remove them. Note that they are non-standard, but are supported by all major compilers. Removing them, without replacing them with standard Fortran 90 KIND specifications may change the behaviour of the code.
 
CHANGE KINDS TO DATA SIZES
CHANGE DATA SIZES TO KINDS
 
Convert declarations between the standard Fortran data kind specifications, For example, INTEGER(KIND=ki4) and data size specifications, for example, INTEGER*4.
CHANGE DOUBLE PRECISION TO REAL
CHANGE REAL*8 TO DOUBLE PRECISION
 
Change between declaring double precision real objects as DOUBLE PRECISION or as REAL*8 or REAL(KIND=kr8).
 
REMOVE NESTED STRUCTURE DECLARATIONS
 
Nested sub-structure declarations are named, and are moved before their parent STRUCTURE declarations.
 

Changing The Way Data Types and Variables are Used in the Executable Code

CORRECT INCONSISTENT ARGUMENTS
 
If the data type, data size or kind or passing protocol of an actual argument passed into a sub-program differ from those of the formal argument in the sub-program header, the code is modified to correct the attributes of the actual argument. Changes are marked in the code for inspection.
 
CORRECT INCONSISTENT STRING ARGUMENTS TO
 
Specifies the way in which inconsistent string arguments are to be handled.
 
CORRECT MISSING ARGUMENTS
 
Sub-program calls with missing arguments are corrected. Provision is made to supply variables for the missing arguments, to mark them with commas, or to supply null pointers.
 
CORRECT USE OF INTEGER FOR LOGICAL
 
Code is modified to correct the use of integer variables in contexts where logical variables are required. Provision is made to use the sign bit of the integer, the least significant bit or the zero/non-zero value to generate the logical value.
 
CHANGE EQ FOR LOGICAL
 
The operators .EQ. and .NE. are replaced by .EQV. and .NEQV. when used to compare logical objects.
EVALUATE INTRINSICS IN PARAMETER STATEMENTS
 
Intrinsic function invocations in PARAMETER statements are replaced by the literal values of the results.
 
CHANGE INTRINSICS TO GENERIC
 
Intrinsic functions are replaced by their generic equivalents.
 
ENFORCE INTENT IN AS DECLARED
 
Where a sub-program argument is declared INTENT IN, a check is made that it cannot be written to. If the argument can be written to, the code is modified to prevent the change.
 
REMOVE INTENT SPECIFICATIONS
 
All non-mandatory INTENT declaratons are removed from the code.
 
INTENT
 
This command is written in a comment in the code to specify the INTENT of an argument. It may be used in code for Fortran 77 compilers which do not support INTENT declarations, and is hidden from the compiler which may not therefore use the information in code generation.
 
PROTECT AGAINST DIVISION BY ZERO
 
Division operators, where the denominator is a variable, are replaced by function invocations. The functions trap and prevent division by values close to zero.
 
COUNT TRAILING WHITE SPACE IN STRINGS
 
This command handles the case where a string extends across a continuation line in fixed format code. Some compilers assume that the string extends to column 72, others count the number of trailing space characters on the line. This command selects the way in which the literal string length is computed. fpt inserts string delimiters to make the length unambiguous.
 

Changing the Way Control Constructs and Labels are Written

CHANGE DO CONTINUE TO DO ENDDO
 
DO - CONTINUE constructs are replaced by DO - ENDDO constructs and the statement labels are removed.
 
CHANGE IF TO IF THEN
 
IF statements with executable sub-clauses are replaced by IF - THEN constructs.
 
CHANGE SELECT CASE TO IF-THEN-ELSE
 
CASE statements are replaced by IF - THEN - ELSE constructs.
 
REMOVE LABELS FROM EXECUTABLE STATEMENTS
 
Labels are removed from executable statements and labelled CONTINUE statements are inserted before or after the original statements as appropriate.
 
REMOVE LABELS FROM ENDDO STATEMENTS
 
Labels are removed from ENDDO statements and from the corresponding DO and DO WHILE statements.
SEPARATE DO AND GOTO DESTINATION LABELS
 
If a DO construct and a GOTO or alternate return construct both direct control to the same statement label, labelled CONTINUE statements are inserted to accept control, and the original statement label is removed.
 
RENUMBER LABELS
 
All statement labels are renumbered. The label numbers are written in ascending order through all files in the code. Every label is unique.
 
CHANGE MULTIPLE ASSIGNMENTS TO SEPARATE STATEMENTS
 
Multiple assignment statements are split into separate statements.
 

Renaming Variables and other User-defined Symbols

EDIT SYMBOL NAMES
 
Systematically edits all user-defined symbol names in the code.
 
RENAME SYMBOL
 
Renames a specific symbol.
 
RENAME DUPLICATE SUBPROGRAMS
 
Systematically renames duplicate sub-programs by appending _2, _3 etc. to the original names.
 

Handling CPP Macros

#define
#undef
 
Defines or undefines a CPP macro. CPP macros are expanded by fpt as the code is processed.
 
HIDE CPP
 
The macro expansion is used in code analysis but the original macro text is reproduced in the code viewed interactively and in the output files.
 
SHOW CPP
 
The interpretation of the CPP macros is shown in the output. Use this command to inspect the behaviour of the CPP code, but note that it will not compile. Do not write this code to the output files.
 
EMULATE CPP
 
The code displayed interactively and written to the output files is that generated by expansion of the CPP macros.
 

Duplicate and Unused Sub-programs

CHANGE NAMES OF DUPLICATE SUBPROGRAMS
 
Systematically renames duplicate sub-programs by appending _2, _3 etc. to the original names.
 
DELETE UNUSED SUBPROGRAMS
 
Unused sub-programs are removed from the code generated by fpt. They are not deleted from the original input files.
 

Include Files

INSERT INCLUDE FILES INLINE
 
The text of INCLUDE files is inserted in-line in the output files. This should not change the executable code produced by a compiler, but overcomes a problem with some systems, in particular, HP-UX, where the line numbering information used by the debugger is corrupted when INCLUDE files are processed.
 


Copyright ©1995 to 2014 Software Validation Ltd. All rights reserved.