[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes the data that may be accessed from within the
option processing callback routines. The following fields may be used
in the following ways and may be used for read only. The first set is
addressed from the tOptDesc*
pointer:
These may be used by option procedures to determine which option they are working on (in case they handle several options).
These may be used by option procedures to determine which option was used to set the current option. This may be different from the above if the options are members of an equivalence class.
If AutoOpts is processing command line arguments, then this value will contain the current occurrence count. During the option preset phase (reading configuration files and examining environment variables), the value is zero.
The field may be tested for the following bit values
(prefix each name with OPTST_
, e.g. OPTST_INIT
):
Initial compiled value. As a bit test, it will always yield FALSE.
The option was set via the SET_OPT()
macro.
The option was set via a configuration file.
The option was set via a command line option.
This is a mask of flags that show the set state, one of the above four values.
This bit is set when the option was selected by an equivalenced option.
This bit is set if the option is to be disabled.
(Meaning it was a long option prefixed by the disablement prefix, or
the option has not been specified yet and initializes as disabled
.)
As an example of how this might be used, in AutoGen I want to allow
template writers to specify that the template output can be left
in a writable or read-only state. To support this, there is a Guile
function named set-writable
(see section ‘set-writable’ - Make the output file be writable).
Also, I provide for command options ‘--writable’ and
‘--not-writable’. I give precedence to command line and RC
file options, thus:
switch (STATE_OPT( WRITABLE )) { case OPTST_DEFINED: case OPTST_PRESET: fprintf(stderr, zOverrideWarn, pCurTemplate->pzFileName, pCurMacro->lineNo); break; default: if (gh_boolean_p( set ) && (set == SCM_BOOL_F)) CLEAR_OPT( WRITABLE ); else SET_OPT_WRITABLE; } |
Pointer to the latest argument string. BEWARE If the argument type is numeric, an enumeration or a bit mask, then this will be the argument value and not a pointer to a string.
The following two fields are addressed from the tOptions*
pointer:
Points to a NUL-terminated string containing the current program name, as retrieved from the argument vector.
Points to a NUL-terminated string containing the full path of the current program, as retrieved from the argument vector. (If available on your system.)
Note these fields get filled in during the first call to
optionProcess()
. All other fields are private, for the exclusive
use of AutoOpts code and are subject to change.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.