3e953af053f962e24daf50ea101b7974d755b823
[platform/upstream/isl.git] / include / isl / list.h
1 /*
2  * Copyright 2008-2009 Katholieke Universiteit Leuven
3  *
4  * Use of this software is governed by the MIT license
5  *
6  * Written by Sven Verdoolaege, K.U.Leuven, Departement
7  * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8  */
9
10 #ifndef ISL_LIST_H
11 #define ISL_LIST_H
12
13 #include <isl/ctx.h>
14 #include <isl/printer.h>
15
16 #if defined(__cplusplus)
17 extern "C" {
18 #endif
19
20 #define ISL_DECLARE_LIST(EL)                                            \
21 struct isl_##EL;                                                        \
22 struct isl_##EL##_list;                                                 \
23 typedef struct isl_##EL##_list isl_##EL##_list;                         \
24 isl_ctx *isl_##EL##_list_get_ctx(__isl_keep isl_##EL##_list *list);     \
25 __isl_give isl_##EL##_list *isl_##EL##_list_from_##EL(                  \
26         __isl_take struct isl_##EL *el);                                \
27 __isl_give isl_##EL##_list *isl_##EL##_list_alloc(isl_ctx *ctx, int n); \
28 __isl_give isl_##EL##_list *isl_##EL##_list_copy(                       \
29         __isl_keep isl_##EL##_list *list);                              \
30 void *isl_##EL##_list_free(__isl_take isl_##EL##_list *list);           \
31 __isl_give isl_##EL##_list *isl_##EL##_list_add(                        \
32         __isl_take isl_##EL##_list *list,                               \
33         __isl_take struct isl_##EL *el);                                \
34 __isl_give isl_##EL##_list *isl_##EL##_list_insert(                     \
35         __isl_take isl_##EL##_list *list, unsigned pos,                 \
36         __isl_take struct isl_##EL *el);                                \
37 __isl_give isl_##EL##_list *isl_##EL##_list_drop(                       \
38         __isl_take isl_##EL##_list *list, unsigned first, unsigned n);  \
39 __isl_give isl_##EL##_list *isl_##EL##_list_concat(                     \
40         __isl_take isl_##EL##_list *list1,                              \
41         __isl_take isl_##EL##_list *list2);                             \
42 int isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list);           \
43 __isl_give struct isl_##EL *isl_##EL##_list_get_##EL(                   \
44         __isl_keep isl_##EL##_list *list, int index);                   \
45 __isl_give struct isl_##EL##_list *isl_##EL##_list_set_##EL(            \
46         __isl_take struct isl_##EL##_list *list, int index,             \
47         __isl_take struct isl_##EL *el);                                \
48 int isl_##EL##_list_foreach(__isl_keep isl_##EL##_list *list,           \
49         int (*fn)(__isl_take struct isl_##EL *el, void *user),          \
50         void *user);                                                    \
51 __isl_give isl_##EL##_list *isl_##EL##_list_sort(                       \
52         __isl_take isl_##EL##_list *list,                               \
53         int (*cmp)(__isl_keep struct isl_##EL *a,                       \
54                 __isl_keep struct isl_##EL *b,                          \
55                 void *user), void *user);                               \
56 int isl_##EL##_list_foreach_scc(__isl_keep isl_##EL##_list *list,       \
57         int (*follows)(__isl_keep struct isl_##EL *a,                   \
58                         __isl_keep struct isl_##EL *b, void *user),     \
59         void *follows_user,                                             \
60         int (*fn)(__isl_take isl_##EL##_list *scc, void *user),         \
61         void *fn_user);                                                 \
62 __isl_give isl_printer *isl_printer_print_##EL##_list(                  \
63         __isl_take isl_printer *p, __isl_keep isl_##EL##_list *list);   \
64 void isl_##EL##_list_dump(__isl_keep isl_##EL##_list *list);
65
66 ISL_DECLARE_LIST(id)
67 ISL_DECLARE_LIST(constraint)
68 ISL_DECLARE_LIST(basic_set)
69 ISL_DECLARE_LIST(set)
70 ISL_DECLARE_LIST(aff)
71 ISL_DECLARE_LIST(pw_aff)
72 ISL_DECLARE_LIST(band)
73
74 #if defined(__cplusplus)
75 }
76 #endif
77
78 #endif