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.
This commit is contained in:
Daniel Kolesa 2017-04-21 15:47:12 +02:00
parent c9377e2ef7
commit da43c63ce1
9 changed files with 31 additions and 45 deletions

View File

@ -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.

View File

@ -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]]

View File

@ -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 (*");

View File

@ -79,7 +79,6 @@ static const char * const ctypes[] =
"void *",
"Efl_Event_Cb",
"Eina_Free_Cb",
};

View File

@ -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), \
\

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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));