Function: presentn Purpose: Logical function checking the 'presence' of a numeric argument in a subroutine/function call. Category: UTILITY File: present.c Author: K.G. Begeman Use: LOGICAL PRESENTN( NUMARG ) Input any type except character PRESENTN Returns true if argument is present, false if not. NUMARG Numeric argument in argument list which is checked for its presence. Description: PRESENTN is intended to be used in routines which perform a different action depending on the 'presence' or 'absence' of certain numeric arguments. In C procedures a numeric argument is considered not present if the calling routine/program puts NULL instead of a pointer to a variable in the argument list, in FORTRAN or SHELTRAN one has to put the first element of the common block NOARGN in the argument list. Example: C SHELTRAN example to demonstrate use of presentn PROGRAM MAINF INTEGER NULLN COMMON /NOARGN/ NULLN ... CALL SUB( NULLN ) ... STOP END SUBROUTINE SUB( ARG ) REAL ARG LOGICAL PRESENTN IF (PRESENTN( ARG )) THEN ... CIF RETURN END C example to demonstrate use of presentn #include "gipsyc.h" #include "presentn.h" void sub( float *arg ) { if (presentn_c( arg )) { ... } } main() { ... sub( NULL ); ... } Warnings: System dependent! Notes: For character arguments use PRESENTC. Updates: Jul 21, 1988: JPT, Original document. Jul 12, 1989: KGB, Converted to ANSI C. Apr 23, 1991: KGB, implemented for HP.