UPD: != operation for udetectstr

This commit is contained in:
b4rr4cuda 2008-02-29 05:52:26 +00:00
commit 2cb5cf48a3
2 changed files with 25 additions and 19 deletions

View file

@ -380,11 +380,6 @@ s:=str;
Result:=Copy(s,1,pos(s,'}')-1);
end;
//'ThisIsSimpleTest [DC(Panel).GetFileName] [DC(Panel).GetFileExt]
//[Script(ScriptName).ScriptFunction{param1,param2...}]'
//[Plugin(Pluginname).Function{param...}]
function TPanelColumn.ActGetInfo(FuncS:string; ptr: PFileRecItem):string;
//---------------------
const
@ -396,15 +391,13 @@ function TPanelColumn.ActGetInfo(FuncS:string; ptr: PFileRecItem):string;
//---------------------
var AType,AName,AFunc,AParam:string;
begin
// DebugLn('Entered ActGetInfo');
// DebugLn('FuncS='+FuncS);
//---------------------
AType:=upcase(GetModType(FuncS));
AName:=upcase(GetModName(FuncS));
AFunc:=upcase(GetModFunctionName(FuncS));
AParam:=upcase(GetModFunctionParams(FuncS));
//---------------------
// DebugLn('AType='+AType+#13+#10+'AName='+AName+#13+#10+'AFunc='+AFunc+#13+#10+'AParam='+AParam);
// DebugLn('AType='+AType+#13+#10+'AName='+AName+#13+#10+'AFunc='+AFunc+#13+#10+'AParam='+AParam);
//Internal doublecmd function
//------------------------------------------------------
if AType=DC then
@ -424,7 +417,6 @@ begin
else
Result:=cnvFormatFileSize(iSize);
end;
// end;
end;
3: Result:=ptr^.sModeStr;
4: Result:=ptr^.sPath;
@ -454,7 +446,6 @@ begin
begin
if not WdxPlugins.IsLoaded(AName) then
if not WdxPlugins.LoadModule(AName) then Exit;
// DebugLn('ptrFileName: '+ptr^.sPath+ptr^.sName);
if WdxPlugins.GetWdxModule(AName).FileParamVSDetectStr(ptr) then
begin
@ -482,7 +473,6 @@ begin
begin
s:=s+ActGetInfo(FuncList[I],ptr);
end;
// DebugLn('Iter:'+Inttostr(i)+' Rez: '+s+' ptr.sname: '+ptr^.sName);
end;
Result:=s;
end;

View file

@ -25,19 +25,20 @@ unit uDetectStr;
interface
uses
SysUtils, Classes,uTypes;
SysUtils, Classes, uTypes;//,LCLProc;
type
TMathtype=(mtnil,mtoperator,mtlbracket,mtrbracket,mtoperand);
type
TMathOperatortype=(monone,
moequ,
moles,
momor,
moand,
moor
TMathOperatortype=(monone, // NULL
moequ, // =
moneq, // != replaced with #
moles, // <
momor, // >
moand, // &
moor // |
);
type
@ -104,6 +105,7 @@ begin
case Aoperator.op of
moequ: Result:=BooleanToStr(tmp=operand2.data);
moneq: Result:=BooleanToStr(tmp<>operand2.data);
end;
// DebugLn(Result);
end;
@ -115,6 +117,7 @@ begin
tmp:=IntToStr(fptr^.iSize);
case Aoperator.op of
moequ: Result:= BooleanToStr(strtoint(tmp)=strtoint(operand2.data));
moneq: Result:= BooleanToStr(strtoint(tmp)<>strtoint(operand2.data));
moles: Result:= BooleanToStr(strtoint(tmp)<strtoint(operand2.data));
momor: Result:= BooleanToStr(strtoint(tmp)>strtoint(operand2.data));
end;
@ -185,6 +188,8 @@ end;
result:=moand
else if c='=' then
result:=moequ
else if c='#' then
result:=moneq
else if c='|' then
result:=moor;
end;
@ -210,16 +215,25 @@ end;
len:=length(tmpnum);
end;
procedure TParserControl.processstring;
procedure TParserControl.processstring;
var
i:integer;
numlen:integer;
begin
while pos('!=',fmathstring)>0 do
begin
i:=pos('!=',fmathstring);
delete(fmathstring,i,2);
insert('#',fmathstring,i);
end;
i:=0;
numlen:=0;
setlength(output,0);
setlength(input,0);
setlength(stack,0);
fmathstring:='('+fmathstring+')';
setlength(input,length(fmathstring));
while i<=length(fmathstring)-1 do
@ -254,6 +268,7 @@ end;
begin
result:=false;
if (c='=')
or (c='#')
or (c='&')
or (c='<')
or (c='>')
@ -276,6 +291,7 @@ function TParserControl.isdigit(c:char):boolean;
moor:result:=1;
moand:result:=1;
moequ:result:=2;
moneq:result:=2;
moles:result:=2;
momor:result:=2;
end;