Task Parameters

     subroutine keyini
     subroutine keyr(keyword,value,default)
     subroutine keyd(keyword,value,default)
     subroutine keyi(keyword,value,default)
     subroutine keyl(keyword,value,default)
     subroutine keya(keyword,value,default)
     subroutine keyf(keyword,value,default)
     subroutine mkeyr(keyword,values,nmax,n)
     subroutine mkeyi(keyword,values,nmax,n)
     subroutine mkeya(keyword,values,nmax,n)
     subroutine mkeyf(keyword,values,nmax,n)
     logical function keyprsnt(keyword)
     subroutine keyfin
The key routines are used to get task parameters, which describe the processing that is to be performed. Typically the key routines will be called in the first few lines of the task, and never called again. All checking for the validity of the parameters should be carried out at this time.

Keyini initializes the key routines, and must be the first routine called. Similarly keyfin tidies up, and closes down. Keyr, keyd, keyi, keyl and keya return the value of a task parameter from the user. Their inputs are keyword (a character string) and default, the default value for the parameter. The keyword must be in lower case. The task parameter is returned in value. Keyi, keyr, keyl, keyd and keya are used for integer, real, logical, double precision and character values respectively. Only one value is returned at a time. The keyf routine is like keya, except that the string entered by the user is treated as a file name, and wildcard expansion is performed. The key routines can be called several times, giving the same keyword, and each successive call will get the next value associated with the keyword.

For example, if TRC is defined by the user as:

      % TRC = 45,50
then the code:
     call keyi('trc',n1,1)
     call keyi('trc',n2,1)
will return the values 45 and 50 to n1 and n2 respectively.

These routines always return a value, even if it is only the default value. To determine if a parameter was actually set by the use, the keyprsnt routine can be called. This returns .true. if a value for the keyword still remains. An alternate way to test if a value is still present is to use a default which is clearly illegal (e.g. a blank string for a file name, or 0 for a pixel index).

The mkey routine return all values entered by the user for that particular keyword where all the values of the keyword are of the same data type. For these routines values is an array of nmax elements. The number of values returned (which may be zero) is given by n.

Miriad manager
2011-08-19