[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.6.5 Arg Type Set Membership

arg-type = set;

The argument must be a list of names each of which must match the strings “all”, “none” or one of the keywords (see section Keyword list) specified for this option. all will turn on all membership bits and none will turn them all off. Specifying one of the keywords will set the corresponding set membership bit on (or off, if negated) . Literal numbers may also be used and may, thereby, set or clear more than one bit.

The membership result starts with the previous (or initialized) result. To clear previous results, either start the membership string with ‘none +’ or with the equals character (‘=’). To invert (bit flip) the final result (regardless of whether the previous result is carried over or not), start the string with a carat character (‘^’). If you wish to invert the result and start without a carried over value, use one of the following: =^ or ^none+. These are equivalent.

The list of names or numbers must be separated by one of the following characters: ‘+-|!,’ or whitespace. The comma is equivalent to whitespace, except that only one may appear between two entries and it may not appear in conjunction with the or bar (‘|’). The ‘+|’ leading characters or unadorned name signify adding the next named bit to the mask, and the ‘-!’ leading characters indicate removing it.

The number of keywords allowed is constrained by the number of bits in a pointer, as the bit set is kept in a void * pointer.

If, for example, you specified first in your list of keywords, then you can use the following code to test to see if either first or all was specified:

 
uintptr_t opt = OPT_VALUE_OPTN_NAME;
if (opt & OPTN_NAME_FIRST)
    /* OPTN_NAME_FIRST bit was set */ ;

AutoOpts produces a special purpose procedure for this option. To set multiple bits as the default (initial) value, you must specify an initial numeric value (which might become inaccurate over time), or else specify arg-default multiple times. Do not specify a series of names conjoined with + symbols as the value for any of the arg-default attributes. That works for option parsing, but not for the option code generation.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on October 16, 2013 using texi2html 1.82.