argmnt man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



VARARGS(3F)							   VARARGS(3F)

NAME
     varargs, argmnt, getadr, nullok, xetarg, retour - allow variable number
     of arguments in argument list

SYNOPSIS
     subroutine argmnt( nargs )
     integer*4 nargs

     subroutine getadr( n, iaddr )
     integer*4 n, iaddr

     integer*4 function nullok( n, iaddr )
     integer*4 n, iaddr

     subroutine xetarg( n, len, iarg )
     integer*4 n, len
     anytype iarg

     subroutine retour( nargs, len1, val1, len2, val2, ..., lenn, valn )
     integer*4 nargs, len1, len2, ..., lenn
     anytype val1, val2, ..., valn

DESCRIPTION
     These utilities are used to provide f77 support for subroutines with
     variable number of arguments.  In order to use these utilities, all
     variable argument subroutines must be declared in each source file before
     they are referenced or defined.   This is done by adding a $varargs
     compiler directive at the beginning of the source file.

     For example:

     $varargs vasub1 vasub2 vasub3

     where vasub1, vasub2, and vasub3 are the names of the variable argument
     subroutines which are referenced or defined in the current source file.

     argmnt returns the number of actual arguments in the integer variable
     nargs.  The default behavior is to count each character argument in the
     actual argument list as two arguments since both the character address
     and its length will be put on the argument stack.	The -chararg1 option
     can be used to count each character argument as only one argument.

     getadr returns the address of the nth argument in the variable iaddr.
     This function has to be used to get the length of a character argument
     since it is passed by value, not by reference like other Fortran
     arguments.

     nullok returns 0 if the address of the nth argument is the same as the
     address contained in the variable iaddr.

									Page 1

VARARGS(3F)							   VARARGS(3F)

     xetarg initializes len bytes of iarg with the value of the nth argument .

     retour returns values to the calling program by setting nargs actual
     arguments using len1, len2,..., lenn bytes of the values stored in the
     variables val1, val2,..., valn, respectively.

     In normal usage of variable argument subroutines, when the formal
     argument list is specified using the maximum number of arguments the
     subroutine can received, the argument addresses and return values are
     passed in the standard f77 convention.  The only utility needed in this
     case is argmnt to determine the number of actual arguments passed to the
     variable argument subroutine.

     The other utilities are needed when there is no formal argument list in
     the variable argument subroutine. xetarg is normally used to initializes
     some local variables to the initial values of the actual arguments.
     retour is then used to return the locally calculated values back to the
     calling subroutine by setting the actual arguments to the values of the
     local variables.

     Example:

     $varargs chsign
	  program tvararg
	  i = 1
	  j = -2
	  k = 3
	  call chsign( i, j, k, "fourth argument", "fifth" )
	  print *, i, j, k
	  end

	  subroutine chsign()
     C	  This subroutine changes the sign of all integer arguments passed to it
     C	  and prints the value of all character arguments.  It assumes that
     C	  there are at most three integer arguments, followed by the character
     C	  arguments.  The way this subroutine is written it has to be compiled
     C	  with the -chararg1 option since it assumes that the lengths of the
     C	  character arguments can be obtained by using GETADR(NARGS+I) where
     C	  NARGS is the number of arguments returned by ARGMNT().
	  integer*4 val(3)
	  pointer (stradr, str)
	  character*(*) str

	  call argmnt( nargs )
	  print *, "Number of arguments = ", nargs
	  j = min(3,nargs)
	  do 10 i=1,j
	      call xetarg( i, 4, val(i) )
     10	  val(i) = - val(i)
     C	  Get the address and the length of the character arguments
	     do 100 i=j+1, nargs
		 call getadr( i, stradr )

									Page 2

VARARGS(3F)							   VARARGS(3F)

		 call getadr( nargs+i-j, lenstr )
		 write (*,*) str(1:lenstr)
     100     continue

	  call retour(j,4,val(1),4,val(2),4,val(3))
	  end

									Page 3

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net