mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:59:20 +02:00
fixed special pascal includes
git-svn-id: trunk@3663 -
This commit is contained in:
parent
565d1935ce
commit
f11f15fbb3
@ -2098,31 +2098,33 @@ function TLinkScanner.IncludeDirective: boolean;
|
||||
var IncFilename: string;
|
||||
begin
|
||||
inc(SrcPos);
|
||||
IncFilename:=Trim(copy(Src,SrcPos,CommentInnerEndPos-SrcPos));
|
||||
if PascalCompiler<>pcDelphi then begin
|
||||
// default is fpc behaviour
|
||||
if ExtractFileExt(IncFilename)='' then
|
||||
IncFilename:=IncFilename+'.pp';
|
||||
end else begin
|
||||
// delphi understands quoted include files and default extension is .pas
|
||||
if (copy(IncFilename,1,1)='''')
|
||||
and (copy(IncFilename,length(IncFilename),1)='''') then
|
||||
IncFilename:=copy(IncFilename,2,length(IncFilename)-2);
|
||||
if ExtractFileExt(IncFilename)='' then
|
||||
IncFilename:=IncFilename+'.pas';
|
||||
end;
|
||||
UpdateCleanedSource(CommentEndPos-1);
|
||||
// put old position on stack
|
||||
PushIncludeLink(CleanedLen,CommentEndPos,Code);
|
||||
// load include file
|
||||
Result:=IncludeFile(IncFilename);
|
||||
if Result then begin
|
||||
if (SrcPos<=SrcLen) then
|
||||
CommentEndPos:=SrcPos
|
||||
else
|
||||
ReturnFromIncludeFile;
|
||||
end else begin
|
||||
PopIncludeLink;
|
||||
if (Src[SrcPos]<>'%') then begin
|
||||
IncFilename:=Trim(copy(Src,SrcPos,CommentInnerEndPos-SrcPos));
|
||||
if PascalCompiler<>pcDelphi then begin
|
||||
// default is fpc behaviour
|
||||
if ExtractFileExt(IncFilename)='' then
|
||||
IncFilename:=IncFilename+'.pp';
|
||||
end else begin
|
||||
// delphi understands quoted include files and default extension is .pas
|
||||
if (copy(IncFilename,1,1)='''')
|
||||
and (copy(IncFilename,length(IncFilename),1)='''') then
|
||||
IncFilename:=copy(IncFilename,2,length(IncFilename)-2);
|
||||
if ExtractFileExt(IncFilename)='' then
|
||||
IncFilename:=IncFilename+'.pas';
|
||||
end;
|
||||
UpdateCleanedSource(CommentEndPos-1);
|
||||
// put old position on stack
|
||||
PushIncludeLink(CleanedLen,CommentEndPos,Code);
|
||||
// load include file
|
||||
Result:=IncludeFile(IncFilename);
|
||||
if Result then begin
|
||||
if (SrcPos<=SrcLen) then
|
||||
CommentEndPos:=SrcPos
|
||||
else
|
||||
ReturnFromIncludeFile;
|
||||
end else begin
|
||||
PopIncludeLink;
|
||||
end;
|
||||
end;
|
||||
//writeln('[TLinkScanner.IncludeDirective] END ',CommentEndPos,',',SrcPos,',',SrcLen);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user