Mercurial > pub > dyncall > dyncall
annotate test/callback_suite_aggrs/main.c @ 561:d60f741e5eae
- test code comments
author | Tassilo Philipp |
---|---|
date | Sat, 03 Sep 2022 17:34:23 +0200 |
parents | 5e1002095afa |
children | f29db2bf3c0e |
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> |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
29 #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
|
30 #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
|
31 #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
|
32 #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
|
33 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
40 %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
|
41 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
|
42 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
|
43 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
|
44 -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
|
45 \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 ", 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
|
47 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 *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
|
58 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
|
59 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
|
60 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 -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
|
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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
68 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
|
69 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
|
70 int s = 0; |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
101 /* bounds check */ |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
102 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
|
103 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
|
104 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
|
105 s = 0; |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
106 } |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
107 } |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
108 |
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
|
109 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
|
110 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
114 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
|
115 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
|
116 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 ++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
|
118 ++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
|
119 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
125 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
|
126 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
128 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
|
129 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
|
130 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
132 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
|
133 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 case DC_SIGCHAR_AGGREGATE: |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
151 /* bounds check init */ |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
152 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
|
153 dcbArgAggr(input, V_a[pos]); |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
154 break; |
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
155 |
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
|
156 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
|
157 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
|
158 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 ++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
|
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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
163 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
|
164 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
166 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
188 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
|
189 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
205 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
|
206 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
|
207 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 /* 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
|
211 * 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
|
212 * 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
|
213 * 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
|
214 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
|
215 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
|
216 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 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
|
230 } |
548
a6d00ee46731
- dyncallback test: added aggregate arg bounds check
Tassilo Philipp
parents:
533
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 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
|
235 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
237 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
|
238 ++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
|
239 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
523
diff
changeset
|
244 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
|
245 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
|
246 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 /* 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
|
250 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
|
251 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
255 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
|
256 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
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 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
|
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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 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
|
268 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
|
269 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
|
270 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
|
271 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 #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
|
277 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
278 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
|
279 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
280 int from = 0, to = G_ncases-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
|
281 int i, pos = 0, total; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
282 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
283 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
|
284 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 /* 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
|
287 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
|
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 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
|
290 { |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in dyncall code and won't compile, though, as with call_suite_aggrs; dc code will be checked in, soon)
Tassilo Philipp
parents:
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 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
|
295 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
|
296 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
|
297 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
|
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 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
301 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
|
302 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
|
303 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
|
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 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
307 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
|
308 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 init_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
|
311 total = run_all(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
|
312 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
|
313 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 printf("result: callback_suite_aggrs: %d\n", total); |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 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
|
317 |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 return !total; |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 } |
cd46e111bc4c
- new test/callback_suite_aggrs (currently ahead of checked-in 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 |