typedef struct _Eo_Internal _Eo;
-#define EO_FUNC_CALL() func(objid, obj_data)
-#define EO_FUNC_CALLV(...) func(objid, obj_data, __VA_ARGS__)
+typedef struct _Eo2_Op_Call_Data
+{
+ void *func;
+ void *data;
+} Eo2_Op_Call_Data;
+
+#define EO_FUNC_CALL() func(objid, call.data)
+#define EO_FUNC_CALLV(...) func(objid, call.data, __VA_ARGS__)
/* XXX: Essential, because we need to adjust objid for comp objects. */
#define EO_FUNC_BODY(Name, Ret, Id, Func, DefRet) \
Ret \
Name(_Eo *obj, Eo *objid) \
{ \
- Ret (*func)(Eo *, void *obj_data) = eo2_func_get(obj, Id(Name)); \
- if (!func) return DefRet; \
- void *obj_data = eo2_data_scope_get(obj); \
+ Eo2_Op_Call_Data call; \
+ if (!eo2_call_resolve(obj, Id(Name), &call)) return DefRet; \
+ Ret (*func)(Eo *, void *obj_data) = call.func; \
return Func; \
}
Ret \
Name(_Eo *obj, Eo *objid, __VA_ARGS__) \
{ \
- Ret (*func)(Eo *, void *obj_data, __VA_ARGS__) = eo2_func_get(obj, Id(Name)); \
- if (!func) return DefRet; \
- void *obj_data = eo2_data_scope_get(obj); \
+ Eo2_Op_Call_Data call; \
+ if (!eo2_call_resolve(obj, Id(Name), &call)) return DefRet; \
+ Ret (*func)(Eo *, void *obj_data, __VA_ARGS__) = call.func; \
return Func; \
}
EAPI _Eo * eo2_do_start(Eo *obj_id);
-EAPI void * eo2_data_scope_get(const _Eo *obj);
-#define eo2_func_get(obj_id, op) eo2_func_get_internal(obj_id, NULL, op)
-EAPI void * eo2_func_get_internal(_Eo *obj, const Eo_Class *klass, Eo_Op op);
+#define eo2_call_resolve(obj_id, op, call) eo2_call_resolve_internal(obj_id, NULL, op, call)
+EAPI Eina_Bool eo2_call_resolve_internal(_Eo *obj, const Eo_Class *klass, Eo_Op op, Eo2_Op_Call_Data *call);
/* FIXME: Don't use this unref, use an internal one. Reduce id resolution. */
return obj;
}
-EAPI void *eo2_data_scope_get(const _Eo *obj)
+EAPI Eina_Bool
+eo2_call_resolve_internal(_Eo *obj, const Eo_Class *klass_id, Eo_Op op, Eo2_Op_Call_Data *call)
{
- return _eo_data_scope_get(obj, obj->klass);
-}
+ const _Eo_Class *klass;
+ const op_type_funcs *func;
-static void *
-_eo2_func_get(const _Eo_Class *cur_klass, Eo_Op op)
-{
+ if (klass_id)
+ klass = _eo_class_pointer_get(klass_id);
+ else
+ klass = obj->klass;
+
+ func = _eo_kls_itr_func_get(klass, op);
+ if (EINA_LIKELY(func != NULL))
{
- const op_type_funcs *func = _eo_kls_itr_func_get(cur_klass, op);
- if (EINA_LIKELY(func != NULL))
- {
- return func->func;
- }
+ call->func = func->func;
+ call->data = _eo_data_scope_get(obj, func->src);
+ return EINA_TRUE;
}
/* Try composite objects */
/* FIXME!!! */
- return NULL;
-}
-
-EAPI void *
-eo2_func_get_internal(_Eo *obj, const Eo_Class *klass_id, Eo_Op op)
-{
- const _Eo_Class *klass;
- if (klass_id)
- klass = _eo_class_pointer_get(klass_id);
- else
- klass = obj->klass;
- return _eo2_func_get(klass, op);
+ return EINA_FALSE;
}
#define _EO_OP_ERR_NO_OP_PRINT(file, line, op, klass) \