summaryrefslogtreecommitdiff
path: root/src/bin/eolian/sources.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/eolian/sources.c')
-rw-r--r--src/bin/eolian/sources.c88
1 files changed, 38 insertions, 50 deletions
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index e7a4612..a973dd3 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -194,11 +194,6 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
194 194
195 //generate the field definition 195 //generate the field definition
196 eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type, EOLIAN_C_TYPE_DEFAULT)); 196 eina_strbuf_append_printf(*buf, " %s", eolian_type_c_type_get(inner_type, EOLIAN_C_TYPE_DEFAULT));
197 if(t == EOLIAN_TYPE_BUILTIN_INARRAY
198 || t == EOLIAN_TYPE_BUILTIN_INLIST)
199 {
200 eina_strbuf_append(*buf, "*");
201 }
202 eina_strbuf_append_buffer(*buf, iter_param); 197 eina_strbuf_append_buffer(*buf, iter_param);
203 eina_strbuf_append(*buf, ";\n"); 198 eina_strbuf_append(*buf, ";\n");
204 199
@@ -212,24 +207,6 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
212 eina_strbuf_append(*buf, ")\n"); 207 eina_strbuf_append(*buf, ")\n");
213 _generate_loop_content(buf, inner_type, iter_param); 208 _generate_loop_content(buf, inner_type, iter_param);
214 } 209 }
215 else if (t == EOLIAN_TYPE_BUILTIN_INARRAY)
216 {
217 eina_strbuf_append_printf(*buf, " EINA_INARRAY_FOREACH(");
218 eina_strbuf_append_buffer(*buf, param);
219 eina_strbuf_append_char(*buf, ',');
220 eina_strbuf_append_buffer(*buf, iter_param);
221 eina_strbuf_append(*buf, ")\n");
222 _generate_loop_content(buf, inner_type, iter_param);
223 }
224 else if (t == EOLIAN_TYPE_BUILTIN_INLIST)
225 {
226 eina_strbuf_append_printf(*buf, " EINA_INLIST_FREE(");
227 eina_strbuf_append_buffer(*buf, param);
228 eina_strbuf_append_char(*buf, ',');
229 eina_strbuf_append_buffer(*buf, iter_param);
230 eina_strbuf_append(*buf, ")\n");
231 _generate_loop_content(buf, inner_type, iter_param);
232 }
233 else if (t == EOLIAN_TYPE_BUILTIN_ITERATOR) 210 else if (t == EOLIAN_TYPE_BUILTIN_ITERATOR)
234 { 211 {
235 eina_strbuf_append_printf(*buf, " EINA_ITERATOR_FOREACH("); 212 eina_strbuf_append_printf(*buf, " EINA_ITERATOR_FOREACH(");
@@ -437,6 +414,39 @@ _gen_reflect_set(Eina_Strbuf *buf, const char *cnamel, const Eolian_Type *valt,
437} 414}
438 415
439static void 416static void
417_emit_class_function(Eina_Strbuf *buf, const Eolian_Function *fid, const Eolian_Type *rtp, Eina_Strbuf *params_full,
418 const char *ocnamel, const char *func_suffix, Eina_Strbuf *params, const char *function_name)
419{
420 eina_strbuf_append(buf, "EOAPI ");
421 if (rtp)
422 eina_strbuf_append(buf, eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN));
423 else
424 eina_strbuf_append(buf, "void");
425 eina_strbuf_append(buf, " ");
426 eina_strbuf_append(buf, function_name);
427 eina_strbuf_append(buf, "(");
428 if (eina_strbuf_length_get(params_full) == 0)
429 eina_strbuf_append(buf, "void");
430 else
431 eina_strbuf_append_buffer(buf, params_full);
432 eina_strbuf_append(buf, ")\n");
433 eina_strbuf_append(buf, "{\n");
434 eina_strbuf_append_printf(buf, " %s();\n", eolian_class_c_get_function_name_get(eolian_function_class_get(fid)));
435 if (rtp)
436 eina_strbuf_append(buf, " return ");
437 else
438 eina_strbuf_append(buf, " ");
439 eina_strbuf_append_printf(buf, "_%s", ocnamel);
440 eina_strbuf_append_char(buf, '_');
441 eina_strbuf_append(buf, eolian_function_name_get(fid));
442 eina_strbuf_append(buf, func_suffix);
443 eina_strbuf_append(buf, "(");
444 eina_strbuf_append_buffer(buf, params);
445 eina_strbuf_append(buf, ");\n");
446 eina_strbuf_append(buf, "}\n");
447}
448
449static void
440_gen_func(const Eolian_Class *cl, const Eolian_Function *fid, 450_gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
441 Eolian_Function_Type ftype, Eina_Strbuf *buf, 451 Eolian_Function_Type ftype, Eina_Strbuf *buf,
442 const Eolian_Implement *impl, Eina_Strbuf *lbuf, 452 const Eolian_Implement *impl, Eina_Strbuf *lbuf,
@@ -901,33 +911,11 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
901 } 911 }
902 if (impl_same_class && eolian_function_is_class(fid)) 912 if (impl_same_class && eolian_function_is_class(fid))
903 { 913 {
904 eina_strbuf_append(buf, "EOAPI "); 914 const char *legacy_name = eolian_function_full_c_name_get(fid, ftype, EINA_TRUE);
905 if (rtp) 915
906 eina_strbuf_append(buf, eolian_type_c_type_get(rtp, EOLIAN_C_TYPE_RETURN)); 916 _emit_class_function(buf, fid, rtp, params_full, ocnamel, func_suffix, params, eolian_function_full_c_name_get(fid, ftype, EINA_FALSE));
907 else 917 if (legacy_name)
908 eina_strbuf_append(buf, "void"); 918 _emit_class_function(buf, fid, rtp, params_full, ocnamel, func_suffix, params, legacy_name);
909 eina_strbuf_append(buf, " ");
910 eina_strbuf_append(buf, eolian_function_full_c_name_get(fid, ftype, EINA_FALSE));
911 eina_strbuf_append(buf, "(");
912 if (eina_strbuf_length_get(params_full) == 0)
913 eina_strbuf_append(buf, "void");
914 else
915 eina_strbuf_append_buffer(buf, params_full);
916 eina_strbuf_append(buf, ")\n");
917 eina_strbuf_append(buf, "{\n");
918 eina_strbuf_append_printf(buf, " %s();\n", eolian_class_c_get_function_name_get(cl));
919 if (rtp)
920 eina_strbuf_append(buf, " return ");
921 else
922 eina_strbuf_append(buf, " ");
923 eina_strbuf_append_printf(buf, "_%s", ocnamel);
924 eina_strbuf_append_char(buf, '_');
925 eina_strbuf_append(buf, eolian_function_name_get(fid));
926 eina_strbuf_append(buf, func_suffix);
927 eina_strbuf_append(buf, "(");
928 eina_strbuf_append_buffer(buf, params);
929 eina_strbuf_append(buf, ");\n");
930 eina_strbuf_append(buf, "}\n");
931 } 919 }
932 920
933 free(cname); 921 free(cname);