Next: Making Genparse Files, Previous: Top, Up: Top [Contents][Index]
The Genparse package allows the automated creation of command line parsing routines, based on a command line option description file. Given a target language, Genparse outputs a suitable parser. For example, in C, a function is created that reads the command line parameters and stores their values in a data structure. In C++ and Java, a command line parsing class is created, with member functions that return parameter values.
The goal of Genparse is to eliminate the effort required to write a
command line parser for every newly-developed program. Typically, these
parsers all follow a very similar format, with a series of calls to the
getopt ()
or getopt_long ()
library functions. Genparse
allows users to specify their program’s command line options in a
concise text file (hereafter, a "Genparse File"). Genparse reads this
file, and produces the appropriate parsing routines in the user’s
language of choice. Users may call the parser’s functions from their
main code in order to obtain the values of the parameters.
In addition to providing a simple interface to the parameters, Genparse also has the following features:
-o
) and long (--option
) parameters are supported.
usage ()
function is automatically created, which can be used to
describe a program’s command line parameters. Genparse also allows a
description string to be associated with each parameter. These strings
will be displayed in the usage ()
function.
Currently, we do not believe that Genparse has any significant limitations. It cannot handle dependencies between different options, but the user can write callback function to accomplish this task. A virtually unlimited number of long command line options are available, but only 52 single-character options can be used by a given program.
Mail suggestions and bug reports for Genparse to mike@borella.net. The latest version of Genparse can always be found at http://genparse.sourceforge.net.
Next: Making Genparse Files, Previous: Top, Up: Top [Contents][Index]