aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/gen_api_ui_events.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/generators/gen_api_ui_events.lua')
-rwxr-xr-xsrc/nvim/generators/gen_api_ui_events.lua90
1 files changed, 15 insertions, 75 deletions
diff --git a/src/nvim/generators/gen_api_ui_events.lua b/src/nvim/generators/gen_api_ui_events.lua
index 93bbaab74c..827097f69d 100755
--- a/src/nvim/generators/gen_api_ui_events.lua
+++ b/src/nvim/generators/gen_api_ui_events.lua
@@ -3,14 +3,12 @@ local mpack = require('mpack')
local nvimdir = arg[1]
package.path = nvimdir .. '/?.lua;' .. package.path
-assert(#arg == 8)
+assert(#arg == 6)
local input = io.open(arg[2], 'rb')
-local proto_output = io.open(arg[3], 'wb')
-local call_output = io.open(arg[4], 'wb')
-local remote_output = io.open(arg[5], 'wb')
-local bridge_output = io.open(arg[6], 'wb')
-local metadata_output = io.open(arg[7], 'wb')
-local client_output = io.open(arg[8], 'wb')
+local call_output = io.open(arg[3], 'wb')
+local remote_output = io.open(arg[4], 'wb')
+local metadata_output = io.open(arg[5], 'wb')
+local client_output = io.open(arg[6], 'wb')
local c_grammar = require('generators.c_grammar')
local events = c_grammar.grammar:match(input:read('*all'))
@@ -75,17 +73,16 @@ local function call_ui_event_method(output, ev)
hlattrs_args_count = hlattrs_args_count + 1
elseif kind == 'Object' then
output:write('args.items['..(j-1)..'];\n')
+ elseif kind == 'Window' then
+ output:write('(Window)args.items['..(j-1)..'].data.integer;\n')
else
output:write('args.items['..(j-1)..'].data.'..string.lower(kind)..';\n')
end
end
- output:write(' ui_call_'..ev.name..'(')
+ output:write(' tui_'..ev.name..'(tui')
for j = 1, #ev.parameters do
- output:write('arg_'..j)
- if j ~= #ev.parameters then
- output:write(', ')
- end
+ output:write(', arg_'..j)
end
output:write(');\n')
@@ -103,12 +100,9 @@ for i = 1, #events do
ev.since = tonumber(ev.since)
if not ev.remote_only then
- proto_output:write(' void (*'..ev.name..')')
- write_signature(proto_output, ev, 'UI *ui')
- proto_output:write(';\n')
if not ev.remote_impl and not ev.noexport then
- remote_output:write('static void remote_ui_'..ev.name)
+ remote_output:write('void remote_ui_'..ev.name)
write_signature(remote_output, ev, 'UI *ui')
remote_output:write('\n{\n')
remote_output:write(' UIData *data = ui->data;\n')
@@ -117,62 +111,6 @@ for i = 1, #events do
remote_output:write(' push_call(ui, "'..ev.name..'", args);\n')
remote_output:write('}\n\n')
end
-
- if not ev.bridge_impl and not ev.noexport then
- local send, argv, recv, recv_argv, recv_cleanup = '', '', '', '', ''
- local argc = 1
- for j = 1, #ev.parameters do
- local param = ev.parameters[j]
- local copy = 'copy_'..param[2]
- if param[1] == 'String' then
- send = send..' String copy_'..param[2]..' = copy_string('..param[2]..');\n'
- argv = argv..', '..copy..'.data, INT2PTR('..copy..'.size)'
- recv = (recv..' String '..param[2]..
- ' = (String){.data = argv['..argc..'],'..
- '.size = (size_t)argv['..(argc+1)..']};\n')
- recv_argv = recv_argv..', '..param[2]
- recv_cleanup = recv_cleanup..' api_free_string('..param[2]..');\n'
- argc = argc+2
- elseif param[1] == 'Array' then
- send = send..' Array '..copy..' = copy_array('..param[2]..');\n'
- argv = argv..', '..copy..'.items, INT2PTR('..copy..'.size)'
- recv = (recv..' Array '..param[2]..
- ' = (Array){.items = argv['..argc..'],'..
- '.size = (size_t)argv['..(argc+1)..']};\n')
- recv_argv = recv_argv..', '..param[2]
- recv_cleanup = recv_cleanup..' api_free_array('..param[2]..');\n'
- argc = argc+2
- elseif param[1] == 'Object' then
- send = send..' Object *'..copy..' = xmalloc(sizeof(Object));\n'
- send = send..' *'..copy..' = copy_object('..param[2]..');\n'
- argv = argv..', '..copy
- recv = recv..' Object '..param[2]..' = *(Object *)argv['..argc..'];\n'
- recv_argv = recv_argv..', '..param[2]
- recv_cleanup = (recv_cleanup..' api_free_object('..param[2]..');\n'..
- ' xfree(argv['..argc..']);\n')
- argc = argc+1
- elseif param[1] == 'Integer' or param[1] == 'Boolean' then
- argv = argv..', INT2PTR('..param[2]..')'
- recv_argv = recv_argv..', PTR2INT(argv['..argc..'])'
- argc = argc+1
- else
- assert(false)
- end
- end
- bridge_output:write('static void ui_bridge_'..ev.name..
- '_event(void **argv)\n{\n')
- bridge_output:write(' UI *ui = UI(argv[0]);\n')
- bridge_output:write(recv)
- bridge_output:write(' ui->'..ev.name..'(ui'..recv_argv..');\n')
- bridge_output:write(recv_cleanup)
- bridge_output:write('}\n\n')
-
- bridge_output:write('static void ui_bridge_'..ev.name)
- write_signature(bridge_output, ev, 'UI *ui')
- bridge_output:write('\n{\n')
- bridge_output:write(send)
- bridge_output:write(' UI_BRIDGE_CALL(ui, '..ev.name..', '..argc..', ui'..argv..');\n}\n\n')
- end
end
if not (ev.remote_only and ev.remote_impl) then
@@ -185,6 +123,9 @@ for i = 1, #events do
call_output:write(' UI_LOG('..ev.name..');\n')
call_output:write(' ui_call_event("'..ev.name..'", args);\n')
elseif ev.compositor_impl then
+ call_output:write(' ui_comp_'..ev.name)
+ write_signature(call_output, ev, '', true)
+ call_output:write(";\n")
call_output:write(' UI_CALL')
write_signature(call_output, ev, '!ui->composed, '..ev.name..', ui', true)
call_output:write(";\n")
@@ -206,14 +147,14 @@ for i = 1, #events do
call_output:write("}\n\n")
end
- if (not ev.remote_only) and (not ev.noexport) and (not ev.client_impl) then
+ if (not ev.remote_only) and (not ev.noexport) and (not ev.client_impl) and (not ev.client_ignore) then
call_ui_event_method(client_output, ev)
end
end
local client_events = {}
for _,ev in ipairs(events) do
- if (not ev.noexport) and ((not ev.remote_only) or ev.client_impl) then
+ if (not ev.noexport) and ((not ev.remote_only) or ev.client_impl) and (not ev.client_ignore) then
client_events[ev.name] = ev
end
end
@@ -231,7 +172,6 @@ end
client_output:write('\n};\n\n')
client_output:write(hashfun)
-proto_output:close()
call_output:close()
remote_output:close()
client_output:close()