add a script to print all non-legacy C names in eo files
This commit is contained in:
commit
3cf525bd21
|
@ -0,0 +1 @@
|
||||||
|
*.luac
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Eolian tools
|
||||||
|
|
||||||
|
These are various scripts and utilities to be used with Eolian. It may include
|
||||||
|
things such as various statistics scripts or analysis utilities.
|
||||||
|
|
||||||
|
Each utility typically accepts the `-h`/`--help` option for usage.
|
||||||
|
|
||||||
|
## Lua scripts
|
||||||
|
|
||||||
|
These are invoked using `elua`. You can do so like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
elua script_name.lua <arguments>
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also invoke them using `elua` from inside an EFL tree without
|
||||||
|
installing it, using the script also provided in this repo:
|
||||||
|
|
||||||
|
```
|
||||||
|
./elua_in_tree.sh ../path/to/EFL script_name.lua <arguments>
|
||||||
|
```
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "Usage: $0 efl_path script_path [arguments...]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
EFL_PATH="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
PREV_LD_PATH="$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH="${EFL_PATH}/src/lib/eina/.libs"
|
||||||
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EFL_PATH}/src/lib/eolian/.libs"
|
||||||
|
|
||||||
|
if [ -n "$PREV_LD_PATH" ]; then
|
||||||
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PREV_LD_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${EFL_PATH}/src/bin/elua/elua" \
|
||||||
|
"-I${EFL_PATH}/src/bindings/luajit" \
|
||||||
|
"-C${EFL_PATH}/src/scripts/elua/core" \
|
||||||
|
"-M${EFL_PATH}/src/scripts/elua/modules" \
|
||||||
|
"-A${EFL_PATH}/src/scripts/elua/apps" \
|
||||||
|
"$@"
|
|
@ -0,0 +1,104 @@
|
||||||
|
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
|
Loading…
Reference in New Issue