Next: , Previous: struct x1f4_function_type, Up: Expression Evaluator Types


2.20.2.5 struct x1f4_operator_type

typedef struct x1f4_operator_type {
    const char *name;
    int (*operator) (void *, void *, void **), priority, type;
    const int *args;
    unsigned flags, length;
    const void *extension1, *extension2;
} x1f4_operator_type;

The struct x1f4_operator_type record describes symbolic operators.

name
The name field is the operator name. The characters making up the operator name must belong to the !, #, $, %, &, *, +, -, /, :, <, =, >, ?, @, ^, |, ~ set.
length
The length field is the operator name length, i.e. the number of characters (not including the terminal null) making up the operator name.
type
The type field is the operator symbolic type, i.e. the type to which it evaluates. It may be one of X1f4_E4_MODE, X1f4_E4_REAL and X1f4_E4_TEXT or it may indicate an application defined opaque type, case in which it is greater than X1f4_E4_LAST.

See Symbolic Types.

See Application Defined Types.

flags
The flags field is a bitwise OR of zero or more operator and function flag bits and infix binary operator flag bits or prefix unary operator flag.

See Infix Binary Operator Flags.

See Operator And Function Flags.

See Prefix Unary Operator Flags.

args
The args field indicates the type of operator arguments. It should point a memory location at which an int array of 1 for prefix unary operators and 2 for binary infix operators elements is stored. The type of one operator argument is indicated by the corresponding array element, i.e. the type of the first operator argument is indicated by the first array element, the type of the second operator argument is indicated by the second array element. The type of operator arguments may be one of X1f4_E4_MODE, X1f4_E4_REAL and X1f4_E4_TEXT or it may indicate an application defined opaque type, case in which it is greater than X1f4_E4_LAST.

See Symbolic Types.

See Application Defined Types.

operator
The operator field is the address of the routine performing the symbolic operator logic.

The routine is supplied three arguments when called. The first is the execution context, an application supplied pointer that is otherwise not interpreted by the expression evaluator. The second is the address at which the operator result is to be stored. The third is an array of addresses from which the operator arguments are to be read.

The routine is expected to return 0 if it completes execution successfully, non zero otherwise. In the later case the expression evaluation will be terminated.

priority
The priority field regulates the expression evaluation when different infix binary operators occur in the same expression evaluation scope. The operators are evaluated starting with the ones having the smalled priority values to the ones having the greatest priority values.

The priority field has no defined meaning for prefix unary operators.

Note that there is only one defined associativity, the left to right one.