TPF_TC_OVERRIDE: Override a function call
This C/C++ macro overrides a call to a function or program name. You can specify a
different function, or you can specify no function.
Last updated
Added in 2019.
Format
maketpf_env += idevops
#include <tpf/c_devops.h>
void TPF_TC_OVERRIDE(char *function, void *call, void *data,
unsigned int length, char *scope);
- function
- A pointer to a string that contains a function name or a 4-character program name that you want to override.
- call
- A pointer to the function to call. If you specify NULL, the function or program that is specified by the function parameter is not overridden.
- data
- A pointer to optional additional data that you want to pass to the called function. To retrieve the data that is passed with this parameter, use the TPF_TC_GET_PROPERTY macro in the called function and specify TPF_TC_DATA for the property parameter.
- length
- The length of the data that is passed by the data parameter.
- scope
- A pointer to a function or program that calls the function or program that is specified by the function parameter. Specify this value when you want to limit the scope of the override to a specific function or program. The function or program specified by the function parameter will be overridden only when the function or program that you specify for the scope parameter is the caller. If you specify NULL for this parameter, the function or program specified by the function parameter is always overridden.
Normal return
None.
Error return
If a test case handle is not set, a DE1045 system error is issued and the ECB exits.
Programming considerations
- If you specify a C++ function name for the function, call, or scope parameter, you must use the mangled name of the function.
- If you specify an EVM address for the data parameter, the data is visible to only the ECB that obtained the storage.
- The prototype for the override function must match the prototype for the overridden function.
- Do not use this macro in production applications.
Examples
The following example skips all calls to the time function and calls
the my_time function
instead.
TPF_TC_OVERRIDE("time", my_time, NULL, 0, NULL);The following example shows how to end the override of the time
function.
TPF_TC_OVERRIDE("time", NULL, NULL, 0, NULL);