Mercurial > pub > dyncall > dyncall
comparison test/callback_suite/make-signatures.lua @ 516:1a813b706de4
callback_suite: fixed 'ordered' mode config (was missing first line)
author | Tassilo Philipp |
---|---|
date | Sun, 10 Apr 2022 22:03:16 +0200 |
parents | 45ac093ca822 |
children | f8856e29b512 |
comparison
equal
deleted
inserted
replaced
515:c9c546f8598b | 516:1a813b706de4 |
---|---|
10 | 10 |
11 | 11 |
12 function orderedSignature(x) | 12 function orderedSignature(x) |
13 local signature = "" | 13 local signature = "" |
14 local typeindex | 14 local typeindex |
15 local nargtypes = string.len(types) | 15 local nargtypes = #types |
16 while true do | 16 while x >= nargtypes do |
17 if x < nargtypes then break end | 17 typeindex = 1 + (x % nargtypes) |
18 typeindex = 1 + math.mod(x, nargtypes) | |
19 signature = signature .. string.sub(types, typeindex, typeindex) | 18 signature = signature .. string.sub(types, typeindex, typeindex) |
20 x = math.floor( x / nargtypes ) | 19 x = math.floor( x / nargtypes ) |
21 end | 20 end |
22 typeindex = 1 + x | 21 typeindex = 1 + x |
23 signature = signature .. ")" .. string.sub(types, typeindex, typeindex) | 22 signature = signature .. ")" .. string.sub(types, typeindex, typeindex) |
25 end | 24 end |
26 | 25 |
27 | 26 |
28 function orderedSignatures() | 27 function orderedSignatures() |
29 local i | 28 local i |
30 for i = 1, ncases do | 29 for i = 0, ncases-1 do |
31 io.write( orderedSignature(offset+i*step) .. "\n" ) | 30 io.write( orderedSignature(offset+i*step) .. "\n" ) |
32 end | 31 end |
33 end | 32 end |
34 | 33 |
35 | 34 |