summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-01-17 21:33:09 +0900
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-01-17 21:36:27 +0900
commitadc2e674af528c01ca5bb11d56edc475bce5cc4d (patch)
tree670312a6280387fbba6c25eeea23ea10beb22dfe /src/bin/eolian_mono
parent7b342e8fddaff50dd62354f357a3d249afc77498 (diff)
eolian-mono: Add interface registration to inherited classes
Summary: Depends on D7635, D7634 Reviewers: woohyun, bu5hm4n, segfaultxavi, lauromoura Reviewed By: woohyun Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7636
Diffstat (limited to 'src/bin/eolian_mono')
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_definition.hh10
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_registration.hh30
-rw-r--r--src/bin/eolian_mono/eolian/mono/klass.hh178
-rw-r--r--src/bin/eolian_mono/eolian/mono/name_helpers.hh12
4 files changed, 99 insertions, 131 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index 763bbc4..2d9e1b5 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -71,7 +71,11 @@ struct native_function_definition_generator
71 if(!as_generator(eolian_mono::type(true)).generate(std::back_inserter(return_type), f.return_type, context)) 71 if(!as_generator(eolian_mono::type(true)).generate(std::back_inserter(return_type), f.return_type, context))
72 return false; 72 return false;
73 73
74 std::string klass_inherit_name = name_helpers::klass_inherit_name(*klass); 74 std::string klass_cast_name;
75 if (klass->type != attributes::class_type::interface_)
76 klass_cast_name = name_helpers::klass_inherit_name(*klass);
77 else
78 klass_cast_name = name_helpers::klass_interface_name(*klass);
75 79
76 if(!as_generator 80 if(!as_generator
77 (scope_tab 81 (scope_tab
@@ -89,7 +93,7 @@ struct native_function_definition_generator
89 << scope_tab << scope_tab << "if(wrapper != null) {\n" 93 << scope_tab << scope_tab << "if(wrapper != null) {\n"
90 << scope_tab << scope_tab << scope_tab << eolian_mono::native_function_definition_preamble() 94 << scope_tab << scope_tab << scope_tab << eolian_mono::native_function_definition_preamble()
91 << scope_tab << scope_tab << scope_tab << "try {\n" 95 << scope_tab << scope_tab << scope_tab << "try {\n"
92 << scope_tab << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "_ret_var = " : "") << "((" << klass_inherit_name << ")wrapper)." << string 96 << scope_tab << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "_ret_var = " : "") << "((" << klass_cast_name << ")wrapper)." << string
93 << "(" << (native_argument_invocation % ", ") << ");\n" 97 << "(" << (native_argument_invocation % ", ") << ");\n"
94 << scope_tab << scope_tab << scope_tab << "} catch (Exception e) {\n" 98 << scope_tab << scope_tab << scope_tab << "} catch (Exception e) {\n"
95 << scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Log.Warning($\"Callback error: {e.ToString()}\");\n" 99 << scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Log.Warning($\"Callback error: {e.ToString()}\");\n"
@@ -98,7 +102,7 @@ struct native_function_definition_generator
98 << eolian_mono::native_function_definition_epilogue(*klass) 102 << eolian_mono::native_function_definition_epilogue(*klass)
99 << scope_tab << scope_tab << "} else {\n" 103 << scope_tab << scope_tab << "} else {\n"
100 << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "return " : "") << string 104 << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "return " : "") << string
101 << "(Efl.Eo.Globals.efl_super(obj, " << "EoKlass)" << *(", " << argument) << ");\n" 105 << "(Efl.Eo.Globals.efl_super(obj, " << "GetEflClass())" << *(", " << argument) << ");\n"
102 << scope_tab << scope_tab << "}\n" 106 << scope_tab << scope_tab << "}\n"
103 << scope_tab << "}\n" 107 << scope_tab << "}\n"
104 ) 108 )
diff --git a/src/bin/eolian_mono/eolian/mono/function_registration.hh b/src/bin/eolian_mono/eolian/mono/function_registration.hh
index 0b8da4a..78f2d71 100644
--- a/src/bin/eolian_mono/eolian/mono/function_registration.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_registration.hh
@@ -20,10 +20,10 @@
20 20
21namespace eolian_mono { 21namespace eolian_mono {
22 22
23template <typename I> 23// template <typename I>
24struct function_registration_generator 24struct function_registration_generator
25{ 25{
26 I index_generator; 26 // I index_generator;
27 attributes::klass_def const* klass; 27 attributes::klass_def const* klass;
28 28
29 template <typename OutputIterator, typename Context> 29 template <typename OutputIterator, typename Context>
@@ -34,7 +34,7 @@ struct function_registration_generator
34 return true; 34 return true;
35 else 35 else
36 { 36 {
37 auto index = index_generator(); 37 // auto index = index_generator();
38 38
39 if(!as_generator( 39 if(!as_generator(
40 scope_tab << scope_tab << f.c_name << "_static_delegate = new " << f.c_name << "_delegate(" << 40 scope_tab << scope_tab << f.c_name << "_static_delegate = new " << f.c_name << "_delegate(" <<
@@ -43,12 +43,13 @@ struct function_registration_generator
43 return false; 43 return false;
44 44
45 if(!as_generator 45 if(!as_generator
46 (scope_tab << scope_tab << "descs.Add(new Efl_Op_Description() {"
46#ifdef _WIN32 47#ifdef _WIN32
47 (scope_tab << scope_tab << "descs[" << index << "].api_func = Marshal.StringToHGlobalAnsi(\"" << string << "\");\n" 48 << "api_func = Marshal.StringToHGlobalAnsi(\"" << string << "\")"
48#else 49#else
49 (scope_tab << scope_tab << "descs[" << index << "].api_func = Efl.Eo.Globals.dlsym(Efl.Eo.Globals.RTLD_DEFAULT, \"" << string << "\");\n" 50 << "api_func = Efl.Eo.Globals.dlsym(Efl.Eo.Globals.RTLD_DEFAULT, \"" << string << "\")"
50#endif 51#endif
51 << scope_tab << scope_tab << "descs[" << index << "].func = Marshal.GetFunctionPointerForDelegate(" << string << "_static_delegate);\n" 52 ", func = Marshal.GetFunctionPointerForDelegate(" << string << "_static_delegate)});\n"
52 ) 53 )
53 .generate(sink, std::make_tuple(f.c_name, f.c_name), context)) 54 .generate(sink, std::make_tuple(f.c_name, f.c_name), context))
54 return false; 55 return false;
@@ -59,10 +60,9 @@ struct function_registration_generator
59 60
60struct function_registration_parameterized 61struct function_registration_parameterized
61{ 62{
62 template <typename I> 63 function_registration_generator operator()(attributes::klass_def const& klass) const
63 function_registration_generator<I> operator()(I i, attributes::klass_def const& klass) const
64 { 64 {
65 return {i, &klass}; 65 return {&klass};
66 } 66 }
67} const function_registration; 67} const function_registration;
68 68
@@ -70,15 +70,15 @@ struct function_registration_parameterized
70 70
71namespace efl { namespace eolian { namespace grammar { 71namespace efl { namespace eolian { namespace grammar {
72 72
73template <typename I> 73template <>
74struct is_eager_generator< ::eolian_mono::function_registration_generator<I>> : std::true_type {}; 74struct is_eager_generator< ::eolian_mono::function_registration_generator> : std::true_type {};
75template <typename I> 75template <>
76struct is_generator< ::eolian_mono::function_registration_generator<I>> : std::true_type {}; 76struct is_generator< ::eolian_mono::function_registration_generator> : std::true_type {};
77 77
78namespace type_traits { 78namespace type_traits {
79 79
80template <typename I> 80template <>
81struct attributes_needed< ::eolian_mono::function_registration_generator<I>> : std::integral_constant<int, 1> {}; 81struct attributes_needed< ::eolian_mono::function_registration_generator> : std::integral_constant<int, 1> {};
82} 82}
83 83
84} } } 84} } }
diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh
index 5dc22f5..c3d430e 100644
--- a/src/bin/eolian_mono/eolian/mono/klass.hh
+++ b/src/bin/eolian_mono/eolian/mono/klass.hh
@@ -123,58 +123,57 @@ struct klass
123 // Interface class 123 // Interface class
124 if(class_type == "interface") 124 if(class_type == "interface")
125 { 125 {
126 auto iface_cxt = context_add_tag(class_context{class_context::interface}, context); 126 auto iface_cxt = context_add_tag(class_context{class_context::interface}, context);
127 127
128 if(!as_generator(documentation).generate(sink, cls, iface_cxt)) 128 if(!as_generator(documentation).generate(sink, cls, iface_cxt))
129 return false; 129 return false;
130 130
131 // Mark the interface with the proper native Efl_Class* getter 131 // Mark the interface with the proper native Efl_Class* getter
132 if(!as_generator(lit("[") << name_helpers::interface_native_getter_attr_name(cls) << "]\n") 132 if(!as_generator(lit("[") << name_helpers::klass_native_inherit_name(cls) << "]\n")
133 .generate(sink, attributes::unused, iface_cxt)) 133 .generate(sink, attributes::unused, iface_cxt))
134 return false; 134 return false;
135 135
136 if(!as_generator 136 if(!as_generator
137 ( 137 (
138 "public " /*<< class_type*/ "interface" /*<<*/ " " << string << " : " 138 "public " /*<< class_type*/ "interface" /*<<*/ " " << string << " : "
139 ) 139 )
140 .generate(sink, name_helpers::klass_interface_name(cls), iface_cxt)) 140 .generate(sink, name_helpers::klass_interface_name(cls), iface_cxt))
141 return false; 141 return false;
142 for(auto first = std::begin(cls.immediate_inherits) 142 for(auto first = std::begin(cls.immediate_inherits)
143 , last = std::end(cls.immediate_inherits); first != last; ++first) 143 , last = std::end(cls.immediate_inherits); first != last; ++first)
144 { 144 {
145 if(first->type != attributes::class_type::regular && first->type != attributes::class_type::abstract_) 145 if(first->type != attributes::class_type::regular && first->type != attributes::class_type::abstract_)
146 if(!as_generator("\n" << scope_tab << string << " ,").generate(sink, name_helpers::klass_full_interface_name(*first), iface_cxt)) 146 if(!as_generator("\n" << scope_tab << string << " ,").generate(sink, name_helpers::klass_full_interface_name(*first), iface_cxt))
147 return false; 147 return false;
148 } 148 }
149 149
150 if(!as_generator("\n" << scope_tab << "Efl.Eo.IWrapper, IDisposable").generate(sink, attributes::unused, iface_cxt)) 150 if(!as_generator("\n" << scope_tab << "Efl.Eo.IWrapper, IDisposable").generate(sink, attributes::unused, iface_cxt))
151 return false; 151 return false;
152 152
153 if(!as_generator("\n{\n").generate(sink, attributes::unused, iface_cxt)) 153 if(!as_generator("\n{\n").generate(sink, attributes::unused, iface_cxt))
154 return false; 154 return false;
155 155
156 if(!as_generator(*(scope_tab << function_declaration)).generate(sink, cls.functions, iface_cxt)) 156 if(!as_generator(*(scope_tab << function_declaration)).generate(sink, cls.functions, iface_cxt))
157 return false; 157 return false;
158 158
159 if(!as_generator(*(scope_tab << async_function_declaration)).generate(sink, cls.functions, iface_cxt)) 159 if(!as_generator(*(scope_tab << async_function_declaration)).generate(sink, cls.functions, iface_cxt))
160 return false; 160 return false;
161 161
162 if(!as_generator(*(event_declaration)).generate(sink, cls.events, iface_cxt)) 162 if(!as_generator(*(event_declaration)).generate(sink, cls.events, iface_cxt))
163 return false; 163 return false;
164 164
165 for (auto &&p : cls.parts) 165 for (auto &&p : cls.parts)
166 if (!as_generator( 166 if (!as_generator(
167 documentation(1) 167 documentation(1)
168 << name_helpers::klass_full_concrete_or_interface_name(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n" 168 << name_helpers::klass_full_concrete_or_interface_name(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n"
169 ).generate(sink, p, iface_cxt)) 169 ).generate(sink, p, iface_cxt))
170 return false; 170 return false;
171
172 if (!as_generator(*(property_wrapper_definition)).generate(sink, cls.properties, iface_cxt))
173 return false;
174 171
175 // End of interface declaration 172 if (!as_generator(*(property_wrapper_definition)).generate(sink, cls.properties, iface_cxt))
176 if(!as_generator("}\n").generate(sink, attributes::unused, iface_cxt)) return false; 173 return false;
177 174
175 // End of interface declaration
176 if(!as_generator("}\n").generate(sink, attributes::unused, iface_cxt)) return false;
178 } 177 }
179 178
180 // Events arguments go in the top namespace to avoid the Concrete suffix clutter in interface events. 179 // Events arguments go in the top namespace to avoid the Concrete suffix clutter in interface events.
@@ -276,17 +275,6 @@ struct klass
276 275
277 276
278 if(!as_generator("}\n").generate(sink, attributes::unused, concrete_cxt)) return false; 277 if(!as_generator("}\n").generate(sink, attributes::unused, concrete_cxt)) return false;
279
280 // Attribute getter of the native 'Efl_Class *' handle (for proper inheritance from additional explicit interfaces)
281 if(!as_generator(lit("public class ") << name_helpers::interface_native_getter_attr_name(cls) << " : Efl.Eo.NativeGetterAttr\n"
282 << "{\n"
283 << scope_tab << "public override IntPtr GetEflClass()\n"
284 << scope_tab << "{\n"
285 << scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
286 << scope_tab << "}\n"
287 << "}\n")
288 .generate(sink, attributes::unused, concrete_cxt))
289 return false;
290 } 278 }
291 279
292 // Inheritable class 280 // Inheritable class
@@ -298,6 +286,7 @@ struct klass
298 if(!as_generator 286 if(!as_generator
299 ( 287 (
300 documentation 288 documentation
289 << "[" << name_helpers::klass_native_inherit_name(cls) << "]\n"
301 << "public " << class_type << " " << name_helpers::klass_concrete_name(cls) << " : " 290 << "public " << class_type << " " << name_helpers::klass_concrete_name(cls) << " : "
302 << (klass_full_concrete_or_interface_name % ",") // classes 291 << (klass_full_concrete_or_interface_name % ",") // classes
303 << (inherit_classes.empty() ? "" : ",") 292 << (inherit_classes.empty() ? "" : ",")
@@ -359,16 +348,8 @@ struct klass
359 if(!as_generator("}\n").generate(sink, attributes::unused, inherit_cxt)) return false; 348 if(!as_generator("}\n").generate(sink, attributes::unused, inherit_cxt)) return false;
360 } 349 }
361 350
362 std::size_t function_count = get_implementable_function_count(cls);
363
364 int function_registration_index = 0;
365 auto index_generator = [&function_registration_index]
366 {
367 return function_registration_index++;
368 };
369
370 // Native Inherit class 351 // Native Inherit class
371 if(class_type == "class") 352 //if(class_type == "class")
372 { 353 {
373 auto inative_cxt = context_add_tag(class_context{class_context::inherit_native}, context); 354 auto inative_cxt = context_add_tag(class_context{class_context::inherit_native}, context);
374 auto native_inherit_name = name_helpers::klass_native_inherit_name(cls); 355 auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
@@ -382,21 +363,21 @@ struct klass
382 363
383 if(!as_generator 364 if(!as_generator
384 ( 365 (
385 "public " << class_type << " " << native_inherit_name << " " << (root ? "" : (": " + base_name)) <<"{\n" 366 "public class " << native_inherit_name << " " << (root ? ": Efl.Eo.NativeClass" : (": " + base_name)) <<"{\n"
386 << scope_tab << (root ? "protected IntPtr EoKlass { get; set; }\n" : "\n") 367 // << scope_tab << (root ? "protected IntPtr EoKlass { get; set; }\n" : "\n")
387 << scope_tab << "public " << (root ? "" : "new ") << "Efl_Op_Description[] GetEoOps()\n" 368 << scope_tab << "public " << /*(root ? "" : "new ")*/ "override " << "System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)\n"
388 << scope_tab << "{\n" 369 << scope_tab << "{\n"
389 << scope_tab << scope_tab << "Efl_Op_Description[] descs = new Efl_Op_Description[" << grammar::int_ << "];\n" 370 << scope_tab << scope_tab << "var descs = new System.Collections.Generic.List<Efl_Op_Description>();\n"
390 ) 371 )
391 .generate(sink, function_count, inative_cxt)) 372 .generate(sink, attributes::unused, inative_cxt))
392 return false; 373 return false;
393 374
394 // Native wrapper registration 375 // Native wrapper registration
395 if(!as_generator(*(function_registration(index_generator, cls))) 376 if(!as_generator(*(function_registration(cls)))
396 .generate(sink, helpers::get_all_implementable_methods(cls), inative_cxt)) return false; 377 .generate(sink, helpers::get_all_implementable_methods(cls), inative_cxt)) return false;
397 378
398 if(!root) 379 if(!root)
399 if(!as_generator(scope_tab << scope_tab << "descs = descs.Concat(base.GetEoOps()).ToArray();\n").generate(sink, attributes::unused, inative_cxt)) 380 if(!as_generator(scope_tab << scope_tab << "descs.AddRange(base.GetEoOps(type));\n").generate(sink, attributes::unused, inative_cxt))
400 return false; 381 return false;
401 382
402 if(!as_generator( 383 if(!as_generator(
@@ -405,32 +386,23 @@ struct klass
405 ).generate(sink, attributes::unused, inative_cxt)) 386 ).generate(sink, attributes::unused, inative_cxt))
406 return false; 387 return false;
407 388
408 if(!as_generator 389 // Attribute getter of the native 'Efl_Class *' handle (for proper inheritance from additional explicit interfaces)
409 (scope_tab << "public " << (root ? "" : "new " ) << "byte class_initializer(IntPtr klass)\n" 390 if(!as_generator(
410 << scope_tab << "{\n" 391 scope_tab << "public override IntPtr GetEflClass()\n"
411 << scope_tab << scope_tab << "var descs = GetEoOps();\n" 392 << scope_tab << "{\n"
412 << scope_tab << scope_tab << "var count = descs.Length;\n" 393 << scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
413 << scope_tab << scope_tab << "IntPtr descs_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(descs[0])*count);\n" 394 << scope_tab << "}\n"
414 << scope_tab << scope_tab << "IntPtr ptr = descs_ptr;\n" 395 ).generate(sink, attributes::unused, inative_cxt))
415 << scope_tab << scope_tab << "for(int i = 0; i != count; ++i)\n" 396 return false;
416 << scope_tab << scope_tab << "{\n" 397
417 << scope_tab << scope_tab << scope_tab << "Marshal.StructureToPtr(descs[i], ptr, false);\n" 398 if(!as_generator(
418 << scope_tab << scope_tab << scope_tab << "ptr = IntPtr.Add(ptr, Marshal.SizeOf(descs[0]));\n" 399 scope_tab << "public static " << (root ? "" : "new ") << " IntPtr GetEflClassStatic()\n"
419 << scope_tab << scope_tab << "}\n" 400 << scope_tab << "{\n"
420 << scope_tab << scope_tab << "Efl_Object_Ops ops;\n" 401 << scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
421 << scope_tab << scope_tab << "ops.descs = descs_ptr;\n" 402 << scope_tab << "}\n"
422 << scope_tab << scope_tab << "ops.count = (UIntPtr)count;\n" 403 ).generate(sink, attributes::unused, inative_cxt))
423 << scope_tab << scope_tab << "IntPtr ops_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(ops));\n" 404 return false;
424 << scope_tab << scope_tab << "Marshal.StructureToPtr(ops, ops_ptr, false);\n" 405
425 << scope_tab << scope_tab << "Efl.Eo.Globals.efl_class_functions_set(klass, ops_ptr, IntPtr.Zero);\n"
426 << scope_tab << scope_tab << "EoKlass = klass;\n"
427 ).generate(sink, attributes::unused, inative_cxt)) return false;
428
429
430 if(!as_generator(scope_tab << scope_tab << "return 1;\n"
431 << scope_tab << "}\n")
432 .generate(sink, attributes::unused, inative_cxt)) return false;
433 //
434 // Native method definitions 406 // Native method definitions
435 if(!as_generator(*(native_function_definition(cls))) 407 if(!as_generator(*(native_function_definition(cls)))
436 .generate(sink, helpers::get_all_implementable_methods(cls), inative_cxt)) return false; 408 .generate(sink, helpers::get_all_implementable_methods(cls), inative_cxt)) return false;
@@ -451,8 +423,9 @@ struct klass
451 bool root = !helpers::has_regular_ancestor(cls); 423 bool root = !helpers::has_regular_ancestor(cls);
452 bool is_inherit = is_inherit_context(context); 424 bool is_inherit = is_inherit_context(context);
453 425
454 std::string class_getter = "return Efl.Eo.Globals.efl_class_get(handle);"; 426 std::string class_getter = name_helpers::klass_get_name(cls) + "()";
455 std::string native_inherit_full_name = name_helpers::klass_full_native_inherit_name(cls); 427 std::string native_inherit_full_name = name_helpers::klass_full_native_inherit_name(cls);
428 auto inherit_name = name_helpers::klass_concrete_name(cls);
456 429
457 // The klass field is static but there is no problem if multiple C# classes inherit from this generated one 430 // The klass field is static but there is no problem if multiple C# classes inherit from this generated one
458 // as it is just a simple wrapper, forwarding the Eo calls either to the user API (where C#'s virtual method 431 // as it is just a simple wrapper, forwarding the Eo calls either to the user API (where C#'s virtual method
@@ -464,7 +437,6 @@ struct klass
464 << scope_tab << "public " << (root ? "" : "new ") << "static " << native_inherit_full_name << " nativeInherit = new " << native_inherit_full_name << "();\n" 437 << scope_tab << "public " << (root ? "" : "new ") << "static " << native_inherit_full_name << " nativeInherit = new " << native_inherit_full_name << "();\n"
465 ).generate(sink, attributes::unused, context)) 438 ).generate(sink, attributes::unused, context))
466 return false; 439 return false;
467 class_getter = "return klass;";
468 } 440 }
469 441
470 std::string raw_klass_modifier; 442 std::string raw_klass_modifier;
@@ -477,7 +449,10 @@ struct klass
477 scope_tab << "///<summary>Pointer to the native class description.</summary>\n" 449 scope_tab << "///<summary>Pointer to the native class description.</summary>\n"
478 << scope_tab << "public " << raw_klass_modifier << "System.IntPtr NativeClass {\n" 450 << scope_tab << "public " << raw_klass_modifier << "System.IntPtr NativeClass {\n"
479 << scope_tab << scope_tab << "get {\n" 451 << scope_tab << scope_tab << "get {\n"
480 << scope_tab << scope_tab << scope_tab << class_getter << "\n" //return klass; }\n" 452 << scope_tab << scope_tab << scope_tab << "if (((object)this).GetType() == typeof (" << inherit_name << "))\n"
453 << scope_tab << scope_tab << scope_tab << scope_tab << "return " << native_inherit_full_name << ".GetEflClassStatic();\n"
454 << scope_tab << scope_tab << scope_tab << "else\n"
455 << scope_tab << scope_tab << scope_tab << scope_tab << "return Efl.Eo.Globals.klasses[((object)this).GetType()];\n"
481 << scope_tab << scope_tab << "}\n" 456 << scope_tab << scope_tab << "}\n"
482 << scope_tab << "}\n" 457 << scope_tab << "}\n"
483 ).generate(sink, attributes::unused, context)) 458 ).generate(sink, attributes::unused, context))
@@ -534,7 +509,8 @@ struct klass
534 scope_tab << "///<summary>Creates a new instance.</summary>\n" 509 scope_tab << "///<summary>Creates a new instance.</summary>\n"
535 << scope_tab << "///<param name=\"parent\">Parent instance.</param>\n" 510 << scope_tab << "///<param name=\"parent\">Parent instance.</param>\n"
536 << scope_tab << "///<param name=\"init_cb\">Delegate to call constructing methods that should be run inside the constructor.</param>\n" 511 << scope_tab << "///<param name=\"init_cb\">Delegate to call constructing methods that should be run inside the constructor.</param>\n"
537 << scope_tab << "public " << inherit_name << "(Efl.Object parent = null, ConstructingMethod init_cb=null) : base(nativeInherit.class_initializer, \"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent, ref klass)\n" 512 << scope_tab << "public " << inherit_name << "(Efl.Object parent = null, ConstructingMethod init_cb=null) : "
513 "base(\"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n"
538 << scope_tab << "{\n" 514 << scope_tab << "{\n"
539 << scope_tab << scope_tab << "if (init_cb != null) {\n" 515 << scope_tab << scope_tab << "if (init_cb != null) {\n"
540 << scope_tab << scope_tab << scope_tab << "init_cb(this);\n" 516 << scope_tab << scope_tab << scope_tab << "init_cb(this);\n"
@@ -543,7 +519,7 @@ struct klass
543 << scope_tab << "}\n" 519 << scope_tab << "}\n"
544 520
545 << scope_tab << "///<summary>Internal constructor to forward the wrapper initialization to the root class.</summary>\n" 521 << scope_tab << "///<summary>Internal constructor to forward the wrapper initialization to the root class.</summary>\n"
546 << scope_tab << "protected " << inherit_name << "(Efl.Eo.Globals.class_initializer class_initializer, String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent, ref IntPtr target_klass) : base(class_initializer, klass_name, base_klass, managed_type, parent, ref target_klass) {}\n" 522 << scope_tab << "protected " << inherit_name << "(String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(klass_name, base_klass, managed_type, parent) {}\n"
547 523
548 << scope_tab << "///<summary>Constructs an instance from a native pointer.</summary>\n" 524 << scope_tab << "///<summary>Constructs an instance from a native pointer.</summary>\n"
549 << scope_tab << "public " << inherit_name << "(System.IntPtr raw)" << (root ? "" : " : base(raw)") << "\n" 525 << scope_tab << "public " << inherit_name << "(System.IntPtr raw)" << (root ? "" : " : base(raw)") << "\n"
@@ -559,7 +535,7 @@ struct klass
559 scope_tab << "///<summary>Creates a new instance.</summary>\n" 535 scope_tab << "///<summary>Creates a new instance.</summary>\n"
560 << scope_tab << "///<param name=\"parent\">Parent instance.</param>\n" 536 << scope_tab << "///<param name=\"parent\">Parent instance.</param>\n"
561 << scope_tab << "///<param name=\"init_cb\">Delegate to call constructing methods that should be run inside the constructor.</param>\n" 537 << scope_tab << "///<param name=\"init_cb\">Delegate to call constructing methods that should be run inside the constructor.</param>\n"
562 << scope_tab << "public " << inherit_name << "(Efl.Object parent = null, ConstructingMethod init_cb=null) : this(nativeInherit.class_initializer, \"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent, ref klass)\n" 538 << scope_tab << "public " << inherit_name << "(Efl.Object parent = null, ConstructingMethod init_cb=null) : this(\"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n"
563 << scope_tab << "{\n" 539 << scope_tab << "{\n"
564 << scope_tab << scope_tab << "if (init_cb != null) {\n" 540 << scope_tab << scope_tab << "if (init_cb != null) {\n"
565 << scope_tab << scope_tab << scope_tab << "init_cb(this);\n" 541 << scope_tab << scope_tab << scope_tab << "init_cb(this);\n"
@@ -567,22 +543,22 @@ struct klass
567 << scope_tab << scope_tab << "FinishInstantiation();\n" 543 << scope_tab << scope_tab << "FinishInstantiation();\n"
568 << scope_tab << "}\n" 544 << scope_tab << "}\n"
569 545
570 << scope_tab << "protected " << inherit_name << "(Efl.Eo.Globals.class_initializer class_initializer, String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent, ref IntPtr target_klass)\n" 546 << scope_tab << "protected " << inherit_name << "(String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent)\n"
571 << scope_tab << "{\n" 547 << scope_tab << "{\n"
572 << scope_tab << scope_tab << "inherited = this.GetType() != managed_type;\n" 548 << scope_tab << scope_tab << "inherited = ((object)this).GetType() != managed_type;\n"
573 << scope_tab << scope_tab << "IntPtr actual_klass = base_klass;\n" 549 << scope_tab << scope_tab << "IntPtr actual_klass = base_klass;\n"
574 << scope_tab << scope_tab << "if (inherited) {\n" 550 << scope_tab << scope_tab << "if (inherited) {\n"
575 << scope_tab << scope_tab << scope_tab << "if (target_klass == System.IntPtr.Zero) {\n" 551 << scope_tab << scope_tab << scope_tab << "if (!Efl.Eo.Globals.klasses.ContainsKey(((object)this).GetType())) {\n"
576 << scope_tab << scope_tab << scope_tab << scope_tab << "lock (klassAllocLock) {\n" 552 << scope_tab << scope_tab << scope_tab << scope_tab << "lock (klassAllocLock) {\n"
577 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "if (target_klass == System.IntPtr.Zero) {\n" 553 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "actual_klass = Efl.Eo.Globals.register_class(klass_name, base_klass, ((object)this).GetType());\n"
578 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "target_klass = Efl.Eo.Globals.register_class(class_initializer, klass_name, base_klass, this.GetType());\n" 554 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "if (actual_klass == System.IntPtr.Zero) {\n"
579 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "if (target_klass == System.IntPtr.Zero) {\n"
580 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "throw new System.InvalidOperationException(\"Failed to initialize class '" << inherit_name << "'\");\n" 555 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "throw new System.InvalidOperationException(\"Failed to initialize class '" << inherit_name << "'\");\n"
581 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n" 556 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
582 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "}\n" 557 << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << scope_tab << "Efl.Eo.Globals.klasses[((object)this).GetType()] = actual_klass;\n"
583 << scope_tab << scope_tab << scope_tab << scope_tab << "}\n" 558 << scope_tab << scope_tab << scope_tab << scope_tab << "}\n"
584 << scope_tab << scope_tab << scope_tab << "}\n" 559 << scope_tab << scope_tab << scope_tab << "}\n"
585 << scope_tab << scope_tab << scope_tab << "actual_klass = target_klass;\n" 560 << scope_tab << scope_tab << scope_tab << "else\n"
561 << scope_tab << scope_tab << scope_tab << scope_tab << "actual_klass = Efl.Eo.Globals.klasses[((object)this).GetType()];\n"
586 << scope_tab << scope_tab << "}\n" 562 << scope_tab << scope_tab << "}\n"
587 << scope_tab << scope_tab << "handle = Efl.Eo.Globals.instantiate_start(actual_klass, parent);\n" 563 << scope_tab << scope_tab << "handle = Efl.Eo.Globals.instantiate_start(actual_klass, parent);\n"
588 << scope_tab << scope_tab << "register_event_proxies();\n" 564 << scope_tab << scope_tab << "register_event_proxies();\n"
diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
index a5cf5c0..8910447 100644
--- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
@@ -379,18 +379,6 @@ inline std::string klass_get_full_name(T const& clsname)
379 return klass_full_concrete_name(clsname) + "." + klass_get_name(clsname); 379 return klass_full_concrete_name(clsname) + "." + klass_get_name(clsname);
380} 380}
381 381
382template<typename T>
383inline std::string interface_native_getter_attr_name(T const& clsname)
384{
385 return klass_interface_name(clsname) + "NativeGetterAttr";
386}
387
388template<typename T>
389inline std::string interface_native_getter_attr_full_name(T const& clsname)
390{
391 return klass_full_interface_name(clsname) + "NativeGetterAttr";
392}
393
394// Events 382// Events
395inline std::string managed_event_name(std::string const& name) 383inline std::string managed_event_name(std::string const& name)
396{ 384{