isl_output.c: extract out common print_dim
[isl.git] / isl_obj.c
blob74381465c219c4591d380199f52e613bfcb58559
1 /*
2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
8 * 91893 Orsay, France
9 */
11 #include <isl_obj.h>
13 static void *isl_obj_map_copy(void *v)
15 return isl_map_copy((struct isl_map *)v);
18 static void isl_obj_map_free(void *v)
20 isl_map_free((struct isl_map *)v);
23 static __isl_give isl_printer *isl_obj_map_print(__isl_take isl_printer *p,
24 void *v)
26 return isl_printer_print_map(p, (struct isl_map *)v);
29 static void *isl_obj_map_add(void *v1, void *v2)
31 return isl_map_union((struct isl_map *)v1, (struct isl_map *)v2);
34 struct isl_obj_vtable isl_obj_map_vtable = {
35 isl_obj_map_copy,
36 isl_obj_map_add,
37 isl_obj_map_print,
38 isl_obj_map_free
41 static void *isl_obj_union_map_copy(void *v)
43 return isl_union_map_copy((isl_union_map *)v);
46 static void isl_obj_union_map_free(void *v)
48 isl_union_map_free((isl_union_map *)v);
51 static __isl_give isl_printer *isl_obj_union_map_print(__isl_take isl_printer *p,
52 void *v)
54 return isl_printer_print_union_map(p, (isl_union_map *)v);
57 static void *isl_obj_union_map_add(void *v1, void *v2)
59 return isl_union_map_union((isl_union_map *)v1, (isl_union_map *)v2);
62 struct isl_obj_vtable isl_obj_union_map_vtable = {
63 isl_obj_union_map_copy,
64 isl_obj_union_map_add,
65 isl_obj_union_map_print,
66 isl_obj_union_map_free
69 static void *isl_obj_set_copy(void *v)
71 return isl_set_copy((struct isl_set *)v);
74 static void isl_obj_set_free(void *v)
76 isl_set_free((struct isl_set *)v);
79 static __isl_give isl_printer *isl_obj_set_print(__isl_take isl_printer *p,
80 void *v)
82 return isl_printer_print_set(p, (struct isl_set *)v);
85 static void *isl_obj_set_add(void *v1, void *v2)
87 return isl_set_union((struct isl_set *)v1, (struct isl_set *)v2);
90 struct isl_obj_vtable isl_obj_set_vtable = {
91 isl_obj_set_copy,
92 isl_obj_set_add,
93 isl_obj_set_print,
94 isl_obj_set_free
97 static void *isl_obj_union_set_copy(void *v)
99 return isl_union_set_copy((isl_union_set *)v);
102 static void isl_obj_union_set_free(void *v)
104 isl_union_set_free((isl_union_set *)v);
107 static __isl_give isl_printer *isl_obj_union_set_print(__isl_take isl_printer *p,
108 void *v)
110 return isl_printer_print_union_set(p, (isl_union_set *)v);
113 static void *isl_obj_union_set_add(void *v1, void *v2)
115 return isl_union_set_union((isl_union_set *)v1, (isl_union_set *)v2);
118 struct isl_obj_vtable isl_obj_union_set_vtable = {
119 isl_obj_union_set_copy,
120 isl_obj_union_set_add,
121 isl_obj_union_set_print,
122 isl_obj_union_set_free
125 static void *isl_obj_none_copy(void *v)
127 return v;
130 static void isl_obj_none_free(void *v)
134 static __isl_give isl_printer *isl_obj_none_print(__isl_take isl_printer *p,
135 void *v)
137 return p;
140 static void *isl_obj_none_add(void *v1, void *v2)
142 return NULL;
145 struct isl_obj_vtable isl_obj_none_vtable = {
146 isl_obj_none_copy,
147 isl_obj_none_add,
148 isl_obj_none_print,
149 isl_obj_none_free
152 static void *isl_obj_pw_qp_copy(void *v)
154 return isl_pw_qpolynomial_copy((struct isl_pw_qpolynomial *)v);
157 static void isl_obj_pw_qp_free(void *v)
159 isl_pw_qpolynomial_free((struct isl_pw_qpolynomial *)v);
162 static __isl_give isl_printer *isl_obj_pw_qp_print(__isl_take isl_printer *p,
163 void *v)
165 return isl_printer_print_pw_qpolynomial(p,
166 (struct isl_pw_qpolynomial *)v);
169 static void *isl_obj_pw_qp_add(void *v1, void *v2)
171 return isl_pw_qpolynomial_add((struct isl_pw_qpolynomial *)v1,
172 (struct isl_pw_qpolynomial *)v2);
175 struct isl_obj_vtable isl_obj_pw_qpolynomial_vtable = {
176 isl_obj_pw_qp_copy,
177 isl_obj_pw_qp_add,
178 isl_obj_pw_qp_print,
179 isl_obj_pw_qp_free
182 static void *isl_obj_union_pw_qp_copy(void *v)
184 return isl_union_pw_qpolynomial_copy((struct isl_union_pw_qpolynomial *)v);
187 static void isl_obj_union_pw_qp_free(void *v)
189 isl_union_pw_qpolynomial_free((struct isl_union_pw_qpolynomial *)v);
192 static __isl_give isl_printer *isl_obj_union_pw_qp_print(
193 __isl_take isl_printer *p, void *v)
195 return isl_printer_print_union_pw_qpolynomial(p,
196 (struct isl_union_pw_qpolynomial *)v);
199 static void *isl_obj_union_pw_qp_add(void *v1, void *v2)
201 return isl_union_pw_qpolynomial_add(
202 (struct isl_union_pw_qpolynomial *)v1,
203 (struct isl_union_pw_qpolynomial *)v2);
206 struct isl_obj_vtable isl_obj_union_pw_qpolynomial_vtable = {
207 isl_obj_union_pw_qp_copy,
208 isl_obj_union_pw_qp_add,
209 isl_obj_union_pw_qp_print,
210 isl_obj_union_pw_qp_free
213 static void *isl_obj_pw_qpf_copy(void *v)
215 return isl_pw_qpolynomial_fold_copy((struct isl_pw_qpolynomial_fold *)v);
218 static void isl_obj_pw_qpf_free(void *v)
220 isl_pw_qpolynomial_fold_free((struct isl_pw_qpolynomial_fold *)v);
223 static __isl_give isl_printer *isl_obj_pw_qpf_print(__isl_take isl_printer *p,
224 void *v)
226 return isl_printer_print_pw_qpolynomial_fold(p,
227 (struct isl_pw_qpolynomial_fold *)v);
230 static void *isl_obj_pw_qpf_add(void *v1, void *v2)
232 return isl_pw_qpolynomial_fold_add((struct isl_pw_qpolynomial_fold *)v1,
233 (struct isl_pw_qpolynomial_fold *)v2);
236 struct isl_obj_vtable isl_obj_pw_qpolynomial_fold_vtable = {
237 isl_obj_pw_qpf_copy,
238 isl_obj_pw_qpf_add,
239 isl_obj_pw_qpf_print,
240 isl_obj_pw_qpf_free
243 static void *isl_obj_union_pw_qpf_copy(void *v)
245 return isl_union_pw_qpolynomial_fold_copy((struct isl_union_pw_qpolynomial_fold *)v);
248 static void isl_obj_union_pw_qpf_free(void *v)
250 isl_union_pw_qpolynomial_fold_free((struct isl_union_pw_qpolynomial_fold *)v);
253 static __isl_give isl_printer *isl_obj_union_pw_qpf_print(
254 __isl_take isl_printer *p, void *v)
256 return isl_printer_print_union_pw_qpolynomial_fold(p,
257 (struct isl_union_pw_qpolynomial_fold *)v);
260 static void *isl_obj_union_pw_qpf_add(void *v1, void *v2)
262 return isl_union_pw_qpolynomial_fold_add(
263 (struct isl_union_pw_qpolynomial_fold *)v1,
264 (struct isl_union_pw_qpolynomial_fold *)v2);
267 struct isl_obj_vtable isl_obj_union_pw_qpolynomial_fold_vtable = {
268 isl_obj_union_pw_qpf_copy,
269 isl_obj_union_pw_qpf_add,
270 isl_obj_union_pw_qpf_print,
271 isl_obj_union_pw_qpf_free