Mercurial > pub > dyncall > dyncall
comparison test/suite_aggrs/mk-cases.lua @ 441:e59e381b4fca
- suite_aggrs: silenced warning, generated real case list
author | Tassilo Philipp |
---|---|
date | Wed, 26 Jan 2022 14:33:31 +0100 |
parents | b4ddad459690 |
children | 236015fdf7a8 |
comparison
equal
deleted
inserted
replaced
440:e4ae6753a276 | 441:e59e381b4fca |
---|---|
141 -- struct cp and cmp funcs | 141 -- struct cp and cmp funcs |
142 s = { | 142 s = { |
143 'void f_cp'..v[2]..'('..st..' *x, const '..st..' *y) { ', | 143 'void f_cp'..v[2]..'('..st..' *x, const '..st..' *y) { ', |
144 'int f_cmp'..v[2]..'(const '..st..' *x, const '..st..' *y) { return ' | 144 'int f_cmp'..v[2]..'(const '..st..' *x, const '..st..' *y) { return ' |
145 } | 145 } |
146 o = { '=', '==', 'f_cp', 'f_cmp', '; ', ' && ' } | 146 o = { '=', '==', 'f_cp', 'f_cmp', '; ', ' && ', '', '1' } |
147 for t = 1, 2 do | 147 for t = 1, 2 do |
148 io.write(s[t]) | 148 io.write(s[t]) |
149 b = {} | 149 b = {} |
150 for i = 1, #v[1], 2 do | 150 for i = 1, #v[1], 2 do |
151 if string.match(v[1][i], '^struct') then | 151 if string.match(v[1][i], '^struct') then |
152 b[#b+1] = o[t+2]..v[1][i]:sub(8)..'(&x->'..v[1][i+1]..', &y->'..v[1][i+1]..')'; | 152 b[#b+1] = o[t+2]..v[1][i]:sub(8)..'(&x->'..v[1][i+1]..', &y->'..v[1][i+1]..')'; |
153 else | 153 else |
154 b[#b+1] = 'x->'..v[1][i+1]..' '..o[t]..' y->'..v[1][i+1]; | 154 b[#b+1] = 'x->'..v[1][i+1]..' '..o[t]..' y->'..v[1][i+1]; |
155 end | 155 end |
156 end | 156 end |
157 if #b == 0 then | 157 if #b == 0 then -- to handle empty structs |
158 b[1] = '1' -- to handle empty structs | 158 b[1] = o[t+6] |
159 end | 159 end |
160 io.write(table.concat(b,o[t+4]).."; };\n") | 160 io.write(table.concat(b,o[t+4]).."; };\n") |
161 end | 161 end |
162 | 162 |
163 -- convenient dcnewstruct helper funcs | 163 -- convenient dcnewstruct helper funcs |