add generic isl_obj
[platform/upstream/isl.git] / isl_ctx.c
index a9e29f7..ea9831f 100644 (file)
--- a/isl_ctx.c
+++ b/isl_ctx.c
@@ -1,13 +1,22 @@
+/*
+ * Copyright 2008-2009 Katholieke Universiteit Leuven
+ *
+ * Use of this software is governed by the GNU LGPLv2.1 license
+ *
+ * Written by Sven Verdoolaege, K.U.Leuven, Departement
+ * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
+ */
+
 #include "isl_ctx.h"
 #include "isl_vec.h"
-#ifdef ISL_POLYLIB
-#include <polylib/polylibgmp.h>
-#endif
 
-struct isl_ctx *isl_ctx_alloc()
+isl_ctx *isl_ctx_alloc_with_options(struct isl_options *opt)
 {
        struct isl_ctx *ctx = NULL;
 
+       if (!opt)
+               return NULL;
+
        ctx = isl_calloc_type(NULL, struct isl_ctx);
        if (!ctx)
                goto error;
@@ -19,6 +28,7 @@ struct isl_ctx *isl_ctx_alloc()
        if (!ctx->stats)
                goto error;
 
+       ctx->opt = opt;
        ctx->ref = 0;
 
        isl_int_init(ctx->one);
@@ -31,23 +41,21 @@ struct isl_ctx *isl_ctx_alloc()
 
        ctx->n_cached = 0;
 
-#ifdef ISL_POLYLIB
-       ctx->MaxRays = POL_NO_DUAL | POL_INTEGER;
-#endif
-
-       ctx->lp_solver = ISL_LP_TAB;
-       ctx->ilp_solver = ISL_ILP_GBR;
-       ctx->pip = ISL_PIP_TAB;
-
-       ctx->gbr = ISL_GBR_ONCE;
-       ctx->gbr_only_first = 0;
-
        return ctx;
 error:
        free(ctx);
        return NULL;
 }
 
+struct isl_ctx *isl_ctx_alloc()
+{
+       struct isl_options *opt;
+
+       opt = isl_options_new_with_defaults();
+
+       return isl_ctx_alloc_with_options(opt);
+}
+
 void isl_ctx_ref(struct isl_ctx *ctx)
 {
        ctx->ref++;
@@ -69,6 +77,14 @@ void isl_ctx_free(struct isl_ctx *ctx)
        isl_int_clear(ctx->one);
        isl_int_clear(ctx->negone);
        isl_int_clear(ctx->normalize_gcd);
+       free(ctx->opt);
        free(ctx->stats);
        free(ctx);
 }
+
+struct isl_options *isl_ctx_options(isl_ctx *ctx)
+{
+       if (!ctx)
+               return NULL;
+       return ctx->opt;
+}