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)
downloadefl-4429b16e36254087f9e6f952677c561f2236d8c0.tar.gz
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):
return self._ref
+class Error(Object):
+ def __repr__(self):
+ return "<eolian.Error '{0.name}', message='{0.message}'>".format(self)
+
+ @cached_property
+ def message(self):
+ return _str_to_py(lib.eolian_error_message_get(self))
+
+ @cached_property
+ def documentation(self):
+ c_doc = lib.eolian_error_documentation_get(self)
+ return Documentation(c_doc) if c_doc else None
+
+ @cached_property
+ def is_extern(self):
+ return bool(lib.eolian_error_is_extern(self))
+
+
# internal string encode/decode #############################################
def _str_to_bytes(s):
@@ -1380,6 +1398,7 @@ class _Eolian_Object_Type(IntEnum):
IMPLEMENT = 12
CONSTRUCTOR = 13
DOCUMENTATION = 14
+ ERROR = 15
_eolian_type_class_mapping = {
@@ -1398,6 +1417,7 @@ _eolian_type_class_mapping = {
_Eolian_Object_Type.IMPLEMENT: Implement,
_Eolian_Object_Type.CONSTRUCTOR: Constructor,
_Eolian_Object_Type.DOCUMENTATION: Documentation,
+ _Eolian_Object_Type.ERROR: Error,
}
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
# 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);
# lib.eolian_doc_token_ref_resolve.argtypes = (c_void_p, c_void_p, ???, ???)
# lib.eolian_doc_token_ref_resolve.restype = c_int
+
+
+# Eolian_Error ##############################################################
+# EAPI const char *eolian_error_message_get(const Eolian_Error *err);
+lib.eolian_error_message_get.argtypes = (c_void_p,)
+lib.eolian_error_message_get.restype = c_char_p
+
+# EAPI const Eolian_Documentation *eolian_error_documentation_get(const Eolian_Error *err);
+lib.eolian_error_documentation_get.argtypes = (c_void_p,)
+lib.eolian_error_documentation_get.restype = c_void_p
+
+# EAPI Eina_Bool eolian_error_is_extern(const Eolian_Error *err);
+lib.eolian_error_is_extern.argtypes = (c_void_p,)
+lib.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):
'Constant': eolian.Constant,
'Documentation': eolian.Documentation,
'Documentation_Token': eolian.Documentation_Token,
+ 'Error': eolian.Error,
# Eolian Enums
'Eolian_Function_Type': eolian.Eolian_Function_Type,
'Eolian_Parameter_Direction': eolian.Eolian_Parameter_Direction,