comparison test/call_suite/main.c @ 527:ed8835abe05f

- cosmetics
author Tassilo Philipp
date Thu, 14 Apr 2022 10:13:10 +0200
parents c9c546f8598b
children 316c9d6f94a9
comparison
equal deleted inserted replaced
526:93628a1eaed4 527:ed8835abe05f
1 /* 1 /*
2 2
3 Package: dyncall 3 Package: dyncall
4 Library: test 4 Library: test
5 File: test/call_suite/main.c 5 File: test/call_suite/main.c
6 Description: 6 Description:
7 License: 7 License:
8 8
9 Copyright (c) 2011-2022 Daniel Adler <dadler@uni-goettingen.de>, 9 Copyright (c) 2011-2022 Daniel Adler <dadler@uni-goettingen.de>,
10 Tassilo Philipp <tphilipp@potion-studios.com> 10 Tassilo Philipp <tphilipp@potion-studios.com>
11 11
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 23
24 */ 24 */
25
26 25
27 #include "dyncall.h" 26 #include "dyncall.h"
28 #include "globals.h" 27 #include "globals.h"
29 #include <string.h> 28 #include <string.h>
30 #include "../common/platformInit.h" 29 #include "../common/platformInit.h"
42 char atype; 41 char atype;
43 int pos = 0; 42 int pos = 0;
44 int s = 0; 43 int s = 0;
45 44
46 clear_V(); 45 clear_V();
47 46
48 dcReset(p); 47 dcReset(p);
49 48
50 /* locate return type in sig; if no ')' separator, test failed */ 49 /* locate return type in sig; if no ')' separator, test failed */
51 rtype = strchr(sig, ')'); 50 rtype = strchr(sig, ')');
52 if(!rtype) { 51 if(!rtype) {
74 case 'd': dcArgDouble (p,K_d[pos]); break; 73 case 'd': dcArgDouble (p,K_d[pos]); break;
75 default: printf("unknown atype '%c' (1) ;", atype); return 0; 74 default: printf("unknown atype '%c' (1) ;", atype); return 0;
76 } 75 }
77 ++pos; 76 ++pos;
78 } 77 }
79 78
80 switch(*rtype) 79 switch(*rtype)
81 { 80 {
82 case 'v': dcCallVoid (p,t); s=1; break; /*TODO:check that no return-arg was touched.*/ 81 case 'v': dcCallVoid (p,t); s=1; break; /*TODO:check that no return-arg was touched.*/
83 case 'B': s = ( dcCallBool (p,t) == K_B[pos]); break; 82 case 'B': s = ( dcCallBool (p,t) == K_B[pos]); break;
84 case 'c': s = ( dcCallChar (p,t) == K_c[pos]); break; 83 case 'c': s = ( dcCallChar (p,t) == K_c[pos]); break;
85 case 's': s = ( dcCallShort (p,t) == K_s[pos]); break; 84 case 's': s = ( dcCallShort (p,t) == K_s[pos]); break;
128 } 127 }
129 return 1; 128 return 1;
130 } 129 }
131 130
132 static int run_test(int i) 131 static int run_test(int i)
133 { 132 {
134 char const * sig; 133 char const * sig;
135 void * target; 134 void * target;
136 int success; 135 int success;
137 sig = G_sigtab[i]; 136 sig = G_sigtab[i];
138 target = (void*) G_funtab[i]; 137 target = (void*) G_funtab[i];