APG
… an ABNF Parser Generator
|
Handles the main function argument list and produces the configuration structure that drives APG. More...
Go to the source code of this file.
Data Structures | |
struct | config_ctx |
The configuration component context. More... | |
Functions | |
void * | vpConfigCtor (exception *spEx) |
Constructs a configuration object to hold all data relating to this instance of the configuration. More... | |
void | vConfigDtor (void *vpCtx) |
The configuration destructor. More... | |
const config * | spConfigOptions (void *vpCtx, int iArgCount, char **cppArgs) |
Reads the command line arguments and parses them into a configuration structure. More... | |
void | vConfigHelp (void) |
Prints the help screen when requested or if there is a command line options error. More... | |
void | vConfigVersion (void) |
Display the version number. More... | |
void | vConfigDefault (void *vpCtx, char *cpFileName) |
Prints a default configuration file. More... | |
void | vConfigDisplay (const config *spConfig, int iArgCount, char **cppArgs) |
Displays the full configuration as determined from the command line or command file arguments. More... | |
Handles the main function argument list and produces the configuration structure that drives APG.
This suite of functions work together to parse the command line parameters into a configuration structure that drives the generator. The parameters can be on the command line directly or in a file (see the @filename command).
Definition in file config.c.
const config* spConfigOptions | ( | void * | vpCtx, |
int | iArgCount, | ||
char ** | cppArgs | ||
) |
Reads the command line arguments and parses them into a configuration structure.
vpCtx | Pointer to the configuration context previously returned by a call to the constructor vConfigCtor(). |
iArgCount | the number of arguments on the command line. |
cppArgs | an array of pointers to the command line arguments. |
void vConfigDefault | ( | void * | vpCtx, |
char * | cpFileName | ||
) |
Prints a default configuration file.
A configuration file may in many cases be a more convenient than a command line for providing the main() program with its options. This program will print a default file with all options available commented out. The user can then conveniently un-comment the options desired and customize it to his/her needs. This is especially useful to avoid the need to re-type long file names onto the command line for repeated applications.
vpCtx | Pointer to the configuration context previously returned by a call to the constructor vConfigCtor(). |
cpFileName | Name of the file to open and write the default configuration to. If NULL, prints to stdout. |
void vConfigDisplay | ( | const config * | spConfig, |
int | iArgCount, | ||
char ** | cppArgs | ||
) |
Displays the full configuration as determined from the command line or command file arguments.
After all options have been read from the command line, or command file if present, the final interpretation of them is stored in the configuration structure. This function displays all of the arguments passed to the main function and the configuration that results from them. It is called if the flag -dc is set.
spConfig | Pointer to the configuration structure. |
iArgCount | The number of option arguments. |
cppArgs | Array of pointers to the arguments |
void vConfigDtor | ( | void * | vpCtx | ) |
The configuration destructor.
Closes the open config file, if necessary.
vpCtx | Pointer to the configuration context previously returned by a call to the constructor vConfigCtor(). NULL is silently ignored. However, if non-NULL it must be a valid config context pointer. |
void vConfigHelp | ( | void | ) |
void* vpConfigCtor | ( | exception * | spEx | ) |