[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Several attributes relate to the handling of arguments to options.
Each may appear only once, except for the arg-range
attribute.
It may appear as often as may be needed.
arg-range
section below for some considerations.
AutoOpts contains a library procedure to convert the string to a number.
If you specify range checking with arg-range
, then AutoOpts
produces a special purpose procedure for this option.
f
, F
, n
or N
(representing False or No). Anything else will be interpreted as True.
opt-name
,
the strings will be converted into an enumeration of type te_Opt_Name
with the values OPT_NAME_KEYWORD
. If you have not
specified a default value, the value OPT_NAME_UNDEFINED
will be
inserted with the value zero. The option will be initialized to that
value. You may now use this in your code as follows:
te_Opt_Name opt = OPT_VALUE_OPT_NAME; switch (opt) { case OPT_NAME_UNDEFINED: /* undefined things */ break; case OPT_NAME_KEYWORD: /* `keyword' things */ break; default: /* utterly impossible */ ; } |
AutoOpts produces a special purpose procedure for this option.
arg-type
is keyword
, then you must specify the
list of keywords by a series of keyword
entries. The interface
file will contain an enumeration of <OPT_NAME>_<KEYWORD>
for
each keyword entry.
string
or keyword
. If it is keyword
, then
this attribute may also specify the default keyword to assume when
the argument is not supplied. Without such a specification, the
default keyword will be the zero-valued keyword.
arg-type
specified, but not the arg-optional
attribute. That is to say,
the option argument must be required.
If you have done this, then any arguments that do not match an option
name and do not contain an equal sign (=
) will be interpreted as
an option argument to the default option.
arg-type
is number
, then arg-range
s may be
specified, too. If you specify one or more of these option attributes,
then AutoOpts will create a callback procedure for handling it. The
argument value supplied for the option must match one of the range
entries. Each arg-range should consist of either an integer by itself
or an integer range. The integer range is specified by one or two
integers separated by the two character sequence, ->
.
The generated procedure imposes some constraints:
INT_MIN
,
both for obvious reasons and because
that value is used to indicate a single-valued match.
The usage procedure displays these ranges by calling the callback
with the pOptDesc
pointer set to NULL
. Therefore,
all callback procedures designed to handle options with numeric
arguments must be prepared to handle a call with that
pointer set NULL
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |