From b2d9ffbb5f43d21eca9bb33c36493fcaccd1166f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 27 Jul 2010 16:11:01 +0200 Subject: [PATCH] isl_cat: read generic objects Signed-off-by: Sven Verdoolaege --- cat.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/cat.c b/cat.c index 21fbf66d..a37c183e 100644 --- a/cat.c +++ b/cat.c @@ -1,5 +1,7 @@ #include -#include +#include +#include +#include struct isl_arg_choice cat_format[] = { {"isl", ISL_FORMAT_ISL}, @@ -26,8 +28,10 @@ ISL_ARG_DEF(cat_options, struct cat_options, cat_options_arg) int main(int argc, char **argv) { struct isl_ctx *ctx; - struct isl_map *map; + struct isl_stream *s; + struct isl_obj obj; struct cat_options *options; + isl_printer *p; options = cat_options_new_with_defaults(); assert(options); @@ -35,11 +39,17 @@ int main(int argc, char **argv) ctx = isl_ctx_alloc_with_options(cat_options_arg, options); - map = isl_map_read_from_file(ctx, stdin, -1); - isl_map_print(map, stdout, 0, options->format); - if (options->format == ISL_FORMAT_ISL) - printf("\n"); - isl_map_free(map); + s = isl_stream_new_file(ctx, stdin); + obj = isl_stream_read_obj(s); + isl_stream_free(s); + + p = isl_printer_to_file(ctx, stdout); + p = isl_printer_set_output_format(p, options->format); + p = obj.type->print(p, obj.v); + p = isl_printer_end_line(p); + isl_printer_free(p); + + obj.type->free(obj.v); isl_ctx_free(ctx); -- 2.11.4.GIT