diff options
author | pgen <p.gen.progs@gmail.com> | 2019-09-15 23:40:37 +0200 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2019-10-01 00:32:56 +0200 |
commit | 24037bdfe6aaf3ba6fa3453869466b6fd7b2579d (patch) | |
tree | 5fc9a1e3eb2d9998d64cfc7b6f0d63e2042ed695 /ctxopt.h | |
parent | a2adfc0f3c304aec4a573478838ea769c3f590a8 (diff) |
Use ctxopt.[ch] for options management
The old getopt, derived from egetopt, was too restrictive, so I developed
ctxopt to better manage smenu options.
Diffstat (limited to 'ctxopt.h')
-rw-r--r-- | ctxopt.h | 71 |
1 files changed, 71 insertions, 0 deletions
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); |