help-gengetopt
[Top][All Lists]
Advanced

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

Re: [help-gengetopt] enums for string values


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] enums for string values
Date: Thu, 13 Apr 2006 11:04:38 +0200
User-agent: Mail/News 1.5 (X11/20060228)

Gyozo, PAPP (VBuster) wrote:
Hi,

" -----Original Message----- " From: Lorenzo Bettini
[mailto:address@hidden " Gyozo, PAPP (VBuster) wrote: " > Hi, " > " > It would be nice if enums were generated beside string "
arrays (in the " > same order) and these enums were also set be
cmdline parser. The " > corresponding *_given could store the enum
value in case of simple " > (not multiple) option if enum offsets
start from 1 instead of 0. I " > don't know what to do with multiple
options now. (Of course, a very " > new tag in the cmdline structure
would be the most convenient " > solution.) " > " > A little example
w/ cmdline.ggo: option  "string-option" s "bla-bla" " >
typestr="LEVEL" values="off","normal","high" default="normal" no " >
 " > cmdline.c: char *cmdline_string_option_values[] = {"off",
"normal", " > "high", 0} ; /* Possible values for string-option. */ " > " > cmdline.h: enum cmdline_string_options { /* " >
cmdline_string_option_no_value = 0 -- do we need it? */ " >
cmdline_string_option_off = 1, cmdline_string_option_normal, " >
cmdline_string_option_high }; " " yes this is very useful, as for
multiple options I guess, as " you said, a new tab in the cmdline
structure would be the best thing.

I'll go more far :-) Options of type string with predefined
acceptable values (enums like "string-option" above!) can be treated
as real enums in most cases. I think it's not likely that someone
really wants to know what the user typed in just to know what logical
value (enum) (s)he choosed. So it may be unneccessary to store or
hold the real string arguments in this case just to store the mapped
enum values. What do you think?


mhhh... I really fear that as soon as I remove the string representations of enums some one will want it ;-)

thus I would keep both (for instance if you wanted to also print the string representations inserted by the user)


" I'll work on this!

You always work on what we say - it' quite impressive ;-)

that's part of the game :-D

cheers
        Lorenzo

--
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Tel +39 055 4237460, Fax +39 055 4237437           |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+





reply via email to

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