summaryrefslogtreecommitdiff
path: root/src/bin/eolian/eo_generator.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-09-25 15:09:36 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-09-25 15:09:36 +0100
commit13a9650491edac356c098a2c605a444d2e16af09 (patch)
treefd6ecba5fe727c1da2b7b5e3ed1490e679036a60 /src/bin/eolian/eo_generator.c
parenta1552fe6a9f8fc07929a68dafc0413c5338bcd61 (diff)
eolian: properly replace commas in event_c_name_get and cleanup generator
Diffstat (limited to 'src/bin/eolian/eo_generator.c')
-rw-r--r--src/bin/eolian/eo_generator.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index e1a7bfe1a7..31431abbfc 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -265,7 +265,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
265 itr = eolian_class_events_get(class); 265 itr = eolian_class_events_get(class);
266 EINA_ITERATOR_FOREACH(itr, event) 266 EINA_ITERATOR_FOREACH(itr, event)
267 { 267 {
268 const char *evname = eolian_event_c_name_get(event); 268 Eina_Stringshare *evname = eolian_event_c_name_get(event);
269 const char *evdesc = eolian_event_description_get(event); 269 const char *evdesc = eolian_event_description_get(event);
270 Eolian_Object_Scope scope = eolian_event_scope_get(event); 270 Eolian_Object_Scope scope = eolian_event_scope_get(event);
271 271
@@ -287,14 +287,9 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
287 eina_strbuf_prepend(tmpbuf," * "); 287 eina_strbuf_prepend(tmpbuf," * ");
288 eina_strbuf_append_printf(str_ev, "/**\n%s\n */\n", eina_strbuf_string_get(tmpbuf)); 288 eina_strbuf_append_printf(str_ev, "/**\n%s\n */\n", eina_strbuf_string_get(tmpbuf));
289 289
290 eina_strbuf_reset(tmpbuf); 290 eina_strbuf_append_printf(str_ev, "#define %s (&(_%s))\n", evname, evname);
291 eina_strbuf_append(tmpbuf, evname); 291 eina_strbuf_append_printf(str_extrn_ev, "EOAPI extern const Eo_Event_Description _%s;\n", evname);
292 eina_stringshare_del(evname); 292 eina_stringshare_del(evname);
293 eina_strbuf_replace_all(tmpbuf, ",", "_");
294 char* s = (char *)eina_strbuf_string_get(tmpbuf);
295 eina_str_toupper(&s);
296 eina_strbuf_append_printf(str_ev, "#define %s (&(_%s))\n", s, s);
297 eina_strbuf_append_printf(str_extrn_ev, "EOAPI extern const Eo_Event_Description _%s;\n", s);
298 293
299 if (scope == EOLIAN_SCOPE_PROTECTED) 294 if (scope == EOLIAN_SCOPE_PROTECTED)
300 { 295 {
@@ -662,35 +657,25 @@ eo_source_beginning_generate(const Eolian_Class *class, Eina_Strbuf *buf)
662 Eina_Iterator *itr; 657 Eina_Iterator *itr;
663 658
664 Eina_Strbuf *tmpbuf = eina_strbuf_new(); 659 Eina_Strbuf *tmpbuf = eina_strbuf_new();
665 Eina_Strbuf *str_ev = eina_strbuf_new();
666 660
667 Eolian_Event *event; 661 Eolian_Event *event;
668 itr = eolian_class_events_get(class); 662 itr = eolian_class_events_get(class);
669 EINA_ITERATOR_FOREACH(itr, event) 663 EINA_ITERATOR_FOREACH(itr, event)
670 { 664 {
671 const char *evname = eolian_event_c_name_get(event); 665 Eina_Stringshare *evname = eolian_event_c_name_get(event);
672 const char *evdesc = eolian_event_description_get(event); 666 const char *evdesc = eolian_event_description_get(event);
673 char *evdesc_line1; 667 char *evdesc_line1 = _source_desc_get(evdesc);
674 char *p;
675
676 eina_strbuf_reset(str_ev);
677 evdesc_line1 = _source_desc_get(evdesc);
678 eina_strbuf_append(str_ev, evname);
679 eina_stringshare_del(evname);
680 p = (char *)eina_strbuf_string_get(str_ev);
681 eina_str_toupper(&p);
682 eina_strbuf_replace_all(str_ev, ",", "_");
683 668
684 eina_strbuf_append_printf(tmpbuf, 669 eina_strbuf_append_printf(tmpbuf,
685 "EOAPI const Eo_Event_Description _%s =\n EO_EVENT_DESCRIPTION(\"%s\", \"%s\");\n", 670 "EOAPI const Eo_Event_Description _%s =\n EO_EVENT_DESCRIPTION(\"%s\", \"%s\");\n",
686 eina_strbuf_string_get(str_ev), eolian_event_name_get(event), evdesc_line1); 671 evname, eolian_event_name_get(event), evdesc_line1);
672 eina_stringshare_del(evname);
687 free(evdesc_line1); 673 free(evdesc_line1);
688 } 674 }
689 eina_iterator_free(itr); 675 eina_iterator_free(itr);
690 676
691 eina_strbuf_append(buf, eina_strbuf_string_get(tmpbuf)); 677 eina_strbuf_append(buf, eina_strbuf_string_get(tmpbuf));
692 678
693 eina_strbuf_free(str_ev);
694 eina_strbuf_free(tmpbuf); 679 eina_strbuf_free(tmpbuf);
695 return EINA_TRUE; 680 return EINA_TRUE;
696} 681}
@@ -880,16 +865,9 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
880 itr = eolian_class_events_get(class); 865 itr = eolian_class_events_get(class);
881 EINA_ITERATOR_FOREACH(itr, event) 866 EINA_ITERATOR_FOREACH(itr, event)
882 { 867 {
883 const char *evname = eolian_event_c_name_get(event); 868 Eina_Stringshare *evname = eolian_event_c_name_get(event);
884 char *p; 869 eina_strbuf_append_printf(str_ev, "\n %s,", evname);
885
886 eina_strbuf_reset(tmpbuf);
887 eina_strbuf_append(tmpbuf, evname);
888 eina_stringshare_del(evname); 870 eina_stringshare_del(evname);
889 p = (char *)eina_strbuf_string_get(tmpbuf);
890 eina_str_toupper(&p);
891 eina_strbuf_replace_all(tmpbuf, ",", "_");
892 eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf));
893 } 871 }
894 eina_iterator_free(itr); 872 eina_iterator_free(itr);
895 873