summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-23 07:28:04 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-03-24 08:14:30 +0200
commit4092dc6277b3c8b79034d4e80ec35631450d5f3d (patch)
tree2be3c5cbc4508a994f7dee6d6b5e69cc5c95fc32 /src
parent0987b31247b99fcd78eaaddd60072279a9dc9be4 (diff)
Eolian/Generator: more stuff.
Better support of empty events/funcs lists Better support of class constructor Preparation for Eo2: separate Eo1 specific code and common code
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian/common_funcs.c93
-rw-r--r--src/bin/eolian/common_funcs.h9
-rw-r--r--src/bin/eolian/eo1_generator.c161
-rw-r--r--src/bin/eolian/eo1_generator.h121
-rw-r--r--src/bin/eolian/legacy_generator.c1
5 files changed, 135 insertions, 250 deletions
diff --git a/src/bin/eolian/common_funcs.c b/src/bin/eolian/common_funcs.c
index b3e9703..311228a 100644
--- a/src/bin/eolian/common_funcs.c
+++ b/src/bin/eolian/common_funcs.c
@@ -5,94 +5,55 @@ int _eolian_gen_log_dom = -1;
5 5
6const char *current_classname = NULL; 6const char *current_classname = NULL;
7 7
8static void
9_class_names_fill(const char *classname)
10{
11 char *p;
12 const char *eo_prefix = NULL;
13 if (classname == current_classname) return;
14 current_classname = classname;
15 if (eolian_class_exists(classname))
16 eo_prefix = eolian_class_eo_prefix_get(classname);
17 if (!eo_prefix) eo_prefix = classname;
18 strncpy(current_eo_prefix_lower, eo_prefix, sizeof(current_eo_prefix_lower) - 1);
19 p = current_eo_prefix_lower;
20 eina_str_tolower(&p);
21 strncpy(current_eo_prefix_upper, eo_prefix, sizeof(current_eo_prefix_lower) - 1);
22 p = current_eo_prefix_upper;
23 eina_str_toupper(&p);
24}
25
26void 8void
27_template_fill(Eina_Strbuf *buf, const char* templ, const char* classname, const char *funcname, Eina_Bool reset) 9_class_func_names_fill(const char *classname, const char *funcname)
28{ 10{
29 static char capobjclass[0xFF];
30 static char lowobjclass[0xFF];
31 static char capclass[0xFF];
32 static char lowclass[0xFF];
33 static char normclass[0xFF];
34 static char capfunc[0xFF];
35
36 char *p; 11 char *p;
37 12 const char *eo_prefix = NULL;
38 _class_names_fill(classname); 13 if (classname != current_classname)
39 if (buf)
40 {
41 if (reset) eina_strbuf_reset(buf);
42 if (templ) eina_strbuf_append(buf, templ);
43 }
44
45 if (strcmp(classname, normclass))
46 { 14 {
47 //Fill cache 15 current_classname = classname;
48 strncpy(normclass, classname, sizeof(normclass) - 1);
49 16
17 /* class/CLASS*/
50 strncpy(capclass, classname, sizeof(capclass) - 1); 18 strncpy(capclass, classname, sizeof(capclass) - 1);
51 p = capclass; 19 p = capclass;
52 eina_str_toupper(&p); 20 eina_str_toupper(&p);
53
54 strncpy(lowclass, classname, sizeof(lowclass) - 1); 21 strncpy(lowclass, classname, sizeof(lowclass) - 1);
55 p = lowclass; 22 p = lowclass;
56 eina_str_tolower(&p); 23 eina_str_tolower(&p);
57 24
58 Eina_Strbuf *classobj = eina_strbuf_new(); 25 /* eo_prefix */
59 eina_strbuf_append(classobj, classname); 26 if (eolian_class_exists(classname))
60 27 eo_prefix = eolian_class_eo_prefix_get(classname);
61 // More to exclusion list 28 if (!eo_prefix) eo_prefix = classname;
62 if (strcmp(classname, "Eo_Base") && strcmp(classname, "Elm_Widget")) 29 strncpy(current_eo_prefix_lower, eo_prefix, sizeof(current_eo_prefix_lower) - 1);
63 eina_strbuf_replace(classobj, "_", "_obj_", 1); 30 p = current_eo_prefix_lower;
64
65 if (!strcmp(classname, "Evas_Object"))
66 {
67 eina_strbuf_reset(classobj);
68 eina_strbuf_append(classobj, "Evas_Obj");
69 }
70
71 strncpy(capobjclass, eina_strbuf_string_get(classobj),
72 sizeof(capobjclass) - 1);
73 p = capobjclass;
74 eina_str_toupper(&p);
75
76 strncpy(lowobjclass, eina_strbuf_string_get(classobj),
77 sizeof(lowobjclass) - 1);
78 p = lowobjclass;
79 eina_str_tolower(&p); 31 eina_str_tolower(&p);
80 32 strncpy(current_eo_prefix_upper, eo_prefix, sizeof(current_eo_prefix_lower) - 1);
81 eina_strbuf_free(classobj); 33 p = current_eo_prefix_upper;
34 eina_str_toupper(&p);
82 } 35 }
36 if (funcname)
37 {
38 strncpy(capfunc, funcname, sizeof(capfunc) - 1);
39 p = capfunc;
40 eina_str_toupper(&p);
41 }
42}
83 43
84 if (funcname) strncpy(capfunc, funcname, sizeof(capfunc) - 1); 44void
85 p = capfunc; eina_str_toupper(&p); 45_template_fill(Eina_Strbuf *buf, const char* templ, const char* classname, const char *funcname, Eina_Bool reset)
86 46{
47 _class_func_names_fill(classname, funcname);
87 if (buf) 48 if (buf)
88 { 49 {
50 if (reset) eina_strbuf_reset(buf);
51 if (templ) eina_strbuf_append(buf, templ);
89 if (funcname) eina_strbuf_replace_all(buf, "@#func", funcname); 52 if (funcname) eina_strbuf_replace_all(buf, "@#func", funcname);
90 eina_strbuf_replace_all(buf, "@#FUNC", capfunc); 53 eina_strbuf_replace_all(buf, "@#FUNC", capfunc);
91 eina_strbuf_replace_all(buf, "@#Class", classname); 54 eina_strbuf_replace_all(buf, "@#Class", classname);
92 eina_strbuf_replace_all(buf, "@#class", lowclass); 55 eina_strbuf_replace_all(buf, "@#class", lowclass);
93 eina_strbuf_replace_all(buf, "@#CLASS", capclass); 56 eina_strbuf_replace_all(buf, "@#CLASS", capclass);
94 eina_strbuf_replace_all(buf, "@#OBJCLASS", capobjclass);
95 eina_strbuf_replace_all(buf, "@#objclass", lowobjclass);
96 } 57 }
97} 58}
98 59
diff --git a/src/bin/eolian/common_funcs.h b/src/bin/eolian/common_funcs.h
index 922cb2a..bbe88c3 100644
--- a/src/bin/eolian/common_funcs.h
+++ b/src/bin/eolian/common_funcs.h
@@ -38,7 +38,16 @@ char *_startline(char *str, char *pos);
38 38
39char *_source_desc_get(const char *str); 39char *_source_desc_get(const char *str);
40 40
41void _class_func_names_fill(const char *classname, const char *funcname);
42
41char current_eo_prefix_lower[256]; 43char current_eo_prefix_lower[256];
42 44
43char current_eo_prefix_upper[256]; 45char current_eo_prefix_upper[256];
46
47char capobjclass[0xFF];
48char lowobjclass[0xFF];
49char capclass[0xFF];
50char lowclass[0xFF];
51char normclass[0xFF];
52char capfunc[0xFF];
44#endif 53#endif
diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c
index b6f61ef..d294504 100644
--- a/src/bin/eolian/eo1_generator.c
+++ b/src/bin/eolian/eo1_generator.c
@@ -16,9 +16,7 @@ _gen_@#class_class_destructor(Eo_Class *klass)\n\
16"; 16";
17 17
18static const char 18static const char
19tmpl_eo_src_end[] = "\ 19tmpl_eo1_class_ctor[] = "\
20@#list_ctors_body\
21\n\
22static void\n\ 20static void\n\
23_gen_@#class_class_constructor(Eo_Class *klass)\n\ 21_gen_@#class_class_constructor(Eo_Class *klass)\n\
24{\n\ 22{\n\
@@ -26,24 +24,35 @@ _gen_@#class_class_constructor(Eo_Class *klass)\n\
26 EO_OP_FUNC_SENTINEL\n\ 24 EO_OP_FUNC_SENTINEL\n\
27 };\n\ 25 };\n\
28 eo_class_funcs_set(klass, func_desc);\n\ 26 eo_class_funcs_set(klass, func_desc);\n\
29@#ctor_func\ 27@#user_ctor_func\
30}\n\ 28}\n\n";
31\n\ 29
32@#dtor_func\ 30static const char
31tmpl_eo1_ops_desc[] = "\
33static const Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\ 32static const Eo_Op_Description _@#class_op_desc[] = {@#list_op\n\
34 EO_OP_DESCRIPTION_SENTINEL\n\ 33 EO_OP_DESCRIPTION_SENTINEL\n\
35};\n\ 34};\n\n";
36\n\ 35
36static const char
37tmpl_events_desc[] = "\
37static const Eo_Event_Description *_@#class_event_desc[] = {@#list_evdesc\n\ 38static const Eo_Event_Description *_@#class_event_desc[] = {@#list_evdesc\n\
38 NULL\n\ 39 NULL\n\
39};\n\ 40};\n\n";
41
42static const char
43tmpl_eo_src[] = "\
44@#functions_body\
40\n\ 45\n\
46@#ctor_func\
47@#dtor_func\
48@#ops_desc\
49@#events_desc\
41static const Eo_Class_Description _@#class_class_desc = {\n\ 50static const Eo_Class_Description _@#class_class_desc = {\n\
42 EO_VERSION,\n\ 51 EO_VERSION,\n\
43 \"@#Class\",\n\ 52 \"@#Class\",\n\
44 @#type_class,\n\ 53 @#type_class,\n\
45 EO_CLASS_DESCRIPTION_OPS(&@#EOPREFIX_BASE_ID, _@#class_op_desc, @#EOPREFIX_SUB_ID_LAST),\n\ 54 @#eo_class_desc_ops,\n\
46 _@#class_event_desc,\n\ 55 @#Events_Desc,\n\
47 @#SizeOfData,\n\ 56 @#SizeOfData,\n\
48 _gen_@#class_class_constructor,\n\ 57 _gen_@#class_class_constructor,\n\
49 @#dtor_name\n\ 58 @#dtor_name\n\
@@ -120,14 +129,7 @@ _eo_obj_@#class_@#func(Eo *obj, void *_pd, va_list *list@#list_unused)\n\
120}\n\ 129}\n\
121"; 130";
122 131
123Eina_Bool 132static Eina_Bool
124eo1_enum_append(const char *classname, const char *funcname, Eina_Strbuf *str)
125{
126 _template_fill(str, tmpl_eo_subid_apnd, classname, funcname, EINA_FALSE);
127 return EINA_TRUE;
128}
129
130Eina_Bool
131eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext) 133eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *functext)
132{ 134{
133 const char *str_dir[] = {"in", "out", "inout"}; 135 const char *str_dir[] = {"in", "out", "inout"};
@@ -357,7 +359,7 @@ _varg_upgr(const char *stype)
357 return stype; 359 return stype;
358} 360}
359 361
360Eina_Bool 362static Eina_Bool
361eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name) 363eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name)
362{ 364{
363 const char *suffix = ""; 365 const char *suffix = "";
@@ -499,24 +501,34 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
499 return EINA_TRUE; 501 return EINA_TRUE;
500} 502}
501 503
502Eina_Bool 504static Eina_Bool
503eo1_eo_func_desc_generate(const char *classname, const char *funcname, Eina_Strbuf *buf) 505eo1_eo_func_desc_generate(const char *class_name, const char *impl_name, const char *func_name, Eina_Strbuf *buf)
504{ 506{
505 _template_fill(buf, tmpl_eo_func_desc, classname, funcname, EINA_TRUE); 507 if (impl_name)
506 eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper); 508 _class_func_names_fill(impl_name, func_name);
509 else
510 _class_func_names_fill(class_name, func_name);
511 eina_strbuf_reset(buf);
512 eina_strbuf_append_printf(buf,
513 "\n EO_OP_FUNC(%s_ID(%s_SUB_ID_%s), _eo_obj_%s%s%s_%s),",
514 current_eo_prefix_upper, current_eo_prefix_upper, capfunc,
515 lowclass, impl_name?"_":"", impl_name?impl_name:"",
516 func_name);
507 return EINA_TRUE; 517 return EINA_TRUE;
508} 518}
509 519
510Eina_Bool 520static Eina_Bool
511eo1_eo_op_desc_generate(const char *classname, const char *funcname, Eina_Strbuf *buf) 521eo1_eo_op_desc_generate(const char *classname, const char *funcname,
522 const char *desc, Eina_Strbuf *buf)
512{ 523{
513 _template_fill(buf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE); 524 _template_fill(buf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE);
514 eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper); 525 eina_strbuf_replace_all(buf, "@#EOPREFIX", current_eo_prefix_upper);
526 eina_strbuf_replace_all(buf, "@#desc", desc);
515 527
516 return EINA_TRUE; 528 return EINA_TRUE;
517} 529}
518 530
519Eina_Bool 531static Eina_Bool
520eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf) 532eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
521{ 533{
522 const Eina_List *itr; 534 const Eina_List *itr;
@@ -559,7 +571,7 @@ eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf)
559 return EINA_TRUE; 571 return EINA_TRUE;
560} 572}
561 573
562Eina_Bool 574static Eina_Bool
563eo1_source_end_generate(const char *classname, Eina_Strbuf *buf) 575eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
564{ 576{
565 Eina_Bool ret = EINA_FALSE; 577 Eina_Bool ret = EINA_FALSE;
@@ -599,20 +611,19 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
599 Eina_Strbuf *str_ev = eina_strbuf_new(); 611 Eina_Strbuf *str_ev = eina_strbuf_new();
600 Eina_Strbuf *tmpl_impl = eina_strbuf_new(); 612 Eina_Strbuf *tmpl_impl = eina_strbuf_new();
601 613
602 _template_fill(str_end, tmpl_eo_src_end, classname, "", EINA_TRUE); 614 _template_fill(str_end, tmpl_eo_src, classname, NULL, EINA_TRUE);
603 615
604 if (!eolian_class_functions_list_get(classname, CONSTRUCTOR) &&
605 !eolian_class_functions_list_get(classname, DESTRUCTOR) &&
606 !eolian_class_functions_list_get(classname, PROPERTY_FUNC) &&
607 !eolian_class_functions_list_get(classname, METHOD_FUNC))
608 {
609 eina_strbuf_replace_all(str_end, "&@#EOPREFIX_BASE_ID", "NULL");
610 eina_strbuf_replace_all(str_end, "@#EOPREFIX_SUB_ID_LAST", "0");
611 }
612 eina_strbuf_replace_all(str_end, "@#type_class", str_classtype); 616 eina_strbuf_replace_all(str_end, "@#type_class", str_classtype);
613 eina_strbuf_replace_all(str_end, "@#EOPREFIX", current_eo_prefix_upper); 617 eina_strbuf_replace_all(str_end, "@#EOPREFIX", current_eo_prefix_upper);
614 eina_strbuf_replace_all(str_end, "@#eoprefix", current_eo_prefix_lower); 618 eina_strbuf_replace_all(str_end, "@#eoprefix", current_eo_prefix_lower);
615 619
620 _template_fill(tmpbuf, tmpl_eo1_class_ctor, classname, "", EINA_TRUE);
621 eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf));
622 eina_strbuf_reset(tmpbuf);
623 if (eolian_class_ctor_enable_get(classname))
624 _template_fill(tmpbuf, " _@#class_class_constructor(klass);\n", classname, "", EINA_TRUE);
625 eina_strbuf_replace_all(str_end, "@#user_ctor_func", eina_strbuf_string_get(tmpbuf));
626
616 if (eolian_class_dtor_enable_get(classname)) 627 if (eolian_class_dtor_enable_get(classname))
617 { 628 {
618 _template_fill(tmpbuf, tmpl_dtor, classname, "", EINA_TRUE); 629 _template_fill(tmpbuf, tmpl_dtor, classname, "", EINA_TRUE);
@@ -627,9 +638,6 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
627 } 638 }
628 639
629 eina_strbuf_reset(tmpbuf); 640 eina_strbuf_reset(tmpbuf);
630 if (eolian_class_ctor_enable_get(classname))
631 _template_fill(tmpbuf, " _@#class_class_constructor(klass);\n", classname, "", EINA_TRUE);
632 eina_strbuf_replace_all(str_end, "@#ctor_func", eina_strbuf_string_get(tmpbuf));
633 641
634 // default constructor 642 // default constructor
635 Eolian_Function ctor_fn = eolian_class_default_constructor_get(classname); 643 Eolian_Function ctor_fn = eolian_class_default_constructor_get(classname);
@@ -722,17 +730,13 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
722 { 730 {
723 const char *funcname = eolian_function_name_get(fn); 731 const char *funcname = eolian_function_name_get(fn);
724 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment")); 732 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment"));
725 733 eo1_eo_op_desc_generate(classname, funcname, desc, tmpbuf);
726 _template_fill(tmpbuf, tmpl_eo_op_desc, classname, funcname, EINA_TRUE); 734 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
727 eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper);
728
729 eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
730 free(desc); 735 free(desc);
731 736
732 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); 737 eo1_eo_func_desc_generate(classname, NULL, funcname, tmpbuf);
738 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
733 739
734 _template_fill(str_func, tmpl_eo_func_desc, classname, funcname, EINA_FALSE);
735 eina_strbuf_replace_all(str_func, "@#EOPREFIX", current_eo_prefix_upper);
736 eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf, NULL); 740 eo1_bind_func_generate(classname, fn, UNRESOLVED, str_bodyf, NULL);
737 } 741 }
738 742
@@ -751,13 +755,12 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
751 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set")); 755 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set"));
752 756
753 sprintf(tmpstr, "%s_set", funcname); 757 sprintf(tmpstr, "%s_set", funcname);
754 eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf); 758 eo1_eo_op_desc_generate(classname, tmpstr, desc, tmpbuf);
755 eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
756 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); 759 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
757 free(desc); 760 free(desc);
758 761
759 if (!eolian_function_is_virtual_pure(fn)) 762 if (!eolian_function_is_virtual_pure(fn))
760 eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf); 763 eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf);
761 else 764 else
762 eina_strbuf_reset(tmpbuf); 765 eina_strbuf_reset(tmpbuf);
763 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); 766 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
@@ -767,13 +770,12 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
767 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get")); 770 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get"));
768 771
769 sprintf(tmpstr, "%s_get", funcname); 772 sprintf(tmpstr, "%s_get", funcname);
770 eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf); 773 eo1_eo_op_desc_generate(classname, tmpstr, desc, tmpbuf);
771 eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
772 free(desc); 774 free(desc);
773 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); 775 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
774 776
775 if (!eolian_function_is_virtual_pure(fn)) 777 if (!eolian_function_is_virtual_pure(fn))
776 eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf); 778 eo1_eo_func_desc_generate(classname, NULL, tmpstr, tmpbuf);
777 else 779 else
778 eina_strbuf_reset(tmpbuf); 780 eina_strbuf_reset(tmpbuf);
779 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); 781 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
@@ -784,15 +786,14 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
784 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn) 786 EINA_LIST_FOREACH(eolian_class_functions_list_get(classname, METHOD_FUNC), itr, fn)
785 { 787 {
786 const char *funcname = eolian_function_name_get(fn); 788 const char *funcname = eolian_function_name_get(fn);
787 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment"));
788 789
789 eo1_eo_op_desc_generate(classname, funcname, tmpbuf); 790 char *desc = _source_desc_get(eolian_function_description_get(fn, "comment"));
790 eina_strbuf_replace_all(tmpbuf, "@#desc", desc); 791 eo1_eo_op_desc_generate(classname, funcname, desc, tmpbuf);
791 free(desc); 792 free(desc);
792 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf)); 793 eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
793 794
794 if (!eolian_function_is_virtual_pure(fn)) 795 if (!eolian_function_is_virtual_pure(fn))
795 eo1_eo_func_desc_generate(classname, funcname, tmpbuf); 796 eo1_eo_func_desc_generate(classname, NULL, funcname, tmpbuf);
796 else 797 else
797 eina_strbuf_reset(tmpbuf); 798 eina_strbuf_reset(tmpbuf);
798 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf)); 799 eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
@@ -808,7 +809,23 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
808 eina_strbuf_replace_all(tmpbuf, ",", "_"); 809 eina_strbuf_replace_all(tmpbuf, ",", "_");
809 eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf)); 810 eina_strbuf_append_printf(str_ev, "\n %s,", eina_strbuf_string_get(tmpbuf));
810 } 811 }
811 eina_strbuf_replace_all(str_end, "@#list_evdesc", eina_strbuf_string_get(str_ev)); 812
813 eina_strbuf_reset(tmpbuf);
814 if (eina_strbuf_length_get(str_ev))
815 {
816 Eina_Strbuf *events_desc = eina_strbuf_new();
817 _template_fill(events_desc, tmpl_events_desc, classname, "", EINA_TRUE);
818 eina_strbuf_replace_all(events_desc, "@#list_evdesc", eina_strbuf_string_get(str_ev));
819 eina_strbuf_replace_all(str_end, "@#events_desc", eina_strbuf_string_get(events_desc));
820 eina_strbuf_free(events_desc);
821 eina_strbuf_append_printf(tmpbuf, "_%s_event_desc", lowclass);
822 }
823 else
824 {
825 eina_strbuf_append_printf(tmpbuf, "NULL");
826 eina_strbuf_replace_all(str_end, "@#events_desc", "");
827 }
828 eina_strbuf_replace_all(str_end, "@#Events_Desc", eina_strbuf_string_get(tmpbuf));
812 829
813 const char *inherit_name; 830 const char *inherit_name;
814 eina_strbuf_reset(tmpbuf); 831 eina_strbuf_reset(tmpbuf);
@@ -824,8 +841,28 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
824 eina_strbuf_replace_all(str_end, "@#list_inherit", eina_strbuf_string_get(tmpbuf)); 841 eina_strbuf_replace_all(str_end, "@#list_inherit", eina_strbuf_string_get(tmpbuf));
825 842
826 eina_strbuf_replace_all(str_end, "@#list_func", eina_strbuf_string_get(str_func)); 843 eina_strbuf_replace_all(str_end, "@#list_func", eina_strbuf_string_get(str_func));
827 eina_strbuf_replace_all(str_end, "@#list_op", eina_strbuf_string_get(str_op)); 844
828 eina_strbuf_replace_all(str_end, "@#list_ctors_body", eina_strbuf_string_get(str_bodyf)); 845 eina_strbuf_reset(tmpbuf);
846 if (eina_strbuf_length_get(str_op))
847 {
848 Eina_Strbuf *ops_desc = eina_strbuf_new();
849 _template_fill(ops_desc, tmpl_eo1_ops_desc, classname, "", EINA_TRUE);
850 eina_strbuf_replace_all(ops_desc, "@#list_op", eina_strbuf_string_get(str_op));
851 eina_strbuf_replace_all(str_end, "@#ops_desc", eina_strbuf_string_get(ops_desc));
852 eina_strbuf_free(ops_desc);
853 _template_fill(tmpbuf,
854 "EO_CLASS_DESCRIPTION_OPS(&@#EOPREFIX_BASE_ID, _@#class_op_desc, @#EOPREFIX_SUB_ID_LAST)",
855 classname, NULL, EINA_TRUE);
856 eina_strbuf_replace_all(tmpbuf, "@#EOPREFIX", current_eo_prefix_upper);
857 }
858 else
859 {
860 eina_strbuf_replace_all(str_end, "@#ops_desc", "");
861 eina_strbuf_append_printf(tmpbuf, "EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0)");
862 }
863
864 eina_strbuf_replace_all(str_end, "@#functions_body", eina_strbuf_string_get(str_bodyf));
865 eina_strbuf_replace_all(str_end, "@#eo_class_desc_ops", eina_strbuf_string_get(tmpbuf));
829 866
830 const char *data_type = eolian_class_data_type_get(classname); 867 const char *data_type = eolian_class_data_type_get(classname);
831 if (data_type && !strcmp(data_type, "null")) 868 if (data_type && !strcmp(data_type, "null"))
diff --git a/src/bin/eolian/eo1_generator.h b/src/bin/eolian/eo1_generator.h
index 8fba677..a3965aa 100644
--- a/src/bin/eolian/eo1_generator.h
+++ b/src/bin/eolian/eo1_generator.h
@@ -19,53 +19,6 @@ Eina_Bool
19eo_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf); 19eo_source_generate(const char *classname, int eo_version, Eina_Strbuf *buf);
20 20
21/* 21/*
22 * @brief Generate beginning of Eo1 source code for Eo class
23 *
24 * This function generates the base id definition and the list of events.
25 *
26 * @param[in] classname class name
27 * @param[inout] buf buffer to fill
28 *
29 * @return EINA_TRUE on success, EINA_FALSE on error.
30 *
31 */
32Eina_Bool
33eo1_source_beginning_generate(const char *classname, Eina_Strbuf *buf);
34
35/*
36 * @brief Generate end of Eo1 source code for Eo class
37 *
38 * This function generates the constructors, the class constructor, the function
39 * descriptions and the class description.
40 *
41 * @param[in] classname class name
42 * @param[inout] buf buffer to fill
43 *
44 * @return EINA_TRUE on success, EINA_FALSE on error.
45 *
46 */
47Eina_Bool
48eo1_source_end_generate(const char *classname, Eina_Strbuf *buf);
49
50/*
51 * @brief Generate the source code for a specific Eo function.
52 *
53 * This function generates for a given function id the corresponding
54 * Eo function.
55 *
56 * @param[in] classname class name
57 * @param[in] funcid Function Id
58 * @param[in] ftype type of the function (SET/GET/METHOD...)
59 * @param[in] impl_name name to append in case of implement.
60 * @param[inout] buf buffer to fill
61 *
62 * @return EINA_TRUE on success, EINA_FALSE on error.
63 *
64 */
65Eina_Bool
66eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Function_Type ftype, Eina_Strbuf *buf, const char *impl_name);
67
68/*
69 * @brief Generate the header code for a specific Eo class. 22 * @brief Generate the header code for a specific Eo class.
70 * 23 *
71 * This function generates header code from scratch. 24 * This function generates header code from scratch.
@@ -78,79 +31,5 @@ eo1_bind_func_generate(const char *classname, Eolian_Function funcid, Eolian_Fun
78 */ 31 */
79Eina_Bool eo1_header_generate(const char *classname, Eina_Strbuf *buf); 32Eina_Bool eo1_header_generate(const char *classname, Eina_Strbuf *buf);
80 33
81/*
82 * @brief Append the header code for a specific Eo class.
83 *
84 * This function generates header code by appending it into an existing class.
85 *
86 * @param[in] classname class name
87 * @param[inout] buf buffer to fill
88 *
89 * @return EINA_TRUE on success, EINA_FALSE on error.
90 *
91 */
92Eina_Bool eo1_header_append(const char *classname, Eina_Strbuf *buf);
93
94/*
95 * @brief Fill the given buffer with the Eo enum of a given function.
96 *
97 * @param[in] classname class name
98 * @param[in] funcname function name
99 * @param[inout] buf buffer to fill
100 *
101 * @return EINA_TRUE on success, EINA_FALSE on error.
102 *
103 */
104Eina_Bool eo1_enum_append(const char *classname, const char *funcname, Eina_Strbuf *buf);
105
106/*
107 * @brief Generate the function definition (header) for a specific Eo function.
108 *
109 * This function generates for a given function the corresponding
110 * Eo function definition.
111 *
112 * @param[in] classname class name
113 * @param[in] funcid Function Id
114 * @param[in] ftype type of the function (SET/GET/METHOD...)
115 * @param[inout] buf buffer to fill
116 *
117 * @return EINA_TRUE on success, EINA_FALSE on error.
118 *
119 */
120Eina_Bool
121eo1_fundef_generate(const char *classname, Eolian_Function func, Eolian_Function_Type ftype, Eina_Strbuf *buf);
122
123/*
124 * @brief Generate the function description for a specific Eo function.
125 *
126 * This function generates for a given function the corresponding
127 * Eo function description.
128 *
129 * @param[in] classname class name
130 * @param[in] funcname function name
131 * @param[inout] buf buffer to fill
132 *
133 * @return EINA_TRUE on success, EINA_FALSE on error.
134 *
135 */
136Eina_Bool
137eo1_eo_func_desc_generate(const char *classname, const char *funcname, Eina_Strbuf *buf);
138
139/*
140 * @brief Generate the Eo op description for a specific Eo function.
141 *
142 * This function generates for a given function the corresponding
143 * Eo function definition.
144 *
145 * @param[in] classname class name
146 * @param[in] funcname function name
147 * @param[inout] buf buffer to fill
148 *
149 * @return EINA_TRUE on success, EINA_FALSE on error.
150 *
151 */
152Eina_Bool
153eo1_eo_op_desc_generate(const char *classname, const char *funcname, Eina_Strbuf *buf);
154
155#endif 34#endif
156 35
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index f1d209c..00464ed 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -4,7 +4,6 @@
4#include "Eolian.h" 4#include "Eolian.h"
5 5
6#include "legacy_generator.h" 6#include "legacy_generator.h"
7#include "eo1_generator.h"
8#include "common_funcs.h" 7#include "common_funcs.h"
9 8
10static const char 9static const char