comparison test/callback_suite/globals.h @ 505:049e04af13c8

test/callback_suite: - greatly simplified - refactored to look more like other test cases (especially call_suite{,_aggrs} for consistency/maintainablity/future code sharing
author Tassilo Philipp
date Sat, 09 Apr 2022 13:53:58 +0200
parents test/callback_suite/env.h@d8f0e6cecdab
children f3d44195dbdf
comparison
equal deleted inserted replaced
504:f263eb7a206e 505:049e04af13c8
1 /*
2
3 Package: dyncall
4 Library: test
5 File: test/callback_suite/globals.h
6 Description:
7 License:
8
9 Copyright (c) 2011-2022 Daniel Adler <dadler@uni-goettingen.de>,
10 Tassilo Philipp <tphilipp@potion-studios.com>
11
12 Permission to use, copy, modify, and distribute this software for any
13 purpose with or without fee is hereby granted, provided that the above
14 copyright notice and this permission notice appear in all copies.
15
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
24 */
25
26 #include "dyncall_value.h"
27
28
29 #define DEF_NON_VOID_TYPES \
30 X(B,DCbool) \
31 X(c,DCchar) X(C,DCuchar) X(s,DCshort) X(S,DCushort) \
32 X(i,DCint) X(I,DCuint) X(j,DClong) X(J,DCulong) \
33 X(l,DClonglong) X(L,DCulonglong) \
34 X(f,DCfloat) X(d,DCdouble) \
35 X(p,DCpointer) X(Z,DCpointer)
36
37 #define DEF_TYPES \
38 X(v,DCvoid) \
39 DEF_NON_VOID_TYPES
40
41
42 typedef struct DCValueSet_
43 {
44 #define X(CH,T) T CH;
45 DEF_NON_VOID_TYPES
46 #undef X
47 } DCValueSet;
48 extern DCValueSet* ValueMatrix;
49
50 /* arguments filled-in by callback handlers, and return value */
51 extern DCValue* Args;
52 extern DCValue Result;
53
54
55 typedef void (*funptr)(void*);
56
57 extern funptr G_funtab[];
58 extern const char * G_sigtab[];
59 extern int G_ncases;
60 extern int G_maxargs;
61
62 void init_test_data();
63 void deinit_test_data();
64
65 /* function of type and position */
66 void get_reference_arg(DCValue* output, char type, int argpos);
67 /* function of type (position = -1) */
68 void get_reference_result(DCValue* output, char type);
69
70