X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Finclude%2Flttv%2Foption.h;h=4447f9f6bfd56202e5da2ff8fb33bbf0a1326c9a;hb=dc87756342c051418eccb2b7d932ffa5453c6788;hp=09fd803bfc82ae3499158b8e0eb2f2e042ed2f6c;hpb=90b93bd19d886e2d78e798fb29b6bae14343da1e;p=lttv.git diff --git a/ltt/branches/poly/include/lttv/option.h b/ltt/branches/poly/include/lttv/option.h index 09fd803b..4447f9f6 100644 --- a/ltt/branches/poly/include/lttv/option.h +++ b/ltt/branches/poly/include/lttv/option.h @@ -1,29 +1,33 @@ #ifndef OPTION_H #define OPTION_H -/* Options parsing mechanism */ - -/* Define a new command line option with a long name (--long_name), a short +/* Define a new option with a long name (--long_name), a short one character name (-c), a descriptive text, the argument type, and a pointer to where the argument value will be stored. For an option of type LTTV_OPT_NONE, the argument is a boolean value set to true when the - option is present. */ - -/* Initial draft by Michel Dagenais May 2003 - * Reworked by Mathieu Desnoyers, May 2003 - */ + option is present. The option hook is called if non NULL. */ -typedef enum _lttv_option_type +typedef enum _LttvOptionType {LTTV_OPT_NONE, LTTV_OPT_STRING, LTTV_OPT_INT, LTTV_OPT_LONG } -lttv_option_type; +LttvOptionType; -typedef void (*lttv_option_hook)(void *hook_data); +typedef void (*LttvOptionHook)(void *hook_data); void lttv_option_add(const char *long_name, const char char_name, - const char *description, const char *argDescription, - const lttv_option_type t, void *p, - const lttv_option_hook h, void *hook_data); + const char *description, const char *arg_description, + const LttvOptionType t, void *p, + const LttvOptionHook h, void *hook_data); + + +/* Remove an option */ + +void lttv_option_remove(const char *long_name); + +/* Parse command line options. It is possible to add options (through the + hooks being called) while the parsing is done. The new options will be + used for subsequent command line arguments. */ +void lttv_option_parse(int argc, char **argv); #endif // OPTION_H