fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

REPLACE INTRINSIC IARGCOUNT

Syntax:

[DO NOT] REPLACE INSTRINSIC IARGCOUNT

Function:

The VMS intrinsic function IARGCOUNT returns the number of actual arguments passed to a sub-program. Additional arguments to IARGCOUNT return the values passed. IARGCOUNT is non-standard and the authors know or no implementation as an intrinsic outside VMS.

This command replaces invocations or the intrinsic IARGCOUNT with invocations of an external function with the same name. The arguments of the function are a default integer which specifies the number of formal arguments, followed by the formal argument list. Alternate return arguments are marked by the literal value 0.

The external function IARGCOUNT is provided by Sector7 USA LLC. as part of the VXRMS library. The function should be declared wherever it is used, and this may be achieved by inserting a USE statement for a module in all sub-programs, using the command USE MODULE IN ALL SUB-PROGRAMS.

Please note that an advanced fpt licence is required to use the command REPLACE INTRINSIC IARGCOUNT.

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

DO NOT REPLACE INTRINSIC IARGCOUNT

(Note that defaults may be changed in the configuration file)

Example

The test program:

! ***************************************************************************** ! t_replace_iargcount.for 19-Nov-20 John Collins ! ***************************************************************************** PROGRAM t_replace_iargcount ! s has no arguments and shouldn't be touched CALL s ! ! s_1 has 1 argument. We expect () WRITE(*,'(/," No arguments")') CALL s_1 WRITE(*,'(" 1 argument")') CALL s_1(1) ! s_5 has 5 arguments WRITE(*,'(/," No arguments")') CALL s_5 WRITE(*,'(" 3 arguments")') CALL s_5(1,2,3) WRITE(*,'(" 5 arguments")') CALL s_5(1,2,3,4,5) ! s_3 has 3 arguments including an alternate return WRITE(*,'(/," 2 arguments")') CALL s_3(42.0,*200) 200 CONTINUE END PROGRAM t_replace_iargcount ! ************************************* SUBROUTINE s CALL s_sfm(iargcount) WRITE(*,'(/, 1 " s: A statement which shouldn''t be modified")') END SUBROUTINE s ! **************************************************** SUBROUTINE s_1(i) INTEGER*4 :: i WRITE(*,'(" s_1: ",I4)')iargcount() END SUBROUTINE s_1 ! ************************************************** SUBROUTINE s_5(i,j,k,l,m) INTEGER*4 :: i,j,k,l,m ! No parentheses WRITE(*,'(" s_5: ",I4)')iargcount END SUBROUTINE s_5 ! ************************************************** SUBROUTINE s_3(x,*,y) REAL*4 :: x,y IF (x < 0.0) RETURN 1 ! An alternate return WRITE(*,'(" s_3: ",I4)')iargcount() END SUBROUTINE s_3 ! ************************************************** SUBROUTINE s_sfm(fun) ! This exists to have a reference to iargcount which isn't an invocation INTEGER*4,EXTERNAL :: fun END SUBROUTINE s_sfm ! ************************************************

is processed by the fsp file:

! t_replace_iargcount.fsp % primary output file name extension: ".f" % overwrite changed files % no column format declarations % upper case keywords % lower case symbols % replace intrinsic iargcount % correct missing arguments % missing arguments to be marked by commas % use module module_iargcount in all sub-programs % input directory: FPTTESTS: m_replace_iargcount.for t_replace_iargcount.for ! End of t_replace_iargcount.fsp

to generate the output:

