summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-21 19:21:42 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-25 10:14:01 -0300
commit6e92acd4e2538da0cb6e544e5ebbb2d551523ec3 (patch)
treedc1414e28b953e9f149883867f5c01dd429f250b
parentd761658985f45c582a9d5cbc6ab6a1beada6d642 (diff)
efl-csharp: Remove spaces from type strings in generator.
Summary: Previously, the type_impl and marshall_type_impl generators relied on a type mismatch in the match table to fallback to the else branch in the match check to actually print the type string. This was achieved by adding the " " prefix to the type. This commit changes this behavior to invoke a proper visitor just to print and makes both generators return trimmed type strings. This will help conforming to the C# coding conventions. Test Plan: run test suite Reviewers: felipealmeida, vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8441
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_definition.hh4
-rw-r--r--src/bin/eolian_mono/eolian/mono/function_pointer.hh2
-rw-r--r--src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh50
-rw-r--r--src/bin/eolian_mono/eolian/mono/type_impl.hh120
4 files changed, 99 insertions, 77 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/function_definition.hh b/src/bin/eolian_mono/eolian/mono/function_definition.hh
index 465a8fee71..fe349effab 100644
--- a/src/bin/eolian_mono/eolian/mono/function_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_definition.hh
@@ -107,7 +107,7 @@ struct native_function_definition_generator
107 << scope_tab << scope_tab << "if(wrapper != null) {\n" 107 << scope_tab << scope_tab << "if(wrapper != null) {\n"
108 << scope_tab << scope_tab << scope_tab << eolian_mono::native_function_definition_preamble() 108 << scope_tab << scope_tab << scope_tab << eolian_mono::native_function_definition_preamble()
109 << scope_tab << scope_tab << scope_tab << "try {\n" 109 << scope_tab << scope_tab << scope_tab << "try {\n"
110 << scope_tab << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "_ret_var = " : "") 110 << scope_tab << scope_tab << scope_tab << scope_tab << (return_type != "void" ? "_ret_var = " : "")
111 << (f.is_static ? "" : "((") << klass_cast_name << (f.is_static ? "." : ")wrapper).") << string 111 << (f.is_static ? "" : "((") << klass_cast_name << (f.is_static ? "." : ")wrapper).") << string
112 << "(" << (native_argument_invocation % ", ") << ");\n" 112 << "(" << (native_argument_invocation % ", ") << ");\n"
113 << scope_tab << scope_tab << scope_tab << "} catch (Exception e) {\n" 113 << scope_tab << scope_tab << scope_tab << "} catch (Exception e) {\n"
@@ -116,7 +116,7 @@ struct native_function_definition_generator
116 << scope_tab << scope_tab << scope_tab << "}\n" 116 << scope_tab << scope_tab << scope_tab << "}\n"
117 << eolian_mono::native_function_definition_epilogue(*klass) 117 << eolian_mono::native_function_definition_epilogue(*klass)
118 << scope_tab << scope_tab << "} else {\n" 118 << scope_tab << scope_tab << "} else {\n"
119 << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "return " : "") << string 119 << scope_tab << scope_tab << scope_tab << (return_type != "void" ? "return " : "") << string
120 << "_ptr.Value.Delegate(" << self << ((!f.is_static && f.parameters.size() > 0) ? ", " : "") << (argument % ", ") << ");\n" 120 << "_ptr.Value.Delegate(" << self << ((!f.is_static && f.parameters.size() > 0) ? ", " : "") << (argument % ", ") << ");\n"
121 << scope_tab << scope_tab << "}\n" 121 << scope_tab << scope_tab << "}\n"
122 << scope_tab << "}\n" 122 << scope_tab << "}\n"
diff --git a/src/bin/eolian_mono/eolian/mono/function_pointer.hh b/src/bin/eolian_mono/eolian/mono/function_pointer.hh
index f3918f1c26..d616f1da2a 100644
--- a/src/bin/eolian_mono/eolian/mono/function_pointer.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_pointer.hh
@@ -89,7 +89,7 @@ struct function_pointer {
89 << scope_tab << scope_tab << string << " cb = (" << string << ")handle.Target;\n" 89 << scope_tab << scope_tab << string << " cb = (" << string << ")handle.Target;\n"
90 << native_function_definition_preamble 90 << native_function_definition_preamble
91 << scope_tab << scope_tab << "try {\n" 91 << scope_tab << scope_tab << "try {\n"
92 << scope_tab << scope_tab << scope_tab << (return_type != " void" ? "_ret_var = " : "") << "cb(" << (native_argument_invocation % ", ") << ");\n" 92 << scope_tab << scope_tab << scope_tab << (return_type != "void" ? "_ret_var = " : "") << "cb(" << (native_argument_invocation % ", ") << ");\n"
93 << scope_tab << scope_tab << "} catch (Exception e) {\n" 93 << scope_tab << scope_tab << "} catch (Exception e) {\n"
94 << scope_tab << scope_tab << scope_tab << "Eina.Log.Warning($\"Callback error: {e.ToString()}\");\n" 94 << scope_tab << scope_tab << scope_tab << "Eina.Log.Warning($\"Callback error: {e.ToString()}\");\n"
95 << scope_tab << scope_tab << scope_tab << "Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);\n" 95 << scope_tab << scope_tab << scope_tab << "Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);\n"
diff --git a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
index 998ca0bdb3..ae619ea19e 100644
--- a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
@@ -46,55 +46,55 @@ struct marshall_type_visitor_generate
46 { 46 {
47 regular_type_def r = regular; 47 regular_type_def r = regular;
48 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 48 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
49 return replace_base_type(r, " System.String"); 49 return replace_base_type(r, "System.String");
50 }} 50 }}
51 , {"string", false, [&] 51 , {"string", false, [&]
52 { 52 {
53 regular_type_def r = regular; 53 regular_type_def r = regular;
54 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 54 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
55 return replace_base_type(r, " System.String"); 55 return replace_base_type(r, "System.String");
56 }} 56 }}
57 , {"mstring", true, [&] 57 , {"mstring", true, [&]
58 { 58 {
59 regular_type_def r = regular; 59 regular_type_def r = regular;
60 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 60 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
61 return replace_base_type(r, " System.String"); 61 return replace_base_type(r, "System.String");
62 }} 62 }}
63 , {"mstring", false, [&] 63 , {"mstring", false, [&]
64 { 64 {
65 regular_type_def r = regular; 65 regular_type_def r = regular;
66 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 66 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
67 return replace_base_type(r, " System.String"); 67 return replace_base_type(r, "System.String");
68 }} 68 }}
69 , {"stringshare", true, [&] 69 , {"stringshare", true, [&]
70 { 70 {
71 regular_type_def r = regular; 71 regular_type_def r = regular;
72 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 72 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
73 return replace_base_type(r, " System.String"); 73 return replace_base_type(r, "System.String");
74 }} 74 }}
75 , {"stringshare", false, [&] 75 , {"stringshare", false, [&]
76 { 76 {
77 regular_type_def r = regular; 77 regular_type_def r = regular;
78 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 78 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
79 return replace_base_type(r, " System.String"); 79 return replace_base_type(r, "System.String");
80 }} 80 }}
81 , {"strbuf", nullptr, [&] 81 , {"strbuf", nullptr, [&]
82 { 82 {
83 regular_type_def r = regular; 83 regular_type_def r = regular;
84 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 84 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
85 return replace_base_type(r, " Eina.Strbuf"); 85 return replace_base_type(r, "Eina.Strbuf");
86 }} 86 }}
87 , {"Binbuf", true, [&] 87 , {"Binbuf", true, [&]
88 { 88 {
89 regular_type_def r = regular; 89 regular_type_def r = regular;
90 r.base_type = " System.IntPtr"; 90 r.base_type = "System.IntPtr";
91 r.namespaces.clear(); 91 r.namespaces.clear();
92 return r; 92 return r;
93 }} 93 }}
94 , {"Binbuf", false, [&] 94 , {"Binbuf", false, [&]
95 { 95 {
96 regular_type_def r = regular; 96 regular_type_def r = regular;
97 r.base_type = " System.IntPtr"; 97 r.base_type = "System.IntPtr";
98 r.namespaces.clear(); 98 r.namespaces.clear();
99 return r; 99 return r;
100 }} 100 }}
@@ -103,9 +103,9 @@ struct marshall_type_visitor_generate
103 regular_type_def r = regular; 103 regular_type_def r = regular;
104 r.namespaces.clear(); 104 r.namespaces.clear();
105 if (is_ptr) 105 if (is_ptr)
106 r.base_type = " Eina.Value"; 106 r.base_type = "Eina.Value";
107 else 107 else
108 r.base_type = " Eina.ValueNative"; 108 r.base_type = "Eina.ValueNative";
109 return r; 109 return r;
110 }} 110 }}
111 , {"any_value", false, [&] 111 , {"any_value", false, [&]
@@ -113,23 +113,23 @@ struct marshall_type_visitor_generate
113 regular_type_def r = regular; 113 regular_type_def r = regular;
114 r.namespaces.clear(); 114 r.namespaces.clear();
115 if (is_ptr) 115 if (is_ptr)
116 r.base_type = " Eina.Value"; 116 r.base_type = "Eina.Value";
117 else 117 else
118 r.base_type = " Eina.ValueNative"; 118 r.base_type = "Eina.ValueNative";
119 return r; 119 return r;
120 }} 120 }}
121 , {"any_value_ptr", true, [&] 121 , {"any_value_ptr", true, [&]
122 { 122 {
123 regular_type_def r = regular; 123 regular_type_def r = regular;
124 r.namespaces.clear(); 124 r.namespaces.clear();
125 r.base_type = " Eina.Value"; 125 r.base_type = "Eina.Value";
126 return r; 126 return r;
127 }} 127 }}
128 , {"any_value_ptr", false, [&] 128 , {"any_value_ptr", false, [&]
129 { 129 {
130 regular_type_def r = regular; 130 regular_type_def r = regular;
131 r.namespaces.clear(); 131 r.namespaces.clear();
132 r.base_type = " Eina.Value"; 132 r.base_type = "Eina.Value";
133 return r; 133 return r;
134 }} 134 }}
135 , {"void", nullptr, [&] 135 , {"void", nullptr, [&]
@@ -137,9 +137,9 @@ struct marshall_type_visitor_generate
137 regular_type_def r = regular; 137 regular_type_def r = regular;
138 r.namespaces.clear(); 138 r.namespaces.clear();
139 if (is_out) // @inout too 139 if (is_out) // @inout too
140 r.base_type = " System.IntPtr"; 140 r.base_type = "System.IntPtr";
141 else 141 else
142 r.base_type = " void"; 142 r.base_type = "void";
143 return r; 143 return r;
144 }} 144 }}
145 }; 145 };
@@ -147,7 +147,7 @@ struct marshall_type_visitor_generate
147 if (regular.is_struct() && !blacklist::is_struct_blacklisted(regular) && !(bool)(regular.base_qualifier & qualifier_info::is_own)) 147 if (regular.is_struct() && !blacklist::is_struct_blacklisted(regular) && !(bool)(regular.base_qualifier & qualifier_info::is_own))
148 { 148 {
149 if ((is_out || is_return) && is_ptr) 149 if ((is_out || is_return) && is_ptr)
150 return as_generator(" System.IntPtr").generate(sink, attributes::unused, *context); 150 return as_generator("System.IntPtr").generate(sink, attributes::unused, *context);
151 return as_generator(string << "_StructInternal") 151 return as_generator(string << "_StructInternal")
152 .generate(sink, name_helpers::type_full_managed_name(regular), *context); 152 .generate(sink, name_helpers::type_full_managed_name(regular), *context);
153 } 153 }
@@ -161,7 +161,7 @@ struct marshall_type_visitor_generate
161 } 161 }
162 , [&] (attributes::type_def::variant_type const& v) 162 , [&] (attributes::type_def::variant_type const& v)
163 { 163 {
164 return v.visit(*this); // we want to keep is_out info 164 return v.visit(visitor_regular_type_def_printer<OutputIterator, Context>{sink, context}); // we want to keep is_out info
165 })) 165 }))
166 { 166 {
167 return *b; 167 return *b;
@@ -169,7 +169,7 @@ struct marshall_type_visitor_generate
169 else if (is_ptr && helpers::need_pointer_conversion(&regular)) 169 else if (is_ptr && helpers::need_pointer_conversion(&regular))
170 { 170 {
171 regular_type_def r = regular; 171 regular_type_def r = regular;
172 r.base_type = " System.IntPtr"; 172 r.base_type = "System.IntPtr";
173 r.namespaces.clear(); 173 r.namespaces.clear();
174 return visitor_generate<OutputIterator, Context>{sink, context, c_type, is_out, is_return, is_ptr}(r); 174 return visitor_generate<OutputIterator, Context>{sink, context, c_type, is_out, is_return, is_ptr}(r);
175 } 175 }
@@ -196,27 +196,27 @@ struct marshall_type_visitor_generate
196 { 196 {
197 {"array", nullptr, nullptr, [&] 197 {"array", nullptr, nullptr, [&]
198 { 198 {
199 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 199 return regular_type_def{"System.IntPtr", complex.outer.base_qualifier, {}};
200 } 200 }
201 } 201 }
202 ,{"list", nullptr, nullptr, [&] 202 ,{"list", nullptr, nullptr, [&]
203 { 203 {
204 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 204 return regular_type_def{"System.IntPtr", complex.outer.base_qualifier, {}};
205 } 205 }
206 } 206 }
207 ,{"hash", nullptr, nullptr, [&] 207 ,{"hash", nullptr, nullptr, [&]
208 { 208 {
209 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 209 return regular_type_def{"System.IntPtr", complex.outer.base_qualifier, {}};
210 } 210 }
211 } 211 }
212 ,{"iterator", nullptr, nullptr, [&] 212 ,{"iterator", nullptr, nullptr, [&]
213 { 213 {
214 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 214 return regular_type_def{"System.IntPtr", complex.outer.base_qualifier, {}};
215 } 215 }
216 } 216 }
217 ,{"accessor", nullptr, nullptr, [&] 217 ,{"accessor", nullptr, nullptr, [&]
218 { 218 {
219 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 219 return regular_type_def{"System.IntPtr", complex.outer.base_qualifier, {}};
220 } 220 }
221 } 221 }
222 }; 222 };
diff --git a/src/bin/eolian_mono/eolian/mono/type_impl.hh b/src/bin/eolian_mono/eolian/mono/type_impl.hh
index f34c4796ec..f888f2573c 100644
--- a/src/bin/eolian_mono/eolian/mono/type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/type_impl.hh
@@ -26,10 +26,10 @@ attributes::regular_type_def replace_base_integer(attributes::regular_type_def v
26 bool s = std::is_signed<T>::value; 26 bool s = std::is_signed<T>::value;
27 switch (sizeof(T)) 27 switch (sizeof(T))
28 { 28 {
29 case 1: return s ? replace_base_type(v, " sbyte") : replace_base_type(v, " byte"); 29 case 1: return s ? replace_base_type(v, "sbyte") : replace_base_type(v, "byte");
30 case 2: return s ? replace_base_type(v, " short") : replace_base_type(v, " ushort"); 30 case 2: return s ? replace_base_type(v, "short") : replace_base_type(v, "ushort");
31 case 4: return s ? replace_base_type(v, " int") : replace_base_type(v, " uint"); 31 case 4: return s ? replace_base_type(v, "int") : replace_base_type(v, "uint");
32 case 8: return s ? replace_base_type(v, " long") : replace_base_type(v, " ulong"); 32 case 8: return s ? replace_base_type(v, "long") : replace_base_type(v, "ulong");
33 default: return v; 33 default: return v;
34 } 34 }
35} 35}
@@ -40,10 +40,10 @@ attributes::regular_type_def replace_base_opt_integer(attributes::regular_type_d
40 bool s = std::is_signed<T>::value; 40 bool s = std::is_signed<T>::value;
41 switch (sizeof(T)) 41 switch (sizeof(T))
42 { 42 {
43 case 1: return s ? replace_base_type(v, " sbyte?") : replace_base_type(v, " byte?"); 43 case 1: return s ? replace_base_type(v, "sbyte?") : replace_base_type(v, "byte?");
44 case 2: return s ? replace_base_type(v, " short?") : replace_base_type(v, " ushort?"); 44 case 2: return s ? replace_base_type(v, "short?") : replace_base_type(v, "ushort?");
45 case 4: return s ? replace_base_type(v, " int?") : replace_base_type(v, " uint?"); 45 case 4: return s ? replace_base_type(v, "int?") : replace_base_type(v, "uint?");
46 case 8: return s ? replace_base_type(v, " long?") : replace_base_type(v, " ulong?"); 46 case 8: return s ? replace_base_type(v, "long?") : replace_base_type(v, "ulong?");
47 default: return v; 47 default: return v;
48 } 48 }
49} 49}
@@ -67,7 +67,29 @@ eina::optional<bool> call_match(Array const (&array)[N], F f, A a)
67 } 67 }
68 return {nullptr}; 68 return {nullptr};
69} 69}
70 70
71template <typename OutputIterator, typename Context>
72struct visitor_regular_type_def_printer
73{
74 typedef visitor_regular_type_def_printer visitor_type;
75 typedef bool result_type;
76
77 mutable OutputIterator sink;
78 Context const* context;
79
80 bool operator()(grammar::attributes::regular_type_def const &regular) const
81 {
82 std::string full_type_name = name_helpers::type_full_eolian_name(regular);
83 return as_generator(string).generate(sink, name_helpers::type_full_managed_name(regular), *context);
84 }
85
86 template<typename T>
87 bool operator()(T const&) const
88 {
89 return true;
90 }
91};
92
71template <typename OutputIterator, typename Context> 93template <typename OutputIterator, typename Context>
72struct visitor_generate 94struct visitor_generate
73{ 95{
@@ -94,110 +116,110 @@ struct visitor_generate
94 const optional_match_table[] = 116 const optional_match_table[] =
95 { 117 {
96 // signed primitives 118 // signed primitives
97 {"byte", nullptr, [&] { return replace_base_type(regular, " sbyte?"); }} 119 {"byte", nullptr, [&] { return replace_base_type(regular, "sbyte?"); }}
98 , {"float", nullptr, [&] { return replace_base_type(regular, " float?"); }} 120 , {"float", nullptr, [&] { return replace_base_type(regular, "float?"); }}
99 , {"double", nullptr, [&] { return replace_base_type(regular, " double?"); }} 121 , {"double", nullptr, [&] { return replace_base_type(regular, "double?"); }}
100 , {"bool", nullptr, [&] { return replace_base_type(regular, " bool?"); }} 122 , {"bool", nullptr, [&] { return replace_base_type(regular, "bool?"); }}
101 , {"short", nullptr, [&] { return replace_base_opt_integer<short>(regular); }} 123 , {"short", nullptr, [&] { return replace_base_opt_integer<short>(regular); }}
102 , {"int", nullptr, [&] { return replace_base_opt_integer<int>(regular); }} 124 , {"int", nullptr, [&] { return replace_base_opt_integer<int>(regular); }}
103 , {"long", nullptr, [&] { return replace_base_opt_integer<long>(regular); }} 125 , {"long", nullptr, [&] { return replace_base_opt_integer<long>(regular); }}
104 , {"llong", nullptr, [&] { return replace_base_opt_integer<long long>(regular); }} 126 , {"llong", nullptr, [&] { return replace_base_opt_integer<long long>(regular); }}
105 , {"int8", nullptr, [&] { return replace_base_type(regular, " sbyte?"); }} 127 , {"int8", nullptr, [&] { return replace_base_type(regular, "sbyte?"); }}
106 , {"int16", nullptr, [&] { return replace_base_type(regular, " short?"); }} 128 , {"int16", nullptr, [&] { return replace_base_type(regular, "short?"); }}
107 , {"int32", nullptr, [&] { return replace_base_type(regular, " int?"); }} 129 , {"int32", nullptr, [&] { return replace_base_type(regular, "int?"); }}
108 , {"int64", nullptr, [&] { return replace_base_type(regular, " long?"); }} 130 , {"int64", nullptr, [&] { return replace_base_type(regular, "long?"); }}
109 , {"ssize", nullptr, [&] { return replace_base_opt_integer<ssize_t>(regular); }} 131 , {"ssize", nullptr, [&] { return replace_base_opt_integer<ssize_t>(regular); }}
110 // unsigned primitives 132 // unsigned primitives
111 , {"ubyte", nullptr, [&] { return replace_base_type(regular, " byte?"); }} 133 , {"ubyte", nullptr, [&] { return replace_base_type(regular, "byte?"); }}
112 , {"ushort", nullptr, [&] { return replace_base_opt_integer<unsigned short>(regular); }} 134 , {"ushort", nullptr, [&] { return replace_base_opt_integer<unsigned short>(regular); }}
113 , {"uint", nullptr, [&] { return replace_base_opt_integer<unsigned int>(regular); }} 135 , {"uint", nullptr, [&] { return replace_base_opt_integer<unsigned int>(regular); }}
114 , {"ulong", nullptr, [&] { return replace_base_opt_integer<unsigned long>(regular); }} 136 , {"ulong", nullptr, [&] { return replace_base_opt_integer<unsigned long>(regular); }}
115 , {"ullong", nullptr, [&] { return replace_base_opt_integer<unsigned long long>(regular); }} 137 , {"ullong", nullptr, [&] { return replace_base_opt_integer<unsigned long long>(regular); }}
116 , {"uint8", nullptr, [&] { return replace_base_type(regular, " byte?"); }} 138 , {"uint8", nullptr, [&] { return replace_base_type(regular, "byte?"); }}
117 , {"uint16", nullptr, [&] { return replace_base_type(regular, " ushort?"); }} 139 , {"uint16", nullptr, [&] { return replace_base_type(regular, "ushort?"); }}
118 , {"uint32", nullptr, [&] { return replace_base_type(regular, " uint?"); }} 140 , {"uint32", nullptr, [&] { return replace_base_type(regular, "uint?"); }}
119 , {"uint64", nullptr, [&] { return replace_base_type(regular, " ulong?"); }} 141 , {"uint64", nullptr, [&] { return replace_base_type(regular, "ulong?"); }}
120 , {"size", nullptr, [&] { return replace_base_opt_integer<size_t>(regular); }} 142 , {"size", nullptr, [&] { return replace_base_opt_integer<size_t>(regular); }}
121 143
122 , {"ptrdiff", nullptr, [&] { return replace_base_opt_integer<ptrdiff_t>(regular); }} 144 , {"ptrdiff", nullptr, [&] { return replace_base_opt_integer<ptrdiff_t>(regular); }}
123 , {"intptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr?"); }} 145 , {"intptr", nullptr, [&] { return replace_base_type(regular, "System.IntPtr?"); }}
124 , {"uintptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr?"); }} 146 , {"uintptr", nullptr, [&] { return replace_base_type(regular, "System.IntPtr?"); }}
125 , {"void_ptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr?"); }} 147 , {"void_ptr", nullptr, [&] { return replace_base_type(regular, "System.IntPtr?"); }}
126 }; 148 };
127 struct match 149 struct match
128 const match_table[] = 150 const match_table[] =
129 { 151 {
130 // signed primitives 152 // signed primitives
131 {"byte", nullptr, [&] { return replace_base_type(regular, " sbyte"); }} 153 {"byte", nullptr, [&] { return replace_base_type(regular, "sbyte"); }}
132 , {"short", nullptr, [&] { return replace_base_integer<short>(regular); }} 154 , {"short", nullptr, [&] { return replace_base_integer<short>(regular); }}
133 , {"int", nullptr, [&] { return replace_base_integer<int>(regular); }} 155 , {"int", nullptr, [&] { return replace_base_integer<int>(regular); }}
134 , {"long", nullptr, [&] { return replace_base_integer<long>(regular); }} 156 , {"long", nullptr, [&] { return replace_base_integer<long>(regular); }}
135 , {"llong", nullptr, [&] { return replace_base_integer<long long>(regular); }} 157 , {"llong", nullptr, [&] { return replace_base_integer<long long>(regular); }}
136 , {"int8", nullptr, [&] { return replace_base_type(regular, " sbyte"); }} 158 , {"int8", nullptr, [&] { return replace_base_type(regular, "sbyte"); }}
137 , {"int16", nullptr, [&] { return replace_base_type(regular, " short"); }} 159 , {"int16", nullptr, [&] { return replace_base_type(regular, "short"); }}
138 , {"int32", nullptr, [&] { return replace_base_type(regular, " int"); }} 160 , {"int32", nullptr, [&] { return replace_base_type(regular, "int"); }}
139 , {"int64", nullptr, [&] { return replace_base_type(regular, " long"); }} 161 , {"int64", nullptr, [&] { return replace_base_type(regular, "long"); }}
140 , {"ssize", nullptr, [&] { return replace_base_integer<ssize_t>(regular); }} 162 , {"ssize", nullptr, [&] { return replace_base_integer<ssize_t>(regular); }}
141 // unsigned primitives 163 // unsigned primitives
142 , {"ubyte", nullptr, [&] { return replace_base_type(regular, " byte"); }} 164 , {"ubyte", nullptr, [&] { return replace_base_type(regular, "byte"); }}
143 , {"ushort", nullptr, [&] { return replace_base_integer<unsigned short>(regular); }} 165 , {"ushort", nullptr, [&] { return replace_base_integer<unsigned short>(regular); }}
144 , {"uint", nullptr, [&] { return replace_base_integer<unsigned int>(regular); }} 166 , {"uint", nullptr, [&] { return replace_base_integer<unsigned int>(regular); }}
145 , {"ulong", nullptr, [&] { return replace_base_integer<unsigned long>(regular); }} 167 , {"ulong", nullptr, [&] { return replace_base_integer<unsigned long>(regular); }}
146 , {"ullong", nullptr, [&] { return replace_base_integer<unsigned long long>(regular); }} 168 , {"ullong", nullptr, [&] { return replace_base_integer<unsigned long long>(regular); }}
147 , {"uint8", nullptr, [&] { return replace_base_type(regular, " byte"); }} 169 , {"uint8", nullptr, [&] { return replace_base_type(regular, "byte"); }}
148 , {"uint16", nullptr, [&] { return replace_base_type(regular, " ushort"); }} 170 , {"uint16", nullptr, [&] { return replace_base_type(regular, "ushort"); }}
149 , {"uint32", nullptr, [&] { return replace_base_type(regular, " uint"); }} 171 , {"uint32", nullptr, [&] { return replace_base_type(regular, "uint"); }}
150 , {"uint64", nullptr, [&] { return replace_base_type(regular, " ulong"); }} 172 , {"uint64", nullptr, [&] { return replace_base_type(regular, "ulong"); }}
151 , {"size", nullptr, [&] { return replace_base_integer<size_t>(regular); }} 173 , {"size", nullptr, [&] { return replace_base_integer<size_t>(regular); }}
152 174
153 , {"ptrdiff", nullptr, [&] { return replace_base_integer<ptrdiff_t>(regular); }} 175 , {"ptrdiff", nullptr, [&] { return replace_base_integer<ptrdiff_t>(regular); }}
154 , {"intptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr"); }} 176 , {"intptr", nullptr, [&] { return replace_base_type(regular, "System.IntPtr"); }}
155 , {"uintptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr"); }} 177 , {"uintptr", nullptr, [&] { return replace_base_type(regular, "System.IntPtr"); }}
156 , {"void_ptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr"); }} 178 , {"void_ptr", nullptr, [&] { return replace_base_type(regular, "System.IntPtr"); }}
157 , {"void", nullptr, [&] 179 , {"void", nullptr, [&]
158 { 180 {
159 regular_type_def r = regular; 181 regular_type_def r = regular;
160 r.namespaces.clear(); 182 r.namespaces.clear();
161 if (is_out) // @inout too 183 if (is_out) // @inout too
162 r.base_type = " System.IntPtr"; 184 r.base_type = "System.IntPtr";
163 else 185 else
164 r.base_type = " void"; 186 r.base_type = "void";
165 return r; 187 return r;
166 }} 188 }}
167 , {"Eina.Error", nullptr, [&] // Eina.Error 189 , {"Eina.Error", nullptr, [&] // Eina.Error
168 { 190 {
169 return regular_type_def{" Eina.Error", regular.base_qualifier, {}}; 191 return regular_type_def{"Eina.Error", regular.base_qualifier, {}};
170 }} // TODO 192 }} // TODO
171 , {"string", nullptr, [&] 193 , {"string", nullptr, [&]
172 { 194 {
173 regular_type_def r = regular; 195 regular_type_def r = regular;
174 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 196 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
175 return replace_base_type(r, " System.String"); 197 return replace_base_type(r, "System.String");
176 }} 198 }}
177 , {"mstring", nullptr, [&] 199 , {"mstring", nullptr, [&]
178 { 200 {
179 regular_type_def r = regular; 201 regular_type_def r = regular;
180 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 202 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
181 return replace_base_type(r, " System.String"); 203 return replace_base_type(r, "System.String");
182 }} 204 }}
183 , {"stringshare", nullptr, [&] 205 , {"stringshare", nullptr, [&]
184 { 206 {
185 regular_type_def r = regular; 207 regular_type_def r = regular;
186 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 208 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
187 return replace_base_type(r, " System.String"); 209 return replace_base_type(r, "System.String");
188 }} 210 }}
189 , {"strbuf", nullptr, [&] 211 , {"strbuf", nullptr, [&]
190 { 212 {
191 return regular_type_def{" Eina.Strbuf", regular.base_qualifier, {}}; 213 return regular_type_def{"Eina.Strbuf", regular.base_qualifier, {}};
192 }} 214 }}
193 , {"any_value", true, [&] 215 , {"any_value", true, [&]
194 { return regular_type_def{" Eina.Value", regular.base_qualifier, {}}; 216 { return regular_type_def{"Eina.Value", regular.base_qualifier, {}};
195 }} 217 }}
196 , {"any_value", false, [&] 218 , {"any_value", false, [&]
197 { return regular_type_def{" Eina.Value", regular.base_qualifier, {}}; 219 { return regular_type_def{"Eina.Value", regular.base_qualifier, {}};
198 }} 220 }}
199 , {"any_value_ptr", nullptr, [&] 221 , {"any_value_ptr", nullptr, [&]
200 { return regular_type_def{" Eina.Value", regular.base_qualifier, {}}; 222 { return regular_type_def{"Eina.Value", regular.base_qualifier, {}};
201 }} // FIXME add proper support for any_value_ptr 223 }} // FIXME add proper support for any_value_ptr
202 }; 224 };
203 std::string full_type_name = name_helpers::type_full_eolian_name(regular); 225 std::string full_type_name = name_helpers::type_full_eolian_name(regular);
@@ -234,7 +256,7 @@ struct visitor_generate
234 } 256 }
235 , [&] (attributes::type_def::variant_type const& v) 257 , [&] (attributes::type_def::variant_type const& v)
236 { 258 {
237 return v.visit(*this); // we want to keep is_out info 259 return v.visit(visitor_regular_type_def_printer<OutputIterator, Context>{sink, context}); // we want to keep is_out info
238 })) 260 }))
239 { 261 {
240 return *b; 262 return *b;