Mention ctxopt_free_memory in the manual.
[ctxopt.git] / ctxopt.h
blob5964bb37fcbd371368714933c5c0e8296ee5fdfc
1 /* ################################################################### */
2 /* This Source Code Form is subject to the terms of the Mozilla Public */
3 /* License, v. 2.0. If a copy of the MPL was not distributed with this */
4 /* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
5 /* ################################################################### */
7 #ifndef CTXOPT_H
8 #define CTXOPT_H
10 typedef enum
12 parameters,
13 constraints,
14 actions,
15 incompatibilities,
16 error_functions
17 } settings;
19 typedef enum
21 entering,
22 exiting
23 } direction;
25 typedef enum
27 CTXOPTNOERR = 0,
28 CTXOPTMISPAR,
29 CTXOPTMISARG,
30 CTXOPTDUPOPT,
31 CTXOPTUNKPAR,
32 CTXOPTINCOPT,
33 CTXOPTCTEOPT,
34 CTXOPTCTLOPT,
35 CTXOPTCTGOPT,
36 CTXOPTCTEARG,
37 CTXOPTCTLARG,
38 CTXOPTCTGARG,
39 CTXOPTUNXARG,
40 CTXOPTERRSIZ
41 } errors;
43 typedef enum
45 continue_after,
46 exit_after
47 } usage_behaviour;
49 typedef struct state_s
51 char * prog_name; /* base name of the program name. */
52 char * ctx_name; /* current context name. */
53 char * ctx_par_name; /* parameter which led to this context. */
54 char * opt_name; /* current option name. */
55 int opts_count; /* limit of the number of occurrences of *
56 | the current option. */
57 int opt_args_count; /* limit of the number of parameters of *
58 | the current option. */
59 char * pre_opt_par_name; /* parameter before the current one. */
60 char * cur_opt_par_name; /* current parameter. */
61 } state_t;
63 void
64 ctxopt_init(char * prog_name, char * flags);
66 void
67 ctxopt_analyze(int nb_words, char ** words, int * rem_count, char *** rem_args);
69 void
70 ctxopt_evaluate(void);
72 void
73 ctxopt_new_ctx(char * name, char * opts_specs);
75 void
76 ctxopt_ctx_disp_usage(char * ctx_name, usage_behaviour action);
78 void
79 ctxopt_disp_usage(usage_behaviour action);
81 void
82 ctxopt_add_global_settings(settings s, ...);
84 void
85 ctxopt_add_ctx_settings(settings s, ...);
87 void
88 ctxopt_add_opt_settings(settings s, ...);
90 int
91 ctxopt_format_constraint(int nb_args, char ** args, char * value, char * par);
93 int
94 ctxopt_re_constraint(int nb_args, char ** args, char * value, char * par);
96 int
97 ctxopt_range_constraint(int nb_args, char ** args, char * value, char * par);
99 void
100 ctxopt_free_memory(void);
102 #endif