sp; w:=jexpr.read; end; 0://= begin sFunc:=optr.pop; if sFunc<>''''('''' then begin nParamCount:=1; while sFunc='''','''' do begin Inc(nParamCount); sFunc:=optr.pop; end; if GetParamCount(sFunc)=0 then nParamCount:=0; for i:=1 to nParamCount do sParam[i]:=opnd.Pop; opnd.push(ExecFunc(sFunc,sParam,nParamCount)); end; w:=jexpr.read; end; 1://> begin theta:=optr.pop; b:=opnd.pop; a:=opnd.pop; opnd.push(CalcExprItem(theta,a,b)); end; end; end; end; Result:=opnd.GetTop; opnd.free; optr.free; end;
function CalcExprItem(sOptr,sA,sB:String):String; begin if sOptr=''''+'''' then begin if (sA<>'''''''')and(sB<>'''''''') then begin Result:=floattostr(strtofloat(sA)+strtofloat(sB)); end else begin Result:=sA+sB; if Result='''''''' then Result:=''''0''''; end; exit; end; if sOptr=''''-'''' then begin if sA='''''''' then Result:=floattostr(-strtofloat(sB)) else Result:=floattostr(strtofloat(sA)-strtofloat(sB)); exit; end; if sOptr=''''*'''' then begin Result:=floattostr(strtofloat(sA)*strtofloat(sB)); exit; end; if sOptr=''''/'''' then begin Result:=floattostr(strtofloat(sA)/strtofloat(sB)); exit; end; if sOptr=''''>'''' then begin if strtofloat(sA)>strtofloat(sB) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr=''''<'''' then begin if strtofloat(sA)<strtofloat(sB) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr=''''>='''' then begin if strtofloat(sA)>=strtofloat(sB) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr=''''<='''' then begin if strtofloat(sA)<=strtofloat(sB) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr=''''='''' then begin if strtofloat(sA)=strtofloat(sB) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr=''''<>'''' then begin if strtofloat(sA)<>strtofloat(sB) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr=''''&'''' then begin if (strtofloat(sA)<>0)and(strtofloat(sB)<>0) then Result:=''''1'''' else Result:=''''0''''; exit; end; if sOptr='''':'''' then begin if strtofloat(sA)=0 then Result:=''''0'''' else Result:=sB; exit; end; end;
function GetParamCount(pFunc:String):Integer; begin if pFunc=''''max('''' then result:=2; end;
function OptrIndex(w:string):Integer; begin if w=''''+'''' then begin result:=1; exit; end; if w=''''-'''' then begin result:=2; exit; end; if w=''''*'''' then begin result:=3; exit; end; if w=''''/'''' then begin result:=4; exit; end; if w=''''('''' then begin result:=5; exit; end; if w='''')'''' then begin result:=6; exit; end; if w=''''#'''' then begin result:=7; exit; end; if w=''''>'''' then begin result:=8; exit; end; if w=''''<'''' then begin result:=9; exit; end; if w=''''>='''' then begin result:=10; exit; end; if w=''''<='''' then begin result:=11; exit; end; if w=''''='''' then begin result:=12; exit; end; if w=''''<>'''' then begin result:=13; exit; end; if w=''''&'''' then begin result:=14; exit; end; if w='''':'''' then begin result:=15; exit; end; if w='''','''' then begin result:=16; exit; end; if w=''''max('''' then begin Result:=17; exit; end; result:=-1; end;
function ExecFunc(pFunc:String;pParam:Array of string;pParamCount:Integer):string; var tmpFloat:real; i:integer; begin // if pFunc=''''max('''' then begin tmpFloat:=strtofloat(pParam[0]); for i:=1 to pParamCount-1 do begin if tmpFloat<strtofloat(pParam[i]) then tmpFloat:=strtofloat(pParam[i]); end