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: Gyozo, PAPP (VBuster)
Subject: RE: [help-gengetopt] enums for string values
Date: Tue, 11 Apr 2006 11:04:58 +0200

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?


" I'll work on this!

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




reply via email to

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