fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

Systematic Code Changes

fpt analyses the code of a program or suite of programs and reports errors and code metrics. It can also rewrite the code making systematic changes

The Changes to the Code

Code Formatting

fpt always reformats the input code in a style specified by the user. Please see Code Formatting. For this reason we recommend that the output files are written to a different directory or directory structure from the input files instead of overwriting them. Please see File Handling for a description of the way this is set up.

The output code may be written in free or fixed form. The line length, including and excluding comments, the indentation rules for declarations and control constructs, the spacing between keywords and symbols and the upper and lower case spelling of keywords, symbols, Fortran parameters, kind tags and exponent characters may all be specified.

fpt always writes the output files with file name extensions, upper and lower case spelling and to a directory structure specified by the user. Again see File Handling for a description.

Code Modernisation

There is a great deal more to code modernisation than reformatting to free format. The facilities include:

Automatic Error Correction

The automatic error corrections include:

Migration Between Systems

fpt has been used in many software migrations, in particular from VMS to ifort or ifx, and from Gould-SEL MPX to ifort, ifx or gfortran.

The VMS migration facilities include:

The Gould-SEL MPX migration facilities include:

Optimisation for Speed of Execution

Optimisations include:

It is expected that all but the last of these optimisations will be carried out as part of the build procedure for production code. Development should not be carried out on code with in-line expansion, loop unwinding or scalarisation.

Enforcement of Standards

Many of the code formatting commands are appropriate for code standardisation. In addition:

Changes for Software Research

Two research projects in particular required specialised processing by fpt. The first, the conversion of Fortran programs to run on a highly parallel system implemented on an FPGA, required:

The second tested the precisions required in real variables and in literal values in existing programs. This required:

All of the machinery for this study is included in the fpt distribution, and the fpt commands are available.

Code Obfuscation

Anyone like to guess what this does?

DO IABABH=1,3 AAAJAI(IABABH,1)=AABABC(IABABH,1,2)+AABABC(IABABH,1,3) AAAJAI(IABABH,2)=AABABC(IABABH,2,1)+AABABC(IABABH,2,3) AAAJAI(IABABH,3)=AABABC(IABABH,3,1)+AABABC(IABABH,3,2) DO IABABI=1,3 AABABD(IABABH,IABABI)=AABABE(IABABH,IABABI) AABABE(IABABH,IABABI)=AABABE(IABABH,IABABI)+(3*AAAJAI(IABABH, 1 IABABI)-AABABF(IABABH,IABABI))*AABAAB*0.5D0 AAAJCA(IABABH,IABABI)=AAAJCA(IABABH,IABABI)+0.5D0*(AABABE(IABABH, 1 IABABI)+AABABD(IABABH,IABABI))*AABAAB AABABF(IABABH,IABABI)=AAAJAI(IABABH,IABABI) ENDDO ENDDO

The answer is here

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