Move to Eo2 and adjust code accordingly

Eo2 is the new object system for the EFL, and the replacement for Eo. It
improves Eo1 in many ways that will be listed on the Wiki and discussed
on the ML before.

Another change this merge includes is using the slightly different API
eo2 offers in actual code.

For example:
eo_do(obj, elm_object_text_get(&text));
becomes:
eo_do(obj, text = elm_object_text_get());

@feature
This commit is contained in:
Tom Hacohen 2014-04-10 09:46:04 +01:00
commit 30d945307c
106 changed files with 2377 additions and 2535 deletions

32
TODO-eo2 Normal file
View File

@ -0,0 +1,32 @@
- eo_composite_attach
maybe check that the class of comp_obj is part of parent extensions
- Eo2_Call_Stack
grow/shrink
stack push and pop functions
per thread stack
- Remove the memset in do_end? Waste of cpu...
- cleanup EO2_VERSION specific code in eo.c and eo_private.c
- Move the Op_Descs to be set using a function inside the class_constructor
check if it works ASIS on windows
if it does, do nothing
- Rediscuss the whole attribute cleanup thing. I'm not sure we want that as everything breaks if that isn't there. Embedded old gcc?
- function name from pointer
dladdr backtrace ??
- Get rid of some of the EO2_VOID_FUNC_BODY?
- Add line number to errors (like in eo1...)
- A bit annoying that we don't get type checks on the callbacks, fix that? That's really dangerous!
- Get all the optimisations cedric has been doing to Eo1? I think that's where the children thing got lost...
- Make sure all the improvements have been migrated...
- Fix all the FIXME

View File

@ -10,8 +10,8 @@ lib_eo_libeo_la_SOURCES = \
lib/eo/eo.c \
lib/eo/eo_ptr_indirection.c \
lib/eo/eo_ptr_indirection.h \
lib/eo/eo_class_class.c \
lib/eo/eo_base_class.c \
lib/eo/eo_class_class.c \
lib/eo/eo_private.h
lib_eo_libeo_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EO_CFLAGS@
@ -91,9 +91,13 @@ tests/eo/suite/eo_test_class_simple.c \
tests/eo/suite/eo_test_class_simple.h \
tests/eo/suite/eo_suite.c \
tests/eo/suite/eo_suite.h \
tests/eo/suite/eo_error_msgs.h \
tests/eo/suite/eo_error_msgs.c \
tests/eo/suite/eo_test_class_errors.c \
tests/eo/suite/eo_test_call_errors.c \
tests/eo/suite/eo_test_general.c \
tests/eo/suite/eo_test_value.c \
tests/eo/suite/eo_test_threaded_calls.c \
tests/eo/suite/eo_test_init.c
tests_eo_eo_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eo\" \

View File

@ -46,5 +46,5 @@ static const Eo_Class_Description class_desc = {
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL)
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL)

View File

@ -3,7 +3,7 @@
#include <Eina.h>
//#define EO
#define EO
extern int _eolian_gen_log_dom;

View File

@ -167,7 +167,6 @@ eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function
char *fsuffix = "";
rettype = eolian_function_return_type_get(func, ftype);
if (rettype && !strcmp(rettype, "void")) rettype = NULL;
if (ftype == EOLIAN_PROP_GET)
{
fsuffix = "_get";
@ -468,7 +467,6 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
Eina_Strbuf *full_params = eina_strbuf_new(); /* variables types + names */
rettype = eolian_function_return_type_get(funcid, ftype);
if (rettype && !strcmp(rettype, "void")) rettype = NULL;
retname = "ret";
if (ftype == EOLIAN_PROP_GET)
{

View File

@ -266,7 +266,7 @@ main(int argc, const char *argv[])
{
if (!strncmp(val, "freq=", 5)) {
freq = atoi(&val[5]);
eo_do(in, eo_base_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
} else if (!strncmp(val, "duration=", 9)) {
eo_do(in, ecore_audio_obj_in_length_set(atof(&val[9])));
}

View File

@ -143,4 +143,4 @@ static const Eo_Class_Description class_desc = {
NULL
};
EO_DEFINE_CLASS(evas_object_class_get, &class_desc, EO_BASE_CLASS, NULL)
EO_DEFINE_CLASS(evas_object_class_get, &class_desc, EO_CLASS, NULL)

View File

@ -76,7 +76,7 @@ static inline Evas_Object *
eo_evas_object_get(const Eo *obj)
{
void *data;
eo_do((Eo *) obj, eo_base_data_get(EXEVAS_OBJ_STR, &data));
eo_do((Eo *) obj, eo_key_data_get(EXEVAS_OBJ_STR, &data));
return data;
}
@ -84,7 +84,7 @@ eo_evas_object_get(const Eo *obj)
static inline void
eo_evas_object_set(Eo *obj, Evas_Object *evas_obj)
{
eo_do(obj, eo_base_data_set(EXEVAS_OBJ_STR, evas_obj, NULL));
eo_do(obj, eo_key_data_set(EXEVAS_OBJ_STR, evas_obj, NULL));
}
#endif

View File

@ -75,4 +75,4 @@ static const Eo_Class_Description class_desc = {
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);

View File

@ -75,4 +75,4 @@ static const Eo_Class_Description class_desc = {
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, INTERFACE_CLASS, MIXIN_CLASS, NULL);

View File

@ -431,7 +431,7 @@ ecore_timer_freeze_get(Ecore_Timer *timer)
{
int r = 0;
eo_do(timer, eo_event_freeze_get(&r));
eo_do(timer, r = eo_event_freeze_get());
return !!r;
}

View File

@ -110,7 +110,7 @@ class Ecore_Audio (Eo_Base)
params {
Ecore_Audio_Vio *vio; /*The @ref Ecore_Audio_Vio struct with the function callbacks*/
void *data; /*User data to pass to the VIO functions*/
eo_base_data_free_func free_func; /*This function takes care to clean up @ref data when he VIO is destroyed. NULL means do nothing.*/
eo_key_data_free_func free_func; /*This function takes care to clean up @ref data when he VIO is destroyed. NULL means do nothing.*/
}
}
}

View File

@ -3,10 +3,10 @@ class Ecore_Audio_In_Tone (Ecore_Audio_In)
eo_prefix: ecore_audio_obj_in_tone;
implements {
Eo_Base::constructor;
Eo_Base::data_set;
Eo_Base::data_get;
Eo_Base::key_data_set;
Eo_Base::key_data_get;
Ecore_Audio_In::length::set;
Ecore_Audio_In::seek;
Ecore_Audio_In::read_internal;
}
}
}

View File

@ -175,7 +175,7 @@ enum Ecore_Audio_Obj_Sub_Ids
* @param[in] free_func This function takes care to clean up @ref data when
* the VIO is destroyed. NULL means do nothing.
*/
#define ecore_audio_obj_vio_set(vio, data, free_func) ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), EO_TYPECHECK(Ecore_Audio_Vio *, vio), EO_TYPECHECK(void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func)
#define ecore_audio_obj_vio_set(vio, data, free_func) ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), EO_TYPECHECK(Ecore_Audio_Vio *, vio), EO_TYPECHECK(void *, data), EO_TYPECHECK(eo_key_data_free_func, free_func)
#endif
/**

View File

@ -27,7 +27,7 @@ _ecore_audio_in_speed_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, double
obj->speed = speed;
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL));
}
EOLIAN static double
@ -41,7 +41,7 @@ _ecore_audio_in_samplerate_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, i
{
obj->samplerate = samplerate;
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL));
}
EOLIAN static int
@ -88,8 +88,8 @@ _ecore_audio_in_remaining_get(Eo *eo_obj, Ecore_Audio_Input *obj)
{
if (!obj->seekable) return -1;
else {
double ret;
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, &ret));
double ret = 0.0;
eo_do(eo_obj, ret = ecore_audio_obj_in_seek(0, SEEK_CUR));
return obj->length - ret;
}
}
@ -104,14 +104,14 @@ _ecore_audio_in_read(Eo *eo_obj, Ecore_Audio_Input *obj, void *buf, size_t len)
memset(buf, 0, len);
len_read = len;
} else {
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
eo_do(eo_obj, len_read = ecore_audio_obj_in_read_internal(buf, len));
if (len_read == 0) {
if (!obj->looped || !obj->seekable) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_STOPPED, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_STOPPED, NULL));
} else {
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL));
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_LOOPED, NULL, NULL));
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET));
eo_do(eo_obj, len_read = ecore_audio_obj_in_read_internal(buf, len));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_LOOPED, NULL));
}
}
@ -149,7 +149,7 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
}
EOLIAN static void
_ecore_audio_in_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_Input *obj, Ecore_Audio_Vio *vio, void *data, eo_base_data_free_func free_func)
_ecore_audio_in_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_Input *obj, Ecore_Audio_Vio *vio, void *data, eo_key_data_free_func free_func)
{
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
@ -182,7 +182,7 @@ EOLIAN static void
_ecore_audio_in_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Input *obj)
{
if(obj->output)
eo_do(obj->output, ecore_audio_obj_out_input_detach(eo_obj, NULL));
eo_do(obj->output, ecore_audio_obj_out_input_detach(eo_obj));
eo_do_super(eo_obj, MY_CLASS, eo_destructor());
}

View File

@ -142,7 +142,7 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
}
EOLIAN static void
_ecore_audio_in_sndfile_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_In_Sndfile_Data *obj, Ecore_Audio_Vio *vio, void *data, eo_base_data_free_func free_func)
_ecore_audio_in_sndfile_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_In_Sndfile_Data *obj, Ecore_Audio_Vio *vio, void *data, eo_key_data_free_func free_func)
{
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
Ecore_Audio_Input *in_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_IN_CLASS);

View File

@ -83,26 +83,26 @@ _ecore_audio_in_tone_ecore_audio_in_length_set(Eo *eo_obj, Ecore_Audio_In_Tone_D
}
EOLIAN static void
_ecore_audio_in_tone_eo_base_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key, const void *val, eo_base_data_free_func func)
_ecore_audio_in_tone_eo_base_key_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key, const void *val, eo_key_data_free_func func)
{
if (!key) return;
if (!strcmp(key, ECORE_AUDIO_ATTR_TONE_FREQ)) {
obj->freq = *(int *)val;
} else {
eo_do_super(eo_obj, MY_CLASS, eo_base_data_set(key, val, func));
eo_do_super(eo_obj, MY_CLASS, eo_key_data_set(key, val, func));
}
}
EOLIAN static void*
_ecore_audio_in_tone_eo_base_data_get(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key)
_ecore_audio_in_tone_eo_base_key_data_get(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key)
{
if (!strcmp(key, ECORE_AUDIO_ATTR_TONE_FREQ)) {
return (void *) (intptr_t) obj->freq;
} else {
void *ret = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_base_data_get(key, &ret));
eo_do_super(eo_obj, MY_CLASS, ret = eo_key_data_get(key));
return ret;
}
}

View File

@ -37,7 +37,7 @@ extern "C"
/**
* @brief The frequency of the tone in Hz
*
* Set with @ref eo_base_data_set()
* Set with @ref eo_key_data_set()
*/
#define ECORE_AUDIO_ATTR_TONE_FREQ "ecore_audio_freq"

View File

@ -25,7 +25,7 @@ static Eina_Bool _write_cb(void *data)
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
ssize_t written, bread;
ssize_t written, bread = 0;
float buf[1024];
if (!ea_obj->vio || !ea_obj->vio->vio->write)
@ -34,7 +34,7 @@ static Eina_Bool _write_cb(void *data)
/* FIXME: Multiple inputs */
in = eina_list_data_get(out_obj->inputs);
eo_do(in, ecore_audio_obj_in_read(buf, 4*1024, &bread));
eo_do(in, bread = ecore_audio_obj_in_read(buf, 4*1024));
if (bread == 0) {
ea_obj->paused = EINA_TRUE;
@ -61,7 +61,7 @@ _ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Output *obj, Eo *input)
if (in->output == eo_obj)
return EINA_FALSE;
if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input, NULL));
if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input));
in->output = eo_obj;
/* TODO: Send event */
@ -113,7 +113,7 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
}
EOLIAN static void
_ecore_audio_out_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_Output *_pd EINA_UNUSED, Ecore_Audio_Vio *vio, void *data, eo_base_data_free_func free_func)
_ecore_audio_out_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_Output *_pd EINA_UNUSED, Ecore_Audio_Vio *vio, void *data, eo_key_data_free_func free_func)
{
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
@ -144,7 +144,7 @@ _ecore_audio_out_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Output *obj)
Eo *in;
EINA_LIST_FOREACH_SAFE(obj->inputs, cur, tmp, in) {
eo_do(eo_obj, ecore_audio_obj_out_input_detach(in, NULL));
eo_do(eo_obj, ecore_audio_obj_out_input_detach(in));
}
eo_do_super(eo_obj, MY_CLASS, eo_destructor());

View File

@ -46,7 +46,7 @@ EOLIAN static void
_ecore_audio_out_pulse_ecore_audio_volume_set(Eo *eo_obj, Ecore_Audio_Out_Pulse_Data *_pd EINA_UNUSED, double volume)
{
Eo *in;
pa_stream *stream;
pa_stream *stream = NULL;
Eina_List *input;
uint32_t idx;
pa_cvolume pa_volume;
@ -60,7 +60,7 @@ _ecore_audio_out_pulse_ecore_audio_volume_set(Eo *eo_obj, Ecore_Audio_Out_Pulse_
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_volume_set(volume));
EINA_LIST_FOREACH(out_obj->inputs, input, in) {
eo_do(in, eo_base_data_get("pulse_data", (void **)&stream));
eo_do(in, stream = eo_key_data_get("pulse_data"));
idx = pa_stream_get_index(stream);
pa_operation_unref(pa_context_set_sink_input_volume(class_vars.context, idx, &pa_volume, NULL, NULL));
}
@ -72,12 +72,12 @@ static void _write_cb(pa_stream *stream, size_t len, void *data)
Eo *in = data;
void *buf;
ssize_t bread;
ssize_t bread = 0;
size_t wlen = len;
pa_stream_begin_write(stream, &buf, &wlen);
eo_do(in, ecore_audio_obj_in_read(buf, wlen, &bread));
eo_do(in, bread = ecore_audio_obj_in_read(buf, wlen));
pa_stream_write(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE);
if (bread < (int)len)
@ -88,14 +88,14 @@ static void _write_cb(pa_stream *stream, size_t len, void *data)
static Eina_Bool _update_samplerate_cb(void *data EINA_UNUSED, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
{
pa_stream *stream;
int samplerate;
double speed;
pa_stream *stream = NULL;
int samplerate = 0;
double speed = 0;
eo_do(eo_obj, ecore_audio_obj_in_samplerate_get(&samplerate));
eo_do(eo_obj, ecore_audio_obj_in_speed_get(&speed));
eo_do(eo_obj, samplerate = ecore_audio_obj_in_samplerate_get());
eo_do(eo_obj, speed = ecore_audio_obj_in_speed_get());
eo_do(eo_obj, eo_base_data_get("pulse_data", (void **)&stream));
eo_do(eo_obj, stream = eo_key_data_get("pulse_data"));
pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL));
@ -104,35 +104,35 @@ static Eina_Bool _update_samplerate_cb(void *data EINA_UNUSED, Eo *eo_obj, const
static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
{
const char *name;
const char *name = NULL;
pa_sample_spec ss;
double speed;
double speed = 0;
pa_stream *stream;
Eina_Bool ret;
Eina_Bool ret = EINA_FALSE;
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret));
eo_do_super(eo_obj, MY_CLASS, ret = ecore_audio_obj_out_input_attach(in));
if (!ret)
return EINA_FALSE;
ss.format = PA_SAMPLE_FLOAT32LE;
eo_do(in, ecore_audio_obj_in_samplerate_get((int *)&ss.rate));
eo_do(in, ecore_audio_obj_in_speed_get(&speed));
eo_do(in, ecore_audio_obj_in_channels_get((int *)&ss.channels));
eo_do(in, ecore_audio_obj_name_get(&name));
eo_do(in, ss.rate = ecore_audio_obj_in_samplerate_get());
eo_do(in, speed = ecore_audio_obj_in_speed_get());
eo_do(in, ss.channels = ecore_audio_obj_in_channels_get());
eo_do(in, name = ecore_audio_obj_name_get());
ss.rate = ss.rate * speed;
stream = pa_stream_new(class_vars.context, name, &ss, NULL);
if (!stream) {
ERR("Could not create stream");
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, NULL));
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in));
return EINA_FALSE;
}
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj));
eo_do(in, eo_base_data_set("pulse_data", stream, NULL));
eo_do(in, eo_key_data_set("pulse_data", stream, NULL));
pa_stream_set_write_callback(stream, _write_cb, in);
@ -178,14 +178,14 @@ static void _drain_cb(pa_stream *stream, int success EINA_UNUSED, void *data EIN
EOLIAN static Eina_Bool
_ecore_audio_out_pulse_ecore_audio_out_input_detach(Eo *eo_obj, Ecore_Audio_Out_Pulse_Data *_pd EINA_UNUSED, Eo *in)
{
pa_stream *stream;
Eina_Bool ret2;
pa_stream *stream = NULL;
Eina_Bool ret2 = EINA_FALSE;
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, &ret2));
eo_do_super(eo_obj, MY_CLASS, ret2 = ecore_audio_obj_out_input_detach(in));
if (!ret2)
return EINA_FALSE;
eo_do(in, eo_base_data_get("pulse_data", (void **)&stream));
eo_do(in, stream = eo_key_data_get("pulse_data"));
pa_stream_set_write_callback(stream, NULL, NULL);
pa_operation_unref(pa_stream_drain(stream, _drain_cb, NULL));
@ -210,12 +210,12 @@ static void _state_cb(pa_context *context, void *data EINA_UNUSED)
if (state == PA_CONTEXT_READY) {
DBG("PA context ready.");
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, NULL));
}
} else if ((state == PA_CONTEXT_FAILED) || (state == PA_CONTEXT_TERMINATED)) {
DBG("PA context fail.");
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL));
}
} else {
DBG("Connection state %i", state);
@ -241,7 +241,7 @@ static void _state_job(void *data EINA_UNUSED)
}
// the callback here can delete things in the list..
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL));
}
// now unref everything safely
EINA_LIST_FOREACH_SAFE(class_vars.outputs, out, tmp, eo_obj) {

View File

@ -37,13 +37,13 @@ static Eina_Bool _write_cb(void *data)
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
ssize_t written, bread;
ssize_t written, bread = 0;
float buf[1024];
/* TODO: Support mixing of multiple inputs */
in = eina_list_data_get(out_obj->inputs);
eo_do(in, ecore_audio_obj_in_read(buf, 4*1024, &bread));
eo_do(in, bread = ecore_audio_obj_in_read(buf, 4*1024));
if (bread == 0) {
sf_write_sync(obj->handle);
@ -64,21 +64,21 @@ _ecore_audio_out_sndfile_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Ou
{
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
Eina_Bool ret2;
Eina_Bool ret2 = EINA_FALSE;
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret2));
eo_do_super(eo_obj, MY_CLASS, ret2 = ecore_audio_obj_out_input_attach(in));
if (!ret2)
return EINA_FALSE;
eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate));
eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels));
eo_do(in, obj->sfinfo.samplerate = ecore_audio_obj_in_samplerate_get());
eo_do(in, obj->sfinfo.channels = ecore_audio_obj_in_channels_get());
obj->handle = sf_open(ea_obj->source, SFM_WRITE, &obj->sfinfo);
if (!obj->handle) {
eina_stringshare_del(ea_obj->source);
ea_obj->source = NULL;
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, NULL));
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in));
return EINA_FALSE;
}
@ -165,7 +165,7 @@ _ecore_audio_out_sndfile_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Out_Sndfile
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG, NULL));
eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG));
// FIXME: Use writer from output
out_obj->need_writer = EINA_FALSE;

View File

@ -94,7 +94,7 @@ struct _Ecore_Audio_Module
struct _Ecore_Audio_Vio_Internal {
Ecore_Audio_Vio *vio;
void *data;
eo_base_data_free_func free_func;
eo_key_data_free_func free_func;
};
typedef struct _Ecore_Audio_Vio_Internal Ecore_Audio_Vio_Internal;

View File

@ -193,7 +193,7 @@ _edje_edit_edje_file_set(Eo *obj, Edje_Edit *eed, const char *file, const char *
* groups).
*/
Eina_Bool int_ret = EINA_FALSE;
eo_do_super(obj, MY_CLASS, edje_obj_file_set(file, group, &int_ret));
eo_do_super(obj, MY_CLASS, int_ret = edje_obj_file_set(file, group));
if (!int_ret)
return ret;

View File

@ -264,7 +264,7 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const
{
in = eo_add(ECORE_AUDIO_OBJ_IN_TONE_CLASS, NULL);
eo_do(in, ecore_audio_obj_name_set("tone"));
eo_do(in, eo_base_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &tone->value, NULL));
eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &tone->value, NULL));
eo_do(in, ecore_audio_obj_in_length_set(duration));
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _play_finished, NULL));

View File

