Gyozo, PAPP (VBuster) wrote:
Hi,
from time to time I run into the same situation to lookup string
values in gengetopt generated arrays (you know _values postfixed
variables with "/* Possible values for ...*/" comment) to map
user-given parameters into integer value, that is, the index of the
array.
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 work on this!
thanks
cheers
Lorenzo
--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| PhD in Computer Science |
| Dip. Sistemi e Informatica, Univ. di Firenze |
| 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 |
+-----------------------------------------------------+
_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt