summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-04-22 18:15:19 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-22 18:20:52 -0300
commit0c5a0186d18b6b893797d76abb63ab7cad01b815 (patch)
tree00f6c5a21699f5fa857cf8e5e2641a3a4ce54373 /src/bin
parent863c0b3272d6185f028afb83f2643ad75bcafbe5 (diff)
csharp: Small style changes
Summary: - Marshal annotations - Parameters - Structs - Parts Depends on D8614 Reviewers: segfaultxavi, vitor.sousa Reviewed By: segfaultxavi, vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8622
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eolian_mono/eolian/mono/marshall_annotation.hh44
-rw-r--r--src/bin/eolian_mono/eolian/mono/parameter.hh17
-rw-r--r--src/bin/eolian_mono/eolian/mono/part_definition.hh2
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_fields.hh2
4 files changed, 34 insertions, 31 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh b/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh
index 296b59c04c..632696d6a7 100644
--- a/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh
+++ b/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh
@@ -51,71 +51,71 @@ struct marshall_annotation_visitor_generate
51 match const parameter_match_table[] = 51 match const parameter_match_table[] =
52 { 52 {
53 // signed primitives 53 // signed primitives
54 {"bool", nullptr, [&] { return " [MarshalAs(UnmanagedType.U1)]"; }}, 54 {"bool", nullptr, [&] { return "[MarshalAs(UnmanagedType.U1)]"; }},
55 {"string", true, [&] { 55 {"string", true, [&] {
56 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]"; 56 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
57 }}, 57 }},
58 {"string", false, [&] { 58 {"string", false, [&] {
59 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]"; 59 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
60 }}, 60 }},
61 {"mstring", true, [&] { 61 {"mstring", true, [&] {
62 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]"; 62 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
63 }}, 63 }},
64 {"mstring", false, [&] { 64 {"mstring", false, [&] {
65 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]"; 65 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
66 }}, 66 }},
67 {"stringshare", true, [&] { 67 {"stringshare", true, [&] {
68 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]"; 68 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]";
69 }}, 69 }},
70 {"stringshare", false, [&] { 70 {"stringshare", false, [&] {
71 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]"; 71 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]";
72 }}, 72 }},
73 {"any_value_ptr", true, [&] { 73 {"any_value_ptr", true, [&] {
74 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]"; 74 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]";
75 }}, 75 }},
76 {"any_value_ptr", false, [&] { 76 {"any_value_ptr", false, [&] {
77 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]"; 77 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]";
78 }}, 78 }},
79 {"strbuf", true, [&] { 79 {"strbuf", true, [&] {
80 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]"; 80 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]";
81 }}, 81 }},
82 {"strbuf", false, [&] { 82 {"strbuf", false, [&] {
83 return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]"; 83 return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]";
84 }}, 84 }},
85 }; 85 };
86 match const return_match_table[] = 86 match const return_match_table[] =
87 { 87 {
88 // signed primitives 88 // signed primitives
89 {"bool", nullptr, [&] { return " [return: MarshalAs(UnmanagedType.U1)]"; }}, 89 {"bool", nullptr, [&] { return "[return: MarshalAs(UnmanagedType.U1)]"; }},
90 {"string", true, [&] { 90 {"string", true, [&] {
91 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]"; 91 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
92 }}, 92 }},
93 {"string", nullptr, [&] { 93 {"string", nullptr, [&] {
94 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]"; 94 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
95 }}, 95 }},
96 {"mstring", true, [&] { 96 {"mstring", true, [&] {
97 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]"; 97 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
98 }}, 98 }},
99 {"mstring", false, [&] { 99 {"mstring", false, [&] {
100 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]"; 100 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
101 }}, 101 }},
102 {"stringshare", true, [&] { 102 {"stringshare", true, [&] {
103 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]"; 103 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]";
104 }}, 104 }},
105 {"stringshare", false, [&] { 105 {"stringshare", false, [&] {
106 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]"; 106 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]";
107 }}, 107 }},
108 {"any_value_ptr", true, [&] { 108 {"any_value_ptr", true, [&] {
109 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]"; 109 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]";
110 }}, 110 }},
111 {"any_value_ptr", false, [&] { 111 {"any_value_ptr", false, [&] {
112 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]"; 112 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]";
113 }}, 113 }},
114 {"strbuf", true, [&] { 114 {"strbuf", true, [&] {
115 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]"; 115 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]";
116 }}, 116 }},
117 {"strbuf", false, [&] { 117 {"strbuf", false, [&] {
118 return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]"; 118 return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]";
119 }}, 119 }},
120 }; 120 };
121 121
diff --git a/src/bin/eolian_mono/eolian/mono/parameter.hh b/src/bin/eolian_mono/eolian/mono/parameter.hh
index acd0c5dfe1..ca3c573df7 100644
--- a/src/bin/eolian_mono/eolian/mono/parameter.hh
+++ b/src/bin/eolian_mono/eolian/mono/parameter.hh
@@ -389,22 +389,22 @@ inline std::string direction_modifier(attributes::parameter_def const& param)
389{ 389{
390 if (param.direction == attributes::parameter_direction::inout) 390 if (param.direction == attributes::parameter_direction::inout)
391 { 391 {
392 return " ref "; 392 return "ref ";
393 } 393 }
394 else if (param.direction != attributes::parameter_direction::in) 394 else if (param.direction != attributes::parameter_direction::in)
395 { 395 {
396 if (param.type.c_type == "Eina_Slice" || param.type.c_type == "Eina_Rw_Slice") 396 if (param.type.c_type == "Eina_Slice" || param.type.c_type == "Eina_Rw_Slice")
397 return " ref "; 397 return "ref ";
398 else 398 else
399 return " out "; 399 return "out ";
400 } 400 }
401 else if (param.direction == attributes::parameter_direction::in && param.type.is_ptr) 401 else if (param.direction == attributes::parameter_direction::in && param.type.is_ptr)
402 { 402 {
403 auto regular = efl::eina::get<attributes::regular_type_def>(&param.type.original_type); 403 auto regular = efl::eina::get<attributes::regular_type_def>(&param.type.original_type);
404 if (helpers::need_struct_conversion(regular)) 404 if (helpers::need_struct_conversion(regular))
405 return " ref "; // Don't add ref on Marshal if it is ptr 405 return "ref "; // Don't add ref on Marshal if it is ptr
406 } 406 }
407 return " "; 407 return "";
408} 408}
409 409
410std::string marshall_direction_modifier(attributes::parameter_def const& param) 410std::string marshall_direction_modifier(attributes::parameter_def const& param)
@@ -1477,7 +1477,8 @@ struct constructor_invocation_generator
1477 if (!as_generator( 1477 if (!as_generator(
1478 "if (" << 1478 "if (" <<
1479 (efl::eolian::grammar::attribute_reorder<-1> 1479 (efl::eolian::grammar::attribute_reorder<-1>
1480 ("Efl.Eo.Globals.ParamHelperCheck(" << constructor_parameter_name(ctor) << ")") % "||") << ")\n" 1480 ("Efl.Eo.Globals.ParamHelperCheck(" << constructor_parameter_name(ctor) << ")") % " || ") << ")\n"
1481 << scope_tab << scope_tab << "{\n"
1481 << scope_tab << scope_tab << scope_tab << name_helpers::managed_method_name(ctor.function) << "(" 1482 << scope_tab << scope_tab << scope_tab << name_helpers::managed_method_name(ctor.function) << "("
1482 ).generate(sink, params, context)) 1483 ).generate(sink, params, context))
1483 return false; 1484 return false;
@@ -1493,7 +1494,9 @@ struct constructor_invocation_generator
1493 return false; 1494 return false;
1494 } 1495 }
1495 1496
1496 if (!as_generator(");").generate(sink, attributes::unused, context)) 1497 if (!as_generator(
1498 ");\n"
1499 << scope_tab << scope_tab << "}\n").generate(sink, attributes::unused, context))
1497 return false; 1500 return false;
1498 return true; 1501 return true;
1499 } 1502 }
diff --git a/src/bin/eolian_mono/eolian/mono/part_definition.hh b/src/bin/eolian_mono/eolian/mono/part_definition.hh
index 06cdf1584f..9c57587b33 100644
--- a/src/bin/eolian_mono/eolian/mono/part_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/part_definition.hh
@@ -27,7 +27,7 @@ struct part_definition_generator
27 << scope_tab << "{\n" 27 << scope_tab << "{\n"
28 << scope_tab << scope_tab << "get\n" 28 << scope_tab << scope_tab << "get\n"
29 << scope_tab << scope_tab << "{\n" 29 << scope_tab << scope_tab << "{\n"
30 << scope_tab << scope_tab << scope_tab << "return Efl.IPartNativeInherit.efl_part_get_ptr.Value.Delegate(NativeHandle, \"" << part.name << "\") as " << part_klass_name << ";\n" 30 << scope_tab << scope_tab << scope_tab << "return GetPart(\"" << part.name << "\") as " << part_klass_name << ";\n"
31 << scope_tab << scope_tab << "}\n" 31 << scope_tab << scope_tab << "}\n"
32 << scope_tab << "}\n" 32 << scope_tab << "}\n"
33 ).generate(sink, part.documentation, context); 33 ).generate(sink, part.documentation, context);
diff --git a/src/bin/eolian_mono/eolian/mono/struct_fields.hh b/src/bin/eolian_mono/eolian/mono/struct_fields.hh
index 42a20e1aba..163d1b94db 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_fields.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_fields.hh
@@ -18,7 +18,7 @@ struct field_argument_default_generator
18 template<typename OutputIterator, typename Context> 18 template<typename OutputIterator, typename Context>
19 bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const 19 bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
20 { 20 {
21 if (!as_generator(type << " " << string << "=default(" << type << ")") 21 if (!as_generator(type << " " << string << " = default(" << type << ")")
22 .generate(sink, std::make_tuple(field.type, name_helpers::to_field_name(field.name), field.type), context)) 22 .generate(sink, std::make_tuple(field.type, name_helpers::to_field_name(field.name), field.type), context))
23 return false; 23 return false;
24 return true; 24 return true;