| Unit calc |
| Classes |
| Functions |
Calculate -
DefCalcProc - Default calculator callback proc
DegreeToStr - Degree convertation functions
fmod - some math functions
power -
StrCalculate - Calculate functions
StrToDegree -
| Types |
PNamedVar
TCalcCBProc
TCalcCBType
TNamedVar
TToken
| Constants |
SFunctionError
SInvalidDegree
SSyntaxError
| Variables |
| Functions |
| Types |
PNamedVar = ^TNamedVar
TCalcCBProc =
function(ctype: TCalcCBType; const S: String; var Value: Double): Boolean
TCalcCBType = (ctGetValue, ctSetValue, ctFunction);
TNamedVar = record
Value : Double;
Name : array[0..0] of Char;
end;
TToken = (
{ } tkEOF, tkERROR, tkASSIGN,
{7} tkLBRACE, tkRBRACE, tkNUMBER, tkIDENT, tkSEMICOLON,
{6} tkPOW,
{5} tkINV, tkNOT,
{4} tkMUL, tkDIV, tkMOD, tkPER,
{3} tkADD, tkSUB,
{2} tkLT, tkLE, tkEQ, tkNE, tkGE, tkGT,
{1} tkOR, tkXOR, tkAND
);
//.TITLE Calculator
//.DESC Simple calculator for standard expressions
//.AUTOR Ivlev M.Dmitry
// Email: Dimon@Diogen.nstu.nsk.su
//.PATCHED Sergey Pedora
// Email: Sergey@mail.fact400.ru
//
Syntax:
0xABCD, 0ABCDh, $ABCD - Hex number
0b0101, 01010b, - Binary number
90`15`2 - Degree
Operators by priorities:
{ 7} () (BRACES)
{ 6} ** (POWER),
{ 5} ~ (INVERSE), ! (NOT),
{ 4} * (MUL), / (DIV), % (MOD), %% (PERSENT),
{ 3} + (ADD), - (SUB),
{ 2} < (LT), <= (LE), == (EQ), <> != (NE), >= (GE), > (GT),
{ 1} | (OR), ^ (XOR), & (AND),
| Constants |
| Variables |