struct {
Eo_Op *base_op_id;
const Eo_Op_Description *descs;
+ Eo2_Op_Description *descs2; /**< EO2 */
size_t count;
} ops; /**< The ops description, should be filled using #EO_CLASS_DESCRIPTION_OPS */
const Eo_Event_Description **events; /**< The event descriptions for this class. */
size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */
void (*class_constructor)(Eo_Class *klass); /**< The constructor of the class. */
void (*class_destructor)(Eo_Class *klass); /**< The destructor of the class. */
- Eo2_Op_Description *op_descs; /**< should replace ops.descs */
};
/**
* @param op_descs the op descriptions array.
* @param count the number of ops in the op descriptions array.
*/
-#define EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count }
+#define EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, NULL, count }
/**
* @def EO_OP_DESCRIPTION(op, doc)
/************************************ EO2 ************************************/
+// computes size of Eo2_Op_Description[]
+#define OP_DESC_SIZE(desc) (sizeof(desc)/sizeof(Eo2_Op_Description) -1 )
+
+// An helper macro to help populating #Eo_Class_Description.
+#define EO2_CLASS_DESCRIPTION_OPS(op_descs, count) { NULL, NULL, op_descs, count }
+
// sort Eo2_Op_Description[] by eapi_func then attribute OP ids
EAPI void
eo2_class_funcs_set(Eo_Class *klass_id);
imin = 0;
imax = obj->klass->desc->ops.count - 1;
- op_descs = obj->klass->desc->op_descs;
+ op_descs = obj->klass->desc->ops.descs2;
while (imax >= imin)
{
EAPI void
eo2_class_funcs_set(Eo_Class *klass_id)
{
- int i, base_op_id, n;
+ int op_id, n;
_Eo_Class *klass;
Eo2_Op_Description *op_desc;
+ Eo2_Op_Description *op_descs;
klass = _eo_class_pointer_get(klass_id);
EO_MAGIC_RETURN(klass, EO_CLASS_EINA_MAGIC);
+ op_descs = klass->desc->ops.descs2;
- base_op_id = *klass->desc->ops.base_op_id;
// klass->desc->ops.count only counts class OP, not _constructor or _destructor
- for (op_desc = klass->desc->op_descs; op_desc->op_type != EO_OP_TYPE_INVALID; op_desc++);
- n = op_desc - klass->desc->op_descs;
+ for (op_desc = op_descs; op_desc->op_type != EO_OP_TYPE_INVALID; op_desc++);
+ n = op_desc - op_descs;
- qsort((void*)klass->desc->op_descs, n, sizeof(Eo2_Op_Description), eo2_api_funcs_cmp);
+ qsort((void*)op_descs, n, sizeof(Eo2_Op_Description), eo2_api_funcs_cmp);
- i = 0;
- for (op_desc = klass->desc->op_descs; op_desc->op_type != EO_OP_TYPE_INVALID; op_desc++)
+ op_id = klass->base_id;
+ for (op_desc = op_descs; op_desc->op_type != EO_OP_TYPE_INVALID; op_desc++)
{
if (op_desc->op == EO_NOOP)
{
if(op_desc->api_func == NULL)
ERR("Setting implementation for NULL EAPI for class '%s'. Func index: %lu",
- klass->desc->name, (unsigned long) (op_desc - klass->desc->op_descs));
+ klass->desc->name, (unsigned long) (op_desc - op_descs));
- op_desc->op = base_op_id + i;
- i++;
+ op_desc->op = op_id;
+ op_id++;
}
/* printf("%d %p %p\n", op_desc->op, op_desc->api_func, op_desc->func); */
// no need to check func->op_type != op_desc->op_type
DBG("Started building class '%s'", desc->name);
- if (!_eo_class_check_op_descs(desc))
- return NULL;
+ if (desc->version == 1)
+ {
+ if (!_eo_class_check_op_descs(desc))
+ return NULL;
+ }
+ else {
+ // FIXME: jeyzu
+ /* if (!_eo2_class_check_op_descs(desc)) */
+ /* return NULL; */
+ }
_Eo_Class *parent = _eo_class_pointer_get(parent_id);
#ifndef HAVE_EO_ID