summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-03-02 11:32:16 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-03-02 11:32:16 -0300
commitc25267fcc6a2b9cf4b7bb74c7ce4d60a0a7d717e (patch)
tree1ba93fccc3f8af83793c2a286d83965167e0082a
parent08a11f231bc92ae328182973ac393182b00c6b90 (diff)
downloadefl-devs/felipealmeida/eo4.tar.gz
eolian-cxx: Partial fix for generation without eo_dodevs/felipealmeida/eo4
-rw-r--r--src/bindings/eo_cxx/eo_event.hh2
-rw-r--r--src/bindings/eo_cxx/eo_inherit_bindings.hh4
-rw-r--r--src/bindings/eo_cxx/eo_ops.hh56
-rw-r--r--src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh5
-rw-r--r--src/lib/eolian_cxx/grammar/eo_class_events_generator.hh11
-rw-r--r--src/lib/eolian_cxx/grammar/eo_class_functions_generator.hh29
-rw-r--r--src/lib/eolian_cxx/grammar/inheritance_base_generator.hh5
-rw-r--r--src/lib/eolian_cxx/grammar/parameters_generator.hh7
-rw-r--r--src/tests/eolian_cxx/callback.c4
9 files changed, 71 insertions, 52 deletions
diff --git a/src/bindings/eo_cxx/eo_event.hh b/src/bindings/eo_cxx/eo_event.hh
index d0b335e0e5..5fa6404256 100644
--- a/src/bindings/eo_cxx/eo_event.hh
+++ b/src/bindings/eo_cxx/eo_event.hh
@@ -95,7 +95,7 @@ struct _event_deleter
void operator()() const
{
- eo_do(_eo, ::eo_event_callback_del(_description, _cb, _data));
+ ::eo_event_callback_del(_eo, _description, _cb, _data);
::ecore_main_loop_thread_safe_call_async(&_deleter_call, _data);
}
diff --git a/src/bindings/eo_cxx/eo_inherit_bindings.hh b/src/bindings/eo_cxx/eo_inherit_bindings.hh
index cbd2bc8d98..458036d099 100644
--- a/src/bindings/eo_cxx/eo_inherit_bindings.hh
+++ b/src/bindings/eo_cxx/eo_inherit_bindings.hh
@@ -61,7 +61,9 @@ void inherit_constructor_impl(Eo*, Inherit_Private_Data* self, void* this_)
/// @param this_ The <em>user data</em> to be passed to the resolved function.
/// @param args An heterogeneous sequence of arguments.
///
-inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_);
+// inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_);
+inline
+void inherit_constructor(void* this_);
template <typename T>
int initialize_operation_description(detail::tag<void>, void*);
diff --git a/src/bindings/eo_cxx/eo_ops.hh b/src/bindings/eo_cxx/eo_ops.hh
index 47d920d31c..46a33c77dc 100644
--- a/src/bindings/eo_cxx/eo_ops.hh
+++ b/src/bindings/eo_cxx/eo_ops.hh
@@ -22,112 +22,112 @@ shutdown()
}
inline Eo*
-ref(const Eo *obj)
+ref(Eo *obj)
{
return ::eo_ref(obj);
}
inline void
-unref(const Eo *obj)
+unref(Eo *obj)
{
::eo_unref(obj);
}
inline int
-ref_get(const Eo *obj)
+ref_get(Eo *obj)
{
return ::eo_ref_get(obj);
}
inline void
-del(const Eo *obj)
+del(Eo *obj)
{
::eo_del(obj);
}
inline Eina_Bool
-isa(const Eo *obj, const Eo_Class *klass)
+isa(Eo *obj, Eo_Class *klass)
{
return eo_isa(obj, klass);
}
inline Eo*
-add(const Eo_Class *klass, Eo *parent = NULL)
+add(Eo_Class *klass, Eo *parent = NULL)
{
Eo *eo = eo_add_ref(klass, parent);
return eo;
}
inline void
-dbg_info_get(const Eo *obj, Eo_Dbg_Info *info)
+dbg_info_get(Eo *obj, Eo_Dbg_Info *info)
{
- eo_do(obj, eo_dbg_info_get(info));
+ eo_dbg_info_get(obj, info);
}
inline void
-base_data_set(const Eo *obj, const char *key, const void *data)
+base_data_set(Eo *obj, const char *key, const void *data)
{
- eo_do(obj, eo_key_data_set(key, data));
+ eo_key_data_set(obj, key, data);
}
inline void*
-base_data_get(const Eo *obj, const char *key)
+base_data_get(Eo *obj, const char *key)
{
void *data;
- eo_do(obj, data = eo_key_data_get(key));
+ data = eo_key_data_get(obj, key);
return data;
}
inline void
-base_data_del(const Eo *obj, const char *key)
+base_data_del(Eo *obj, const char *key)
{
- eo_do(obj, eo_key_data_del(key));
+ eo_key_data_del(obj, key);
}
inline void
-parent_set(const Eo *obj, Eo *parent)
+parent_set(Eo *obj, Eo *parent)
{
- eo_do(obj, eo_parent_set(parent));
+ eo_parent_set(obj, parent);
}
inline Eo*
-parent_get(const Eo *obj)
+parent_get(Eo *obj)
{
Eo *parent;
- eo_do(obj, parent = eo_parent_get());
+ parent = eo_parent_get(obj);
return parent;
}
inline void
-event_freeze(const Eo *obj)
+event_freeze(Eo *obj)
{
- eo_do(obj, eo_event_freeze());
+ eo_event_freeze(obj);
}
inline void
-event_thaw(const Eo *obj)
+event_thaw(Eo *obj)
{
- eo_do(obj, eo_event_thaw());
+ eo_event_thaw(obj);
}
inline int
-event_freeze_get(const Eo *obj)
+event_freeze_get(Eo *obj)
{
int count = -1;
- eo_do(obj, count = eo_event_freeze_count_get());
+ count = eo_event_freeze_count_get(obj);
return count;
}
inline void
-wref_add(const Eo *obj, Eo **wref)
+wref_add(Eo *obj, Eo **wref)
{
- eo_do(obj, eo_wref_add(wref));
+ eo_wref_add(obj, wref);
}
inline void
-wref_del(const Eo *obj, Eo **wref)
+wref_del(Eo *obj, Eo **wref)
{
- eo_do(obj, eo_wref_del(wref));
+ eo_wref_del(obj, wref);
}
} } }
diff --git a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
index 73847a8c39..74c9c32883 100644
--- a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
+++ b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
@@ -172,11 +172,10 @@ operator<<(std::ostream& out, functors_constructor_methods const& x)
{
if (d.is_cb)
d.out << tab(3)
- << "eo_do(_eoptr," << endl
- << tab(4) << "eo_event_callback_add(EO_BASE_EVENT_DEL, "
+ << "eo_event_callback_add(_eoptr, EO_BASE_EVENT_DEL, "
<< "&::efl::eolian::free_callback_callback<"
<< parameter_no_ref_type(d.type, d.name)
- << ">, " << callback_tmp(d.name) << "));" << endl;
+ << ">, " << callback_tmp(d.name) << ");" << endl;
})
<< tab(2) << "}" << endl;
diff --git a/src/lib/eolian_cxx/grammar/eo_class_events_generator.hh b/src/lib/eolian_cxx/grammar/eo_class_events_generator.hh
index b86b4c4243..95e155ce58 100644
--- a/src/lib/eolian_cxx/grammar/eo_class_events_generator.hh
+++ b/src/lib/eolian_cxx/grammar/eo_class_events_generator.hh
@@ -52,10 +52,9 @@ operator<<(std::ostream& out, event_callback_add const& x)
<< tab(1) << "{" << endl
<< tab(2) << "typedef typename std::remove_reference<F>::type function_type;" << endl
<< tab(2) << "::std::unique_ptr<function_type> f ( new function_type(std::forward<F>(callback_)) );" << endl
- << tab(2) << "eo_do(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr()," << endl
- << tab(4) << "eo_event_callback_priority_add" << endl
- << tab(4) << "(" << x._event.eo_name << ", priority_," << endl
- << tab(4) << "&::efl::eo::_detail::event_callback<" << full_name(x._cls) << ", function_type>, f.get()));" << endl
+ << tab(2) << "eo_event_callback_priority_add(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr()," << endl
+ << tab(2) << x._event.eo_name << ", priority_," << endl
+ << tab(2) << "&::efl::eo::_detail::event_callback<" << full_name(x._cls) << ", function_type>, f.get());" << endl
<< tab(2) << "return ::efl::eo::make_signal_connection" << endl
<< tab(3) << "(f, " << add_cast_to_t(x._add_cast_to_t)
<< "_concrete_eo_ptr(), &::efl::eo::_detail::event_callback<"
@@ -82,8 +81,8 @@ operator<<(std::ostream& out, event_callback_call const& x)
<< tab(1) << "void" << endl
<< tab(1) << "callback_" << x._event.name << "_call(T* info)" << endl
<< tab(1) << "{" << endl
- << tab(2) << "eo_do(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr(), eo_event_callback_call" << endl
- << tab(4) << "(" << x._event.eo_name << ", info));" << endl
+ << tab(2) << "eo_event_callback_call" << endl
+ << tab(4) << "(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr(), " << x._event.eo_name << ", info);" << endl
<< tab(1) << "}" << endl;
return out;
}
diff --git a/src/lib/eolian_cxx/grammar/eo_class_functions_generator.hh b/src/lib/eolian_cxx/grammar/eo_class_functions_generator.hh
index 1a64a8ca98..f99254c322 100644
--- a/src/lib/eolian_cxx/grammar/eo_class_functions_generator.hh
+++ b/src/lib/eolian_cxx/grammar/eo_class_functions_generator.hh
@@ -20,15 +20,38 @@ struct function_call
function_call(eo_function const& func) : _func(func) {}
};
+struct parameterized_obj_function_call
+{
+ eo_function const& _func;
+ std::string obj;
+ parameterized_obj_function_call(eo_function const& func, std::string obj) : _func(func), obj(obj) {}
+};
+
inline std::ostream&
operator<<(std::ostream& out, function_call const& x)
{
bool is_void = function_is_void(x._func);
+ bool is_static = function_is_static(x._func);
return out << (!is_void ? "_tmp_ret = " : "")
<< "::" << x._func.impl
- << "(" << parameters_forward_to_c(x._func.params) << ")";
+ << "("
+ << (is_static ? "const_cast<Eo*>(_eo_class())" : "_concrete_eo_ptr()")
+ << (x._func.params.empty() ? "" : ",")
+ << parameters_forward_to_c(x._func.params) << ")";
}
+inline std::ostream&
+operator<<(std::ostream& out, parameterized_obj_function_call const& x)
+{
+ bool is_void = function_is_void(x._func);
+ return out << (!is_void ? "_tmp_ret = " : "")
+ << "::" << x._func.impl
+ << "("
+ << x.obj
+ << (x._func.params.empty() ? "" : ",")
+ << parameters_forward_to_c(x._func.params) << ")";
+}
+
struct function_declaration
{
eo_class const& _cls;
@@ -94,9 +117,7 @@ operator<<(std::ostream& out, function_definition const& x)
out << callbacks_heap_alloc("_concrete_eo_ptr()", func.params, is_static, 1);
- out << tab(1) << "eo_do("
- << (is_static ? "_eo_class(), " : "_concrete_eo_ptr(), ")
- << function_call(x._func) << ");" << endl;
+ out << tab(1) << function_call(x._func) << ";" << endl;
if (!function_is_void(func))
out << tab(1) << "return " << to_cxx(func.ret, "_tmp_ret") << ";" << endl;
diff --git a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
index 561ce8c9e5..5cee5e297d 100644
--- a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
+++ b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
@@ -264,10 +264,7 @@ operator<<(std::ostream& out, inheritance_base_operations_function const& x)
out << callbacks_heap_alloc("dynamic_cast<T*>(this)->_eo_ptr()", func.params, function_is_static(x._func), 3)
<< endl;
- out << tab(3)
- << "eo_do_super(dynamic_cast<T*>(this)->_eo_ptr()," << endl
- << tab(5) << "dynamic_cast<T*>(this)->_eo_class()," << endl
- << tab(5) << function_call(func) << ");" << endl;
+ out << tab(3) << parameterized_obj_function_call(func, "eo_super(dynamic_cast<T*>(this)->_eo_ptr(), dynamic_cast<T*>(this)->_eo_class())") << ";" << endl;
if (!is_void)
out << tab(4) << "return " << to_cxx(func.ret, "_tmp_ret") << ";" << endl;
diff --git a/src/lib/eolian_cxx/grammar/parameters_generator.hh b/src/lib/eolian_cxx/grammar/parameters_generator.hh
index ecda9d8e2a..9d27926364 100644
--- a/src/lib/eolian_cxx/grammar/parameters_generator.hh
+++ b/src/lib/eolian_cxx/grammar/parameters_generator.hh
@@ -121,10 +121,11 @@ callback_parameter_free_ev_add
inline std::ostream&
operator<<(std::ostream& out, callback_parameter_free_ev_add const& x)
{
- out << "eo_do(" << x._eo_raw_expr
- << ", eo_event_callback_add(EO_BASE_EVENT_DEL, &::efl::eolian::free_callback_callback<"
+ out
+ << "eo_event_callback_add(" << x._eo_raw_expr
+ << ", EO_BASE_EVENT_DEL, &::efl::eolian::free_callback_callback<"
<< parameter_no_ref_type(x._type, x._name) << ">, "
- << callback_tmp(x._name) << "));";
+ << callback_tmp(x._name) << ");";
return out;
}
diff --git a/src/tests/eolian_cxx/callback.c b/src/tests/eolian_cxx/callback.c
index 757c5a29c6..cd73160fcc 100644
--- a/src/tests/eolian_cxx/callback.c
+++ b/src/tests/eolian_cxx/callback.c
@@ -21,7 +21,7 @@ static Eina_Bool _callback_callback_added(void* data EINA_UNUSED, Eo_Event2 cons
{
Callback_Data* pd = event->event_info;
++pd->callbacks;
- eo_event_callback_call(CALLBACK_EVENT_CALL_ON_ADD, &pd->callbacks);
+ eo_event_callback_call(event->obj, CALLBACK_EVENT_CALL_ON_ADD, &pd->callbacks);
return EINA_TRUE;
}
@@ -30,7 +30,7 @@ static Eo *_callback_eo_base_constructor(Eo *obj, Callback_Data *pd EINA_UNUSED)
pd->callbacks = 0;
obj = eo_constructor(eo_super(obj, MY_CLASS));
- eo_event_callback_priority_add(EO_BASE_EVENT_CALLBACK_ADD, EO_CALLBACK_PRIORITY_DEFAULT
+ eo_event_callback_priority_add(obj, EO_BASE_EVENT_CALLBACK_ADD, EO_CALLBACK_PRIORITY_DEFAULT
, &_callback_callback_added, pd);
return obj;