From 13380772221c4aaa3542a693fc04bcad53b1ca1d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 8 Nov 2010 14:31:32 +0100 Subject: [PATCH] isl_bound: accept folds as input Signed-off-by: Sven Verdoolaege --- bound.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bound.c b/bound.c index a326e35c..ae81543a 100644 --- a/bound.c +++ b/bound.c @@ -225,10 +225,10 @@ static int check_solution(__isl_take isl_pw_qpolynomial_fold *pwf, int main(int argc, char **argv) { isl_ctx *ctx; - isl_pw_qpolynomial *pwqp; isl_pw_qpolynomial_fold *copy; isl_pw_qpolynomial_fold *pwf; struct isl_stream *s; + struct isl_obj obj; struct bound_options *options; int exact; int r = 0; @@ -240,8 +240,16 @@ int main(int argc, char **argv) ctx = isl_ctx_alloc_with_options(bound_options_arg, options); s = isl_stream_new_file(ctx, stdin); - pwqp = isl_stream_read_pw_qpolynomial(s); - pwf = isl_pw_qpolynomial_fold_from_pw_qpolynomial(isl_fold_max, pwqp); + obj = isl_stream_read_obj(s); + if (obj.type == isl_obj_pw_qpolynomial) + pwf = isl_pw_qpolynomial_fold_from_pw_qpolynomial(isl_fold_max, + obj.v); + else if (obj.type == isl_obj_pw_qpolynomial_fold) + pwf = obj.v; + else { + obj.type->free(obj.v); + isl_die(ctx, isl_error_invalid, "invalid input", goto error); + } if (options->verify) copy = isl_pw_qpolynomial_fold_copy(pwf); @@ -259,6 +267,7 @@ int main(int argc, char **argv) isl_pw_qpolynomial_fold_free(pwf); } +error: isl_stream_free(s); isl_ctx_free(ctx); -- 2.11.4.GIT