fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |

CHANGE CALL FUNCTION TO FUNCTION INVOCATION

Syntax:

CHANGE CALL [TO] FUNCTION [TO] [FUNCTION] INVOCATION

Function:

fpt reports a warning if a function is called by a CALL statement, as if it were a subroutine. These statements cause failures in linking or at run-time on some systems.

The command CHANGE CALL FUNCTION TO FUNCTION INVOCATION instructs fpt to change CALL statements to functions to function invocations. The invocations are written as assignments. A new variable is created to receive the function return value which is declared locally in every sub-program in which it is required. The new variable name is generated from the name of the function, with the suffix '_RETURN', but may be shortened to the length set by the NAME LENGTH command and modified to avoid name clashes. The function is also declared.

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 Yes

Default

The change is not made by default (Note that defaults may be changed in the configuration file).

Examples

The INTEGER function NAM2UNIX is called as a subroutine:

CALL NAM2UNIX(FSPEC,VMSPEC)

It is rewritten as

NAM2UNIX_RETURN=NAM2UNIX(FSPEC,VMSPEC) !------------------------------^--------------------------------- fpt - 2682 CALL to function replaced by function invocation !----------------------------------------------------------------

and NAM2UNIX and NAM2UNIX_RETURN are declared to be of type integer.

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