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 /* ################################################################### */
51 typedef struct state_s
53 char * prog_name
; /* base name of the program name. */
54 char * ctx_name
; /* current context name. */
55 char * ctx_par_name
; /* parameter which led to this context. */
56 char * opt_name
; /* current option name. */
57 int opts_count
; /* limit of the number of occurrences of *
58 | the current option. */
59 int opt_args_count
; /* limit of the number of parameters of *
60 | the current option. */
61 char * pre_opt_par_name
; /* parameter before the current one. */
62 char * cur_opt_par_name
; /* current parameter. */
63 char * cur_opt_params
; /* All the option's parameters. */
67 ctxopt_init(char * prog_name
, char * flags
);
70 ctxopt_analyze(int nb_words
, char ** words
, int * rem_count
, char *** rem_args
);
73 ctxopt_evaluate(void);
76 ctxopt_new_ctx(char * name
, char * opts_specs
);
79 ctxopt_ctx_disp_usage(char * ctx_name
, usage_behaviour action
);
82 ctxopt_disp_usage(usage_behaviour action
);
85 ctxopt_add_global_settings(settings s
, ...);
88 ctxopt_add_ctx_settings(settings s
, ...);
91 ctxopt_add_opt_settings(settings s
, ...);
94 ctxopt_format_constraint(int nb_args
, char ** args
, char * value
, char * par
);
97 ctxopt_re_constraint(int nb_args
, char ** args
, char * value
, char * par
);
100 ctxopt_range_constraint(int nb_args
, char ** args
, char * value
, char * par
);
103 ctxopt_free_memory(void);