@ -78,7 +78,7 @@ edje_object_signal_callback_del(Evas_Object *obj, const char *emission, const ch
{
if (!obj) return NULL;
void *ret = NULL;
eo_do(obj, edje_obj_signal_callback_del(emission, source, (Edje_Signal_Cb)func, NULL, &ret));
eo_do(obj, ret = edje_obj_signal_callback_del(emission, source, (Edje_Signal_Cb)func, NULL));
return ret;
}
@ -107,7 +107,7 @@ edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, con
{
if (!obj) return NULL;
void *ret = NULL;
eo_do(obj, edje_obj_signal_callback_del(emission, source, func, data, &ret));
eo_do(obj, ret = edje_obj_signal_callback_del(emission, source, func, data));
return ret;
}

View File

@ -52,8 +52,8 @@ _edje_eo_base_dbg_info_get(Eo *eo_obj, Edje *_pd EINA_UNUSED, Eo_Dbg_Info *root)
EO_DBG_INFO_APPEND(group, "File", EINA_VALUE_TYPE_STRING, file);
EO_DBG_INFO_APPEND(group, "Group", EINA_VALUE_TYPE_STRING, edje_group);
Edje_Load_Error error;
eo_do(eo_obj, edje_obj_load_error_get(&error));
Edje_Load_Error error = EDJE_LOAD_ERROR_NONE;
eo_do(eo_obj, error = edje_obj_load_error_get());
if (error != EDJE_LOAD_ERROR_NONE)
{
EO_DBG_INFO_APPEND(group, "Error", EINA_VALUE_TYPE_STRING,
@ -363,4 +363,4 @@ _edje_mmap_set(Eo *obj, Edje *_pd EINA_UNUSED, const Eina_File *f, const char *g
return ret;
}
#include "edje.eo.c"
#include "edje.eo.c"

View File

@ -229,20 +229,6 @@ EAPI void eo_dbg_info_free(Eo_Dbg_Info *info);
* @}
*/
/**
* @def EO_TYPECHECK(type, x)
*
* Checks x is castable to type "type" and casts it to it.
* @param type The C type to check against.
* @param x the variable to test and cast.
*/
#define EO_TYPECHECK(type, x) \
({ \
type __x; \
__x = x; \
(type) __x; \
})
/**
* @typedef Eo_Op
* The Eo operation type id.
@ -255,15 +241,6 @@ typedef unsigned int Eo_Op;
*/
#define EO_NOOP ((Eo_Op) 0)
/**
* @typedef eo_op_func_type
* The type of the Op functions. This is the type of the functions used by
* Eo.
*
* @see eo_op_func_type_class
*/
typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list);
/**
* @addtogroup Eo_Events Eo's Event Handling
* @{
@ -382,71 +359,20 @@ enum _Eo_Class_Type
*/
typedef enum _Eo_Class_Type Eo_Class_Type;
/**
* @struct _Eo_Op_Func_Description
* Used to associate an Op with a func.
* @see eo_class_funcs_set
*/
struct _Eo_Op_Func_Description
{
Eo_Op op; /**< The op */
eo_op_func_type func; /**< The function to call for the op. */
Eo_Op_Type op_type; /**< The type of the op */
};
/**
* @typedef Eo_Op_Func_Description
* A convenience typedef for #_Eo_Op_Func_Description
*/
typedef struct _Eo_Op_Func_Description Eo_Op_Func_Description;
/**
* @def EO_OP_FUNC(op, func)
* A convenience macro to be used when populating the #Eo_Op_Func_Description
* array.
*/
#define EO_OP_FUNC(op, func) { op, EO_TYPECHECK(eo_op_func_type, func), EO_OP_TYPE_REGULAR }
/**
* @def EO_OP_FUNC_CLASS(op, func)
* A convenience macro to be used when populating the #Eo_Op_Func_Description
* array.
* The same as #EO_OP_FUNC but for class functions.
*
* @see EO_OP_FUNC
*/
#define EO_OP_FUNC_CLASS(op, func) { op, EO_TYPECHECK(eo_op_func_type, func), EO_OP_TYPE_CLASS }
/**
* @def EO_OP_FUNC_SENTINEL
* A convenience macro to be used when populating the #Eo_Op_Func_Description
* array. It must appear at the end of the ARRAY.
*/
#define EO_OP_FUNC_SENTINEL { 0, NULL, EO_OP_TYPE_INVALID }
/**
* @struct _Eo_Op_Description
* This struct holds the description of a specific op.
*/
struct _Eo_Op_Description
{
Eo_Op sub_op; /**< The sub_id of the op in it's class. */
const char *name; /**< The name of the op. */
const char *doc; /**< Explanation about the Op. */
Eo_Op_Type op_type; /**< The type of the Op. */
};
/**
* @typedef Eo_Op_Description
* A convenience typedef for #_Eo_Op_Description
*/
typedef struct _Eo_Op_Description Eo_Op_Description;
/**
* @def EO_VERSION
* The current version of EO.
*/
#define EO_VERSION 1
#define EO_VERSION 2
typedef struct _Eo_Op_Description
{
void *api_func; /**< The EAPI function offering this op. */
void *func; /**< The static function to call for the op. */
Eo_Op op; /**< The op. */
Eo_Op_Type op_type; /**< The type of the Op. */
const char *doc; /**< Explanation about the Op. */
} Eo_Op_Description;
/**
* @struct _Eo_Class_Description
@ -460,8 +386,7 @@ struct _Eo_Class_Description
const char *name; /**< The name of the class. */
Eo_Class_Type type; /**< The type of the class. */
struct {
Eo_Op *base_op_id;
const Eo_Op_Description *descs;
Eo_Op_Description *descs2;
size_t count;
} ops; /**< The ops description, should be filled using #EO_CLASS_DESCRIPTION_OPS */
const Eo_Event_Description **events; /**< The event descriptions for this class. */
@ -476,60 +401,6 @@ struct _Eo_Class_Description
*/
typedef struct _Eo_Class_Description Eo_Class_Description;
/**
* @def EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count)
* An helper macro to help populating #Eo_Class_Description.
* @param base_op_id A pointer to the base op id of the class.
* @param op_descs the op descriptions array.
* @param count the number of ops in the op descriptions array.
*/
#define EO_CLASS_DESCRIPTION_OPS(base_op_id, op_descs, count) { base_op_id, op_descs, count }
/**
* @def EO_OP_DESCRIPTION(op, doc)
* An helper macro to help populating #Eo_Op_Description
* @param sub_id The sub id of the op being described.
* @param doc Additional doc for the op.
* @see Eo_Op_Description
* @see EO_OP_DESCRIPTION_CLASS
* @see EO_OP_DESCRIPTION_SENTINEL
*/
#define EO_OP_DESCRIPTION(sub_id, doc) { sub_id, #sub_id, doc, EO_OP_TYPE_REGULAR }
/**
* @def EO_OP_DESCRIPTION_CLASS(op, doc)
* An helper macro to help populating #Eo_Op_Description
* This macro is the same as EO_OP_DESCRIPTION but indicates that the op's
* implementation is of type CLASS.
* @param sub_id The sub id of the op being described.
* @param doc Additional doc for the op.
* @see Eo_Op_Description
* @see EO_OP_DESCRIPTION
* @see EO_OP_DESCRIPTION_SENTINEL
*/
#define EO_OP_DESCRIPTION_CLASS(sub_id, doc) { sub_id, #sub_id, doc, EO_OP_TYPE_CLASS }
/**
* @def EO_OP_DESCRIPTION_SENTINEL
* An helper macro to help populating #Eo_Op_Description
* Should be placed at the end of the array.
* @see Eo_Op_Description
* @see EO_OP_DESCRIPTION
*/
#define EO_OP_DESCRIPTION_SENTINEL { 0, NULL, NULL, EO_OP_TYPE_INVALID }
/**
* @def EO_PARAMETER_GET
* An helper macro to get parameter with less mistake
*/
#define EO_PARAMETER_GET(Type, Name, List) Type Name = va_arg(*List, Type);
/**
* @def EO_PARAMETER_ENUM_GET
* An helper macro to get parameter that are enum with less mistake (require to ask an int)
*/
#define EO_PARAMETER_ENUM_GET(Type, Name, List) Type Name = va_arg(*List, int);
/**
* @brief Create a new class.
* @param desc the class description to create the class with.
@ -554,15 +425,6 @@ EAPI const Eo_Class *eo_class_new(const Eo_Class_Description *desc, const Eo_Cla
*/
EAPI Eina_Bool eo_isa(const Eo *obj, const Eo_Class *klass);
/**
* @brief Sets the OP functions for a class.
* @param klass the class to set the functions to.
* @param func_descs a NULL terminated array of #Eo_Op_Func_Description
*
* Should be called from within the class constructor.
*/
EAPI void eo_class_funcs_set(Eo_Class *klass, const Eo_Op_Func_Description *func_descs);
/**
* @brief Gets the name of the passed class.
* @param klass the class to work on.
@ -592,73 +454,139 @@ EAPI Eina_Bool eo_init(void);
*/
EAPI Eina_Bool eo_shutdown(void);
/**
* @def eo_do
* A convenience wrapper around eo_do_internal()
* @see eo_do_internal
*/
#define eo_do(obj, ...) eo_do_internal(__FILE__, __LINE__, obj, __VA_ARGS__, EO_NOOP)
// computes size of Eo_Op_Description[]
#define EO_OP_DESC_SIZE(desc) (sizeof(desc)/sizeof(*desc) - 1)
/**
* @def eo_vdo
* A convenience wrapper around eo_vdo_internal()
* @see eo_vdo_internal
*/
#define eo_vdo(obj, args) eo_vdo_internal(__FILE__, __LINE__, obj, args)
// Helpers macro to help populating #Eo_Class_Description.
#define EO_CLASS_DESCRIPTION_NOOPS() { NULL, 0}
#define EO_CLASS_DESCRIPTION_OPS(op_descs) { op_descs, EO_OP_DESC_SIZE(op_descs) }
/**
* @brief Calls op functions of an object
* @param obj The object to work on
* @param ... NULL terminated list of OPs and parameters.
* @return @c EINA_TRUE on success.
*
* Use the helper macros, don't pass the parameters manually.
* Use #eo_do instead of this function.
*
* @see #eo_do
*/
EAPI Eina_Bool eo_do_internal(const char *file, int line, const Eo *obj, ...);
// to fetch internal function and object data at once
typedef struct _Eo_Op_Call_Data
{
Eo *obj;
Eo_Class *klass; // remove this not necessary in Eo_Hook_Call
void *func;
void *data;
} Eo_Op_Call_Data;
/**
* @brief Calls op functions of an object
* @param obj The object to work on
* @param ops NULL terminated list of OPs and parameters.
* @return @c EINA_TRUE on success.
*
* Use the helper macros, don't pass the parameters manually.
* Use #eo_vdo instead of this function.
*
* @see #eo_vdo
*/
EAPI Eina_Bool eo_vdo_internal(const char *file, int line, const Eo *obj, va_list *ops);
typedef void (*Eo_Hook_Call)(const Eo_Class *klass_id, const Eo *obj, void *func, ...);
/**
* @brief Calls the super function for the specific op.
* @param obj The object to work on
* @param cur_klass The *current* class (use the class *after* this in the MRO).
* @param ... list of parameters.
* @return @c EINA_TRUE on success.
*
* Unlike eo_do(), this function only accepts one op.
*
* @see #eo_do
*/
#define eo_do_super(obj, cur_klass, ...) eo_do_super_internal(__FILE__, __LINE__, obj, cur_klass, __VA_ARGS__)
EAPI extern Eo_Hook_Call eo_hook_call_pre;
EAPI extern Eo_Hook_Call eo_hook_call_post;
/**
* @brief Calls the super function for the specific op.
* @param obj The object to work on
* @param cur_klass The *current* class (use the class *after* this in the MRO).
* @param op The wanted op.
* @param ... list of parameters.
* @return @c EINA_TRUE on success.
*
* Don't use this function, use the wrapping macros instead.
*
* @see #eo_do
* @see #eo_do_super
*/
EAPI Eina_Bool eo_do_super_internal(const char *file, int line, const Eo *obj, const Eo_Class *cur_klass, Eo_Op op, ...);
// to pass the internal function call to EO_FUNC_BODY (as Func parameter)
#define EO_FUNC_CALL(...) __VA_ARGS__
#define EO_HOOK_CALL_PREPARE(Hook) \
if (Hook) \
Hook(call.klass, call.obj, call.func);
#define EO_HOOK_CALL_PREPAREV(Hook, ...) \
if (Hook) \
Hook(call.klass, call.obj, call.func, __VA_ARGS__);
// cache OP id, get real fct and object data then do the call
#define EO_FUNC_COMMON_OP(Name, DefRet) \
Eo_Op_Call_Data call; \
static Eo_Op op = EO_NOOP; \
if (op == EO_NOOP) \
op = _eo_api_op_id_get((void*) Name, __FILE__, __LINE__); \
if (!_eo_call_resolve(#Name, op, &call, __FILE__, __LINE__)) return DefRet; \
_Eo_##Name##_func _func_ = (_Eo_##Name##_func) call.func; \
// to define an EAPI function
#define EO_FUNC_BODY(Name, Ret, DefRet) \
Ret \
Name(void) \
{ \
typedef Ret (*_Eo_##Name##_func)(Eo *, void *obj_data); \
Ret _r; \
EO_FUNC_COMMON_OP(Name, DefRet); \
EO_HOOK_CALL_PREPARE(eo_hook_call_pre); \
_r = _func_(call.obj, call.data); \
EO_HOOK_CALL_PREPARE(eo_hook_call_post); \
return _r; \
}
#define EO_VOID_FUNC_BODY(Name) \
void \
Name(void) \
{ \
typedef void (*_Eo_##Name##_func)(Eo *, void *obj_data); \
EO_FUNC_COMMON_OP(Name, ); \
EO_HOOK_CALL_PREPARE(eo_hook_call_pre); \
_func_(call.obj, call.data); \
EO_HOOK_CALL_PREPARE(eo_hook_call_post); \
}
#define EO_FUNC_BODYV(Name, Ret, DefRet, Arguments, ...) \
Ret \
Name(__VA_ARGS__) \
{ \
typedef Ret (*_Eo_##Name##_func)(Eo *, void *obj_data, __VA_ARGS__); \
Ret _r; \
EO_FUNC_COMMON_OP(Name, DefRet); \
EO_HOOK_CALL_PREPAREV(eo_hook_call_pre, Arguments); \
_r = _func_(call.obj, call.data, Arguments); \
EO_HOOK_CALL_PREPAREV(eo_hook_call_post, Arguments); \
return _r; \
}
#define EO_VOID_FUNC_BODYV(Name, Arguments, ...) \
void \
Name(__VA_ARGS__) \
{ \
typedef void (*_Eo_##Name##_func)(Eo *, void *obj_data, __VA_ARGS__); \
EO_FUNC_COMMON_OP(Name, ); \
EO_HOOK_CALL_PREPAREV(eo_hook_call_pre, Arguments); \
_func_(call.obj, call.data, Arguments); \
EO_HOOK_CALL_PREPAREV(eo_hook_call_post, Arguments); \
}
// OP ID of an overriding function
#define EO_OP_OVERRIDE ((Eo_Op) -1)
#define EO_OP_FUNC(_api, _private, _doc) {_api, _private, EO_NOOP, EO_OP_TYPE_REGULAR, _doc}
#define EO_OP_CLASS_FUNC(_api, _private, _doc) {_api, _private, EO_NOOP, EO_OP_TYPE_CLASS, _doc}
#define EO_OP_FUNC_OVERRIDE(_api, _private) {_api, _private, EO_OP_OVERRIDE, EO_OP_TYPE_REGULAR, NULL}
#define EO_OP_CLASS_FUNC_OVERRIDE(_api, _private) {_api, _private, EO_OP_OVERRIDE, EO_OP_TYPE_CLASS, NULL}
#define EO_OP_SENTINEL { NULL, NULL, 0, EO_OP_TYPE_INVALID, NULL}
// returns the OP id corresponding to the given api_func
EAPI Eo_Op _eo_api_op_id_get(const void *api_func, const char *file, int line);
// gets the real function pointer and the object data
EAPI Eina_Bool _eo_call_resolve(const char *func_name, const Eo_Op op, Eo_Op_Call_Data *call, const char *file, int line);
// start of eo_do barrier, gets the object pointer and ref it, put it on the stask
EAPI Eina_Bool _eo_do_start(const Eo *obj, const Eo_Class *cur_klass, Eina_Bool is_super, const char *file, const char *func, int line);
// end of the eo_do barrier, unref the obj, move the stack pointer
EAPI void _eo_do_end(const Eo **ojb);
#define EO_DO_CLEANUP __attribute__((cleanup(_eo_do_end)))
// eo object method calls batch,
#define _eo_do_common(eoid, clsid, is_super, ...) \
do \
{ \
const Eo *_eoid_ = eoid; \
if (_eo_do_start(_eoid_, clsid, is_super, __FILE__, __FUNCTION__, __LINE__)) \
{ \
const Eo *_id_clean_ EO_DO_CLEANUP = _eoid_; \
__VA_ARGS__; \
(void) _id_clean_; \
} \
} while (0)
#define eo_do(eoid, ...) _eo_do_common(eoid, NULL, EINA_FALSE, __VA_ARGS__)
#define eo_do_super(eoid, clsid, func) _eo_do_common(eoid, clsid, EINA_TRUE, func)
/*****************************************************************************/
/**
* @brief Gets the class of the object.
@ -695,7 +623,13 @@ EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line);
#define eo_add(klass, parent, ...) \
({ \
const Eo_Class *_tmp_klass = klass; \
eo_add_internal(__FILE__, __LINE__, _tmp_klass, parent, eo_constructor(), ## __VA_ARGS__, EO_NOOP); \
Eo *_tmp_obj = _eo_add_internal_start(__FILE__, __LINE__, _tmp_klass, parent); \
eo_do(_tmp_obj, \
eo_constructor(); \
__VA_ARGS__; \
_tmp_obj = _eo_add_internal_end(__FILE__, __LINE__, _tmp_obj); \
); \
_tmp_obj; \
})
/**
@ -711,22 +645,16 @@ EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line);
#define eo_add_custom(klass, parent, ...) \
({ \
const Eo_Class *_tmp_klass = klass; \
eo_add_internal(__FILE__, __LINE__, _tmp_klass, parent, ## __VA_ARGS__, EO_NOOP); \
Eo *_tmp_obj = _eo_add_internal_start(__FILE__, __LINE__, _tmp_klass, parent); \
eo_do(_tmp_obj, \
__VA_ARGS__; \
_tmp_obj = _eo_add_internal_end(__FILE__, __LINE__, _tmp_obj); \
); \
_tmp_obj; \
})
/**
* @brief Create a new object.
* @param klass the class of the object to create.
* @param parent the parent to set to the object.
* @param ... The ops to run. With the constructor being first.
* @return An handle to the new object on success, NULL otherwise.
*
* Use the helper macros, don't pass the parameters manually.
* Use #eo_add or #eo_add_custom instead of this function.
*
* @see #eo_add
*/
EAPI Eo *eo_add_internal(const char *file, int line, const Eo_Class *klass, Eo *parent, ...);
EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent);
EAPI Eo * _eo_add_internal_end(const char *file, int line, const Eo *obj);
/**
* @brief Get a pointer to the data of an object for a specific class.
@ -993,16 +921,6 @@ EAPI Eina_Bool eo_composite_is(const Eo *comp_obj);
* */
EAPI const Eo_Class *eo_class_class_get(void);
/**
* @var EO_CLASS_CLASS_BASE_ID
* #EO_CLASS_CLASS 's base id.
*/
extern EAPI Eo_Op EO_CLASS_CLASS_BASE_ID;
enum {
EO_CLASS_CLASS_SUB_ID_LAST
};
/**
* @}
*/
@ -1013,105 +931,59 @@ enum {
*/
/**
* @def EO_BASE_CLASS
* @def EO_CLASS
* The class type for the Eo base class.
*/
#define EO_BASE_CLASS eo_base_class_get()
#define EO_CLASS eo_base_class_get()
/**
* @brief Use #EO_BASE_CLASS
* @brief Use #EO_CLASS
* @internal
* */
EAPI const Eo_Class *eo_base_class_get(void);
/**
* @typedef eo_base_data_free_func
* @typedef eo_key_data_free_func
* Data free func prototype.
*/
typedef void (*eo_base_data_free_func)(void *);
typedef void (*eo_key_data_free_func)(void *);
/**
* @var EO_BASE_BASE_ID
* #EO_BASE_CLASS 's base id.
*/
extern EAPI Eo_Op EO_BASE_BASE_ID;
enum {
EO_BASE_SUB_ID_CONSTRUCTOR,
EO_BASE_SUB_ID_DESTRUCTOR,
EO_BASE_SUB_ID_PARENT_SET,
EO_BASE_SUB_ID_PARENT_GET,
EO_BASE_SUB_ID_CHILDREN_ITERATOR_NEW,
EO_BASE_SUB_ID_DATA_SET,
EO_BASE_SUB_ID_DATA_GET,
EO_BASE_SUB_ID_DATA_DEL,
EO_BASE_SUB_ID_WREF_ADD,
EO_BASE_SUB_ID_WREF_DEL,
EO_BASE_SUB_ID_EVENT_CALLBACK_PRIORITY_ADD,
EO_BASE_SUB_ID_EVENT_CALLBACK_DEL,
EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_PRIORITY_ADD,
EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_DEL,
EO_BASE_SUB_ID_EVENT_CALLBACK_CALL,
EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_ADD,
EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_DEL,
EO_BASE_SUB_ID_EVENT_FREEZE,
EO_BASE_SUB_ID_EVENT_THAW,
EO_BASE_SUB_ID_EVENT_FREEZE_GET,
EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE,
EO_BASE_SUB_ID_EVENT_GLOBAL_THAW,
EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET,
EO_BASE_SUB_ID_DBG_INFO_GET,
EO_BASE_SUB_ID_LAST
};
/**
* @def EO_BASE_ID(sub_id)
* Helper macro to get the full Op ID out of the sub_id for EO_BASE.
* @param sub_id the sub id inside EO_BASE.
*/
#define EO_BASE_ID(sub_id) (EO_BASE_BASE_ID + (sub_id))
/**
* @def eo_base_data_set(key, data, free_func)
* Set generic data to object.
* @brief Set generic data to object.
* @param[in] key the key associated with the data
* @param[in] data the data to set.
* @param[in] free_func the func to free data with (NULL means "do nothing").
*
* @see #eo_base_data_get
* @see #eo_base_data_del
* @see #eo_key_data_get
* @see #eo_key_data_del
*/
#define eo_base_data_set(key, data, free_func) EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(const void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func)
EAPI void eo_key_data_set(const char *key, const void *data, eo_key_data_free_func free_func);
/**
* @def eo_base_data_get(key, data)
* Get generic data from object.
* @brief Get generic data from object.
* @param[in] key the key associated with the data
* @param[out] data the data for the key
*
* @see #eo_base_data_set
* @see #eo_base_data_del
* @see #eo_key_data_set
* @see #eo_key_data_del
*/
#define eo_base_data_get(key, data) EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(void **, data)
EAPI void *eo_key_data_get(const char *key);
/**
* @def eo_dbg_info_get(root_node)
* Get dbg information from the object.
* @brief Get dbg information from the object.
* @param[in] root node of the tree
*/
#define eo_dbg_info_get(root_node) EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), EO_TYPECHECK(Eo_Dbg_Info *, root_node)
EAPI void eo_dbg_info_get(Eo_Dbg_Info *root_node);
/**
* @def eo_base_data_del(key)
* Del generic data from object.
* @brief Del generic data from object.
* @param[in] key the key associated with the data
*
* @see #eo_base_data_set
* @see #eo_base_data_get
* @see #eo_key_data_set
* @see #eo_key_data_get
*/
#define eo_base_data_del(key) EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), EO_TYPECHECK(const char *, key)
EAPI void eo_key_data_del(const char *key);
/**
* @def eo_parent_set
* @brief Set the parent of an object
* @param[in] parent the new parent.
*
@ -1122,29 +994,26 @@ enum {
* @see eo_del()
* @see eo_parent_get()
*/
#define eo_parent_set(parent) EO_BASE_ID(EO_BASE_SUB_ID_PARENT_SET), EO_TYPECHECK(Eo *, parent)
EAPI void eo_parent_set(Eo *parent);
/**
* @def eo_parent_get
* @brief Get the parent of an object
* @param[out] a pointer to the parent object.
*
* @see eo_parent_set()
*/
#define eo_parent_get(parent) EO_BASE_ID(EO_BASE_SUB_ID_PARENT_GET), EO_TYPECHECK(Eo **, parent)
EAPI Eo *eo_parent_get(void);
/**
* @def eo_children_iterator_new
* @brief Get an iterator on all childrens
* @param obj the object to get the childrens from.
* @return a pointer to an Eina_Iterator containing all the childrens.
*
* @see eo_parent_set()
*/
#define eo_children_iterator_new(it) EO_BASE_ID(EO_BASE_SUB_ID_CHILDREN_ITERATOR_NEW), EO_TYPECHECK(Eina_Iterator **, it)
EAPI Eina_Iterator *eo_children_iterator_new(void);
/**
* @def eo_wref_add
* @brief Add a new weak reference to obj.
* @param wref The pointer to use for the weak ref.
*
@ -1155,16 +1024,15 @@ enum {
*
* @see #eo_wref_del
*/
#define eo_wref_add(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), EO_TYPECHECK(Eo **, wref)
EAPI void eo_wref_add(Eo **wref);
/**
* @def eo_wref_del
* @brief Delete the weak reference passed.
* @param wref the weak reference to free.
*
* @see #eo_wref_add
*/
#define eo_wref_del(wref) EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), EO_TYPECHECK(Eo **, wref)
EAPI void eo_wref_del(Eo **wref);
/**
* @def eo_weak_ref
@ -1178,9 +1046,9 @@ enum {
* @see eo_weak_unref
* @see eo_wref_add
*/
#define eo_weak_ref(wref) \
do { \
if (*wref) eo_do(*wref, eo_wref_add(wref)); \
#define eo_weak_ref(wref) \
do { \
if (*wref) eo_do(*wref, eo_wref_add(wref)); \
} while (0)
/**
@ -1196,9 +1064,9 @@ enum {
* @see eo_wref_del
* @see eo_wref_del_safe
*/
#define eo_weak_unref(wref) \
do { \
if (*wref) eo_do(*wref, eo_wref_del(wref)); \
#define eo_weak_unref(wref) \
do { \
if (*wref) eo_do(*wref, eo_wref_del(wref)); \
} while (0)
/**
@ -1214,24 +1082,22 @@ enum {
#define eo_wref_del_safe(wref) eo_weak_unref(wref)
/**
* @def eo_constructor
* @brief Call the object's constructor.
*
* Should not be used with #eo_do. Only use it with #eo_do_super.
*
* @see #eo_destructor
*/
#define eo_constructor() EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR)
EAPI void eo_constructor(void);
/**
* @def eo_destructor
* @brief Call the object's destructor.
*
* Should not be used with #eo_do. Only use it with #eo_do_super.
*
* @see #eo_constructor
*/
#define eo_destructor() EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR)
EAPI void eo_destructor(void);
/**
* @addtogroup Eo_Events Eo's Event Handling
@ -1316,47 +1182,42 @@ struct _Eo_Callback_Array_Item
}
/**
* @def eo_event_callback_forwarder_add
* @brief Add an event callback forwarder for an event and an object.
* @param[in] desc The description of the event to listen to.
* @param[in] new_obj The object to emit events from.
*
* @see eo_event_callback_forwarder_del()
*/
#define eo_event_callback_forwarder_add(desc, new_obj) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_ADD), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo *, new_obj)
EAPI void eo_event_callback_forwarder_add(const Eo_Event_Description *desc, Eo *new_obj);
/**
* @def eo_event_callback_forwarder_del
* @brief Remove an event callback forwarder for an event and an object.
* @param[in] desc The description of the event to listen to.
* @param[in] new_obj The object to emit events from.
*
* @see eo_event_callback_forwarder_add()
*/
#define eo_event_callback_forwarder_del(desc, new_obj) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_DEL), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo *, new_obj)
EAPI void eo_event_callback_forwarder_del(const Eo_Event_Description *desc, Eo *new_obj);
/**
* @def eo_event_freeze
* @brief freeze events of object.
*
* Prevents event callbacks from being called for the object.
*
* @see #eo_event_thaw
*/
#define eo_event_freeze() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_FREEZE)
EAPI void eo_event_freeze(void);
/**
* @def eo_event_thaw
* @brief thaw events of object.
*
* Lets event callbacks be called for the object.
*
* @see #eo_event_freeze
*/
#define eo_event_thaw() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_THAW)
EAPI void eo_event_thaw(void);
/**
* @def eo_event_freeze_get
* @brief return freeze events of object.
*
* @param[out] fcount The event freeze count of the object.
@ -1366,10 +1227,9 @@ struct _Eo_Callback_Array_Item
* @see #eo_event_freeze
* @see #eo_event_thaw
*/
#define eo_event_freeze_get(fcount) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_FREEZE_GET), EO_TYPECHECK(int *, fcount)
EAPI int eo_event_freeze_get(void);
/**
* @def eo_event_global_freeze
* @brief freeze events of object.
*
* Prevents event callbacks from being called for the object.
@ -1377,10 +1237,9 @@ struct _Eo_Callback_Array_Item
* @see #eo_event_freeze
* @see #eo_event_global_thaw
*/
#define eo_event_global_freeze() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE)
EAPI void eo_event_global_freeze(void);
/**
* @def eo_event_global_thaw
* @brief thaw events of object.
*
* Lets event callbacks be called for the object.
@ -1388,10 +1247,9 @@ struct _Eo_Callback_Array_Item
* @see #eo_event_thaw
* @see #eo_event_global_freeze
*/
#define eo_event_global_thaw() EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_THAW)
EAPI void eo_event_global_thaw(void);
/**
* @def eo_event_global_freeze_get
* @brief return freeze events of object.
*
* @param[out] fcount The event freeze count of the object.
@ -1402,7 +1260,7 @@ struct _Eo_Callback_Array_Item
* @see #eo_event_global_freeze
* @see #eo_event_global_thaw
*/
#define eo_event_global_freeze_get(fcount) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET), EO_TYPECHECK(int *, fcount)
EAPI int eo_event_global_freeze_get(void);
/**
* @def eo_event_callback_add(obj, desc, cb, data)
@ -1420,7 +1278,6 @@ struct _Eo_Callback_Array_Item
EO_CALLBACK_PRIORITY_DEFAULT, cb, data)
/**
* @def eo_event_callback_priority_add
* @brief Add a callback for an event with a specific priority.
* @param[in] desc The description of the event to listen to.
* @param[in] priority The priority of the callback.
@ -1431,17 +1288,21 @@ struct _Eo_Callback_Array_Item
*
* @see #eo_event_callback_add
*/
#define eo_event_callback_priority_add(desc, priority, cb, data) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_PRIORITY_ADD), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo_Callback_Priority, priority), EO_TYPECHECK(Eo_Event_Cb, cb), EO_TYPECHECK(const void *, data)
EAPI void eo_event_callback_priority_add(const Eo_Event_Description *desc,
Eo_Callback_Priority priority,
Eo_Event_Cb func,
const void *user_data);
/**
* @def eo_event_callback_del
* @brief Del a callback with a specific data associated to it for an event.
* @param[in] desc The description of the event to listen to.
* @param[in] func the callback to delete.
* @param[in] user_data The data to compare.
*
*/
#define eo_event_callback_del(desc, func, user_data) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_DEL), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(Eo_Event_Cb, func), EO_TYPECHECK(const void *, user_data)
EAPI void eo_event_callback_del(const Eo_Event_Description *desc,
Eo_Event_Cb func,
const void *user_data);
/**
* @def eo_event_callback_array_add(obj, desc, cb, data)
@ -1458,7 +1319,6 @@ struct _Eo_Callback_Array_Item
EO_CALLBACK_PRIORITY_DEFAULT, data)
/**
* @def eo_event_callback_array_priority_add
* @brief Add a callback array for an event with a specific priority.
* @param[in] array an #Eo_Callback_Array_Item of events to listen to.
* @param[in] priority The priority of the callback.
@ -1468,25 +1328,26 @@ struct _Eo_Callback_Array_Item
*
* @see #eo_event_callback_add
*/
#define eo_event_callback_array_priority_add(array, priority, data) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_PRIORITY_ADD), EO_TYPECHECK(const Eo_Callback_Array_Item *, array), EO_TYPECHECK(Eo_Callback_Priority, priority), EO_TYPECHECK(const void *, data)
EAPI void eo_event_callback_array_priority_add(const Eo_Callback_Array_Item *array,
Eo_Callback_Priority priority,
const void *user_data);
/**
* @def eo_event_callback_array_del
* @brief Del a callback array with a specific data associated to it for an event.
* @param[in] array an #Eo_Callback_Array_Item of events to listen to.
* @param[in] user_data The data to compare.
*
*/
#define eo_event_callback_array_del(array, user_data) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_DEL), EO_TYPECHECK(const Eo_Callback_Array_Item *, array), EO_TYPECHECK(const void *, user_data)
EAPI void eo_event_callback_array_del(const Eo_Callback_Array_Item *array,
const void *user_data);
/**
* @def eo_event_callback_call
* @brief Call the callbacks for an event of an object.
* @param[in] desc The description of the event to call.
* @param[in] event_info Extra event info to pass to the callbacks.
* @param[out] aborted @c EINA_TRUE if one of the callbacks aborted the call, @c EINA_FALSE otherwise.
*/
#define eo_event_callback_call(desc, event_info, aborted) EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_CALL), EO_TYPECHECK(const Eo_Event_Description *, desc), EO_TYPECHECK(const void *, event_info), EO_TYPECHECK(Eina_Bool *, aborted)
EAPI Eina_Bool eo_event_callback_call(const Eo_Event_Description *desc, void *event_info);
/**
* @}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
abstract Eo_Base ()
{
eo_prefix: eo;
constructors {
constructor {
/*@ Call the object's constructor.
@ -75,15 +77,15 @@ Prevents event callbacks from being called for the object. */
/*@ Call the object's destructor.
Should not be used with #eo_do. Only use it with #eo_do_super. */
}
data_set {
key_data_set {
/*@ Set generic data to object. */
params {
@in const char* key; /*@ the key associated with the data */
@in const void* data; /*@ the data to set */
@in eo_base_data_free_func free_func; /*@ the func to free data with (NULL means */
@in eo_key_data_free_func free_func; /*@ the func to free data with (NULL means */
}
}
data_get {
key_data_get {
/*@ Get generic data from object. */
params {
@in const char* key; /*@ the key associated with the data */
@ -102,7 +104,7 @@ Should not be used with #eo_do. Only use it with #eo_do_super. */
/*@ thaw events of object.
Lets event callbacks be called for the object. */
}
data_del {
key_data_del {
/*@ Del generic data from object. */
params {
@in const char* key; /*@ the key associated with the data */

View File

@ -8,8 +8,6 @@
#include "eo_ptr_indirection.h"
#include "eo_private.h"
EAPI Eo_Op EO_BASE_BASE_ID = 0;
static int event_freeze_count = 0;
typedef struct _Eo_Callback_Description Eo_Callback_Description;
@ -33,7 +31,7 @@ typedef struct
EINA_INLIST;
Eina_Stringshare *key;
void *data;
eo_base_data_free_func free_func;
eo_key_data_free_func free_func;
} Eo_Generic_Data_Node;
static void
@ -61,19 +59,16 @@ _eo_generic_data_del_all(Private_Data *pd)
}
static void
_data_set(Eo *obj, void *class_data, va_list *list)
_data_set(Eo *obj, void *class_data,
const char *key, const void *data, eo_key_data_free_func free_func)
{
Private_Data *pd = class_data;
EO_PARAMETER_GET(const char *, key, list);
EO_PARAMETER_GET(const void *, data, list);
EO_PARAMETER_GET(eo_base_data_free_func, free_func, list);
Eo_Generic_Data_Node *node;
if (!key) return;
eo_do(obj, eo_base_data_del(key));
eo_do(obj, eo_key_data_del(key); );
node = malloc(sizeof(Eo_Generic_Data_Node));
if (!node) return;
@ -83,21 +78,17 @@ _data_set(Eo *obj, void *class_data, va_list *list)
pd->generic_data = eina_inlist_prepend(pd->generic_data,
EINA_INLIST_GET(node));
}
EAPI EO_VOID_FUNC_BODYV(eo_key_data_set, EO_FUNC_CALL(key, data, free_func),
const char *key, const void *data, eo_key_data_free_func free_func);
static void
_data_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
static void *
_data_get(Eo *obj EINA_UNUSED, void *class_data, const char *key)
{
/* We don't really change it... */
Eo_Generic_Data_Node *node;
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(const char *, key, list);
EO_PARAMETER_GET(void **, data, list);
if (!data) return;
*data = NULL;
if (!key) return;
if (!key) return NULL;
EINA_INLIST_FOREACH(pd->generic_data, node)
{
@ -105,21 +96,21 @@ _data_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
{
pd->generic_data =
eina_inlist_promote(pd->generic_data, EINA_INLIST_GET(node));
*data = node->data;
return;
return node->data;
}
}
return NULL;
}
EAPI EO_FUNC_BODYV(eo_key_data_get, void*, NULL, EO_FUNC_CALL(key), const char *key);
static void
_parent_set(Eo *obj, void *class_data, va_list *list)
_parent_set(Eo *obj, void *class_data, Eo *parent_id)
{
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(Eo *, parent_id, list);
if (pd->parent == parent_id)
return ;
return;
if (eo_composite_is(obj) && pd->parent)
{
@ -130,11 +121,11 @@ _parent_set(Eo *obj, void *class_data, va_list *list)
{
Private_Data *old_parent_pd;
old_parent_pd = eo_data_scope_get(pd->parent, EO_BASE_CLASS);
old_parent_pd = eo_data_scope_get(pd->parent, EO_CLASS);
if (old_parent_pd)
{
old_parent_pd->children = eina_list_remove(old_parent_pd->children,
obj);
obj);
}
else
{
@ -149,7 +140,7 @@ _parent_set(Eo *obj, void *class_data, va_list *list)
if (parent_id)
{
Private_Data *parent_pd = NULL;
parent_pd = eo_data_scope_get(parent_id, EO_BASE_CLASS);
parent_pd = eo_data_scope_get(parent_id, EO_CLASS);
if (EINA_LIKELY(parent_pd != NULL))
{
@ -170,18 +161,16 @@ _parent_set(Eo *obj, void *class_data, va_list *list)
pd->parent = NULL;
}
}
EAPI EO_VOID_FUNC_BODYV(eo_parent_set, EO_FUNC_CALL(parent_id), Eo *parent_id);
static void
_parent_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
static Eo *
_parent_get(Eo *obj EINA_UNUSED, void *class_data)
{
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(Eo **, parent_id, list);
if (!parent_id) return ;
*parent_id = pd->parent;
return pd->parent;
}
EAPI EO_FUNC_BODY(eo_parent_get, Eo *, NULL);
/* Children accessor */
typedef struct _Eo_Children_Iterator Eo_Children_Iterator;
@ -191,7 +180,6 @@ struct _Eo_Children_Iterator
Eina_List *current;
_Eo_Object *obj;
Eo *obj_id;
};
static Eina_Bool
@ -231,65 +219,63 @@ _eo_children_iterator_free(Eo_Children_Iterator *it)
free(it);
}
eina_spinlock_release(&klass->iterators.trash_lock);
_eo_unref(obj);
}
static void
_children_iterator_new(Eo *obj_id, void *class_data, va_list *list)
static Eina_Iterator *
_children_iterator_new(Eo *obj_id, void *class_data)
{
Private_Data *pd = class_data;
_Eo_Class *klass;
Eo_Children_Iterator *it;
EO_PARAMETER_GET(Eo_Children_Iterator **, it, list);
EO_OBJ_POINTER_RETURN(obj_id, obj);
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
if (!it) return ;
*it = NULL;
if (!pd->children) return ;
if (!pd->children) return NULL;
klass = (_Eo_Class *) obj->klass;
eina_spinlock_take(&klass->iterators.trash_lock);
*it = eina_trash_pop(&klass->iterators.trash);
if (*it)
it = eina_trash_pop(&klass->iterators.trash);
if (it)
{
klass->iterators.trash_count--;
memset(*it, 0, sizeof (Eo_Children_Iterator));
memset(it, 0, sizeof (Eo_Children_Iterator));
}
else
{
*it = calloc(1, sizeof (Eo_Children_Iterator));
it = calloc(1, sizeof (Eo_Children_Iterator));
}
eina_spinlock_release(&klass->iterators.trash_lock);
if (!*it) return ;
if (!it) return NULL;
EINA_MAGIC_SET(&(*it)->iterator, EINA_MAGIC_ITERATOR);
(*it)->current = obj->children;
(*it)->obj = _eo_ref(obj);
(*it)->obj_id = obj_id;
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
it->current = obj->children;
it->obj = _eo_ref(obj);
it->obj_id = obj_id;
(*it)->iterator.next = FUNC_ITERATOR_NEXT(_eo_children_iterator_next);
(*it)->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eo_children_iterator_container);
(*it)->iterator.free = FUNC_ITERATOR_FREE(_eo_children_iterator_free);
it->iterator.next = FUNC_ITERATOR_NEXT(_eo_children_iterator_next);
it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eo_children_iterator_container);
it->iterator.free = FUNC_ITERATOR_FREE(_eo_children_iterator_free);
return (Eina_Iterator *)it;
}
EAPI EO_FUNC_BODY(eo_children_iterator_new, Eina_Iterator *, NULL);
static void
_dbg_info_get(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED,
va_list *data EINA_UNUSED)
_dbg_info_get(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, Eo_Dbg_Info *root_node EINA_UNUSED)
{ /* No info required in the meantime */
return;
}
EAPI EO_VOID_FUNC_BODYV(eo_dbg_info_get, EO_FUNC_CALL(root_node), Eo_Dbg_Info *root_node);
static void
_data_del(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
_data_del(Eo *obj EINA_UNUSED, void *class_data, const char *key)
{
Eo_Generic_Data_Node *node;
Private_Data *pd = class_data;
EO_PARAMETER_GET(const char *, key, list);
if (!key) return;
EINA_INLIST_FOREACH(pd->generic_data, node)
@ -303,6 +289,7 @@ _data_del(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
}
}
}
EAPI EO_VOID_FUNC_BODYV(eo_key_data_del, EO_FUNC_CALL(key), const char *key);
/* Weak reference. */
@ -314,41 +301,38 @@ _wref_count(Private_Data *pd)
return 0;
Eo ***itr;
for (itr = pd->wrefs ; *itr ; itr++)
for (itr = pd->wrefs; *itr; itr++)
count++;
return count;
}
static void
_wref_add(Eo *obj, void *class_data, va_list *list)
_wref_add(Eo *obj, void *class_data, Eo **wref)
{
Private_Data *pd = (Private_Data *) class_data;
size_t count;
Eo ***tmp;
EO_PARAMETER_GET(Eo **, wref, list);
count = _wref_count(pd);
count += 1; /* New wref. */
tmp = realloc(pd->wrefs, sizeof(*pd->wrefs) * (count + 1));
if (!tmp) return ;
if (!tmp) return;
pd->wrefs = tmp;
pd->wrefs[count - 1] = wref;
pd->wrefs[count] = NULL;
*wref = obj;
}
EAPI EO_VOID_FUNC_BODYV(eo_wref_add, EO_FUNC_CALL(wref), Eo **wref);
static void
_wref_del(Eo *obj, void *class_data, va_list *list)
_wref_del(Eo *obj, void *class_data, Eo **wref)
{
Private_Data *pd = (Private_Data *) class_data;
size_t count;
EO_PARAMETER_GET(Eo **, wref, list);
if (*wref != obj)
{
ERR("Wref is a weak ref to %p, while this function was called on %p.",
@ -368,7 +352,7 @@ _wref_del(Eo *obj, void *class_data, va_list *list)
{
Eo ***itr;
for (itr = pd->wrefs ; *itr ; itr++)
for (itr = pd->wrefs; *itr; itr++)
{
if (*itr == wref)
{
@ -390,7 +374,7 @@ _wref_del(Eo *obj, void *class_data, va_list *list)
Eo ***tmp;
// No count--; because of the NULL that is not included in the count. */
tmp = realloc(pd->wrefs, sizeof(*pd->wrefs) * count);
if (!tmp) return ;
if (!tmp) return;
pd->wrefs = tmp;
pd->wrefs[count - 1] = NULL;
}
@ -402,6 +386,7 @@ _wref_del(Eo *obj, void *class_data, va_list *list)
*wref = NULL;
}
EAPI EO_VOID_FUNC_BODYV(eo_wref_del, EO_FUNC_CALL(wref), Eo **wref);
static inline void
_wref_destruct(Private_Data *pd)
@ -410,7 +395,7 @@ _wref_destruct(Private_Data *pd)
if (!pd->wrefs)
return;
for (itr = pd->wrefs ; *itr ; itr++)
for (itr = pd->wrefs; *itr; itr++)
{
**itr = NULL;
}
@ -445,11 +430,13 @@ struct _Eo_Callback_Description
static void
_eo_callback_remove(Private_Data *pd, Eo_Callback_Description *cb)
{
Eo_Callback_Description *itr, *pitr = NULL;
Eo_Callback_Description *itr, *pitr;
itr = pd->callbacks;
itr = pitr = pd->callbacks;
if (pd->callbacks == cb)
pd->callbacks = cb->next;
for ( ; itr ; )
for ( ; itr; )
{
Eo_Callback_Description *titr = itr;
itr = itr->next;
@ -460,10 +447,6 @@ _eo_callback_remove(Private_Data *pd, Eo_Callback_Description *cb)
{
pitr->next = titr->next;
}
else
{
pd->callbacks = titr->next;
}
free(titr);
}
else
@ -485,7 +468,7 @@ _eo_callback_remove_all(Private_Data *pd)
}
}
static inline void
static void
_eo_callbacks_clear(Private_Data *pd)
{
Eo_Callback_Description *cb = NULL;
@ -500,7 +483,7 @@ _eo_callbacks_clear(Private_Data *pd)
pd->deletions_waiting = EINA_FALSE;
for (cb = pd->callbacks ; cb ; )
for (cb = pd->callbacks; cb; )
{
Eo_Callback_Description *titr = cb;
cb = cb->next;
@ -516,7 +499,7 @@ static void
_eo_callbacks_sorted_insert(Private_Data *pd, Eo_Callback_Description *cb)
{
Eo_Callback_Description *itr, *itrp = NULL;
for (itr = pd->callbacks ; itr && (itr->priority < cb->priority) ;
for (itr = pd->callbacks; itr && (itr->priority < cb->priority);
itr = itr->next)
{
itrp = itr;
@ -535,41 +518,45 @@ _eo_callbacks_sorted_insert(Private_Data *pd, Eo_Callback_Description *cb)
}
static void
_ev_cb_priority_add(Eo *obj, void *class_data, va_list *list)
_ev_cb_priority_add(Eo *obj, void *class_data,
const Eo_Event_Description *desc,
Eo_Callback_Priority priority,
Eo_Event_Cb func,
const void *user_data)
{
Eo_Callback_Description *cb;
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(const Eo_Event_Description *, desc, list);
EO_PARAMETER_ENUM_GET(Eo_Callback_Priority, priority, list);
EO_PARAMETER_GET(Eo_Event_Cb, func, list);
EO_PARAMETER_GET(const void *, data, list);
cb = calloc(1, sizeof(*cb));
if (!cb) return ;
if (!cb) return;
cb->items.item.desc = desc;
cb->items.item.func = func;
cb->func_data = (void *) data;
cb->func_data = (void *) user_data;
cb->priority = priority;
_eo_callbacks_sorted_insert(pd, cb);
{
const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, arr, NULL));
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, (void *)arr));
}
}
EAPI EO_VOID_FUNC_BODYV(eo_event_callback_priority_add,
EO_FUNC_CALL(desc, priority, func, user_data),
const Eo_Event_Description *desc,
Eo_Callback_Priority priority,
Eo_Event_Cb func,
const void *user_data);
static void
_ev_cb_del(Eo *obj, void *class_data, va_list *list)
_ev_cb_del(Eo *obj, void *class_data,
const Eo_Event_Description *desc,
Eo_Event_Cb func,
void *user_data)
{
Eo_Callback_Description *cb;
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(const Eo_Event_Description *, desc, list);
EO_PARAMETER_GET(Eo_Event_Cb, func, list);
EO_PARAMETER_GET(void *, user_data, list);
for (cb = pd->callbacks ; cb ; cb = cb->next)
for (cb = pd->callbacks; cb; cb = cb->next)
{
if ((cb->items.item.desc == desc) && (cb->items.item.func == func) &&
(cb->func_data == user_data))
@ -579,47 +566,55 @@ _ev_cb_del(Eo *obj, void *class_data, va_list *list)
cb->delete_me = EINA_TRUE;
pd->deletions_waiting = EINA_TRUE;
_eo_callbacks_clear(pd);
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, arr, NULL));
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)arr); );
return;
}
}
DBG("Callback of object %p with function %p and data %p not found.", obj, func, user_data);
}
EAPI EO_VOID_FUNC_BODYV(eo_event_callback_del,
EO_FUNC_CALL(desc, func, user_data),
const Eo_Event_Description *desc,
Eo_Event_Cb func,
const void *user_data);
static void
_ev_cb_array_priority_add(Eo *obj, void *class_data, va_list *list)
_ev_cb_array_priority_add(Eo *obj, void *class_data,
const Eo_Callback_Array_Item *array,
Eo_Callback_Priority priority,
const void *user_data)
{
Eo_Callback_Description *cb;
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(const Eo_Callback_Array_Item *, array, list);
EO_PARAMETER_ENUM_GET(Eo_Callback_Priority, priority, list);
EO_PARAMETER_GET(const void *, data, list);
cb = calloc(1, sizeof(*cb));
if (!cb) return ;
cb->func_data = (void *) data;
if (!cb) return;
cb->func_data = (void *) user_data;
cb->priority = priority;
cb->items.item_array = array;
cb->func_array = EINA_TRUE;
_eo_callbacks_sorted_insert(pd, cb);
{
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, array, NULL));
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, (void *)array); );
}
}
EAPI EO_VOID_FUNC_BODYV(eo_event_callback_array_priority_add,
EO_FUNC_CALL(array, priority, user_data),
const Eo_Callback_Array_Item *array,
Eo_Callback_Priority priority,
const void *user_data);
static void
_ev_cb_array_del(Eo *obj, void *class_data, va_list *list)
_ev_cb_array_del(Eo *obj, void *class_data,
const Eo_Callback_Array_Item *array,
void *user_data)
{
Eo_Callback_Description *cb;
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(const Eo_Callback_Array_Item *, array, list);
EO_PARAMETER_GET(void *, user_data, list);
for (cb = pd->callbacks ; cb ; cb = cb->next)
for (cb = pd->callbacks; cb; cb = cb->next)
{
if ((cb->items.item_array == array) && (cb->func_data == user_data))
{
@ -627,32 +622,35 @@ _ev_cb_array_del(Eo *obj, void *class_data, va_list *list)
pd->deletions_waiting = EINA_TRUE;
_eo_callbacks_clear(pd);
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, array, NULL));
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)array); );
return;
}
}
DBG("Callback of object %p with function array %p and data %p not found.", obj, array, user_data);
}
EAPI EO_VOID_FUNC_BODYV(eo_event_callback_array_del,
EO_FUNC_CALL(array, user_data),
const Eo_Callback_Array_Item *array,
const void *user_data);
static void
_ev_cb_call(Eo *obj_id, void *class_data, va_list *list)
static Eina_Bool
_ev_cb_call(Eo *obj_id, void *class_data,
const Eo_Event_Description *desc,
void *event_info)
{
Eina_Bool ret;
Eo_Callback_Description *cb;
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(const Eo_Event_Description *, desc, list);
EO_PARAMETER_GET(void *, event_info, list);
EO_PARAMETER_GET(Eina_Bool *, ret, list);
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_FALSE);
EO_OBJ_POINTER_RETURN(obj_id, obj);
if (ret) *ret = EINA_TRUE;
ret = EINA_TRUE;
_eo_ref(obj);
pd->walking_list++;
for (cb = pd->callbacks ; cb ; cb = cb->next)
for (cb = pd->callbacks; cb; cb = cb->next)
{
if (!cb->delete_me)
{
@ -660,7 +658,7 @@ _ev_cb_call(Eo *obj_id, void *class_data, va_list *list)
{
const Eo_Callback_Array_Item *it;
for (it = cb->items.item_array ; it->func ; it++)
for (it = cb->items.item_array; it->func; it++)
{
if (it->desc != desc)
continue;
@ -672,7 +670,7 @@ _ev_cb_call(Eo *obj_id, void *class_data, va_list *list)
if (!it->func((void *) cb->func_data, obj_id, desc,
(void *) event_info))
{
if (ret) *ret = EINA_FALSE;
ret = EINA_FALSE;
goto end;
}
}
@ -690,7 +688,7 @@ _ev_cb_call(Eo *obj_id, void *class_data, va_list *list)
if (!cb->items.item.func((void *) cb->func_data, obj_id, desc,
(void *) event_info))
{
if (ret) *ret = EINA_FALSE;
ret = EINA_FALSE;
goto end;
}
}
@ -701,52 +699,68 @@ end:
pd->walking_list--;
_eo_callbacks_clear(pd);
_eo_unref(obj);
return ret;
}
EAPI EO_FUNC_BODYV(eo_event_callback_call, Eina_Bool,
EINA_FALSE,
EO_FUNC_CALL(desc, event_info),
const Eo_Event_Description *desc,
void *event_info);
static Eina_Bool
_eo_event_forwarder_callback(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
{
(void) obj;
Eo *new_obj = (Eo *) data;
Eina_Bool ret;
Eina_Bool ret = EINA_FALSE;
eo_do(new_obj, eo_event_callback_call(desc, event_info, &ret));
eo_do(new_obj, ret = eo_event_callback_call(desc, (void *)event_info); );
return ret;
}
/* FIXME: Change default priority? Maybe call later? */
static void
_ev_cb_forwarder_add(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
_ev_cb_forwarder_add(Eo *obj, void *class_data EINA_UNUSED,
const Eo_Event_Description *desc,
Eo *new_obj)
{
EO_PARAMETER_GET(const Eo_Event_Description *, desc, list);
EO_PARAMETER_GET(Eo *, new_obj, list);
/* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
eo_do(obj, eo_event_callback_add(desc, _eo_event_forwarder_callback, new_obj));
eo_do(obj, eo_event_callback_add(desc, _eo_event_forwarder_callback, new_obj); );
}
EAPI EO_VOID_FUNC_BODYV(eo_event_callback_forwarder_add,
EO_FUNC_CALL(desc, new_obj),
const Eo_Event_Description *desc,
Eo *new_obj);
static void
_ev_cb_forwarder_del(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
_ev_cb_forwarder_del(Eo *obj, void *class_data EINA_UNUSED,
const Eo_Event_Description *desc,
Eo *new_obj)
{
EO_PARAMETER_GET(const Eo_Event_Description *, desc, list);
EO_PARAMETER_GET(Eo *, new_obj, list);
/* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
eo_do(obj, eo_event_callback_del(desc, _eo_event_forwarder_callback, new_obj));
eo_do(obj, eo_event_callback_del(desc, _eo_event_forwarder_callback, new_obj); );
}
EAPI EO_VOID_FUNC_BODYV(eo_event_callback_forwarder_del,
EO_FUNC_CALL(desc, new_obj),
const Eo_Event_Description *desc,
Eo *new_obj);
static void
_ev_freeze(Eo *obj EINA_UNUSED, void *class_data, va_list *list EINA_UNUSED)
_ev_freeze(Eo *obj EINA_UNUSED, void *class_data)
{
Private_Data *pd = (Private_Data *) class_data;
pd->event_freeze_count++;
}
EAPI EO_VOID_FUNC_BODY(eo_event_freeze);
static void
_ev_thaw(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
_ev_thaw(Eo *obj, void *class_data)
{
Private_Data *pd = (Private_Data *) class_data;
if (pd->event_freeze_count > 0)
@ -758,24 +772,26 @@ _ev_thaw(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
ERR("Events for object %p have already been thawed.", obj);
}
}
EAPI EO_VOID_FUNC_BODY(eo_event_thaw);
static void
_ev_freeze_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
static int
_ev_freeze_get(Eo *obj EINA_UNUSED, void *class_data)
{
Private_Data *pd = (Private_Data *) class_data;
EO_PARAMETER_GET(int *, ret, list);
*ret = pd->event_freeze_count;
return pd->event_freeze_count;
}
EAPI EO_FUNC_BODY(eo_event_freeze_get, int, 0);
static void
_ev_global_freeze(Eo_Class *klass EINA_UNUSED, void *data EINA_UNUSED, va_list *list EINA_UNUSED)
_ev_global_freeze(const Eo_Class *klass EINA_UNUSED, void *class_data EINA_UNUSED)
{
event_freeze_count++;
}
EAPI EO_VOID_FUNC_BODY(eo_event_global_freeze);
static void
_ev_global_thaw(Eo_Class *klass EINA_UNUSED, void *data EINA_UNUSED, va_list *list EINA_UNUSED)
_ev_global_thaw(const Eo_Class *klass EINA_UNUSED, void *class_data EINA_UNUSED)
{
if (event_freeze_count > 0)
{
@ -786,14 +802,14 @@ _ev_global_thaw(Eo_Class *klass EINA_UNUSED, void *data EINA_UNUSED, va_list *li
ERR("Global events have already been thawed.");
}
}
EAPI EO_VOID_FUNC_BODY(eo_event_global_thaw);
static void
_ev_global_freeze_get(Eo_Class *klass EINA_UNUSED, void *data EINA_UNUSED, va_list *list)
static int
_ev_global_freeze_get(const Eo_Class *klass EINA_UNUSED, void *class_data EINA_UNUSED)
{
EO_PARAMETER_GET(int *, ret, list);
*ret = event_freeze_count;
return event_freeze_count;
}
EAPI EO_FUNC_BODY(eo_event_global_freeze_get, int, 0);
/* Eo_Dbg */
EAPI void
@ -849,6 +865,8 @@ _eo_dbg_info_convert_to(const Eina_Value_Type *type EINA_UNUSED, const Eina_Valu
free(inner_val);
return ret;
}
eina_error_set(EINA_ERROR_VALUE_FAILED);
return EINA_FALSE;
}
@ -891,10 +909,9 @@ EAPI const Eina_Value_Type *EO_DBG_INFO_TYPE = &_EO_DBG_INFO_TYPE;
/* EOF event callbacks */
/* EO_BASE_CLASS stuff */
#define MY_CLASS EO_BASE_CLASS
/* EO_CLASS stuff */
#define MY_CLASS EO_CLASS
/* FIXME: Set proper type descriptions. */
EAPI const Eo_Event_Description _EO_EV_CALLBACK_ADD =
EO_EVENT_DESCRIPTION("callback,add", "A callback was added.");
EAPI const Eo_Event_Description _EO_EV_CALLBACK_DEL =
@ -903,15 +920,16 @@ EAPI const Eo_Event_Description _EO_EV_DEL =
EO_HOT_EVENT_DESCRIPTION("del", "Obj is being deleted.");
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
_eo_condtor_done(obj);
}
EAPI EO_VOID_FUNC_BODY(eo_constructor);
static void
_destructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
_destructor(Eo *obj, void *class_data)
{
Private_Data *pd = class_data;
Eo *child;
@ -927,71 +945,43 @@ _destructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED)
_eo_condtor_done(obj);
}
EAPI EO_VOID_FUNC_BODY(eo_destructor);
static void
_class_constructor(Eo_Class *klass)
_class_constructor(Eo_Class *klass EINA_UNUSED)
{
event_freeze_count = 0;
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_PARENT_SET), _parent_set),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_PARENT_GET), _parent_get),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CHILDREN_ITERATOR_NEW), _children_iterator_new),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_SET), _data_set),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), _data_get),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DATA_DEL), _data_del),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_WREF_ADD), _wref_add),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_WREF_DEL), _wref_del),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_PRIORITY_ADD), _ev_cb_priority_add),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_DEL), _ev_cb_del),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_PRIORITY_ADD), _ev_cb_array_priority_add),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_DEL), _ev_cb_array_del),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_CALL), _ev_cb_call),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_ADD), _ev_cb_forwarder_add),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_DEL), _ev_cb_forwarder_del),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_FREEZE), _ev_freeze),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_THAW), _ev_thaw),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_FREEZE_GET), _ev_freeze_get),
EO_OP_FUNC_CLASS(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE), _ev_global_freeze),
EO_OP_FUNC_CLASS(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_THAW), _ev_global_thaw),
EO_OP_FUNC_CLASS(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET), _ev_global_freeze_get),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_CONSTRUCTOR, "Constructor"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DESTRUCTOR, "Destructor"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_PARENT_SET, "Set parent"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_PARENT_GET, "Get parent"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_CHILDREN_ITERATOR_NEW, "Children Iterator"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DATA_SET, "Set data for key."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DATA_GET, "Get data for key."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DATA_DEL, "Del key."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_WREF_ADD, "Add a weak ref to the object."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_WREF_DEL, "Delete the weak ref."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_PRIORITY_ADD, "Add an event callback with a priority."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_DEL, "Delete an event callback"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_PRIORITY_ADD, "Add an event callback array with a priority."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_ARRAY_DEL, "Delete an event callback array"),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_CALL, "Call the event callbacks for an event."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_ADD, "Add an event forwarder."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_CALLBACK_FORWARDER_DEL, "Delete an event forwarder."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_FREEZE, "Freezes events."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_THAW, "Thaws events."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_EVENT_FREEZE_GET, "Get event freeze counter."),
EO_OP_DESCRIPTION_CLASS(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE, "Freezes events globally."),
EO_OP_DESCRIPTION_CLASS(EO_BASE_SUB_ID_EVENT_GLOBAL_THAW, "Thaws events globally."),
EO_OP_DESCRIPTION_CLASS(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET, "Get global event freeze counter."),
EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DBG_INFO_GET, "Get debug info list for obj."),
EO_OP_DESCRIPTION_SENTINEL
static Eo_Op_Description op_descs [] = {
EO_OP_FUNC(eo_constructor, _constructor, "Constructor."),
EO_OP_FUNC(eo_destructor, _destructor, "Destructor."),
EO_OP_FUNC(eo_parent_set, _parent_set, "Set parent."),
EO_OP_FUNC(eo_parent_get, _parent_get, "Get parent."),
EO_OP_FUNC(eo_children_iterator_new, _children_iterator_new, "Get Children Iterator."),
EO_OP_FUNC(eo_key_data_set, _data_set, "Set data for key."),
EO_OP_FUNC(eo_key_data_get, _data_get, "Get data for key."),
EO_OP_FUNC(eo_key_data_del, _data_del, "Del key."),
EO_OP_FUNC(eo_wref_add, _wref_add, "Add a weak ref to the object."),
EO_OP_FUNC(eo_wref_del, _wref_del, "Delete the weak ref."),
EO_OP_FUNC(eo_event_callback_priority_add, _ev_cb_priority_add, "Add an event callback with a priority."),
EO_OP_FUNC(eo_event_callback_del, _ev_cb_del, "Delete an event callback"),
EO_OP_FUNC(eo_event_callback_array_priority_add, _ev_cb_array_priority_add, "Add an event callback array with a priority."),
EO_OP_FUNC(eo_event_callback_array_del, _ev_cb_array_del, "Delete an event callback array"),
EO_OP_FUNC(eo_event_callback_call, _ev_cb_call, "Call the event callbacks for an event."),
EO_OP_FUNC(eo_event_callback_forwarder_add, _ev_cb_forwarder_add, "Add an event forwarder."),
EO_OP_FUNC(eo_event_callback_forwarder_del, _ev_cb_forwarder_del, "Delete an event forwarder."),
EO_OP_FUNC(eo_event_freeze, _ev_freeze, "Freezes events."),
EO_OP_FUNC(eo_event_thaw, _ev_thaw, "Thaws events."),
EO_OP_FUNC(eo_event_freeze_get, _ev_freeze_get, "Get event freeze counter."),
EO_OP_FUNC(eo_event_global_freeze, _ev_global_freeze, "Freezes events globally."),
EO_OP_FUNC(eo_event_global_thaw, _ev_global_thaw, "Thaws events globally."),
EO_OP_FUNC(eo_event_global_freeze_get, _ev_global_freeze_get, "Get global event freeze counter."),
EO_OP_FUNC(eo_dbg_info_get, _dbg_info_get, "Get debug info list for obj."),
EO_OP_SENTINEL
};
// FIXME: eo
static const Eo_Event_Description *event_desc[] = {
EO_EV_CALLBACK_ADD,
EO_EV_CALLBACK_DEL,
@ -1003,7 +993,7 @@ static const Eo_Class_Description class_desc = {
EO_VERSION,
"Eo_Base",
EO_CLASS_TYPE_REGULAR_NO_INSTANT,
EO_CLASS_DESCRIPTION_OPS(&EO_BASE_BASE_ID, op_desc, EO_BASE_SUB_ID_LAST),
EO_CLASS_DESCRIPTION_OPS(op_descs),
event_desc,
sizeof(Private_Data),
_class_constructor,

View File

@ -4,13 +4,11 @@
#include "Eo.h"
EAPI Eo_Op EO_CLASS_CLASS_BASE_ID = 0;
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Eo_Abstract_Class",
EO_CLASS_TYPE_REGULAR_NO_INSTANT,
EO_CLASS_DESCRIPTION_OPS(&EO_CLASS_CLASS_BASE_ID, NULL, EO_CLASS_CLASS_SUB_ID_LAST),
EO_CLASS_DESCRIPTION_NOOPS(),
NULL,
0,
NULL,

View File

@ -109,6 +109,9 @@ struct _Eo_Object
/* [composite*] */
};
/* FIXME: Change the type to something generic that makes sense for eo */
typedef void (*eo_op_func_type)(Eo *, void *class_data, va_list *list);
typedef struct _Dich_Chain1 Dich_Chain1;
typedef struct
@ -207,22 +210,16 @@ _eo_condtor_reset(_Eo_Object *obj)
static inline void
_eo_del_internal(const char *file, int line, _Eo_Object *obj)
{
Eina_Bool do_err;
/* We need that for the event callbacks that may ref/unref. */
obj->refcount++;
eo_do(_eo_id_get(obj), eo_event_callback_call(EO_EV_DEL, NULL, NULL));
const _Eo_Class *klass = obj->klass;
eo_do(_eo_id_get(obj), eo_event_callback_call(EO_EV_DEL, NULL));
_eo_condtor_reset(obj);
do_err = eo_do(_eo_id_get(obj), eo_destructor());
if (EINA_UNLIKELY(!do_err))
{
ERR("in %s:%d: Object of class '%s' - One of the object destructors have failed.",
file, line, klass->desc->name);
}
eo_do(_eo_id_get(obj), eo_destructor(););
if (!obj->condtor_done)
{

View File

@ -238,7 +238,7 @@ evas_event_callback_cleanup(Evas *eo_e)
void
evas_event_callback_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
{
eo_do(eo_e, eo_event_callback_call(_legacy_evas_callback_table[type], event_info, NULL));
eo_do(eo_e, eo_event_callback_call(_legacy_evas_callback_table[type], event_info));
}
void
@ -299,7 +299,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
break;
}
eo_do(eo_obj, eo_event_callback_call(_legacy_evas_callback_table[type], event_info, NULL));
eo_do(eo_obj, eo_event_callback_call(_legacy_evas_callback_table[type], event_info));
if (type == EVAS_CALLBACK_MOUSE_DOWN)
{

View File

@ -8,7 +8,7 @@ evas_object_data_set(Evas_Object *obj, const char *key, const void *data)
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
eo_do(obj, eo_base_data_set(key, data, NULL));
eo_do(obj, eo_key_data_set(key, data, NULL));
}
EAPI void *
@ -18,7 +18,7 @@ evas_object_data_get(const Evas_Object *obj, const char *key)
return NULL;
MAGIC_CHECK_END();
void *data = NULL;
eo_do((Evas_Object *)obj, eo_base_data_get(key, &data));
eo_do((Evas_Object *)obj, data = eo_key_data_get(key));
return data;
}
@ -29,6 +29,6 @@ evas_object_data_del(Evas_Object *obj, const char *key)
return NULL;
MAGIC_CHECK_END();
void *data = NULL;
eo_do(obj, eo_base_data_get(key, &data), eo_base_data_del(key));
eo_do(obj, data = eo_key_data_get(key), eo_key_data_del(key));
return data;
}

