summaryrefslogtreecommitdiffstats
path: root/ctxopt.h
blob: 0ca17581058207608b5a19edc9acc99054323a6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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_ctx_disp_usage(char * ctx_name, usage_behaviour action);

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);