typedef struct
{
- const Eo_Class **kls_itr;
- Eina_Bool insuper_context:1;
+ const Eo_Class *kls;
} Eo_Kls_Itr;
struct _Eo {
static inline void
_eo_kls_itr_init(const Eo_Class *obj_klass, Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state)
{
- if (cur->insuper_context)
- {
- memcpy(prev_state, cur, sizeof(*cur));
- cur->kls_itr = obj_klass->mro;
- }
+ memcpy(prev_state, cur, sizeof(*cur));
+ cur->kls = *obj_klass->mro;
}
static inline void
_eo_kls_itr_end(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state)
{
- if (cur->insuper_context)
- {
- memcpy(cur, prev_state, sizeof(*cur));
- }
+ memcpy(cur, prev_state, sizeof(*cur));
}
static inline const Eo_Class *
_eo_kls_itr_get(Eo_Kls_Itr *cur)
{
- return *(cur->kls_itr);
+ return cur->kls;
+}
+
+static inline void
+_eo_kls_itr_set(Eo_Kls_Itr *cur, const Eo_Class *kls)
+{
+ cur->kls = kls;
}
static inline const Eo_Class *
-_eo_kls_itr_next(Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state, Eo_Op op)
+_eo_kls_itr_next(const Eo_Class *orig_kls, Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_state, Eo_Op op)
{
- const Eo_Class **kls_itr = cur->kls_itr;
+ const Eo_Class **kls_itr = NULL;
memcpy(prev_state, cur, sizeof(*cur));
- cur->insuper_context = EINA_TRUE;
- if (*kls_itr)
- {
- const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op);
- while (*kls_itr && (*(kls_itr++) != fsrc->src))
- ;
+ /* Find the kls itr. */
+ kls_itr = orig_kls->mro;
+ while (*kls_itr && (*kls_itr != cur->kls))
+ kls_itr++;
- cur->kls_itr = kls_itr;
- return *kls_itr;
- }
- else
+ if (*kls_itr)
{
- return NULL;
+ kls_itr++;
+ if (*kls_itr)
+ {
+ const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op);
+ cur->kls = fsrc->src;
+ return cur->kls;
+ }
}
+
+ return NULL;
}
static inline const op_type_funcs *
if (func && func->func)
{
+ _eo_kls_itr_set(mro_itr, func->src);
return func;
}
}
+ _eo_kls_itr_set(mro_itr, NULL);
return NULL;
}
Eo *emb_obj;
EINA_LIST_FOREACH(obj->composite_objects, itr, emb_obj)
{
+ /* FIXME: Clean this up a bit. */
+ Eo_Kls_Itr prev_state;
+ _eo_kls_itr_init(emb_obj->klass, &emb_obj->mro_itr, &prev_state);
if (_eo_op_internal(emb_obj, op_type, op, p_list))
{
+ _eo_kls_itr_end(&emb_obj->mro_itr, &prev_state);
return EINA_TRUE;
}
+ _eo_kls_itr_end(&emb_obj->mro_itr, &prev_state);
}
}
return EINA_FALSE;
EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, EINA_FALSE);
/* Advance the kls itr. */
- nklass = _eo_kls_itr_next(&obj->mro_itr, &prev_state, op);
+ nklass = _eo_kls_itr_next(obj->klass, &obj->mro_itr, &prev_state, op);
va_start(p_list, op);
if (!_eo_op_internal(obj, op_type, op, &p_list))
EO_MAGIC_RETURN_VAL(klass, EO_CLASS_EINA_MAGIC, EINA_FALSE);
/* Advance the kls itr. */
- nklass = _eo_kls_itr_next(&((Eo_Class *) klass)->mro_itr, &prev_state, op);
+ nklass = _eo_kls_itr_next(klass, &((Eo_Class *) klass)->mro_itr, &prev_state, op);
va_start(p_list, op);
if (!_eo_class_op_internal((Eo_Class *) klass, op, &p_list))
}
}
- klass->mro_itr.kls_itr = klass->mro;
-
_eo_class_constructor(klass);
va_end(p_list);
EINA_MAGIC_SET(obj, EO_EINA_MAGIC);
obj->refcount++;
obj->klass = klass;
- obj->mro_itr.kls_itr = obj->klass->mro;
eo_parent_set(obj, parent);