view 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
line wrap: on
line source

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


CONFIGURE SUITE

  needs lua: edit config.lua and run "make config".


DESCRIPTION

Generates a set of callback invokers in C using lua as a preprocessor.

The invokers pass arguments to the callback to test from a set of reference
values which are argument type- and position-specific.


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);
}              ^^^^^^^^^^- specific calling convention
                          ^^^^^^^^^^^^^- signature
         ^- return type signature
                                                  ^- arg signature char 0 value (to be retrieved in handler)


Result (type DCValue) and ValueMatrix (type DCValueSet[MAXARGS], holding the
reference values) are globals, as well as an Args (type DCValue) array, which
is used by the callback handler to write the received argument values to.


Reference argument and result value

The reference values are generated by get_reference_arg() and
get_reference_result(), which always return the exact same value for the a
given set of arguments.
ValueMatrix was filled by those functions and thus holds a temporary copy,
which is useful to test whether any input argument was modified (which should
never be the case).


Testing for exotic calling conventions on Windows

Specify 'api' and 'ccprefix' accordingly:


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

See the dyncall documentation for other/more calling convention prefixes.