Mercurial > pub > dyncall > dyncall
annotate test/plain/test_aggrs.c @ 629:4754d195d2b5
(older) C conformance fix
author | Tassilo Philipp |
---|---|
date | Fri, 28 Oct 2022 15:34:49 +0200 |
parents | c477ddd64718 |
children | a388de1c822e |
rev | line source |
---|---|
0 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: test | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
5 File: test/plain/test_aggrs.c |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
6 Description: |
0 | 7 License: |
8 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
9 Copyright (c) 2022 Tassilo Philipp <tphilipp@potion-studios.com> |
0 | 10 |
11 Permission to use, copy, modify, and distribute this software for any | |
12 purpose with or without fee is hereby granted, provided that the above | |
13 copyright notice and this permission notice appear in all copies. | |
14 | |
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
22 | |
23 */ | |
24 | |
25 | |
26 | |
27 | |
28 #include "../../dyncall/dyncall.h" | |
29 #include "../../dyncall/dyncall_signature.h" | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
30 #include "../../dyncall/dyncall_aggregate.h" |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
31 #include <stdio.h> |
627 | 32 #include <stdarg.h> |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
33 |
0 | 34 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
35 #if defined(DC__Feature_AggrByVal) |
0 | 36 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
37 #if !defined(DC__OS_Win32) |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
38 # define __cdecl |
335
5fe52b7c6e02
- test/plain additions mainly for preparing future struct support, experimental at best currently
Tassilo Philipp
parents:
334
diff
changeset
|
39 #endif |
5fe52b7c6e02
- test/plain additions mainly for preparing future struct support, experimental at best currently
Tassilo Philipp
parents:
334
diff
changeset
|
40 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
41 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
42 unsigned char a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
43 } U8; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
44 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
45 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
46 unsigned char a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
47 double b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
48 } U8_Double; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
49 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
50 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
51 float a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
52 float b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
53 } Float_Float; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
54 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
55 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
56 double a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
57 unsigned char b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
58 } Double_U8; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
59 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
60 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
61 float f; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
62 } NestedFloat; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
63 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
64 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
65 int a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
66 NestedFloat b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
67 } Int_NestedFloat; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
68 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
69 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
70 double f; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
71 } NestedDouble; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
72 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
73 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
74 int a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
75 NestedDouble b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
76 } Int_NestedDouble; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
77 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
78 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
79 double a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
80 double b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
81 double c; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
82 } Three_Double; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
83 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
84 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
85 int a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
86 long long b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
87 } Int_LongLong; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
88 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
89 /* large struct: more than 8 int/ptr and 8 fp args, more than are passed by reg for both win and sysv for example */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
90 typedef struct { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
91 double a; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
92 double b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
93 double c; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
94 long long d; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
95 char e; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
96 char f; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
97 double g; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
98 double h; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
99 double i; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
100 float j; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
101 int k; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
102 float l; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
103 double m; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
104 short n; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
105 long o; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
106 int p; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
107 unsigned int q; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
108 long long r; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
109 } More_Than_Regs; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
110 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
111 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
112 static U8 __cdecl fun_return_u8(unsigned char a) { U8 r; r.a = a; return r; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
113 static U8_Double __cdecl fun_return_u8_double(unsigned char a, double b) { U8_Double r; r.a = a; r.b = b; return r; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
114 static Double_U8 __cdecl fun_return_double_u8(double a, unsigned char b) { Double_U8 r; r.a = a; r.b = b; return r; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
115 static Int_NestedFloat __cdecl fun_return_int_nested_float(int a, float b) { Int_NestedFloat r; r.a = a; r.b.f = b; return r; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
116 static Int_NestedDouble __cdecl fun_return_int_nested_double(int a, double b) { Int_NestedDouble r; r.a = a; r.b.f = b; return r; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
117 static Three_Double __cdecl fun_return_three_double(double a, double b, double c) { Three_Double r; r.a = a; r.b = b; r.c = c; return r; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
118 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
119 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
120 int testAggrReturns() |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
121 { |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
122 int ret = 1; |
0 | 123 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
124 DCCallVM* vm = dcNewCallVM(4096); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
125 dcMode(vm,DC_CALL_C_DEFAULT); |
0 | 126 { |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
127 U8 expected = fun_return_u8(5), returned = { 124 }; |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
128 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
129 DCaggr *s = dcNewAggr(1, sizeof(expected)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
130 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
131 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(U8, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
132 dcCloseAggr(s); |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
133 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
134 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
135 dcBeginCallAggr(vm, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
136 dcArgChar(vm, expected.a); |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
137 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
138 dcCallAggr(vm, (DCpointer) &fun_return_u8, s, &returned); |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
139 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
140 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
141 |
627 | 142 printf("C){C} (cdecl): %d\n", (returned.a == expected.a)); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
143 ret = returned.a == expected.a && ret; |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
144 } |
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
145 { |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
146 U8_Double expected = fun_return_u8_double(5, 5.5), returned = { 6, 7.8 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
147 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
148 DCaggr *s = dcNewAggr(2, sizeof(expected)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
149 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
150 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(U8_Double, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
151 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(U8_Double, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
152 dcCloseAggr(s); |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
153 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
154 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
155 dcBeginCallAggr(vm, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
156 dcArgChar(vm, expected.a); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
157 dcArgDouble(vm, expected.b); |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
158 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
159 dcCallAggr(vm, (DCpointer) &fun_return_u8_double, s, &returned); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
160 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
161 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
162 |
627 | 163 printf("Cd){Cd} (cdecl): %d\n", (returned.a == expected.a && returned.b == expected.b)); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
164 ret = returned.a == expected.a && returned.b == expected.b && ret; |
334
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
165 } |
1cf6a4a94aca
- better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents:
324
diff
changeset
|
166 { |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
167 Double_U8 expected = fun_return_double_u8(5.5, 42), returned = { 6.7, 8 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
168 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
169 DCaggr *s = dcNewAggr(2, sizeof(expected)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
170 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
171 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Double_U8, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
172 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(Double_U8, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
173 dcCloseAggr(s); |
0 | 174 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
175 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
176 dcBeginCallAggr(vm, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
177 dcArgDouble(vm, expected.a); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
178 dcArgChar(vm, expected.b); |
0 | 179 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
180 dcCallAggr(vm, (DCpointer) &fun_return_double_u8, s, &returned); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
181 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
182 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
183 |
627 | 184 printf("dC){dC} (cdecl): %d\n", (returned.a == expected.a && returned.b == expected.b)); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
185 ret = returned.a == expected.a && returned.b == expected.b && ret; |
0 | 186 } |
187 { | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
188 Int_NestedFloat expected = fun_return_int_nested_float(24, 2.5f), returned = { 25, { 3.5f } }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
189 DCaggr *s, *s_; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
190 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
191 s_ = dcNewAggr(1, sizeof(NestedFloat)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
192 dcAggrField(s_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
193 dcCloseAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
194 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
195 s = dcNewAggr(2, sizeof(expected)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
196 dcAggrField(s, DC_SIGCHAR_INT, offsetof(Int_NestedFloat, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
197 dcAggrField(s, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedFloat, b), 1, s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
198 dcCloseAggr(s); |
0 | 199 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
200 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
201 dcBeginCallAggr(vm, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
202 dcArgInt(vm, expected.a); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
203 dcArgFloat(vm, expected.b.f); |
0 | 204 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
205 dcCallAggr(vm, (DCpointer) &fun_return_int_nested_float, s, &returned); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
206 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
207 dcFreeAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
208 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
209 |
627 | 210 printf("if){i{f}} (cdecl): %d\n", (returned.a == expected.a && returned.b.f == expected.b.f)); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
211 ret = returned.a == expected.a && returned.b.f == expected.b.f && ret; |
0 | 212 } |
213 { | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
214 Int_NestedDouble expected = fun_return_int_nested_double(24, 2.5), returned = { 25, { 3.5f } }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
215 DCaggr *s, *s_; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
216 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
217 s_ = dcNewAggr(1, sizeof(NestedDouble)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
218 dcAggrField(s_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
219 dcCloseAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
220 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
221 s = dcNewAggr(2, sizeof(expected)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
222 dcAggrField(s, DC_SIGCHAR_INT, offsetof(Int_NestedDouble, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
223 dcAggrField(s, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedDouble, b), 1, s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
224 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
225 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
226 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
227 dcBeginCallAggr(vm, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
228 dcArgInt(vm, expected.a); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
229 dcArgDouble(vm, expected.b.f); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
230 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
231 dcCallAggr(vm, (DCpointer) &fun_return_int_nested_double, s, &returned); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
232 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
233 dcFreeAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
234 dcFreeAggr(s); |
0 | 235 |
627 | 236 printf("id){i{d}} (cdecl): %d\n", (returned.a == expected.a && returned.b.f == expected.b.f)); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
237 ret = returned.a == expected.a && returned.b.f == expected.b.f && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
238 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
239 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
240 Three_Double expected = fun_return_three_double(1.5, 2.5, 3.5), returned = { 2.5, 3.5, 4.5 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
241 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
242 DCaggr *s = dcNewAggr(3, sizeof(expected)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
243 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
244 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
245 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
246 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, c), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
247 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
248 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
249 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
250 dcBeginCallAggr(vm, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
251 dcArgDouble(vm, expected.a); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
252 dcArgDouble(vm, expected.b); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
253 dcArgDouble(vm, expected.c); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
254 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
255 dcCallAggr(vm, (DCpointer) &fun_return_three_double, s, &returned); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
256 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
257 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
258 |
627 | 259 printf("ddd){ddd} (cdecl): %d\n", (returned.a == expected.a && returned.b == expected.b && returned.c == expected.c)); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
260 ret = returned.a == expected.a && returned.b == expected.b && returned.c == expected.c && ret; |
0 | 261 } |
262 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
263 dcFree(vm); |
0 | 264 |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
265 return ret; |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
266 } |
0 | 267 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
268 static double __cdecl fun_take_u8(U8 s) { return s.a; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
269 static double __cdecl fun_take_u8_double(U8_Double s) { return s.a + s.b; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
270 static double __cdecl fun_take_float_float(Float_Float s) { return s.a + s.b; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
271 static double __cdecl fun_take_double_u8(Double_U8 s) { return s.a + s.b; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
272 static double __cdecl fun_take_int_nested_float(Int_NestedFloat s) { return s.a + s.b.f; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
273 static double __cdecl fun_take_int_nested_double(Int_NestedDouble s) { return s.a + s.b.f; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
274 static double __cdecl fun_take_three_double(Three_Double s) { return s.a + s.b + s.c; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
275 static double __cdecl fun_take_mixed_fp(double a, float b, float c, int d, float e, double f, float g, Three_Double s) { return a + 2.*b + 3.*c + 4.*d + 5.*e + 6.*f + 7.*g + 8.*s.a + 9.*s.b + 10.*s.c; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
276 static int __cdecl fun_take_iiiii_il(int a, int b, int c, int d, int e, Int_LongLong f) { return a + b + c + d + e + f.a + (int)f.b; } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
277 static double __cdecl fun_take_more_than_regs(More_Than_Regs s) { return s.a + s.b + s.c + s.d + s.e + s.f + s.g + s.h + s.i + s.j + s.k + s.l + s.m + s.n + s.o + s.p + s.q + s.r; } |
629 | 278 static double __cdecl fun_take_mixed_fp_vararg(double a, float b, float c, int d, ...) { double r = a + 2.*b + 3.*c + 4.*d; Three_Double s; va_list v; va_start(v,d); r += 5.*va_arg(v,double); r += 6.*va_arg(v,double); r += 7.*va_arg(v,double); s = va_arg(v,Three_Double); va_end(v); return r + 8.*s.a + 9.*s.b + 10.*s.c; } |
279 static int __cdecl fun_take_iiiii_il_vararg(int a, int b, int c, int d, int e, ...) { int r = a + b + c + d + e; Int_LongLong f; va_list v; va_start(v,e); f = va_arg(v,Int_LongLong); va_end(v); return r + f.a + (int)f.b; } | |
280 static double __cdecl fun_take_aggrs_vararg(Int_NestedDouble a, ...) { double r = a.a + a.b.f; Int_NestedFloat b; va_list v; va_start(v,a); b = va_arg(v,Int_NestedFloat); va_end(v); return r + b.a + b.b.f; } | |
0 | 281 |
282 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
283 int testAggrParameters() |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
284 { |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
285 int ret = 1; |
0 | 286 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
287 DCCallVM* vm = dcNewCallVM(4096); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
288 dcMode(vm,DC_CALL_C_DEFAULT); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
289 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
290 U8 t = { 5 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
291 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
292 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
293 DCaggr *s = dcNewAggr(1, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
294 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(U8, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
295 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
296 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
297 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
298 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
299 returned = dcCallDouble(vm, (DCpointer) &fun_take_u8); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
300 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
301 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
302 |
627 | 303 printf("{C})d (cdecl): %d\n", returned == t.a); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
304 ret = returned == t.a && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
305 } |
0 | 306 { |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
307 U8_Double t = { 5, 5.5 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
308 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
309 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
310 DCaggr *s = dcNewAggr(2, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
311 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(U8_Double, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
312 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(U8_Double, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
313 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
314 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
315 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
316 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
317 returned = dcCallDouble(vm, (DCpointer) &fun_take_u8_double); |
0 | 318 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
319 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
320 |
627 | 321 printf("{Cd})d (cdecl): %d\n", returned == t.a + t.b); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
322 ret = returned == t.a + t.b && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
323 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
324 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
325 Float_Float t = { 1.5, 5.5 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
326 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
327 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
328 DCaggr *s = dcNewAggr(2, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
329 dcAggrField(s, DC_SIGCHAR_FLOAT, offsetof(Float_Float, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
330 dcAggrField(s, DC_SIGCHAR_FLOAT, offsetof(Float_Float, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
331 dcCloseAggr(s); |
0 | 332 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
333 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
334 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
335 returned = dcCallDouble(vm, (DCpointer) &fun_take_float_float); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
336 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
337 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
338 |
627 | 339 printf("{ff})d (cdecl): %d\n", returned == t.a + t.b); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
340 ret = returned == t.a + t.b && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
341 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
342 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
343 Double_U8 t = { 5.5, 42 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
344 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
345 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
346 DCaggr *s = dcNewAggr(2, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
347 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Double_U8, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
348 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(Double_U8, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
349 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
350 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
351 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
352 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
353 returned = dcCallDouble(vm, (DCpointer) &fun_take_double_u8); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
354 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
355 dcFreeAggr(s); |
0 | 356 |
627 | 357 printf("{dC})d (cdecl): %d\n", returned == t.a + t.b); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
358 ret = returned == t.a + t.b && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
359 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
360 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
361 Int_NestedFloat t = { 24, { 2.5f } }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
362 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
363 DCaggr *s, *s_; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
364 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
365 s_ = dcNewAggr(1, sizeof(NestedFloat)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
366 dcAggrField(s_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
367 dcCloseAggr(s_); |
0 | 368 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
369 s = dcNewAggr(2, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
370 dcAggrField(s, DC_SIGCHAR_INT, offsetof(Int_NestedFloat, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
371 dcAggrField(s, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedFloat, b), 1, s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
372 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
373 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
374 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
375 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
376 returned = dcCallDouble(vm, (DCpointer) &fun_take_int_nested_float); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
377 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
378 dcFreeAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
379 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
380 |
627 | 381 printf("{i{f}})d (cdecl): %d\n", returned == t.a + t.b.f); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
382 ret = returned == t.a + t.b.f && ret; |
0 | 383 } |
384 { | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
385 Int_NestedDouble t = { 24, { 2.5} }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
386 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
387 DCaggr *s, *s_; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
388 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
389 s_ = dcNewAggr(1, sizeof(NestedDouble)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
390 dcAggrField(s_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
391 dcCloseAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
392 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
393 s = dcNewAggr(2, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
394 dcAggrField(s, DC_SIGCHAR_INT, offsetof(Int_NestedDouble, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
395 dcAggrField(s, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedDouble, b), 1, s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
396 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
397 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
398 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
399 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
400 returned = dcCallDouble(vm, (DCpointer) &fun_take_int_nested_double); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
401 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
402 dcFreeAggr(s_); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
403 dcFreeAggr(s); |
0 | 404 |
627 | 405 printf("{i{d}})d (cdecl): %d\n", returned == t.a + t.b.f); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
406 ret = returned == t.a + t.b.f && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
407 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
408 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
409 Three_Double t = { 1.5, 2.5, 3.5 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
410 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
411 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
412 DCaggr *s = dcNewAggr(3, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
413 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
414 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
415 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, c), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
416 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
417 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
418 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
419 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
420 returned = dcCallDouble(vm, (DCpointer) &fun_take_three_double); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
421 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
422 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
423 |
627 | 424 printf("{fff})d (cdecl): %d\n", returned == t.a + t.b + t.c); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
425 ret = returned == t.a + t.b + t.c && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
426 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
427 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
428 /* w/ some prev params, so not fitting into float regs anymore (on win and sysv) */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
429 Three_Double t = { 1.5, 2.5, 3.5 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
430 double returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
431 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
432 DCaggr *s = dcNewAggr(3, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
433 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
434 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
435 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, c), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
436 dcCloseAggr(s); |
0 | 437 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
438 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
439 dcArgDouble(vm, 234.4); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
440 dcArgFloat(vm, 34.4f); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
441 dcArgFloat(vm, 4.0f); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
442 dcArgInt(vm, -12); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
443 dcArgFloat(vm, -83.9f); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
444 dcArgDouble(vm, -.9); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
445 dcArgFloat(vm, .6f); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
446 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
447 returned = dcCallDouble(vm, (DCpointer) &fun_take_mixed_fp) + 84.; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
448 if(returned < 0.) |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
449 returned = -returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
450 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
451 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
452 |
627 | 453 printf("dffifdf{fff})d (cdecl): %d\n", returned < .00001); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
454 ret = returned < .00001 && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
455 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
456 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
457 Int_LongLong t = { -17, 822LL }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
458 int returned; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
459 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
460 DCaggr *s = dcNewAggr(2, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
461 dcAggrField(s, DC_SIGCHAR_INT, offsetof(Int_LongLong, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
462 dcAggrField(s, DC_SIGCHAR_LONGLONG, offsetof(Int_LongLong, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
463 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
464 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
465 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
466 dcArgInt(vm, 23); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
467 dcArgInt(vm, -211); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
468 dcArgInt(vm, 111); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
469 dcArgInt(vm, 34); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
470 dcArgInt(vm, -19290); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
471 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
472 returned = dcCallInt(vm, (DCpointer) &fun_take_iiiii_il); |
0 | 473 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
474 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
475 |
627 | 476 printf("iiiii{il})i (cdecl): %d\n", returned == -18528); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
477 ret = returned == -18528 && ret; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
478 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
479 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
480 More_Than_Regs t = { 1., 2., 3., 4, 5, 6, 7., 8., 9., 10.f, 11, 12.f, 13., 14, 15, 16, 17, 18 }; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
481 double returned; |
0 | 482 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
483 DCaggr *s = dcNewAggr(18, sizeof(t)); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
484 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, a), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
485 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, b), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
486 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, c), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
487 dcAggrField(s, DC_SIGCHAR_LONGLONG, offsetof(More_Than_Regs, d), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
488 dcAggrField(s, DC_SIGCHAR_CHAR, offsetof(More_Than_Regs, e), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
489 dcAggrField(s, DC_SIGCHAR_CHAR, offsetof(More_Than_Regs, f), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
490 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, g), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
491 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, h), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
492 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, i), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
493 dcAggrField(s, DC_SIGCHAR_FLOAT, offsetof(More_Than_Regs, j), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
494 dcAggrField(s, DC_SIGCHAR_INT, offsetof(More_Than_Regs, k), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
495 dcAggrField(s, DC_SIGCHAR_FLOAT, offsetof(More_Than_Regs, l), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
496 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(More_Than_Regs, m), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
497 dcAggrField(s, DC_SIGCHAR_SHORT, offsetof(More_Than_Regs, n), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
498 dcAggrField(s, DC_SIGCHAR_LONG, offsetof(More_Than_Regs, o), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
499 dcAggrField(s, DC_SIGCHAR_INT, offsetof(More_Than_Regs, p), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
500 dcAggrField(s, DC_SIGCHAR_UINT, offsetof(More_Than_Regs, q), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
501 dcAggrField(s, DC_SIGCHAR_LONGLONG, offsetof(More_Than_Regs, r), 1); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
502 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
503 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
504 dcReset(vm); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
505 dcArgAggr(vm, s, &t); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
506 returned = dcCallDouble(vm, (DCpointer) &fun_take_more_than_regs); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
507 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
508 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
509 |
627 | 510 printf("{dddlccdddfifdsjiIl})d (cdecl): %d\n", returned == 171.); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
511 ret = returned == 171. && ret; |
0 | 512 } |
627 | 513 { |
514 /* w/ some prev params, so not fitting into float regs anymore (on win and sysv) */ | |
515 Three_Double t = { 1.4, 3.6, 4.7 }; | |
516 double returned; | |
517 | |
518 DCaggr *s = dcNewAggr(3, sizeof(t)); | |
519 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, a), 1); | |
520 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, b), 1); | |
521 dcAggrField(s, DC_SIGCHAR_DOUBLE, offsetof(Three_Double, c), 1); | |
522 dcCloseAggr(s); | |
523 | |
524 dcReset(vm); | |
525 dcMode(vm,DC_CALL_C_ELLIPSIS); | |
526 dcArgDouble(vm, 234.6); | |
527 dcArgFloat(vm, 29.4f); | |
528 dcArgFloat(vm, 5.0f); | |
529 dcArgInt(vm, -11); | |
530 dcMode(vm,DC_CALL_C_ELLIPSIS_VARARGS); | |
531 dcArgDouble(vm, -83.9f); | |
532 dcArgDouble(vm, -.9); | |
533 dcArgDouble(vm, .6f); | |
534 dcArgAggr(vm, s, &t); | |
535 returned = dcCallDouble(vm, (DCpointer) &fun_take_mixed_fp_vararg) + 65.7; | |
536 if(returned < 0.) | |
537 returned = -returned; | |
538 | |
539 dcFreeAggr(s); | |
540 | |
541 printf("dffi.fdf{fff})d (cdecl): %d\n", returned < .00001); | |
542 ret = returned < .00001 && ret; | |
543 } | |
544 { | |
545 Int_LongLong t = { 71, -1177LL }; | |
546 int returned; | |
547 | |
548 DCaggr *s = dcNewAggr(2, sizeof(t)); | |
549 dcAggrField(s, DC_SIGCHAR_INT, offsetof(Int_LongLong, a), 1); | |
550 dcAggrField(s, DC_SIGCHAR_LONGLONG, offsetof(Int_LongLong, b), 1); | |
551 dcCloseAggr(s); | |
552 | |
553 dcReset(vm); | |
554 dcMode(vm,DC_CALL_C_ELLIPSIS); | |
555 dcArgInt(vm, 31); | |
556 dcArgInt(vm, -123); | |
557 dcArgInt(vm, 108); | |
558 dcArgInt(vm, 133); | |
559 dcArgInt(vm, -17933); | |
560 dcMode(vm,DC_CALL_C_ELLIPSIS_VARARGS); | |
561 dcArgAggr(vm, s, &t); | |
562 returned = dcCallInt(vm, (DCpointer) &fun_take_iiiii_il_vararg); | |
563 | |
564 dcFreeAggr(s); | |
565 | |
566 printf("iiiii.{il})i (cdecl): %d\n", returned == -18890); | |
567 ret = returned == -18890 && ret; | |
568 } | |
569 { | |
570 Int_NestedDouble t0 = { -64, { -6.6} }; | |
571 Int_NestedFloat t1 = { 112, { 7.5f } }; | |
572 int returned; | |
629 | 573 DCaggr *s0, *s0_, *s1, *s1_; |
627 | 574 |
629 | 575 s0_ = dcNewAggr(1, sizeof(NestedDouble)); |
627 | 576 dcAggrField(s0_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1); |
577 dcCloseAggr(s0_); | |
578 | |
629 | 579 s0 = dcNewAggr(2, sizeof(t0)); |
627 | 580 dcAggrField(s0, DC_SIGCHAR_INT, offsetof(Int_NestedDouble, a), 1); |
581 dcAggrField(s0, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedDouble, b), 1, s0_); | |
582 dcCloseAggr(s0); | |
583 | |
629 | 584 s1_ = dcNewAggr(1, sizeof(NestedFloat)); |
627 | 585 dcAggrField(s1_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1); |
586 dcCloseAggr(s1_); | |
587 | |
629 | 588 s1 = dcNewAggr(2, sizeof(t1)); |
627 | 589 dcAggrField(s1, DC_SIGCHAR_INT, offsetof(Int_NestedFloat, a), 1); |
590 dcAggrField(s1, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedFloat, b), 1, s1_); | |
591 dcCloseAggr(s1); | |
592 | |
593 dcReset(vm); | |
594 dcMode(vm,DC_CALL_C_ELLIPSIS); | |
595 dcArgAggr(vm, s0, &t0); | |
596 dcMode(vm,DC_CALL_C_ELLIPSIS_VARARGS); | |
597 dcArgAggr(vm, s1, &t1); | |
598 returned = dcCallDouble(vm, (DCpointer) &fun_take_aggrs_vararg) - 48.9; | |
599 | |
600 dcFreeAggr(s0_); | |
601 dcFreeAggr(s0); | |
602 dcFreeAggr(s1_); | |
603 dcFreeAggr(s1); | |
604 | |
605 printf("{i{d}}.{i{f}})d (cdecl): %d\n", returned < .00001); | |
606 ret = returned < .00001 && ret; | |
607 } | |
0 | 608 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
609 dcFree(vm); |
0 | 610 |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
141
diff
changeset
|
611 return ret; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
612 } |
0 | 613 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
614 #endif |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
335
diff
changeset
|
615 |