summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorq66 <daniel@octaforge.org>2018-07-31 17:01:59 +0200
committerq66 <daniel@octaforge.org>2018-07-31 17:02:41 +0200
commit3cf525bd219cee2b584a04c4686d772d5c507e9b (patch)
tree0771d06e5bc17f42487ff687c3180697708bc9e2
add a script to print all non-legacy C names in eo files
-rw-r--r--.gitignore1
-rw-r--r--README21
-rwxr-xr-xelua_in_tree.sh25
-rw-r--r--list_beta_c_names.lua104
4 files changed, 151 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..31b688b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
*.luac
diff --git a/README b/README
new file mode 100644
index 0000000..845c8b6
--- /dev/null
+++ b/README
@@ -0,0 +1,21 @@
1# Eolian tools
2
3These are various scripts and utilities to be used with Eolian. It may include
4things such as various statistics scripts or analysis utilities.
5
6Each utility typically accepts the `-h`/`--help` option for usage.
7
8## Lua scripts
9
10These are invoked using `elua`. You can do so like this:
11
12```
13elua script_name.lua <arguments>
14```
15
16You can also invoke them using `elua` from inside an EFL tree without
17installing it, using the script also provided in this repo:
18
19```
20./elua_in_tree.sh ../path/to/EFL script_name.lua <arguments>
21```
diff --git a/elua_in_tree.sh b/elua_in_tree.sh
new file mode 100755
index 0000000..e7a0e45
--- /dev/null
+++ b/elua_in_tree.sh
@@ -0,0 +1,25 @@
1#!/bin/sh
2
3if [ $# -lt 2 ]; then
4 echo "Usage: $0 efl_path script_path [arguments...]"
5 exit 1
6fi
7
8EFL_PATH="$1"
9shift
10
11PREV_LD_PATH="$LD_LIBRARY_PATH"
12
13export LD_LIBRARY_PATH="${EFL_PATH}/src/lib/eina/.libs"
14export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${EFL_PATH}/src/lib/eolian/.libs"
15
16if [ -n "$PREV_LD_PATH" ]; then
17 export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PREV_LD_PATH}"
18fi
19
20"${EFL_PATH}/src/bin/elua/elua" \
21 "-I${EFL_PATH}/src/bindings/luajit" \
22 "-C${EFL_PATH}/src/scripts/elua/core" \
23 "-M${EFL_PATH}/src/scripts/elua/modules" \
24 "-A${EFL_PATH}/src/scripts/elua/apps" \
25 "$@"
diff --git a/list_beta_c_names.lua b/list_beta_c_names.lua
new file mode 100644
index 0000000..f036cd5
--- /dev/null
+++ b/list_beta_c_names.lua
@@ -0,0 +1,104 @@
1local eolian = require("eolian")
2local getopt = require("getopt")
3
4local exit = false
5local pargs
6
7getopt.parse {
8 usage = "Usage: %prog [OPTIONS] [path_to_eo_files]",
9 args = arg,
10 header = [[
11Print all non-legacy C names generated in header files for the given
12path. If no path is specified, system-wide eo files are used instead.]],
13 descs = {
14 { "h", "help", false, help = "Show this message.",
15 callback = getopt.help_cb(io.stdout)
16 }
17 },
18 error_cb = function(parser, msg)
19 io.stderr:write(msg, "\n")
20 getopt.help(parser, io.stderr)
21 exit = true
22 end,
23 done_cb = function(parser, opts, args)
24 if opts["h"] then
25 exit = true
26 end
27 pargs = args
28 end
29}
30
31if exit then
32 return true
33end
34
35local eos = eolian.new()
36
37if #pargs >= 1 then
38 eos:directory_add(pargs[1])
39else
40 eos:system_directory_add()
41end
42
43eos:all_eot_files_parse()
44eos:all_eo_files_parse()
45
46print("API functions:\n")
47for cl in eos:classes_get() do
48 local fntp = eolian.function_type
49 for fn in cl:functions_get(fntp.METHOD) do
50 print(fn:full_c_name_get(fntp.METHOD, false))
51 end
52 for fn in cl:functions_get(fntp.PROPERTY) do
53 local tp = fn:type_get()
54 if tp == fntp.PROPERTY then
55 print(fn:full_c_name_get(fntp.PROP_GET, false))
56 print(fn:full_c_name_get(fntp.PROP_SET, false))
57 else
58 print(fn:full_c_name_get(tp, false))
59 end
60 end
61end
62
63print("\nEvents:\n")
64for cl in eos:classes_get() do
65 for ev in cl:events_get() do
66 print(ev:c_name_get())
67 end
68end
69
70print("\nFunction pointers:\n")
71for tp in eos:aliases_get() do
72 if tp:type_get() == eolian.typedecl_type.FUNCTION_POINTER then
73 print((tp:name_get():gsub("%.", "_")))
74 end
75end
76
77print("\nAliases:\n")
78for tp in eos:aliases_get() do
79 if tp:type_get() ~= eolian.typedecl_type.FUNCTION_POINTER then
80 print((tp:name_get():gsub("%.", "_")))
81 end
82end
83
84print("\nStructs:\n")
85for tp in eos:structs_get() do
86 print((tp:name_get():gsub("%.", "_")))
87end
88
89print("\nEnums:\n")
90for tp in eos:enums_get() do
91 print((tp:name_get():gsub("%.", "_")))
92end
93
94print("\nGlobals:\n")
95for v in eos:globals_get() do
96 print(v:name_get():gsub("%.", "_"):upper())
97end
98
99print("\nConstants:\n")
100for v in eos:constants_get() do
101 print(v:name_get():gsub("%.", "_"):upper())
102end
103
104return true