105 lines
2.4 KiB
Lua
105 lines
2.4 KiB
Lua
local eolian = require("eolian")
|
|
local getopt = require("getopt")
|
|
|
|
local exit = false
|
|
local pargs
|
|
|
|
getopt.parse {
|
|
usage = "Usage: %prog [OPTIONS] [path_to_eo_files]",
|
|
args = arg,
|
|
header = [[
|
|
Print all non-legacy C names generated in header files for the given
|
|
path. If no path is specified, system-wide eo files are used instead.]],
|
|
descs = {
|
|
{ "h", "help", false, help = "Show this message.",
|
|
callback = getopt.help_cb(io.stdout)
|
|
}
|
|
},
|
|
error_cb = function(parser, msg)
|
|
io.stderr:write(msg, "\n")
|
|
getopt.help(parser, io.stderr)
|
|
exit = true
|
|
end,
|
|
done_cb = function(parser, opts, args)
|
|
if opts["h"] then
|
|
exit = true
|
|
end
|
|
pargs = args
|
|
end
|
|
}
|
|
|
|
if exit then
|
|
return true
|
|
end
|
|
|
|
local eos = eolian.new()
|
|
|
|
if #pargs >= 1 then
|
|
eos:directory_add(pargs[1])
|
|
else
|
|
eos:system_directory_add()
|
|
end
|
|
|
|
eos:all_eot_files_parse()
|
|
eos:all_eo_files_parse()
|
|
|
|
print("API functions:\n")
|
|
for cl in eos:classes_get() do
|
|
local fntp = eolian.function_type
|
|
for fn in cl:functions_get(fntp.METHOD) do
|
|
print(fn:full_c_name_get(fntp.METHOD, false))
|
|
end
|
|
for fn in cl:functions_get(fntp.PROPERTY) do
|
|
local tp = fn:type_get()
|
|
if tp == fntp.PROPERTY then
|
|
print(fn:full_c_name_get(fntp.PROP_GET, false))
|
|
print(fn:full_c_name_get(fntp.PROP_SET, false))
|
|
else
|
|
print(fn:full_c_name_get(tp, false))
|
|
end
|
|
end
|
|
end
|
|
|
|
print("\nEvents:\n")
|
|
for cl in eos:classes_get() do
|
|
for ev in cl:events_get() do
|
|
print(ev:c_name_get())
|
|
end
|
|
end
|
|
|
|
print("\nFunction pointers:\n")
|
|
for tp in eos:aliases_get() do
|
|
if tp:type_get() == eolian.typedecl_type.FUNCTION_POINTER then
|
|
print((tp:name_get():gsub("%.", "_")))
|
|
end
|
|
end
|
|
|
|
print("\nAliases:\n")
|
|
for tp in eos:aliases_get() do
|
|
if tp:type_get() ~= eolian.typedecl_type.FUNCTION_POINTER then
|
|
print((tp:name_get():gsub("%.", "_")))
|
|
end
|
|
end
|
|
|
|
print("\nStructs:\n")
|
|
for tp in eos:structs_get() do
|
|
print((tp:name_get():gsub("%.", "_")))
|
|
end
|
|
|
|
print("\nEnums:\n")
|
|
for tp in eos:enums_get() do
|
|
print((tp:name_get():gsub("%.", "_")))
|
|
end
|
|
|
|
print("\nGlobals:\n")
|
|
for v in eos:globals_get() do
|
|
print(v:name_get():gsub("%.", "_"):upper())
|
|
end
|
|
|
|
print("\nConstants:\n")
|
|
for v in eos:constants_get() do
|
|
print(v:name_get():gsub("%.", "_"):upper())
|
|
end
|
|
|
|
return true
|