q66 pushed a commit to branch master.

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

commit 825349c7b8a7edb54d24b74356ec597f27e5d18a
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Wed Jul 8 12:09:56 2015 +0100

    eolian: improve function_full_c_name_get API
    
    It's now generalized to work properly with legacy functions
    as well as correctly append suffixes. Thus, it can be easily
    used with the documentation generator and in other places.
    
    @feature
---
 src/bin/eolian/common_funcs.c          | 43 +++++++------------------
 src/bin/eolian/docs_generator.c        | 52 +++++++++++++++----------------
 src/bin/eolian/docs_generator.h        |  6 ++--
 src/bin/eolian/eo_generator.c          | 30 ++++++++++--------
 src/bin/eolian/legacy_generator.c      |  4 +--
 src/bin/eolian/main.c                  |  6 ++--
 src/bin/eolian/types_generator.c       | 12 +++----
 src/bin/eolian/types_generator.h       |  3 +-
 src/bin/eolian_cxx/eolian_wrappers.hh  |  2 +-
 src/bindings/luajit/eolian.lua         |  6 ++--
 src/lib/eolian/Eolian.h                |  9 +++++-
 src/lib/eolian/database_function_api.c | 57 +++++++++++++++++++++++++++++++---
 src/scripts/elua/modules/lualian.lua   |  4 +--
 13 files changed, 136 insertions(+), 98 deletions(-)

diff --git a/src/bin/eolian/common_funcs.c b/src/bin/eolian/common_funcs.c
index 4bfd303..5ebd6cc 100644
--- a/src/bin/eolian/common_funcs.c
+++ b/src/bin/eolian/common_funcs.c
@@ -76,21 +76,7 @@ void
 _class_func_env_create(const Eolian_Class *class, const char *funcname, 
Eolian_Function_Type ftype, _eolian_class_func_vars *env)
 {
    char *p;
-   const char *ret;
-   const char *suffix = "";
-   const char *legacy = NULL;
    const Eolian_Function *funcid = eolian_class_function_get_by_name(class, 
funcname, ftype);
-   if (ftype == EOLIAN_PROP_GET)
-     {
-        suffix = "_get";
-        legacy = eolian_function_legacy_get(funcid, ftype);
-     }
-   else if (ftype == EOLIAN_PROP_SET)
-     {
-        suffix = "_set";
-        legacy = eolian_function_legacy_get(funcid, ftype);
-     }
-   else legacy = eolian_function_legacy_get(funcid, EOLIAN_METHOD);
 
    _eolian_class_vars tmp_env;
    _class_env_create(class, NULL, &tmp_env);
@@ -98,28 +84,21 @@ _class_func_env_create(const Eolian_Class *class, const 
char *funcname, Eolian_F
    p = strncpy(env->upper_func, funcname, PATH_MAX - 1);
    eina_str_toupper(&p);
 
-   ret = eolian_function_full_c_name_get(funcid);
-   sprintf(p = env->upper_eo_func, "%s%s", ret, suffix);
+   Eolian_Function_Type aftype = ftype;
+   if (aftype == EOLIAN_PROPERTY) aftype = EOLIAN_METHOD;
+
+   Eina_Stringshare *fname = eolian_function_full_c_name_get(funcid, aftype, 
EINA_FALSE);
+   strcpy(p = env->upper_eo_func, fname);
    eina_str_toupper(&p);
-   sprintf(p = env->lower_eo_func, "%s%s", ret, suffix);
+   strcpy(p = env->lower_eo_func, fname);
    eina_str_tolower(&p);
-   eina_stringshare_del(ret);
+   eina_stringshare_del(fname);
 
+   Eina_Stringshare *lname = eolian_function_full_c_name_get(funcid, aftype, 
EINA_TRUE);
    env->legacy_func[0] = '\0';
-   if (legacy && !strcmp(legacy, "null")) goto end;
-   if (legacy)
-     {
-        sprintf(p = env->legacy_func, "%s", legacy);
-        goto end;
-     }
-
-   legacy = eolian_class_legacy_prefix_get(class);
-   if (legacy && !strcmp(legacy, "null")) goto end;
-
-   sprintf(env->legacy_func, "%s_%s%s", legacy?legacy:tmp_env.lower_classname, 
funcname, suffix);
-
-end:
-   return;
+   if (!lname) return;
+   strcpy(p = env->legacy_func, lname);
+   eina_stringshare_del(lname);
 }
 
 void
diff --git a/src/bin/eolian/docs_generator.c b/src/bin/eolian/docs_generator.c
index 2016488..908b082 100644
--- a/src/bin/eolian/docs_generator.c
+++ b/src/bin/eolian/docs_generator.c
@@ -23,7 +23,7 @@ _indent_line(Eina_Strbuf *buf, int ind)
                                               : DOC_LINE_LIMIT)
 
 static void
