felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=401cc81355be66c147848815d243ec167c1f7532

commit 401cc81355be66c147848815d243ec167c1f7532
Author: Felipe Magno de Almeida <[email protected]>
Date:   Thu Jul 17 14:09:26 2014 -0300

    eolian-cxx: Workaround for multiple callbacks without corresponding 
void*data
    
    Added workaround for generating classes with methods that have more
    than one callback but doesn't have a corresponding void* data
    parameter. E.g., elm_box.eo.
---
 src/lib/eolian_cxx/eo_types.hh                      |  5 +++--
 .../grammar/inheritance_base_generator.hh           |  2 +-
 src/lib/eolian_cxx/grammar/parameters_generator.hh  | 21 ++++++++++++++-------
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/lib/eolian_cxx/eo_types.hh b/src/lib/eolian_cxx/eo_types.hh
index 08bbd73..31a32da 100644
--- a/src/lib/eolian_cxx/eo_types.hh
+++ b/src/lib/eolian_cxx/eo_types.hh
@@ -234,8 +234,9 @@ inline unsigned int
 parameters_count_callbacks(parameters_container_type const& parameters)
 {
    unsigned int r = 0u;
-   for (eo_parameter const& param : parameters)
-     if(type_is_callback(param.type))
+   for (auto first = parameters.begin(), last = parameters.end()
+          ; first != last ; ++first)
+     if(type_is_callback(first->type) && first + 1 != last)
        ++r;
    return r;
 }
diff --git a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh 
b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
index 8f426a5..1b902fc 100644
--- a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
+++ b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
@@ -250,7 +250,7 @@ operator<<(std::ostream& out, 
inheritance_call_constructor_arguments const& x)
    for (i=0; i<n; i++)
      {
         if(i!=0) out << ", ";
-        out << "args.get<" << i << ">()";
+        out << "::efl::eolian::to_c(args.get<" << i << ">())";
      }
    return out;
 }
diff --git a/src/lib/eolian_cxx/grammar/parameters_generator.hh 
b/src/lib/eolian_cxx/grammar/parameters_generator.hh
index 9f6f3e5..648a995 100644
--- a/src/lib/eolian_cxx/grammar/parameters_generator.hh
+++ b/src/lib/eolian_cxx/grammar/parameters_generator.hh
@@ -28,11 +28,11 @@ operator<<(std::ostream& out, parameters_declaration const& 
x)
      {
         if (it != first)
           out << ", ";
-        if (type_is_callback((*it).type))
+        if (type_is_callback((*it).type) && it+1 != last)
           {
-             out << "F && " << (*it).name;
-             assert(it+1 != last);
-             ++it; // skip next.
+            out << "F && " << (*it).name;
+            assert(it+1 != last);
+            ++it; // skip next.
           }
         else
           out << reinterpret_type((*it).type) << " " << (*it).name;
@@ -80,12 +80,19 @@ operator<<(std::ostream& out, parameters_list const& x)
      {
         if (it != first)
           out << ", ";
-        out << to_c((*it).type, (*it).name);
         if (type_is_callback((*it).type))
           {
-             out << ", _tmp_f";
-             ++it; // skip next
+            if(it + 1 != last)
+              {
+                out << to_c((*it).type, (*it).name)
+                    << ", _tmp_f";
+                ++it; // skip next
+              }
+            else
+              out << it->name;
           }
+        else
+          out << to_c((*it).type, (*it).name);
      }
    return out;
 }

-- 


Reply via email to