X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Finclude%2Flttv%2Foption.h;h=fc8f14d5cdf6cb0d303171370fd4e7f42db01c95;hb=dd025f915d9b3a3e587578e97b3738115193c180;hp=09fd803bfc82ae3499158b8e0eb2f2e042ed2f6c;hpb=48f6f3c280c4b511fdbdc3a650b2f4aa7040fc97;p=lttv.git diff --git a/ltt/branches/poly/include/lttv/option.h b/ltt/branches/poly/include/lttv/option.h index 09fd803b..fc8f14d5 100644 --- a/ltt/branches/poly/include/lttv/option.h +++ b/ltt/branches/poly/include/lttv/option.h @@ -1,29 +1,53 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Michel Dagenais + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License Version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + #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); +void lttv_option_show_help(void); #endif // OPTION_H