summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2019-09-29 10:19:11 +0200
committerDave Andreoli <dave@gurumeditation.it>2019-09-29 10:19:11 +0200
commitd1e27aacfc9ba004ec8f7ca083154032dbaab4ce (patch)
treead90f3cd68a0cd224499c51bfa934a24251ffcf3
parenta864d62ecfeb09177cc4f4d311351477879e229e (diff)
Pyolian: reformat code to make pycharm happy
and fix some typos in the code
-rw-r--r--src/scripts/pyolian/eolian.py157
-rw-r--r--src/scripts/pyolian/eolian_lib.py50
-rwxr-xr-xsrc/scripts/pyolian/generator.py16
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py93
4 files changed, 177 insertions, 139 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index bed0beab62..fb6963cd4f 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -35,8 +35,8 @@ except ImportError:
35 35
36_already_halted = False 36_already_halted = False
37 37
38### Eolian Enums ############################################################
39 38
39# Eolian Enums ##############################################################
40class Eolian_Function_Type(IntEnum): 40class Eolian_Function_Type(IntEnum):
41 UNRESOLVED = 0 41 UNRESOLVED = 0
42 PROPERTY = 1 42 PROPERTY = 1
@@ -45,12 +45,14 @@ class Eolian_Function_Type(IntEnum):
45 METHOD = 4 45 METHOD = 4
46 FUNCTION_POINTER = 5 46 FUNCTION_POINTER = 5
47 47
48
48class Eolian_Parameter_Direction(IntEnum): 49class Eolian_Parameter_Direction(IntEnum):
49 UNKNOWN = 0 50 UNKNOWN = 0
50 IN = 1 51 IN = 1
51 OUT = 2 52 OUT = 2
52 INOUT = 3 53 INOUT = 3
53 54
55
54class Eolian_Class_Type(IntEnum): 56class Eolian_Class_Type(IntEnum):
55 UNKNOWN_TYPE = 0 57 UNKNOWN_TYPE = 0
56 REGULAR = 1 58 REGULAR = 1
@@ -58,12 +60,14 @@ class Eolian_Class_Type(IntEnum):
58 MIXIN = 3 60 MIXIN = 3
59 INTERFACE = 4 61 INTERFACE = 4
60 62
63
61class Eolian_Object_Scope(IntEnum): 64class Eolian_Object_Scope(IntEnum):
62 UNKNOWN = 0 65 UNKNOWN = 0
63 PUBLIC = 1 66 PUBLIC = 1
64 PRIVATE = 2 67 PRIVATE = 2
65 PROTECTED = 3 68 PROTECTED = 3
66 69
70
67class Eolian_Typedecl_Type(IntEnum): 71class Eolian_Typedecl_Type(IntEnum):
68 UNKNOWN = 0 72 UNKNOWN = 0
69 STRUCT = 1 73 STRUCT = 1
@@ -72,6 +76,7 @@ class Eolian_Typedecl_Type(IntEnum):
72 ALIAS = 4 76 ALIAS = 4
73 FUNCTION_POINTER = 5 77 FUNCTION_POINTER = 5
74 78
79
75class Eolian_Type_Type(IntEnum): 80class Eolian_Type_Type(IntEnum):
76 UNKNOWN_TYPE = 0 81 UNKNOWN_TYPE = 0
77 VOID = 1 82 VOID = 1
@@ -79,6 +84,7 @@ class Eolian_Type_Type(IntEnum):
79 CLASS = 3 84 CLASS = 3
80 UNDEFINED = 4 85 UNDEFINED = 4
81 86
87
82class Eolian_Type_Builtin_Type(IntEnum): 88class Eolian_Type_Builtin_Type(IntEnum):
83 INVALID = 0 89 INVALID = 0
84 BYTE = 1 90 BYTE = 1
@@ -141,6 +147,7 @@ class Eolian_Type_Builtin_Type(IntEnum):
141 HASH = 47 147 HASH = 47
142 VOID_PTR = 48 148 VOID_PTR = 48
143 149
150
144class Eolian_Expression_Type(IntEnum): 151class Eolian_Expression_Type(IntEnum):
145 UNKNOWN = 0 152 UNKNOWN = 0
146 INT = 1 153 INT = 1
@@ -159,18 +166,20 @@ class Eolian_Expression_Type(IntEnum):
159 UNARY = 14 166 UNARY = 14
160 BINARY = 15 167 BINARY = 15
161 168
169
162class Eolian_Expression_Mask(IntEnum): 170class Eolian_Expression_Mask(IntEnum):
163 SINT = 1 << 0 171 SINT = 1 << 0
164 UINT = 1 << 1 172 UINT = 1 << 1
165 INT = SINT | UINT 173 INT = SINT | UINT
166 FLOAT = 1 << 2 174 FLOAT = 1 << 2
167 BOOL = 1 << 3 175 BOOL = 1 << 3
168 STRING = 1 << 4 176 STRING = 1 << 4
169 CHAR = 1 << 5 177 CHAR = 1 << 5
170 NULL = 1 << 6 178 NULL = 1 << 6
171 SIGNED = SINT | FLOAT 179 SIGNED = SINT | FLOAT
172 NUMBER = INT | FLOAT 180 NUMBER = INT | FLOAT
173 ALL = NUMBER | BOOL | STRING | CHAR | NULL 181 ALL = NUMBER | BOOL | STRING | CHAR | NULL
182
174 183
175class Eolian_Binary_Operator(IntEnum): 184class Eolian_Binary_Operator(IntEnum):
176 INVALID = 0 185 INVALID = 0
@@ -186,12 +195,13 @@ class Eolian_Binary_Operator(IntEnum):
186 GE = 10 # >= int, float 195 GE = 10 # >= int, float
187 LE = 11 # <= int, float 196 LE = 11 # <= int, float
188 AND = 12 # && all types 197 AND = 12 # && all types
189 OR = 13 # || all types 198 OR = 13 # || all types
190 BAND = 14 # & int 199 BAND = 14 # & int
191 BOR = 15 # | int 200 BOR = 15 # | int
192 BXOR = 16 # ^ int 201 BXOR = 16 # ^ int
193 LSH = 17 # << int 202 LSH = 17 # << int
194 RSH = 18 # >> int 203 RSH = 18 # >> int
204
195 205
196class Eolian_Unary_Operator(IntEnum): 206class Eolian_Unary_Operator(IntEnum):
197 INVALID = 0 207 INVALID = 0
@@ -200,6 +210,7 @@ class Eolian_Unary_Operator(IntEnum):
200 NOT = 3 # ! int, float, bool 210 NOT = 3 # ! int, float, bool
201 BNOT = 4 # ~ int 211 BNOT = 4 # ~ int
202 212
213
203class Eolian_Doc_Token_Type(IntEnum): 214class Eolian_Doc_Token_Type(IntEnum):
204 UNKNOWN = 0 215 UNKNOWN = 0
205 TEXT = 1 216 TEXT = 1
@@ -211,12 +222,12 @@ class Eolian_Doc_Token_Type(IntEnum):
211 MARKUP_MONOSPACE = 7 222 MARKUP_MONOSPACE = 7
212 223
213 224
214### internal Classes ######################################################## 225# Internal Classes ##########################################################
215 226
216class Iterator(object): 227class Iterator(object):
217 """ Generic eina iterator wrapper """ 228 """ Generic eina iterator wrapper """
218 def __init__(self, conv_func, iterator): 229 def __init__(self, conv_func, iterator):
219 self.next = self.__next__ # py2 compat 230 self.next = self.__next__ # py2 compat
220 self._conv = conv_func 231 self._conv = conv_func
221 self._iter = c_void_p(iterator) 232 self._iter = c_void_p(iterator)
222 self._tmp = c_void_p(0) 233 self._tmp = c_void_p(0)
@@ -251,6 +262,7 @@ class cached_property(object):
251 262
252class EolianBaseObject(object): 263class EolianBaseObject(object):
253 __instances_cache = {} 264 __instances_cache = {}
265
254 def __new__(cls, c_obj_pointer=None, *args, **kargs): 266 def __new__(cls, c_obj_pointer=None, *args, **kargs):
255 # cannot cache without a pointer 267 # cannot cache without a pointer
256 if c_obj_pointer is None: 268 if c_obj_pointer is None:
@@ -307,7 +319,7 @@ class EolianBaseObject(object):
307 return self._obj 319 return self._obj
308 320
309 321
310### Main Eolian Unit ######################################################## 322# Main Eolian Unit ##########################################################
311 323
312class Eolian_Unit(EolianBaseObject): 324class Eolian_Unit(EolianBaseObject):
313 def __repr__(self): 325 def __repr__(self):
@@ -451,7 +463,7 @@ class Eolian_State(Eolian_Unit):
451 463
452 def objects_by_file_get(self, file_name): 464 def objects_by_file_get(self, file_name):
453 return Iterator(Object, 465 return Iterator(Object,
454 lib.eolian_state_objects_by_file_get(self, _str_to_bytes(file_name))) 466 lib.eolian_state_objects_by_file_get(self, _str_to_bytes(file_name)))
455 467
456 def class_by_file_get(self, file_name): 468 def class_by_file_get(self, file_name):
457 c_cls = lib.eolian_state_class_by_file_get(self, _str_to_bytes(file_name)) 469 c_cls = lib.eolian_state_class_by_file_get(self, _str_to_bytes(file_name))
@@ -459,22 +471,22 @@ class Eolian_State(Eolian_Unit):
459 471
460 def constants_by_file_get(self, file_name): 472 def constants_by_file_get(self, file_name):
461 return Iterator(Constant, 473 return Iterator(Constant,
462 lib.eolian_state_constants_by_file_get(self, _str_to_bytes(file_name))) 474 lib.eolian_state_constants_by_file_get(self, _str_to_bytes(file_name)))
463 475
464 def aliases_by_file_get(self, file_name): 476 def aliases_by_file_get(self, file_name):
465 return Iterator(Typedecl, 477 return Iterator(Typedecl,
466 lib.eolian_state_aliases_by_file_get(self, _str_to_bytes(file_name))) 478 lib.eolian_state_aliases_by_file_get(self, _str_to_bytes(file_name)))
467 479
468 def structs_by_file_get(self, file_name): 480 def structs_by_file_get(self, file_name):
469 return Iterator(Typedecl, 481 return Iterator(Typedecl,
470 lib.eolian_state_structs_by_file_get(self, _str_to_bytes(file_name))) 482 lib.eolian_state_structs_by_file_get(self, _str_to_bytes(file_name)))
471 483
472 def enums_by_file_get(self, file_name): 484 def enums_by_file_get(self, file_name):
473 return Iterator(Typedecl, 485 return Iterator(Typedecl,
474 lib.eolian_state_enums_by_file_get(self, _str_to_bytes(file_name))) 486 lib.eolian_state_enums_by_file_get(self, _str_to_bytes(file_name)))
475 487
476 488
477### Namespace Utility Class ################################################# 489# Namespace Utility Class ###################################################
478 490
479class Namespace(object): 491class Namespace(object):
480 def __init__(self, unit, namespace_name): 492 def __init__(self, unit, namespace_name):
@@ -512,55 +524,55 @@ class Namespace(object):
512 def sub_namespaces(self): 524 def sub_namespaces(self):
513 base = self._name + '.' 525 base = self._name + '.'
514 deep = self._name.count('.') + 1 526 deep = self._name.count('.') + 1
515 return [ ns for ns in self._unit.all_namespaces 527 return [ns for ns in self._unit.all_namespaces
516 if ns.name.startswith(base) and ns.name.count('.') == deep ] 528 if ns.name.startswith(base) and ns.name.count('.') == deep]
517 529
518 @property 530 @property
519 def classes(self): 531 def classes(self):
520 return sorted([ c for c in self._unit.classes 532 return sorted([c for c in self._unit.classes
521 if c.namespace == self._name ]) 533 if c.namespace == self._name])
522 534
523 @property 535 @property
524 def regulars(self): 536 def regulars(self):
525 return sorted([ c for c in self._unit.classes 537 return sorted([c for c in self._unit.classes
526 if c.type == Eolian_Class_Type.REGULAR and 538 if c.type == Eolian_Class_Type.REGULAR
527 c.namespace == self._name]) 539 and c.namespace == self._name])
528 540
529 @property 541 @property
530 def abstracts(self): 542 def abstracts(self):
531 return sorted([ c for c in self._unit.classes 543 return sorted([c for c in self._unit.classes
532 if c.type == Eolian_Class_Type.ABSTRACT and 544 if c.type == Eolian_Class_Type.ABSTRACT
533 c.namespace == self._name]) 545 and c.namespace == self._name])
534 546
535 @property 547 @property
536 def mixins(self): 548 def mixins(self):
537 return sorted([ c for c in self._unit.classes 549 return sorted([c for c in self._unit.classes
538 if c.type == Eolian_Class_Type.MIXIN and 550 if c.type == Eolian_Class_Type.MIXIN
539 c.namespace == self._name]) 551 and c.namespace == self._name])
540 552
541 @property 553 @property
542 def interfaces(self): 554 def interfaces(self):
543 return sorted([ c for c in self._unit.classes 555 return sorted([c for c in self._unit.classes
544 if c.type == Eolian_Class_Type.INTERFACE and 556 if c.type == Eolian_Class_Type.INTERFACE
545 c.namespace == self._name]) 557 and c.namespace == self._name])
546 558
547 @property 559 @property
548 def aliases(self): 560 def aliases(self):
549 return sorted([ td for td in self._unit.aliases 561 return sorted([td for td in self._unit.aliases
550 if td.namespace == self._name]) 562 if td.namespace == self._name])
551 563
552 @property 564 @property
553 def structs(self): 565 def structs(self):
554 return sorted([ td for td in self._unit.structs 566 return sorted([td for td in self._unit.structs
555 if td.namespace == self._name]) 567 if td.namespace == self._name])
556 568
557 @property 569 @property
558 def enums(self): 570 def enums(self):
559 return sorted([ td for td in self._unit.enums 571 return sorted([td for td in self._unit.enums
560 if td.namespace == self._name]) 572 if td.namespace == self._name])
561 573
562 574
563### Eolian Classes ########################################################## 575# Eolian Classes ############################################################
564 576
565class Object(EolianBaseObject): 577class Object(EolianBaseObject):
566 def __new__(cls, c_obj_pointer): 578 def __new__(cls, c_obj_pointer):
@@ -680,27 +692,27 @@ class Class(Object):
680 692
681 @cached_property 693 @cached_property
682 def inherits_full(self): 694 def inherits_full(self):
683 L = [] 695 li = []
684 696
685 def do_class_recursive(cls): 697 def do_class_recursive(cls):
686 if cls.parent: 698 if cls.parent:
687 L.append(cls.parent) 699 li.append(cls.parent)
688 for other in cls.extensions: 700 for other in cls.extensions:
689 if other not in L: 701 if other not in li:
690 L.append(other) 702 li.append(other)
691 do_class_recursive(other) 703 do_class_recursive(other)
692 704
693 do_class_recursive(self) 705 do_class_recursive(self)
694 return L 706 return li
695 707
696 @cached_property 708 @cached_property
697 def hierarchy(self): 709 def hierarchy(self):
698 L = [] 710 li = []
699 base = self.parent 711 base = self.parent
700 while base: 712 while base:
701 L.append(base) 713 li.append(base)
702 base = base.parent 714 base = base.parent
703 return L 715 return li
704 716
705 @cached_property 717 @cached_property
706 def ctor_enable(self): 718 def ctor_enable(self):
@@ -710,10 +722,10 @@ class Class(Object):
710 def dtor_enable(self): 722 def dtor_enable(self):
711 return bool(lib.eolian_class_dtor_enable_get(self)) 723 return bool(lib.eolian_class_dtor_enable_get(self))
712 724
713 def function_by_name_get(self, func_name, 725 def function_by_name_get(self, function_name,
714 ftype=Eolian_Function_Type.UNRESOLVED): 726 ftype=Eolian_Function_Type.UNRESOLVED):
715 f = lib.eolian_class_function_by_name_get(self, 727 f = lib.eolian_class_function_by_name_get(self,
716 _str_to_bytes(func_name), 728 _str_to_bytes(function_name),
717 ftype) 729 ftype)
718 return Function(f) if f else None 730 return Function(f) if f else None
719 731
@@ -868,36 +880,40 @@ class Function(Object):
868 return Iterator(Function_Parameter, 880 return Iterator(Function_Parameter,
869 lib.eolian_function_parameters_get(self)) 881 lib.eolian_function_parameters_get(self))
870 882
871 def values_get(self, ftype): # TODO rename in property_values_get (or implement a proper Property class?) 883 def values_get(self, ftype):
884 # TODO rename in property_values_get
885 # (or implement a proper Property class?)
872 return Iterator(Function_Parameter, 886 return Iterator(Function_Parameter,
873 lib.eolian_property_values_get(self, ftype)) 887 lib.eolian_property_values_get(self, ftype))
874 888
875 @property 889 @property
876 def getter_values(self): # TODO rename ... 890 def getter_values(self): # TODO rename ...
877 return self.values_get(Eolian_Function_Type.PROP_GET) 891 return self.values_get(Eolian_Function_Type.PROP_GET)
878 892
879 @property 893 @property
880 def setter_values(self): # TODO rename ... 894 def setter_values(self): # TODO rename ...
881 return self.values_get(Eolian_Function_Type.PROP_SET) 895 return self.values_get(Eolian_Function_Type.PROP_SET)
882 896
883 def keys_get(self, ftype): # TODO rename in property_keys_get (or implement a proper Property class?) 897 def keys_get(self, ftype):
898 # TODO rename in property_keys_get
899 # (or implement a proper Property class?)
884 return Iterator(Function_Parameter, 900 return Iterator(Function_Parameter,
885 lib.eolian_property_keys_get(self, ftype)) 901 lib.eolian_property_keys_get(self, ftype))
886 902
887 @property 903 @property
888 def getter_keys(self): # TODO rename ... 904 def getter_keys(self): # TODO rename ...
889 return self.keys_get(Eolian_Function_Type.PROP_GET) 905 return self.keys_get(Eolian_Function_Type.PROP_GET)
890 906
891 @property 907 @property
892 def setter_keys(self): # TODO rename ... 908 def setter_keys(self): # TODO rename ...
893 return self.keys_get(Eolian_Function_Type.PROP_SET) 909 return self.keys_get(Eolian_Function_Type.PROP_SET)
894 910
895 def return_type_get(self, ftype): 911 def return_type_get(self, ftype):
896 c_type = lib.eolian_function_return_type_get(self, ftype) 912 c_type = lib.eolian_function_return_type_get(self, ftype)
897 return Type(c_type) if c_type else None 913 return Type(c_type) if c_type else None
898 914
899 def return_default_value(self, ftye): 915 def return_default_value(self, ftype):
900 c_expr = lib.eolian_function_return_default_value_get(sel._obj, ftype) 916 c_expr = lib.eolian_function_return_default_value_get(self._obj, ftype)
901 return Expression(c_expr) if c_expr else None 917 return Expression(c_expr) if c_expr else None
902 918
903 def return_documentation(self, ftype): 919 def return_documentation(self, ftype):
@@ -1019,7 +1035,7 @@ class Implement(Object):
1019 1035
1020class Type(Object): 1036class Type(Object):
1021 def __repr__(self): 1037 def __repr__(self):
1022 # return "<eolian.Type '{0.name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self) 1038 # return "<eolian.Type '{0.name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self)
1023 return "<eolian.Type '{0.name}', type={0.type!s}>".format(self) 1039 return "<eolian.Type '{0.name}', type={0.type!s}>".format(self)
1024 1040
1025 @cached_property 1041 @cached_property
@@ -1326,11 +1342,12 @@ class Documentation_Token(object):
1326 return self._ref 1342 return self._ref
1327 1343
1328 1344
1329### internal string encode/decode ########################################### 1345# internal string encode/decode #############################################
1330 1346
1331def _str_to_bytes(s): 1347def _str_to_bytes(s):
1332 return s.encode('utf-8') 1348 return s.encode('utf-8')
1333 1349
1350
1334def _str_to_py(s): 1351def _str_to_py(s):
1335 if s is None: 1352 if s is None:
1336 return None 1353 return None
@@ -1345,7 +1362,7 @@ def _str_to_py(s):
1345 print('WARNING !!!!!!!!! Unknown type: %s' % type(s)) 1362 print('WARNING !!!!!!!!! Unknown type: %s' % type(s))
1346 1363
1347 1364
1348### internal Object type -> Class mapping ################################### 1365# internal Object type -> Class mapping #####################################
1349 1366
1350class _Eolian_Object_Type(IntEnum): 1367class _Eolian_Object_Type(IntEnum):
1351 UNKNOWN = 0 1368 UNKNOWN = 0
@@ -1364,6 +1381,7 @@ class _Eolian_Object_Type(IntEnum):
1364 CONSTRUCTOR = 13 1381 CONSTRUCTOR = 13
1365 DOCUMENTATION = 14 1382 DOCUMENTATION = 14
1366 1383
1384
1367_eolian_type_class_mapping = { 1385_eolian_type_class_mapping = {
1368 _Eolian_Object_Type.UNKNOWN: Object, 1386 _Eolian_Object_Type.UNKNOWN: Object,
1369 _Eolian_Object_Type.CLASS: Class, 1387 _Eolian_Object_Type.CLASS: Class,
@@ -1382,17 +1400,20 @@ _eolian_type_class_mapping = {
1382 _Eolian_Object_Type.DOCUMENTATION: Documentation, 1400 _Eolian_Object_Type.DOCUMENTATION: Documentation,
1383} 1401}
1384 1402
1385### module init/shutdown #################################################### 1403
1404# module init/shutdown ######################################################
1405
1386def _cleanup(): 1406def _cleanup():
1387 global _already_halted 1407 global _already_halted
1388 lib.eolian_shutdown() 1408 lib.eolian_shutdown()
1389 _already_halted = True 1409 _already_halted = True
1390 1410
1411
1391lib.eolian_init() 1412lib.eolian_init()
1392atexit.register(_cleanup) 1413atexit.register(_cleanup)
1393 1414
1394 1415
1395### API coverage statistics ################################################# 1416# API coverage statistics ###################################################
1396 1417
1397if __name__ == '__main__': 1418if __name__ == '__main__':
1398 import sys 1419 import sys
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index f219eecfd7..4ab968eb4d 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -29,7 +29,7 @@ for lib_dir in search_in:
29 file_path = f 29 file_path = f
30 30
31if not file_path: 31if not file_path:
32 raise RuntimeError('Error: cannot find a built eolian library in source tree') 32 raise RuntimeError('Error: cannot find a built eolian lib in source tree')
33 33
34lib = CDLL(file_path) 34lib = CDLL(file_path)
35 35
@@ -42,7 +42,8 @@ lib.eolian_init.restype = c_int
42lib.eolian_shutdown.argtypes = None 42lib.eolian_shutdown.argtypes = None
43lib.eolian_shutdown.restype = c_int 43lib.eolian_shutdown.restype = c_int
44 44
45### Eolian_State ############################################################ 45
46# Eolian_State ##############################################################
46 47
47# EAPI Eolian_State *eolian_state_new(void); 48# EAPI Eolian_State *eolian_state_new(void);
48lib.eolian_state_new.argtypes = None 49lib.eolian_state_new.argtypes = None
@@ -124,7 +125,8 @@ lib.eolian_state_structs_by_file_get.restype = c_void_p
124lib.eolian_state_enums_by_file_get.argtypes = (c_void_p, c_char_p) 125lib.eolian_state_enums_by_file_get.argtypes = (c_void_p, c_char_p)
125lib.eolian_state_enums_by_file_get.restype = c_void_p 126lib.eolian_state_enums_by_file_get.restype = c_void_p
126 127
127### Eolian_Unit ############################################################# 128
129# Eolian_Unit ###############################################################
128 130
129# EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit); 131# EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
130lib.eolian_unit_children_get.argtypes = (c_void_p,) 132lib.eolian_unit_children_get.argtypes = (c_void_p,)
@@ -186,7 +188,8 @@ lib.eolian_unit_constant_by_name_get.restype = c_void_p
186lib.eolian_unit_constants_get.argtypes = (c_void_p,) 188lib.eolian_unit_constants_get.argtypes = (c_void_p,)
187lib.eolian_unit_constants_get.restype = c_void_p 189lib.eolian_unit_constants_get.restype = c_void_p
188 190
189### Eolian_Object ########################################################### 191
192# Eolian_Object #############################################################
190 193
191# EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj); 194# EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj);
192lib.eolian_object_type_get.argtypes = (c_void_p,) 195lib.eolian_object_type_get.argtypes = (c_void_p,)
@@ -224,7 +227,8 @@ lib.eolian_object_namespaces_get.restype = c_void_p
224lib.eolian_object_is_beta.argtypes = (c_void_p,) 227lib.eolian_object_is_beta.argtypes = (c_void_p,)
225lib.eolian_object_is_beta.restype = c_bool 228lib.eolian_object_is_beta.restype = c_bool
226 229
227### Eolian_Class ############################################################ 230
231# Eolian_Class ##############################################################
228 232
229# EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); 233# EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
230lib.eolian_class_type_get.argtypes = (c_void_p,) 234lib.eolian_class_type_get.argtypes = (c_void_p,)
@@ -302,7 +306,8 @@ lib.eolian_class_c_macro_get.restype = c_void_p # Stringshare TO BE FREED
302lib.eolian_class_c_data_type_get.argtypes = (c_void_p,) 306lib.eolian_class_c_data_type_get.argtypes = (c_void_p,)
303lib.eolian_class_c_data_type_get.restype = c_void_p # Stringshare TO BE FREED 307lib.eolian_class_c_data_type_get.restype = c_void_p # Stringshare TO BE FREED
304 308
305### Eolian_Function ######################################################### 309
310# Eolian_Function ###########################################################
306 311
307# EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id); 312# EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
308lib.eolian_function_type_get.argtypes = (c_void_p,) 313lib.eolian_function_type_get.argtypes = (c_void_p,)
@@ -369,7 +374,8 @@ lib.eolian_property_keys_get.restype = c_void_p
369lib.eolian_property_values_get.argtypes = (c_void_p, c_int) 374lib.eolian_property_values_get.argtypes = (c_void_p, c_int)
370lib.eolian_property_values_get.restype = c_void_p 375lib.eolian_property_values_get.restype = c_void_p
371 376
372### Eolian_Function_Parameter ############################################### 377
378# Eolian_Function_Parameter #################################################
373 379
374# EAPI Eolian_Parameter_Direction eolian_parameter_direction_get(const Eolian_Function_Parameter *param); 380# EAPI Eolian_Parameter_Direction eolian_parameter_direction_get(const Eolian_Function_Parameter *param);
375lib.eolian_parameter_direction_get.argtypes = (c_void_p,) 381lib.eolian_parameter_direction_get.argtypes = (c_void_p,)
@@ -391,7 +397,8 @@ lib.eolian_parameter_documentation_get.restype = c_void_p
391lib.eolian_parameter_is_optional.argtypes = (c_void_p,) 397lib.eolian_parameter_is_optional.argtypes = (c_void_p,)
392lib.eolian_parameter_is_optional.restype = c_bool 398lib.eolian_parameter_is_optional.restype = c_bool
393 399
394### Eolian_Implement ######################################################## 400
401# Eolian_Implement ##########################################################
395 402
396# EAPI const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl); 403# EAPI const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
397lib.eolian_implement_class_get.argtypes = (c_void_p,) 404lib.eolian_implement_class_get.argtypes = (c_void_p,)
@@ -425,7 +432,8 @@ lib.eolian_implement_is_prop_get.restype = c_bool
425lib.eolian_implement_is_prop_set.argtypes = (c_void_p,) 432lib.eolian_implement_is_prop_set.argtypes = (c_void_p,)
426lib.eolian_implement_is_prop_set.restype = c_bool 433lib.eolian_implement_is_prop_set.restype = c_bool
427 434
428### Eolian_Constructor ###################################################### 435
436# Eolian_Constructor ########################################################
429 437
430# EAPI const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor); 438# EAPI const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor);
431lib.eolian_constructor_class_get.argtypes = (c_void_p,) 439lib.eolian_constructor_class_get.argtypes = (c_void_p,)
@@ -439,7 +447,8 @@ lib.eolian_constructor_function_get.restype = c_void_p
439lib.eolian_constructor_is_optional.argtypes = (c_void_p,) 447lib.eolian_constructor_is_optional.argtypes = (c_void_p,)
440lib.eolian_constructor_is_optional.restype = c_bool 448lib.eolian_constructor_is_optional.restype = c_bool
441 449
442### Eolian_Event ############################################################ 450
451# Eolian_Event ##############################################################
443 452
444# EAPI Eina_Stringshare *eolian_event_c_macro_get(const Eolian_Event *event); 453# EAPI Eina_Stringshare *eolian_event_c_macro_get(const Eolian_Event *event);
445lib.eolian_event_c_macro_get.argtypes = (c_void_p,) 454lib.eolian_event_c_macro_get.argtypes = (c_void_p,)
@@ -465,7 +474,8 @@ lib.eolian_event_is_hot.restype = c_bool
465lib.eolian_event_is_restart.argtypes = (c_void_p,) 474lib.eolian_event_is_restart.argtypes = (c_void_p,)
466lib.eolian_event_is_restart.restype = c_bool 475lib.eolian_event_is_restart.restype = c_bool
467 476
468### Eolian_Part ############################################################# 477
478# Eolian_Part ###############################################################
469 479
470# EAPI const Eolian_Class *eolian_part_class_get(const Eolian_Part *part); 480# EAPI const Eolian_Class *eolian_part_class_get(const Eolian_Part *part);
471lib.eolian_part_class_get.argtypes = (c_void_p,) 481lib.eolian_part_class_get.argtypes = (c_void_p,)
@@ -475,7 +485,8 @@ lib.eolian_part_class_get.restype = c_void_p
475lib.eolian_part_documentation_get.argtypes = (c_void_p,) 485lib.eolian_part_documentation_get.argtypes = (c_void_p,)
476lib.eolian_part_documentation_get.restype = c_void_p 486lib.eolian_part_documentation_get.restype = c_void_p
477 487
478### Eolian_Typedecl ######################################################### 488
489# Eolian_Typedecl ###########################################################
479 490
480# EAPI Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp); 491# EAPI Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
481lib.eolian_typedecl_type_get.argtypes = (c_void_p,) 492lib.eolian_typedecl_type_get.argtypes = (c_void_p,)
@@ -549,7 +560,8 @@ lib.eolian_typedecl_free_func_get.restype = c_char_p
549lib.eolian_typedecl_function_pointer_get.argtypes = (c_void_p,) 560lib.eolian_typedecl_function_pointer_get.argtypes = (c_void_p,)
550lib.eolian_typedecl_function_pointer_get.restype = c_void_p 561lib.eolian_typedecl_function_pointer_get.restype = c_void_p
551 562
552### Eolian_Type ############################################################# 563
564# Eolian_Type ###############################################################
553 565
554# EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp); 566# EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
555lib.eolian_type_type_get.argtypes = (c_void_p,) 567lib.eolian_type_type_get.argtypes = (c_void_p,)
@@ -588,10 +600,11 @@ lib.eolian_type_is_ptr.argtypes = (c_void_p,)
588lib.eolian_type_is_ptr.restype = c_bool 600lib.eolian_type_is_ptr.restype = c_bool
589 601
590# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp); 602# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
591lib.eolian_type_c_type_get.argtypes = (c_void_p) 603lib.eolian_type_c_type_get.argtypes = (c_void_p,)
592lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED 604lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED
593 605
594### Eolian_Expression ####################################################### 606
607# Eolian_Expression #########################################################
595 608
596# EAPI Eina_Stringshare *eolian_expression_serialize(const Eolian_Expression *expr); 609# EAPI Eina_Stringshare *eolian_expression_serialize(const Eolian_Expression *expr);
597lib.eolian_expression_serialize.argtypes = (c_void_p,) 610lib.eolian_expression_serialize.argtypes = (c_void_p,)
@@ -621,7 +634,8 @@ lib.eolian_expression_unary_operator_get.restype = c_int
621lib.eolian_expression_unary_expression_get.argtypes = (c_void_p,) 634lib.eolian_expression_unary_expression_get.argtypes = (c_void_p,)
622lib.eolian_expression_unary_expression_get.restype = c_void_p 635lib.eolian_expression_unary_expression_get.restype = c_void_p
623 636
624### Eolian_Constant ######################################################### 637
638# Eolian_Constant ###########################################################
625 639
626# EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var); 640# EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var);
627lib.eolian_constant_documentation_get.argtypes = (c_void_p,) 641lib.eolian_constant_documentation_get.argtypes = (c_void_p,)
@@ -639,7 +653,8 @@ lib.eolian_constant_value_get.restype = c_void_p
639lib.eolian_constant_is_extern.argtypes = (c_void_p,) 653lib.eolian_constant_is_extern.argtypes = (c_void_p,)
640lib.eolian_constant_is_extern.restype = c_bool 654lib.eolian_constant_is_extern.restype = c_bool
641 655
642### Eolian_Documentation #################################################### 656
657# Eolian_Documentation ######################################################
643 658
644# EAPI Eina_Stringshare *eolian_documentation_summary_get(const Eolian_Documentation *doc); 659# EAPI Eina_Stringshare *eolian_documentation_summary_get(const Eolian_Documentation *doc);
645lib.eolian_documentation_summary_get.argtypes = (c_void_p,) 660lib.eolian_documentation_summary_get.argtypes = (c_void_p,)
@@ -677,4 +692,3 @@ lib.eolian_doc_token_text_get.restype = c_void_p # char* TO BE FREED
677# EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2); 692# EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2);
678# lib.eolian_doc_token_ref_resolve.argtypes = (c_void_p, c_void_p, ???, ???) 693# lib.eolian_doc_token_ref_resolve.argtypes = (c_void_p, c_void_p, ???, ???)
679# lib.eolian_doc_token_ref_resolve.restype = c_int 694# lib.eolian_doc_token_ref_resolve.restype = c_int
680
diff --git a/src/scripts/pyolian/generator.py b/src/scripts/pyolian/generator.py
index 5d119d3511..71fb312ad6 100755
--- a/src/scripts/pyolian/generator.py
+++ b/src/scripts/pyolian/generator.py
@@ -41,6 +41,7 @@ PYTHON_PATH, fe:
41""" 41"""
42import os 42import os
43import datetime 43import datetime
44import atexit
44 45
45try: 46try:
46 from . import eolian 47 from . import eolian
@@ -70,11 +71,13 @@ if not eolian_db.all_eot_files_parse():
70if not eolian_db.all_eo_files_parse(): 71if not eolian_db.all_eo_files_parse():
71 raise(RuntimeError('Eolian, failed to parse all EO files')) 72 raise(RuntimeError('Eolian, failed to parse all EO files'))
72 73
74
73# cleanup the database on exit 75# cleanup the database on exit
74import atexit
75def cleanup_db(): 76def cleanup_db():
76 global eolian_db 77 global eolian_db
77 del eolian_db 78 del eolian_db
79
80
78atexit.register(cleanup_db) 81atexit.register(cleanup_db)
79 82
80 83
@@ -92,11 +95,12 @@ class Template(pyratemp.Template):
92 filename: Template file to load. (REQUIRED) 95 filename: Template file to load. (REQUIRED)
93 context: User provided context for the template (dict). 96 context: User provided context for the template (dict).
94 """ 97 """
98
95 def __init__(self, filename, encoding='utf-8', context=None, escape=None, 99 def __init__(self, filename, encoding='utf-8', context=None, escape=None,
96 loader_class=pyratemp.LoaderFile, 100 loader_class=pyratemp.LoaderFile,
97 parser_class=pyratemp.Parser, 101 parser_class=pyratemp.Parser,
98 renderer_class=pyratemp.Renderer, 102 renderer_class=pyratemp.Renderer,
99 eval_class=pyratemp.EvalPseudoSandbox): 103 eval_class=pyratemp.EvalPseudoSandbox):
100 104
101 # Build the global context for the template 105 # Build the global context for the template
102 global_ctx = {} 106 global_ctx = {}
@@ -154,7 +158,7 @@ class Template(pyratemp.Template):
154 eval_class=eval_class) 158 eval_class=eval_class)
155 159
156 def render(self, filename=None, verbose=True, cls=None, ns=None, 160 def render(self, filename=None, verbose=True, cls=None, ns=None,
157 struct=None, enum=None, alias=None, **kargs): 161 struct=None, enum=None, alias=None, **kargs):
158 # Build the context for the template 162 # Build the context for the template
159 ctx = {} 163 ctx = {}
160 if kargs: 164 if kargs:
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index 7e2d1402c0..0271e50117 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -99,26 +99,26 @@ class TestEolianUnit(unittest.TestCase):
99 99
100 @unittest.skip('Skipped until unit/state support is fixed') 100 @unittest.skip('Skipped until unit/state support is fixed')
101 def test_children_listing(self): 101 def test_children_listing(self):
102 l = list(eolian_db.children) 102 li = list(eolian_db.children)
103 self.assertGreater(len(l), 500) 103 self.assertGreater(len(li), 500)
104 self.assertIsInstance(l[0], eolian.Eolian_Unit) 104 self.assertIsInstance(li[0], eolian.Eolian_Unit)
105 105
106 def test_file_listing(self): 106 def test_file_listing(self):
107 l = list(eolian_db.eo_file_paths) 107 li = list(eolian_db.eo_file_paths)
108 self.assertGreater(len(l), 400) 108 self.assertGreater(len(li), 400)
109 self.assertTrue(l[0].endswith('.eo')) 109 self.assertTrue(li[0].endswith('.eo'))
110 110
111 l = list(eolian_db.eo_files) 111 li = list(eolian_db.eo_files)
112 self.assertGreater(len(l), 400) 112 self.assertGreater(len(li), 400)
113 self.assertTrue(l[0].endswith('.eo')) 113 self.assertTrue(li[0].endswith('.eo'))
114 114
115 l = list(eolian_db.eot_file_paths) 115 li = list(eolian_db.eot_file_paths)
116 self.assertGreater(len(l), 10) 116 self.assertGreater(len(li), 10)
117 self.assertTrue(l[0].endswith('.eot')) 117 self.assertTrue(li[0].endswith('.eot'))
118 118
119 l = list(eolian_db.eot_files) 119 li = list(eolian_db.eot_files)
120 self.assertGreater(len(l), 10) 120 self.assertGreater(len(li), 10)
121 self.assertTrue(l[0].endswith('.eot')) 121 self.assertTrue(li[0].endswith('.eot'))
122 122
123 def test_object_listing(self): 123 def test_object_listing(self):
124 unit = eolian_db.unit_by_file_get('efl_ui_win.eo') 124 unit = eolian_db.unit_by_file_get('efl_ui_win.eo')
@@ -137,10 +137,10 @@ class TestEolianUnit(unittest.TestCase):
137 self.assertGreater(count, 5) 137 self.assertGreater(count, 5)
138 138
139 def test_enum_listing(self): 139 def test_enum_listing(self):
140 l = list(eolian_db.enums_by_file_get('efl_ui_win.eo')) 140 li = list(eolian_db.enums_by_file_get('efl_ui_win.eo'))
141 self.assertGreater(len(l), 5) 141 self.assertGreater(len(li), 5)
142 self.assertIsInstance(l[0], eolian.Typedecl) 142 self.assertIsInstance(li[0], eolian.Typedecl)
143 self.assertEqual(l[0].type, eolian.Eolian_Typedecl_Type.ENUM) 143 self.assertEqual(li[0].type, eolian.Eolian_Typedecl_Type.ENUM)
144 144
145 all_count = 0 145 all_count = 0
146 for enum in eolian_db.enums: 146 for enum in eolian_db.enums:
@@ -150,10 +150,10 @@ class TestEolianUnit(unittest.TestCase):
150 self.assertGreater(all_count, 50) 150 self.assertGreater(all_count, 50)
151 151
152 def test_struct_listing(self): 152 def test_struct_listing(self):
153 l = list(eolian_db.structs_by_file_get('eina_types.eot')) 153 li = list(eolian_db.structs_by_file_get('eina_types.eot'))
154 self.assertGreater(len(l), 10) 154 self.assertGreater(len(li), 10)
155 self.assertIsInstance(l[0], eolian.Typedecl) 155 self.assertIsInstance(li[0], eolian.Typedecl)
156 self.assertIn(l[0].type, ( 156 self.assertIn(li[0].type, (
157 eolian.Eolian_Typedecl_Type.STRUCT, 157 eolian.Eolian_Typedecl_Type.STRUCT,
158 eolian.Eolian_Typedecl_Type.STRUCT_OPAQUE)) 158 eolian.Eolian_Typedecl_Type.STRUCT_OPAQUE))
159 159
@@ -167,27 +167,27 @@ class TestEolianUnit(unittest.TestCase):
167 self.assertGreater(all_count, 50) 167 self.assertGreater(all_count, 50)
168 168
169 def test_alias_listing(self): 169 def test_alias_listing(self):
170 l = list(eolian_db.aliases_by_file_get('eina_types.eot')) 170 li = list(eolian_db.aliases_by_file_get('eina_types.eot'))
171 self.assertGreater(len(l), 2) 171 self.assertGreater(len(li), 2)
172 self.assertIsInstance(l[0], eolian.Typedecl) 172 self.assertIsInstance(li[0], eolian.Typedecl)
173 173
174 all_count = 0 174 all_count = 0
175 for alias in eolian_db.aliases: 175 for alias in eolian_db.aliases:
176 self.assertIsInstance(alias, eolian.Typedecl) 176 self.assertIsInstance(alias, eolian.Typedecl)
177 self.assertIn(alias.type, ( 177 self.assertIn(alias.type, (
178 eolian.Eolian_Typedecl_Type.ALIAS, 178 eolian.Eolian_Typedecl_Type.ALIAS,
179 eolian.Eolian_Typedecl_Type.FUNCTION_POINTER)) # TODO is this correct ?? 179 eolian.Eolian_Typedecl_Type.FUNCTION_POINTER)) # TODO is this correct ??
180 all_count += 1 180 all_count += 1
181 self.assertGreater(all_count, 10) 181 self.assertGreater(all_count, 10)
182 182
183 def test_constant_listing(self): 183 def test_constant_listing(self):
184 l = list(eolian_db.constants) 184 li = list(eolian_db.constants)
185 self.assertGreater(len(l), 2) 185 self.assertGreater(len(li), 2)
186 self.assertIsInstance(l[0], eolian.Constant) 186 self.assertIsInstance(li[0], eolian.Constant)
187 187
188 l = list(eolian_db.constants_by_file_get('efl_gfx_stack.eo')) 188 li = list(eolian_db.constants_by_file_get('efl_gfx_stack.eo'))
189 self.assertGreater(len(l), 1) 189 self.assertGreater(len(li), 1)
190 self.assertIsInstance(l[0], eolian.Constant) 190 self.assertIsInstance(li[0], eolian.Constant)
191 191
192 def test_class_listing(self): 192 def test_class_listing(self):
193 all_count = 0 193 all_count = 0
@@ -219,7 +219,7 @@ class TestEolianNamespace(unittest.TestCase):
219 'Ector.Software.Buffer', 219 'Ector.Software.Buffer',
220 'Eio.Sentry', 220 'Eio.Sentry',
221 'Eldbus.Model', 221 'Eldbus.Model',
222 ] 222 ]
223 for ns in eolian_db.all_namespaces: 223 for ns in eolian_db.all_namespaces:
224 cls = eolian_db.class_by_name_get(ns.name) 224 cls = eolian_db.class_by_name_get(ns.name)
225 # Some legacy classes are parsed and still make this fail. 225 # Some legacy classes are parsed and still make this fail.
@@ -344,8 +344,8 @@ class TestEolianClass(unittest.TestCase):
344 self.assertEqual(cls.c_get_function_name, 'efl_loop_timer_class_get') 344 self.assertEqual(cls.c_get_function_name, 'efl_loop_timer_class_get')
345 self.assertEqual(cls.c_macro, 'EFL_LOOP_TIMER_CLASS') 345 self.assertEqual(cls.c_macro, 'EFL_LOOP_TIMER_CLASS')
346 self.assertEqual(cls.c_data_type, 'Efl_Loop_Timer_Data') 346 self.assertEqual(cls.c_data_type, 'Efl_Loop_Timer_Data')
347 self.assertEqual([f.name for f in cls.methods], ['timer_reset','timer_loop_reset','timer_delay']) 347 self.assertEqual([f.name for f in cls.methods], ['timer_reset', 'timer_loop_reset', 'timer_delay'])
348 self.assertEqual([f.name for f in cls.properties], ['timer_interval','time_pending']) 348 self.assertEqual([f.name for f in cls.properties], ['timer_interval', 'time_pending'])
349 self.assertGreater(len(list(cls.implements)), 5) 349 self.assertGreater(len(list(cls.implements)), 5)
350 self.assertIsInstance(list(cls.implements)[0], eolian.Implement) 350 self.assertIsInstance(list(cls.implements)[0], eolian.Implement)
351 351
@@ -399,7 +399,7 @@ class TestEolianImplement(unittest.TestCase):
399 self.assertEqual(im.name, 'Efl.Loop_Timer.timer_delay') 399 self.assertEqual(im.name, 'Efl.Loop_Timer.timer_delay')
400 self.assertIsInstance(im.class_, eolian.Class) 400 self.assertIsInstance(im.class_, eolian.Class)
401 self.assertIsInstance(im.function, eolian.Function) 401 self.assertIsInstance(im.function, eolian.Function)
402 self.assertIsInstance(im.documentation_get(), eolian.Documentation) # TODO is UNRESOLVED correct ? 402 self.assertIsInstance(im.documentation_get(), eolian.Documentation) # TODO is UNRESOLVED correct ?
403 self.assertFalse(im.is_auto()) 403 self.assertFalse(im.is_auto())
404 self.assertFalse(im.is_empty()) 404 self.assertFalse(im.is_empty())
405 self.assertFalse(im.is_pure_virtual()) 405 self.assertFalse(im.is_pure_virtual())
@@ -473,7 +473,7 @@ class TestEolianConstant(unittest.TestCase):
473 self.assertEqual(var.short_name, 'Hint_Expand') 473 self.assertEqual(var.short_name, 'Hint_Expand')
474 self.assertEqual(var.file, 'efl_gfx_hint.eo') 474 self.assertEqual(var.file, 'efl_gfx_hint.eo')
475 self.assertFalse(var.is_extern) 475 self.assertFalse(var.is_extern)
476 self.assertEqual(list(var.namespaces), ['Efl','Gfx']) 476 self.assertEqual(list(var.namespaces), ['Efl', 'Gfx'])
477 self.assertIsInstance(var.documentation, eolian.Documentation) 477 self.assertIsInstance(var.documentation, eolian.Documentation)
478 self.assertIsInstance(var.type, eolian.Type) 478 self.assertIsInstance(var.type, eolian.Type)
479 self.assertIsInstance(var.value, eolian.Expression) 479 self.assertIsInstance(var.value, eolian.Expression)
@@ -487,7 +487,7 @@ class TestEolianTypedecl(unittest.TestCase):
487 self.assertEqual(td.name, 'Efl.Net.Http.Version') 487 self.assertEqual(td.name, 'Efl.Net.Http.Version')
488 self.assertEqual(td.short_name, 'Version') 488 self.assertEqual(td.short_name, 'Version')
489 self.assertEqual(td.file, 'efl_net_http_types.eot') 489 self.assertEqual(td.file, 'efl_net_http_types.eot')
490 self.assertEqual(list(td.namespaces), ['Efl','Net','Http']) 490 self.assertEqual(list(td.namespaces), ['Efl', 'Net', 'Http'])
491 self.assertIsInstance(td.documentation, eolian.Documentation) 491 self.assertIsInstance(td.documentation, eolian.Documentation)
492 self.assertIsNone(td.base_type) # TODO find a better test 492 self.assertIsNone(td.base_type) # TODO find a better test
493 self.assertIsNone(td.free_func) # TODO find a better test 493 self.assertIsNone(td.free_func) # TODO find a better test
@@ -511,7 +511,7 @@ class TestEolianTypedecl(unittest.TestCase):
511 self.assertEqual(td.name, 'Efl.Gfx.Color32') 511 self.assertEqual(td.name, 'Efl.Gfx.Color32')
512 self.assertEqual(td.short_name, 'Color32') 512 self.assertEqual(td.short_name, 'Color32')
513 self.assertEqual(td.file, 'efl_canvas_filter_internal.eo') 513 self.assertEqual(td.file, 'efl_canvas_filter_internal.eo')
514 self.assertEqual(list(td.namespaces), ['Efl','Gfx']) 514 self.assertEqual(list(td.namespaces), ['Efl', 'Gfx'])
515 self.assertIsInstance(td.documentation, eolian.Documentation) 515 self.assertIsInstance(td.documentation, eolian.Documentation)
516 self.assertIsNone(td.base_type) # TODO find a better test 516 self.assertIsNone(td.base_type) # TODO find a better test
517 self.assertIsNone(td.free_func) # TODO find a better test 517 self.assertIsNone(td.free_func) # TODO find a better test
@@ -544,13 +544,13 @@ class TestEolianType(unittest.TestCase):
544 cls = eolian_db.class_by_name_get('Efl.Loop_Timer') 544 cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
545 func = cls.function_by_name_get('timer_delay') 545 func = cls.function_by_name_get('timer_delay')
546 param = list(func.parameters)[0] 546 param = list(func.parameters)[0]
547 t = param.type # type: double 547 t = param.type # type double
548 self.assertIsInstance(t, eolian.Type) 548 self.assertIsInstance(t, eolian.Type)
549 self.assertEqual(t.name, 'double') 549 self.assertEqual(t.name, 'double')
550 self.assertEqual(t.short_name, 'double') 550 self.assertEqual(t.short_name, 'double')
551 self.assertEqual(t.type, eolian.Eolian_Type_Type.REGULAR) 551 self.assertEqual(t.type, eolian.Eolian_Type_Type.REGULAR)
552 self.assertEqual(t.builtin_type, eolian.Eolian_Type_Builtin_Type.DOUBLE) 552 self.assertEqual(t.builtin_type, eolian.Eolian_Type_Builtin_Type.DOUBLE)
553 self.assertEqual(t.file, 'efl_loop_timer.eo') # TODO is this correct ? 553 self.assertEqual(t.file, 'efl_loop_timer.eo') # TODO is this correct ?
554 self.assertIsNone(t.base_type) # TODO find a better test 554 self.assertIsNone(t.base_type) # TODO find a better test
555 self.assertIsNone(t.next_type) # TODO find a better test 555 self.assertIsNone(t.next_type) # TODO find a better test
556 self.assertFalse(t.is_const) 556 self.assertFalse(t.is_const)
@@ -563,7 +563,7 @@ class TestEolianType(unittest.TestCase):
563 cls = eolian_db.class_by_name_get('Efl.Gfx.Entity') 563 cls = eolian_db.class_by_name_get('Efl.Gfx.Entity')
564 func = cls.function_by_name_get('geometry') 564 func = cls.function_by_name_get('geometry')
565 param = list(func.setter_values)[0] 565 param = list(func.setter_values)[0]
566 t = param.type # type: Eina.Rect 566 t = param.type # type Eina.Rect
567 self.assertIsInstance(t, eolian.Type) 567 self.assertIsInstance(t, eolian.Type)
568 self.assertEqual(t.name, 'Eina.Rect') 568 self.assertEqual(t.name, 'Eina.Rect')
569 self.assertEqual(t.short_name, 'Rect') 569 self.assertEqual(t.short_name, 'Rect')
@@ -582,7 +582,7 @@ class TestEolianType(unittest.TestCase):
582 cls = eolian_db.class_by_name_get('Efl.Content') 582 cls = eolian_db.class_by_name_get('Efl.Content')
583 func = cls.function_by_name_get('content') 583 func = cls.function_by_name_get('content')
584 param = list(func.setter_values)[0] 584 param = list(func.setter_values)[0]
585 t = param.type # type: Efl.Gfx (class interface) 585 t = param.type # type Efl.Gfx (class interface)
586 self.assertIsInstance(t, eolian.Type) 586 self.assertIsInstance(t, eolian.Type)
587 self.assertEqual(t.name, 'Efl.Gfx.Entity') 587 self.assertEqual(t.name, 'Efl.Gfx.Entity')
588 self.assertEqual(t.short_name, 'Entity') 588 self.assertEqual(t.short_name, 'Entity')
@@ -612,11 +612,11 @@ class TestEolianExpression(unittest.TestCase):
612 self.assertIsInstance(exp, eolian.Expression) 612 self.assertIsInstance(exp, eolian.Expression)
613 self.assertEqual(exp.type, eolian.Eolian_Expression_Type.UNARY) 613 self.assertEqual(exp.type, eolian.Eolian_Expression_Type.UNARY)
614 self.assertEqual(float(exp.serialize), 32768.0) # TODO is this a bug? isn't -1.0 ? 614 self.assertEqual(float(exp.serialize), 32768.0) # TODO is this a bug? isn't -1.0 ?
615 self.assertEqual(exp.unary_operator, eolian.Eolian_Unary_Operator.UNM) # Invalid -> NOP 615 self.assertEqual(exp.unary_operator, eolian.Eolian_Unary_Operator.UNM) # Invalid -> NOP
616 unary = exp.unary_expression 616 unary = exp.unary_expression
617 self.assertIsInstance(unary, eolian.Expression) 617 self.assertIsInstance(unary, eolian.Expression)
618 self.assertEqual(unary.type, eolian.Eolian_Expression_Type.INT) 618 self.assertEqual(unary.type, eolian.Eolian_Expression_Type.INT)
619 self.assertEqual(float(exp.serialize), 32768.0) # Bug too? 619 self.assertEqual(float(exp.serialize), 32768.0) # Bug too?
620 620
621 # TODO test_expression_binary 621 # TODO test_expression_binary
622 # exp.binary_operator # TODO find a better test (only works for BINARY expr) 622 # exp.binary_operator # TODO find a better test (only works for BINARY expr)
@@ -624,7 +624,6 @@ class TestEolianExpression(unittest.TestCase):
624 # exp.binary_rhs # TODO find a better test (only works for BINARY expr) 624 # exp.binary_rhs # TODO find a better test (only works for BINARY expr)
625 625
626 626
627
628if __name__ == '__main__': 627if __name__ == '__main__':
629 # create main eolian state 628 # create main eolian state
630 eolian_db = eolian.Eolian_State() 629 eolian_db = eolian.Eolian_State()