annotate test/plain/test_aggrs.c @ 533:71c884e610f0

- integration of patches from Raphael Luba, Thekla, Inc.: * integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv) * windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.) * see Changelog for details - new calling convention modes for thiscalls (platform agnostic, was specific before) * new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL) - dcCallF(), dcVCallF(), dcArgF() and dcVArgF(): * added support for aggregates-by-value (wasn't part of patch) * change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change) - added macros to feature test implementation for aggregate-by-value and syscall support - changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order - doc: * man page updates to describe aggregate interface * manual overview changes to highlight platforms with aggregate-by-value support - test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author Tassilo Philipp
date Thu, 21 Apr 2022 13:35:47 +0200
parents test/plain/test_structs.c@5fe52b7c6e02
children c477ddd64718
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 Package: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
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
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 License:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
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
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 #include "../../dyncall/dyncall.h"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
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>
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
32
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
34 #if defined(DC__Feature_AggrByVal)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
36 #if !defined(DC__OS_Win32)
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
37 # define __cdecl
335
5fe52b7c6e02 - test/plain additions mainly for preparing future struct support, experimental at best currently
Tassilo Philipp
parents: 334
diff changeset
38 #endif
5fe52b7c6e02 - test/plain additions mainly for preparing future struct support, experimental at best currently
Tassilo Philipp
parents: 334
diff changeset
39
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
40 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
41 unsigned char a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
42 } U8;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
43
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
44 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
45 unsigned char a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
46 double b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
47 } U8_Double;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
48
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
49 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
50 float a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
51 float b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
52 } Float_Float;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
53
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
54 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
55 double a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
56 unsigned char b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
57 } Double_U8;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
58
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
59 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
60 float f;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
61 } NestedFloat;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
62
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
63 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
64 int a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
65 NestedFloat b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
66 } Int_NestedFloat;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
67
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
68 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
69 double f;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
70 } NestedDouble;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
71
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
72 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
73 int a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
74 NestedDouble b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
75 } Int_NestedDouble;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
76
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
77 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
78 double a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
79 double b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
80 double c;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
81 } Three_Double;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
82
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
83 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
84 int a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
85 long long b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
86 } Int_LongLong;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
87
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
88 /* 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
89 typedef struct {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
90 double a;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
91 double b;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
92 double c;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
93 long long d;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
94 char e;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
95 char f;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
96 double g;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
97 double h;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
98 double i;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
99 float j;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
100 int k;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
101 float l;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
102 double m;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
103 short n;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
104 long o;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
105 int p;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
106 unsigned int q;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
107 long long r;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
108 } More_Than_Regs;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
109
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 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
112 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
113 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
114 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
115 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
116 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
117
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 int testAggrReturns()
324
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
120 {
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
121 int ret = 1;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
122
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
123 DCCallVM* vm = dcNewCallVM(4096);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
124 dcMode(vm,DC_CALL_C_DEFAULT);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
126 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
127
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
128 DCaggr *s = dcNewAggr(1, sizeof(expected));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
129
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
130 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(U8, a), 1);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
131 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
132
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
133 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
134 dcBeginCallAggr(vm, s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
135 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
136
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
137 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
138
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
139 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
140
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
141 printf("r:{C} (cdecl): %d\n", (returned.a == expected.a));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
142 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
143 }
1cf6a4a94aca - better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents: 324
diff changeset
144 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
145 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
146
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
147 DCaggr *s = dcNewAggr(2, sizeof(expected));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
148
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
149 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
150 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
151 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
152
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
153 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
154 dcBeginCallAggr(vm, s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
155 dcArgChar(vm, expected.a);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
156 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
157
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
158 dcCallAggr(vm, (DCpointer) &fun_return_u8_double, s, &returned);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
159
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
160 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
161
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
162 printf("r:{Cd} (cdecl): %d\n", (returned.a == expected.a && returned.b == expected.b));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
163 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
164 }
1cf6a4a94aca - better output for plain test's struct size testing (maybe in prep for full struct support)
Tassilo Philipp
parents: 324
diff changeset
165 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
166 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
167
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
168 DCaggr *s = dcNewAggr(2, sizeof(expected));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
169
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
170 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
171 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
172 dcCloseAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
173
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
174 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
175 dcBeginCallAggr(vm, s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
176 dcArgDouble(vm, expected.a);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
177 dcArgChar(vm, expected.b);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
179 dcCallAggr(vm, (DCpointer) &fun_return_double_u8, s, &returned);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
180
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
181 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
182
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
183 printf("r:{dC} (cdecl): %d\n", (returned.a == expected.a && returned.b == expected.b));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
184 ret = returned.a == expected.a && returned.b == expected.b && ret;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
185 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
187 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
188 DCaggr *s, *s_;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
189
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
190 s_ = dcNewAggr(1, sizeof(NestedFloat));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
191 dcAggrField(s_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
192 dcCloseAggr(s_);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
193
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
194 s = dcNewAggr(2, sizeof(expected));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
195 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
196 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
197 dcCloseAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
198
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
199 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
200 dcBeginCallAggr(vm, s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
201 dcArgInt(vm, expected.a);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
202 dcArgFloat(vm, expected.b.f);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
203
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
204 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
205
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
206 dcFreeAggr(s_);
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
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
209 printf("r:{i{f}} (cdecl): %d\n", (returned.a == expected.a && returned.b.f == expected.b.f));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
210 ret = returned.a == expected.a && returned.b.f == expected.b.f && ret;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
211 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
212 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
213 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
214 DCaggr *s, *s_;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
215
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
216 s_ = dcNewAggr(1, sizeof(NestedDouble));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
217 dcAggrField(s_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
218 dcCloseAggr(s_);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
219
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
220 s = dcNewAggr(2, sizeof(expected));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
221 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
222 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
223 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
224
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
225 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
226 dcBeginCallAggr(vm, s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
227 dcArgInt(vm, expected.a);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
228 dcArgDouble(vm, expected.b.f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
229
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
230 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
231
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
232 dcFreeAggr(s_);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
233 dcFreeAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
234
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
235 printf("r:{i{d}} (cdecl): %d\n", (returned.a == expected.a && returned.b.f == expected.b.f));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
236 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
237 }
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 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
240
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
241 DCaggr *s = dcNewAggr(3, sizeof(expected));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
242
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
243 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
244 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
245 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
246 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
247
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
248 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
249 dcBeginCallAggr(vm, s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
250 dcArgDouble(vm, expected.a);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
251 dcArgDouble(vm, expected.b);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
252 dcArgDouble(vm, expected.c);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
253
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
254 dcCallAggr(vm, (DCpointer) &fun_return_three_double, s, &returned);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
255
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
256 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
257
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
258 printf("r:{ddd} (cdecl): %d\n", (returned.a == expected.a && returned.b == expected.b && returned.c == expected.c));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
259 ret = returned.a == expected.a && returned.b == expected.b && returned.c == expected.c && ret;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
260 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
261
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
262 dcFree(vm);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
263
324
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
264 return ret;
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
265 }
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
266
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
267 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
268 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
269 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
270 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
271 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
272 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
273 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
274 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
275 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
276 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; }
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
277
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
278
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
279 int testAggrParameters()
324
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
280 {
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
281 int ret = 1;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
282
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
283 DCCallVM* vm = dcNewCallVM(4096);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
284 dcMode(vm,DC_CALL_C_DEFAULT);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
285 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
286 U8 t = { 5 };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
287 double returned;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
288
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
289 DCaggr *s = dcNewAggr(1, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
290 dcAggrField(s, DC_SIGCHAR_UCHAR, offsetof(U8, a), 1);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
291 dcCloseAggr(s);
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 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
294 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
295 returned = dcCallDouble(vm, (DCpointer) &fun_take_u8);
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 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
298
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
299 printf("{C} (cdecl): %d\n", returned == t.a);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
300 ret = returned == t.a && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
301 }
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
302 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
303 U8_Double t = { 5, 5.5 };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
304 double returned;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
305
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
306 DCaggr *s = dcNewAggr(2, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
307 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
308 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
309 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
310
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
311 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
312 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
313 returned = dcCallDouble(vm, (DCpointer) &fun_take_u8_double);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
314
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
315 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
316
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
317 printf("{Cd} (cdecl): %d\n", returned == t.a + t.b);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
318 ret = returned == t.a + t.b && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
319 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
320 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
321 Float_Float t = { 1.5, 5.5 };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
322 double returned;
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 DCaggr *s = dcNewAggr(2, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
325 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
326 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
327 dcCloseAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
328
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
329 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
330 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
331 returned = dcCallDouble(vm, (DCpointer) &fun_take_float_float);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
332
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
333 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
334
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
335 printf("{ff} (cdecl): %d\n", returned == t.a + t.b);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
336 ret = returned == t.a + t.b && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
337 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
338 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
339 Double_U8 t = { 5.5, 42 };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
340 double returned;
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 DCaggr *s = dcNewAggr(2, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
343 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
344 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
345 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
346
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
347 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
348 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
349 returned = dcCallDouble(vm, (DCpointer) &fun_take_double_u8);
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 dcFreeAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
352
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
353 printf("{dC} (cdecl): %d\n", returned == t.a + t.b);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
354 ret = returned == t.a + t.b && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
355 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
356 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
357 Int_NestedFloat t = { 24, { 2.5f } };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
358 double returned;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
359 DCaggr *s, *s_;
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 s_ = dcNewAggr(1, sizeof(NestedFloat));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
362 dcAggrField(s_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
363 dcCloseAggr(s_);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
364
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
365 s = dcNewAggr(2, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
366 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
367 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
368 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
369
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
370 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
371 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
372 returned = dcCallDouble(vm, (DCpointer) &fun_take_int_nested_float);
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 dcFreeAggr(s_);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
375 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
376
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
377 printf("{i{f}} (cdecl): %d\n", returned == t.a + t.b.f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
378 ret = returned == t.a + t.b.f && ret;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
379 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
380 {
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
381 Int_NestedDouble t = { 24, { 2.5} };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
382 double returned;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
383 DCaggr *s, *s_;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
384
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
385 s_ = dcNewAggr(1, sizeof(NestedDouble));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
386 dcAggrField(s_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
387 dcCloseAggr(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(2, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
390 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
391 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
392 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
393
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
394 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
395 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
396 returned = dcCallDouble(vm, (DCpointer) &fun_take_int_nested_double);
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 dcFreeAggr(s_);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
399 dcFreeAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
400
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
401 printf("{i{d}} (cdecl): %d\n", returned == t.a + t.b.f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
402 ret = returned == t.a + t.b.f && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
403 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
404 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
405 Three_Double t = { 1.5, 2.5, 3.5 };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
406 double returned;
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 DCaggr *s = dcNewAggr(3, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
409 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
410 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
411 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
412 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
413
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
414 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
415 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
416 returned = dcCallDouble(vm, (DCpointer) &fun_take_three_double);
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 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
419
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
420 printf("{fff} (cdecl): %d\n", returned == t.a + t.b + t.c);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
421 ret = returned == t.a + t.b + t.c && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
422 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
423 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
424 /* 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
425 Three_Double t = { 1.5, 2.5, 3.5 };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
426 double returned;
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 DCaggr *s = dcNewAggr(3, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
429 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
430 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
431 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
432 dcCloseAggr(s);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
433
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
434 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
435 dcArgDouble(vm, 234.4);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
436 dcArgFloat(vm, 34.4f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
437 dcArgFloat(vm, 4.0f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
438 dcArgInt(vm, -12);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
439 dcArgFloat(vm, -83.9f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
440 dcArgDouble(vm, -.9);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
441 dcArgFloat(vm, .6f);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
442 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
443 returned = dcCallDouble(vm, (DCpointer) &fun_take_mixed_fp) + 84.;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
444 if(returned < 0.)
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
445 returned = -returned;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
446
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
447 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
448
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
449 printf("dffifdf{fff} (cdecl): %d\n", returned < .00001);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
450 ret = returned < .00001 && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
451 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
452 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
453 Int_LongLong t = { -17, 822LL };
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
454 int returned;
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 DCaggr *s = dcNewAggr(2, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
457 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
458 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
459 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
460
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
461 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
462 dcArgInt(vm, 23);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
463 dcArgInt(vm, -211);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
464 dcArgInt(vm, 111);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
465 dcArgInt(vm, 34);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
466 dcArgInt(vm, -19290);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
467 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
468 returned = dcCallInt(vm, (DCpointer) &fun_take_iiiii_il);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
469
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
470 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
471
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
472 printf("iiiii{il} (cdecl): %d\n", returned == -18528);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
473 ret = returned == -18528 && ret;
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
474 }
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
475 {
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
476 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
477 double returned;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
478
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
479 DCaggr *s = dcNewAggr(18, sizeof(t));
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 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
498 dcCloseAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
499
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
500 dcReset(vm);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
501 dcArgAggr(vm, s, &t);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
502 returned = dcCallDouble(vm, (DCpointer) &fun_take_more_than_regs);
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 dcFreeAggr(s);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
505
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
506 printf("{dddlccdddfifdsjiIl} (cdecl): %d\n", returned == 171.);
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
507 ret = returned == 171. && ret;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
508 }
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
509
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
510 dcFree(vm);
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
511
324
dd78bd0152af - removal of never-adopted mini-test framework stub
Tassilo Philipp
parents: 141
diff changeset
512 return ret;
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
513 }
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
514
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
515 #endif
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 335
diff changeset
516