mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 13:19:20 +02:00
codetools: fixed last line of TCodeBuffer
git-svn-id: trunk@29841 -
This commit is contained in:
parent
19860fefde
commit
e8de399c71
@ -656,12 +656,14 @@ var
|
|||||||
if length(Line)<length('#include')+2 then continue;
|
if length(Line)<length('#include')+2 then continue;
|
||||||
if copy(Line,1,length('#include'))<>'#include' then continue;
|
if copy(Line,1,length('#include'))<>'#include' then continue;
|
||||||
if not (Line[length('#include')+1] in [' ',#9]) then continue;
|
if not (Line[length('#include')+1] in [' ',#9]) then continue;
|
||||||
|
debugln(['Parse AAA0 "',Line,'"']);
|
||||||
IncludeParam:=Trim(copy(Line,length('#include')+1,length(Line)));
|
IncludeParam:=Trim(copy(Line,length('#include')+1,length(Line)));
|
||||||
|
debugln(['Parse AAA1 ',IncludeParam]);
|
||||||
if (IncludeParam<>'') and (IncludeParam[1] in ['<','"']) then
|
if (IncludeParam<>'') and (IncludeParam[1] in ['<','"']) then
|
||||||
IncludeParam:=copy(IncludeParam,2,length(IncludeParam)-2);
|
IncludeParam:=copy(IncludeParam,2,length(IncludeParam)-2);
|
||||||
if IncludeParam<>'' then begin
|
if IncludeParam<>'' then begin
|
||||||
// for example: glib/gutils.h
|
// for example: glib/gutils.h
|
||||||
//debugln(['TCHeaderFileMerger.Merge Param=',IncludeParam]);
|
debugln(['TCHeaderFileMerger.Merge Param=',IncludeParam]);
|
||||||
// search file in list
|
// search file in list
|
||||||
for j:=1 to SourceBuffers.Count-1 do begin
|
for j:=1 to SourceBuffers.Count-1 do begin
|
||||||
IncCode:=TCodeBuffer(SourceBuffers[j]);
|
IncCode:=TCodeBuffer(SourceBuffers[j]);
|
||||||
@ -674,9 +676,9 @@ var
|
|||||||
// include file found
|
// include file found
|
||||||
if MergedBuffers.IndexOf(IncCode)<0 then begin
|
if MergedBuffers.IndexOf(IncCode)<0 then begin
|
||||||
debugln(['TCHeaderFileMerger.Merge file '+IncFilename+' into '+Code.Filename]);
|
debugln(['TCHeaderFileMerger.Merge file '+IncFilename+' into '+Code.Filename]);
|
||||||
Append('/* h2pas: merged '+IncludeParam+' into '+ExtractFileName(Code.Filename)+' */'+LineEnding);
|
|
||||||
Append(Code,MergePos,Code.GetLineStart(i));
|
Append(Code,MergePos,Code.GetLineStart(i));
|
||||||
MergePos:=Code.GetLineStart(i+1);
|
MergePos:=Code.GetLineStart(i+1);
|
||||||
|
Append('/* h2pas: merged '+IncludeParam+' into '+ExtractFileName(Code.Filename)+' */'+LineEnding);
|
||||||
Parse(IncCode);
|
Parse(IncCode);
|
||||||
Append('/* h2pas: end of merged '+IncludeParam+' into '+ExtractFileName(Code.Filename)+' */'+LineEnding+LineEnding);
|
Append('/* h2pas: end of merged '+IncludeParam+' into '+ExtractFileName(Code.Filename)+' */'+LineEnding+LineEnding);
|
||||||
end;
|
end;
|
||||||
@ -685,8 +687,8 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if MergePos<Code.SourceLength then
|
if MergePos<=Code.SourceLength then
|
||||||
Append(Code,MergePos,Code.SourceLength);
|
Append(Code,MergePos,Code.SourceLength+1);
|
||||||
Append(LineEnding);
|
Append(LineEnding);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ begin
|
|||||||
if Index<fLineCount-1 then
|
if Index<fLineCount-1 then
|
||||||
LineLen:=fLineRanges[Index+1].StartPos-fLineRanges[Index].StartPos
|
LineLen:=fLineRanges[Index+1].StartPos-fLineRanges[Index].StartPos
|
||||||
else
|
else
|
||||||
LineLen:=fSrcLen-fLineRanges[Index].StartPos;
|
LineLen:=fSrcLen-fLineRanges[Index].StartPos+1;
|
||||||
SetLength(Result,LineLen);
|
SetLength(Result,LineLen);
|
||||||
if LineLen>0 then
|
if LineLen>0 then
|
||||||
System.Move(fSource[fLineRanges[Index].StartPos],Result[1],LineLen);
|
System.Move(fSource[fLineRanges[Index].StartPos],Result[1],LineLen);
|
||||||
|
Loading…
Reference in New Issue
Block a user