Previous: , Up: Procedural Language Interpreter Types   [Index]


6.14.2.4 struct x1f4_dispatch_type

typedef struct x1f4_dispatch_type {
    int (*call)(void *, int, void *, struct x1f4_dispatch_type **);
    struct x1f4_transfer_type transfer;
    void *back;
} x1f4_dispatch_type;

The struct x1f4_dispatch_type record describes step by step aime coded function execution contexts.

See Step By Step Higher Order Function Execution.

The record is filled by the aime coded function caller and passed to the aime interpreter.

It describes the aime coded function to be executed as:

transfer

The transfer field enumerates the function to be executed (which may be C coded or aime coded), its input, output and executing context.

See struct x1f4_transfer_type.

One void * slot before input is expected defined and set as the function execution hook.

See Step By Step Higher Order Function Execution.

and the control returning procedure as:

back

The back field is the control returning context, passed as the first argument to the control returning method (hinted by the call field) and otherwise not interpreted.

call

The call field is the control returning method, called by the aime interpreter when the aime coded function execution completed. It is passed the control returning context (the back field pointer), the return of the C function (the function pointer in the transfer.function_data) implementing the logic of the executed function, the address at which the logic execution result is to be stored should the logic execution has completed, and the address of one struct x1f4_dispatch_type record address as arguments, in the indicated order.

The method should return zero for successful execution, non zero otherwise. Its non zero return will be examined against the defined error classes, and depending the result, the libaime interpreters will continue or stop the execution of program execution.

See Error Classes.

The method itself is allowed to resolve the success of function execution by the same criteria by examining its second argument, with zero indicating success, X1f4_E4_CAN_CONTINUE a recoverable error and non recoverable error otherwise. The error classes may not be observed by the executed function, but at the very least the method should assume a zero value means successful execution, non zero less than that.

See Limiting The Scope Of Errors.

The method is to set the address indicated by its last parameter for success. A NULL value will indicate the completion of the control transfer sequence, a non NULL value its continuation, with a new function to be executed as described by the transfer field of the pointed struct x1f4_dispatch_type record, and control to be reverted by call and back fields of the same record.


Previous: struct x1f4_a1screen_type, Up: Procedural Language Interpreter Types   [Index]