Mercurial > pub > dyncall > dyncall
diff test/callback_suite/mk-cases.lua @ 509:f3d44195dbdf
callback_suite:
- further, big refactoring to make the test data setup be a lot more in line with call_suite and call_suite_aggrs
- added support to test void return values (was missing in prev version)
author | Tassilo Philipp |
---|---|
date | Sat, 09 Apr 2022 23:00:24 +0200 |
parents | 5a3c07a0f376 |
children | 95f6f43178ed |
line wrap: on
line diff
--- a/test/callback_suite/mk-cases.lua Sat Apr 09 14:44:33 2022 +0200 +++ b/test/callback_suite/mk-cases.lua Sat Apr 09 23:00:24 2022 +0200 @@ -2,8 +2,8 @@ function trim(l) return l:gsub("^%s+",""):gsub("%s+$","") end function mkcase(id,sig) - local nargs = string.len(sig) - 2 - local rtype = string.sub(sig, nargs + 2, nargs + 2) + local nargs = string.len(sig) - 2 -- @@@ wrong, b/c ignores callconv prefixes + local rtype = string.sub(sig, -1) local s = "F" .. nargs .. "(f" .. id .. "," .. rtype for i = 1, nargs do local type = string.sub(sig, i, i) @@ -52,10 +52,10 @@ argset = argset .. "," end argdef = argdef .. "M" .. j - argset = argset .. "M[" .. j .. "].M" .. j + argset = argset .. "K_##M" .. j .. "[" .. j .. "]" end end - line = line .. argdef .. ") void ID(void* addr) { Result.R = ((CONFIG_API R(*)(" .. argdef .. "))addr)(" .. argset .. ");}\n" + line = line .. argdef .. ") void ID(void* addr) { write_V_##R(" .. i .. ", ((CONFIG_API R(*)(" .. argdef .. "))addr)(" .. argset .. "));}\n" io.write(line) end