Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/gipsy/sub/presentc.dc2
Дата изменения: Wed Oct 5 18:40:19 1994
Дата индексирования: Fri Jan 16 20:40:51 2009
Кодировка:

Поисковые слова: chandra

Function: presentc

Purpose: Logical function checking the 'presence' of a character
argument in a subroutine/function call.

Category: UTILITY

File: present.c

Author: K.G. Begeman

Use: LOGICAL PRESENTC( CHARARG ) Input CHARACTER*(*)

PRESENTC Returns true is argument is present, false if not.
CHARARG Character argument in argument list which is
checked for its presence.

Description: PRESENTC is intended to be used in routines which perform
a different action depending on the 'presence' or
'absence' of certain character arguments.
In C procedures a character argument is considered not
present if the calling routine/program assigns NULL to
the character pointer of the fchar struct, in
FORTRAN or SHELTRAN one has to put the first element of
the common block NOARGC in the argument list.

Example: C SHELTRAN example to demonstrate use of presentc

PROGRAM MAINF
CHARACTER NULLC
COMMON /NOARGC/ NULLC
...
CALL SUB( NULLC )
...
STOP
END
SUBROUTINE SUB( ARG )
CHARACTER*(*) ARG
LOGICAL PRESENTC
IF (PRESENTC( ARG ))
THEN
...
CIF
RETURN
END

C example to demonstrate use of presentc
#include "gipsyc.h"
#include "presentc.h"

void sub( fchar arg )
{
if (presentc_c( arg )) {
...
}
}

main()
{
static fchar nullc = { NULL, 0 };
...
sub( nullc );
...
}

Warnings: System dependent!

Notes: Use PRESENTN for numeric arguments.

Updates: Jul 21, 1988: JPT, Original document.
Jul 12, 1989: KGB, Converted to ANSI C.
Apr 23, 1991: KGB, implemented for HP.