Next: Function Pointers Examples, Previous: Application Defined Function Pointer Variables, Up: Function Pointers [Index]
A function pointer assignment operator is made available by the object library.
See Object Library.
When the object library cannot be included, defining an assignment operator is still trivial when aime coded functions are not considered. The latter are fully referable objects and the operator will have to cater for updating their reference counters.
The operator will include the X1f4_E4_CALL_XSET
bit in its list of flags
and its (return) type and the types of its two operands will be set to
X1f4_E4_CALL
.
See Symbolic Types.
The function implementing its logic will copy the second operand both on output and over the first operand (the example below does not consider the aime coded functions, so this operator will not suffice for the procedural aime programs).
The operator may be defined as:
See Binary Operator Definition Example.
const struct x1f4_operator_type fp_assignment = { "=", assign, 0400, X1f4_E4_CALL, call2, X1f4_E4_BACK_LINK | X1f4_E4_CALL_XSET, 1, NULL, NULL };
See struct x1f4_operator_type.
int call2[] = { X1f4_E4_CALL, X1f4_E4_CALL };
int assign(void *context, void *output, void **input) { X1f4_E4_C_USER *in; X1f4_E4_C_USER *out; in = (X1f4_E4_C_USER *) input[1]; out = (X1f4_E4_C_USER *) input[0]; *out = *in; out = (X1f4_E4_C_USER *) output; *out = *in; return 0; }