Make your own free website on


libplot.gif (990 bytes)TMathParser object widely used in DM2000 for expression evaluation. Although it has a large set of predefined functions, you may add new functions and parameters. Its methods are briefly described below:

Method function Parse(S: string): TReal

Evaluates string S, may raise EMathParser and other exceptions. Returns result of evaluation.

Method procedure Init(No: integer)

Allocates memory for parameters and functions. All previous data will be deleted. "No" parameter is the size of buffer for identifiers.

Method procedure AddObject(a: pointer; n: tfp_fname; t: tfp_ftype)

Adds new object - function or parameter. "n" is the name of identifier, t - its type, a - pointer to function or variable for parameter. See source code of parser.pas unit and other library units for examples how to add functions and parameters.

Method procedure AddGonio

Add trigonometric functions: ARCTAN(X), COS(X), DEG(X) - converts radians to degrees, PI - returns "pi" number, RAD(X) - converts degrees to radians, SIN(X), TAN(X).

Method procedure AddLogic

Add logic functions: AND(X1,X2,...), OR(X1,X2,...), XOR(X1,X2,...) boolean functions (multiple arguments allowed!), TRUE and FALSE numbers. Note that TRUE is equal to1.0, FALSE is 0.0 real numbers, and you may freely mix numerical and boolean expressions.

Method procedure AddMath

Add mathematical functions: ABS(X), EXP(X), LN(X), LOG(X), SQR(X), SQRT(X) and RANDOM function that has no parameters and returns random number from 0 to 1.

Method procedure AddMisc

Add miscellaneous functions: FRAC(X) - returns fractional part, INT(X) - integer part; MAX(X1,X2,...), MIN(X1,X2,...) - found maximal/minimal value, ROUND(X) - rounds value, SGN(X) - returns argument sign (+1/-1).

Method procedure AddSpec

Add special functions used in DM2000: Time - no arguments, returns GetTickCount(); f_VDP(Ra,Rb) - returns Van-der-Paw formfactor; Ro_VDP(Ra,Rb[Ohm]; d[cm]) - returns resistivity for Van-der-Paw four-probe method; GCX(M,Fi,Gx,Gy), GCX(M,Fi,Gx,Gy) - returns real and imaginary part of impedance Z for G-compensation method; OSCX(ZoX,ZoY,ZsX,ZsY,ZX,ZY), OSCX(ZoX,ZoY,ZsX,ZsY,ZX,ZY) - the same but for Open/Short compensation; InvCX(Re,Im), InvCY(Re,Im) - invert complex value.

Method procedure AddStdParams(Pars: PRealArray)

This procedure adds standard parameters array (parameters identifiers created by AddStdParams() are named from "a" to "z").

In addition to functions and parameters parser support standard set of arithmetic operators: "+", "-", "*", "/",  "^" (power), Boolean logic operators: "<", "<=", "<>", "=", ">=", ">" and parenthesis (). Note that all identifier names in expressions are not case-sensitive.