summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2016-05-24 15:41:39 +0300
committerYakov Goldberg <yakov.g@samsung.com>2016-05-29 16:37:18 +0300
commit64e3eed4fd708e7d6fd71f422bd5c8cdd1b90dc7 (patch)
treeff512282a78a31dac32c9779185543034e62a200
parent70226ff36e02a9f7d83da3842ba9f3f9d39900fa (diff)
Fix event name generationdevs/yakov/develop
-rw-r--r--src/lib/plugin_C.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/lib/plugin_C.c b/src/lib/plugin_C.c
index 7b9acfc..2a7a89a 100644
--- a/src/lib/plugin_C.c
+++ b/src/lib/plugin_C.c
@@ -7,50 +7,38 @@
7#include "plugin_C.h" 7#include "plugin_C.h"
8#include "database.h" 8#include "database.h"
9 9
10static Eina_Strbuf * 10static Eina_Stringshare *
11_eo_event_name_get(const char *class_name, const char *event_name) 11_eo_event_name_get(const char *class_name, const char *event_name)
12{ 12{
13 Eina_Strbuf *eo_event = NULL;
14 Eina_List *classes = eo_class_mro_get(class_name), *itr; 13 Eina_List *classes = eo_class_mro_get(class_name), *itr;
15 const char *inherit; 14 const char *inherit;
15 Eina_Stringshare *ev_c_name = NULL;
16 16
17 EINA_LIST_FOREACH(classes, itr, inherit) 17 EINA_LIST_FOREACH(classes, itr, inherit)
18 { 18 {
19 Eolian_Event *event;
20 const Eolian_Class *class = eolian_class_get_by_name(inherit); 19 const Eolian_Class *class = eolian_class_get_by_name(inherit);
21 Eina_Iterator *events = eolian_class_events_get(class); 20 const Eolian_Event *event = eolian_class_event_get_by_name(class, event_name);
22 EINA_ITERATOR_FOREACH(events, event) 21 if (event)
23 { 22 {
24 const char *ev_name = eolian_event_name_get(event); 23 ev_c_name = eolian_event_c_name_get(event);
25 if (!strcmp(ev_name, event_name)) 24 goto end;
26 {
27 eo_event = eina_strbuf_new();
28 eina_strbuf_append_printf(eo_event, "%s_EVENT_%s", inherit, event_name);
29 eina_strbuf_replace_all(eo_event, ",", "_");
30 eina_strbuf_replace_all(eo_event, ".", "_");
31 char *str = (char *)eina_strbuf_string_get(eo_event);
32 eina_str_toupper(&str);
33 eina_iterator_free(events);
34 goto end;
35 }
36 } 25 }
37 eina_iterator_free(events);
38 } 26 }
39 printf("%s: Event %s not found in the class hierarchy of %s\n", 27 printf("%s: Event %s not found in the class hierarchy of %s\n",
40 __FUNCTION__, event_name, class_name); 28 __FUNCTION__, event_name, class_name);
41end: 29end:
42 eina_list_free(classes); 30 eina_list_free(classes);
43 return eo_event; 31 return ev_c_name;
44} 32}
45 33
46char * 34char *
47_c_plugin_eo_event_name_get(const char *class_name, const char *event_name) 35_c_plugin_eo_event_name_get(const char *class_name, const char *event_name)
48{ 36{
49 char *str = NULL; 37 char *str = NULL;
50 Eina_Strbuf *buf = _eo_event_name_get(class_name, event_name); 38 Eina_Stringshare *buf = _eo_event_name_get(class_name, event_name);
51 if (buf) 39 if (buf)
52 str = eina_strbuf_string_steal(buf); 40 str = strdup(buf);
53 eina_strbuf_free(buf); 41 eina_stringshare_del(buf);
54 return str; 42 return str;
55} 43}
56 44
@@ -58,7 +46,8 @@ const Eo_Event_Description *
58_c_plugin_eo_event_get(const char *class_name, const char *event_name) 46_c_plugin_eo_event_get(const char *class_name, const char *event_name)
59{ 47{
60 const Eo_Event_Description *eo_event = NULL; 48 const Eo_Event_Description *eo_event = NULL;
61 Eina_Strbuf *buf = _eo_event_name_get(class_name, event_name); 49 Eina_Strbuf *buf = eina_strbuf_new();
50 eina_strbuf_append_printf(buf, "%s", _eo_event_name_get(class_name, event_name));
62 if (buf) 51 if (buf)
63 { 52 {
64 eina_strbuf_prepend_printf(buf, "_"); 53 eina_strbuf_prepend_printf(buf, "_");