12 #define ISLPP_STRINGIZE_(X) #X
13 #define ISLPP_STRINGIZE(X) ISLPP_STRINGIZE_(X)
15 #define ISLPP_ASSERT(test, message) \
19 fputs("Assertion \"" #test "\" failed at " __FILE__ \
20 ":" ISLPP_STRINGIZE(__LINE__) "\n " message "\n", \
27 mutable bool checked = false;
30 friend boolean manage(isl_bool val);
31 boolean(isl_bool val): val(val) {}
34 : val(isl_bool_error) {}
36 ISLPP_ASSERT(checked, "IMPLEMENTATION ERROR: Unchecked state");
39 /* implicit */ boolean(bool val)
40 : val(val ? isl_bool_true : isl_bool_false) {}
42 bool is_error() const { checked = true; return val == isl_bool_error; }
43 bool is_false() const { checked = true; return val == isl_bool_false; }
44 bool is_true() const { checked = true; return val == isl_bool_true; }
46 explicit operator bool() const {
47 ISLPP_ASSERT(checked, "IMPLEMENTATION ERROR: Unchecked error state");
48 ISLPP_ASSERT(!is_error(), "IMPLEMENTATION ERROR: Unhandled error state");
52 boolean operator!() const {
59 inline boolean manage(isl_bool val) {
66 /* implicit */ ctx(isl_ctx *ctx)
78 /* Class encapsulating an isl_stat value.
82 mutable bool checked = false;
85 friend stat manage(isl_stat val);
86 constexpr stat(isl_stat val) : val(val) {}
89 return stat(isl_stat_ok);
92 return stat(isl_stat_error);
94 stat() : val(isl_stat_error) {}
96 ISLPP_ASSERT(checked, "IMPLEMENTATION ERROR: Unchecked state");
104 bool is_error() const {
106 return val == isl_stat_error;
110 return val == isl_stat_ok;
114 inline stat manage(isl_stat val)