summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-04-11 00:53:03 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-04-11 01:28:50 -0300
commit62841aee3ce838321149b329008a54185341f9f8 (patch)
tree62abd7842778d1fd0c541ba1063d732097dc57f2 /src/bin
parenteff86cd48a9f01ace61aadcfcb8241ec426d6262 (diff)
downloadefl-62841aee3ce838321149b329008a54185341f9f8.tar.gz
eolian: Make promise eolian generation use macros for hooks
Modify the way hooks are defined and used by promise generation in Eolian in the Eo API. Instead of passing macro names as parameters to EO_FUNC_BODY macros, just re-define the actual hooks when it is needed.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian/eo_generator.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/bin/eolian/eo_generator.c b/src/bin/eolian/eo_generator.c
index 78e8108fa0..c36702709e 100644
--- a/src/bin/eolian/eo_generator.c
+++ b/src/bin/eolian/eo_generator.c
@@ -546,16 +546,6 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
(ftype == EOLIAN_PROP_GET ||
eolian_function_object_is_const(funcid) ||
eolian_function_is_class(funcid))?"_CONST":"", func_env.lower_eo_func);
- if(has_promise)
- {
- eina_strbuf_append_printf(eo_func_decl,
- ", _EINA_PROMISE_BEFORE_HOOK(%s, %s%s) _EO_EMPTY_HOOK, _EINA_PROMISE_AFTER_HOOK(%s) _EO_EMPTY_HOOK",
- promise_value_type, !rettype ? "void" : rettype,
- eina_strbuf_string_get(impl_full_params),
- promise_param_name);
- }
- else
- eina_strbuf_append_printf(eo_func_decl, ", _EO_EMPTY_HOOK, _EO_EMPTY_HOOK");
if (!ret_is_void)
{
const char *val_str = NULL;
@@ -583,7 +573,29 @@ eo_bind_func_generate(const Eolian_Class *class, const Eolian_Function *funcid,
eina_strbuf_string_get(full_params));
}
eina_strbuf_append_printf(eo_func_decl, ");");
+
+ if(has_promise)
+ {
+ eina_strbuf_append_printf(fbody,
+ "#undef _EO_API_BEFORE_HOOK\n#undef _EO_API_AFTER_HOOK\n#undef _EO_API_CALL_HOOK\n"
+ "#define _EO_API_BEFORE_HOOK _EINA_PROMISE_BEFORE_HOOK(%s, %s%s)\n"
+ "#define _EO_API_AFTER_HOOK _EINA_PROMISE_AFTER_HOOK(%s)\n"
+ "#define _EO_API_CALL_HOOK(x) _EINA_PROMISE_CALL_HOOK(EO_FUNC_CALL(%s))\n\n",
+ promise_value_type, !rettype ? "void" : rettype,
+ eina_strbuf_string_get(impl_full_params),
+ promise_param_name,
+ eina_strbuf_string_get(params));
+ }
+
eina_strbuf_append_printf(fbody, "%s\n", eina_strbuf_string_get(eo_func_decl));
+
+ if(has_promise)
+ {
+ eina_strbuf_append_printf(fbody, "\n#undef _EO_API_BEFORE_HOOK\n#undef _EO_API_AFTER_HOOK\n#undef _EO_API_CALL_HOOK\n"
+ "#define _EO_API_BEFORE_HOOK\n#define _EO_API_AFTER_HOOK\n"
+ "#define _EO_API_CALL_HOOK(x) x\n");
+ }
+
eina_strbuf_free(eo_func_decl);
}