enable the scripts to work in efl 1.20 environment

This commit is contained in:
q66 2018-08-03 01:24:25 +02:00
parent b6b9eaac4a
commit 158f4cc690
3 changed files with 74 additions and 10 deletions

View File

@ -1,4 +1,3 @@
local eolian = require("eolian")
local getopt = require("getopt") local getopt = require("getopt")
local eou = require("utils.eolian_extras") local eou = require("utils.eolian_extras")
@ -34,7 +33,7 @@ if exit then
return true return true
end end
local eos = eolian.new() local eos = eou.new()
if #pargs >= 1 then if #pargs >= 1 then
eos:directory_add(pargs[1]) eos:directory_add(pargs[1])

View File

@ -1,4 +1,3 @@
local eolian = require("eolian")
local getopt = require("getopt") local getopt = require("getopt")
local eou = require("utils.eolian_extras") local eou = require("utils.eolian_extras")
@ -39,7 +38,7 @@ if exit then
return true return true
end end
local eos = eolian.new() local eos = eou.new()
if #pargs > 1 then if #pargs > 1 then
eos:directory_add(pargs[2]) eos:directory_add(pargs[2])

View File

@ -2,6 +2,61 @@ local eolian = require("eolian")
local M = {} local M = {}
-- check for pre-state eolian api
local legacy = not eolian.new
-- wrapper for legacy eolian api to mimic modern
local legacy_eos = {
directory_add = function(self, dir)
eolian.directory_scan(dir)
end,
system_directory_add = function(self)
eolian.system_directory_scan()
end,
all_eo_files_parse = function(self)
assert(eolian.all_eo_files_parse())
assert(eolian.database_validate())
end,
all_eot_files_parse = function(self)
assert(eolian.all_eot_files_parse())
assert(eolian.database_validate())
end,
classes_get = function(self)
return eolian.all_classes_get(nil)
end,
aliases_get = function(self)
return eolian.typedecl_all_aliases_get(nil)
end,
structs_get = function(self)
return eolian.typedecl_all_structs_get(nil)
end,
enums_get = function(self)
return eolian.typedecl_all_enums_get(nil)
end,
globals_get = function(self)
return eolian.variable_all_globals_get(nil)
end,
constants_get = function(self)
return eolian.variable_all_constants_get(nil)
end
}
M.new = function()
if legacy then
return legacy_eos
end
return eolian.new()
end
M.get_c_functions = function(eos) M.get_c_functions = function(eos)
local ret = {} local ret = {}
for cl in eos:classes_get() do for cl in eos:classes_get() do
@ -32,11 +87,22 @@ M.get_c_events = function(eos)
return ret return ret
end end
local full_name_get = function(obj)
if legacy then
return obj:full_name_get()
end
return obj:name_get()
end
M.get_c_function_pointers = function(eos) M.get_c_function_pointers = function(eos)
if legacy then
-- no function pointer support in pre-state api
return {}
end
local ret = {} local ret = {}
for tp in eos:aliases_get() do for tp in eos:aliases_get() do
if tp:type_get() == eolian.typedecl_type.FUNCTION_POINTER then if tp:type_get() == eolian.typedecl_type.FUNCTION_POINTER then
ret[#ret + 1] = tp:name_get():gsub("%.", "_") ret[#ret + 1] = full_name_get(tp):gsub("%.", "_")
end end
end end
return ret return ret
@ -46,7 +112,7 @@ M.get_c_aliases = function(eos)
local ret = {} local ret = {}
for tp in eos:aliases_get() do for tp in eos:aliases_get() do
if tp:type_get() ~= eolian.typedecl_type.FUNCTION_POINTER then if tp:type_get() ~= eolian.typedecl_type.FUNCTION_POINTER then
ret[#ret + 1] = tp:name_get():gsub("%.", "_") ret[#ret + 1] = full_name_get(tp):gsub("%.", "_")
end end
end end
return ret return ret
@ -55,7 +121,7 @@ end
M.get_c_structs = function(eos) M.get_c_structs = function(eos)
local ret = {} local ret = {}
for tp in eos:structs_get() do for tp in eos:structs_get() do
ret[#ret + 1] = tp:name_get():gsub("%.", "_") ret[#ret + 1] = full_name_get(tp):gsub("%.", "_")
end end
return ret return ret
end end
@ -63,7 +129,7 @@ end
M.get_c_enums = function(eos) M.get_c_enums = function(eos)
local ret = {} local ret = {}
for tp in eos:enums_get() do for tp in eos:enums_get() do
ret[#ret + 1] = tp:name_get():gsub("%.", "_") ret[#ret + 1] = full_name_get(tp):gsub("%.", "_")
end end
return ret return ret
end end
@ -71,7 +137,7 @@ end
M.get_c_globals = function(eos) M.get_c_globals = function(eos)
local ret = {} local ret = {}
for v in eos:globals_get() do for v in eos:globals_get() do
ret[#ret + 1] = v:name_get():gsub("%.", "_"):upper() ret[#ret + 1] = full_name_get(v):gsub("%.", "_"):upper()
end end
return ret return ret
end end
@ -79,7 +145,7 @@ end
M.get_c_constants = function(eos) M.get_c_constants = function(eos)
local ret = {} local ret = {}
for v in eos:constants_get() do for v in eos:constants_get() do
ret[#ret + 1] = v:name_get():gsub("%.", "_"):upper() ret[#ret + 1] = full_name_get(v):gsub("%.", "_"):upper()
end end
return ret return ret
end end