fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

DEC$ DEFINE

Syntax:

DEC$ DEFINE <symbol> DEC$ UNDEFINE <symbol>

Function:

fpt processes DEC$ directives in the Fortran code. Some directives use symbols which are specified in the compilation commands when the code is built. The DEC$ DEFINE and DEC$ UNDEFINE commands provide the facility to define or to undefine these symbols when fpt is run.

The DEC$ DEFINE and DEC$ UNDEFINE commands are position-sensitive. When DEC$ symbols are defined on the fpt command-line or in an fsp file the symbols are defined or undefined in the files which follow the command.

The definitions of DEC$ symbols are displayed by the command SHOW DEC$ SYMBOLS

DEC$ directives are supported under (at least) VMS, CVF, HP-UX and ifort.

Where to Use this Command

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

Default

No DEC$ symbols are defined by default.

Example

The test program t_decd_if.f90 contains the code fragment enclosed in a DEC$ IF construct:

!DEC$ if defined (CRASH) WRITE(*,'("iter:",I8)')iter !DEC$ endif

If fpt is run without a definition of the symbol CRASH fpt does not process the lines between DEC$ IF and DEC$ ENDIF. These lines are treated as if they were comments. A search for the symbol iter then shows:

FPT> find iter SEARCH - Searching all files Symbol(s) sought: Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ iter t_decd_if LOCAL INTEGER *4 1 symbol selected Target found at line: 11 in file: /home/john/projects/WinFPT/fpt/fpttest/t_decd_if.f90 7 ! 8 ! 9 REAL*8 time_8 10 REAL*8 end_time_8 11 >> INTEGER*4 iter 12 INTEGER*4 ie 13 ! FPT> next Target found at line: 18 in file: /home/john/projects/WinFPT/fpt/fpttest/t_decd_if.f90 16 ! 17 DO WHILE (time_8 < end_time_8) 18 >> iter=iter+1 19 ! 20 !DEC$ IF DEFINED(crash) 21 WRITE (*,'("iter:",I8)')iter 22 !DEC$ ENDIF FPT> FPT> next Target found at line: 18 in file: /home/john/projects/WinFPT/fpt/fpttest/t_decd_if.f90 16 ! 17 DO WHILE (time_8 < end_time_8) 18 >> iter=iter+1 19 ! 20 !DEC$ IF DEFINED(crash) 21 WRITE (*,'("iter:",I8)')iter 22 !DEC$ ENDIF FPT> next NEXT/FIND/SEARCH - Target not found. FPT>

If CRASH is defined, for example by the command-line command:

john@gemsbok:~/projects/WinFPT/fpt/fpttest$ fpt "%dec$ define crash" t_decd_if.f90 %i

the search for iter then finds the symbol which has been identified by fpt:

: : FPT> n Target found at line: 18 in file: /home/john/projects/WinFPT/fpt/fpttest/t_decd_if.f90 16 ! 17 DO WHILE (time_8 < end_time_8) 18 >> iter=iter+1 19 ! 20 !DEC$ IF DEFINED(crash) 21 WRITE (*,'("iter:",I8)')iter 22 !DEC$ ENDIF FPT> n Target found at line: 21 in file: /home/john/projects/WinFPT/fpt/fpttest/t_decd_if.f90 17 DO WHILE (time_8 < end_time_8) 18 iter=iter+1 19 ! 20 !DEC$ IF DEFINED(crash) 21 >> WRITE (*,'("iter:",I8)')iter 22 !DEC$ ENDIF 23 ! 24 ! Compute the derivatives 25 CALL deriv(ie) FPT>

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