vitorsousa pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9cbda57bf03bfdaa5c0379023a05868b2f0986aa

commit 9cbda57bf03bfdaa5c0379023a05868b2f0986aa
Author: Vitor Sousa <vitorsousasi...@gmail.com>
Date:   Thu Mar 3 15:10:13 2016 -0300

    eolian-cxx: Fix Eolian C++ constructing methods with new eo_add
    
    Also fix Eolian C++ examples using the new "eo_super".
---
 src/bindings/eo_cxx/eo_cxx_interop.hh                       |  4 ++--
 src/bindings/eo_cxx/eo_inherit.hh                           | 13 ++++++++++---
 src/bindings/eo_cxx/eo_inherit_bindings.hh                  | 12 ------------
 src/examples/eolian_cxx/colourable_cxx.cc                   |  6 +++---
 src/examples/eolian_cxx/colourablesquare_cxx.cc             |  2 +-
 src/examples/eolian_cxx/eolian_cxx_inherit_01.cc            |  4 ++--
 .../eolian_cxx/grammar/eo_class_constructors_generator.hh   |  9 +++++----
 7 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/src/bindings/eo_cxx/eo_cxx_interop.hh 
b/src/bindings/eo_cxx/eo_cxx_interop.hh
index 7cd7b35..b1978a8 100644
--- a/src/bindings/eo_cxx/eo_cxx_interop.hh
+++ b/src/bindings/eo_cxx/eo_cxx_interop.hh
@@ -472,9 +472,9 @@ F* alloc_static_callback(F&& f)
 
 template <typename... Fs>
 inline
-void call_ctors(Fs&&... fs)
+void call_ctors(Eo* _obj_eoid, Fs&&... fs)
 {
-   std::initializer_list<int const> const v {(fs(), 0)...};
+   std::initializer_list<int const> const v {(fs(_obj_eoid), 0)...};
    (void) v;
 }
 
diff --git a/src/bindings/eo_cxx/eo_inherit.hh 
b/src/bindings/eo_cxx/eo_inherit.hh
index 3138d1e..9639e33 100644
--- a/src/bindings/eo_cxx/eo_inherit.hh
+++ b/src/bindings/eo_cxx/eo_inherit.hh
@@ -22,8 +22,15 @@ namespace detail {
 template <typename D, typename... E, std::size_t... S>
 Eo_Class const* create_class(eina::index_sequence<S...>);
 
-inline
-void inherit_constructor(void* this_);
+/// @internal
+///
+/// @brief Find the correct function for the <em>"constructor"</em>
+/// operation and invoke it.
+///
+/// @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_);
 
 }
 
@@ -78,7 +85,7 @@ struct inherit
    inherit(efl::eo::parent_type _p, Args&& ... args)
    {
       _eo_cls = detail::create_class<D, E...> 
(eina::make_index_sequence<sizeof...(E)>());
-      _eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, 
detail::inherit_constructor(this), ::efl::eolian::call_ctors(args...));
+      _eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, 
detail::inherit_constructor(eoid, this), ::efl::eolian::call_ctors(eoid, 
args...));
       ::efl::eolian::register_ev_del_free_callback(_eo_raw, args...);
   }
 
diff --git a/src/bindings/eo_cxx/eo_inherit_bindings.hh 
b/src/bindings/eo_cxx/eo_inherit_bindings.hh
index 458036d..bb29b9e 100644
--- a/src/bindings/eo_cxx/eo_inherit_bindings.hh
+++ b/src/bindings/eo_cxx/eo_inherit_bindings.hh
@@ -53,18 +53,6 @@ void inherit_constructor_impl(Eo*, Inherit_Private_Data* 
self, void* this_)
    self->this_ = this_;
 }
 
-/// @internal
-///
-/// @brief Find the correct function for the <em>"constructor"</em>
-/// operation and invoke it.
-///
-/// @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
-void inherit_constructor(void* this_);
-
 template <typename T>
 int initialize_operation_description(detail::tag<void>, void*);
 
diff --git a/src/examples/eolian_cxx/colourable_cxx.cc 
b/src/examples/eolian_cxx/colourable_cxx.cc
index 934a5d0..f1f6bec 100644
--- a/src/examples/eolian_cxx/colourable_cxx.cc
+++ b/src/examples/eolian_cxx/colourable_cxx.cc
@@ -24,14 +24,14 @@ _colourable_eo_base_constructor(Eo *obj, Colourable_Data 
*self)
 {
    EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl;
    self->r = self->g = self->b = 0;
-   return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
+   return eo_constructor(eo_super(obj, MY_CLASS));
 }
 
 void
 _colourable_eo_base_destructor(Eo *obj, Colourable_Data *self EINA_UNUSED)
 {
    EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl;
-   eo_do_super(obj, MY_CLASS, eo_destructor());
+   eo_destructor(eo_super(obj, MY_CLASS));
 }
 
 void
@@ -42,7 +42,7 @@ _colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data 
*self, int rgb)
    self->r = (rgb & 0x00ff0000) >> 16;
    self->g = (rgb & 0x0000ff00) >> 8;
    self->b = rgb & 0x000000ff;
-   eo_do_super(obj, MY_CLASS, eo_constructor());
+   eo_constructor(eo_super(obj, MY_CLASS));
 }
 
 void
diff --git a/src/examples/eolian_cxx/colourablesquare_cxx.cc 
b/src/examples/eolian_cxx/colourablesquare_cxx.cc
index 906183a2..6908f73 100644
--- a/src/examples/eolian_cxx/colourablesquare_cxx.cc
+++ b/src/examples/eolian_cxx/colourablesquare_cxx.cc
@@ -25,7 +25,7 @@ _colourablesquare_size_constructor(Eo *obj, 
ColourableSquare_Data *self, int siz
 {
    self->size = size;
    EINA_CXX_DOM_LOG_DBG(domain) << __func__ << " [ size = " << size << " ]" << 
std::endl;
-   eo_do_super(obj, MY_CLASS, eo_constructor());
+   eo_constructor(eo_super(obj, MY_CLASS));
 }
 
 int
diff --git a/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc 
b/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc
index bdfa3ad..b0fb169 100644
--- a/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc
+++ b/src/examples/eolian_cxx/eolian_cxx_inherit_01.cc
@@ -23,7 +23,7 @@ struct ColourableCircle
    int colour_get()
    {
       int rgb = 0;
-      eo_do_super(_eo_ptr(), _eo_class(), rgb = ::colourable_colour_get());
+      rgb = ::colourable_colour_get(eo_super(_eo_ptr(), _eo_class()));
       std::cout << "ColourableCircle::colour_get(" << this << ") ==> "
                 << std::hex << rgb << std::endl;
       return rgb;
@@ -52,7 +52,7 @@ struct ColourableBar
    int colour_get()
    {
       int rgb = 0;
-      eo_do_super(_eo_ptr(), _eo_class(), rgb = ::colourable_colour_get());
+      rgb = ::colourable_colour_get(eo_super(_eo_ptr(), _eo_class()));
       std::cout << "ColourableBar::colour_get(" << this << ") ==> "
                 << std::hex << rgb << std::endl;
       return rgb;
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 74c9c32..2a7091a 100644
--- a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
+++ b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
@@ -158,9 +158,10 @@ operator<<(std::ostream& out, functors_constructor_methods 
const& x)
             << tab(2) << "{}" << endl;
 
         // Struct operator()
-        out << tab(2) << "void operator()()" << endl
+        out << tab(2) << "void operator()(Eo* _obj_eoid)" << endl
             << tab(2) << "{" << endl
-            << tab(3) << "::" << c.impl << "(" << 
parameters_forward_to_c(c.params) << ");" << endl
+            << tab(3) << "::" << c.impl << "(_obj_eoid" << (c.params.empty() ? 
"" : ", ")
+            << parameters_forward_to_c(c.params) << ");" << endl
             << tab(2) << "}" << endl;
 
         // Register event to free allocated callbacks when the Eo* is deleted
@@ -579,10 +580,10 @@ operator<<(std::ostream& out, 
function_call_constructor_methods const& x)
        << tab(2) << "Eo* _ret_eo = eo_add_ref(" << x._cls.eo_name << ", 
_p._eo_raw";
    for (it = first; it != last; ++it)
      {
-        out << ", _c" << (it-first) << "()";
+        out << ", _c" << (it-first) << "(eoid)";
      }
    if (!x._cls.optional_constructors.empty())
-     out << ", ::efl::eolian::call_ctors(_opts...)";
+     out << ", ::efl::eolian::call_ctors(eoid, _opts...)";
    out << ");" << endl << endl;
 
    for (it = first; it != last; ++it)

-- 


Reply via email to