mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 13:18:25 +02:00
* source linebuf as dyn array
This commit is contained in:
parent
2f3c0bc8bf
commit
25e955b6e4
@ -1039,8 +1039,8 @@ Implementation
|
|||||||
if not assigned(f) then
|
if not assigned(f) then
|
||||||
exit;
|
exit;
|
||||||
for i:=0 to f.maxlinebuf-1 do
|
for i:=0 to f.maxlinebuf-1 do
|
||||||
if f.linebuf^[i]<0 then
|
if f.linebuf[i]<0 then
|
||||||
f.linebuf^[i]:=-f.linebuf^[i]-1;
|
f.linebuf[i]:=-f.linebuf[i]-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -1094,13 +1094,13 @@ Implementation
|
|||||||
(hp.fileinfo.line<infile.maxlinebuf) then
|
(hp.fileinfo.line<infile.maxlinebuf) then
|
||||||
begin
|
begin
|
||||||
if (hp.fileinfo.line<>0) and
|
if (hp.fileinfo.line<>0) and
|
||||||
(infile.linebuf^[hp.fileinfo.line]>=0) then
|
(infile.linebuf[hp.fileinfo.line]>=0) then
|
||||||
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp.fileinfo.line)+'] '+
|
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp.fileinfo.line)+'] '+
|
||||||
fixline(infile.GetLineStr(hp.fileinfo.line)));
|
fixline(infile.GetLineStr(hp.fileinfo.line)));
|
||||||
{ set it to a negative value !
|
{ set it to a negative value !
|
||||||
to make that is has been read already !! PM }
|
to make that is has been read already !! PM }
|
||||||
if (infile.linebuf^[hp.fileinfo.line]>=0) then
|
if (infile.linebuf[hp.fileinfo.line]>=0) then
|
||||||
infile.linebuf^[hp.fileinfo.line]:=-infile.linebuf^[hp.fileinfo.line]-1;
|
infile.linebuf[hp.fileinfo.line]:=-infile.linebuf[hp.fileinfo.line]-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
lastfileinfo:=hp.fileinfo;
|
lastfileinfo:=hp.fileinfo;
|
||||||
|
@ -33,8 +33,7 @@ interface
|
|||||||
linebufincrease=512;
|
linebufincrease=512;
|
||||||
|
|
||||||
type
|
type
|
||||||
tlongintarr = array[0..1000000] of longint;
|
tlongintarr = array of longint;
|
||||||
plongintarr = ^tlongintarr;
|
|
||||||
|
|
||||||
tinputfile = class
|
tinputfile = class
|
||||||
path,name : TPathStr; { path and filename }
|
path,name : TPathStr; { path and filename }
|
||||||
@ -50,7 +49,7 @@ interface
|
|||||||
savelastlinepos,
|
savelastlinepos,
|
||||||
saveline_no : longint;
|
saveline_no : longint;
|
||||||
|
|
||||||
linebuf : plongintarr; { line buffer to retrieve lines }
|
linebuf : tlongintarr; { line buffer to retrieve lines }
|
||||||
maxlinebuf : longint;
|
maxlinebuf : longint;
|
||||||
|
|
||||||
ref_index : longint;
|
ref_index : longint;
|
||||||
@ -248,9 +247,7 @@ uses
|
|||||||
begin
|
begin
|
||||||
if not closed then
|
if not closed then
|
||||||
close;
|
close;
|
||||||
{ free memory }
|
linebuf:=Nil;
|
||||||
if assigned(linebuf) then
|
|
||||||
freemem(linebuf,maxlinebuf*sizeof(linebuf^[0]));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -387,11 +384,10 @@ uses
|
|||||||
while (line>=maxlinebuf) do
|
while (line>=maxlinebuf) do
|
||||||
begin
|
begin
|
||||||
{ create new linebuf and move old info }
|
{ create new linebuf and move old info }
|
||||||
linebuf:=reallocmem(linebuf,(maxlinebuf+linebufincrease)*sizeof(linebuf^[0]));
|
SetLength(linebuf,(maxlinebuf+linebufincrease));
|
||||||
fillchar(linebuf^[maxlinebuf],linebufincrease*sizeof(linebuf^[0]),0);
|
|
||||||
inc(maxlinebuf,linebufincrease);
|
inc(maxlinebuf,linebufincrease);
|
||||||
end;
|
end;
|
||||||
linebuf^[line]:=linepos;
|
linebuf[line]:=linepos;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -405,7 +401,7 @@ uses
|
|||||||
getlinestr:='';
|
getlinestr:='';
|
||||||
if l<maxlinebuf then
|
if l<maxlinebuf then
|
||||||
begin
|
begin
|
||||||
fpos:=linebuf^[l];
|
fpos:=linebuf[l];
|
||||||
{ fpos is set negativ if the line was already written }
|
{ fpos is set negativ if the line was already written }
|
||||||
{ but we still know the correct value }
|
{ but we still know the correct value }
|
||||||
if fpos<0 then
|
if fpos<0 then
|
||||||
|
@ -346,13 +346,13 @@ implementation
|
|||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
||||||
begin
|
begin
|
||||||
if (hp1.fileinfo.line<>0) and
|
if (hp1.fileinfo.line<>0) and
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
((infile.linebuf[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
||||||
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
||||||
{ set it to a negative value !
|
{ set it to a negative value !
|
||||||
to make that is has been read already !! PM }
|
to make that is has been read already !! PM }
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
if (infile.linebuf[hp1.fileinfo.line]>=0) then
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
infile.linebuf[hp1.fileinfo.line]:=-infile.linebuf[hp1.fileinfo.line]-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
lastfileinfo:=hp1.fileinfo;
|
lastfileinfo:=hp1.fileinfo;
|
||||||
|
@ -283,13 +283,13 @@ implementation
|
|||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
||||||
begin
|
begin
|
||||||
if (hp1.fileinfo.line<>0) and
|
if (hp1.fileinfo.line<>0) and
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
((infile.linebuf[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
||||||
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
||||||
{ set it to a negative value !
|
{ set it to a negative value !
|
||||||
to make that is has been read already !! PM }
|
to make that is has been read already !! PM }
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
if (infile.linebuf[hp1.fileinfo.line]>=0) then
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
infile.linebuf[hp1.fileinfo.line]:=-infile.linebuf[hp1.fileinfo.line]-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
lastfileinfo:=hp1.fileinfo;
|
lastfileinfo:=hp1.fileinfo;
|
||||||
|
@ -455,13 +455,13 @@ implementation
|
|||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
||||||
begin
|
begin
|
||||||
if (hp1.fileinfo.line<>0) and
|
if (hp1.fileinfo.line<>0) and
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
((infile.linebuf[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
||||||
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
writer.AsmWriteLn(asminfo^.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
||||||
{ set it to a negative value !
|
{ set it to a negative value !
|
||||||
to make that is has been read already !! PM }
|
to make that is has been read already !! PM }
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
if (infile.linebuf[hp1.fileinfo.line]>=0) then
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
infile.linebuf[hp1.fileinfo.line]:=-infile.linebuf[hp1.fileinfo.line]-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
lastfileinfo:=hp1.fileinfo;
|
lastfileinfo:=hp1.fileinfo;
|
||||||
|
Loading…
Reference in New Issue
Block a user