aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-12-05 12:15:16 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2018-12-05 22:38:15 -0300
commitcf2aebd9b36072d14c6fcc8b9cc7453e55a5f3d7 (patch)
tree00398f125c4c822fc36f19ad7d4a448a497a6161
parentefl-mono: Add test on inherited virtual calls from C (diff)
downloadefl-devs/lauromoura/inherit_fix.tar.gz
WIP - Efl_Ops revampdevs/lauromoura/inherit_fix
The idea is to extend the Efl_Op_Description array with the parent operations. Currently some class errors in a efl_super call I couldn't locate yet.
-rw-r--r--src/bin/eolian_mono/eolian/mono/blacklist.hh1
-rw-r--r--src/bin/eolian_mono/eolian/mono/klass.hh40
-rw-r--r--src/bin/eolian_mono/eolian_mono.cc1
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp8
4 files changed, 45 insertions, 5 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/blacklist.hh b/src/bin/eolian_mono/eolian/mono/blacklist.hh
index 99ec12e91d..1c3632f2d0 100644
--- a/src/bin/eolian_mono/eolian/mono/blacklist.hh
+++ b/src/bin/eolian_mono/eolian/mono/blacklist.hh
@@ -50,6 +50,7 @@ inline bool is_function_blacklisted(std::string const& c_name)
|| c_name == "efl_ui_spin_button_loop_get"
|| c_name == "efl_ui_list_model_size_get"
|| c_name == "efl_ui_list_relayout_layout_do"
+ || c_name == "efl_constructor"
;
}
diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh
index 077a0fad07..c246231561 100644
--- a/src/bin/eolian_mono/eolian/mono/klass.hh
+++ b/src/bin/eolian_mono/eolian/mono/klass.hh
@@ -315,6 +315,26 @@ struct klass
if(!as_generator(*(async_function_definition(true))).generate(sink, implemented_methods, inherit_cxt))
return false;
+ auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
+ std::string base_name;
+
+ if (!root)
+ {
+ EINA_LOG_ERR("Class is %s and parent is %s", cls.eolian_name.c_str(), cls.parent->eolian_name.c_str());
+ attributes::klass_def parent_klass(get_klass(*cls.parent, cls.unit), cls.unit);
+ base_name = name_helpers::klass_full_concrete_or_interface_name(parent_klass);
+ EINA_LOG_ERR("Base name is %s", base_name.c_str());
+ }
+ /* // Ops accessor */
+ if(!as_generator(
+ scope_tab << "public " << (root ? "" : "new ") << "static Efl_Op_Description[] GetEoOps()\n"
+ << scope_tab << "{\n"
+ << scope_tab << scope_tab << "return " << native_inherit_name << ".GetEoOps()" <<
+ (root ? "" : (".Concat(" + base_name + ".GetEoOps()).ToArray()")) << ";\n"
+ << scope_tab << "}\n"
+ ).generate(sink, attributes::unused, inherit_cxt))
+ return false;
+
if(!as_generator("}\n").generate(sink, attributes::unused, inherit_cxt)) return false;
}
@@ -331,10 +351,11 @@ struct klass
{
auto inative_cxt = context_add_tag(class_context{class_context::inherit_native}, context);
auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
+ auto inherit_name = name_helpers::klass_inherit_name(cls);
if(!as_generator
(
"internal " << class_type << " " << native_inherit_name << " {\n"
- << scope_tab << "public static byte class_initializer(IntPtr klass)\n"
+ << scope_tab << "public static Efl_Op_Description[] GetEoOps()\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "Efl_Op_Description[] descs = new Efl_Op_Description[" << grammar::int_ << "];\n"
)
@@ -345,17 +366,28 @@ struct klass
if(!as_generator(*(function_registration(index_generator, cls)))
.generate(sink, helpers::get_all_implementable_methods(cls), inative_cxt)) return false;
+
+ if(!as_generator(
+ scope_tab << scope_tab << "return descs;\n"
+ << scope_tab << "}\n"
+ ).generate(sink, attributes::unused, inative_cxt))
+ return false;
+
if(!as_generator
- ( scope_tab << scope_tab << "IntPtr descs_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(descs[0])*" << function_count << ");\n"
+ (scope_tab << "public static byte class_initializer(IntPtr klass)\n"
+ << scope_tab << "{\n"
+ << scope_tab << scope_tab << "var descs = " << inherit_name << ".GetEoOps();\n"
+ << scope_tab << scope_tab << "var count = descs.Length;\n"
+ << scope_tab << scope_tab << "IntPtr descs_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(descs[0])*count);\n"
<< scope_tab << scope_tab << "IntPtr ptr = descs_ptr;\n"
- << scope_tab << scope_tab << "for(int i = 0; i != " << function_count << "; ++i)\n"
+ << scope_tab << scope_tab << "for(int i = 0; i != count; ++i)\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "Marshal.StructureToPtr(descs[i], ptr, false);\n"
<< scope_tab << scope_tab << scope_tab << "ptr = IntPtr.Add(ptr, Marshal.SizeOf(descs[0]));\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << "Efl_Object_Ops ops;\n"
<< scope_tab << scope_tab << "ops.descs = descs_ptr;\n"
- << scope_tab << scope_tab << "ops.count = (UIntPtr)" << function_count << ";\n"
+ << scope_tab << scope_tab << "ops.count = (UIntPtr)count;\n"
<< scope_tab << scope_tab << "IntPtr ops_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(ops));\n"
<< scope_tab << scope_tab << "Marshal.StructureToPtr(ops, ops_ptr, false);\n"
<< scope_tab << scope_tab << "Efl.Eo.Globals.efl_class_functions_set(klass, ops_ptr, IntPtr.Zero);\n"
diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc
index 328b983052..2e0e8918cb 100644
--- a/src/bin/eolian_mono/eolian_mono.cc
+++ b/src/bin/eolian_mono/eolian_mono.cc
@@ -131,6 +131,7 @@ run(options_type const& opts)
if (!as_generator("using System;\n"
"using System.Runtime.InteropServices;\n"
"using System.Collections.Generic;\n"
+ "using System.Linq;\n"
"using System.ComponentModel;\n")
.generate(iterator, efl::eolian::grammar::attributes::unused, efl::eolian::grammar::context_null()))
{
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 1db9324001..532fee5c80 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -977,6 +977,9 @@ struct klass_def
class_type type;
std::vector<event_def> events;
std::set<klass_name, compare_klass_name_by_name> immediate_inherits;
+ eina::optional<klass_name> parent;
+ std::set<klass_name, compare_klass_name_by_name> extensions;
+
std::set<part_def> parts;
Eolian_Unit const* unit;
@@ -1098,7 +1101,10 @@ struct klass_def
} catch(std::exception const&) {}
}
if(::eolian_class_parent_get(klass))
- immediate_inherits.insert({::eolian_class_parent_get(klass), {}});
+ {
+ parent = eina::optional<klass_name>({::eolian_class_parent_get(klass), {}});
+ immediate_inherits.insert(*parent);
+ }
for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_extensions_get(klass))
, inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
{