#include "interface_interface.h"
#include "interface_simple.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_AB_SUM_GET, "Get the sum of a and b."),
- EO_OP_DESCRIPTION_SENTINEL
+EO2_FUNC_BODY(interface_ab_sum_get, int, 0);
+
+static Eo2_Op_Description op_descs[] = {
+ EO2_OP_FUNC(NULL, interface_ab_sum_get, "Get the sum of a and b."),
+ EO2_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
- EO_VERSION,
+ EO2_VERSION,
"Interface",
EO_CLASS_TYPE_INTERFACE,
- EO_CLASS_DESCRIPTION_OPS(&INTERFACE_BASE_ID, op_desc, INTERFACE_SUB_ID_LAST),
+ EO2_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
NULL,
#ifndef INTERFACE_H
#define INTERFACE_H
-extern EAPI Eo_Op INTERFACE_BASE_ID;
-
-enum {
- INTERFACE_SUB_ID_AB_SUM_GET,
- INTERFACE_SUB_ID_LAST
-};
-
-#define INTERFACE_ID(sub_id) (INTERFACE_BASE_ID + sub_id)
-
-
-/**
- * @def interface_ab_sum_get(sum)
- * @brief Get sum of a,b integer elements
- * @param[out] sum integer pointer to sum - value
- */
-#define interface_ab_sum_get(sum) INTERFACE_ID(INTERFACE_SUB_ID_AB_SUM_GET), EO_TYPECHECK(int *, sum)
+EAPI int interface_ab_sum_get(void);
#define INTERFACE_CLASS interface_class_get()
const Eo_Class *interface_class_get(void);
#include "interface_interface2.h"
#include "interface_simple.h"
-EAPI Eo_Op INTERFACE2_BASE_ID = 0;
-
#define MY_CLASS INTERFACE2_CLASS
-static const Eo_Op_Description op_desc[] = {
- EO_OP_DESCRIPTION(INTERFACE2_SUB_ID_AB_SUM_GET2, "Print the sum of a and b."),
- EO_OP_DESCRIPTION_SENTINEL
+EO2_FUNC_BODY(interface2_ab_sum_get2, int, 0);
+
+static Eo2_Op_Description op_descs[] = {
+ EO2_OP_FUNC(NULL, interface2_ab_sum_get2, "Print the sum of a and b."),
+ EO2_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
- EO_VERSION,
+ EO2_VERSION,
"Interface2",
EO_CLASS_TYPE_INTERFACE,
- EO_CLASS_DESCRIPTION_OPS(&INTERFACE2_BASE_ID, op_desc, INTERFACE2_SUB_ID_LAST),
+ EO2_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
NULL,
#ifndef INTERFACE2_H
#define INTERFACE2_H
-extern EAPI Eo_Op INTERFACE2_BASE_ID;
-
-enum {
- INTERFACE2_SUB_ID_AB_SUM_GET2,
- INTERFACE2_SUB_ID_LAST
-};
-
-#define INTERFACE2_ID(sub_id) (INTERFACE2_BASE_ID + sub_id)
-
-
-/**
- * @def interface2_ab_sum_get2(sum)
- * @brief Get sum of a,b integer elements
- * @param[out] sum integer pointer to sum - value
- */
-#define interface2_ab_sum_get2(sum) INTERFACE2_ID(INTERFACE2_SUB_ID_AB_SUM_GET2), EO_TYPECHECK(int *, sum)
+EAPI int interface2_ab_sum_get2(void);
#define INTERFACE2_CLASS interface2_class_get()
const Eo_Class *interface2_class_get(void);
(void) argv;
eo_init();
- Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+ Eo *obj = eo2_add(SIMPLE_CLASS, NULL);
- eo_do(obj, simple_a_set(1), simple_b_set(2));
+ eo2_do(obj, simple_a_set(1), simple_b_set(2));
int a, b, sum = 0;
- eo_do(obj, simple_a_get(&a), simple_b_get(&b), interface_ab_sum_get(&sum));
+ eo2_do(obj, a = simple_a_get(), b = simple_b_get(), sum = interface_ab_sum_get());
fail_if(sum != a + b);
sum = 0;
- eo_do(obj, interface_ab_sum_get(&sum), interface_ab_sum_get(&sum));
+ eo2_do(obj, sum = interface_ab_sum_get(), sum = interface_ab_sum_get());
fail_if(sum != a + b);
- eo_do(obj, interface2_ab_sum_get2(&sum), interface2_ab_sum_get2(&sum));
+ eo2_do(obj, sum = interface2_ab_sum_get2(), sum = interface2_ab_sum_get2());
fail_if(sum != a + b + 1);
eo_unref(obj);
#define MY_CLASS SIMPLE_CLASS
#define _GET_SET_FUNC(name) \
-static void \
-_##name##_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list) \
+static int \
+_##name##_get(Eo *obj EINA_UNUSED, void *class_data) \
{ \
const Private_Data *pd = class_data; \
- int *name; \
- name = va_arg(*list, int *); \
- *name = pd->name; \
printf("%s %d\n", __func__, pd->name); \
+ return pd->name; \
} \
static void \
-_##name##_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) \
+_##name##_set(Eo *obj EINA_UNUSED, void *class_data, int name) \
{ \
Private_Data *pd = class_data; \
- int name; \
- name = va_arg(*list, int); \
pd->name = name; \
printf("%s %d\n", __func__, pd->name); \
-}
+} \
+EO2_VOID_FUNC_BODYV(simple_##name##_set, EO2_FUNC_CALL(name), int name); \
+EO2_FUNC_BODY(simple_##name##_get, int, 0);
_GET_SET_FUNC(a)
_GET_SET_FUNC(b)
-static void
-_ab_sum_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
+static int
+_ab_sum_get(Eo *obj, void *class_data EINA_UNUSED)
{
int a, b;
- eo_do(obj, simple_a_get(&a), simple_b_get(&b));
- int *sum = va_arg(*list, int *);
- if (sum)
- *sum = a + b;
+ eo2_do(obj, a = simple_a_get(), b = simple_b_get());
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
+ return a + b;
}
-static void
-_ab_sum_get2(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
+static int
+_ab_sum_get2(Eo *obj, void *class_data EINA_UNUSED)
{
int a, b;
- eo_do(obj, simple_a_get(&a), simple_b_get(&b));
- int *sum = va_arg(*list, int *);
- if (sum)
- *sum = a + b + 1;
+ eo2_do(obj, a = simple_a_get(), b = simple_b_get());
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
+ return a + b + 1;
}
-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(SIMPLE_ID(SIMPLE_SUB_ID_B_SET), _b_set),
- EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_B_GET), _b_get),
- EO_OP_FUNC(INTERFACE_ID(INTERFACE_SUB_ID_AB_SUM_GET), _ab_sum_get),
- EO_OP_FUNC(INTERFACE2_ID(INTERFACE2_SUB_ID_AB_SUM_GET2), _ab_sum_get2),
- EO_OP_FUNC_SENTINEL
- };
-
- 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(SIMPLE_SUB_ID_B_SET, "Set property B"),
- EO_OP_DESCRIPTION(SIMPLE_SUB_ID_B_GET, "Get property B"),
- EO_OP_DESCRIPTION_SENTINEL
+static Eo2_Op_Description op_descs[] = {
+ EO2_OP_FUNC(_a_set, simple_a_set, "Set property a"),
+ EO2_OP_FUNC(_a_get, simple_a_get, "Get property a"),
+ EO2_OP_FUNC(_b_set, simple_b_set, "Set property b"),
+ EO2_OP_FUNC(_b_get, simple_b_get, "Get property b"),
+ EO2_OP_FUNC_OVERRIDE(_ab_sum_get, interface_ab_sum_get),
+ EO2_OP_FUNC_OVERRIDE(_ab_sum_get2, interface2_ab_sum_get2),
+ EO2_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
- EO_VERSION,
+ EO2_VERSION,
"Simple",
EO_CLASS_TYPE_REGULAR,
- EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST),
+ EO2_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
sizeof(Private_Data),
- _class_constructor,
+ NULL,
NULL
};
-EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, INTERFACE2_CLASS, NULL);
+EO_DEFINE_CLASS(simple_class_get, &class_desc, EO2_BASE_CLASS, INTERFACE2_CLASS, NULL);
#ifndef SIMPLE_H
#define SIMPLE_H
-extern EAPI Eo_Op SIMPLE_BASE_ID;
-
-enum {
- SIMPLE_SUB_ID_A_SET,
- SIMPLE_SUB_ID_A_GET,
- SIMPLE_SUB_ID_B_SET,
- SIMPLE_SUB_ID_B_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)
-
-/**
- * @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)
-
-/**
- * @def simple_b_set(b)
- * @brief Set value to b-property
- * @param[in] a integer value to set
- */
-#define simple_b_set(b) SIMPLE_ID(SIMPLE_SUB_ID_B_SET), EO_TYPECHECK(int, b)
-
-/**
- * @def simple_b_get(b)
- * @brief Get value of b-property
- * @param[out] integer pointer to b-value
- */
-#define simple_b_get(b) SIMPLE_ID(SIMPLE_SUB_ID_B_GET), EO_TYPECHECK(int *, b)
+EAPI void simple_a_set(int a);
+EAPI int simple_a_get(void);
+EAPI void simple_b_set(int b);
+EAPI int simple_b_get(void);
#define SIMPLE_CLASS simple_class_get()
const Eo_Class *simple_class_get(void);