9c312311 |
1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2003-2004 Michel Dagenais |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License Version 2 as |
6 | * published by the Free Software Foundation; |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
16 | * MA 02111-1307, USA. |
17 | */ |
18 | |
c5d77517 |
19 | #ifndef OPTION_H |
20 | #define OPTION_H |
21 | |
dc877563 |
22 | /* Define a new option with a long name (--long_name), a short |
c5d77517 |
23 | one character name (-c), a descriptive text, the argument type, and a |
24 | pointer to where the argument value will be stored. For an option of |
25 | type LTTV_OPT_NONE, the argument is a boolean value set to true when the |
dc877563 |
26 | option is present. The option hook is called if non NULL. */ |
c5d77517 |
27 | |
dc877563 |
28 | typedef enum _LttvOptionType |
c5d77517 |
29 | {LTTV_OPT_NONE, LTTV_OPT_STRING, LTTV_OPT_INT, LTTV_OPT_LONG } |
dc877563 |
30 | LttvOptionType; |
c5d77517 |
31 | |
dc877563 |
32 | typedef void (*LttvOptionHook)(void *hook_data); |
c5d77517 |
33 | |
f68ad60d |
34 | void lttv_option_add(const char *long_name, const char char_name, |
dc877563 |
35 | const char *description, const char *arg_description, |
36 | const LttvOptionType t, void *p, |
37 | const LttvOptionHook h, void *hook_data); |
38 | |
39 | |
40 | /* Remove an option */ |
41 | |
42 | void lttv_option_remove(const char *long_name); |
43 | |
c5d77517 |
44 | |
dc877563 |
45 | /* Parse command line options. It is possible to add options (through the |
46 | hooks being called) while the parsing is done. The new options will be |
47 | used for subsequent command line arguments. */ |
c5d77517 |
48 | |
dc877563 |
49 | void lttv_option_parse(int argc, char **argv); |
c5d77517 |
50 | |
c5467007 |
51 | void lttv_option_show_help(void); |
52 | |
c5d77517 |
53 | #endif // OPTION_H |