q66 pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8b5d555cf58f0d65a3d13ba94f61121a846eda8a
commit 8b5d555cf58f0d65a3d13ba94f61121a846eda8a Author: Daniel Kolesa <d.kol...@osg.samsung.com> Date: Wed Aug 30 19:38:53 2017 +0200 elua: update eolian bindings and make docgen work again --- src/bindings/luajit/eolian.lua | 51 ++++++++++++++++++++++++-------- src/scripts/elua/apps/docgen/doctree.lua | 26 ++++++++++++++++ src/scripts/elua/apps/gendoc.lua | 3 ++ 3 files changed, 68 insertions(+), 12 deletions(-) diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 660667bec6..d86e8e8396 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -36,7 +36,8 @@ ffi.cdef [[ EOLIAN_PROPERTY, EOLIAN_PROP_SET, EOLIAN_PROP_GET, - EOLIAN_METHOD + EOLIAN_METHOD, + EOLIAN_FUNCTION_POINTER } Eolian_Function_Type; typedef enum @@ -69,7 +70,8 @@ ffi.cdef [[ EOLIAN_TYPEDECL_STRUCT, EOLIAN_TYPEDECL_STRUCT_OPAQUE, EOLIAN_TYPEDECL_ENUM, - EOLIAN_TYPEDECL_ALIAS + EOLIAN_TYPEDECL_ALIAS, + EOLIAN_TYPEDECL_FUNCTION_POINTER } Eolian_Typedecl_Type; typedef enum @@ -259,6 +261,9 @@ ffi.cdef [[ const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id); Eina_Bool eolian_function_is_legacy_only(const Eolian_Function *function_id, Eolian_Function_Type ftype); Eina_Bool eolian_function_is_class(const Eolian_Function *function_id); + Eina_Bool eolian_function_is_beta(const Eolian_Function *function_id); + Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass); + Eina_Bool eolian_function_is_function_pointer(const Eolian_Function *function_id); Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); Eina_Iterator *eolian_property_values_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); Eina_Iterator *eolian_function_parameters_get(const Eolian_Function *function_id); @@ -361,6 +366,8 @@ ffi.cdef [[ const char *eolian_type_free_func_get(const Eolian_Type *tp); const char *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp); + const Eolian_Function *eolian_typedecl_function_pointer_get(const Eolian_Typedecl *tp); + Eolian_Value_t eolian_expression_eval(const Eolian_Unit *unit, const Eolian_Expression *expr, Eolian_Expression_Mask m); Eolian_Value_t eolian_expression_eval_type(const Eolian_Unit *unit, const Eolian_Expression *expr, const Eolian_Type *type); const char *eolian_expression_value_to_literal(const Eolian_Value *v); @@ -510,11 +517,12 @@ M.type_type = { } M.typedecl_type = { - UNKNOWN = 0, - STRUCT = 1, - STRUCT_OPAQUE = 2, - ENUM = 3, - ALIAS = 4 + UNKNOWN = 0, + STRUCT = 1, + STRUCT_OPAQUE = 2, + ENUM = 3, + ALIAS = 4, + FUNCTION_POINTER = 5 } M.c_type_type = { @@ -662,6 +670,12 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", { local v = eolian.eolian_typedecl_free_func_get(self) if v == nil then return nil end return ffi.string(v) + end, + + function_pointer_get = function(self) + local v = eolian.eolian_typedecl_function_pointer_get(self) + if v == nil then return nil end + return v end } }) @@ -756,11 +770,12 @@ M.Type = ffi.metatype("Eolian_Type", { }) M.function_type = { - UNRESOLVED = 0, - PROPERTY = 1, - PROP_SET = 2, - PROP_GET = 3, - METHOD = 4 + UNRESOLVED = 0, + PROPERTY = 1, + PROP_SET = 2, + PROP_GET = 3, + METHOD = 4, + FUNCTION_POINTER = 5 } M.Function = ffi.metatype("Eolian_Function", { @@ -805,6 +820,18 @@ M.Function = ffi.metatype("Eolian_Function", { return eolian.eolian_function_is_class(self) ~= 0 end, + is_beta = function(self) + return eolian.eolian_function_is_beta(self) ~= 0 + end, + + is_constructor = function(self, klass) + return eolian.eolian_function_is_constructor(self, klass) ~= 0 + end, + + is_function_pointer = function(self) + return eolian.eolian_function_is_function_pointer(self) ~= 0 + end, + property_keys_get = function(self, ftype) return Ptr_Iterator("const Eolian_Function_Parameter*", eolian.eolian_property_keys_get(self, ftype)) diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua index 9130f3ca46..008e705d1a 100644 --- a/src/scripts/elua/apps/docgen/doctree.lua +++ b/src/scripts/elua/apps/docgen/doctree.lua @@ -349,6 +349,7 @@ M.Function = Node:clone { PROP_SET = eolian.function_type.PROP_SET, PROP_GET = eolian.function_type.PROP_GET, METHOD = eolian.function_type.METHOD, + FUNCTION_POINTER = eolian.function_type.FUNCTION_POINTER, __ctor = function(self, fn) self.func = fn @@ -391,6 +392,18 @@ M.Function = Node:clone { return self.func:is_class() end, + is_beta = function(self) + return self.func:is_beta() + end, + + is_constructor = function(self, klass) + return self.func:is_constructor(klass.class) + end, + + is_function_pointer = function(self) + return self.func:is_function_pointer() + end, + property_keys_get = function(self, ft) local ret = {} for par in self.func:property_keys_get(ft) do @@ -808,6 +821,7 @@ M.Typedecl = Node:clone { STRUCT_OPAQUE = eolian.typedecl_type.STRUCT_OPAQUE, ENUM = eolian.typedecl_type.ENUM, ALIAS = eolian.typedecl_type.ALIAS, + FUNCTION_POINTER = eolian.typedecl_type.FUNCTION_POINTER, __ctor = function(self, tp) self.typedecl = tp @@ -913,6 +927,14 @@ M.Typedecl = Node:clone { return self.typedecl:free_func_get() end, + function_pointer_get = function(self) + local v = self.typedecl:function_pointer_get() + if not v then + return nil + end + return M.Function(v) + end, + nspaces_get = function(self, root) return M.Node.nspaces_get(self, self:type_str_get(), root) end, @@ -1064,6 +1086,8 @@ M.Typedecl = Node:clone { buf[#buf + 1] = self:base_type_get():serialize() buf[#buf + 1] = ";" return table.concat(buf) + elseif tpt == self.FUNCTION_POINTER then + return "TODO" end error("unhandled typedecl type: " .. tpt) end, @@ -1134,6 +1158,8 @@ M.Typedecl = Node:clone { keyref.add(fulln, ns, "c") return "typedef " .. M.type_cstr_get(self:base_type_get(), fulln) .. ";" + elseif tpt == self.FUNCTION_POINTER then + return "TODO" end error("unhandled typedecl type: " .. tpt) end diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua index 77e9df0757..3ecf3dd061 100644 --- a/src/scripts/elua/apps/gendoc.lua +++ b/src/scripts/elua/apps/gendoc.lua @@ -100,6 +100,9 @@ local gen_func_namesig = function(fn, cl, buf, isprop, isget, isset) end buf[#buf + 1] = fn:name_get() buf[#buf + 1] = " " + if fn:is_beta() then + buf[#buf + 1] = "@beta " + end if not isprop then if fn:scope_get(fn.METHOD) == fn.scope.PROTECTED then buf[#buf + 1] = "@protected " --