36#ifndef __isl_constructor
37#define __isl_constructor
40#define __isl_subclass(super)
43#if defined(__cplusplus)
98#define isl_size_error ((int) -1)
104#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
105#define ISL_DEPRECATED __attribute__((__deprecated__))
107#define ISL_DEPRECATED
110#define ISL_FL_INIT(l, f) (l) = (f)
111#define ISL_FL_SET(l, f) ((l) |= (f))
112#define ISL_FL_CLR(l, f) ((l) &= ~(f))
113#define ISL_FL_ISSET(l, f) (!!((l) & (f)))
115#define ISL_F_INIT(p, f) ISL_FL_INIT((p)->flags, f)
116#define ISL_F_SET(p, f) ISL_FL_SET((p)->flags, f)
117#define ISL_F_CLR(p, f) ISL_FL_CLR((p)->flags, f)
118#define ISL_F_ISSET(p, f) ISL_FL_ISSET((p)->flags, f)
124#define isl_alloc(ctx,type,size) ((type *)isl_malloc_or_die(ctx, size))
125#define isl_calloc(ctx,type,size) ((type *)isl_calloc_or_die(ctx,\
127#define isl_realloc(ctx,ptr,type,size) ((type *)isl_realloc_or_die(ctx,\
129#define isl_alloc_type(ctx,type) isl_alloc(ctx,type,sizeof(type))
130#define isl_calloc_type(ctx,type) isl_calloc(ctx,type,sizeof(type))
131#define isl_realloc_type(ctx,ptr,type) isl_realloc(ctx,ptr,type,sizeof(type))
132#define isl_alloc_array(ctx,type,n) isl_alloc(ctx,type,(n)*sizeof(type))
133#define isl_calloc_array(ctx,type,n) ((type *)isl_calloc_or_die(ctx,\
135#define isl_realloc_array(ctx,ptr,type,n) \
136 isl_realloc(ctx,ptr,type,(n)*sizeof(type))
138#define isl_die(ctx,errno,msg,code) \
140 isl_handle_error(ctx, errno, msg, __FILE__, __LINE__); \
145 const char *file,
int line);
147#define isl_assert4(ctx,test,code,errno) \
151 isl_die(ctx, errno, "Assertion \"" #test "\" failed", code); \
153#define isl_assert(ctx,test,code) \
154 isl_assert4(ctx,test,code,isl_error_unknown)
156#define isl_min(a,b) ((a < b) ? (a) : (b))
179#define ISL_ARG_CTX_DECL(prefix,st,args) \
180st *isl_ctx_peek_ ## prefix(isl_ctx *ctx);
182#define ISL_ARG_CTX_DEF(prefix,st,args) \
183st *isl_ctx_peek_ ## prefix(isl_ctx *ctx) \
185 return (st *)isl_ctx_peek_options(ctx, &(args)); \
188#define ISL_CTX_GET_INT_DEF(prefix,st,args,field) \
189int prefix ## _get_ ## field(isl_ctx *ctx) \
192 options = isl_ctx_peek_ ## prefix(ctx); \
194 isl_die(ctx, isl_error_invalid, \
195 "isl_ctx does not reference " #prefix, \
197 return options->field; \
200#define ISL_CTX_SET_INT_DEF(prefix,st,args,field) \
201isl_stat prefix ## _set_ ## field(isl_ctx *ctx, int val) \
204 options = isl_ctx_peek_ ## prefix(ctx); \
206 isl_die(ctx, isl_error_invalid, \
207 "isl_ctx does not reference " #prefix, \
208 return isl_stat_error); \
209 options->field = val; \
210 return isl_stat_ok; \
213#define ISL_CTX_GET_STR_DEF(prefix,st,args,field) \
214const char *prefix ## _get_ ## field(isl_ctx *ctx) \
217 options = isl_ctx_peek_ ## prefix(ctx); \
219 isl_die(ctx, isl_error_invalid, \
220 "isl_ctx does not reference " #prefix, \
222 return options->field; \
225#define ISL_CTX_SET_STR_DEF(prefix,st,args,field) \
226isl_stat prefix ## _set_ ## field(isl_ctx *ctx, const char *val) \
229 options = isl_ctx_peek_ ## prefix(ctx); \
231 isl_die(ctx, isl_error_invalid, \
232 "isl_ctx does not reference " #prefix, \
233 return isl_stat_error); \
235 return isl_stat_error; \
236 free(options->field); \
237 options->field = strdup(val); \
238 if (!options->field) \
239 return isl_stat_error; \
240 return isl_stat_ok; \
243#define ISL_CTX_GET_BOOL_DEF(prefix,st,args,field) \
244 ISL_CTX_GET_INT_DEF(prefix,st,args,field)
246#define ISL_CTX_SET_BOOL_DEF(prefix,st,args,field) \
247 ISL_CTX_SET_INT_DEF(prefix,st,args,field)
249#define ISL_CTX_GET_CHOICE_DEF(prefix,st,args,field) \
250 ISL_CTX_GET_INT_DEF(prefix,st,args,field)
252#define ISL_CTX_SET_CHOICE_DEF(prefix,st,args,field) \
253 ISL_CTX_SET_INT_DEF(prefix,st,args,field)
262#if defined(__cplusplus)
isl_ctx * isl_ctx_alloc_with_options(struct isl_args *args, __isl_take void *opt)
isl_stat isl_stat_non_null(void *obj)
const char * isl_ctx_last_error_file(isl_ctx *ctx)
enum isl_error isl_ctx_last_error(isl_ctx *ctx)
int isl_ctx_aborted(isl_ctx *ctx)
isl_ctx * isl_ctx_alloc(void)
void * isl_realloc_or_die(isl_ctx *ctx, void *ptr, size_t size)
void isl_handle_error(isl_ctx *ctx, enum isl_error error, const char *msg, const char *file, int line)
void isl_ctx_deref(struct isl_ctx *ctx)
unsigned long isl_ctx_get_max_operations(isl_ctx *ctx)
void isl_ctx_reset_operations(isl_ctx *ctx)
isl_bool isl_bool_ok(int b)
void isl_ctx_resume(isl_ctx *ctx)
void isl_ctx_reset_error(isl_ctx *ctx)
void * isl_calloc_or_die(isl_ctx *ctx, size_t nmemb, size_t size)
void isl_ctx_set_error(isl_ctx *ctx, enum isl_error error)
int isl_ctx_last_error_line(isl_ctx *ctx)
void isl_ctx_abort(isl_ctx *ctx)
void isl_ctx_ref(struct isl_ctx *ctx)
isl_stat isl_stat_non_error_bool(isl_bool b)
struct isl_options * isl_ctx_options(isl_ctx *ctx)
isl_bool isl_bool_not(isl_bool b)
void * isl_malloc_or_die(isl_ctx *ctx, size_t size)
const char * isl_ctx_last_error_msg(isl_ctx *ctx)
void * isl_ctx_peek_options(isl_ctx *ctx, struct isl_args *args)
void isl_ctx_set_max_operations(isl_ctx *ctx, unsigned long max_operations)
int isl_ctx_parse_options(isl_ctx *ctx, int argc, char **argv, unsigned flags)
void isl_ctx_free(isl_ctx *ctx)
unsigned long max_operations