eolian: add a builtin to handle a free callback.

This commit is contained in:
Cedric BAIL 2016-06-29 15:25:22 -07:00
parent ed9dff8fbd
commit 36bc9aa187
7 changed files with 25 additions and 7 deletions

View File

@ -198,13 +198,22 @@ _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"))
if (tp->base_type->type == EOLIAN_TYPE_REGULAR)
{
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_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 (*");
_append_name(tp, buf);
eina_strbuf_append(buf, ")(void *data)");
return;
}
}
Eina_Strbuf *fulln = eina_strbuf_new();

View File

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

View File

@ -58,6 +58,7 @@ enum Tokens
\
KW(void_ptr), \
KW(__builtin_event_cb), \
KW(__builtin_free_cb), \
KW(__undefined_type), \
\
KW(true), KW(false), KW(null)

View File

@ -10,6 +10,8 @@ type Undef: __undefined_type; /* not generated */
type Event: __builtin_event_cb; /* specially generated */
type Free: __builtin_free_cb; /* specially generated */
enum Enum.Bar
{
legacy: bar;

View File

@ -21,6 +21,8 @@ typedef Evas_Coord2 Evas_Coord3;
typedef void (*Event)(void *data, const Efl_Event *event);
typedef void (*Free)(void *data);
typedef enum
{
BAR_FIRST_ITEM = 0,

View File

@ -13,5 +13,7 @@ typedef Evas_Coord2 Evas_Coord3;
typedef void (*Event)(void *data, const Efl_Event *event);
typedef void (*Free)(void *data);
#endif

View File

@ -410,7 +410,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 */
/* event type and free cb, tested by generation tests */
fail_if(!eina_iterator_next(iter, (void**)&tdl));
fail_if(!eina_iterator_next(iter, (void**)&tdl));
fail_if(eina_iterator_next(iter, (void**)&tdl));