mirror of
https://github.com/neovim/neovim.git
synced 2024-12-21 19:55:04 -07:00
Merge #8570 'gen_events.lua: define NUM_EVENTS as enum'
This commit is contained in:
commit
b006771cba
@ -24,12 +24,12 @@ if(BUSTED_OUTPUT_TYPE STREQUAL junit)
|
||||
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{TEST_TAG})
|
||||
if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "")
|
||||
set(TEST_TAG "--tags=$ENV{TEST_TAG}")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{TEST_FILTER})
|
||||
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
|
||||
if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
|
||||
set(TEST_FILTER "--filter=$ENV{TEST_FILTER}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${WORKING_DIR}/Xtest-tmpdir)
|
||||
|
@ -25,25 +25,22 @@ static const struct event_name {
|
||||
} event_names[] = {]])
|
||||
|
||||
for i, event in ipairs(events) do
|
||||
if i > 1 then
|
||||
comma = ',\n'
|
||||
else
|
||||
comma = '\n'
|
||||
enum_tgt:write(('\n EVENT_%s = %u,'):format(event:upper(), i - 1))
|
||||
names_tgt:write(('\n {%u, "%s", EVENT_%s},'):format(#event, event, event:upper()))
|
||||
if i == #events then -- Last item.
|
||||
enum_tgt:write(('\n NUM_EVENTS = %u,'):format(i))
|
||||
end
|
||||
enum_tgt:write(('%s EVENT_%s = %u'):format(comma, event:upper(), i - 1))
|
||||
names_tgt:write(('%s {%u, "%s", EVENT_%s}'):format(comma, #event, event, event:upper()))
|
||||
end
|
||||
|
||||
for alias, event in pairs(aliases) do
|
||||
names_tgt:write((',\n {%u, "%s", EVENT_%s}'):format(#alias, alias, event:upper()))
|
||||
names_tgt:write(('\n {%u, "%s", EVENT_%s},'):format(#alias, alias, event:upper()))
|
||||
end
|
||||
|
||||
names_tgt:write(',\n {0, NULL, (event_T)0}')
|
||||
names_tgt:write('\n {0, NULL, (event_T)0},')
|
||||
|
||||
enum_tgt:write('\n} event_T;\n')
|
||||
names_tgt:write('\n};\n')
|
||||
|
||||
enum_tgt:write(('\n#define NUM_EVENTS %u\n'):format(#events))
|
||||
names_tgt:write('\nstatic AutoPat *first_autopat[NUM_EVENTS] = {\n ')
|
||||
line_len = 1
|
||||
for i = 1,((#events) - 1) do
|
||||
|
Loading…
Reference in New Issue
Block a user