summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-06-06 15:22:56 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-06-06 15:28:10 +0100
commit9752c44a48c7ff228782a6f9c193542045bfa2b6 (patch)
tree6ab9e553282ff7c5734031cedf1459096cece871 /src/tests
parent614d1fad6e20f0ea1dc715d561ba24e48422f2c3 (diff)
eolian: add a new references system to help replace pointers
It's now possible to mark struct fields and function params as "references", which causes them to become pointers in C (in bindings, they become whatever is necessary). They're not a part of the type and are much more restricted than pointers, allowing bindings to be easier. This system will be gradually utilized and expanded as required. @feature
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/eolian/data/class_simple.eo1
-rw-r--r--src/tests/eolian/data/class_simple_ref.c8
-rw-r--r--src/tests/eolian/data/class_simple_ref_eo.h3
-rw-r--r--src/tests/eolian/data/class_simple_ref_legacy.h3
-rw-r--r--src/tests/eolian/data/struct.eo2
-rw-r--r--src/tests/eolian/data/struct_ref.c2
-rw-r--r--src/tests/eolian/eolian_parsing.c6
7 files changed, 17 insertions, 8 deletions
diff --git a/src/tests/eolian/data/class_simple.eo b/src/tests/eolian/data/class_simple.eo
index 653c2fbe25..62a1f3358e 100644
--- a/src/tests/eolian/data/class_simple.eo
+++ b/src/tests/eolian/data/class_simple.eo
@@ -27,6 +27,7 @@ class Class_Simple {
27 @in a: int; [[a]] 27 @in a: int; [[a]]
28 @inout b: char; 28 @inout b: char;
29 @out c: double (1337.6); 29 @out c: double (1337.6);
30 @ref d: int;
30 } 31 }
31 return: char * (null); [[comment for method return]] 32 return: char * (null); [[comment for method return]]
32 } 33 }
diff --git a/src/tests/eolian/data/class_simple_ref.c b/src/tests/eolian/data/class_simple_ref.c
index b97639d3c3..b71ebb4a6d 100644
--- a/src/tests/eolian/data/class_simple_ref.c
+++ b/src/tests/eolian/data/class_simple_ref.c
@@ -11,15 +11,15 @@ void _class_simple_b_set(Eo *obj, Evas_Simple_Data *pd);
11 11
12EOAPI EO_VOID_FUNC_BODY(evas_obj_simple_b_set); 12EOAPI EO_VOID_FUNC_BODY(evas_obj_simple_b_set);
13 13
14char * _class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, char *b, double *c); 14char * _class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, char *b, double *c, int *d);
15 15
16static char * __eolian_class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, char *b, double *c) 16static char * __eolian_class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, char *b, double *c, int *d)
17{ 17{
18 if (c) *c = 1337.600000; 18 if (c) *c = 1337.600000;
19 return _class_simple_foo(obj, pd, a, b, c); 19 return _class_simple_foo(obj, pd, a, b, c, d);
20} 20}
21 21
22EOAPI EO_FUNC_BODYV(evas_obj_simple_foo, char *, NULL, EO_FUNC_CALL(a, b, c), int a, char *b, double *c); 22EOAPI EO_FUNC_BODYV(evas_obj_simple_foo, char *, NULL, EO_FUNC_CALL(a, b, c, d), int a, char *b, double *c, int *d);
23 23
24int _class_simple_bar(Eo *obj, Evas_Simple_Data *pd, int x); 24int _class_simple_bar(Eo *obj, Evas_Simple_Data *pd, int x);
25 25
diff --git a/src/tests/eolian/data/class_simple_ref_eo.h b/src/tests/eolian/data/class_simple_ref_eo.h
index f0957e73b6..754349109b 100644
--- a/src/tests/eolian/data/class_simple_ref_eo.h
+++ b/src/tests/eolian/data/class_simple_ref_eo.h
@@ -55,12 +55,13 @@ EOAPI void evas_obj_simple_b_set(Eo *obj);
55 * 55 *
56 * @param[in,out] b 56 * @param[in,out] b
57 * @param[out] c 57 * @param[out] c
58 * @param[in] d
58 * 59 *
59 * @return comment for method return 60 * @return comment for method return
60 * 61 *
61 * @ingroup Class_Simple 62 * @ingroup Class_Simple
62 */ 63 */
63EOAPI char *evas_obj_simple_foo(Eo *obj, int a, char *b, double *c); 64EOAPI char *evas_obj_simple_foo(Eo *obj, int a, char *b, double *c, int *d);
64#endif 65#endif
65 66
66EOAPI int evas_obj_simple_bar(Eo *obj, int x); 67EOAPI int evas_obj_simple_bar(Eo *obj, int x);
diff --git a/src/tests/eolian/data/class_simple_ref_legacy.h b/src/tests/eolian/data/class_simple_ref_legacy.h
index 8fd63455ad..8664dbf9da 100644
--- a/src/tests/eolian/data/class_simple_ref_legacy.h
+++ b/src/tests/eolian/data/class_simple_ref_legacy.h
@@ -46,12 +46,13 @@ EAPI void evas_object_simple_b_set(Class_Simple *obj);
46 * 46 *
47 * @param[in,out] b 47 * @param[in,out] b
48 * @param[out] c 48 * @param[out] c
49 * @param[in] d
49 * 50 *
50 * @return comment for method return 51 * @return comment for method return
51 * 52 *
52 * @ingroup Class_Simple 53 * @ingroup Class_Simple
53 */ 54 */
54EAPI char *evas_object_simple_foo(Class_Simple *obj, int a, char *b, double *c); 55EAPI char *evas_object_simple_foo(Class_Simple *obj, int a, char *b, double *c, int *d);
55EAPI int evas_object_simple_bar(Class_Simple *obj, int x); 56EAPI int evas_object_simple_bar(Class_Simple *obj, int x);
56 57
57#endif 58#endif
diff --git a/src/tests/eolian/data/struct.eo b/src/tests/eolian/data/struct.eo
index f5656362c5..842b1b23c9 100644
--- a/src/tests/eolian/data/struct.eo
+++ b/src/tests/eolian/data/struct.eo
@@ -1,5 +1,5 @@
1struct Named { 1struct Named {
2 field: int; 2 @ref field: int;
3 something: string; 3 something: string;
4} 4}
5 5
diff --git a/src/tests/eolian/data/struct_ref.c b/src/tests/eolian/data/struct_ref.c
index e00f2e1de7..1fbec777bc 100644
--- a/src/tests/eolian/data/struct_ref.c
+++ b/src/tests/eolian/data/struct_ref.c
@@ -13,7 +13,7 @@ typedef Eo Struct;
13 13
14typedef struct _Named 14typedef struct _Named
15{ 15{
16 int field; 16 int *field;
17 const char *something; 17 const char *something;
18} Named; 18} Named;
19 19
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 008d1308e6..66f4b87197 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -639,6 +639,10 @@ START_TEST(eolian_simple_parsing)
639 v = eolian_expression_eval(expr, EOLIAN_MASK_FLOAT); 639 v = eolian_expression_eval(expr, EOLIAN_MASK_FLOAT);
640 fail_if(v.type != EOLIAN_EXPR_DOUBLE); 640 fail_if(v.type != EOLIAN_EXPR_DOUBLE);
641 fail_if(v.value.d != 1337.6); 641 fail_if(v.value.d != 1337.6);
642 fail_if(!(eina_iterator_next(iter, (void**)&param)));
643 fail_if(eolian_parameter_direction_get(param) != EOLIAN_REF_PARAM);
644 fail_if(strcmp(eolian_type_name_get(eolian_parameter_type_get(param)), "int"));
645 fail_if(strcmp(eolian_parameter_name_get(param), "d"));
642 fail_if(eina_iterator_next(iter, &dummy)); 646 fail_if(eina_iterator_next(iter, &dummy));
643 eina_iterator_free(iter); 647 eina_iterator_free(iter);
644 648
@@ -680,10 +684,12 @@ START_TEST(eolian_struct)
680 fail_if(strcmp(file, "struct.eo")); 684 fail_if(strcmp(file, "struct.eo"));
681 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "field"))); 685 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "field")));
682 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); 686 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
687 fail_if(!eolian_typedecl_struct_field_is_ref(field));
683 fail_if(!(type_name = eolian_type_name_get(ftype))); 688 fail_if(!(type_name = eolian_type_name_get(ftype)));
684 fail_if(strcmp(type_name, "int")); 689 fail_if(strcmp(type_name, "int"));
685 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something"))); 690 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something")));
686 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); 691 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
692 fail_if(eolian_typedecl_struct_field_is_ref(field));
687 fail_if(!(type_name = eolian_type_c_type_get(ftype))); 693 fail_if(!(type_name = eolian_type_c_type_get(ftype)));
688 fail_if(strcmp(type_name, "const char *")); 694 fail_if(strcmp(type_name, "const char *"));
689 eina_stringshare_del(type_name); 695 eina_stringshare_del(type_name);