accept option arguments (even in enum)

View: New views
5 Messages — Rating Filter:   Alert me  

accept option arguments (even in enum)

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

long time was passing by since my last mail. It actually means the current version suffices our needs quite very well. Actually it is a good piece of work! Congratulation.

Now we have run into a problem. gengetopt denies special characters (ie. symbols like '-' or '+') in enum option values and in default values as well suspectedly.

We would like to have a filter option which filters out/in the specified type of records. We thought it was quite natural to do it in the following way:

option  "filter"  f
    "include or exclude the given type in case of leading '-' or '+', respectively."
    multiple enum
    values="-unspecified","-ok","-incompatible","-missing","-other",
           "+unspecified","+ok","+incompatible","+missing","+other",
           "problematic","all"
    default="problematic"
    optional

What do you think? gengetopt should enable symbols in enums or should we rephrase our idea? Please note that this option is multiple enum, so the real strength of this approach that custom mixed filter definitions can be described this way:

--filter=+other,-missing


--
Papp, Gyozo
VirusBuster Kft


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: accept option arguments (even in enum)

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Papp Gyozo (VBuster) wrote:
> Hi there,
>
> long time was passing by since my last mail. It actually means the current version suffices our needs quite very well. Actually it is a good piece of work! Congratulation.

thanks a lot!
this kind of emails always makes me happy :-)

>
> Now we have run into a problem. gengetopt denies special characters (ie. symbols like '-' or '+') in enum option values and in default values as well suspectedly.
>
> We would like to have a filter option which filters out/in the specified type of records. We thought it was quite natural to do it in the following way:
>
> option  "filter"  f
>     "include or exclude the given type in case of leading '-' or '+', respectively."
>     multiple enum
>     values="-unspecified","-ok","-incompatible","-missing","-other",
>            "+unspecified","+ok","+incompatible","+missing","+other",
>            "problematic","all"
>     default="problematic"
>     optional
>
> What do you think? gengetopt should enable symbols in enums or should we rephrase our idea? Please note that this option is multiple enum, so the real strength of this approach that custom mixed filter definitions can be described this way:
>
> --filter=+other,-missing

well I think this would be feasible without any problem!
My only concern is the literals used for the actual C enum values: + and
  - are not valid characters, so these characters should be translated
in the C enum...

something like

enum { filter_MINUS_UNSPECIFIED, filter_PLUS_OK, ... }

what do you think?  Or do you have any other suggestion?

cheers
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
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



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: accept option arguments (even in enum)

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> > What do you think? gengetopt should enable symbols in enums or should we
> rephrase our idea? Please note that this option is multiple enum, so the
> real strength of this approach that custom mixed filter definitions can be
> described this way:
> >
> > --filter=+other,-missing
>
> well I think this would be feasible without any problem!
> My only concern is the literals used for the actual C enum values: + and
>   - are not valid characters, so these characters should be translated
> in the C enum...
>
> something like
>
> enum { filter_MINUS_UNSPECIFIED, filter_PLUS_OK, ... }
>
> what do you think?  Or do you have any other suggestion?

It would be ok. My first thought was to simply ignore special characters and replace them with an underscore (_) however it would raise the risk of ambiguity. MINUS , PLUS (and the others like QUOTE, EXCLAMATION?) would be ok.


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: accept option arguments (even in enum)

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi

I've uploaded a candidate release here

http://rap.dsi.unifi.it/~bettini/gengetopt-2.22.3.tar.gz

which provides this feature (you may want to take a look at test_values*
files).

look forward to getting some feedback and then I'll release it :-)

cheers
        Lorenzo

Papp Gyozo (VBuster) wrote:

> Hi,
>
>>> What do you think? gengetopt should enable symbols in enums or should we
>> rephrase our idea? Please note that this option is multiple enum, so the
>> real strength of this approach that custom mixed filter definitions can be
>> described this way:
>>> --filter=+other,-missing
>> well I think this would be feasible without any problem!
>> My only concern is the literals used for the actual C enum values: + and
>>   - are not valid characters, so these characters should be translated
>> in the C enum...
>>
>> something like
>>
>> enum { filter_MINUS_UNSPECIFIED, filter_PLUS_OK, ... }
>>
>> what do you think?  Or do you have any other suggestion?
>
> It would be ok. My first thought was to simply ignore special characters and replace them with an underscore (_) however it would raise the risk of ambiguity. MINUS , PLUS (and the others like QUOTE, EXCLAMATION?) would be ok.
>
>
> _______________________________________________
> Help-gengetopt mailing list
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
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


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: accept option arguments (even in enum)

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gyozo, on august I sent this email with a version that should implement
what you requested, have you managed to try it?

hi

I've uploaded a candidate release here

http://rap.dsi.unifi.it/~bettini/gengetopt-2.22.3.tar.gz

which provides this feature (you may want to take a look at test_values*
files).

look forward to getting some feedback and then I'll release it :-)

cheers
        Lorenzo

Papp Gyozo (VBuster) wrote:

> Hi,
>
>>> What do you think? gengetopt should enable symbols in enums or should we
>> rephrase our idea? Please note that this option is multiple enum, so the
>> real strength of this approach that custom mixed filter definitions can be
>> described this way:
>>> --filter=+other,-missing
>> well I think this would be feasible without any problem!
>> My only concern is the literals used for the actual C enum values: + and
>>   - are not valid characters, so these characters should be translated
>> in the C enum...
>>
>> something like
>>
>> enum { filter_MINUS_UNSPECIFIED, filter_PLUS_OK, ... }
>>
>> what do you think?  Or do you have any other suggestion?
>
> It would be ok. My first thought was to simply ignore special characters and replace them with an underscore (_) however it would raise the risk of ambiguity. MINUS , PLUS (and the others like QUOTE, EXCLAMATION?) would be ok.
>
>
> _______________________________________________
> Help-gengetopt mailing list
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
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



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt