q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=253e18159bbc601972cad4b3b42bbbe23cbf390d

commit 253e18159bbc601972cad4b3b42bbbe23cbf390d
Author: Vitor Sousa <vitorso...@expertisesolutions.com.br>
Date:   Tue Jul 23 14:09:23 2019 +0200

    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
---
 .../eolian_mono/eolian/mono/marshall_type_impl.hh  | 14 +++++++++++
 src/bin/eolian_mono/eolian/mono/type_impl.hh       |  8 +++++++
 src/tests/efl_mono/Eina.cs                         |  2 --
 src/tests/efl_mono/EinaTestData.cs                 |  2 --
 src/tests/efl_mono/StructHelpers.cs                | 10 ++++----
 src/tests/efl_mono/dummy_test_object.c             |  8 ++-----
 src/tests/efl_mono/dummy_test_object.eo            | 28 ++++++++++------------
 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
                 r.namespaces.clear();
                 return r;
               }}
+           , {"binbuf", nullptr, [&]
+              {
+                regular_type_def r = regular;
+                r.base_type = "System.IntPtr";
+                r.namespaces.clear();
+                return r;
+              }}
+           , {"event", nullptr, [&]
+              {
+                regular_type_def r = regular;
+                r.base_type = "Efl.Event.NativeStruct";
+                r.namespaces.clear();
+                return r;
+              }}
            , {"any_value", true, [&]
                {
                 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
               {
                 return regular_type_def{"Eina.Strbuf", regular.base_qualifier, 
{}};
               }}
+           , {"binbuf", nullptr, [&]
+              {
+                return regular_type_def{"Eina.Binbuf", regular.base_qualifier, 
{}};
+              }}
+           , {"event", nullptr, [&]
+              {
+                return regular_type_def{"Efl.Event", regular.base_qualifier, 
{}};
+              }}
            , {"any_value", true, [&]
               { return regular_type_def{"Eina.Value", regular.base_qualifier, 
{}};
               }}
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
 
 #if EFL_BETA
 
-/*
 class TestEinaBinbuf
 {
     private static readonly byte[] test_string = 
System.Text.Encoding.UTF8.GetBytes("0123456789ABCDEF");
@@ -309,7 +308,6 @@ class TestEinaBinbuf
         Test.Assert(t.binbuf_return_own_no_longer_own());
     }
 }
-*/
 
 #endif
 
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
     // //
     //
 #if EFL_BETA
-/*
     override public bool EinaBinbufIn(Eina.Binbuf binbuf)
     {
         binbuf_in_flag = true;
@@ -282,7 +281,6 @@ class NativeInheritImpl : Dummy.TestObject
         binbuf_return_own_binbuf = null;
         return r;
     }
-*/
 #endif
 }
 
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
         complex.Fany_value_ptr = new Eina.Value(Eina.ValueType.String);
         complex.Fany_value_ptr.Set("abc");
 
-        //complex.Fbinbuf = new Eina.Binbuf();
-        //complex.Fbinbuf.Append(126);
+        complex.Fbinbuf = new Eina.Binbuf();
+        complex.Fbinbuf.Append(126);
 
         complex.Fslice.Length = 1;
         complex.Fslice.Mem = Eina.MemoryNative.Alloc(1);
@@ -187,8 +187,8 @@ internal class StructHelpers
         Test.Assert(complex.Fany_value_ptr.Get(out str_val));
         Test.Assert(str_val == "abc");
 
-        //Test.Assert(complex.Fbinbuf.Length == 1);
-        //Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
+        Test.Assert(complex.Fbinbuf.Length == 1);
+        Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);
 
         Test.Assert(complex.Fslice.Length == 1);
         Test.Assert(complex.Fslice.GetBytes()[0] == 125);
@@ -206,7 +206,7 @@ internal class StructHelpers
         Test.Assert(complex.Fiterator == null);
         Test.Assert(complex.Fany_value == null);
         Test.Assert(complex.Fany_value_ptr == null);
-        //Test.Assert(complex.Fbinbuf == null);
+        Test.Assert(complex.Fbinbuf == null);
 
         Test.Assert(complex.Fslice.Length == 0);
         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_
   return slc;
 }
 
