diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-03 17:19:55 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-12 13:25:28 -0300 |
commit | d5e3cede28858dfe079b782cfea4bce6ebc268c0 (patch) | |
tree | 9d4746081a51c0e81d59aa16ada598fd9da59dee /scripts/msgpack-gen.lua | |
parent | cd70b9c0152f79887ed548e6cf8992ae2121fedb (diff) | |
download | rneovim-d5e3cede28858dfe079b782cfea4bce6ebc268c0.tar.gz rneovim-d5e3cede28858dfe079b782cfea4bce6ebc268c0.tar.bz2 rneovim-d5e3cede28858dfe079b782cfea4bce6ebc268c0.zip |
msgpack-rpc: Remove support for integer ids in methods
There's no need to have integer and string ids, and since we now fully support
msgpack-RPC, support for integer ids was removed.
Diffstat (limited to 'scripts/msgpack-gen.lua')
-rw-r--r-- | scripts/msgpack-gen.lua | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/scripts/msgpack-gen.lua b/scripts/msgpack-gen.lua index 1516271973..36fe07896b 100644 --- a/scripts/msgpack-gen.lua +++ b/scripts/msgpack-gen.lua @@ -60,8 +60,7 @@ for i = 1, #arg - 1 do local tmp = grammar:match(input:read('*all')) for i = 1, #tmp do api.functions[#api.functions + 1] = tmp[i] - local fn_id = #api.functions - local fn = api.functions[fn_id] + local fn = 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 @@ -75,8 +74,6 @@ for i = 1, #arg - 1 do -- for specifying errors fn.parameters[#fn.parameters] = nil end - -- assign a unique integer id for each api function - fn.id = fn_id end input:close() end @@ -221,17 +218,6 @@ for i = 1, #api.functions do end end --- Generate the table of handler functions indexed by method id -output:write([[ -static const rpc_method_handler_fn rpc_method_handlers[] = { - [0] = (rpc_method_handler_fn)NULL]]) - -for i = 1, #api.functions do - local fn = api.functions[i] - output:write(',\n ['..i..'] = handle_'..fn.name..'') -end -output:write('\n};\n\n') - -- Generate a function that initializes method names with handler functions output:write([[ static Map(String, rpc_method_handler_fn) *methods = NULL; @@ -279,7 +265,6 @@ Object msgpack_rpc_dispatch(uint64_t channel_id, Error *error) { msgpack_object method = req->via.array.ptr[2]; - uint64_t method_id = method.via.u64; rpc_method_handler_fn handler = NULL; if (method.type == MSGPACK_OBJECT_BIN || method.type == MSGPACK_OBJECT_STR) { @@ -288,8 +273,6 @@ output:write(' handler = map_get(String, rpc_method_handler_fn)') output:write('(methods, (String){.data=(char *)method.via.bin.ptr,') output:write('.size=min(method.via.bin.size, '..max_fname_len..')});\n') output:write([[ - } else if (method_id <= ]]..#api.functions..[[) { - handler = rpc_method_handlers[method_id]; } if (!handler) { |