fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

CHANGE DATA SIZES TO KINDS

Syntax:

[DO NOT] CHANGE [DATA] SIZES TO [DATA] KINDS

Function:

All logical, integer, real and complex declarations with data size specifications of the form, for example, INTEGER*4 are re-written with data kind specifications, of the form, for example, INTEGER(KIND=ki4). Fortran parameters which define the kind values are declared in the module fpt_module_kinds written in the file with the same name, and with the current primary output file name extension, for example, fpt_module_kinds.f90. USE statements for this module are inserted systematically in all top-level sub-programs.

Please note:

The command CHANGE KINDS TO SIZES systematically replaces kind specifications with data size specifications. For a discussion of the relative advantages of kind and data size specifications please see Whether to use kinds or data sizes.

Where to Use this Command

Operating system command line Yes
Configuration file, config.fsp Yes
Specification (fsp) files, *.fsp Yes
Interactively, to FPT> prompt Yes
Interactive command files Yes
Embedded in the Fortran code No

Default

Declarations are not changed by default (Note that defaults may be changed in the configuration file).

Examples

The code fragment:

SUBROUTINE track_phase LOGICAL*4 fl,lstat INTEGER*4 i,j,k,n_val,ie INTEGER*1 b REAL*4 dx,dh,ddx,ddh REAL*8 x,h,xic,hic COMPLEX*8 dphase COMPLEX*16 phase

is changed by the command written in an fsp file:

% change data sizes to kinds % suppress error 2255

to:

SUBROUTINE track_phase ! USE fpt_module_kinds ! LOGICAL(KIND=kl4)fl,lstat INTEGER(KIND=ki4)i,j,k,n_val,ie INTEGER(KIND=ki1)b REAL(KIND=kr4)dx,dh,ddx,ddh REAL(KIND=kr8)x,h,xic,hic COMPLEX(KIND=kr4)dphase COMPLEX(KIND=kr8)phase

Note that the diagnostic number 2255, which is used by fpt to mark the change, was suppressed by the SUPPRESS ERROR command.

The module fpt_module_kinds is written in the file fpt_module_kinds.fpt. The code is:

MODULE fpt_module_kinds ! IMPLICIT NONE ! INTEGER,PARAMETER :: kl1=1 INTEGER,PARAMETER :: kl2=2 INTEGER,PARAMETER :: kl4=4 INTEGER,PARAMETER :: kl8=8 INTEGER,PARAMETER :: ki1=SELECTED_INT_KIND(2) INTEGER,PARAMETER :: ki2=SELECTED_INT_KIND(4) INTEGER,PARAMETER :: ki4=SELECTED_INT_KIND(9) INTEGER,PARAMETER :: ki8=SELECTED_INT_KIND(18) INTEGER,PARAMETER :: kr4=SELECTED_REAL_KIND(6,37) INTEGER,PARAMETER :: kr8=SELECTED_REAL_KIND(15,307) INTEGER,PARAMETER :: kr16=SELECTED_REAL_KIND(33,4931) ! END MODULE fpt_module_kinds

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