Next: Extended Execution Context, Previous: Pass By Reference Example, Up: Functions [Index]
A function specific data set may be supplied to the method implementing the function logic as its first argument.
To indicate that such provision should be made, the function definition must
include the X1f4_E4_TEXT_LINK bit in its flags field.
See Function Flags.
Whenever the expression parser picks up a reference to a function requiring a
specific execution context it calls the function_set.fix method of the
struct x1f4_e4_type expression parsing context, immediately
after the function_set.get call that looked up the function. The
function_set.fix method is supplied the function lookup context as first
argument (the function_set.context field in the parsing context) and the
function definition as the second (as retrieved via the immediately preceding
function_set.get call). The function_set.fix method is expected
to set the context reference (void pointer, that is) for which a reference is
passed as the third argument to the function specific execution context.
See struct x1f4_e4_type.
The function_set.fix method in the struct x1f4_e4_type
expression parsing context is used only to retrieve the function specific
execution contexts and only for functions requiring specific execution contexts
(and marked by the X1f4_E4_TEXT_LINK bit in their flags field
defitions).
Assuming ‘method13’ implementing the logic of some function having a
specific execution context, the function specific execution context can be
accessed context:
int
method13(void *context, void *output, void **input)
{
-context- is the function specific context
}