summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-03-02 11:32:16 -0300
committerVitor Sousa <vitorsousasilva@gmail.com>2016-03-03 16:05:40 -0300
commit5c7d78d1040b5bdfe6430e84c90d36ab8bf27064 (patch)
tree92df4e670157028a85de897f1fbbc0ffeffb63a7
parent0c545b88ba69e7f66e927b1f7318cdb156b07d79 (diff)
eolian-cxx: Partial fix for generation without eo_do
-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
95 95
96 void operator()() const 96 void operator()() const
97 { 97 {
98 eo_do(_eo, ::eo_event_callback_del(_description, _cb, _data)); 98 ::eo_event_callback_del(_eo, _description, _cb, _data);
99 ::ecore_main_loop_thread_safe_call_async(&_deleter_call, _data); 99 ::ecore_main_loop_thread_safe_call_async(&_deleter_call, _data);
100 } 100 }
101 101
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_)
61/// @param this_ The <em>user data</em> to be passed to the resolved function. 61/// @param this_ The <em>user data</em> to be passed to the resolved function.
62/// @param args An heterogeneous sequence of arguments. 62/// @param args An heterogeneous sequence of arguments.
63/// 63///
64inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_); 64// inline EOAPI EO_VOID_FUNC_BODYV(inherit_constructor, EO_FUNC_CALL(this_), void* this_);
65inline
66void inherit_constructor(void* this_);
65 67
66template <typename T> 68template <typename T>
67int initialize_operation_description(detail::tag<void>, void*); 69int 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()
22} 22}
23 23
24inline Eo* 24inline Eo*
25ref(const Eo *obj) 25ref(Eo *obj)
26{ 26{
27 return ::eo_ref(obj); 27 return ::eo_ref(obj);
28} 28}
29 29
30inline void 30inline void
31unref(const Eo *obj) 31unref(Eo *obj)
32{ 32{
33 ::eo_unref(obj); 33 ::eo_unref(obj);
34} 34}
35 35
36inline int 36inline int
37ref_get(const Eo *obj) 37ref_get(Eo *obj)
38{ 38{
39 return ::eo_ref_get(obj); 39 return ::eo_ref_get(obj);
40} 40}
41 41
42inline void 42inline void
43del(const Eo *obj) 43del(Eo *obj)
44{ 44{
45 ::eo_del(obj); 45 ::eo_del(obj);
46} 46}
47 47
48inline Eina_Bool 48inline Eina_Bool
49isa(const Eo *obj, const Eo_Class *klass) 49isa(Eo *obj, Eo_Class *klass)
50{ 50{
51 return eo_isa(obj, klass); 51 return eo_isa(obj, klass);
52} 52}
53 53
54inline Eo* 54inline Eo*
55add(const Eo_Class *klass, Eo *parent = NULL) 55add(Eo_Class *klass, Eo *parent = NULL)
56{ 56{
57 Eo *eo = eo_add_ref(klass, parent); 57 Eo *eo = eo_add_ref(klass, parent);
58 return eo; 58 return eo;
59} 59}
60 60
61inline void 61inline void
62dbg_info_get(const Eo *obj, Eo_Dbg_Info *info) 62dbg_info_get(Eo *obj, Eo_Dbg_Info *info)
63{ 63{
64 eo_do(obj, eo_dbg_info_get(info)); 64 eo_dbg_info_get(obj, info);
65} 65}
66 66
67inline void 67inline void
68base_data_set(const Eo *obj, const char *key, const void *data) 68base_data_set(Eo *obj, const char *key, const void *data)
69{ 69{
70 eo_do(obj, eo_key_data_set(key, data)); 70 eo_key_data_set(obj, key, data);
71} 71}
72 72
73inline void* 73inline void*
74base_data_get(const Eo *obj, const char *key) 74base_data_get(Eo *obj, const char *key)
75{ 75{
76 void *data; 76 void *data;
77 eo_do(obj, data = eo_key_data_get(key)); 77 data = eo_key_data_get(obj, key);
78 return data; 78 return data;
79} 79}
80 80
81inline void 81inline void
82base_data_del(const Eo *obj, const char *key) 82base_data_del(Eo *obj, const char *key)
83{ 83{
84 eo_do(obj, eo_key_data_del(key)); 84 eo_key_data_del(obj, key);
85} 85}
86 86
87inline void 87inline void
88parent_set(const Eo *obj, Eo *parent) 88parent_set(Eo *obj, Eo *parent)
89{ 89{
90 eo_do(obj, eo_parent_set(parent)); 90 eo_parent_set(obj, parent);
91} 91}
92 92
93inline Eo* 93inline Eo*
94parent_get(const Eo *obj) 94parent_get(Eo *obj)
95{ 95{
96 Eo *parent; 96 Eo *parent;
97 eo_do(obj, parent = eo_parent_get()); 97 parent = eo_parent_get(obj);
98 return parent; 98 return parent;
99} 99}
100 100
101inline void 101inline void
102event_freeze(const Eo *obj) 102event_freeze(Eo *obj)
103{ 103{
104 eo_do(obj, eo_event_freeze()); 104 eo_event_freeze(obj);
105} 105}
106 106
107inline void 107inline void
108event_thaw(const Eo *obj) 108event_thaw(Eo *obj)
109{ 109{
110 eo_do(obj, eo_event_thaw()); 110 eo_event_thaw(obj);
111} 111}
112 112
113inline int 113inline int
114event_freeze_get(const Eo *obj) 114event_freeze_get(Eo *obj)
115{ 115{
116 int count = -1; 116 int count = -1;
117 eo_do(obj, count = eo_event_freeze_count_get()); 117 count = eo_event_freeze_count_get(obj);
118 return count; 118 return count;
119} 119}
120 120
121inline void 121inline void
122wref_add(const Eo *obj, Eo **wref) 122wref_add(Eo *obj, Eo **wref)
123{ 123{
124 eo_do(obj, eo_wref_add(wref)); 124 eo_wref_add(obj, wref);
125} 125}
126 126
127inline void 127inline void
128wref_del(const Eo *obj, Eo **wref) 128wref_del(Eo *obj, Eo **wref)
129{ 129{
130 eo_do(obj, eo_wref_del(wref)); 130 eo_wref_del(obj, wref);
131} 131}
132 132
133} } } 133} } }
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)
172 { 172 {
173 if (d.is_cb) 173 if (d.is_cb)
174 d.out << tab(3) 174 d.out << tab(3)
175 << "eo_do(_eoptr," << endl 175 << "eo_event_callback_add(_eoptr, EO_BASE_EVENT_DEL, "
176 << tab(4) << "eo_event_callback_add(EO_BASE_EVENT_DEL, "
177 << "&::efl::eolian::free_callback_callback<" 176 << "&::efl::eolian::free_callback_callback<"
178 << parameter_no_ref_type(d.type, d.name) 177 << parameter_no_ref_type(d.type, d.name)
179 << ">, " << callback_tmp(d.name) << "));" << endl; 178 << ">, " << callback_tmp(d.name) << ");" << endl;
180 }) 179 })
181 << tab(2) << "}" << endl; 180 << tab(2) << "}" << endl;
182 181
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)
52 << tab(1) << "{" << endl 52 << tab(1) << "{" << endl
53 << tab(2) << "typedef typename std::remove_reference<F>::type function_type;" << endl 53 << tab(2) << "typedef typename std::remove_reference<F>::type function_type;" << endl
54 << tab(2) << "::std::unique_ptr<function_type> f ( new function_type(std::forward<F>(callback_)) );" << endl 54 << tab(2) << "::std::unique_ptr<function_type> f ( new function_type(std::forward<F>(callback_)) );" << endl
55 << tab(2) << "eo_do(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr()," << endl 55 << tab(2) << "eo_event_callback_priority_add(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr()," << endl
56 << tab(4) << "eo_event_callback_priority_add" << endl 56 << tab(2) << x._event.eo_name << ", priority_," << endl
57 << tab(4) << "(" << x._event.eo_name << ", priority_," << endl 57 << tab(2) << "&::efl::eo::_detail::event_callback<" << full_name(x._cls) << ", function_type>, f.get());" << endl
58 << tab(4) << "&::efl::eo::_detail::event_callback<" << full_name(x._cls) << ", function_type>, f.get()));" << endl
59 << tab(2) << "return ::efl::eo::make_signal_connection" << endl 58 << tab(2) << "return ::efl::eo::make_signal_connection" << endl
60 << tab(3) << "(f, " << add_cast_to_t(x._add_cast_to_t) 59 << tab(3) << "(f, " << add_cast_to_t(x._add_cast_to_t)
61 << "_concrete_eo_ptr(), &::efl::eo::_detail::event_callback<" 60 << "_concrete_eo_ptr(), &::efl::eo::_detail::event_callback<"
@@ -82,8 +81,8 @@ operator<<(std::ostream& out, event_callback_call const& x)
82 << tab(1) << "void" << endl 81 << tab(1) << "void" << endl
83 << tab(1) << "callback_" << x._event.name << "_call(T* info)" << endl 82 << tab(1) << "callback_" << x._event.name << "_call(T* info)" << endl
84 << tab(1) << "{" << endl 83 << tab(1) << "{" << endl
85 << tab(2) << "eo_do(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr(), eo_event_callback_call" << endl 84 << tab(2) << "eo_event_callback_call" << endl
86 << tab(4) << "(" << x._event.eo_name << ", info));" << endl 85 << tab(4) << "(" << add_cast_to_t(x._add_cast_to_t) << "_concrete_eo_ptr(), " << x._event.eo_name << ", info);" << endl
87 << tab(1) << "}" << endl; 86 << tab(1) << "}" << endl;
88 return out; 87 return out;
89} 88}
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
20 function_call(eo_function const& func) : _func(func) {} 20 function_call(eo_function const& func) : _func(func) {}
21}; 21};
22 22
23struct parameterized_obj_function_call
24{
25 eo_function const& _func;
26 std::string obj;
27 parameterized_obj_function_call(eo_function const& func, std::string obj) : _func(func), obj(obj) {}
28};
29
23inline std::ostream& 30inline std::ostream&
24operator<<(std::ostream& out, function_call const& x) 31operator<<(std::ostream& out, function_call const& x)
25{ 32{
26 bool is_void = function_is_void(x._func); 33 bool is_void = function_is_void(x._func);
34 bool is_static = function_is_static(x._func);
27 return out << (!is_void ? "_tmp_ret = " : "") 35 return out << (!is_void ? "_tmp_ret = " : "")
28 << "::" << x._func.impl 36 << "::" << x._func.impl
29 << "(" << parameters_forward_to_c(x._func.params) << ")"; 37 << "("
38 << (is_static ? "const_cast<Eo*>(_eo_class())" : "_concrete_eo_ptr()")
39 << (x._func.params.empty() ? "" : ",")
40 << parameters_forward_to_c(x._func.params) << ")";
30} 41}
31 42
43inline std::ostream&
44operator<<(std::ostream& out, parameterized_obj_function_call const& x)
45{
46 bool is_void = function_is_void(x._func);
47 return out << (!is_void ? "_tmp_ret = " : "")
48 << "::" << x._func.impl
49 << "("
50 << x.obj
51 << (x._func.params.empty() ? "" : ",")
52 << parameters_forward_to_c(x._func.params) << ")";
53}
54
32struct function_declaration 55struct function_declaration
33{ 56{
34 eo_class const& _cls; 57 eo_class const& _cls;
@@ -94,9 +117,7 @@ operator<<(std::ostream& out, function_definition const& x)
94 117
95 out << callbacks_heap_alloc("_concrete_eo_ptr()", func.params, is_static, 1); 118 out << callbacks_heap_alloc("_concrete_eo_ptr()", func.params, is_static, 1);
96 119
97 out << tab(1) << "eo_do(" 120 out << tab(1) << function_call(x._func) << ";" << endl;
98 << (is_static ? "_eo_class(), " : "_concrete_eo_ptr(), ")
99 << function_call(x._func) << ");" << endl;
100 121
101 if (!function_is_void(func)) 122 if (!function_is_void(func))
102 out << tab(1) << "return " << to_cxx(func.ret, "_tmp_ret") << ";" << endl; 123 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)
264 out << callbacks_heap_alloc("dynamic_cast<T*>(this)->_eo_ptr()", func.params, function_is_static(x._func), 3) 264 out << callbacks_heap_alloc("dynamic_cast<T*>(this)->_eo_ptr()", func.params, function_is_static(x._func), 3)
265 << endl; 265 << endl;
266 266
267 out << tab(3) 267 out << tab(3) << parameterized_obj_function_call(func, "eo_super(dynamic_cast<T*>(this)->_eo_ptr(), dynamic_cast<T*>(this)->_eo_class())") << ";" << endl;
268 << "eo_do_super(dynamic_cast<T*>(this)->_eo_ptr()," << endl
269 << tab(5) << "dynamic_cast<T*>(this)->_eo_class()," << endl
270 << tab(5) << function_call(func) << ");" << endl;
271 268
272 if (!is_void) 269 if (!is_void)
273 out << tab(4) << "return " << to_cxx(func.ret, "_tmp_ret") << ";" << endl; 270 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
121inline std::ostream& 121inline std::ostream&
122operator<<(std::ostream& out, callback_parameter_free_ev_add const& x) 122operator<<(std::ostream& out, callback_parameter_free_ev_add const& x)
123{ 123{
124 out << "eo_do(" << x._eo_raw_expr 124 out
125 << ", eo_event_callback_add(EO_BASE_EVENT_DEL, &::efl::eolian::free_callback_callback<" 125 << "eo_event_callback_add(" << x._eo_raw_expr
126 << ", EO_BASE_EVENT_DEL, &::efl::eolian::free_callback_callback<"
126 << parameter_no_ref_type(x._type, x._name) << ">, " 127 << parameter_no_ref_type(x._type, x._name) << ">, "
127 << callback_tmp(x._name) << "));"; 128 << callback_tmp(x._name) << ");";
128 return out; 129 return out;
129} 130}
130 131
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
21{ 21{
22 Callback_Data* pd = event->event_info; 22 Callback_Data* pd = event->event_info;
23 ++pd->callbacks; 23 ++pd->callbacks;
24 eo_event_callback_call(CALLBACK_EVENT_CALL_ON_ADD, &pd->callbacks); 24 eo_event_callback_call(event->obj, CALLBACK_EVENT_CALL_ON_ADD, &pd->callbacks);
25 return EINA_TRUE; 25 return EINA_TRUE;
26} 26}
27 27
@@ -30,7 +30,7 @@ static Eo *_callback_eo_base_constructor(Eo *obj, Callback_Data *pd EINA_UNUSED)
30 pd->callbacks = 0; 30 pd->callbacks = 0;
31 obj = eo_constructor(eo_super(obj, MY_CLASS)); 31 obj = eo_constructor(eo_super(obj, MY_CLASS));
32 32
33 eo_event_callback_priority_add(EO_BASE_EVENT_CALLBACK_ADD, EO_CALLBACK_PRIORITY_DEFAULT 33 eo_event_callback_priority_add(obj, EO_BASE_EVENT_CALLBACK_ADD, EO_CALLBACK_PRIORITY_DEFAULT
34 , &_callback_callback_added, pd); 34 , &_callback_callback_added, pd);
35 35
36 return obj; 36 return obj;