Mercurial > pub > dyncall > dyncall
comparison test/callback_suite/README.txt @ 508:1aa2af848e8a
- callback_suite: updated readme to reflect changes and general cleanup
author | Tassilo Philipp |
---|---|
date | Sat, 09 Apr 2022 14:44:33 +0200 |
parents | 5a3c07a0f376 |
children | f3d44195dbdf |
comparison
equal
deleted
inserted
replaced
507:5a3c07a0f376 | 508:1aa2af848e8a |
---|---|
1 Callback Test Suite 2 | 1 Callback Test Suite |
2 --------------------- | 2 ------------------- |
3 | 3 |
4 REQUIREMENTS | |
5 - dyncall | |
6 - ANSI C compiler | |
7 - lua (tested with 5.1) | |
8 | 4 |
9 CONFIGURE SUITE | 5 CONFIGURE SUITE |
10 | 6 |
11 edit config.lua and run "make config". | 7 needs lua: edit config.lua and run "make config". |
8 | |
12 | 9 |
13 DESCRIPTION | 10 DESCRIPTION |
14 | 11 |
15 Generates a set of callback invokers in C using lua as a preprocessor. | 12 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 | 13 |
19 The Value-Matrix | 14 The invokers pass arguments to the callback to test from a set of reference |
15 values which are argument type- and position-specific. | |
20 | 16 |
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 | 17 |
26 The Callback Invocation Body | 18 The Callback Invocation Body |
27 | 19 |
28 Example: | 20 Example: |
29 The body for a signature of type "dpdf)p" at case id 19 is: | 21 The body for a signature of type "dpdf)p" at case id 19 is: |
30 | 22 |
31 void f19(void* addr) | 23 void f19(void* addr) |
32 { | 24 { |
33 Result.p = ((CONFIG_API p(*)(d,p,d,f))addr)(ValueMatrix[0].d,ValueMatrix[1].p,ValueMatrix[2].d,ValueMatrix[3].f); | 25 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 | 26 } ^^^^^^^^^^- specific calling convention |
35 ^^^^^^^^^^^^^- signature | 27 ^^^^^^^^^^^^^- signature |
36 ^- return type signature | 28 ^- return type signature |
37 ^- arg signature char 0 (later expected) value | 29 ^- arg signature char 0 value (to be retrieved in handler) |
38 | 30 |
39 | 31 |
40 Result (type DCValue) and ValueMatrix (type DCValueSet[MAXARGS]) are globals. | 32 Result (type DCValue) and ValueMatrix (type DCValueSet[MAXARGS], holding the |
41 The ValueMatrix is initialized once from main.c for all combinations of types | 33 reference values) are globals, as well as an Args (type DCValue) array, which |
42 and argument position. | 34 is used by the callback handler to write the received argument values to. |
43 See globals.* files for details. | |
44 | 35 |
45 | 36 |
46 Reference argument and result value | 37 Reference argument and result value |
47 | 38 |
48 The value is generated by a pure function get_reference_arg and | 39 The reference values are generated by get_reference_arg() and |
49 get_reference_result (file globals.c). They have formals position and type | 40 get_reference_result(), which always return the exact same value for the a |
50 and are pure without any side-effects (means the function value does only | 41 given set of arguments. |
51 relay on the input arguments - if called with same arguments it will reveal | 42 ValueMatrix was filled by those functions and thus holds a temporary copy, |
52 the same value. | 43 which is useful to test whether any input argument was modified (which should |
44 never be the case). | |
53 | 45 |
54 It defined in globals.c. | |
55 | 46 |
56 Tssting for exotic calling conventions on Windows: | 47 Testing for exotic calling conventions on Windows |
57 | 48 |
58 Specify 'api' and 'ccprefix' accordingly: | 49 Specify 'api' and 'ccprefix' accordingly: |
59 | 50 |
60 | 51 |
61 "__stdcall" "_s" | 52 "__stdcall" "_s" |
62 "__fastcall" "_f" for gcc compiler | 53 "__fastcall" "_f" for gcc compiler |
63 "_F" for microsoft compiler | 54 "_F" for microsoft compiler |
64 | 55 |
56 See the dyncall documentation for other/more calling convention prefixes. | |
65 | 57 |
66 |