eo2: Eo2 first commit.

This commit is contained in:
Tom Hacohen 2013-07-08 16:31:36 +01:00
parent 87776ff0fa
commit 35856fdd13
2 changed files with 79 additions and 0 deletions

View File

@ -592,6 +592,50 @@ EAPI Eina_Bool eo_init(void);
*/
EAPI Eina_Bool eo_shutdown(void);
typedef struct _Eo_Internal _Eo;
/* XXX: Essential, because we need to adjust objid for comp objects. */
#define EO_FUNC(Name, Ret, Id, Func, DefRet, ...) \
Ret \
Name(_Eo *obj, Eo *objid, __VA_ARGS__) \
{ \
Ret (*func)(Eo *, __VA_ARGS__) = eo2_func_get(obj, Id(Name)); \
if (func) \
{ \
return Func; \
} \
else \
{ \
return DefRet; \
} \
}
EAPI _Eo * eo2_do_start(Eo *obj_id);
#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);
/* FIXME: Don't use this unref, use an internal one. Reduce id resolution. */
#define eo2_do_end(obj) eo_unref(obj)
#define eo_o _obj_, _objid_
#define eo2_do(objid, ...) \
do \
{ \
Eo *_objid_ = obj; \
_Eo *_obj_ = eo2_do_start(obj); \
do { __VA_ARGS__ ; } while (0); \
eo2_do_end(obj); \
} while (0)
#define eo2_class_do(clsid, ...) \
do \
{ \
do { __VA_ARGS__ ; } while (0); \
} while (0)
/**
* @def eo_do
* A convenience wrapper around eo_do_internal()

View File

@ -255,6 +255,41 @@ _eo_kls_itr_func_get(const _Eo_Class *cur_klass, Eo_Op op)
return NULL;
}
EAPI _Eo *
eo2_do_start(Eo *obj_id)
{
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
_eo_ref(obj);
return obj;
}
static void *
_eo2_func_get(const _Eo_Class *cur_klass, Eo_Op op)
{
{
const op_type_funcs *func = _eo_kls_itr_func_get(cur_klass, op);
if (EINA_LIKELY(func != NULL))
{
return func->func;
}
}
/* 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);
}
#define _EO_OP_ERR_NO_OP_PRINT(file, line, op, klass) \
do \
{ \