Polly 19.0.0git
Classes | Macros | Enumerations | Functions
arg.h File Reference
#include <stddef.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  isl_arg_choice
 
struct  isl_arg_flags
 
struct  isl_arg
 
struct  isl_args
 

Macros

#define ISL_ARG_OFFSET_NONE   ((size_t) -1)
 
#define ISL_ARG_SINGLE_DASH   (1 << 0)
 
#define ISL_ARG_BOOL_ARG   (1 << 1)
 
#define ISL_ARG_HIDDEN   (1 << 2)
 
#define ISL_ARGS_START(s, name)
 
#define ISL_ARGS_END    { isl_arg_end } };
 
#define ISL_ARG_ALIAS(l)
 
#define ISL_ARG_ARG(st, f, a, d)
 
#define ISL_ARG_FOOTER(h)
 
#define ISL_ARG_CHOICE(st, f, s, l, c, d, h)
 
#define ISL_ARG_OPT_CHOICE(st, f, s, l, c, d, ds, h)
 
#define ISL_ARG_PHANTOM_USER_CHOICE_F(s, l, c, setter, d, h, fl)
 
#define ISL_ARG_USER_OPT_CHOICE(st, f, s, l, c, setter, d, ds, h)
 
#define _ISL_ARG_BOOL_F(o, s, l, setter, d, h, fl)
 
#define ISL_ARG_BOOL_F(st, f, s, l, d, h, fl)    _ISL_ARG_BOOL_F(offsetof(st, f),s,l,NULL,d,h,fl)
 
#define ISL_ARG_BOOL(st, f, s, l, d, h)    ISL_ARG_BOOL_F(st,f,s,l,d,h,0)
 
#define ISL_ARG_PHANTOM_BOOL_F(s, l, setter, h, fl)    _ISL_ARG_BOOL_F(ISL_ARG_OFFSET_NONE,s,l,setter,0,h,fl)
 
#define ISL_ARG_PHANTOM_BOOL(s, l, setter, h)    ISL_ARG_PHANTOM_BOOL_F(s,l,setter,h,0)
 
#define ISL_ARG_INT_F(st, f, s, l, a, d, h, fl)
 
#define ISL_ARG_INT(st, f, s, l, a, d, h)    ISL_ARG_INT_F(st,f,s,l,a,d,h,0)
 
#define ISL_ARG_LONG(st, f, s, lo, d, h)
 
#define ISL_ARG_USER_LONG(st, f, s, lo, setter, d, h)
 
#define ISL_ARG_OPT_LONG(st, f, s, lo, d, ds, h)
 
#define ISL_ARG_ULONG(st, f, s, l, d, h)
 
#define ISL_ARG_STR_F(st, f, s, l, a, d, h, fl)
 
#define ISL_ARG_STR(st, f, s, l, a, d, h)    ISL_ARG_STR_F(st,f,s,l,a,d,h,0)
 
#define ISL_ARG_STR_LIST(st, f_n, f_l, s, l, a, h)
 
#define _ISL_ARG_CHILD(o, l, c, h, fl)
 
#define ISL_ARG_CHILD(st, f, l, c, h)    _ISL_ARG_CHILD(offsetof(st, f),l,c,h,0)
 
#define ISL_ARG_GROUP_F(l, c, h, fl)    _ISL_ARG_CHILD(ISL_ARG_OFFSET_NONE,l,c,h,fl)
 
#define ISL_ARG_GROUP(l, c, h)    ISL_ARG_GROUP_F(l,c,h,0)
 
#define ISL_ARG_FLAGS(st, f, s, l, c, d, h)
 
#define ISL_ARG_USER(st, f, i, c)
 
#define ISL_ARG_VERSION(print)
 
#define ISL_ARG_ALL   (1 << 0)
 
#define ISL_ARG_SKIP_HELP   (1 << 1)
 
#define ISL_ARG_DECL(prefix, st, args)
 
#define ISL_ARG_DEF(prefix, st, args)
 

Enumerations

enum  isl_arg_type {
  isl_arg_end , isl_arg_alias , isl_arg_arg , isl_arg_bool ,
  isl_arg_child , isl_arg_choice , isl_arg_flags , isl_arg_footer ,
  isl_arg_int , isl_arg_user , isl_arg_long , isl_arg_ulong ,
  isl_arg_str , isl_arg_str_list , isl_arg_version
}
 

Functions

void isl_args_set_defaults (struct isl_args *args, void *opt)
 
void isl_args_free (struct isl_args *args, void *opt)
 
int isl_args_parse (struct isl_args *args, int argc, char **argv, void *opt, unsigned flags)
 

