summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-07-08 12:09:56 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-07-08 12:10:20 +0100
commit825349c7b8a7edb54d24b74356ec597f27e5d18a (patch)
tree70484c067c277bd64fbe50aa8a122696c7134b04
parentef65806ce4dc7560d9027b951cf707e7aae4eb86 (diff)
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
-rw-r--r--src/bin/eolian/common_funcs.c43
-rw-r--r--src/bin/eolian/docs_generator.c52
-rw-r--r--src/bin/eolian/docs_generator.h6
-rw-r--r--src/bin/eolian/eo_generator.c30
-rw-r--r--src/bin/eolian/legacy_generator.c4
-rw-r--r--src/bin/eolian/main.c6
-rw-r--r--src/bin/eolian/types_generator.c12
-rw-r--r--src/bin/eolian/types_generator.h3
-rw-r--r--src/bin/eolian_cxx/eolian_wrappers.hh2
-rw-r--r--src/bindings/luajit/eolian.lua6
-rw-r--r--src/lib/eolian/Eolian.h9
-rw-r--r--src/lib/eolian/database_function_api.c57
-rw-r--r--src/scripts/elua/modules/lualian.lua4
13 files changed, 136 insertions, 98 deletions
diff --git a/src/bin/eolian/common_funcs.c b/src/bin/eolian/common_funcs.c
index 4bfd3036e7..5ebd6cc0b0 100644
--- a/src/bin/eolian/common_funcs.c
+++ b/src/bin/eolian/common_funcs.c
@@ -76,21 +76,7 @@ void
76_class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_Function_Type ftype, _eolian_class_func_vars *env) 76_class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_Function_Type ftype, _eolian_class_func_vars *env)
77{ 77{
78 char *p; 78 char *p;
79 const char *ret;
80 const char *suffix = "";
81 const char *legacy = NULL;
82 const Eolian_Function *funcid = eolian_class_function_get_by_name(class, funcname, ftype); 79 const Eolian_Function *funcid = eolian_class_function_get_by_name(class, funcname, ftype);
83 if (ftype == EOLIAN_PROP_GET)
84 {
85 suffix = "_get";
86 legacy = eolian_function_legacy_get(funcid, ftype);
87 }
88 else if (ftype == EOLIAN_PROP_SET)
89 {
90 suffix = "_set";
91 legacy = eolian_function_legacy_get(funcid, ftype);
92 }
93 else legacy = eolian_function_legacy_get(funcid, EOLIAN_METHOD);
94 80
95 _eolian_class_vars tmp_env; 81 _eolian_class_vars tmp_env;
96 _class_env_create(class, NULL, &tmp_env); 82 _class_env_create(class, NULL, &tmp_env);
@@ -98,28 +84,21 @@ _class_func_env_create(const Eolian_Class *class, const char *funcname, Eolian_F
98 p = strncpy(env->upper_func, funcname, PATH_MAX - 1); 84 p = strncpy(env->upper_func, funcname, PATH_MAX - 1);
99 eina_str_toupper(&p); 85 eina_str_toupper(&p);
100 86
101 ret = eolian_function_full_c_name_get(funcid); 87 Eolian_Function_Type aftype = ftype;
102 sprintf(p = env->upper_eo_func, "%s%s", ret, suffix); 88 if (aftype == EOLIAN_PROPERTY) aftype = EOLIAN_METHOD;
89
90 Eina_Stringshare *fname = eolian_function_full_c_name_get(funcid, aftype, EINA_FALSE);
91 strcpy(p = env->upper_eo_func, fname);
103 eina_str_toupper(&p); 92 eina_str_toupper(&p);
104 sprintf(p = env->lower_eo_func, "%s%s", ret, suffix); 93 strcpy(p = env->lower_eo_func, fname);
105 eina_str_tolower(&p); 94 eina_str_tolower(&p);
106 eina_stringshare_del(ret); 95 eina_stringshare_del(fname);
107 96
97 Eina_Stringshare *lname = eolian_function_full_c_name_get(funcid, aftype, EINA_TRUE);
108 env->legacy_func[0] = '\0'; 98 env->legacy_func[0] = '\0';
109 if (legacy && !strcmp(legacy, "null")) goto end; 99 if (!lname) return;
110 if (legacy) 100 strcpy(p = env->legacy_func, lname);
111 { 101 eina_stringshare_del(lname);
112 sprintf(p = env->legacy_func, "%s", legacy);
113 goto end;
114 }
115
116 legacy = eolian_class_legacy_prefix_get(class);
117 if (legacy && !strcmp(legacy, "null")) goto end;
118
119 sprintf(env->legacy_func, "%s_%s%s", legacy?legacy:tmp_env.lower_classname, funcname, suffix);
120
121end:
122 return;
123} 102}
124 103
125void 104void
diff --git a/src/bin/eolian/docs_generator.c b/src/bin/eolian/docs_generator.c
index 201648891b..908b08273b 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)
23 : DOC_LINE_LIMIT) 23 : DOC_LINE_LIMIT)
24 24
25static void 25static void
26_generate_ref(const char *refn, Eina_Strbuf *wbuf) 26_generate_ref(const char *refn, Eina_Strbuf *wbuf, Eina_Bool use_legacy)
27{ 27{
28 const Eolian_Declaration *decl = eolian_declaration_get_by_name(refn); 28 const Eolian_Declaration *decl = eolian_declaration_get_by_name(refn);
29 if (decl) 29 if (decl)
@@ -46,7 +46,7 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf)
46 if (tp) 46 if (tp)
47 { 47 {
48 if (!eolian_type_struct_field_get(tp, sfx + 1)) goto noref; 48 if (!eolian_type_struct_field_get(tp, sfx + 1)) goto noref;
49 _generate_ref(bname, wbuf); 49 _generate_ref(bname, wbuf, use_legacy);
50 eina_strbuf_append(wbuf, sfx); 50 eina_strbuf_append(wbuf, sfx);
51 eina_stringshare_del(bname); 51 eina_stringshare_del(bname);
52 return; 52 return;
@@ -57,7 +57,7 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf)
57 { 57 {
58 const Eolian_Enum_Type_Field *efl = eolian_type_enum_field_get(tp, sfx + 1); 58 const Eolian_Enum_Type_Field *efl = eolian_type_enum_field_get(tp, sfx + 1);
59 if (!efl) goto noref; 59 if (!efl) goto noref;
60 _generate_ref(bname, wbuf); 60 _generate_ref(bname, wbuf, use_legacy);
61 Eina_Stringshare *str = eolian_type_enum_field_c_name_get(efl); 61 Eina_Stringshare *str = eolian_type_enum_field_c_name_get(efl);
62 eina_strbuf_append_char(wbuf, '.'); 62 eina_strbuf_append_char(wbuf, '.');
63 eina_strbuf_append(wbuf, str); 63 eina_strbuf_append(wbuf, str);
@@ -101,14 +101,9 @@ _generate_ref(const char *refn, Eina_Strbuf *wbuf)
101 101
102 if (!fn) goto noref; 102 if (!fn) goto noref;
103 103
104 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fn); 104 Eina_Stringshare *fcn = eolian_function_full_c_name_get(fn, ftype, use_legacy);
105 eina_strbuf_append(wbuf, fcn); 105 eina_strbuf_append(wbuf, fcn);
106 eina_stringshare_del(fcn); 106 eina_stringshare_del(fcn);
107 if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
108 eina_strbuf_append(wbuf, "_get");
109 else if (ftype == EOLIAN_PROP_SET)
110 eina_strbuf_append(wbuf, "_set");
111
112 return; 107 return;
113noref: 108noref:
114 eina_strbuf_append(wbuf, refn); 109 eina_strbuf_append(wbuf, refn);
@@ -116,7 +111,7 @@ noref:
116 111
117int 112int
118_append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf, 113_append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf,
119 Eina_Strbuf *wbuf) 114 Eina_Strbuf *wbuf, Eina_Bool use_legacy)
120{ 115{
121 while (*desc) 116 while (*desc)
122 { 117 {
@@ -140,7 +135,7 @@ _append_section(const char *desc, int ind, int curl, Eina_Strbuf *buf,
140 ++desc; 135 ++desc;
141 if (*(desc - 1) == '.') --desc; 136 if (*(desc - 1) == '.') --desc;
142 Eina_Stringshare *refn = eina_stringshare_add_length(ref, desc - ref); 137 Eina_Stringshare *refn = eina_stringshare_add_length(ref, desc - ref);
143 _generate_ref(refn, wbuf); 138 _generate_ref(refn, wbuf, use_legacy);
144 eina_stringshare_del(refn); 139 eina_stringshare_del(refn);
145 } 140 }
146 else 141 else
@@ -204,12 +199,12 @@ _append_since(const char *since, int indent, int curl, Eina_Strbuf *buf)
204 199
205void 200void
206_gen_doc_brief(const char *summary, const char *since, int indent, 201_gen_doc_brief(const char *summary, const char *since, int indent,
207 Eina_Strbuf *buf) 202 Eina_Strbuf *buf, Eina_Bool use_legacy)
208{ 203{
209 int curl = 4 + indent; 204 int curl = 4 + indent;
210 Eina_Strbuf *wbuf = eina_strbuf_new(); 205 Eina_Strbuf *wbuf = eina_strbuf_new();
211 eina_strbuf_append(buf, "/** "); 206 eina_strbuf_append(buf, "/** ");
212 curl = _append_section(summary, indent, curl, buf, wbuf); 207 curl = _append_section(summary, indent, curl, buf, wbuf, use_legacy);
213 eina_strbuf_free(wbuf); 208 eina_strbuf_free(wbuf);
214 curl = _append_since(since, indent, curl, buf); 209 curl = _append_since(since, indent, curl, buf);
215 if ((curl + 3) > DOC_LIMIT(indent)) 210 if ((curl + 3) > DOC_LIMIT(indent))
@@ -224,7 +219,7 @@ _gen_doc_brief(const char *summary, const char *since, int indent,
224 219
225void 220void
226_gen_doc_full(const char *summary, const char *description, const char *since, 221_gen_doc_full(const char *summary, const char *description, const char *since,
227 int indent, Eina_Strbuf *buf) 222 int indent, Eina_Strbuf *buf, Eina_Bool use_legacy)
228{ 223{
229 int curl = 0; 224 int curl = 0;
230 Eina_Strbuf *wbuf = eina_strbuf_new(); 225 Eina_Strbuf *wbuf = eina_strbuf_new();
@@ -232,13 +227,13 @@ _gen_doc_full(const char *summary, const char *description, const char *since,
232 curl += _indent_line(buf, indent); 227 curl += _indent_line(buf, indent);
233 eina_strbuf_append(buf, " * @brief "); 228 eina_strbuf_append(buf, " * @brief ");
234 curl += sizeof(" * @brief ") - 1; 229 curl += sizeof(" * @brief ") - 1;
235 _append_section(summary, indent, curl, buf, wbuf); 230 _append_section(summary, indent, curl, buf, wbuf, use_legacy);
236 eina_strbuf_append_char(buf, '\n'); 231 eina_strbuf_append_char(buf, '\n');
237 _indent_line(buf, indent); 232 _indent_line(buf, indent);
238 eina_strbuf_append(buf, " *\n"); 233 eina_strbuf_append(buf, " *\n");
239 curl = _indent_line(buf, indent); 234 curl = _indent_line(buf, indent);
240 eina_strbuf_append(buf, " * "); 235 eina_strbuf_append(buf, " * ");
241 _append_section(description, indent, curl + 3, buf, wbuf); 236 _append_section(description, indent, curl + 3, buf, wbuf, use_legacy);
242 curl = _append_since(since, indent, curl, buf); 237 curl = _append_since(since, indent, curl, buf);
243 eina_strbuf_append_char(buf, '\n'); 238 eina_strbuf_append_char(buf, '\n');
244 _indent_line(buf, indent); 239 _indent_line(buf, indent);
@@ -247,7 +242,8 @@ _gen_doc_full(const char *summary, const char *description, const char *since,
247} 242}
248 243
249Eina_Strbuf * 244Eina_Strbuf *
250docs_generate_full(const Eolian_Documentation *doc, int indent) 245docs_generate_full(const Eolian_Documentation *doc, int indent,
246 Eina_Bool use_legacy)
251{ 247{
252 if (!doc) return NULL; 248 if (!doc) return NULL;
253 249
@@ -257,14 +253,15 @@ docs_generate_full(const Eolian_Documentation *doc, int indent)
257 253
258 Eina_Strbuf *buf = eina_strbuf_new(); 254 Eina_Strbuf *buf = eina_strbuf_new();
259 if (!desc) 255 if (!desc)
260 _gen_doc_brief(sum, since, indent, buf); 256 _gen_doc_brief(sum, since, indent, buf, use_legacy);
261 else 257 else
262 _gen_doc_full(sum, desc, since, indent, buf); 258 _gen_doc_full(sum, desc, since, indent, buf, use_legacy);
263 return buf; 259 return buf;
264} 260}
265 261
266Eina_Strbuf * 262Eina_Strbuf *
267docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, int indent) 263docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype,
264 int indent, Eina_Bool use_legacy)
268{ 265{
269 const Eolian_Function_Parameter *par = NULL; 266 const Eolian_Function_Parameter *par = NULL;
270 const Eolian_Function_Parameter *vpar = NULL; 267 const Eolian_Function_Parameter *vpar = NULL;
@@ -376,7 +373,8 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
376 /* only summary, nothing else; generate standard brief doc */ 373 /* only summary, nothing else; generate standard brief doc */
377 if (!desc && !par && !vpar && !rdoc && (ftype == EOLIAN_METHOD || !pdoc)) 374 if (!desc && !par && !vpar && !rdoc && (ftype == EOLIAN_METHOD || !pdoc))
378 { 375 {
379 _gen_doc_brief(sum ? sum : "No description supplied.", since, indent, buf); 376 _gen_doc_brief(sum ? sum : "No description supplied.", since, indent,
377 buf, use_legacy);
380 return buf; 378 return buf;
381 } 379 }
382 380
@@ -387,7 +385,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
387 eina_strbuf_append(buf, " * @brief "); 385 eina_strbuf_append(buf, " * @brief ");
388 curl += sizeof(" * @brief ") - 1; 386 curl += sizeof(" * @brief ") - 1;
389 _append_section(sum ? sum : "No description supplied.", 387 _append_section(sum ? sum : "No description supplied.",
390 indent, curl, buf, wbuf); 388 indent, curl, buf, wbuf, use_legacy);
391 389
392 eina_strbuf_append_char(buf, '\n'); 390 eina_strbuf_append_char(buf, '\n');
393 if (desc || since || par || rdoc || pdoc) 391 if (desc || since || par || rdoc || pdoc)
@@ -400,7 +398,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
400 { 398 {
401 curl = _indent_line(buf, indent); 399 curl = _indent_line(buf, indent);
402 eina_strbuf_append(buf, " * "); 400 eina_strbuf_append(buf, " * ");
403 _append_section(desc, indent, curl + 3, buf, wbuf); 401 _append_section(desc, indent, curl + 3, buf, wbuf, use_legacy);
404 eina_strbuf_append_char(buf, '\n'); 402 eina_strbuf_append_char(buf, '\n');
405 if (par || rdoc || pdoc || since) 403 if (par || rdoc || pdoc || since)
406 { 404 {
@@ -415,7 +413,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
415 curl = _indent_line(buf, indent); 413 curl = _indent_line(buf, indent);
416 eina_strbuf_append(buf, " * "); 414 eina_strbuf_append(buf, " * ");
417 _append_section(eolian_documentation_summary_get(pdoc), indent, 415 _append_section(eolian_documentation_summary_get(pdoc), indent,
418 curl + 3, buf, wbuf); 416 curl + 3, buf, wbuf, use_legacy);
419 eina_strbuf_append_char(buf, '\n'); 417 eina_strbuf_append_char(buf, '\n');
420 if (pdesc) 418 if (pdesc)
421 { 419 {
@@ -423,7 +421,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
423 eina_strbuf_append(buf, " *\n"); 421 eina_strbuf_append(buf, " *\n");
424 curl = _indent_line(buf, indent); 422 curl = _indent_line(buf, indent);
425 eina_strbuf_append(buf, " * "); 423 eina_strbuf_append(buf, " * ");
426 _append_section(pdesc, indent, curl + 3, buf, wbuf); 424 _append_section(pdesc, indent, curl + 3, buf, wbuf, use_legacy);
427 eina_strbuf_append_char(buf, '\n'); 425 eina_strbuf_append_char(buf, '\n');
428 } 426 }
429 if (par || rdoc || since) 427 if (par || rdoc || since)
@@ -467,7 +465,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
467 eina_strbuf_append_char(buf, ' '); 465 eina_strbuf_append_char(buf, ' ');
468 curl += 1; 466 curl += 1;
469 _append_section(eolian_documentation_summary_get(adoc), 467 _append_section(eolian_documentation_summary_get(adoc),
470 indent, curl, buf, wbuf); 468 indent, curl, buf, wbuf, use_legacy);
471 } 469 }
472 470
473 eina_strbuf_append_char(buf, '\n'); 471 eina_strbuf_append_char(buf, '\n');
@@ -500,7 +498,7 @@ docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, i
500 eina_strbuf_append(buf, " * @return "); 498 eina_strbuf_append(buf, " * @return ");
501 curl += sizeof(" * @return ") - 1; 499 curl += sizeof(" * @return ") - 1;
502 _append_section(eolian_documentation_summary_get(rdoc), indent, curl, 500 _append_section(eolian_documentation_summary_get(rdoc), indent, curl,
503 buf, wbuf); 501 buf, wbuf, use_legacy);
504 eina_strbuf_append_char(buf, '\n'); 502 eina_strbuf_append_char(buf, '\n');
505 if (since) 503 if (since)
506 { 504 {
diff --git a/src/bin/eolian/docs_generator.h b/src/bin/eolian/docs_generator.h
index c8a6c1f019..0f4424a3f2 100644
--- a/src/bin/eolian/docs_generator.h
+++ b/src/bin/eolian/docs_generator.h
@@ -9,11 +9,12 @@
9 * 9 *
10 * @param[in] doc the documentation 10 * @param[in] doc the documentation
11 * @param[in] indent by how many spaces to indent the comment from second line 11 * @param[in] indent by how many spaces to indent the comment from second line
12 * @param[in] use_legacy whether to use legacy names
12 * 13 *
13 * @return A documentation comment 14 * @return A documentation comment
14 * 15 *
15 */ 16 */
16Eina_Strbuf *docs_generate_full(const Eolian_Documentation *doc, int indent); 17Eina_Strbuf *docs_generate_full(const Eolian_Documentation *doc, int indent, Eina_Bool use_legacy);
17 18
18/* 19/*
19 * @brief Generate function documentation 20 * @brief Generate function documentation
@@ -21,11 +22,12 @@ Eina_Strbuf *docs_generate_full(const Eolian_Documentation *doc, int indent);
21 * @param[in] fid te function 22 * @param[in] fid te function
22 * @param[in] type the function type (either METHOD, PROP_GET, PROP_SET) 23 * @param[in] type the function type (either METHOD, PROP_GET, PROP_SET)
23 * @param[in] indent by how many spaces to indent the comment from second line 24 * @param[in] indent by how many spaces to indent the comment from second line
25 * @param[in] use_legacy whether to use legacy names
24 * 26 *
25 * @return A documentation comment 27 * @return A documentation comment
26 * 28 *
27 */ 29 */
28Eina_Strbuf *docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, int indent); 30Eina_Strbuf *docs_generate_function(const Eolian_Function *fid, Eolian_Function_Type ftype, int indent, Eina_Bool use_legacy);
29 31
30#endif 32#endif
31 33
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 2be1fa7ffe..b60b4299d8 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
120 } 120 }
121 else 121 else
122 { 122 {
123 Eina_Strbuf *dbuf = docs_generate_function(func, ftype, 0); 123 Eina_Strbuf *dbuf = docs_generate_function(func, ftype, 0, EINA_FALSE);
124 eina_strbuf_append(str_func, eina_strbuf_string_get(dbuf)); 124 eina_strbuf_append(str_func, eina_strbuf_string_get(dbuf));
125 eina_strbuf_append_char(str_func, '\n'); 125 eina_strbuf_append_char(str_func, '\n');
126 eina_strbuf_free(dbuf); 126 eina_strbuf_free(dbuf);
@@ -251,7 +251,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
251 251
252 if (doc) 252 if (doc)
253 { 253 {
254 Eina_Strbuf *cdoc = docs_generate_full(doc, 0); 254 Eina_Strbuf *cdoc = docs_generate_full(doc, 0, EINA_FALSE);
255 if (cdoc) 255 if (cdoc)
256 { 256 {
257 eina_strbuf_append(buf, eina_strbuf_string_get(cdoc)); 257 eina_strbuf_append(buf, eina_strbuf_string_get(cdoc));
@@ -309,7 +309,7 @@ eo_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
309 309
310 if (evdoc) 310 if (evdoc)
311 { 311 {
312 Eina_Strbuf *evdbuf = docs_generate_full(evdoc, 0); 312 Eina_Strbuf *evdbuf = docs_generate_full(evdoc, 0, EINA_FALSE);
313 eina_strbuf_append(str_ev, eina_strbuf_string_get(evdbuf)); 313 eina_strbuf_append(str_ev, eina_strbuf_string_get(evdbuf));
314 eina_strbuf_append_char(str_ev, '\n'); 314 eina_strbuf_append_char(str_ev, '\n');
315 eina_strbuf_free(evdbuf); 315 eina_strbuf_free(evdbuf);
@@ -819,7 +819,6 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
819 Eolian_Function_Type ftype; 819 Eolian_Function_Type ftype;
820 const Eolian_Function *fnid = NULL; 820 const Eolian_Function *fnid = NULL;
821 const char *funcname = NULL; 821 const char *funcname = NULL;
822 const char *rets;
823 822
824 const char *names[] = { "", "getter ", "setter " }; 823 const char *names[] = { "", "getter ", "setter " };
825 824
@@ -874,8 +873,6 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
874 goto end; 873 goto end;
875 } 874 }
876 875
877 rets = eolian_function_full_c_name_get(fnid);
878
879 const char *class_str = ""; 876 const char *class_str = "";
880 if (eolian_function_is_class(fnid)) class_str = "CLASS_"; 877 if (eolian_function_is_class(fnid)) class_str = "CLASS_";
881 878
@@ -884,25 +881,32 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
884 case EOLIAN_PROP_SET: case EOLIAN_PROP_GET: case EOLIAN_PROPERTY: 881 case EOLIAN_PROP_SET: case EOLIAN_PROP_GET: case EOLIAN_PROPERTY:
885 if (ftype != EOLIAN_PROP_GET) 882 if (ftype != EOLIAN_PROP_GET)
886 { 883 {
887 eina_strbuf_append_printf(str_op, "\n EO_OP_%sFUNC_OVERRIDE(%s_set, %s_%s_set),", 884 Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, EOLIAN_PROP_SET, EINA_FALSE);
885 eina_strbuf_append_printf(str_op, "\n EO_OP_%sFUNC_OVERRIDE(%s, %s_%s_set),",
888 class_str, rets, implname, funcname); 886 class_str, rets, implname, funcname);
889 eo_bind_func_generate(class, fnid, EOLIAN_PROP_SET, str_bodyf, impl_desc, &impl_env); 887 eo_bind_func_generate(class, fnid, EOLIAN_PROP_SET, str_bodyf, impl_desc, &impl_env);
888 eina_stringshare_del(rets);
890 } 889 }
891 890
892 if (ftype != EOLIAN_PROP_SET) 891 if (ftype != EOLIAN_PROP_SET)
893 { 892 {
894 eina_strbuf_append_printf(str_op, "\n EO_OP_%sFUNC_OVERRIDE(%s_get, %s_%s_get),", 893 Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, EOLIAN_PROP_GET, EINA_FALSE);
894 eina_strbuf_append_printf(str_op, "\n EO_OP_%sFUNC_OVERRIDE(%s, %s_%s_get),",
895 class_str, rets, implname, funcname); 895 class_str, rets, implname, funcname);
896 eo_bind_func_generate(class, fnid, EOLIAN_PROP_GET, str_bodyf, impl_desc, &impl_env); 896 eo_bind_func_generate(class, fnid, EOLIAN_PROP_GET, str_bodyf, impl_desc, &impl_env);
897 eina_stringshare_del(rets);
897 } 898 }
898 break; 899 break;
899 default: 900 default:
900 eina_strbuf_append_printf(str_op, "\n EO_OP_%sFUNC_OVERRIDE(%s, %s_%s),", 901 {
901 class_str, rets, implname, funcname); 902 Eina_Stringshare *rets = eolian_function_full_c_name_get(fnid, ftype, EINA_FALSE);
902 eo_bind_func_generate(class, fnid, ftype, str_bodyf, impl_desc, &impl_env); 903 eina_strbuf_append_printf(str_op, "\n EO_OP_%sFUNC_OVERRIDE(%s, %s_%s),",
903 break; 904 class_str, rets, implname, funcname);
905 eo_bind_func_generate(class, fnid, ftype, str_bodyf, impl_desc, &impl_env);
906 eina_stringshare_del(rets);
907 break;
908 }
904 } 909 }
905 eina_stringshare_del(rets);
906 } 910 }
907 eina_iterator_free(itr); 911 eina_iterator_free(itr);
908 912
diff --git a/src/bin/eolian/legacy_generator.c b/src/bin/eolian/legacy_generator.c
index d1e56dc5eb..6f49d6b3cd 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
97 } 97 }
98 else 98 else
99 { 99 {
100 Eina_Strbuf *dbuf = docs_generate_function(funcid, ftype, 0); 100 Eina_Strbuf *dbuf = docs_generate_function(funcid, ftype, 0, EINA_TRUE);
101 eina_strbuf_append_char(fbody, '\n'); 101 eina_strbuf_append_char(fbody, '\n');
102 eina_strbuf_append(fbody, eina_strbuf_string_get(dbuf)); 102 eina_strbuf_append(fbody, eina_strbuf_string_get(dbuf));
103 eina_strbuf_append_char(fbody, '\n'); 103 eina_strbuf_append_char(fbody, '\n');
@@ -387,7 +387,7 @@ legacy_header_generate(const Eolian_Class *class, Eina_Strbuf *buf)
387 const Eolian_Documentation *doc = eolian_class_documentation_get(class); 387 const Eolian_Documentation *doc = eolian_class_documentation_get(class);
388 if (doc) 388 if (doc)
389 { 389 {
390 Eina_Strbuf *cdoc = docs_generate_full(doc, 0); 390 Eina_Strbuf *cdoc = docs_generate_full(doc, 0, EINA_TRUE);
391 if (cdoc) 391 if (cdoc)
392 { 392 {
393 eina_strbuf_append(buf, eina_strbuf_string_get(cdoc)); 393 eina_strbuf_append(buf, eina_strbuf_string_get(cdoc));
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index f2dbd5a8e8..941053b870 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)
120 120
121 Eina_Strbuf *buffer = eina_strbuf_new(); 121 Eina_Strbuf *buffer = eina_strbuf_new();
122 122
123 if (!types_header_generate(eo_filename, buffer, EINA_TRUE)) 123 if (!types_header_generate(eo_filename, buffer, EINA_TRUE, EINA_FALSE))
124 { 124 {
125 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename); 125 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
126 goto end; 126 goto end;
@@ -166,7 +166,7 @@ _generate_stub_header_file(char *filename, const char *eo_filename)
166 166
167 Eina_Strbuf *buffer = eina_strbuf_new(); 167 Eina_Strbuf *buffer = eina_strbuf_new();
168 168
169 if (!types_header_generate(eo_filename, buffer, EINA_FALSE)) 169 if (!types_header_generate(eo_filename, buffer, EINA_FALSE, EINA_FALSE))
170 { 170 {
171 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename); 171 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
172 goto end; 172 goto end;
@@ -259,7 +259,7 @@ _generate_legacy_header_file(char *filename, const char *eo_filename)
259 259
260 Eina_Strbuf *buffer = eina_strbuf_new(); 260 Eina_Strbuf *buffer = eina_strbuf_new();
261 261
262 if (!types_header_generate(eo_filename, buffer, EINA_TRUE)) 262 if (!types_header_generate(eo_filename, buffer, EINA_TRUE, EINA_TRUE))
263 { 263 {
264 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename); 264 fprintf(stderr, "eolian: could not generate types of '%s'\n", eo_filename);
265 goto end; 265 goto end;
diff --git a/src/bin/eolian/types_generator.c b/src/bin/eolian/types_generator.c
index 1876c4cde6..7a032ef27e 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)
34} 34}
35 35
36static Eina_Strbuf * 36static Eina_Strbuf *
37_type_generate(const Eolian_Type *tp, Eina_Bool full) 37_type_generate(const Eolian_Type *tp, Eina_Bool full, Eina_Bool use_legacy)
38{ 38{
39 Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp), 0); 39 Eina_Strbuf *buf = docs_generate_full(eolian_type_documentation_get(tp), 0, use_legacy);
40 if (!buf) buf = eina_strbuf_new(); 40 if (!buf) buf = eina_strbuf_new();
41 else eina_strbuf_append_char(buf, '\n'); 41 else eina_strbuf_append_char(buf, '\n');
42 Eolian_Type_Type tp_type = eolian_type_type_get(tp); 42 Eolian_Type_Type tp_type = eolian_type_type_get(tp);
@@ -79,7 +79,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
79 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n'); 79 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
80 if (nl) 80 if (nl)
81 { 81 {
82 Eina_Strbuf *fbuf = docs_generate_full(fdoc, strlen(nl)); 82 Eina_Strbuf *fbuf = docs_generate_full(fdoc, strlen(nl), use_legacy);
83 if (fbuf) 83 if (fbuf)
84 eina_strbuf_append_printf(buf, " %s", 84 eina_strbuf_append_printf(buf, " %s",
85 eina_strbuf_string_get(fbuf)); 85 eina_strbuf_string_get(fbuf));
@@ -145,7 +145,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
145 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n'); 145 const char *nl = strrchr(eina_strbuf_string_get(buf), '\n');
146 if (nl) 146 if (nl)
147 { 147 {
148 Eina_Strbuf *fbuf = docs_generate_full(fdoc, strlen(nl)); 148 Eina_Strbuf *fbuf = docs_generate_full(fdoc, strlen(nl), use_legacy);
149 if (fbuf) 149 if (fbuf)
150 eina_strbuf_append_printf(buf, " %s", 150 eina_strbuf_append_printf(buf, " %s",
151 eina_strbuf_string_get(fbuf)); 151 eina_strbuf_string_get(fbuf));
@@ -170,7 +170,7 @@ _type_generate(const Eolian_Type *tp, Eina_Bool full)
170} 170}
171 171
172Eina_Bool 172Eina_Bool
173types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full) 173types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool use_legacy)
174{ 174{
175 const Eolian_Declaration *decl; 175 const Eolian_Declaration *decl;
176 176
@@ -198,7 +198,7 @@ types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full)
198 continue; 198 continue;
199 } 199 }
200 200
201 Eina_Strbuf *tbuf = _type_generate(tp, full); 201 Eina_Strbuf *tbuf = _type_generate(tp, full, use_legacy);
202 if (tbuf) 202 if (tbuf)
203 { 203 {
204 eina_strbuf_append(buf, eina_strbuf_string_get(tbuf)); 204 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 84eb15dd25..5096614217 100644
--- a/src/bin/eolian/types_generator.h
+++ b/src/bin/eolian/types_generator.h
@@ -9,11 +9,12 @@
9 * @param[in] eo_filename Eo filename 9 * @param[in] eo_filename Eo filename
10 * @param[inout] buf buffer to fill 10 * @param[inout] buf buffer to fill
11 * @param[in]full whether to generate full type definitions 11 * @param[in]full whether to generate full type definitions
12 * @param[in] use_legacy whether to use legacy names
12 * 13 *
13 * @return EINA_TRUE on success, EINA_FALSE on error. 14 * @return EINA_TRUE on success, EINA_FALSE on error.
14 * 15 *
15 */ 16 */
16Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full); 17Eina_Bool types_header_generate(const char *eo_filename, Eina_Strbuf *buf, Eina_Bool full, Eina_Bool use_legacy);
17 18
18Eina_Bool types_class_typedef_generate(const char *eo_filename, Eina_Strbuf *buf); 19Eina_Bool types_class_typedef_generate(const char *eo_filename, Eina_Strbuf *buf);
19 20
diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh b/src/bin/eolian_cxx/eolian_wrappers.hh
index 9ea4f4cf15..0b78020188 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)
164inline std::string 164inline std::string
165function_impl(Eolian_Function const& func) 165function_impl(Eolian_Function const& func)
166{ 166{
167 const char *s = ::eolian_function_full_c_name_get(&func); 167 const char *s = ::eolian_function_full_c_name_get(&func, EOLIAN_METHOD, EINA_FALSE);
168 std::string ret(s); 168 std::string ret(s);
169 ::eina_stringshare_del(s); 169 ::eina_stringshare_del(s);
170 return ret; 170 return ret;
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 6cf150002d..3a8686d960 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -206,7 +206,7 @@ ffi.cdef [[
206 Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id); 206 Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
207 Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *function_id); 207 Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *function_id);
208 const char *eolian_function_name_get(const Eolian_Function *function_id); 208 const char *eolian_function_name_get(const Eolian_Function *function_id);
209 const char *eolian_function_full_c_name_get(const Eolian_Function *function_id); 209 const char *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy);
210 const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type); 210 const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
211 const char *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type); 211 const char *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
212 const Eolian_Documentation *eolian_function_documentation_get(const Eolian_Function *function_id, Eolian_Function_Type f_type); 212 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", {
617 return ffi.string(v) 617 return ffi.string(v)
618 end, 618 end,
619 619
620 full_c_name_get = function(self) 620 full_c_name_get = function(self, ftype, use_legacy)
621 local v = eolian.eolian_function_full_c_name_get(self) 621 local v = eolian.eolian_function_full_c_name_get(self, ftype, use_legacy or false)
622 if v == nil then return nil end 622 if v == nil then return nil end
623 return ffi_stringshare(v) 623 return ffi_stringshare(v)
624 end, 624 end,
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index e950e21545..1af271ebd6 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_
648 * @brief Returns the full C name of a function. 648 * @brief Returns the full C name of a function.
649 * 649 *
650 * @param[in] function_id Id of the function 650 * @param[in] function_id Id of the function
651 * @param[in] ftype The type of function to get the name for
652 * @param[in] use_legacy If true, legacy prefix or name will be used when available
651 * @return the function name 653 * @return the function name
652 * 654 *
653 * It's here because the C API names are deduplicated (prefix of function and 655 * It's here because the C API names are deduplicated (prefix of function and
654 * suffix of prefix merge if applicable) and this helps generators not write 656 * suffix of prefix merge if applicable) and this helps generators not write
655 * the same code over and over. 657 * the same code over and over.
658 *
659 * If legacy name is supplied for the given type and use_legacy is set, it
660 * will be used. Also, if the given type is PROP_GET or PROPERTY, a "_get"
661 * suffix will be applied when not using legacy name, and "_set" for PROP_SET.
662 *
656 * Also, you're responsible for deleting the stringshare. 663 * Also, you're responsible for deleting the stringshare.
657 * 664 *
658 * @ingroup Eolian 665 * @ingroup Eolian
659 */ 666 */
660EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id); 667EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy);
661 668
662/* 669/*
663 * @brief Get a function in a class by its name and type 670 * @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 4ff34a7813..3c23156acb 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)
27} 27}
28 28
29static const char * 29static const char *
30get_eo_prefix(const Eolian_Function *foo_id, char *buf) 30_get_eo_prefix(const Eolian_Function *foo_id, char *buf, Eina_Bool use_legacy)
31{ 31{
32 char *tmp = buf; 32 char *tmp = buf;
33 if (foo_id->klass->eo_prefix) 33 if (use_legacy && foo_id->klass->legacy_prefix)
34 {
35 if (!strcmp(foo_id->klass->legacy_prefix, "null"))
36 return NULL;
37 return foo_id->klass->legacy_prefix;
38 }
39 else if (!use_legacy && foo_id->klass->eo_prefix)
34 return foo_id->klass->eo_prefix; 40 return foo_id->klass->eo_prefix;
35 strcpy(buf, foo_id->klass->full_name); 41 strcpy(buf, foo_id->klass->full_name);
36 eina_str_tolower(&buf); 42 eina_str_tolower(&buf);
@@ -39,10 +45,39 @@ get_eo_prefix(const Eolian_Function *foo_id, char *buf)
39} 45}
40 46
41EAPI Eina_Stringshare * 47EAPI Eina_Stringshare *
42eolian_function_full_c_name_get(const Eolian_Function *foo_id) 48eolian_function_full_c_name_get(const Eolian_Function *foo_id,
49 Eolian_Function_Type ftype,
50 Eina_Bool use_legacy)
43{ 51{
52 switch (ftype)
53 {
54 case EOLIAN_UNRESOLVED:
55 case EOLIAN_METHOD:
56 case EOLIAN_PROPERTY:
57 case EOLIAN_PROP_GET:
58 if (foo_id->get_legacy && use_legacy)
59 {
60 if (!strcmp(foo_id->get_legacy, "null"))
61 return NULL;
62 return eina_stringshare_ref(foo_id->get_legacy);
63 }
64 break;
65 case EOLIAN_PROP_SET:
66 if (foo_id->set_legacy && use_legacy)
67 {
68 if (!strcmp(foo_id->set_legacy, "null"))
69 return NULL;
70 return eina_stringshare_ref(foo_id->set_legacy);
71 }
72 break;
73 }
74
44 char tbuf[512]; 75 char tbuf[512];
45 const char *prefix = get_eo_prefix(foo_id, tbuf); 76 const char *prefix = _get_eo_prefix(foo_id, tbuf, use_legacy);
77
78 if (!prefix)
79 return NULL;
80
46 const char *funcn = eolian_function_name_get(foo_id); 81 const char *funcn = eolian_function_name_get(foo_id);
47 const char *last_p = strrchr(prefix, '_'); 82 const char *last_p = strrchr(prefix, '_');
48 const char *func_p = strchr(funcn, '_'); 83 const char *func_p = strchr(funcn, '_');
@@ -55,11 +90,17 @@ eolian_function_full_c_name_get(const Eolian_Function *foo_id)
55 if (!func_p) len = strlen(funcn); 90 if (!func_p) len = strlen(funcn);
56 else len = func_p - funcn; 91 else len = func_p - funcn;
57 92
58 if ((int)strlen(last_p) != len || strncmp(last_p, funcn, len)) 93 if (use_legacy || (int)strlen(last_p) != len || strncmp(last_p, funcn, len))
59 { 94 {
60 eina_strbuf_append(buf, prefix); 95 eina_strbuf_append(buf, prefix);
61 eina_strbuf_append_char(buf, '_'); 96 eina_strbuf_append_char(buf, '_');
62 eina_strbuf_append(buf, funcn); 97 eina_strbuf_append(buf, funcn);
98
99 if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
100 eina_strbuf_append(buf, "_get");
101 else if (ftype == EOLIAN_PROP_SET)
102 eina_strbuf_append(buf, "_set");
103
63 ret = eina_stringshare_add(eina_strbuf_string_get(buf)); 104 ret = eina_stringshare_add(eina_strbuf_string_get(buf));
64 eina_strbuf_free(buf); 105 eina_strbuf_free(buf);
65 return ret; 106 return ret;
@@ -69,6 +110,12 @@ eolian_function_full_c_name_get(const Eolian_Function *foo_id)
69 eina_strbuf_append_n(buf, prefix, last_p - prefix); /* includes _ */ 110 eina_strbuf_append_n(buf, prefix, last_p - prefix); /* includes _ */
70 111
71 eina_strbuf_append(buf, funcn); 112 eina_strbuf_append(buf, funcn);
113
114 if ((ftype == EOLIAN_PROP_GET) || (ftype == EOLIAN_PROPERTY))
115 eina_strbuf_append(buf, "_get");
116 else if (ftype == EOLIAN_PROP_SET)
117 eina_strbuf_append(buf, "_set");
118
72 ret = eina_stringshare_add(eina_strbuf_string_get(buf)); 119 ret = eina_stringshare_add(eina_strbuf_string_get(buf));
73 eina_strbuf_free(buf); 120 eina_strbuf_free(buf);
74 return ret; 121 return ret;
diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua
index 72c07f65aa..b54d01656f 100644
--- a/src/scripts/elua/modules/lualian.lua
+++ b/src/scripts/elua/modules/lualian.lua
@@ -183,7 +183,7 @@ local Method = Node:clone {
183 local allocs = {} 183 local allocs = {}
184 proto.allocs = allocs 184 proto.allocs = allocs
185 185
186 proto.full_name = meth:full_c_name_get() 186 proto.full_name = meth:full_c_name_get(func_type.METHOD)
187 187
188 local fulln = proto.full_name 188 local fulln = proto.full_name
189 189
@@ -278,7 +278,7 @@ local Property = Method:clone {
278 local allocs = {} 278 local allocs = {}
279 proto.allocs = allocs 279 proto.allocs = allocs
280 280
281 proto.full_name = prop:full_c_name_get() .. proto.suffix 281 proto.full_name = prop:full_c_name_get(self.ftype)
282 282
283 local fulln = proto.full_name 283 local fulln = proto.full_name
284 if #keys > 0 then 284 if #keys > 0 then