You are here: Symbol Reference > MtxParseClass Namespace > Types > MtxParseClass.TExprFunc Type
MtxVec VCL
ContentsIndex
PreviousUpNext
MtxParseClass.TExprFunc Type

Function type for custom function definition.

Pascal
TExprFunc = procedure (const Expr: TExprRec);

Any custome defined function must be of this type to be used in the expression parser.

Custom function definition taking a single parameter stored at Args[0]. The second parameter (if present) would be stored at Args[1] and so on... 

 

procedure _log10x(Param: TExprRec); begin with Param, Res do begin Complex := Args[0].Complex; if Complex then PCValue^ := Log10(Args[0].PCValue^) else PValue^ := Log10(Args[0].PValue^); end; end; var ep: TMtxExpression; begin ep := TMtxExpression.Create; try ep.DefineFunction('Log10x',_log10x,1); ep.Add('Log10x(1.2)+3'); Label1.Caption := SampleToStr(ep.Evaluate); finally ep.Free; end; end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!