aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-16 15:40:21 +0100
committerGitHub <noreply@github.com>2020-12-16 15:40:21 +0100
commit2debabb0805ccd014478e6aff88fce8129a352d0 (patch)
tree37077a4618b573d8c8ac6386df5a0d53ce4e94e2 /src/nvim/generators
parent5e202f69b3e42b90bc0393b0cee3bfddd2678216 (diff)
parent30ef8c693c08e0b507851b93c1905f0de86ad384 (diff)
downloadrneovim-2debabb0805ccd014478e6aff88fce8129a352d0.tar.gz
rneovim-2debabb0805ccd014478e6aff88fce8129a352d0.tar.bz2
rneovim-2debabb0805ccd014478e6aff88fce8129a352d0.zip
Merge pull request #13355 from notomo/check-textlock-in-api
api: add textlock check
Diffstat (limited to 'src/nvim/generators')
-rw-r--r--src/nvim/generators/c_grammar.lua1
-rw-r--r--src/nvim/generators/gen_api_dispatch.lua17
2 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/generators/c_grammar.lua b/src/nvim/generators/c_grammar.lua
index de098b7a7b..c9ab0cf709 100644
--- a/src/nvim/generators/c_grammar.lua
+++ b/src/nvim/generators/c_grammar.lua
@@ -43,6 +43,7 @@ local c_proto = Ct(
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
(fill * Cg((P('FUNC_API_REMOTE_ONLY') * Cc(true)), 'remote_only') ^ -1) *
(fill * Cg((P('FUNC_API_LUA_ONLY') * Cc(true)), 'lua_only') ^ -1) *
+ (fill * Cg((P('FUNC_API_CHECK_TEXTLOCK') * Cc(true)), 'check_textlock') ^ -1) *
(fill * Cg((P('FUNC_API_REMOTE_IMPL') * Cc(true)), 'remote_impl') ^ -1) *
(fill * Cg((P('FUNC_API_BRIDGE_IMPL') * Cc(true)), 'bridge_impl') ^ -1) *
(fill * Cg((P('FUNC_API_COMPOSITOR_IMPL') * Cc(true)), 'compositor_impl') ^ -1) *
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua
index b31209e8ff..7e78b9e9d6 100644
--- a/src/nvim/generators/gen_api_dispatch.lua
+++ b/src/nvim/generators/gen_api_dispatch.lua
@@ -260,6 +260,13 @@ for i = 1, #functions do
args[#args + 1] = converted
end
+ if fn.check_textlock then
+ output:write('\n if (textlock != 0) {')
+ output:write('\n api_set_error(error, kErrorTypeException, "%s", e_secure);')
+ output:write('\n goto cleanup;')
+ output:write('\n }\n')
+ end
+
-- function call
local call_args = table.concat(args, ', ')
output:write('\n ')
@@ -393,6 +400,16 @@ local function process_function(fn)
}
]], fn.name))
end
+
+ if fn.check_textlock then
+ write_shifted_output(output, [[
+ if (textlock != 0) {
+ api_set_error(&err, kErrorTypeException, "%s", e_secure);
+ goto exit_0;
+ }
+ ]])
+ end
+
local cparams = ''
local free_code = {}
for j = #fn.parameters,1,-1 do