Mercurial > pub > dyncall > dyncall
changeset 518:a0ff5dff090b
- callback_suite: generator simplification and removal of pointless lua local var declarations
author | Tassilo Philipp |
---|---|
date | Mon, 11 Apr 2022 15:06:44 +0200 |
parents | f8856e29b512 |
children | 99819b874bac |
files | test/callback_suite/mk-cases.lua |
diffstat | 1 files changed, 6 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/test/callback_suite/mk-cases.lua Mon Apr 11 14:50:35 2022 +0200 +++ b/test/callback_suite/mk-cases.lua Mon Apr 11 15:06:44 2022 +0200 @@ -18,7 +18,7 @@ if(c == '_') then -- filter out prefixes i = i + 1 else - args[#args+1] = c + args[#args+1] = c end i = i + 1 end @@ -27,24 +27,18 @@ function mkall() -- case macros - local i for i = minargs, maxargs do local line = "#define F" .. i .. "(ID,R" - local argdef = "" - local argset = "" + local argdef = { } + local argset = { } if i > 0 then line = line .. "," - local j for j = 0, i-1 do - if j > 0 then - argdef = argdef .. "," - argset = argset .. "," - end - argdef = argdef .. "M" .. j - argset = argset .. "K_##M" .. j .. "[" .. j .. "]" + argdef[#argdef+1] = "M" .. j + argset[#argset+1] = "K_##M" .. j .. "[" .. j .. "]" end end - line = line .. argdef .. ") void ID(void* addr) { write_V_##R(" .. i .. ", ((" .. api .. " R(*)(" .. argdef .. "))addr)(" .. argset .. "));}\n" + line = line .. table.concat(argdef,",") .. ") void ID(void* addr) { write_V_##R(" .. i .. ", ((" .. api .. " R(*)(" .. table.concat(argdef,",") .. "))addr)(" .. table.concat(argset,",") .. "));}\n" io.write(line) end