2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
13 isl_ctx
*isl_ctx_alloc_with_options(struct isl_options
*opt
)
15 struct isl_ctx
*ctx
= NULL
;
20 ctx
= isl_calloc_type(NULL
, struct isl_ctx
);
24 if (isl_hash_table_init(ctx
, &ctx
->name_hash
, 0))
27 ctx
->stats
= isl_calloc_type(ctx
, struct isl_stats
);
34 isl_int_init(ctx
->one
);
35 isl_int_set_si(ctx
->one
, 1);
37 isl_int_init(ctx
->negone
);
38 isl_int_set_si(ctx
->negone
, -1);
40 isl_int_init(ctx
->normalize_gcd
);
50 struct isl_ctx
*isl_ctx_alloc()
52 struct isl_options
*opt
;
54 opt
= isl_options_new_with_defaults();
56 return isl_ctx_alloc_with_options(opt
);
59 void isl_ctx_ref(struct isl_ctx
*ctx
)
64 void isl_ctx_deref(struct isl_ctx
*ctx
)
66 isl_assert(ctx
, ctx
->ref
> 0, return);
70 void isl_ctx_free(struct isl_ctx
*ctx
)
74 isl_assert(ctx
, ctx
->ref
== 0, return);
75 isl_hash_table_clear(&ctx
->name_hash
);
76 isl_blk_clear_cache(ctx
);
77 isl_int_clear(ctx
->one
);
78 isl_int_clear(ctx
->negone
);
79 isl_int_clear(ctx
->normalize_gcd
);
85 struct isl_options
*isl_ctx_options(isl_ctx
*ctx
)