| 16 |
16 |
| 17 #define OBJ_IS(OBJ, TYPE) obj_is((Obj*)OBJ, &CLASSDESCR(TYPE)) |
17 #define OBJ_IS(OBJ, TYPE) obj_is((Obj*)OBJ, &CLASSDESCR(TYPE)) |
| 18 #define OBJ_CAST(OBJ, TYPE) (TYPE*)obj_cast((Obj*)OBJ, &CLASSDESCR(TYPE)) |
18 #define OBJ_CAST(OBJ, TYPE) (TYPE*)obj_cast((Obj*)OBJ, &CLASSDESCR(TYPE)) |
| 19 |
19 |
| 20 #define INTRSTRUCT(STRU) \ |
20 #define INTRSTRUCT(STRU) \ |
| 21 struct STRU##_struct; typedef struct STRU##_struct STRU |
21 struct STRU##_struct; typedef struct STRU##_struct STRU |
| 22 #define DECLSTRUCT(STRU) \ |
22 #define DECLSTRUCT(STRU) \ |
| 23 struct STRU##_struct |
23 struct STRU##_struct |
| 24 |
24 |
| 25 #define INTRCLASS(OBJ) INTRSTRUCT(OBJ); extern ClassDescr CLASSDESCR(OBJ) |
25 #define INTRCLASS(OBJ) INTRSTRUCT(OBJ); extern ClassDescr CLASSDESCR(OBJ) |
| 26 #define DECLCLASS(OBJ) DECLSTRUCT(OBJ) |
26 #define DECLCLASS(OBJ) DECLSTRUCT(OBJ) |
| 27 |
27 |
| 28 INTRSTRUCT(ClassDescr); |
28 INTRSTRUCT(ClassDescr); |
| 51 typedef void WatchHandler(Watch *watch, Obj *obj); |
51 typedef void WatchHandler(Watch *watch, Obj *obj); |
| 52 |
52 |
| 53 #define WWATCH_INIT {NULL, NULL, NULL, NULL} |
53 #define WWATCH_INIT {NULL, NULL, NULL, NULL} |
| 54 |
54 |
| 55 DECLSTRUCT(Watch){ |
55 DECLSTRUCT(Watch){ |
| 56 Obj *obj; |
56 Obj *obj; |
| 57 Watch *next, *prev; |
57 Watch *next, *prev; |
| 58 WatchHandler *handler; |
58 WatchHandler *handler; |
| 59 }; |
59 }; |
| 60 |
60 |
| 61 extern bool watch_setup(Watch *watch, Obj *obj, |
61 extern bool watch_setup(Watch *watch, Obj *obj, |
| 62 WatchHandler *handler); |
62 WatchHandler *handler); |
| 63 extern void watch_reset(Watch *watch); |
63 extern void watch_reset(Watch *watch); |
| 64 extern bool watch_ok(Watch *watch); |
64 extern bool watch_ok(Watch *watch); |
| 65 extern void watch_init(Watch *watch); |
65 extern void watch_init(Watch *watch); |
| 66 extern void watch_call(Obj *obj); |
66 extern void watch_call(Obj *obj); |
| 67 |
67 |