Macro Definition Documentation

◆ _ISL_ARG_BOOL_F

#define _ISL_ARG_BOOL_F (   o,
  s,
  l,
  setter,
  d,
  h,
  fl 
)
Value:
{ \
.type = isl_arg_bool, \
.short_name = s, \
.long_name = l, \
.offset = o, \
.help_msg = h, \
.flags = fl, \
.u = { .b = { .default_value = d, .set = setter } } \
},
@ isl_arg_bool
Definition: arg.h:35

Definition at line 171 of file arg.h.

◆ _ISL_ARG_CHILD

#define _ISL_ARG_CHILD (   o,
  l,
  c,
  h,
  fl 
)
Value:
{ \
.type = isl_arg_child, \
.long_name = l, \
.offset = o, \
.help_msg = h, \
.flags = fl, \
.u = { .child = { .child = c } } \
},
@ isl_arg_child
Definition: arg.h:36

Definition at line 256 of file arg.h.

◆ ISL_ARG_ALIAS

#define ISL_ARG_ALIAS (   l)
Value:
{ \
.type = isl_arg_alias, \
.long_name = l, \
},
@ isl_arg_alias
Definition: arg.h:33

Definition at line 120 of file arg.h.

◆ ISL_ARG_ALL

#define ISL_ARG_ALL   (1 << 0)

Definition at line 288 of file arg.h.

◆ ISL_ARG_ARG

#define ISL_ARG_ARG (   st,
  f,
  a,
 
)
Value:
{ \
.type = isl_arg_arg, \
.argument_name = a, \
.offset = offsetof(st, f), \
.u = { .str = { .default_value = d } } \
},
@ isl_arg_arg
Definition: arg.h:34
const char * f
Definition: isl_test.c:8642
a(0)

Definition at line 124 of file arg.h.

◆ ISL_ARG_BOOL

#define ISL_ARG_BOOL (   st,
  f,
  s,
  l,
  d,
 
)     ISL_ARG_BOOL_F(st,f,s,l,d,h,0)

Definition at line 182 of file arg.h.

◆ ISL_ARG_BOOL_ARG

#define ISL_ARG_BOOL_ARG   (1 << 1)

Definition at line 60 of file arg.h.

◆ ISL_ARG_BOOL_F

#define ISL_ARG_BOOL_F (   st,
  f,
  s,
  l,
  d,
  h,
  fl 
)     _ISL_ARG_BOOL_F(offsetof(st, f),s,l,NULL,d,h,fl)

Definition at line 180 of file arg.h.

◆ ISL_ARG_CHILD

#define ISL_ARG_CHILD (   st,
  f,
  l,
  c,
 
)     _ISL_ARG_CHILD(offsetof(st, f),l,c,h,0)

Definition at line 264 of file arg.h.

◆ ISL_ARG_CHOICE

#define ISL_ARG_CHOICE (   st,
  f,
  s,
  l,
  c,
  d,
 
)
Value:
{ \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = d, .set = NULL } } \
},

Definition at line 134 of file arg.h.

◆ ISL_ARG_DECL

#define ISL_ARG_DECL (   prefix,
  st,
  args 
)
Value:
extern struct isl_args args; \
st *prefix ## _new_with_defaults(void); \
void prefix ## _free(st *opt); \
int prefix ## _parse(st *opt, int argc, char **argv, unsigned flags);
Definition: arg.h:108
struct isl_arg * args
Definition: arg.h:110

Definition at line 296 of file arg.h.

◆ ISL_ARG_DEF

#define ISL_ARG_DEF (   prefix,
  st,
  args 
)
Value:
st *prefix ## _new_with_defaults() \
{ \
st *opt = (st *)calloc(1, sizeof(st)); \
if (opt) \
isl_args_set_defaults(&(args), opt); \
return opt; \
} \
\
void prefix ## _free(st *opt) \
{ \
isl_args_free(&(args), opt); \
} \
\
int prefix ## _parse(st *opt, int argc, char **argv, unsigned flags) \
{ \
return isl_args_parse(&(args), argc, argv, opt, flags); \
}
int isl_args_parse(struct isl_args *args, int argc, char **argv, void *opt, unsigned flags)
Definition: isl_arg.c:1256

Definition at line 302 of file arg.h.

◆ ISL_ARG_FLAGS

#define ISL_ARG_FLAGS (   st,
  f,
  s,
  l,
  c,
  d,
 
)
Value:
{ \
.type = isl_arg_flags, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .flags = { .flags = c, .default_value = d } } \
},

Definition at line 270 of file arg.h.

