fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

fpt_project_setup

Running fpt

Command-line fpt is run by the command:

$ fpt argument_1 argument_2 ...

where the arguments are Fortran file names, fpt commands or fpt specification files (fsp files). The fsp files are scripts which contain Fortran file names, fpt commands and references to other fsp files. For any non-trivial project the Fortran input files are listed in fsp files.

The utility fpt_project_setup may be used to set up an initial fpt project.

Running fpt_project_setup

The utility is launched by the command fpt_project_setup made without arguments in an operating system terminal window.

fpt_project_setup prompts for the project name. It creates a directory with this name in the current working directory, This is the root project directory. If the directory already exists a warning is issued that it will be overwritten and the user may choose not to continue. Two directories are created under the project directory, original_source which will contain copies of the Fortran files which are to be processed, and fpt which will contain the project fsp files.

The utility then prompts for the location of the Fortran files to be processed. The entire directory tree specified is copied to the original_source directory. The prompt is repeated, and more directory trees may be added, for example, to capture library files. Note that the directories and files are copied. They are not referenced through symbolic links. This is done for two reasons. Firstly, symbolic links are not supported by all file systems. Secondly, fpt may generate output files which will be written with the same directory structure as the input files. fpt follows symbolic links and would therefore write output files to directories outside the current project. This should be avoided.

When the user chooses to continue, three additional directories are created under the project directory, fpt_output which will receive the Fortran files written by fpt, modified_source, which will receive any files which the user chooses to modify as a result of fpt reports and diagnostics, and external which will hold any include files which are not within the original_source directory trees. The directory structures of fpt_output and modified_source are exactly the same as that of original_source but at this stage the directories are empty.

The directory structure created is then:

project_directory original_source first_Fortran_source_tree with source files second_Fortran_source_tree with source files : fpt_output first_Fortran_source_tree without source files second_Fortran_source_tree without source files : modified_source first_Fortran_source_tree without source files second_Fortran_source_tree without source files : external (empty) fpt (empty)

fpt_project_setup then checks that all of the Fortran modules used in the sources are available. If any are not, the module names are reported and the user is prompted to add more input files. Intrinsic modules are not included in the check. fpt cannot process code if Fortran modules are missing.

A check is then made that all include files are present in the sources. The directories in the INCLUDE statements are ignored in this check. They may be in a format from another operating system or may be unspecified. If include files are missing the user is prompted for their location and they are copied to the external directory.

The fsp files

fpt_project_setup writes two fsp files in the fpt directory. The first, <project>.fsp is simply a template, and invokes the second, <project>_files.fsp. They are, for example for the project t_setup:

!H! ************************************************************************************** !H! t_setup.fsp 16-Apr-25,12:18 Output by fpt_project_files v1.2 !H! ************************************************************************************** t_setup_files.fsp ! Insert formatting and engineering commands here ! End of t_setup.fsp

 

!H! ************************************************************************************** !H! t_setup_files.fsp 16-Apr-25,12:18 Output by fpt_project_files v1.2 !H! ************************************************************************************** % ignore directories in include statements % check modified source % keep directories % keep file name extensions % output directory: ../fpt_output % edit output file names: replace "original_source" by "fpt_output" % edit output file names: replace "modified_source" by "fpt_output" % infer input code layout from extension % input directory: ../original_source/t_project_setup/main module_m1.f90 t_project_setup.f90 % input directory: ../original_source/t_project_setup/subs % add to include input path: ../original_source/t_project_setup/inc s1.f90 s2.f90 % input directory: ../original_source/t_project_setup/subs/subs_sub % add to include input path: ../original_source/t_project_setup/inc s3.f90 % input directory: ../original_source/t_project_setup_env module_env.f90 ! End of t_setup_files.fsp

In explanation, the commands ignore directories in include statements is made in case the code has been migrated from a different operating system. The directories have been searched for the include files and the command % add to include input path has been used so that fpt will find them.

The command % check modified source directs fpt to search for each input file in the modified_source directory structure before searching original_source.

The % keep directories and % edit output file names are the mechanism by which the output files are redirected to fpt_output. The command % output directory directs any new Fortran files with no corresponding input file to the top level of fpt_output.

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