forked from enlightenment/efl
eolian: builtin support for event callback signature
This commit is contained in:
parent
fbd9defdd4
commit
22875f066c
|
@ -195,21 +195,35 @@ _etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name)
|
|||
}
|
||||
|
||||
static void
|
||||
_atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||
_append_name(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||
{
|
||||
Eina_Strbuf *fulln = eina_strbuf_new();
|
||||
Eina_List *l;
|
||||
const char *sp;
|
||||
|
||||
eina_strbuf_append(buf, "typedef ");
|
||||
|
||||
EINA_LIST_FOREACH(tp->namespaces, l, sp)
|
||||
{
|
||||
eina_strbuf_append(fulln, sp);
|
||||
eina_strbuf_append_char(fulln, '_');
|
||||
eina_strbuf_append(buf, sp);
|
||||
eina_strbuf_append_char(buf, '_');
|
||||
}
|
||||
eina_strbuf_append(fulln, tp->name);
|
||||
eina_strbuf_append(buf, tp->name);
|
||||
}
|
||||
|
||||
static void
|
||||
_atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
|
||||
{
|
||||
eina_strbuf_append(buf, "typedef ");
|
||||
|
||||
if (tp->base_type->type == EOLIAN_TYPE_REGULAR &&
|
||||
!strcmp(tp->base_type->name, "__builtin_event_cb"))
|
||||
{
|
||||
eina_strbuf_append(buf, "Eina_Bool (*");
|
||||
_append_name(tp, buf);
|
||||
eina_strbuf_append(buf, ")(void *data, const Eo_Event *event)");
|
||||
return;
|
||||
}
|
||||
|
||||
Eina_Strbuf *fulln = eina_strbuf_new();
|
||||
_append_name(tp, fulln);
|
||||
database_type_to_str(tp->base_type, buf, eina_strbuf_string_get(fulln));
|
||||
eina_strbuf_free(fulln);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ type @extern Evas.Pants: float; /* not generated */
|
|||
|
||||
type Undef: __undefined_type; /* not generated */
|
||||
|
||||
type Event: __builtin_event_cb; /* specially generated */
|
||||
|
||||
enum Enum.Bar
|
||||
{
|
||||
legacy: bar;
|
||||
|
|
|
@ -19,6 +19,8 @@ typedef Evas_Coord Evas_Coord2;
|
|||
|
||||
typedef Evas_Coord2 Evas_Coord3;
|
||||
|
||||
typedef Eina_Bool (*Event)(void *data, const Eo_Event *event);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BAR_FIRST_ITEM = 0,
|
||||
|
|
|
@ -11,5 +11,7 @@ typedef Evas_Coord Evas_Coord2;
|
|||
|
||||
typedef Evas_Coord2 Evas_Coord3;
|
||||
|
||||
typedef Eina_Bool (*Event)(void *data, const Eo_Event *event);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -418,6 +418,8 @@ 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, tested by generation tests */
|
||||
fail_if(!eina_iterator_next(iter, (void**)&tdl));
|
||||
fail_if(eina_iterator_next(iter, (void**)&tdl));
|
||||
|
||||
eolian_shutdown();
|
||||
|
|
Loading…
Reference in New Issue