From 24037bdfe6aaf3ba6fa3453869466b6fd7b2579d Mon Sep 17 00:00:00 2001 From: pgen Date: Sun, 15 Sep 2019 23:40:37 +0200 Subject: Use ctxopt.[ch] for options management The old getopt, derived from egetopt, was too restrictive, so I developed ctxopt to better manage smenu options. --- ctxopt.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ctxopt.h (limited to 'ctxopt.h') diff --git a/ctxopt.h b/ctxopt.h new file mode 100644 index 0000000..7233731 --- /dev/null +++ b/ctxopt.h @@ -0,0 +1,71 @@ +/* This file was automatically generated. Do not edit! */ +/* This file was automatically generated. Do not edit! */ + +typedef enum +{ + parameters, + constraints, + actions, + incompatibilities, + error_functions, +} settings; + +typedef enum +{ + entering, + exiting, +} direction; + +typedef enum +{ + CTXOPTNOERR = 0, + CTXOPTMISPAR, + CTXOPTMISARG, + CTXOPTDUPOPT, + CTXOPTUNKPAR, + CTXOPTINCTXOPTT, + CTXOPTINTERNAL, + CTXOPTERRSIZE, +} errors; + +typedef enum +{ + continue_after, + exit_after, +} usage_behaviour; + +char * ctxoptopt; +errors ctxopterrno; + +void +ctxopt_init(void); + +void +ctxopt_analyze(int nb_words, char ** words, int * rem_count, char *** rem_args); + +void +ctxopt_evaluate(void); + +void +ctxopt_new_ctx(char * name, char * opts_specs); + +void +ctxopt_disp_usage(usage_behaviour action); + +void +ctxopt_add_global_settings(settings s, ...); + +void +ctxopt_add_ctx_settings(settings s, ...); + +void +ctxopt_add_opt_settings(settings s, ...); + +int +ctxopt_format_constraint(int nb_args, char ** args, char * value); + +int +ctxopt_re_constraint(int nb_args, char ** args, char * value); + +int +ctxopt_range_constraint(int nb_args, char ** args, char * value); -- cgit v1.2.3