Mercurial > pub > dyncall > dyncall
comparison test/callback_suite/make-signatures.lua @ 517:f8856e29b512
- tests: made "ordered" signature generation code shareable, and added possibility to specify return types, separately (mainly to include 'void')
author | Tassilo Philipp |
---|---|
date | Mon, 11 Apr 2022 14:50:35 +0200 |
parents | 1a813b706de4 |
children |
comparison
equal
deleted
inserted
replaced
516:1a813b706de4 | 517:f8856e29b512 |
---|---|
7 package.path = '../common/?.lua;' .. package.path | 7 package.path = '../common/?.lua;' .. package.path |
8 require"rand-sig" | 8 require"rand-sig" |
9 end | 9 end |
10 | 10 |
11 | 11 |
12 function orderedSignature(x) | |
13 local signature = "" | |
14 local typeindex | |
15 local nargtypes = #types | |
16 while x >= nargtypes do | |
17 typeindex = 1 + (x % nargtypes) | |
18 signature = signature .. string.sub(types, typeindex, typeindex) | |
19 x = math.floor( x / nargtypes ) | |
20 end | |
21 typeindex = 1 + x | |
22 signature = signature .. ")" .. string.sub(types, typeindex, typeindex) | |
23 return signature | |
24 end | |
25 | |
26 | |
27 function orderedSignatures() | 12 function orderedSignatures() |
28 local i | 13 package.path = '../common/?.lua;' .. package.path |
29 for i = 0, ncases-1 do | 14 require"ordered-sig" |
30 io.write( orderedSignature(offset+i*step) .. "\n" ) | |
31 end | |
32 end | 15 end |
33 | 16 |
34 | 17 |
35 function designedSignatures() | 18 function designedSignatures() |
36 for line in io.lines(designfile) do | 19 for line in io.lines(designfile) do |