[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.3.2 Generated main Procedures (deprecated)

The following is deprecated. Users are encouraged to use the main description (see section 7.6 Generating main procedures) for specifying the type and content of a generated main procedure. [[note to self: move some of this text to the new section.]]

AutoOpts can generate the main procedure in certain circumstances. It will do this to help with integrating with the guile library environment, and for creating a program to convert command line options into environment variables for use in processing shell script options and for testing the command line interface.

`guile-main'
Creates a guile-style main and inner-main procedures. The inner main procedure will call optionProcess() and will invoke any code specified by this attribute. If this attribute does not specify any code, then calls to the AutoOpts library procedure export_options_to_guile() and then scm_shell() will be inserted into inner_main().

Instead of this, use 7.6 Generating main procedures procedures, specifying a main-type of guile (see section 7.6.1 guile: main and inner_main procedures).

`before-guile-boot'
If guile-main has been specified and if this is specified as well, then this code will be inserted into the actual main() procedure before gh_enter() is called.

Instead of this, use 7.6 Generating main procedures procedures, specifying a main-type of guile (see section 7.6.1 guile: main and inner_main procedures) and add the before-guile-boot attribute.

`main-text'
If you need to specify the content of the main procedure generated for the "option testing" program, you can do that with this attribute. The result will be a procedure that looks similar to this:

 
int main( int argc, char** argv ) {
[+  main-text  +]
    return EXIT_SUCCESS;
}

Instead of this, use 7.6 Generating main procedures procedures, specifying a main-type of main (see section 7.6.4 main: user supplied main procedure) and add the code attribute.

`test-main'
Creates a test main procedure for testing option processing. The resulting program may also be used for several purposes.

Instead of this, use 7.6 Generating main procedures procedures, specifying a main-type of main (see section 7.6.4 main: user supplied main procedure) and add the test-main attribute.

  1. If the text of test-main is short (3 or fewer characters), the generated main() will call putBourneShell. That routine will emit Bourne shell commands that can be eval-ed by a Bourne-derived shell to incorporate the digested options into the shell's environment, See section 7.9 AutoOpts for Shell Scripts. You would use it thus:
     
    eval "`./programopts $@`"
    test -z "${OPTION_CT}" && exit 1
    test ${OPTION_CT} -gt 0 && shift ${OPTION_CT}
    

  2. If the text of test-main contains putShellParse, the program will generate portable Bourne shell commands that will parse the command line options. The expectation is that this result will be copied into a shell script and used there, See section 7.9 AutoOpts for Shell Scripts.

  3. Any other text must be the name of a routine that you will write yourself. That routine will be called after processing the command line options and it will be passed the option processing descriptor pointer as its sole argument.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on October 24, 2004 using texi2html

Viewable With Any Browser   AutoGen Home