X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_ctx.c;h=5b37bf550b9114de21b76fb6644b820ef347c503;hb=91dceca677c550ef4d9016a13b20a4a2a53d1405;hp=e844e564ae08a04431a9c8a35a81d40c51f59710;hpb=7adc3116c28a60bd8975a04e0041ea6005613249;p=platform%2Fupstream%2Fisl.git diff --git a/isl_ctx.c b/isl_ctx.c index e844e56..5b37bf5 100644 --- a/isl_ctx.c +++ b/isl_ctx.c @@ -7,23 +7,23 @@ * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ -#include "isl_ctx.h" -#include "isl_vec.h" +#include +#include -static struct isl_options *find_nested_isl_options(struct isl_arg *arg, - void *opt) +static struct isl_options *find_nested_options(struct isl_arg *arg, + void *opt, struct isl_arg *wanted) { int i; struct isl_options *options; - if (arg == isl_options_arg) + if (arg == wanted) return opt; for (i = 0; arg[i].type != isl_arg_end; ++i) { if (arg[i].type != isl_arg_child) continue; - options = find_nested_isl_options(arg[i].u.child.child, - *(void **)(((char *)opt) + arg->offset)); + options = find_nested_options(arg[i].u.child.child, + *(void **)(((char *)opt) + arg->offset), wanted); if (options) return options; } @@ -31,6 +31,19 @@ static struct isl_options *find_nested_isl_options(struct isl_arg *arg, return NULL; } +static struct isl_options *find_nested_isl_options(struct isl_arg *arg, + void *opt) +{ + return find_nested_options(arg, opt, isl_options_arg); +} + +void *isl_ctx_peek_options(isl_ctx *ctx, struct isl_arg *arg) +{ + if (!ctx) + return NULL; + return find_nested_options(ctx->user_arg, ctx->user_opt, arg); +} + isl_ctx *isl_ctx_alloc_with_options(struct isl_arg *arg, void *user_opt) { struct isl_ctx *ctx = NULL; @@ -71,12 +84,18 @@ isl_ctx *isl_ctx_alloc_with_options(struct isl_arg *arg, void *user_opt) isl_int_init(ctx->one); isl_int_set_si(ctx->one, 1); + isl_int_init(ctx->two); + isl_int_set_si(ctx->two, 2); + isl_int_init(ctx->negone); isl_int_set_si(ctx->negone, -1); isl_int_init(ctx->normalize_gcd); ctx->n_cached = 0; + ctx->n_miss = 0; + + ctx->error = isl_error_none; return ctx; error: @@ -116,6 +135,7 @@ void isl_ctx_free(struct isl_ctx *ctx) isl_blk_clear_cache(ctx); isl_int_clear(ctx->zero); isl_int_clear(ctx->one); + isl_int_clear(ctx->two); isl_int_clear(ctx->negone); isl_int_clear(ctx->normalize_gcd); isl_arg_free(ctx->user_arg, ctx->user_opt); @@ -131,3 +151,36 @@ struct isl_options *isl_ctx_options(isl_ctx *ctx) return NULL; return ctx->opt; } + +enum isl_error isl_ctx_last_error(isl_ctx *ctx) +{ + return ctx->error; +} + +void isl_ctx_reset_error(isl_ctx *ctx) +{ + ctx->error = isl_error_none; +} + +void isl_ctx_set_error(isl_ctx *ctx, enum isl_error error) +{ + if (ctx) + ctx->error = error; +} + +void isl_ctx_abort(isl_ctx *ctx) +{ + if (ctx) + ctx->abort = 1; +} + +void isl_ctx_resume(isl_ctx *ctx) +{ + if (ctx) + ctx->abort = 0; +} + +int isl_ctx_aborted(isl_ctx *ctx) +{ + return ctx ? ctx->abort : -1; +}