Mercurial > pub > dyncall > dyncall
annotate test/call_suite_aggrs/mk-cases.lua @ 519:99819b874bac
test/call_suite_aggrs:
- refactored generator code a bit to be simpler, write cleaner output, have better shareability and clarity
- added rtypes w/ default value nil to config.lua, to self document
- shared some code under test/common/
- fixed nonemptyaggrs sigs and cases.h (accidentally overwritten with cases having empty aggrs)
author | Tassilo Philipp |
---|---|
date | Mon, 11 Apr 2022 22:26:07 +0200 |
parents | 01f928eb9584 |
children | a2de1d0a73f3 |
rev | line source |
---|---|
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
1 require"config" |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
2 require"math" |
514 | 3 |
4 -- use shared helpers to generate cases | |
5 package.path = '../common/?.lua;' .. package.path | |
6 require"mk-cases" | |
7 | |
8 | |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
9 local max_numargs = 0 |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
10 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
11 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
12 |
496
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
13 function put_sig_rtype_first(sig) |
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
14 return sig:sub(sig:find(')')+1,-1)..sig:sub(1,sig:find(')')-1) |
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
15 end |
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
16 |
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
17 |
519 | 18 -- returns one case as str; accumulates unique idx => aggr-sig in aggrs |
19 -- (sequentially) and aggr-sig => {body,name} in seen_aggrs (depth first for | |
20 -- nested aggrs, so sub-aggrs conveniently precede parents) | |
21 function mkcase(id, sig, aggrs, seen_aggrs) | |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
22 local sig = trim(sig) |
496
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
23 local fsig = put_sig_rtype_first(sig) |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
24 local h = { "/* ",id,":",sig," */ " } |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
25 local t = { "" } |
510 | 26 local pos = -1 |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
27 local n_nest = 0 |
434
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
28 local aggr = { } |
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
29 local aggr_sig = { } |
519 | 30 aggr[0] = { } -- non-sequential [0] collects all non-aggr types (not used, though) |
434
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
31 aggr_sig[0] = '' |
496
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
32 for i = 1, #fsig do |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
33 local name = "a"..pos |
496
da5232da6270
- test code: rand-sig now spitting out dyncallish sigs (with ')' end delim and rettype at end), purely for consistency
Tassilo Philipp
parents:
485
diff
changeset
|
34 local ch = fsig:sub(i,i) |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
35 |
462 | 36 |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
37 -- aggregate nest level change? |
461 | 38 if ch == '{' or ch == '<' then |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
39 n_nest = n_nest + 1 |
434
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
40 aggr[n_nest] = { } |
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
41 aggr_sig[n_nest] = '' |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
42 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
43 |
434
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
44 aggr_sig[n_nest] = aggr_sig[n_nest]..ch |
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
45 |
462 | 46 -- array? Just append to name of member var from prev loop |
47 if ch:match('[%[%]0123456789]') ~= nil then | |
48 aggr[n_nest][#aggr[n_nest]] = aggr[n_nest][#aggr[n_nest]]..ch | |
49 else | |
519 | 50 -- register (sub)aggrs on closing char |
462 | 51 if ch == '}' or ch == '>' then |
519 | 52 -- only add unseen aggregates, key is aggr sig, val is body and name |
462 | 53 if seen_aggrs[aggr_sig[n_nest]] == nil then |
54 aggrs[#aggrs+1] = aggr_sig[n_nest] | |
519 | 55 if ch == '}' then ch = 'struct ' else ch = 'union ' end |
56 ch = ch..'A'..#aggrs | |
462 | 57 seen_aggrs[aggr_sig[n_nest]] = { aggr[n_nest], ch } |
58 end | |
59 ch = seen_aggrs[aggr_sig[n_nest]][2] | |
434
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
60 |
462 | 61 n_nest = n_nest - 1 |
62 aggr_sig[n_nest] = aggr_sig[n_nest]..aggr_sig[n_nest+1] | |
63 end | |
64 | |
519 | 65 -- add member type and var name to aggr |
462 | 66 if ch ~= '{' and ch ~= '}' and ch ~= '<' and ch ~= '>' then |
519 | 67 aggr[n_nest][#aggr[n_nest]+1] = ch |
462 | 68 aggr[n_nest][#aggr[n_nest]+1] = 'm'..(#aggr[n_nest] >> 1) |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
69 end |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
70 |
462 | 71 -- no nesting (= actual func args), generate case code |
72 if n_nest == 0 then | |
519 | 73 h[#h+1] = ch |
74 -- aggregate types have more than one char | |
462 | 75 if #h[#h] > 1 then |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
76 if aggrcpsimple then |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
77 t[#t+1] = '*('..h[#h]..'*)V_a['..pos.."]="..name..";" |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
78 else |
519 | 79 t[#t+1] = 'f_cp'..h[#h]:match('A.*')..'(V_a['..pos.."],&"..name..");" |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
80 end |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
81 if aggrmutabletest then |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
82 t[#t] = t[#t]..'memset(&'..name..',0,sizeof('..name..'));' |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
83 end |
462 | 84 else |
85 t[#t+1] = "V_"..ch.."["..pos.."]="..name..";" | |
86 end | |
87 | |
88 -- is return type or func arg? | |
510 | 89 if pos == -1 then |
462 | 90 h[#h+1] = " f"..id.."(" |
91 h[#h+1] = '' | |
92 t[#t] = '' -- clear; aggr return type handled explicitly | |
93 else | |
94 h[#h+1] = ' '..name | |
95 h[#h+1] = "," | |
96 end | |
97 | |
98 pos = pos + 1 | |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
99 end |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
100 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
101 end |
510 | 102 max_numargs = math.max(max_numargs, pos) |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
103 h[#h] = "){" |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
104 if #h[6] == 1 then |
510 | 105 t[#t+1] = "ret_"..h[6].."("..pos..")}\n" |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
106 else |
510 | 107 t[#t+1] = "ret_a("..pos..","..h[6]..")}\n" |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
108 end |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
109 return table.concat(h,"")..table.concat(t,"") |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
110 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
111 |
462 | 112 |
519 | 113 function mkaggrdefs(aggrs, seen_aggrs) |
114 local agg_defs = { } | |
115 local agg_sizes = { } | |
116 local agg_sigs = { } | |
117 local agg_names = { } | |
501
62c3746390da
- call_suite_aggrs: simplified and made output more consistent with dyncall sig style
Tassilo Philipp
parents:
500
diff
changeset
|
118 |
434
3d2c5d156d78
- test/suite_aggrs: support for nested structs, now
Tassilo Philipp
parents:
433
diff
changeset
|
119 for a = 1, #aggrs do |
462 | 120 local k = aggrs[a] |
121 local v = seen_aggrs[k] | |
519 | 122 local am = v[1] -- aggregate members |
123 local at = v[2] -- aggregate type | |
124 local an = at:match('A.*') -- aggregate name (w/o struct or union) | |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
125 |
461 | 126 -- aggregate def |
519 | 127 aggr_def = '/* '..k..' */\n' |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
128 if aggrpacking ~= 0 then |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
129 local pack = aggrpacking |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
130 if pack < 0 then |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
131 pack = math.floor(math.pow(2,math.floor(math.log(math.random(math.abs(pack)),2)))) |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
132 end |
519 | 133 aggr_def = aggr_def..'#pragma pack(push,'..pack..')\n' |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
134 end |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
135 |
519 | 136 aggr_def = aggr_def..at..' { ' |
462 | 137 for i = 1, #am, 2 do |
519 | 138 aggr_def = aggr_def..am[i]..' '..am[i+1]..'; ' |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
139 end |
519 | 140 aggr_def = aggr_def..'};\n' |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
141 |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
142 if aggrpacking ~= 0 then |
519 | 143 aggr_def = aggr_def..'#pragma pack(pop)\n' |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
144 end |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
145 |
461 | 146 -- aggregate cp and cmp funcs |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
147 s = { |
519 | 148 'void f_cp'..an..'('..at..' *x, const '..at..' *y) { ', |
149 'int f_cmp'..an..'(const '..at..' *x, const '..at..' *y) { return ' | |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
150 } |
441
e59e381b4fca
- suite_aggrs: silenced warning, generated real case list
Tassilo Philipp
parents:
438
diff
changeset
|
151 o = { '=', '==', 'f_cp', 'f_cmp', '; ', ' && ', '', '1' } |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
152 for t = 1, 2 do |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
153 if t ~= 1 or aggrcpsimple == false then |
519 | 154 aggr_def = aggr_def..s[t] |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
155 local b = {} |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
156 for i = 1, #am, 2 do |
519 | 157 local mn, mc = split_array_decl(am[i+1]) -- aggr member name and (array) count |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
158 local fmt = '' |
519 | 159 if mc ~= nil then -- need array suffixes? |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
160 fmt = '[%d]' |
462 | 161 else |
519 | 162 mc = 1 |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
163 end |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
164 |
519 | 165 for j = 1, mc do |
166 name = mn..fmt:format(j-1) | |
167 amn = am[i]:match('A.*') | |
168 if amn then -- is aggr? | |
169 b[#b+1] = o[t+2]..amn..'(&x->'..name..', &y->'..name..')' | |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
170 else |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
171 b[#b+1] = 'x->'..name..' '..o[t]..' y->'..name |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
172 end |
462 | 173 end |
174 end | |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
175 if #b == 0 then -- to handle empty aggregates |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
176 b[1] = o[t+6] |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
177 end |
519 | 178 aggr_def = aggr_def..table.concat(b,o[t+4])..'; };\n' |
179 end | |
180 end | |
181 | |
182 -- write convenient dcNewAggr() helper/wrapper funcs | |
183 aggr_def = aggr_def..'DCaggr* f_touchdcst'..an..'() {\n\tstatic DCaggr* a = NULL;\n\tif(!a) {\n\t\ta = dcNewAggr('..(#am>>1)..', sizeof('..at..'));\n\t\t' | |
184 for i = 1, #am, 2 do | |
185 local mn, mc = split_array_decl(am[i+1]) | |
186 if mc == nil then | |
187 mc = 1 | |
188 end | |
189 amn = am[i]:match('A.*') | |
190 if amn then -- is aggr? | |
191 --aggr_def = aggr_def..'dcAggrField(at, DC_SIGCHAR_AGGREGATE, offsetof('..at..', '..mn..'), '..mc..', f_touchdcst'..amn..'());\n\t\t' | |
192 aggr_def = aggr_def.."AFa("..at..','..mn..','..mc..','..amn..')\n\t\t' | |
193 else | |
194 --aggr_def = aggr_def.."dcAggrField(at, '"..am[i].."', offsetof("..at..', '..mn..'), '..mc..');\n\t\t' | |
195 aggr_def = aggr_def.."AF('"..am[i].."',"..at..','..mn..','..mc..')\n\t\t' | |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
196 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
197 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
198 |
519 | 199 agg_defs [#agg_defs + 1] = aggr_def..'dcCloseAggr(a);\n\t}\n\treturn a;\n};' |
200 agg_sizes[#agg_sizes + 1] = 'sizeof('..at..')' | |
201 agg_sigs [#agg_sigs + 1] = k | |
202 agg_names[#agg_names + 1] = an | |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
203 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
204 |
519 | 205 return agg_defs, agg_sizes, agg_sigs, agg_names |
206 end | |
207 | |
208 | |
209 function mkall() | |
210 local lineno = 0 | |
211 local sigtab = { } | |
212 local cases = '' | |
213 local aggrs = { } | |
214 local seen_aggrs = { } | |
215 | |
216 | |
217 for line in io.lines() do | |
218 local sig = trim(line) | |
219 cases = cases..mkcase(lineno, sig, aggrs, seen_aggrs) | |
220 sigtab[#sigtab+1] = sig | |
221 lineno = lineno + 1 | |
222 end | |
223 | |
224 local agg_defs, agg_sizes, agg_sigs, agg_names = mkaggrdefs(aggrs, seen_aggrs) | |
225 | |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
226 -- make table.concat work |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
227 if #agg_names > 0 then |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
228 table.insert(agg_names, 1, '') |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
229 end |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
230 |
519 | 231 io.write(table.concat(agg_defs,'\n')..'\n') |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
232 io.write(cases) |
512 | 233 io.write(mkfuntab(lineno, 'f', 'funptr', 'G_funtab', true)) |
234 io.write(mksigtab(sigtab, '', 'G_sigtab')) | |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
235 io.write('const char* G_agg_sigs[] = {\n\t"'..table.concat(agg_sigs, '",\n\t"')..'"\n};\n') |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
236 io.write('int G_agg_sizes[] = {\n\t'..table.concat(agg_sizes, ',\n\t')..'\n};\n') |
438 | 237 io.write('funptr G_agg_touchdcstfuncs[] = {'..string.sub(table.concat(agg_names, ',\n\t(funptr)&f_touchdcst'),2)..'\n};\n') |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
238 io.write('funptr G_agg_cmpfuncs[] = {'..string.sub(table.concat(agg_names, ',\n\t(funptr)&f_cmp'),2)..'\n};\n') |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
239 io.write("int G_maxargs = "..max_numargs..";\n") |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
240 end |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
241 |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
462
diff
changeset
|
242 math.randomseed(seed) |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
243 mkall() |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
244 |