2012-09-07 14:56:44 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
#include "Eo.h"
|
2012-04-17 08:22:27 -07:00
|
|
|
#include "mixin.h"
|
|
|
|
#include "mixin2.h"
|
|
|
|
#include "simple.h"
|
|
|
|
|
2012-04-19 01:52:11 -07:00
|
|
|
#include "../eunit_tests.h"
|
|
|
|
|
2012-04-23 01:09:54 -07:00
|
|
|
#define MY_CLASS MIXIN2_CLASS
|
2012-04-17 08:22:27 -07:00
|
|
|
|
|
|
|
static void
|
2012-06-26 20:58:45 -07:00
|
|
|
_ab_sum_get(Eo *obj, void *class_data, va_list *list)
|
2012-04-17 08:22:27 -07:00
|
|
|
{
|
2012-04-24 01:04:14 -07:00
|
|
|
/* This cast is a hack just for the tests... */
|
|
|
|
Mixin2_Public_Data *pd = (Mixin2_Public_Data *) class_data;
|
2012-04-19 01:52:11 -07:00
|
|
|
int *sum = va_arg(*list, int *);
|
2012-05-01 00:40:14 -07:00
|
|
|
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
|
2012-06-26 20:58:45 -07:00
|
|
|
eo_do_super(obj, mixin_ab_sum_get(sum));
|
2012-04-19 01:52:11 -07:00
|
|
|
|
|
|
|
++*sum;
|
2012-04-19 01:52:25 -07:00
|
|
|
pd->count += 2;
|
2012-04-19 01:52:11 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
int _a, _b;
|
2012-06-26 20:58:45 -07:00
|
|
|
eo_do(obj, simple_a_get(&_a), simple_b_get(&_b));
|
2012-04-19 01:52:11 -07:00
|
|
|
fail_if(*sum != _a + _b + 1);
|
|
|
|
}
|
2012-04-17 08:22:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-10 07:04:53 -07:00
|
|
|
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
2012-04-17 08:22:27 -07:00
|
|
|
{
|
2012-06-10 07:04:53 -07:00
|
|
|
eo_do_super(obj, eo_constructor());
|
2012-04-17 08:22:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-10 07:04:53 -07:00
|
|
|
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
2012-04-17 08:22:27 -07:00
|
|
|
{
|
2012-06-10 07:04:53 -07:00
|
|
|
eo_do_super(obj, eo_destructor());
|
2012-04-17 08:22:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-01 00:40:14 -07:00
|
|
|
_class_constructor(Eo_Class *klass)
|
2012-04-17 08:22:27 -07:00
|
|
|
{
|
2012-05-01 00:40:14 -07:00
|
|
|
const Eo_Op_Func_Description func_desc[] = {
|
2012-06-10 07:04:53 -07:00
|
|
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
|
|
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
|
2012-06-26 20:58:45 -07:00
|
|
|
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
|
2012-05-01 00:40:14 -07:00
|
|
|
EO_OP_FUNC_SENTINEL
|
2012-04-17 08:22:27 -07:00
|
|
|
};
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
eo_class_funcs_set(klass, func_desc);
|
2012-04-17 08:22:27 -07:00
|
|
|
}
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
static const Eo_Class_Description class_desc = {
|
2012-07-09 02:09:46 -07:00
|
|
|
EO_VERSION,
|
2012-04-23 01:09:54 -07:00
|
|
|
"Mixin2",
|
2012-05-01 00:40:14 -07:00
|
|
|
EO_CLASS_TYPE_MIXIN,
|
|
|
|
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
2012-04-23 01:09:54 -07:00
|
|
|
NULL,
|
|
|
|
sizeof(Mixin2_Public_Data),
|
|
|
|
_class_constructor,
|
|
|
|
NULL
|
|
|
|
};
|
2012-04-17 08:22:27 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
EO_DEFINE_CLASS(mixin2_class_get, &class_desc, MIXIN_CLASS, NULL);
|
2012-04-17 08:22:27 -07:00
|
|
|
|