This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Automated options for Guile



Hi all,

I  would like to know if this is interesting for you:

As a test, I defined a set of options that produces this usage:

> test_guile - Test AutoOpts for guile
> USAGE:  guile [ -<flag> [<val>] ]... [ <guile-arg> ...]
>   Flg Arg Option-Name    Description
>    -o no  option         The option option descrip
> 				  - enabled by default
>    -s YES second         The second option descrip
>                                 - may appear without limit
>    -? no  help           Display usage information and exit
>    -! no  more-help      Extended usage information passed thru pager

I then generated a complete program and ran it thus:

> test_guile -s 'value 1 for second.' -s 'value number two' <<EOF
> have-opt-second
> opt-enabled-second
> opt-ct-second
> opt-args-second
> have-opt-option
> opt-enabled-option
> EOF

The output was this:

> guile> #t
> guile> #t
> guile> 2
> guile> ("value 1 for second." "value number two")
> guile> #f
> guile> #t
> guile> 

Please note that the option state does not have to be
set on the command line.  It can be affected by
environment variables and config files as well.
There are lots of optional option features.  See:

  http://AutoGen.SourceForge.net/autoopts/index.html

Here is the complete input text that was used to create
the above "program":

> AutoGen definitions options;
> 
> prog_name  = "test_guile";
> prog_title = "Test AutoOpts for guile";
> argument   = '[ <guile-arg> ...]';
> flag = {
>     name = "option";
>     enabled;
>     descrip = "The option option descrip";
>     value = 'o';
> };
> 
> flag = {
>     name = "second";
>     max = NOLIMIT; stack_arg;
>     descrip = "The second option descrip";
>     value = 's';
>     flag_arg = ':';
> };
> 
> include = '#include <stdio.h>';
> include = '#include <guile/gh.h>';
> guile-main;
> before-guile-boot = 'fputs( "guile starts\n", stderr );';

It also turns out to be fairly trivial to emit the code
needed to export variables and procedures into the Guile
name space.  For that, tho, I am working with David Beazley.

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]