Remove a spurious printf
[ctxopt.git] / ctxopt.h
blob0c184d560ced740765d0ad654f8e023fa53ba173
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 char * opt_params; /* parameters of the current option. */
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);
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);
93 int
94 ctxopt_re_constraint(int nb_args, char ** args, char * value);
96 int
97 ctxopt_range_constraint(int nb_args, char ** args, char * value);
99 #endif