AutoGen - The Automated Program Generator: 7.5.2.1 AutoOpt-ed Library for AutoOpt-ed Program

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

#### 7.5.2.1 AutoOpt-ed Library for AutoOpt-ed Program

The library source code must provide an option definition file that consists of only the attribute `library` and `flag` entries. The “library” attribute does not need any associated value, so it will generally appeary by itself on a line folowed by a semi-colon. The first `flag` entry must contain the following attributes:

‘`name`’

  This name is used in the construction of a global pointer of type `tOptDesc const*`. It is always required.

‘`documentation`’

  It tells `AutoOpts` that this option serves no normal purpose. It will be used to add usage clarity and to locate option descriptors in the library code.

‘`descrip`’

  This is a string that is inserted in the extended usage display before the options specific to the current library. It is always required.

‘`lib-name`’

  This should match the name of the library. This string is also used in the construction of the option descriptor pointer name. In the end, it looks like this:

      extern tOptDesc const* <<lib-name>>_<<name>>_optDesc_p;

  and is used in the macros generated for the library’s `.h` file.

In order to compile this `AutoOpts` using library, you must create a special header that is not used by the client program. This is accomplished by creating an option definition file that contains essentially exactly the following:

    AutoGen definitions options;
    prog-name  = does-not-matter;  // but is always required
    prog-title = 'also does not matter';  // also required
    config-header = 'config.h'; // optional, but common
    library;
    #include library-options-only.def

and nothing else. AutoGen will produce only the `.h` file. You may now compile your library, referencing just this `.h` file. The macros it creates will utilize a global variable that will be defined by the `AutoOpts`-using client program. That program will need to have the following `#include` in its option definition file:

    #include library-options-only.def

All the right things will magically happen so that the global variables named `<<lib-name>>_<<name>>_optDesc_p` are initialized correctly. For an example, please see the `AutoOpts` test script: ‘`autoopts/test/library.test`’.

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

This document was generated by Bruce Korb on June 25, 2010 using texi2html 1.82.