This commit is contained in:
2018-06-01 22:02:26 +03:00
parent acb5bd9c9b
commit 11ee2b8985
2 changed files with 25 additions and 22 deletions

View File

@@ -1,8 +1,11 @@
//****************************************************
//*Copyright (c) 2018 Artem Gavrilov,Vlad Untkin. *
//*Website: https://teamfnd.ru *
//*License: MIT *
//*Donate: https://money.yandex.ru/to/410014959153552*
//****************************************************
unit FasmOnDelphi; unit FasmOnDelphi;
{Delphi Translation&Tests:Artyom Gavrilov,Vlad Untkin.
Donate:https://money.yandex.ru/to/410014959153552}
interface interface
{$Define USEFasm4Delphi} {$Define USEFasm4Delphi}
@@ -199,8 +202,8 @@ begin
for Offset:=1 to Length(SubStr)-1 do for Offset:=1 to Length(SubStr)-1 do
if SubStr[1+Offset]<>Str[Result+Offset] then if SubStr[1+Offset]<>Str[Result+Offset] then
begin begin
f:=false; f:=false;
break; break;
end; end;
if f then if f then
exit; exit;
@@ -364,7 +367,7 @@ begin
while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do
begin begin
Result.OutStr:=Result.OutStr+sLineBreak+ Result.OutStr:=Result.OutStr+sLineBreak+
string(p^.file_path)+'['+p^.line_number.ToString+']'; string(p^.file_path)+'['+p^.line_number.ToString+']';
inc(nr); inc(nr);
SetLength(Result.Lines,nr); SetLength(Result.Lines,nr);
Result.Lines[nr-1].Line:=p^.line_number; Result.Lines[nr-1].Line:=p^.line_number;
@@ -399,7 +402,7 @@ begin
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if LocalStrComp(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
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@@ -435,7 +438,7 @@ begin
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger; Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger;
for i0:=0 to 2 do for i0:=0 to 2 do
i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak); i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak);
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
end; end;
end; end;
@@ -487,7 +490,7 @@ begin
while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do
begin begin
Result.OutStr:=Result.OutStr+sLineBreak+ Result.OutStr:=Result.OutStr+sLineBreak+
string(p^.file_path)+'['+p^.line_number.ToString+']'; string(p^.file_path)+'['+p^.line_number.ToString+']';
inc(nr); inc(nr);
SetLength(Result.Lines,nr); SetLength(Result.Lines,nr);
Result.Lines[nr-1].Line:=p^.line_number; Result.Lines[nr-1].Line:=p^.line_number;
@@ -522,7 +525,7 @@ begin
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if LocalStrComp(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;
if Result.Error<>FASM_OK then if Result.Error<>FASM_OK then
@@ -540,7 +543,7 @@ begin
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger; Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger;
for i0:=0 to 2 do for i0:=0 to 2 do
i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak); i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak);
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
end; end;
end; end;
@@ -590,7 +593,7 @@ begin
while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do
begin begin
Result.OutStr:=Result.OutStr+sLineBreak+ Result.OutStr:=Result.OutStr+sLineBreak+
string(p^.file_path)+'['+p^.line_number.ToString+']'; string(p^.file_path)+'['+p^.line_number.ToString+']';
inc(nr); inc(nr);
SetLength(Result.Lines,nr); SetLength(Result.Lines,nr);
Result.Lines[nr-1].Line:=p^.line_number; Result.Lines[nr-1].Line:=p^.line_number;
@@ -613,7 +616,7 @@ begin
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if LocalStrComp(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
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@@ -649,7 +652,7 @@ begin
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger; Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger;
for i0:=0 to 2 do for i0:=0 to 2 do
i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak); i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak);
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
end; end;
end; end;
@@ -697,7 +700,7 @@ begin
while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do while(NativeUInt(p)>=NativeUInt(Mem))and(NativeUInt(Mem)+NativeUInt(cbMemorySize)>=NativeUInt(p))do
begin begin
Result.OutStr:=Result.OutStr+sLineBreak+ Result.OutStr:=Result.OutStr+sLineBreak+
string(p^.file_path)+'['+p^.line_number.ToString+']'; string(p^.file_path)+'['+p^.line_number.ToString+']';
inc(nr); inc(nr);
SetLength(Result.Lines,nr); SetLength(Result.Lines,nr);
Result.Lines[nr-1].Line:=p^.line_number; Result.Lines[nr-1].Line:=p^.line_number;
@@ -719,7 +722,7 @@ begin
else else
for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do for i0:=FASMERR_ASSERTION_FAILED to FASM_ERROR do
if LocalStrComp(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;
if Result.Error=FASM_OK then if Result.Error=FASM_OK then
@@ -737,7 +740,7 @@ begin
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger; Result.Lines[nr-1].Line:=Copy(Result.OutStr,i,i1-i).ToInteger;
for i0:=0 to 2 do for i0:=0 to 2 do
i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak); i:=Pos(sLineBreak,Result.OutStr,i)+length(sLineBreak);
i1:=Pos(']:',Result.OutStr,i); i1:=Pos(']:',Result.OutStr,i);
end; end;
end; end;