summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-06-29 15:25:22 -0700
committerCedric Bail <cedric@osg.samsung.com>2016-08-04 11:00:24 -0700
commit6a13677a438414d0e76a678751b0f1cefc8310e0 (patch)
tree51ea1e0ba112ced71af13eb286e0237ae125fcea
parentf73fa86950dfda44c1c93c4e449face2861572b9 (diff)
eolian: add a builtin to handle a free callback.
-rw-r--r--src/lib/eolian/database_type.c21
-rw-r--r--src/lib/eolian/eo_lexer.c1
-rw-r--r--src/lib/eolian/eo_lexer.h1
-rw-r--r--src/tests/eolian/data/typedef.eo2
-rw-r--r--src/tests/eolian/data/typedef_ref.c2
-rw-r--r--src/tests/eolian/data/typedef_ref_stub.c2
-rw-r--r--src/tests/eolian/eolian_parsing.c3
7 files changed, 25 insertions, 7 deletions
diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index 8bc8b02524..35581fc603 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -198,13 +198,22 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf)
198{ 198{
199 eina_strbuf_append(buf, "typedef "); 199 eina_strbuf_append(buf, "typedef ");
200 200
201 if (tp->base_type->type == EOLIAN_TYPE_REGULAR && 201 if (tp->base_type->type == EOLIAN_TYPE_REGULAR)
202 !strcmp(tp->base_type->name, "__builtin_event_cb"))
203 { 202 {
204 eina_strbuf_append(buf, "void (*"); 203 if (!strcmp(tp->base_type->name, "__builtin_event_cb"))
205 _append_name(tp, buf); 204 {
206 eina_strbuf_append(buf, ")(void *data, const Eo_Event *event)"); 205 eina_strbuf_append(buf, "void (*");
207 return; 206 _append_name(tp, buf);
207 eina_strbuf_append(buf, ")(void *data, const Eo_Event *event)");
208 return;
209 }
210 if (!strcmp(tp->base_type->name, "__builtin_free_cb"))
211 {
212 eina_strbuf_append(buf, "void (*");
213 _append_name(tp, buf);
214 eina_strbuf_append(buf, ")(void *data)");
215 return;
216 }
208 } 217 }
209 218
210 Eina_Strbuf *fulln = eina_strbuf_new(); 219 Eina_Strbuf *fulln = eina_strbuf_new();
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index 63320bcc0a..5d6d953292 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -81,6 +81,7 @@ static const char * const ctypes[] =
81 "void *", 81 "void *",
82 82
83 "Eo_Event_Cb", 83 "Eo_Event_Cb",
84 "Eina_Free_Cb",
84}; 85};
85 86
86#undef KW 87#undef KW
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index b33f047396..beaeca65f6 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -58,6 +58,7 @@ enum Tokens
58 \ 58 \
59 KW(void_ptr), \ 59 KW(void_ptr), \
60 KW(__builtin_event_cb), \ 60 KW(__builtin_event_cb), \
61 KW(__builtin_free_cb), \
61 KW(__undefined_type), \ 62 KW(__undefined_type), \
62 \ 63 \
63 KW(true), KW(false), KW(null) 64 KW(true), KW(false), KW(null)
diff --git a/src/tests/eolian/data/typedef.eo b/src/tests/eolian/data/typedef.eo
index b76ecb3bde..6c87ccdf31 100644
--- a/src/tests/eolian/data/typedef.eo
+++ b/src/tests/eolian/data/typedef.eo
@@ -10,6 +10,8 @@ type Undef: __undefined_type; /* not generated */
10 10
11type Event: __builtin_event_cb; /* specially generated */ 11type Event: __builtin_event_cb; /* specially generated */
12 12
13type Free: __builtin_free_cb; /* specially generated */
14
13enum Enum.Bar 15enum Enum.Bar
14{ 16{
15 legacy: bar; 17 legacy: bar;
diff --git a/src/tests/eolian/data/typedef_ref.c b/src/tests/eolian/data/typedef_ref.c
index 14d0dfd8d6..edc7555b4d 100644
--- a/src/tests/eolian/data/typedef_ref.c
+++ b/src/tests/eolian/data/typedef_ref.c
@@ -21,6 +21,8 @@ typedef Evas_Coord2 Evas_Coord3;
21 21
22typedef void (*Event)(void *data, const Eo_Event *event); 22typedef void (*Event)(void *data, const Eo_Event *event);
23 23
24typedef void (*Free)(void *data);
25
24typedef enum 26typedef enum
25{ 27{
26 BAR_FIRST_ITEM = 0, 28 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 033d5dac53..8dd7cafd02 100644
--- a/src/tests/eolian/data/typedef_ref_stub.c
+++ b/src/tests/eolian/data/typedef_ref_stub.c
@@ -13,5 +13,7 @@ typedef Evas_Coord2 Evas_Coord3;
13 13
14typedef void (*Event)(void *data, const Eo_Event *event); 14typedef void (*Event)(void *data, const Eo_Event *event);
15 15
16typedef void (*Free)(void *data);
17
16 18
17#endif 19#endif
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 2a880dac02..d10dcdd087 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -410,7 +410,8 @@ START_TEST(eolian_typedef)
410 fail_if(!eina_iterator_next(iter, (void**)&tdl)); 410 fail_if(!eina_iterator_next(iter, (void**)&tdl));
411 /* not generated undefined type, skip */ 411 /* not generated undefined type, skip */
412 fail_if(!eina_iterator_next(iter, (void**)&tdl)); 412 fail_if(!eina_iterator_next(iter, (void**)&tdl));
413 /* event type, tested by generation tests */ 413 /* event type and free cb, tested by generation tests */
414 fail_if(!eina_iterator_next(iter, (void**)&tdl));
414 fail_if(!eina_iterator_next(iter, (void**)&tdl)); 415 fail_if(!eina_iterator_next(iter, (void**)&tdl));
415 fail_if(eina_iterator_next(iter, (void**)&tdl)); 416 fail_if(eina_iterator_next(iter, (void**)&tdl));
416 417