View File

@ -958,8 +958,9 @@ _canvas_event_thaw(Eo *eo_e, void *_pd, va_list *list EINA_UNUSED)
{
int fcount = -1;
eo_do_super(eo_e, EVAS_CLASS,
eo_event_thaw(),
eo_event_freeze_get(&fcount));
eo_event_thaw());
eo_do_super(eo_e, EVAS_CLASS,
fcount = eo_event_freeze_get());
if (0 == fcount)
{
Evas_Public_Data *e = _pd;
@ -988,7 +989,7 @@ evas_event_freeze_get(const Evas *eo_e)
return 0;
MAGIC_CHECK_END();
int ret = 0;
eo_do((Eo *)eo_e, eo_event_freeze_get(&ret));
eo_do((Eo *)eo_e, ret = eo_event_freeze_get());
return ret;
}

View File

@ -131,7 +131,7 @@ _on_child_del(void *data, Eo *o, const Eo_Event_Description *desc EINA_UNUSED, v
Evas_Object *box = data;
Evas_Object *ret = NULL;
eo_do(box, evas_obj_box_internal_remove(o, &ret));
eo_do(box, ret = evas_obj_box_internal_remove(o));
if (!ret)
ERR("child removal failed");
evas_object_smart_changed(box);
@ -163,7 +163,7 @@ _evas_object_box_option_new(Evas_Object *o, Evas_Object_Box_Data *priv EINA_UNUS
{
Evas_Object_Box_Option *opt = NULL;
eo_do(o, evas_obj_box_internal_option_new(child, &opt));
eo_do(o, opt = evas_obj_box_internal_option_new(child));
if (!opt)
{
ERR("option_new failed");
@ -464,7 +464,7 @@ _evas_box_eo_base_constructor(Eo *obj, Evas_Object_Box_Data *class_data EINA_UNU
{
eo_do_super(obj, MY_CLASS, eo_constructor());
eo_do(obj,
evas_obj_smart_callbacks_descriptions_set(_signals, NULL),
evas_obj_smart_callbacks_descriptions_set(_signals),
evas_obj_type_set(MY_CLASS_NAME_LEGACY));
}
@ -1686,7 +1686,7 @@ _evas_box_append(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child)
if (!child)
return NULL;
eo_do(o, evas_obj_box_internal_append(child, &opt));
eo_do(o, opt = evas_obj_box_internal_append(child));
if (opt)
{
@ -1705,7 +1705,7 @@ _evas_box_prepend(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child)
if (!child)
return NULL;
eo_do(o, evas_obj_box_internal_prepend(child, &opt));
eo_do(o, opt = evas_obj_box_internal_prepend(child));
if (opt)
{
@ -1723,7 +1723,7 @@ _evas_box_insert_before(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child, c
if (!child)
return NULL;
eo_do(o, evas_obj_box_internal_insert_before(child, reference, &opt));
eo_do(o, opt = evas_obj_box_internal_insert_before(child, reference));
if (opt)
{
@ -1742,7 +1742,7 @@ _evas_box_insert_after(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child, co
if (!child)
return NULL;
eo_do(o, evas_obj_box_internal_insert_after(child, reference, &opt));
eo_do(o, opt = evas_obj_box_internal_insert_after(child, reference));
if (opt)
{
@ -1761,7 +1761,7 @@ _evas_box_insert_at(Eo *o, Evas_Object_Box_Data *priv, Evas_Object *child, unsig
if (!child)
return NULL;
eo_do(o, evas_obj_box_internal_insert_at(child, pos, &opt));
eo_do(o, opt = evas_obj_box_internal_insert_at(child, pos));
if (opt)
{
@ -1778,7 +1778,7 @@ _evas_box_remove(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED, Evas_Object *chil
{
Evas_Object *obj = NULL;
eo_do(o, evas_obj_box_internal_remove(child, &obj));
eo_do(o, obj = evas_obj_box_internal_remove(child));
if (obj)
{
@ -1796,7 +1796,7 @@ _evas_box_remove_at(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED, unsigned int p
{
Evas_Object *obj = NULL;
eo_do(o, evas_obj_box_internal_remove_at(pos, &obj));
eo_do(o, obj = evas_obj_box_internal_remove_at(pos));
if (obj)
{
@ -1819,7 +1819,7 @@ _evas_box_remove_all(Eo *o, Evas_Object_Box_Data *priv, Eina_Bool clear)
Evas_Object_Box_Option *opt = priv->children->data;
Evas_Object *obj = NULL;
eo_do(o, evas_obj_box_internal_remove(opt->obj, &obj));
eo_do(o, obj = evas_obj_box_internal_remove(opt->obj));
if (obj)
{
_evas_object_box_child_callbacks_unregister(obj, o);
@ -1921,7 +1921,7 @@ EAPI Eina_Bool
evas_object_box_option_property_vset(Evas_Object *o, Evas_Object_Box_Option *opt, int property, va_list args)
{
Eina_Bool ret = EINA_FALSE;
eo_do(o, evas_obj_box_option_property_vset(opt, property, (va_list *) &args, &ret));
eo_do(o, ret = evas_obj_box_option_property_vset(opt, property, (va_list *) &args));
return ret;
}
@ -1948,7 +1948,7 @@ EAPI Eina_Bool
evas_object_box_option_property_vget(const Evas_Object *o, Evas_Object_Box_Option *opt, int property, va_list args)
{
Eina_Bool ret = EINA_FALSE;
eo_do((Eo *)o, evas_obj_box_option_property_vget(opt, property, (va_list *) &args, &ret));
eo_do((Eo *)o, ret = evas_obj_box_option_property_vget(opt, property, (va_list *) &args));
return ret;
}

View File

@ -324,12 +324,12 @@ _evas_image_eo_base_constructor(Eo *eo_obj, Evas_Image_Data *o)
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
Evas *eo_e;
Eo *parent;
Eo *parent = NULL;
Evas_Colorspace cspace;
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
eo_do(eo_obj, eo_parent_get(&parent));
eo_do(eo_obj, parent = eo_parent_get());
eo_e = evas_object_evas_get(parent);
evas_object_image_init(eo_obj);
@ -650,7 +650,7 @@ EAPI Eina_Bool
evas_object_image_source_unset(Evas_Object *eo_obj)
{
Eina_Bool result = EINA_FALSE;
eo_do(eo_obj, evas_obj_image_source_set(NULL, &result));
eo_do(eo_obj, result = evas_obj_image_source_set(NULL));
return result;
}
@ -719,8 +719,8 @@ _evas_image_eo_base_dbg_info_get(Eo *eo_obj, Evas_Image_Data *o, Eo_Dbg_Info *ro
if (evas_object_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE)
{
Evas_Load_Error error;
eo_do(eo_obj, evas_obj_image_load_error_get(&error));
Evas_Load_Error error = EVAS_LOAD_ERROR_GENERIC;
eo_do(eo_obj, error = evas_obj_image_load_error_get());
EO_DBG_INFO_APPEND(group, "Load Error", EINA_VALUE_TYPE_STRING,
evas_load_error_str(error));
}
@ -2357,8 +2357,8 @@ _proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy, Evas
ctx = e->engine.func->context_new(e->engine.data.output);
Eina_Bool source_clip;
eo_do(eo_proxy, evas_obj_image_source_clip_get(&source_clip));
Eina_Bool source_clip = EINA_FALSE;
eo_do(eo_proxy, source_clip = evas_obj_image_source_clip_get());
Evas_Proxy_Render_Data proxy_render_data = {
.eo_proxy = eo_proxy,

View File

@ -221,13 +221,13 @@ _evas_line_eo_base_constructor(Eo *eo_obj, Evas_Line_Data *class_data EINA_UNUSE
{
Evas_Object_Protected_Data *obj;
Evas_Line_Data *o;
Eo *parent;
Eo *parent = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
evas_object_line_init(eo_obj);
eo_do(eo_obj, eo_parent_get(&parent));
eo_do(eo_obj, parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(parent));
o = class_data;

View File

@ -1418,7 +1418,7 @@ evas_object_evas_get(const Evas_Object *eo_obj)
return NULL;
MAGIC_CHECK_END();
Evas *eo_evas = NULL;
eo_do((Eo *)eo_obj, evas_common_evas_get(&eo_evas));
eo_do((Eo *)eo_obj, eo_evas = evas_common_evas_get());
return eo_evas;
}
@ -1448,24 +1448,24 @@ _evas_object_eo_base_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Data *obj EI
Eina_Bool clipees_has;
eo_do(eo_obj,
evas_obj_visibility_get(&visible),
evas_obj_layer_get(&layer),
evas_obj_name_get(&name),
visible = evas_obj_visibility_get(),
layer = evas_obj_layer_get(),
name = evas_obj_name_get(),
evas_obj_position_get(&x, &y),
evas_obj_size_get(&w, &h),
evas_obj_scale_get(&scale),
scale = evas_obj_scale_get(),
evas_obj_size_hint_min_get(&minw, &minh),
evas_obj_size_hint_max_get(&maxw, &maxh),
evas_obj_size_hint_request_get(&requestw, &requesth),
evas_obj_size_hint_align_get(&dblx, &dbly),
evas_obj_size_hint_weight_get(&dblw, &dblh),
evas_obj_color_get(&r, &g, &b, &a),
evas_obj_focus_get(&focus),
evas_obj_pointer_mode_get(&m),
evas_obj_pass_events_get(&pass_event),
evas_obj_repeat_events_get(&repeat_event),
evas_obj_propagate_events_get(&propagate_event),
evas_obj_clipees_has(&clipees_has));
focus = evas_obj_focus_get(),
m = evas_obj_pointer_mode_get(),
pass_event = evas_obj_pass_events_get(),
repeat_event = evas_obj_repeat_events_get(),
propagate_event = evas_obj_propagate_events_get(),
clipees_has = evas_obj_clipees_has());
EO_DBG_INFO_APPEND(group, "Visibility", EINA_VALUE_TYPE_CHAR, visible);
@ -1540,7 +1540,7 @@ _evas_object_eo_base_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Data *obj EI
EO_DBG_INFO_APPEND(group, "Has clipees", EINA_VALUE_TYPE_CHAR, clipees_has);
Evas_Object *clipper = NULL;
eo_do(eo_obj, evas_obj_clip_get(&clipper));
eo_do(eo_obj, clipper = evas_obj_clip_get());
EO_DBG_INFO_APPEND(group, "Clipper", EINA_VALUE_TYPE_UINT64, (uintptr_t) clipper);
const Evas_Map *map = evas_object_map_get(eo_obj);
@ -1616,8 +1616,8 @@ evas_object_top_at_pointer_get(const Evas *eo_e)
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CLASS);
Evas_Object *ret = NULL;
if (!e) return NULL;
eo_do((Eo *)eo_e, evas_canvas_object_top_at_xy_get(e->pointer.x, e->pointer.y, EINA_TRUE,
EINA_TRUE, &ret));
eo_do((Eo *)eo_e, ret = evas_canvas_object_top_at_xy_get(e->pointer.x, e->pointer.y, EINA_TRUE,
EINA_TRUE));
return ret;
}

View File

@ -108,13 +108,13 @@ EOLIAN static void
_evas_polygon_eo_base_constructor(Eo *eo_obj, Evas_Polygon_Data *class_data EINA_UNUSED)
{
Evas_Object_Protected_Data *obj;
Eo *parent;
Eo *parent = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
evas_object_polygon_init(eo_obj);
eo_do(eo_obj, eo_parent_get(&parent));
eo_do(eo_obj, parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(parent));
}

View File

@ -95,14 +95,14 @@ evas_object_rectangle_add(Evas *e)
EOLIAN static void
_evas_rectangle_eo_base_constructor(Eo *eo_obj, Evas_Rectangle_Data *class_data EINA_UNUSED)
{
Eo *parent;
Eo *parent = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
evas_object_rectangle_init(eo_obj);
eo_do(eo_obj, eo_parent_get(&parent));
eo_do(eo_obj, parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(parent));
}

View File

@ -547,7 +547,7 @@ _evas_smart_eo_base_constructor(Eo *eo_obj, Evas_Smart_Data *class_data EINA_UNU
{
Evas_Object_Protected_Data *obj;
Evas_Smart_Data *smart;
Eo *parent;
Eo *parent = NULL;
smart = class_data;
smart->object = eo_obj;
@ -556,7 +556,7 @@ _evas_smart_eo_base_constructor(Eo *eo_obj, Evas_Smart_Data *class_data EINA_UNU
evas_object_smart_init(eo_obj);
obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
eo_do(eo_obj, eo_parent_get(&parent));
eo_do(eo_obj, parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(parent));
eo_do(eo_obj,
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
@ -797,7 +797,7 @@ evas_object_smart_callback_call(Evas_Object *eo_obj, const char *event, void *ev
if (!event) return;
const _Evas_Event_Description *event_desc = eina_hash_find(signals_hash_table, event);
if (event_desc)
eo_do(eo_obj, eo_event_callback_call(event_desc->eo_desc, event_info, NULL));
eo_do(eo_obj, eo_event_callback_call(event_desc->eo_desc, event_info));
}
EOLIAN static Eina_Bool

View File

@ -383,9 +383,9 @@ _evas_text_eo_base_constructor(Eo *eo_obj, Evas_Text_Data *class_data EINA_UNUSE
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
evas_object_text_init(eo_obj);
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
Eo *parent;
Eo *parent = NULL;
eo_do(eo_obj, eo_parent_get(&parent));
eo_do(eo_obj, parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(parent));
}
@ -961,10 +961,10 @@ _evas_text_eo_base_dbg_info_get(Eo *eo_obj, Evas_Text_Data *o EINA_UNUSED, Eo_Db
EO_DBG_INFO_APPEND(group, "Font", EINA_VALUE_TYPE_STRING, text);
EO_DBG_INFO_APPEND(group, "Text size", EINA_VALUE_TYPE_INT, size);
eo_do(eo_obj, evas_obj_text_font_source_get(&text));
eo_do(eo_obj, text = evas_obj_text_font_source_get());
EO_DBG_INFO_APPEND(group, "Font source", EINA_VALUE_TYPE_STRING, text);
eo_do(eo_obj, evas_obj_text_text_get(&text));
eo_do(eo_obj, text = evas_obj_text_text_get());
EO_DBG_INFO_APPEND(group, "Text", EINA_VALUE_TYPE_STRING, text);
}

View File

@ -5499,7 +5499,7 @@ _evas_textblock_eo_base_constructor(Eo *eo_obj, Evas_Textblock_Data *class_data
{
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
Evas_Textblock_Data *o;
Eo *eo_parent;
Eo *eo_parent = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
@ -5513,7 +5513,7 @@ _evas_textblock_eo_base_constructor(Eo *eo_obj, Evas_Textblock_Data *class_data
_format_command_init();
evas_object_textblock_init(eo_obj);
eo_do(eo_obj, eo_parent_get(&eo_parent));
eo_do(eo_obj, eo_parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(eo_parent));
}
@ -6889,7 +6889,7 @@ EAPI const Evas_Object_Textblock_Node_Format *
evas_textblock_node_format_first_get(const Evas_Object *eo_obj)
{
const Evas_Object_Textblock_Node_Format *format = NULL;
eo_do((Eo *)eo_obj, evas_obj_textblock_node_format_first_get(&format));
eo_do((Eo *)eo_obj, format = evas_obj_textblock_node_format_first_get());
return format;
}
@ -6903,7 +6903,7 @@ EAPI const Evas_Object_Textblock_Node_Format *
evas_textblock_node_format_last_get(const Evas_Object *eo_obj)
{
const Evas_Object_Textblock_Node_Format *format = NULL;
eo_do((Eo *)eo_obj, evas_obj_textblock_node_format_last_get(&format));
eo_do((Eo *)eo_obj, format = evas_obj_textblock_node_format_last_get());
return format;
}
@ -10506,13 +10506,13 @@ _evas_textblock_eo_base_dbg_info_get(Eo *eo_obj, Evas_Textblock_Data *o EINA_UNU
Eo_Dbg_Info *node;
const char *style;
const char *text;
const char *text = NULL;
char shorttext[48];
const Evas_Textblock_Style *ts;
const Evas_Textblock_Style *ts = NULL;
eo_do(eo_obj, evas_obj_textblock_style_get(&ts));
eo_do(eo_obj, ts = evas_obj_textblock_style_get());
style = evas_textblock_style_get(ts);
eo_do(eo_obj, evas_obj_textblock_text_markup_get(&text));
eo_do(eo_obj, text = evas_obj_textblock_text_markup_get());
strncpy(shorttext, text, 38);
if (shorttext[37])
strcpy(shorttext + 37, "\xe2\x80\xa6"); /* HORIZONTAL ELLIPSIS */

View File

@ -1065,14 +1065,14 @@ evas_object_textgrid_add(Evas *e)
EOLIAN static void
_evas_textgrid_eo_base_constructor(Eo *eo_obj, Evas_Textgrid_Data *class_data EINA_UNUSED)
{
Eo *eo_parent;
Eo *eo_parent = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
evas_object_textgrid_init(eo_obj);
eo_do(eo_obj, eo_parent_get(&eo_parent));
eo_do(eo_obj, eo_parent = eo_parent_get());
evas_object_inject(eo_obj, obj, evas_object_evas_get(eo_parent));
}
@ -1497,7 +1497,7 @@ _evas_textgrid_eo_base_dbg_info_get(Eo *eo_obj, Evas_Textgrid_Data *o EINA_UNUSE
EO_DBG_INFO_APPEND(group, "Font", EINA_VALUE_TYPE_STRING, text);
EO_DBG_INFO_APPEND(group, "Text size", EINA_VALUE_TYPE_INT, size);
eo_do(eo_obj, evas_obj_textgrid_font_source_get(&text));
eo_do(eo_obj, text = evas_obj_textgrid_font_source_get());
EO_DBG_INFO_APPEND(group, "Font source", EINA_VALUE_TYPE_STRING, text);
{

View File

@ -29,10 +29,10 @@ evas_out_add(Evas *e)
EOLIAN static void
_evas_out_eo_base_constructor(Eo *eo_obj, Evas_Out_Data *eo_dat)
{
Eo *eo_parent;
Eo *eo_parent = NULL;
Evas_Public_Data *e;
eo_do(eo_obj, eo_parent_get(&eo_parent));
eo_do(eo_obj, eo_parent = eo_parent_get());
e = eo_data_scope_get(eo_parent, EVAS_CLASS);
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
@ -54,10 +54,10 @@ evas_output_del(Evas_Out *evo)
EOLIAN static void
_evas_out_eo_base_destructor(Eo *eo_obj, Evas_Out_Data *eo_dat)
{
Eo *eo_parent;
Eo *eo_parent = NULL;
Evas_Public_Data *e;
eo_do(eo_obj, eo_parent_get(&eo_parent));
eo_do(eo_obj, eo_parent = eo_parent_get());
e = eo_data_scope_get(eo_parent, EVAS_CLASS);
if (!e) return ;
// XXX: need to free output and context one they get allocated one day

View File

@ -1599,7 +1599,7 @@ _cb_always_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
{
int freeze_num = 0, i;
eo_do(eo_e, eo_event_freeze_get(&freeze_num));
eo_do(eo_e, freeze_num = eo_event_freeze_get());
for (i = 0; i < freeze_num; i++) eo_do(eo_e, eo_event_thaw());
evas_event_callback_call(eo_e, type, event_info);
for (i = 0; i < freeze_num; i++) eo_do(eo_e, eo_event_freeze());

View File

@ -121,7 +121,7 @@ _evas_render2_always_call(Eo *eo_e, Evas_Callback_Type type, void *event_info)
{
int freeze_num = 0, i;
eo_do(eo_e, eo_event_freeze_get(&freeze_num));
eo_do(eo_e, freeze_num = eo_event_freeze_get());
for (i = 0; i < freeze_num; i++) eo_do(eo_e, eo_event_thaw());
evas_event_callback_call(eo_e, type, event_info);
for (i = 0; i < freeze_num; i++) eo_do(eo_e, eo_event_freeze());

View File

@ -250,7 +250,7 @@ _proxy_subrender(Evas *eo_e, Evas_Object *eo_source, Evas_Object *eo_proxy,
ctx = e->engine.func->context_new(e->engine.data.output);
if (eo_isa(eo_proxy, EVAS_OBJ_IMAGE_CLASS))
eo_do(eo_proxy, evas_obj_image_source_clip_get(&source_clip));
eo_do(eo_proxy, source_clip = evas_obj_image_source_clip_get());
Evas_Proxy_Render_Data proxy_render_data = {
.eo_proxy = eo_proxy,

View File

@ -45,14 +45,14 @@ static Eina_Bool _looped_cb(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Desc
static Eina_Bool
_seek_vol(void *data)
{
double len;
double len = 0;
Eo *in = data;
Eo *out;
Eo *out = NULL;
eo_do(in, ecore_audio_obj_in_output_get(&out));
eo_do(in, out = ecore_audio_obj_in_output_get());
eo_do(out, ecore_audio_obj_volume_set(0.4));
eo_do(in, ecore_audio_obj_in_seek(-0.3, SEEK_END, &len));
eo_do(in, len = ecore_audio_obj_in_seek(-0.3, SEEK_END));
fail_if(len < 0);
return EINA_FALSE;
@ -61,14 +61,14 @@ _seek_vol(void *data)
START_TEST(ecore_test_ecore_audio_obj_pulse)
{
Eo *in, *out;
Eina_Bool ret;
Eina_Bool ret = EINA_FALSE;
Eina_Bool pulse_context_failed = EINA_FALSE;
in = eo_add(ECORE_AUDIO_OBJ_IN_SNDFILE_CLASS, NULL);
fail_if(!in);
eo_do(in, ecore_audio_obj_name_set("modem.wav"));
eo_do(in, ecore_audio_obj_source_set(TESTS_SRC_DIR"/modem.wav", &ret));
eo_do(in, ret = ecore_audio_obj_source_set(TESTS_SRC_DIR"/modem.wav"));
fail_if(!ret);
out = eo_add(ECORE_AUDIO_OBJ_OUT_PULSE_CLASS, NULL);
@ -79,7 +79,7 @@ START_TEST(ecore_test_ecore_audio_obj_pulse)
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _finished_cb, NULL));
eo_do(out, eo_event_callback_add(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, _failed_cb, &pulse_context_failed));
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
eo_do(out, ret = ecore_audio_obj_out_input_attach(in));
fail_if(!ret);
ecore_main_loop_begin();
@ -112,21 +112,21 @@ START_TEST(ecore_test_ecore_audio_cleanup)
{
Eo *in, *out;
int freq = 1000;
Eina_Bool ret;
Eina_Bool ret = EINA_FALSE;
in = eo_add(ECORE_AUDIO_OBJ_IN_TONE_CLASS, NULL);
fail_if(!in);
eo_do(in, eo_base_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
eo_do(in, ecore_audio_obj_in_length_set(2));
out = eo_add(ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS, NULL);
fail_if(!out);
eo_do(out, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG, &ret));
eo_do(out, ret = ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG));
fail_if(!ret);
eo_do(out, ecore_audio_obj_source_set(TESTS_BUILD_DIR"/tmp.ogg", &ret));
eo_do(out, ret = ecore_audio_obj_source_set(TESTS_BUILD_DIR"/tmp.ogg"));
fail_if(!ret);
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
eo_do(out, ret = ecore_audio_obj_out_input_attach(in));
fail_if(!ret);
ecore_idler_add(_idle_del, in);
@ -150,69 +150,69 @@ START_TEST(ecore_test_ecore_audio_obj_tone)
eo_do(in, ecore_audio_obj_name_set("tone"));
eo_do(in, ecore_audio_obj_in_channels_get(&channel));
eo_do(in, channel = ecore_audio_obj_in_channels_get());
fail_if(channel != 1);
eo_do(in, ecore_audio_obj_in_samplerate_get(&rate));
eo_do(in, rate = ecore_audio_obj_in_samplerate_get());
fail_if(rate != 44100);
eo_do(in, ecore_audio_obj_in_length_get(&len));
eo_do(in, len = ecore_audio_obj_in_length_get());
fail_if(len != 1);
eo_do(in, ecore_audio_obj_in_length_set(2.5));
eo_do(in, ecore_audio_obj_in_length_get(&len));
eo_do(in, len = ecore_audio_obj_in_length_get());
fail_if(len != 2.5);
eo_do(in, ecore_audio_obj_in_looped_set(EINA_TRUE));
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
eo_do(in, len = ecore_audio_obj_in_remaining_get());
fail_if(len != 2.5);
eo_do(in, eo_base_data_get(ECORE_AUDIO_ATTR_TONE_FREQ, (void **)&freq));
eo_do(in, freq = (intptr_t) eo_key_data_get(ECORE_AUDIO_ATTR_TONE_FREQ));
fail_if(freq != 1000);
freq = 2000;
eo_do(in, eo_base_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
eo_do(in, eo_base_data_get(ECORE_AUDIO_ATTR_TONE_FREQ, (void **)&freq));
eo_do(in, freq = (intptr_t) eo_key_data_get(ECORE_AUDIO_ATTR_TONE_FREQ));
fail_if(freq != 2000);
eo_do(in, eo_base_data_set("foo", "bar", NULL));
eo_do(in, eo_base_data_get("foo", (void **)&tmp));
eo_do(in, eo_key_data_set("foo", "bar", NULL));
eo_do(in, tmp = eo_key_data_get("foo"));
ck_assert_str_eq(tmp, "bar");
eo_do(in, ecore_audio_obj_in_seek(5.0, SEEK_SET, &len));
eo_do(in, len = ecore_audio_obj_in_seek(5.0, SEEK_SET));
fail_if(len != -1);
eo_do(in, ecore_audio_obj_in_seek(1.0, 42, &len));
eo_do(in, len = ecore_audio_obj_in_seek(1.0, 42));
fail_if(len != -1);
eo_do(in, ecore_audio_obj_in_seek(1.0, SEEK_SET, &len));
eo_do(in, len = ecore_audio_obj_in_seek(1.0, SEEK_SET));
fail_if(len != 1.0);
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
eo_do(in, len = ecore_audio_obj_in_remaining_get());
fail_if(len != 1.5);
eo_do(in, ecore_audio_obj_in_seek(1.0, SEEK_CUR, &len));
eo_do(in, len = ecore_audio_obj_in_seek(1.0, SEEK_CUR));
fail_if(len != 2.0);
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
eo_do(in, len = ecore_audio_obj_in_remaining_get());
fail_if(len != 0.5);
eo_do(in, ecore_audio_obj_in_seek(-1.0, SEEK_END, &len));
eo_do(in, len = ecore_audio_obj_in_seek(-1.0, SEEK_END));
fail_if(len != 1.5);
eo_do(in, ecore_audio_obj_in_remaining_get(&len));
eo_do(in, len = ecore_audio_obj_in_remaining_get());
fail_if(len != 1.0);
out = eo_add(ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS, NULL);
fail_if(!out);
eo_do(out, ecore_audio_obj_name_set("tmp.wav"));
eo_do(out, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_WAV, &ret));
eo_do(out, ret = ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_WAV));
fail_if(!ret);
eo_do(out, ecore_audio_obj_source_set(TESTS_BUILD_DIR"/tmp.wav", &ret));
eo_do(out, ret = ecore_audio_obj_source_set(TESTS_BUILD_DIR"/tmp.wav"));
fail_if(!ret);
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
eo_do(out, ret = ecore_audio_obj_out_input_attach(in));
fail_if(!ret);
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_LOOPED, _looped_cb, NULL));
@ -240,70 +240,70 @@ START_TEST(ecore_test_ecore_audio_obj_sndfile)
in = eo_add(ECORE_AUDIO_OBJ_IN_SNDFILE_CLASS, NULL);
fail_if(!in);
eo_do(in, ecore_audio_obj_format_get(&fmt));
eo_do(in, fmt = ecore_audio_obj_format_get());
fail_if(fmt != ECORE_AUDIO_FORMAT_AUTO);
eo_do(in, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_FLAC, &ret));
eo_do(in, ret = ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_FLAC));
fail_if(!ret);
eo_do(in, ecore_audio_obj_format_get(&fmt));
eo_do(in, fmt = ecore_audio_obj_format_get());
fail_if(fmt != ECORE_AUDIO_FORMAT_FLAC);
eo_do(in, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_AUTO, &ret));
eo_do(in, ret = ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_AUTO));
fail_if(!ret);
eo_do(in, ecore_audio_obj_name_set("sms.ogg"));
eo_do(in, ecore_audio_obj_source_set(TESTS_SRC_DIR"/sms.ogg", &ret));
eo_do(in, ret = ecore_audio_obj_source_set(TESTS_SRC_DIR"/sms.ogg"));
fail_if(!ret);
eo_do(in, ecore_audio_obj_source_get(&src));
eo_do(in, src = ecore_audio_obj_source_get());
ck_assert_str_eq(src, TESTS_SRC_DIR"/sms.ogg");
eo_do(in, ecore_audio_obj_format_get(&fmt));
eo_do(in, fmt = ecore_audio_obj_format_get());
fail_if(fmt != ECORE_AUDIO_FORMAT_OGG);
eo_do(in, ecore_audio_obj_in_channels_get(&channel));
eo_do(in, channel = ecore_audio_obj_in_channels_get());
fail_if(channel != 2);
eo_do(in, ecore_audio_obj_in_samplerate_get(&rate));
eo_do(in, rate = ecore_audio_obj_in_samplerate_get());
fail_if(rate != 44100);
eo_do(in, ecore_audio_obj_in_length_get(&len));
eo_do(in, len = ecore_audio_obj_in_length_get());
fail_if(len == 0);
eo_do(in, ecore_audio_obj_in_remaining_get(&rem));
eo_do(in, rem = ecore_audio_obj_in_remaining_get());
fail_if(len != rem);
eo_do(in, ecore_audio_obj_format_get(&fmt));
eo_do(in, fmt = ecore_audio_obj_format_get());
fail_if(fmt != ECORE_AUDIO_FORMAT_OGG);
eo_do(in, ecore_audio_obj_in_seek(0.5, SEEK_SET, &len));
eo_do(in, len = ecore_audio_obj_in_seek(0.5, SEEK_SET));
fail_if(len != 0.5);
eo_do(in, ecore_audio_obj_in_seek(0.5, SEEK_CUR, &len));
eo_do(in, len = ecore_audio_obj_in_seek(0.5, SEEK_CUR));
fail_if(len != 1.0);
eo_do(in, ecore_audio_obj_in_seek(-1.0, SEEK_END, &len));
eo_do(in, len = ecore_audio_obj_in_seek(-1.0, SEEK_END));
fail_if(fabs(rem - 1 - len) > 0.1);
out = eo_add(ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS, NULL);
fail_if(!out);
eo_do(out, ecore_audio_obj_name_set("tmp.wav"));
eo_do(out, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_WAV, &ret));
eo_do(out, ret = ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_WAV));
fail_if(!ret);
eo_do(out, ecore_audio_obj_format_get(&fmt));
eo_do(out, fmt = ecore_audio_obj_format_get());
fail_if(fmt != ECORE_AUDIO_FORMAT_WAV);
// eo_do(out, ecore_audio_obj_source_set("/tmp/file/does/not/exist/hopefully.wav", &ret));
// fail_if(ret);
eo_do(out, ecore_audio_obj_source_set(TESTS_BUILD_DIR"/tmp.wav", &ret));
eo_do(out, ret = ecore_audio_obj_source_set(TESTS_BUILD_DIR"/tmp.wav"));
fail_if(!ret);
eo_do(out, ecore_audio_obj_source_get(&src));
eo_do(out, src = ecore_audio_obj_source_get());
ck_assert_str_eq(src, TESTS_BUILD_DIR"/tmp.wav");
eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
eo_do(out, ret = ecore_audio_obj_out_input_attach(in));
fail_if(!ret);
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _finished_cb, NULL));
@ -332,47 +332,47 @@ START_TEST(ecore_test_ecore_audio_obj_in_out)
fail_if(!in2);
fail_if(!out);
fail_if(!eo_do(in, ecore_audio_obj_in_output_get(&out2)));
eo_do(in, out2 = ecore_audio_obj_in_output_get());
fail_if(out2);
fail_if(!eo_do(out, ecore_audio_obj_out_inputs_get(&in3)));
eo_do(out, in3 = ecore_audio_obj_out_inputs_get());
fail_if(eina_list_count(in3) != 0);
fail_if(!eo_do(out, ecore_audio_obj_out_input_attach(in, &attached)));
eo_do(out, attached = ecore_audio_obj_out_input_attach(in));
fail_if(!attached);
fail_if(!eo_do(out, ecore_audio_obj_out_input_attach(in, &attached)));
eo_do(out, attached = ecore_audio_obj_out_input_attach(in));
fail_if(attached);
fail_if(!eo_do(in, ecore_audio_obj_in_output_get(&out2)));
eo_do(in, out2 = ecore_audio_obj_in_output_get());
fail_if(out2 != out);
fail_if(!eo_do(out, ecore_audio_obj_out_inputs_get(&in3)));
eo_do(out, in3 = ecore_audio_obj_out_inputs_get());
fail_if(eina_list_count(in3) != 1);
fail_if(eina_list_data_get(in3) != in);
fail_if(!eo_do(out, ecore_audio_obj_out_input_attach(in2, &attached)));
eo_do(out, attached = ecore_audio_obj_out_input_attach(in2));
fail_if(!attached);
fail_if(!eo_do(out, ecore_audio_obj_out_inputs_get(&in3)));
eo_do(out, in3 = ecore_audio_obj_out_inputs_get());
fail_if(eina_list_count(in3) != 2);
fail_if(eina_list_data_get(in3) != in);
eo_del(in2);
fail_if(!eo_do(out, ecore_audio_obj_out_inputs_get(&in3)));
eo_do(out, in3 = ecore_audio_obj_out_inputs_get());
fail_if(eina_list_count(in3) != 1);
fail_if(eina_list_data_get(in3) != in);
eo_del(out);
fail_if(!eo_do(in, ecore_audio_obj_in_output_get(&out2)));
eo_do(in, out2 = ecore_audio_obj_in_output_get());
fail_if(out2);
@ -431,7 +431,7 @@ START_TEST(ecore_test_ecore_audio_obj_vio)
eo_do(in, ecore_audio_obj_vio_set(&in_vio, NULL, NULL));
eo_do(out, ecore_audio_obj_vio_set(&out_vio, NULL, NULL));
eo_do(out, ecore_audio_obj_out_input_attach(in, NULL));
eo_do(out, ecore_audio_obj_out_input_attach(in));
ecore_main_loop_begin();
@ -464,73 +464,73 @@ START_TEST(ecore_test_ecore_audio_obj_in)
fail_if(!in);
fail_if(!eo_do(in, ecore_audio_obj_vio_set(&vio, &freed, _myfree)));
eo_do(in, ecore_audio_obj_vio_set(&vio, &freed, _myfree));
fail_if(freed);
fail_if(!eo_do(in, ecore_audio_obj_vio_set(NULL, NULL, NULL)));
eo_do(in, ecore_audio_obj_vio_set(NULL, NULL, NULL));
fail_if(!freed);
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
eo_do(in, speed = ecore_audio_obj_in_speed_get());
fail_if(speed != 1.0);
fail_if(!eo_do(in, ecore_audio_obj_in_speed_set(2.5)));
eo_do(in, ecore_audio_obj_in_speed_set(2.5));
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
eo_do(in, speed = ecore_audio_obj_in_speed_get());
fail_if(speed != 2.5);
fail_if(!eo_do(in, ecore_audio_obj_in_speed_set(0)));
eo_do(in, ecore_audio_obj_in_speed_set(0));
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
eo_do(in, speed = ecore_audio_obj_in_speed_get());
fail_if(speed != 0.2);
fail_if(!eo_do(in, ecore_audio_obj_in_speed_set(10)));
eo_do(in, ecore_audio_obj_in_speed_set(10));
fail_if(!eo_do(in, ecore_audio_obj_in_speed_get(&speed)));
eo_do(in, speed = ecore_audio_obj_in_speed_get());
fail_if(speed != 5.0);
fail_if(!eo_do(in, ecore_audio_obj_in_samplerate_get(&samplerate)));
eo_do(in, samplerate = ecore_audio_obj_in_samplerate_get());
fail_if(samplerate != 0);
fail_if(!eo_do(in, ecore_audio_obj_in_samplerate_set(1234)));
eo_do(in, ecore_audio_obj_in_samplerate_set(1234));
fail_if(!eo_do(in, ecore_audio_obj_in_samplerate_get(&samplerate)));
eo_do(in, samplerate = ecore_audio_obj_in_samplerate_get());
fail_if(samplerate != 1234);
fail_if(!eo_do(in, ecore_audio_obj_in_channels_get(&channels)));
eo_do(in, channels = ecore_audio_obj_in_channels_get());
fail_if(channels != 0);
fail_if(!eo_do(in, ecore_audio_obj_in_channels_set(2)));
eo_do(in, ecore_audio_obj_in_channels_set(2));
fail_if(!eo_do(in, ecore_audio_obj_in_channels_get(&channels)));
eo_do(in, channels = ecore_audio_obj_in_channels_get());
fail_if(channels != 2);
fail_if(!eo_do(in, ecore_audio_obj_in_looped_get(&looped)));
eo_do(in, looped = ecore_audio_obj_in_looped_get());
fail_if(looped);
fail_if(!eo_do(in, ecore_audio_obj_in_looped_set(EINA_TRUE)));
eo_do(in, ecore_audio_obj_in_looped_set(EINA_TRUE));
fail_if(!eo_do(in, ecore_audio_obj_in_looped_get(&looped)));
eo_do(in, looped = ecore_audio_obj_in_looped_get());
fail_if(!looped);
fail_if(!eo_do(in, ecore_audio_obj_in_length_get(&length)));
eo_do(in, length = ecore_audio_obj_in_length_get());
fail_if(length != 0);
fail_if(eo_do(in, ecore_audio_obj_in_length_set(10.0)));
eo_do(in, ecore_audio_obj_in_length_set(10.0));
fail_if(!eo_do(in, ecore_audio_obj_in_remaining_get(&length)));
eo_do(in, length = ecore_audio_obj_in_remaining_get());
fail_if(length != -1);
memset(buf, 0xaa, 10);
fail_if(!eo_do(in, ecore_audio_obj_in_read(buf, 10, &read)));
eo_do(in, read = ecore_audio_obj_in_read(buf, 10));
fail_if(read != 0);
for (i=0; i<10; i++) {
fail_if(buf[i] != 0xaa);
}
fail_if(!eo_do(in, ecore_audio_obj_paused_set(EINA_TRUE)));
eo_do(in, ecore_audio_obj_paused_set(EINA_TRUE));
fail_if(!eo_do(in, ecore_audio_obj_in_read(buf, 10, &read)));
eo_do(in, read = ecore_audio_obj_in_read(buf, 10));
fail_if(read != 10);
for (i=0; i<10; i++) {
@ -560,29 +560,29 @@ START_TEST(ecore_test_ecore_audio_obj)
fail_if(!obj);
fail_if(!eo_do(obj, ecore_audio_obj_name_get(&name)));
eo_do(obj, name = ecore_audio_obj_name_get());
fail_if(name);
fail_if(!eo_do(obj, ecore_audio_obj_name_set("In1")));
fail_if(!eo_do(obj, ecore_audio_obj_name_get(&name)));
eo_do(obj, ecore_audio_obj_name_set("In1"));
eo_do(obj, name = ecore_audio_obj_name_get());
ck_assert_str_eq(name, "In1");
fail_if(!eo_do(obj, ecore_audio_obj_name_get(NULL)));
eo_do(obj, ecore_audio_obj_name_get());
fail_if(!eo_do(obj, ecore_audio_obj_paused_get(&paused)));
eo_do(obj, paused = ecore_audio_obj_paused_get());
fail_if(paused);
fail_if(!eo_do(obj, ecore_audio_obj_paused_set(EINA_TRUE)));
fail_if(!eo_do(obj, ecore_audio_obj_paused_get(&paused)));
eo_do(obj, ecore_audio_obj_paused_set(EINA_TRUE));
eo_do(obj, paused = ecore_audio_obj_paused_get());
fail_if(!paused);
fail_if(!eo_do(obj, ecore_audio_obj_volume_get(&volume)));
eo_do(obj, volume = ecore_audio_obj_volume_get());
fail_if(volume != 1.0);
fail_if(!eo_do(obj, ecore_audio_obj_volume_set(0.5)));
fail_if(!eo_do(obj, ecore_audio_obj_volume_get(&volume)));
eo_do(obj, ecore_audio_obj_volume_set(0.5));
eo_do(obj, volume = ecore_audio_obj_volume_get());
fail_if(volume != 0.5);
eo_del(obj);

View File

@ -7,42 +7,30 @@
#include "access_simple_protected.h"
#include "access_inherit.h"
EAPI Eo_Op INHERIT_BASE_ID = 0;
#define MY_CLASS INHERIT_CLASS
static void
_prot_print(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
_prot_print(Eo *obj, void *class_data EINA_UNUSED)
{
Simple_Protected_Data *pd = eo_data_scope_get(obj, SIMPLE_CLASS);
(void) list;
printf("%s %d\n", __func__, pd->protected_x1);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(INHERIT_ID(INHERIT_SUB_ID_PROT_PRINT), _prot_print),
EO_OP_FUNC_SENTINEL
};
EAPI EO_VOID_FUNC_BODY(inherit_prot_print);
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(INHERIT_SUB_ID_PROT_PRINT, "Print protected var x1."),
EO_OP_DESCRIPTION_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(inherit_prot_print, _prot_print, "Print protected var x1."),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Inherit",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&INHERIT_BASE_ID, op_desc, INHERIT_SUB_ID_LAST),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};

View File

@ -1,16 +1,7 @@
#ifndef INHERIT_H
#define INHERIT_H
extern EAPI Eo_Op INHERIT_BASE_ID;
enum {
INHERIT_SUB_ID_PROT_PRINT,
INHERIT_SUB_ID_LAST
};
#define INHERIT_ID(sub_id) (INHERIT_BASE_ID + sub_id)
#define inherit_prot_print() INHERIT_ID(INHERIT_SUB_ID_PROT_PRINT)
EAPI void inherit_prot_print(void);
#define INHERIT_CLASS inherit_class_get()
const Eo_Class *inherit_class_get(void);

View File

@ -6,8 +6,6 @@
#include "access_simple.h"
#include "access_simple_protected.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
Simple_Protected_Data protected;
@ -20,34 +18,23 @@ EAPI const Eo_Event_Description _EV_A_CHANGED =
#define MY_CLASS SIMPLE_CLASS
static void
_a_set(Eo *obj, void *class_data, va_list *list)
_a_set(Eo *obj, void *class_data, int a)
{
Private_Data *pd = class_data;
int a;
a = va_arg(*list, int);
pd->a = a;
printf("%s %d\n", __func__, pd->a);
pd->protected.protected_x1 = a + 1;
pd->protected.public.public_x2 = a + 2;
eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &pd->a, NULL));
eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &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_SENTINEL
};
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_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(simple_a_set, _a_set, "Set property A"),
EO_OP_SENTINEL
};
static const Eo_Event_Description *event_desc[] = {
@ -59,12 +46,12 @@ 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_descs),
event_desc,
sizeof(Private_Data),
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL)
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL)

View File

@ -1,22 +1,13 @@
#ifndef SIMPLE_H
#define SIMPLE_H
extern EAPI Eo_Op SIMPLE_BASE_ID;
enum {
SIMPLE_SUB_ID_A_SET,
SIMPLE_SUB_ID_LAST
};
EAPI void simple_a_set(int a);
typedef struct
{
int public_x2;
} Simple_Public_Data;
#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id)
#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
extern const Eo_Event_Description _EV_A_CHANGED;
#define EV_A_CHANGED (&(_EV_A_CHANGED))

View File

@ -8,20 +8,19 @@
#include "../eunit_tests.h"
EAPI Eo_Op COMP_BASE_ID = 0;
#define MY_CLASS COMP_CLASS
static void
_a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
static int
_a_get(Eo *obj, void *class_data EINA_UNUSED)
{
int *a;
a = va_arg(*list, int *);
eo_do_super(obj, MY_CLASS, simple_a_get(a));
int a = 0;
eo_do_super(obj, MY_CLASS, a = simple_a_get());
return a;
}
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
@ -32,34 +31,28 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
fail_if(eo_composite_is(obj));
fail_if(!eo_composite_is(simple));
eo_do(obj, eo_base_data_set("simple-obj", simple, NULL));
eo_do(obj, eo_key_data_set("simple-obj", simple, NULL));
eo_unref(simple);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(simple_a_get, _a_get),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Comp",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(comp_class_get, &class_desc, EO_BASE_CLASS,
EO_DEFINE_CLASS(comp_class_get, &class_desc, EO_CLASS,
SIMPLE_CLASS, NULL);

View File

@ -36,16 +36,16 @@ main(int argc, char *argv[])
fail_if(!eo_isa(obj, COMP_CLASS));
fail_if(!eo_isa(obj, SIMPLE_CLASS));
int a;
int a = 0;
eo_do(obj, simple_a_set(1));
fail_if(!cb_called);
eo_do(obj, simple_a_get(&a));
eo_do(obj, a = simple_a_get());
fail_if(a != 1);
/* disable the callback forwarder, and fail if it's still called. */
Eo *simple;
eo_do(obj, eo_base_data_get("simple-obj", (void **) &simple));
Eo *simple = NULL;
eo_do(obj, simple = eo_key_data_get("simple-obj"));
eo_ref(simple);
eo_do(simple, eo_event_callback_forwarder_del(EV_A_CHANGED, obj));

View File

@ -5,50 +5,35 @@
#include "Eo.h"
#include "composite_objects_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
EAPI const Eo_Event_Description _EV_A_CHANGED =
EO_EVENT_DESCRIPTION("a,changed", "Called when a has changed.");
#define MY_CLASS SIMPLE_CLASS
static void
_a_set(Eo *obj, void *class_data, va_list *list)
_a_set(Eo *obj, void *class_data, int a)
{
Simple_Public_Data *pd = class_data;
int a;
a = va_arg(*list, int);
printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
pd->a = a;
eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &pd->a, NULL));
eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &pd->a));
}
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 Simple_Public_Data *pd = class_data;
int *a;
a = va_arg(*list, int *);
*a = pd->a;
return 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_SENTINEL
};
EAPI EO_VOID_FUNC_BODYV(simple_a_set, EO_FUNC_CALL(a), int a);
EAPI EO_FUNC_BODY(simple_a_get, int, 0);
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_descs[] = {
EO_OP_FUNC(simple_a_set, _a_set, "Set property A"),
EO_OP_FUNC(simple_a_get, _a_get, "Get property A"),
EO_OP_SENTINEL
};
static const Eo_Event_Description *event_desc[] = {
@ -60,12 +45,12 @@ 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_descs),
event_desc,
sizeof(Simple_Public_Data),
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -1,23 +1,13 @@
#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_LAST
};
typedef struct
{
int a;
} Simple_Public_Data;
#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id)
#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a)
EAPI void simple_a_set(int a);
EAPI int simple_a_get(void);
extern const Eo_Event_Description _EV_A_CHANGED;
#define EV_A_CHANGED (&(_EV_A_CHANGED))

View File

@ -30,8 +30,10 @@ main(int argc, char *argv[])
eo_do(obj, simple_a_set(1), simple_b_set(2));
int a, b;
eo_do(obj, simple_a_get(&a), simple_b_get(&b), mixin_add_and_print(5));
int a = 0, b = 0;
eo_do(obj, a = simple_a_get(), b = simple_b_get(), mixin_add_and_print(5));
fail_if(a != 1);
fail_if(b != 2);
eo_unref(obj);
@ -68,7 +70,7 @@ main(int argc, char *argv[])
fail_if(!obj);
fail_if(my_init_count != 2);
eo_do(obj, simple_a_get(&a));
eo_do(obj, a = simple_a_get());
fail_if(a != 7);
eo_unref(obj);

View File

@ -6,23 +6,20 @@
#include "constructors_mixin.h"
#include "constructors_simple.h"
EAPI Eo_Op MIXIN_BASE_ID = 0;
#define MY_CLASS MIXIN_CLASS
static void
_add_and_print_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
_add_and_print_set(Eo *obj, void *class_data EINA_UNUSED, int x)
{
int a, b, x;
eo_do(obj, simple_a_get(&a), simple_b_get(&b));
x = va_arg(*list, const int);
int a = 0, b = 0;
eo_do(obj, a = simple_a_get(), b = simple_b_get());
printf("%s %d\n", __func__, a + b + x);
}
extern int my_init_count;
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
@ -30,41 +27,32 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
}
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_destructor());
my_init_count--;
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), _add_and_print_set),
EO_OP_FUNC_SENTINEL
};
EAPI EO_VOID_FUNC_BODYV(mixin_add_and_print, EO_FUNC_CALL(x), int x);
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(MIXIN_SUB_ID_ADD_AND_SET, "Add A + B + param and print it"),
EO_OP_DESCRIPTION_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(mixin_add_and_print, _add_and_print_set, "Add A + B + param and print it"),
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
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_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL);
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, EO_CLASS, NULL);

View File

@ -1,16 +1,7 @@
#ifndef MIXIN_H
#define MIXIN_H
extern EAPI Eo_Op MIXIN_BASE_ID;
enum {
MIXIN_SUB_ID_ADD_AND_SET,
MIXIN_SUB_ID_LAST
};
#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id)
#define mixin_add_and_print(x) MIXIN_ID(MIXIN_SUB_ID_ADD_AND_SET), EO_TYPECHECK(int, x)
EAPI void mixin_add_and_print(int x);
#define MIXIN_CLASS mixin_class_get()
const Eo_Class *mixin_class_get(void);

View File

@ -6,8 +6,6 @@
#include "constructors_mixin.h"
#include "constructors_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
int a;
@ -19,24 +17,22 @@ typedef struct
static char *class_var = NULL;
#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); \
}
} \
EO_VOID_FUNC_BODYV(simple_##name##_set, EO_FUNC_CALL(name), int name); \
EO_FUNC_BODY(simple_##name##_get, int, 0);
_GET_SET_FUNC(a)
_GET_SET_FUNC(b)
@ -44,11 +40,9 @@ _GET_SET_FUNC(b)
extern int my_init_count;
static void
_simple_constructor(Eo *obj, void *class_data, va_list *list)
_simple_constructor(Eo *obj, void *class_data, int a)
{
Private_Data *pd = class_data;
int a;
a = va_arg(*list, int);
eo_do_super(obj, MY_CLASS, eo_constructor());
@ -59,7 +53,7 @@ _simple_constructor(Eo *obj, void *class_data, va_list *list)
}
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
@ -67,7 +61,7 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
}
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_destructor());
@ -75,21 +69,8 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
}
static void
_class_constructor(Eo_Class *klass)
_class_constructor(Eo_Class *klass EINA_UNUSED)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_CONSTRUCTOR), _simple_constructor),
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_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
class_var = malloc(10);
}
@ -99,26 +80,30 @@ _class_destructor(Eo_Class *klass EINA_UNUSED)
free(class_var);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(SIMPLE_SUB_ID_CONSTRUCTOR, "Construct and set A."),
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
EO_VOID_FUNC_BODYV(simple_constructor, EO_FUNC_CALL(a), int a);
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
EO_OP_FUNC(simple_constructor, _simple_constructor, "Construct and set A."),
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(simple_b_set, _b_set, "Set property b"),
EO_OP_FUNC(simple_b_get, _b_get, "Get property b"),
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_descs),
NULL,
sizeof(Private_Data),
_class_constructor,
_class_destructor
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS,
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS,
MIXIN_CLASS, NULL);

View File

@ -1,24 +1,11 @@
#ifndef SIMPLE_H
#define SIMPLE_H
extern EAPI Eo_Op SIMPLE_BASE_ID;
enum {
SIMPLE_SUB_ID_CONSTRUCTOR,
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)
#define simple_constructor(a) SIMPLE_ID(SIMPLE_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(int, a)
#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
#define simple_a_get(a) SIMPLE_ID(SIMPLE_SUB_ID_A_GET), EO_TYPECHECK(int *, a)
#define simple_b_set(b) SIMPLE_ID(SIMPLE_SUB_ID_B_SET), EO_TYPECHECK(int, b)
#define simple_b_get(b) SIMPLE_ID(SIMPLE_SUB_ID_B_GET), EO_TYPECHECK(int *, b)
EAPI void simple_constructor(int a);
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);

