objlist.h

changeset 93
5f72042eb91c
parent 92
55fcdff5bcea
child 94
f48ffd2f2224
equal deleted inserted replaced
92:55fcdff5bcea 93:5f72042eb91c
10 #ifndef LIBTU_OBJLIST_H 10 #ifndef LIBTU_OBJLIST_H
11 #define LIBTU_OBJLIST_H 11 #define LIBTU_OBJLIST_H
12 12
13 #include "types.h" 13 #include "types.h"
14 #include "obj.h" 14 #include "obj.h"
15 #include "ptrlist.h"
15 16
16 17
17 INTRSTRUCT(ObjList); 18 INTRSTRUCT(ObjList);
18 19
19 20
29 #define OBJLIST_FIRST(TYPE, LL) ((LL)==NULL ? NULL : (TYPE)(LL)->watch.obj) 30 #define OBJLIST_FIRST(TYPE, LL) ((LL)==NULL ? NULL : (TYPE)(LL)->watch.obj)
30 #define OBJLIST_LAST(TYPE, LL) ((LL)==NULL ? NULL : (TYPE)(LL)->prev->watch.obj) 31 #define OBJLIST_LAST(TYPE, LL) ((LL)==NULL ? NULL : (TYPE)(LL)->prev->watch.obj)
31 #define OBJLIST_EMPTY(LIST) objlist_empty(LIST) 32 #define OBJLIST_EMPTY(LIST) objlist_empty(LIST)
32 33
33 #define FOR_ALL_ON_OBJLIST(TYPE, VAR, LL, TMP) \ 34 #define FOR_ALL_ON_OBJLIST(TYPE, VAR, LL, TMP) \
34 for(objlist_iter_init(&(TMP), LL), \ 35 FOR_ALL_ITER(objlist_iter_init, (TYPE)objlist_iter, VAR, LL, &(TMP))
35 VAR=(TYPE)objlist_iter(&(TMP)); \
36 VAR!=NULL; \
37 VAR=(TYPE)objlist_iter(&(TMP)))
38 36
39 #define FOR_ALL_ON_OBJLIST_REV(TYPE, VAR, LL, TMP) \ 37 #define FOR_ALL_ON_OBJLIST_REV(TYPE, VAR, LL, TMP) \
40 for(objlist_iter_rev_init(&(TMP), LL), \ 38 FOR_ALL_ITER(objlist_iter_rev_init, \
41 VAR=(TYPE)objlist_iter_rev(&(TMP)); \ 39 (TYPE)objlist_iter_rev, VAR, LL, &(TMP))
42 VAR!=NULL; \
43 VAR=(TYPE)objlist_iter_rev(&(TMP)))
44 40
45 #define FOR_ALL_ON_OBJLIST_UNSAFE(TYPE, VAR, LL) \ 41 #define FOR_ALL_ON_OBJLIST_UNSAFE(TYPE, VAR, LL) \
46 FOR_ALL_ON_OBJLIST(TYPE, VAR, LL, objlist_iter_tmp) 42 FOR_ALL_ON_OBJLIST(TYPE, VAR, LL, objlist_iter_tmp)
47 43
48 extern ObjListIterTmp objlist_iter_tmp; 44 extern ObjListIterTmp objlist_iter_tmp;

mercurial