forked from enlightenment/efl
elua: update lualian against latest eolian API
This commit is contained in:
parent
6896f2949e
commit
6614d02a69
|
@ -351,7 +351,7 @@ local Event = Node:clone {
|
||||||
local ffin = self.cached_ffi_name
|
local ffin = self.cached_ffi_name
|
||||||
if ffin then return ffin end
|
if ffin then return ffin end
|
||||||
ffin = table.concat {
|
ffin = table.concat {
|
||||||
"_", self.parent_node.cname:upper(), "_EVENT_",
|
"_", self.parent_node.klass:name_get():upper(), "_EVENT_",
|
||||||
self.ename:gsub("%W", "_"):upper()
|
self.ename:gsub("%W", "_"):upper()
|
||||||
}
|
}
|
||||||
self.cached_ffi_name = ffin
|
self.cached_ffi_name = ffin
|
||||||
|
@ -418,23 +418,24 @@ local Default_Constructor = Node:clone {
|
||||||
}
|
}
|
||||||
|
|
||||||
local Mixin = Node:clone {
|
local Mixin = Node:clone {
|
||||||
__ctor = function(self, cname, ch, evs)
|
__ctor = function(self, klass, ch, evs)
|
||||||
self.cname = cname
|
self.klass = klass
|
||||||
self.prefix = eolian.class_eo_prefix_get(cname)
|
self.prefix = klass:eo_prefix_get()
|
||||||
self.children = ch
|
self.children = ch
|
||||||
self.events = evs
|
self.events = evs
|
||||||
end,
|
end,
|
||||||
|
|
||||||
generate = function(self, s)
|
generate = function(self, s)
|
||||||
dom:log(log.level.INFO, " Generating for interface/mixin: "
|
dom:log(log.level.INFO, " Generating for interface/mixin: "
|
||||||
.. self.cname)
|
.. self.klass:full_name_get())
|
||||||
|
|
||||||
s:write("ffi.cdef [[\n")
|
s:write("ffi.cdef [[\n")
|
||||||
self:gen_ffi(s)
|
self:gen_ffi(s)
|
||||||
s:write("]]\n\n")
|
s:write("]]\n\n")
|
||||||
|
|
||||||
s:write(("M.%s = eo.class_register(\"%s\", {\n"):format(
|
s:write(("M.%s = eo.class_register(\"%s\", {\n"):format(
|
||||||
strip_name(self, self.cname, self.parent_node.cprefix), self.cname))
|
strip_name(self, self.klass:name_get(),
|
||||||
|
self.parent_node.cprefix), self.klass:name_get()))
|
||||||
|
|
||||||
self:gen_children(s)
|
self:gen_children(s)
|
||||||
|
|
||||||
|
@ -464,30 +465,31 @@ local Mixin = Node:clone {
|
||||||
}
|
}
|
||||||
|
|
||||||
local Class = Node:clone {
|
local Class = Node:clone {
|
||||||
__ctor = function(self, cname, parent, mixins, ch, evs)
|
__ctor = function(self, klass, parent, mixins, ch, evs)
|
||||||
self.cname = cname
|
self.klass = klass
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.interfaces = interfaces
|
self.interfaces = interfaces
|
||||||
self.mixins = mixins
|
self.mixins = mixins
|
||||||
self.prefix = eolian.class_eo_prefix_get(cname)
|
self.prefix = klass:eo_prefix_get()
|
||||||
self.children = ch
|
self.children = ch
|
||||||
self.events = evs
|
self.events = evs
|
||||||
end,
|
end,
|
||||||
|
|
||||||
generate = function(self, s)
|
generate = function(self, s)
|
||||||
dom:log(log.level.INFO, " Generating for class: " .. self.cname)
|
dom:log(log.level.INFO, " Generating for class: "
|
||||||
|
.. self.klass:full_name_get())
|
||||||
|
|
||||||
s:write("ffi.cdef [[\n")
|
s:write("ffi.cdef [[\n")
|
||||||
self:gen_ffi(s)
|
self:gen_ffi(s)
|
||||||
s:write("]]\n\n")
|
s:write("]]\n\n")
|
||||||
|
|
||||||
local name_stripped = strip_name(self, self.cname,
|
local name_stripped = strip_name(self, self.klass:name_get(),
|
||||||
self.parent_node.cprefix)
|
self.parent_node.cprefix)
|
||||||
|
|
||||||
s:write(([[
|
s:write(([[
|
||||||
local Parent = eo.class_get("%s")
|
local Parent = eo.class_get("%s")
|
||||||
M.%s = eo.class_register("%s", Parent:clone {
|
M.%s = eo.class_register("%s", Parent:clone {
|
||||||
]]):format(self.parent, name_stripped, self.cname))
|
]]):format(self.parent, name_stripped, self.klass:name_get()))
|
||||||
|
|
||||||
self:gen_children(s)
|
self:gen_children(s)
|
||||||
|
|
||||||
|
@ -504,9 +506,9 @@ M.%s = eo.class_register("%s", Parent:clone {
|
||||||
}
|
}
|
||||||
|
|
||||||
local File = Node:clone {
|
local File = Node:clone {
|
||||||
__ctor = function(self, fname, cname, modname, libname, cprefix, ch)
|
__ctor = function(self, fname, klass, modname, libname, cprefix, ch)
|
||||||
self.fname = fname:match(".+/(.+)") or fname
|
self.fname = fname:match(".+/(.+)") or fname
|
||||||
self.cname = cname
|
self.klass = klass
|
||||||
self.modname = (modname and #modname > 0) and modname or nil
|
self.modname = (modname and #modname > 0) and modname or nil
|
||||||
self.libname = libname
|
self.libname = libname
|
||||||
self.cprefix = cprefix
|
self.cprefix = cprefix
|
||||||
|
@ -515,7 +517,8 @@ local File = Node:clone {
|
||||||
|
|
||||||
generate = function(self, s)
|
generate = function(self, s)
|
||||||
dom:log(log.level.INFO, "Generating for file: " .. self.fname)
|
dom:log(log.level.INFO, "Generating for file: " .. self.fname)
|
||||||
dom:log(log.level.INFO, " Class : " .. self.cname)
|
dom:log(log.level.INFO, " Class : "
|
||||||
|
.. self.klass:full_name_get())
|
||||||
|
|
||||||
local modn = self.modname
|
local modn = self.modname
|
||||||
if modn then
|
if modn then
|
||||||
|
@ -546,7 +549,8 @@ end
|
||||||
|
|
||||||
cutil.init_module(init, shutdown)
|
cutil.init_module(init, shutdown)
|
||||||
|
|
||||||
]]):format(self.fname, self.cname, modn, self.libname, self.libname))
|
]]):format(self.fname, self.klass:name_get(), modn, self.libname,
|
||||||
|
self.libname))
|
||||||
|
|
||||||
self:gen_children(s)
|
self:gen_children(s)
|
||||||
|
|
||||||
|
@ -566,11 +570,11 @@ return M
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
local gen_contents = function(classn)
|
local gen_contents = function(klass)
|
||||||
local cnt = {}
|
local cnt = {}
|
||||||
local ft = eolian.function_type
|
local ft = eolian.function_type
|
||||||
-- first try properties
|
-- first try properties
|
||||||
local props = eolian.class_functions_list_get(classn, ft.PROPERTY)
|
local props = klass:functions_list_get(ft.PROPERTY)
|
||||||
for i, v in ipairs(props) do
|
for i, v in ipairs(props) do
|
||||||
if v:scope_get() == eolian.function_scope.PUBLIC then
|
if v:scope_get() == eolian.function_scope.PUBLIC then
|
||||||
local ftype = v:type_get()
|
local ftype = v:type_get()
|
||||||
|
@ -585,14 +589,14 @@ local gen_contents = function(classn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- then methods
|
-- then methods
|
||||||
local meths = eolian.class_functions_list_get(classn, ft.METHOD)
|
local meths = klass:functions_list_get(ft.METHOD)
|
||||||
for i, v in ipairs(meths) do
|
for i, v in ipairs(meths) do
|
||||||
if v:scope_get() == eolian.function_scope.PUBLIC then
|
if v:scope_get() == eolian.function_scope.PUBLIC then
|
||||||
cnt[#cnt + 1] = Method(v)
|
cnt[#cnt + 1] = Method(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- and constructors
|
-- and constructors
|
||||||
local ctors = eolian.class_functions_list_get(classn, ft.CTOR)
|
local ctors = klass:functions_list_get(ft.CTOR)
|
||||||
for i, v in ipairs(ctors) do
|
for i, v in ipairs(ctors) do
|
||||||
cnt[#cnt + 1] = Constructor(v)
|
cnt[#cnt + 1] = Constructor(v)
|
||||||
end
|
end
|
||||||
|
@ -601,7 +605,7 @@ local gen_contents = function(classn)
|
||||||
end
|
end
|
||||||
-- events
|
-- events
|
||||||
local evs = {}
|
local evs = {}
|
||||||
local events = eolian.class_events_list_get(classn)
|
local events = klass:events_list_get()
|
||||||
for i, v in ipairs(events) do
|
for i, v in ipairs(events) do
|
||||||
local en, et, ed = v:information_get()
|
local en, et, ed = v:information_get()
|
||||||
evs[#evs + 1] = Event(en, et, ed)
|
evs[#evs + 1] = Event(en, et, ed)
|
||||||
|
@ -609,29 +613,29 @@ local gen_contents = function(classn)
|
||||||
return cnt, evs
|
return cnt, evs
|
||||||
end
|
end
|
||||||
|
|
||||||
local gen_mixin = function(classn)
|
local gen_mixin = function(klass)
|
||||||
return Mixin(classn, gen_contents(classn))
|
return Mixin(klass, gen_contents(klass))
|
||||||
end
|
end
|
||||||
|
|
||||||
local gen_class = function(classn)
|
local gen_class = function(klass)
|
||||||
local inherits = eolian.class_inherits_list_get(classn)
|
local inherits = klass:inherits_list_get()
|
||||||
local parent
|
local parent
|
||||||
local mixins = {}
|
local mixins = {}
|
||||||
local ct = eolian.class_type
|
local ct = eolian.class_type
|
||||||
for i, v in ipairs(inherits) do
|
for i, v in ipairs(inherits) do
|
||||||
local tp = eolian.class_type_get(v)
|
local tp = eolian.class_find_by_name(v):type_get()
|
||||||
if tp == ct.REGULAR or tp == ct.ABSTRACT then
|
if tp == ct.REGULAR or tp == ct.ABSTRACT then
|
||||||
if parent then
|
if parent then
|
||||||
error(classn .. ": more than 1 parent!")
|
error(klass:full_name_get() .. ": more than 1 parent!")
|
||||||
end
|
end
|
||||||
parent = v
|
parent = v
|
||||||
elseif tp == ct.MIXIN or tp == ct.INTERFACE then
|
elseif tp == ct.MIXIN or tp == ct.INTERFACE then
|
||||||
mixins[#mixins + 1] = v
|
mixins[#mixins + 1] = v
|
||||||
else
|
else
|
||||||
error(classn .. ": unknown inherit " .. v)
|
error(klass:full_name_get() .. ": unknown inherit " .. v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return Class(classn, parent, mixins, gen_contents(classn))
|
return Class(klass, parent, mixins, gen_contents(klass))
|
||||||
end
|
end
|
||||||
|
|
||||||
M.include_dir = function(dir)
|
M.include_dir = function(dir)
|
||||||
|
@ -644,18 +648,18 @@ M.generate = function(fname, modname, libname, cprefix, fstream)
|
||||||
if not eolian.eo_file_parse(fname) then
|
if not eolian.eo_file_parse(fname) then
|
||||||
error("Failed parsing file: " .. fname)
|
error("Failed parsing file: " .. fname)
|
||||||
end
|
end
|
||||||
local classn = eolian.class_find_by_file(fname)
|
local klass = eolian.class_find_by_file(fname)
|
||||||
local tp = eolian.class_type_get(classn)
|
local tp = klass:type_get()
|
||||||
local ct = eolian.class_type
|
local ct = eolian.class_type
|
||||||
local cl
|
local cl
|
||||||
if tp == ct.MIXIN or tp == ct.INTERFACE then
|
if tp == ct.MIXIN or tp == ct.INTERFACE then
|
||||||
cl = gen_mixin(classn)
|
cl = gen_mixin(klass)
|
||||||
elseif tp == ct.REGULAR or tp == ct.ABSTRACT then
|
elseif tp == ct.REGULAR or tp == ct.ABSTRACT then
|
||||||
cl = gen_class(classn)
|
cl = gen_class(klass)
|
||||||
else
|
else
|
||||||
error(classn .. ": unknown type")
|
error(klass:full_name_get() .. ": unknown type")
|
||||||
end
|
end
|
||||||
File(fname, classn, modname, libname, cprefix, { cl })
|
File(fname, klass, modname, libname, cprefix, { cl })
|
||||||
:generate(fstream or io.stdout)
|
:generate(fstream or io.stdout)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,11 @@ ffi.cdef [[
|
||||||
typedef unsigned char Eina_Bool;
|
typedef unsigned char Eina_Bool;
|
||||||
typedef struct _Eina_List Eina_List;
|
typedef struct _Eina_List Eina_List;
|
||||||
|
|
||||||
|
typedef struct _Eolian_Class Eolian_Class;
|
||||||
typedef struct _Eolian_Function Eolian_Function;
|
typedef struct _Eolian_Function Eolian_Function;
|
||||||
typedef struct _Eolian_Type Eolian_Type;
|
typedef struct _Eolian_Type Eolian_Type;
|
||||||
typedef struct _Eolian_Function_Parameter Eolian_Function_Parameter;
|
typedef struct _Eolian_Function_Parameter Eolian_Function_Parameter;
|
||||||
typedef struct _Eolian_Implement Eolian_Implement;
|
typedef struct _Eolian_Implement Eolian_Implement;
|
||||||
typedef struct _Eolian_Implement_Legacy Eolian_Implement_Legacy;
|
|
||||||
typedef struct _Eolian_Implement_Legacy_Parameter Eolian_Implement_Legacy_Parameter;
|
|
||||||
typedef struct _Eolian_Event Eolian_Event;
|
typedef struct _Eolian_Event Eolian_Event;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -52,22 +51,25 @@ ffi.cdef [[
|
||||||
int eolian_shutdown(void);
|
int eolian_shutdown(void);
|
||||||
Eina_Bool eolian_directory_scan(const char *dir);
|
Eina_Bool eolian_directory_scan(const char *dir);
|
||||||
Eina_Bool eolian_all_eo_files_parse();
|
Eina_Bool eolian_all_eo_files_parse();
|
||||||
Eina_Bool eolian_show(const char *class_name);
|
Eina_Bool eolian_show(const Eolian_Class *klass);
|
||||||
const char *eolian_class_find_by_file(const char *file_name);
|
Eolian_Class *eolian_class_find_by_name(const char *class_name);
|
||||||
const char *eolian_class_file_get(const char *class_name);
|
Eolian_Class *eolian_class_find_by_file(const char *file_name);
|
||||||
Eolian_Class_Type eolian_class_type_get(const char *class_name);
|
const char *eolian_class_file_get(const Eolian_Class *klass);
|
||||||
|
const char *eolian_class_full_name_get(const Eolian_Class *klass);
|
||||||
|
const char *eolian_class_name_get(const Eolian_Class *klass);
|
||||||
|
const Eina_List *eolian_class_namespaces_list_get(const Eolian_Class klass);
|
||||||
|
Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
|
||||||
const Eina_List *eolian_class_names_list_get(void);
|
const Eina_List *eolian_class_names_list_get(void);
|
||||||
Eina_Bool eolian_class_exists(const char *class_name);
|
const char *eolian_class_description_get(const Eolian_Class *klass);
|
||||||
const char *eolian_class_description_get(const char *class_name);
|
const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass);
|
||||||
const char *eolian_class_legacy_prefix_get(const char *class_name);
|
const char *eolian_class_eo_prefix_get(const Eolian_Class *klass);
|
||||||
const char *eolian_class_eo_prefix_get(const char *class_name);
|
const char *eolian_class_data_type_get(const Eolian_Class *klass);
|
||||||
const char *eolian_class_data_type_get(const char *class_name);
|
const Eina_List *eolian_class_inherits_list_get(const Eolian_Class *klass);
|
||||||
const Eina_List *eolian_class_inherits_list_get(const char *class_name);
|
const Eina_List *eolian_class_functions_list_get(const Eolian_Class *klass, Eolian_Function_Type func_type);
|
||||||
const Eina_List *eolian_class_functions_list_get(const char *class_name, Eolian_Function_Type func_type);
|
|
||||||
Eolian_Function_Type eolian_function_type_get(Eolian_Function *function_id);
|
Eolian_Function_Type eolian_function_type_get(Eolian_Function *function_id);
|
||||||
Eolian_Function_Scope eolian_function_scope_get(Eolian_Function *function_id);
|
Eolian_Function_Scope eolian_function_scope_get(Eolian_Function *function_id);
|
||||||
const char *eolian_function_name_get(Eolian_Function *function_id);
|
const char *eolian_function_name_get(Eolian_Function *function_id);
|
||||||
Eolian_Function *eolian_class_function_find_by_name(const char *classname, const char *func_name, Eolian_Function_Type f_type);
|
Eolian_Function *eolian_class_function_find_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
|
||||||
const char *eolian_function_data_get(Eolian_Function *function_id, const char *key);
|
const char *eolian_function_data_get(Eolian_Function *function_id, const char *key);
|
||||||
Eina_Bool eolian_function_is_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type f_type);
|
Eina_Bool eolian_function_is_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type f_type);
|
||||||
Eolian_Function_Parameter *eolian_function_parameter_get(const Eolian_Function *function_id, const char *param_name);
|
Eolian_Function_Parameter *eolian_function_parameter_get(const Eolian_Function *function_id, const char *param_name);
|
||||||
|
@ -88,11 +90,11 @@ ffi.cdef [[
|
||||||
Eina_Bool eolian_function_return_is_warn_unused(Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
Eina_Bool eolian_function_return_is_warn_unused(Eolian_Function *foo_id, Eolian_Function_Type ftype);
|
||||||
Eina_Bool eolian_function_object_is_const(Eolian_Function *function_id);
|
Eina_Bool eolian_function_object_is_const(Eolian_Function *function_id);
|
||||||
Eina_Bool eolian_implement_information_get(Eolian_Implement *impl, const char **class_name, const char **func_name, Eolian_Function_Type *type);
|
Eina_Bool eolian_implement_information_get(Eolian_Implement *impl, const char **class_name, const char **func_name, Eolian_Function_Type *type);
|
||||||
const Eina_List *eolian_class_implements_list_get(const char *class_name);
|
const Eina_List *eolian_class_implements_list_get(const Eolian_Class *klass);
|
||||||
const Eina_List *eolian_class_events_list_get(const char *class_name);
|
const Eina_List *eolian_class_events_list_get(const Eolian_Class *klass);
|
||||||
Eina_Bool eolian_class_event_information_get(Eolian_Event *event, const char **event_name, const char **event_type, const char **event_desc);
|
Eina_Bool eolian_class_event_information_get(Eolian_Event *event, const char **event_name, const char **event_type, const char **event_desc);
|
||||||
Eina_Bool eolian_class_ctor_enable_get(const char *class_name);
|
Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
|
||||||
Eina_Bool eolian_class_dtor_enable_get(const char *class_name);
|
Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
|
||||||
Eolian_Type *eolian_type_find_by_alias(const char *alias);
|
Eolian_Type *eolian_type_find_by_alias(const char *alias);
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
@ -129,69 +131,8 @@ M.eo_file_parse = function(fname)
|
||||||
return eolian.eolian_eo_file_parse(fname) ~= 0
|
return eolian.eolian_eo_file_parse(fname) ~= 0
|
||||||
end
|
end
|
||||||
|
|
||||||
M.show = function(cname)
|
M.show = function(klass)
|
||||||
return eolian.eolian_show(cname) ~= 0
|
return eolian.eolian_show(klass) ~= 0
|
||||||
end
|
|
||||||
|
|
||||||
M.class_find_by_file = function(fname)
|
|
||||||
local v = eolian.eolian_class_find_by_file(fname)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_file_get = function(cname)
|
|
||||||
local v = eolian.eolian_class_file_get(cname)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_type = {
|
|
||||||
UNKNOWN = 0,
|
|
||||||
REGULAR = 1,
|
|
||||||
ABSTRACT = 2,
|
|
||||||
MIXIN = 3,
|
|
||||||
INTERFACE = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
M.class_type_get = function(cname)
|
|
||||||
return eolian.eolian_class_type_get(cname)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_names_list_get = function()
|
|
||||||
return list.String_List(eolian.eolian_class_names_list_get()):to_array()
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_exists = function(cname)
|
|
||||||
return eolian.eolian_class_exists(cname) ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_description_get = function(cname)
|
|
||||||
local v = eolian.eolian_class_description_get(cname)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_legacy_prefix_get = function(cname)
|
|
||||||
local v = eolian.eolian_class_legacy_prefix_get(cname)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_eo_prefix_get = function(cname)
|
|
||||||
local v = eolian.eolian_class_eo_prefix_get(cname)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_data_type_get = function(cname)
|
|
||||||
local v = eolian.eolian_class_data_type_get(cname)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return ffi.string(v)
|
|
||||||
end
|
|
||||||
|
|
||||||
M.class_inherits_list_get = function(cname)
|
|
||||||
return list.String_List(eolian.eolian_class_inherits_list_get(cname))
|
|
||||||
:to_array()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.Type = ffi.metatype("Eolian_Type", {
|
M.Type = ffi.metatype("Eolian_Type", {
|
||||||
|
@ -206,15 +147,6 @@ M.Type = ffi.metatype("Eolian_Type", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local List_Base = list.List_Base
|
|
||||||
|
|
||||||
local Eolian_Functions_List = List_Base:clone {
|
|
||||||
data_get = function(self, ptr)
|
|
||||||
ptr = List_Base.data_get(self, ptr)
|
|
||||||
return ffi.cast("Eolian_Function*", ptr)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
M.function_type = {
|
M.function_type = {
|
||||||
UNRESOLVED = 0,
|
UNRESOLVED = 0,
|
||||||
PROPERTY = 1,
|
PROPERTY = 1,
|
||||||
|
@ -229,10 +161,7 @@ M.function_scope = {
|
||||||
PROTECTED = 1
|
PROTECTED = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
M.class_functions_list_get = function(cname, func_type)
|
local List_Base = list.List_Base
|
||||||
return Eolian_Functions_List(eolian.eolian_class_functions_list_get(cname,
|
|
||||||
func_type)):to_array()
|
|
||||||
end
|
|
||||||
|
|
||||||
local Eolian_Parameters_List = List_Base:clone {
|
local Eolian_Parameters_List = List_Base:clone {
|
||||||
data_get = function(self, ptr)
|
data_get = function(self, ptr)
|
||||||
|
@ -243,13 +172,6 @@ local Eolian_Parameters_List = List_Base:clone {
|
||||||
|
|
||||||
M.Function = ffi.metatype("Eolian_Function", {
|
M.Function = ffi.metatype("Eolian_Function", {
|
||||||
__index = {
|
__index = {
|
||||||
find_by_name = function(cname, fname, ftype)
|
|
||||||
local v = eolian.eolian_class_function_find_by_name(cname, fname,
|
|
||||||
ftype)
|
|
||||||
if v == nil then return nil end
|
|
||||||
return v
|
|
||||||
end,
|
|
||||||
|
|
||||||
type_get = function(self)
|
type_get = function(self)
|
||||||
return eolian.eolian_function_type_get(self)
|
return eolian.eolian_function_type_get(self)
|
||||||
end,
|
end,
|
||||||
|
@ -382,13 +304,6 @@ ffi.metatype("Eolian_Function_Parameter", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local Eolian_Implements_List = List_Base:clone {
|
|
||||||
data_get = function(self, ptr)
|
|
||||||
ptr = List_Base.data_get(self, ptr)
|
|
||||||
return ffi.cast("Eolian_Implement*", ptr)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
ffi.metatype("Eolian_Implement", {
|
ffi.metatype("Eolian_Implement", {
|
||||||
__index = {
|
__index = {
|
||||||
information_get = function(self)
|
information_get = function(self)
|
||||||
|
@ -403,18 +318,6 @@ ffi.metatype("Eolian_Implement", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
M.class_implements_list_get = function(cname)
|
|
||||||
return Eolian_Implements_List(
|
|
||||||
eolian.eolian_class_implements_list_get(cname)):to_array()
|
|
||||||
end
|
|
||||||
|
|
||||||
local Eolian_Events_List = List_Base:clone {
|
|
||||||
data_get = function(self, ptr)
|
|
||||||
ptr = List_Base.data_get(self, ptr)
|
|
||||||
return ffi.cast("Eolian_Event*", ptr)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
ffi.metatype("Eolian_Event", {
|
ffi.metatype("Eolian_Event", {
|
||||||
__index = {
|
__index = {
|
||||||
information_get = function(self)
|
information_get = function(self)
|
||||||
|
@ -429,22 +332,144 @@ ffi.metatype("Eolian_Event", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
M.class_events_list_get = function(cname)
|
M.class_find_by_name = function(cname)
|
||||||
return Eolian_Events_List(
|
local v = eolian.eolian_class_find_by_name(cname)
|
||||||
eolian.eolian_class_events_list_get(cname)):to_array()
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
M.class_ctor_enable_get = function(cname)
|
M.class_find_by_file = function(fname)
|
||||||
return eolian.eolian_class_ctor_enable_get(cname) ~= 0
|
local v = eolian.eolian_class_find_by_file(fname)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
M.class_dtor_enable_get = function(cname)
|
M.class_names_list_get = function()
|
||||||
return eolian.eolian_class_dtor_enable_get(cname) ~= 0
|
return list.String_List(eolian.eolian_class_names_list_get()):to_array()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.class_type = {
|
||||||
|
UNKNOWN = 0,
|
||||||
|
REGULAR = 1,
|
||||||
|
ABSTRACT = 2,
|
||||||
|
MIXIN = 3,
|
||||||
|
INTERFACE = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
local Eolian_Functions_List = List_Base:clone {
|
||||||
|
data_get = function(self, ptr)
|
||||||
|
ptr = List_Base.data_get(self, ptr)
|
||||||
|
return ffi.cast("Eolian_Function*", ptr)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
local Eolian_Implements_List = List_Base:clone {
|
||||||
|
data_get = function(self, ptr)
|
||||||
|
ptr = List_Base.data_get(self, ptr)
|
||||||
|
return ffi.cast("Eolian_Implement*", ptr)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
local Eolian_Events_List = List_Base:clone {
|
||||||
|
data_get = function(self, ptr)
|
||||||
|
ptr = List_Base.data_get(self, ptr)
|
||||||
|
return ffi.cast("Eolian_Event*", ptr)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
M.Class = ffi.metatype("Eolian_Class", {
|
||||||
|
__index = {
|
||||||
|
file_get = function(self)
|
||||||
|
local v = eolian.eolian_class_file_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
full_name_get = function(self)
|
||||||
|
local v = eolian.eolian_class_full_name_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
name_get = function(self)
|
||||||
|
local v = eolian.eolian_class_name_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
namespaces_list_get = function(self)
|
||||||
|
return list.String_List(eolian.eolian_class_namespaces_list_get(
|
||||||
|
self)):to_array()
|
||||||
|
end,
|
||||||
|
|
||||||
|
type_get = function(self)
|
||||||
|
return eolian.eolian_class_type_get(self)
|
||||||
|
end,
|
||||||
|
|
||||||
|
description_get = function(self)
|
||||||
|
local v = eolian.eolian_class_description_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
legacy_prefix_get = function(self)
|
||||||
|
local v = eolian.eolian_class_legacy_prefix_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
eo_prefix_get = function(self)
|
||||||
|
local v = eolian.eolian_class_eo_prefix_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
data_type_get = function(self)
|
||||||
|
local v = eolian.eolian_class_data_type_get(self)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return ffi.string(v)
|
||||||
|
end,
|
||||||
|
|
||||||
|
inherits_list_get = function(self)
|
||||||
|
return list.String_List(eolian.eolian_class_inherits_list_get(
|
||||||
|
self)):to_array()
|
||||||
|
end,
|
||||||
|
|
||||||
|
functions_list_get = function(self, func_type)
|
||||||
|
return Eolian_Functions_List(
|
||||||
|
eolian.eolian_class_functions_list_get(self, func_type))
|
||||||
|
:to_array()
|
||||||
|
end,
|
||||||
|
|
||||||
|
function_find_by_name = function(self, fname, ftype)
|
||||||
|
local v = eolian.eolian_class_function_find_by_name(self, fname,
|
||||||
|
ftype)
|
||||||
|
if v == nil then return nil end
|
||||||
|
return v
|
||||||
|
end,
|
||||||
|
|
||||||
|
implements_list_get = function(self)
|
||||||
|
return Eolian_Implements_List(
|
||||||
|
eolian.eolian_class_implements_list_get(self)):to_array()
|
||||||
|
end,
|
||||||
|
|
||||||
|
events_list_get = function(self)
|
||||||
|
return Eolian_Events_List(
|
||||||
|
eolian.eolian_class_events_list_get(self)):to_array()
|
||||||
|
end,
|
||||||
|
|
||||||
|
ctor_enable_get = function(self)
|
||||||
|
return eolian.eolian_class_ctor_enable_get(self) ~= 0
|
||||||
|
end,
|
||||||
|
|
||||||
|
dtor_enable_get = function(self)
|
||||||
|
return eolian.eolian_class_dtor_enable_get(self) ~= 0
|
||||||
|
end
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
M.type_find_by_alias = function(alias)
|
M.type_find_by_alias = function(alias)
|
||||||
-- implement after merge
|
return eolian.eolian_type_find_by_alias(alias)
|
||||||
-- return eolian.eolian_type_find_by_alias(alias)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
Loading…
Reference in New Issue