add a mode to list only-legacy names
This commit is contained in:
parent
158f4cc690
commit
7f8e6528fe
|
@ -3,6 +3,7 @@ local getopt = require("getopt")
|
||||||
local eou = require("utils.eolian_extras")
|
local eou = require("utils.eolian_extras")
|
||||||
|
|
||||||
local exit = false
|
local exit = false
|
||||||
|
local legacy = false
|
||||||
local pargs
|
local pargs
|
||||||
|
|
||||||
getopt.parse {
|
getopt.parse {
|
||||||
|
@ -14,7 +15,8 @@ path. If no path is specified, system-wide eo files are used instead.]],
|
||||||
descs = {
|
descs = {
|
||||||
{ "h", "help", false, help = "Show this message.",
|
{ "h", "help", false, help = "Show this message.",
|
||||||
callback = getopt.help_cb(io.stdout)
|
callback = getopt.help_cb(io.stdout)
|
||||||
}
|
},
|
||||||
|
{ "l", "legacy", false, help = "Print only legacy names intead." }
|
||||||
},
|
},
|
||||||
error_cb = function(parser, msg)
|
error_cb = function(parser, msg)
|
||||||
io.stderr:write(msg, "\n")
|
io.stderr:write(msg, "\n")
|
||||||
|
@ -25,6 +27,9 @@ path. If no path is specified, system-wide eo files are used instead.]],
|
||||||
if opts["h"] then
|
if opts["h"] then
|
||||||
exit = true
|
exit = true
|
||||||
end
|
end
|
||||||
|
if opts["l"] then
|
||||||
|
legacy = true
|
||||||
|
end
|
||||||
pargs = args
|
pargs = args
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -45,17 +50,17 @@ eos:all_eot_files_parse()
|
||||||
eos:all_eo_files_parse()
|
eos:all_eo_files_parse()
|
||||||
|
|
||||||
print("API functions:\n")
|
print("API functions:\n")
|
||||||
for i, n in ipairs(eou.get_c_functions(eos)) do
|
for i, n in ipairs(eou.get_c_functions(eos, legacy)) do
|
||||||
print(n)
|
print(n)
|
||||||
end
|
end
|
||||||
|
|
||||||
print("\nEvents:\n")
|
print("\nEvents:\n")
|
||||||
for i, n in ipairs(eou.get_c_events(eos)) do
|
for i, n in ipairs(eou.get_c_events(eos, legacy)) do
|
||||||
print(n)
|
print(n)
|
||||||
end
|
end
|
||||||
|
|
||||||
print("\nFunction pointers:\n")
|
print("\nFunction pointers:\n")
|
||||||
for i, n in ipairs(eou.get_c_function_pointers(eos)) do
|
for i, n in ipairs(eou.get_c_function_pointers(eos, legacy)) do
|
||||||
print(n)
|
print(n)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,28 +57,43 @@ M.new = function()
|
||||||
return eolian.new()
|
return eolian.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.get_c_functions = function(eos)
|
local f_is_beta = function(fn)
|
||||||
|
if legacy then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return fn:is_beta()
|
||||||
|
end
|
||||||
|
|
||||||
|
M.get_c_functions = function(eos, only_legacy)
|
||||||
|
only_legacy = not not only_legacy
|
||||||
local ret = {}
|
local ret = {}
|
||||||
for cl in eos:classes_get() do
|
for cl in eos:classes_get() do
|
||||||
local fntp = eolian.function_type
|
local fntp = eolian.function_type
|
||||||
for fn in cl:functions_get(fntp.METHOD) do
|
for fn in cl:functions_get(fntp.METHOD) do
|
||||||
ret[#ret + 1] = fn:full_c_name_get(fntp.METHOD, false)
|
if not only_legacy or not f_is_beta(fn) then
|
||||||
|
ret[#ret + 1] = fn:full_c_name_get(fntp.METHOD, only_legacy)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
for fn in cl:functions_get(fntp.PROPERTY) do
|
for fn in cl:functions_get(fntp.PROPERTY) do
|
||||||
local tp = fn:type_get()
|
if not only_legacy or not f_is_beta(fn) then
|
||||||
if tp == fntp.PROPERTY then
|
local tp = fn:type_get()
|
||||||
ret[#ret + 1] = fn:full_c_name_get(fntp.PROP_GET, false)
|
if tp == fntp.PROPERTY then
|
||||||
ret[#ret + 1] = fn:full_c_name_get(fntp.PROP_SET, false)
|
ret[#ret + 1] = fn:full_c_name_get(fntp.PROP_GET, only_legacy)
|
||||||
else
|
ret[#ret + 1] = fn:full_c_name_get(fntp.PROP_SET, only_legacy)
|
||||||
ret[#ret + 1] = fn:full_c_name_get(tp, false)
|
else
|
||||||
|
ret[#ret + 1] = fn:full_c_name_get(tp, only_legacy)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
M.get_c_events = function(eos)
|
M.get_c_events = function(eos, only_legacy)
|
||||||
local ret = {}
|
local ret = {}
|
||||||
|
if only_legacy then
|
||||||
|
return ret
|
||||||
|
end
|
||||||
for cl in eos:classes_get() do
|
for cl in eos:classes_get() do
|
||||||
for ev in cl:events_get() do
|
for ev in cl:events_get() do
|
||||||
ret[#ret + 1] = ev:c_name_get()
|
ret[#ret + 1] = ev:c_name_get()
|
||||||
|
@ -94,8 +109,8 @@ local full_name_get = function(obj)
|
||||||
return obj:name_get()
|
return obj:name_get()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.get_c_function_pointers = function(eos)
|
M.get_c_function_pointers = function(eos, only_legacy)
|
||||||
if legacy then
|
if legacy or only_legacy then
|
||||||
-- no function pointer support in pre-state api
|
-- no function pointer support in pre-state api
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue