aboutsummaryrefslogtreecommitdiff
path: root/scripts/msgpack-gen.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-04-14 20:47:01 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2016-05-27 13:18:04 +0200
commitdd539366fcbecd340462a626523a3f689cf7589e (patch)
tree4866ae0b68db326c34a6aca145ae1e26f047f395 /scripts/msgpack-gen.lua
parentc74ce334f2f7c42dcd33bc5a0d1cc02b752733f6 (diff)
downloadrneovim-dd539366fcbecd340462a626523a3f689cf7589e.tar.gz
rneovim-dd539366fcbecd340462a626523a3f689cf7589e.tar.bz2
rneovim-dd539366fcbecd340462a626523a3f689cf7589e.zip
api: refactor remote ui to use API dispatch generation
Diffstat (limited to 'scripts/msgpack-gen.lua')
-rw-r--r--scripts/msgpack-gen.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/msgpack-gen.lua b/scripts/msgpack-gen.lua
index c726db3920..190af636dc 100644
--- a/scripts/msgpack-gen.lua
+++ b/scripts/msgpack-gen.lua
@@ -35,7 +35,8 @@ c_proto = Ct(
Cg(c_type, 'return_type') * Cg(c_id, 'name') *
fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') *
Cg(Cc(false), 'async') *
- (fill * Cg((P('FUNC_ATTR_ASYNC') * Cc(true)), 'async') ^ -1) *
+ (fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
+ (fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
fill * P(';')
)
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
@@ -62,8 +63,11 @@ for i = 1, #arg - 1 do
local input = io.open(full_path, 'rb')
local tmp = grammar:match(input:read('*all'))
for i = 1, #tmp do
- functions[#functions + 1] = tmp[i]
local fn = tmp[i]
+ if fn.noexport then
+ goto continue
+ end
+ functions[#functions + 1] = tmp[i]
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
-- this function should receive the channel id
fn.receives_channel_id = true
@@ -77,6 +81,7 @@ for i = 1, #arg - 1 do
-- for specifying errors
fn.parameters[#fn.parameters] = nil
end
+ ::continue::
end
input:close()
end
@@ -217,7 +222,7 @@ for i = 1, #functions do
if fn.receives_channel_id then
-- if the function receives the channel id, pass it as first argument
- if #args > 0 then
+ if #args > 0 or fn.can_fail then
output:write('channel_id, '..call_args)
else
output:write('channel_id')