Yo Mickey, I see you begin to integrate Eolian into Enlightenment. It means more bugs for you ;-)
Thank you for this patch but I don't understand why there is so much code for that :-\ . If I understand correctly, you wanted to remove the useless return for void functions. However, it can be done in an easier way, by setting the "return " as a token in the template and inserting it only when needed. Since we moved to Eo2, I have to remove useless code and simplify it then. The templates are not good for a lot of generations and I planned to change part of them to eina_strbuf...printf. Jack, alias D2 On 04/11/2014 05:34 PM, Mike Blumenkrantz wrote: > discomfitor pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id=bdb8542e3bca2ca8e9a01590c2d470e4d321cb79 > > commit bdb8542e3bca2ca8e9a01590c2d470e4d321cb79 > Author: Mike Blumenkrantz <zm...@samsung.com> > Date: Fri Apr 11 10:32:48 2014 -0400 > > eolian no longer generates return statements for void functions > --- > src/bin/eolian/legacy_generator.c | 52 > +++++++++++++++++++++++++-------------- > 1 file changed, 33 insertions(+), 19 deletions(-) > > diff --git a/src/bin/eolian/legacy_generator.c > b/src/bin/eolian/legacy_generator.c > index a911132..b7167cb 100644 > --- a/src/bin/eolian/legacy_generator.c > +++ b/src/bin/eolian/legacy_generator.c > @@ -30,6 +30,15 @@ EAPI @#ret_type\n\ > return @#ret_val;\n\ > }\n\ > "; > +static const char > +tmpl_eapi_body_void[] ="\ > +\n\ > +EAPI void\n\ > +@#eapi_prefix_@#func(@#is_constEo *obj@#full_params)\n\ > +{\n\ > + eo_do((Eo *) obj, @#eoprefix_@#func(@#eo_params));\n\ > +}\n\ > +"; > > static void > _eapi_decl_func_generate(const char *classname, Eolian_Function funcid, > Eolian_Function_Type ftype, Eina_Strbuf *buf) > @@ -242,7 +251,10 @@ _eapi_func_generate(const char *classname, > Eolian_Function funcid, Eolian_Functi > func_lpref = (func_lpref) ? func_lpref : > eolian_function_data_get(funcid, EOLIAN_LEGACY); > if (func_lpref && !strcmp(func_lpref, "null")) goto end; > > - _template_fill(fbody, tmpl_eapi_body, classname, NULL, EINA_FALSE); > + if (rettype && (!ret_is_void)) > + _template_fill(fbody, tmpl_eapi_body, classname, NULL, EINA_FALSE); > + else > + _template_fill(fbody, tmpl_eapi_body_void, classname, NULL, EINA_FALSE); > eina_strbuf_replace_all(fbody, "@#eoprefix", current_eo_prefix_lower); > > if (func_lpref) > @@ -299,31 +311,33 @@ _eapi_func_generate(const char *classname, > Eolian_Function funcid, Eolian_Functi > } > } > > - char tmp_ret_str[0xFF]; > - sprintf (tmp_ret_str, "%s%s", ret_const?"const ":"", > rettype?rettype:"void"); > - if (rettype && !ret_is_void) > + if (rettype && (!ret_is_void)) > { > + char tmp_ret_str[0xFF]; > + sprintf (tmp_ret_str, "%s%s", ret_const?"const ":"", > rettype?rettype:"void"); > #ifndef EO > - if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", > "); > - eina_strbuf_append_printf(eoparam, "&%s", retname); > + if (eina_strbuf_length_get(eoparam)) > eina_strbuf_append(eoparam, ", "); > + eina_strbuf_append_printf(eoparam, "&%s", retname); > +#endif > + const char *dflt_ret_val = > + eolian_function_return_dflt_value_get(funcid, ftype); > + Eina_Bool had_star = !!strchr(rettype, '*'); > + sprintf (tmpstr, " %s%s%s%s = %s;\n", > + ret_const?"const ":"", rettype, had_star?"":" ", retname, > + dflt_ret_val?dflt_ret_val:"0"); > + > + eina_strbuf_replace_all(fbody, "@#ret_type", tmp_ret_str); > + eina_strbuf_replace_all(fbody, "@#ret_init_val", tmpstr); > + tmp_ret_str[0] = '\0'; > +#ifdef EO > + if (rettype && !ret_is_void) sprintf(tmp_ret_str, "%s = ", > retname); > #endif > - const char *dflt_ret_val = > - eolian_function_return_dflt_value_get(funcid, ftype); > - Eina_Bool had_star = !!strchr(rettype, '*'); > - sprintf (tmpstr, " %s%s%s%s = %s;\n", > - ret_const?"const ":"", rettype, had_star?"":" ", retname, > - dflt_ret_val?dflt_ret_val:"0"); > + eina_strbuf_replace_all(fbody, "@#eo_ret_assign", tmp_ret_str); > } > > eina_strbuf_replace_all(fbody, "@#full_params", > eina_strbuf_string_get(fparam)); > eina_strbuf_replace_all(fbody, "@#eo_params", > eina_strbuf_string_get(eoparam)); > - eina_strbuf_replace_all(fbody, "@#ret_type", tmp_ret_str); > - eina_strbuf_replace_all(fbody, "@#ret_init_val", tmpstr); > - tmp_ret_str[0] = '\0'; > -#ifdef EO > - if (rettype && !ret_is_void) sprintf(tmp_ret_str, "%s = ", retname); > -#endif > - eina_strbuf_replace_all(fbody, "@#eo_ret_assign", tmp_ret_str); > + > eina_strbuf_replace_all(fbody, "@#ret_val", (rettype && !ret_is_void) ? > retname : ""); > eina_strbuf_replace_all(fbody, "@#is_const", (ftype == EOLIAN_PROP_GET > || eolian_function_object_is_const(funcid)) ? "const " : ""); > > ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel