Which functions are predefined in JCL TEvaluator class
delphi, delphi-7
Solution
There are none of the standard functions from `Math.pas` included. All that is implemented in the default evaluation parser are the operators `or`, `xor`, `and`, `not`, `mod`, `+`, `-`, `/`, `*`, `<`, `>`, `<=`, `>=`, `=`, `div`, `cmp`, `bor`, `bxor`, `band`, `bnot`, `shl`, and `shr`. (As many as I found in a quick check of the source, and a few I missed based on @David's comment.)
You can add functions (including those that are part of the Delphi RTL) to the evaluator fairly easily. It's even shown in the demo, which adds the functions from one of the JCL units.
The JCL evaluator example (ExprEvalExample.dpr) found by default in the `JCL\examples\common\expreval` folder passes a `TComboBox.Items` to the `Init` function in `ExprEvalExampleLogic.pas` as the `FuncList` parameter, which is populated by this code (the `TEasyEvaluator` is given the functions in the same routine) with the functions from `JclMath.pas`:
with FuncList do
begin
Add('LogBase10');
Add('LogBase2');
Add('LogBaseN');
Add('ArcCos');
Add('ArcCot');
Add('ArcCsc');
Add('ArcSec');
Add('ArcSin');
Add('ArcTan');
Add('ArcTan2');
Add('Cos');
Add('Cot');
Add('Coversine');
Add('Csc');
Add('Exsecans');
Add('Haversine');
Add('Sec');
Add('Sin');
Add('Tan');
Add('Versine');
Add('ArcCosH');
Add('ArcCotH');
Add('ArcCscH');
Add('ArcSecH');
Add('ArcSinH');
Add('ArcTanH');
Add('CosH');
Add('CotH');
Add('CscH');
Add('SecH');
Add('SinH');
Add('TanH');
end;
Those would be the functions supported in the demo app. You can add your own in a similar fashion.
Problem
Does anyone know which predefined functions (e.g ABS function) are included in the `TEvaluator` JCL class for Delphi 7?