summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2017-06-22 17:48:29 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-07-13 18:34:55 -0300
commitb3d6d544d3a456c84500fd3cfca43dd556da149e (patch)
treef1a087fdd1d6361ab6725711db59f7f242f62cd3
parentb75d14e668b48970e6e51a9abca3a604310924ad (diff)
eolian_mono eina_mono: working version of eina.Inlist (corrections+generation+tests)
Also remove default value for "InPlace" methods in traits. It is only relevant in the caller static function.
-rw-r--r--src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh5
-rw-r--r--src/bin/eolian_mono/eolian/mono/parameter.hh28
-rw-r--r--src/bin/eolian_mono/eolian/mono/type_impl.hh6
-rw-r--r--src/bindings/mono/eina_mono/eina_container_common.cs70
-rw-r--r--src/bindings/mono/eina_mono/eina_inlist.cs146
-rw-r--r--src/lib/efl_mono/efl_custom_exports_mono.c25
-rw-r--r--src/tests/efl_mono/Eina.cs491
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.c462
-rw-r--r--src/tests/efl_mono/test_testing.eo147
9 files changed, 1292 insertions, 88 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 94ce00dbd5..5f2ba17932 100644
--- a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
@@ -142,6 +142,11 @@ struct marshall_type_visitor_generate
142 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 142 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}};
143 } 143 }
144 } 144 }
145 ,{"inlist", nullptr, nullptr, [&]
146 {
147 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}};
148 }
149 }
145 ,{"hash", nullptr, nullptr, [&] 150 ,{"hash", nullptr, nullptr, [&]
146 { 151 {
147 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}}; 152 return regular_type_def{" System.IntPtr", complex.outer.base_qualifier, {}};
diff --git a/src/bin/eolian_mono/eolian/mono/parameter.hh b/src/bin/eolian_mono/eolian/mono/parameter.hh
index c2b7de6e4f..2338a44280 100644
--- a/src/bin/eolian_mono/eolian/mono/parameter.hh
+++ b/src/bin/eolian_mono/eolian/mono/parameter.hh
@@ -244,6 +244,10 @@ inline bool param_should_use_out_var(attributes::parameter_def const& param)
244 || param_is_acceptable(param, "Eina_List *", WANT_OWN, WANT_OUT) 244 || param_is_acceptable(param, "Eina_List *", WANT_OWN, WANT_OUT)
245 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT) 245 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
246 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT) 246 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
247 || param_is_acceptable(param, "Eina_Inlist *", !WANT_OWN, WANT_OUT)
248 || param_is_acceptable(param, "Eina_Inlist *", WANT_OWN, WANT_OUT)
249 || param_is_acceptable(param, "const Eina_Inlist *", !WANT_OWN, WANT_OUT)
250 || param_is_acceptable(param, "const Eina_Inlist *", WANT_OWN, WANT_OUT)
247 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, WANT_OUT) 251 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, WANT_OUT)
248 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, WANT_OUT) 252 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, WANT_OUT)
249 || param_is_acceptable(param, "const Eina_Hash *", !WANT_OWN, WANT_OUT) 253 || param_is_acceptable(param, "const Eina_Hash *", !WANT_OWN, WANT_OUT)
@@ -272,6 +276,10 @@ inline bool param_should_use_in_var(attributes::parameter_def const& param)
272 || param_is_acceptable(param, "Eina_List *", WANT_OWN, !WANT_OUT) 276 || param_is_acceptable(param, "Eina_List *", WANT_OWN, !WANT_OUT)
273 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, !WANT_OUT) 277 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, !WANT_OUT)
274 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, !WANT_OUT) 278 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, !WANT_OUT)
279 || param_is_acceptable(param, "Eina_Inlist *", !WANT_OWN, !WANT_OUT)
280 || param_is_acceptable(param, "Eina_Inlist *", WANT_OWN, !WANT_OUT)
281 || param_is_acceptable(param, "const Eina_Inlist *", !WANT_OWN, !WANT_OUT)
282 || param_is_acceptable(param, "const Eina_Inlist *", WANT_OWN, !WANT_OUT)
275 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, !WANT_OUT) 283 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, !WANT_OUT)
276 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, !WANT_OUT) 284 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, !WANT_OUT)
277 || param_is_acceptable(param, "const Eina_Hash *", !WANT_OWN, !WANT_OUT) 285 || param_is_acceptable(param, "const Eina_Hash *", !WANT_OWN, !WANT_OUT)
@@ -452,6 +460,7 @@ struct native_convert_in_variable_generator
452 else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *" 460 else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *"
453 || param.type.c_type == "Eina_Inarray *" || param.type.c_type == "const Eina_Inarray *" 461 || param.type.c_type == "Eina_Inarray *" || param.type.c_type == "const Eina_Inarray *"
454 || param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *" 462 || param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *"
463 || param.type.c_type == "Eina_Inlist *" || param.type.c_type == "const Eina_Inlist *"
455 ) 464 )
456 { 465 {
457 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type); 466 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type);
@@ -518,6 +527,7 @@ struct convert_in_variable_generator
518 else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *" 527 else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *"
519 || param.type.c_type == "Eina_Inarray *" || param.type.c_type == "const Eina_Inarray *" 528 || param.type.c_type == "Eina_Inarray *" || param.type.c_type == "const Eina_Inarray *"
520 || param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *" 529 || param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *"
530 || param.type.c_type == "Eina_Inlist *" || param.type.c_type == "const Eina_Inlist *"
521 ) 531 )
522 { 532 {
523 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type); 533 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type);
@@ -581,6 +591,10 @@ struct convert_out_variable_generator
581 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT) 591 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
582 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT) 592 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
583 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT) 593 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
594 || param_is_acceptable(param, "Eina_Inlist *", WANT_OWN, WANT_OUT)
595 || param_is_acceptable(param, "Eina_Inlist *", !WANT_OWN, WANT_OUT)
596 || param_is_acceptable(param, "const Eina_Inlist *", WANT_OWN, WANT_OUT)
597 || param_is_acceptable(param, "const Eina_Inlist *", !WANT_OWN, WANT_OUT)
584 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, WANT_OUT) 598 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, WANT_OUT)
585 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, WANT_OUT) 599 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, WANT_OUT)
586 || param_is_acceptable(param, "const Eina_Hash *", WANT_OWN, WANT_OUT) 600 || param_is_acceptable(param, "const Eina_Hash *", WANT_OWN, WANT_OUT)
@@ -630,6 +644,10 @@ struct native_convert_out_variable_generator
630 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT) 644 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
631 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT) 645 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
632 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT) 646 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
647 || param_is_acceptable(param, "Eina_Inlist *", WANT_OWN, WANT_OUT)
648 || param_is_acceptable(param, "Eina_Inlist *", !WANT_OWN, WANT_OUT)
649 || param_is_acceptable(param, "const Eina_Inlist *", WANT_OWN, WANT_OUT)
650 || param_is_acceptable(param, "const Eina_Inlist *", !WANT_OWN, WANT_OUT)
633 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, WANT_OUT) 651 || param_is_acceptable(param, "Eina_Hash *", WANT_OWN, WANT_OUT)
634 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, WANT_OUT) 652 || param_is_acceptable(param, "Eina_Hash *", !WANT_OWN, WANT_OUT)
635 || param_is_acceptable(param, "const Eina_Hash *", WANT_OWN, WANT_OUT) 653 || param_is_acceptable(param, "const Eina_Hash *", WANT_OWN, WANT_OUT)
@@ -721,6 +739,10 @@ struct convert_out_assign_generator
721 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT) 739 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
722 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT) 740 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
723 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT) 741 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
742 || param_is_acceptable(param, "Eina_Inlist *", WANT_OWN, WANT_OUT)
743 || param_is_acceptable(param, "Eina_Inlist *", !WANT_OWN, WANT_OUT)
744 || param_is_acceptable(param, "const Eina_Inlist *", WANT_OWN, WANT_OUT)
745 || param_is_acceptable(param, "const Eina_Inlist *", !WANT_OWN, WANT_OUT)
724 ) 746 )
725 { 747 {
726 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type); 748 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type);
@@ -798,6 +820,7 @@ struct convert_return_generator
798 else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *" 820 else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *"
799 || ret_type.c_type == "Eina_Inarray *" || ret_type.c_type == "const Eina_Inarray *" 821 || ret_type.c_type == "Eina_Inarray *" || ret_type.c_type == "const Eina_Inarray *"
800 || ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *" 822 || ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *"
823 || ret_type.c_type == "Eina_Inlist *" || ret_type.c_type == "const Eina_Inlist *"
801 ) 824 )
802 { 825 {
803 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type); 826 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
@@ -893,6 +916,10 @@ struct native_convert_out_assign_generator
893 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT) 916 || param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
894 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT) 917 || param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
895 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT) 918 || param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
919 || param_is_acceptable(param, "Eina_Inlist *", WANT_OWN, WANT_OUT)
920 || param_is_acceptable(param, "Eina_Inlist *", !WANT_OWN, WANT_OUT)
921 || param_is_acceptable(param, "const Eina_Inlist *", WANT_OWN, WANT_OUT)
922 || param_is_acceptable(param, "const Eina_Inlist *", !WANT_OWN, WANT_OUT)
896 ) 923 )
897 { 924 {
898 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type); 925 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&param.type.original_type);
@@ -995,6 +1022,7 @@ struct native_convert_return_generator
995 else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *" 1022 else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *"
996 || ret_type.c_type == "Eina_Inarray *" || ret_type.c_type == "const Eina_Inarray *" 1023 || ret_type.c_type == "Eina_Inarray *" || ret_type.c_type == "const Eina_Inarray *"
997 || ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *" 1024 || ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *"
1025 || ret_type.c_type == "Eina_Inlist *" || ret_type.c_type == "const Eina_Inlist *"
998 ) 1026 )
999 { 1027 {
1000 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type); 1028 attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
diff --git a/src/bin/eolian_mono/eolian/mono/type_impl.hh b/src/bin/eolian_mono/eolian/mono/type_impl.hh
index 562aac7b0e..4bcd71d4ee 100644
--- a/src/bin/eolian_mono/eolian/mono/type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/type_impl.hh
@@ -266,6 +266,12 @@ struct visitor_generate
266 c.outer.base_type = "eina.List"; 266 c.outer.base_type = "eina.List";
267 return c; 267 return c;
268 }} 268 }}
269 , {"inlist", nullptr, nullptr, [&]
270 {
271 complex_type_def c = complex;
272 c.outer.base_type = "eina.Inlist";
273 return c;
274 }}
269 , {"array", nullptr, nullptr, [&] 275 , {"array", nullptr, nullptr, [&]
270 { 276 {
271 complex_type_def c = complex; 277 complex_type_def c = complex;
diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs
index f9b51b5340..baaf3b920b 100644
--- a/src/bindings/mono/eina_mono/eina_container_common.cs
+++ b/src/bindings/mono/eina_mono/eina_container_common.cs
@@ -66,12 +66,13 @@ public struct InlistNode<T>
66public interface IBaseElementTraits<T> 66public interface IBaseElementTraits<T>
67{ 67{
68 IntPtr ManagedToNativeAlloc(T man); 68 IntPtr ManagedToNativeAlloc(T man);
69 IntPtr ManagedToNativeAllocRef(T man, bool refs = false); 69 IntPtr ManagedToNativeAllocRef(T man, bool refs);
70 IntPtr ManagedToNativeAllocInlistNode(T man); 70 IntPtr ManagedToNativeAllocInlistNode(T man);
71 IntPtr ManagedToNativeAllocInplace(T man); 71 IntPtr ManagedToNativeAllocInplace(T man);
72 void NativeFree(IntPtr nat); 72 void NativeFree(IntPtr nat);
73 void NativeFreeRef(IntPtr nat, bool unrefs = false); 73 void NativeFreeRef(IntPtr nat, bool unrefs);
74 void NativeFreeInlistNode(IntPtr nat); 74 void NativeFreeInlistNodeElement(IntPtr nat);
75 void NativeFreeInlistNode(IntPtr nat, bool freeElement);
75 void NativeFreeInplace(IntPtr nat); 76 void NativeFreeInplace(IntPtr nat);
76 void ResidueFreeInplace(IntPtr nat); 77 void ResidueFreeInplace(IntPtr nat);
77 T NativeToManaged(IntPtr nat); 78 T NativeToManaged(IntPtr nat);
@@ -97,7 +98,7 @@ public class StringElementTraits<T> : IBaseElementTraits<T>
97 return efl_mono_native_strdup((string)(object)man); 98 return efl_mono_native_strdup((string)(object)man);
98 } 99 }
99 100
100 public IntPtr ManagedToNativeAllocRef(T man, bool refs = false) 101 public IntPtr ManagedToNativeAllocRef(T man, bool refs)
101 { 102 {
102 // Keep alloc on C# ? 103 // Keep alloc on C# ?
103 return ManagedToNativeAlloc(man); 104 return ManagedToNativeAlloc(man);
@@ -125,17 +126,25 @@ public class StringElementTraits<T> : IBaseElementTraits<T>
125 efl_mono_native_free(nat); 126 efl_mono_native_free(nat);
126 } 127 }
127 128
128 public void NativeFreeRef(IntPtr nat, bool unrefs = false) 129 public void NativeFreeRef(IntPtr nat, bool unrefs)
129 { 130 {
130 NativeFree(nat); 131 NativeFree(nat);
131 } 132 }
132 133
133 public void NativeFreeInlistNode(IntPtr nat) 134 public void NativeFreeInlistNodeElement(IntPtr nat)
134 { 135 {
135 if (nat == IntPtr.Zero) 136 if (nat == IntPtr.Zero)
136 return; 137 return;
137 var node = Marshal.PtrToStructure< InlistNode<IntPtr> >(nat); 138 var node = Marshal.PtrToStructure< InlistNode<IntPtr> >(nat);
138 NativeFree(node.Val); 139 NativeFree(node.Val);
140 }
141
142 public void NativeFreeInlistNode(IntPtr nat, bool freeElement)
143 {
144 if (nat == IntPtr.Zero)
145 return;
146 if (freeElement)
147 NativeFreeInlistNodeElement(nat);
139 efl_mono_native_free(nat); 148 efl_mono_native_free(nat);
140 } 149 }
141 150
@@ -215,7 +224,7 @@ public class EflObjectElementTraits<T> : IBaseElementTraits<T>
215 return efl.eo.Globals.efl_ref(h); 224 return efl.eo.Globals.efl_ref(h);
216 } 225 }
217 226
218 public IntPtr ManagedToNativeAllocRef(T man, bool refs = false) 227 public IntPtr ManagedToNativeAllocRef(T man, bool refs)
219 { 228 {
220 IntPtr h = refs ? ManagedToNativeAlloc(man) : ((efl.eo.IWrapper)man).raw_handle; 229 IntPtr h = refs ? ManagedToNativeAlloc(man) : ((efl.eo.IWrapper)man).raw_handle;
221 return intPtrTraits.ManagedToNativeAlloc(h); 230 return intPtrTraits.ManagedToNativeAlloc(h);
@@ -243,19 +252,27 @@ public class EflObjectElementTraits<T> : IBaseElementTraits<T>
243 efl.eo.Globals.efl_unref(nat); 252 efl.eo.Globals.efl_unref(nat);
244 } 253 }
245 254
246 public void NativeFreeRef(IntPtr nat, bool unrefs = false) 255 public void NativeFreeRef(IntPtr nat, bool unrefs)
247 { 256 {
248 if (unrefs) 257 if (unrefs)
249 NativeFree(intPtrTraits.NativeToManaged(nat)); 258 NativeFree(intPtrTraits.NativeToManaged(nat));
250 intPtrTraits.NativeFree(nat); 259 intPtrTraits.NativeFree(nat);
251 } 260 }
252 261
253 public void NativeFreeInlistNode(IntPtr nat) 262 public void NativeFreeInlistNodeElement(IntPtr nat)
254 { 263 {
255 if (nat == IntPtr.Zero) 264 if (nat == IntPtr.Zero)
256 return; 265 return;
257 var node = Marshal.PtrToStructure< InlistNode<IntPtr> >(nat); 266 var node = Marshal.PtrToStructure< InlistNode<IntPtr> >(nat);
258 NativeFree(node.Val); 267 NativeFree(node.Val);
268 }
269
270 public void NativeFreeInlistNode(IntPtr nat, bool freeElement)
271 {
272 if (nat == IntPtr.Zero)
273 return;
274 if (freeElement)
275 NativeFreeInlistNodeElement(nat);
259 efl_mono_native_free(nat); 276 efl_mono_native_free(nat);
260 } 277 }
261 278
@@ -349,7 +366,12 @@ public abstract class PrimitiveElementTraits<T>
349 efl_mono_native_free(nat); 366 efl_mono_native_free(nat);
350 } 367 }
351 368
352 public void NativeFreeInlistNode(IntPtr nat) 369 public void NativeFreeInlistNodeElement(IntPtr nat)
370 {
371 // Do nothing
372 }
373
374 public void NativeFreeInlistNode(IntPtr nat, bool freeElement)
353 { 375 {
354 efl_mono_native_free(nat); 376 efl_mono_native_free(nat);
355 } 377 }
@@ -429,12 +451,12 @@ public class Primitive32ElementTraits<T> : PrimitiveElementTraits<T>, IBaseEleme
429 int32Traits = TraitFunctions.GetTypeTraits<Int32>(); 451 int32Traits = TraitFunctions.GetTypeTraits<Int32>();
430 } 452 }
431 453
432 public IntPtr ManagedToNativeAllocRef(T man, bool refs = false) 454 public IntPtr ManagedToNativeAllocRef(T man, bool refs)
433 { 455 {
434 return int32Traits.ManagedToNativeAlloc(Convert.ToInt32((object)man)); 456 return int32Traits.ManagedToNativeAlloc(Convert.ToInt32((object)man));
435 } 457 }
436 458
437 public void NativeFreeRef(IntPtr nat, bool unrefs = false) 459 public void NativeFreeRef(IntPtr nat, bool unrefs)
438 { 460 {
439 int32Traits.NativeFree(nat); 461 int32Traits.NativeFree(nat);
440 } 462 }
@@ -458,12 +480,12 @@ public class Primitive64ElementTraits<T> : PrimitiveElementTraits<T>, IBaseEleme
458 int64Traits = TraitFunctions.GetTypeTraits<Int64>(); 480 int64Traits = TraitFunctions.GetTypeTraits<Int64>();
459 } 481 }
460 482
461 public IntPtr ManagedToNativeAllocRef(T man, bool refs = false) 483 public IntPtr ManagedToNativeAllocRef(T man, bool refs)
462 { 484 {
463 return int64Traits.ManagedToNativeAlloc(Convert.ToInt64((object)man)); 485 return int64Traits.ManagedToNativeAlloc(Convert.ToInt64((object)man));
464 } 486 }
465 487
466 public void NativeFreeRef(IntPtr nat, bool unrefs = false) 488 public void NativeFreeRef(IntPtr nat, bool unrefs)
467 { 489 {
468 int64Traits.NativeFree(nat); 490 int64Traits.NativeFree(nat);
469 } 491 }
@@ -564,6 +586,11 @@ public static class TraitFunctions
564 return GetTypeTraits<T>().ManagedToNativeAllocInplace(man); 586 return GetTypeTraits<T>().ManagedToNativeAllocInplace(man);
565 } 587 }
566 588
589 public static IntPtr ManagedToNativeAllocInlistNode<T>(T man)
590 {
591 return GetTypeTraits<T>().ManagedToNativeAllocInlistNode(man);
592 }
593
567 public static void NativeFree<T>(IntPtr nat) 594 public static void NativeFree<T>(IntPtr nat)
568 { 595 {
569 GetTypeTraits<T>().NativeFree(nat); 596 GetTypeTraits<T>().NativeFree(nat);
@@ -574,6 +601,16 @@ public static class TraitFunctions
574 GetTypeTraits<T>().NativeFreeRef(nat, unrefs); 601 GetTypeTraits<T>().NativeFreeRef(nat, unrefs);
575 } 602 }
576 603
604 public static void NativeFreeInlistNodeElement<T>(IntPtr nat)
605 {
606 GetTypeTraits<T>().NativeFreeInlistNodeElement(nat);
607 }
608
609 public static void NativeFreeInlistNode<T>(IntPtr nat, bool freeElement = true)
610 {
611 GetTypeTraits<T>().NativeFreeInlistNode(nat, freeElement);
612 }
613
577 public static void NativeFreeInplace<T>(IntPtr nat) 614 public static void NativeFreeInplace<T>(IntPtr nat)
578 { 615 {
579 GetTypeTraits<T>().NativeFreeInplace(nat); 616 GetTypeTraits<T>().NativeFreeInplace(nat);
@@ -589,6 +626,11 @@ public static class TraitFunctions
589 return GetTypeTraits<T>().NativeToManaged(nat); 626 return GetTypeTraits<T>().NativeToManaged(nat);
590 } 627 }
591 628
629 public static T NativeToManagedInlistNode<T>(IntPtr nat)
630 {
631 return GetTypeTraits<T>().NativeToManagedInlistNode(nat);
632 }
633
592 public static T NativeToManagedInplace<T>(IntPtr nat) 634 public static T NativeToManagedInplace<T>(IntPtr nat)
593 { 635 {
594 return GetTypeTraits<T>().NativeToManagedInplace(nat); 636 return GetTypeTraits<T>().NativeToManagedInplace(nat);
diff --git a/src/bindings/mono/eina_mono/eina_inlist.cs b/src/bindings/mono/eina_mono/eina_inlist.cs
index 1ef51e8aa1..b95a5f0dc3 100644
--- a/src/bindings/mono/eina_mono/eina_inlist.cs
+++ b/src/bindings/mono/eina_mono/eina_inlist.cs
@@ -61,13 +61,21 @@ public static class InlistNativeFunctions
61 [DllImport("eina")] public static extern IntPtr 61 [DllImport("eina")] public static extern IntPtr
62 eina_inlist_sort(IntPtr head, IntPtr func); 62 eina_inlist_sort(IntPtr head, IntPtr func);
63 63
64// static inline IntPtr eina_inlist_first(IntPtr list); 64
65// static inline IntPtr eina_inlist_last(IntPtr list); 65 [DllImport("eflcustomexportsmono")] public static extern IntPtr
66 eina_inlist_first_custom_export_mono(IntPtr list);
67 [DllImport("eflcustomexportsmono")] public static extern IntPtr
68 eina_inlist_last_custom_export_mono(IntPtr list);
69
70
71 [DllImport("eflcustomexportsmono")] public static extern IntPtr
72 eina_inlist_next_custom_export_mono(IntPtr list);
73 [DllImport("eflcustomexportsmono")] public static extern IntPtr
74 eina_inlist_prev_custom_export_mono(IntPtr list);
66} 75}
67 76
68public class Inlist<T> // : IEnumerable<T>, IDisposable 77public class Inlist<T> : IEnumerable<T>, IDisposable
69{ 78{
70/*
71 public IntPtr Handle {get;set;} = IntPtr.Zero; 79 public IntPtr Handle {get;set;} = IntPtr.Zero;
72 public bool Own {get;set;} 80 public bool Own {get;set;}
73 public bool OwnContent {get;set;} 81 public bool OwnContent {get;set;}
@@ -85,29 +93,35 @@ public class Inlist<T> // : IEnumerable<T>, IDisposable
85 OwnContent = true; 93 OwnContent = true;
86 } 94 }
87 95
88 private IntPtr InternalLast() 96 private IntPtr InternalFirst()
89 { 97 {
90 return eina_inlist_last_custom_export_mono(Handle); 98 return eina_inlist_first_custom_export_mono(Handle);
91 } 99 }
92 100
93 private static IntPtr InternalNext(IntPtr inlist) 101 private IntPtr InternalLast()
94 { 102 {
95 return eina_inlist_next_custom_export_mono(inlist); 103 return eina_inlist_last_custom_export_mono(Handle);
96 } 104 }
97 105
98 private static IntPtr InternalPrev(IntPtr inlist) 106 private IntPtr InternalAt(int idx)
99 { 107 {
100 return eina_inlist_prev_custom_export_mono(inlist); 108 if (idx < 0)
109 return IntPtr.Zero;
110
111 IntPtr curr = Handle;
112 for (int n = 0; n != idx && curr != IntPtr.Zero; ++n)
113 curr = InternalNext(curr);
114 return curr;
101 } 115 }
102 116
103 private static IntPtr InternalDataGet(IntPtr inlist) 117 private static IntPtr InternalNext(IntPtr inlist)
104 { 118 {
105 return eina_inlist_data_get_custom_export_mono(inlist); 119 return eina_inlist_next_custom_export_mono(inlist);
106 } 120 }
107 121
108 private static IntPtr InternalDataSet(IntPtr inlist, IntPtr data) 122 private static IntPtr InternalPrev(IntPtr inlist)
109 { 123 {
110 return eina_inlist_data_set_custom_export_mono(inlist, data); 124 return eina_inlist_prev_custom_export_mono(inlist);
111 } 125 }
112 126
113 127
@@ -146,12 +160,19 @@ public class Inlist<T> // : IEnumerable<T>, IDisposable
146 { 160 {
147 for(IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr)) 161 for(IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
148 { 162 {
149 NativeFree<T>(InternalDataGet(curr)); 163 NativeFreeInlistNodeElement<T>(curr);
150 } 164 }
151 } 165 }
152 166
153 if (Own) 167 if (Own)
154 eina_inlist_free(h); 168 {
169 while (h != IntPtr.Zero)
170 {
171 var aux = h;
172 h = eina_inlist_remove(h, h);
173 NativeFreeInlistNode<T>(aux, false);
174 }
175 }
155 } 176 }
156 177
157 public void Dispose() 178 public void Dispose()
@@ -186,71 +207,65 @@ public class Inlist<T> // : IEnumerable<T>, IDisposable
186 207
187 public int Count() 208 public int Count()
188 { 209 {
189 return (int) eina_inlist_count_custom_export_mono(Handle); 210 return (int) eina_inlist_count(Handle);
190 } 211 }
191 212
192 public void Append(T val) 213 public void Clean()
193 { 214 {
194 IntPtr ele = ManagedToNativeAlloc(val); 215 while (Handle != IntPtr.Zero)
195 Handle = eina_inlist_append(Handle, ele); 216 {
217 var aux = Handle;
218 Handle = eina_inlist_remove(Handle, Handle);
219 NativeFreeInlistNode<T>(aux, OwnContent);
220 }
196 } 221 }
197 222
198 public void Prepend(T val) 223 public void Append(T val)
199 { 224 {
200 IntPtr ele = ManagedToNativeAlloc(val); 225 IntPtr node = ManagedToNativeAllocInlistNode(val);
201 Handle = eina_inlist_prepend(Handle, ele); 226 Handle = eina_inlist_append(Handle, node);
202 } 227 }
203 228
204 public void SortedInsert(T val) 229 public void Prepend(T val)
205 { 230 {
206 IntPtr ele = ManagedToNativeAlloc(val); 231 IntPtr node = ManagedToNativeAllocInlistNode(val);
207 Handle = eina_inlist_sorted_insert(Handle, EinaCompareCb<T>(), ele); 232 Handle = eina_inlist_prepend(Handle, node);
208 } 233 }
209 234
210 public void SortedInsert(Eina_Compare_Cb compareCb, T val) 235 public void Remove(int idx)
211 { 236 {
212 IntPtr ele = ManagedToNativeAlloc(val); 237 IntPtr node = InternalAt(idx);
213 Handle = eina_inlist_sorted_insert(Handle, Marshal.GetFunctionPointerForDelegate(compareCb), ele); 238 Handle = eina_inlist_remove(Handle, node);
239 NativeFreeInlistNode<T>(node, OwnContent);
214 } 240 }
215 241
216 public void Sort(int limit = 0) 242 public T At(int idx)
217 { 243 {
218 Handle = eina_inlist_sort(Handle, (uint)limit, EinaCompareCb<T>()); 244 IntPtr node = InternalAt(idx);
245 if (node == IntPtr.Zero)
246 throw new IndexOutOfRangeException();
247 return NativeToManagedInlistNode<T>(node);
219 } 248 }
220 249
221 public void Sort(Eina_Compare_Cb compareCb) 250 public void DataSet(int idx, T val)
222 { 251 {
223 Handle = eina_inlist_sort(Handle, 0, Marshal.GetFunctionPointerForDelegate(compareCb)); 252 IntPtr old = InternalAt(idx);
224 } 253 if (old == IntPtr.Zero)
254 throw new IndexOutOfRangeException();
225 255
226 public void Sort(int limit, Eina_Compare_Cb compareCb) 256 IntPtr new_node = ManagedToNativeAllocInlistNode(val);
227 {
228 Handle = eina_inlist_sort(Handle, (uint)limit, Marshal.GetFunctionPointerForDelegate(compareCb));
229 }
230 257
231 public T Nth(int n) 258 Handle = eina_inlist_append_relative(Handle, new_node, old);
232 { 259 Handle = eina_inlist_remove(Handle, old);
233 // TODO: check bounds ???
234 IntPtr ele = eina_inlist_nth(Handle, (uint)n);
235 return NativeToManaged<T>(ele);
236 }
237 260
238 public void DataSet(int idx, T val) 261 NativeFreeInlistNode<T>(old, OwnContent);
239 {
240 IntPtr pos = eina_inlist_nth_inlist(Handle, (uint)idx);
241 if (pos == IntPtr.Zero)
242 throw new IndexOutOfRangeException();
243 if (OwnContent)
244 NativeFree<T>(InternalDataGet(pos));
245 IntPtr ele = ManagedToNativeAlloc(val);
246 InternalDataSet(pos, ele);
247 } 262 }
248 263
249 public T this[int idx] 264 public T this[int idx]
250 { 265 {
251 get 266 get
252 { 267 {
253 return Nth(idx); 268 return At(idx);
254 } 269 }
255 set 270 set
256 { 271 {
@@ -258,29 +273,13 @@ public class Inlist<T> // : IEnumerable<T>, IDisposable
258 } 273 }
259 } 274 }
260 275
261 public T LastDataGet()
262 {
263 IntPtr ele = eina_inlist_last_data_get_custom_export_mono(Handle);
264 return NativeToManaged<T>(ele);
265 }
266
267 public void Reverse()
268 {
269 Handle = eina_inlist_reverse(Handle);
270 }
271
272 public void Shuffle()
273 {
274 Handle = eina_inlist_shuffle(Handle, IntPtr.Zero);
275 }
276
277 public T[] ToArray() 276 public T[] ToArray()
278 { 277 {
279 var managed = new T[Count()]; 278 var managed = new T[Count()];
280 int i = 0; 279 int i = 0;
281 for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr), ++i) 280 for(IntPtr curr = Handle; curr != IntPtr.Zero; ++i, curr = InternalNext(curr))
282 { 281 {
283 managed[i] = NativeToManaged<T>(InternalDataGet(curr)); 282 managed[i] = NativeToManagedInlistNode<T>(curr);
284 } 283 }
285 return managed; 284 return managed;
286 } 285 }
@@ -295,7 +294,7 @@ public class Inlist<T> // : IEnumerable<T>, IDisposable
295 { 294 {
296 for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr)) 295 for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
297 { 296 {
298 yield return NativeToManaged<T>(InternalDataGet(curr)); 297 yield return NativeToManagedInlistNode<T>(curr);
299 } 298 }
300 } 299 }
301 300
@@ -303,7 +302,6 @@ public class Inlist<T> // : IEnumerable<T>, IDisposable
303 { 302 {
304 return this.GetEnumerator(); 303 return this.GetEnumerator();
305 } 304 }
306*/
307} 305}
308 306
309} 307}
diff --git a/src/lib/efl_mono/efl_custom_exports_mono.c b/src/lib/efl_mono/efl_custom_exports_mono.c
index efc5fe6745..cd48721daf 100644
--- a/src/lib/efl_mono/efl_custom_exports_mono.c
+++ b/src/lib/efl_mono/efl_custom_exports_mono.c
@@ -180,3 +180,28 @@ EAPI void *eina_list_last_data_get_custom_export_mono(const Eina_List *list)
180 return eina_list_last_data_get(list); 180 return eina_list_last_data_get(list);
181} 181}
182 182
183// Inlist //
184
185EAPI Eina_Inlist *eina_inlist_first_custom_export_mono(const Eina_Inlist *list)
186{
187 return eina_inlist_first(list);
188}
189
190EAPI Eina_Inlist *eina_inlist_last_custom_export_mono(const Eina_Inlist *list)
191{
192 return eina_inlist_last(list);
193}
194
195EAPI Eina_Inlist *eina_inlist_next_custom_export_mono(const Eina_Inlist *list)
196{
197 if (list)
198 return list->next;
199 return NULL;
200}
201
202EAPI Eina_Inlist *eina_inlist_prev_custom_export_mono(const Eina_Inlist *list)
203{
204 if (list)
205 return list->prev;
206 return NULL;
207}
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index e42494186c..ef32d9a571 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -2341,6 +2341,497 @@ class TestEinaList
2341 } 2341 }
2342} 2342}
2343 2343
2344class TestEinaInlist
2345{
2346 public static void data_set_int()
2347 {
2348 var lst = new eina.Inlist<int>();
2349 lst.Append(88);
2350 Test.Assert(lst[0] == 88);
2351 lst.DataSet(0, 44);
2352 Test.Assert(lst[0] == 44);
2353 lst[0] = 22;
2354 Test.Assert(lst[0] == 22);
2355 Test.Assert(lst.Count() == 1);
2356 }
2357
2358 public static void data_set_string()
2359 {
2360 var lst = new eina.Inlist<string>();
2361 lst.Append("test string");
2362 Test.Assert(lst[0] == "test string");
2363 lst.DataSet(0, "other string");
2364 Test.Assert(lst[0] == "other string");
2365 lst[0] = "abc";
2366 Test.Assert(lst[0] == "abc");
2367 Test.Assert(lst.Count() == 1);
2368 }
2369
2370 public static void data_set_obj()
2371 {
2372 var lst = new eina.Inlist<test.NumberwrapperConcrete>();
2373
2374 var o1 = new test.NumberwrapperConcrete();
2375 o1.number_set(88);
2376
2377 lst.Append(o1);
2378 Test.Assert(lst[0].raw_handle == o1.raw_handle);
2379 Test.Assert(lst[0].number_get() == 88);
2380
2381 var o2 = new test.NumberwrapperConcrete();
2382 o2.number_set(44);
2383
2384 lst.DataSet(0, o2);
2385 Test.Assert(lst[0].raw_handle == o2.raw_handle);
2386 Test.Assert(lst[0].number_get() == 44);
2387
2388 var o3 = new test.NumberwrapperConcrete();
2389 o3.number_set(22);
2390
2391 lst[0] = o3;
2392 Test.Assert(lst[0].raw_handle == o3.raw_handle);
2393 Test.Assert(lst[0].number_get() == 22);
2394
2395 Test.Assert(lst.Count() == 1);
2396 }
2397
2398 public static void append_count_int()
2399 {
2400 var lst = new eina.Inlist<int>();
2401 Test.Assert(lst.Count() == 0);
2402 lst.Append(88);
2403 Test.Assert(lst[0] == 88);
2404 Test.Assert(lst.Count() == 1);
2405 lst.Append(44);
2406 Test.Assert(lst[1] == 44);
2407 Test.Assert(lst.Count() == 2);
2408 lst.Append(22);
2409 Test.Assert(lst[2] == 22);
2410 Test.Assert(lst.Count() == 3);
2411 }
2412
2413 public static void append_count_string()
2414 {
2415 var lst = new eina.Inlist<string>();
2416 Test.Assert(lst.Count() == 0);
2417 lst.Append("a");
2418 Test.Assert(lst[0] == "a");
2419 Test.Assert(lst.Count() == 1);
2420 lst.Append("b");
2421 Test.Assert(lst[1] == "b");
2422 Test.Assert(lst.Count() == 2);
2423 lst.Append("c");
2424 Test.Assert(lst[2] == "c");
2425 Test.Assert(lst.Count() == 3);
2426 }
2427
2428 public static void append_count_obj()
2429 {
2430 var lst = new eina.Inlist<test.NumberwrapperConcrete>();
2431
2432 Test.Assert(lst.Count() == 0);
2433
2434 var o1 = new test.NumberwrapperConcrete();
2435 o1.number_set(88);
2436 lst.Append(o1);
2437 Test.Assert(lst[0].raw_handle == o1.raw_handle);
2438 Test.Assert(lst[0].number_get() == 88);
2439 Test.Assert(lst.Count() == 1);
2440
2441 var o2 = new test.NumberwrapperConcrete();
2442 o2.number_set(44);
2443 lst.Append(o2);
2444 Test.Assert(lst[1].raw_handle == o2.raw_handle);
2445 Test.Assert(lst[1].number_get() == 44);
2446 Test.Assert(lst.Count() == 2);
2447
2448 var o3 = new test.NumberwrapperConcrete();
2449 o3.number_set(22);
2450 lst.Append(o3);
2451 Test.Assert(lst[2].raw_handle == o3.raw_handle);
2452 Test.Assert(lst[2].number_get() == 22);
2453 Test.Assert(lst.Count() == 3);
2454 }
2455
2456 public static void length_int()
2457 {
2458 var lst = new eina.Inlist<int>();
2459 Test.Assert(lst.Length == 0);
2460 lst.Append(88);
2461 Test.Assert(lst[0] == 88);
2462 Test.Assert(lst.Length == 1);
2463 lst.Append(44);
2464 Test.Assert(lst[1] == 44);
2465 Test.Assert(lst.Length == 2);
2466 lst.Append(22);
2467 Test.Assert(lst[2] == 22);
2468 Test.Assert(lst.Length == 3);
2469 }
2470
2471 public static void length_string()
2472 {
2473 var lst = new eina.Inlist<string>();
2474 Test.Assert(lst.Length == 0);
2475 lst.Append("a");
2476 Test.Assert(lst[0] == "a");
2477 Test.Assert(lst.Length == 1);
2478 lst.Append("b");
2479 Test.Assert(lst[1] == "b");
2480 Test.Assert(lst.Length == 2);
2481 lst.Append("c");
2482 Test.Assert(lst[2] == "c");
2483 Test.Assert(lst.Length == 3);
2484 }
2485
2486 public static void prepend_count_int()
2487 {
2488 var lst = new eina.Inlist<int>();
2489 Test.Assert(lst.Count() == 0);
2490 lst.Prepend(88);
2491 Test.Assert(lst[0] == 88);
2492 Test.Assert(lst.Count() == 1);
2493 lst.Prepend(44);
2494 Test.Assert(lst[0] == 44);
2495 Test.Assert(lst.Count() == 2);
2496 lst.Prepend(22);
2497 Test.Assert(lst[0] == 22);
2498 Test.Assert(lst.Count() == 3);
2499 }
2500
2501 public static void prepend_count_string()
2502 {
2503 var lst = new eina.Inlist<string>();
2504 Test.Assert(lst.Count() == 0);
2505 lst.Prepend("a");
2506 Test.Assert(lst[0] == "a");
2507 Test.Assert(lst.Count() == 1);
2508 lst.Prepend("b");
2509 Test.Assert(lst[0] == "b");
2510 Test.Assert(lst.Count() == 2);
2511 lst.Prepend("c");
2512 Test.Assert(lst[0] == "c");
2513 Test.Assert(lst.Count() == 3);
2514 }
2515
2516 public static void prepend_count_obj()
2517 {
2518 var lst = new eina.Inlist<test.NumberwrapperConcrete>();
2519
2520 Test.Assert(lst.Count() == 0);
2521
2522 var o1 = new test.NumberwrapperConcrete();
2523 o1.number_set(88);
2524 lst.Prepend(o1);
2525 Test.Assert(lst[0].raw_handle == o1.raw_handle);
2526 Test.Assert(lst[0].number_get() == 88);
2527 Test.Assert(lst.Count() == 1);
2528
2529 var o2 = new test.NumberwrapperConcrete();
2530 o2.number_set(44);
2531 lst.Prepend(o2);
2532 Test.Assert(lst[0].raw_handle == o2.raw_handle);
2533 Test.Assert(lst[0].number_get() == 44);
2534 Test.Assert(lst.Count() == 2);
2535
2536 var o3 = new test.NumberwrapperConcrete();
2537 o3.number_set(22);
2538 lst.Prepend(o3);
2539 Test.Assert(lst[0].raw_handle == o3.raw_handle);
2540 Test.Assert(lst[0].number_get() == 22);
2541 Test.Assert(lst.Count() == 3);
2542 }
2543
2544 public static void eina_inlist_as_ienumerable_int()
2545 {
2546 var lst = new eina.Inlist<int>();
2547 lst.Append(88);
2548 lst.Append(44);
2549 lst.Append(22);
2550
2551 int cmp = 88;
2552 foreach (int e in lst)
2553 {
2554 Test.AssertEquals(cmp, e);
2555 cmp /= 2;
2556 }
2557 }
2558
2559 public static void eina_inlist_as_ienumerable_string()
2560 {
2561 var lst = new eina.Inlist<string>();
2562 lst.Append("X");
2563 lst.Append("XX");
2564 lst.Append("XXX");
2565
2566 string cmp = "X";
2567 foreach (string e in lst)
2568 {
2569 Test.AssertEquals(cmp, e);
2570 cmp = cmp + "X";
2571 }
2572 }
2573
2574 public static void eina_inlist_as_ienumerable_obj()
2575 {
2576 var a = new test.NumberwrapperConcrete();
2577 var b = new test.NumberwrapperConcrete();
2578 var c = new test.NumberwrapperConcrete();
2579 a.number_set(88);
2580 b.number_set(44);
2581 c.number_set(22);
2582 var cmp = new test.NumberwrapperConcrete[]{a,b,c};
2583
2584 var lst = new eina.Inlist<test.NumberwrapperConcrete>();
2585 lst.Append(a);
2586 lst.Append(b);
2587 lst.Append(c);
2588
2589 int i = 0;
2590 foreach (test.NumberwrapperConcrete e in lst)
2591 {
2592 Test.AssertEquals(cmp[i].number_get(), e.number_get());
2593 Test.Assert(cmp[i].raw_handle == e.raw_handle);
2594 ++i;
2595 }
2596 }
2597
2598 // //
2599 // Code Generation
2600 //
2601
2602 // Integer //
2603
2604 public static void test_eina_inlist_int_in()
2605 {
2606 test.Testing t = new test.TestingConcrete();
2607 var lst = new eina.Inlist<int>();
2608 lst.AppendArray(base_arr_int);
2609 Test.Assert(t.eina_inlist_int_in(lst));
2610 Test.Assert(lst.Own);
2611 Test.Assert(lst.ToArray().SequenceEqual(base_arr_int));
2612 lst.Dispose();
2613 Test.Assert(lst.Handle == IntPtr.Zero);
2614 }
2615
2616 public static void test_eina_inlist_int_in_own()
2617 {
2618 test.Testing t = new test.TestingConcrete();
2619 var lst = new eina.Inlist<int>();
2620 lst.AppendArray(base_arr_int);
2621 Test.Assert(t.eina_inlist_int_in_own(lst));
2622 Test.Assert(!lst.Own);
2623 lst.Dispose();
2624 Test.Assert(lst.Handle == IntPtr.Zero);
2625 Test.Assert(t.check_eina_inlist_int_in_own());
2626 }
2627
2628 public static void test_eina_inlist_int_out()
2629 {
2630 test.Testing t = new test.TestingConcrete();
2631 eina.Inlist<int> lst;
2632 Test.Assert(t.eina_inlist_int_out(out lst));
2633 Test.Assert(!lst.Own);
2634 Test.Assert(lst.ToArray().SequenceEqual(base_arr_int));
2635 lst.Dispose();
2636 Test.Assert(lst.Handle == IntPtr.Zero);
2637 Test.Assert(t.check_eina_inlist_int_out());
2638 }
2639
2640 public static void test_eina_inlist_int_out_own()
2641 {
2642 test.Testing t = new test.TestingConcrete();
2643 eina.Inlist<int> lst;
2644 Test.Assert(t.eina_inlist_int_out_own(out lst));
2645 Test.Assert(lst.Own);
2646 Test.Assert(lst.ToArray().SequenceEqual(base_arr_int));
2647 lst.AppendArray(append_arr_int);
2648 lst.Dispose();
2649 Test.Assert(lst.Handle == IntPtr.Zero);
2650 }
2651
2652 public static void test_eina_inlist_int_return()
2653 {
2654 test.Testing t = new test.TestingConcrete();
2655 var lst = t.eina_inlist_int_return();
2656 Test.Assert(!lst.Own);
2657 Test.Assert(lst.ToArray().SequenceEqual(base_arr_int));
2658 lst.Dispose();
2659 Test.Assert(lst.Handle == IntPtr.Zero);
2660 Test.Assert(t.check_eina_inlist_int_return());
2661 }
2662
2663 public static void test_eina_inlist_int_return_own()
2664 {
2665 test.Testing t = new test.TestingConcrete();
2666 var lst = t.eina_inlist_int_return_own();
2667 Test.Assert(lst.Own);
2668 Test.Assert(lst.ToArray().SequenceEqual(base_arr_int));
2669 lst.AppendArray(append_arr_int);
2670 lst.Dispose();
2671 Test.Assert(lst.Handle == IntPtr.Zero);
2672 }
2673
2674 // String //
2675 public static void test_eina_inlist_str_in()
2676 {
2677 test.Testing t = new test.TestingConcrete();
2678 var lst = new eina.Inlist<string>();
2679 lst.AppendArray(base_arr_str);
2680 Test.Assert(t.eina_inlist_str_in(lst));
2681 Test.Assert(lst.Own);
2682 Test.Assert(lst.ToArray().SequenceEqual(base_arr_str));
2683 lst.Dispose();
2684 Test.Assert(lst.Handle == IntPtr.Zero);
2685 }
2686
2687 public static void test_eina_inlist_str_in_own()
2688 {
2689 test.Testing t = new test.TestingConcrete();
2690 var lst = new eina.Inlist<string>();
2691 lst.AppendArray(base_arr_str);
2692 Test.Assert(t.eina_inlist_str_in_own(lst));
2693 Test.Assert(!lst.Own);
2694 lst.Dispose();
2695 Test.Assert(lst.Handle == IntPtr.Zero);
2696 Test.Assert(t.check_eina_inlist_str_in_own());
2697 }
2698
2699 public static void test_eina_inlist_str_out()
2700 {
2701 test.Testing t = new test.TestingConcrete();
2702 eina.Inlist<string> lst;
2703 Test.Assert(t.eina_inlist_str_out(out lst));
2704 Test.Assert(!lst.Own);
2705 Test.Assert(lst.ToArray().SequenceEqual(base_arr_str));
2706 lst.Dispose();
2707 Test.Assert(lst.Handle == IntPtr.Zero);
2708 Test.Assert(t.check_eina_inlist_str_out());
2709 }
2710
2711 public static void test_eina_inlist_str_out_own()
2712 {
2713 test.Testing t = new test.TestingConcrete();
2714 eina.Inlist<string> lst;
2715 Test.Assert(t.eina_inlist_str_out_own(out lst));
2716 Test.Assert(lst.Own);
2717 Test.Assert(lst.ToArray().SequenceEqual(base_arr_str));
2718 lst.AppendArray(append_arr_str);
2719 lst.Dispose();
2720 Test.Assert(lst.Handle == IntPtr.Zero);
2721 }
2722
2723 public static void test_eina_inlist_str_return()
2724 {
2725 test.Testing t = new test.TestingConcrete();
2726 var lst = t.eina_inlist_str_return();
2727 Test.Assert(!lst.Own);
2728 Test.Assert(lst.ToArray().SequenceEqual(base_arr_str));
2729 lst.Dispose();
2730 Test.Assert(lst.Handle == IntPtr.Zero);
2731 Test.Assert(t.check_eina_inlist_str_return());
2732 }
2733
2734 public static void test_eina_inlist_str_return_own()
2735 {
2736 test.Testing t = new test.TestingConcrete();
2737 var lst = t.eina_inlist_str_return_own();
2738 Test.Assert(lst.Own);
2739 Test.Assert(lst.ToArray().SequenceEqual(base_arr_str));
2740 lst.AppendArray(append_arr_str);
2741 lst.Dispose();
2742 Test.Assert(lst.Handle == IntPtr.Zero);
2743 }
2744
2745 // Object //
2746
2747 public static void test_eina_inlist_obj_in()
2748 {
2749 test.Testing t = new test.TestingConcrete();
2750 var lst = new eina.Inlist<test.Numberwrapper>();
2751 lst.AppendArray(BaseArrObj());
2752 Test.Assert(t.eina_inlist_obj_in(lst));
2753 Test.Assert(lst.Own);
2754 NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseArrObj());
2755 lst.Dispose();
2756 Test.Assert(lst.Handle == IntPtr.Zero);
2757 }
2758
2759 public static void test_eina_inlist_obj_in_own()
2760 {
2761 test.Testing t = new test.TestingConcrete();
2762 var lst = new eina.Inlist<test.Numberwrapper>();
2763 lst.AppendArray(BaseArrObj());
2764 Test.Assert(t.eina_inlist_obj_in_own(lst));
2765 Test.Assert(!lst.Own);
2766 lst.Dispose();
2767 Test.Assert(lst.Handle == IntPtr.Zero);
2768 Test.Assert(t.check_eina_inlist_obj_in_own());
2769 }
2770
2771 public static void test_eina_inlist_obj_out()
2772 {
2773 test.Testing t = new test.TestingConcrete();
2774 eina.Inlist<test.Numberwrapper> lst;
2775 Test.Assert(t.eina_inlist_obj_out(out lst));
2776 Test.Assert(!lst.Own);
2777 NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseArrObj());
2778 lst.Dispose();
2779 Test.Assert(lst.Handle == IntPtr.Zero);
2780 Test.Assert(t.check_eina_inlist_obj_out());
2781 }
2782
2783 public static void test_eina_inlist_obj_out_own()
2784 {
2785 test.Testing t = new test.TestingConcrete();
2786 eina.Inlist<test.Numberwrapper> lst;
2787 Test.Assert(t.eina_inlist_obj_out_own(out lst));
2788 Test.Assert(lst.Own);
2789 NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseArrObj());
2790 lst.AppendArray(AppendArrObj());
2791 lst.Dispose();
2792 Test.Assert(lst.Handle == IntPtr.Zero);
2793 }
2794
2795 public static void test_eina_inlist_obj_return()
2796 {
2797 test.Testing t = new test.TestingConcrete();
2798 var lst = t.eina_inlist_obj_return();
2799 Test.Assert(!lst.Own);
2800 NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseArrObj());
2801 lst.Dispose();
2802 Test.Assert(lst.Handle == IntPtr.Zero);
2803 Test.Assert(t.check_eina_inlist_obj_return());
2804 }
2805
2806 public static void test_eina_inlist_obj_return_own()
2807 {
2808 test.Testing t = new test.TestingConcrete();
2809 var lst = t.eina_inlist_obj_return_own();
2810 Test.Assert(lst.Own);
2811 NumberwrapperSequenceAssertEqual(lst.ToArray(), BaseArrObj());
2812 lst.AppendArray(AppendArrObj());
2813 lst.Dispose();
2814 Test.Assert(lst.Handle == IntPtr.Zero);
2815 }
2816
2817 public static void test_eina_inlist_obj_return_in_same_id()
2818 {
2819 test.Testing t = new test.TestingConcrete();
2820 var cmp = BaseArrObj();
2821 var a = new eina.Inlist<test.Numberwrapper>();
2822 a.AppendArray(cmp);
2823 var b = t.eina_inlist_obj_return_in(a);
2824 NumberwrapperSequenceAssertEqual(a.ToArray(), b.ToArray());
2825 NumberwrapperSequenceAssertEqual(a.ToArray(), BaseArrObj());
2826 int len = a.Length;
2827 for (int i=0; i < len; ++i)
2828 {
2829 Test.Assert(a[i].raw_handle == b[i].raw_handle);
2830 Test.Assert(a[i].raw_handle == cmp[i].raw_handle);
2831 }
2832 }
2833} // < TestEinaInlist
2834
2344 2835
2345class TestEinaHash 2836class TestEinaHash
2346{ 2837{
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/libefl_mono_native_test.c
index d23b6903cd..16f5304423 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/libefl_mono_native_test.c
@@ -1540,6 +1540,468 @@ Eina_List *_test_testing_eina_list_obj_return_in(EINA_UNUSED Eo *obj, EINA_UNUSE
1540} 1540}
1541 1541
1542 1542
1543// //
1544// Inlist
1545//
1546
1547// Integer
1548
1549typedef struct _Test_Inlist_Node_Int
1550{
1551 EINA_INLIST;
1552 int val;
1553} Test_Inlist_Node_Int;
1554
1555
1556Eina_Inlist *_new_inlist_int(int v)
1557{
1558 Test_Inlist_Node_Int *node = malloc(sizeof(Test_Inlist_Node_Int));
1559 node->val = v;
1560 return EINA_INLIST_GET(node);
1561}
1562
1563Eina_Bool _inlist_int_equal(const Eina_Inlist *lst, const int base[], unsigned int len)
1564{
1565 if (eina_inlist_count(lst) != len)
1566 return EINA_FALSE;
1567
1568 const Test_Inlist_Node_Int *node;
1569 int i = 0;
1570 EINA_INLIST_FOREACH(lst, node)
1571 {
1572 if (node->val != base[i])
1573 return EINA_FALSE;
1574 ++i;
1575 }
1576
1577 return EINA_TRUE;
1578}
1579
1580Eina_Bool _test_testing_eina_inlist_int_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
1581{
1582 Eina_Bool r = _inlist_int_equal(lst, base_arr_int, base_arr_int_size);
1583 return r;
1584}
1585
1586static Eina_Inlist *_inlist_int_in_own_to_check = NULL;
1587
1588Eina_Bool _test_testing_eina_inlist_int_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
1589{
1590 Eina_Bool r = _inlist_int_equal(lst, base_arr_int, base_arr_int_size);
1591 if (!r) return r;
1592
1593 lst = eina_inlist_append(lst, _new_inlist_int(42));
1594 lst = eina_inlist_append(lst, _new_inlist_int(43));
1595 lst = eina_inlist_append(lst, _new_inlist_int(33));
1596 _inlist_int_in_own_to_check = lst;
1597 return r;
1598}
1599
1600Eina_Bool _test_testing_check_eina_inlist_int_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1601{
1602 Eina_Inlist *lst = _inlist_int_in_own_to_check;
1603 if (!lst) return EINA_FALSE;
1604 _inlist_int_in_own_to_check = NULL;
1605
1606 Eina_Bool r = _inlist_int_equal(lst, modified_arr_int, modified_arr_int_size);
1607 if (!r) return r;
1608
1609 Test_Inlist_Node_Int *node;
1610 EINA_INLIST_FREE(lst, node)
1611 {
1612 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1613 free(node);
1614 }
1615 return r;
1616}
1617
1618Eina_Inlist *_inlist_int_out_to_check = NULL;
1619
1620Eina_Bool _test_testing_eina_inlist_int_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist **lst)
1621{
1622 if (!lst) return EINA_FALSE;
1623 *lst = eina_inlist_append(*lst, _new_inlist_int(0x0));
1624 *lst = eina_inlist_append(*lst, _new_inlist_int(0x2A));
1625 *lst = eina_inlist_append(*lst, _new_inlist_int(0x42));
1626 _inlist_int_out_to_check = *lst;
1627 return EINA_TRUE;
1628}
1629Eina_Bool _test_testing_check_eina_inlist_int_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1630{
1631 Eina_Inlist *lst = _inlist_int_out_to_check;
1632 if (!lst) return EINA_FALSE;
1633 _inlist_int_out_to_check = NULL;
1634
1635 Eina_Bool r = _inlist_int_equal(lst, base_arr_int, base_arr_int_size);
1636 if (!r) return r;
1637
1638 Test_Inlist_Node_Int *node;
1639 EINA_INLIST_FREE(lst, node)
1640 {
1641 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1642 free(node);
1643 }
1644
1645 return r;
1646}
1647
1648Eina_Bool _test_testing_eina_inlist_int_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist **lst)
1649{
1650 if (!lst) return EINA_FALSE;
1651 *lst = eina_inlist_append(*lst, _new_inlist_int(0x0));
1652 *lst = eina_inlist_append(*lst, _new_inlist_int(0x2A));
1653 *lst = eina_inlist_append(*lst, _new_inlist_int(0x42));
1654 return EINA_TRUE;
1655}
1656
1657Eina_Inlist *_inlist_int_return_to_check = NULL;
1658
1659Eina_Inlist *_test_testing_eina_inlist_int_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1660{
1661 Eina_Inlist *lst = NULL;
1662 lst = eina_inlist_append(lst, _new_inlist_int(0x0));
1663 lst = eina_inlist_append(lst, _new_inlist_int(0x2A));
1664 lst = eina_inlist_append(lst, _new_inlist_int(0x42));
1665 _inlist_int_return_to_check = lst;
1666 return lst;
1667}
1668Eina_Bool _test_testing_check_eina_inlist_int_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1669{
1670 Eina_Inlist *lst = _inlist_int_return_to_check;
1671 if (!lst) return EINA_FALSE;
1672 _inlist_int_return_to_check = NULL;
1673
1674 Eina_Bool r = _inlist_int_equal(lst, base_arr_int, base_arr_int_size);
1675 if (!r) return r;
1676
1677 Test_Inlist_Node_Int *node;
1678 EINA_INLIST_FREE(lst, node)
1679 {
1680 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1681 free(node);
1682 }
1683
1684 return r;
1685}
1686
1687Eina_Inlist *_test_testing_eina_inlist_int_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1688{
1689 Eina_Inlist *lst = NULL;
1690 lst = eina_inlist_append(lst, _new_inlist_int(0x0));
1691 lst = eina_inlist_append(lst, _new_inlist_int(0x2A));
1692 lst = eina_inlist_append(lst, _new_inlist_int(0x42));
1693 return lst;
1694}
1695
1696// String
1697
1698typedef struct _Test_Inlist_Node_Str
1699{
1700 EINA_INLIST;
1701 char *val;
1702} Test_Inlist_Node_Str;
1703
1704
1705Eina_Inlist *_new_inlist_str(const char *v)
1706{
1707 Test_Inlist_Node_Str *node = malloc(sizeof(Test_Inlist_Node_Str));
1708 node->val = strdup(v);
1709 return EINA_INLIST_GET(node);
1710}
1711
1712Eina_Bool _inlist_str_equal(const Eina_Inlist *lst, const char * const base[], unsigned int len)
1713{
1714 if (eina_inlist_count(lst) != len)
1715 return EINA_FALSE;
1716
1717 const Test_Inlist_Node_Str *node;
1718 int i = 0;
1719 EINA_INLIST_FOREACH(lst, node)
1720 {
1721 if (0 != strcmp(node->val, base[i]))
1722 return EINA_FALSE;
1723 ++i;
1724 }
1725 return EINA_TRUE;
1726}
1727
1728Eina_Bool _test_testing_eina_inlist_str_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
1729{
1730 Eina_Bool r = _inlist_str_equal(lst, base_arr_str, base_arr_str_size);
1731 return r;
1732}
1733
1734static Eina_Inlist *_inlist_str_in_own_to_check = NULL;
1735
1736Eina_Bool _test_testing_eina_inlist_str_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
1737{
1738 Eina_Bool r = _inlist_str_equal(lst, base_arr_str, base_arr_str_size);
1739 if (!r) return r;
1740 lst = eina_inlist_append(lst, _new_inlist_str("42"));
1741 lst = eina_inlist_append(lst, _new_inlist_str("43"));
1742 lst = eina_inlist_append(lst, _new_inlist_str("33"));
1743 _inlist_str_in_own_to_check = lst;
1744 return r;
1745}
1746
1747Eina_Bool _test_testing_check_eina_inlist_str_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1748{
1749 Eina_Inlist *lst = _inlist_str_in_own_to_check;
1750 if (!lst) return EINA_FALSE;
1751 _inlist_str_in_own_to_check = NULL;
1752
1753 Eina_Bool r = _inlist_str_equal(lst, modified_arr_str, modified_arr_str_size);
1754 if (!r) return r;
1755
1756 Test_Inlist_Node_Str *node;
1757 EINA_INLIST_FREE(lst, node)
1758 {
1759 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1760 free(node->val);
1761 free(node);
1762 }
1763
1764 return r;
1765}
1766
1767Eina_Inlist *_inlist_str_out_to_check = NULL;
1768
1769Eina_Bool _test_testing_eina_inlist_str_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist **lst)
1770{
1771 if (!lst) return EINA_FALSE;
1772 *lst = eina_inlist_append(*lst, _new_inlist_str("0x0"));
1773 *lst = eina_inlist_append(*lst, _new_inlist_str("0x2A"));
1774 *lst = eina_inlist_append(*lst, _new_inlist_str("0x42"));
1775 _inlist_str_out_to_check = *lst;
1776 return EINA_TRUE;
1777}
1778Eina_Bool _test_testing_check_eina_inlist_str_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1779{
1780 Eina_Inlist *lst = _inlist_str_out_to_check;
1781 if (!lst) return EINA_FALSE;
1782 _inlist_str_out_to_check = NULL;
1783
1784 Eina_Bool r = _inlist_str_equal(lst, base_arr_str, base_arr_str_size);
1785 if (!r) return r;
1786
1787 Test_Inlist_Node_Str *node;
1788 EINA_INLIST_FREE(lst, node)
1789 {
1790 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1791 free(node->val);
1792 free(node);
1793 }
1794
1795 return r;
1796}
1797
1798Eina_Bool _test_testing_eina_inlist_str_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist **lst)
1799{
1800 if (!lst) return EINA_FALSE;
1801 *lst = eina_inlist_append(*lst, _new_inlist_str("0x0"));
1802 *lst = eina_inlist_append(*lst, _new_inlist_str("0x2A"));
1803 *lst = eina_inlist_append(*lst, _new_inlist_str("0x42"));
1804 return EINA_TRUE;
1805}
1806
1807Eina_Inlist *_inlist_str_return_to_check = NULL;
1808
1809Eina_Inlist *_test_testing_eina_inlist_str_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1810{
1811 Eina_Inlist *lst = NULL;
1812 lst = eina_inlist_append(lst, _new_inlist_str("0x0"));
1813 lst = eina_inlist_append(lst, _new_inlist_str("0x2A"));
1814 lst = eina_inlist_append(lst, _new_inlist_str("0x42"));
1815 _inlist_str_return_to_check = lst;
1816 return lst;
1817}
1818Eina_Bool _test_testing_check_eina_inlist_str_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1819{
1820 Eina_Inlist *lst = _inlist_str_return_to_check;
1821 if (!lst) return EINA_FALSE;
1822 _inlist_str_return_to_check = NULL;
1823
1824 Eina_Bool r = _inlist_str_equal(lst, base_arr_str, base_arr_str_size);
1825 if (!r) return r;
1826
1827 Test_Inlist_Node_Str *node;
1828 EINA_INLIST_FREE(lst, node)
1829 {
1830 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1831 free(node->val);
1832 free(node);
1833 }
1834
1835 return r;
1836}
1837
1838Eina_Inlist *_test_testing_eina_inlist_str_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1839{
1840 Eina_Inlist *lst = NULL;
1841 lst = eina_inlist_append(lst, _new_inlist_str("0x0"));
1842 lst = eina_inlist_append(lst, _new_inlist_str("0x2A"));
1843 lst = eina_inlist_append(lst, _new_inlist_str("0x42"));
1844 return lst;
1845}
1846
1847// Object
1848
1849typedef struct _Test_Inlist_Node_Obj
1850{
1851 EINA_INLIST;
1852 Test_Numberwrapper *val;
1853} Test_Inlist_Node_Obj;
1854
1855
1856Eina_Inlist *_new_inlist_obj(int v)
1857{
1858 Test_Inlist_Node_Obj *node = malloc(sizeof(Test_Inlist_Node_Obj));
1859 node->val = _new_obj(v);
1860 return EINA_INLIST_GET(node);
1861}
1862
1863Eina_Bool _inlist_obj_equal(const Eina_Inlist *lst, const Test_Numberwrapper * const base[], unsigned int len)
1864{
1865 if (eina_inlist_count(lst) != len)
1866 return EINA_FALSE;
1867
1868 const Test_Inlist_Node_Obj *node;
1869 int i = 0;
1870 EINA_INLIST_FOREACH(lst, node)
1871 {
1872 int a = test_numberwrapper_number_get(node->val);
1873 int b = test_numberwrapper_number_get(base[i]);
1874 if (a != b)
1875 return EINA_FALSE;
1876 ++i;
1877 }
1878 return EINA_TRUE;
1879}
1880
1881Eina_Bool _test_testing_eina_inlist_obj_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
1882{
1883 Eina_Bool r = _inlist_obj_equal(lst, base_arr_obj, base_arr_obj_size);
1884 return r;
1885}
1886
1887static Eina_Inlist *_inlist_obj_in_own_to_check = NULL;
1888
1889Eina_Bool _test_testing_eina_inlist_obj_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
1890{
1891 Eina_Bool r = _inlist_obj_equal(lst, base_arr_obj, base_arr_obj_size);
1892 if (!r) return r;
1893 lst = eina_inlist_append(lst, _new_inlist_obj(42));
1894 lst = eina_inlist_append(lst, _new_inlist_obj(43));
1895 lst = eina_inlist_append(lst, _new_inlist_obj(33));
1896 _inlist_obj_in_own_to_check = lst;
1897 return r;
1898}
1899
1900Eina_Bool _test_testing_check_eina_inlist_obj_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1901{
1902 Eina_Inlist *lst = _inlist_obj_in_own_to_check;
1903 if (!lst) return EINA_FALSE;
1904 _inlist_obj_in_own_to_check = NULL;
1905
1906 Eina_Bool r = _inlist_obj_equal(lst, modified_arr_obj, modified_arr_obj_size);
1907 if (!r) return r;
1908
1909 Test_Inlist_Node_Obj *node;
1910 EINA_INLIST_FREE(lst, node)
1911 {
1912 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1913 efl_unref(node->val);
1914 free(node);
1915 }
1916
1917 return r;
1918}
1919
1920Eina_Inlist *_inlist_obj_out_to_check = NULL;
1921
1922Eina_Bool _test_testing_eina_inlist_obj_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist **lst)
1923{
1924 if (!lst) return EINA_FALSE;
1925 *lst = eina_inlist_append(*lst, _new_inlist_obj(0x0));
1926 *lst = eina_inlist_append(*lst, _new_inlist_obj(0x2A));
1927 *lst = eina_inlist_append(*lst, _new_inlist_obj(0x42));
1928 _inlist_obj_out_to_check = *lst;
1929 return EINA_TRUE;
1930}
1931Eina_Bool _test_testing_check_eina_inlist_obj_out(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1932{
1933 Eina_Inlist *lst = _inlist_obj_out_to_check;
1934 if (!lst) return EINA_FALSE;
1935 _inlist_obj_out_to_check = NULL;
1936
1937 Eina_Bool r = _inlist_obj_equal(lst, base_arr_obj, base_arr_obj_size);
1938 if (!r) return r;
1939
1940 Test_Inlist_Node_Obj *node;
1941 EINA_INLIST_FREE(lst, node)
1942 {
1943 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1944 efl_unref(node->val);
1945 free(node);
1946 }
1947
1948 return r;
1949}
1950
1951Eina_Bool _test_testing_eina_inlist_obj_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist **lst)
1952{
1953 if (!lst) return EINA_FALSE;
1954 *lst = eina_inlist_append(*lst, _new_inlist_obj(0x0));
1955 *lst = eina_inlist_append(*lst, _new_inlist_obj(0x2A));
1956 *lst = eina_inlist_append(*lst, _new_inlist_obj(0x42));
1957 return EINA_TRUE;
1958}
1959
1960Eina_Inlist *_inlist_obj_return_to_check = NULL;
1961
1962Eina_Inlist *_test_testing_eina_inlist_obj_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1963{
1964 Eina_Inlist *lst = NULL;
1965 lst = eina_inlist_append(lst, _new_inlist_obj(0x0));
1966 lst = eina_inlist_append(lst, _new_inlist_obj(0x2A));
1967 lst = eina_inlist_append(lst, _new_inlist_obj(0x42));
1968 _inlist_obj_return_to_check = lst;
1969 return lst;
1970}
1971Eina_Bool _test_testing_check_eina_inlist_obj_return(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1972{
1973 Eina_Inlist *lst = _inlist_obj_return_to_check;
1974 if (!lst) return EINA_FALSE;
1975 _inlist_obj_return_to_check = NULL;
1976
1977 Eina_Bool r = _inlist_obj_equal(lst, base_arr_obj, base_arr_obj_size);
1978 if (!r) return r;
1979
1980 Test_Inlist_Node_Obj *node;
1981 EINA_INLIST_FREE(lst, node)
1982 {
1983 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
1984 efl_unref(node->val);
1985 free(node);
1986 }
1987
1988 return r;
1989}
1990
1991Eina_Inlist *_test_testing_eina_inlist_obj_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd)
1992{
1993 Eina_Inlist *lst = NULL;
1994 lst = eina_inlist_append(lst, _new_inlist_obj(0x0));
1995 lst = eina_inlist_append(lst, _new_inlist_obj(0x2A));
1996 lst = eina_inlist_append(lst, _new_inlist_obj(0x42));
1997 return lst;
1998}
1999
2000Eina_Inlist *_test_testing_eina_inlist_obj_return_in(EINA_UNUSED Eo *obj, EINA_UNUSED Test_Testing_Data *pd, Eina_Inlist *lst)
2001{
2002 return lst;
2003}
2004
1543 2005
1544// // 2006// //
1545// Hash // 2007// Hash //
diff --git a/src/tests/efl_mono/test_testing.eo b/src/tests/efl_mono/test_testing.eo
index 7bbf84d616..05bb77c72f 100644
--- a/src/tests/efl_mono/test_testing.eo
+++ b/src/tests/efl_mono/test_testing.eo
@@ -659,6 +659,153 @@ class Test.Testing (Efl.Object) {
659 return: list<Test.Numberwrapper>; 659 return: list<Test.Numberwrapper>;
660 } 660 }
661 661
662 /* Eina Inlist */
663
664 /* Integer */
665 eina_inlist_int_in {
666 params {
667 @in lst: inlist<int>;
668 }
669 return: bool;
670 }
671
672 eina_inlist_int_in_own {
673 params {
674 @in lst: own(inlist<own(ref(int))>);
675 }
676 return: bool;
677 }
678 check_eina_inlist_int_in_own {
679 return: bool;
680 }
681
682 eina_inlist_int_out {
683 params {
684 @out lst: inlist<int>;
685 }
686 return: bool;
687 }
688 check_eina_inlist_int_out {
689 return: bool;
690 }
691
692 eina_inlist_int_out_own {
693 params {
694 @out lst: own(inlist<own(ref(int))>);
695 }
696 return: bool;
697 }
698
699 eina_inlist_int_return {
700 return: inlist<int>;
701 }
702 check_eina_inlist_int_return {
703 return: bool;
704 }
705
706 eina_inlist_int_return_own {
707 return: own(inlist<own(ref(int))>);
708 }
709
710 /* String */
711 eina_inlist_str_in {
712 params {
713 @in lst: inlist<string>;
714 }
715 return: bool;
716 }
717
718 eina_inlist_str_in_own {
719 params {
720 @in lst: own(inlist<own(string)>);
721 }
722 return: bool;
723 }
724 check_eina_inlist_str_in_own {
725 return: bool;
726 }
727
728 eina_inlist_str_out {
729 params {
730 @out lst: inlist<string>;
731 }
732 return: bool;
733 }
734 check_eina_inlist_str_out {
735 return: bool;
736 }
737
738 eina_inlist_str_out_own {
739 params {
740 @out lst: own(inlist<own(string)>);
741 }
742 return: bool;
743 }
744
745 eina_inlist_str_return {
746 return: inlist<string>;
747 }
748 check_eina_inlist_str_return {
749 return: bool;
750 }
751
752 eina_inlist_str_return_own {
753 return: own(inlist<own(string)>);
754 }
755
756 /* Object */
757 eina_inlist_obj_in {
758 params {
759 @in lst: inlist<Test.Numberwrapper>;
760 }
761 return: bool;
762 }
763
764 eina_inlist_obj_in_own {
765 params {
766 @in lst: own(inlist<own(Test.Numberwrapper)>);
767 }
768 return: bool;
769 }
770 check_eina_inlist_obj_in_own {
771 return: bool;
772 }
773
774 eina_inlist_obj_out {
775 params {
776 @out lst: inlist<Test.Numberwrapper>;
777 }
778 return: bool;
779 }
780 check_eina_inlist_obj_out {
781 return: bool;
782 }
783
784 eina_inlist_obj_out_own {
785 params {
786 @out lst: own(inlist<own(Test.Numberwrapper)>);
787 }
788 return: bool;
789 }
790
791 eina_inlist_obj_return {
792 return: inlist<Test.Numberwrapper>;
793 }
794 check_eina_inlist_obj_return {
795 return: bool;
796 }
797
798 eina_inlist_obj_return_own {
799 return: own(inlist<own(Test.Numberwrapper)>);
800 }
801
802 eina_inlist_obj_return_in {
803 params {
804 @in lst: inlist<Test.Numberwrapper>;
805 }
806 return: inlist<Test.Numberwrapper>;
807 }
808
662 809
663 // Eina Hash // 810 // Eina Hash //
664 811