-_generate_ref(const char *refn, Eina_Strbuf *wbuf)
+_generate_ref(const char *refn, Eina_Strbuf *wbuf, Eina_Bool use_legacy)
 {
    const Eolian_Declaration *decl = eolian_declaration_get_by_name(refn);
    if (decl)
@@ -46,7 +46,7 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf)
    if (tp)
      {
         if (!eolian_type_struct_field_get(tp, sfx + 1)) goto noref;
-        _generate_ref(bname, wbuf);
+        _generate_ref(bname, wbuf, use_legacy);
         eina_strbuf_append(wbuf, sfx);
         eina_stringshare_del(bname);
         return;
@@ -57,7 +57,7 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf)
      {
         const Eolian_Enum_Type_Field *efl = eolian_type_enum_field_get(tp, sfx 
+ 1);
         if (!efl) goto noref;
-        _generate_ref(bname, wbuf);
+        _generate_ref(bname, wbuf, use_legacy);
         Eina_Stringshare *str = eolian_type_enum_field_c_name_get(efl);
         eina_strbuf_append_char(wbuf, '.');
         eina_strbuf_append(wbuf, str);
@@ -101,14 +101,9 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf)
 
    if (!fn) goto noref;
 
-   Eina_Stringshare *fcn = eolian_function_full_c_name_get(fn);
+   Eina_Stringshare *fcn = eolian_function_full_c_name_get(fn, ftype, 
use_legacy);
    eina_strbuf_append(wbuf, fcn);
    eina_stringshare_del(fcn);
-   if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
-     eina_strbuf_append(wbuf, "_get");
-   else if (ftype == EOLIAN_PROP_SET)
-     eina_strbuf_append(wbuf, "_set");
-
    return;
 noref:
    eina_strbuf_append(wbuf, refn);
@@ -116,7 +111,7 @@ noref:
 
 int
 _append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf,
