summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-12-28 13:49:03 +0100
committerDave Andreoli <dave@gurumeditation.it>2017-12-28 13:53:54 +0100
commit455f2414635237ed8cebbd1d8ab324d8ec7c167f (patch)
tree1b629b6ae65b9f37929924290e7255b0b6d20f53
parentb27ca559f6fd63dac36ae74bcfc8132ea19299a5 (diff)
New python bindings for eolian
This are manually written ctype bindings for eolian, that means they run on the standard python library (nothing to install) and can run without any build step (in fact ctypes just open the so/dll file at runtime) Next step will be (soon) a template based generator for eolian that will be a lot of fun :)
-rw-r--r--src/scripts/pyolian/eolian.py1294
-rw-r--r--src/scripts/pyolian/eolian_lib.py757
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py440
3 files changed, 2491 insertions, 0 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
new file mode 100644
index 0000000000..f74f350324
--- /dev/null
+++ b/src/scripts/pyolian/eolian.py
@@ -0,0 +1,1294 @@
1#!/usr/bin/env python3
2# encoding: utf-8
3"""
4Pyolian: ctypes bindings for the eolian library.
5
6This file (along with eolian_lib.py) implement full pythonic eolian bindings.
7
8Those bindings are designed to work at runtime without any prepare/compilation
9steps required. The only requirement is that we can find the eolian.so/dll
10somwhere built in the source tree, look at eolian_lib.py to see the searchs
11performed.
12
13You can directly use the python API provided here if you need direct access
14to eolian, or we suggest to look at the template-based generator.py if you just
15need to generate some sort of text files out of the eolian database.
16
17"""
18from enum import IntEnum
19from ctypes import cast, byref, c_char_p, c_void_p
20
21from eolian_lib import lib
22
23
24### Eolian Enums ############################################################
25
26class Eolian_Function_Type(IntEnum):
27 UNRESOLVED = 0
28 PROPERTY = 1
29 PROP_SET = 2
30 PROP_GET = 3
31 METHOD = 4
32 FUNCTION_POINTER = 5
33
34class Eolian_Parameter_Dir(IntEnum):
35 UNKNOWN = 0
36 IN = 1
37 OUT = 2
38 INOUT = 3
39
40class Eolian_Class_Type(IntEnum):
41 UNKNOWN_TYPE = 0
42 REGULAR = 1
43 ABSTRACT = 2
44 MIXIN = 3
45 INTERFACE = 4
46
47class Eolian_Object_Scope(IntEnum):
48 UNKNOWN = 0
49 PUBLIC = 1
50 PRIVATE = 2
51 PROTECTED = 3
52
53class Eolian_Typedecl_Type(IntEnum):
54 UNKNOWN = 0
55 STRUCT = 1
56 STRUCT_OPAQUE = 2
57 ENUM = 3
58 ALIAS = 4
59 FUNCTION_POINTER = 5
60
61class Eolian_Type_Type(IntEnum):
62 UNKNOWN_TYPE = 0
63 VOID = 1
64 REGULAR = 2
65 CLASS = 3
66 UNDEFINED = 4
67
68class Eolian_Type_Builtin_Type(IntEnum):
69 INVALID = 0
70 BYTE = 1
71 UBYTE = 2
72 CHAR = 3
73 SHORT = 4
74 USHORT = 5
75 INT = 6
76 UINT = 7
77 LONG = 8
78 ULONG = 9
79 LLONG = 10
80 ULLONG = 11
81
82 INT8 = 12
83 UINT8 = 13
84 INT16 = 14
85 UINT16 = 15
86 INT32 = 16
87 UINT32 = 17
88 INT64 = 18
89 UINT64 = 19
90 INT128 = 20
91 UINT128 = 21
92
93 SIZE = 22
94 SSIZE = 23
95 INTPTR = 24
96 UINTPTR = 25
97 PTRDIFF = 26
98
99 TIME = 27
100
101 FLOAT = 28
102 DOUBLE = 29
103
104 BOOL = 30
105 VOID = 31
106
107 ACCESSOR = 32
108 ARRAY = 33
109 ITERATOR = 34
110 HASH = 35
111 LIST = 36
112 INARRAY = 37
113 INLIST = 38
114
115 FUTURE = 39
116
117 ANY_VALUE = 40
118 ANY_VALUE_PTR = 41
119
120 MSTRING = 42
121 STRING = 43
122 STRINGSHARE = 44
123
124 VOID_PTR = 45
125 FREE_CB = 46
126
127class Eolian_C_Type_Type(IntEnum):
128 DEFAULT = 0
129 PARAM = 1
130 RETURN = 2
131
132class Eolian_Expression_Type(IntEnum):
133 UNKNOWN = 0
134 INT = 1
135 UINT = 2
136 LONG = 3
137 ULONG = 4
138 LLONG = 5
139 ULLONG = 6
140 FLOAT = 7
141 DOUBLE = 8
142 STRING = 9
143 CHAR = 10
144 NULL = 11
145 BOOL = 12
146 NAME = 13
147 UNARY = 14
148 BINARY = 15
149
150class Eolian_Expression_Mask(IntEnum):
151 SINT = 1 << 0
152 UINT = 1 << 1
153 INT = SINT | UINT
154 FLOAT = 1 << 2
155 BOOL = 1 << 3
156 STRING = 1 << 4
157 CHAR = 1 << 5
158 NULL = 1 << 6
159 SIGNED = SINT | FLOAT
160 NUMBER = INT | FLOAT
161 ALL = NUMBER | BOOL | STRING | CHAR | NULL
162
163class Eolian_Variable_Type(IntEnum):
164 UNKNOWN = 0
165 CONSTANT = 1
166 GLOBAL = 2
167
168class Eolian_Binary_Operator(IntEnum):
169 INVALID = 0
170 ADD = 1 # + int, float
171 SUB = 2 # - int, float
172 MUL = 3 # * int, float
173 DIV = 4 # / int, float
174 MOD = 5 # % int
175 EQ = 6 # == all types
176 NQ = 7 # != all types
177 GT = 8 # > int, float
178 LT = 9 # < int, float
179 GE = 10 # >= int, float
180 LE = 11 # <= int, float
181 AND = 12 # && all types
182 OR = 13 # || all types
183 BAND = 14 # & int
184 BOR = 15 # | int
185 BXOR = 16 # ^ int
186 LSH = 17 # << int
187 RSH = 18 # >> int
188
189class Eolian_Unary_Operator(IntEnum):
190 INVALID = 0
191 UNM = 1 # - sint
192 UNP = 2 # + sint
193 NOT = 3 # ! int, float, bool
194 BNOT = 4 # ~ int
195
196class Eolian_Declaration_Type(IntEnum):
197 UNKNOWN = 0
198 CLASS = 1
199 ALIAS = 2
200 STRUCT = 3
201 ENUM = 4
202 VAR = 5
203
204class Eolian_Doc_Token_Type(IntEnum):
205 UNKNOWN = 0
206 TEXT = 1
207 REF = 2
208 MARK_NOTE = 3
209 MARK_WARNING = 4
210 MARK_REMARK = 5
211 MARK_TODO = 6
212 MARKUP_MONOSPACE = 7
213
214class Eolian_Doc_Ref_Type(IntEnum):
215 INVALID = 0
216 CLASS = 1
217 FUNC = 2
218 EVENT = 3
219 ALIAS = 4
220 STRUCT = 5
221 STRUCT_FIELD = 6
222 ENUM = 7
223 ENUM_FIELD = 8
224 VAR = 9
225
226
227### internal Classes ########################################################
228
229class Iterator(object):
230 """ Generic eina iterator wrapper """
231 def __init__(self, conv_func, iterator):
232 self.next = self.__next__ # py2 compat
233 self._conv = conv_func
234 self._iter = c_void_p(iterator)
235 self._tmp = c_void_p(0)
236
237 def __iter__(self):
238 return self
239
240 def __next__(self):
241 if not self._iter or not self._iter.value:
242 print("NULL Iterator... Error ?")
243 raise StopIteration
244 if not lib.eina_iterator_next(self._iter, byref(self._tmp)):
245 lib.eina_iterator_free(self._iter)
246 raise StopIteration
247 return self._conv(self._tmp)
248
249 def free(self):
250 lib.eina_iterator_free(self._iter)
251
252
253class EolianBaseObject(object):
254 def __init__(self, c_obj_pointer):
255 if isinstance(c_obj_pointer, c_void_p):
256 self._obj = c_void_p(c_obj_pointer.value)
257 elif isinstance(c_obj_pointer, int):
258 self._obj = c_void_p(c_obj_pointer)
259 else:
260 raise TypeError('Invalid constructor of type: %s for class: %s' % (
261 type(c_obj_pointer), self.__class__.__name__))
262
263
264### Main Eolian Unit ########################################################
265
266class Eolian_Unit(EolianBaseObject):
267 def class_get_by_name(self, class_name):
268 c_cls = lib.eolian_class_get_by_name(self._obj, _str_to_bytes(class_name))
269 return Class(c_cls) if c_cls else None
270
271 def class_get_by_file(self, file_name):
272 c_cls = lib.eolian_class_get_by_file(self._obj, _str_to_bytes(file_name))
273 return Class(c_cls) if c_cls else None
274
275 @property
276 def all_classes(self):
277 return Iterator(Class, lib.eolian_all_classes_get(self._obj))
278
279 @property
280 def typedecl_all_enums(self):
281 return Iterator(Typedecl, lib.eolian_typedecl_all_enums_get(self._obj))
282
283 def typedecl_enum_get_by_name(self, name):
284 c_tdecl = lib.eolian_typedecl_enum_get_by_name(self._obj, _str_to_bytes(name))
285 return Typedecl(c_tdecl) if c_tdecl else None
286
287 def typedecl_enums_get_by_file(self, fname):
288 return Iterator(Typedecl,
289 lib.eolian_typedecl_enums_get_by_file(self._obj, _str_to_bytes(fname)))
290
291 @property
292 def typedecl_all_structs(self):
293 return Iterator(Typedecl, lib.eolian_typedecl_all_structs_get(self._obj))
294
295 def typedecl_struct_get_by_name(self, name):
296 c_tdecl = lib.eolian_typedecl_struct_get_by_name(self._obj, _str_to_bytes(name))
297 return Typedecl(c_tdecl) if c_tdecl else None
298
299 def typedecl_structs_get_by_file(self, fname):
300 return Iterator(Typedecl,
301 lib.eolian_typedecl_structs_get_by_file(self._obj, _str_to_bytes(fname)))
302
303 @property
304 def typedecl_all_aliases(self):
305 return Iterator(Typedecl, lib.eolian_typedecl_all_aliases_get(self._obj))
306
307 def typedecl_alias_get_by_name(self, name):
308 c_tdecl = lib.eolian_typedecl_alias_get_by_name(self._obj, _str_to_bytes(name))
309 return Typedecl(c_tdecl) if c_tdecl else None
310
311 def typedecl_aliases_get_by_file(self, fname):
312 return Iterator(Typedecl,
313 lib.eolian_typedecl_aliases_get_by_file(self._obj, _str_to_bytes(fname)))
314
315 @property
316 def variable_all_constants(self):
317 return Iterator(Variable, lib.eolian_variable_all_constants_get(self._obj))
318
319 def variable_constant_get_by_name(self, name):
320 c_var = lib.eolian_variable_constant_get_by_name(self._obj, _str_to_bytes(name))
321 return Variable(c_var) if c_var else None
322
323 def variable_constants_get_by_file(self, fname):
324 return Iterator(Variable,
325 lib.eolian_variable_constants_get_by_file(self._obj, _str_to_bytes(fname)))
326
327 @property
328 def variable_all_globals(self):
329 return Iterator(Variable, lib.eolian_variable_all_globals_get(self._obj))
330
331 def variable_global_get_by_name(self, name):
332 c_var = lib.eolian_variable_global_get_by_name(self._obj, _str_to_bytes(name))
333 return Variable(c_var) if c_var else None
334
335 def variable_globals_get_by_file(self, fname):
336 return Iterator(Variable,
337 lib.eolian_variable_globals_get_by_file(self._obj, _str_to_bytes(fname)))
338
339 @property
340 def all_declarations(self):
341 return Iterator(Declaration, lib.eolian_all_declarations_get(self._obj))
342
343 def declaration_get_by_name(self, name):
344 c_decl = lib.eolian_declaration_get_by_name(self._obj, _str_to_bytes(name))
345 return Declaration(c_decl) if c_decl else None
346
347 def declarations_get_by_file(self, fname):
348 return Iterator(Declaration,
349 lib.eolian_declarations_get_by_file(self._obj, _str_to_bytes(fname)))
350
351
352class Eolian(Eolian_Unit):
353 def __init__(self):
354 self._obj = lib.eolian_new() # Eolian *
355
356 def __del__(self):
357 # TODO I'm not sure about this, It is automatically called on gc, that
358 # is fired after atexit (eolian_shutdown). Thus causing a segfault
359 # if the user do not call del before exit.
360 lib.eolian_free(self._obj)
361
362 def file_parse(self, filepath):
363 c_unit = lib.eolian_file_parse(self._obj, _str_to_bytes(filepath))
364 return Eolian_Unit(c_unit) if c_unit else None
365
366 @property
367 def all_eo_file_paths(self):
368 return Iterator(_str_to_py, lib.eolian_all_eo_file_paths_get(self._obj))
369
370 @property
371 def all_eot_file_paths(self):
372 return Iterator(_str_to_py, lib.eolian_all_eot_file_paths_get(self._obj))
373
374 @property
375 def all_eo_files(self):
376 return Iterator(_str_to_py, lib.eolian_all_eo_files_get(self._obj))
377
378 @property
379 def all_eot_files(self):
380 return Iterator(_str_to_py, lib.eolian_all_eot_files_get(self._obj))
381
382 def directory_scan(self, dir_path):
383 return bool(lib.eolian_directory_scan(self._obj, _str_to_bytes(dir_path)))
384
385 def system_directory_scan(self):
386 return bool(lib.eolian_system_directory_scan(self._obj))
387
388 def all_eo_files_parse(self):
389 return bool(lib.eolian_all_eo_files_parse(self._obj))
390
391 def all_eot_files_parse(self):
392 return bool(lib.eolian_all_eot_files_parse(self._obj))
393
394
395### Eolian Classes ##########################################################
396
397class Class(EolianBaseObject):
398 def __repr__(self):
399 return "<eolian.Class '{0.full_name}', {0.type!s}>".format(self)
400
401 @property
402 def name(self):
403 return _str_to_py(lib.eolian_class_name_get(self._obj))
404
405 @property
406 def full_name(self):
407 return _str_to_py(lib.eolian_class_full_name_get(self._obj))
408
409 @property
410 def c_name(self):
411 s = lib.eolian_class_c_name_get(self._obj)
412 ret = _str_to_py(s)
413 lib.eina_stringshare_del(c_void_p(s))
414 return ret
415
416 @property
417 def c_get_function_name(self):
418 s = lib.eolian_class_c_get_function_name_get(self._obj)
419 ret = _str_to_py(s)
420 lib.eina_stringshare_del(c_void_p(s))
421 return ret
422
423 @property
424 def type(self):
425 return Eolian_Class_Type(lib.eolian_class_type_get(self._obj))
426
427 @property
428 def data_type(self):
429 return _str_to_py(lib.eolian_class_data_type_get(self._obj))
430
431 @property
432 def c_data_type(self):
433 s = lib.eolian_class_c_data_type_get(self._obj)
434 ret = _str_to_py(s)
435 lib.eina_stringshare_del(c_void_p(s))
436 return ret
437
438 @property
439 def legacy_prefix(self):
440 return _str_to_py(lib.eolian_class_legacy_prefix_get(self._obj))
441
442 @property
443 def eo_prefix(self):
444 return _str_to_py(lib.eolian_class_eo_prefix_get(self._obj))
445
446 @property
447 def event_prefix(self):
448 return _str_to_py(lib.eolian_class_event_prefix_get(self._obj))
449
450 @property
451 def documentation(self):
452 c_doc = lib.eolian_class_documentation_get(self._obj)
453 return Documentation(c_doc) if c_doc else None
454
455 @property
456 def constructors(self):
457 return Iterator(Constructor, lib.eolian_class_constructors_get(self._obj))
458
459 @property
460 def events(self):
461 return Iterator(Event, lib.eolian_class_events_get(self._obj))
462
463 def event_get_by_name(self, event_name):
464 c_event = lib.eolian_class_event_get_by_name(self._obj,
465 _str_to_bytes(event_name))
466 return Event(c_event) if c_event else None
467
468 @property
469 def inherits(self):
470 return Iterator(Class, lib.eolian_class_inherits_get(self._obj))
471
472 @property
473 def inherits_full(self):
474 L = []
475 def do_class_recursive(cls):
476 for other in cls.inherits:
477 if not other in L:
478 L.append(other)
479 do_class_recursive(other)
480
481 do_class_recursive(self)
482 return L
483
484 @property
485 def base_class(self):
486 inherits = list(self.inherits)
487 if len(inherits) > 0:
488 return inherits[0]
489
490 @property
491 def namespaces(self):
492 return Iterator(_str_to_py, lib.eolian_class_namespaces_get(self._obj))
493
494 @property
495 def file(self):
496 return _str_to_py(lib.eolian_class_file_get(self._obj))
497
498 @property
499 def ctor_enable(self):
500 return bool(lib.eolian_class_ctor_enable_get(self._obj))
501
502 @property
503 def dtor_enable(self):
504 return bool(lib.eolian_class_dtor_enable_get(self._obj))
505
506 def function_get_by_name(self, func_name,
507 ftype=Eolian_Function_Type.UNRESOLVED):
508 f = lib.eolian_class_function_get_by_name(self._obj,
509 _str_to_bytes(func_name),
510 ftype)
511 return Function(f) if f else None
512
513 def functions_get(self, ftype):
514 return Iterator(Function, lib.eolian_class_functions_get(self._obj, ftype))
515 @property
516 def methods(self):
517 return self.functions_get(Eolian_Function_Type.METHOD)
518
519 @property
520 def properties(self):
521 return self.functions_get(Eolian_Function_Type.PROPERTY)
522
523 @property
524 def implements(self):
525 return Iterator(Implement, lib.eolian_class_implements_get(self._obj))
526
527 @property
528 def parts(self):
529 return Iterator(Part, lib.eolian_class_parts_get(self._obj))
530
531
532class Part(EolianBaseObject):
533 def __repr__(self):
534 return "<eolian.Part '{0.name}'>".format(self)
535
536 @property
537 def name(self):
538 return _str_to_py(lib.eolian_part_name_get(self._obj))
539
540 @property
541 def class_(self):
542 return Class(lib.eolian_part_class_get(self._obj))
543
544 @property
545 def documentation(self):
546 c_doc = lib.eolian_part_documentation_get(self._obj)
547 return Documentation(c_doc) if c_doc else None
548
549
550class Constructor(EolianBaseObject):
551 def __repr__(self):
552 return "<eolian.Constructor '{0.full_name}', optional={0.is_optional}>".format(self)
553
554 @property
555 def full_name(self):
556 return _str_to_py(lib.eolian_constructor_full_name_get(self._obj))
557
558 @property
559 def function(self):
560 return Function(lib.eolian_constructor_function_get(self._obj))
561
562 @property
563 def is_optional(self):
564 return bool(lib.eolian_constructor_is_optional(self._obj))
565
566 @property
567 def class_(self):
568 return Class(lib.eolian_constructor_class_get(self._obj))
569
570
571class Event(EolianBaseObject):
572 def __repr__(self):
573 return "<eolian.Event '{0.name}', c_name='{0.c_name}'>".format(self)
574
575 @property
576 def name(self):
577 return _str_to_py(lib.eolian_event_name_get(self._obj))
578
579 @property
580 def c_name(self):
581 s = lib.eolian_event_c_name_get(self._obj)
582 ret = _str_to_py(s)
583 lib.eina_stringshare_del(c_void_p(s))
584 return ret
585
586 @property
587 def type(self):
588 c_type = lib.eolian_event_type_get(self._obj)
589 return Type(c_type) if c_type else None
590
591 @property
592 def documentation(self):
593 c_doc = lib.eolian_event_documentation_get(self._obj)
594 return Documentation(c_doc) if c_doc else None
595
596 @property
597 def scope(self):
598 return Eolian_Object_Scope(lib.eolian_event_scope_get(self._obj))
599
600 @property
601 def is_beta(self):
602 return bool(lib.eolian_event_is_beta(self._obj))
603
604 @property
605 def is_hot(self):
606 return bool(lib.eolian_event_is_hot(self._obj))
607
608 @property
609 def is_restart(self):
610 return bool(lib.eolian_event_is_restart(self._obj))
611
612
613class Function(EolianBaseObject):
614 def __repr__(self):
615 return "<eolian.Function '{0.name}'>".format(self)
616
617 @property
618 def name(self):
619 return _str_to_py(lib.eolian_function_name_get(self._obj))
620
621 def full_c_name_get(self, ftype, use_legacy=False):
622 s = lib.eolian_function_full_c_name_get(self._obj, ftype, use_legacy)
623 ret = _str_to_py(s)
624 lib.eina_stringshare_del(c_void_p(s))
625 return ret
626
627 @property
628 def full_c_method_name(self):
629 return self.full_c_name_get(Eolian_Function_Type.METHOD)
630
631 @property
632 def full_c_getter_name(self):
633 return self.full_c_name_get(Eolian_Function_Type.PROP_GET)
634
635 @property
636 def full_c_setter_name(self):
637 return self.full_c_name_get(Eolian_Function_Type.PROP_SET)
638
639 @property
640 def full_c_method_name_legacy(self):
641 return self.full_c_name_get(Eolian_Function_Type.METHOD, True)
642
643 @property
644 def full_c_getter_name_legacy(self):
645 return self.full_c_name_get(Eolian_Function_Type.PROP_GET, True)
646
647 @property
648 def full_c_setter_name_legacy(self):
649 return self.full_c_name_get(Eolian_Function_Type.PROP_SET, True)
650
651 @property
652 def type(self):
653 return Eolian_Function_Type(lib.eolian_function_type_get(self._obj))
654
655 def scope_get(self, ftype):
656 return Eolian_Object_Scope(lib.eolian_function_scope_get(self._obj, ftype))
657
658 @property
659 def method_scope(self):
660 return self.scope_get(Eolian_Function_Type.METHOD)
661
662 @property
663 def getter_scope(self):
664 return self.scope_get(Eolian_Function_Type.PROP_GET)
665
666 @property
667 def setter_scope(self):
668 return self.scope_get(Eolian_Function_Type.PROP_SET)
669
670 def legacy_get(self, ftype):
671 return _str_to_py(lib.eolian_function_legacy_get(self._obj, ftype))
672
673 def is_legacy_only(self, ftype):
674 return bool(lib.eolian_function_is_legacy_only(self._obj, ftype))
675
676 @property
677 def is_class(self):
678 return bool(lib.eolian_function_is_class(self._obj))
679
680 @property
681 def is_beta(self):
682 return bool(lib.eolian_function_is_beta(self._obj))
683
684 @property
685 def object_is_const(self):
686 return bool(lib.eolian_function_object_is_const(self._obj))
687
688 @property
689 def class_(self):
690 c_cls = lib.eolian_function_class_get(self._obj)
691 return Class(c_cls) if c_cls else None
692
693 def is_constructor(self, klass):
694 return bool(lib.eolian_function_is_constructor(self._obj, klass._obj))
695
696 # @property
697 # def is_function_pointer(self):
698 # return bool(lib.eolian_function_is_function_pointer(self._obj))
699
700 @property
701 def parameters(self):
702 return Iterator(Function_Parameter,
703 lib.eolian_function_parameters_get(self._obj))
704
705 def values_get(self, ftype):
706 return Iterator(Function_Parameter,
707 lib.eolian_property_values_get(self._obj, ftype))
708
709 @property
710 def getter_values(self):
711 return self.values_get(Eolian_Function_Type.PROP_GET)
712
713 @property
714 def setter_values(self):
715 return self.values_get(Eolian_Function_Type.PROP_SET)
716
717 def return_type_get(self, ftype):
718 c_type = lib.eolian_function_return_type_get(self._obj, ftype)
719 return Type(c_type) if c_type else None
720
721 def return_default_value(self, ftye):
722 c_expr = lib.eolian_function_return_default_value_get(sel._obj, ftype)
723 return Expression(c_expr) if c_expr else None
724
725 def return_documentation(self, ftype):
726 c_doc = lib.eolian_function_return_documentation_get(self._obj, ftype)
727 return Documentation(c_doc) if c_doc else None
728
729 def return_is_warn_unused(self, ftype):
730 return bool(lib.eolian_function_return_is_warn_unused(self._obj, ftype))
731
732 @property
733 def method_return_type(self):
734 return self.return_type_get(Eolian_Function_Type.METHOD)
735
736 @property
737 def getter_return_type(self):
738 return self.return_type_get(Eolian_Function_Type.PROP_GET)
739
740 @property
741 def setter_return_type(self):
742 return self.return_type_get(Eolian_Function_Type.PROP_SET)
743
744 @property
745 def prop_readable(self):
746 # TODO: maybe there is a better way to do this...
747 ftype = Eolian_Function_Type.PROP_GET
748 scope = lib.eolian_function_scope_get(self._obj, ftype)
749 return True if scope != Eolian_Object_Scope.UNKNOWN else False
750
751 @property
752 def prop_writable(self):
753 # TODO: maybe there is a better way to do this...
754 ftype = Eolian_Function_Type.PROP_SET
755 scope = lib.eolian_function_scope_get(self._obj, ftype)
756 return True if scope != Eolian_Object_Scope.UNKNOWN else False
757
758 @property
759 def implement(self):
760 c_impl = lib.eolian_function_implement_get(self._obj)
761 return Implement(c_impl) if c_impl else None
762
763
764class Function_Parameter(EolianBaseObject):
765 def __repr__(self):
766 return "<eolian.Function_Parameter '{0.name}', type={0.type}," \
767 " optional={0.is_optional}, nullable={0.is_nullable}>".format(self)
768
769 @property
770 def name(self):
771 return _str_to_py(lib.eolian_parameter_name_get(self._obj))
772
773 # @property
774 # def name_fixed(self):
775 # name = _str_to_py(lib.eolian_parameter_name_get(self._obj))
776 # if name in PY_KW:
777 # return name + '_'
778 # return name
779
780 # name = name_fixed
781
782 @property
783 def direction(self):
784 return Eolian_Parameter_Dir(lib.eolian_parameter_direction_get(self._obj))
785
786 @property
787 def documentation(self):
788 c_doc = lib.eolian_parameter_documentation_get(self._obj)
789 return Documentation(c_doc) if c_doc else None
790
791 @property
792 def is_nonull(self):
793 return bool(lib.eolian_parameter_is_nonull(self._obj))
794
795 @property
796 def is_nullable(self):
797 return bool(lib.eolian_parameter_is_nullable(self._obj))
798
799 @property
800 def is_optional(self):
801 return bool(lib.eolian_parameter_is_optional(self._obj))
802
803 @property
804 def type(self):
805 c_type = lib.eolian_parameter_type_get(self._obj)
806 return Type(c_type) if c_type else None
807
808 @property
809 def default_value(self):
810 c_expr = lib.eolian_parameter_default_value_get(self._obj)
811 return Expression(c_expr) if c_expr else None
812
813
814class Implement(EolianBaseObject):
815 def __repr__(self):
816 return "<eolian.Implement '{0.full_name}'>".format(self)
817
818 @property
819 def full_name(self):
820 return _str_to_py(lib.eolian_implement_full_name_get(self._obj))
821
822 @property
823 def class_(self):
824 c_cls = lib.eolian_implement_class_get(self._obj)
825 return Class(c_cls) if c_cls else None
826
827 def function_get(self, ftype=Eolian_Function_Type.UNRESOLVED):
828 c_func = lib.eolian_implement_function_get(self._obj, ftype)
829 return Function(c_func) if c_func else None
830 # TODO implement util properties for function_get
831
832 def documentation_get(self, ftype=Eolian_Function_Type.METHOD):
833 c_doc = lib.eolian_implement_documentation_get(self._obj, ftype)
834 return Documentation(c_doc) if c_doc else None
835 # TODO implement util properties for documentation_get
836
837 def is_auto(self, ftype=Eolian_Function_Type.METHOD):
838 return bool(lib.eolian_implement_is_auto(self._obj, ftype))
839 # TODO implement util properties for is_auto
840
841 def is_empty(self, ftype=Eolian_Function_Type.METHOD):
842 return bool(lib.eolian_implement_is_empty(self._obj, ftype))
843 # TODO implement util properties for is_empty
844
845 def is_pure_virtual(self, ftype=Eolian_Function_Type.METHOD):
846 return bool(lib.eolian_implement_is_pure_virtual(self._obj, ftype))
847 # TODO implement util properties for is_pure_virtual
848
849 @property
850 def is_prop_set(self):
851 return bool(lib.eolian_implement_is_prop_set(self._obj))
852
853 @property
854 def is_prop_get(self):
855 return bool(lib.eolian_implement_is_prop_get(self._obj))
856
857
858class Type(EolianBaseObject): # OK (4 eolian issue)
859 def __repr__(self):
860 # return "<eolian.Type '{0.full_name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self)
861 return "<eolian.Type '{0.full_name}', type={0.type!s}>".format(self)
862
863 @property
864 def name(self):
865 return _str_to_py(lib.eolian_type_name_get(self._obj))
866
867 @property
868 def full_name(self):
869 return _str_to_py(lib.eolian_type_full_name_get(self._obj))
870
871 @property
872 def namespaces(self):
873 return Iterator(_str_to_py,
874 lib.eolian_type_namespaces_get(self._obj))
875
876 @property
877 def free_func(self):
878 return _str_to_py(lib.eolian_type_free_func_get(self._obj))
879
880 @property
881 def type(self):
882 return Eolian_Type_Type(lib.eolian_type_type_get(self._obj))
883
884 @property
885 def builtin_type(self):
886 return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self._obj))
887
888 # TODO FIXME STRANGE API (need Eolian_Unit*)
889 # @property
890 # def c_type(self):
891 # return _str_to_py(lib.eolian_type_c_type_get(self._obj))
892
893 # TODO FIXME STRANGE API (need Eolian_Unit*)
894 # @property
895 # def typedecl(self):
896 # c_tdecl = lib.eolian_type_typedecl_get(self._obj)
897 # return Typedecl(c_tdecl) if c_tdecl else None
898
899 @property
900 def base_type(self):
901 c_type = lib.eolian_type_base_type_get(self._obj)
902 return Type(c_type) if c_type else None
903
904 @property
905 def next_type(self):
906 c_type = lib.eolian_type_next_type_get(self._obj)
907 return Type(c_type) if c_type else None
908
909 # TODO FIXME STRANGE API (need Eolian_Unit*)
910 # @property
911 # def aliased_base(self):
912 # c_type = lib.eolian_type_aliased_base_get(self._obj)
913 # return Type(c_type) if c_type else None
914
915 # TODO FIXME STRANGE API (need Eolian_Unit*)
916 # @property
917 # def class_(self):
918 # c_cls = lib.eolian_type_class_get(self._obj)
919 # return Class(c_cls) if c_cls else None
920
921 @property
922 def file(self):
923 return _str_to_py(lib.eolian_type_file_get(self._obj))
924
925 @property
926 def is_owned(self):
927 return bool(lib.eolian_type_is_owned(self._obj))
928
929 @property
930 def is_const(self):
931 return bool(lib.eolian_type_is_const(self._obj))
932
933 @property
934 def is_ptr(self):
935 return bool(lib.eolian_type_is_ptr(self._obj))
936
937
938class Typedecl(EolianBaseObject): # OK (2 TODO)
939 def __repr__(self):
940 return "<eolian.Typedecl '{0.full_name}', type={0.type!s}>".format(self)
941
942 @property
943 def name(self):
944 return _str_to_py(lib.eolian_typedecl_name_get(self._obj))
945
946 @property
947 def full_name(self):
948 return _str_to_py(lib.eolian_typedecl_full_name_get(self._obj))
949
950 @property
951 def file(self):
952 return _str_to_py(lib.eolian_typedecl_file_get(self._obj))
953
954 @property
955 def type(self):
956 return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self._obj))
957
958 # TODO FIX THIS, need Eolian_Unit* param ???
959 # @property
960 # def c_type(self):
961 # return _str_to_py(lib.eolian_typedecl_c_type_get(self._obj))
962
963 @property
964 def namespaces(self):
965 return Iterator(_str_to_py,
966 lib.eolian_typedecl_namespaces_get(self._obj))
967
968 @property
969 def free_func(self):
970 return _str_to_py(lib.eolian_typedecl_free_func_get(self._obj))
971
972 @property
973 def is_extern(self):
974 return bool(lib.eolian_typedecl_is_extern(self._obj))
975
976 @property
977 def enum_fields(self):
978 return Iterator(Enum_Type_Field,
979 lib.eolian_typedecl_enum_fields_get(self._obj))
980
981 def enum_field_get(self, field):
982 c_field = lib.eolian_typedecl_enum_field_get(self._obj, _str_to_bytes(field))
983 return Enum_Type_Field(c_field) if c_field else None
984
985 @property
986 def struct_fields(self):
987 return Iterator(Struct_Type_Field,
988 lib.eolian_typedecl_struct_fields_get(self._obj))
989
990 def struct_field_get(self, field):
991 c_field = lib.eolian_typedecl_struct_field_get(self._obj, _str_to_bytes(field))
992 return Struct_Type_Field(c_field) if c_field else None
993
994 @property
995 def base_type(self):
996 c_type = lib.eolian_typedecl_base_type_get(self._obj)
997 return Type(c_type) if c_type else None
998
999 # TODO FIX THIS, need Eolian_Unit* param ???
1000 # @property
1001 # def aliased_base(self):
1002 # c_type = lib.eolian_typedecl_aliased_base_get(self._obj)
1003 # return Type(c_type) if c_type else None
1004
1005 @property
1006 def documentation(self):
1007 c_doc = lib.eolian_typedecl_documentation_get(self._obj)
1008 return Documentation(c_doc) if c_doc else None
1009
1010 @property
1011 def enum_legacy_prefix(self):
1012 return _str_to_py(lib.eolian_typedecl_enum_legacy_prefix_get(self._obj))
1013
1014 @property
1015 def function_pointer(self):
1016 c_func = lib.eolian_typedecl_function_pointer_get(self._obj)
1017 return Function(c_func) if c_func else None
1018
1019
1020class Enum_Type_Field(EolianBaseObject):
1021 def __repr__(self):
1022 return "<eolian.Enum_Type_Field '{0.name}', c_name='{0.c_name}'>".format(self)
1023
1024 @property
1025 def name(self):
1026 return _str_to_py(lib.eolian_typedecl_enum_field_name_get(self._obj))
1027
1028 @property
1029 def c_name(self):
1030 s = lib.eolian_typedecl_enum_field_c_name_get(self._obj)
1031 ret = _str_to_py(s)
1032 lib.eina_stringshare_del(c_void_p(s))
1033 return ret
1034
1035 @property
1036 def value(self):
1037 c_expr = lib.eolian_typedecl_enum_field_value_get(self._obj, True)
1038 return Expression(c_expr) if c_expr else None
1039
1040 @property
1041 def documentation(self):
1042 c_doc = lib.eolian_typedecl_enum_field_documentation_get(self._obj)
1043 return Documentation(c_doc) if c_doc else None
1044
1045
1046class Struct_Type_Field(EolianBaseObject):
1047 def __repr__(self):
1048 return "<eolian.Struct_Type_Field '{0.name}', type={0.type!s}>".format(self)
1049
1050 @property
1051 def name(self):
1052 return _str_to_py(lib.eolian_typedecl_struct_field_name_get(self._obj))
1053
1054 @property
1055 def type(self):
1056 c_type = lib.eolian_typedecl_struct_field_type_get(self._obj)
1057 return Type(c_type) if c_type else None
1058
1059 @property
1060 def documentation(self):
1061 c_doc = lib.eolian_typedecl_struct_field_documentation_get(self._obj)
1062 return Documentation(c_doc) if c_doc else None
1063
1064
1065class Expression(EolianBaseObject):
1066 def __repr__(self):
1067 return "<eolian.Expression type={0.type!s}, serialize='{0.serialize}'>".format(self)
1068
1069 @property
1070 def type(self):
1071 return Eolian_Expression_Type(lib.eolian_expression_type_get(self._obj))
1072
1073 # TODO: EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr);
1074
1075 @property
1076 def serialize(self):
1077 s = lib.eolian_expression_serialize(self._obj)
1078 ret = _str_to_py(s)
1079 lib.eina_stringshare_del(c_void_p(s))
1080 return ret
1081
1082 @property
1083 def binary_operator(self):
1084 c_op = lib.eolian_expression_binary_operator_get(self._obj)
1085 return Eolian_Binary_Operator(c_op) if c_op is not None else None
1086
1087 @property
1088 def binary_lhs(self):
1089 c_expr = lib.eolian_expression_binary_lhs_get(self._obj)
1090 return Expression(c_expr) if c_expr else None
1091
1092 @property
1093 def binary_rhs(self):
1094 c_expr = lib.eolian_expression_binary_rhs_get(self._obj)
1095 return Expression(c_expr) if c_expr else None
1096
1097 @property
1098 def unary_operator(self):
1099 c_op = lib.eolian_expression_unary_operator_get(self._obj)
1100 return Eolian_Unary_Operator(c_op) if c_op is not None else None
1101
1102 @property
1103 def unary_expression(self):
1104 c_expr = lib.eolian_expression_unary_expression_get(self._obj)
1105 return Expression(c_expr) if c_expr is not None else None
1106
1107
1108class Variable(EolianBaseObject):
1109 def __repr__(self):
1110 return "<eolian.Variable '{0.full_name}', type={0.type!s}, file={0.file}>".format(self)
1111
1112 @property
1113 def name(self):
1114 return _str_to_py(lib.eolian_variable_name_get(self._obj))
1115
1116 @property
1117 def full_name(self):
1118 return _str_to_py(lib.eolian_variable_full_name_get(self._obj))
1119
1120 @property
1121 def namespaces(self):
1122 return Iterator(_str_to_py,
1123 lib.eolian_variable_namespaces_get(self._obj))
1124
1125 @property
1126 def type(self):
1127 return Eolian_Variable_Type(lib.eolian_variable_type_get(self._obj))
1128
1129 @property
1130 def value(self):
1131 c_expr = lib.eolian_variable_value_get(self._obj)
1132 return Expression(c_expr) if c_expr else None
1133
1134 @property
1135 def file(self):
1136 return _str_to_py(lib.eolian_variable_file_get(self._obj))
1137
1138 @property
1139 def base_type(self):
1140 c_type = lib.eolian_variable_base_type_get(self._obj)
1141 return Type(c_type) if c_type else None
1142
1143 @property
1144 def is_extern(self):
1145 return bool(lib.eolian_variable_is_extern(self._obj))
1146
1147
1148 @property
1149 def documentation(self):
1150 c_doc = lib.eolian_variable_documentation_get(self._obj)
1151 return Documentation(c_doc) if c_doc else None
1152
1153
1154class Declaration(EolianBaseObject):
1155 def __repr__(self):
1156 return "<eolian.Declaration '{0.name}'>".format(self)
1157
1158 @property
1159 def name(self):
1160 return _str_to_py(lib.eolian_declaration_name_get(self._obj))
1161
1162 @property
1163 def type(self):
1164 return Eolian_Declaration_Type(lib.eolian_declaration_type_get(self._obj))
1165
1166 @property
1167 def class_(self):
1168 c_cls = lib.eolian_declaration_class_get(self._obj)
1169 return Class(c_cls) if c_cls else None
1170
1171 @property
1172 def data_type(self):
1173 c_typedec = lib.eolian_declaration_data_type_get(self._obj)
1174 return Typedecl(c_typedec) if c_typedec else None
1175
1176 @property
1177 def variable(self):
1178 c_var = lib.eolian_declaration_variable_get(self._obj)
1179 return Variable(c_var) if c_var else None
1180
1181
1182class Documentation(EolianBaseObject):
1183 # def __repr__(self):
1184 # return "<eolian.Documentation '{0.name}'>".format(self)
1185
1186 # this is too much for py, just use string.split('\n\n')
1187 # def string_split(self, string):
1188 # c_list = lib.eolian_documentation_string_split
1189
1190 @property
1191 def summary(self):
1192 return _str_to_py(lib.eolian_documentation_summary_get(self._obj))
1193
1194 @property
1195 def description(self):
1196 return _str_to_py(lib.eolian_documentation_description_get(self._obj))
1197
1198 @property
1199 def since(self):
1200 return _str_to_py(lib.eolian_documentation_since_get(self._obj))
1201
1202
1203### internal string encode/decode ###########################################
1204
1205def _str_to_bytes(s):
1206 return s.encode('utf-8')
1207
1208def _str_to_py(s):
1209 if s is None:
1210 return None
1211 if isinstance(s, bytes):
1212 return s.decode('utf-8')
1213 if isinstance(s, c_char_p):
1214 return s.value.decode('utf-8')
1215 if isinstance(s, c_void_p):
1216 return cast(s, c_char_p).value.decode('utf-8')
1217 if isinstance(s, int):
1218 return cast(s, c_char_p).value.decode('utf-8')
1219 print('WARNING !!!!!!!!! Unknown type: %s' % type(s))
1220
1221
1222### module init/shutdown ####################################################
1223
1224import atexit
1225lib.eolian_init()
1226atexit.register(lambda: lib.eolian_shutdown())
1227
1228
1229
1230### API coverage statistics #################################################
1231
1232if __name__ == '__main__':
1233 import sys
1234 import os
1235 import re
1236
1237 # find Eolian.h in source tree
1238 script_path = os.path.dirname(os.path.realpath(__file__))
1239 eolian_header = os.path.join(script_path, '..', '..', 'lib', 'eolian', 'Eolian.h')
1240 eolian_header = os.path.abspath(eolian_header)
1241
1242 # prepare the two regexp
1243 flags = re.S | re.M
1244 DEFINED_RE = re.compile('^EAPI[\w\n *]*(eolian_\w*)\([\w *,]*\);', flags)
1245 USED_RE = re.compile('lib\.(eolian_[\w]*)\(', flags)
1246
1247 # extract all EAPI functions from Eolian.h
1248 defined_funcs = []
1249 with open(eolian_header, 'r') as fh:
1250 header = fh.read()
1251 for match in re.finditer(DEFINED_RE, header):
1252 func_name = match.group(1)
1253 defined_funcs.append(func_name)
1254 defined_funcs = set(defined_funcs)
1255
1256 # extract all called functions in eolian.py (this file)
1257 used_funcs = []
1258 with open(__file__, 'r') as fh:
1259 source = fh.read()
1260 for match in re.finditer(USED_RE, source):
1261 func_name = match.group(1)
1262 used_funcs.append(func_name)
1263 used_funcs = set(used_funcs)
1264
1265 # show general info
1266 num_def = len(defined_funcs)
1267 num_usd = len(used_funcs)
1268 print('Pyolian coverage results')
1269 print('========================')
1270 print('Found %d functions defined in Eolian.h (%s)' % (num_def, eolian_header))
1271 print('Found %d functions used in eolian.py (hopefully not commented out)' % num_usd)
1272 print('Total API coverage %.1f%%' % (num_usd / num_def * 100))
1273 print()
1274
1275 # list all missing functions
1276 missing = defined_funcs - used_funcs
1277 print('{} Missing functions in eolian.py'.format(len(missing)))
1278 print('=================================')
1279 for i, func_name in enumerate(sorted(missing), 1):
1280 print('{:02d}. {}'.format(i, func_name))
1281 print()
1282
1283 # List all functions found in Eolian.h (--all option)
1284 if '--all' in sys.argv:
1285 print('{} functions found in Eolian.h'.format(num_def))
1286 print('===============================')
1287 for i, func_name in enumerate(sorted(defined_funcs), 1):
1288 print('{:03d}. {}'.format(i, func_name))
1289 print()
1290 else:
1291 print('Additional arguments')
1292 print('====================')
1293 print(' --all To list all functions')
1294 print()
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
new file mode 100644
index 0000000000..5553d066ee
--- /dev/null
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -0,0 +1,757 @@
1#!/usr/bin/env python3
2# encoding: utf-8
3
4from ctypes import CDLL, c_bool, c_int, c_uint, c_char_p, c_void_p
5from ctypes.util import find_library
6
7import os
8
9
10# load the eolian so/dll already built in source tree
11script_path = os.path.dirname(os.path.realpath(__file__))
12root_path = os.path.abspath(os.path.join(script_path, '..', '..', '..'))
13
14search_in = (
15 os.path.join(root_path, 'src', 'lib', 'eolian', '.libs'),
16 os.path.join(root_path, 'build', 'src', 'lib', 'eolian'),
17)
18
19search_names = ('libeolian.so', 'eolian.dll')
20
21file_path = None
22for lib_dir in search_in:
23 for name in search_names:
24 f = os.path.join(lib_dir, name)
25 if os.path.exists(f):
26 file_path = f
27
28if not file_path:
29 raise RuntimeError('Error: cannot find a built eolian library in source tree')
30
31lib = CDLL(file_path)
32
33
34# EAPI int eolian_init(void);
35lib.eolian_init.argtypes = []
36lib.eolian_init.restype = c_int
37
38# EAPI int eolian_shutdown(void);
39lib.eolian_shutdown.argtypes = []
40lib.eolian_shutdown.restype = c_int
41
42# EAPI Eolian *eolian_new(void);
43lib.eolian_new.argtypes = []
44lib.eolian_new.restype = c_void_p
45
46# EAPI void eolian_free(Eolian *state);
47lib.eolian_free.argtypes = [c_void_p,]
48lib.eolian_free.restype = None
49
50# EAPI const Eolian_Unit *eolian_file_parse(Eolian *state, const char *filepath);
51lib.eolian_file_parse.argtypes = [c_void_p, c_char_p]
52lib.eolian_file_parse.restype = c_void_p
53
54# EAPI Eina_Iterator *eolian_all_eo_file_paths_get(const Eolian *state);
55lib.eolian_all_eo_file_paths_get.argtypes = [c_void_p,]
56lib.eolian_all_eo_file_paths_get.restype = c_void_p
57
58# EAPI Eina_Iterator *eolian_all_eot_file_paths_get(const Eolian *state);
59lib.eolian_all_eot_file_paths_get.argtypes = [c_void_p,]
60lib.eolian_all_eot_file_paths_get.restype = c_void_p
61
62# EAPI Eina_Iterator *eolian_all_eo_files_get(const Eolian *state);
63lib.eolian_all_eo_files_get.argtypes = [c_void_p,]
64lib.eolian_all_eo_files_get.restype = c_void_p
65
66# EAPI Eina_Iterator *eolian_all_eot_files_get(const Eolian *state);
67lib.eolian_all_eot_files_get.argtypes = [c_void_p,]
68lib.eolian_all_eot_files_get.restype = c_void_p
69
70# EAPI Eina_Bool eolian_directory_scan(Eolian *state, const char *dir);
71lib.eolian_directory_scan.argtypes = [c_void_p, c_char_p]
72lib.eolian_directory_scan.restype = c_bool
73
74# EAPI Eina_Bool eolian_system_directory_scan(Eolian *state);
75lib.eolian_system_directory_scan.argtypes = [c_void_p,]
76lib.eolian_system_directory_scan.restype = c_bool
77
78# EAPI Eina_Bool eolian_all_eo_files_parse(Eolian *state);
79lib.eolian_all_eo_files_parse.argtypes = [c_void_p,]
80lib.eolian_all_eo_files_parse.restype = c_bool
81
82# EAPI Eina_Bool eolian_all_eot_files_parse(Eolian *state);
83lib.eolian_all_eot_files_parse.argtypes = [c_void_p,]
84lib.eolian_all_eot_files_parse.restype = c_bool
85
86# EAPI const Eolian_Class *eolian_class_get_by_name(const Eolian_Unit *unit, const char *class_name);
87lib.eolian_class_get_by_name.argtypes = [c_void_p, c_char_p]
88lib.eolian_class_get_by_name.restype = c_void_p
89
90# EAPI const Eolian_Class *eolian_class_get_by_file(const Eolian_Unit *unit, const char *file_name);
91lib.eolian_class_get_by_file.argtypes = [c_void_p, c_char_p]
92lib.eolian_class_get_by_file.restype = c_void_p
93
94# EAPI Eina_Stringshare *eolian_class_file_get(const Eolian_Class *klass);
95lib.eolian_class_file_get.argtypes = [c_void_p,]
96lib.eolian_class_file_get.restype = c_char_p
97
98# EAPI Eina_Stringshare *eolian_class_full_name_get(const Eolian_Class *klass);
99lib.eolian_class_full_name_get.argtypes = [c_void_p,]
100lib.eolian_class_full_name_get.restype = c_char_p
101
102# EAPI Eina_Stringshare *eolian_class_name_get(const Eolian_Class *klass);
103lib.eolian_class_name_get.argtypes = [c_void_p,]
104lib.eolian_class_name_get.restype = c_char_p
105
106# EAPI Eina_Iterator *eolian_class_namespaces_get(const Eolian_Class *klass);
107lib.eolian_class_namespaces_get.argtypes = [c_void_p,]
108lib.eolian_class_namespaces_get.restype = c_void_p
109
110# EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
111lib.eolian_class_type_get.argtypes = [c_void_p,]
112lib.eolian_class_type_get.restype = c_int
113
114# EAPI Eina_Iterator *eolian_all_classes_get(const Eolian_Unit *unit);
115lib.eolian_all_classes_get.argtypes = [c_void_p,]
116lib.eolian_all_classes_get.restype = c_void_p
117
118# EAPI const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass);
119lib.eolian_class_documentation_get.argtypes = [c_void_p,]
120lib.eolian_class_documentation_get.restype = c_void_p
121
122# EAPI Eina_Stringshare *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
123lib.eolian_class_legacy_prefix_get.argtypes = [c_void_p,]
124lib.eolian_class_legacy_prefix_get.restype = c_char_p
125
126# EAPI Eina_Stringshare *eolian_class_eo_prefix_get(const Eolian_Class *klass);
127lib.eolian_class_eo_prefix_get.argtypes = [c_void_p,]
128lib.eolian_class_eo_prefix_get.restype = c_char_p
129
130# EAPI Eina_Stringshare* eolian_class_event_prefix_get(const Eolian_Class *klass);
131lib.eolian_class_event_prefix_get.argtypes = [c_void_p,]
132lib.eolian_class_event_prefix_get.restype = c_char_p
133
134# EAPI Eina_Stringshare *eolian_class_data_type_get(const Eolian_Class *klass);
135lib.eolian_class_data_type_get.argtypes = [c_void_p,]
136lib.eolian_class_data_type_get.restype = c_char_p
137
138# EAPI Eina_Iterator *eolian_class_inherits_get(const Eolian_Class *klass);
139lib.eolian_class_inherits_get.argtypes = [c_void_p,]
140lib.eolian_class_inherits_get.restype = c_void_p
141
142# EAPI Eina_Iterator *eolian_class_functions_get(const Eolian_Class *klass, Eolian_Function_Type func_type);
143lib.eolian_class_functions_get.argtypes = [c_void_p, c_int]
144lib.eolian_class_functions_get.restype = c_void_p
145
146# EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
147lib.eolian_function_type_get.argtypes = [c_void_p,]
148lib.eolian_function_type_get.restype = c_int
149
150# EAPI Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
151lib.eolian_function_scope_get.argtypes = [c_void_p, c_int]
152lib.eolian_function_scope_get.restype = c_int
153
154# EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_id);
155lib.eolian_function_name_get.argtypes = [c_void_p,]
156lib.eolian_function_name_get.restype = c_char_p
157
158# EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy);
159lib.eolian_function_full_c_name_get.argtypes = [c_void_p, c_int, c_bool]
160lib.eolian_function_full_c_name_get.restype = c_void_p # Stringshare TO BE FREED
161
162# EAPI const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
163lib.eolian_class_function_get_by_name.argtypes = [c_void_p, c_char_p, c_int]
164lib.eolian_class_function_get_by_name.restype = c_void_p
165
166# EAPI Eina_Stringshare *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type);
167lib.eolian_function_legacy_get.argtypes = [c_void_p, c_int]
168lib.eolian_function_legacy_get.restype = c_char_p
169
170# EAPI const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id);
171lib.eolian_function_implement_get.argtypes = [c_void_p,]
172lib.eolian_function_implement_get.restype = c_void_p
173
174# EAPI Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id, Eolian_Function_Type ftype);
175lib.eolian_function_is_legacy_only.argtypes = [c_void_p, c_int]
176lib.eolian_function_is_legacy_only.restype = c_bool
177
178# EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
179lib.eolian_function_is_class.argtypes = [c_void_p,]
180lib.eolian_function_is_class.restype = c_bool
181
182# EAPI Eina_Bool eolian_function_is_beta(const Eolian_Function *function_id);
183lib.eolian_function_is_beta.argtypes = [c_void_p,]
184lib.eolian_function_is_beta.restype = c_bool
185
186# EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
187lib.eolian_function_is_constructor.argtypes = [c_void_p,c_void_p,]
188lib.eolian_function_is_constructor.restype = c_bool
189
190# TODO FIXME
191# EAPI Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id);
192# lib.eolian_function_is_function_pointer.argtypes = [c_void_p,]
193# lib.eolian_function_is_function_pointer.restype = c_bool
194
195# EAPI Eina_Iterator *eolian_function_parameters_get(const Eolian_Function *function_id);
196lib.eolian_function_parameters_get.argtypes = [c_void_p,]
197lib.eolian_function_parameters_get.restype = c_void_p
198
199# EAPI Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
200lib.eolian_property_keys_get.argtypes = [c_void_p, c_int]
201lib.eolian_property_keys_get.restype = c_void_p
202
203# EAPI Eina_Iterator *eolian_property_values_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
204lib.eolian_property_values_get.argtypes = [c_void_p, c_int]
205lib.eolian_property_values_get.restype = c_void_p
206
207# EAPI Eolian_Parameter_Dir eolian_parameter_direction_get(const Eolian_Function_Parameter *param);
208lib.eolian_parameter_direction_get.argtypes = [c_void_p,]
209lib.eolian_parameter_direction_get.restype = c_int
210
211# EAPI const Eolian_Type *eolian_parameter_type_get(const Eolian_Function_Parameter *param);
212lib.eolian_parameter_type_get.argtypes = [c_void_p,]
213lib.eolian_parameter_type_get.restype = c_void_p
214
215# EAPI const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param);
216lib.eolian_parameter_default_value_get.argtypes = [c_void_p,]
217lib.eolian_parameter_default_value_get.restype = c_void_p
218
219# EAPI Eina_Stringshare *eolian_parameter_name_get(const Eolian_Function_Parameter *param);
220lib.eolian_parameter_name_get.argtypes = [c_void_p,]
221lib.eolian_parameter_name_get.restype = c_char_p
222
223# EAPI const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian_Function_Parameter *param);
224lib.eolian_parameter_documentation_get.argtypes = [c_void_p,]
225lib.eolian_parameter_documentation_get.restype = c_void_p
226
227# EAPI Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc);
228lib.eolian_parameter_is_nonull.argtypes = [c_void_p,]
229lib.eolian_parameter_is_nonull.restype = c_bool
230
231# EAPI Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc);
232lib.eolian_parameter_is_nullable.argtypes = [c_void_p,]
233lib.eolian_parameter_is_nullable.restype = c_bool
234
235# EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
236lib.eolian_parameter_is_optional.argtypes = [c_void_p,]
237lib.eolian_parameter_is_optional.restype = c_bool
238
239# EAPI const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
240lib.eolian_function_return_type_get.argtypes = [c_void_p, c_int]
241lib.eolian_function_return_type_get.restype = c_void_p
242
243# EAPI const Eolian_Expression * eolian_function_return_default_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
244lib.eolian_function_return_default_value_get.argtypes = [c_void_p, c_int]
245lib.eolian_function_return_default_value_get.restype = c_void_p
246
247# EAPI const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
248lib.eolian_function_return_documentation_get.argtypes = [c_void_p, c_int]
249lib.eolian_function_return_documentation_get.restype = c_void_p
250
251# EAPI Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
252lib.eolian_function_return_is_warn_unused.argtypes = [c_void_p, c_int]
253lib.eolian_function_return_is_warn_unused.restype = c_bool
254
255# EAPI Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
256lib.eolian_function_object_is_const.argtypes = [c_void_p,]
257lib.eolian_function_object_is_const.restype = c_bool
258
259# EAPI const Eolian_Class *eolian_function_class_get(const Eolian_Function *function_id);
260lib.eolian_function_class_get.argtypes = [c_void_p,]
261lib.eolian_function_class_get.restype = c_void_p
262
263# EAPI Eina_Stringshare *eolian_implement_full_name_get(const Eolian_Implement *impl);
264lib.eolian_implement_full_name_get.argtypes = [c_void_p,]
265lib.eolian_implement_full_name_get.restype = c_char_p
266
267# EAPI const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
268lib.eolian_implement_class_get.argtypes = [c_void_p,]
269lib.eolian_implement_class_get.restype = c_void_p
270
271# EAPI const Eolian_Function *eolian_implement_function_get(const Eolian_Implement *impl, Eolian_Function_Type *func_type);
272lib.eolian_implement_function_get.argtypes = [c_void_p, c_int]
273lib.eolian_implement_function_get.restype = c_void_p
274
275# EAPI const Eolian_Documentation *eolian_implement_documentation_get(const Eolian_Implement *impl, Eolian_Function_Type f_type);
276lib.eolian_implement_documentation_get.argtypes = [c_void_p, c_int]
277lib.eolian_implement_documentation_get.restype = c_void_p
278
279# EAPI Eina_Bool eolian_implement_is_auto(const Eolian_Implement *impl, Eolian_Function_Type f_type);
280lib.eolian_implement_is_auto.argtypes = [c_void_p, c_int]
281lib.eolian_implement_is_auto.restype = c_bool
282
283# EAPI Eina_Bool eolian_implement_is_empty(const Eolian_Implement *impl, Eolian_Function_Type f_type);
284lib.eolian_implement_is_empty.argtypes = [c_void_p, c_int]
285lib.eolian_implement_is_empty.restype = c_bool
286
287# EAPI Eina_Bool eolian_implement_is_pure_virtual(const Eolian_Implement *impl, Eolian_Function_Type f_type);
288lib.eolian_implement_is_pure_virtual.argtypes = [c_void_p, c_int]
289lib.eolian_implement_is_pure_virtual.restype = c_bool
290
291# EAPI Eina_Bool eolian_implement_is_prop_get(const Eolian_Implement *impl);
292lib.eolian_implement_is_prop_get.argtypes = [c_void_p,]
293lib.eolian_implement_is_prop_get.restype = c_bool
294
295# EAPI Eina_Bool eolian_implement_is_prop_set(const Eolian_Implement *impl);
296lib.eolian_implement_is_prop_set.argtypes = [c_void_p,]
297lib.eolian_implement_is_prop_set.restype = c_bool
298
299# EAPI Eina_Iterator *eolian_class_implements_get(const Eolian_Class *klass);
300lib.eolian_class_implements_get.argtypes = [c_void_p,]
301lib.eolian_class_implements_get.restype = c_void_p
302
303# EAPI Eina_Stringshare *eolian_constructor_full_name_get(const Eolian_Constructor *ctor);
304lib.eolian_constructor_full_name_get.argtypes = [c_void_p,]
305lib.eolian_constructor_full_name_get.restype = c_char_p
306
307# EAPI const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor);
308lib.eolian_constructor_class_get.argtypes = [c_void_p,]
309lib.eolian_constructor_class_get.restype = c_void_p
310
311# EAPI const Eolian_Function *eolian_constructor_function_get(const Eolian_Constructor *ctor);
312lib.eolian_constructor_function_get.argtypes = [c_void_p,]
313lib.eolian_constructor_function_get.restype = c_void_p
314
315# EAPI Eina_Bool eolian_constructor_is_optional(const Eolian_Constructor *ctor);
316lib.eolian_constructor_is_optional.argtypes = [c_void_p,]
317lib.eolian_constructor_is_optional.restype = c_bool
318
319# EAPI Eina_Iterator *eolian_class_constructors_get(const Eolian_Class *klass);
320lib.eolian_class_constructors_get.argtypes = [c_void_p,]
321lib.eolian_class_constructors_get.restype = c_void_p
322
323# EAPI Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass);
324lib.eolian_class_events_get.argtypes = [c_void_p,]
325lib.eolian_class_events_get.restype = c_void_p
326
327# EAPI Eina_Stringshare *eolian_event_name_get(const Eolian_Event *event);
328lib.eolian_event_name_get.argtypes = [c_void_p,]
329lib.eolian_event_name_get.restype = c_char_p
330
331# EAPI const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
332lib.eolian_event_type_get.argtypes = [c_void_p,]
333lib.eolian_event_type_get.restype = c_void_p
334
335# EAPI const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event);
336lib.eolian_event_documentation_get.argtypes = [c_void_p,]
337lib.eolian_event_documentation_get.restype = c_void_p
338
339# EAPI Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
340lib.eolian_event_scope_get.argtypes = [c_void_p,]
341lib.eolian_event_scope_get.restype = c_int
342
343# EAPI Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
344lib.eolian_event_is_beta.argtypes = [c_void_p,]
345lib.eolian_event_is_beta.restype = c_bool
346
347# EAPI Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
348lib.eolian_event_is_hot.argtypes = [c_void_p,]
349lib.eolian_event_is_hot.restype = c_bool
350
351# EAPI Eina_Bool eolian_event_is_restart(const Eolian_Event *event);
352lib.eolian_event_is_restart.argtypes = [c_void_p,]
353lib.eolian_event_is_restart.restype = c_bool
354
355# EAPI Eina_Iterator *eolian_class_parts_get(const Eolian_Class *klass);
356lib.eolian_class_parts_get.argtypes = [c_void_p,]
357lib.eolian_class_parts_get.restype = c_void_p
358
359# EAPI Eina_Stringshare *eolian_part_name_get(const Eolian_Part *part);
360lib.eolian_part_name_get.argtypes = [c_void_p,]
361lib.eolian_part_name_get.restype = c_char_p
362
363# EAPI const Eolian_Class *eolian_part_class_get(const Eolian_Part *part);
364lib.eolian_part_class_get.argtypes = [c_void_p,]
365lib.eolian_part_class_get.restype = c_void_p
366
367# EAPI const Eolian_Documentation *eolian_part_documentation_get(const Eolian_Part *part);
368lib.eolian_part_documentation_get.argtypes = [c_void_p,]
369lib.eolian_part_documentation_get.restype = c_void_p
370
371# EAPI Eina_Stringshare *eolian_event_c_name_get(const Eolian_Event *event);
372lib.eolian_event_c_name_get.argtypes = [c_void_p,]
373lib.eolian_event_c_name_get.restype = c_void_p # Stringshare TO BE FREED
374
375# EAPI const Eolian_Event *eolian_class_event_get_by_name(const Eolian_Class *klass, const char *event_name);
376lib.eolian_class_event_get_by_name.argtypes = [c_void_p, c_char_p]
377lib.eolian_class_event_get_by_name.restype = c_void_p
378
379# EAPI Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
380lib.eolian_class_ctor_enable_get.argtypes = [c_void_p,]
381lib.eolian_class_ctor_enable_get.restype = c_bool
382
383# EAPI Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
384lib.eolian_class_dtor_enable_get.argtypes = [c_void_p,]
385lib.eolian_class_dtor_enable_get.restype = c_bool
386
387# EAPI Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
388lib.eolian_class_c_get_function_name_get.argtypes = [c_void_p,]
389lib.eolian_class_c_get_function_name_get.restype = c_void_p # Stringshare TO BE FREED
390
391# EAPI Eina_Stringshare *eolian_class_c_name_get(const Eolian_Class *klass);
392lib.eolian_class_c_name_get.argtypes = [c_void_p,]
393lib.eolian_class_c_name_get.restype = c_void_p # Stringshare TO BE FREED
394
395# EAPI Eina_Stringshare *eolian_class_c_data_type_get(const Eolian_Class *klass);
396lib.eolian_class_c_data_type_get.argtypes = [c_void_p,]
397lib.eolian_class_c_data_type_get.restype = c_void_p # Stringshare TO BE FREED
398
399# EAPI const Eolian_Typedecl *eolian_typedecl_alias_get_by_name(const Eolian_Unit *unit, const char *name);
400lib.eolian_typedecl_alias_get_by_name.argtypes = [c_void_p, c_char_p]
401lib.eolian_typedecl_alias_get_by_name.restype = c_void_p
402
403# EAPI const Eolian_Typedecl *eolian_typedecl_struct_get_by_name(const Eolian_Unit *unit, const char *name);
404lib.eolian_typedecl_struct_get_by_name.argtypes = [c_void_p, c_char_p]
405lib.eolian_typedecl_struct_get_by_name.restype = c_void_p
406
407# EAPI const Eolian_Typedecl *eolian_typedecl_enum_get_by_name(const Eolian_Unit *unit, const char *name);
408lib.eolian_typedecl_enum_get_by_name.argtypes = [c_void_p, c_char_p]
409lib.eolian_typedecl_enum_get_by_name.restype = c_void_p
410
411# EAPI Eina_Iterator *eolian_typedecl_aliases_get_by_file(const Eolian_Unit *unit, const char *fname);
412lib.eolian_typedecl_aliases_get_by_file.argtypes = [c_void_p, c_char_p]
413lib.eolian_typedecl_aliases_get_by_file.restype = c_void_p
414
415# EAPI Eina_Iterator *eolian_typedecl_structs_get_by_file(const Eolian_Unit *unit, const char *fname);
416lib.eolian_typedecl_structs_get_by_file.argtypes = [c_void_p, c_char_p]
417lib.eolian_typedecl_structs_get_by_file.restype = c_void_p
418
419# EAPI Eina_Iterator *eolian_typedecl_enums_get_by_file(const Eolian_Unit *unit, const char *fname);
420lib.eolian_typedecl_enums_get_by_file.argtypes = [c_void_p, c_char_p]
421lib.eolian_typedecl_enums_get_by_file.restype = c_void_p
422
423# EAPI Eina_Iterator *eolian_typedecl_all_aliases_get(const Eolian_Unit *unit);
424lib.eolian_typedecl_all_aliases_get.argtypes = [c_void_p,]
425lib.eolian_typedecl_all_aliases_get.restype = c_void_p
426
427# EAPI Eina_Iterator *eolian_typedecl_all_structs_get(const Eolian_Unit *unit);
428lib.eolian_typedecl_all_structs_get.argtypes = [c_void_p,]
429lib.eolian_typedecl_all_structs_get.restype = c_void_p
430
431# EAPI Eina_Iterator *eolian_typedecl_all_enums_get(const Eolian_Unit *unit);
432lib.eolian_typedecl_all_enums_get.argtypes = [c_void_p,]
433lib.eolian_typedecl_all_enums_get.restype = c_void_p
434
435# EAPI Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
436lib.eolian_typedecl_type_get.argtypes = [c_void_p,]
437lib.eolian_typedecl_type_get.restype = c_int
438
439# EAPI Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp);
440lib.eolian_typedecl_struct_fields_get.argtypes = [c_void_p,]
441lib.eolian_typedecl_struct_fields_get.restype = c_void_p
442
443# EAPI const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field);
444lib.eolian_typedecl_struct_field_get.argtypes = [c_void_p, c_char_p]
445lib.eolian_typedecl_struct_field_get.restype = c_void_p
446
447# EAPI Eina_Stringshare *eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *fl);
448lib.eolian_typedecl_struct_field_name_get.argtypes = [c_void_p,]
449lib.eolian_typedecl_struct_field_name_get.restype = c_char_p
450
451# EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
452lib.eolian_typedecl_struct_field_documentation_get.argtypes = [c_void_p,]
453lib.eolian_typedecl_struct_field_documentation_get.restype = c_void_p
454
455# EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
456lib.eolian_typedecl_struct_field_type_get.argtypes = [c_void_p,]
457lib.eolian_typedecl_struct_field_type_get.restype = c_void_p
458
459# EAPI Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
460lib.eolian_typedecl_enum_fields_get.argtypes = [c_void_p,]
461lib.eolian_typedecl_enum_fields_get.restype = c_void_p
462
463# EAPI const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field);
464lib.eolian_typedecl_enum_field_get.argtypes = [c_void_p, c_char_p]
465lib.eolian_typedecl_enum_field_get.restype = c_void_p
466
467# EAPI Eina_Stringshare *eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *fl);
468lib.eolian_typedecl_enum_field_name_get.argtypes = [c_void_p,]
469lib.eolian_typedecl_enum_field_name_get.restype = c_char_p
470
471# EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl);
472lib.eolian_typedecl_enum_field_c_name_get.argtypes = [c_void_p,]
473lib.eolian_typedecl_enum_field_c_name_get.restype = c_void_p # Stringshare TO BE FREED
474
475# EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
476lib.eolian_typedecl_enum_field_documentation_get.argtypes = [c_void_p,]
477lib.eolian_typedecl_enum_field_documentation_get.restype = c_void_p
478
479# EAPI const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
480lib.eolian_typedecl_enum_field_value_get.argtypes = [c_void_p, c_bool]
481lib.eolian_typedecl_enum_field_value_get.restype = c_void_p
482
483# EAPI Eina_Stringshare *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp);
484lib.eolian_typedecl_enum_legacy_prefix_get.argtypes = [c_void_p,]
485lib.eolian_typedecl_enum_legacy_prefix_get.restype = c_char_p
486
487# EAPI const Eolian_Documentation *eolian_typedecl_documentation_get(const Eolian_Typedecl *tp);
488lib.eolian_typedecl_documentation_get.argtypes = [c_void_p,]
489lib.eolian_typedecl_documentation_get.restype = c_void_p
490
491# EAPI Eina_Stringshare *eolian_typedecl_file_get(const Eolian_Typedecl *tp);
492lib.eolian_typedecl_file_get.argtypes = [c_void_p,]
493lib.eolian_typedecl_file_get.restype = c_char_p
494
495# EAPI const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
496lib.eolian_typedecl_base_type_get.argtypes = [c_void_p,]
497lib.eolian_typedecl_base_type_get.restype = c_void_p
498
499# TODO FIXME STRANGE API (need Eolian_Unit*)
500# EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
501# lib.eolian_typedecl_aliased_base_get.argtypes = [c_void_p, c_void_p,]
502# lib.eolian_typedecl_aliased_base_get.restype = c_void_p
503
504# EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
505lib.eolian_typedecl_is_extern.argtypes = [c_void_p,]
506lib.eolian_typedecl_is_extern.restype = c_bool
507
508# TODO FIXME STRANGE API (need Eolian_Unit*)
509# EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
510# lib.eolian_typedecl_c_type_get.argtypes = [c_void_p,]
511# lib.eolian_typedecl_c_type_get.restype = None
512
513# EAPI Eina_Stringshare *eolian_typedecl_name_get(const Eolian_Typedecl *tp);
514lib.eolian_typedecl_name_get.argtypes = [c_void_p,]
515lib.eolian_typedecl_name_get.restype = c_char_p
516
517# EAPI Eina_Stringshare *eolian_typedecl_full_name_get(const Eolian_Typedecl *tp);
518lib.eolian_typedecl_full_name_get.argtypes = [c_void_p,]
519lib.eolian_typedecl_full_name_get.restype = c_char_p
520
521# EAPI Eina_Iterator *eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp);
522lib.eolian_typedecl_namespaces_get.argtypes = [c_void_p,]
523lib.eolian_typedecl_namespaces_get.restype = c_void_p
524
525# EAPI Eina_Stringshare *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp);
526lib.eolian_typedecl_free_func_get.argtypes = [c_void_p,]
527lib.eolian_typedecl_free_func_get.restype = c_char_p
528
529# EAPI const Eolian_Function *eolian_typedecl_function_pointer_get(const Eolian_Typedecl *tp);
530lib.eolian_typedecl_function_pointer_get.argtypes = [c_void_p,]
531lib.eolian_typedecl_function_pointer_get.restype = c_void_p
532
533# EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
534lib.eolian_type_type_get.argtypes = [c_void_p,]
535lib.eolian_type_type_get.restype = c_int
536
537# EAPI Eolian_Type_Builtin_Type eolian_type_builtin_type_get(const Eolian_Type *tp);
538lib.eolian_type_builtin_type_get.argtypes = [c_void_p,]
539lib.eolian_type_builtin_type_get.restype = c_int
540
541# EAPI Eina_Stringshare *eolian_type_file_get(const Eolian_Type *tp);
542lib.eolian_type_file_get.argtypes = [c_void_p,]
543lib.eolian_type_file_get.restype = c_char_p
544
545# EAPI const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
546lib.eolian_type_base_type_get.argtypes = [c_void_p,]
547lib.eolian_type_base_type_get.restype = c_void_p
548
549# EAPI const Eolian_Type *eolian_type_next_type_get(const Eolian_Type *tp);
550lib.eolian_type_next_type_get.argtypes = [c_void_p,]
551lib.eolian_type_next_type_get.restype = c_void_p
552
553# TODO FIXME STRANGE API (need Eolian_Unit*)
554# EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Unit *unit, const Eolian_Type *tp);
555# lib.eolian_type_typedecl_get.argtypes = [c_void_p,]
556# lib.eolian_type_typedecl_get.restype = c_void_p
557
558# TODO FIXME STRANGE API (need Eolian_Unit*)
559# EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
560# lib.eolian_type_aliased_base_get.argtypes = [c_void_p,]
561# lib.eolian_type_aliased_base_get.restype = c_void_p
562
563# TODO FIXME STRANGE API (need Eolian_Unit*)
564# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp);
565# lib.eolian_type_class_get.argtypes = [c_void_p,]
566# lib.eolian_type_class_get.restype = c_void_p
567
568# EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
569lib.eolian_type_is_owned.argtypes = [c_void_p,]
570lib.eolian_type_is_owned.restype = c_bool
571
572# EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
573lib.eolian_type_is_const.argtypes = [c_void_p,]
574lib.eolian_type_is_const.restype = c_bool
575
576# EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
577lib.eolian_type_is_ptr.argtypes = [c_void_p,]
578lib.eolian_type_is_ptr.restype = c_bool
579
580# TODO FIXME STRANGE API (need Eolian_Unit*)
581# EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Unit *unit, const Eolian_Type *tp, Eolian_C_Type_Type ctype);
582# lib.eolian_type_c_type_get.argtypes = [c_void_p,]
583# lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED
584
585# EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp);
586lib.eolian_type_name_get.argtypes = [c_void_p,]
587lib.eolian_type_name_get.restype = c_char_p
588
589# EAPI Eina_Stringshare *eolian_type_full_name_get(const Eolian_Type *tp);
590lib.eolian_type_full_name_get.argtypes = [c_void_p,]
591lib.eolian_type_full_name_get.restype = c_char_p
592
593# EAPI Eina_Iterator *eolian_type_namespaces_get(const Eolian_Type *tp);
594lib.eolian_type_namespaces_get.argtypes = [c_void_p,]
595lib.eolian_type_namespaces_get.restype = c_void_p
596
597# EAPI Eina_Stringshare *eolian_type_free_func_get(const Eolian_Type *tp);
598lib.eolian_type_free_func_get.argtypes = [c_void_p,]
599lib.eolian_type_free_func_get.restype = c_char_p
600
601# EAPI Eina_Stringshare *eolian_expression_serialize(const Eolian_Expression *expr);
602lib.eolian_expression_serialize.argtypes = [c_void_p,]
603lib.eolian_expression_serialize.restype = c_void_p # Stringshare TO BE FREED
604
605# EAPI Eolian_Expression_Type eolian_expression_type_get(const Eolian_Expression *expr);
606lib.eolian_expression_type_get.argtypes = [c_void_p,]
607lib.eolian_expression_type_get.restype = c_int
608
609# EAPI Eolian_Binary_Operator eolian_expression_binary_operator_get(const Eolian_Expression *expr);
610lib.eolian_expression_binary_operator_get.argtypes = [c_void_p,]
611lib.eolian_expression_binary_operator_get.restype = c_int
612
613# EAPI const Eolian_Expression *eolian_expression_binary_lhs_get(const Eolian_Expression *expr);
614lib.eolian_expression_binary_lhs_get.argtypes = [c_void_p,]
615lib.eolian_expression_binary_lhs_get.restype = c_void_p
616
617# EAPI const Eolian_Expression *eolian_expression_binary_rhs_get(const Eolian_Expression *expr);
618lib.eolian_expression_binary_rhs_get.argtypes = [c_void_p,]
619lib.eolian_expression_binary_rhs_get.restype = c_void_p
620
621# EAPI Eolian_Unary_Operator eolian_expression_unary_operator_get(const Eolian_Expression *expr);
622lib.eolian_expression_unary_operator_get.argtypes = [c_void_p,]
623lib.eolian_expression_unary_operator_get.restype = c_int
624
625# EAPI const Eolian_Expression *eolian_expression_unary_expression_get(const Eolian_Expression *expr);
626lib.eolian_expression_unary_expression_get.argtypes = [c_void_p,]
627lib.eolian_expression_unary_expression_get.restype = c_void_p
628
629# EAPI const Eolian_Variable *eolian_variable_global_get_by_name(const Eolian_Unit *unit, const char *name);
630lib.eolian_variable_global_get_by_name.argtypes = [c_void_p, c_char_p]
631lib.eolian_variable_global_get_by_name.restype = c_void_p
632
633# EAPI const Eolian_Variable *eolian_variable_constant_get_by_name(const Eolian_Unit *unit, const char *name);
634lib.eolian_variable_constant_get_by_name.argtypes = [c_void_p, c_char_p]
635lib.eolian_variable_constant_get_by_name.restype = c_void_p
636
637# EAPI Eina_Iterator *eolian_variable_globals_get_by_file(const Eolian_Unit *unit, const char *fname);
638lib.eolian_variable_globals_get_by_file.argtypes = [c_void_p, c_char_p]
639lib.eolian_variable_globals_get_by_file.restype = c_void_p
640
641# EAPI Eina_Iterator *eolian_variable_constants_get_by_file(const Eolian_Unit *unit, const char *fname);
642lib.eolian_variable_constants_get_by_file.argtypes = [c_void_p, c_char_p]
643lib.eolian_variable_constants_get_by_file.restype = c_void_p
644
645# EAPI Eina_Iterator *eolian_variable_all_constants_get(const Eolian_Unit *unit);
646lib.eolian_variable_all_constants_get.argtypes = [c_void_p,]
647lib.eolian_variable_all_constants_get.restype = c_void_p
648
649# EAPI Eina_Iterator *eolian_variable_all_globals_get(const Eolian_Unit *unit);
650lib.eolian_variable_all_globals_get.argtypes = [c_void_p,]
651lib.eolian_variable_all_globals_get.restype = c_void_p
652
653# EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var);
654lib.eolian_variable_type_get.argtypes = [c_void_p,]
655lib.eolian_variable_type_get.restype = c_int
656
657# EAPI const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var);
658lib.eolian_variable_documentation_get.argtypes = [c_void_p,]
659lib.eolian_variable_documentation_get.restype = c_void_p
660
661# EAPI Eina_Stringshare *eolian_variable_file_get(const Eolian_Variable *var);
662lib.eolian_variable_file_get.argtypes = [c_void_p,]
663lib.eolian_variable_file_get.restype = c_char_p
664
665# EAPI const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var);
666lib.eolian_variable_base_type_get.argtypes = [c_void_p,]
667lib.eolian_variable_base_type_get.restype = c_void_p
668
669# EAPI const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var);
670lib.eolian_variable_value_get.argtypes = [c_void_p,]
671lib.eolian_variable_value_get.restype = c_void_p
672
673# EAPI Eina_Stringshare *eolian_variable_name_get(const Eolian_Variable *var);
674lib.eolian_variable_name_get.argtypes = [c_void_p,]
675lib.eolian_variable_name_get.restype = c_char_p
676
677# EAPI Eina_Stringshare *eolian_variable_full_name_get(const Eolian_Variable *var);
678lib.eolian_variable_full_name_get.argtypes = [c_void_p,]
679lib.eolian_variable_full_name_get.restype = c_char_p
680
681# EAPI Eina_Iterator *eolian_variable_namespaces_get(const Eolian_Variable *var);
682lib.eolian_variable_namespaces_get.argtypes = [c_void_p,]
683lib.eolian_variable_namespaces_get.restype = c_void_p
684
685# EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var);
686lib.eolian_variable_is_extern.argtypes = [c_void_p,]
687lib.eolian_variable_is_extern.restype = c_bool
688
689# EAPI const Eolian_Declaration *eolian_declaration_get_by_name(const Eolian_Unit *unit, const char *name);
690lib.eolian_declaration_get_by_name.argtypes = [c_void_p, c_char_p]
691lib.eolian_declaration_get_by_name.restype = c_void_p
692
693# EAPI Eina_Iterator *eolian_declarations_get_by_file(const Eolian *state, const char *fname);
694lib.eolian_declarations_get_by_file.argtypes = [c_void_p, c_char_p]
695lib.eolian_declarations_get_by_file.restype = c_void_p
696
697# EAPI Eina_Iterator *eolian_all_declarations_get(const Eolian_Unit *unit);
698lib.eolian_all_declarations_get.argtypes = [c_void_p,]
699lib.eolian_all_declarations_get.restype = c_void_p
700
701# EAPI Eolian_Declaration_Type eolian_declaration_type_get(const Eolian_Declaration *decl);
702lib.eolian_declaration_type_get.argtypes = [c_void_p,]
703lib.eolian_declaration_type_get.restype = c_int
704
705# EAPI Eina_Stringshare *eolian_declaration_name_get(const Eolian_Declaration *decl);
706lib.eolian_declaration_name_get.argtypes = [c_void_p,]
707lib.eolian_declaration_name_get.restype = c_char_p
708
709# EAPI const Eolian_Class *eolian_declaration_class_get(const Eolian_Declaration *decl);
710lib.eolian_declaration_class_get.argtypes = [c_void_p,]
711lib.eolian_declaration_class_get.restype = c_void_p
712
713# EAPI const Eolian_Typedecl *eolian_declaration_data_type_get(const Eolian_Declaration *decl);
714lib.eolian_declaration_data_type_get.argtypes = [c_void_p,]
715lib.eolian_declaration_data_type_get.restype = c_void_p
716
717# EAPI const Eolian_Variable *eolian_declaration_variable_get(const Eolian_Declaration *decl);
718lib.eolian_declaration_variable_get.argtypes = [c_void_p,]
719lib.eolian_declaration_variable_get.restype = c_void_p
720
721# EAPI Eina_Stringshare *eolian_documentation_summary_get(const Eolian_Documentation *doc);
722lib.eolian_documentation_summary_get.argtypes = [c_void_p,]
723lib.eolian_documentation_summary_get.restype = c_char_p
724
725# EAPI Eina_Stringshare *eolian_documentation_description_get(const Eolian_Documentation *doc);
726lib.eolian_documentation_description_get.argtypes = [c_void_p,]
727lib.eolian_documentation_description_get.restype = c_char_p
728
729# EAPI Eina_Stringshare *eolian_documentation_since_get(const Eolian_Documentation *doc);
730lib.eolian_documentation_since_get.argtypes = [c_void_p,]
731lib.eolian_documentation_since_get.restype = c_char_p
732
733# NOT IMPLEMENTED
734# EAPI Eina_List *eolian_documentation_string_split(const char *doc);
735# lib.eolian_documentation_string_split.argtypes = [c_char_p,]
736# lib.eolian_documentation_string_split.restype = c_void_p
737
738# # EAPI const char *eolian_documentation_tokenize(const char *doc, Eolian_Doc_Token *ret);
739lib.eolian_documentation_tokenize.argtypes = [c_char_p, c_void_p]
740lib.eolian_documentation_tokenize.restype = c_char_p
741
742# EAPI void eolian_doc_token_init(Eolian_Doc_Token *tok);
743lib.eolian_doc_token_init.argtypes = [c_void_p,]
744lib.eolian_doc_token_init.restype = None
745
746# EAPI Eolian_Doc_Token_Type eolian_doc_token_type_get(const Eolian_Doc_Token *tok);
747lib.eolian_doc_token_type_get.argtypes = [c_void_p,]
748lib.eolian_doc_token_type_get.restype = c_int
749
750# EAPI char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok);
751lib.eolian_doc_token_text_get.argtypes = [c_void_p,]
752lib.eolian_doc_token_text_get.restype = c_void_p # char* TO BE FREED
753
754# EAPI Eolian_Doc_Ref_Type eolian_doc_token_ref_get(const Eolian_Unit *unit, const Eolian_Doc_Token *tok, const void **data, const void **data2);
755# lib.eolian_doc_token_ref_get.argtypes = [c_void_p, c_void_p, ???, ???]
756# lib.eolian_doc_token_ref_get.restype = c_int
757
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
new file mode 100755
index 0000000000..fa9869d93b
--- /dev/null
+++ b/src/scripts/pyolian/test_eolian.py
@@ -0,0 +1,440 @@
1#!/usr/bin/env python3
2# encoding: utf-8
3"""
4Pyolian test suite.
5
6Just run this file to execute the full suite.
7
8A return value of 0 means all test passed successfully.
9
10"""
11import os
12import unittest
13
14import eolian
15
16
17# Use .eo files from the source tree (not the installed ones)
18script_path = os.path.dirname(os.path.realpath(__file__))
19root_path = os.path.abspath(os.path.join(script_path, '..', '..', '..'))
20SCAN_FOLDER = os.path.join(root_path, 'src', 'lib')
21
22# the main Eolian unit state
23state = None
24
25
26class TestEolianUnit(unittest.TestCase):
27 def test_file_listing(self):
28 l = list(state.all_eo_file_paths)
29 self.assertGreater(len(l), 400)
30 self.assertTrue(l[0].endswith('.eo'))
31
32 l = list(state.all_eo_files)
33 self.assertGreater(len(l), 400)
34 self.assertTrue(l[0].endswith('.eo'))
35
36 l = list(state.all_eot_file_paths)
37 self.assertGreater(len(l), 10)
38 self.assertTrue(l[0].endswith('.eot'))
39
40 l = list(state.all_eot_files)
41 self.assertGreater(len(l), 10)
42 self.assertTrue(l[0].endswith('.eot'))
43
44 def test_enum_listing(self):
45 l = list(state.typedecl_enums_get_by_file('efl_ui_win.eo'))
46 self.assertGreater(len(l), 5)
47 self.assertIsInstance(l[0], eolian.Typedecl)
48 self.assertEqual(l[0].type, eolian.Eolian_Typedecl_Type.ENUM)
49
50 all_count = 0
51 for enum in state.typedecl_all_enums:
52 self.assertIsInstance(enum, eolian.Typedecl)
53 self.assertEqual(enum.type, eolian.Eolian_Typedecl_Type.ENUM)
54 all_count += 1
55 self.assertGreater(all_count, 50)
56
57 def test_struct_listing(self):
58 l = list(state.typedecl_structs_get_by_file('eina_types.eot'))
59 self.assertGreater(len(l), 10)
60 self.assertIsInstance(l[0], eolian.Typedecl)
61 self.assertIn(l[0].type, (
62 eolian.Eolian_Typedecl_Type.STRUCT,
63 eolian.Eolian_Typedecl_Type.STRUCT_OPAQUE))
64
65 all_count = 0
66 for struct in state.typedecl_all_structs:
67 self.assertIsInstance(struct, eolian.Typedecl)
68 self.assertIn(struct.type, (
69 eolian.Eolian_Typedecl_Type.STRUCT,
70 eolian.Eolian_Typedecl_Type.STRUCT_OPAQUE))
71 all_count += 1
72 self.assertGreater(all_count, 50)
73
74 def test_alias_listing(self):
75 l = list(state.typedecl_aliases_get_by_file('edje_types.eot'))
76 self.assertGreater(len(l), 5)
77 self.assertIsInstance(l[0], eolian.Typedecl)
78
79 all_count = 0
80 for alias in state.typedecl_all_aliases:
81 self.assertIsInstance(alias, eolian.Typedecl)
82 self.assertIn(alias.type, (
83 eolian.Eolian_Typedecl_Type.ALIAS,
84 eolian.Eolian_Typedecl_Type.FUNCTION_POINTER)) # TODO is this correct ??
85 all_count += 1
86 self.assertGreater(all_count, 10)
87
88 def test_variable_listing(self):
89 l = list(state.variable_all_constants)
90 self.assertGreater(len(l), 2)
91 self.assertIsInstance(l[0], eolian.Variable)
92
93 l = list(state.variable_all_globals)
94 self.assertGreater(len(l), 20)
95 self.assertIsInstance(l[0], eolian.Variable)
96
97 l = list(state.variable_constants_get_by_file('efl_gfx_stack.eo'))
98 self.assertGreater(len(l), 1)
99 self.assertIsInstance(l[0], eolian.Variable)
100
101 l = list(state.variable_globals_get_by_file('efl_net_http_types.eot'))
102 self.assertGreater(len(l), 10)
103 self.assertIsInstance(l[0], eolian.Variable)
104
105 def test_declaration_listing(self):
106 l = list(state.declarations_get_by_file('eina_types.eot'))
107 self.assertGreater(len(l), 10)
108 self.assertIsInstance(l[0], eolian.Declaration)
109
110 l = list(state.all_declarations)
111 self.assertGreater(len(l), 100)
112 self.assertIsInstance(l[0], eolian.Declaration)
113
114 def test_class_listing(self):
115 all_count = 0
116 for cls in state.all_classes:
117 self.assertIsInstance(cls, eolian.Class)
118 all_count += 1
119 self.assertGreater(all_count, 400)
120
121
122class TestEolianClass(unittest.TestCase):
123 def test_class(self):
124 cls = state.class_get_by_file('efl_loop_timer.eo')
125 self.assertIsInstance(cls, eolian.Class)
126
127 cls = state.class_get_by_name('Efl.Loop.Timer')
128 self.assertIsInstance(cls, eolian.Class)
129
130 self.assertEqual(cls.name, 'Timer')
131 self.assertEqual(cls.full_name, 'Efl.Loop.Timer')
132 self.assertEqual(cls.file, 'efl_loop_timer.eo')
133 self.assertEqual(list(cls.namespaces), ['Efl', 'Loop'])
134 self.assertEqual(cls.type, eolian.Eolian_Class_Type.REGULAR)
135 self.assertIsInstance(cls.documentation, eolian.Documentation)
136 self.assertEqual(cls.legacy_prefix, 'ecore_timer')
137 self.assertIsNone(cls.eo_prefix) # TODO fin a class with a value
138 self.assertIsNone(cls.event_prefix) # TODO same as above
139 self.assertIsNone(cls.data_type) # TODO same as above
140 self.assertEqual(len(list(cls.inherits)), 1)
141 self.assertFalse(cls.ctor_enable)
142 self.assertFalse(cls.dtor_enable)
143 self.assertEqual(cls.c_get_function_name, 'efl_loop_timer_class_get')
144 self.assertEqual(cls.c_name, 'EFL_LOOP_TIMER_CLASS')
145 self.assertEqual(cls.c_data_type, 'Efl_Loop_Timer_Data')
146 self.assertEqual([f.name for f in cls.methods], ['reset','loop_reset','delay'])
147 self.assertEqual([f.name for f in cls.properties], ['interval','pending'])
148 self.assertGreater(len(list(cls.implements)), 5)
149 self.assertIsInstance(list(cls.implements)[0], eolian.Implement)
150
151
152class TestEolianFunction(unittest.TestCase):
153 def test_function(self):
154 cls = state.class_get_by_name('Efl.Loop.Timer')
155 f = cls.function_get_by_name('delay')
156 self.assertIsInstance(f, eolian.Function)
157 self.assertEqual(f.name, 'delay')
158 self.assertEqual(f.type, eolian.Eolian_Function_Type.METHOD)
159 self.assertEqual(f.method_scope, eolian.Eolian_Object_Scope.PUBLIC)
160 self.assertEqual(f.getter_scope, eolian.Eolian_Object_Scope.UNKNOWN) # TODO correct?
161 self.assertEqual(f.setter_scope, eolian.Eolian_Object_Scope.UNKNOWN) # TODO correct?
162 self.assertEqual(f.full_c_method_name, 'efl_loop_timer_delay')
163 self.assertEqual(f.full_c_getter_name, 'efl_loop_timer_delay_get')
164 self.assertEqual(f.full_c_setter_name, 'efl_loop_timer_delay_set')
165 self.assertEqual(f.full_c_method_name_legacy, 'ecore_timer_delay')
166 self.assertEqual(f.full_c_getter_name_legacy, 'ecore_timer_delay_get')
167 self.assertEqual(f.full_c_setter_name_legacy, 'ecore_timer_delay_set')
168 self.assertIsNone(f.method_return_type) # TODO correct ?
169 self.assertIsNone(f.setter_return_type) # TODO correct ?
170 self.assertIsNone(f.getter_return_type) # TODO correct ?
171 self.assertFalse(f.is_legacy_only(eolian.Eolian_Function_Type.PROP_GET))
172 self.assertFalse(f.is_class)
173 self.assertFalse(f.is_beta)
174 self.assertFalse(f.is_constructor(cls))
175 # # #assert f.is_function_pointer == False # TODO broken somehow
176 self.assertEqual(len(list(f.getter_values)), 1)
177 self.assertEqual(len(list(f.getter_values)), 1)
178 self.assertEqual(len(list(f.parameters)), 1)
179 self.assertFalse(f.return_is_warn_unused(eolian.Eolian_Function_Type.METHOD))
180 self.assertFalse(f.object_is_const)
181 self.assertEqual(f.class_.full_name, 'Efl.Loop.Timer')
182
183 def test_function_parameter(self):
184 cls = state.class_get_by_name('Efl.Loop.Timer')
185 f = cls.function_get_by_name('delay')
186 p = list(f.parameters)[0]
187 self.assertEqual(p.direction, eolian.Eolian_Parameter_Dir.IN)
188 self.assertEqual(p.name, 'add')
189 self.assertIsNone(p.default_value)
190 self.assertFalse(p.is_nonull) # TODO is correct ?? 'add' can be null?
191 self.assertFalse(p.is_nullable)
192 self.assertFalse(p.is_optional)
193 self.assertEqual(p.type.name, 'double')
194 self.assertIsInstance(p.documentation, eolian.Documentation)
195
196
197class TestEolianImplement(unittest.TestCase):
198 def test_implement(self):
199 cls = state.class_get_by_name('Efl.Loop.Timer')
200 f = cls.function_get_by_name('delay')
201 im = f.implement
202 self.assertIsInstance(im, eolian.Implement)
203 self.assertEqual(im.full_name, 'Efl.Loop.Timer.delay')
204 self.assertIsInstance(im.class_, eolian.Class)
205 self.assertIsInstance(im.function_get(), eolian.Function) # TODO is UNRESOLVED correct ?
206 self.assertIsInstance(im.documentation_get(), eolian.Documentation) # TODO is UNRESOLVED correct ?
207 self.assertFalse(im.is_auto())
208 self.assertFalse(im.is_empty())
209 self.assertFalse(im.is_pure_virtual())
210 self.assertFalse(im.is_prop_set)
211 self.assertFalse(im.is_prop_get)
212
213
214class TestEolianEvent(unittest.TestCase):
215 def test_event(self):
216 cls = state.class_get_by_name('Efl.Loop.Timer')
217 self.assertEqual([e.name for e in cls.events], ['tick'])
218 ev = cls.event_get_by_name('tick')
219 self.assertIsInstance(ev, eolian.Event)
220 self.assertEqual(ev.name, 'tick')
221 self.assertEqual(ev.c_name, 'EFL_LOOP_TIMER_EVENT_TICK')
222 self.assertIsNone(ev.type) # TODO is this correct
223 self.assertIsInstance(ev.documentation, eolian.Documentation)
224 self.assertEqual(ev.scope, eolian.Eolian_Object_Scope.PUBLIC)
225 self.assertFalse(ev.is_beta)
226 self.assertFalse(ev.is_hot)
227 self.assertFalse(ev.is_restart)
228
229
230class TestEolianPart(unittest.TestCase):
231 def test_part(self):
232 cls = state.class_get_by_name('Efl.Ui.Popup')
233 parts = list(cls.parts)
234 self.assertGreater(len(parts), 0)
235
236 part = parts[0]
237 self.assertEqual(part.name, 'backwall')
238 self.assertIsInstance(part.class_, eolian.Class)
239 self.assertEqual(part.class_.full_name, 'Efl.Ui.Popup.Part')
240 self.assertIsInstance(part.documentation, eolian.Documentation)
241
242
243class TestEolianConstructor(unittest.TestCase):
244 def test_constructor(self):
245 cls = state.class_get_by_name('Efl.Ui.Win')
246 ctors = list(cls.constructors)
247 self.assertGreater(len(ctors), 0)
248 ctor = ctors[0]
249 self.assertIsInstance(ctor, eolian.Constructor)
250 self.assertEqual(ctor.full_name, 'Efl.Ui.Win.win_name')
251 self.assertFalse(ctor.is_optional)
252 self.assertIsInstance(ctor.class_, eolian.Class)
253 self.assertEqual(ctor.class_.full_name, 'Efl.Ui.Win')
254 self.assertIsInstance(ctor.function, eolian.Function)
255 self.assertEqual(ctor.function.name, 'win_name')
256
257
258class TestEolianDocumentation(unittest.TestCase):
259 def test_documentation(self):
260 td = state.class_get_by_name('Efl.Net.Control')
261 doc = td.documentation
262 self.assertIsInstance(doc, eolian.Documentation)
263 self.assertIsInstance(doc.summary, str)
264 self.assertGreater(len(doc.summary), 10)
265 self.assertIsInstance(doc.description, str)
266 self.assertGreater(len(doc.description), 20)
267 self.assertEqual(doc.since, '1.19')
268
269
270class TestEolianVariable(unittest.TestCase):
271 def test_variable_global(self):
272 var = state.variable_global_get_by_name('Efl.Net.Http.Error.BAD_CONTENT_ENCODING')
273 self.assertIsInstance(var, eolian.Variable)
274 self.assertEqual(var.full_name, 'Efl.Net.Http.Error.BAD_CONTENT_ENCODING')
275 self.assertEqual(var.name, 'BAD_CONTENT_ENCODING')
276 self.assertEqual(var.type, eolian.Eolian_Variable_Type.GLOBAL)
277 self.assertEqual(var.file, 'efl_net_http_types.eot')
278 self.assertFalse(var.is_extern)
279 self.assertEqual(list(var.namespaces), ['Efl','Net','Http','Error'])
280 self.assertIsInstance(var.documentation, eolian.Documentation)
281 self.assertIsInstance(var.base_type, eolian.Type)
282 self.assertIsNone(var.value) # TODO is None correct here? no value?
283
284 def test_variable_constant(self):
285 var = state.variable_constant_get_by_name('Efl.Gfx.Size.Hint.Fill')
286 self.assertIsInstance(var, eolian.Variable)
287 self.assertEqual(var.full_name, 'Efl.Gfx.Size.Hint.Fill')
288 self.assertEqual(var.name, 'Fill')
289 self.assertEqual(var.type, eolian.Eolian_Variable_Type.CONSTANT)
290 self.assertEqual(var.file, 'efl_gfx_size_hint.eo')
291 self.assertFalse(var.is_extern)
292 self.assertEqual(list(var.namespaces), ['Efl','Gfx','Size','Hint'])
293 self.assertIsInstance(var.documentation, eolian.Documentation)
294 self.assertIsInstance(var.base_type, eolian.Type)
295 self.assertIsInstance(var.value, eolian.Expression)
296 self.assertEqual(float(var.value.serialize), +1.0)
297
298
299class TestEolianTypedecl(unittest.TestCase):
300 def test_typedecl_enum(self):
301 td = state.typedecl_enum_get_by_name('Efl.Net.Http.Version')
302 self.assertIsInstance(td, eolian.Typedecl)
303 self.assertEqual(td.name, 'Version')
304 self.assertEqual(td.full_name, 'Efl.Net.Http.Version')
305 self.assertEqual(td.file, 'efl_net_http_types.eot')
306 self.assertEqual(list(td.namespaces), ['Efl','Net','Http'])
307 self.assertIsInstance(td.documentation, eolian.Documentation)
308 self.assertIsNone(td.base_type) # TODO find a better test
309 self.assertIsNone(td.free_func) # TODO find a better test
310 self.assertIsNone(td.function_pointer) # TODO find a better test
311 self.assertFalse(td.is_extern)
312 self.assertEqual(len(list(td.enum_fields)), 3)
313
314 def test_typedecl_enum_field(self):
315 td = state.typedecl_enum_get_by_name('Efl.Net.Http.Version')
316 field = td.enum_field_get('v1_0')
317 self.assertIsInstance(field, eolian.Enum_Type_Field)
318 self.assertEqual(field.name, 'v1_0')
319 self.assertEqual(field.c_name, 'EFL_NET_HTTP_VERSION_V1_0')
320 self.assertIsInstance(field.documentation, eolian.Documentation)
321 self.assertIsInstance(field.value, eolian.Expression)
322
323 def test_typedecl_struct(self):
324 td = state.typedecl_struct_get_by_name('Efl.Gfx.Color32')
325 self.assertIsInstance(td, eolian.Typedecl)
326 self.assertEqual(td.name, 'Color32')
327 self.assertEqual(td.full_name, 'Efl.Gfx.Color32')
328 self.assertEqual(td.file, 'efl_canvas_filter_internal.eo')
329 self.assertEqual(list(td.namespaces), ['Efl','Gfx'])
330 self.assertIsInstance(td.documentation, eolian.Documentation)
331 self.assertIsNone(td.base_type) # TODO find a better test
332 self.assertIsNone(td.free_func) # TODO find a better test
333 self.assertIsNone(td.function_pointer) # TODO find a better test
334 self.assertFalse(td.is_extern)
335 self.assertEqual(len(list(td.struct_fields)), 4)
336
337 def test_typedecl_struct_field(self):
338 td = state.typedecl_struct_get_by_name('Efl.Gfx.Color32')
339 field = td.struct_field_get('b')
340 self.assertIsInstance(field, eolian.Struct_Type_Field)
341 self.assertEqual(field.name, 'b')
342 self.assertIsInstance(field.type, eolian.Type)
343 self.assertIsInstance(field.documentation, eolian.Documentation)
344
345 def test_typedecl_alias(self):
346 alias = state.typedecl_alias_get_by_name('Eina.Error')
347 self.assertIsInstance(alias, eolian.Typedecl)
348 self.assertEqual(alias.name, 'Error')
349
350
351class TestEolianType(unittest.TestCase):
352 def test_type_regular(self):
353 cls = state.class_get_by_name('Efl.Loop.Timer')
354 func = cls.function_get_by_name('delay')
355 param = list(func.parameters)[0]
356 t = param.type
357 self.assertIsInstance(t, eolian.Type)
358 self.assertEqual(t.name, 'double')
359 self.assertEqual(t.full_name, 'double')
360 self.assertEqual(t.type, eolian.Eolian_Type_Type.REGULAR)
361 self.assertEqual(t.builtin_type, eolian.Eolian_Type_Builtin_Type.DOUBLE)
362 self.assertEqual(t.file, 'efl_loop_timer.eo')
363 self.assertIsNone(t.base_type) # TODO find a better test
364 self.assertIsNone(t.next_type) # TODO find a better test
365 self.assertFalse(t.is_owned)
366 self.assertFalse(t.is_const)
367 self.assertFalse(t.is_ptr)
368 # self.assertEqual(list(t.namespaces), []) # TODO find a better test
369 self.assertIsNone(t.free_func) # TODO find a better test
370
371
372class TestEolianDeclaration(unittest.TestCase):
373 def test_declaration(self):
374 d = state.declaration_get_by_name('Eina.File')
375 self.assertIsInstance(d, eolian.Declaration)
376 self.assertEqual(d.name, 'Eina.File')
377 self.assertEqual(d.type, eolian.Eolian_Declaration_Type.STRUCT)
378 # self.assertIsNone(d.class_) # TODO find a better test
379 # self.assertIsNone(d.variable) # TODO find a better test
380 self.assertIsInstance(d.data_type, eolian.Typedecl)
381 self.assertEqual(d.data_type.full_name, 'Eina.File')
382
383
384class TestEolianExpression(unittest.TestCase):
385 def test_expression_simple(self):
386 td = state.typedecl_enum_get_by_name('Efl.Net.Http.Version')
387 field = td.enum_field_get('v1_0')
388 exp = field.value
389 self.assertIsInstance(exp, eolian.Expression)
390 self.assertEqual(exp.type, eolian.Eolian_Expression_Type.INT)
391 self.assertEqual(exp.serialize, '100')
392
393 def test_expression_unary(self):
394 var = state.variable_constant_get_by_name('Efl.Gfx.Size.Hint.Fill')
395 exp = var.value
396 self.assertIsInstance(exp, eolian.Expression)
397 self.assertEqual(exp.type, eolian.Eolian_Expression_Type.UNARY)
398 self.assertEqual(float(exp.serialize), 1.0) # TODO is this a bug? isn't -1.0 ?
399 self.assertEqual(exp.unary_operator, eolian.Eolian_Unary_Operator.UNM)
400 unary = exp.unary_expression
401 self.assertIsInstance(unary, eolian.Expression)
402 self.assertEqual(unary.type, eolian.Eolian_Expression_Type.DOUBLE)
403 self.assertEqual(float(exp.serialize), 1.0)
404
405 # TODO test_expression_binary
406 # exp.binary_operator # TODO find a better test (only works for BINARY expr)
407 # exp.binary_lhs # TODO find a better test (only works for BINARY expr)
408 # exp.binary_rhs # TODO find a better test (only works for BINARY expr)
409
410
411
412if __name__ == '__main__':
413 # create main eolian state
414 state = eolian.Eolian()
415 if not isinstance(state, eolian.Eolian):
416 raise(RuntimeError('Eolian, failed to create Eolian state'))
417
418 # eolian system scan (BROKEN)
419 # if not state.system_directory_scan():
420 # raise(RuntimeError('Eolian, failed to scan system directories'))
421
422 # eolian source tree scan
423 if not state.directory_scan(SCAN_FOLDER):
424 raise(RuntimeError('Eolian, failed to scan source directory'))
425
426 # Parse all known eo files
427 if not state.all_eot_files_parse():
428 raise(RuntimeError('Eolian, failed to parse all EOT files'))
429
430 if not state.all_eo_files_parse():
431 raise(RuntimeError('Eolian, failed to parse all EO files'))
432
433 # start the test suite
434 suite = unittest.main(verbosity=2, exit=False)
435
436 # cleanup (or it will segfault on gc, that happend after atexit)
437 del state
438
439 # exit 0 (success) or 1 (failure)
440 exit(0 if suite.result.wasSuccessful() else 1)