Improve comments
[ctxopt.git] / ctxopt.h
blob1b03ae73ffb54c479e88e3fd9ffce6e0e4e92df2
1 /* ########################################################### */
2 /* This Software is licensed under the GPL licensed Version 2, */
3 /* please read http://www.gnu.org/copyleft/gpl.html */
4 /* ########################################################### */
6 #ifndef CTXOPT_H
7 #define CTXOPT_H
9 typedef enum
11 parameters,
12 constraints,
13 actions,
14 incompatibilities,
15 error_functions
16 } settings;
18 typedef enum
20 entering,
21 exiting
22 } direction;
24 typedef enum
26 CTXOPTNOERR = 0,
27 CTXOPTMISPAR,
28 CTXOPTMISARG,
29 CTXOPTDUPOPT,
30 CTXOPTUNKPAR,
31 CTXOPTINCOPT,
32 CTXOPTCTEOPT,
33 CTXOPTCTLOPT,
34 CTXOPTCTGOPT,
35 CTXOPTCTEARG,
36 CTXOPTCTLARG,
37 CTXOPTCTGARG,
38 CTXOPTUNXARG,
39 CTXOPTERRSIZ
40 } errors;
42 typedef enum
44 continue_after,
45 exit_after
46 } usage_behaviour;
48 typedef struct state_s
50 char * prog_name; /* base name of the program name. */
51 char * ctx_name; /* current context name. */
52 char * ctx_par_name; /* parameter which led to this context. */
53 char * opt_name; /* current option name. */
54 int opts_count; /* limit of the number of occurrences of *
55 | the current option. */
56 int opt_args_count; /* limit of the number of parameters of *
57 | the current option. */
58 char * pre_opt_par_name; /* parameter before the current one. */
59 char * cur_opt_par_name; /* current parameter. */
60 } state_t;
62 void
63 ctxopt_init(char * prog_name);
65 void
66 ctxopt_analyze(int nb_words, char ** words, int * rem_count, char *** rem_args);
68 void
69 ctxopt_evaluate(void);
71 void
72 ctxopt_new_ctx(char * name, char * opts_specs);
74 void
75 ctxopt_ctx_disp_usage(char * ctx_name, usage_behaviour action);
77 void
78 ctxopt_disp_usage(usage_behaviour action);
80 void
81 ctxopt_add_global_settings(settings s, ...);
83 void
84 ctxopt_add_ctx_settings(settings s, ...);
86 void
87 ctxopt_add_opt_settings(settings s, ...);
89 int
90 ctxopt_format_constraint(int nb_args, char ** args, char * value, char * par);
92 int
93 ctxopt_re_constraint(int nb_args, char ** args, char * value, char * par);
95 int
96 ctxopt_range_constraint(int nb_args, char ** args, char * value, char * par);
98 void
99 ctxopt_free_memory(void);
101 #endif