-                Eina_Strbuf *wbuf)
+                Eina_Strbuf *wbuf, Eina_Bool use_legacy)
 {
    while (*desc)
      {
@@ -140,7 +135,7 @@ _append_section(const char *desc, int ind, int curl, 
Eina_Strbuf *buf,
                     ++desc;
                   if (*(desc - 1) == '.') --desc;
                   Eina_Stringshare *refn = eina_stringshare_add_length(ref, 
desc - ref);
-                  _generate_ref(refn, wbuf);
+                  _generate_ref(refn, wbuf, use_legacy);
                   eina_stringshare_del(refn);
                }
              else
@@ -204,12 +199,12 @@ _append_since(const char *since, int indent, int curl, 
Eina_Strbuf *buf)
 
 void
 _gen_doc_brief(const char *summary, const char *since, int indent,
-               Eina_Strbuf *buf)
+               Eina_Strbuf *buf, Eina_Bool use_legacy)
 {
    int curl = 4 + indent;
    Eina_Strbuf *wbuf = eina_strbuf_new();
    eina_strbuf_append(buf, "/** ");
-   curl = _append_section(summary, indent, curl, buf, wbuf);
+   curl = _append_section(summary, indent, curl, buf, wbuf, use_legacy);
    eina_strbuf_free(wbuf);
    curl = _append_since(since, indent, curl, buf);
    if ((curl + 3) > DOC_LIMIT(indent))
@@ -224,7 +219,7 @@ _gen_doc_brief(const char *summary, const char *since, int 
indent,
 
 void
 _gen_doc_full(const char *summary, const char *description, const char *since,
-              int indent, Eina_Strbuf *buf)
+              int indent, Eina_Strbuf *buf, Eina_Bool use_legacy)
 {
    int curl = 0;
    Eina_Strbuf *wbuf = eina_strbuf_new();
@@ -232,13 +227,13 @@ _gen_doc_full(const char *summary, const char 
*description, const char *since,
    curl += _indent_line(buf, indent);
    eina_strbuf_append(buf, " * @brief ");
    curl += sizeof(" * @brief ") - 1;
-   _append_section(summary, indent, curl, buf, wbuf);
+   _append_section(summary, indent, curl, buf, wbuf, use_legacy);
    eina_strbuf_append_char(buf, '\n');
    _indent_line(buf, indent);
    eina_strbuf_append(buf, " *\n");
    curl = _indent_line(buf, indent);
    eina_strbuf_append(buf, " * ");
-   _append_section(description, indent, curl + 3, buf, wbuf);
+   _append_section(description, indent, curl + 3, buf, wbuf, use_legacy);
    curl = _append_since(since, indent, curl, buf);
    eina_strbuf_append_char(buf, '\n');
    _indent_line(buf, indent);
@@ -247,7 +242,8 @@ _gen_doc_full(const char *summary, const char *description, 
const char *since,
 }
 
 Eina_Strbuf *
-docs_generate_full(const Eolian_Documentation *doc, int indent)
+docs_generate_full(const Eolian_Documentation *doc, int indent,
+                   Eina_Bool use_legacy)
 {
    if (!doc) return NULL;
 
@@ -257,14 +253,15 @@ docs_generate_full(const Eolian_Documentation *doc, int 
indent)
 
    Eina_Strbuf *buf = eina_strbuf_new();
    if (!desc)
-     _gen_doc_brief(sum, since, indent, buf);
+     _gen_doc_brief(sum, since, indent, buf, use_legacy);
    else
-     _gen_doc_full(sum, desc, since, indent, buf);
+     _gen_doc_full(sum, desc, since, indent, buf, use_legacy);
    return buf;
 }
 
 Eina_Strbuf *
-docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, 
int indent)
+docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype,
+                       int indent, Eina_Bool use_legacy)
 {
    const Eolian_Function_Parameter *par = NULL;
    const Eolian_Function_Parameter *vpar = NULL;
@@ -376,7 +373,8 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
    /* only summary, nothing else; generate standard brief doc */
    if (!desc && !par && !vpar && !rdoc && (ftype == EOLIAN_METHOD || !pdoc))
      {
-        _gen_doc_brief(sum ? sum : "No description supplied.", since, indent, 
buf);
+        _gen_doc_brief(sum ? sum : "No description supplied.", since, indent,
+                       buf, use_legacy);
         return buf;
      }
 
@@ -387,7 +385,7 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
    eina_strbuf_append(buf, " * @brief ");
    curl += sizeof(" * @brief ") - 1;
    _append_section(sum ? sum : "No description supplied.",
-                   indent, curl, buf, wbuf);
+                   indent, curl, buf, wbuf, use_legacy);
 
    eina_strbuf_append_char(buf, '\n');
    if (desc || since || par || rdoc || pdoc)
@@ -400,7 +398,7 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
      {
         curl = _indent_line(buf, indent);
         eina_strbuf_append(buf, " * ");
-        _append_section(desc, indent, curl + 3, buf, wbuf);
+        _append_section(desc, indent, curl + 3, buf, wbuf, use_legacy);
         eina_strbuf_append_char(buf, '\n');
         if (par || rdoc || pdoc || since)
           {
@@ -415,7 +413,7 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
         curl = _indent_line(buf, indent);
         eina_strbuf_append(buf, " * ");
         _append_section(eolian_documentation_summary_get(pdoc), indent,
-            curl + 3, buf, wbuf);
+            curl + 3, buf, wbuf, use_legacy);
         eina_strbuf_append_char(buf, '\n');
         if (pdesc)
           {
@@ -423,7 +421,7 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
              eina_strbuf_append(buf, " *\n");
              curl = _indent_line(buf, indent);
              eina_strbuf_append(buf, " * ");
-             _append_section(pdesc, indent, curl + 3, buf, wbuf);
+             _append_section(pdesc, indent, curl + 3, buf, wbuf, use_legacy);
              eina_strbuf_append_char(buf, '\n');
           }
         if (par || rdoc || since)
@@ -467,7 +465,7 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
              eina_strbuf_append_char(buf, ' ');
              curl += 1;
              _append_section(eolian_documentation_summary_get(adoc),
-                             indent, curl, buf, wbuf);
+                             indent, curl, buf, wbuf, use_legacy);
           }
 
         eina_strbuf_append_char(buf, '\n');
@@ -500,7 +498,7 @@ docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, i
         eina_strbuf_append(buf, " * @return ");
         curl += sizeof(" * @return ") - 1;
         _append_section(eolian_documentation_summary_get(rdoc), indent, curl,
-            buf, wbuf);
+            buf, wbuf, use_legacy);
         eina_strbuf_append_char(buf, '\n');
         if (since)
           {
diff --git a/src/bin/eolian/docs_generator.h b/src/bin/eolian/docs_generator.h
index c8a6c1f..0f4424a 100644
--- a/src/bin/eolian/docs_generator.h
+++ b/src/bin/eolian/docs_generator.h
@@ -9,11 +9,12 @@
  *
  * @param[in] doc the documentation
  * @param[in] indent by how many spaces to indent the comment from second line
+ * @param[in] use_legacy whether to use legacy names
  *
  * @return A documentation comment
  *
  */
-Eina_Strbuf *docs_generate_full(const Eolian_Documentation *doc, int indent);
+Eina_Strbuf *docs_generate_full(const Eolian_Documentation *doc, int indent, 
Eina_Bool use_legacy);
 
 /*
  * @brief Generate function documentation
@@ -21,11 +22,12 @@ Eina_Strbuf *docs_generate_full(const Eolian_Documentation 
*doc, int indent);
  * @param[in] fid te function
  * @param[in] type the function type (either METHOD, PROP_GET, PROP_SET)
  * @param[in] indent by how many spaces to indent the comment from second line
+ * @param[in] use_legacy whether to use legacy names
  *
  * @return A documentation comment
  *
  */
-Eina_Strbuf *docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, int indent);
+Eina_Strbuf *docs_generate_function(const Eolian_Function *fid, 
Eolian_Function_Type ftype, int indent, Eina_Bool use_legacy);
 
 #endif
 
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 2be1fa7..b60b429 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -120,7 +120,7 @@ eo_fundef_generate(const Eolian_Class *class, const 
Eolian_Function *func, Eolia
      }
    else
      {
-        Eina_Strbuf *dbuf = docs_generate_function(func, ftype, 0);
+        Eina_Strbuf *dbuf = docs_generate_function(func, ftype, 0, EINA_FALSE);
         eina_strbuf_append(str_func, eina_strbuf_string_get(dbuf));
         eina_strbuf_append_char(str_func, '\n');
         eina_strbuf_free(dbuf);
@@ -251,7 +251,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf 
*buf)
 
    if (doc)
      {
-        Eina_Strbuf *cdoc = docs_generate_full(doc, 0);
+        Eina_Strbuf *cdoc = docs_generate_full(doc, 0, EINA_FALSE);
         if (cdoc)
           {
              eina_strbuf_append(buf, eina_strbuf_string_get(cdoc));
@@ -309,7 +309,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf 
*buf)
 
         if (evdoc)
           {
-             Eina_Strbuf *evdbuf = docs_generate_full(evdoc, 0);
+             Eina_Strbuf *evdbuf = docs_generate_full(evdoc, 0, EINA_FALSE);
              eina_strbuf_append(str_ev, eina_strbuf_string_get(evdbuf));
              eina_strbuf_append_char(str_ev, '\n');
              eina_strbuf_free(evdbuf);
@@ -819,7 +819,6 @@ eo_source_end_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
         Eolian_Function_Type ftype;
         const Eolian_Function *fnid = NULL;
         const char *funcname = NULL;
-        const char *rets;
 
         const char *names[] = { "", "getter ", "setter " };
 
@@ -874,8 +873,6 @@ eo_source_end_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
              goto end;
           }
 
-        rets = eolian_function_full_c_name_get(fnid);
-
         const char *class_str = "";
         if (eolian_function_is_class(fnid)) class_str = "CLASS_";
 
@@ -884,25 +881,32 @@ eo_source_end_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
            case EOLIAN_PROP_SET: case EOLIAN_PROP_GET: case EOLIAN_PROPERTY:
               if (ftype != EOLIAN_PROP_GET)
                 {
-                   eina_strbuf_append_printf(str_op, "\n     
EO_OP_%sFUNC_OVERRIDE(%s_set, %s_%s_set),",
+                   Eina_Stringshare *rets = 
eolian_function_full_c_name_get(fnid, EOLIAN_PROP_SET, EINA_FALSE);
+                   eina_strbuf_append_printf(str_op, "\n     
EO_OP_%sFUNC_OVERRIDE(%s, %s_%s_set),",
                          class_str, rets, implname, funcname);
                    eo_bind_func_generate(class, fnid, EOLIAN_PROP_SET, 
str_bodyf, impl_desc, &impl_env);
+                   eina_stringshare_del(rets);
                 }
 
               if (ftype != EOLIAN_PROP_SET)
                 {
-                   eina_strbuf_append_printf(str_op, "\n     
EO_OP_%sFUNC_OVERRIDE(%s_get, %s_%s_get),",
+                   Eina_Stringshare *rets = 
eolian_function_full_c_name_get(fnid, EOLIAN_PROP_GET, EINA_FALSE);
+                   eina_strbuf_append_printf(str_op, "\n     
EO_OP_%sFUNC_OVERRIDE(%s, %s_%s_get),",
                          class_str, rets, implname, funcname);
                    eo_bind_func_generate(class, fnid, EOLIAN_PROP_GET, 
str_bodyf, impl_desc, &impl_env);
+                   eina_stringshare_del(rets);
                 }
               break;
            default:
-              eina_strbuf_append_printf(str_op, "\n     
EO_OP_%sFUNC_OVERRIDE(%s, %s_%s),",
-                    class_str, rets, implname, funcname);
-              eo_bind_func_generate(class, fnid, ftype, str_bodyf, impl_desc, 
&impl_env);
-              break;
+             {
+                Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, 
ftype, EINA_FALSE);
+                eina_strbuf_append_printf(str_op, "\n     
EO_OP_%sFUNC_OVERRIDE(%s, %s_%s),",
+                      class_str, rets, implname, funcname);
+                eo_bind_func_generate(class, fnid, ftype, str_bodyf, 
impl_desc, &impl_env);
+                eina_stringshare_del(rets);
+                break;
+             }
           }
-        eina_stringshare_del(rets);
      }
    eina_iterator_free(itr);
 