◆ ISL_ARG_FOOTER

#define ISL_ARG_FOOTER (   h)
Value:
{ \
.type = isl_arg_footer, \
.help_msg = h, \
},
@ isl_arg_footer
Definition: arg.h:39

Definition at line 130 of file arg.h.

◆ ISL_ARG_GROUP

#define ISL_ARG_GROUP (   l,
  c,
 
)     ISL_ARG_GROUP_F(l,c,h,0)

Definition at line 268 of file arg.h.

◆ ISL_ARG_GROUP_F

#define ISL_ARG_GROUP_F (   l,
  c,
  h,
  fl 
)     _ISL_ARG_CHILD(ISL_ARG_OFFSET_NONE,l,c,h,fl)

Definition at line 266 of file arg.h.

◆ ISL_ARG_HIDDEN

#define ISL_ARG_HIDDEN   (1 << 2)

Definition at line 61 of file arg.h.

◆ ISL_ARG_INT

#define ISL_ARG_INT (   st,
  f,
  s,
  l,
  a,
  d,
 
)     ISL_ARG_INT_F(st,f,s,l,a,d,h,0)

Definition at line 198 of file arg.h.

◆ ISL_ARG_INT_F

#define ISL_ARG_INT_F (   st,
  f,
  s,
  l,
  a,
  d,
  h,
  fl 
)
Value:
{ \
.type = isl_arg_int, \
.short_name = s, \
.long_name = l, \
.argument_name = a, \
.offset = offsetof(st, f), \
.help_msg = h, \
.flags = fl, \
.u = { .i = { .default_value = d } } \
},
@ isl_arg_int
Definition: arg.h:40

Definition at line 188 of file arg.h.

◆ ISL_ARG_LONG

#define ISL_ARG_LONG (   st,
  f,
  s,
  lo,
  d,
 
)
Value:
{ \
.type = isl_arg_long, \
.short_name = s, \
.long_name = lo, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .l = { .default_value = d, .default_selected = d, \
.set = NULL } } \
},
@ isl_arg_long
Definition: arg.h:42

Definition at line 200 of file arg.h.

◆ ISL_ARG_OFFSET_NONE

#define ISL_ARG_OFFSET_NONE   ((size_t) -1)

Definition at line 56 of file arg.h.

◆ ISL_ARG_OPT_CHOICE

#define ISL_ARG_OPT_CHOICE (   st,
  f,
  s,
  l,
  c,
  d,
  ds,
 
)
Value:
{ \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = ds, .set = NULL } } \
},

Definition at line 143 of file arg.h.

◆ ISL_ARG_OPT_LONG

#define ISL_ARG_OPT_LONG (   st,
  f,
  s,
  lo,
  d,
  ds,
 
)
Value:
{ \
.type = isl_arg_long, \
.short_name = s, \
.long_name = lo, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .l = { .default_value = d, .default_selected = ds, \
.set = NULL } } \
},

Definition at line 218 of file arg.h.

◆ ISL_ARG_PHANTOM_BOOL

#define ISL_ARG_PHANTOM_BOOL (   s,
  l,
  setter,
 
)     ISL_ARG_PHANTOM_BOOL_F(s,l,setter,h,0)

Definition at line 186 of file arg.h.

◆ ISL_ARG_PHANTOM_BOOL_F

#define ISL_ARG_PHANTOM_BOOL_F (   s,
  l,
  setter,
  h,
  fl 
)     _ISL_ARG_BOOL_F(ISL_ARG_OFFSET_NONE,s,l,setter,0,h,fl)

Definition at line 184 of file arg.h.

◆ ISL_ARG_PHANTOM_USER_CHOICE_F

#define ISL_ARG_PHANTOM_USER_CHOICE_F (   s,
  l,
  c,
  setter,
  d,
  h,
  fl 
)
Value:
{ \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = ISL_ARG_OFFSET_NONE, \
.help_msg = h, \
.flags = fl, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = d, .set = setter } } \
},
#define ISL_ARG_OFFSET_NONE
Definition: arg.h:56

Definition at line 152 of file arg.h.

◆ ISL_ARG_SINGLE_DASH

#define ISL_ARG_SINGLE_DASH   (1 << 0)

Definition at line 59 of file arg.h.

◆ ISL_ARG_SKIP_HELP

#define ISL_ARG_SKIP_HELP   (1 << 1)

Definition at line 289 of file arg.h.

◆ ISL_ARG_STR

#define ISL_ARG_STR (   st,
  f,
  s,
  l,
  a,
  d,
 
)     ISL_ARG_STR_F(st,f,s,l,a,d,h,0)

