summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2019-10-10 11:05:12 +0200
committerDave Andreoli <dave@gurumeditation.it>2019-10-10 11:06:55 +0200
commit30ddac07581daeeb1184ba366b6e0ac7392e8d79 (patch)
tree3c4df635c73c1bc9bdd17c3a2f74247ccbdf6acd /src/scripts
parent15933eb37b258736619c27d7c8d93b2f38ba00f7 (diff)
Pyolian: some more missing symbols defined
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/pyolian/eolian.py39
-rw-r--r--src/scripts/pyolian/eolian_lib.py29
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py23
3 files changed, 89 insertions, 2 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index c4425e37df..3d27fa481e 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -790,6 +790,10 @@ class Class(Object):
790 def parts(self): 790 def parts(self):
791 return Iterator(Part, lib.eolian_class_parts_get(self)) 791 return Iterator(Part, lib.eolian_class_parts_get(self))
792 792
793 @property
794 def requires(self):
795 return Iterator(Class, lib.eolian_class_requires_get(self))
796
793 797
794class Part(Object): 798class Part(Object):
795 def __repr__(self): 799 def __repr__(self):
@@ -976,6 +980,12 @@ class Function(Object):
976 def return_allow_unused(self, ftype): 980 def return_allow_unused(self, ftype):
977 return bool(lib.eolian_function_return_allow_unused(self, ftype)) 981 return bool(lib.eolian_function_return_allow_unused(self, ftype))
978 982
983 def return_is_by_ref(self, ftype):
984 return bool(lib.eolian_function_return_is_by_ref(self, ftype))
985
986 def return_is_move(self, ftype):
987 return bool(lib.eolian_function_return_is_move(self, ftype))
988
979 @cached_property 989 @cached_property
980 def method_return_type(self): 990 def method_return_type(self):
981 return self.return_type_get(Eolian_Function_Type.METHOD) 991 return self.return_type_get(Eolian_Function_Type.METHOD)
@@ -1027,6 +1037,14 @@ class Function_Parameter(Object):
1027 return bool(lib.eolian_parameter_is_optional(self)) 1037 return bool(lib.eolian_parameter_is_optional(self))
1028 1038
1029 @cached_property 1039 @cached_property
1040 def is_by_ref(self):
1041 return bool(lib.eolian_parameter_is_by_ref(self))
1042
1043 @cached_property
1044 def is_move(self):
1045 return bool(lib.eolian_parameter_is_move(self))
1046
1047 @cached_property
1030 def type(self): 1048 def type(self):
1031 c_type = lib.eolian_parameter_type_get(self) 1049 c_type = lib.eolian_parameter_type_get(self)
1032 return Type(c_type) if c_type else None 1050 return Type(c_type) if c_type else None
@@ -1158,6 +1176,10 @@ class Type(Object):
1158 def is_ptr(self): 1176 def is_ptr(self):
1159 return bool(lib.eolian_type_is_ptr(self)) 1177 return bool(lib.eolian_type_is_ptr(self))
1160 1178
1179 @cached_property
1180 def is_move(self):
1181 return bool(lib.eolian_type_is_move(self))
1182
1161 1183
1162class Typedecl(Object): 1184class Typedecl(Object):
1163 def __repr__(self): 1185 def __repr__(self):
@@ -1255,7 +1277,22 @@ class Struct_Type_Field(Object):
1255 def type(self): 1277 def type(self):
1256 c_type = lib.eolian_typedecl_struct_field_type_get(self) 1278 c_type = lib.eolian_typedecl_struct_field_type_get(self)
1257 return Type(c_type) if c_type else None 1279 return Type(c_type) if c_type else None
1258 1280
1281 @cached_property
1282 def c_type(self):
1283 s = lib.eolian_typedecl_struct_field_c_type_get(self)
1284 ret = _str_to_py(s)
1285 lib.eina_stringshare_del(c_void_p(s))
1286 return ret
1287
1288 @cached_property
1289 def is_by_ref(self):
1290 return bool(lib.eolian_typedecl_struct_field_is_by_ref(self))
1291
1292 @cached_property
1293 def is_move(self):
1294 return bool(lib.eolian_typedecl_struct_field_is_move(self))
1295
1259 @cached_property 1296 @cached_property
1260 def documentation(self): 1297 def documentation(self):
1261 c_doc = lib.eolian_typedecl_struct_field_documentation_get(self) 1298 c_doc = lib.eolian_typedecl_struct_field_documentation_get(self)
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 3e9c89111e..712a51926d 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -270,6 +270,11 @@ lib.eolian_class_data_type_get.restype = c_char_p
270lib.eolian_class_parent_get.argtypes = (c_void_p,) 270lib.eolian_class_parent_get.argtypes = (c_void_p,)
271lib.eolian_class_parent_get.restype = c_void_p 271lib.eolian_class_parent_get.restype = c_void_p
272 272
273# EAPI Eina_Iterator *eolian_class_requires_get(const Eolian_Class *klass);
274lib.eolian_class_requires_get.argtypes = (c_void_p,)
275lib.eolian_class_requires_get.restype = c_void_p
276
277
273# EAPI Eina_Iterator *eolian_class_extensions_get(const Eolian_Class *klass); 278# EAPI Eina_Iterator *eolian_class_extensions_get(const Eolian_Class *klass);
274lib.eolian_class_extensions_get.argtypes = (c_void_p,) 279lib.eolian_class_extensions_get.argtypes = (c_void_p,)
275lib.eolian_class_extensions_get.restype = c_void_p 280lib.eolian_class_extensions_get.restype = c_void_p
@@ -349,6 +354,14 @@ lib.eolian_function_is_static.restype = c_bool
349lib.eolian_function_is_constructor.argtypes = (c_void_p, c_void_p) 354lib.eolian_function_is_constructor.argtypes = (c_void_p, c_void_p)
350lib.eolian_function_is_constructor.restype = c_bool 355lib.eolian_function_is_constructor.restype = c_bool
351 356
357# EAPI Eina_Bool eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param_desc);
358lib.eolian_parameter_is_by_ref.argtypes = (c_void_p,)
359lib.eolian_parameter_is_by_ref.restype = c_bool
360
361# EAPI Eina_Bool eolian_parameter_is_move(const Eolian_Function_Parameter *param_desc);
362lib.eolian_parameter_is_move.argtypes = (c_void_p,)
363lib.eolian_parameter_is_move.restype = c_bool
364
352# EAPI Eina_Stringshare *eolian_parameter_c_type_get(const Eolian_Function_Parameter *param_desc, Eina_Bool as_return); 365# EAPI Eina_Stringshare *eolian_parameter_c_type_get(const Eolian_Function_Parameter *param_desc, Eina_Bool as_return);
353lib.eolian_parameter_c_type_get.argtypes = (c_void_p, c_bool) 366lib.eolian_parameter_c_type_get.argtypes = (c_void_p, c_bool)
354lib.eolian_parameter_c_type_get.restype = c_void_p # Stringshare TO BE FREED 367lib.eolian_parameter_c_type_get.restype = c_void_p # Stringshare TO BE FREED
@@ -540,6 +553,18 @@ lib.eolian_typedecl_struct_field_documentation_get.restype = c_void_p
540lib.eolian_typedecl_struct_field_type_get.argtypes = (c_void_p,) 553lib.eolian_typedecl_struct_field_type_get.argtypes = (c_void_p,)
541lib.eolian_typedecl_struct_field_type_get.restype = c_void_p 554lib.eolian_typedecl_struct_field_type_get.restype = c_void_p
542 555
556# EAPI Eina_Bool eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl);
557lib.eolian_typedecl_struct_field_is_by_ref.argtypes = (c_void_p,)
558lib.eolian_typedecl_struct_field_is_by_ref.restype = c_bool
559
560# EAPI Eina_Bool eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl);
561lib.eolian_typedecl_struct_field_is_move.argtypes = (c_void_p,)
562lib.eolian_typedecl_struct_field_is_move.restype = c_bool
563
564# EAPI Eina_Stringshare *eolian_typedecl_struct_field_c_type_get(const Eolian_Struct_Type_Field *fl);
565lib.eolian_typedecl_struct_field_c_type_get.argtypes = (c_void_p,)
566lib.eolian_typedecl_struct_field_c_type_get.restype = c_void_p # Stringshare TO BE FREED
567
543# EAPI Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp); 568# EAPI Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
544lib.eolian_typedecl_enum_fields_get.argtypes = (c_void_p,) 569lib.eolian_typedecl_enum_fields_get.argtypes = (c_void_p,)
545lib.eolian_typedecl_enum_fields_get.restype = c_void_p 570lib.eolian_typedecl_enum_fields_get.restype = c_void_p
@@ -623,6 +648,10 @@ lib.eolian_type_aliased_base_get.restype = c_void_p
623lib.eolian_type_class_get.argtypes = (c_void_p,) 648lib.eolian_type_class_get.argtypes = (c_void_p,)
624lib.eolian_type_class_get.restype = c_void_p 649lib.eolian_type_class_get.restype = c_void_p
625 650
651# EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp);
652lib.eolian_type_is_move.argtypes = (c_void_p,)
653lib.eolian_type_is_move.restype = c_bool
654
626# EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp); 655# EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
627lib.eolian_type_is_const.argtypes = (c_void_p,) 656lib.eolian_type_is_const.argtypes = (c_void_p,)
628lib.eolian_type_is_const.restype = c_bool 657lib.eolian_type_is_const.restype = c_bool
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index bc869c9370..4aa4588640 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -392,6 +392,13 @@ class TestEolianClass(object):
392 assert len(list(cls.implements)) > 5 392 assert len(list(cls.implements)) > 5
393 assert isinstance(list(cls.implements)[0], eolian.Implement) 393 assert isinstance(list(cls.implements)[0], eolian.Implement)
394 394
395 def test_mixins_requires(self, eolian_db):
396 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
397 assert len(list(cls.requires)) == 0
398 cls = eolian_db.class_by_name_get('Efl.File')
399 assert len(list(cls.requires)) == 1
400 assert list(cls.requires)[0].name == 'Efl.Object'
401
395 402
396class TestEolianFunction(object): 403class TestEolianFunction(object):
397 def test_function(self, eolian_db): 404 def test_function(self, eolian_db):
@@ -416,7 +423,9 @@ class TestEolianFunction(object):
416 assert len(list(f.getter_values)) == 1 423 assert len(list(f.getter_values)) == 1
417 assert len(list(f.getter_values)) == 1 424 assert len(list(f.getter_values)) == 1
418 assert len(list(f.parameters)) == 1 425 assert len(list(f.parameters)) == 1
419 assert f.return_allow_unused(eolian.Eolian_Function_Type.METHOD) is True 426 assert f.return_allow_unused(eolian.Eolian_Function_Type.PROP_GET) is True
427 assert f.return_is_by_ref(eolian.Eolian_Function_Type.PROP_GET) is False
428 assert f.return_is_move(eolian.Eolian_Function_Type.PROP_GET) is False
420 assert f.object_is_const is False 429 assert f.object_is_const is False
421 assert f.class_.name == 'Efl.Loop_Timer' 430 assert f.class_.name == 'Efl.Loop_Timer'
422 assert isinstance(f.implement, eolian.Implement) 431 assert isinstance(f.implement, eolian.Implement)
@@ -429,6 +438,8 @@ class TestEolianFunction(object):
429 assert p.name == 'add' 438 assert p.name == 'add'
430 assert p.default_value is None 439 assert p.default_value is None
431 assert p.is_optional is False 440 assert p.is_optional is False
441 assert p.is_by_ref is False
442 assert p.is_move is False
432 assert p.type.name == 'double' 443 assert p.type.name == 'double'
433 assert p.c_type_get(False) == 'double' 444 assert p.c_type_get(False) == 'double'
434 assert p.c_type_get(True) == 'double' 445 assert p.c_type_get(True) == 'double'
@@ -583,6 +594,9 @@ class TestEolianTypedecl(object):
583 assert field.name == 'b' 594 assert field.name == 'b'
584 assert isinstance(field.type, eolian.Type) 595 assert isinstance(field.type, eolian.Type)
585 assert isinstance(field.documentation, eolian.Documentation) 596 assert isinstance(field.documentation, eolian.Documentation)
597 assert field.c_type == "uint8_t"
598 assert field.is_by_ref is False
599 assert field.is_move is False
586 600
587 def test_typedecl_alias(self, eolian_db): 601 def test_typedecl_alias(self, eolian_db):
588 alias = eolian_db.alias_by_name_get('Eina.Error') 602 alias = eolian_db.alias_by_name_get('Eina.Error')
@@ -611,6 +625,7 @@ class TestEolianType(object):
611 assert t.next_type is None # TODO find a better test 625 assert t.next_type is None # TODO find a better test
612 assert t.is_const is False 626 assert t.is_const is False
613 assert t.is_ptr is False 627 assert t.is_ptr is False
628 assert t.is_move is False
614 assert list(t.namespaces) == [] 629 assert list(t.namespaces) == []
615 assert t.class_ is None 630 assert t.class_ is None
616 assert t == t.aliased_base # TODO find a better test 631 assert t == t.aliased_base # TODO find a better test
@@ -626,6 +641,9 @@ class TestEolianType(object):
626 assert t.type == eolian.Eolian_Type_Type.REGULAR 641 assert t.type == eolian.Eolian_Type_Type.REGULAR
627 assert t.builtin_type == eolian.Eolian_Type_Builtin_Type.INVALID 642 assert t.builtin_type == eolian.Eolian_Type_Builtin_Type.INVALID
628 assert t.file == 'efl_gfx_entity.eo' # TODO is this correct ? 643 assert t.file == 'efl_gfx_entity.eo' # TODO is this correct ?
644 assert t.is_const is False
645 assert t.is_ptr is False
646 assert t.is_move is False
629 assert list(t.namespaces) == ['Eina'] 647 assert list(t.namespaces) == ['Eina']
630 assert t.class_ is None 648 assert t.class_ is None
631 assert t == t.aliased_base 649 assert t == t.aliased_base
@@ -645,6 +663,9 @@ class TestEolianType(object):
645 assert t.type == eolian.Eolian_Type_Type.CLASS 663 assert t.type == eolian.Eolian_Type_Type.CLASS
646 assert t.builtin_type == eolian.Eolian_Type_Builtin_Type.INVALID 664 assert t.builtin_type == eolian.Eolian_Type_Builtin_Type.INVALID
647 assert t.file == 'efl_content.eo' # TODO is this correct ? 665 assert t.file == 'efl_content.eo' # TODO is this correct ?
666 assert t.is_const is False
667 assert t.is_ptr is False
668 assert t.is_move is False
648 assert list(t.namespaces) == ['Efl', 'Gfx'] 669 assert list(t.namespaces) == ['Efl', 'Gfx']
649 assert t == t.aliased_base 670 assert t == t.aliased_base
650 671