-#if 0
 Eina_Bool _dummy_test_object_eina_binbuf_in(EINA_UNUSED Eo *obj, EINA_UNUSED 
Dummy_Test_Object_Data *pd, Eina_Binbuf *binbuf)
 {
   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
 {
   return dummy_test_object_eina_binbuf_return_own(obj);
 }
-#endif
 
 
 static const int base_seq_int[] = {0x0,0x2A,0x42};
@@ -4118,8 +4116,8 @@ void struct_complex_with_values(Dummy_StructComplex 
*complex)
    complex->fany_value_ptr = eina_value_new(EINA_VALUE_TYPE_STRING);
    eina_value_set(complex->fany_value_ptr, "abc");
 
-   //complex->fbinbuf = eina_binbuf_new();
-   //eina_binbuf_append_char(complex->fbinbuf, 126);
+   complex->fbinbuf = eina_binbuf_new();
+   eina_binbuf_append_char(complex->fbinbuf, 126);
 
    complex->fslice.len = 1;
    complex->fslice.mem = malloc(1);
@@ -4153,10 +4151,8 @@ Eina_Bool 
check_and_modify_struct_complex(Dummy_StructComplex *complex)
    if (!eina_value_get(complex->fany_value_ptr, &str_val) || strcmp(str_val, 
"abc") != 0)
      return EINA_FALSE;
 
-   /*
    if (eina_binbuf_length_get(complex->fbinbuf) != 1 || 
eina_binbuf_string_get(complex->fbinbuf)[0] != 126)
      return EINA_FALSE;
-   */
 
    if (complex->fslice.len != 1 || *(char*)complex->fslice.mem != 125)
      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 {
    fiterator: iterator<string>;
    fany_value: any_value;
    fany_value_ptr: any_value_ptr;
-   // fbinbuf: ptr(Eina.Binbuf);
+   fbinbuf: binbuf;
    fslice: slice<ubyte>;
    // fslice: ptr(Eina.Slice); // TODO
    fobj: Dummy.Numberwrapper;
@@ -298,31 +298,30 @@ class Dummy.Test_Object extends Efl.Object implements 
Dummy.Test_Iface {
       }
       */
 
-      /*
       eina_binbuf_in @beta {
          params {
-            @in binbuf: ptr(Eina.Binbuf);
+            @in binbuf: binbuf;
          }
          return: bool;
       }
 
       call_eina_binbuf_in @beta {
          params {
-            @in binbuf: ptr(Eina.Binbuf);
+            @in binbuf: binbuf;
          }
          return: bool;
       }
 
       eina_binbuf_in_own @beta {
          params {
-            @in binbuf: ptr(Eina.Binbuf) @owned;
+            @in binbuf: binbuf @owned;
          }
          return: bool;
       }
 
       call_eina_binbuf_in_own @beta {
         params {
-            @in str: ptr(Eina.Binbuf) @owned;
+            @in str: binbuf @owned;
         }
         return: bool;
       }
@@ -333,13 +332,13 @@ class Dummy.Test_Object extends Efl.Object implements 
Dummy.Test_Iface {
 
       eina_binbuf_out @beta {
          params {
-            @out binbuf: ptr(Eina.Binbuf);
+            @out binbuf: binbuf;
          }
          return: bool;
       }
 
       call_eina_binbuf_out @beta {
-         return: ptr(Eina.Binbuf);
+         return: binbuf;
       }
 
       check_binbuf_out {
@@ -348,21 +347,21 @@ class Dummy.Test_Object extends Efl.Object implements 
Dummy.Test_Iface {
 
       eina_binbuf_out_own @beta {
          params {
-            @out binbuf: ptr(Eina.Binbuf) @owned;
+            @out binbuf: binbuf @owned;
          }
          return: bool;
       }
 
       call_eina_binbuf_out_own @beta {
-         return: ptr(Eina.Binbuf) @owned;
+         return: binbuf @owned;
       }
 
       eina_binbuf_return @beta {
-         return: ptr(Eina.Binbuf);
+         return: binbuf;
       }
 
       call_eina_binbuf_return @beta {
-         return: ptr(Eina.Binbuf);
+         return: binbuf;
       }
 
       check_binbuf_return {
@@ -370,13 +369,12 @@ class Dummy.Test_Object extends Efl.Object implements 
Dummy.Test_Iface {
       }
 
       eina_binbuf_return_own @beta {
-         return: ptr(Eina.Binbuf) @owned;
+         return: binbuf @owned;
       }
 
       call_eina_binbuf_return_own @beta {
-         return: ptr(Eina.Binbuf) @owned;
+         return: binbuf @owned;
       }
-      */
 
       /* Eina Array */
 

-- 


Reply via email to