Eolian/Generator: Switch set/get functions generation.

We want to generate first set properties and then get properties to be
in accordance with the current op ids order.
This commit is contained in:
Daniel Zaoui 2014-03-05 13:45:14 +02:00
parent b5f0df20dc
commit 7aebf671bf
2 changed files with 48 additions and 48 deletions

View File

@ -278,18 +278,18 @@ eo1_header_generate(const char *classname, Eina_Strbuf *buf)
_template_fill(str_subid, tmpl_eo_subid, classname, funcname, EINA_FALSE);
eo1_fundef_generate(classname, (Eolian_Function)data, UNRESOLVED, str_hdr);
}
if (prop_read)
{
sprintf(tmpstr, "%s_get", funcname);
_template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE);
eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_hdr);
}
if (prop_write)
{
sprintf(tmpstr, "%s_set", funcname);
_template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE);
eo1_fundef_generate(classname, (Eolian_Function)data, SET, str_hdr);
}
if (prop_read)
{
sprintf(tmpstr, "%s_get", funcname);
_template_fill(str_subid, tmpl_eo_subid, classname, tmpstr, EINA_FALSE);
eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_hdr);
}
}
eina_strbuf_replace_all(str_hdr, "@#list_subid", eina_strbuf_string_get(str_subid));
@ -621,19 +621,19 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
if (prop_read)
{
sprintf(tmpstr, "%s_get", funcname);
_template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
eo1_bind_func_generate(classname, in_prop, GET, str_bodyf, impl_class);
}
if (prop_write)
{
sprintf(tmpstr, "%s_set", funcname);
_template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
eo1_bind_func_generate(classname, in_prop, SET, str_bodyf, impl_class);
}
if (prop_read)
{
sprintf(tmpstr, "%s_get", funcname);
_template_fill(str_func, tmpl_impl_str, impl_class, tmpstr, EINA_FALSE);
eo1_bind_func_generate(classname, in_prop, GET, str_bodyf, impl_class);
}
}
eina_strbuf_free(tmpl_impl);
}
@ -664,22 +664,6 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
if (prop_read)
{
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get"));
sprintf(tmpstr, "%s_get", funcname);
eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf);
eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
free(desc);
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
if (!eolian_function_is_virtual_pure(fn))
eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf);
else
eina_strbuf_reset(tmpbuf);
eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
}
if (prop_write)
{
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_set"));
@ -690,6 +674,22 @@ eo1_source_end_generate(const char *classname, Eina_Strbuf *buf)
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
free(desc);
if (!eolian_function_is_virtual_pure(fn))
eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf);
else
eina_strbuf_reset(tmpbuf);
eina_strbuf_append(str_func, eina_strbuf_string_get(tmpbuf));
}
if (prop_read)
{
char *desc = _source_desc_get(eolian_function_description_get(fn, "comment_get"));
sprintf(tmpstr, "%s_get", funcname);
eo1_eo_op_desc_generate(classname, tmpstr, tmpbuf);
eina_strbuf_replace_all(tmpbuf, "@#desc", desc);
free(desc);
eina_strbuf_append(str_op, eina_strbuf_string_get(tmpbuf));
if (!eolian_function_is_virtual_pure(fn))
eo1_eo_func_desc_generate(classname, tmpstr, tmpbuf);
else

View File

@ -331,14 +331,14 @@ legacy_header_generate(const char *classname, int eo_version EINA_UNUSED, Eina_S
{
_eapi_decl_func_generate(classname, (Eolian_Function)data, METHOD_FUNC, buf);
}
if (prop_read)
{
_eapi_decl_func_generate(classname, (Eolian_Function)data, GET, buf);
}
if (prop_write)
{
_eapi_decl_func_generate(classname, (Eolian_Function)data, SET, buf);
}
if (prop_read)
{
_eapi_decl_func_generate(classname, (Eolian_Function)data, GET, buf);
}
}
return EINA_TRUE;
}
@ -400,16 +400,6 @@ legacy_header_append(const char *classname, int eo_version EINA_UNUSED, Eina_Str
if (!eo1_fundef_generate(classname, (Eolian_Function)data, UNRESOLVED, str_funcdef)) return EINA_FALSE;
}
}
if (prop_read)
{
sprintf(tmpstr, "%s_get", funcname);
if (!strstr(eina_strbuf_string_get(header), tmpstr))
{
printf ("Appending eo function %s\n", tmpstr);
eo1_enum_append(classname, tmpstr, str_subid);
if (!eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_funcdef)) return EINA_FALSE;
}
}
if (prop_write)
{
sprintf(tmpstr, "%s_set", funcname);
@ -420,6 +410,16 @@ legacy_header_append(const char *classname, int eo_version EINA_UNUSED, Eina_Str
if (!eo1_fundef_generate(classname, (Eolian_Function)data, SET, str_funcdef)) return EINA_FALSE;
}
}
if (prop_read)
{
sprintf(tmpstr, "%s_get", funcname);
if (!strstr(eina_strbuf_string_get(header), tmpstr))
{
printf ("Appending eo function %s\n", tmpstr);
eo1_enum_append(classname, tmpstr, str_subid);
if (!eo1_fundef_generate(classname, (Eolian_Function)data, GET, str_funcdef)) return EINA_FALSE;
}
}
}
const char *hdstr = eina_strbuf_string_get(header);
@ -459,16 +459,16 @@ legacy_source_generate(const char *classname, Eina_Bool legacy, int eo_version E
Eina_Bool prop_read = ( ftype == SET ) ? EINA_FALSE : EINA_TRUE;
Eina_Bool prop_write = ( ftype == GET ) ? EINA_FALSE : EINA_TRUE;
if (prop_read)
{
if (!eo1_bind_func_generate(classname, fn, GET, str_bodyf, NULL)) return EINA_FALSE;
if (legacy) _eapi_func_generate(classname, fn, GET, str_bodyf);
}
if (prop_write)
{
if (!eo1_bind_func_generate(classname, fn, SET, str_bodyf, NULL)) return EINA_FALSE;
if (legacy) _eapi_func_generate(classname, fn, SET, str_bodyf);
}
if (prop_read)
{
if (!eo1_bind_func_generate(classname, fn, GET, str_bodyf, NULL)) return EINA_FALSE;
if (legacy) _eapi_func_generate(classname, fn, GET, str_bodyf);
}
}
//Methods