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 /* ################################################################### */
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. */
64 ctxopt_init(char * prog_name
, char * flags
);
67 ctxopt_analyze(int nb_words
, char ** words
, int * rem_count
, char *** rem_args
);
70 ctxopt_evaluate(void);
73 ctxopt_new_ctx(char * name
, char * opts_specs
);
76 ctxopt_ctx_disp_usage(char * ctx_name
, usage_behaviour action
);
79 ctxopt_disp_usage(usage_behaviour action
);
82 ctxopt_add_global_settings(settings s
, ...);
85 ctxopt_add_ctx_settings(settings s
, ...);
88 ctxopt_add_opt_settings(settings s
, ...);
91 ctxopt_format_constraint(int nb_args
, char ** args
, char * value
, char * par
);
94 ctxopt_re_constraint(int nb_args
, char ** args
, char * value
, char * par
);
97 ctxopt_range_constraint(int nb_args
, char ** args
, char * value
, char * par
);
100 ctxopt_free_memory(void);