Next: , Previous: , Up: Function Pointers   [Index]

3.6.5 The Function Pointer Assignment Operator

A function pointer assignment operator is being made available by the object library.

See Object Library.

See Object Library Operators.

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.

See Binary Operator Flags.

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 = {
    X1f4_E4_BACK_LINK | X1f4_E4_CALL_XSET,

See struct x1f4_operator_type.

int call2[] = { X1f4_E4_CALL, X1f4_E4_CALL };
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;