summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
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 /src/lib/eolian_cxx
parent0c545b88ba69e7f66e927b1f7318cdb156b07d79 (diff)
eolian-cxx: Partial fix for generation without eo_do
Diffstat (limited to 'src/lib/eolian_cxx')
-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
5 files changed, 37 insertions, 20 deletions
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