Merge 'remotes/dkogan/merged_submodules'
[notion.git] / libtu / iterable.h
blob8b70b09d67f836a63fbd302963b57896e5e8cd3a
1 /*
2 * libtu/iterable.h
4 * Copyright (c) Tuomo Valkonen 2005.
6 * You may distribute and modify this library under the terms of either
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
8 */
10 #ifndef LIBTU_ITERABLE_H
11 #define LIBTU_ITERABLE_H
13 #include "types.h"
14 #include "obj.h"
16 typedef void *VoidIterator(void *);
17 typedef Obj *ObjIterator(void *);
19 typedef bool BoolFilter(void *p, void *param);
21 #define FOR_ALL_ITER(INIT, ITER, VAR, LL, TMP) \
22 for(INIT(TMP, LL), (VAR)=ITER(TMP); (VAR)!=NULL; VAR=ITER(TMP))
24 extern void *iterable_nth(uint n, VoidIterator *iter, void *st);
25 extern bool iterable_is_on(void *p, VoidIterator *iter, void *st);
26 extern void *iterable_find(BoolFilter *f, void *fparam,
27 VoidIterator *iter, void *st);
29 #endif /* LIBTU_ITERABLE_H */