iterable.h

Tue, 01 Mar 2005 22:57:57 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 01 Mar 2005 22:57:57 +0100
changeset 95
6737fe676e48
parent 94
f48ffd2f2224
permissions
-rw-r--r--

Use install-sh.

94
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1 /*
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 * libtu/iterable.h
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3 *
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4 * Copyright (c) Tuomo Valkonen 2005.
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5 *
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6 * You may distribute and modify this library under the terms of either
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8 */
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 #ifndef LIBTU_ITERABLE_H
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 #define LIBTU_ITERABLE_H
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
13 #include "types.h"
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
14 #include "obj.h"
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
15
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16 typedef void *VoidIterator(void *);
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
17 typedef Obj *ObjIterator(void *);
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
18
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
19 typedef bool BoolFilter(void *p, void *param);
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
20
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
21 #define FOR_ALL_ITER(INIT, ITER, VAR, LL, TMP) \
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
22 for(INIT(TMP, LL), (VAR)=ITER(TMP); (VAR)!=NULL; VAR=ITER(TMP))
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
23
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
24 extern void *iterable_nth(uint n, VoidIterator *iter, void *st);
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
25 extern bool iterable_is_on(void *p, VoidIterator *iter, void *st);
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
26 extern void *iterable_find(BoolFilter *f, void *fparam,
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
27 VoidIterator *iter, void *st);
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
28
f48ffd2f2224 Added routinesn for generic iterables.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
29 #endif /* LIBTU_ITERABLE_H */

mercurial