view test/callback_suite/README.txt @ 457:90b1d927912a

- suite_aggrs: make sure random memory used doesn't ever result in NaN fp values (for every possible address), as this messes with result comparison
author Tassilo Philipp
date Fri, 28 Jan 2022 14:11:21 +0100
parents 3e629dc19168
children 45ac093ca822
line wrap: on
line source

Callback Test Suite 2 
---------------------

REQUIREMENTS
- dyncall
- ANSI C compiler
- lua (tested with 5.1)

CONFIGURE SUITE

  edit config.lua and run "make config".

DESCRIPTION

Generates a set of callback invokers in C using lua as a preprocessor.
The invokers put up an argument vector using a global Value-Matrix which
holds a specific type-specific value pattern as a function of position.

The Value-Matrix

The value-matrix is a data structure consisting of n x m elements of
type DCValueSet which can store distinct numbers for each type.

It is used in the body of the auto-generated callback invokers (C code).

The Callback Invocation Body

Example:
The body for a signature of type  "dpdf)p" at case id 19 is:

void f19(void* addr) 
{ 
  Result.p = ((CONFIG_API p(*)(d,p,d,f))addr)(ValueMatrix[0].d,ValueMatrix[1].p,ValueMatrix[2].d,ValueMatrix[3].f);
}              ^^^^^^^^^^- calling convention
                          ^^^^^^^^^^^^^- signature
         ^- return type signature
                                                  ^- arg signature char 0 (later expected) value


Result (type DCValue)  and ValueMatrix (type DCValueSet[MAXARGS]) are globals. 
The ValueMatrix is initialized once from main.c for all cominations of types
and argument position.
See env.* files for details.


Reference argument and result value

The value is generated by a pure function GetReferenceValue and
GetReferenceResult (file env.c). They have formals position and type 
and are pure without any side-effects (means the function value does only
relay on the input arguments - if called with same arguments it will reveal
the same value.

It defined in env.c.

Tssting for exotic calling conventions on Windows:

Specify 'api' and 'ccprefix' accordingly:


"__stdcall"	"_s"
"__fastcall"	"_f" for gcc compiler
		"_F" for microsoft compiler