Mercurial > pub > dyncall > dyncall
comparison test/suite_aggrs/cases.h @ 432:167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
still missing:
- unions
- arrays
- aggregates as return values
author | Tassilo Philipp |
---|---|
date | Fri, 21 Jan 2022 15:42:29 +0100 |
parents | |
children | a29baee68340 |
comparison
equal
deleted
inserted
replaced
431:1cb8a65ea27f | 432:167faab0c0be |
---|---|
1 /* {ici} */ | |
2 struct A2{ i m0; c m1; i m2; }; | |
3 void f_cpA2(struct A2 *x, const struct A2 *y) { x->m0 = y->m0; x->m1 = y->m1; x->m2 = y->m2; }; | |
4 int f_cmpA2(const struct A2 *x, const struct A2 *y) { return x->m0 == y->m0 && x->m1 == y->m1 && x->m2 == y->m2; }; | |
5 DCstruct* f_newdcstA2() { DCstruct* st = dcNewStruct(3, sizeof(struct A2), 0, 1); dcStructField(st, 'i', offsetof(struct A2, m0), 1); dcStructField(st, 'c', offsetof(struct A2, m1), 1); dcStructField(st, 'i', offsetof(struct A2, m2), 1); dcCloseStruct(st); return st; }; | |
6 /* {ii} */ | |
7 struct A1{ i m0; i m1; }; | |
8 void f_cpA1(struct A1 *x, const struct A1 *y) { x->m0 = y->m0; x->m1 = y->m1; }; | |
9 int f_cmpA1(const struct A1 *x, const struct A1 *y) { return x->m0 == y->m0 && x->m1 == y->m1; }; | |
10 DCstruct* f_newdcstA1() { DCstruct* st = dcNewStruct(2, sizeof(struct A1), 0, 1); dcStructField(st, 'i', offsetof(struct A1, m0), 1); dcStructField(st, 'i', offsetof(struct A1, m1), 1); dcCloseStruct(st); return st; }; | |
11 /* {ps} */ | |
12 struct A5{ p m0; s m1; }; | |
13 void f_cpA5(struct A5 *x, const struct A5 *y) { x->m0 = y->m0; x->m1 = y->m1; }; | |
14 int f_cmpA5(const struct A5 *x, const struct A5 *y) { return x->m0 == y->m0 && x->m1 == y->m1; }; | |
15 DCstruct* f_newdcstA5() { DCstruct* st = dcNewStruct(2, sizeof(struct A5), 0, 1); dcStructField(st, 'p', offsetof(struct A5, m0), 1); dcStructField(st, 's', offsetof(struct A5, m1), 1); dcCloseStruct(st); return st; }; | |
16 /* {iiii} */ | |
17 struct A9{ i m0; i m1; i m2; i m3; }; | |
18 void f_cpA9(struct A9 *x, const struct A9 *y) { x->m0 = y->m0; x->m1 = y->m1; x->m2 = y->m2; x->m3 = y->m3; }; | |
19 int f_cmpA9(const struct A9 *x, const struct A9 *y) { return x->m0 == y->m0 && x->m1 == y->m1 && x->m2 == y->m2 && x->m3 == y->m3; }; | |
20 DCstruct* f_newdcstA9() { DCstruct* st = dcNewStruct(4, sizeof(struct A9), 0, 1); dcStructField(st, 'i', offsetof(struct A9, m0), 1); dcStructField(st, 'i', offsetof(struct A9, m1), 1); dcStructField(st, 'i', offsetof(struct A9, m2), 1); dcStructField(st, 'i', offsetof(struct A9, m3), 1); dcCloseStruct(st); return st; }; | |
21 /* {iii} */ | |
22 struct A8{ i m0; i m1; i m2; }; | |
23 void f_cpA8(struct A8 *x, const struct A8 *y) { x->m0 = y->m0; x->m1 = y->m1; x->m2 = y->m2; }; | |
24 int f_cmpA8(const struct A8 *x, const struct A8 *y) { return x->m0 == y->m0 && x->m1 == y->m1 && x->m2 == y->m2; }; | |
25 DCstruct* f_newdcstA8() { DCstruct* st = dcNewStruct(3, sizeof(struct A8), 0, 1); dcStructField(st, 'i', offsetof(struct A8, m0), 1); dcStructField(st, 'i', offsetof(struct A8, m1), 1); dcStructField(st, 'i', offsetof(struct A8, m2), 1); dcCloseStruct(st); return st; }; | |
26 /* {li} */ | |
27 struct A4{ l m0; i m1; }; | |
28 void f_cpA4(struct A4 *x, const struct A4 *y) { x->m0 = y->m0; x->m1 = y->m1; }; | |
29 int f_cmpA4(const struct A4 *x, const struct A4 *y) { return x->m0 == y->m0 && x->m1 == y->m1; }; | |
30 DCstruct* f_newdcstA4() { DCstruct* st = dcNewStruct(2, sizeof(struct A4), 0, 1); dcStructField(st, 'l', offsetof(struct A4, m0), 1); dcStructField(st, 'i', offsetof(struct A4, m1), 1); dcCloseStruct(st); return st; }; | |
31 /* {} */ | |
32 struct A6{ }; | |
33 void f_cpA6(struct A6 *x, const struct A6 *y) { 1; }; | |
34 int f_cmpA6(const struct A6 *x, const struct A6 *y) { return 1; }; | |
35 DCstruct* f_newdcstA6() { DCstruct* st = dcNewStruct(0, sizeof(struct A6), 0, 1); dcCloseStruct(st); return st; }; | |
36 /* {i} */ | |
37 struct A7{ i m0; }; | |
38 void f_cpA7(struct A7 *x, const struct A7 *y) { x->m0 = y->m0; }; | |
39 int f_cmpA7(const struct A7 *x, const struct A7 *y) { return x->m0 == y->m0; }; | |
40 DCstruct* f_newdcstA7() { DCstruct* st = dcNewStruct(1, sizeof(struct A7), 0, 1); dcStructField(st, 'i', offsetof(struct A7, m0), 1); dcCloseStruct(st); return st; }; | |
41 /* {il} */ | |
42 struct A3{ i m0; l m1; }; | |
43 void f_cpA3(struct A3 *x, const struct A3 *y) { x->m0 = y->m0; x->m1 = y->m1; }; | |
44 int f_cmpA3(const struct A3 *x, const struct A3 *y) { return x->m0 == y->m0 && x->m1 == y->m1; }; | |
45 DCstruct* f_newdcstA3() { DCstruct* st = dcNewStruct(2, sizeof(struct A3), 0, 1); dcStructField(st, 'i', offsetof(struct A3, m0), 1); dcStructField(st, 'l', offsetof(struct A3, m1), 1); dcCloseStruct(st); return st; }; | |
46 /* 0:viiiii{ii} */ v f0(i a1,i a2,i a3,i a4,i a5,struct A1 a6){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA1(V_a[6],&a6);ret_v(6)} | |
47 /* 1:viiiii{ici} */ v f1(i a1,i a2,i a3,i a4,i a5,struct A2 a6){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA2(V_a[6],&a6);ret_v(6)} | |
48 /* 2:viiiii{il} */ v f2(i a1,i a2,i a3,i a4,i a5,struct A3 a6){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA3(V_a[6],&a6);ret_v(6)} | |
49 /* 3:vfiiiii{il} */ v f3(f a1,i a2,i a3,i a4,i a5,i a6,struct A3 a7){V_f[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;V_i[6]=a6;f_cpA3(V_a[7],&a7);ret_v(7)} | |
50 /* 4:viiiiif{il} */ v f4(i a1,i a2,i a3,i a4,i a5,f a6,struct A3 a7){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;V_f[6]=a6;f_cpA3(V_a[7],&a7);ret_v(7)} | |
51 /* 5:viiiiif{li} */ v f5(i a1,i a2,i a3,i a4,i a5,f a6,struct A4 a7){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;V_f[6]=a6;f_cpA4(V_a[7],&a7);ret_v(7)} | |
52 /* 6:viiiii{il}f */ v f6(i a1,i a2,i a3,i a4,i a5,struct A3 a6,f a7){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA3(V_a[6],&a6);V_f[7]=a7;ret_v(7)} | |
53 /* 7:viiiii{li}f */ v f7(i a1,i a2,i a3,i a4,i a5,struct A4 a6,f a7){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA4(V_a[6],&a6);V_f[7]=a7;ret_v(7)} | |
54 /* 8:viiffiii{ps} */ v f8(i a1,i a2,f a3,f a4,i a5,i a6,i a7,struct A5 a8){V_i[1]=a1;V_i[2]=a2;V_f[3]=a3;V_f[4]=a4;V_i[5]=a5;V_i[6]=a6;V_i[7]=a7;f_cpA5(V_a[8],&a8);ret_v(8)} | |
55 /* 9:viiiiiff{li} */ v f9(i a1,i a2,i a3,i a4,i a5,f a6,f a7,struct A4 a8){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;V_f[6]=a6;V_f[7]=a7;f_cpA4(V_a[8],&a8);ret_v(8)} | |
56 /* 10:viiiiiff{il} */ v f10(i a1,i a2,i a3,i a4,i a5,f a6,f a7,struct A3 a8){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;V_f[6]=a6;V_f[7]=a7;f_cpA3(V_a[8],&a8);ret_v(8)} | |
57 /* 11:viiiii{il}ff */ v f11(i a1,i a2,i a3,i a4,i a5,struct A3 a6,f a7,f a8){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA3(V_a[6],&a6);V_f[7]=a7;V_f[8]=a8;ret_v(8)} | |
58 /* 12:viiiii{li}ff */ v f12(i a1,i a2,i a3,i a4,i a5,struct A4 a6,f a7,f a8){V_i[1]=a1;V_i[2]=a2;V_i[3]=a3;V_i[4]=a4;V_i[5]=a5;f_cpA4(V_a[6],&a6);V_f[7]=a7;V_f[8]=a8;ret_v(8)} | |
59 /* 13:i */ i f13(){ret_i(0)} | |
60 /* 14:i{} */ i f14(struct A6 a1){f_cpA6(V_a[1],&a1);ret_i(1)} | |
61 /* 15:i{i} */ i f15(struct A7 a1){f_cpA7(V_a[1],&a1);ret_i(1)} | |
62 /* 16:i{ii} */ i f16(struct A1 a1){f_cpA1(V_a[1],&a1);ret_i(1)} | |
63 /* 17:i{iii} */ i f17(struct A8 a1){f_cpA8(V_a[1],&a1);ret_i(1)} | |
64 /* 18:i{iiii} */ i f18(struct A9 a1){f_cpA9(V_a[1],&a1);ret_i(1)} | |
65 /* 19:f */ f f19(){ret_f(0)} | |
66 /* 20:f{} */ f f20(struct A6 a1){f_cpA6(V_a[1],&a1);ret_f(1)} | |
67 /* 21:f{i} */ f f21(struct A7 a1){f_cpA7(V_a[1],&a1);ret_f(1)} | |
68 /* 22:f{ii} */ f f22(struct A1 a1){f_cpA1(V_a[1],&a1);ret_f(1)} | |
69 /* 23:d{ii} */ d f23(struct A1 a1){f_cpA1(V_a[1],&a1);ret_d(1)} | |
70 /* 24:f{iii} */ f f24(struct A8 a1){f_cpA8(V_a[1],&a1);ret_f(1)} | |
71 /* 25:f{iiii} */ f f25(struct A9 a1){f_cpA9(V_a[1],&a1);ret_f(1)} | |
72 /* 26:ss{ii} */ s f26(s a1,struct A1 a2){V_s[1]=a1;f_cpA1(V_a[2],&a2);ret_s(2)} | |
73 funptr G_funtab[] = { | |
74 (funptr)&f0, | |
75 (funptr)&f1, | |
76 (funptr)&f2, | |
77 (funptr)&f3, | |
78 (funptr)&f4, | |
79 (funptr)&f5, | |
80 (funptr)&f6, | |
81 (funptr)&f7, | |
82 (funptr)&f8, | |
83 (funptr)&f9, | |
84 (funptr)&f10, | |
85 (funptr)&f11, | |
86 (funptr)&f12, | |
87 (funptr)&f13, | |
88 (funptr)&f14, | |
89 (funptr)&f15, | |
90 (funptr)&f16, | |
91 (funptr)&f17, | |
92 (funptr)&f18, | |
93 (funptr)&f19, | |
94 (funptr)&f20, | |
95 (funptr)&f21, | |
96 (funptr)&f22, | |
97 (funptr)&f23, | |
98 (funptr)&f24, | |
99 (funptr)&f25, | |
100 (funptr)&f26, | |
101 }; | |
102 char const * G_sigtab[] = { | |
103 "viiiii{ii}", | |
104 "viiiii{ici}", | |
105 "viiiii{il}", | |
106 "vfiiiii{il}", | |
107 "viiiiif{il}", | |
108 "viiiiif{li}", | |
109 "viiiii{il}f", | |
110 "viiiii{li}f", | |
111 "viiffiii{ps}", | |
112 "viiiiiff{li}", | |
113 "viiiiiff{il}", | |
114 "viiiii{il}ff", | |
115 "viiiii{li}ff", | |
116 "i", | |
117 "i{}", | |
118 "i{i}", | |
119 "i{ii}", | |
120 "i{iii}", | |
121 "i{iiii}", | |
122 "f", | |
123 "f{}", | |
124 "f{i}", | |
125 "f{ii}", | |
126 "d{ii}", | |
127 "f{iii}", | |
128 "f{iiii}", | |
129 "ss{ii}", | |
130 }; | |
131 const char* G_agg_sigs[] = { | |
132 "{ici}", | |
133 "{ii}", | |
134 "{ps}", | |
135 "{iiii}", | |
136 "{iii}", | |
137 "{li}", | |
138 "{}", | |
139 "{i}", | |
140 "{il}" | |
141 }; | |
142 int G_agg_sizes[] = { | |
143 sizeof(struct A2), | |
144 sizeof(struct A1), | |
145 sizeof(struct A5), | |
146 sizeof(struct A9), | |
147 sizeof(struct A8), | |
148 sizeof(struct A4), | |
149 sizeof(struct A6), | |
150 sizeof(struct A7), | |
151 sizeof(struct A3) | |
152 }; | |
153 funptr G_agg_newdcstfuncs[] = { | |
154 (funptr)&f_newdcstA2, | |
155 (funptr)&f_newdcstA1, | |
156 (funptr)&f_newdcstA5, | |
157 (funptr)&f_newdcstA9, | |
158 (funptr)&f_newdcstA8, | |
159 (funptr)&f_newdcstA4, | |
160 (funptr)&f_newdcstA6, | |
161 (funptr)&f_newdcstA7, | |
162 (funptr)&f_newdcstA3 | |
163 }; | |
164 funptr G_agg_cmpfuncs[] = { | |
165 (funptr)&f_cmpA2, | |
166 (funptr)&f_cmpA1, | |
167 (funptr)&f_cmpA5, | |
168 (funptr)&f_cmpA9, | |
169 (funptr)&f_cmpA8, | |
170 (funptr)&f_cmpA4, | |
171 (funptr)&f_cmpA6, | |
172 (funptr)&f_cmpA7, | |
173 (funptr)&f_cmpA3 | |
174 }; | |
175 int G_maxargs = 8; |