EAPI Eo_Op eo2_api_op_id_get(const void *api_func, const Eo_Op_Type);
// gets the real function pointer and the object data
-#define eo2_call_resolve(op, call) eo2_call_resolve_internal(NULL, op, call)
-EAPI Eina_Bool eo2_call_resolve_internal(const Eo_Class *klass, const Eo_Op op, Eo2_Op_Call_Data *call);
+EAPI Eina_Bool eo2_call_resolve(const Eo_Op op, Eo2_Op_Call_Data *call);
// start of eo2_do barrier, gets the object pointer and ref it, put it on the stask
EAPI Eina_Bool eo2_do_start(const Eo *obj, const Eo_Class *cur_klass, const char *file, const char *func, int line);
typedef struct _Eo2_Stack_Frame
{
const Eo *eo_id;
- Eo_Base *base;
+ _Eo_Object *obj;
const _Eo_Class *cur_klass;
void *obj_data;
if (pfptr)
{
- obj = (_Eo_Object *)pfptr->base;
+ obj = pfptr->obj;
memcpy(fptr, pfptr, sizeof(Eo2_Stack_Frame));
}
else
EO_OBJ_POINTER_RETURN_VAL(eo_id, _obj, EINA_FALSE);
obj = _obj;
fptr->eo_id = eo_id;
- fptr->base = (Eo_Base *)_obj;
+ fptr->obj = _obj;
}
if (cur_klass_id)
else
klass = obj->klass;
- if (klass != fptr->cur_klass)
+ if ((!pfptr) || (klass != fptr->cur_klass))
{
fptr->cur_klass = klass;
fptr->obj_data = EO2_INVALID_DATA;
if (pfptr)
{
- klass = (_Eo_Class *)pfptr->base;
+ klass = pfptr->cur_klass;
memcpy(fptr, pfptr, sizeof(Eo2_Stack_Frame));
}
else
EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE);
klass = _klass;
fptr->eo_id = eo_id;
- fptr->base = (Eo_Base *)_klass;
+ fptr->obj = NULL;
+ fptr->obj_data = EO2_INVALID_DATA;
}
if(cur_klass_id)
else
fptr->cur_klass = klass;
- fptr->obj_data = EO2_INVALID_DATA;
-
return EINA_TRUE;
}
}
EAPI void
-eo2_do_end(const Eo **eo_id)
+eo2_do_end(const Eo **eo_id EINA_UNUSED)
{
Eo2_Stack_Frame *fptr;
fptr = eo2_call_stack.frame_ptr;
- if(!_eo_is_a_class(*eo_id))
- _eo_unref((_Eo_Object *)fptr->base);
+ if(fptr->obj)
+ _eo_unref(fptr->obj);
memset(fptr, 0, sizeof (Eo2_Stack_Frame));
fptr->obj_data = EO2_INVALID_DATA;
}
EAPI Eina_Bool
-eo2_call_resolve_internal(const Eo_Class *klass_id, const Eo_Op op, Eo2_Op_Call_Data *call)
+eo2_call_resolve(const Eo_Op op, Eo2_Op_Call_Data *call)
{
Eo2_Stack_Frame *fptr;
const _Eo_Object * obj;
const op_type_funcs *func;
fptr = eo2_call_stack.frame_ptr;
- obj = (_Eo_Object *)fptr->base;
- klass = NULL;
+ obj = fptr->obj;
+ klass = fptr->cur_klass;
- if (klass_id)
- {
- EO_CLASS_POINTER_RETURN_VAL(klass_id, _klass, EINA_FALSE);
- klass = _klass;
- }
- else
+ func = _dich_func_get(klass, op);
+ if (EINA_UNLIKELY(func == NULL))
{
- klass = fptr->cur_klass;
- if (!klass)
- return EINA_FALSE;
+ ERR("you called func %d which is unknown in class '%s'", op, klass->desc->name);
+ return EINA_FALSE;
}
- func = _dich_func_get(klass, op);
- if (EINA_LIKELY(func != NULL))
+ if (EINA_LIKELY(func->func && func->src ))
{
- if (func->func == NULL)
- {
- ERR("you called a pure virtual func");
- return EINA_FALSE;
- }
- call->klass = _eo_class_id_get(klass);
call->obj = (Eo *)fptr->eo_id;
+ call->klass = _eo_class_id_get(klass);
call->func = func->func;
if (obj)
return EINA_TRUE;
}
+ if (func->src != NULL)
+ {
+ ERR("you called a pure virtual func %d", op);
+ return EINA_FALSE;
+ }
+
/* Try composite objects */
/* FIXME!!! */
return EINA_FALSE;
const _Eo_Class *klass;
if (op_type == EO_OP_TYPE_REGULAR)
- klass = ((_Eo_Object *)eo2_call_stack.frame_ptr->base)->klass;
+ klass = eo2_call_stack.frame_ptr->obj->klass;
else if (op_type == EO_OP_TYPE_CLASS)
klass = eo2_call_stack.frame_ptr->cur_klass;
else
return NULL;
}
- if (!((_Eo_Object *)fptr->base)->condtor_done)
+ if (!fptr->obj->condtor_done)
{
ERR("in %s:%d: Object of class '%s' - Not all of the object constructors have been executed.",
file, line, fptr->cur_klass->desc->name);
/* Unref twice, once for the ref in eo2_add_internal_start, and once for the basic object ref. */
- _eo_unref((_Eo_Object *)fptr->base);
- _eo_unref((_Eo_Object *)fptr->base);
+ _eo_unref(fptr->obj);
+ _eo_unref(fptr->obj);
return NULL;
}
- _eo_unref((_Eo_Object *)fptr->base);
+ _eo_unref(fptr->obj);
return (Eo *)eo_id;
}