From adf6f98ef87dfd0f936ecff40c5cf4ef9626019f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 14 Feb 2010 19:04:13 +0100 Subject: [PATCH] add isl_closure test application --- Makefile.am | 9 ++++++++- closure.c | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 closure.c diff --git a/Makefile.am b/Makefile.am index 85815bb..eaf3bec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,8 @@ ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = libisl.la noinst_PROGRAMS = isl_test isl_polyhedron_sample isl_pip \ isl_polyhedron_minimize isl_polytope_scan \ - isl_polyhedron_detect_equalities isl_cat + isl_polyhedron_detect_equalities isl_cat \ + isl_closure TESTS = isl_test if HAVE_PIPLIB @@ -128,6 +129,12 @@ isl_cat_LDADD = libisl.la isl_cat_SOURCES = \ cat.c +isl_closure_CPPFLAGS = -I$(srcdir)/include -Iinclude/ \ + @GMP_CPPFLAGS@ +isl_closure_LDADD = libisl.la +isl_closure_SOURCES = \ + closure.c + nodist_pkginclude_HEADERS = \ include/isl_config.h \ include/isl_stdint.h diff --git a/closure.c b/closure.c new file mode 100644 index 0000000..7f415e7 --- /dev/null +++ b/closure.c @@ -0,0 +1,25 @@ +#include + +int main(int argc, char **argv) +{ + struct isl_ctx *ctx; + struct isl_map *map; + int exact; + + ctx = isl_ctx_alloc(); + + map = isl_map_read_from_file(ctx, stdin, -1); + map = isl_map_transitive_closure(map, &exact); + if (!exact) + printf("# NOT exact\n"); + isl_map_print(map, stdout, 0, ISL_FORMAT_ISL); + map = isl_map_compute_divs(map); + map = isl_map_coalesce(map); + printf("# coalesced\n"); + isl_map_print(map, stdout, 0, ISL_FORMAT_ISL); + isl_map_free(map); + + isl_ctx_free(ctx); + + return 0; +} -- 2.7.4