eolian: builtin support for event callback signature
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Mon, 14 Mar 2016 17:16:41 +0000 (17:16 +0000)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Mon, 14 Mar 2016 17:16:41 +0000 (17:16 +0000)
src/lib/eolian/database_type.c
src/tests/eolian/data/typedef.eo
src/tests/eolian/data/typedef_ref.c
src/tests/eolian/data/typedef_ref_stub.c
src/tests/eolian/eolian_parsing.c

index 749281b..bc153a0 100644 (file)
@@ -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_LIST_FOREACH(tp->namespaces, l, sp)
+     {
+        eina_strbuf_append(buf, sp);
+        eina_strbuf_append_char(buf, '_');
+     }
+   eina_strbuf_append(buf, tp->name);
+}
+
+static void
+_atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
+{
    eina_strbuf_append(buf, "typedef ");
 
-   EINA_LIST_FOREACH(tp->namespaces, l, sp)
+   if (tp->base_type->type == EOLIAN_TYPE_REGULAR &&
+       !strcmp(tp->base_type->name, "__builtin_event_cb"))
      {
-        eina_strbuf_append(fulln, sp);
-        eina_strbuf_append_char(fulln, '_');
+        eina_strbuf_append(buf, "Eina_Bool (*");
+        _append_name(tp, buf);
+        eina_strbuf_append(buf, ")(void *data, const Eo_Event *event)");
+        return;
      }
-   eina_strbuf_append(fulln, tp->name);
 
+   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);
 }
index 0e4a647..95d96ad 100644 (file)
@@ -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;
index 5236e54..bfc2b92 100644 (file)
@@ -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,
index fe9200a..9ba5294 100644 (file)
@@ -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
index 13e93bb..e6d522a 100644 (file)
@@ -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();