codetools: creating FPC source defines with appended pathdelim

git-svn-id: trunk@17729 -
This commit is contained in:
mattias 2008-12-08 15:01:18 +00:00
parent 7348c85216
commit fe7b742f0b
4 changed files with 13 additions and 13 deletions

View File

@ -2971,7 +2971,7 @@ var CmdLine: string;
Step: String; Step: String;
begin begin
Result:=nil; Result:=nil;
DebugLn('TDefinePool.CreateFPCTemplate PPC386Path="',CompilerPath,'" FPCOptions="',CompilerOptions,'"'); //DebugLn('TDefinePool.CreateFPCTemplate PPC386Path="',CompilerPath,'" FPCOptions="',CompilerOptions,'"');
if TestPascalFile='' then begin if TestPascalFile='' then begin
DebugLn(['WARNING: TDefinePool.CreateFPCTemplate TestPascalFile empty']); DebugLn(['WARNING: TDefinePool.CreateFPCTemplate TestPascalFile empty']);
end; end;
@ -3224,8 +3224,7 @@ var
begin begin
MacroCount:=0; MacroCount:=0;
Result:=copy(AFilename,length(FPCSrcDir)+1, Result:=copy(AFilename,length(Dir)+1,length(AFilename)-length(Dir));
length(AFilename)-length(FPCSrcDir));
DirStart:=1; DirStart:=1;
while (DirStart<=length(Result)) do begin while (DirStart<=length(Result)) do begin
while (DirStart<=length(Result)) and (Result[DirStart]=PathDelim) while (DirStart<=length(Result)) and (Result[DirStart]=PathDelim)
@ -3268,7 +3267,7 @@ var
end; end;
DirStart:=DirEnd; DirStart:=DirEnd;
end; end;
Result:=FPCSrcDir+Result; Result:=Dir+Result;
end; end;
procedure BrowseDirectory(ADirPath: string; Priority: integer); procedure BrowseDirectory(ADirPath: string; Priority: integer);
@ -3309,7 +3308,7 @@ var
end; end;
// set directory priority // set directory priority
if System.Pos(AppendPathDelim(FPCSrcDir)+'rtl'+PathDelim,ADirPath)>0 then if System.Pos(Dir+'rtl'+PathDelim,ADirPath)>0 then
inc(Priority); inc(Priority);
// search sources .pp,.pas // search sources .pp,.pas
if FindFirstUTF8(ADirPath+FileMask,faAnyFile,FileInfo)=0 then begin if FindFirstUTF8(ADirPath+FileMask,faAnyFile,FileInfo)=0 then begin
@ -3328,7 +3327,7 @@ var
// directory -> recursively // directory -> recursively
// ToDo: prevent cycling in links // ToDo: prevent cycling in links
SubPriority:=0; SubPriority:=0;
if CompareFilenames(AFilename,AppendPathDelim(FPCSrcDir)+'rtl')=0 if CompareFilenames(AFilename,Dir+'rtl')=0
then begin then begin
// units in 'rtl' have higher priority than other directories // units in 'rtl' have higher priority than other directories
inc(SubPriority); inc(SubPriority);
@ -3473,7 +3472,7 @@ var
UnitTree:=TAVLTree.Create(@CompareUnitLinkNodes) UnitTree:=TAVLTree.Create(@CompareUnitLinkNodes)
else else
UnitTree.FreeAndClear; UnitTree.FreeAndClear;
BrowseDirectory(FPCSrcDir,0); BrowseDirectory(Dir,0);
end; end;
@ -3718,7 +3717,7 @@ begin
RTLOSDir:=TDefineTemplate.Create('TargetOS','Target OS','', RTLOSDir:=TDefineTemplate.Create('TargetOS','Target OS','',
TargetOS,da_Directory); TargetOS,da_Directory);
s:=IncPathMacro s:=IncPathMacro
+';'+Dir+'rtl'+DS+TargetOS+DS+SrcOS+'inc' // e.g. rtl/win32/wininc/ +';'+Dir+'rtl'+DS+TargetOS+DS+SrcOS+'inc' // e.g. rtl/win32/inc/
+';'+Dir+'rtl'+DS+TargetOS+DS+TargetProcessor+DS +';'+Dir+'rtl'+DS+TargetOS+DS+TargetProcessor+DS
; ;
RTLOSDir.AddChild(TDefineTemplate.Create('Include Path', RTLOSDir.AddChild(TDefineTemplate.Create('Include Path',
@ -3739,8 +3738,8 @@ begin
Format(ctsIncludeDirectoriesPlusDirs,['wininc']), Format(ctsIncludeDirectoriesPlusDirs,['wininc']),
ExternalMacroStart+'IncPath', ExternalMacroStart+'IncPath',
IncPathMacro IncPathMacro
+';'+FPCSrcDir+'rtl'+DS+'win'+DS+'wininc' +';'+Dir+'rtl'+DS+'win'+DS+'wininc'
+';'+FPCSrcDir+'rtl'+DS+'win', +';'+Dir+'rtl'+DS+'win',
da_DefineRecurse)); da_DefineRecurse));
RTLDir.AddChild(IFTempl); RTLDir.AddChild(IFTempl);
@ -3751,7 +3750,7 @@ begin
Format(ctsIncludeDirectoriesPlusDirs,['rtl'+DS+'freebsd']), Format(ctsIncludeDirectoriesPlusDirs,['rtl'+DS+'freebsd']),
ExternalMacroStart+'IncPath', ExternalMacroStart+'IncPath',
IncPathMacro IncPathMacro
+';'+FPCSrcDir+'rtl'+DS+'freebsd', +';'+Dir+'rtl'+DS+'freebsd',
da_DefineRecurse)); da_DefineRecurse));
RTLDir.AddChild(IFTempl); RTLDir.AddChild(IFTempl);

View File

@ -17,6 +17,7 @@ var
begin begin
// setup the Options // setup the Options
CodeToolBoss.SimpleInit(ConfigFilename); CodeToolBoss.SimpleInit(ConfigFilename);
writeln(CodeToolBoss.GetIncludePathForDirectory());
// Example: find declaration of 'TObject' // Example: find declaration of 'TObject'

View File

@ -5,7 +5,7 @@ unit GetContextExample;
interface interface
uses uses
{$IFDEF MSWindows}Windows,{$ENDIF} Classes, SysUtils; {$IFDEF Windows}Windows,{$ENDIF} Classes, SysUtils;
implementation implementation

View File

@ -2898,7 +2898,7 @@ var
Driver: TAbstractObjectReader; Driver: TAbstractObjectReader;
begin begin
Result:=TReader.Create(s,4096); Result:=TReader.Create(s,4096);
//If included Default translator LRSTranslator will be set //If included Default translator LRSTranslator will be set
if Assigned(LRSTranslator) then if Assigned(LRSTranslator) then
Result.OnReadStringProperty:=@(LRSTranslator.TranslateStringProperty); Result.OnReadStringProperty:=@(LRSTranslator.TranslateStringProperty);