fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
Specifying a Symbol
Many fpt commands operate on one or more symbols. The show symbol command, for example, accepts a comma-separated list of symbol specifications. The general form of a symbol specification is:
[[ [ <class> : ] <grand-parent> % ] <parent> % ] <target>
Where the [ ] characters enclose optional components. The parent-child chain may be extended as far as is appropriate. There may, for example, be a module which contains a module subroutine which in turn contains an internal subroutine which contains a derived type with type components. Fortran structures (Which are non-standard but widely supported) may contain sub-structures to an arbitrary depth of nesting.
Spaces are not required to be written around the % character parent-child separators. The % character is always used as the separator, even in the case of structures, sub-structures and fields.
The <class> specification optionally specifies that the first name in the specification is a top-level program unit. It is the keyword MODULE, PROGRAM, SUBROUTINE or FUNCTION. The keywords SUBROUTINE and FUNCTION may not be used to specify a module sub-program or an internal sub-program.
The target name may be the name of any user-defined symbol, for example, a sub-program name, a variable name, a derived type name, a type component name, a record name or the name of a control construct tag.
In the special case of COMMON block names and variables in COMMON, the target may be specified:
/ <target> / | where the target is the COMMON block symbol itself |
// <target> |
where the target is a variable in the default COMMON |
/ <COMMON_name> / <target> | where the target is in the named COMMON block |
fpt matches, and operates on, all of the symbols with matching names in the specified scope. If no scope is specified, all symbols with matching names are selected. For example, in the following code:
MODULE module_m IMPLICIT NONE CONTAINS SUBROUTINE sort(ia) INTEGER :: ia(10) INTEGER :: i LOGICAL :: changed changed = .TRUE. DO WHILE (changed) changed = .FALSE. DO i = 2,10 IF (ia(i) < ia(i-1)) THEN CALL swap(ia(i),ia(i-1)) changed = .TRUE. ENDIF ENDDO ENDDO CONTAINS SUBROUTINE swap(i1,i2) INTEGER :: i1,i2 INTEGER i i = i1 i1 = i2 i2 = i END SUBROUTINE swap END SUBROUTINE sort END MODULE module_m PROGRAM test USE module_m IMPLICIT NONE INTEGER :: i, ia(10) DO i = 1,10 WRITE(*,'(I2,"> ",$)')i READ(*,*)ia(i) ENDDO CALL sort(ia) WRITE(*,'(/,10I6)')ia END PROGRAM test
the interactive show symbol command generates reports:
FPT> FPT> show symbol i Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ i test Local INTEGER *4 df i module_m%sort%swap Local INTEGER *4 df i module_m%sort Local INTEGER *4 df 3 matching symbols FPT> show symbol swap%i, swap%i1, swap%i2 Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ i module_m%sort%swap Local INTEGER *4 df 1 matching symbol Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ i1 module_m%sort%swap Formal Input-Output Argument INTEGER *4 df 1 matching symbol Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ i2 module_m%sort%swap Formal Input-Output Argument INTEGER *4 df 1 matching symbol FPT> show symbol module_m % sort % swap % i Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ i module_m%sort%swap Local INTEGER *4 df 1 matching symbol FPT>
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.