summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-07-23 14:09:23 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-07-23 14:09:24 +0200
commit253e18159bbc601972cad4b3b42bbbe23cbf390d (patch)
tree26007723987fd24dac59d489a5f6ebcfcfcf8329
parent8c90deecd737cf025ce1c3162e50937639c30f09 (diff)
eolian_mono: parse `binbuf` and `event` keywords, also re-enable binbuf tests
Summary: Parse `binbuf` and `event` type names and generate the proper binding type. In 288f645e3cdb tests for `Eina.Binbuf` were disabled in order to avoid the usage of deprecated notations in eolian. Since the new `binbuf` keyword works as a substitute for the old notation `ptr(Eina.Binbuf)`, tests were updated and re-enabled using the new notation. Test Plan: `meson test` Reviewers: felipealmeida, lauromoura, q66 Reviewed By: q66 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9349
-rw-r--r--src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh14
-rw-r--r--src/bin/eolian_mono/eolian/mono/type_impl.hh8
-rw-r--r--src/tests/efl_mono/Eina.cs2
-rw-r--r--src/tests/efl_mono/EinaTestData.cs2
-rw-r--r--src/tests/efl_mono/StructHelpers.cs10
-rw-r--r--src/tests/efl_mono/dummy_test_object.c8
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo28
7 files changed, 42 insertions, 30 deletions
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 ce16c9a374..8de109e88b 100644
--- a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
@@ -103,6 +103,20 @@ struct marshall_type_visitor_generate
103 r.namespaces.clear(); 103 r.namespaces.clear();
104 return r; 104 return r;
105 }} 105 }}
106 , {"binbuf", nullptr, [&]
107 {
108 regular_type_def r = regular;
109 r.base_type = "System.IntPtr";
110 r.namespaces.clear();
111 return r;
112 }}
113 , {"event", nullptr, [&]
114 {
115 regular_type_def r = regular;
116 r.base_type = "Efl.Event.NativeStruct";
117 r.namespaces.clear();
118 return r;
119 }}
106 , {"any_value", true, [&] 120 , {"any_value", true, [&]
107 { 121 {
108 regular_type_def r = regular; 122 regular_type_def r = regular;
diff --git a/src/bin/eolian_mono/eolian/mono/type_impl.hh b/src/bin/eolian_mono/eolian/mono/type_impl.hh
index abfa6e9db6..7e5159fc26 100644
--- a/src/bin/eolian_mono/eolian/mono/type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/type_impl.hh
@@ -214,6 +214,14 @@ struct visitor_generate
214 { 214 {
215 return regular_type_def{"Eina.Strbuf", regular.base_qualifier, {}}; 215 return regular_type_def{"Eina.Strbuf", regular.base_qualifier, {}};
216 }} 216 }}
217 , {"binbuf", nullptr, [&]
218 {
219 return regular_type_def{"Eina.Binbuf", regular.base_qualifier, {}};
220 }}
221 , {"event", nullptr, [&]
222 {
223 return regular_type_def{"Efl.Event", regular.base_qualifier, {}};
224 }}
217 , {"any_value", true, [&] 225 , {"any_value", true, [&]
218 { return regular_type_def{"Eina.Value", regular.base_qualifier, {}}; 226 { return regular_type_def{"Eina.Value", regular.base_qualifier, {}};
219 }} 227 }}
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index 2c22cdb444..d71d6c8f7f 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -12,7 +12,6 @@ namespace TestSuite
12 12
13#if EFL_BETA 13#if EFL_BETA
14 14
15/*
16class TestEinaBinbuf 15class TestEinaBinbuf
17{ 16{
18 private static readonly byte[] test_string = System.Text.Encoding.UTF8.GetBytes("0123456789ABCDEF"); 17 private static readonly byte[] test_string = System.Text.Encoding.UTF8.GetBytes("0123456789ABCDEF");
@@ -309,7 +308,6 @@ class TestEinaBinbuf
309 Test.Assert(t.binbuf_return_own_no_longer_own()); 308 Test.Assert(t.binbuf_return_own_no_longer_own());
310 } 309 }
311} 310}
312*/
313 311
314#endif 312#endif
315 313
diff --git a/src/tests/efl_mono/EinaTestData.cs b/src/tests/efl_mono/EinaTestData.cs
index 0e5d4bb5a1..81b318ffae 100644
--- a/src/tests/efl_mono/EinaTestData.cs
+++ b/src/tests/efl_mono/EinaTestData.cs
@@ -153,7 +153,6 @@ class NativeInheritImpl : Dummy.TestObject
153 // // 153 // //
154 // 154 //
155#if EFL_BETA 155#if EFL_BETA
156/*
157 override public bool EinaBinbufIn(Eina.Binbuf binbuf) 156 override public bool EinaBinbufIn(Eina.Binbuf binbuf)
158 { 157 {
159 binbuf_in_flag = true; 158 binbuf_in_flag = true;
@@ -282,7 +281,6 @@ class NativeInheritImpl : Dummy.TestObject
282 binbuf_return_own_binbuf = null; 281 binbuf_return_own_binbuf = null;
283 return r; 282 return r;
284 } 283 }
285*/
286#endif 284#endif
287} 285}
288 286
diff --git a/src/tests/efl_mono/StructHelpers.cs b/src/tests/efl_mono/StructHelpers.cs
index 088e613f73..110432f08f 100644
--- a/src/tests/efl_mono/StructHelpers.cs
+++ b/src/tests/efl_mono/StructHelpers.cs
@@ -148,8 +148,8 @@ internal class StructHelpers
148 complex.Fany_value_ptr = new Eina.Value(Eina.ValueType.String); 148 complex.Fany_value_ptr = new Eina.Value(Eina.ValueType.String);
149 complex.Fany_value_ptr.Set("abc"); 149 complex.Fany_value_ptr.Set("abc");
150 150
151 //complex.Fbinbuf = new Eina.Binbuf(); 151 complex.Fbinbuf = new Eina.Binbuf();
152 //complex.Fbinbuf.Append(126); 152 complex.Fbinbuf.Append(126);
153 153
154 complex.Fslice.Length = 1; 154 complex.Fslice.Length = 1;
155 complex.Fslice.Mem = Eina.MemoryNative.Alloc(1); 155 complex.Fslice.Mem = Eina.MemoryNative.Alloc(1);
@@ -187,8 +187,8 @@ internal class StructHelpers
187 Test.Assert(complex.Fany_value_ptr.Get(out str_val)); 187 Test.Assert(complex.Fany_value_ptr.Get(out str_val));
188 Test.Assert(str_val == "abc"); 188 Test.Assert(str_val == "abc");
189 189
190 //Test.Assert(complex.Fbinbuf.Length == 1); 190 Test.Assert(complex.Fbinbuf.Length == 1);
191 //Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126); 191 Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
192 192
193 Test.Assert(complex.Fslice.Length == 1); 193 Test.Assert(complex.Fslice.Length == 1);
194 Test.Assert(complex.Fslice.GetBytes()[0] == 125); 194 Test.Assert(complex.Fslice.GetBytes()[0] == 125);
@@ -206,7 +206,7 @@ internal class StructHelpers
206 Test.Assert(complex.Fiterator == null); 206 Test.Assert(complex.Fiterator == null);
207 Test.Assert(complex.Fany_value == null); 207 Test.Assert(complex.Fany_value == null);
208 Test.Assert(complex.Fany_value_ptr == null); 208 Test.Assert(complex.Fany_value_ptr == null);
209 //Test.Assert(complex.Fbinbuf == null); 209 Test.Assert(complex.Fbinbuf == null);
210 210
211 Test.Assert(complex.Fslice.Length == 0); 211 Test.Assert(complex.Fslice.Length == 0);
212 Test.Assert(complex.Fslice.Mem == IntPtr.Zero); 212 Test.Assert(complex.Fslice.Mem == IntPtr.Zero);
diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c
index 1a1def6ff6..e6bec29362 100644
--- a/src/tests/efl_mono/dummy_test_object.c
+++ b/src/tests/efl_mono/dummy_test_object.c
@@ -347,7 +347,6 @@ Eina_Rw_Slice _dummy_test_object_eina_rw_slice_return(EINA_UNUSED Eo *obj, EINA_
347 return slc; 347 return slc;
348} 348}
349 349
350#if 0
351Eina_Bool _dummy_test_object_eina_binbuf_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Binbuf *binbuf) 350Eina_Bool _dummy_test_object_eina_binbuf_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Binbuf *binbuf)
352{ 351{
353 Eina_Bool r = (0 == memcmp(eina_binbuf_string_get(binbuf), base_seq, eina_binbuf_length_get(binbuf))); 352 Eina_Bool r = (0 == memcmp(eina_binbuf_string_get(binbuf), base_seq, eina_binbuf_length_get(binbuf)));
@@ -459,7 +458,6 @@ Eina_Binbuf *_dummy_test_object_call_eina_binbuf_return_own(Eo *obj, EINA_UNUSED
459{ 458{
460 return dummy_test_object_eina_binbuf_return_own(obj); 459 return dummy_test_object_eina_binbuf_return_own(obj);
461} 460}
462#endif
463 461
464 462
465static const int base_seq_int[] = {0x0,0x2A,0x42}; 463static const int base_seq_int[] = {0x0,0x2A,0x42};
@@ -4118,8 +4116,8 @@ void struct_complex_with_values(Dummy_StructComplex *complex)
4118 complex->fany_value_ptr = eina_value_new(EINA_VALUE_TYPE_STRING); 4116 complex->fany_value_ptr = eina_value_new(EINA_VALUE_TYPE_STRING);
4119 eina_value_set(complex->fany_value_ptr, "abc"); 4117 eina_value_set(complex->fany_value_ptr, "abc");
4120 4118
4121 //complex->fbinbuf = eina_binbuf_new(); 4119 complex->fbinbuf = eina_binbuf_new();
4122 //eina_binbuf_append_char(complex->fbinbuf, 126); 4120 eina_binbuf_append_char(complex->fbinbuf, 126);
4123 4121
4124 complex->fslice.len = 1; 4122 complex->fslice.len = 1;
4125 complex->fslice.mem = malloc(1); 4123 complex->fslice.mem = malloc(1);
@@ -4153,10 +4151,8 @@ Eina_Bool check_and_modify_struct_complex(Dummy_StructComplex *complex)
4153 if (!eina_value_get(complex->fany_value_ptr, &str_val) || strcmp(str_val, "abc") != 0) 4151 if (!eina_value_get(complex->fany_value_ptr, &str_val) || strcmp(str_val, "abc") != 0)
4154 return EINA_FALSE; 4152 return EINA_FALSE;
4155 4153
4156 /*
4157 if (eina_binbuf_length_get(complex->fbinbuf) != 1 || eina_binbuf_string_get(complex->fbinbuf)[0] != 126) 4154 if (eina_binbuf_length_get(complex->fbinbuf) != 1 || eina_binbuf_string_get(complex->fbinbuf)[0] != 126)
4158 return EINA_FALSE; 4155 return EINA_FALSE;
4159 */
4160 4156
4161 if (complex->fslice.len != 1 || *(char*)complex->fslice.mem != 125) 4157 if (complex->fslice.len != 1 || *(char*)complex->fslice.mem != 125)
4162 return EINA_FALSE; 4158 return EINA_FALSE;
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index 005431dd6e..97b7cf6641 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -81,7 +81,7 @@ struct @beta @free(free) Dummy.StructComplex {
81 fiterator: iterator<string>; 81 fiterator: iterator<string>;
82 fany_value: any_value; 82 fany_value: any_value;
83 fany_value_ptr: any_value_ptr; 83 fany_value_ptr: any_value_ptr;
84 // fbinbuf: ptr(Eina.Binbuf); 84 fbinbuf: binbuf;
85 fslice: slice<ubyte>; 85 fslice: slice<ubyte>;
86 // fslice: ptr(Eina.Slice); // TODO 86 // fslice: ptr(Eina.Slice); // TODO
87 fobj: Dummy.Numberwrapper; 87 fobj: Dummy.Numberwrapper;
@@ -298,31 +298,30 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
298 } 298 }
299 */ 299 */
300 300
301 /*
302 eina_binbuf_in @beta { 301 eina_binbuf_in @beta {
303 params { 302 params {
304 @in binbuf: ptr(Eina.Binbuf); 303 @in binbuf: binbuf;
305 } 304 }
306 return: bool; 305 return: bool;
307 } 306 }
308 307
309 call_eina_binbuf_in @beta { 308 call_eina_binbuf_in @beta {
310 params { 309 params {
311 @in binbuf: ptr(Eina.Binbuf); 310 @in binbuf: binbuf;
312 } 311 }
313 return: bool; 312 return: bool;
314 } 313 }
315 314
316 eina_binbuf_in_own @beta { 315 eina_binbuf_in_own @beta {
317 params { 316 params {
318 @in binbuf: ptr(Eina.Binbuf) @owned; 317 @in binbuf: binbuf @owned;
319 } 318 }
320 return: bool; 319 return: bool;
321 } 320 }
322 321
323 call_eina_binbuf_in_own @beta { 322 call_eina_binbuf_in_own @beta {
324 params { 323 params {
325 @in str: ptr(Eina.Binbuf) @owned; 324 @in str: binbuf @owned;
326 } 325 }
327 return: bool; 326 return: bool;
328 } 327 }
@@ -333,13 +332,13 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
333 332
334 eina_binbuf_out @beta { 333 eina_binbuf_out @beta {
335 params { 334 params {
336 @out binbuf: ptr(Eina.Binbuf); 335 @out binbuf: binbuf;
337 } 336 }
338 return: bool; 337 return: bool;
339 } 338 }
340 339
341 call_eina_binbuf_out @beta { 340 call_eina_binbuf_out @beta {
342 return: ptr(Eina.Binbuf); 341 return: binbuf;
343 } 342 }
344 343
345 check_binbuf_out { 344 check_binbuf_out {
@@ -348,21 +347,21 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
348 347
349 eina_binbuf_out_own @beta { 348 eina_binbuf_out_own @beta {
350 params { 349 params {
351 @out binbuf: ptr(Eina.Binbuf) @owned; 350 @out binbuf: binbuf @owned;
352 } 351 }
353 return: bool; 352 return: bool;
354 } 353 }
355 354
356 call_eina_binbuf_out_own @beta { 355 call_eina_binbuf_out_own @beta {
357 return: ptr(Eina.Binbuf) @owned; 356 return: binbuf @owned;
358 } 357 }
359 358
360 eina_binbuf_return @beta { 359 eina_binbuf_return @beta {
361 return: ptr(Eina.Binbuf); 360 return: binbuf;
362 } 361 }
363 362
364 call_eina_binbuf_return @beta { 363 call_eina_binbuf_return @beta {
365 return: ptr(Eina.Binbuf); 364 return: binbuf;
366 } 365 }
367 366
368 check_binbuf_return { 367 check_binbuf_return {
@@ -370,13 +369,12 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
370 } 369 }
371 370
372 eina_binbuf_return_own @beta { 371 eina_binbuf_return_own @beta {
373 return: ptr(Eina.Binbuf) @owned; 372 return: binbuf @owned;
374 } 373 }
375 374
376 call_eina_binbuf_return_own @beta { 375 call_eina_binbuf_return_own @beta {
377 return: ptr(Eina.Binbuf) @owned; 376 return: binbuf @owned;
378 } 377 }
379 */
380 378
381 /* Eina Array */ 379 /* Eina Array */
382 380