]> mj.ucw.cz Git - libucw.git/blob - ucw/opt-internal.h
Merge remote-tracking branch 'origin/master'
[libucw.git] / ucw / opt-internal.h
1 /*
2  *      UCW Library -- Internals of the option parser
3  *
4  *      (c) 2013 Jan Moskyto Matejka <mq@ucw.cz>
5  *      (c) 2014 Martin Mares <mj@ucw.cz>
6  *
7  *      This software may be freely distributed and used according to the terms
8  *      of the GNU Lesser General Public License.
9  */
10
11 #ifndef _UCW_OPT_INTERNAL_H
12 #define _UCW_OPT_INTERNAL_H
13
14 #ifdef CONFIG_UCW_CLEAN_ABI
15 #define opt_precompute ucw_opt_precompute
16 #endif
17
18 enum opt_conf_state {
19   OPT_CONF_HOOK_BEGIN,
20   OPT_CONF_HOOK_CONFIG,
21   OPT_CONF_HOOK_OTHERS,
22 };
23
24 struct opt_context {
25   const struct opt_section * options;
26   struct opt_precomputed * opts;
27   struct opt_precomputed ** shortopt;
28   struct opt_item ** hooks;
29   int opt_count;
30   int hook_count;
31   int positional_max;
32   int positional_count;
33   bool stop_parsing;
34   enum opt_conf_state conf_state;
35 };
36
37 struct opt_precomputed {
38   struct opt_item * item;
39   const char * name;
40   short flags;
41   short count;
42 };
43
44 void opt_precompute(struct opt_precomputed *opt, struct opt_item *item);
45
46 #endif