[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Automated options for Guile
From: |
Bruce Korb |
Subject: |
Automated options for Guile |
Date: |
Sat, 30 Sep 2000 12:12:02 -0700 |
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Automated options for Guile,
Bruce Korb <=