From 65bdd10b25c1bc0d1859291349c0f0f8a9503130 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 1 Feb 2010 13:37:32 +0100 Subject: [PATCH] isl_map_read: accept "strict" inequalities --- isl_input.c | 14 +++++++++++++- isl_stream.c | 16 ++++++++++------ isl_stream.h | 3 ++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/isl_input.c b/isl_input.c index 6c8f0c6..e3cc97a 100644 --- a/isl_input.c +++ b/isl_input.c @@ -397,6 +397,8 @@ static struct isl_basic_map *add_constraint(struct isl_stream *s, goto error; tok = isl_stream_next_token(s); switch (tok->type) { + case ISL_TOKEN_LT: + case ISL_TOKEN_GT: case ISL_TOKEN_LE: case ISL_TOKEN_GE: case '=': @@ -421,7 +423,17 @@ static struct isl_basic_map *add_constraint(struct isl_stream *s, isl_seq_combine(bmap->ineq[k], (*v)->ctx->one, aff1->el, (*v)->ctx->negone, aff2->el, aff1->size); - else { + else if (tok->type == ISL_TOKEN_LT) { + isl_seq_combine(bmap->ineq[k], (*v)->ctx->negone, aff1->el, + (*v)->ctx->one, aff2->el, + aff1->size); + isl_int_sub_ui(bmap->ineq[k][0], bmap->ineq[k][0], 1); + } else if (tok->type == ISL_TOKEN_GT) { + isl_seq_combine(bmap->ineq[k], (*v)->ctx->one, aff1->el, + (*v)->ctx->negone, aff2->el, + aff1->size); + isl_int_sub_ui(bmap->ineq[k][0], bmap->ineq[k][0], 1); + } else { isl_seq_combine(bmap->ineq[k], (*v)->ctx->one, aff1->el, (*v)->ctx->negone, aff2->el, aff1->size); diff --git a/isl_stream.c b/isl_stream.c index 276759e..bad3085 100644 --- a/isl_stream.c +++ b/isl_stream.c @@ -250,27 +250,31 @@ struct isl_token *isl_stream_next_token(struct isl_stream *s) } if (c == '>') { int c; + tok = isl_token_new(s->ctx, line, col, old_line != line); + if (!tok) + return NULL; if ((c = isl_stream_getc(s)) == '=') { - tok = isl_token_new(s->ctx, line, col, old_line != line); - if (!tok) - return NULL; tok->type = ISL_TOKEN_GE; return tok; } if (c != -1) isl_stream_ungetc(s, c); + tok->type = ISL_TOKEN_GT; + return tok; } if (c == '<') { int c; + tok = isl_token_new(s->ctx, line, col, old_line != line); + if (!tok) + return NULL; if ((c = isl_stream_getc(s)) == '=') { - tok = isl_token_new(s->ctx, line, col, old_line != line); - if (!tok) - return NULL; tok->type = ISL_TOKEN_LE; return tok; } if (c != -1) isl_stream_ungetc(s, c); + tok->type = ISL_TOKEN_LT; + return tok; } if (c == '&') { tok = isl_token_new(s->ctx, line, col, old_line != line); diff --git a/isl_stream.h b/isl_stream.h index 2d0119b..cd39b59 100644 --- a/isl_stream.h +++ b/isl_stream.h @@ -18,7 +18,8 @@ extern "C" { enum isl_token_type { ISL_TOKEN_UNKNOWN = 256, ISL_TOKEN_VALUE, ISL_TOKEN_IDENT, ISL_TOKEN_GE, - ISL_TOKEN_LE, ISL_TOKEN_TO, ISL_TOKEN_AND, + ISL_TOKEN_LE, ISL_TOKEN_GT, ISL_TOKEN_LT, + ISL_TOKEN_TO, ISL_TOKEN_AND, ISL_TOKEN_OR, ISL_TOKEN_EXISTS }; struct isl_token { -- 2.7.4