summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2019-09-29 11:29:38 +0200
committerDave Andreoli <dave@gurumeditation.it>2019-09-29 11:29:38 +0200
commit4429b16e36254087f9e6f952677c561f2236d8c0 (patch)
tree68f98c7ee5576e8ba6eca064c305b0704d832420
parentd1e27aacfc9ba004ec8f7ca083154032dbaab4ce (diff)
Pyolian: implemented eolian Error object
-rw-r--r--src/scripts/pyolian/eolian.py20
-rw-r--r--src/scripts/pyolian/eolian_lib.py14
-rwxr-xr-xsrc/scripts/pyolian/generator.py1
3 files changed, 35 insertions, 0 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index fb6963cd4f..2c23fa2c5b 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -1342,6 +1342,24 @@ class Documentation_Token(object):
1342 return self._ref 1342 return self._ref
1343 1343
1344 1344
1345class Error(Object):
1346 def __repr__(self):
1347 return "<eolian.Error '{0.name}', message='{0.message}'>".format(self)
1348
1349 @cached_property
1350 def message(self):
1351 return _str_to_py(lib.eolian_error_message_get(self))
1352
1353 @cached_property
1354 def documentation(self):
1355 c_doc = lib.eolian_error_documentation_get(self)
1356 return Documentation(c_doc) if c_doc else None
1357
1358 @cached_property
1359 def is_extern(self):
1360 return bool(lib.eolian_error_is_extern(self))
1361
1362
1345# internal string encode/decode ############################################# 1363# internal string encode/decode #############################################
1346 1364
1347def _str_to_bytes(s): 1365def _str_to_bytes(s):
@@ -1380,6 +1398,7 @@ class _Eolian_Object_Type(IntEnum):
1380 IMPLEMENT = 12 1398 IMPLEMENT = 12
1381 CONSTRUCTOR = 13 1399 CONSTRUCTOR = 13
1382 DOCUMENTATION = 14 1400 DOCUMENTATION = 14
1401 ERROR = 15
1383 1402
1384 1403
1385_eolian_type_class_mapping = { 1404_eolian_type_class_mapping = {
@@ -1398,6 +1417,7 @@ _eolian_type_class_mapping = {
1398 _Eolian_Object_Type.IMPLEMENT: Implement, 1417 _Eolian_Object_Type.IMPLEMENT: Implement,
1399 _Eolian_Object_Type.CONSTRUCTOR: Constructor, 1418 _Eolian_Object_Type.CONSTRUCTOR: Constructor,
1400 _Eolian_Object_Type.DOCUMENTATION: Documentation, 1419 _Eolian_Object_Type.DOCUMENTATION: Documentation,
1420 _Eolian_Object_Type.ERROR: Error,
1401} 1421}
1402 1422
1403 1423
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index 4ab968eb4d..a92d896972 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -692,3 +692,17 @@ lib.eolian_doc_token_text_get.restype = c_void_p # char* TO BE FREED
692# EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2); 692# EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2);
693# lib.eolian_doc_token_ref_resolve.argtypes = (c_void_p, c_void_p, ???, ???) 693# lib.eolian_doc_token_ref_resolve.argtypes = (c_void_p, c_void_p, ???, ???)
694# lib.eolian_doc_token_ref_resolve.restype = c_int 694# lib.eolian_doc_token_ref_resolve.restype = c_int
695
696
697# Eolian_Error ##############################################################
698# EAPI const char *eolian_error_message_get(const Eolian_Error *err);
699lib.eolian_error_message_get.argtypes = (c_void_p,)
700lib.eolian_error_message_get.restype = c_char_p
701
702# EAPI const Eolian_Documentation *eolian_error_documentation_get(const Eolian_Error *err);
703lib.eolian_error_documentation_get.argtypes = (c_void_p,)
704lib.eolian_error_documentation_get.restype = c_void_p
705
706# EAPI Eina_Bool eolian_error_is_extern(const Eolian_Error *err);
707lib.eolian_error_is_extern.argtypes = (c_void_p,)
708lib.eolian_error_is_extern.restype = c_bool
diff --git a/src/scripts/pyolian/generator.py b/src/scripts/pyolian/generator.py
index 71fb312ad6..0b7e8024e3 100755
--- a/src/scripts/pyolian/generator.py
+++ b/src/scripts/pyolian/generator.py
@@ -132,6 +132,7 @@ class Template(pyratemp.Template):
132 'Constant': eolian.Constant, 132 'Constant': eolian.Constant,
133 'Documentation': eolian.Documentation, 133 'Documentation': eolian.Documentation,
134 'Documentation_Token': eolian.Documentation_Token, 134 'Documentation_Token': eolian.Documentation_Token,
135 'Error': eolian.Error,
135 # Eolian Enums 136 # Eolian Enums
136 'Eolian_Function_Type': eolian.Eolian_Function_Type, 137 'Eolian_Function_Type': eolian.Eolian_Function_Type,
137 'Eolian_Parameter_Direction': eolian.Eolian_Parameter_Direction, 138 'Eolian_Parameter_Direction': eolian.Eolian_Parameter_Direction,