View File

@ -9,34 +9,28 @@
#define MY_CLASS SIMPLE2_CLASS
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
eo_error_set(obj);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple2",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple2_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple2_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -14,27 +14,21 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
(void) obj;
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple3",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple3_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple3_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -13,7 +13,7 @@ static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple4",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_NOOPS(),
NULL,
0,
NULL,

View File

@ -14,27 +14,21 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
(void) obj;
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple5",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple5_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple5_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -9,34 +9,28 @@
#define MY_CLASS SIMPLE6_CLASS
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_destructor());
eo_error_set(obj);
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs [] = {
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple6",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple6_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple6_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -14,28 +14,23 @@
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
fail_if(eo_do_super(obj, MY_CLASS, eo_constructor()));
/* FIXME: Actually test it. */
eo_do_super(obj, MY_CLASS, eo_constructor());
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs [] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Simple7",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};

View File

@ -12,7 +12,7 @@ static const Eo_Class_Description class_desc = {
EO_VERSION,
"Inherit",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_NOOPS(),
NULL,
0,
NULL,

View File

@ -9,72 +9,72 @@
#include "../eunit_tests.h"
EAPI Eo_Op INHERIT2_BASE_ID = 0;
#define MY_CLASS INHERIT2_CLASS
static void
_a_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
_a_set(Eo *obj, void *class_data EINA_UNUSED, int a)
{
int a;
a = va_arg(*list, int);
printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
eo_do(obj, simple_a_print());
eo_do_super(obj, MY_CLASS, simple_a_set(a + 1));
fail_if(!eo_do_super(obj, MY_CLASS, simple_a_print()));
Eina_Bool called = EINA_FALSE;
eo_do_super(obj, MY_CLASS, called = simple_a_print());
fail_if(!called);
}
static void
_print(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
static Eina_Bool
_print(Eo *obj, void *class_data EINA_UNUSED)
{
Eina_Bool called = EINA_FALSE;
printf("Hey\n");
fail_if(eo_do_super(obj, MY_CLASS, inherit2_print()));
eo_do_super(obj, MY_CLASS, called = inherit2_print());
fail_if(called);
return EINA_TRUE;
}
static void
_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
static Eina_Bool
_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED)
{
printf("Hey2\n");
return EINA_TRUE;
}
static void
_class_print(Eo_Class *klass, void *data EINA_UNUSED, va_list *list)
static Eina_Bool
_class_print(Eo_Class *klass, void *data EINA_UNUSED)
{
(void) list;
Eina_Bool called = EINA_FALSE;
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
fail_if(!eo_do_super(klass, MY_CLASS, simple_class_print()));
fail_if(!eo_do_super(klass, MY_CLASS, simple_class_print2()));
eo_do_super(klass, MY_CLASS, called = simple_class_print());
fail_if(!called);
eo_do_super(klass, MY_CLASS, called = simple_class_print2());
fail_if(!called);
return EINA_TRUE;
}
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(INHERIT2_ID(INHERIT2_SUB_ID_PRINT), _print),
EO_OP_FUNC(INHERIT2_ID(INHERIT2_SUB_ID_PRINT2), _print2),
EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_PRINT), _class_print),
EO_OP_FUNC_SENTINEL
};
EAPI EO_FUNC_BODY(inherit2_print, Eina_Bool, EINA_FALSE);
EAPI EO_FUNC_BODY(inherit2_print2, Eina_Bool, EINA_FALSE);
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT, "Print hey"),
EO_OP_DESCRIPTION(INHERIT2_SUB_ID_PRINT2, "Print hey2"),
EO_OP_DESCRIPTION_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(inherit2_print, _print, "Print hey"),
EO_OP_FUNC(inherit2_print2, _print2, "Print hey2"),
EO_OP_CLASS_FUNC_OVERRIDE(simple_class_print, _class_print),
EO_OP_FUNC_OVERRIDE(simple_a_set, _a_set),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Inherit2",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(&INHERIT2_BASE_ID, op_desc, INHERIT2_SUB_ID_LAST),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};

View File

@ -1,18 +1,8 @@
#ifndef INHERIT2_H
#define INHERIT2_H
extern EAPI Eo_Op INHERIT2_BASE_ID;
enum {
INHERIT2_SUB_ID_PRINT,
INHERIT2_SUB_ID_PRINT2,
INHERIT2_SUB_ID_LAST
};
#define INHERIT2_ID(sub_id) (INHERIT2_BASE_ID + sub_id)
#define inherit2_print() INHERIT2_ID(INHERIT2_SUB_ID_PRINT)
#define inherit2_print2() INHERIT2_ID(INHERIT2_SUB_ID_PRINT2)
EAPI Eina_Bool inherit2_print(void);
EAPI Eina_Bool inherit2_print2(void);
#define INHERIT2_CLASS inherit2_class_get()
const Eo_Class *inherit2_class_get(void);

View File

@ -10,33 +10,25 @@
#define MY_CLASS INHERIT3_CLASS
static void
_a_set(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
_a_set(Eo *obj, void *class_data EINA_UNUSED, int a)
{
int a;
a = va_arg(*list, int);
printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
eo_do_super(obj, MY_CLASS, simple_a_set(a + 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_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(simple_a_set, _a_set),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Inherit3",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};

View File

@ -17,6 +17,7 @@ main(int argc, char *argv[])
(void) argv;
eo_init();
Eina_Bool called = EINA_FALSE;
Eo *obj = eo_add(INHERIT2_CLASS, NULL);
eo_do(obj, simple_a_set(1));
@ -34,24 +35,36 @@ main(int argc, char *argv[])
eo_unref(obj);
obj = eo_add(INHERIT2_CLASS, NULL);
fail_if(!eo_do(obj, inherit2_print()));
fail_if(!eo_do(obj, inherit2_print(), inherit2_print()));
eo_do(obj, called = inherit2_print());
fail_if(!called);
eo_do(obj, called = inherit2_print(), called = inherit2_print());
fail_if(!called);
eo_unref(obj);
obj = eo_add(SIMPLE_CLASS, NULL);
fail_if(eo_do(obj, inherit2_print2()));
eo_do(obj, called = inherit2_print());
fail_if(called);
#ifdef EO_DEBUG
fail_if(eo_do(obj, simple_class_print()));
eo_do(obj, called = simple_class_print());
fail_if(called);
#endif
fail_if(!eo_do(SIMPLE_CLASS, simple_class_print()));
fail_if(!eo_do(INHERIT_CLASS, simple_class_print()));
fail_if(!eo_do(INHERIT2_CLASS, simple_class_print()));
fail_if(!eo_do(INHERIT3_CLASS, simple_class_print()));
eo_do(SIMPLE_CLASS, called = simple_class_print());
fail_if(!called);
eo_do(INHERIT_CLASS, called = simple_class_print());
fail_if(!called);
eo_do(INHERIT2_CLASS, called = simple_class_print());
fail_if(!called);
eo_do(INHERIT3_CLASS, called = simple_class_print());
fail_if(!called);
#ifdef EO_DEBUG
fail_if(eo_do(SIMPLE_CLASS, simple_a_print()));
eo_do(SIMPLE_CLASS, called = simple_a_print());
fail_if(called);
#endif
eo_do_super(obj, SIMPLE_CLASS, eo_constructor());

View File

@ -7,76 +7,73 @@
#include "../eunit_tests.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
#define MY_CLASS SIMPLE_CLASS
Eina_Bool class_print_called = EINA_FALSE;
Eina_Bool class_print2_called = EINA_FALSE;
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)
{
Simple_Public_Data *pd = class_data;
int a;
a = va_arg(*list, int);
printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
pd->a = a;
}
static void
_a_print(Eo *obj EINA_UNUSED, void *class_data, va_list *list)
static Eina_Bool
_a_print(Eo *obj EINA_UNUSED, void *class_data)
{
const Simple_Public_Data *pd = class_data;
(void) list;
Simple_Public_Data *pd = class_data;
printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
return EINA_TRUE;
}
static void
_class_print(Eo_Class *klass, void *data EINA_UNUSED, va_list *list)
static Eina_Bool
_class_print(Eo_Class *klass, void *class_data EINA_UNUSED)
{
(void) list;
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
fail_if(eo_do_super(klass, MY_CLASS, simple_class_print()));
fail_if(eo_do_super(klass, MY_CLASS, simple_class_print2()));
Eina_Bool called = EINA_FALSE;
eo_do_super(klass, MY_CLASS, called = simple_class_print());
fail_if(called);
eo_do_super(klass, MY_CLASS, called = simple_class_print2());
fail_if(called);
return EINA_TRUE;
}
static void
_class_print2(Eo_Class *klass, void *data EINA_UNUSED, va_list *list)
static Eina_Bool
_class_print2(Eo_Class *klass, void *class_data EINA_UNUSED)
{
(void) list;
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
return EINA_TRUE;
}
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_PRINT), _a_print),
EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_PRINT), _class_print),
EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_PRINT2), _class_print2),
EO_OP_FUNC_SENTINEL
};
EAPI EO_VOID_FUNC_BODYV(simple_a_set, EO_FUNC_CALL(a), int a);
EAPI EO_FUNC_BODY(simple_a_print, Eina_Bool, EINA_FALSE);
EAPI EO_FUNC_BODY(simple_class_print, Eina_Bool, EINA_FALSE);
EAPI EO_FUNC_BODY(simple_class_print2, Eina_Bool, EINA_FALSE);
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_PRINT, "Print property A"),
EO_OP_DESCRIPTION_CLASS(SIMPLE_SUB_ID_CLASS_PRINT, "Print class name."),
EO_OP_DESCRIPTION_CLASS(SIMPLE_SUB_ID_CLASS_PRINT2, "Print2 class name."),
EO_OP_DESCRIPTION_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(simple_a_set, _a_set, "Set property A"),
EO_OP_FUNC(simple_a_print, _a_print, "Print property A"),
EO_OP_FUNC(simple_class_print, _class_print, "Print class name."),
EO_OP_FUNC(simple_class_print2, _class_print2, "Print2 class name."),
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_descs),
NULL,
sizeof(Simple_Public_Data),
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -1,27 +1,15 @@
#ifndef SIMPLE_H
#define SIMPLE_H
extern EAPI Eo_Op SIMPLE_BASE_ID;
enum {
SIMPLE_SUB_ID_A_SET,
SIMPLE_SUB_ID_A_PRINT,
SIMPLE_SUB_ID_CLASS_PRINT,
SIMPLE_SUB_ID_CLASS_PRINT2,
SIMPLE_SUB_ID_LAST
};
typedef struct
{
int a;
} Simple_Public_Data;
#define SIMPLE_ID(sub_id) (SIMPLE_BASE_ID + sub_id)
#define simple_a_set(a) SIMPLE_ID(SIMPLE_SUB_ID_A_SET), EO_TYPECHECK(int, a)
#define simple_a_print() SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT)
#define simple_class_print() SIMPLE_ID(SIMPLE_SUB_ID_CLASS_PRINT)
#define simple_class_print2() SIMPLE_ID(SIMPLE_SUB_ID_CLASS_PRINT2)
EAPI void simple_a_set(int a);
EAPI Eina_Bool simple_a_print(void);
EAPI Eina_Bool simple_class_print(void);
EAPI Eina_Bool simple_class_print2(void);
extern const Eo_Event_Description _SIG_A_CHANGED;
#define SIG_A_CHANGED (&(_SIG_A_CHANGED))

