Next: struct x1f4_operator_type, Previous: struct x1f4_eerecord_type, Up: Expression Evaluator Types
typedef struct x1f4_function_type { const char *name; int (*function) (void *, void *, void **), type; const int *args; unsigned count, flags, length; } x1f4_function_type;
The struct x1f4_function_type
record describes symbolic functions.
name
name
field is the function name. A valid C identifier is expected
for the function name, thus the first character in the function name may be a
letter or an underscore (_
), while the rest may be letters, digits or
underscores (_
s).
length
length
field is the function name length, i.e. the number of
characters (not including the terminal null) making up the function name.
type
type
field is the function symbolic type, i.e. the type to which it
evaluates. It may be one of X1f4_E4_MODE
, X1f4_E4_REAL
,
X1f4_E4_TEXT
and X1f4_E4_VOID
or it may indicate an application
defined opaque type, case in which it is greater than X1f4_E4_LAST
.
See Symbolic Types.
flags
flags
field is a bitwise OR of zero or more operator and function
flag bits and function flag bits.
See Operator And Function Flags.
See Function Flags.
count
count
field indicates the function number of arguments.
args
args
field indicates the type of function arguments. It should
point a memory location at which an int
array of count
elements
is stored. The type of one function argument is indicated by the corresponding
array element, i.e. the type of the first function argument is indicated by the
first array element, the type of the second function argument is indicated by
the second array element and so on. The type of function 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.
If the function definition includes flags lists for function arguments (and
thus X1f4_E4_POST_TYPE
bit is present in the flags
field) the
args
array is expected to be double allocated to provide for argument
flags lists.
Thus, the next count
elements in the args
following the first
count
elements specify the flags lists of the function arguments.
The function argument flags lists are interpreted as bitwise ORs of zero or more operator and function argument flag bits.
These extra args
elements are observed by the expression evaluator if
and only if the X1f4_E4_POST_TYPE
bit is present in the flags
field of the function definition.
function
function
field is the address of the routine performing the symbolic
function 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 function result, if any, is to be stored. The third is an array of addresses from which the function arguments, if any, 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.