forked from enlightenment/efl
elua: update eolian bindings with c type serialization change
This commit is contained in:
parent
e288f5160b
commit
e38418dd9d
|
@ -84,6 +84,12 @@ ffi.cdef [[
|
||||||
EOLIAN_TYPE_UNDEFINED
|
EOLIAN_TYPE_UNDEFINED
|
||||||
} Eolian_Type_Type;
|
} Eolian_Type_Type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
EOLIAN_C_TYPE_DEFAULT = 0,
|
||||||
|
EOLIAN_C_TYPE_PARAM,
|
||||||
|
EOLIAN_C_TYPE_RETURN
|
||||||
|
} Eolian_C_Type_Type;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EOLIAN_EXPR_UNKNOWN = 0,
|
EOLIAN_EXPR_UNKNOWN = 0,
|
||||||
EOLIAN_EXPR_INT,
|
EOLIAN_EXPR_INT,
|
||||||
|
@ -341,7 +347,7 @@ ffi.cdef [[
|
||||||
|
|
||||||
Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
|
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_typedecl_c_type_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const char *eolian_type_name_get(const Eolian_Type *tp);
|
const char *eolian_type_name_get(const Eolian_Type *tp);
|
||||||
|
@ -512,6 +518,12 @@ M.typedecl_type = {
|
||||||
ALIAS = 4
|
ALIAS = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M.c_type_type = {
|
||||||
|
DEFAULT = 0,
|
||||||
|
PARAM = 1,
|
||||||
|
RETURN = 2
|
||||||
|
}
|
||||||
|
|
||||||
ffi.metatype("Eolian_Struct_Type_Field", {
|
ffi.metatype("Eolian_Struct_Type_Field", {
|
||||||
__index = {
|
__index = {
|
||||||
name_get = function(self)
|
name_get = function(self)
|
||||||
|
@ -713,8 +725,8 @@ M.Type = ffi.metatype("Eolian_Type", {
|
||||||
return eolian.eolian_type_is_ptr(self) ~= 0
|
return eolian.eolian_type_is_ptr(self) ~= 0
|
||||||
end,
|
end,
|
||||||
|
|
||||||
c_type_get = function(self)
|
c_type_get = function(self, ctype)
|
||||||
local v = eolian.eolian_type_c_type_get(self)
|
local v = eolian.eolian_type_c_type_get(self, ctype)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return ffi_stringshare(v)
|
return ffi_stringshare(v)
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -729,7 +729,7 @@ M.Type = Node:clone {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
c_type_get = function(self)
|
c_type_get = function(self)
|
||||||
return self.type:c_type_get()
|
return self.type:c_type_get(eolian.c_type_type.DEFAULT)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
name_get = function(self)
|
name_get = function(self)
|
||||||
|
|
|
@ -94,7 +94,7 @@ end
|
||||||
local typeconv = function(tps, expr, isin)
|
local typeconv = function(tps, expr, isin)
|
||||||
if tps:type_get() == type_type.POINTER then
|
if tps:type_get() == type_type.POINTER then
|
||||||
local base = tps:base_type_get()
|
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
|
if f then return f(expr) end
|
||||||
return build_calln(tps, expr, isin)
|
return build_calln(tps, expr, isin)
|
||||||
end
|
end
|
||||||
|
@ -180,7 +180,7 @@ local Method = Node:clone {
|
||||||
local proto = {
|
local proto = {
|
||||||
name = meth:name_get()
|
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" }, {}, {}
|
local args, cargs, vargs = { "self" }, {}, {}
|
||||||
proto.args, proto.cargs, proto.vargs = args, cargs, vargs
|
proto.args, proto.cargs, proto.vargs = args, cargs, vargs
|
||||||
local rets = {}
|
local rets = {}
|
||||||
|
@ -198,7 +198,7 @@ local Method = Node:clone {
|
||||||
|
|
||||||
for v in pars do
|
for v in pars do
|
||||||
local dir, tps, nm = v:direction_get(), v:type_get(), kw_t(v:name_get())
|
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.OUT or dir == param_dir.INOUT then
|
||||||
if dir == param_dir.INOUT then
|
if dir == param_dir.INOUT then
|
||||||
args[#args + 1] = nm
|
args[#args + 1] = nm
|
||||||
|
@ -275,7 +275,7 @@ local Property = Method:clone {
|
||||||
nkeys = #keys,
|
nkeys = #keys,
|
||||||
nvals = #vals
|
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" }, {}, {}
|
local args, cargs, vargs = { "self" }, {}, {}
|
||||||
proto.args, proto.cargs, proto.vargs = args, cargs, vargs
|
proto.args, proto.cargs, proto.vargs = args, cargs, vargs
|
||||||
local rets = {}
|
local rets = {}
|
||||||
|
@ -290,7 +290,7 @@ local Property = Method:clone {
|
||||||
for i, v in ipairs(keys) do
|
for i, v in ipairs(keys) do
|
||||||
local nm = kw_t(v:name_get())
|
local nm = kw_t(v:name_get())
|
||||||
local tps = v:type_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
|
args [#args + 1] = nm
|
||||||
cargs[#cargs + 1] = tp .. " " .. nm
|
cargs[#cargs + 1] = tp .. " " .. nm
|
||||||
vargs[#vargs + 1] = typeconv(tps, nm, true)
|
vargs[#vargs + 1] = typeconv(tps, nm, true)
|
||||||
|
@ -302,13 +302,13 @@ local Property = Method:clone {
|
||||||
if self.isget then
|
if self.isget then
|
||||||
if #vals == 1 and not rett then
|
if #vals == 1 and not rett then
|
||||||
local tps = vals[1]:type_get()
|
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)
|
rets[#rets + 1] = typeconv(tps, "v", false)
|
||||||
else
|
else
|
||||||
for i, v in ipairs(vals) do
|
for i, v in ipairs(vals) do
|
||||||
local dir, tps, nm = v:direction_get(), v:type_get(),
|
local dir, tps, nm = v:direction_get(), v:type_get(),
|
||||||
kw_t(v:name_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
|
cargs [#cargs + 1] = tp .. " *" .. nm
|
||||||
vargs [#vargs + 1] = nm
|
vargs [#vargs + 1] = nm
|
||||||
allocs[#allocs + 1] = { tp, nm }
|
allocs[#allocs + 1] = { tp, nm }
|
||||||
|
@ -319,7 +319,7 @@ local Property = Method:clone {
|
||||||
for i, v in ipairs(vals) do
|
for i, v in ipairs(vals) do
|
||||||
local dir, tps, nm = v:direction_get(), v:type_get(),
|
local dir, tps, nm = v:direction_get(), v:type_get(),
|
||||||
kw_t(v:name_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
|
args [#args + 1] = nm
|
||||||
cargs[#cargs + 1] = tp .. " " .. nm
|
cargs[#cargs + 1] = tp .. " " .. nm
|
||||||
vargs[#vargs + 1] = typeconv(tps, nm, true)
|
vargs[#vargs + 1] = typeconv(tps, nm, true)
|
||||||
|
|
Loading…
Reference in New Issue