return NULL;
}
-static struct isl_basic_map *basic_map_read(struct isl_stream *s)
+static struct isl_map *map_read(struct isl_stream *s, int nparam)
{
struct isl_basic_map *bmap = NULL;
struct isl_token *tok;
bmap = isl_basic_map_simplify(bmap);
bmap = isl_basic_map_finalize(bmap);
- return bmap;
+ return isl_map_from_basic_map(bmap);
error:
isl_basic_map_free(bmap);
if (v)
return NULL;
}
+static struct isl_basic_map *basic_map_read(struct isl_stream *s, int nparam)
+{
+ struct isl_map *map;
+ struct isl_basic_map *bmap;
+
+ map = map_read(s, nparam);
+ if (!map)
+ return NULL;
+
+ isl_assert(map->ctx, map->n <= 1, goto error);
+
+ if (map->n == 0)
+ bmap = isl_basic_map_empty_like_map(map);
+ else
+ bmap = isl_basic_map_copy(map->p[0]);
+
+ isl_map_free(map);
+
+ return bmap;
+error:
+ isl_map_free(map);
+ return NULL;
+}
+
struct isl_basic_map *isl_basic_map_read_from_file_omega(
struct isl_ctx *ctx, FILE *input)
{
struct isl_stream *s = isl_stream_new_file(ctx, input);
if (!s)
return NULL;
- bmap = basic_map_read(s);
+ bmap = basic_map_read(s, 0);
isl_stream_free(s);
return bmap;
}
struct isl_stream *s = isl_stream_new_str(ctx, str);
if (!s)
return NULL;
- bmap = basic_map_read(s);
+ bmap = basic_map_read(s, 0);
isl_stream_free(s);
return bmap;
}