View File

@ -6,20 +6,20 @@
#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
EO_FUNC_BODY(interface_ab_sum_get, int, 0);
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(interface_ab_sum_get, NULL, "Get the sum of a and b."),
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_descs),
NULL,
0,
NULL,

View File

@ -1,22 +1,7 @@
#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);

View File

@ -7,20 +7,20 @@
#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
EO_FUNC_BODY(interface2_ab_sum_get2, int, 0);
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC(interface2_ab_sum_get2, NULL, "Print the sum of a and b."),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Interface2",
EO_CLASS_TYPE_INTERFACE,
EO_CLASS_DESCRIPTION_OPS(&INTERFACE2_BASE_ID, op_desc, INTERFACE2_SUB_ID_LAST),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
NULL,

View File

@ -1,22 +1,7 @@
#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);

View File

@ -20,14 +20,14 @@ main(int argc, char *argv[])
eo_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));
int a = 0, b = 0, sum = 0;
eo_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));
eo_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));
eo_do(obj, sum = interface2_ab_sum_get2(), sum = interface2_ab_sum_get2());
fail_if(sum != a + b + 1);
eo_unref(obj);

View File

@ -7,8 +7,6 @@
#include "interface_interface2.h"
#include "interface_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
int a;
@ -18,83 +16,63 @@ typedef struct
#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); \
}
} \
EO_VOID_FUNC_BODYV(simple_##name##_set, EO_FUNC_CALL(name), int name); \
EO_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;
int a = 0, b = 0;
eo_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;
int a = 0, b = 0;
eo_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 Eo_Op_Description op_descs[] = {
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(simple_b_set, _b_set, "Set property b"),
EO_OP_FUNC(simple_b_get, _b_get, "Get property b"),
EO_OP_FUNC_OVERRIDE(interface_ab_sum_get, _ab_sum_get),
EO_OP_FUNC_OVERRIDE(interface2_ab_sum_get2, _ab_sum_get2),
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_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, EO_CLASS, INTERFACE2_CLASS, NULL);

View File

@ -1,45 +1,10 @@
#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);

View File

@ -9,33 +9,29 @@
#define MY_CLASS INHERIT_CLASS
static void
_a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
static int
_a_get(Eo *obj, void *class_data EINA_UNUSED)
{
int *name = va_arg(*list, int *);
eo_do_super(obj, MY_CLASS, simple_a_get(name));
printf("%s\n", __func__);
int ret = 0;
eo_do_super(obj, MY_CLASS, ret = simple_a_get());
printf("%s %d\n", __func__, ret);
return ret;
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(simple_a_get, _a_get),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Inherit",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};

View File

@ -22,11 +22,11 @@ main(int argc, char *argv[])
eo_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), mixin_ab_sum_get(&sum));
int a = 0, b = 0, sum = 0;
eo_do(obj, a = simple_a_get(), b = simple_b_get(), sum = mixin_ab_sum_get());
fail_if(sum != a + b + 2); /* 2 for the two mixins... */
eo_do(obj, mixin_ab_sum_get(&sum), mixin_ab_sum_get(&sum));
eo_do(obj, sum = mixin_ab_sum_get(), sum = mixin_ab_sum_get());
Mixin2_Public_Data *pd2 = eo_data_scope_get(obj, MIXIN2_CLASS);
fail_if(pd2->count != 6);
@ -37,7 +37,8 @@ main(int argc, char *argv[])
eo_unref(obj);
obj = eo_add(INHERIT_CLASS, NULL);
eo_do(obj, simple_a_set(5), simple_a_get(&a));
eo_do(obj, simple_a_set(5), a = simple_a_get());
printf("%d\n", a);
fail_if(a != 5);
eo_unref(obj);

