diff options
Diffstat (limited to 'src/nvim/generators')
-rw-r--r-- | src/nvim/generators/gen_api_dispatch.lua | 33 | ||||
-rw-r--r-- | src/nvim/generators/gen_api_ui_events.lua | 11 | ||||
-rw-r--r-- | src/nvim/generators/gen_options.lua | 14 | ||||
-rw-r--r-- | src/nvim/generators/nvim_version.lua.in | 2 |
4 files changed, 29 insertions, 31 deletions
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index 04b4363e42..62c99ce082 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -259,8 +259,12 @@ put('version') fixdict(1 + #version) for _, item in ipairs(version) do -- NB: all items are mandatory. But any error will be less confusing - -- with placholder vim.NIL (than invalid mpack data) - put(item[1], item[2] or vim.NIL) + -- with placeholder vim.NIL (than invalid mpack data) + local val = item[2] + if val == nil then + val = vim.NIL + end + put(item[1], val) end put('build', version_build) @@ -716,23 +720,6 @@ end -- start building lua output output = assert(io.open(lua_c_bindings_outputf, 'wb')) -output:write([[ -#include <lua.h> -#include <lualib.h> -#include <lauxlib.h> - -#include "nvim/ex_docmd.h" -#include "nvim/ex_getln.h" -#include "nvim/func_attr.h" -#include "nvim/globals.h" -#include "nvim/api/private/defs.h" -#include "nvim/api/private/helpers.h" -#include "nvim/api/private/dispatch.h" -#include "nvim/lua/converter.h" -#include "nvim/lua/executor.h" -#include "nvim/memory.h" - -]]) include_headers(output, headers) output:write('\n') @@ -913,7 +900,7 @@ exit_0: write_shifted_output(string.format( [[ if (lua_gettop(lstate) == 0) { - nlua_push_%s(lstate, %sret, true); + nlua_push_%s(lstate, %sret, kNluaPushSpecial | kNluaPushFreeRefs); } ]], return_type, @@ -927,10 +914,10 @@ exit_0: else local special = (fn.since ~= nil and fn.since < 11) write_shifted_output( - ' nlua_push_%s(lstate, %sret, %s);\n', + ' nlua_push_%s(lstate, %sret, %s | kNluaPushFreeRefs);\n', return_type, ret_mode, - tostring(special) + special and 'kNluaPushSpecial' or '0' ) end @@ -975,8 +962,6 @@ end output:write(string.format( [[ void nlua_add_api_functions(lua_State *lstate) - REAL_FATTR_NONNULL_ALL; -void nlua_add_api_functions(lua_State *lstate) { lua_createtable(lstate, 0, %u); ]], diff --git a/src/nvim/generators/gen_api_ui_events.lua b/src/nvim/generators/gen_api_ui_events.lua index 0808f71daa..516b5ad5ae 100644 --- a/src/nvim/generators/gen_api_ui_events.lua +++ b/src/nvim/generators/gen_api_ui_events.lua @@ -31,6 +31,10 @@ local function write_signature(output, ev, prefix, notype) end local function write_arglist(output, ev) + if #ev.parameters == 0 then + return + end + output:write(' MAXSIZE_TEMP_ARRAY(args, ' .. #ev.parameters .. ');\n') for j = 1, #ev.parameters do local param = ev.parameters[j] local kind = string.upper(param[1]) @@ -107,14 +111,14 @@ for i = 1, #events do end ev.since = tonumber(ev.since) + local args = #ev.parameters > 0 and 'args' or 'noargs' if not ev.remote_only then if not ev.remote_impl and not ev.noexport then remote_output:write('void remote_ui_' .. ev.name) write_signature(remote_output, ev, 'RemoteUI *ui') remote_output:write('\n{\n') - remote_output:write(' Array args = ui->call_buf;\n') write_arglist(remote_output, ev) - remote_output:write(' push_call(ui, "' .. ev.name .. '", args);\n') + remote_output:write(' push_call(ui, "' .. ev.name .. '", ' .. args .. ');\n') remote_output:write('}\n\n') end end @@ -124,9 +128,8 @@ for i = 1, #events do write_signature(call_output, ev, '') call_output:write('\n{\n') if ev.remote_only then - call_output:write(' Array args = call_buf;\n') write_arglist(call_output, ev) - call_output:write(' ui_call_event("' .. ev.name .. '", args);\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) diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua index 749844e658..0718d965c6 100644 --- a/src/nvim/generators/gen_options.lua +++ b/src/nvim/generators/gen_options.lua @@ -164,14 +164,24 @@ local function dump_option(i, o) if o.enable_if then w(get_cond(o.enable_if)) end + + -- An option cannot be both hidden and immutable. + assert(not o.hidden or not o.immutable) + + local has_var = true if o.varname then w(' .var=&' .. o.varname) - -- Immutable options can directly point to the default value. - elseif o.immutable then + elseif o.hidden or o.immutable then + -- Hidden and immutable options can directly point to the default value. w((' .var=&options[%u].def_val'):format(i - 1)) elseif #o.scope == 1 and o.scope[1] == 'window' then w(' .var=VAR_WIN') + else + has_var = false end + -- `enable_if = false` should be present iff there is no variable. + assert((o.enable_if == false) == not has_var) + w(' .hidden=' .. (o.hidden and 'true' or 'false')) w(' .immutable=' .. (o.immutable and 'true' or 'false')) if #o.scope == 1 and o.scope[1] == 'global' then w(' .indir=PV_NONE') diff --git a/src/nvim/generators/nvim_version.lua.in b/src/nvim/generators/nvim_version.lua.in index d0dbf77922..c29141fc68 100644 --- a/src/nvim/generators/nvim_version.lua.in +++ b/src/nvim/generators/nvim_version.lua.in @@ -2,7 +2,7 @@ return { {"major", ${NVIM_VERSION_MAJOR}}, {"minor", ${NVIM_VERSION_MINOR}}, {"patch", ${NVIM_VERSION_PATCH}}, - {"prerelease", "$NVIM_VERSION_PRERELEASE" ~= ""}, + {"prerelease", "${NVIM_VERSION_PRERELEASE}" ~= ""}, {"api_level", ${NVIM_API_LEVEL}}, {"api_compatible", ${NVIM_API_LEVEL_COMPAT}}, {"api_prerelease", ${NVIM_API_PRERELEASE}}, |