Mercurial > pub > dyncall > dyncall
annotate test/call_suite_aggrs/cases.c @ 485:0c68b3f91367
- renamed suite_aggrs to call_suite_aggrs for consistency (callback version will be called callback_suite_aggrs)
author | Tassilo Philipp |
---|---|
date | Thu, 17 Mar 2022 15:41:26 +0100 |
parents | test/suite_aggrs/cases.c@0f3b6898078d |
children | 29d09d10ecd9 |
rev | line source |
---|---|
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
1 /* |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
2 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
3 Package: dyncall |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
4 Library: test |
485
0c68b3f91367
- renamed suite_aggrs to call_suite_aggrs for consistency (callback version will be called callback_suite_aggrs)
Tassilo Philipp
parents:
482
diff
changeset
|
5 File: test/call_suite_aggrs/cases.c |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
6 Description: |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
7 License: |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
8 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
9 Copyright (c) 2022 Tassilo Philipp <tphilipp@potion-studios.com> |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
10 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
11 Permission to use, copy, modify, and distribute this software for any |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
12 purpose with or without fee is hereby granted, provided that the above |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
13 copyright notice and this permission notice appear in all copies. |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
14 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
22 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
23 */ |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
24 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
25 #include "globals.h" |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
26 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
27 #define ret_v(X) |
433
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
28 #define ret_c(X) return(K_c[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
29 #define ret_s(X) return(K_s[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
30 #define ret_i(X) return(K_i[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
31 #define ret_j(X) return(K_j[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
32 #define ret_l(X) return(K_l[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
33 #define ret_p(X) return(K_p[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
34 #define ret_f(X) return(K_f[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
35 #define ret_d(X) return(K_d[X]); |
45662241d9cd
suite_aggrs now handling struct by value return types, also
Tassilo Philipp
parents:
432
diff
changeset
|
36 #define ret_a(X,t) return(*(t*)K_a[X]); |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
37 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
38 #define v void |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
39 #define c char |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
40 #define s short |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
41 #define i int |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
42 #define j long |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
43 #define l long long |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
44 #define p void* |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
45 #define f float |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
46 #define d double |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
47 #define a void* /* all generated aggregates */ |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
48 |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
461
diff
changeset
|
49 #define AF(c,t,i,n) dcAggrField(at,c,offsetof(t,i),n); |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
461
diff
changeset
|
50 #define AFa(t,i,n,f) dcAggrField(at,DC_SIGCHAR_AGGREGATE,offsetof(t,i),n,f_touchdcst##f()); |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
461
diff
changeset
|
51 |
440 | 52 #include "dyncall.h" |
482
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
461
diff
changeset
|
53 #include <string.h> |
0f3b6898078d
suite_aggrs (still ahead of checked in version of dyncall, sorry):
Tassilo Philipp
parents:
461
diff
changeset
|
54 |
446
54c1dc2e6ea5
suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
Tassilo Philipp
parents:
445
diff
changeset
|
55 |
461 | 56 /* Plan9 pcc and MSVC (when using C) do not allow empty structs */ |
454
68d98455a8bd
suite_aggrs: var scope change for older compilers; excluding msvc from tests with empty structs
Tassilo Philipp
parents:
446
diff
changeset
|
57 #if defined(DC__C_MSVC) || defined(DC__OS_Plan9) |
446
54c1dc2e6ea5
suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
Tassilo Philipp
parents:
445
diff
changeset
|
58 # include "nonemptystructs.h" |
54c1dc2e6ea5
suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
Tassilo Philipp
parents:
445
diff
changeset
|
59 #else |
54c1dc2e6ea5
suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
Tassilo Philipp
parents:
445
diff
changeset
|
60 # include "cases.h" |
54c1dc2e6ea5
suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
Tassilo Philipp
parents:
445
diff
changeset
|
61 #endif |
432
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
62 |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
63 int G_ncases = sizeof(G_sigtab)/sizeof(G_sigtab[0]); |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
64 int G_naggs = sizeof(G_agg_sigs)/sizeof(G_agg_sigs[0]); |
167faab0c0be
first usable version of test suite for aggregates, handling only non-nested struct params, at the moment;
Tassilo Philipp
parents:
diff
changeset
|
65 |