Definition at line 245 of file arg.h.

◆ ISL_ARG_STR_F

#define ISL_ARG_STR_F (   st,
  f,
  s,
  l,
  a,
  d,
  h,
  fl 
)
Value:
{ \
.type = isl_arg_str, \
.short_name = s, \
.long_name = l, \
.argument_name = a, \
.offset = offsetof(st, f), \
.help_msg = h, \
.flags = fl, \
.u = { .str = { .default_value = d } } \
},
@ isl_arg_str
Definition: arg.h:44

Definition at line 235 of file arg.h.

◆ ISL_ARG_STR_LIST

#define ISL_ARG_STR_LIST (   st,
  f_n,
  f_l,
  s,
  l,
  a,
 
)
Value:
{ \
.type = isl_arg_str_list, \
.short_name = s, \
.long_name = l, \
.argument_name = a, \
.offset = offsetof(st, f_l), \
.help_msg = h, \
.u = { .str_list = { .offset_n = offsetof(st, f_n) } } \
},
@ isl_arg_str_list
Definition: arg.h:45

Definition at line 247 of file arg.h.

◆ ISL_ARG_ULONG

#define ISL_ARG_ULONG (   st,
  f,
  s,
  l,
  d,
 
)
Value:
{ \
.type = isl_arg_ulong, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .ul = { .default_value = d } } \
},
@ isl_arg_ulong
Definition: arg.h:43

Definition at line 227 of file arg.h.

◆ ISL_ARG_USER

#define ISL_ARG_USER (   st,
  f,
  i,
 
)
Value:
{ \
.type = isl_arg_user, \
.offset = offsetof(st, f), \
.u = { .user = { .init = i, .clear = c} } \
},
@ isl_arg_user
Definition: arg.h:41

Definition at line 278 of file arg.h.

◆ ISL_ARG_USER_LONG

#define ISL_ARG_USER_LONG (   st,
  f,
  s,
  lo,
  setter,
  d,
 
)
Value:
{ \
.type = isl_arg_long, \
.short_name = s, \
.long_name = lo, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .l = { .default_value = d, .default_selected = d, \
.set = setter } } \
},

Definition at line 209 of file arg.h.

◆ ISL_ARG_USER_OPT_CHOICE

#define ISL_ARG_USER_OPT_CHOICE (   st,
  f,
  s,
  l,
  c,
  setter,
  d,
  ds,
 
)
Value:
{ \
.type = isl_arg_choice, \
.short_name = s, \
.long_name = l, \
.offset = offsetof(st, f), \
.help_msg = h, \
.u = { .choice = { .choice = c, .default_value = d, \
.default_selected = ds, .set = setter } } \
},

Definition at line 162 of file arg.h.

◆ ISL_ARG_VERSION

#define ISL_ARG_VERSION (   print)
Value:
{ \
.type = isl_arg_version, \
.u = { .version = { .print_version = print } } \
},
@ isl_arg_version
Definition: arg.h:46

Definition at line 283 of file arg.h.

◆ ISL_ARGS_END

#define ISL_ARGS_END    { isl_arg_end } };

Definition at line 117 of file arg.h.

◆ ISL_ARGS_START

#define ISL_ARGS_START (   s,
  name 
)
Value:
struct isl_arg name ## LIST[]; \
struct isl_args name = { sizeof(s), name ## LIST }; \
struct isl_arg name ## LIST[] = {
#define LIST(EL)
Definition: isl_list_macro.h:8
const char * name
Definition: isl_test.c:10938
Definition: arg.h:51

Definition at line 113 of file arg.h.

Enumeration Type Documentation

◆ isl_arg_type

Enumerator
isl_arg_end 
isl_arg_alias 
isl_arg_arg 
isl_arg_bool 
isl_arg_child 
isl_arg_choice 
isl_arg_flags 
isl_arg_footer 
isl_arg_int 
isl_arg_user 
isl_arg_long 
isl_arg_ulong 
isl_arg_str 
isl_arg_str_list 
isl_arg_version 

Definition at line 31 of file arg.h.

Function Documentation

◆ isl_args_free()

void isl_args_free ( struct isl_args args,
void *  opt 
)

Definition at line 199 of file isl_arg.c.

References isl_args::args, and free_args().

Referenced by free_child(), isl_ctx_alloc_with_options(), and isl_ctx_free().

◆ isl_args_parse()

int isl_args_parse ( struct isl_args args,
int  argc,
char **  argv,
void *  opt,
unsigned  flags 
)

◆ isl_args_set_defaults()

void isl_args_set_defaults ( struct isl_args args,
void *  opt 
)