objlist.h

Thu, 24 Feb 2005 09:12:21 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Thu, 24 Feb 2005 09:12:21 +0100
changeset 88
308dfa54da3e
parent 62
aae5facf9fc5
child 91
817f90f58aec
permissions
-rw-r--r--

Symlist improvements.

60
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
1 /*
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
2 * libtu/objlist.h
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
3 *
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2004.
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
5 *
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
6 * You may distribute and modify this library under the terms of either
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
8 */
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
9
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
10 #ifndef LIBTU_OBJLIST_H
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
11 #define LIBTU_OBJLIST_H
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
12
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
13 #include "types.h"
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
14 #include "obj.h"
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
15
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
16
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
17 INTRSTRUCT(ObjList);
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
18
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
19
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
20 DECLSTRUCT(ObjList){
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 60
diff changeset
21 Watch watch; /* Must be kept at head of structure */
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 60
diff changeset
22 ObjList *next, *prev;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 60
diff changeset
23 ObjList **list;
60
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
24 };
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
25
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
26
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
27 #define FOR_ALL_ON_OBJLIST(TYPE, VAR, LIST) \
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 60
diff changeset
28 for((VAR)=(TYPE)objlist_init_iter(LIST); \
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 60
diff changeset
29 (VAR)!=NULL; \
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 60
diff changeset
30 (VAR)=(TYPE)objlist_iter())
60
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
31
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
32
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
33 bool objlist_insert(ObjList **objlist, Obj *obj);
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
34 void objlist_remove(ObjList **objlist, Obj *obj);
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
35 void objlist_clear(ObjList **objlist);
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
36 Obj *objlist_init_iter(ObjList *objlist);
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
37 Obj *objlist_iter();
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
38
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
39 #endif /* LIBTU_OBJLIST_H */

mercurial