q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=22875f066c5b0f341bdae57d14b4428b525a273e

commit 22875f066c5b0f341bdae57d14b4428b525a273e
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Mon Mar 14 17:16:41 2016 +0000

    eolian: builtin support for event callback signature
---
 src/lib/eolian/database_type.c           | 26 ++++++++++++++++++++------
 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        |  2 ++
 5 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 749281b..bc153a0 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -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);
 }
diff --git a/src/tests/eolian/data/typedef.eo b/src/tests/eolian/data/typedef.eo
index 0e4a647..95d96ad 100644
--- a/src/tests/eolian/data/typedef.eo
+++ b/src/tests/eolian/data/typedef.eo
@@ -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;
diff --git a/src/tests/eolian/data/typedef_ref.c 
b/src/tests/eolian/data/typedef_ref.c
index 5236e54..bfc2b92 100644
--- a/src/tests/eolian/data/typedef_ref.c
+++ b/src/tests/eolian/data/typedef_ref.c
@@ -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,
diff --git a/src/tests/eolian/data/typedef_ref_stub.c 
b/src/tests/eolian/data/typedef_ref_stub.c
index fe9200a..9ba5294 100644
--- a/src/tests/eolian/data/typedef_ref_stub.c
+++ b/src/tests/eolian/data/typedef_ref_stub.c
@@ -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
diff --git a/src/tests/eolian/eolian_parsing.c 
b/src/tests/eolian/eolian_parsing.c
index 13e93bb..e6d522a 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -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();

-- 


Reply via email to