diff --git a/src/examples/eo/isa/eo_isa_complex.c b/src/examples/eo/isa/eo_isa_complex.c index 4e4ff3e2c9..12b8784356 100644 --- a/src/examples/eo/isa/eo_isa_complex.c +++ b/src/examples/eo/isa/eo_isa_complex.c @@ -11,7 +11,7 @@ static const Eo_Class_Description class_desc = { EO_VERSION, "Complex", EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + EO_CLASS_DESCRIPTION_NOOPS(), NULL, 0, NULL, diff --git a/src/examples/eo/isa/eo_isa_interface.c b/src/examples/eo/isa/eo_isa_interface.c index 8009012e21..95f026699f 100644 --- a/src/examples/eo/isa/eo_isa_interface.c +++ b/src/examples/eo/isa/eo_isa_interface.c @@ -5,20 +5,20 @@ #include "Eo.h" #include "eo_isa_interface.h" -EAPI Eo_Op INTERFACE_BASE_ID = 0; - #define MY_CLASS INTERFACE_CLASS -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(INTERFACE_SUB_ID_A_POWER_3_GET, "Get the a^3"), - EO_OP_DESCRIPTION_SENTINEL +EAPI EO_FUNC_BODY(interface_a_power_3_get, int, 0); + +static Eo_Op_Description op_desc[] = { + EO_OP_FUNC(interface_a_power_3_get, NULL, "Get the a^3"), + EO_OP_SENTINEL }; static const Eo_Class_Description class_desc = { EO_VERSION, "Interface", EO_CLASS_TYPE_INTERFACE, - EO_CLASS_DESCRIPTION_OPS(&INTERFACE_BASE_ID, op_desc, INTERFACE_SUB_ID_LAST), + EO_CLASS_DESCRIPTION_OPS(op_desc), NULL, 0, NULL, diff --git a/src/examples/eo/isa/eo_isa_interface.h b/src/examples/eo/isa/eo_isa_interface.h index c5bf43e135..382744038f 100644 --- a/src/examples/eo/isa/eo_isa_interface.h +++ b/src/examples/eo/isa/eo_isa_interface.h @@ -3,22 +3,12 @@ #include "Eo.h" -extern EAPI Eo_Op INTERFACE_BASE_ID; - -enum { - INTERFACE_SUB_ID_A_POWER_3_GET, - INTERFACE_SUB_ID_LAST -}; - -#define INTERFACE_ID(sub_id) (INTERFACE_BASE_ID + sub_id) - - /** * @def interface_a_power_3_get(ret) * @brief Get a^3 - * @param[out] ret integer pointer to ret - value + * @return integer value */ -#define interface_a_power_3_get(ret) INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), EO_TYPECHECK(int *, ret) +EAPI int interface_a_power_3_get(void); #define INTERFACE_CLASS interface_class_get() const Eo_Class *interface_class_get(void); diff --git a/src/examples/eo/isa/eo_isa_mixin.c b/src/examples/eo/isa/eo_isa_mixin.c index 71f1d859cc..66d501dfaf 100644 --- a/src/examples/eo/isa/eo_isa_mixin.c +++ b/src/examples/eo/isa/eo_isa_mixin.c @@ -6,46 +6,31 @@ #include "eo_isa_mixin.h" #include "eo_isa_simple.h" -EAPI Eo_Op MIXIN_BASE_ID = 0; - #define MY_CLASS MIXIN_CLASS -static void -_a_square_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list) +static int +_a_square_get(Eo *obj, void *class_data EINA_UNUSED) { - int a; - eo_do(obj, simple_a_get(&a)); - int *ret = va_arg(*list, int *); - if (ret) - *ret = a * a; + int a = eo_do(obj, simple_a_get()); printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + return a * a; } -static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), _a_square_get), - EO_OP_FUNC_SENTINEL - }; +EAPI EO_FUNC_BODY(mixin_a_square_get, int, 0); - eo_class_funcs_set(klass, func_desc); -} - - -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(MIXIN_SUB_ID_A_SQUARE_GET, "Get the value of A^2"), - EO_OP_DESCRIPTION_SENTINEL +static Eo_Op_Description op_desc[] = { + EO_OP_FUNC(mixin_a_square_get, _a_square_get, "Get the value of A^2"), + EO_OP_SENTINEL }; static const Eo_Class_Description class_desc = { EO_VERSION, "Mixin", EO_CLASS_TYPE_MIXIN, - EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST), + EO_CLASS_DESCRIPTION_OPS(op_desc), NULL, 0, - _class_constructor, + NULL, NULL }; diff --git a/src/examples/eo/isa/eo_isa_mixin.h b/src/examples/eo/isa/eo_isa_mixin.h index 539504d3ad..b09ba4d5de 100644 --- a/src/examples/eo/isa/eo_isa_mixin.h +++ b/src/examples/eo/isa/eo_isa_mixin.h @@ -3,22 +3,12 @@ #include "Eo.h" -extern EAPI Eo_Op MIXIN_BASE_ID; - -enum { - MIXIN_SUB_ID_A_SQUARE_GET, - MIXIN_SUB_ID_LAST -}; - -#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id) - - /** * @def mixin_a_square_get(ret) * @brief Get the square of a. * @param[out] ret the square of a */ -#define mixin_a_square_get(ret) MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), EO_TYPECHECK(int *, ret) +EAPI int mixin_a_square_get(void); #define MIXIN_CLASS mixin_class_get() const Eo_Class *mixin_class_get(void); diff --git a/src/examples/eo/isa/eo_isa_simple.c b/src/examples/eo/isa/eo_isa_simple.c index 67f47fd5f9..f5dcb3c6de 100644 --- a/src/examples/eo/isa/eo_isa_simple.c +++ b/src/examples/eo/isa/eo_isa_simple.c @@ -5,8 +5,6 @@ #include "Eo.h" #include "eo_isa_simple.h" -EAPI Eo_Op SIMPLE_BASE_ID = 0; - typedef struct { int a; @@ -14,64 +12,48 @@ typedef struct #define MY_CLASS SIMPLE_CLASS -static void -_a_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +static int +_a_get(Eo *obj EINA_UNUSED, void *class_data) { const Private_Data *pd = class_data; - int *a; - a = va_arg(*list, int *); - *a = pd->a; printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + return pd->a; } static void -_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +_a_set(Eo *obj EINA_UNUSED, void *class_data, int a) { Private_Data *pd = class_data; - int a; - a = va_arg(*list, int); pd->a = a; printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); } -static void -_a_power_3_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +static int +_a_power_3_get(Eo *obj EINA_UNUSED, void *class_data) { const Private_Data *pd = class_data; - int *ret; - ret = va_arg(*list, int *); - if (ret) - *ret = pd->a * pd->a * pd->a; printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + return pd->a * pd->a * pd->a; } -static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), - EO_OP_FUNC(INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), _a_power_3_get), - EO_OP_FUNC_SENTINEL - }; +EAPI EO_FUNC_BODY(simple_a_get, int, 0); +EAPI EO_VOID_FUNC_BODYV(simple_a_set, EO_FUNC_CALL(a), int a); - eo_class_funcs_set(klass, func_desc); -} - -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"), - EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "Get property A"), - EO_OP_DESCRIPTION_SENTINEL +static Eo_Op_Description op_desc[] = { + EO_OP_FUNC(simple_a_set, _a_set, "Set property A"), + EO_OP_FUNC(simple_a_get, _a_get, "Get property A"), + EO_OP_FUNC_OVERRIDE(interface_a_power_3_get, _a_power_3_get), + EO_OP_SENTINEL }; static const Eo_Class_Description class_desc = { EO_VERSION, "Simple", EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_DESCRIPTION_OPS(op_desc), NULL, sizeof(Private_Data), - _class_constructor, + NULL, NULL }; diff --git a/src/examples/eo/isa/eo_isa_simple.h b/src/examples/eo/isa/eo_isa_simple.h index eead797238..ee30208782 100644 --- a/src/examples/eo/isa/eo_isa_simple.h +++ b/src/examples/eo/isa/eo_isa_simple.h @@ -5,29 +5,19 @@ #include "eo_isa_interface.h" #include "eo_isa_mixin.h" -extern EAPI Eo_Op SIMPLE_BASE_ID; - -enum { - SIMPLE_SUB_ID_A_SET, - SIMPLE_SUB_ID_A_GET, - SIMPLE_SUB_ID_LAST -}; - -#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) - /** * @def simple_a_set(a) * @brief Set value to a-property * @param[in] a integer value to set */ -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) +EAPI void simple_a_set(int a); /** * @def simple_a_get(a) * @brief Get value of a-property * @param[out] integer pointer to a-value */ -#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a) +EAPI int simple_a_get(void); #define SIMPLE_CLASS simple_class_get() const Eo_Class *simple_class_get(void); diff --git a/src/examples/eo/simple/simple_interface.c b/src/examples/eo/simple/simple_interface.c index e59107267a..eeda051a1c 100644 --- a/src/examples/eo/simple/simple_interface.c +++ b/src/examples/eo/simple/simple_interface.c @@ -5,20 +5,20 @@ #include "Eo.h" #include "simple_interface.h" -EAPI Eo_Op INTERFACE_BASE_ID = 0; - #define MY_CLASS INTERFACE_CLASS -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(INTERFACE_SUB_ID_A_POWER_3_GET, "Get the a^3"), - EO_OP_DESCRIPTION_SENTINEL +EAPI EO_FUNC_BODY(interface_a_power_3_get, int, 0); + +static Eo_Op_Description op_desc[] = { + EO_OP_FUNC(interface_a_power_3_get, NULL, "Get the a^3"), + EO_OP_SENTINEL }; static const Eo_Class_Description class_desc = { EO_VERSION, "Interface", EO_CLASS_TYPE_INTERFACE, - EO_CLASS_DESCRIPTION_OPS(&INTERFACE_BASE_ID, op_desc, INTERFACE_SUB_ID_LAST), + EO_CLASS_DESCRIPTION_OPS(op_desc), NULL, 0, NULL, diff --git a/src/examples/eo/simple/simple_interface.h b/src/examples/eo/simple/simple_interface.h index c5bf43e135..382744038f 100644 --- a/src/examples/eo/simple/simple_interface.h +++ b/src/examples/eo/simple/simple_interface.h @@ -3,22 +3,12 @@ #include "Eo.h" -extern EAPI Eo_Op INTERFACE_BASE_ID; - -enum { - INTERFACE_SUB_ID_A_POWER_3_GET, - INTERFACE_SUB_ID_LAST -}; - -#define INTERFACE_ID(sub_id) (INTERFACE_BASE_ID + sub_id) - - /** * @def interface_a_power_3_get(ret) * @brief Get a^3 - * @param[out] ret integer pointer to ret - value + * @return integer value */ -#define interface_a_power_3_get(ret) INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), EO_TYPECHECK(int *, ret) +EAPI int interface_a_power_3_get(void); #define INTERFACE_CLASS interface_class_get() const Eo_Class *interface_class_get(void); diff --git a/src/examples/eo/simple/simple_main.c b/src/examples/eo/simple/simple_main.c index a93a5e37d2..2ee7ee44ca 100644 --- a/src/examples/eo/simple/simple_main.c +++ b/src/examples/eo/simple/simple_main.c @@ -18,9 +18,9 @@ main(int argc, char *argv[]) int a = 0, a2 = 0, a3 = 0; - eo_do(obj, simple_a_get(&a), - interface_a_power_3_get(&a3), - mixin_a_square_get(&a2)); + eo_do(obj, a = simple_a_get(), + a3 = interface_a_power_3_get(), + a2 = mixin_a_square_get()); printf("Got %d %d %d\n", a, a2, a3); diff --git a/src/examples/eo/simple/simple_mixin.c b/src/examples/eo/simple/simple_mixin.c index 389b0891f9..9f31880c87 100644 --- a/src/examples/eo/simple/simple_mixin.c +++ b/src/examples/eo/simple/simple_mixin.c @@ -6,46 +6,31 @@ #include "simple_mixin.h" #include "simple_simple.h" -EAPI Eo_Op MIXIN_BASE_ID = 0; - #define MY_CLASS MIXIN_CLASS -static void -_a_square_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list) +static int +_a_square_get(Eo *obj, void *class_data EINA_UNUSED) { - int a; - eo_do(obj, simple_a_get(&a)); - int *ret = va_arg(*list, int *); - if (ret) - *ret = a * a; + int a = eo_do(obj, simple_a_get()); printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + return a * a; } -static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), _a_square_get), - EO_OP_FUNC_SENTINEL - }; +EAPI EO_FUNC_BODY(mixin_a_square_get, int, 0); - eo_class_funcs_set(klass, func_desc); -} - - -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(MIXIN_SUB_ID_A_SQUARE_GET, "Get the value of A^2"), - EO_OP_DESCRIPTION_SENTINEL +static Eo_Op_Description op_desc[] = { + EO_OP_FUNC(mixin_a_square_get, _a_square_get, "Get the value of A^2"), + EO_OP_SENTINEL }; static const Eo_Class_Description class_desc = { EO_VERSION, "Mixin", EO_CLASS_TYPE_MIXIN, - EO_CLASS_DESCRIPTION_OPS(&MIXIN_BASE_ID, op_desc, MIXIN_SUB_ID_LAST), + EO_CLASS_DESCRIPTION_OPS(op_desc), NULL, 0, - _class_constructor, + NULL, NULL }; diff --git a/src/examples/eo/simple/simple_mixin.h b/src/examples/eo/simple/simple_mixin.h index 539504d3ad..b09ba4d5de 100644 --- a/src/examples/eo/simple/simple_mixin.h +++ b/src/examples/eo/simple/simple_mixin.h @@ -3,22 +3,12 @@ #include "Eo.h" -extern EAPI Eo_Op MIXIN_BASE_ID; - -enum { - MIXIN_SUB_ID_A_SQUARE_GET, - MIXIN_SUB_ID_LAST -}; - -#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id) - - /** * @def mixin_a_square_get(ret) * @brief Get the square of a. * @param[out] ret the square of a */ -#define mixin_a_square_get(ret) MIXIN_ID(MIXIN_SUB_ID_A_SQUARE_GET), EO_TYPECHECK(int *, ret) +EAPI int mixin_a_square_get(void); #define MIXIN_CLASS mixin_class_get() const Eo_Class *mixin_class_get(void); diff --git a/src/examples/eo/simple/simple_simple.c b/src/examples/eo/simple/simple_simple.c index 42eb1f75b2..480938ffc5 100644 --- a/src/examples/eo/simple/simple_simple.c +++ b/src/examples/eo/simple/simple_simple.c @@ -5,8 +5,6 @@ #include "Eo.h" #include "simple_simple.h" -EAPI Eo_Op SIMPLE_BASE_ID = 0; - typedef struct { int a; @@ -14,64 +12,48 @@ typedef struct #define MY_CLASS SIMPLE_CLASS -static void -_a_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +static int +_a_get(Eo *obj EINA_UNUSED, void *class_data) { const Private_Data *pd = class_data; - int *a; - a = va_arg(*list, int *); - *a = pd->a; printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + return pd->a; } static void -_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +_a_set(Eo *obj EINA_UNUSED, void *class_data, int a) { Private_Data *pd = class_data; - int a; - a = va_arg(*list, int); pd->a = a; printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); } -static void -_a_power_3_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list) +static int +_a_power_3_get(Eo *obj EINA_UNUSED, void *class_data) { const Private_Data *pd = class_data; - int *ret; - ret = va_arg(*list, int *); - if (ret) - *ret = pd->a * pd->a * pd->a; printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__); + return pd->a * pd->a * pd->a; } -static void -_class_constructor(Eo_Class *klass) -{ - const Eo_Op_Func_Description func_desc[] = { - EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set), - EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), - EO_OP_FUNC(INTERFACE_ID(INTERFACE_SUB_ID_A_POWER_3_GET), _a_power_3_get), - EO_OP_FUNC_SENTINEL - }; +EAPI EO_FUNC_BODY(simple_a_get, int, 0); +EAPI EO_VOID_FUNC_BODYV(simple_a_set, EO_FUNC_CALL(a), int a); - eo_class_funcs_set(klass, func_desc); -} - -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"), - EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_GET, "Get property A"), - EO_OP_DESCRIPTION_SENTINEL +static Eo_Op_Description op_desc[] = { + EO_OP_FUNC(simple_a_set, _a_set, "Set property A"), + EO_OP_FUNC(simple_a_get, _a_get, "Get property A"), + EO_OP_FUNC_OVERRIDE(interface_a_power_3_get, _a_power_3_get), + EO_OP_SENTINEL }; static const Eo_Class_Description class_desc = { EO_VERSION, "Simple", EO_CLASS_TYPE_REGULAR, - EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), + EO_CLASS_DESCRIPTION_OPS(op_desc), NULL, sizeof(Private_Data), - _class_constructor, + NULL, NULL }; diff --git a/src/examples/eo/simple/simple_simple.h b/src/examples/eo/simple/simple_simple.h index 36d4a00713..845a1f1a1d 100644 --- a/src/examples/eo/simple/simple_simple.h +++ b/src/examples/eo/simple/simple_simple.h @@ -5,29 +5,19 @@ #include "simple_interface.h" #include "simple_mixin.h" -extern EAPI Eo_Op SIMPLE_BASE_ID; - -enum { - SIMPLE_SUB_ID_A_SET, - SIMPLE_SUB_ID_A_GET, - SIMPLE_SUB_ID_LAST -}; - -#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id) - /** * @def simple_a_set(a) * @brief Set value to a-property * @param[in] a integer value to set */ -#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a) +EAPI void simple_a_set(int a); /** * @def simple_a_get(a) * @brief Get value of a-property * @param[out] integer pointer to a-value */ -#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a) +EAPI int simple_a_get(void); #define SIMPLE_CLASS simple_class_get() const Eo_Class *simple_class_get(void); diff --git a/src/examples/evas/evas-object-manipulation-eo.c b/src/examples/evas/evas-object-manipulation-eo.c index 5a2bdb8e8f..2621791cd3 100644 --- a/src/examples/evas/evas-object-manipulation-eo.c +++ b/src/examples/evas/evas-object-manipulation-eo.c @@ -122,7 +122,7 @@ _on_keydown(void *data EINA_UNUSED, fprintf(stdout, "Toggling clipping "); Evas_Object *clip = NULL; - eo_do(d.img, evas_obj_clip_get(&clip)); + clip = eo_do(d.img, evas_obj_clip_get()); if (clip == d.clipper) { eo_do(d.img, evas_obj_clip_unset()); @@ -141,7 +141,7 @@ _on_keydown(void *data EINA_UNUSED, Eina_Bool visibility; /* Don't use "get"-"set" expressions in one eo_do call, * if you pass parameter to "set" by value. */ - eo_do(d.clipper, evas_obj_visibility_get(&visibility)); + visibility = eo_do(d.clipper, evas_obj_visibility_get()); eo_do(d.clipper, evas_obj_visibility_set(!visibility)); fprintf(stdout, "Clipper is now %s\n", visibility ? "hidden" : "visible"); return; @@ -193,7 +193,7 @@ main(void) eo_do(d.img, evas_obj_image_filled_set(EINA_TRUE), evas_obj_image_file_set(img_path, NULL), - evas_obj_image_load_error_get(&err)); + err = evas_obj_image_load_error_get()); if (err != EVAS_LOAD_ERROR_NONE) { @@ -206,7 +206,7 @@ main(void) evas_obj_visibility_set(EINA_TRUE)); const char *type = NULL; - eo_do(d.img, evas_obj_type_get(&type)); + eo_do(d.img, type = evas_obj_type_get()); fprintf(stdout, "Image object added, type is: %s\n", type); } @@ -214,7 +214,7 @@ main(void) d.clipper_border = eo_add(EVAS_OBJ_IMAGE_CLASS, d.canvas); eo_do(d.clipper_border, evas_obj_image_filled_set(EINA_TRUE), evas_obj_image_file_set(border_img_path, NULL), - evas_obj_image_load_error_get(&err)); + err = evas_obj_image_load_error_get()); if (err != EVAS_LOAD_ERROR_NONE) {