mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
5e59916e84
Problems: - Disables cross-compiling (alternative: keeps two hash implementations which need to be synchronized with each other). - Puts code-specific name literals into CMakeLists.txt. - Workaround for lua’s absence of bidirectional pipe communication is rather ugly.
35 lines
814 B
Lua
35 lines
814 B
Lua
local nvimsrcdir = arg[1]
|
|
local autodir = arg[2]
|
|
|
|
if nvimsrcdir == '--help' then
|
|
print([[
|
|
Usage:
|
|
lua geneval.lua src/nvim build/src/nvim/auto
|
|
|
|
Will generate build/src/nvim/auto/funcs.generated.h with definition of functions
|
|
static const array.
|
|
]])
|
|
os.exit(0)
|
|
end
|
|
|
|
package.path = nvimsrcdir .. '/?.lua;' .. package.path
|
|
|
|
local funcsfname = autodir .. '/funcs.generated.h'
|
|
|
|
local funcspipe = io.open(funcsfname .. '.hsh', 'w')
|
|
|
|
local funcs = require('eval')
|
|
|
|
for name, def in pairs(funcs.funcs) do
|
|
args = def.args or 0
|
|
if type(args) == 'number' then
|
|
args = {args, args}
|
|
elseif #args == 1 then
|
|
args[2] = 'MAX_FUNC_ARGS'
|
|
end
|
|
func = def.func or ('f_' .. name)
|
|
local val = ('{ %s, %s, &%s }'):format(args[1], args[2], func)
|
|
funcspipe:write(name .. '\n' .. val .. '\n')
|
|
end
|
|
funcspipe:close()
|