aboutsummaryrefslogtreecommitdiff
path: root/scripts/gendispatch.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-09-26 19:05:13 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2016-09-27 16:54:55 +0200
commit50c26017a3b9af59a6c3bacb8aea44ab5a300b55 (patch)
treef32ce085a53c16034489476701c3334ef9ac06a4 /scripts/gendispatch.lua
parent6f55d1377f4c4442f66c67471001e666a97f9195 (diff)
downloadrneovim-50c26017a3b9af59a6c3bacb8aea44ab5a300b55.tar.gz
rneovim-50c26017a3b9af59a6c3bacb8aea44ab5a300b55.tar.bz2
rneovim-50c26017a3b9af59a6c3bacb8aea44ab5a300b55.zip
api: define the set of function attributes to expose in the metadata
Diffstat (limited to 'scripts/gendispatch.lua')
-rw-r--r--scripts/gendispatch.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua
index 65e4559491..69b9384000 100644
--- a/scripts/gendispatch.lua
+++ b/scripts/gendispatch.lua
@@ -145,6 +145,18 @@ for i,f in ipairs(shallowcopy(functions)) do
end
end
+-- don't expose internal attributes like "impl_name" in public metadata
+exported_attributes = {'name', 'parameters', 'return_type', 'method',
+ 'since', 'deprecated_since'}
+exported_functions = {}
+for _,f in ipairs(functions) do
+ local f_exported = {}
+ for _,attr in ipairs(exported_attributes) do
+ f_exported[attr] = f[attr]
+ end
+ exported_functions[#exported_functions+1] = f_exported
+end
+
-- start building the output
output = io.open(outputf, 'wb')
@@ -179,9 +191,9 @@ static const uint8_t msgpack_metadata[] = {
]])
-- serialize the API metadata using msgpack and embed into the resulting
-- binary for easy querying by clients
-packed = mpack.pack(functions)
-for i = 1, #packed do
- output:write(string.byte(packed, i)..', ')
+packed_exported_functions = mpack.pack(exported_functions)
+for i = 1, #packed_exported_functions do
+ output:write(string.byte(packed_exported_functions, i)..', ')
if i % 10 == 0 then
output:write('\n ')
end
@@ -370,5 +382,5 @@ MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
output:close()
mpack_output = io.open(mpack_outputf, 'wb')
-mpack_output:write(packed)
+mpack_output:write(mpack.pack(functions))
mpack_output:close()