FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


CORRECT MISSING ARGUMENTS

Syntax:

[DO NOT] CORRECT MISSING ARGUMENTS

Function:

FPT checks that the actual arguments passed in a subroutine or function call match the formal arguments specified in the subroutine or function definition. Arguments missing from the call are inserted.

The way in which the missing arguments are supplied is controlled separately for numeric and for character arguments, by the commands:

MISSING NUMERIC ARGUMENTS TO BE MARKED BY COMMAS

MISSING NUMERIC ARGUMENTS TO BE REPLACED BY %VAL(0)

MISSING NUMERIC ARGUMENTS TO BE REPLACED BY SYMBOLS

MISSING STRING ARGUMENTS TO BE MARKED BY COMMAS

MISSING STRING ARGUMENTS TO BE REPLACED BY %VAL(0)

MISSING STRING ARGUMENTS TO BE REPLACED BY SYMBOLS

MISSING STRING ARGUMENTS TO BE REPLACED BY SYMBOLS OF LENGTH: <integer>

DEFAULT LENGTH OF MISSING STRING ARGUMENTS: <integer>

These commands are most often used when code is migrated from systems such as VMS to Unix or Windows. Unix and Windows Fortran compilers usually pass sub-program argument addresses on the system stack. The called routine un-stacks the addresses. If the number of arguments in the call does not match the number required by the sub-program, a stack violation occurs.

Character arguments are handled as a special case because the string length is usually also placed on the stack when the routine is called, and un-stacked during sub-program execution.

%VAL(0) is used by some systems as a null pointer, to indicate an unused argument.

The changes made by FPT are best shown by example. If a subroutine code begins:

SUBROUTINE PRINTMAX(I1,I2,I3,I4) INTEGER I1,I2,I3,I4

and is invoked

CALL PRINTMAX(KAPPA,LAMBDA)

FPT modifies the call site, according to the settings:

% MISSING NUMERIC ARGUMENTS TO BE MARKED BY COMMAS

CALL PRINTMAX(KAPPA,LAMBDA,,)

% MISSING NUMERIC ARGUMENTS TO BE REPLACED BY %VAL(0)

CALL PRINTMAX(KAPPA,LAMBDA,%VAL(0),%VAL(0))

% MISSING NUMERIC ARGUMENTS TO BE REPLACED BY SYMBOLS

INTEGER*4 I3_ARG INTEGER*4 I4_ARG : CALL PRINTMAX(KAPPA,LAMBDA,I3_ARG,I4_ARG)

Similarly, if a subroutine is written:

SUBROUTINE AXLABEL(C1,C2,C3,C4) CHARACTER*16 C1,C2,C4 CHARACTER*(*) C3

and invoked:

CALL AXLEBEL('Depth','ft')

the call site is modified:

% DEFAULT SIZE FOR MISSING STRING ARGUMENTS: 32
% MISSING STRING ARGUMENTS TO BE REPLACED BY SYMBOLS

CHARACTER*32 C3_ARG CHARACTER*16 C4_ARG : CALL AXLEBEL('Depth','ft',C3_ARG,C4_ARG)

Note that the CHARACTER*(*) argument receives the default string argument size. A local variable may not be declared with a variable size.

% MISSING STRING ARGUMENTS TO BE REPLACED BY SYMBOLS OF LENGTH: 0

or, for IBM AIX systems,

% MISSING STRING ARGUMENTS TO BE REPLACED BY SYMBOLS OF LENGTH: 65536

The generated code is:

INCLUDE 'fpt_missing_string_argument.fpi' : CALL AXLABEL('Depth','ft',FPT_MISSING_STRING_ARGUMENT, 1 FPT_MISSING_STRING_ARGUMENT)

The INCLUDE file contains:

CHARACTER*0 FPT_MISSING_STRING_ARGUMENT COMMON /FPT_MISSING_STRING_COMMON/ 1 FPT_MISSING_STRING_ARGUMENT

or

CHARACTER*65536 FPT_MISSING_STRING_ARGUMENT COMMON /FPT_MISSING_STRING_COMMON/ 1 FPT_MISSING_STRING_ARGUMENT

Usually, the missing string arguments are specified with a length of zero, which is recognised by Compaq Visual Fortran, and most Unix systems as a null string. The length of 65536 is used for IBM AIX systems because CHARACTER*0 does not compile under AIX, but the AIX compiler treats a length of 65536 as if it were zero. A single variable in COMMON is used to save memory.

Note that the INCLUDE file fpt_missing_string_argument.fpi is overwritten if it already exists, and the size of FPT_MISSING_STRING_ARGUMENT is changed to the current setting.

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:

No correction is made by default (Note that defaults may be changed in the configuration file).


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