1 | #define xCAT(A,B) A ## B |
2 | #define CAT(A,B) xCAT(A,B) |
3 | #undef TYPE |
4 | #define TYPE CAT(isl_,BASE) |
5 | #define xFN(TYPE,NAME) TYPE ## _ ## NAME |
6 | #define FN(TYPE,NAME) xFN(TYPE,NAME) |
7 | |
8 | /* Check that printing "obj" and parsing the output results |
9 | * in the same expression. |
10 | */ |
11 | static isl_stat FN(check_reparse,BASE)(isl_ctx *ctx, |
12 | __isl_take TYPE *obj) |
13 | { |
14 | char *str; |
15 | isl_bool equal; |
16 | TYPE *obj2; |
17 | |
18 | str = FN(TYPE,to_str)(mpa: obj); |
19 | obj2 = FN(TYPE,read_from_str)(ctx, str); |
20 | free(ptr: str); |
21 | equal = FN(TYPE,plain_is_equal)(multi1: obj, multi2: obj2); |
22 | FN(TYPE,free)(multi: obj); |
23 | FN(TYPE,free)(multi: obj2); |
24 | if (equal < 0) |
25 | return isl_stat_error; |
26 | if (!equal) |
27 | isl_die(ctx, isl_error_unknown, |
28 | "parsed function not equal to original" , |
29 | return isl_stat_error); |
30 | |
31 | return isl_stat_ok; |
32 | } |
33 | |