isl_multi_templ.c: extract out isl_multi_arith_templ.c
[isl.git] / include / isl / list.h
blobe04a1e80b9e790c3a6f579bb39ad938e23a3c307
1 /*
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 */
10 #ifndef ISL_LIST_H
11 #define ISL_LIST_H
13 #include <isl/ctx.h>
14 #include <isl/printer_type.h>
16 #if defined(__cplusplus)
17 extern "C" {
18 #endif
20 #define ISL_DECLARE_LIST_TYPE2(EL,EXPORT) \
21 struct isl_##EL; \
22 struct EXPORT isl_##EL##_list; \
23 typedef struct isl_##EL##_list isl_##EL##_list;
24 #define ISL_DECLARE_LIST_TYPE(EL) \
25 ISL_DECLARE_LIST_TYPE2(EL,)
26 #define ISL_DECLARE_EXPORTED_LIST_TYPE(EL) \
27 ISL_DECLARE_LIST_TYPE2(EL,__isl_export)
28 #define ISL_DECLARE_LIST_FN3(EL,CONSTRUCTOR,EXPORT) \
29 isl_ctx *isl_##EL##_list_get_ctx(__isl_keep isl_##EL##_list *list); \
30 CONSTRUCTOR \
31 __isl_give isl_##EL##_list *isl_##EL##_list_from_##EL( \
32 __isl_take isl_##EL *el); \
33 CONSTRUCTOR \
34 __isl_give isl_##EL##_list *isl_##EL##_list_alloc(isl_ctx *ctx, int n); \
35 __isl_give isl_##EL##_list *isl_##EL##_list_copy( \
36 __isl_keep isl_##EL##_list *list); \
37 __isl_null isl_##EL##_list *isl_##EL##_list_free( \
38 __isl_take isl_##EL##_list *list); \
39 EXPORT \
40 __isl_give isl_##EL##_list *isl_##EL##_list_add( \
41 __isl_take isl_##EL##_list *list, \
42 __isl_take isl_##EL *el); \
43 __isl_give isl_##EL##_list *isl_##EL##_list_insert( \
44 __isl_take isl_##EL##_list *list, unsigned pos, \
45 __isl_take struct isl_##EL *el); \
46 __isl_give isl_##EL##_list *isl_##EL##_list_drop( \
47 __isl_take isl_##EL##_list *list, unsigned first, unsigned n); \
48 __isl_give isl_##EL##_list *isl_##EL##_list_swap( \
49 __isl_take isl_##EL##_list *list, unsigned pos1, \
50 unsigned pos2); \
51 __isl_give isl_##EL##_list *isl_##EL##_list_reverse( \
52 __isl_take isl_##EL##_list *list); \
53 EXPORT \
54 __isl_give isl_##EL##_list *isl_##EL##_list_concat( \
55 __isl_take isl_##EL##_list *list1, \
56 __isl_take isl_##EL##_list *list2); \
57 EXPORT \
58 isl_size isl_##EL##_list_size(__isl_keep isl_##EL##_list *list); \
59 isl_size isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list); \
60 EXPORT \
61 __isl_give isl_##EL *isl_##EL##_list_get_at( \
62 __isl_keep isl_##EL##_list *list, int index); \
63 __isl_give struct isl_##EL *isl_##EL##_list_get_##EL( \
64 __isl_keep isl_##EL##_list *list, int index); \
65 __isl_give struct isl_##EL##_list *isl_##EL##_list_set_##EL( \
66 __isl_take struct isl_##EL##_list *list, int index, \
67 __isl_take struct isl_##EL *el); \
68 EXPORT \
69 isl_stat isl_##EL##_list_foreach(__isl_keep isl_##EL##_list *list, \
70 isl_stat (*fn)(__isl_take isl_##EL *el, void *user), \
71 void *user); \
72 __isl_give isl_##EL##_list *isl_##EL##_list_map( \
73 __isl_take isl_##EL##_list *list, \
74 __isl_give isl_##EL * (*fn)(__isl_take isl_##EL *el, \
75 void *user), \
76 void *user); \
77 __isl_give isl_##EL##_list *isl_##EL##_list_sort( \
78 __isl_take isl_##EL##_list *list, \
79 int (*cmp)(__isl_keep struct isl_##EL *a, \
80 __isl_keep struct isl_##EL *b, \
81 void *user), void *user); \
82 isl_stat isl_##EL##_list_foreach_scc(__isl_keep isl_##EL##_list *list, \
83 isl_bool (*follows)(__isl_keep struct isl_##EL *a, \
84 __isl_keep struct isl_##EL *b, void *user), \
85 void *follows_user, \
86 isl_stat (*fn)(__isl_take isl_##EL##_list *scc, void *user), \
87 void *fn_user); \
88 __isl_give char *isl_##EL##_list_to_str( \
89 __isl_keep isl_##EL##_list *list); \
90 __isl_give isl_printer *isl_printer_print_##EL##_list( \
91 __isl_take isl_printer *p, __isl_keep isl_##EL##_list *list); \
92 void isl_##EL##_list_dump(__isl_keep isl_##EL##_list *list);
93 #define ISL_DECLARE_LIST_FN(EL) \
94 ISL_DECLARE_LIST_FN3(EL,,)
95 #define ISL_DECLARE_EXPORTED_LIST_FN(EL) \
96 ISL_DECLARE_LIST_FN3(EL,__isl_constructor,__isl_export)
98 #define ISL_DECLARE_LIST(EL) \
99 ISL_DECLARE_LIST_TYPE(EL) \
100 ISL_DECLARE_LIST_FN(EL)
101 #define ISL_DECLARE_EXPORTED_LIST(EL) \
102 ISL_DECLARE_EXPORTED_LIST_TYPE(EL) \
103 ISL_DECLARE_EXPORTED_LIST_FN(EL)
105 #if defined(__cplusplus)
107 #endif
109 #endif