elua: update eolian bindings with c type serialization change
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 10 Aug 2017 10:17:10 +0000 (12:17 +0200)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Thu, 10 Aug 2017 10:19:59 +0000 (12:19 +0200)
src/bindings/luajit/eolian.lua
src/scripts/elua/apps/docgen/doctree.lua
src/scripts/elua/modules/lualian.lua

index 0563706..d31ead5 100644 (file)
@@ -85,6 +85,12 @@ ffi.cdef [[
     } Eolian_Type_Type;
 
     typedef enum {
+        EOLIAN_C_TYPE_DEFAULT = 0,
+        EOLIAN_C_TYPE_PARAM,
+        EOLIAN_C_TYPE_RETURN
+    } Eolian_C_Type_Type;
+
+    typedef enum {
         EOLIAN_EXPR_UNKNOWN = 0,
         EOLIAN_EXPR_INT,
         EOLIAN_EXPR_UINT,
@@ -341,7 +347,7 @@ ffi.cdef [[
 
     Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
 
-    const char *eolian_type_c_type_get(const Eolian_Type *tp);
+    const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype);
     const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
 
     const char *eolian_type_name_get(const Eolian_Type *tp);
@@ -512,6 +518,12 @@ M.typedecl_type = {
     ALIAS         = 4
 }
 
+M.c_type_type = {
+    DEFAULT = 0,
+    PARAM   = 1,
+    RETURN  = 2
+}
+
 ffi.metatype("Eolian_Struct_Type_Field", {
     __index = {
         name_get = function(self)
@@ -713,8 +725,8 @@ M.Type = ffi.metatype("Eolian_Type", {
             return eolian.eolian_type_is_ptr(self) ~= 0
         end,
 
-        c_type_get = function(self)
-            local v = eolian.eolian_type_c_type_get(self)
+        c_type_get = function(self, ctype)
+            local v = eolian.eolian_type_c_type_get(self, ctype)
             if v == nil then return nil end
             return ffi_stringshare(v)
         end,
index 65f337e..2f77dbc 100644 (file)
@@ -729,7 +729,7 @@ M.Type = Node:clone {
     end,
 
     c_type_get = function(self)
-        return self.type:c_type_get()
+        return self.type:c_type_get(eolian.c_type_type.DEFAULT)
     end,
 
     name_get = function(self)
index cfcb148..fd6072e 100644 (file)
@@ -94,7 +94,7 @@ end
 local typeconv = function(tps, expr, isin)
     if tps:type_get() == type_type.POINTER then
         local base = tps:base_type_get()
-        local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get()]
+        local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(eolian.c_type_type.DEFAULT)]
         if f then return f(expr) end
         return build_calln(tps, expr, isin)
     end
@@ -180,7 +180,7 @@ local Method = Node:clone {
         local proto = {
             name    = meth:name_get()
         }
-        proto.ret_type = rett and rett:c_type_get() or "void"
+        proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void"
         local args, cargs, vargs = { "self" }, {}, {}
         proto.args, proto.cargs, proto.vargs = args, cargs, vargs
         local rets = {}
@@ -198,7 +198,7 @@ local Method = Node:clone {
 
         for v in pars do
             local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get())
-            local tp = tps:c_type_get()
+            local tp = tps:c_type_get(eolian.c_type_type.PARAM)
             if dir == param_dir.OUT or dir == param_dir.INOUT then
                 if dir == param_dir.INOUT then
                     args[#args + 1] = nm
@@ -275,7 +275,7 @@ local Property = Method:clone {
             nkeys   = #keys,
             nvals   = #vals
         }
-        proto.ret_type = rett and rett:c_type_get() or "void"
+        proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void"
         local args, cargs, vargs = { "self" }, {}, {}
         proto.args, proto.cargs, proto.vargs = args, cargs, vargs
         local rets = {}
@@ -290,7 +290,7 @@ local Property = Method:clone {
             for i, v in ipairs(keys) do
                 local nm  = kw_t(v:name_get())
                 local tps = v:type_get()
-                local tp  = tps:c_type_get()
+                local tp  = tps:c_type_get(eolian.c_type_type.PARAM)
                 args [#args  + 1] = nm
                 cargs[#cargs + 1] = tp .. " " .. nm
                 vargs[#vargs + 1] = typeconv(tps, nm, true)
@@ -302,13 +302,13 @@ local Property = Method:clone {
             if self.isget then
                 if #vals == 1 and not rett then
                     local tps = vals[1]:type_get()
-                    proto.ret_type = tps:c_type_get()
+                    proto.ret_type = tps:c_type_get(eolian.c_type_type.PARAM)
                     rets[#rets + 1] = typeconv(tps, "v", false)
                 else
                     for i, v in ipairs(vals) do
                         local dir, tps, nm = v:direction_get(), v:type_get(),
                             kw_t(v:name_get())
-                        local tp = tps:c_type_get()
+                        local tp = tps:c_type_get(eolian.c_type_type.PARAM)
                         cargs [#cargs  + 1] = tp .. " *" .. nm
                         vargs [#vargs  + 1] = nm
                         allocs[#allocs + 1] = { tp, nm }
@@ -319,7 +319,7 @@ local Property = Method:clone {
                 for i, v in ipairs(vals) do
                     local dir, tps, nm = v:direction_get(), v:type_get(),
                         kw_t(v:name_get())
-                    local tp = tps:c_type_get()
+                    local tp = tps:c_type_get(eolian.c_type_type.PARAM)
                     args [#args  + 1] = nm
                     cargs[#cargs + 1] = tp .. " " .. nm
                     vargs[#vargs + 1] = typeconv(tps, nm, true)