6 struct isl_arg_choice {
19 enum isl_arg_type type;
21 const char *long_name;
25 struct isl_arg_choice *choice;
26 unsigned default_value;
29 unsigned default_value;
32 struct isl_arg *child;
38 #define ISL_ARG_CHOICE(st,f,s,l,c,d) { \
39 .type = isl_arg_choice, \
42 .offset = offsetof(st, f), \
43 .u = { .choice = { .choice = c, .default_value = d } } \
45 #define ISL_ARG_BOOL(st,f,s,l,d) { \
46 .type = isl_arg_bool, \
49 .offset = offsetof(st, f), \
50 .u = { .b = { .default_value = d } } \
52 #define ISL_ARG_CHILD(st,f,l,c) { \
53 .type = isl_arg_child, \
55 .offset = offsetof(st, f), \
56 .u = { .child = { .child = c, .size = sizeof(*((st *)NULL)->f) } }\
58 #define ISL_ARG_END { isl_arg_end }
60 void isl_arg_set_defaults(struct isl_arg *arg, void *opt);
61 int isl_arg_parse(struct isl_arg *arg, int argc, char **argv, void *opt);
63 #define ISL_ARG_DECL(prefix,st,arg) \
64 st *prefix ## _new_with_defaults(); \
65 int prefix ## _parse(st *opt, int argc, char **argv);
67 #define ISL_ARG_DEF(prefix,st,arg) \
68 st *prefix ## _new_with_defaults() \
70 st *opt = (st *)calloc(1, sizeof(st)); \
72 isl_arg_set_defaults(arg, opt); \
76 int prefix ## _parse(st *opt, int argc, char **argv) \
78 return isl_arg_parse(arg, argc, argv, opt); \