|
|
|
@ -40,19 +40,28 @@ |
|
|
|
* @TODO: actually i use gcc feature ## for variadoc... think about |
|
|
|
* a way to make this standard. |
|
|
|
*/ |
|
|
|
#define CALL(object,_iface,method,...) \ |
|
|
|
do { \ |
|
|
|
class_ptr class = class_getClass((object)); \ |
|
|
|
struct i_##_iface * iface; \ |
|
|
|
if (class->init) class->init(); \ |
|
|
|
iface = (struct i_##_iface *)class_getInterface(&class, &i_##_iface); \ |
|
|
|
while ((NULL == iface || NULL == iface->method) && HAS_PARENT(class)) { \ |
|
|
|
class = class->parent; \ |
|
|
|
if (class->init) class->init(); \ |
|
|
|
iface = (struct i_##_iface *)class_getInterface(&class, &i_##_iface); \ |
|
|
|
}; \ |
|
|
|
assert(NULL != iface->method); \ |
|
|
|
iface->method(object, ##__VA_ARGS__); \ |
|
|
|
#define _CALL(object,_iface,method,...) \ |
|
|
|
class_ptr class = class_getClass((object)); \ |
|
|
|
struct i_##_iface * iface; \ |
|
|
|
if (class->init) class->init(); \ |
|
|
|
iface = (struct i_##_iface *)class_getInterface(&class, &i_##_iface); \ |
|
|
|
while ((NULL == iface || NULL == iface->method) && HAS_PARENT(class)) { \ |
|
|
|
class = class->parent; \ |
|
|
|
if (class->init) class->init(); \ |
|
|
|
iface = (struct i_##_iface *)class_getInterface(&class, &i_##_iface); \ |
|
|
|
}; \ |
|
|
|
assert(NULL != iface->method); |
|
|
|
|
|
|
|
#define CALL(object,_iface,method,...) \ |
|
|
|
do { \ |
|
|
|
_CALL(object, _iface, method, ##__VA_ARGS__); \ |
|
|
|
iface->method(object, ##__VA_ARGS__); \ |
|
|
|
} while(0) |
|
|
|
|
|
|
|
#define RETCALL(object,_iface,method,ret,...) \ |
|
|
|
do { \ |
|
|
|
_CALL(object, _iface, method, ##__VA_ARGS__); \ |
|
|
|
ret = iface->method(object, ##__VA_ARGS__); \ |
|
|
|
} while(0) |
|
|
|
|
|
|
|
|
|
|
|
|