Polly 20.0.0git
list.h
Go to the documentation of this file.
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_type.h>
15
16#if defined(__cplusplus)
17extern "C" {
18#endif
19
20#define ISL_DECLARE_LIST_TYPE2(EL,EXPORT) \
21struct isl_##EL; \
22struct EXPORT isl_##EL##_list; \
23typedef 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) \
29isl_ctx *isl_##EL##_list_get_ctx(__isl_keep isl_##EL##_list *list); \
30EXPORT \
31__isl_give isl_##EL##_list *isl_##EL##_to_list(__isl_take isl_##EL *el);\
32CONSTRUCTOR \
33__isl_give isl_##EL##_list *isl_##EL##_list_from_##EL( \
34 __isl_take isl_##EL *el); \
35CONSTRUCTOR \
36__isl_give isl_##EL##_list *isl_##EL##_list_alloc(isl_ctx *ctx, int n); \
37__isl_give isl_##EL##_list *isl_##EL##_list_copy( \
38 __isl_keep isl_##EL##_list *list); \
39__isl_null isl_##EL##_list *isl_##EL##_list_free( \
40 __isl_take isl_##EL##_list *list); \
41EXPORT \
42__isl_give isl_##EL##_list *isl_##EL##_list_add( \
43 __isl_take isl_##EL##_list *list, \
44 __isl_take isl_##EL *el); \
45EXPORT \
46__isl_give isl_##EL##_list *isl_##EL##_list_insert( \
47 __isl_take isl_##EL##_list *list, unsigned pos, \
48 __isl_take isl_##EL *el); \
49EXPORT \
50__isl_give isl_##EL##_list *isl_##EL##_list_drop( \
51 __isl_take isl_##EL##_list *list, unsigned first, unsigned n); \
52EXPORT \
53__isl_give isl_##EL##_list *isl_##EL##_list_clear( \
54 __isl_take isl_##EL##_list *list); \
55__isl_give isl_##EL##_list *isl_##EL##_list_swap( \
56 __isl_take isl_##EL##_list *list, unsigned pos1, \
57 unsigned pos2); \
58__isl_give isl_##EL##_list *isl_##EL##_list_reverse( \
59 __isl_take isl_##EL##_list *list); \
60EXPORT \
61__isl_give isl_##EL##_list *isl_##EL##_list_concat( \
62 __isl_take isl_##EL##_list *list1, \
63 __isl_take isl_##EL##_list *list2); \
64EXPORT \
65isl_size isl_##EL##_list_size(__isl_keep isl_##EL##_list *list); \
66isl_size isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list); \
67EXPORT \
68__isl_give isl_##EL *isl_##EL##_list_get_at( \
69 __isl_keep isl_##EL##_list *list, int index); \
70__isl_give struct isl_##EL *isl_##EL##_list_get_##EL( \
71 __isl_keep isl_##EL##_list *list, int index); \
72EXPORT \
73__isl_give isl_##EL##_list *isl_##EL##_list_set_at( \
74 __isl_take isl_##EL##_list *list, int index, \
75 __isl_take isl_##EL *el); \
76__isl_give struct isl_##EL##_list *isl_##EL##_list_set_##EL( \
77 __isl_take struct isl_##EL##_list *list, int index, \
78 __isl_take struct isl_##EL *el); \
79EXPORT \
80isl_stat isl_##EL##_list_foreach(__isl_keep isl_##EL##_list *list, \
81 isl_stat (*fn)(__isl_take isl_##EL *el, void *user), \
82 void *user); \
83isl_bool isl_##EL##_list_every(__isl_keep isl_##EL##_list *list, \
84 isl_bool (*test)(__isl_keep isl_##EL *el, void *user), \
85 void *user); \
86__isl_give isl_##EL##_list *isl_##EL##_list_map( \
87 __isl_take isl_##EL##_list *list, \
88 __isl_give isl_##EL * (*fn)(__isl_take isl_##EL *el, \
89 void *user), \
90 void *user); \
91__isl_give isl_##EL##_list *isl_##EL##_list_sort( \
92 __isl_take isl_##EL##_list *list, \
93 int (*cmp)(__isl_keep struct isl_##EL *a, \
94 __isl_keep struct isl_##EL *b, \
95 void *user), void *user); \
96EXPORT \
97isl_stat isl_##EL##_list_foreach_scc(__isl_keep isl_##EL##_list *list, \
98 isl_bool (*follows)(__isl_keep isl_##EL *a, \
99 __isl_keep isl_##EL *b, void *user), \
100 void *follows_user, \
101 isl_stat (*fn)(__isl_take isl_##EL##_list *scc, void *user), \
102 void *fn_user); \
103__isl_give char *isl_##EL##_list_to_str( \
104 __isl_keep isl_##EL##_list *list); \
105__isl_give isl_printer *isl_printer_print_##EL##_list( \
106 __isl_take isl_printer *p, __isl_keep isl_##EL##_list *list); \
107void isl_##EL##_list_dump(__isl_keep isl_##EL##_list *list);
108#define ISL_DECLARE_LIST_FN(EL) \
109 ISL_DECLARE_LIST_FN3(EL,,)
110#define ISL_DECLARE_EXPORTED_LIST_FN(EL) \
111 ISL_DECLARE_LIST_FN3(EL,__isl_constructor,__isl_export)
112#define ISL_DECLARE_LIST_FN_READ2(EL,CONSTRUCTOR) \
113CONSTRUCTOR \
114__isl_give isl_##EL##_list *isl_##EL##_list_read_from_str( \
115 isl_ctx *ctx, const char *str);
116#define ISL_DECLARE_LIST_FN_READ(EL) \
117 ISL_DECLARE_LIST_FN_READ2(EL,)
118#define ISL_DECLARE_EXPORTED_LIST_FN_READ(EL) \
119 ISL_DECLARE_LIST_FN_READ2(EL,__isl_constructor)
120
121#define ISL_DECLARE_LIST(EL) \
122 ISL_DECLARE_LIST_TYPE(EL) \
123 ISL_DECLARE_LIST_FN(EL)
124#define ISL_DECLARE_EXPORTED_LIST(EL) \
125 ISL_DECLARE_EXPORTED_LIST_TYPE(EL) \
126 ISL_DECLARE_EXPORTED_LIST_FN(EL)
127
128#if defined(__cplusplus)
129}
130#endif
131
132#endif