Fix error cheker's bug

This commit is contained in:
2018-04-12 21:52:30 +03:00
parent dd1e5ff80a
commit 1a13e90b9c

View File

@@ -270,6 +270,23 @@ pclose(Output);
end; end;
{$ENDIF} {$ENDIF}
function LocalStrComp(s1,s2:string):boolean;inline;
var
i,n:NativeUInt;
begin
if length(s1)>length(s2) then
n:=length(s2)
else
n:=length(s1);
Result:=true;
for i:=1 to n do
if s1[i]<>s2[i] then
begin
Result:=false;
break;
end;
end;
function FasmVersion:TFasmVersion; function FasmVersion:TFasmVersion;
const const
preverstr='version '; preverstr='version ';
@@ -376,12 +393,12 @@ begin
s+'.in '+s); s+'.in '+s);
DeleteFile(PChar(s+'.in')); DeleteFile(PChar(s+'.in'));
i:=Pos('error: ',Result.OutStr); i:=Pos('error: ',Result.OutStr);
s0:=Copy(Result.OutStr,i+length('error: '),Pos('.',Result.OutStr,i)-i-length('error: ')); s0:=Copy(Result.OutStr,i+length('error: '),Pos(sLineBreak,Result.OutStr,i)-i-length('error: '));
if i=0 then if i=0 then
Result.Error:=FASM_OK Result.Error:=FASM_OK
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if FasmErrorCodeNames[i0]=s0 then if LocalStrComp(FasmErrorCodeNames[i0],s0)then
Result.Error:=i0; Result.Error:=i0;
if Result.Error=FASM_OK then if Result.Error=FASM_OK then
begin begin
@@ -499,12 +516,12 @@ begin
s+' '+OutFile); s+' '+OutFile);
DeleteFile(PChar(s)); DeleteFile(PChar(s));
i:=Pos('error: ',Result.OutStr); i:=Pos('error: ',Result.OutStr);
s0:=Copy(Result.OutStr,i+length('error: '),Pos('.',Result.OutStr,i)-i-length('error: ')); s0:=Copy(Result.OutStr,i+length('error: '),Pos(sLineBreak,Result.OutStr,i)-i-length('error: '));
if i=0 then if i=0 then
Result.Error:=FASM_OK Result.Error:=FASM_OK
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if FasmErrorCodeNames[i0]=s0 then if LocalStrComp(FasmErrorCodeNames[i0],s0)then
Result.Error:=i0; Result.Error:=i0;
Result.OutData:=nil; Result.OutData:=nil;
Result.sb:=0; Result.sb:=0;
@@ -590,12 +607,12 @@ begin
Result.OutStr:=RunFasm('-m '+trunc(cbMemorySize/1024).ToString+' -p '+nPassesLimit.ToString+' '+ Result.OutStr:=RunFasm('-m '+trunc(cbMemorySize/1024).ToString+' -p '+nPassesLimit.ToString+' '+
Source+' '+s); Source+' '+s);
i:=Pos('error: ',Result.OutStr); i:=Pos('error: ',Result.OutStr);
s0:=Copy(Result.OutStr,i+length('error: '),Pos('.',Result.OutStr,i)-i-length('error: ')); s0:=Copy(Result.OutStr,i+length('error: '),Pos(sLineBreak,Result.OutStr,i)-i-length('error: '));
if i=0 then if i=0 then
Result.Error:=FASM_OK Result.Error:=FASM_OK
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if FasmErrorCodeNames[i0]=s0 then if LocalStrComp(FasmErrorCodeNames[i0],s0)then
Result.Error:=i0; Result.Error:=i0;
if Result.Error=FASM_OK then if Result.Error=FASM_OK then
begin begin
@@ -696,12 +713,12 @@ begin
Result.OutStr:=RunFasm('-m '+trunc(cbMemorySize/1024).ToString+' -p '+nPassesLimit.ToString+' '+ Result.OutStr:=RunFasm('-m '+trunc(cbMemorySize/1024).ToString+' -p '+nPassesLimit.ToString+' '+
Source+' '+OutFile); Source+' '+OutFile);
i:=Pos('error: ',Result.OutStr); i:=Pos('error: ',Result.OutStr);
s0:=Copy(Result.OutStr,i+length('error: '),Pos('.',Result.OutStr,i)-i-length('error: ')); s0:=Copy(Result.OutStr,i+length('error: '),Pos(sLineBreak,Result.OutStr,i)-i-length('error: '));
if i=0 then if i=0 then
Result.Error:=FASM_OK Result.Error:=FASM_OK
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if FasmErrorCodeNames[i0]=s0 then if LocalStrComp(FasmErrorCodeNames[i0],s0)then
Result.Error:=i0; Result.Error:=i0;
Result.OutData:=nil; Result.OutData:=nil;
Result.sb:=0; Result.sb:=0;