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