eolian-cxx: Partial fix for generation without eo_do

This commit is contained in:
Felipe Magno de Almeida 2016-03-02 11:32:16 -03:00 committed by Vitor Sousa
parent 0c545b88ba
commit 5c7d78d104
9 changed files with 71 additions and 52 deletions

View File

@ -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);
}

View File

@ -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*);

View File

@ -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);
}
} } }

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;