diff options
author | Yossi Kantor <yossi.kantor@samsung.com> | 2014-02-20 14:47:46 +0200 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-03-03 14:09:57 +0200 |
commit | 67dd5ef497ae08a2943d3fae64ec91c56701dc6e (patch) | |
tree | 47f7bb32876ca382944bf7a1a3914d5a0ca1ceed /src/bin/eolian/eo1_generator.c | |
parent | 87f661e08ed7a88e831dce456ed163cd7e4749f3 (diff) |
Eolian: New generation feature tested and bugs fixed
1) Underscore for static global names
2) Escape special characters for in-code descriptions
3) Proper spaces for generated lines
Diffstat (limited to 'src/bin/eolian/eo1_generator.c')
-rw-r--r-- | src/bin/eolian/eo1_generator.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c index ab5f80b066..8e1f2407f6 100644 --- a/src/bin/eolian/eo1_generator.c +++ b/src/bin/eolian/eo1_generator.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | static const char | 8 | static const char |
9 | tmpl_eo_src_begin[] = "\ | 9 | tmpl_eo_src_begin[] = "\ |
10 | \n\ | ||
10 | EAPI Eo_Op @#OBJCLASS_BASE_ID = EO_NOOP;\n\ | 11 | EAPI Eo_Op @#OBJCLASS_BASE_ID = EO_NOOP;\n\ |
11 | \n\ | 12 | \n\ |
12 | @#list_events\n\ | 13 | @#list_events\n\ |
@@ -15,6 +16,7 @@ EAPI Eo_Op @#OBJCLASS_BASE_ID = EO_NOOP;\n\ | |||
15 | 16 | ||
16 | static const char | 17 | static const char |
17 | tmpl_dtor[] = "\ | 18 | tmpl_dtor[] = "\ |
19 | static void\n\ | ||
18 | _gen_@#class_class_destructor(Eo_Class *klass)\n\ | 20 | _gen_@#class_class_destructor(Eo_Class *klass)\n\ |
19 | {\n\ | 21 | {\n\ |
20 | _@#class_class_destructor(klass);\n\ | 22 | _@#class_class_destructor(klass);\n\ |
@@ -37,26 +39,26 @@ _gen_@#class_class_constructor(Eo_Class *klass)\n\ | |||
37 | }\n\ | 39 | }\n\ |
38 | \n\ | 40 | \n\ |
39 | @#dtor_func\ | 41 | @#dtor_func\ |
40 | static const Eo_Op_Description @#class_op_desc[] = {@#list_op\n\ | 42 | static const Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\ |
41 | EO_OP_DESCRIPTION_SENTINEL\n\ | 43 | EO_OP_DESCRIPTION_SENTINEL\n\ |
42 | };\n\ | 44 | };\n\ |
43 | \n\ | 45 | \n\ |
44 | static const Eo_Event_Description *@#class_event_desc[] = {@#list_evdesc\n\ | 46 | static const Eo_Event_Description *_@#class_event_desc[] = {@#list_evdesc\n\ |
45 | NULL\n\ | 47 | NULL\n\ |
46 | };\n\ | 48 | };\n\ |
47 | \n\ | 49 | \n\ |
48 | static const Eo_Class_Description @#class_class_desc = {\n\ | 50 | static const Eo_Class_Description _@#class_class_desc = {\n\ |
49 | EO_VERSION,\n\ | 51 | EO_VERSION,\n\ |
50 | \"@#Class\",\n\ | 52 | \"@#Class\",\n\ |
51 | @#type_class,\n\ | 53 | @#type_class,\n\ |
52 | EO_CLASS_DESCRIPTION_OPS(&@#OBJCLASS_BASE_ID, @#class_op_desc, @#OBJCLASS_SUB_ID_LAST),\n\ | 54 | EO_CLASS_DESCRIPTION_OPS(&@#OBJCLASS_BASE_ID, _@#class_op_desc, @#OBJCLASS_SUB_ID_LAST),\n\ |
53 | @#class_event_desc,\n\ | 55 | _@#class_event_desc,\n\ |
54 | sizeof(@#Class_Data),\n\ | 56 | sizeof(@#Class_Data),\n\ |
55 | _gen_@#class_class_constructor,\n\ | 57 | _gen_@#class_class_constructor,\n\ |
56 | @#dtor_name\n\ | 58 | @#dtor_name\n\ |
57 | };\n\ | 59 | };\n\ |
58 | \n\ | 60 | \n\ |
59 | EO_DEFINE_CLASS(@#objclass_class_get, &@#class_class_desc, @#list_inheritNULL);\ | 61 | EO_DEFINE_CLASS(@#objclass_class_get, &_@#class_class_desc, @#list_inheritNULL);\ |
60 | "; | 62 | "; |
61 | 63 | ||
62 | static const char | 64 | static const char |
@@ -299,11 +301,11 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf) | |||
299 | static const char* | 301 | static const char* |
300 | _varg_upgr(const char *stype) | 302 | _varg_upgr(const char *stype) |
301 | { | 303 | { |
302 | if (!strcmp(stype, "Eina_Bool") || | 304 | if (!strcmp(stype, "Eina_Bool") || |
303 | !strcmp(stype, "char") || | 305 | !strcmp(stype, "char") || |
304 | !strcmp(stype, "short")) | 306 | !strcmp(stype, "short")) |
305 | return "int"; | 307 | return "int"; |
306 | return stype; | 308 | return stype; |
307 | } | 309 | } |
308 | 310 | ||
309 | Eina_Bool | 311 | Eina_Bool |
@@ -465,7 +467,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf) | |||
465 | char *evdesc_line1; | 467 | char *evdesc_line1; |
466 | 468 | ||
467 | eolian_class_event_information_get(event, &evname, &evdesc); | 469 | eolian_class_event_information_get(event, &evname, &evdesc); |
468 | evdesc_line1 = _first_line_get(evdesc); | 470 | evdesc_line1 = _source_desc_get(evdesc); |
469 | _template_fill(str_ev, "@#CLASS_@#FUNC", classname, evname, EINA_TRUE); | 471 | _template_fill(str_ev, "@#CLASS_@#FUNC", classname, evname, EINA_TRUE); |
470 | eina_strbuf_replace_all(str_ev, ",", "_"); | 472 | eina_strbuf_replace_all(str_ev, ",", "_"); |
471 | 473 | ||
@@ -633,7 +635,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
633 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, CONSTRUCTOR), itr, fn) | 635 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, CONSTRUCTOR), itr, fn) |
634 | { | 636 | { |
635 | const char *funcname = eolian_function_name_get(fn); | 637 | const char *funcname = eolian_function_name_get(fn); |
636 | char *desc = _first_line_get(eolian_function_description_get(fn, "comment")); | 638 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); |
637 | 639 | ||
638 | _template_fill(tmpbuf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE); | 640 | _template_fill(tmpbuf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE); |
639 | eina_strbuf_replace_all(tmpbuf, "@#desc", desc); | 641 | eina_strbuf_replace_all(tmpbuf, "@#desc", desc); |
@@ -657,7 +659,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
657 | 659 | ||
658 | if (prop_read) | 660 | if (prop_read) |
659 | { | 661 | { |
660 | char *desc = _first_line_get(eolian_function_description_get(fn, "comment_get")); | 662 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get")); |
661 | 663 | ||
662 | sprintf(tmpstr, "%s_get", funcname); | 664 | sprintf(tmpstr, "%s_get", funcname); |
663 | eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf); | 665 | eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf); |
@@ -673,7 +675,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
673 | } | 675 | } |
674 | if (prop_write) | 676 | if (prop_write) |
675 | { | 677 | { |
676 | char *desc = _first_line_get(eolian_function_description_get(fn, "comment_set")); | 678 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set")); |
677 | 679 | ||
678 | sprintf(tmpstr, "%s_set", funcname); | 680 | sprintf(tmpstr, "%s_set", funcname); |
679 | eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf); | 681 | eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf); |
@@ -693,7 +695,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
693 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn) | 695 | EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn) |
694 | { | 696 | { |
695 | const char *funcname = eolian_function_name_get(fn); | 697 | const char *funcname = eolian_function_name_get(fn); |
696 | char *desc = _first_line_get(eolian_function_description_get(fn, "comment")); | 698 | char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); |
697 | 699 | ||
698 | eo1_eo_op_desc_generate(classname, funcname, tmpbuf); | 700 | eo1_eo_op_desc_generate(classname, funcname, tmpbuf); |
699 | eina_strbuf_replace_all(tmpbuf, "@#desc", desc); | 701 | eina_strbuf_replace_all(tmpbuf, "@#desc", desc); |
@@ -715,7 +717,7 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) | |||
715 | eolian_class_event_information_get(event, &evname, NULL); | 717 | eolian_class_event_information_get(event, &evname, NULL); |
716 | _template_fill(tmpbuf, "@#CLASS_@#FUNC", classname, evname, EINA_TRUE); | 718 | _template_fill(tmpbuf, "@#CLASS_@#FUNC", classname, evname, EINA_TRUE); |
717 | eina_strbuf_replace_all(tmpbuf, ",", "_"); | 719 | eina_strbuf_replace_all(tmpbuf, ",", "_"); |
718 | eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf)); | 720 | eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf)); |
719 | } | 721 | } |
720 | eina_strbuf_replace_all(str_end, "@#list_evdesc", eina_strbuf_string_get(str_ev)); | 722 | eina_strbuf_replace_all(str_end, "@#list_evdesc", eina_strbuf_string_get(str_ev)); |
721 | 723 | ||