annotate test/callback_suite_aggrs/mk-cases.lua @ 523:cd46e111bc4c

- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
author Tassilo Philipp
date Wed, 13 Apr 2022 14:59:57 +0200
parents
children 1b1abed0ea32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
523
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
1 require "config"
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
2
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
3 -- use shared helpers to generate cases
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
4 package.path = '../common/?.lua;' .. package.path
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
5 require"mk-cases"
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
6
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
7
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
8 -- returns: generated case str, num args; accumulates unique idx => aggr-sig in
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
9 -- aggrs (sequentially) and aggr-sig => {body,name} in seen_aggrs (depth first
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
10 -- for nested aggrs, so sub-aggrs conveniently precede parents)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
11 function mkcase(id, sig, aggrs, seen_aggrs)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
12 local sig = trim(sig)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
13 local fsig = put_sig_rtype_first(sig)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
14 local h = { "/* ",id,":",sig," */ " }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
15 local t = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
16 local pos = -1
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
17 local n_nest = 0
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
18 local aggr = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
19 local aggr_sig = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
20 aggr[0] = { } -- non-sequential [0] collects all non-aggr types (not used, though)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
21 aggr_sig[0] = ''
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
22 for i = 1, #fsig do
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
23 local name = "a"..pos
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
24 local ch = fsig:sub(i,i)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
25
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
26 -- @@@ not handling callconv prefixes
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
27
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
28 -- aggregate nest level change?
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
29 if ch == '{' or ch == '<' then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
30 n_nest = n_nest + 1
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
31 aggr[n_nest] = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
32 aggr_sig[n_nest] = ''
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
33 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
34
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
35 aggr_sig[n_nest] = aggr_sig[n_nest]..ch
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
36
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
37 -- array? Just append to name of member var from prev loop
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
38 if ch:match('[%[%]0123456789]') ~= nil then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
39 aggr[n_nest][#aggr[n_nest]] = aggr[n_nest][#aggr[n_nest]]..ch
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
40 else
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
41 -- register (sub)aggrs on closing char
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
42 if ch == '}' or ch == '>' then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
43 -- only add unseen aggregates, key is aggr sig, val is body and name
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
44 if seen_aggrs[aggr_sig[n_nest]] == nil then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
45 aggrs[#aggrs+1] = aggr_sig[n_nest]
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
46 if ch == '}' then ch = 'struct ' else ch = 'union ' end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
47 ch = ch..'A'..#aggrs
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
48 seen_aggrs[aggr_sig[n_nest]] = { aggr[n_nest], ch }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
49 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
50 ch = seen_aggrs[aggr_sig[n_nest]][2]
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
51
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
52 n_nest = n_nest - 1
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
53 aggr_sig[n_nest] = aggr_sig[n_nest]..aggr_sig[n_nest+1]
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
54 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
55
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
56 -- add member type and var name to aggr
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
57 if ch ~= '{' and ch ~= '}' and ch ~= '<' and ch ~= '>' then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
58 aggr[n_nest][#aggr[n_nest]+1] = ch
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
59 aggr[n_nest][#aggr[n_nest]+1] = 'm'..(#aggr[n_nest] >> 1)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
60 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
61
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
62 -- no nesting (= actual func args), generate case code
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
63 if n_nest == 0 then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
64 -- aggregate types have more than one char
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
65 if #ch > 1 then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
66 t[#t+1] = "*("..ch.."*)K_a["..pos.."]"
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
67 else
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
68 --t[#t+1] = "V_"..ch.."["..pos.."]="..name..";"
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
69 t[#t+1] = "K_"..ch.."["..pos.."]"
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
70 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
71
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
72 -- is return type or func arg?
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
73 if pos == -1 then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
74 h[#h+1] = "void f"..id.."(void* addr) { write_V_" -- @@@ not handling callconv prefixes
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
75 h[#h+1] = ch -- pos = 7
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
76 h[#h+1] = '('
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
77 h[#h+1] = -1 -- pos = 9; retval pos (=num args), will be set at end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
78 h[#h+1] = ', (( '..ch..'(*)('
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
79 t = { } -- clear; aggr return type handled explicitly
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
80 else
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
81 h[#h+1] = ch
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
82 h[#h+1] = ","
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
83 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
84
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
85 pos = pos + 1
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
86 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
87 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
88 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
89 e = ')'
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
90 -- retval is aggregate?
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
91 if #h[7] > 1 then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
92 e = '), '..h[7]
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
93 h[7] = 'a'
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
94 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
95 h[9] = pos
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
96 if h[#h] == ',' then h[#h] = '' end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
97 h[#h + 1] = "))addr)("
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
98 return table.concat(h,"")..table.concat(t,",")..e..");}\n", pos
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
99 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
100
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
101
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
102 function mkall()
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
103 local lineno = 0
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
104 local sigtab = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
105 local cases = ''
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
106 local aggrs = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
107 local seen_aggrs = { }
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
108 local max_numargs = 0
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
109
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
110 for line in io.lines() do
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
111 local sig = trim(line)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
112 local c, n = mkcase(lineno, sig, aggrs, seen_aggrs)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
113 cases = cases..c
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
114 max_numargs = math.max(max_numargs, n)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
115 sigtab[#sigtab+1] = sig
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
116 lineno = lineno + 1
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
117 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
118
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
119 local agg_defs, agg_sizes, agg_sigs, agg_names = mkaggrdefs(aggrs, seen_aggrs, aggrpacking, aggrpackingseed, aggrcpsimple)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
120
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
121 -- make table.concat work
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
122 if #agg_names > 0 then
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
123 table.insert(agg_names, 1, '')
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
124 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
125
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
126 io.write(table.concat(agg_defs,'\n')..'\n')
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
127 io.write(cases)
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
128 io.write(mkfuntab(lineno, 'f', 'funptr', 'G_funtab', true))
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
129 io.write(mksigtab(sigtab, '', 'G_sigtab'))
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
130 io.write('const char* G_agg_sigs[] = {\n\t"'..table.concat(agg_sigs, '",\n\t"')..'"\n};\n')
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
131 io.write('int G_agg_sizes[] = {\n\t'..table.concat(agg_sizes, ',\n\t')..'\n};\n')
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
132 io.write('funptr G_agg_touchAfuncs[] = {'..string.sub(table.concat(agg_names, ',\n\t(funptr)&f_touch'),2)..'\n};\n')
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
133 io.write('funptr G_agg_cmpfuncs[] = {'..string.sub(table.concat(agg_names, ',\n\t(funptr)&f_cmp'),2)..'\n};\n')
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
134 io.write("int G_maxargs = "..max_numargs..";\n")
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
135 end
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
136
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
137 mkall()
cd46e111bc4c - new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff changeset
138