extract out shared isl_reordering_get_space
[isl.git] / print_templ.c
blobd6b0db76bd14739a5050e4e7832aacc0e058b30f
1 #include <isl_printer_private.h>
3 #define xCAT(A,B) A ## B
4 #define CAT(A,B) xCAT(A,B)
5 #undef TYPE
6 #define TYPE CAT(isl_,BASE)
7 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
8 #define FN(TYPE,NAME) xFN(TYPE,NAME)
10 void FN(TYPE,dump)(__isl_keep TYPE *obj)
12 isl_printer *p;
14 if (!obj)
15 return;
16 p = isl_printer_to_file(FN(TYPE,get_ctx)(obj), stderr);
17 p = isl_printer_set_dump(p, 1);
18 p = FN(isl_printer_print,BASE)(p, obj);
19 p = isl_printer_end_line(p);
20 isl_printer_free(p);
23 __isl_give char *FN(TYPE,to_str)(__isl_keep TYPE *obj)
25 isl_printer *p;
26 char *s;
28 if (!obj)
29 return NULL;
30 p = isl_printer_to_str(FN(TYPE,get_ctx)(obj));
31 p = FN(isl_printer_print,BASE)(p, obj);
32 s = isl_printer_get_str(p);
33 isl_printer_free(p);
35 return s;