diff --git a/components/codetools/codetoolmanager.pas b/components/codetools/codetoolmanager.pas index f67b46b2b6..e5450dfce8 100644 --- a/components/codetools/codetoolmanager.pas +++ b/components/codetools/codetoolmanager.pas @@ -214,6 +214,8 @@ type function GetCompiledSrcExtForDirectory(const Directory: string): string; function FindUnitInUnitLinks(const Directory, UnitName: string): string; function GetUnitLinksForDirectory(const Directory: string): string; + procedure GetFPCVersionForDirectory(const Directory: string; + var FPCVersion, FPCRelease, FPCPatch: integer); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -777,6 +779,55 @@ begin Result:=Evaluator[ExternalMacroStart+'UnitLinks']; end; +procedure TCodeToolManager.GetFPCVersionForDirectory(const Directory: string; + var FPCVersion, FPCRelease, FPCPatch: integer); +var + Evaluator: TExpressionEvaluator; + i: Integer; + VarName: String; + p: Integer; + + function ReadInt(var AnInteger: integer): boolean; + var + StartPos: Integer; + begin + StartPos:=p; + AnInteger:=0; + while (p<=length(VarName)) and (VarName[p] in ['0'..'9']) do begin + AnInteger:=AnInteger*10+(ord(VarName[p])-ord('0')); + if AnInteger>=100 then begin + Result:=false; + exit; + end; + inc(p); + end; + Result:=StartPos3) and (VarName[1] in ['V','v']) + and (VarName[2] in ['E','e']) and (VarName[3] in ['R','r']) + and (VarName[4] in ['0'..'9']) then begin + p:=4; + if not ReadInt(FPCVersion) then continue; + if (p>=length(VarName)) or (VarName[p]<>'_') then continue; + inc(p); + if not ReadInt(FPCRelease) then continue; + if (p>=length(VarName)) or (VarName[p]<>'_') then continue; + inc(p); + if not ReadInt(FPCPatch) then continue; + exit; + end; + end; +end; + function TCodeToolManager.Explore(Code: TCodeBuffer; var ACodeTool: TCodeTool; WithStatements: boolean): boolean; begin diff --git a/components/codetools/expreval.pas b/components/codetools/expreval.pas index 939e158b79..141fb31ac0 100644 --- a/components/codetools/expreval.pas +++ b/components/codetools/expreval.pas @@ -61,15 +61,15 @@ type function IndexOfName(const VarName: string): integer; procedure Expand; public - property Variables[const Name:string]: string + property Variables[const Name: string]: string read GetVariables write SetVariables; default; property Count: integer read FCount; - procedure Undefine(const Name:string); - function IsDefined(const Name:string): boolean; + procedure Undefine(const Name: string); + function IsDefined(const Name: string): boolean; function Equals(AnExpressionEvaluator: TExpressionEvaluator): boolean; procedure Assign(SourceExpressionEvaluator: TExpressionEvaluator); procedure AssignTo(SL: TStringList); - function Eval(const Expression:string):string; + function Eval(const Expression: string):string; property ErrorPosition:integer read ErrorPos; property OnChange: TOnValuesChanged read FOnChange write FOnChange; function Items(Index: integer): string; diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas index 5a80e7482c..bd41333a5a 100644 --- a/ide/buildlazdialog.pas +++ b/ide/buildlazdialog.pas @@ -133,7 +133,7 @@ type procedure Assign(Source: TBuildLazarusOptions); procedure SetBuildAll; function FindName(const Name: string): TBuildLazarusItem; - function CompiledUnitExt: string; + function CompiledUnitExt(FPCVersion, FPCRelease: integer): string; public property Count: integer read GetCount; property Items[Index: integer]: TBuildLazarusItem read GetItems; @@ -207,7 +207,8 @@ function ShowConfigureBuildLazarusDlg( function BuildLazarus(Options: TBuildLazarusOptions; ExternalTools: TExternalToolList; Macros: TTransferMacroList; - const PackageOptions: string; Flags: TBuildLazarusFlags): TModalResult; + const PackageOptions, CompilerPath: string; + Flags: TBuildLazarusFlags): TModalResult; function CreateBuildLazarusOptions(Options: TBuildLazarusOptions; ItemIndex: integer; Macros: TTransferMacroList; const PackageOptions: string; Flags: TBuildLazarusFlags; @@ -280,7 +281,8 @@ end; function BuildLazarus(Options: TBuildLazarusOptions; ExternalTools: TExternalToolList; Macros: TTransferMacroList; - const PackageOptions: string; Flags: TBuildLazarusFlags): TModalResult; + const PackageOptions, CompilerPath: string; + Flags: TBuildLazarusFlags): TModalResult; var Tool: TExternalToolOptions; i: Integer; @@ -295,6 +297,8 @@ begin Tool.Filename:=Options.MakeFilename; Tool.EnvironmentOverrides.Values['LCL_PLATFORM']:= LCLPlatformNames[Options.LCLPlatform]; + if CompilerPath<>'' then + Tool.EnvironmentOverrides.Values['PP']:=CompilerPath; if not FileExists(Tool.Filename) then begin Tool.Filename:=FindDefaultMakePath; if not FileExists(Tool.Filename) then exit; @@ -1004,16 +1008,14 @@ begin end; end; -function TBuildLazarusOptions.CompiledUnitExt: string; +function TBuildLazarusOptions.CompiledUnitExt(FPCVersion, FPCRelease: integer + ): string; begin - Result:=GetDefaultCompiledUnitExt; - if AnsiCompareText(TargetOS,'win32')=0 then + Result:=GetDefaultCompiledUnitExt(FPCVersion,FPCRelease); + if (AnsiCompareText(TargetOS,'win32')=0) + and (FPCVersion=1) and (FPCRelease=0) then Result:='.ppw' - else if (AnsiCompareText(TargetOS,'linux')=0) - or (AnsiCompareText(TargetOS,'freebsd')=0) - or (AnsiCompareText(TargetOS,'netbsd')=0) - or (AnsiCompareText(TargetOS,'openbsd')=0) - then + else Result:='.ppu'; end; diff --git a/ide/include/unix/lazbaseconf.inc b/ide/include/unix/lazbaseconf.inc index 9c796911a4..0bb2ebeede 100644 --- a/ide/include/unix/lazbaseconf.inc +++ b/ide/include/unix/lazbaseconf.inc @@ -154,7 +154,7 @@ begin Result:=''; end; -function GetDefaultCompiledUnitExt: string; +function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string; begin Result:='.ppu'; end; diff --git a/ide/include/win32/lazconf.inc b/ide/include/win32/lazconf.inc index 2cd6f18c82..905f5aab93 100644 --- a/ide/include/win32/lazconf.inc +++ b/ide/include/win32/lazconf.inc @@ -136,9 +136,12 @@ begin Result:='.exe'; end; -function GetDefaultCompiledUnitExt: string; +function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string; begin - Result:='.ppw'; + if (FPCVersion=1) and (FPCRelease=0) then + Result:='.ppw' + else + Result:='.ppu'; end; function GetDefaultTestBuildDirectory: string; @@ -179,6 +182,9 @@ end; { $Log$ + Revision 1.18 2003/11/16 19:28:33 mattias + build lazarus now uses custom compiler path + Revision 1.17 2003/11/15 13:07:09 mattias added ambigious unit check for IDE diff --git a/ide/lazconf.pp b/ide/lazconf.pp index 3b18abdd56..7a0332980f 100644 --- a/ide/lazconf.pp +++ b/ide/lazconf.pp @@ -80,7 +80,7 @@ uses function GetDefaultExecutableExt: string; // returns the standard file extension for compiled units (e.g '.ppu') - function GetDefaultCompiledUnitExt: string; + function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string; procedure GetDefaultCompilerFilenames(List: TStrings); procedure GetDefaultTestBuildDirs(List: TStrings); @@ -143,6 +143,9 @@ end. { $Log$ + Revision 1.21 2003/11/16 19:28:33 mattias + build lazarus now uses custom compiler path + Revision 1.20 2003/11/15 13:07:09 mattias added ambigious unit check for IDE diff --git a/ide/main.pp b/ide/main.pp index 439616a27e..4e0b53df9f 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -5899,6 +5899,8 @@ var PkgOptions: string; IDEBuildFlags: TBuildLazarusFlags; InheritedOptionStrings: TInheritedCompOptsStrings; + CompiledUnitExt: String; + FPCVersion, FPCRelease, FPCPatch: integer; begin if ToolStatus<>itNone then begin MessageDlg(lisNotNow, @@ -5913,7 +5915,8 @@ begin SourceNotebook.ClearErrorLines; Result:=BuildLazarus(MiscellaneousOptions.BuildLazOpts, EnvironmentOptions.ExternalTools,MacroList, - '',Flags+[blfWithoutLinkingIDE]); + '',EnvironmentOptions.CompilerFilename, + Flags+[blfWithoutLinkingIDE]); if Result<>mrOk then exit; // then compile the IDE @@ -5936,10 +5939,15 @@ begin PkgOptions:=PkgBoss.DoGetIDEInstallPackageOptions(InheritedOptionStrings); // check ambigious units + CodeToolBoss.GetFPCVersionForDirectory( + EnvironmentOptions.LazarusDirectory, + FPCVersion,FPCRelease,FPCPatch); + CompiledUnitExt:=MiscellaneousOptions.BuildLazOpts.CompiledUnitExt( + FPCVersion,FPCRelease); Result:=DoCheckUnitPathForAmbigiousPascalFiles( EnvironmentOptions.LazarusDirectory, InheritedOptionStrings[icoUnitPath], - MiscellaneousOptions.BuildLazOpts.CompiledUnitExt,'IDE'); + CompiledUnitExt,'IDE'); if Result<>mrOk then exit; end; @@ -5953,7 +5961,8 @@ begin SourceNotebook.ClearErrorLines; Result:=BuildLazarus(MiscellaneousOptions.BuildLazOpts, EnvironmentOptions.ExternalTools,MacroList, - PkgOptions,IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean]); + PkgOptions,EnvironmentOptions.CompilerFilename, + IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean]); if Result<>mrOk then exit; finally DoCheckFilesOnDisk; @@ -10091,6 +10100,9 @@ end. { ============================================================================= $Log$ + Revision 1.670 2003/11/16 19:28:33 mattias + build lazarus now uses custom compiler path + Revision 1.669 2003/11/16 01:56:15 mattias changed TMenuItem.Graphic to TMenuItem.Bitmap