mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
feat(tui): run TUI as external process
This commit is contained in:
@@ -60,6 +60,12 @@ for i = 6, #arg do
|
||||
if public and not fn.noexport then
|
||||
functions[#functions + 1] = tmp[j]
|
||||
function_names[fn.name] = true
|
||||
if #fn.parameters >= 2 and fn.parameters[2][1] == 'Array' and fn.parameters[2][2] == 'uidata' then
|
||||
-- function recieves the "args" as a parameter
|
||||
fn.receives_array_args = true
|
||||
-- remove the args parameter
|
||||
table.remove(fn.parameters, 2)
|
||||
end
|
||||
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
|
||||
-- this function should receive the channel id
|
||||
fn.receives_channel_id = true
|
||||
@@ -159,7 +165,7 @@ local exported_attributes = {'name', 'return_type', 'method',
|
||||
'since', 'deprecated_since'}
|
||||
local exported_functions = {}
|
||||
for _,f in ipairs(functions) do
|
||||
if not (startswith(f.name, "nvim__") or f.name == "nvim_error_event") then
|
||||
if not (startswith(f.name, "nvim__") or f.name == "nvim_error_event" or f.name == "redraw") then
|
||||
local f_exported = {}
|
||||
for _,attr in ipairs(exported_attributes) do
|
||||
f_exported[attr] = f[attr]
|
||||
@@ -264,11 +270,13 @@ for i = 1, #functions do
|
||||
output:write('\n '..rt..' '..converted..';')
|
||||
end
|
||||
output:write('\n')
|
||||
output:write('\n if (args.size != '..#fn.parameters..') {')
|
||||
output:write('\n api_set_error(error, kErrorTypeException, \
|
||||
"Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
if not fn.receives_array_args then
|
||||
output:write('\n if (args.size != '..#fn.parameters..') {')
|
||||
output:write('\n api_set_error(error, kErrorTypeException, \
|
||||
"Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
end
|
||||
|
||||
-- Validation/conversion for each argument
|
||||
for j = 1, #fn.parameters do
|
||||
@@ -350,12 +358,28 @@ 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 or fn.can_fail then
|
||||
output:write('channel_id, '..call_args)
|
||||
output:write('channel_id, ')
|
||||
if fn.receives_array_args then
|
||||
-- if the function recieves the array args, pass it the second argument
|
||||
output:write('args, ')
|
||||
end
|
||||
output:write(call_args)
|
||||
else
|
||||
output:write('channel_id')
|
||||
if fn.receives_array_args then
|
||||
output:write(', args')
|
||||
end
|
||||
end
|
||||
else
|
||||
output:write(call_args)
|
||||
if fn.receives_array_args then
|
||||
if #args > 0 or fn.call_fail then
|
||||
output:write('args, '..call_args)
|
||||
else
|
||||
output:write('args')
|
||||
end
|
||||
else
|
||||
output:write(call_args)
|
||||
end
|
||||
end
|
||||
|
||||
if fn.arena_return then
|
||||
|
Reference in New Issue
Block a user