--- a/objp.h Mon Feb 16 18:09:03 2004 +0100 +++ b/objp.h Mon Feb 16 18:50:28 2004 +0100 @@ -18,54 +18,54 @@ INTRSTRUCT(DynFunTab); DECLSTRUCT(DynFunTab){ - DynFun *func, *handler; + DynFun *func, *handler; }; DECLSTRUCT(ClassDescr){ - const char *name; - ClassDescr *ancestor; - int funtab_n; - DynFunTab *funtab; - void (*destroy_fn)(); + const char *name; + ClassDescr *ancestor; + int funtab_n; + DynFunTab *funtab; + void (*destroy_fn)(); }; #define OBJ_TYPESTR(OBJ) (((Obj*)OBJ)->obj_type->name) #define IMPLCLASS(CLS, ANCESTOR, DFN, DYN) \ - ClassDescr CLASSDESCR(CLS)={ \ - #CLS, &CLASSDESCR(ANCESTOR), -1, DYN, (void (*)())DFN} + ClassDescr CLASSDESCR(CLS)={ \ + #CLS, &CLASSDESCR(ANCESTOR), -1, DYN, (void (*)())DFN} #define OBJ_INIT(O, TYPE) {((Obj*)(O))->obj_type=&CLASSDESCR(TYPE); \ - ((Obj*)(O))->obj_watches=NULL; ((Obj*)(O))->flags=0;} + ((Obj*)(O))->obj_watches=NULL; ((Obj*)(O))->flags=0;} #define CREATEOBJ_IMPL(OBJ, LOWOBJ, INIT_ARGS) \ - OBJ *p; p=ALLOC(OBJ); if(p==NULL){ warn_err(); return NULL; } \ - OBJ_INIT(p, OBJ); \ - if(!LOWOBJ ## _init INIT_ARGS) { free((void*)p); return NULL; } return p + OBJ *p; p=ALLOC(OBJ); if(p==NULL){ warn_err(); return NULL; } \ + OBJ_INIT(p, OBJ); \ + if(!LOWOBJ ## _init INIT_ARGS) { free((void*)p); return NULL; } return p #define SIMPLECREATEOBJ_IMPL(OBJ, LOWOBJ) \ - OBJ *p; p=ALLOC(OBJ); if(p==NULL){ warn_err(); return NULL; } \ - OBJ_INIT(p, OBJ); \ - return p; + OBJ *p; p=ALLOC(OBJ); if(p==NULL){ warn_err(); return NULL; } \ + OBJ_INIT(p, OBJ); \ + return p; #define END_DYNFUNTAB {NULL, NULL} extern DynFun *lookup_dynfun(const Obj *obj, DynFun *func, - bool *funnotfound); + bool *funnotfound); extern bool has_dynfun(const Obj *obj, DynFun *func); #define CALL_DYN(FUNC, OBJ, ARGS) \ - bool funnotfound; \ - lookup_dynfun((Obj*)OBJ, (DynFun*)FUNC, &funnotfound) ARGS; + bool funnotfound; \ + lookup_dynfun((Obj*)OBJ, (DynFun*)FUNC, &funnotfound) ARGS; #define CALL_DYN_RET(RETV, RET, FUNC, OBJ, ARGS) \ - typedef RET ThisDynFun(); \ - bool funnotfound; \ - ThisDynFun *funtmp; \ - funtmp=(ThisDynFun*)lookup_dynfun((Obj*)OBJ, (DynFun*)FUNC, \ - &funnotfound); \ - if(!funnotfound) \ - RETV=funtmp ARGS; + typedef RET ThisDynFun(); \ + bool funnotfound; \ + ThisDynFun *funtmp; \ + funtmp=(ThisDynFun*)lookup_dynfun((Obj*)OBJ, (DynFun*)FUNC, \ + &funnotfound); \ + if(!funnotfound) \ + RETV=funtmp ARGS; #define HAS_DYN(OBJ, FUNC) has_dynfun((Obj*)OBJ, (DynFun*)FUNC)