2 * Copyright 2014 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
10 #include <isl_multi_macro.h>
12 /* Data structure that specifies how isl_multi_*_un_op should
15 * If "fn_space" is set, then it is applied to the space.
17 * "fn_el" is applied to each base expression.
19 S(MULTI(BASE
),un_op_control
) {
20 __isl_give isl_space
*(*fn_space
)(__isl_take isl_space
*space
);
21 __isl_give EL
*(*fn_el
)(__isl_take EL
*el
);
24 /* Modify "multi" based on "control".
26 static __isl_give
MULTI(BASE
) *FN(MULTI(BASE
),un_op
)(
27 __isl_take
MULTI(BASE
) *multi
, S(MULTI(BASE
),un_op_control
) *control
)
33 n
= FN(MULTI(BASE
),size
)(multi
);
35 return FN(MULTI(BASE
),free
)(multi
);
37 for (i
= 0; i
< n
; ++i
) {
40 el
= FN(MULTI(BASE
),take_at
)(multi
, i
);
41 el
= control
->fn_el(el
);
42 multi
= FN(MULTI(BASE
),restore_at
)(multi
, i
, el
);
45 if (!control
->fn_space
)
48 space
= FN(MULTI(BASE
),take_space
)(multi
);
49 space
= control
->fn_space(space
);
50 multi
= FN(MULTI(BASE
),restore_space
)(multi
, space
);