diff --git a/src/bin/elementary/test_ui_box.c b/src/bin/elementary/test_ui_box.c index e12438a3e3..44fedfab4c 100644 --- a/src/bin/elementary/test_ui_box.c +++ b/src/bin/elementary/test_ui_box.c @@ -177,7 +177,7 @@ _custom_layout_update(Eo *pack, const void *data EINA_UNUSED) static void custom_check_cb(void *data, const Efl_Event *event) { - EFL_OBJECT_OVERRIDE_OPS_DEFINE(custom_layout_ops, + EFL_OPS_DEFINE(custom_layout_ops, EFL_OBJECT_OP_FUNC_OVERRIDE(efl_pack_layout_update, _custom_layout_update)); Eina_Bool chk = elm_check_selected_get(event->object); diff --git a/src/bin/elementary/test_ui_grid.c b/src/bin/elementary/test_ui_grid.c index cf92f42267..ba198c1b43 100644 --- a/src/bin/elementary/test_ui_grid.c +++ b/src/bin/elementary/test_ui_grid.c @@ -19,13 +19,19 @@ typedef enum { static void _custom_engine_layout_do(Eo *obj, void *pd, Efl_Pack *pack, const void *data); /* Common Efl Class boilerplate. */ -static const Efl_Op_Description custom_engine_op_desc[] = { - EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(efl_pack_layout_do, _custom_engine_layout_do), -}; +static Eina_Bool +_custom_engine_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(efl_pack_layout_do, _custom_engine_layout_do), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description custom_engine_class_desc = { EO_VERSION, "Custom Layout Engine", EFL_CLASS_TYPE_INTERFACE, - EFL_CLASS_DESCRIPTION_OPS(custom_engine_op_desc), 0, NULL, NULL + 0, _custom_engine_class_initializer, NULL, NULL }; EFL_DEFINE_CLASS(_test_ui_grid_custom_engine_class_get, &custom_engine_class_desc, EFL_PACK_LAYOUT_INTERFACE, NULL) diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c index 3be54c8a0d..35b0593f6a 100644 --- a/src/bin/eolian/eo_generator.c +++ b/src/bin/eolian/eo_generator.c @@ -19,7 +19,14 @@ static Eina_Hash *_funcs_params_init = NULL; static const char tmpl_eo_ops_desc[] = "\ -static const Efl_Op_Description _@#class_op_desc[] = {@#list_op\n};\n\n"; +static Eina_Bool\n\ +_@#class_class_initializer(Efl_Class *klass)\n\ +{\n\ + EFL_OPS_DEFINE(ops,@#list_op\n\ + );\n\ +\n\ + return efl_class_functions_set(klass, &ops);\n\ +}\n\n"; static const char tmpl_eo_src[] = "\ @@ -32,8 +39,8 @@ static const Efl_Class_Description _@#class_class_desc = {\n\ EO_VERSION,\n\ \"@#Class\",\n\ @#type_class,\n\ - @#eo_class_desc_ops,\n\ @#SizeOfData,\n\ + @#init_name,\n\ @#ctor_name,\n\ @#dtor_name\n\ };\n\ @@ -615,7 +622,7 @@ eo_op_desc_generate(const Eolian_Class *class, const Eolian_Function *fid, Eolia Eina_Bool is_virtual_pure = eolian_function_is_virtual_pure(fid, ftype); const char *class_str = ""; if (eolian_function_is_class(fid)) class_str = "CLASS_"; - eina_strbuf_append_printf(buf, "\n EFL_OBJECT_OP_%sFUNC(%s, ", class_str, func_env.lower_eo_func); + eina_strbuf_append_printf(buf, "\n EFL_OBJECT_OP_%sFUNC(%s, ", class_str, func_env.lower_eo_func); if (!is_virtual_pure) { Eolian_Function_Type ftype2 = (Eolian_Function_Type) eina_hash_find(_funcs_params_init, funcname); @@ -815,7 +822,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf) if (ftype != EOLIAN_PROP_GET) { Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, EOLIAN_PROP_SET, EINA_FALSE); - eina_strbuf_append_printf(str_op, "\n EFL_OBJECT_OP_%sFUNC_OVERRIDE(%s, %s_%s_set),", + eina_strbuf_append_printf(str_op, "\n EFL_OBJECT_OP_%sFUNC_OVERRIDE(%s, %s_%s_set),", class_str, rets, implname, funcname); eo_bind_func_generate(class, fnid, EOLIAN_PROP_SET, str_bodyf, impl_desc, &impl_env); eina_stringshare_del(rets); @@ -824,7 +831,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf) if (ftype != EOLIAN_PROP_SET) { Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, EOLIAN_PROP_GET, EINA_FALSE); - eina_strbuf_append_printf(str_op, "\n EFL_OBJECT_OP_%sFUNC_OVERRIDE(%s, %s_%s_get),", + eina_strbuf_append_printf(str_op, "\n EFL_OBJECT_OP_%sFUNC_OVERRIDE(%s, %s_%s_get),", class_str, rets, implname, funcname); eo_bind_func_generate(class, fnid, EOLIAN_PROP_GET, str_bodyf, impl_desc, &impl_env); eina_stringshare_del(rets); @@ -833,7 +840,7 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf) default: { Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, ftype, EINA_FALSE); - eina_strbuf_append_printf(str_op, "\n EFL_OBJECT_OP_%sFUNC_OVERRIDE(%s, %s_%s),", + eina_strbuf_append_printf(str_op, "\n EFL_OBJECT_OP_%sFUNC_OVERRIDE(%s, %s_%s),", class_str, rets, implname, funcname); eo_bind_func_generate(class, fnid, ftype, str_bodyf, impl_desc, &impl_env); eina_stringshare_del(rets); @@ -882,26 +889,27 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf) if (eina_strbuf_length_get(tmpbuf) == 0) eina_strbuf_append(tmpbuf, "NULL, "); eina_strbuf_replace_all(str_end, "@#list_inherit", eina_strbuf_string_get(tmpbuf)); - eina_strbuf_reset(tmpbuf); if (eina_strbuf_length_get(str_op)) { + size_t stroplen = eina_strbuf_length_get(str_op); + if (eina_strbuf_string_get(str_op)[stroplen - 1] == ',') + eina_strbuf_remove(str_op, stroplen - 1, stroplen); Eina_Strbuf *ops_desc = eina_strbuf_new(); _template_fill(ops_desc, tmpl_eo_ops_desc, class, NULL, NULL, EINA_TRUE); eina_strbuf_replace_all(ops_desc, "@#list_op", eina_strbuf_string_get(str_op)); eina_strbuf_replace_all(str_end, "@#ops_desc", eina_strbuf_string_get(ops_desc)); eina_strbuf_free(ops_desc); - _template_fill(tmpbuf, - "EFL_CLASS_DESCRIPTION_OPS(_@#class_op_desc)", - class, NULL, NULL, EINA_TRUE); + eina_strbuf_reset(tmpbuf); + _template_fill(tmpbuf, "_@#class_class_initializer", class, NULL, NULL, EINA_TRUE); + eina_strbuf_replace_all(str_end, "@#init_name", eina_strbuf_string_get(tmpbuf)); } else { eina_strbuf_replace_all(str_end, "@#ops_desc", ""); - eina_strbuf_append_printf(tmpbuf, "EFL_CLASS_DESCRIPTION_NOOPS()"); + eina_strbuf_replace_all(str_end, "@#init_name", "NULL"); } eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf)); - eina_strbuf_replace_all(str_end, "@#eo_class_desc_ops", eina_strbuf_string_get(tmpbuf)); const char *data_type = eolian_class_data_type_get(class); if (data_type && !strcmp(data_type, "null")) diff --git a/src/lib/elementary/efl_ui_grid.c b/src/lib/elementary/efl_ui_grid.c index 5c8db37991..cb72cdff95 100644 --- a/src/lib/elementary/efl_ui_grid.c +++ b/src/lib/elementary/efl_ui_grid.c @@ -165,14 +165,19 @@ _table_size_hints_changed(void *data, Evas *e EINA_UNUSED, /* Custom table class: overrides smart_calculate. */ static void _custom_table_calc(Eo *obj, Custom_Table_Data *pd); -static const Efl_Op_Description custom_table_op_desc[] = { - EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(efl_canvas_group_calculate, _custom_table_calc), +static Eina_Bool +_custom_table_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(efl_canvas_group_calculate, _custom_table_calc) + ); + + return efl_class_functions_set(klass, &ops); }; static const Efl_Class_Description custom_table_class_desc = { EO_VERSION, "Efl.Ui.Grid.Internal", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(custom_table_op_desc), - sizeof(Custom_Table_Data), NULL, NULL + sizeof(Custom_Table_Data), _custom_table_initializer, NULL, NULL }; EFL_DEFINE_CLASS(_efl_ui_grid_custom_table_class_get, &custom_table_class_desc, diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index f241ca80f8..55311278ee 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -410,8 +410,8 @@ struct _Efl_Class_Description unsigned int version; /**< The current version of eo, use #EO_VERSION */ const char *name; /**< The name of the class. */ Efl_Class_Type type; /**< The type of the class. */ - Efl_Object_Ops ops; /**< The ops description, should be filled using #EFL_CLASS_DESCRIPTION_OPS (later sorted by Eo). */ size_t data_size; /**< The size of data (private + protected + public) this class needs per object. */ + Eina_Bool (*class_initializer)(Efl_Class *klass); /**< The initializer for the class */ void (*class_constructor)(Efl_Class *klass); /**< The constructor of the class. */ void (*class_destructor)(Efl_Class *klass); /**< The destructor of the class. */ }; @@ -436,6 +436,18 @@ typedef struct _Efl_Class_Description Efl_Class_Description; */ EAPI const Efl_Class *efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent, ...); +/** + * @brief Set the functions of a class + * @param klass_id the class whose functions we are setting. + * @param ops The function structure we are setting. + * @return True on success, False otherwise. + * + * This should only be called from within the initializer function. + * + * @see #EFL_DEFINE_CLASS + */ +EAPI Eina_Bool efl_class_functions_set(const Efl_Class *klass_id, const Efl_Object_Ops *ops); + /** * @brief Override Eo functions of this object. * @param ops The op description to override with. @@ -466,13 +478,13 @@ EAPI Eina_Bool efl_object_override(Eo *obj, const Efl_Object_Ops *ops); * * This can be used as follows: * @code - * EFL_OBJECT_OVERRIDE_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC_OVERRIDE(public_func, _my_func)); + * EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC_OVERRIDE(public_func, _my_func)); * efl_object_override(obj, &ops); * @endcode * * @see efl_object_override */ -#define EFL_OBJECT_OVERRIDE_OPS_DEFINE(ops, ...) \ +#define EFL_OPS_DEFINE(ops, ...) \ const Efl_Op_Description _##ops##_descs[] = { __VA_ARGS__ }; \ const Efl_Object_Ops ops = { _##ops##_descs, EINA_C_ARRAY_LENGTH(_##ops##_descs) } @@ -515,10 +527,6 @@ EAPI Eina_Bool efl_object_init(void); */ EAPI Eina_Bool efl_object_shutdown(void); -// Helpers macro to help populating #Efl_Class_Description. -#define EFL_CLASS_DESCRIPTION_NOOPS() { NULL, 0} -#define EFL_CLASS_DESCRIPTION_OPS(op_descs) { op_descs, EINA_C_ARRAY_LENGTH(op_descs) } - // to fetch internal function and object data at once typedef struct _Efl_Object_Op_Call_Data { diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 560b9280b6..3f03ab42b2 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -38,6 +38,7 @@ static void _eo_condtor_reset(_Eo_Object *obj); static inline void *_efl_data_scope_get(const _Eo_Object *obj, const _Efl_Class *klass); static inline void *_efl_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Efl_Class *klass, const _Eo_Object *ref_obj); static inline void _efl_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj); +static void _vtable_init(Eo_Vtable *vtable, size_t size); /* Start of Dich */ @@ -175,7 +176,7 @@ _eo_op_class_get(Efl_Object_Op op) { mid = (min + max) / 2; - if (itr[mid]->base_id + itr[mid]->desc->ops.count < op) + if (itr[mid]->base_id + itr[mid]->ops_count < op) min = mid + 1; else if (itr[mid]->base_id > op) max = mid - 1; @@ -548,48 +549,6 @@ _eo_api_func_equal(const void *api_func1, const void *api_func2) #endif } -/* api_func should be the pointer to the function on all platforms except windows, - * in which it should be the the name of the function (string). - */ -static inline const Efl_Op_Description * -_eo_api_desc_get(const void *api_func, const _Efl_Class *klass, const _Efl_Class **extns) -{ - const _Efl_Class *cur_klass; - const _Efl_Class **kls_itr = NULL; - const Efl_Op_Description *op_desc; - const Efl_Op_Description *op_descs; - - if (klass) - { - for (kls_itr = klass->mro ; *kls_itr ; kls_itr++) - { - unsigned int i; - cur_klass = *kls_itr; - op_descs = cur_klass->desc->ops.descs; - - for (i = 0, op_desc = op_descs; i < cur_klass->desc->ops.count; i++, op_desc++) - { - if (_eo_api_func_equal(op_desc->api_func, api_func)) - { - return op_desc; - } - } - } - } - - if (extns) - { - for (kls_itr = extns ; *kls_itr ; kls_itr++) - { - cur_klass = *kls_itr; - op_desc = _eo_api_desc_get(api_func, cur_klass, NULL); - if (op_desc) return op_desc; - } - } - - return NULL; -} - EAPI Efl_Object_Op _efl_object_api_op_id_get(const void *api_func) { @@ -667,23 +626,7 @@ _eo_class_funcs_set(Eo_Vtable *vtable, const Efl_Object_Ops *ops, const _Efl_Cla } else if ((op_desc->op_type == EFL_OBJECT_OP_TYPE_REGULAR_OVERRIDE) || (op_desc->op_type == EFL_OBJECT_OP_TYPE_CLASS_OVERRIDE)) { - const Efl_Op_Description *api_desc; - if (override_only) - { - api_desc = _eo_api_desc_get(op_desc->api_func, hierarchy_klass, NULL); - } - else - { - api_desc = _eo_api_desc_get(op_desc->api_func, hierarchy_klass->parent, hierarchy_klass->extensions); - } - - if (api_desc == NULL) - { - ERR("Class '%s': Can't find api func description in class hierarchy (%p->%p) (%s).", - hierarchy_klass->desc->name, op_desc->api_func, op_desc->func, _eo_op_desc_name_get(op_desc)); - return EINA_FALSE; - } - + /* We allow any overrides, we don't check if in hierarchy. */ op = _efl_object_api_op_id_get(op_desc->api_func); } @@ -705,6 +648,47 @@ _eo_class_funcs_set(Eo_Vtable *vtable, const Efl_Object_Ops *ops, const _Efl_Cla return EINA_TRUE; } +EAPI Eina_Bool +efl_class_functions_set(const Efl_Class *klass_id, const Efl_Object_Ops *ops) +{ + EO_CLASS_POINTER_RETURN_VAL(klass_id, klass, EINA_FALSE); + Efl_Object_Ops empty_ops = { 0 }; + if (klass->functions_set) + { + ERR("Class %s already had its functions set..", klass->desc->name); + return EINA_FALSE; + } + klass->functions_set = EINA_TRUE; + + if (!ops) + { + ops = &empty_ops; + } + + klass->ops_count = ops->count; + + klass->base_id = _eo_ops_last_id; + _eo_ops_last_id += klass->ops_count + 1; + + _vtable_init(&klass->vtable, DICH_CHAIN1(_eo_ops_last_id) + 1); + + + /* Flatten the function array */ + { + const _Efl_Class **mro_itr = klass->mro; + for ( ; *mro_itr ; mro_itr++) + ; + + /* Skip ourselves. */ + for ( mro_itr-- ; mro_itr > klass->mro ; mro_itr--) + { + _vtable_copy_all(&klass->vtable, &(*mro_itr)->vtable); + } + } + + return _eo_class_funcs_set(&klass->vtable, ops, klass, klass, EINA_FALSE); +} + EAPI Eo * _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent_id, Eina_Bool ref EINA_UNUSED, Eina_Bool is_fallback) { @@ -892,18 +876,6 @@ _vtable_init(Eo_Vtable *vtable, size_t size) vtable->chain = calloc(vtable->size, sizeof(*vtable->chain)); } -static void -_eo_class_base_op_init(_Efl_Class *klass) -{ - const Efl_Class_Description *desc = klass->desc; - - klass->base_id = _eo_ops_last_id; - - _eo_ops_last_id += desc->ops.count + 1; - - _vtable_init(&klass->vtable, DICH_CHAIN1(_eo_ops_last_id) + 1); -} - #ifdef EO_DEBUG static Eina_Bool _eo_class_mro_has(const _Efl_Class *klass, const _Efl_Class *find) @@ -1025,6 +997,15 @@ _eo_class_mro_init(const Efl_Class_Description *desc, const _Efl_Class *parent, return mro; } +static Eina_Bool +_eo_class_initializer(_Efl_Class *klass) +{ + if (klass->desc->class_initializer) + return klass->desc->class_initializer(_eo_class_id_get(klass)); + + return EINA_TRUE; +} + static void _eo_class_constructor(_Efl_Class *klass) { @@ -1256,6 +1237,7 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ... klass->extensions = (const _Efl_Class **) ((char *) klass + _eo_class_sz); klass->mro = (const _Efl_Class **) ((char *) klass->extensions + extn_sz); klass->extn_data_off = (Eo_Extension_Data_Offset *) ((char *) klass->mro + mro_sz); + if (klass->parent) { /* FIXME: Make sure this alignment is enough. */ @@ -1328,19 +1310,27 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ... desc->name, klass->obj_size); } - _eo_class_base_op_init(klass); - - /* Flatten the function array */ { - const _Efl_Class **mro_itr = klass->mro; - for ( ; *mro_itr ; mro_itr++) - ; + Eo_Id new_id; - /* Skip ourselves. */ - for ( mro_itr-- ; mro_itr > klass->mro ; mro_itr--) - { - _vtable_copy_all(&klass->vtable, &(*mro_itr)->vtable); - } + eina_spinlock_take(&_efl_class_creation_lock); + new_id = (_eo_classes_last_id + 1) | MASK_CLASS_TAG; + _eo_classes_expand(); + _eo_classes[_UNMASK_ID(new_id) - 1] = klass; + eina_spinlock_release(&_efl_class_creation_lock); + + klass->header.id = new_id; + } + + if (!_eo_class_initializer(klass)) + { + return NULL; + } + + /* If functions haven't been set, invoke it with an empty ops structure. */ + if (!klass->functions_set) + { + efl_class_functions_set(_eo_class_id_get(klass), NULL); } /* Mark which classes we implement */ @@ -1352,41 +1342,20 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ... const _Efl_Class *extn = *extn_itr; /* Set it in the dich. */ _vtable_func_set(&klass->vtable, klass, extn->base_id + - extn->desc->ops.count, _eo_class_isa_func); + extn->ops_count, _eo_class_isa_func); } - _vtable_func_set(&klass->vtable, klass, klass->base_id + klass->desc->ops.count, + _vtable_func_set(&klass->vtable, klass, klass->base_id + klass->ops_count, _eo_class_isa_func); if (klass->parent) { _vtable_func_set(&klass->vtable, klass, - klass->parent->base_id + klass->parent->desc->ops.count, + klass->parent->base_id + klass->parent->ops_count, _eo_class_isa_func); } } - if (!_eo_class_funcs_set(&klass->vtable, &(klass->desc->ops), klass, klass, EINA_FALSE)) - { - eina_spinlock_free(&klass->objects.trash_lock); - eina_spinlock_free(&klass->iterators.trash_lock); - _vtable_func_clean_all(&klass->vtable); - free(klass); - return NULL; - } - - { - Eo_Id new_id; - - eina_spinlock_take(&_efl_class_creation_lock); - new_id = (_eo_classes_last_id + 1) | MASK_CLASS_TAG; - _eo_classes_expand(); - _eo_classes[_UNMASK_ID(new_id) - 1] = klass; - eina_spinlock_release(&_efl_class_creation_lock); - - klass->header.id = new_id; - } - _eo_class_constructor(klass); DBG("Finished building class '%s'", klass->desc->name); @@ -1452,7 +1421,7 @@ efl_isa(const Eo *eo_id, const Efl_Class *klass_id) EO_OBJ_POINTER_RETURN_VAL(eo_id, obj, EINA_FALSE); EO_CLASS_POINTER_RETURN_VAL(klass_id, klass, EINA_FALSE); const op_type_funcs *func = _vtable_func_get(obj->vtable, - klass->base_id + klass->desc->ops.count); + klass->base_id + klass->ops_count); eina_spinlock_take(&_eoid_lock); diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h index 9fb982d510..b0e8752505 100644 --- a/src/lib/eo/eo_private.h +++ b/src/lib/eo/eo_private.h @@ -185,8 +185,10 @@ struct _Efl_Class unsigned int obj_size; /**< size of an object of this class */ unsigned int base_id; unsigned int data_offset; /* < Offset of the data within object data. */ + unsigned int ops_count; /* < Offset of the data within object data. */ Eina_Bool constructed : 1; + Eina_Bool functions_set : 1; /* [extensions*] + NULL */ /* [mro*] + NULL */ /* [extensions data offset] + NULL */ diff --git a/src/tests/eo/access/access_inherit.c b/src/tests/eo/access/access_inherit.c index 2967f3d66d..71929012ce 100644 --- a/src/tests/eo/access/access_inherit.c +++ b/src/tests/eo/access/access_inherit.c @@ -18,16 +18,22 @@ _prot_print(Eo *obj, void *class_data EINA_UNUSED) EAPI EFL_VOID_FUNC_BODY(inherit_prot_print); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(inherit_prot_print, _prot_print), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(inherit_prot_print, _prot_print), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Inherit", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/access/access_simple.c b/src/tests/eo/access/access_simple.c index 52bafcf776..f29683447f 100644 --- a/src/tests/eo/access/access_simple.c +++ b/src/tests/eo/access/access_simple.c @@ -32,16 +32,22 @@ _a_set(Eo *obj, void *class_data, int a) EAPI EFL_VOID_FUNC_BODYV(simple_a_set, EFL_FUNC_CALL(a), int a); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Private_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/children/children_simple.c b/src/tests/eo/children/children_simple.c index 4f4dae975b..c5cd9fac1b 100644 --- a/src/tests/eo/children/children_simple.c +++ b/src/tests/eo/children/children_simple.c @@ -11,9 +11,9 @@ static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; diff --git a/src/tests/eo/composite_objects/composite_objects_comp.c b/src/tests/eo/composite_objects/composite_objects_comp.c index d182835638..ee6686da22 100644 --- a/src/tests/eo/composite_objects/composite_objects_comp.c +++ b/src/tests/eo/composite_objects/composite_objects_comp.c @@ -36,17 +36,23 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED) return obj; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_get, _a_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_get, _a_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Comp", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/composite_objects/composite_objects_simple.c b/src/tests/eo/composite_objects/composite_objects_simple.c index ea627dd901..a377af3608 100644 --- a/src/tests/eo/composite_objects/composite_objects_simple.c +++ b/src/tests/eo/composite_objects/composite_objects_simple.c @@ -95,85 +95,92 @@ EAPI EFL_VOID_FUNC_BODYV(simple_a_get30, EFL_FUNC_CALL(a), int a); EAPI EFL_VOID_FUNC_BODYV(simple_a_get31, EFL_FUNC_CALL(a), int a); EAPI EFL_VOID_FUNC_BODYV(simple_a_get32, EFL_FUNC_CALL(a), int a); -/* XXX: This is fragile, and emulates many IDs in order to go to the next - * op id chain (assuming chain size is as it is at the moment, 32). - * This is needed in order to properly test some edge cases (see commit message - * for more info). */ -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(simple_a_set1, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set2, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set3, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set4, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set5, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set6, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set7, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set8, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set9, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set10, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set11, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set12, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set13, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set14, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set15, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set16, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set17, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set18, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set19, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set20, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set21, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set22, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set23, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set24, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set25, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set26, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set27, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set28, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set29, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set30, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set31, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_set32, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_get1, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get2, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get3, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get4, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get5, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get6, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get7, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get8, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get9, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get10, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get11, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get12, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get13, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get14, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get15, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get16, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get17, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get18, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get19, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get20, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get21, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get22, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get23, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get24, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get25, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get26, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get27, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get28, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get29, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get30, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get31, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_get32, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), -}; + +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + /* XXX: This is fragile, and emulates many IDs in order to go to the next + * op id chain (assuming chain size is as it is at the moment, 32). + * This is needed in order to properly test some edge cases (see commit message + * for more info). */ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(simple_a_set1, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set2, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set3, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set4, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set5, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set6, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set7, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set8, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set9, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set10, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set11, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set12, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set13, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set14, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set15, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set16, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set17, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set18, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set19, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set20, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set21, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set22, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set23, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set24, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set25, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set26, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set27, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set28, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set29, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set30, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set31, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_set32, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_get1, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get2, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get3, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get4, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get5, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get6, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get7, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get8, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get9, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get10, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get11, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get12, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get13, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get14, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get15, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get16, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get17, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get18, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get19, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get20, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get21, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get22, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get23, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get24, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get25, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get26, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get27, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get28, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get29, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get30, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get31, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_get32, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Simple_Public_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_mixin.c b/src/tests/eo/constructors/constructors_mixin.c index e193d9e1e9..a68c10bdc1 100644 --- a/src/tests/eo/constructors/constructors_mixin.c +++ b/src/tests/eo/constructors/constructors_mixin.c @@ -37,18 +37,24 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED) EAPI EFL_VOID_FUNC_BODYV(mixin_add_and_print, EFL_FUNC_CALL(x), int x); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(mixin_add_and_print, _add_and_print_set), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(mixin_add_and_print, _add_and_print_set), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Mixin", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_simple.c b/src/tests/eo/constructors/constructors_simple.c index a6c992ad2f..62d47d2688 100644 --- a/src/tests/eo/constructors/constructors_simple.c +++ b/src/tests/eo/constructors/constructors_simple.c @@ -85,22 +85,28 @@ _class_destructor(Efl_Class *klass EINA_UNUSED) EFL_VOID_FUNC_BODYV(simple_constructor, EFL_FUNC_CALL(a), int a); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_finalize, _finalize), - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), - EFL_OBJECT_OP_FUNC(simple_b_set, _b_set), +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_finalize, _finalize), + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), + EFL_OBJECT_OP_FUNC(simple_b_set, _b_set), EFL_OBJECT_OP_FUNC(simple_b_get, _b_get), -}; + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Private_Data), + _class_initializer, _class_constructor, _class_destructor }; diff --git a/src/tests/eo/constructors/constructors_simple2.c b/src/tests/eo/constructors/constructors_simple2.c index 9dc68597b9..e97b95fe2d 100644 --- a/src/tests/eo/constructors/constructors_simple2.c +++ b/src/tests/eo/constructors/constructors_simple2.c @@ -16,16 +16,22 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED) return NULL; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_simple3.c b/src/tests/eo/constructors/constructors_simple3.c index 528efb2734..8e7bdc59c3 100644 --- a/src/tests/eo/constructors/constructors_simple3.c +++ b/src/tests/eo/constructors/constructors_simple3.c @@ -14,16 +14,22 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) return obj; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple3", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_simple4.c b/src/tests/eo/constructors/constructors_simple4.c index 83e27ce425..177c199c1b 100644 --- a/src/tests/eo/constructors/constructors_simple4.c +++ b/src/tests/eo/constructors/constructors_simple4.c @@ -13,9 +13,9 @@ static const Efl_Class_Description class_desc = { EO_VERSION, "Simple4", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_simple5.c b/src/tests/eo/constructors/constructors_simple5.c index 280b335a19..86d9167005 100644 --- a/src/tests/eo/constructors/constructors_simple5.c +++ b/src/tests/eo/constructors/constructors_simple5.c @@ -14,16 +14,22 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) (void) obj; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple5", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_simple6.c b/src/tests/eo/constructors/constructors_simple6.c index 92825d3416..ffe99098b7 100644 --- a/src/tests/eo/constructors/constructors_simple6.c +++ b/src/tests/eo/constructors/constructors_simple6.c @@ -14,16 +14,22 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED) efl_destructor(efl_super(obj, MY_CLASS)); } -static Efl_Op_Description op_descs [] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple6", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/constructors/constructors_simple7.c b/src/tests/eo/constructors/constructors_simple7.c index c4bfaf6dba..815b974afe 100644 --- a/src/tests/eo/constructors/constructors_simple7.c +++ b/src/tests/eo/constructors/constructors_simple7.c @@ -18,16 +18,22 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) return efl_constructor(efl_super(obj, MY_CLASS)); } -static Efl_Op_Description op_descs [] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple7", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/function_overrides/function_overrides_inherit.c b/src/tests/eo/function_overrides/function_overrides_inherit.c index de17dfb2da..d93e3839d4 100644 --- a/src/tests/eo/function_overrides/function_overrides_inherit.c +++ b/src/tests/eo/function_overrides/function_overrides_inherit.c @@ -12,9 +12,9 @@ static const Efl_Class_Description class_desc = { EO_VERSION, "Inherit", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; diff --git a/src/tests/eo/function_overrides/function_overrides_inherit2.c b/src/tests/eo/function_overrides/function_overrides_inherit2.c index c962d8a06f..0211a8cd21 100644 --- a/src/tests/eo/function_overrides/function_overrides_inherit2.c +++ b/src/tests/eo/function_overrides/function_overrides_inherit2.c @@ -59,19 +59,25 @@ _class_print(Efl_Class *klass, void *data EINA_UNUSED) EAPI EFL_FUNC_BODY(inherit2_print, Eina_Bool, EINA_FALSE); EAPI EFL_FUNC_BODY(inherit2_print2, Eina_Bool, EINA_FALSE); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(inherit2_print, _print), - EFL_OBJECT_OP_FUNC(inherit2_print2, _print2), - EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(simple_class_print, _class_print), - EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _a_set), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(inherit2_print, _print), + EFL_OBJECT_OP_FUNC(inherit2_print2, _print2), + EFL_OBJECT_OP_CLASS_FUNC_OVERRIDE(simple_class_print, _class_print), + EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _a_set), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Inherit2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/function_overrides/function_overrides_inherit3.c b/src/tests/eo/function_overrides/function_overrides_inherit3.c index 38dd470342..1043a2a93f 100644 --- a/src/tests/eo/function_overrides/function_overrides_inherit3.c +++ b/src/tests/eo/function_overrides/function_overrides_inherit3.c @@ -16,16 +16,22 @@ _a_set(Eo *obj, void *class_data EINA_UNUSED, int a) simple_a_set(efl_super(obj, MY_CLASS), a + 1); } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _a_set), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _a_set), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Inherit3", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/function_overrides/function_overrides_simple.c b/src/tests/eo/function_overrides/function_overrides_simple.c index 7b3ef7a4d0..9477e7d41a 100644 --- a/src/tests/eo/function_overrides/function_overrides_simple.c +++ b/src/tests/eo/function_overrides/function_overrides_simple.c @@ -56,19 +56,25 @@ EAPI EFL_FUNC_BODY(simple_a_print, Eina_Bool, EINA_FALSE); EAPI EFL_FUNC_BODY_CONST(simple_class_print, Eina_Bool, EINA_FALSE); EAPI EFL_FUNC_BODY_CONST(simple_class_print2, Eina_Bool, EINA_FALSE); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_print, _a_print), - EFL_OBJECT_OP_FUNC(simple_class_print, _class_print), - EFL_OBJECT_OP_FUNC(simple_class_print2, _class_print2), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_print, _a_print), + EFL_OBJECT_OP_FUNC(simple_class_print, _class_print), + EFL_OBJECT_OP_FUNC(simple_class_print2, _class_print2), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Simple_Public_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/interface/interface_interface.c b/src/tests/eo/interface/interface_interface.c index 8358bcc4ad..deac3af2a4 100644 --- a/src/tests/eo/interface/interface_interface.c +++ b/src/tests/eo/interface/interface_interface.c @@ -10,16 +10,22 @@ EFL_FUNC_BODY(interface_ab_sum_get, int, 0); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(interface_ab_sum_get, NULL), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(interface_ab_sum_get, NULL), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Interface", EFL_CLASS_TYPE_INTERFACE, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/interface/interface_interface2.c b/src/tests/eo/interface/interface_interface2.c index b4c2f9df4c..6cbc0b8337 100644 --- a/src/tests/eo/interface/interface_interface2.c +++ b/src/tests/eo/interface/interface_interface2.c @@ -11,16 +11,22 @@ EFL_FUNC_BODY(interface2_ab_sum_get2, int, 0); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(interface2_ab_sum_get2, NULL), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(interface2_ab_sum_get2, NULL), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Interface2", EFL_CLASS_TYPE_INTERFACE, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/interface/interface_simple.c b/src/tests/eo/interface/interface_simple.c index a1e03d8d44..433de5ce68 100644 --- a/src/tests/eo/interface/interface_simple.c +++ b/src/tests/eo/interface/interface_simple.c @@ -56,21 +56,27 @@ _ab_sum_get2(Eo *obj, void *class_data EINA_UNUSED) return a + b + 1; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), - EFL_OBJECT_OP_FUNC(simple_b_set, _b_set), - EFL_OBJECT_OP_FUNC(simple_b_get, _b_get), - EFL_OBJECT_OP_FUNC_OVERRIDE(interface_ab_sum_get, _ab_sum_get), - EFL_OBJECT_OP_FUNC_OVERRIDE(interface2_ab_sum_get2, _ab_sum_get2), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), + EFL_OBJECT_OP_FUNC(simple_b_set, _b_set), + EFL_OBJECT_OP_FUNC(simple_b_get, _b_get), + EFL_OBJECT_OP_FUNC_OVERRIDE(interface_ab_sum_get, _ab_sum_get), + EFL_OBJECT_OP_FUNC_OVERRIDE(interface2_ab_sum_get2, _ab_sum_get2), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Private_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/mixin/mixin_inherit.c b/src/tests/eo/mixin/mixin_inherit.c index afabf6f957..5c4503f695 100644 --- a/src/tests/eo/mixin/mixin_inherit.c +++ b/src/tests/eo/mixin/mixin_inherit.c @@ -19,16 +19,22 @@ _a_get(Eo *obj, void *class_data EINA_UNUSED) return ret; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_get, _a_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_get, _a_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Inherit", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/mixin/mixin_mixin.c b/src/tests/eo/mixin/mixin_mixin.c index 4373c5c022..e5ac3af1a8 100644 --- a/src/tests/eo/mixin/mixin_mixin.c +++ b/src/tests/eo/mixin/mixin_mixin.c @@ -32,18 +32,24 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED) EAPI EFL_FUNC_BODY(mixin_ab_sum_get, int, 0); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), - EFL_OBJECT_OP_FUNC(mixin_ab_sum_get, _ab_sum_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + EFL_OBJECT_OP_FUNC(mixin_ab_sum_get, _ab_sum_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Mixin", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/mixin/mixin_mixin2.c b/src/tests/eo/mixin/mixin_mixin2.c index 71f6b0b231..38547dab26 100644 --- a/src/tests/eo/mixin/mixin_mixin2.c +++ b/src/tests/eo/mixin/mixin_mixin2.c @@ -46,18 +46,24 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) efl_destructor(efl_super(obj, MY_CLASS)); } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Mixin2", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Mixin2_Public_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/mixin/mixin_mixin3.c b/src/tests/eo/mixin/mixin_mixin3.c index d0133722c7..21da5d0cfd 100644 --- a/src/tests/eo/mixin/mixin_mixin3.c +++ b/src/tests/eo/mixin/mixin_mixin3.c @@ -45,18 +45,24 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) efl_destructor(efl_super(obj, MY_CLASS)); } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Mixin3", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Mixin3_Public_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/mixin/mixin_mixin4.c b/src/tests/eo/mixin/mixin_mixin4.c index ff2757dc8d..da0f98c6cf 100644 --- a/src/tests/eo/mixin/mixin_mixin4.c +++ b/src/tests/eo/mixin/mixin_mixin4.c @@ -15,9 +15,9 @@ static const Efl_Class_Description class_desc = { EO_VERSION, "Mixin4", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; diff --git a/src/tests/eo/mixin/mixin_simple.c b/src/tests/eo/mixin/mixin_simple.c index d2f2d41bdd..8322d31235 100644 --- a/src/tests/eo/mixin/mixin_simple.c +++ b/src/tests/eo/mixin/mixin_simple.c @@ -37,19 +37,25 @@ EFL_FUNC_BODY(simple_##name##_get, int, 0); _GET_SET_FUNC(a) _GET_SET_FUNC(b) -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), - EFL_OBJECT_OP_FUNC(simple_b_set, _b_set), - EFL_OBJECT_OP_FUNC(simple_b_get, _b_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), + EFL_OBJECT_OP_FUNC(simple_b_set, _b_set), + EFL_OBJECT_OP_FUNC(simple_b_get, _b_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Private_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/signals/signals_simple.c b/src/tests/eo/signals/signals_simple.c index 74b569be63..3cd4d946d7 100644 --- a/src/tests/eo/signals/signals_simple.c +++ b/src/tests/eo/signals/signals_simple.c @@ -71,17 +71,23 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED) EAPI EFL_VOID_FUNC_BODYV(simple_a_set, EFL_FUNC_CALL(a), int a); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _constructor), + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Private_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/suite/eo_test_class_behaviour_errors.c b/src/tests/eo/suite/eo_test_class_behaviour_errors.c index 678cce638d..fc443fbe8b 100644 --- a/src/tests/eo/suite/eo_test_class_behaviour_errors.c +++ b/src/tests/eo/suite/eo_test_class_behaviour_errors.c @@ -22,21 +22,27 @@ static void _destructor_unref(Eo *obj, void *class_data EINA_UNUSED) efl_unref(obj); } +static Eina_Bool +_destructor_unref_class_initializer(Efl_Class *klass2) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor_unref), + ); + + return efl_class_functions_set(klass2, &ops); +} + START_TEST(efl_destructor_unref) { efl_object_init(); eina_log_print_cb_set(eo_test_print_cb, &ctx); - static Efl_Op_Description op_descs [] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor_unref), - }; - static Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _destructor_unref_class_initializer, NULL, NULL }; @@ -65,9 +71,9 @@ START_TEST(efl_destructor_double_del) EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; diff --git a/src/tests/eo/suite/eo_test_class_errors.c b/src/tests/eo/suite/eo_test_class_errors.c index a63d9f5f5a..89ad49be23 100644 --- a/src/tests/eo/suite/eo_test_class_errors.c +++ b/src/tests/eo/suite/eo_test_class_errors.c @@ -25,9 +25,9 @@ START_TEST(eo_inherit_errors) EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -35,9 +35,9 @@ START_TEST(eo_inherit_errors) EO_VERSION, "Mixin", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -45,9 +45,9 @@ START_TEST(eo_inherit_errors) EO_VERSION, "General", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -90,9 +90,9 @@ START_TEST(eo_inconsistent_mro) EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -100,9 +100,9 @@ START_TEST(eo_inconsistent_mro) EO_VERSION, "Mixin", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -110,9 +110,9 @@ START_TEST(eo_inconsistent_mro) EO_VERSION, "Mixin2", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -120,9 +120,9 @@ START_TEST(eo_inconsistent_mro) EO_VERSION, "Mixin3", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -165,9 +165,9 @@ START_TEST(eo_bad_interface) EO_VERSION, "Interface", EFL_CLASS_TYPE_INTERFACE, - EFL_CLASS_DESCRIPTION_NOOPS(), 10, NULL, + NULL, NULL }; @@ -202,6 +202,16 @@ END_TEST static void _null_fct(Eo *eo_obj EINA_UNUSED, void *d EINA_UNUSED) { } void null_fct (void) {} +static Eina_Bool +_null_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(NULL, _null_fct), + ); + + return efl_class_functions_set(klass, &ops); +} + START_TEST(eo_null_api) { efl_object_init(); @@ -209,15 +219,12 @@ START_TEST(eo_null_api) const Efl_Class *klass; - static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(NULL, _null_fct), - }; static Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _null_class_initializer, NULL, NULL }; @@ -233,21 +240,28 @@ START_TEST(eo_null_api) } END_TEST +static Eina_Bool +_wrong_override_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(null_fct, _null_fct), + ); + + return efl_class_functions_set(klass, &ops); +} + START_TEST(eo_wrong_override) { efl_object_init(); const Efl_Class *klass; - static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(null_fct, _null_fct), - }; static Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _wrong_override_class_initializer, NULL, NULL }; @@ -259,6 +273,17 @@ START_TEST(eo_wrong_override) } END_TEST +static Eina_Bool +_redefined_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(null_fct, _null_fct), + EFL_OBJECT_OP_FUNC(null_fct, NULL), + ); + + return efl_class_functions_set(klass, &ops); +} + START_TEST(eo_api_redefined) { efl_object_init(); @@ -266,16 +291,12 @@ START_TEST(eo_api_redefined) const Efl_Class *klass; - static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(null_fct, _null_fct), - EFL_OBJECT_OP_FUNC(null_fct, NULL), - }; static Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _redefined_class_initializer, NULL, NULL }; @@ -291,6 +312,17 @@ START_TEST(eo_api_redefined) } END_TEST +static Eina_Bool +_dich_func_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _null_fct), + EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, NULL), + ); + + return efl_class_functions_set(klass, &ops); +} + START_TEST(eo_dich_func_override) { efl_object_init(); @@ -298,16 +330,12 @@ START_TEST(eo_dich_func_override) const Efl_Class *klass; - static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _null_fct), - EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, NULL), - }; static Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _dich_func_class_initializer, NULL, NULL }; diff --git a/src/tests/eo/suite/eo_test_class_simple.c b/src/tests/eo/suite/eo_test_class_simple.c index 6bbeda587e..56d424c183 100644 --- a/src/tests/eo/suite/eo_test_class_simple.c +++ b/src/tests/eo/suite/eo_test_class_simple.c @@ -88,23 +88,29 @@ EFL_FUNC_BODY_CONST(simple_class_hi_print, Eina_Bool, EINA_FALSE); EFL_VOID_FUNC_BODY(simple_pure_virtual); EFL_VOID_FUNC_BODY(simple_no_implementation); -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), - EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), - EFL_OBJECT_OP_FUNC(simple_a_print, _a_print), - EFL_OBJECT_OP_CLASS_FUNC(simple_class_hi_print, _class_hi_print), - EFL_OBJECT_OP_FUNC(simple_recursive, _recursive), - EFL_OBJECT_OP_FUNC(simple_part_get, _part_get), - EFL_OBJECT_OP_FUNC(simple_pure_virtual, NULL), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_dbg_info_get, _dbg_info_get), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(simple_a_set, _a_set), + EFL_OBJECT_OP_FUNC(simple_a_get, _a_get), + EFL_OBJECT_OP_FUNC(simple_a_print, _a_print), + EFL_OBJECT_OP_CLASS_FUNC(simple_class_hi_print, _class_hi_print), + EFL_OBJECT_OP_FUNC(simple_recursive, _recursive), + EFL_OBJECT_OP_FUNC(simple_part_get, _part_get), + EFL_OBJECT_OP_FUNC(simple_pure_virtual, NULL), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_dbg_info_get, _dbg_info_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Simple_Public_Data), + _class_initializer, NULL, NULL }; @@ -120,16 +126,22 @@ _beef_get(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED) EFL_FUNC_BODY_CONST(simple2_class_beef_get, int, 0); -static Efl_Op_Description op_descs2[] = { - EFL_OBJECT_OP_CLASS_FUNC(simple2_class_beef_get, _beef_get), -}; +static Eina_Bool +_class_initializer2(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_CLASS_FUNC(simple2_class_beef_get, _beef_get), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc2 = { EO_VERSION, "Simple2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs2), 0, + _class_initializer2, NULL, NULL }; @@ -144,16 +156,22 @@ _interface_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, const Efl_Object *klas return efl_provider_find(efl_super(obj, SEARCHABLE_CLASS), klass); } -static Efl_Op_Description op_descs_searchable[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_provider_find, _interface_get) -}; +static Eina_Bool +_searchable_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_provider_find, _interface_get) + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc_searchable = { EO_VERSION, "Searchable", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs_searchable), 0, + _searchable_class_initializer, NULL, NULL }; diff --git a/src/tests/eo/suite/eo_test_class_singleton.c b/src/tests/eo/suite/eo_test_class_singleton.c index b0a2304b40..2702d68a0a 100644 --- a/src/tests/eo/suite/eo_test_class_singleton.c +++ b/src/tests/eo/suite/eo_test_class_singleton.c @@ -25,16 +25,22 @@ _singleton_efl_constructor(Eo *eo_obj EINA_UNUSED, void *_pd EINA_UNUSED) return singleton_obj; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _singleton_efl_constructor), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _singleton_efl_constructor), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Singleton", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 0, + _class_initializer, NULL, NULL }; diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c index 4e2b2b32d4..9d072dc055 100644 --- a/src/tests/eo/suite/eo_test_general.c +++ b/src/tests/eo/suite/eo_test_general.c @@ -73,7 +73,7 @@ START_TEST(efl_object_override_tests) * make sure we don't cache. */ ck_assert_int_eq(simple_a_get(obj), 0); - EFL_OBJECT_OVERRIDE_OPS_DEFINE( + EFL_OPS_DEFINE( overrides, EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_get, _simple_obj_override_a_get)); fail_if(!efl_object_override(obj, &overrides)); @@ -85,7 +85,7 @@ START_TEST(efl_object_override_tests) ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + OVERRIDE_A_SIMPLE); /* Override again. */ - EFL_OBJECT_OVERRIDE_OPS_DEFINE( + EFL_OPS_DEFINE( overrides2, EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _simple_obj_override_a_double_set)); fail_if(!efl_object_override(obj, NULL)); @@ -99,7 +99,7 @@ START_TEST(efl_object_override_tests) ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A_SIMPLE * 2); /* Try introducing a new function */ - EFL_OBJECT_OVERRIDE_OPS_DEFINE( + EFL_OPS_DEFINE( overrides3, EFL_OBJECT_OP_FUNC(simple2_class_beef_get, _simple_obj_override_a_double_set)); fail_if(!efl_object_override(obj, NULL)); @@ -268,9 +268,9 @@ START_TEST(efl_data_fetch) EO_VERSION, "Simple2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 10, NULL, + NULL, NULL }; @@ -310,9 +310,9 @@ START_TEST(efl_isa_tests) EO_VERSION, "Iface", EFL_CLASS_TYPE_INTERFACE, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -326,9 +326,9 @@ START_TEST(efl_isa_tests) EO_VERSION, "Mixin", EFL_CLASS_TYPE_MIXIN, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -342,9 +342,9 @@ START_TEST(efl_isa_tests) EO_VERSION, "Simple2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 10, NULL, + NULL, NULL }; @@ -427,10 +427,16 @@ _man_des(Eo *obj, void *data EINA_UNUSED, va_list *list EINA_UNUSED) efl_manual_free_set(obj, EINA_FALSE); } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _man_con), - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _man_des), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _man_con), + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _man_des), + ); + + return efl_class_functions_set(klass, &ops); +} START_TEST(eo_man_free) { @@ -441,8 +447,8 @@ START_TEST(eo_man_free) EO_VERSION, "Simple2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), 10, + _class_initializer, NULL, NULL }; @@ -975,10 +981,16 @@ _class_hi_print(Efl_Class *klass EINA_UNUSED, void *class_data EINA_UNUSED) EFL_FUNC_BODY(multi_a_print, Eina_Bool, EINA_FALSE); EFL_FUNC_BODY_CONST(multi_class_hi_print, Eina_Bool, EINA_FALSE); -static Efl_Op_Description _multi_do_op_descs[] = { - EFL_OBJECT_OP_FUNC(multi_a_print, _a_print), - EFL_OBJECT_OP_FUNC(multi_class_hi_print, _class_hi_print), -}; +static Eina_Bool +_multi_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(multi_a_print, _a_print), + EFL_OBJECT_OP_FUNC(multi_class_hi_print, _class_hi_print), + ); + + return efl_class_functions_set(klass, &ops); +} START_TEST(eo_multiple_do) { @@ -989,8 +1001,8 @@ START_TEST(eo_multiple_do) EO_VERSION, "Inherit", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(_multi_do_op_descs), 0, + _multi_class_initializer, NULL, NULL }; @@ -1064,9 +1076,9 @@ START_TEST(eo_pointers_indirection) EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; @@ -1149,9 +1161,15 @@ _efl_add_failures_finalize(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED) return NULL; } -static Efl_Op_Description _efl_add_failures_op_descs[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(efl_finalize, _efl_add_failures_finalize), -}; +static Eina_Bool +_add_failures_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(efl_finalize, _efl_add_failures_finalize), + ); + + return efl_class_functions_set(klass, &ops); +} START_TEST(efl_add_failures) { @@ -1161,8 +1179,8 @@ START_TEST(efl_add_failures) EO_VERSION, "Simple2", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(_efl_add_failures_op_descs), 0, + _add_failures_class_initializer, NULL, NULL }; @@ -1198,9 +1216,9 @@ START_TEST(efl_del_intercept) EO_VERSION, "Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_NOOPS(), 0, NULL, + NULL, NULL }; diff --git a/src/tests/eo/suite/eo_test_threaded_calls.c b/src/tests/eo/suite/eo_test_threaded_calls.c index 935a3164fc..31b31027fd 100644 --- a/src/tests/eo/suite/eo_test_threaded_calls.c +++ b/src/tests/eo/suite/eo_test_threaded_calls.c @@ -60,18 +60,24 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, int v) return obj; } -static Efl_Op_Description op_descs[] = { - EFL_OBJECT_OP_FUNC(thread_test_constructor, _constructor), - EFL_OBJECT_OP_FUNC(thread_test_v_get, _v_get), - EFL_OBJECT_OP_FUNC(thread_test_try_swap_stack, _try_swap_stack), -}; +static Eina_Bool +_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(thread_test_constructor, _constructor), + EFL_OBJECT_OP_FUNC(thread_test_v_get, _v_get), + EFL_OBJECT_OP_FUNC(thread_test_try_swap_stack, _try_swap_stack), + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description class_desc = { EO_VERSION, "Thread Test", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(op_descs), sizeof(Thread_Test_Public_Data), + _class_initializer, NULL, NULL }; diff --git a/src/tests/eolian/data/class_simple_ref.c b/src/tests/eolian/data/class_simple_ref.c index a022792475..cd075e16a4 100644 --- a/src/tests/eolian/data/class_simple_ref.c +++ b/src/tests/eolian/data/class_simple_ref.c @@ -25,20 +25,26 @@ int * _class_simple_bar(Eo *obj, Evas_Simple_Data *pd, int x); EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_bar, int *, 0, EFL_FUNC_CALL(x), int x); -static const Efl_Op_Description _class_simple_op_desc[] = { - EFL_OBJECT_OP_FUNC(efl_canvas_object_simple_a_set, _class_simple_a_set), - EFL_OBJECT_OP_FUNC(efl_canvas_object_simple_a_get, _class_simple_a_get), - EFL_OBJECT_OP_FUNC(efl_canvas_object_simple_foo, __eolian_class_simple_foo), -}; +static Eina_Bool +_class_simple_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(efl_canvas_object_simple_a_set, _class_simple_a_set), + EFL_OBJECT_OP_FUNC(efl_canvas_object_simple_a_get, _class_simple_a_get), + EFL_OBJECT_OP_FUNC(efl_canvas_object_simple_foo, __eolian_class_simple_foo) + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description _class_simple_class_desc = { EO_VERSION, "Class_Simple", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(_class_simple_op_desc), sizeof(Evas_Simple_Data), + _class_simple_class_initializer, NULL, NULL }; -EFL_DEFINE_CLASS(class_simple_class_get, &_class_simple_class_desc, NULL, NULL); +EFL_DEFINE_CLASS(class_simple_class_get, &_class_simple_class_desc, NULL, NULL); \ No newline at end of file diff --git a/src/tests/eolian/data/override_ref.c b/src/tests/eolian/data/override_ref.c index 8e79ce38cf..3a77e8ce71 100644 --- a/src/tests/eolian/data/override_ref.c +++ b/src/tests/eolian/data/override_ref.c @@ -53,28 +53,34 @@ static void __eolian_override_base_z_set(Eo *obj EINA_UNUSED, Override_Data *pd } -static const Efl_Op_Description _override_op_desc[] = { - EFL_OBJECT_OP_FUNC_OVERRIDE(base_constructor, _override_base_constructor), - EFL_OBJECT_OP_FUNC_OVERRIDE(base_z_get, __eolian_override_base_z_get), - EFL_OBJECT_OP_FUNC_OVERRIDE(base_z_set, __eolian_override_base_z_set), - EFL_OBJECT_OP_FUNC(override_b_set, __eolian_override_b_set), - EFL_OBJECT_OP_FUNC(override_bar, __eolian_override_bar), - EFL_OBJECT_OP_FUNC(override_c_get, __eolian_override_c_get), - EFL_OBJECT_OP_FUNC(override_a_set, NULL), - EFL_OBJECT_OP_FUNC(override_a_get, _override_a_get), - EFL_OBJECT_OP_FUNC(override_b_get, _override_b_get), - EFL_OBJECT_OP_FUNC(override_c_set, _override_c_set), - EFL_OBJECT_OP_FUNC(override_foo, NULL), -}; +static Eina_Bool +_override_class_initializer(Efl_Class *klass) +{ + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC_OVERRIDE(base_constructor, _override_base_constructor), + EFL_OBJECT_OP_FUNC_OVERRIDE(base_z_get, __eolian_override_base_z_get), + EFL_OBJECT_OP_FUNC_OVERRIDE(base_z_set, __eolian_override_base_z_set), + EFL_OBJECT_OP_FUNC(override_b_set, __eolian_override_b_set), + EFL_OBJECT_OP_FUNC(override_bar, __eolian_override_bar), + EFL_OBJECT_OP_FUNC(override_c_get, __eolian_override_c_get), + EFL_OBJECT_OP_FUNC(override_a_set, NULL), + EFL_OBJECT_OP_FUNC(override_a_get, _override_a_get), + EFL_OBJECT_OP_FUNC(override_b_get, _override_b_get), + EFL_OBJECT_OP_FUNC(override_c_set, _override_c_set), + EFL_OBJECT_OP_FUNC(override_foo, NULL) + ); + + return efl_class_functions_set(klass, &ops); +} static const Efl_Class_Description _override_class_desc = { EO_VERSION, "Override", EFL_CLASS_TYPE_REGULAR, - EFL_CLASS_DESCRIPTION_OPS(_override_op_desc), sizeof(Override_Data), + _override_class_initializer, NULL, NULL }; -EFL_DEFINE_CLASS(override_class_get, &_override_class_desc, BASE_CLASS, NULL); +EFL_DEFINE_CLASS(override_class_get, &_override_class_desc, BASE_CLASS, NULL); \ No newline at end of file