GitArgGetL - Gets a logical argument value.

Function

Gets a logical argument value.

Description

Assumes "id" is an Sds Structure item containing the required argument and "name" if the name of the argument.

This routine fetches the value of a logical argument. There are several possibilties.

1.
The argument value can be converted to an integer and if non zero, it is considered true, otherwise false.

2.
The argument value can be converted to an integer and the LSB inidicates if the value is true or false.

3.
An array of strings is provided. The array contains pairs of TRUE/FALSE strings. For example, "TRUE" and "FALSE" themselves or "OPEN" and "SHUT" etc.

The value is first treated as an integer, the selection of technique 1 or 2 is based on a flag. If this conversion fails and the strings argument is provided, then technique three is tried.

If there is any error in getting the value, the actual value is set to that specified by "defVal" and status will be reset to OK, (see flags arguments to changes the effect on status).

Language

C

Call

(void) = GitArgGetL (id, name, position, strings, defVal, flags, actValue, status)

Parameters

(">" input, "!" modified, "W" workspace, "<" output)

>idSdsIdTypeId of the argument system.
>nameChar *Name of the argument to get
>positionintThe position of the argument. This is used if "name" is a null pointer, an empty string or if we can't find an SDS structure item of that name.
>stringsGitLogStrType {[]}If nonzero, then this is an array describing the possible values for TRUE and FALSE. "strings[n].true" is a pointer to a character string value representing TRUE, while "strings[n].false" is a pointer character string represeting FALSE. The maximum length is GIT_ARG_LMAX characters (20).

An entry containing two null pointers indicates the end of the array.

If zero, the argument should be able to be converted to an integer value.

>defValIntThe Default value.
>flagsInt A bit-mask of flags. Possible values are

GIT_M_ARG_UPPER Convert value to upper case.
GIT_M_ARG_LOWER Convert value to lower case.
GIT_M_ARG_LASTBIT If set, we only consider the LSB of integer values. If not set, only a value of 0 is false.
GIT_M_ARG_KEEPERR If we use the default value, return the error which caused it to be tasken.
GIT_M_ARG_ABBREV Allow abbreviations. The minimum abbreviation is 2 characters. The first value in the "strings" array which is correct to length of the supplied value is used.
GIT_M_ARG_KEEPVALERR Only retain the error if we found the item (and its value was in error). If we did not find the item, then return status ok and the default.

<actValueint *The actual value is written here. Set to 1 for true and 0 for false.
!statusStatusType *Modified status. If we have an error and GIT_M_ARG_KEEPERR is true then a message is reported using {\tt ErsRep} and status is set. In addition to error codes from the underlying Arg and Sds routines, one of the following may be returned

GIT__NOARG The argument id is zero or no item was found. Will not be returned if GIT_M_ARG_KEEPVALERR flag is set, in that case, just return the default with status ok.
GIT__ARGVAL Invalid argument value, not one of those specified in the strings array.

Include files

Git.h

External functions used

SdsFreeIdSds Free an sds id
GitArgNamePosGit Get an argument Id by name or position
ArgCvtArg Convert an id to a specified type.
ErsRepErs Report an error message
ErsPushErs Increase error context
ErsPopErs Decreate error context
ErsAnnulErs Annul error messages
islowerCRTL Determines if a character is lower case.
isupperCRTL Determines if a character is upper case.
toupperCRTL Convert a character to upper case.
tolowerCRTL Convert a character to lower case.
strcmpCRTL Compare one string to anoterh
strncpyCRTL Copy one string to another.

External values used

none

Prior requirements

As above

Support

Tony Farrell, AAO

Click here for the DRAMA home page and here for the AAO home page.

 For more information, contact tony.farrell@mq.edu.au