3 static void print_constraint_polylib(struct isl_basic_set *bset,
5 FILE *out, int indent, const char *prefix, const char *suffix)
8 unsigned dim = isl_basic_set_n_dim(bset);
9 unsigned nparam = isl_basic_set_n_param(bset);
10 isl_int *c = ineq ? bset->ineq[n] : bset->eq[n];
12 fprintf(out, "%*s%s", indent, "", prefix ? prefix : "");
13 fprintf(out, "%d", ineq);
14 for (i = 0; i < dim; ++i) {
16 isl_int_print(out, c[1+nparam+i], 5);
18 for (i = 0; i < bset->n_div; ++i) {
20 isl_int_print(out, c[1+nparam+dim+i], 5);
22 for (i = 0; i < nparam; ++i) {
24 isl_int_print(out, c[1+i], 5);
27 isl_int_print(out, c[0], 5);
28 fprintf(out, "%s\n", suffix ? suffix : "");
31 static void print_constraints_polylib(struct isl_basic_set *bset,
32 FILE *out, int indent, const char *prefix, const char *suffix)
36 for (i = 0; i < bset->n_eq; ++i)
37 print_constraint_polylib(bset, 0, i, out,
38 indent, prefix, suffix);
39 for (i = 0; i < bset->n_ineq; ++i)
40 print_constraint_polylib(bset, 1, i, out,
41 indent, prefix, suffix);
44 static void isl_basic_set_print_polylib(struct isl_basic_set *bset, FILE *out,
45 int indent, const char *prefix, const char *suffix)
47 unsigned total = isl_basic_set_total_dim(bset);
48 fprintf(out, "%*s%s", indent, "", prefix ? prefix : "");
49 fprintf(out, "%d %d", bset->n_eq + bset->n_ineq, 1 + total + 1);
50 fprintf(out, "%s\n", suffix ? suffix : "");
51 print_constraints_polylib(bset, out, indent, prefix, suffix);
54 static void isl_set_print_polylib(struct isl_set *set, FILE *out, int indent)
58 fprintf(out, "%*s", indent, "");
59 fprintf(out, "%d\n", set->n);
60 for (i = 0; i < set->n; ++i) {
62 isl_basic_set_print_polylib(set->p[i], out, indent, NULL, NULL);
66 void isl_basic_set_print(struct isl_basic_set *bset, FILE *out, int indent,
67 const char *prefix, const char *suffix, unsigned output_format)
71 if (output_format == ISL_FORMAT_POLYLIB)
72 isl_basic_set_print_polylib(bset, out, indent, prefix, suffix);
73 else if (output_format == ISL_FORMAT_POLYLIB_CONSTRAINTS)
74 print_constraints_polylib(bset, out, indent, prefix, suffix);
76 isl_assert(bset->ctx, 0, return);
79 void isl_set_print(struct isl_set *set, FILE *out, int indent,
80 unsigned output_format)
84 if (output_format == ISL_FORMAT_POLYLIB)
85 isl_set_print_polylib(set, out, indent);
87 isl_assert(set->ctx, 0, return);