forked from enlightenment/efl
eo2: EO2_OP_FUNC_OVERRIDE copy doc from overriden func
This commit is contained in:
parent
2edd305507
commit
1d9d0cee9c
|
@ -630,7 +630,7 @@ typedef struct _Eo2_Op_Call_Data
|
||||||
// cache OP id, get real fct and object data then do the call
|
// cache OP id, get real fct and object data then do the call
|
||||||
#define _EO2_FUNC_COMMON(Name, Ret, Func, DefRet) \
|
#define _EO2_FUNC_COMMON(Name, Ret, Func, DefRet) \
|
||||||
static Eo_Op op = EO_NOOP; \
|
static Eo_Op op = EO_NOOP; \
|
||||||
if ( op == EO_NOOP ) op = eo2_get_op_id((void*)Name, NULL); \
|
if ( op == EO_NOOP ) op = eo2_api_op_id_get((void*)Name, NULL); \
|
||||||
Eo2_Op_Call_Data call; \
|
Eo2_Op_Call_Data call; \
|
||||||
if (!eo2_call_resolve(op, &call)) return DefRet; \
|
if (!eo2_call_resolve(op, &call)) return DefRet; \
|
||||||
__##Name##_func _func_ = (__##Name##_func) call.func; \
|
__##Name##_func _func_ = (__##Name##_func) call.func; \
|
||||||
|
@ -662,11 +662,11 @@ typedef struct _Eo2_Op_Call_Data
|
||||||
|
|
||||||
#define EO2_OP_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_REGULAR, _doc}
|
#define EO2_OP_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_REGULAR, _doc}
|
||||||
#define EO2_OP_CLASS_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_CLASS, _doc}
|
#define EO2_OP_CLASS_FUNC(_private, _api, _doc) {_private, _api, EO_NOOP, EO_OP_TYPE_CLASS, _doc}
|
||||||
#define EO2_OP_FUNC_OVERRIDE(_private, _api, _doc) {_private, _api, EO2_OP_OVERRIDE, EO_OP_TYPE_REGULAR, _doc}
|
#define EO2_OP_FUNC_OVERRIDE(_private, _api) {_private, _api, EO2_OP_OVERRIDE, EO_OP_TYPE_REGULAR, NULL}
|
||||||
#define EO2_OP_SENTINEL { NULL, NULL, 0, EO_OP_TYPE_INVALID, NULL}
|
#define EO2_OP_SENTINEL { NULL, NULL, 0, EO_OP_TYPE_INVALID, NULL}
|
||||||
|
|
||||||
// returns the OP id corresponding to the given api_func
|
// returns the OP id corresponding to the given api_func
|
||||||
EAPI Eo_Op eo2_get_op_id(void *api_func, const Eo_Class *klass);
|
EAPI Eo_Op eo2_api_op_id_get(void *api_func, const Eo_Class *klass);
|
||||||
|
|
||||||
// gets the real function pointer and the object data
|
// gets the real function pointer and the object data
|
||||||
#define eo2_call_resolve(op, call) eo2_call_resolve_internal(NULL, op, call)
|
#define eo2_call_resolve(op, call) eo2_call_resolve_internal(NULL, op, call)
|
||||||
|
|
|
@ -410,8 +410,8 @@ eo2_call_resolve_internal(const Eo_Class *klass_id, Eo_Op op, Eo2_Op_Call_Data *
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EAPI Eo_Op
|
static inline const Eo2_Op_Description *
|
||||||
eo2_get_op_id(void *api_func, const Eo_Class *klass_id)
|
_eo2_api_desc_get(void *api_func, const Eo_Class *klass_id)
|
||||||
{
|
{
|
||||||
int imin, imax, imid;
|
int imin, imax, imid;
|
||||||
Eo2_Op_Description *op_desc;
|
Eo2_Op_Description *op_desc;
|
||||||
|
@ -437,10 +437,22 @@ eo2_get_op_id(void *api_func, const Eo_Class *klass_id)
|
||||||
else if (op_desc->api_func < api_func)
|
else if (op_desc->api_func < api_func)
|
||||||
imax = imid - 1;
|
imax = imid - 1;
|
||||||
else
|
else
|
||||||
return op_desc->op;
|
return op_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EO_NOOP;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eo_Op
|
||||||
|
eo2_api_op_id_get(void *api_func, const Eo_Class *klass_id)
|
||||||
|
{
|
||||||
|
const Eo2_Op_Description *desc;
|
||||||
|
|
||||||
|
desc = _eo2_api_desc_get(api_func, klass_id);
|
||||||
|
if (desc == NULL)
|
||||||
|
return EO_NOOP;
|
||||||
|
|
||||||
|
return desc->op;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -459,6 +471,7 @@ eo2_class_funcs_set(Eo_Class *klass_id)
|
||||||
{
|
{
|
||||||
int op_id;
|
int op_id;
|
||||||
_Eo_Class *klass;
|
_Eo_Class *klass;
|
||||||
|
const Eo2_Op_Description *api_desc;
|
||||||
Eo2_Op_Description *op_desc;
|
Eo2_Op_Description *op_desc;
|
||||||
Eo2_Op_Description *op_descs;
|
Eo2_Op_Description *op_descs;
|
||||||
|
|
||||||
|
@ -486,7 +499,14 @@ eo2_class_funcs_set(Eo_Class *klass_id)
|
||||||
ERR("Can't inherit from a NULL parent. Class '%s', Func index: %lu",
|
ERR("Can't inherit from a NULL parent. Class '%s', Func index: %lu",
|
||||||
klass->desc->name, (unsigned long) (op_desc - op_descs));
|
klass->desc->name, (unsigned long) (op_desc - op_descs));
|
||||||
|
|
||||||
op_desc->op = eo2_get_op_id(op_desc->api_func, _eo_class_id_get(klass->parent));
|
api_desc = _eo2_api_desc_get(op_desc->api_func, _eo_class_id_get(klass->parent));
|
||||||
|
|
||||||
|
if (api_desc == NULL)
|
||||||
|
ERR("Can't find api func %p description in '%s' parent class. Class '%s', Func index: %lu",
|
||||||
|
op_desc->api_func, klass->parent->desc->name, klass->desc->name, (unsigned long) (op_desc - op_descs));
|
||||||
|
|
||||||
|
op_desc->op = api_desc->op;
|
||||||
|
op_desc->doc = api_desc->doc;
|
||||||
|
|
||||||
if (op_desc->op == EO_NOOP)
|
if (op_desc->op == EO_NOOP)
|
||||||
ERR("API func %p, not found in direct parent '%s'. Class '%s', Func index: %lu",
|
ERR("API func %p, not found in direct parent '%s'. Class '%s', Func index: %lu",
|
||||||
|
|
Loading…
Reference in New Issue