summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-08-10 12:17:10 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-08-10 12:19:59 +0200
commite38418dd9ddd39b8585305859f07d09683c907cf (patch)
tree3dcf1868319a26e01c99a8acd00ec18f80850979
parente288f5160b2817e8e1713f58f35b0b0445107f90 (diff)
elua: update eolian bindings with c type serialization change
-rw-r--r--src/bindings/luajit/eolian.lua18
-rw-r--r--src/scripts/elua/apps/docgen/doctree.lua2
-rw-r--r--src/scripts/elua/modules/lualian.lua16
3 files changed, 24 insertions, 12 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 056370695d..d31ead5c45 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -85,6 +85,12 @@ ffi.cdef [[
85 } Eolian_Type_Type; 85 } Eolian_Type_Type;
86 86
87 typedef enum { 87 typedef enum {
88 EOLIAN_C_TYPE_DEFAULT = 0,
89 EOLIAN_C_TYPE_PARAM,
90 EOLIAN_C_TYPE_RETURN
91 } Eolian_C_Type_Type;
92
93 typedef enum {
88 EOLIAN_EXPR_UNKNOWN = 0, 94 EOLIAN_EXPR_UNKNOWN = 0,
89 EOLIAN_EXPR_INT, 95 EOLIAN_EXPR_INT,
90 EOLIAN_EXPR_UINT, 96 EOLIAN_EXPR_UINT,
@@ -341,7 +347,7 @@ ffi.cdef [[
341 347
342 Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); 348 Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
343 349
344 const char *eolian_type_c_type_get(const Eolian_Type *tp); 350 const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype);
345 const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp); 351 const char *eolian_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
346 352
347 const char *eolian_type_name_get(const Eolian_Type *tp); 353 const char *eolian_type_name_get(const Eolian_Type *tp);
@@ -512,6 +518,12 @@ M.typedecl_type = {
512 ALIAS = 4 518 ALIAS = 4
513} 519}
514 520
521M.c_type_type = {
522 DEFAULT = 0,
523 PARAM = 1,
524 RETURN = 2
525}
526
515ffi.metatype("Eolian_Struct_Type_Field", { 527ffi.metatype("Eolian_Struct_Type_Field", {
516 __index = { 528 __index = {
517 name_get = function(self) 529 name_get = function(self)
@@ -713,8 +725,8 @@ M.Type = ffi.metatype("Eolian_Type", {
713 return eolian.eolian_type_is_ptr(self) ~= 0 725 return eolian.eolian_type_is_ptr(self) ~= 0
714 end, 726 end,
715 727
716 c_type_get = function(self) 728 c_type_get = function(self, ctype)
717 local v = eolian.eolian_type_c_type_get(self) 729 local v = eolian.eolian_type_c_type_get(self, ctype)
718 if v == nil then return nil end 730 if v == nil then return nil end
719 return ffi_stringshare(v) 731 return ffi_stringshare(v)
720 end, 732 end,
diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua
index 65f337e890..2f77dbcc55 100644
--- a/src/scripts/elua/apps/docgen/doctree.lua
+++ b/src/scripts/elua/apps/docgen/doctree.lua
@@ -729,7 +729,7 @@ M.Type = Node:clone {
729 end, 729 end,
730 730
731 c_type_get = function(self) 731 c_type_get = function(self)
732 return self.type:c_type_get() 732 return self.type:c_type_get(eolian.c_type_type.DEFAULT)
733 end, 733 end,
734 734
735 name_get = function(self) 735 name_get = function(self)
diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua
index cfcb1484d9..fd6072e4d4 100644
--- a/src/scripts/elua/modules/lualian.lua
+++ b/src/scripts/elua/modules/lualian.lua
@@ -94,7 +94,7 @@ end
94local typeconv = function(tps, expr, isin) 94local typeconv = function(tps, expr, isin)
95 if tps:type_get() == type_type.POINTER then 95 if tps:type_get() == type_type.POINTER then
96 local base = tps:base_type_get() 96 local base = tps:base_type_get()
97 local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get()] 97 local f = (isin and known_ptr_in or known_ptr_out)[base:c_type_get(eolian.c_type_type.DEFAULT)]
98 if f then return f(expr) end 98 if f then return f(expr) end
99 return build_calln(tps, expr, isin) 99 return build_calln(tps, expr, isin)
100 end 100 end
@@ -180,7 +180,7 @@ local Method = Node:clone {
180 local proto = { 180 local proto = {
181 name = meth:name_get() 181 name = meth:name_get()
182 } 182 }
183 proto.ret_type = rett and rett:c_type_get() or "void" 183 proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void"
184 local args, cargs, vargs = { "self" }, {}, {} 184 local args, cargs, vargs = { "self" }, {}, {}
185 proto.args, proto.cargs, proto.vargs = args, cargs, vargs 185 proto.args, proto.cargs, proto.vargs = args, cargs, vargs
186 local rets = {} 186 local rets = {}
@@ -198,7 +198,7 @@ local Method = Node:clone {
198 198
199 for v in pars do 199 for v in pars do
200 local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get()) 200 local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get())
201 local tp = tps:c_type_get() 201 local tp = tps:c_type_get(eolian.c_type_type.PARAM)
202 if dir == param_dir.OUT or dir == param_dir.INOUT then 202 if dir == param_dir.OUT or dir == param_dir.INOUT then
203 if dir == param_dir.INOUT then 203 if dir == param_dir.INOUT then
204 args[#args + 1] = nm 204 args[#args + 1] = nm
@@ -275,7 +275,7 @@ local Property = Method:clone {
275 nkeys = #keys, 275 nkeys = #keys,
276 nvals = #vals 276 nvals = #vals
277 } 277 }
278 proto.ret_type = rett and rett:c_type_get() or "void" 278 proto.ret_type = rett and rett:c_type_get(eolian.c_type_type.RETURN) or "void"
279 local args, cargs, vargs = { "self" }, {}, {} 279 local args, cargs, vargs = { "self" }, {}, {}
280 proto.args, proto.cargs, proto.vargs = args, cargs, vargs 280 proto.args, proto.cargs, proto.vargs = args, cargs, vargs
281 local rets = {} 281 local rets = {}
@@ -290,7 +290,7 @@ local Property = Method:clone {
290 for i, v in ipairs(keys) do 290 for i, v in ipairs(keys) do
291 local nm = kw_t(v:name_get()) 291 local nm = kw_t(v:name_get())
292 local tps = v:type_get() 292 local tps = v:type_get()
293 local tp = tps:c_type_get() 293 local tp = tps:c_type_get(eolian.c_type_type.PARAM)
294 args [#args + 1] = nm 294 args [#args + 1] = nm
295 cargs[#cargs + 1] = tp .. " " .. nm 295 cargs[#cargs + 1] = tp .. " " .. nm
296 vargs[#vargs + 1] = typeconv(tps, nm, true) 296 vargs[#vargs + 1] = typeconv(tps, nm, true)
@@ -302,13 +302,13 @@ local Property = Method:clone {
302 if self.isget then 302 if self.isget then
303 if #vals == 1 and not rett then 303 if #vals == 1 and not rett then
304 local tps = vals[1]:type_get() 304 local tps = vals[1]:type_get()
305 proto.ret_type = tps:c_type_get() 305 proto.ret_type = tps:c_type_get(eolian.c_type_type.PARAM)
306 rets[#rets + 1] = typeconv(tps, "v", false) 306 rets[#rets + 1] = typeconv(tps, "v", false)
307 else 307 else
308 for i, v in ipairs(vals) do 308 for i, v in ipairs(vals) do
309 local dir, tps, nm = v:direction_get(), v:type_get(), 309 local dir, tps, nm = v:direction_get(), v:type_get(),
310 kw_t(v:name_get()) 310 kw_t(v:name_get())
311 local tp = tps:c_type_get() 311 local tp = tps:c_type_get(eolian.c_type_type.PARAM)
312 cargs [#cargs + 1] = tp .. " *" .. nm 312 cargs [#cargs + 1] = tp .. " *" .. nm
313 vargs [#vargs + 1] = nm 313 vargs [#vargs + 1] = nm
314 allocs[#allocs + 1] = { tp, nm } 314 allocs[#allocs + 1] = { tp, nm }
@@ -319,7 +319,7 @@ local Property = Method:clone {
319 for i, v in ipairs(vals) do 319 for i, v in ipairs(vals) do
320 local dir, tps, nm = v:direction_get(), v:type_get(), 320 local dir, tps, nm = v:direction_get(), v:type_get(),
321 kw_t(v:name_get()) 321 kw_t(v:name_get())
322 local tp = tps:c_type_get() 322 local tp = tps:c_type_get(eolian.c_type_type.PARAM)
323 args [#args + 1] = nm 323 args [#args + 1] = nm
324 cargs[#cargs + 1] = tp .. " " .. nm 324 cargs[#cargs + 1] = tp .. " " .. nm
325 vargs[#vargs + 1] = typeconv(tps, nm, true) 325 vargs[#vargs + 1] = typeconv(tps, nm, true)