View File

@ -6,62 +6,48 @@
#include "mixin_mixin.h"
#include "mixin_simple.h"
EAPI Eo_Op MIXIN_BASE_ID = 0;
#define MY_CLASS MIXIN_CLASS
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;
int a = 0, b = 0;
eo_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
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
}
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_destructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_destructor());
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
EO_OP_FUNC_SENTINEL
};
EAPI EO_FUNC_BODY(mixin_ab_sum_get, int, 0);
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(MIXIN_SUB_ID_AB_SUM_GET, "Get the sum of a and b."),
EO_OP_DESCRIPTION_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
EO_OP_FUNC(mixin_ab_sum_get, _ab_sum_get, "Get the sum of a and b."),
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_descs),
NULL,
0,
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, NULL)
EO_DEFINE_CLASS(mixin_class_get, &class_desc, NULL, EO_CLASS, NULL)

View File

@ -1,22 +1,7 @@
#ifndef MIXIN_H
#define MIXIN_H
extern EAPI Eo_Op MIXIN_BASE_ID;
enum {
MIXIN_SUB_ID_AB_SUM_GET,
MIXIN_SUB_ID_LAST
};
#define MIXIN_ID(sub_id) (MIXIN_BASE_ID + sub_id)
/**
* @def mixin_ab_sum_get(sum)
* @brief Get sum of a,b integer elements
* @param[out] sum integer pointer to sum - value
*/
#define mixin_ab_sum_get(sum) MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), EO_TYPECHECK(int *, sum)
EAPI int mixin_ab_sum_get(void);
#define MIXIN_CLASS mixin_class_get()
const Eo_Class *mixin_class_get(void);

