KRASCHE
&
BYRNE
         ELZED  HOME       NEWS       DOCS       DOWNLOADS       LICENSING       SUPPORT       FAQ       ABOUT  US

What's An Elzed?
Features
Licensing
Downloads
Documentation
Elzed News
    ELZED 
 Documentation 
 The Details 

External Operators

One of Elzed's most powerful features is the provision to add new operators. Called "external operators" to differentiate them from the built-in (internal) operators, they come in two varieties: "expression" operators and "callback" operators.

Expression operators are the easier of the two. Each expression operator is tied to a single Elzed expression. When an expression operator is invoked, its assigned operands are mapped by name into the associated expression, which is then evaluated. The result is returned. Use the lzDefineExpOp and lzDefineExpOpStr calls to add expression operators to Elzed.

Callback operators involve more work because they link an Elzed operator to a function in your application. When a callback operator is invoked, control is passed to the linked function. The function can retrieve parameters from Elzed and then return an answer (see the lzGet...Parm and lzSet...Result calls respectively). Use the lzLinkCallbackOp call to add callback operators to Elzed.

Note that another major difference between expression and callback operators is in how their parameter lists can be declared. Expression operators have fixed parameter lists: the operator always expects the same number of parameters, every parameter is assigned a unique name, and each individual parameter is always of a specific type. Calls may not deviate from the original declaration.

On the other hand, callback operators can be much more flexible. First, parameter names are optional. Since your code processes the passed parameters by index number, names aren't needed to map them. You may still declare parameter names, they just aren't used by Elzed in defining or executing the operator.

Second, rather than defining a explicit list of parameters by type and (optional) name, you may instead specify a data type and the minimum and maximum numbers of parameters that my be passed to the operator. This method defines a "variable" parameter list in which all passed parameters are of the same type, but the number of parameters may vary within the specified limits.

Still too restrictive? You have a third option: the variable parameter list described above may be declared without a data type. This is the most flexible declaration, allowing you to pass parameters of any data type in any position in the parameter list, so long as you pass at least the minimum number of parameters, and don't exceed the maximum number.

How will your operator support code make sense of this? Three additional calls are here to help. First, lzGetParmCount returns the number of parameters being passed in to your operator. Second, lzGetParmType returns a given parameter's data type, allowing you to make the correct lzGet...Parm call to retrieve it. Call lzGetParmType repeatedly to process all the passed parameters. Third, lzGetParmSig returns a combined parameter count and type string.



  Copyright  ©  MMXXIV  by  R R Le Cropane   •   All Rights Reserved   •   Terms of Use   •   Privacy Policy