diff --git a/src/bin/eolian/legacy_generator.c 
b/src/bin/eolian/legacy_generator.c
index d1e56dc..6f49d6b 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -97,7 +97,7 @@ _eapi_decl_func_generate(const Eolian_Class *class, const 
Eolian_Function *funci
      }
    else
      {
-        Eina_Strbuf *dbuf = docs_generate_function(funcid, ftype, 0);
+        Eina_Strbuf *dbuf = docs_generate_function(funcid, ftype, 0, 
EINA_TRUE);
         eina_strbuf_append_char(fbody, '\n');
         eina_strbuf_append(fbody, eina_strbuf_string_get(dbuf));
         eina_strbuf_append_char(fbody, '\n');
@@ -387,7 +387,7 @@ legacy_header_generate(const Eolian_Class *class, 
Eina_Strbuf *buf)
    const Eolian_Documentation *doc = eolian_class_documentation_get(class);
    if (doc)
      {
-        Eina_Strbuf *cdoc = docs_generate_full(doc, 0);
+        Eina_Strbuf *cdoc = docs_generate_full(doc, 0, EINA_TRUE);
         if (cdoc)
           {
              eina_strbuf_append(buf, eina_strbuf_string_get(cdoc));
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index f2dbd5a..941053b 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -120,7 +120,7 @@ _generate_eo_header_file(char *filename, const char 
*eo_filename)
 
    Eina_Strbuf *buffer = eina_strbuf_new();
 
-   if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
+   if (!types_header_generate(eo_filename, buffer, EINA_TRUE, EINA_FALSE))
      {
         fprintf(stderr, "eolian: could not generate types of '%s'\n", 
eo_filename);
         goto end;
@@ -166,7 +166,7 @@ _generate_stub_header_file(char *filename, const char 
*eo_filename)
 
    Eina_Strbuf *buffer = eina_strbuf_new();
 
-   if (!types_header_generate(eo_filename, buffer, EINA_FALSE))
+   if (!types_header_generate(eo_filename, buffer, EINA_FALSE, EINA_FALSE))
      {
         fprintf(stderr, "eolian: could not generate types of '%s'\n", 
eo_filename);
         goto end;
@@ -259,7 +259,7 @@ _generate_legacy_header_file(char *filename, const char 
*eo_filename)
 
    Eina_Strbuf *buffer = eina_strbuf_new();
 
-   if (!types_header_generate(eo_filename, buffer, EINA_TRUE))
+   if (!types_header_generate(eo_filename, buffer, EINA_TRUE, EINA_TRUE))
      {
         fprintf(stderr, "eolian: could not generate types of '%s'\n", 
eo_filename);
         goto end;
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index 1876c4c..7a032ef 100644
--- a/src/bin/eolian/types_generator.c
+++ b/src/bin/eolian/types_generator.c
@@ -34,9 +34,9 @@ _concat_name(const Eolian_Type *tp)
 }
 
 static Eina_Strbuf *
-_type_generate(const Eolian_Type *tp, Eina_Bool full)
+_type_generate(const Eolian_Type *tp, Eina_Bool full, Eina_Bool use_legacy)
 {
-   Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp), 0);
+   Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp), 0, 
use_legacy);
    if (!buf) buf = eina_strbuf_new();
    else eina_strbuf_append_char(buf, '\n');
    Eolian_Type_Type tp_type = eolian_type_type_get(tp);
@@ -79,7 +79,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
                         const char *nl = strrchr(eina_strbuf_string_get(buf), 
'\n');
                         if (nl)
                           {
-                             Eina_Strbuf *fbuf = docs_generate_full(fdoc, 
strlen(nl));
+                             Eina_Strbuf *fbuf = docs_generate_full(fdoc, 
strlen(nl), use_legacy);
                              if (fbuf)
                                eina_strbuf_append_printf(buf, " %s",
                                                          
eina_strbuf_string_get(fbuf));
@@ -145,7 +145,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
                         const char *nl = strrchr(eina_strbuf_string_get(buf), 
'\n');
                         if (nl)
                           {
-                             Eina_Strbuf *fbuf = docs_generate_full(fdoc, 
strlen(nl));
+                             Eina_Strbuf *fbuf = docs_generate_full(fdoc, 
strlen(nl), use_legacy);
                              if (fbuf)
                                eina_strbuf_append_printf(buf, " %s",
                                                          
eina_strbuf_string_get(fbuf));
@@ -170,7 +170,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
 }
 
 Eina_Bool
-types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool 
full)
+types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool 
full, Eina_Bool use_legacy)
 {
    const Eolian_Declaration *decl;
 
@@ -198,7 +198,7 @@ types_header_generate(const char *eo_filename, Eina_Strbuf 
*buf, Eina_Bool full)
                  continue;
           }
 
-        Eina_Strbuf *tbuf = _type_generate(tp, full);
+        Eina_Strbuf *tbuf = _type_generate(tp, full, use_legacy);
         if (tbuf)
           {
              eina_strbuf_append(buf, eina_strbuf_string_get(tbuf));
diff --git a/src/bin/eolian/types_generator.h b/src/bin/eolian/types_generator.h
index 84eb15d..5096614 100644
--- a/src/bin/eolian/types_generator.h
+++ b/src/bin/eolian/types_generator.h
@@ -9,11 +9,12 @@
  * @param[in] eo_filename Eo filename
  * @param[inout] buf buffer to fill
  * @param[in]full whether to generate full type definitions
+ * @param[in] use_legacy whether to use legacy names
  *
  * @return EINA_TRUE on success, EINA_FALSE on error.
  *
  */
-Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf, 
Eina_Bool full);
+Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf, 
Eina_Bool full, Eina_Bool use_legacy);
 
 Eina_Bool types_class_typedef_generate(const char *eo_filename, Eina_Strbuf 
*buf);
 
diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh 
b/src/bin/eolian_cxx/eolian_wrappers.hh
index 9ea4f4c..0b78020 100644
--- a/src/bin/eolian_cxx/eolian_wrappers.hh
+++ b/src/bin/eolian_cxx/eolian_wrappers.hh
@@ -164,7 +164,7 @@ function_name(Eolian_Function const& func)
 inline std::string
 function_impl(Eolian_Function const& func)
 {
-   const char *s = ::eolian_function_full_c_name_get(&func);
+   const char *s = ::eolian_function_full_c_name_get(&func, EOLIAN_METHOD, 
EINA_FALSE);
    std::string ret(s);
    ::eina_stringshare_del(s);
    return ret;
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 6cf1500..3a8686d 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -206,7 +206,7 @@ ffi.cdef [[
     Eolian_Function_Type eolian_function_type_get(const Eolian_Function 
*function_id);
     Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function 
*function_id);
     const char *eolian_function_name_get(const Eolian_Function *function_id);
-    const char *eolian_function_full_c_name_get(const Eolian_Function 
*function_id);
+    const char *eolian_function_full_c_name_get(const Eolian_Function 
*function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy);
     const Eolian_Function *eolian_class_function_get_by_name(const 
Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
     const char *eolian_function_legacy_get(const Eolian_Function *function_id, 
Eolian_Function_Type f_type);
     const Eolian_Documentation *eolian_function_documentation_get(const 
Eolian_Function *function_id, Eolian_Function_Type f_type);
@@ -617,8 +617,8 @@ M.Function = ffi.metatype("Eolian_Function", {
             return ffi.string(v)
         end,
 
-        full_c_name_get = function(self)
-            local v = eolian.eolian_function_full_c_name_get(self)
+        full_c_name_get = function(self, ftype, use_legacy)
+            local v = eolian.eolian_function_full_c_name_get(self, ftype, 
use_legacy or false)
             if v == nil then return nil end
             return ffi_stringshare(v)
         end,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index e950e21..1af271e 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -648,16 +648,23 @@ EAPI Eina_Stringshare *eolian_function_name_get(const 
Eolian_Function *function_
  * @brief Returns the full C name of a function.
  *
  * @param[in] function_id Id of the function
+ * @param[in] ftype The type of function to get the name for
+ * @param[in] use_legacy If true, legacy prefix or name will be used when 
available
  * @return the function name
  *
  * It's here because the C API names are deduplicated (prefix of function and
  * suffix of prefix merge if applicable) and this helps generators not write
  * the same code over and over.
+ *
+ * If legacy name is supplied for the given type and use_legacy is set, it
+ * will be used. Also, if the given type is PROP_GET or PROPERTY, a "_get"
+ * suffix will be applied when not using legacy name, and "_set" for PROP_SET.
+ *
  * Also, you're responsible for deleting the stringshare.
  *
  * @ingroup Eolian
  */
-EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function 
*function_id);
+EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function 
*function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy);
 
 /*
  * @brief Get a function in a class by its name and type
diff --git a/src/lib/eolian/database_function_api.c 
b/src/lib/eolian/database_function_api.c
index 4ff34a7..3c23156 100644
--- a/src/lib/eolian/database_function_api.c
+++ b/src/lib/eolian/database_function_api.c
@@ -27,10 +27,16 @@ eolian_function_name_get(const Eolian_Function *fid)
 }
 
 static const char *
-get_eo_prefix(const Eolian_Function *foo_id, char *buf)
+_get_eo_prefix(const Eolian_Function *foo_id, char *buf, Eina_Bool use_legacy)
 {
     char *tmp = buf;
-    if (foo_id->klass->eo_prefix)
+    if (use_legacy && foo_id->klass->legacy_prefix)
+      {
+         if (!strcmp(foo_id->klass->legacy_prefix, "null"))
+           return NULL;
+         return foo_id->klass->legacy_prefix;
+      }
+    else if (!use_legacy && foo_id->klass->eo_prefix)
       return foo_id->klass->eo_prefix;
     strcpy(buf, foo_id->klass->full_name);
     eina_str_tolower(&buf);
@@ -39,10 +45,39 @@ get_eo_prefix(const Eolian_Function *foo_id, char *buf)
 }
 
 EAPI Eina_Stringshare *
-eolian_function_full_c_name_get(const Eolian_Function *foo_id)
+eolian_function_full_c_name_get(const Eolian_Function *foo_id,
+                                Eolian_Function_Type ftype,
+                                Eina_Bool use_legacy)
 {
+   switch (ftype)
+     {
+      case EOLIAN_UNRESOLVED:
+      case EOLIAN_METHOD:
+      case EOLIAN_PROPERTY:
+      case EOLIAN_PROP_GET:
+        if (foo_id->get_legacy && use_legacy)
+          {
+             if (!strcmp(foo_id->get_legacy, "null"))
+               return NULL;
+             return eina_stringshare_ref(foo_id->get_legacy);
+          }
+        break;
+      case EOLIAN_PROP_SET:
+        if (foo_id->set_legacy && use_legacy)
+          {
+             if (!strcmp(foo_id->set_legacy, "null"))
+               return NULL;
+             return eina_stringshare_ref(foo_id->set_legacy);
+          }
+        break;
+     }
+
    char tbuf[512];
-   const char  *prefix = get_eo_prefix(foo_id, tbuf);
+   const char *prefix = _get_eo_prefix(foo_id, tbuf, use_legacy);
+
+   if (!prefix)
+     return NULL;
+
    const char  *funcn = eolian_function_name_get(foo_id);
    const char  *last_p = strrchr(prefix, '_');
    const char  *func_p = strchr(funcn, '_');
@@ -55,11 +90,17 @@ eolian_function_full_c_name_get(const Eolian_Function 
*foo_id)
    if (!func_p) len = strlen(funcn);
    else len = func_p - funcn;
 
-   if ((int)strlen(last_p) != len || strncmp(last_p, funcn, len))
+   if (use_legacy || (int)strlen(last_p) != len || strncmp(last_p, funcn, len))
      {
         eina_strbuf_append(buf, prefix);
         eina_strbuf_append_char(buf, '_');
         eina_strbuf_append(buf, funcn);
+
+        if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
+          eina_strbuf_append(buf, "_get");
+        else if (ftype == EOLIAN_PROP_SET)
+          eina_strbuf_append(buf, "_set");
+
         ret = eina_stringshare_add(eina_strbuf_string_get(buf));
         eina_strbuf_free(buf);
         return ret;
@@ -69,6 +110,12 @@ eolian_function_full_c_name_get(const Eolian_Function 
*foo_id)
       eina_strbuf_append_n(buf, prefix, last_p - prefix); /* includes _ */
 
    eina_strbuf_append(buf, funcn);
+
+   if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
+     eina_strbuf_append(buf, "_get");
+   else if (ftype == EOLIAN_PROP_SET)
+     eina_strbuf_append(buf, "_set");
+
    ret = eina_stringshare_add(eina_strbuf_string_get(buf));
    eina_strbuf_free(buf);
    return ret;
diff --git a/src/scripts/elua/modules/lualian.lua 
b/src/scripts/elua/modules/lualian.lua
index 72c07f6..b54d016 100644
--- a/src/scripts/elua/modules/lualian.lua
+++ b/src/scripts/elua/modules/lualian.lua
@@ -183,7 +183,7 @@ local Method = Node:clone {
         local allocs = {}
         proto.allocs = allocs
 
-        proto.full_name = meth:full_c_name_get()
+        proto.full_name = meth:full_c_name_get(func_type.METHOD)
 
         local fulln = proto.full_name
 
@@ -278,7 +278,7 @@ local Property = Method:clone {
         local allocs = {}
         proto.allocs = allocs
 
-        proto.full_name = prop:full_c_name_get() .. proto.suffix
+        proto.full_name = prop:full_c_name_get(self.ftype)
 
         local fulln = proto.full_name
         if #keys > 0 then

-- 


Reply via email to