Mercurial > pub > dyncall > dyncall
annotate test/callback_suite/README.txt @ 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 | 45ac093ca822 |
children | 5a3c07a0f376 |
rev | line source |
---|---|
0 | 1 Callback Test Suite 2 |
2 --------------------- | |
3 | |
4 REQUIREMENTS | |
5 - dyncall | |
6 - ANSI C compiler | |
7 - lua (tested with 5.1) | |
8 | |
9 CONFIGURE SUITE | |
10 | |
11 edit config.lua and run "make config". | |
12 | |
13 DESCRIPTION | |
14 | |
15 Generates a set of callback invokers in C using lua as a preprocessor. | |
16 The invokers put up an argument vector using a global Value-Matrix which | |
17 holds a specific type-specific value pattern as a function of position. | |
18 | |
19 The Value-Matrix | |
20 | |
21 The value-matrix is a data structure consisting of n x m elements of | |
22 type DCValueSet which can store distinct numbers for each type. | |
23 | |
24 It is used in the body of the auto-generated callback invokers (C code). | |
25 | |
26 The Callback Invocation Body | |
27 | |
28 Example: | |
29 The body for a signature of type "dpdf)p" at case id 19 is: | |
30 | |
31 void f19(void* addr) | |
32 { | |
33 Result.p = ((CONFIG_API p(*)(d,p,d,f))addr)(ValueMatrix[0].d,ValueMatrix[1].p,ValueMatrix[2].d,ValueMatrix[3].f); | |
34 } ^^^^^^^^^^- calling convention | |
35 ^^^^^^^^^^^^^- signature | |
36 ^- return type signature | |
37 ^- arg signature char 0 (later expected) value | |
38 | |
39 | |
40 Result (type DCValue) and ValueMatrix (type DCValueSet[MAXARGS]) are globals. | |
505 | 41 The ValueMatrix is initialized once from main.c for all combinations of types |
0 | 42 and argument position. |
505 | 43 See globals.* files for details. |
0 | 44 |
45 | |
46 Reference argument and result value | |
47 | |
505 | 48 The value is generated by a pure function get_reference_arg and |
49 get_reference_result (file globals.c). They have formals position and type | |
0 | 50 and are pure without any side-effects (means the function value does only |
51 relay on the input arguments - if called with same arguments it will reveal | |
52 the same value. | |
53 | |
505 | 54 It defined in globals.c. |
0 | 55 |
56 Tssting for exotic calling conventions on Windows: | |
57 | |
58 Specify 'api' and 'ccprefix' accordingly: | |
59 | |
60 | |
495
45ac093ca822
- test/callback_suite: make it use shared random sig generator from call_suite and call_suite_aggrs
Tassilo Philipp
parents:
0
diff
changeset
|
61 "__stdcall" "_s" |
45ac093ca822
- test/callback_suite: make it use shared random sig generator from call_suite and call_suite_aggrs
Tassilo Philipp
parents:
0
diff
changeset
|
62 "__fastcall" "_f" for gcc compiler |
45ac093ca822
- test/callback_suite: make it use shared random sig generator from call_suite and call_suite_aggrs
Tassilo Philipp
parents:
0
diff
changeset
|
63 "_F" for microsoft compiler |
0 | 64 |
65 | |
505 | 66 @@@STRUCT review |
0 | 67 |