From fe7b742f0b1f9ec609bb7bbdcd52a0cc0914d244 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 8 Dec 2008 15:01:18 +0000 Subject: [PATCH] codetools: creating FPC source defines with appended pathdelim git-svn-id: trunk@17729 - --- components/codetools/definetemplates.pas | 21 +++++++++---------- components/codetools/examples/getcontext.lpr | 1 + .../scanexamples/getcontextexample.pas | 2 +- lcl/lresources.pp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index 802d9a6024..2fa99955dd 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -2971,7 +2971,7 @@ var CmdLine: string; Step: String; begin Result:=nil; - DebugLn('TDefinePool.CreateFPCTemplate PPC386Path="',CompilerPath,'" FPCOptions="',CompilerOptions,'"'); + //DebugLn('TDefinePool.CreateFPCTemplate PPC386Path="',CompilerPath,'" FPCOptions="',CompilerOptions,'"'); if TestPascalFile='' then begin DebugLn(['WARNING: TDefinePool.CreateFPCTemplate TestPascalFile empty']); end; @@ -3224,8 +3224,7 @@ var begin MacroCount:=0; - Result:=copy(AFilename,length(FPCSrcDir)+1, - length(AFilename)-length(FPCSrcDir)); + Result:=copy(AFilename,length(Dir)+1,length(AFilename)-length(Dir)); DirStart:=1; while (DirStart<=length(Result)) do begin while (DirStart<=length(Result)) and (Result[DirStart]=PathDelim) @@ -3268,7 +3267,7 @@ var end; DirStart:=DirEnd; end; - Result:=FPCSrcDir+Result; + Result:=Dir+Result; end; procedure BrowseDirectory(ADirPath: string; Priority: integer); @@ -3309,7 +3308,7 @@ var end; // set directory priority - if System.Pos(AppendPathDelim(FPCSrcDir)+'rtl'+PathDelim,ADirPath)>0 then + if System.Pos(Dir+'rtl'+PathDelim,ADirPath)>0 then inc(Priority); // search sources .pp,.pas if FindFirstUTF8(ADirPath+FileMask,faAnyFile,FileInfo)=0 then begin @@ -3328,7 +3327,7 @@ var // directory -> recursively // ToDo: prevent cycling in links SubPriority:=0; - if CompareFilenames(AFilename,AppendPathDelim(FPCSrcDir)+'rtl')=0 + if CompareFilenames(AFilename,Dir+'rtl')=0 then begin // units in 'rtl' have higher priority than other directories inc(SubPriority); @@ -3473,7 +3472,7 @@ var UnitTree:=TAVLTree.Create(@CompareUnitLinkNodes) else UnitTree.FreeAndClear; - BrowseDirectory(FPCSrcDir,0); + BrowseDirectory(Dir,0); end; @@ -3718,7 +3717,7 @@ begin RTLOSDir:=TDefineTemplate.Create('TargetOS','Target OS','', TargetOS,da_Directory); 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 ; RTLOSDir.AddChild(TDefineTemplate.Create('Include Path', @@ -3739,8 +3738,8 @@ begin Format(ctsIncludeDirectoriesPlusDirs,['wininc']), ExternalMacroStart+'IncPath', IncPathMacro - +';'+FPCSrcDir+'rtl'+DS+'win'+DS+'wininc' - +';'+FPCSrcDir+'rtl'+DS+'win', + +';'+Dir+'rtl'+DS+'win'+DS+'wininc' + +';'+Dir+'rtl'+DS+'win', da_DefineRecurse)); RTLDir.AddChild(IFTempl); @@ -3751,7 +3750,7 @@ begin Format(ctsIncludeDirectoriesPlusDirs,['rtl'+DS+'freebsd']), ExternalMacroStart+'IncPath', IncPathMacro - +';'+FPCSrcDir+'rtl'+DS+'freebsd', + +';'+Dir+'rtl'+DS+'freebsd', da_DefineRecurse)); RTLDir.AddChild(IFTempl); diff --git a/components/codetools/examples/getcontext.lpr b/components/codetools/examples/getcontext.lpr index 969789aa63..1c3b58da04 100644 --- a/components/codetools/examples/getcontext.lpr +++ b/components/codetools/examples/getcontext.lpr @@ -17,6 +17,7 @@ var begin // setup the Options CodeToolBoss.SimpleInit(ConfigFilename); + writeln(CodeToolBoss.GetIncludePathForDirectory()); // Example: find declaration of 'TObject' diff --git a/components/codetools/examples/scanexamples/getcontextexample.pas b/components/codetools/examples/scanexamples/getcontextexample.pas index dcc34190b2..b8cbbea201 100644 --- a/components/codetools/examples/scanexamples/getcontextexample.pas +++ b/components/codetools/examples/scanexamples/getcontextexample.pas @@ -5,7 +5,7 @@ unit GetContextExample; interface uses - {$IFDEF MSWindows}Windows,{$ENDIF} Classes, SysUtils; + {$IFDEF Windows}Windows,{$ENDIF} Classes, SysUtils; implementation diff --git a/lcl/lresources.pp b/lcl/lresources.pp index 3de6950c9d..4fd1e1a567 100644 --- a/lcl/lresources.pp +++ b/lcl/lresources.pp @@ -2898,7 +2898,7 @@ var Driver: TAbstractObjectReader; begin 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 Result.OnReadStringProperty:=@(LRSTranslator.TranslateStringProperty);