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 /* ################################################################### */
53 typedef struct state_s
55 char * prog_name
; /* base name of the program name. */
56 char * ctx_name
; /* current context name. */
57 char * ctx_par_name
; /* parameter which led to this context. */
58 char * opt_name
; /* current option name. */
59 int opts_count
; /* limit of the number of occurrences of *
60 | the current option. */
61 int opt_args_count
; /* limit of the number of parameters of *
62 | the current option. */
63 char * pre_opt_par_name
; /* parameter before the current one. */
64 char * cur_opt_par_name
; /* current parameter. */
65 char * cur_opt_params
; /* All the option's parameters. */
66 char * req_opt_par_needed
; /* Option's params in the missing *
67 | required group of optrions. */
68 char * req_opt_par
; /* Option's params of the option which *
69 | required one of the parameter in *
70 | req_opt_par_needed to also be present *
71 | in the current context. */
75 ctxopt_init(char * prog_name
, char * flags
);
78 ctxopt_analyze(int nb_words
, char ** words
, int * rem_count
, char *** rem_args
);
81 ctxopt_evaluate(void);
84 ctxopt_new_ctx(char * name
, char * opts_specs
);
87 ctxopt_ctx_disp_usage(char * ctx_name
, usage_behaviour action
);
90 ctxopt_disp_usage(usage_behaviour action
);
93 ctxopt_add_global_settings(settings s
, ...);
96 ctxopt_add_ctx_settings(settings s
, ...);
99 ctxopt_add_opt_settings(settings s
, ...);
102 ctxopt_format_constraint(int nb_args
, char ** args
, char * value
, char * par
);
105 ctxopt_re_constraint(int nb_args
, char ** args
, char * value
, char * par
);
108 ctxopt_range_constraint(int nb_args
, char ** args
, char * value
, char * par
);
111 ctxopt_free_memory(void);