print_templ.c 846 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <isl_printer_private.h>
  2. #define xCAT(A,B) A ## B
  3. #define CAT(A,B) xCAT(A,B)
  4. #undef TYPE
  5. #define TYPE CAT(isl_,BASE)
  6. #define xFN(TYPE,NAME) TYPE ## _ ## NAME
  7. #define FN(TYPE,NAME) xFN(TYPE,NAME)
  8. #ifndef PRINT_DUMP_DEFAULT
  9. #define PRINT_DUMP_DEFAULT 1
  10. #endif
  11. void FN(TYPE,dump)(__isl_keep TYPE *obj)
  12. {
  13. 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, PRINT_DUMP_DEFAULT);
  18. p = FN(isl_printer_print,BASE)(p, obj);
  19. p = isl_printer_end_line(p);
  20. isl_printer_free(p);
  21. }
  22. #undef PRINT_DUMP_DEFAULT
  23. __isl_give char *FN(TYPE,to_str)(__isl_keep TYPE *obj)
  24. {
  25. isl_printer *p;
  26. char *s;
  27. if (!obj)
  28. return NULL;
  29. p = isl_printer_to_str(FN(TYPE,get_ctx)(obj));
  30. p = FN(isl_printer_print,BASE)(p, obj);
  31. s = isl_printer_get_str(p);
  32. isl_printer_free(p);
  33. return s;
  34. }