GitArgGetI - Gets an integer argument value with checking against a range.

Function

Gets an integer argument value with checking against a range.

Description

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

If "range" is non-zero, it is an array with two entries - the lower and upper limits of the allowable range of actValue.

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

Language

C

Call

(void) = GitArgGetI (id, name, position, range, 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.
>rangeLong Int {[]}If non-null, array of two values, the lower and upper limit for value.
>defValLong IntThe Default value. Note, this is NOT validated against the range.
>flagsInt A bit-mask of flags. Possible values are

GIT_M_ARG_KEEPERR If we use the default value, return the error which caused it to be 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.

<actValueLong int *The actual value is written here.
!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__ARGLTMIN Argument value less than range[0].
GIT__ARGGTMAX Argument value greater than range[1].

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.
ErsPushErs Increase error context
ErsPopErs Decreate error context
ErsAnnulErs Annul error messages

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