!H!**************************************************************************** !H! File: t_replace_iargcount.f !H! Output by fpt 4.1iI Intel-Linux On 21-DEC-20 At 17:24:18 Input files: !H! Main: /home/john/projects/WinFPT/fpt/fpttests/t_replace_iargcount.fsp !H! Current: /home/john/projects/WinFPT/fpt/fpttests/t_replace_iargcount.for !H! Licensee: Denys Beauchemin. Sector7 Inc. Austin Texas USA. !H!**************************************************************************** ! ***************************************************************************** ! t_replace_iargcount.for 19-Nov-20 John Collins ! ***************************************************************************** C PROGRAM t_replace_iargcount C ! s has no arguments and shouldn't be touched USE module_iargcount !-------------------------^---------------------------------------------------- !!! FPT - 4169 USE statement inserted by fpt !------------------------------------------------------------------------------ C CALL s ! C ! s_1 has 1 argument. We expect () WRITE (*,'(/," No arguments")') CALL s_1(%VAL(0)) !--------------^--------------------------------------------------------------- !!! FPT - 2435 Missing argument(s) inserted !------------------------------------------------------------------------------ WRITE (*,'(" 1 argument")') CALL s_1(1) C C ! s_5 has 5 arguments WRITE (*,'(/," No arguments")') CALL s_5(,,,,) !--------------^----^---------------------------------------------------------- !!! FPT - 2435 Missing argument(s) inserted !------------------------------------------------------------------------------ WRITE (*,'(" 3 arguments")') CALL s_5(1,2,3,,) !--------------^--------------------------------------------------------------- !!! FPT - 2435 Missing argument(s) inserted !------------------------------------------------------------------------------ WRITE (*,'(" 5 arguments")') CALL s_5(1,2,3,4,5) C C ! s_3 has 3 arguments including an alternate return WRITE (*,'(/," 2 arguments")') CALL s_3(42.0,*200,) !--------------^--------------------------------------------------------------- !!! FPT - 2435 Missing argument(s) inserted !------------------------------------------------------------------------------ 200 CONTINUE C END PROGRAM t_replace_iargcount ! ************************************* C C SUBROUTINE s USE module_iargcount !-------------------------^---------------------------------------------------- !!! FPT - 4169 USE statement inserted by fpt !------------------------------------------------------------------------------ C CALL s_sfm(iargcount) WRITE (*,'(/, 1 " s: A statement which shouldn''t be modified")') END SUBROUTINE s ! **************************************************** C C SUBROUTINE s_1(i) USE module_iargcount !-------------------------^---------------------------------------------------- !!! FPT - 4169 USE statement inserted by fpt !------------------------------------------------------------------------------ C INTEGER*4::i WRITE (*,'(" s_1: ",I4)')iargcount(1,i) !----------------------------------------^------------------------------------- !!! FPT - 4259 IARGCOUNT modified to call an external routine !------------------------------------------------------------------------------ END SUBROUTINE s_1 ! ************************************************** C C SUBROUTINE s_5(i,j,k,l,m) USE module_iargcount !-------------------------^---------------------------------------------------- !!! FPT - 4169 USE statement inserted by fpt !------------------------------------------------------------------------------ C INTEGER*4::i,j,k,l,m ! No parentheses WRITE (*,'(" s_5: ",I4)')iargcount(5,i,j,k,l,m) !----------------------------------------^------------------------------------- !!! FPT - 4259 IARGCOUNT modified to call an external routine !------------------------------------------------------------------------------ END SUBROUTINE s_5 ! ************************************************** C C SUBROUTINE s_3(x,*,y) USE module_iargcount !-------------------------^---------------------------------------------------- !!! FPT - 4169 USE statement inserted by fpt !------------------------------------------------------------------------------ C REAL*4::x,y IF (x<0.0) RETURN 1 ! An alternate return WRITE (*,'(" s_3: ",I4)')iargcount(3,x,0,y) !----------------------------------------^------------------------------------- !!! FPT - 4259 IARGCOUNT modified to call an external routine !------------------------------------------------------------------------------ END SUBROUTINE s_3 ! ************************************************** C C SUBROUTINE s_sfm(fun) ! This exists to have a reference to iargcount which isn't an invocation USE module_iargcount !-------------------------^---------------------------------------------------- !!! FPT - 4169 USE statement inserted by fpt !------------------------------------------------------------------------------ C INTEGER*4,EXTERNAL::fun END SUBROUTINE s_sfm ! ************************************************

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