| ELZED | Documentation | The Details | API |
| lzLinkCallbackOpThe lzLinkCallbackOp function establishes a new callback operator in the current context. long lzLinkCallbackOp( | char cScope, | | // the scope of the new operator | | const char* szOperatorName, | | // the name of the new operator | | const char* szOperatorType, | | // the type of the new operator | | const char* szReturnType, | | // the type of value returned | | const char* szParmList, | | // the list of operator parameters | | const char* szPrecedenceOp, | | // an operator with the same precedence | | ExtOpFunction pOpFunction | | // a pointer to the callback function |
);
ParameterscScope | | A character code indicating the scope of the new callback operator. The character code must be one of the following values:
Code
|
Constant
|
Meaning |
'C'
|
kCosmicScope
|
Available in all contexts |
'G'
|
kGlobalScope
|
Available in current context only |
|
szOperatorName | | A null-terminated character string containing the name of the new callback operator. Must be unique within the indicated scope. |
szOperatorType | | A null terminated string containing the type of the new callback operator. Four type value constants are provided for your use:
Type Value
|
Constant
|
Meaning |
"prefix"
|
kOpPrefix
|
Operator before parms, like 'tan' or 'abs' |
"infix"
|
kOpInfix
|
Operator between parms, like '+' or '=' |
"postfix"
|
kOpPostfix
|
Operator after parms (rare), like post-increment '++' |
"nofix"
|
kOpNofix
|
Operator without parms, like 'true' and 'pi' |
|
szReturnType | | A pointer to a null-terminated character string containing the return type.
An Elzed expression operator may return one of the following types:
Type |
Description |
number |
a double precision numeric value |
string |
a null-terminated character string |
boolean |
a char value equal to zero (FALSE) or the current value representing boolean TRUE |
void |
no return value |
|
szParmList | | A null-terminated character string defining the parameters (operands) to be passed to the callback operator. Unlike the parameter list for expression operators, callback operator parameter lists can be declared in multiple ways.
You may, for example, use the same format as that required for expression operators: a list of parameter type/name pairs, punctuated by the current list separator. Parameter names are, however, optional for callback operator definitions. You may include them if you wish (for readability or consistency), but they are not actually used in defining or accessing the callback operator's parameters. A declaration for a three-parameter list might look like this:
number parm_x, string parm_y, boolean parm_z
Or like this, with the parameter names dropped:
number, string, boolean
If the callback operator takes a variable number of parameters, but all are of the same type, you may declare the type once, followed by the minimum and maximum number of parameters allowed. The min and max numbers may be equal. A parameter list for an operator which takes 2 to 12 numeric parameters would look like this:
number 2 12
If the callback operator takes a variable number of parameters, and the parameters may be of different types, you may omit the type declaration. A parameter list for an operator which takes 2 to 12 parameters of varying type would look like this:
2 12
The following parameter types are allowed:
Type |
Description |
number |
a double precision numeric value |
string |
a null-terminated character string |
boolean |
a char value equal to zero (FALSE) or the current value representing boolean TRUE |
Parameter types and names are case sensitive.
If the proposed operator has no parameters, szParmList should be NULL. |
szPrecedenceOp | | A character string containing an operator symbol. When successfully defined, the new callback operator will have the same precedence as this operator. |
pOpFunction | | A pointer the host callback operator function. |
Return Value | Returns an Elzed error code. If the operator is successfully defined, returns "No Error". Returns a non-zero Elzed error code if not successful. Call lzGetLastErrorText to determine the reason for the failure. |
Remarks | See External Operators for information on writing host callback operators. |
Versions | Introduced in Elzed 1.0.0 Modified in Elzed 2.3.1 -- "current list separator" is now "comma" Modified in Elzed 2.4.0 -- String (char*) parameters are now declared const. | | This page describes the version of lzLinkCallbackOp active in Elzed 2.5.0 (214: 2.5.0) |
See Also |
| |