View File

@ -11,23 +11,25 @@
#define MY_CLASS MIXIN2_CLASS
static void
_ab_sum_get(Eo *obj, void *class_data, va_list *list)
static int
_ab_sum_get(Eo *obj, void *class_data)
{
/* This cast is a hack just for the tests... */
Mixin2_Public_Data *pd = (Mixin2_Public_Data *) class_data;
int *sum = va_arg(*list, int *);
int sum = 0;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
eo_do_super(obj, MY_CLASS, mixin_ab_sum_get(sum));
eo_do_super(obj, MY_CLASS, sum = mixin_ab_sum_get());
++*sum;
++sum;
pd->count += 2;
{
int _a, _b;
eo_do(obj, simple_a_get(&_a), simple_b_get(&_b));
fail_if(*sum != _a + _b + 1);
int _a = 0, _b = 0;
eo_do(obj, _a = simple_a_get(), _b = simple_b_get());
fail_if(sum != _a + _b + 1);
}
return sum;
}
static void
@ -42,27 +44,21 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
eo_do_super(obj, MY_CLASS, eo_destructor());
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
EO_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Mixin2",
EO_CLASS_TYPE_MIXIN,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
sizeof(Mixin2_Public_Data),
_class_constructor,
NULL,
NULL
};

View File

@ -11,23 +11,25 @@
#define MY_CLASS MIXIN3_CLASS
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)
{
/* This cast is just a hack for the test. */
Mixin3_Public_Data *pd = (Mixin3_Public_Data *) class_data;
int *sum = va_arg(*list, int *);
int sum = 0;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
eo_do_super(obj, MY_CLASS, mixin_ab_sum_get(sum));
eo_do_super(obj, MY_CLASS, sum = mixin_ab_sum_get());
++*sum;
++sum;
pd->count += 3;
{
int _a, _b;
eo_do(obj, simple_a_get(&_a), simple_b_get(&_b));
fail_if(*sum != _a + _b + 2);
int _a = 0, _b = 0;
eo_do(obj, _a = simple_a_get(), _b = simple_b_get());
fail_if(sum != _a + _b + 2);
}
return sum;
}
static void
@ -42,27 +44,21 @@ _destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
eo_do_super(obj, MY_CLASS, eo_destructor());
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
EO_OP_FUNC(MIXIN_ID(MIXIN_SUB_ID_AB_SUM_GET), _ab_sum_get),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(eo_destructor, _destructor),
EO_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get),
EO_OP_SENTINEL
};
static const Eo_Class_Description class_desc = {
EO_VERSION,
"Mixin3",
EO_CLASS_TYPE_MIXIN,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
sizeof(Mixin3_Public_Data),
_class_constructor,
NULL,
NULL
};

View File

@ -15,7 +15,7 @@ static const Eo_Class_Description class_desc = {
EO_VERSION,
"Mixin4",
EO_CLASS_TYPE_MIXIN,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
EO_CLASS_DESCRIPTION_NOOPS(),
NULL,
0,
NULL,

View File

@ -8,8 +8,6 @@
#include "mixin_mixin3.h"
#include "mixin_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
int a;
@ -19,59 +17,45 @@ typedef struct
#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); \
}
} \
EO_VOID_FUNC_BODYV(simple_##name##_set, EO_FUNC_CALL(name), int name); \
EO_FUNC_BODY(simple_##name##_get, int, 0);
_GET_SET_FUNC(a)
_GET_SET_FUNC(b)
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_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 Eo_Op_Description op_descs[] = {
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(simple_b_set, _b_set, "Set property b"),
EO_OP_FUNC(simple_b_get, _b_get, "Get property b"),
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_descs),
NULL,
sizeof(Private_Data),
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, MIXIN3_CLASS, MIXIN2_CLASS, NULL);
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS,
MIXIN3_CLASS, MIXIN2_CLASS, NULL);

View File

@ -1,45 +1,10 @@
#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);

View File

@ -79,15 +79,15 @@ main(int argc, char *argv[])
eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1));
fail_if(pd->cb_count != 1);
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 0);
eo_do(obj, eo_event_freeze());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 1);
eo_do(obj, eo_event_freeze());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 2);
eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2));
@ -96,11 +96,11 @@ main(int argc, char *argv[])
eo_do(obj, simple_a_set(2));
fail_if(cb_count != 0);
eo_do(obj, eo_event_thaw());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 1);
eo_do(obj, eo_event_thaw());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 0);
eo_do(obj, simple_a_set(3));
@ -108,17 +108,17 @@ main(int argc, char *argv[])
cb_count = 0;
eo_do(obj, eo_event_thaw());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 0);
eo_do(obj, eo_event_freeze());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 1);
eo_do(obj, simple_a_set(2));
fail_if(cb_count != 0);
eo_do(obj, eo_event_thaw());
eo_do(obj, eo_event_freeze_get(&fcount));
eo_do(obj, fcount = eo_event_freeze_get());
fail_if(fcount != 0);
eo_do(obj, eo_event_callback_del(EV_A_CHANGED, _a_changed_cb, (void *) 1));
@ -133,15 +133,15 @@ main(int argc, char *argv[])
eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1));
fail_if(pd->cb_count != 1);
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 0);
eo_do(EO_BASE_CLASS, eo_event_global_freeze());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_freeze());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 1);
eo_do(EO_BASE_CLASS, eo_event_global_freeze());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_freeze());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 2);
eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2));
@ -149,30 +149,30 @@ main(int argc, char *argv[])
eo_do(obj, simple_a_set(2));
fail_if(cb_count != 0);
eo_do(EO_BASE_CLASS, eo_event_global_thaw());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_thaw());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 1);
eo_do(EO_BASE_CLASS, eo_event_global_thaw());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_thaw());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 0);
eo_do(obj, simple_a_set(3));
fail_if(cb_count != 2);
cb_count = 0;
eo_do(EO_BASE_CLASS, eo_event_global_thaw());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_thaw());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 0);
eo_do(EO_BASE_CLASS, eo_event_global_freeze());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_freeze());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 1);
eo_do(obj, simple_a_set(2));
fail_if(cb_count != 0);
eo_do(EO_BASE_CLASS, eo_event_global_thaw());
eo_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount));
eo_do(EO_CLASS, eo_event_global_thaw());
eo_do(EO_CLASS, fcount = eo_event_global_freeze_get());
fail_if(fcount != 0);

View File

@ -5,8 +5,6 @@
#include "Eo.h"
#include "signals_simple.h"
EAPI Eo_Op SIMPLE_BASE_ID = 0;
typedef struct
{
Simple_Public_Data pub;
@ -19,15 +17,13 @@ EAPI const Eo_Event_Description _EV_A_CHANGED =
#define MY_CLASS SIMPLE_CLASS
static void
_a_set(Eo *obj, void *class_data, va_list *list)
_a_set(Eo *obj, void *class_data, int a)
{
Private_Data *pd = class_data;
int a;
a = va_arg(*list, int);
pd->a = a;
printf("%s %d\n", __func__, pd->a);
eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &pd->a, NULL));
eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &pd->a));
}
Eina_Bool
@ -65,33 +61,25 @@ _cb_deled(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_inf
}
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
_constructor(Eo *obj, void *class_data EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_ADD, _cb_added, NULL));
eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_DEL, _cb_deled, NULL));
eo_do(obj, eo_base_data_set("cb_count", (intptr_t) 0, NULL));
eo_do(obj, eo_key_data_set("cb_count", (intptr_t) 0, NULL));
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
EO_OP_FUNC_SENTINEL
};
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_SENTINEL
static Eo_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(eo_constructor, _constructor),
EO_OP_FUNC(simple_a_set, _a_set, "Set property a"),
EO_OP_SENTINEL
};
static const Eo_Event_Description *event_desc[] = {
EV_A_CHANGED,
NULL
@ -101,12 +89,12 @@ 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_descs),
event_desc,
sizeof(Private_Data),
_class_constructor,
NULL,
NULL
};
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL);
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL);

View File

@ -1,26 +1,12 @@
#ifndef SIMPLE_H
#define SIMPLE_H
extern EAPI Eo_Op SIMPLE_BASE_ID;
enum {
SIMPLE_SUB_ID_A_SET,
SIMPLE_SUB_ID_LAST
};
typedef struct
{
int cb_count;
} Simple_Public_Data;
#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);
extern const Eo_Event_Description _EV_A_CHANGED;
#define EV_A_CHANGED (&(_EV_A_CHANGED))

View File

@ -0,0 +1,53 @@
#include "eo_error_msgs.h"
void
eo_test_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args EINA_UNUSED)
{
struct log_ctx *myctx = data;
if (level > _EINA_LOG_MAX)
return;
ck_assert_int_eq(level, myctx->expected_level);
if (myctx->msg)
ck_assert_str_eq(myctx->msg, fmt);
ck_assert_str_eq(myctx->fnc, fnc);
myctx->did = EINA_TRUE;
#ifdef SHOW_LOG
eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, NULL, args);
#else
(void)d;
(void)file;
(void)line;
#endif
}
void
eo_test_safety_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args EINA_UNUSED)
{
struct log_ctx *myctx = data;
va_list cp_args;
const char *str;
if (level > _EINA_LOG_MAX)
return;
va_copy(cp_args, args);
str = va_arg(cp_args, const char *);
va_end(cp_args);
ck_assert_int_eq(level, myctx->expected_level);
ck_assert_str_eq(fmt, "%s");
ck_assert_str_eq(myctx->msg, str);
ck_assert_str_eq(myctx->fnc, fnc);
myctx->did = EINA_TRUE;
#ifdef SHOW_LOG
eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, NULL, args);
#else
(void)d;
(void)file;
(void)line;
#endif
}

View File

@ -0,0 +1,30 @@
#ifndef _EO_ERROR_MSGS_H
#define _EO_ERROR_MSGS_H
#include "Eo.h"
#include "eo_suite.h"
/* The Max level to consider when working with the print cb. */
#define _EINA_LOG_MAX 2
/* #define SHOW_LOG 1 */
struct log_ctx {
const char *msg;
const char *fnc;
Eina_Bool did;
int expected_level;
};
void
eo_test_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args EINA_UNUSED);
void
eo_test_safety_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args EINA_UNUSED);
#define TEST_EO_ERROR(fn, _msg) \
ctx.msg = _msg; \
ctx.fnc = fn; \
ctx.did = EINA_FALSE; \
ctx.expected_level = EINA_LOG_LEVEL_ERR
#endif /* _EO_ERROR_MSGS_H */

View File

@ -20,7 +20,9 @@ static const Eo_Test_Case etc[] = {
{ "Eo init", eo_test_init },
{ "Eo general", eo_test_general },
{ "Eo class errors", eo_test_class_errors },
{ "Eo call errors", eo_test_call_errors },
{ "Eo eina value", eo_test_value },
{ "Eo threaded eo calls", eo_test_threaded_calls },
{ NULL, NULL }
};

View File

@ -6,6 +6,8 @@
void eo_test_init(TCase *tc);
void eo_test_general(TCase *tc);
void eo_test_class_errors(TCase *tc);
void eo_test_call_errors(TCase *tc);
void eo_test_value(TCase *tc);
void eo_test_threaded_calls(TCase *tc);
#endif /* _EO_SUITE_H */

View File

@ -0,0 +1,73 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include "Eo.h"
#include "eo_suite.h"
#include "eo_error_msgs.h"
#include "eo_test_class_simple.h"
static struct log_ctx ctx;
START_TEST(eo_pure_virtual_fct_call)
{
eo_init();
eina_log_print_cb_set(eo_test_print_cb, &ctx);
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
fail_if(!obj);
TEST_EO_ERROR("_eo_call_resolve", "in %s:%d: you called a pure virtual func '%s' (%d).");
eo_do(obj, simple_pure_virtual());
fail_unless(ctx.did);
eo_unref(obj);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
eo_shutdown();
}
END_TEST
START_TEST(eo_api_not_implemented_call)
{
eo_init();
eina_log_print_cb_set(eo_test_print_cb, &ctx);
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
fail_if(!obj);
TEST_EO_ERROR("_eo_api_op_id_get", "in %s:%d: unable to resolve %s api func %p.");
eo_do(obj, simple_no_implementation());
fail_unless(ctx.did);
eo_unref(obj);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
eo_shutdown();
}
END_TEST
START_TEST(eo_op_not_found_in_super)
{
eo_init();
eina_log_print_cb_set(eo_test_print_cb, &ctx);
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
fail_if(!obj);
TEST_EO_ERROR("_eo_call_resolve", "in %s:%d: func '%s' (%d) could not be resolved for class '%s' for super of '%s'.");
eo_do_super(obj, SIMPLE_CLASS, simple_a_set(10));
fail_unless(ctx.did);
eo_unref(obj);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
eo_shutdown();
}
END_TEST
void eo_test_call_errors(TCase *tc)
{
tcase_add_test(tc, eo_pure_virtual_fct_call);
tcase_add_test(tc, eo_api_not_implemented_call);
tcase_add_test(tc, eo_op_not_found_in_super);
}

Some files were not shown because too many files have changed in this diff Show More