isl_map_read: accept "strict" inequalities
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 1 Feb 2010 12:37:32 +0000 (13:37 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 3 Feb 2010 17:29:52 +0000 (18:29 +0100)
isl_input.c
isl_stream.c
isl_stream.h

index 6c8f0c6..e3cc97a 100644 (file)
@@ -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);
index 276759e..bad3085 100644 (file)
@@ -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);
index 2d0119b..cd39b59 100644 (file)
@@ -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 {