jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a04e80e7f6a708f533dc857b0ccdcbd05ce9c256

commit a04e80e7f6a708f533dc857b0ccdcbd05ce9c256
Author: Daniel Zaoui <[email protected]>
Date:   Sun Mar 9 14:07:39 2014 +0200

    Eolian/Generator: fix for legacy function name overriding.
    
    When legacy is specified in the .eo file, the generator was adding the
    property/method name after the legacy name.
    So if you have 'legacy evas_object_textblock_clear_all' for clear method,
    it was adding the function evas_object_textblock_clear_all_clear.
---
 src/bin/eolian/common_funcs.c     |  4 ++--
 src/bin/eolian/legacy_generator.c | 27 +++++++++++++++------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/bin/eolian/common_funcs.c b/src/bin/eolian/common_funcs.c
index b3a5674..e98a02b 100644
--- a/src/bin/eolian/common_funcs.c
+++ b/src/bin/eolian/common_funcs.c
@@ -62,10 +62,10 @@ _template_fill(Eina_Strbuf *buf, const char* templ, const 
char* classname, const
         eina_strbuf_free(classobj);
      }
 
-   strncpy(capfunc, funcname, sizeof(capfunc) - 1);
+   if (funcname) strncpy(capfunc, funcname, sizeof(capfunc) - 1);
    p = capfunc; eina_str_toupper(&p);
 
-   eina_strbuf_replace_all(buf, "@#func", funcname);
+   if (funcname) eina_strbuf_replace_all(buf, "@#func", funcname);
    eina_strbuf_replace_all(buf, "@#FUNC", capfunc);
    eina_strbuf_replace_all(buf, "@#Class", classname);
    eina_strbuf_replace_all(buf, "@#class", lowclass);
diff --git a/src/bin/eolian/legacy_generator.c 
b/src/bin/eolian/legacy_generator.c
index 19fb74a..d219ab1 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -194,6 +194,7 @@ static void
 _eapi_func_generate(const char *classname, Eolian_Function funcid, 
Eolian_Function_Type ftype, Eina_Strbuf *buf)
 {
    //TODO return value
+   char tmpstr[0xFF];
    const char *suffix = "";
    const char *func_lpref = NULL;
    Eina_Bool var_as_ret = EINA_FALSE;
@@ -202,6 +203,10 @@ _eapi_func_generate(const char *classname, Eolian_Function 
funcid, Eolian_Functi
    Eina_Bool ret_const = EINA_FALSE;
    Eina_Bool add_star = EINA_FALSE;
 
+   Eina_Strbuf *fbody = eina_strbuf_new();
+   Eina_Strbuf *fparam = eina_strbuf_new();
+   Eina_Strbuf *eoparam = eina_strbuf_new();
+
    rettype = eolian_function_return_type_get(funcid, ftype);
    if (rettype && !strcmp(rettype, "void")) rettype = NULL;
    retname = "ret";
@@ -229,24 +234,22 @@ _eapi_func_generate(const char *classname, 
Eolian_Function funcid, Eolian_Functi
      }
 
    func_lpref = (func_lpref) ? func_lpref : eolian_function_data_get(funcid, 
EOLIAN_LEGACY);
-   func_lpref = (func_lpref) ? func_lpref : 
eolian_class_legacy_prefix_get(classname);
+   _template_fill(fbody, tmpl_eapi_body, classname, NULL, EINA_FALSE);
 
-   Eina_Strbuf *fbody = eina_strbuf_new();
-   Eina_Strbuf *fparam = eina_strbuf_new();
-   Eina_Strbuf *eoparam = eina_strbuf_new();
-
-   char tmpstr[0xFF];
-   sprintf (tmpstr, "%s%s", eolian_function_name_get(funcid), suffix);
-   _template_fill(fbody, tmpl_eapi_body, classname, tmpstr, EINA_FALSE);
-
-   if (!func_lpref)
+   if (func_lpref)
+      eina_strbuf_replace_all(fbody, "@#eapi_prefix_@#func", func_lpref);
+   else
      {
+        func_lpref = eolian_class_legacy_prefix_get(classname);
+        eina_strbuf_replace_all(fbody, "@#eapi_prefix", func_lpref);
+
         strncpy(tmpstr, classname, sizeof(tmpstr) - 1);
         char *p = tmpstr;
         eina_str_tolower(&p);
-        func_lpref = tmpstr;
      }
-   eina_strbuf_replace_all(fbody, "@#eapi_prefix", func_lpref);
+
+   sprintf (tmpstr, "%s%s", eolian_function_name_get(funcid), suffix);
+   eina_strbuf_replace_all(fbody, "@#func", tmpstr);
 
    const Eina_List *l;
    void *data;

-- 


Reply via email to