1 /* ########################################################### */
2 /* This Software is licensed under the GPL licensed Version 2, */
3 /* please read http://www.gnu.org/copyleft/gpl.html */
4 /* ########################################################### */
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. */
64 ctxopt_init(char * prog_name
);
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
);
94 ctxopt_re_constraint(int nb_args
, char ** args
, char * value
);
97 ctxopt_range_constraint(int nb_args
, char ** args
, char * value
);