summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-07-03 14:27:04 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-07-08 16:06:42 +0200
commit9c249d0467aa4a174dffe2a8292fb66c6c5f4228 (patch)
tree662b34e368090e0ba371bf46afd4923d9edce7fc
parent2a1fa5d2aad8a9ceafc6ddef026b0f42c1518271 (diff)
elua: add error api into eolian bindings
-rw-r--r--src/bindings/luajit/eolian.lua57
1 files changed, 55 insertions, 2 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 07959789ea..e92e587e0a 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -26,6 +26,7 @@ ffi.cdef [[
26 typedef struct _Eolian_Event Eolian_Event; 26 typedef struct _Eolian_Event Eolian_Event;
27 typedef struct _Eolian_Expression Eolian_Expression; 27 typedef struct _Eolian_Expression Eolian_Expression;
28 typedef struct _Eolian_Variable Eolian_Variable; 28 typedef struct _Eolian_Variable Eolian_Variable;
29 typedef struct _Eolian_Error Eolian_Error;
29 typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field; 30 typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field;
30 typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field; 31 typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field;
31 typedef struct _Eolian_Documentation Eolian_Documentation; 32 typedef struct _Eolian_Documentation Eolian_Documentation;
@@ -50,7 +51,8 @@ ffi.cdef [[
50 EOLIAN_OBJECT_PART, 51 EOLIAN_OBJECT_PART,
51 EOLIAN_OBJECT_IMPLEMENT, 52 EOLIAN_OBJECT_IMPLEMENT,
52 EOLIAN_OBJECT_CONSTRUCTOR, 53 EOLIAN_OBJECT_CONSTRUCTOR,
53 EOLIAN_OBJECT_DOCUMENTATION 54 EOLIAN_OBJECT_DOCUMENTATION,
55 EOLIAN_OBJECT_ERROR
54 } Eolian_Object_Type; 56 } Eolian_Object_Type;
55 57
56 typedef enum 58 typedef enum
@@ -331,8 +333,10 @@ ffi.cdef [[
331 Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit); 333 Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit);
332 const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name); 334 const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name);
333 const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); 335 const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name);
336 const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name);
334 Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit); 337 Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit);
335 Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit); 338 Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit);
339 Eina_Iterator *eolian_unit_errors_get(const Eolian_Unit *unit);
336 const Eolian_Typedecl *eolian_unit_alias_by_name_get(const Eolian_Unit *unit, const char *name); 340 const Eolian_Typedecl *eolian_unit_alias_by_name_get(const Eolian_Unit *unit, const char *name);
337 const Eolian_Typedecl *eolian_unit_struct_by_name_get(const Eolian_Unit *unit, const char *name); 341 const Eolian_Typedecl *eolian_unit_struct_by_name_get(const Eolian_Unit *unit, const char *name);
338 const Eolian_Typedecl *eolian_unit_enum_by_name_get(const Eolian_Unit *unit, const char *name); 342 const Eolian_Typedecl *eolian_unit_enum_by_name_get(const Eolian_Unit *unit, const char *name);
@@ -343,6 +347,7 @@ ffi.cdef [[
343 const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name); 347 const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name);
344 Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name); 348 Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name);
345 Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name); 349 Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name);
350 Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name);
346 Eina_Iterator *eolian_state_aliases_by_file_get(const Eolian_State *state, const char *file_name); 351 Eina_Iterator *eolian_state_aliases_by_file_get(const Eolian_State *state, const char *file_name);
347 Eina_Iterator *eolian_state_structs_by_file_get(const Eolian_State *state, const char *file_name); 352 Eina_Iterator *eolian_state_structs_by_file_get(const Eolian_State *state, const char *file_name);
348 Eina_Iterator *eolian_state_enums_by_file_get(const Eolian_State *state, const char *file_name); 353 Eina_Iterator *eolian_state_enums_by_file_get(const Eolian_State *state, const char *file_name);
@@ -435,6 +440,7 @@ ffi.cdef [[
435 const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp); 440 const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
436 441
437 const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp); 442 const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
443 const Eolian_Error *eolian_type_error_get(const Eolian_Type *tp);
438 Eina_Bool eolian_type_is_owned(const Eolian_Type *tp); 444 Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
439 Eina_Bool eolian_type_is_const(const Eolian_Type *tp); 445 Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
440 Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp); 446 Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
@@ -474,6 +480,10 @@ ffi.cdef [[
474 Eolian_Doc_Token_Type eolian_doc_token_type_get(const Eolian_Doc_Token *tok); 480 Eolian_Doc_Token_Type eolian_doc_token_type_get(const Eolian_Doc_Token *tok);
475 char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok); 481 char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok);
476 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); 482 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);
483
484 const char *eolian_error_message_get(const Eolian_Error *err);
485 const Eolian_Documentation *eolian_error_documentation_get(const Eolian_Error *err);
486 Eina_Bool eolian_error_is_extern(const Eolian_Error *err);
477]] 487]]
478 488
479local cutil = require("cutil") 489local cutil = require("cutil")
@@ -524,7 +534,8 @@ M.object_type = {
524 PART = 11, 534 PART = 11,
525 IMPLEMENT = 12, 535 IMPLEMENT = 12,
526 CONSTRUCTOR = 13, 536 CONSTRUCTOR = 13,
527 DOCUMENTATION = 14 537 DOCUMENTATION = 14,
538 ERROR = 15
528} 539}
529 540
530M.object_scope = { 541M.object_scope = {
@@ -679,6 +690,12 @@ local unit_idx, wrap_unit = gen_wrap {
679 return v 690 return v
680 end, 691 end,
681 692
693 error_by_name_get = function(self, name)
694 local v = eolian.eolian_unit_error_by_name_get(cast_unit(self), name)
695 if v == nil then return nil end
696 return v
697 end,
698
682 constants_get = function(self) 699 constants_get = function(self)
683 return Ptr_Iterator("const Eolian_Variable *", 700 return Ptr_Iterator("const Eolian_Variable *",
684 eolian.eolian_unit_constants_get(cast_unit(self))) 701 eolian.eolian_unit_constants_get(cast_unit(self)))
@@ -689,6 +706,11 @@ local unit_idx, wrap_unit = gen_wrap {
689 eolian.eolian_unit_globals_get(cast_unit(self))) 706 eolian.eolian_unit_globals_get(cast_unit(self)))
690 end, 707 end,
691 708
709 errors_get = function(self)
710 return Ptr_Iterator("const Eolian_Error *",
711 eolian.eolian_unit_errors_get(cast_unit(self)))
712 end,
713
692 alias_by_name_get = function(self, name) 714 alias_by_name_get = function(self, name)
693 local v = eolian.eolian_unit_alias_by_name_get(cast_unit(self), name) 715 local v = eolian.eolian_unit_alias_by_name_get(cast_unit(self), name)
694 if v == nil then return nil end 716 if v == nil then return nil end
@@ -852,6 +874,11 @@ ffi.metatype("Eolian_State", {
852 eolian.eolian_state_constants_by_file_get(self, fname)) 874 eolian.eolian_state_constants_by_file_get(self, fname))
853 end, 875 end,
854 876
877 errors_by_file_get = function(unit, fname)
878 return Ptr_Iterator("const Eolian_Error*",
879 eolian.eolian_state_errors_by_file_get(self, fname))
880 end,
881
855 aliases_by_file_get = function(self, fname) 882 aliases_by_file_get = function(self, fname)
856 return Ptr_Iterator("const Eolian_Typedecl *", 883 return Ptr_Iterator("const Eolian_Typedecl *",
857 eolian.eolian_state_aliases_by_file_get(self, fname)) 884 eolian.eolian_state_aliases_by_file_get(self, fname))
@@ -1119,6 +1146,12 @@ M.Type = ffi.metatype("Eolian_Type", {
1119 return v 1146 return v
1120 end, 1147 end,
1121 1148
1149 error_get = function(self)
1150 local v = eolian.eolian_type_error_get(self)
1151 if v == nil then return nil end
1152 return v
1153 end,
1154
1122 is_owned = function(self) 1155 is_owned = function(self)
1123 return eolian.eolian_type_is_owned(self) ~= 0 1156 return eolian.eolian_type_is_owned(self) ~= 0
1124 end, 1157 end,
@@ -1736,6 +1769,26 @@ M.Variable = ffi.metatype("Eolian_Variable", {
1736 } 1769 }
1737}) 1770})
1738 1771
1772M.Error = ffi.metatype("Eolian_Error", {
1773 __index = wrap_object {
1774 documentation_get = function(self)
1775 local v = eolian.eolian_error_documentation_get(self)
1776 if v == nil then return nil end
1777 return v
1778 end,
1779
1780 message_get = function(self)
1781 local v = eolian.eolian_error_message_get(self)
1782 if v == nil then return nil end
1783 return ffi.string(v)
1784 end,
1785
1786 is_extern = function(self)
1787 return eolian.eolian_error_is_extern(self) ~= 0
1788 end
1789 }
1790})
1791
1739M.Documentation = ffi.metatype("Eolian_Documentation", { 1792M.Documentation = ffi.metatype("Eolian_Documentation", {
1740 __index = wrap_object { 1793 __index = wrap_object {
1741 summary_get = function(self) 1794 summary_get = function(self)