From da43c63ce120708100e5205d3d29df26506ca88c Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 21 Apr 2017 15:47:12 +0200 Subject: [PATCH] eo: move event related structures and callback to C We don't need to keep this in eo files anymore because the APIs using them are now fully in C. This also allows removal of the event callback builtin from Eolian. --- src/lib/eo/Eo.h | 38 +++++++++++++++++++----- src/lib/eo/efl_object.eo | 20 ------------- src/lib/eolian/database_type.c | 7 ----- src/lib/eolian/eo_lexer.c | 1 - src/lib/eolian/eo_lexer.h | 1 - src/tests/eolian/data/typedef.eo | 2 -- src/tests/eolian/data/typedef_ref.c | 2 -- src/tests/eolian/data/typedef_ref_stub.c | 2 -- src/tests/eolian/eolian_parsing.c | 3 +- 9 files changed, 31 insertions(+), 45 deletions(-) diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index fe67aa0938..6e59f38304 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -216,22 +216,44 @@ typedef void (*Efl_Del_Intercept) (Eo *obj_id); */ typedef Eo Efl_Future; -/** - * @typedef Efl_Event - * A parameter passed in event callbacks holding extra event parameters. - */ -typedef struct _Efl_Event Efl_Event; - #include "efl_object_override.eo.h" #include "efl_object.eo.h" #include "efl_interface.eo.h" #define EO_CLASS EFL_OBJECT_CLASS -struct _Efl_Event { +/** + * @struct _Efl_Event + * A parameter passed in event callbacks holding extra event parameters. + */ +typedef struct _Efl_Event { Efl_Object *object; /**< The object the event was called on. */ const Efl_Event_Description *desc; /**< The event description. */ void *info; /**< Extra event information passed by the event caller. */ -}; +} Efl_Event; + +/** An event callback prototype. */ +typedef void (*Efl_Event_Cb)(void *data, const Efl_Event *event); + +/** + * @brief Callback priority value. Range is -32k - 32k. The lower the number, + * the higher the priority. + * + * See @ref EFL_CALLBACK_PRIORITY_AFTER, @ref EFL_CALLBACK_PRIORITY_BEFORE @ref + * EFL_CALLBACK_PRIORITY_DEFAULT + */ +typedef short Efl_Callback_Priority; + +/** + * @struct _Efl_Callback_Array_Item + * @brief An item in an array of callback desc/func. + * + * See also efl_event_callback_array_add(). + */ +typedef struct _Efl_Callback_Array_Item +{ + const Efl_Event_Description *desc; /**< The event description. */ + Efl_Event_Cb func; /**< The callback function. */ +} Efl_Callback_Array_Item; /** * @brief Add a callback for an event with a specific priority. diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo index c55ed76e2c..f5f1d4e08e 100644 --- a/src/lib/eo/efl_object.eo +++ b/src/lib/eo/efl_object.eo @@ -8,32 +8,12 @@ struct Efl.Event.Description { restart: bool; [[$true if when the event is triggered again from a callback, it should start from where it was]] } -type Efl.Event_Cb: __builtin_event_cb; [[An event callback prototype.]] - -struct Efl.Callback_Array_Item { - [[An item in an array of callback desc/func. - - See also \@ref efl_event_callback_array_add. - ]] - desc: ptr(const(Efl.Event.Description)); [[The event description.]] - func: Efl.Event_Cb; [[The callback function.]] -} - struct Efl.Dbg_Info { [[The structure for the debug info used by Eo.]] name: stringshare; [[The name of the part (stringshare).]] value: generic_value; [[The value.]] } - -type Efl.Callback_Priority: short; [[Callback priority value. Range is -32k - 32k. - The lower the number, the higher the priority. - - See \@ref EFL_CALLBACK_PRIORITY_AFTER, - \@ref EFL_CALLBACK_PRIORITY_BEFORE - \@ref EFL_CALLBACK_PRIORITY_DEFAULT - ]] - abstract Efl.Object () { [[Abstract Efl object class]] diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 1d08faa4b7..9ac5a981b3 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -200,13 +200,6 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) if (tp->base_type->type == EOLIAN_TYPE_REGULAR) { - if (!strcmp(tp->base_type->name, "__builtin_event_cb")) - { - eina_strbuf_append(buf, "void (*"); - _append_name(tp, buf); - eina_strbuf_append(buf, ")(void *data, const Efl_Event *event)"); - return; - } if (!strcmp(tp->base_type->name, "__builtin_free_cb")) { eina_strbuf_append(buf, "void (*"); diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index f806c414c8..5521e09b81 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -79,7 +79,6 @@ static const char * const ctypes[] = "void *", - "Efl_Event_Cb", "Eina_Free_Cb", }; diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h index 56ef7664b5..45a6ab70f2 100644 --- a/src/lib/eolian/eo_lexer.h +++ b/src/lib/eolian/eo_lexer.h @@ -57,7 +57,6 @@ enum Tokens KW(generic_value), KW(string), KW(stringshare), \ \ KW(void_ptr), \ - KW(__builtin_event_cb), \ KW(__builtin_free_cb), \ KW(__undefined_type), \ \ diff --git a/src/tests/eolian/data/typedef.eo b/src/tests/eolian/data/typedef.eo index 258595ae7b..3e60100a2c 100644 --- a/src/tests/eolian/data/typedef.eo +++ b/src/tests/eolian/data/typedef.eo @@ -8,8 +8,6 @@ type @extern Evas.Pants: float; /* not generated */ type Undef: __undefined_type; /* not generated */ -type Event: __builtin_event_cb; /* specially generated */ - type Free: __builtin_free_cb; /* specially generated */ enum Enum.Bar diff --git a/src/tests/eolian/data/typedef_ref.c b/src/tests/eolian/data/typedef_ref.c index 61d451ebfa..24d4bc6260 100644 --- a/src/tests/eolian/data/typedef_ref.c +++ b/src/tests/eolian/data/typedef_ref.c @@ -19,8 +19,6 @@ typedef Evas_Coord Evas_Coord2; typedef Evas_Coord2 Evas_Coord3; -typedef void (*Event)(void *data, const Efl_Event *event); - typedef void (*Free)(void *data); typedef enum diff --git a/src/tests/eolian/data/typedef_ref_stub.c b/src/tests/eolian/data/typedef_ref_stub.c index 3e1361557f..9dee52ad61 100644 --- a/src/tests/eolian/data/typedef_ref_stub.c +++ b/src/tests/eolian/data/typedef_ref_stub.c @@ -11,8 +11,6 @@ typedef Evas_Coord Evas_Coord2; typedef Evas_Coord2 Evas_Coord3; -typedef void (*Event)(void *data, const Efl_Event *event); - typedef void (*Free)(void *data); diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index f4dc6e2ef4..9c9ac54ab7 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -377,8 +377,7 @@ START_TEST(eolian_typedef) fail_if(!eina_iterator_next(iter, (void**)&tdl)); /* not generated undefined type, skip */ fail_if(!eina_iterator_next(iter, (void**)&tdl)); - /* event type and free cb, tested by generation tests */ - fail_if(!eina_iterator_next(iter, (void**)&tdl)); + /* free cb, tested by generation tests */ fail_if(!eina_iterator_next(iter, (void**)&tdl)); fail_if(eina_iterator_next(iter, (void**)&tdl));