help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[help-gengetopt] Enumerated Options


From: Brian Minard
Subject: [help-gengetopt] Enumerated Options
Date: Sat, 3 Nov 2001 18:47:19 -0500

Hi,

I am wondering if anyone is working on the enumerated option type for
gengetopt?  If not, how about this as a proposal for implementing it.

Description file format for enumerated values is as follows.

        option long short desc enum required

Here, option, long, short, desc, and required have the meanings
currently associated with them.  The enum value is simply a value of
argtype (much like flag is today).

The required value applies to all members of the enumerated type.
That is, you MUST specify a value of the enumeration whenever any of
the enumerated types are required, or you MAY specify a value of the
enumeration whenever none of the enumerated values are required.

This design implies 1 enumerated type in a description file (and also
program).  Lists of enumerated types would be created as follows.

  1.optional enumerated values

    option value1 val1 "first value"  enum no 
    option value2 val2 "second value" enum no

    The enumerated type is not required and is contains the values
    "value1 and value2, or val1 and val2".

  2.required enumerated value (a yes associated with any enum value)

    option value1 val1 "first value"  enum yes
    option value2 val2 "second value" enum no

    OR

    option value1 val1 "first value"  enum no
    option value2 val2 "second value" enum yes

    The enumerated type is required whenever a yes appears in the
    required value.

I've intentionally ignored multiple enumerated types as a way towards
simplifying the resulting code.  Doing this seems to require a larger
change to the description file format.

Thanks,
Brian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]