objlist.h

Mon, 16 Feb 2004 18:04:44 +0100

author
tuomov
date
Mon, 16 Feb 2004 18:04:44 +0100
changeset 60
a4033700e35c
child 62
aae5facf9fc5
permissions
-rw-r--r--

trunk: changeset 1313
Moved Ion object system and other generic code from Ion to libtu.

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){
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
21 Watch watch; /* Must be kept at head of structure */
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
22 ObjList *next, *prev;
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
23 ObjList **list;
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) \
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
28 for((VAR)=(TYPE)objlist_init_iter(LIST); \
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
29 (VAR)!=NULL; \
a4033700e35c trunk: changeset 1313
tuomov
parents:
diff changeset
30 (VAR)=(TYPE)objlist_iter())
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