JCL TEvaluator类中预定义了哪些功能 [英] Which functions are predefined in JCL TEvaluator class

查看:87
本文介绍了JCL TEvaluator类中预定义了哪些功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道Delphi 7的 TEvaluator JCL类中包含哪些预定义功能(例如ABS功能)吗?

Does anyone know which predefined functions (e.g ABS function) are included in the TEvaluator JCL class for Delphi 7?

推荐答案

没有包含 Math.pas 中的标准函数。默认评估分析器中实现的全部是运算符 xor 不是 mod + - / * < > < = > = = div cmp bor bxor band shl shr 。 (我在快速检查源代码时发现了很多,而根据@David的评论,我错过了一些。)

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.)

您可以添加函数(包括那些Delphi RTL的一部分)到评估者。甚至在演示中也显示了该示例,该示例从一个JCL单元中添加了功能。

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.

默认情况下,在 JCL\examples\common\expreval 文件夹将 TComboBox.Items 传递给 Init ExprEvalExampleLogic.pas 中的code>函数作为 FuncList 参数,由以下代码填充( code> TEasyEvaluator 在同一例程中被赋予功能),其功能来自 JclMath.pas

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.

这篇关于JCL TEvaluator类中预定义了哪些功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