Re: Re: Gengetopt 2.21 enhancement suggestions

Lorenzo Bettini <[email protected]> Thu, 18 Oct 2007 09:32:05 +0200
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
J. David Bryan wrote:
> On 17 Oct 2007 at 18:53, Lorenzo Bettini wrote:
> 
>> However, 90 would not be a valid enum (since it starts with a number) so
>> enum values should still be generated in some modified way...
> 
> Agreed.
> 
> 
>> ...e.g., enum_90 or ENUM_90, that was my main problem... 
> 
> Maybe "rotate_arg_90" or "rotate_enum_90"?
> 
> ("enum_<value>" would fail if two different options both had the same 
> "<value>", and "rotate_<value>" would fail if the option value were "given" 
> or "help" or "orig" or "arg".)
> 

OK so possible solutions are:

1. rotate_arg_90
2. rotate_enum_90
3. ROTATE_90

any preferences?

Actually the proposal of Gyozo, rotate_<value> might fail (though 
rarely) for the reasons exposed by David

> 
>> however, I'll work on this
> 
> Thanks!

my pleasure :-)

Please, keep in mind that using types (and enums) for values will 
require lots of changes to the generated code (at least this is my first 
impression) since the type of values will not always be string and will 
require to make the generated check functions more generic (to avoid 
code bloat).  This is the direction where the actual refactoring of 
generated code is going; if you take a look at the current version in 
CVS you'll see lots of usage of void pointers, unions and switch 
statements (with corresponding casts) to deal with different types... 
this is why I love C++'s polymorphism and really don't like C ;-)

Furthermore, using enums, there won't even be a fixed number of types, 
since each option using enum values will introduce a new type.

So, it's crucial to study a good design to implement this.

This is only to say that I might not make it to insert this new feature 
in 2.22, and, moreover, to ask for suggestions about this issue :-)

cheers
	Lorenzo

-- 
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net