forked from enlightenment/efl
elua: a simple list type generator in eina_list
This commit is contained in:
parent
aeaadae1fe
commit
22d03089fc
|
@ -277,6 +277,15 @@ local List_Base = util.Readonly_Object:clone {
|
|||
}
|
||||
M.List_Base = List_Base
|
||||
|
||||
M.gen_list_type = function(tp)
|
||||
return List_Base:clone {
|
||||
data_get = function(self, ptr)
|
||||
ptr = List_Base.data_get(self, ptr)
|
||||
return ffi.cast(tp, ptr)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
M.String_List = List_Base:clone {
|
||||
data_get = function(self, ptr)
|
||||
ptr = List_Base.data_get(self, ptr)
|
||||
|
|
|
@ -162,14 +162,7 @@ M.function_scope = {
|
|||
PROTECTED = 1
|
||||
}
|
||||
|
||||
local List_Base = list.List_Base
|
||||
|
||||
local Eolian_Parameters_List = List_Base:clone {
|
||||
data_get = function(self, ptr)
|
||||
ptr = List_Base.data_get(self, ptr)
|
||||
return ffi.cast("Eolian_Function_Parameter*", ptr)
|
||||
end
|
||||
}
|
||||
local Eolian_Parameters_List = list.gen_list_type("Eolian_Function_Parameter*")
|
||||
|
||||
M.Function = ffi.metatype("Eolian_Function", {
|
||||
__index = {
|
||||
|
@ -361,26 +354,9 @@ M.class_type = {
|
|||
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
|
||||
}
|
||||
local Eolian_Functions_List = list.gen_list_type("Eolian_Function*")
|
||||
local Eolian_Implements_List = list.gen_list_type("Eolian_Implement*")
|
||||
local Eolian_Events_List = list.gen_list_type("Eolian_Event*")
|
||||
|
||||
M.Class = ffi.metatype("Eolian_Class", {
|
||||
__index = {
|
||||
|
|
Loading…
Reference in New Issue