Mercurial > pub > dyncall > dyncall
annotate test/callback_suite_aggrs/main.c @ 663:127b569978cc default tip
- another tweak handling clang trying to be too smart (see last commit)
author | Tassilo Philipp |
---|---|
date | Sun, 24 Mar 2024 13:52:44 +0100 |
parents | 57ad31f924bb |
children |
rev | line source |
---|---|
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
1 /* |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
2 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
3 Package: dyncall |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
4 Library: test |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
5 File: test/callback_suite_aggrs/main.c |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
6 Description: |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
7 License: |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
8 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
9 Copyright (c) 2022 Tassilo Philipp <tphilipp@potion-studios.com> |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
10 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
11 Permission to use, copy, modify, and distribute this software for any |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
12 purpose with or without fee is hereby granted, provided that the above |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
13 copyright notice and this permission notice appear in all copies. |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
14 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
22 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
23 */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
24 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
25 #include <stdio.h> |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
26 #include <stdlib.h> |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
27 #include <assert.h> |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
28 #include <string.h> |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
29 #include <signal.h> |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
30 #include <setjmp.h> |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
31 #include "dyncall_callback.h" |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
32 #include "globals.h" |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
33 #include "../common/platformInit.h" |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
34 #include "../common/platformInit.c" /* Impl. for functions only used in this translation unit */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
35 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
36 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
37 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
38 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
39 static void print_usage(const char* appName) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
40 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
41 printf("usage:\n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
42 %s [ from [to] ]\n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
43 where\n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
44 from, to: test range (0-based, runs single test if \"to\" is omitted)\n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
45 options\n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
46 -h help on usage\n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
47 \n\ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
48 ", appName); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
49 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
50 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
51 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
52 static int find_agg_idx(int* len, const char* sig) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
53 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
54 int i; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
55 for(i=0; i<G_naggs; ++i) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
56 const char* agg_sig = G_agg_sigs[i]; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
57 int l = strlen(agg_sig); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
58 if(len) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
59 *len = l; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
60 if(strncmp(agg_sig, sig, l) == 0) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
61 return i; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
62 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
63 return -1; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
64 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
65 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
66 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
67 static int cmp(const char* signature) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
68 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
69 char atype; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
70 const char* sig = signature; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
71 int pos = 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
72 int s = 0; |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
73 int do_bndck = 1; |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
74 while ( (atype = *sig) != '\0') { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
75 switch(atype) { |
550
5e1002095afa
- callback_suite_aggrs: enabling (non-standard) struct packing, by default (via #pragma, should be ignored by compilers not handling that)
Tassilo Philipp
parents:
548
diff
changeset
|
76 case '_': sig += 2; /* skip cconv prefix */ continue; |
5e1002095afa
- callback_suite_aggrs: enabling (non-standard) struct packing, by default (via #pragma, should be ignored by compilers not handling that)
Tassilo Philipp
parents:
548
diff
changeset
|
77 case ')': ++sig; /* skip ret type separator */ do_bndck = 0; /* no bounds check on retval, as we don't do its copy */ continue; |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
78 case 'v': s = (sig > signature) && sig[-1] == ')'; /* assure this was the return type */ break; /*TODO:check that no return-arg was touched.*/ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
79 case 'B': s = ( V_B[pos] == K_B[pos] ); if (!s) printf("'%c':%d: %d != %d ; ", atype, pos, V_B[pos], K_B[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
80 case 'c': s = ( V_c[pos] == K_c[pos] ); if (!s) printf("'%c':%d: %d != %d ; ", atype, pos, V_c[pos], K_c[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
81 case 's': s = ( V_s[pos] == K_s[pos] ); if (!s) printf("'%c':%d: %d != %d ; ", atype, pos, V_s[pos], K_s[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
82 case 'i': s = ( V_i[pos] == K_i[pos] ); if (!s) printf("'%c':%d: %d != %d ; ", atype, pos, V_i[pos], K_i[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
83 case 'j': s = ( V_j[pos] == K_j[pos] ); if (!s) printf("'%c':%d: %ld != %ld ; ", atype, pos, V_j[pos], K_j[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
84 case 'l': s = ( V_l[pos] == K_l[pos] ); if (!s) printf("'%c':%d: %lld != %lld ; ", atype, pos, V_l[pos], K_l[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
85 case 'C': s = ( V_C[pos] == K_C[pos] ); if (!s) printf("'%c':%d: %u != %u ; ", atype, pos, V_C[pos], K_C[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
86 case 'S': s = ( V_S[pos] == K_S[pos] ); if (!s) printf("'%c':%d: %u != %u ; ", atype, pos, V_S[pos], K_S[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
87 case 'I': s = ( V_I[pos] == K_I[pos] ); if (!s) printf("'%c':%d: %u != %u ; ", atype, pos, V_I[pos], K_I[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
88 case 'J': s = ( V_J[pos] == K_J[pos] ); if (!s) printf("'%c':%d: %lu != %lu ; ", atype, pos, V_J[pos], K_J[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
89 case 'L': s = ( V_L[pos] == K_L[pos] ); if (!s) printf("'%c':%d: %llu != %llu ; ", atype, pos, V_L[pos], K_L[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
90 case 'p': s = ( V_p[pos] == K_p[pos] ); if (!s) printf("'%c':%d: %p != %p ; ", atype, pos, V_p[pos], K_p[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
91 case 'f': s = ( V_f[pos] == K_f[pos] ); if (!s) printf("'%c':%d: %f != %f ; ", atype, pos, V_f[pos], K_f[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
92 case 'd': s = ( V_d[pos] == K_d[pos] ); if (!s) printf("'%c':%d: %f != %f ; ", atype, pos, V_d[pos], K_d[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
93 case '<': /* union */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
94 case '{': /* struct */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
95 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
96 /* no check: guaranteed to exist, or invoke func would've exited when passing args, above */ |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
97 int len, bndck_i; |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
98 int i = find_agg_idx(&len, sig); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
99 s = ((int(*)(const void*,const void*))G_agg_cmpfuncs[i])(V_a[pos], K_a[pos]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
100 if (!s) printf("'%c':%d: *%p != *%p ; ", atype, pos, V_a[pos], K_a[pos]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
101 sig += len-1; /* advance to next arg char; -1 to compensate for ++sig, below */ |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
102 |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
103 /* bounds check */ |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
104 for(bndck_i = 0; do_bndck && bndck_i < AGGR_BND_CHECK_PAD; ++bndck_i) { |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
105 if(((unsigned char*)V_a[pos] + G_agg_sizes[i])[bndck_i] != 0xab) { |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
106 printf("'%c':%d: buffer overflow retrieving aggr arg, target buffer of size %d too small; ", atype, pos, G_agg_sizes[i]); |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
107 s = 0; |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
108 } |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
109 } |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
110 |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
111 break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
112 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
113 default: printf("unknown atype '%c' ; ", atype); return 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
114 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
115 if(!s) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
116 printf("arg mismatch at %d ; ", pos); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
117 return 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
118 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
119 ++sig; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
120 ++pos; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
121 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
122 return 1; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
123 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
124 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
125 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
126 /* handler just copies all received args as well as return value into V_* */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
127 static char handler(DCCallback* that, DCArgs* input, DCValue* output, void* userdata) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
128 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
129 const char* signature = (const char*) userdata; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
130 int pos = 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
131 char ch; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
132 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
133 for(;;) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
134 ch = *signature++; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
135 if (!ch || ch == DC_SIGCHAR_ENDARG) break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
136 switch(ch) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
137 case DC_SIGCHAR_BOOL: V_B[pos] = dcbArgBool (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
138 case DC_SIGCHAR_CHAR: V_c[pos] = dcbArgChar (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
139 case DC_SIGCHAR_UCHAR: V_C[pos] = dcbArgUChar (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
140 case DC_SIGCHAR_SHORT: V_s[pos] = dcbArgShort (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
141 case DC_SIGCHAR_USHORT: V_S[pos] = dcbArgUShort (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
142 case DC_SIGCHAR_INT: V_i[pos] = dcbArgInt (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
143 case DC_SIGCHAR_UINT: V_I[pos] = dcbArgUInt (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
144 case DC_SIGCHAR_LONG: V_j[pos] = dcbArgLong (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
145 case DC_SIGCHAR_ULONG: V_J[pos] = dcbArgULong (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
146 case DC_SIGCHAR_LONGLONG: V_l[pos] = dcbArgLongLong (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
147 case DC_SIGCHAR_ULONGLONG: V_L[pos] = dcbArgULongLong(input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
148 case DC_SIGCHAR_FLOAT: V_f[pos] = dcbArgFloat (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
149 case DC_SIGCHAR_DOUBLE: V_d[pos] = dcbArgDouble (input); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
150 case DC_SIGCHAR_STRING: |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
151 case DC_SIGCHAR_POINTER: V_p[pos] = dcbArgPointer (input); break; |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
152 case DC_SIGCHAR_AGGREGATE: |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
153 /* bounds check init */ |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
154 memset(V_a[pos], 0xab, get_max_aggr_size() + AGGR_BND_CHECK_PAD); |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
155 dcbArgAggr(input, V_a[pos]); |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
156 break; |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
157 |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
158 case DC_SIGCHAR_CC_PREFIX: ++signature; /* skip cconv prefix */ continue; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
159 default: assert(0); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
160 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
161 ++pos; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
162 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
163 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
164 if(ch == DC_SIGCHAR_ENDARG) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
165 ch = *signature; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
166 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
167 /* write retval */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
168 switch(ch) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
169 case DC_SIGCHAR_VOID: /* nothing to set */ break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
170 case DC_SIGCHAR_BOOL: output->B = K_B[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
171 case DC_SIGCHAR_CHAR: output->c = K_c[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
172 case DC_SIGCHAR_UCHAR: output->C = K_C[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
173 case DC_SIGCHAR_SHORT: output->s = K_s[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
174 case DC_SIGCHAR_USHORT: output->S = K_S[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
175 case DC_SIGCHAR_INT: output->i = K_i[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
176 case DC_SIGCHAR_UINT: output->I = K_I[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
177 case DC_SIGCHAR_LONG: output->j = K_j[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
178 case DC_SIGCHAR_ULONG: output->J = K_J[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
179 case DC_SIGCHAR_LONGLONG: output->l = K_l[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
180 case DC_SIGCHAR_ULONGLONG: output->L = K_L[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
181 case DC_SIGCHAR_FLOAT: output->f = K_f[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
182 case DC_SIGCHAR_DOUBLE: output->d = K_d[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
183 case DC_SIGCHAR_STRING: |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
184 case DC_SIGCHAR_POINTER: output->p = K_p[pos]; break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
185 case DC_SIGCHAR_AGGREGATE: dcbReturnAggr(input, output, K_a[pos]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
186 default: assert(0); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
187 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
188 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
189 /* return type info for dyncallback */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
190 return ch; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
191 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
192 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
193 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
194 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
195 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
196 static int run_test(int id) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
197 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
198 const char* signature; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
199 DCCallback* pcb; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
200 int result; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
201 int len_sig; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
202 char *dc_sig; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
203 DCaggr **dc_aggrs; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
204 int n_aggrs = 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
205 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
206 /* index range: [0,nsigs[ */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
207 signature = G_sigtab[id]; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
208 printf("%d:%s", id, signature); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
209 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
210 len_sig = strlen(signature); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
211 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
212 /* prep dcbNewCallback() args: signature in dyncall format and array of |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
213 * DCaggr* descriptions; use len of verbose test-case sig, as always bigger |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
214 * than canonical/dyncall signature (where aggrs represented as single char) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
215 * number of aggregates in sig and */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
216 dc_sig = malloc(sizeof(char) *len_sig); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
217 dc_aggrs = malloc(sizeof(DCaggr*)*len_sig); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
218 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
219 len_sig = 0; /* len of canonical/dyncall sig */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
220 while(*signature != '\0') { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
221 switch(*signature) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
222 case '_': signature += 2; /* skip cconv prefix */ break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
223 case '<': /* union */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
224 case '{': /* struct */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
225 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
226 /* find aggregate sig */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
227 int len; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
228 int i = find_agg_idx(&len, signature); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
229 if(i == -1) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
230 printf("unknown aggr sig at '%s' ;", signature); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
231 return 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
232 } |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
233 dc_sig[len_sig++] = DC_SIGCHAR_AGGREGATE; |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
234 dc_aggrs[n_aggrs++] = ((DCaggr*(*)())G_agg_touchAfuncs[i])(); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
235 signature += len; /* advance to next arg char */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
236 break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
237 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
238 default: |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
239 dc_sig[len_sig++] = *signature; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
240 ++signature; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
241 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
242 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
243 dc_sig[len_sig] = '\0'; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
244 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
245 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
523
diff
changeset
|
246 pcb = dcbNewCallback2(dc_sig, handler, (void*)dc_sig, dc_aggrs); |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
247 assert(pcb != NULL); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
248 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
249 clear_V(); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
250 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
251 /* invoke call */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
252 G_funtab[id]((void*)pcb); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
253 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
254 result = cmp(G_sigtab[id]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
255 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
256 free(dc_sig); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
257 free(dc_aggrs); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
258 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
259 printf(":%d\n", result); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
260 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
261 dcbFreeCallback(pcb); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
262 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
263 return result; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
264 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
265 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
266 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
267 static int run_all(int from, int to) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
268 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
269 int i; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
270 int failure = 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
271 for(i=from; i<=to ;++i) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
272 failure |= !( run_test(i) ); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
273 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
274 return !failure; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
275 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
276 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
277 |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
278 jmp_buf jbuf; |
598 | 279 void sig_handler(int sig) |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
280 { |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
281 longjmp(jbuf, 1); |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
282 } |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
283 |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
284 |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
285 #define Error(X, Y, N) { fprintf(stderr, X, Y); print_usage(N); exit(1); } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
286 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
287 int main(int argc, char* argv[]) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
288 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
289 int from = 0, to = G_ncases-1; |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
290 int i, pos = 0, r = 0; |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
291 |
598 | 292 signal(SIGABRT, sig_handler); |
293 signal(SIGILL, sig_handler); | |
294 signal(SIGSEGV, sig_handler); | |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
295 #if !defined(DC_WINDOWS) |
598 | 296 signal(SIGBUS, sig_handler); |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
297 #endif |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
298 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
299 dcTest_initPlatform(); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
300 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
301 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
302 /* parse args */ |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
303 for(i=1; i<argc; ++i) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
304 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
305 if(argv[i][0] == '-') |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
306 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
307 switch(argv[i][1]) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
308 case 'h': |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
309 case '?': |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
310 print_usage(argv[0]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
311 return 0; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
312 default: |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
313 Error("invalid option: %s\n\n", argv[i], argv[0]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
314 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
315 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
316 switch(pos++) { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
317 case 0: from = to = atoi(argv[i]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
318 case 1: to = atoi(argv[i]); break; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
319 default: Error("too many arguments (%d given, 2 allowed)\n\n", pos, argv[0]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
320 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
321 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
322 if(from < 0 || to >= G_ncases || from > to) |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
323 Error("invalid arguments (provided from or to not in order or outside of range [0,%d])\n\n", G_ncases-1, argv[0]); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
324 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
325 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
326 init_test_data(); |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
327 if(setjmp(jbuf) == 0) |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
328 r = run_all(from, to); |
593
806e415df417
- aggr test suites output cosmetics on exceptions
Tassilo Philipp
parents:
592
diff
changeset
|
329 else |
806e415df417
- aggr test suites output cosmetics on exceptions
Tassilo Philipp
parents:
592
diff
changeset
|
330 printf("\n"); /* new line as current might be filled with garbage */ |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
331 |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
332 /* free all DCaggrs created on the fly (backwards b/c they are interdependency-ordered */ |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
333 for(i=G_naggs-1; i>=0; --i) |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
334 dcFreeAggr(((DCaggr*(*)())G_agg_touchAfuncs[i])()); |
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
335 |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
336 deinit_test_data(); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
337 |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
338 printf("result: callback_suite_aggrs: %d\n", r); |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
339 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
340 dcTest_deInitPlatform(); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
341 |
592
f29db2bf3c0e
- added exception handling to test/call{,back}_suite_aggrs
Tassilo Philipp
parents:
550
diff
changeset
|
342 return !r; |
523
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
343 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
344 |