ArtFormula package contains two nonvisual
Delphi and
Lazarus componenst for symbolic expression parsing and evaluation. Provides runtime scripting engine for automating your programs.
Provides:- 7 arithmetic operations
- 10 logical operations
- 6 bitwise operations
- string concatenation (@) and like (==) operator
- 24 arithmetic functions
- 10 statistical functions
- 2 logical functions
- 17 string functions
- 13 date functions
- 14 programming functions
- User defined constant
- User defined variables
- User defined functions (modules)
- Subroutines, global vars and constants
- Symbolical differentiation of functions with basic simplification of resulting derivatives
Arithmetic operation: x + y, x - y, x * y, x / y, x % y (Mod), x ^ y (power), x\ y (Div)
Logical operation (true=1, false=0): x > y, x < y, x >= y, x <= y, x = y, x <> y, ! x (not), x & y (and), x | y (or), x xor y
Bitwise operations:x && y (band), x || y (bor), !!x (bnot), x bxor y, x >> y (shr), x << y (shl)
Predefined constants: Pi = 3.1415926535897932385
True = 1
False = 0
Functions: sin, cos, tan, sinh, cosh, tanh, asin, acos, atan, asinh, acosh, atanh, sqrt, exp, log, lg (log base 10), int (integer part of a number), frac (fractional part of a number), abs, sign, rnd, randomize, trunc (truncates value to a specified number of digits), round (rounds value to a specified number of digits)
max(x,y...), min(x,y,...), count(x,y,...), sum(x,y,...), sumofsquares(x,y,...), avg(x,y,...), variance(x,y,...), variancep(x,y,...), stddev(x,y,...), stddevp(x,y,...)
iff(cond,x,y) (if cond = true then result = x else result = y),
isnumber(x)
chr(x), length(s), trim(s), trimleft(s), trimright(s) lowercase(s), uppercase(s), midstr(s,x,y), leftstr(s,x), rightstr(s,x), pos(s,t), code(s), format(s,x), formatf(s,x), stringofchar(c,n), concat(s1,s2,...), hex(s)
date(s), now, formatdate(s,d), year(d), month(d), day(d), hour(d), minute(d), second(d), millisecond(d), isleapyear(n), dayofweek(d), encodedate(y,m,d)
Programming:TArtFormula provides two styles of programming: formula style and scripting style. The first style assumes that all statements have the form of function call. The second style imply that you use common program language notation.
For example: block(defines('i','n'), set('n',1),
series(set('i',1), val('i')<=5, inc('i'), set('n',val('n')*val('i'))),
msg('5! = '+val('n'),'result',0)) Is equal to:
begin
var 'i', 'n' end;
$n:=1;
for $i:=1; $i<=5; $i++ do
$n := $n*$i;
next;
msg('5! = '+val('n'),'result',0);
endYou can mix two styles in one program.
TArtFormula programming language supports:
- Variables definitions
- Assigmnent statement
- Increment and Decrement operations
- Return function
- Compound statement (BEGIN... END)
- IF statement
- WHILE loop
- UNTIL loop
- FOR loop
- Interface functions: msg('text','caption',props), input('caption', 'text', defvalue)
- Subroutines, global vars and global constants (with extended syntax)
Spreadsheet applicatiuon:TArtFormula can be used in spreadsheet application. E.g. using GetVarsCount and GetVarValue event handlers one can implement calculation of sum(a1:b4), avg(c1:c99) and similar function calls, where a1:b4 and c1:c99 are range of sheet cells.
Hope it can be usefull for somebody...
Link:
http://artsoft.nm.ru/download.html