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) 17 extern "C" { 18 #endif 19 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 EXPORT \ 44 __isl_give isl_##EL##_list *isl_##EL##_list_insert( \ 45 __isl_take isl_##EL##_list *list, unsigned pos, \ 46 __isl_take isl_##EL *el); \ 47 EXPORT \ 48 __isl_give isl_##EL##_list *isl_##EL##_list_drop( \ 49 __isl_take isl_##EL##_list *list, unsigned first, unsigned n); \ 50 EXPORT \ 51 __isl_give isl_##EL##_list *isl_##EL##_list_clear( \ 52 __isl_take isl_##EL##_list *list); \ 53 __isl_give isl_##EL##_list *isl_##EL##_list_swap( \ 54 __isl_take isl_##EL##_list *list, unsigned pos1, \ 55 unsigned pos2); \ 56 __isl_give isl_##EL##_list *isl_##EL##_list_reverse( \ 57 __isl_take isl_##EL##_list *list); \ 58 EXPORT \ 59 __isl_give isl_##EL##_list *isl_##EL##_list_concat( \ 60 __isl_take isl_##EL##_list *list1, \ 61 __isl_take isl_##EL##_list *list2); \ 62 EXPORT \ 63 isl_size isl_##EL##_list_size(__isl_keep isl_##EL##_list *list); \ 64 isl_size isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list); \ 65 EXPORT \ 66 __isl_give isl_##EL *isl_##EL##_list_get_at( \ 67 __isl_keep isl_##EL##_list *list, int index); \ 68 __isl_give struct isl_##EL *isl_##EL##_list_get_##EL( \ 69 __isl_keep isl_##EL##_list *list, int index); \ 70 __isl_give struct isl_##EL##_list *isl_##EL##_list_set_##EL( \ 71 __isl_take struct isl_##EL##_list *list, int index, \ 72 __isl_take struct isl_##EL *el); \ 73 EXPORT \ 74 isl_stat isl_##EL##_list_foreach(__isl_keep isl_##EL##_list *list, \ 75 isl_stat (*fn)(__isl_take isl_##EL *el, void *user), \ 76 void *user); \ 77 isl_bool isl_##EL##_list_every(__isl_keep isl_##EL##_list *list, \ 78 isl_bool (*test)(__isl_keep isl_##EL *el, void *user), \ 79 void *user); \ 80 __isl_give isl_##EL##_list *isl_##EL##_list_map( \ 81 __isl_take isl_##EL##_list *list, \ 82 __isl_give isl_##EL * (*fn)(__isl_take isl_##EL *el, \ 83 void *user), \ 84 void *user); \ 85 __isl_give isl_##EL##_list *isl_##EL##_list_sort( \ 86 __isl_take isl_##EL##_list *list, \ 87 int (*cmp)(__isl_keep struct isl_##EL *a, \ 88 __isl_keep struct isl_##EL *b, \ 89 void *user), void *user); \ 90 isl_stat isl_##EL##_list_foreach_scc(__isl_keep isl_##EL##_list *list, \ 91 isl_bool (*follows)(__isl_keep struct isl_##EL *a, \ 92 __isl_keep struct isl_##EL *b, void *user), \ 93 void *follows_user, \ 94 isl_stat (*fn)(__isl_take isl_##EL##_list *scc, void *user), \ 95 void *fn_user); \ 96 __isl_give char *isl_##EL##_list_to_str( \ 97 __isl_keep isl_##EL##_list *list); \ 98 __isl_give isl_printer *isl_printer_print_##EL##_list( \ 99 __isl_take isl_printer *p, __isl_keep isl_##EL##_list *list); \ 100 void isl_##EL##_list_dump(__isl_keep isl_##EL##_list *list); 101 #define ISL_DECLARE_LIST_FN(EL) \ 102 ISL_DECLARE_LIST_FN3(EL,,) 103 #define ISL_DECLARE_EXPORTED_LIST_FN(EL) \ 104 ISL_DECLARE_LIST_FN3(EL,__isl_constructor,__isl_export) 105 106 #define ISL_DECLARE_LIST(EL) \ 107 ISL_DECLARE_LIST_TYPE(EL) \ 108 ISL_DECLARE_LIST_FN(EL) 109 #define ISL_DECLARE_EXPORTED_LIST(EL) \ 110 ISL_DECLARE_EXPORTED_LIST_TYPE(EL) \ 111 ISL_DECLARE_EXPORTED_LIST_FN(EL) 112 113 #if defined(__cplusplus) 114 } 115 #endif 116 117 #endif 118