mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 23:18:01 +02:00
implemented compiler options parsed optins with platform independent makros, disabled string highlighting
git-svn-id: trunk@8573 -
This commit is contained in:
parent
61e4e8ec4e
commit
d7347356ff
@ -1,5 +1,5 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
{ Diese Datei wurde automatisch von Lazarus erzeugt. Sie darf nicht bearbeitet werden!
|
||||
Dieser Quelltext dient nur dem Übersetzen und Installieren des Packages.
|
||||
}
|
||||
|
||||
unit RunTimeTypeInfoControls;
|
||||
|
@ -835,7 +835,10 @@ end;
|
||||
|
||||
function TSynPasSyn.Func87: TtkTokenKind;
|
||||
begin
|
||||
if KeyComp('String') then Result := tkKey else Result := tkIdentifier;
|
||||
{$IFNDEF SYN_LAZARUS}
|
||||
if KeyComp('String') then Result := tkKey else
|
||||
{$ENDIF}
|
||||
Result := tkIdentifier;
|
||||
end;
|
||||
|
||||
function TSynPasSyn.Func88: TtkTokenKind;
|
||||
|
@ -131,10 +131,23 @@ const
|
||||
pcosLinkerOptions, // icoLinkerOptions,
|
||||
pcosCustomOptions // icoCustomOptions
|
||||
);
|
||||
|
||||
CompilerOptionMacroNormal = 0;
|
||||
CompilerOptionMacroPlatformIndependent = 1;
|
||||
|
||||
type
|
||||
TLocalSubstitutionEvent = function(const s: string): string of object;
|
||||
TLocalSubstitutionEvent = function(const s: string;
|
||||
PlatformIndependent: boolean): string of object;
|
||||
TGetWritableOutputDirectory = procedure(var s: string) of object;
|
||||
|
||||
TCompilerOptionsParseType = (
|
||||
coptUnparsed, // no macros resolved
|
||||
coptParsed, // all macros resolved
|
||||
coptParsedPlatformIndependent // all but platform macros resolved
|
||||
);
|
||||
|
||||
TInheritedCompOptsParseTypesStrings =
|
||||
array[TCompilerOptionsParseType] of TInheritedCompOptsStrings;
|
||||
|
||||
{ TParsedCompilerOptions }
|
||||
|
||||
@ -145,16 +158,23 @@ type
|
||||
FOnLocalSubstitute: TLocalSubstitutionEvent;
|
||||
public
|
||||
UnparsedValues: array[TParsedCompilerOptString] of string;
|
||||
// parsed
|
||||
ParsedValues: array[TParsedCompilerOptString] of string;
|
||||
ParsedStamp: array[TParsedCompilerOptString] of integer;
|
||||
Parsing: array[TParsedCompilerOptString] of boolean;
|
||||
// parsed except for platform macros
|
||||
ParsedPIValues: array[TParsedCompilerOptString] of string;
|
||||
ParsedPIStamp: array[TParsedCompilerOptString] of integer;
|
||||
ParsingPI: array[TParsedCompilerOptString] of boolean;
|
||||
constructor Create;
|
||||
function GetParsedValue(Option: TParsedCompilerOptString): string;
|
||||
function GetParsedPIValue(Option: TParsedCompilerOptString): string;
|
||||
procedure SetUnparsedValue(Option: TParsedCompilerOptString;
|
||||
const NewValue: string);
|
||||
function DoParseOption(const OptionText: string;
|
||||
Option: TParsedCompilerOptString;
|
||||
UseGetWritableOutputDirectory: boolean): string;
|
||||
Option: TParsedCompilerOptString;
|
||||
UseGetWritableOutputDirectory,
|
||||
PlatformIndependent: boolean): string;
|
||||
procedure Clear;
|
||||
procedure InvalidateAll;
|
||||
procedure InvalidateFiles;
|
||||
@ -169,7 +189,8 @@ type
|
||||
|
||||
TParseStringEvent =
|
||||
function(Options: TParsedCompilerOptions;
|
||||
const UnparsedValue: string): string of object;
|
||||
const UnparsedValue: string; PlatformIndependent: boolean
|
||||
): string of object;
|
||||
|
||||
|
||||
{ TBaseCompilerOptions }
|
||||
@ -217,8 +238,7 @@ type
|
||||
private
|
||||
FBaseDirectory: string;
|
||||
FDefaultMakeOptionsFlags: TCompilerCmdLineOptions;
|
||||
fInheritedParsedOptions: TInheritedCompOptsStrings;
|
||||
fInheritedUnparsedOptions: TInheritedCompOptsStrings;
|
||||
fInheritedOptions: TInheritedCompOptsParseTypesStrings;
|
||||
fInheritedOptParseStamps: integer;
|
||||
fInheritedOptGraphStamps: integer;
|
||||
fLoaded: Boolean;
|
||||
@ -279,22 +299,30 @@ type
|
||||
function GetOwnerName: string; virtual;
|
||||
function GetInheritedOption(Option: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string; virtual;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed
|
||||
): string; virtual;
|
||||
function GetDefaultMainSourceFileName: string; virtual;
|
||||
function NeedsLinkerOpts: boolean;
|
||||
function GetUnitPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed): string;
|
||||
function GetIncludePath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed): string;
|
||||
function GetSrcPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed): string;
|
||||
function GetLibraryPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed): string;
|
||||
function GetUnitOutPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed): string;
|
||||
function GetPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
function GetParsedPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean): string;
|
||||
function GetParsedPIPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean): string;
|
||||
function GetUnparsedPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean): string;
|
||||
@ -396,9 +424,11 @@ var
|
||||
procedure IncreaseCompilerParseStamp;
|
||||
procedure IncreaseCompilerGraphStamp;
|
||||
function ParseString(Options: TParsedCompilerOptions;
|
||||
const UnparsedValue: string): string;
|
||||
const UnparsedValue: string;
|
||||
PlatformIndependent: boolean): string;
|
||||
|
||||
procedure GatherInheritedOptions(AddOptionsList: TList; Parsed: boolean;
|
||||
procedure GatherInheritedOptions(AddOptionsList: TList;
|
||||
Parsed: TCompilerOptionsParseType;
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings);
|
||||
function InheritedOptionsToCompilerParameters(
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings;
|
||||
@ -444,12 +474,13 @@ begin
|
||||
end;
|
||||
|
||||
function ParseString(Options: TParsedCompilerOptions;
|
||||
const UnparsedValue: string): string;
|
||||
const UnparsedValue: string; PlatformIndependent: boolean): string;
|
||||
begin
|
||||
Result:=OnParseString(Options,UnparsedValue);
|
||||
Result:=OnParseString(Options,UnparsedValue,PlatformIndependent);
|
||||
end;
|
||||
|
||||
procedure GatherInheritedOptions(AddOptionsList: TList; Parsed: boolean;
|
||||
procedure GatherInheritedOptions(AddOptionsList: TList;
|
||||
Parsed: TCompilerOptionsParseType;
|
||||
var InheritedOptionStrings: TInheritedCompOptsStrings);
|
||||
var
|
||||
i: Integer;
|
||||
@ -463,36 +494,72 @@ begin
|
||||
AddOptions:=TAdditionalCompilerOptions(AddOptionsList[i]);
|
||||
if (not (AddOptions is TAdditionalCompilerOptions)) then continue;
|
||||
|
||||
if Parsed then begin
|
||||
// unit search path
|
||||
InheritedOptionStrings[icoUnitPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoUnitPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosUnitPath));
|
||||
// include search path
|
||||
InheritedOptionStrings[icoIncludePath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoIncludePath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosIncludePath));
|
||||
// src search path
|
||||
InheritedOptionStrings[icoSrcPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoSrcPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosSrcPath));
|
||||
// object search path
|
||||
InheritedOptionStrings[icoObjectPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoObjectPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosObjectPath));
|
||||
// library search path
|
||||
InheritedOptionStrings[icoLibraryPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoLibraryPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosLibraryPath));
|
||||
// linker options
|
||||
InheritedOptionStrings[icoLinkerOptions]:=
|
||||
MergeLinkerOptions(InheritedOptionStrings[icoLinkerOptions],
|
||||
case Parsed of
|
||||
coptParsed:
|
||||
begin
|
||||
// unit search path
|
||||
InheritedOptionStrings[icoUnitPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoUnitPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosUnitPath));
|
||||
// include search path
|
||||
InheritedOptionStrings[icoIncludePath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoIncludePath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosIncludePath));
|
||||
// src search path
|
||||
InheritedOptionStrings[icoSrcPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoSrcPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosSrcPath));
|
||||
// object search path
|
||||
InheritedOptionStrings[icoObjectPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoObjectPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosObjectPath));
|
||||
// library search path
|
||||
InheritedOptionStrings[icoLibraryPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoLibraryPath],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosLibraryPath));
|
||||
// linker options
|
||||
InheritedOptionStrings[icoLinkerOptions]:=
|
||||
MergeLinkerOptions(InheritedOptionStrings[icoLinkerOptions],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosLinkerOptions));
|
||||
// custom options
|
||||
InheritedOptionStrings[icoCustomOptions]:=
|
||||
MergeCustomOptions(InheritedOptionStrings[icoCustomOptions],
|
||||
// custom options
|
||||
InheritedOptionStrings[icoCustomOptions]:=
|
||||
MergeCustomOptions(InheritedOptionStrings[icoCustomOptions],
|
||||
AddOptions.ParsedOpts.GetParsedValue(pcosCustomOptions));
|
||||
end else begin
|
||||
end;
|
||||
|
||||
coptParsedPlatformIndependent:
|
||||
begin
|
||||
// unit search path
|
||||
InheritedOptionStrings[icoUnitPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoUnitPath],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosUnitPath));
|
||||
// include search path
|
||||
InheritedOptionStrings[icoIncludePath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoIncludePath],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosIncludePath));
|
||||
// src search path
|
||||
InheritedOptionStrings[icoSrcPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoSrcPath],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosSrcPath));
|
||||
// object search path
|
||||
InheritedOptionStrings[icoObjectPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoObjectPath],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosObjectPath));
|
||||
// library search path
|
||||
InheritedOptionStrings[icoLibraryPath]:=
|
||||
MergeSearchPaths(InheritedOptionStrings[icoLibraryPath],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosLibraryPath));
|
||||
// linker options
|
||||
InheritedOptionStrings[icoLinkerOptions]:=
|
||||
MergeLinkerOptions(InheritedOptionStrings[icoLinkerOptions],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosLinkerOptions));
|
||||
// custom options
|
||||
InheritedOptionStrings[icoCustomOptions]:=
|
||||
MergeCustomOptions(InheritedOptionStrings[icoCustomOptions],
|
||||
AddOptions.ParsedOpts.GetParsedPIValue(pcosCustomOptions));
|
||||
end;
|
||||
|
||||
coptUnparsed:
|
||||
for o:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption)
|
||||
do begin
|
||||
UnparsedOption:=AddOptions.GetOption(o);
|
||||
@ -1197,14 +1264,15 @@ end;
|
||||
procedure TBaseCompilerOptions.ClearInheritedOptions;
|
||||
var
|
||||
i: TInheritedCompilerOption;
|
||||
p: TCompilerOptionsParseType;
|
||||
begin
|
||||
fInheritedOptParseStamps:=InvalidParseStamp;
|
||||
fInheritedOptGraphStamps:=InvalidParseStamp;
|
||||
for i:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption) do
|
||||
begin
|
||||
fInheritedParsedOptions[i]:='';
|
||||
fInheritedUnparsedOptions[i]:='';
|
||||
end;
|
||||
for p:=Low(TCompilerOptionsParseType) to High(TCompilerOptionsParseType) do
|
||||
for i:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption) do
|
||||
begin
|
||||
fInheritedOptions[p][i]:='';
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1271,13 +1339,14 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
function TBaseCompilerOptions.GetInheritedOption(
|
||||
Option: TInheritedCompilerOption; RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
------------------------------------------------------------------------------}
|
||||
function TBaseCompilerOptions.GetInheritedOption(
|
||||
Option: TInheritedCompilerOption; RelativeToBaseDir: boolean;
|
||||
Parsed: boolean): string;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
var
|
||||
OptionsList: TList;
|
||||
p: TCompilerOptionsParseType;
|
||||
begin
|
||||
if (fInheritedOptParseStamps<>CompilerParseStamp)
|
||||
or (fInheritedOptGraphStamps<>CompilerGraphStamp)
|
||||
@ -1287,17 +1356,16 @@ begin
|
||||
OptionsList:=nil;
|
||||
GetInheritedCompilerOptions(OptionsList);
|
||||
if OptionsList<>nil then begin
|
||||
GatherInheritedOptions(OptionsList,true,fInheritedParsedOptions);
|
||||
GatherInheritedOptions(OptionsList,false,fInheritedUnparsedOptions);
|
||||
for p:=Low(TCompilerOptionsParseType) to High(TCompilerOptionsParseType)
|
||||
do begin
|
||||
GatherInheritedOptions(OptionsList,p,fInheritedOptions[p]);
|
||||
end;
|
||||
OptionsList.Free;
|
||||
end;
|
||||
fInheritedOptParseStamps:=CompilerParseStamp;
|
||||
fInheritedOptGraphStamps:=CompilerGraphStamp;
|
||||
end;
|
||||
if Parsed then
|
||||
Result:=fInheritedParsedOptions[Option]
|
||||
else
|
||||
Result:=fInheritedUnparsedOptions[Option];
|
||||
Result:=fInheritedOptions[Parsed][Option];
|
||||
if RelativeToBaseDir then begin
|
||||
if Option in [icoUnitPath,icoIncludePath,icoObjectPath,icoLibraryPath] then
|
||||
Result:=CreateRelativeSearchPath(Result,BaseDirectory);
|
||||
@ -1315,52 +1383,58 @@ begin
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetUnitPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean): string;
|
||||
Parsed: TCompilerOptionsParseType = coptParsed): string;
|
||||
begin
|
||||
if Parsed then
|
||||
Result:=GetParsedPath(pcosUnitPath,icoUnitPath,RelativeToBaseDir)
|
||||
else
|
||||
Result:=GetUnparsedPath(pcosUnitPath,icoUnitPath,RelativeToBaseDir)
|
||||
Result:=GetPath(pcosUnitPath,icoUnitPath,RelativeToBaseDir,Parsed);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetIncludePath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean): string;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
begin
|
||||
if Parsed then
|
||||
Result:=GetParsedPath(pcosIncludePath,icoIncludePath,RelativeToBaseDir)
|
||||
else
|
||||
Result:=GetUnparsedPath(pcosIncludePath,icoIncludePath,RelativeToBaseDir);
|
||||
Result:=GetPath(pcosIncludePath,icoIncludePath,RelativeToBaseDir,Parsed);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetSrcPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean): string;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
begin
|
||||
if Parsed then
|
||||
Result:=GetParsedPath(pcosSrcPath,icoSrcPath,RelativeToBaseDir)
|
||||
else
|
||||
Result:=GetUnparsedPath(pcosSrcPath,icoSrcPath,RelativeToBaseDir);
|
||||
Result:=GetPath(pcosSrcPath,icoSrcPath,RelativeToBaseDir,Parsed);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetLibraryPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean): string;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
begin
|
||||
if Parsed then
|
||||
Result:=GetParsedPath(pcosLibraryPath,icoLibraryPath,RelativeToBaseDir)
|
||||
else
|
||||
Result:=GetUnparsedPath(pcosLibraryPath,icoLibraryPath,RelativeToBaseDir);
|
||||
Result:=GetPath(pcosLibraryPath,icoLibraryPath,RelativeToBaseDir,Parsed);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetUnitOutPath(RelativeToBaseDir: boolean;
|
||||
Parsed: boolean = true): string;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
begin
|
||||
if Parsed then
|
||||
Result:=ParsedOpts.GetParsedValue(pcosOutputDir)
|
||||
else
|
||||
Result:=ParsedOpts.UnparsedValues[pcosOutputDir];
|
||||
case Parsed of
|
||||
coptUnparsed: Result:=ParsedOpts.UnparsedValues[pcosOutputDir];
|
||||
coptParsed: Result:=ParsedOpts.GetParsedValue(pcosOutputDir);
|
||||
coptParsedPlatformIndependent:
|
||||
Result:=ParsedOpts.GetParsedPIValue(pcosOutputDir);
|
||||
end;
|
||||
if (not RelativeToBaseDir) then
|
||||
CreateAbsoluteSearchPath(Result,BaseDirectory);
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption; RelativeToBaseDir: boolean;
|
||||
Parsed: TCompilerOptionsParseType): string;
|
||||
begin
|
||||
case Parsed of
|
||||
coptUnparsed:
|
||||
Result:=GetUnparsedPath(Option,InheritedOption,RelativeToBaseDir);
|
||||
coptParsed:
|
||||
Result:=GetParsedPath(Option,InheritedOption,RelativeToBaseDir);
|
||||
coptParsedPlatformIndependent:
|
||||
Result:=GetParsedPIPath(Option,InheritedOption,RelativeToBaseDir);
|
||||
else
|
||||
RaiseGDBException('');
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetParsedPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption;
|
||||
RelativeToBaseDir: boolean): string;
|
||||
@ -1383,7 +1457,7 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
// inherited path
|
||||
InheritedPath:=GetInheritedOption(InheritedOption,RelativeToBaseDir,true);
|
||||
InheritedPath:=GetInheritedOption(InheritedOption,RelativeToBaseDir,coptParsed);
|
||||
{$IFDEF VerbosePkgUnitPath}
|
||||
if Option=pcosUnitPath then
|
||||
debugln('TBaseCompilerOptions.GetParsedPath Inherited ',dbgsName(Self),' InheritedPath="',InheritedPath,'"');
|
||||
@ -1396,6 +1470,42 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetParsedPIPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption; RelativeToBaseDir: boolean
|
||||
): string;
|
||||
var
|
||||
CurrentPath: String;
|
||||
InheritedPath: String;
|
||||
begin
|
||||
// current path
|
||||
CurrentPath:=ParsedOpts.GetParsedPIValue(Option);
|
||||
{$IFDEF VerbosePkgUnitPath}
|
||||
if Option=pcosUnitPath then
|
||||
debugln('TBaseCompilerOptions.GetParsedPIPath GetParsedPIValue ',dbgsName(Self),' RelativeToBaseDir=',dbgs(RelativeToBaseDir),' CurrentPath="',CurrentPath,'"');
|
||||
{$ENDIF}
|
||||
|
||||
if (not RelativeToBaseDir) then
|
||||
CreateAbsoluteSearchPath(CurrentPath,BaseDirectory);
|
||||
{$IFDEF VerbosePkgUnitPath}
|
||||
if Option=pcosUnitPath then
|
||||
debugln('TBaseCompilerOptions.GetParsedPIPath CreateAbsoluteSearchPath ',dbgsName(Self),' CurrentPath="',CurrentPath,'"');
|
||||
{$ENDIF}
|
||||
|
||||
// inherited path
|
||||
InheritedPath:=GetInheritedOption(InheritedOption,RelativeToBaseDir,
|
||||
coptParsedPlatformIndependent);
|
||||
{$IFDEF VerbosePkgUnitPath}
|
||||
if Option=pcosUnitPath then
|
||||
debugln('TBaseCompilerOptions.GetParsedPIPath Inherited ',dbgsName(Self),' InheritedPath="',InheritedPath,'"');
|
||||
{$ENDIF}
|
||||
|
||||
Result:=MergeSearchPaths(CurrentPath,InheritedPath);
|
||||
{$IFDEF VerbosePkgUnitPath}
|
||||
if Option=pcosUnitPath then
|
||||
debugln('TBaseCompilerOptions.GetParsedPIPath Total ',dbgsName(Self),' Result="',Result,'"');
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetUnparsedPath(Option: TParsedCompilerOptString;
|
||||
InheritedOption: TInheritedCompilerOption; RelativeToBaseDir: boolean
|
||||
): string;
|
||||
@ -1418,7 +1528,8 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
// inherited path
|
||||
InheritedPath:=GetInheritedOption(InheritedOption,RelativeToBaseDir,false);
|
||||
InheritedPath:=GetInheritedOption(InheritedOption,RelativeToBaseDir,
|
||||
coptUnparsed);
|
||||
{$IFDEF VerbosePkgUnitPath}
|
||||
if Option=pcosUnitPath then
|
||||
debugln('TBaseCompilerOptions.GetUnparsedPath Inherited ',dbgsName(Self),' InheritedPath="',InheritedPath,'"');
|
||||
@ -1439,7 +1550,7 @@ begin
|
||||
// custom options
|
||||
CurCustomOptions:=ParsedOpts.GetParsedValue(pcosCustomOptions);
|
||||
// inherited custom options
|
||||
InhCustomOptions:=GetInheritedOption(icoCustomOptions,true,true);
|
||||
InhCustomOptions:=GetInheritedOption(icoCustomOptions,true,coptParsed);
|
||||
// concatenate
|
||||
if CurCustomOptions<>'' then
|
||||
Result:=CurCustomOptions+' '+InhCustomOptions
|
||||
@ -1848,7 +1959,7 @@ Processor specific options:
|
||||
|
||||
// inherited Linker options
|
||||
if (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
InhLinkerOpts:=GetInheritedOption(icoLinkerOptions,true,true);
|
||||
InhLinkerOpts:=GetInheritedOption(icoLinkerOptions,true,coptParsed);
|
||||
if InhLinkerOpts<>'' then
|
||||
switches := switches + ' ' + ConvertOptionsToCmdLine(' ','-k', InhLinkerOpts);
|
||||
end;
|
||||
@ -1941,7 +2052,7 @@ Processor specific options:
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', CurObjectPath);
|
||||
|
||||
// inherited object path
|
||||
InhObjectPath:=GetInheritedOption(icoObjectPath,true,true);
|
||||
InhObjectPath:=GetInheritedOption(icoObjectPath,true,coptParsed);
|
||||
if (InhObjectPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', InhObjectPath);
|
||||
|
||||
@ -2496,7 +2607,7 @@ begin
|
||||
end;
|
||||
Parsing[Option]:=true;
|
||||
try
|
||||
s:=DoParseOption(UnparsedValues[Option],Option,true);
|
||||
s:=DoParseOption(UnparsedValues[Option],Option,true,false);
|
||||
ParsedValues[Option]:=s;
|
||||
ParsedStamp[Option]:=CompilerParseStamp;
|
||||
//if Option=pcosCustomOptions then begin
|
||||
@ -2509,6 +2620,31 @@ begin
|
||||
Result:=ParsedValues[Option];
|
||||
end;
|
||||
|
||||
function TParsedCompilerOptions.GetParsedPIValue(
|
||||
Option: TParsedCompilerOptString): string;
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
if ParsedPIStamp[Option]<>CompilerParseStamp then begin
|
||||
if ParsingPI[Option] then begin
|
||||
DebugLn('TParsedCompilerOptions.GetParsedPIValue Circle in Options: ',ParsedCompilerOptStringNames[Option]);
|
||||
exit('');
|
||||
end;
|
||||
ParsingPI[Option]:=true;
|
||||
try
|
||||
s:=DoParseOption(UnparsedValues[Option],Option,false,true);
|
||||
ParsedPIValues[Option]:=s;
|
||||
ParsedPIStamp[Option]:=CompilerParseStamp;
|
||||
//if Option=pcosCustomOptions then begin
|
||||
// DebugLn('TParsedCompilerOptions.GetParsedValue PARSED ',dbgs(ParsedStamp[Option]),' ',dbgs(CompilerParseStamp),' new="',ParsedValues[Option],'"');
|
||||
//end;
|
||||
finally
|
||||
ParsingPI[Option]:=false;
|
||||
end;
|
||||
end;
|
||||
Result:=ParsedPIValues[Option];
|
||||
end;
|
||||
|
||||
procedure TParsedCompilerOptions.SetUnparsedValue(
|
||||
Option: TParsedCompilerOptString; const NewValue: string);
|
||||
begin
|
||||
@ -2516,23 +2652,26 @@ begin
|
||||
if InvalidateGraphOnChange then IncreaseCompilerGraphStamp;
|
||||
if Option=pcosBaseDir then
|
||||
InvalidateFiles
|
||||
else
|
||||
else begin
|
||||
ParsedStamp[Option]:=InvalidParseStamp;
|
||||
ParsedPIStamp[Option]:=InvalidParseStamp;
|
||||
end;
|
||||
UnparsedValues[Option]:=NewValue;
|
||||
end;
|
||||
|
||||
function TParsedCompilerOptions.DoParseOption(const OptionText: string;
|
||||
Option: TParsedCompilerOptString; UseGetWritableOutputDirectory: boolean
|
||||
): string;
|
||||
Option: TParsedCompilerOptString; UseGetWritableOutputDirectory,
|
||||
PlatformIndependent: boolean): string;
|
||||
var
|
||||
s: String;
|
||||
BaseDirectory: String;
|
||||
begin
|
||||
s:=OptionText;
|
||||
// parse locally
|
||||
if Assigned(OnLocalSubstitute) then s:=OnLocalSubstitute(s);
|
||||
if Assigned(OnLocalSubstitute) then
|
||||
s:=OnLocalSubstitute(s,PlatformIndependent);
|
||||
// parse globally
|
||||
s:=ParseString(Self,s);
|
||||
s:=ParseString(Self,s,PlatformIndependent);
|
||||
// improve
|
||||
if Option=pcosBaseDir then
|
||||
// base directory (append path)
|
||||
@ -2541,7 +2680,10 @@ begin
|
||||
// make filename absolute
|
||||
s:=TrimFilename(s);
|
||||
if (s<>'') and (not FilenameIsAbsolute(s)) then begin
|
||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||
if PlatformIndependent then
|
||||
BaseDirectory:=GetParsedPIValue(pcosBaseDir)
|
||||
else
|
||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||
if (BaseDirectory<>'') then s:=TrimFilename(BaseDirectory+s);
|
||||
end;
|
||||
end
|
||||
@ -2550,7 +2692,10 @@ begin
|
||||
s:=TrimFilename(s);
|
||||
if (s='') or (not FilenameIsAbsolute(s))
|
||||
and (Option<>pcosBaseDir) then begin
|
||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||
if PlatformIndependent then
|
||||
BaseDirectory:=GetParsedPIValue(pcosBaseDir)
|
||||
else
|
||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||
if (BaseDirectory<>'') then s:=TrimFilename(BaseDirectory+s);
|
||||
if (Option in ParsedCompilerOutDirectories)
|
||||
and UseGetWritableOutputDirectory
|
||||
@ -2562,7 +2707,10 @@ begin
|
||||
end
|
||||
else if Option in ParsedCompilerSearchPaths then begin
|
||||
// make search paths absolute
|
||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||
if PlatformIndependent then
|
||||
BaseDirectory:=GetParsedPIValue(pcosBaseDir)
|
||||
else
|
||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||
s:=TrimSearchPath(s,BaseDirectory);
|
||||
end;
|
||||
Result:=s;
|
||||
@ -2576,6 +2724,7 @@ begin
|
||||
for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do
|
||||
begin
|
||||
ParsedValues[Option]:='';
|
||||
ParsedPIValues[Option]:='';
|
||||
UnparsedValues[Option]:='';
|
||||
end;
|
||||
end;
|
||||
@ -2585,7 +2734,10 @@ var
|
||||
Option: TParsedCompilerOptString;
|
||||
begin
|
||||
for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do
|
||||
begin
|
||||
ParsedStamp[Option]:=InvalidParseStamp;
|
||||
ParsedPIStamp[Option]:=InvalidParseStamp;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TParsedCompilerOptions.InvalidateFiles;
|
||||
@ -2593,8 +2745,10 @@ var
|
||||
Option: TParsedCompilerOptString;
|
||||
begin
|
||||
for Option:=Low(TParsedCompilerOptString) to High(TParsedCompilerOptString) do
|
||||
if (Option in ParsedCompilerFiles) then
|
||||
if (Option in ParsedCompilerFiles) then begin
|
||||
ParsedStamp[Option]:=InvalidParseStamp;
|
||||
ParsedPIStamp[Option]:=InvalidParseStamp;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TCompilationToolOptions }
|
||||
|
@ -176,7 +176,7 @@ begin
|
||||
OpenPackageMenuItem.Caption:='Open Package '+APackage.IDAsString;
|
||||
OpenPackageMenuItem.Visible:=true;
|
||||
ShownFilename:=PkgComponent.PkgFile.Filename;
|
||||
UnitFilename:=APackage.SubstitutePkgMacro(ShownFilename);
|
||||
UnitFilename:=APackage.SubstitutePkgMacro(ShownFilename,true);
|
||||
LazarusIDE.SubstituteMakros(UnitFilename);
|
||||
if not FileExists(UnitFilename) then begin
|
||||
UnitFilename:=LazarusIDE.FindSourceFile(ExtractFilename(UnitFilename),
|
||||
|
47
ide/main.pp
47
ide/main.pp
@ -802,12 +802,17 @@ type
|
||||
function GetTargetCPU(UseCache: boolean): string;
|
||||
function GetTargetOS(UseCache: boolean): string;
|
||||
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s: string;
|
||||
const Data: PtrInt;
|
||||
var Handled, Abort: boolean);
|
||||
function OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
|
||||
const UnparsedValue: string): string;
|
||||
function OnMacroPromptFunction(const s:string; var Abort: boolean): string;
|
||||
function OnMacroFuncMakeExe(const Filename:string; var Abort: boolean): string;
|
||||
function OnMacroFuncProject(const Param: string; var Abort: boolean): string;
|
||||
const UnparsedValue: string;
|
||||
PlatformIndependent: boolean): string;
|
||||
function OnMacroPromptFunction(const s:string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
function OnMacroFuncMakeExe(const Filename:string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
function OnMacroFuncProject(const Param: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
function OnMacroFuncProjectUnitPath(Data: Pointer): boolean;
|
||||
function OnMacroFuncProjectIncPath(Data: Pointer): boolean;
|
||||
function OnMacroFuncProjectSrcPath(Data: Pointer): boolean;
|
||||
@ -9070,7 +9075,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnMacroSubstitution(TheMacro: TTransferMacro; var s:string;
|
||||
var Handled, Abort: boolean);
|
||||
const Data: PtrInt; var Handled, Abort: boolean);
|
||||
var MacroName:string;
|
||||
begin
|
||||
if TheMacro=nil then begin
|
||||
@ -9138,11 +9143,20 @@ begin
|
||||
end else if MacroName='lazarusdir' then begin
|
||||
s:=EnvironmentOptions.LazarusDirectory;
|
||||
end else if MacroName='lclwidgettype' then begin
|
||||
s:=GetLCLWidgetType(true);
|
||||
if Data=CompilerOptionMacroPlatformIndependent then
|
||||
s:='%(LCL_PLATFORM)'
|
||||
else
|
||||
s:=GetLCLWidgetType(true);
|
||||
end else if MacroName='targetcpu' then begin
|
||||
s:=GetTargetCPU(true);
|
||||
if Data=CompilerOptionMacroPlatformIndependent then
|
||||
s:='%(CPU_TARGET)'
|
||||
else
|
||||
s:=GetTargetCPU(true);
|
||||
end else if MacroName='targetos' then begin
|
||||
s:=GetTargetOS(true);
|
||||
if Data=CompilerOptionMacroPlatformIndependent then
|
||||
s:='%(OS_TARGET)'
|
||||
else
|
||||
s:=GetTargetOS(true);
|
||||
end else if MacroName='fpcsrcdir' then begin
|
||||
s:=EnvironmentOptions.FPCSourceDirectory;
|
||||
end else if MacroName='comppath' then begin
|
||||
@ -9188,22 +9202,25 @@ begin
|
||||
end;
|
||||
|
||||
function TMainIDE.OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
|
||||
const UnparsedValue: string): string;
|
||||
const UnparsedValue: string; PlatformIndependent: boolean): string;
|
||||
begin
|
||||
CurrentParsedCompilerOption:=Options;
|
||||
Result:=UnparsedValue;
|
||||
MacroList.SubstituteStr(Result);
|
||||
if PlatformIndependent then
|
||||
MacroList.SubstituteStr(Result,CompilerOptionMacroPlatformIndependent)
|
||||
else
|
||||
MacroList.SubstituteStr(Result,CompilerOptionMacroNormal);
|
||||
end;
|
||||
|
||||
function TMainIDE.OnMacroPromptFunction(const s:string;
|
||||
var Abort: boolean):string;
|
||||
const Data: PtrInt; var Abort: boolean):string;
|
||||
begin
|
||||
Result:=s;
|
||||
Abort:=(ShowMacroPromptDialog(Result)<>mrOk);
|
||||
end;
|
||||
|
||||
function TMainIDE.OnMacroFuncMakeExe(const Filename: string; var Abort: boolean
|
||||
): string;
|
||||
function TMainIDE.OnMacroFuncMakeExe(const Filename: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
var
|
||||
OldExt: String;
|
||||
ExeExt: String;
|
||||
@ -9216,8 +9233,8 @@ begin
|
||||
DebugLn('TMainIDE.OnMacroFuncMakeExe A ',Filename,' ',Result);
|
||||
end;
|
||||
|
||||
function TMainIDE.OnMacroFuncProject(const Param: string; var Abort: boolean
|
||||
): string;
|
||||
function TMainIDE.OnMacroFuncProject(const Param: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
begin
|
||||
if Project1<>nil then begin
|
||||
if CompareText(Param,'SrcPath')=0 then
|
||||
|
@ -52,9 +52,10 @@ type
|
||||
TTransferMacro = class;
|
||||
|
||||
TOnSubstitution = procedure(TheMacro: TTransferMacro; var s:string;
|
||||
var Handled, Abort: boolean) of object;
|
||||
const Data: PtrInt; var Handled, Abort: boolean) of object;
|
||||
|
||||
TMacroFunction = function(const s:string; var Abort: boolean):string of object;
|
||||
TMacroFunction = function(const s:string; const Data: PtrInt;
|
||||
var Abort: boolean):string of object;
|
||||
|
||||
TTransferMacroFlag = (
|
||||
tmfInteractive
|
||||
@ -81,13 +82,13 @@ type
|
||||
procedure SetItems(Index: integer; NewMacro: TTransferMacro);
|
||||
procedure SetMarkUnhandledMacros(const AValue: boolean);
|
||||
protected
|
||||
function MF_Ext(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_Path(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_Name(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_NameOnly(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_MakeDir(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_MakeFile(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_Trim(const Filename:string; var Abort: boolean):string; virtual;
|
||||
function MF_Ext(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
function MF_Path(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
function MF_Name(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
function MF_NameOnly(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
function MF_MakeDir(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
function MF_MakeFile(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
function MF_Trim(const Filename:string; const Data: PtrInt; var Abort: boolean):string; virtual;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -99,7 +100,7 @@ type
|
||||
procedure Delete(Index: integer);
|
||||
procedure Add(NewMacro: TTransferMacro);
|
||||
function FindByName(const MacroName: string): TTransferMacro; virtual;
|
||||
function SubstituteStr(var s:string): boolean; virtual;
|
||||
function SubstituteStr(var s: string; const Data: PtrInt = 0): boolean; virtual;
|
||||
function StrHasMacros(const s: string): boolean;
|
||||
property OnSubstitution: TOnSubstitution
|
||||
read fOnSubstitution write fOnSubstitution;
|
||||
@ -221,7 +222,8 @@ begin
|
||||
// debugln('TTransferMacroList.Add A ',NewMacro.Name);
|
||||
end;
|
||||
|
||||
function TTransferMacroList.SubstituteStr(var s:string): boolean;
|
||||
function TTransferMacroList.SubstituteStr(var s:string; const Data: PtrInt
|
||||
): boolean;
|
||||
var
|
||||
MacroStart,MacroEnd: integer;
|
||||
MacroName, MacroStr, MacroParam: string;
|
||||
@ -285,13 +287,13 @@ begin
|
||||
// Macro function -> substitute macro parameter first
|
||||
MacroParam:=copy(MacroStr,length(MacroName)+3,
|
||||
length(MacroStr)-length(MacroName)-3);
|
||||
if not SubstituteStr(MacroParam) then begin
|
||||
if not SubstituteStr(MacroParam,Data) then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end;
|
||||
AMacro:=FindByName(MacroName);
|
||||
if Assigned(fOnSubstitution) then begin
|
||||
fOnSubstitution(AMacro,MacroParam,Handled,Abort);
|
||||
fOnSubstitution(AMacro,MacroParam,Data,Handled,Abort);
|
||||
if Handled then
|
||||
MacroStr:=MacroParam
|
||||
else if Abort then begin
|
||||
@ -299,9 +301,9 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
if (not Handled) and (AMacro<>nil) and (Assigned(AMacro.MacroFunction)) then
|
||||
begin
|
||||
MacroStr:=AMacro.MacroFunction(MacroParam,Abort);
|
||||
if (not Handled) and (AMacro<>nil) and (Assigned(AMacro.MacroFunction))
|
||||
then begin
|
||||
MacroStr:=AMacro.MacroFunction(MacroParam,Data,Abort);
|
||||
if Abort then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
@ -313,7 +315,7 @@ begin
|
||||
MacroName:=copy(s,MacroStart+2,OldMacroLen-3);
|
||||
AMacro:=FindByName(MacroName);
|
||||
if Assigned(fOnSubstitution) then begin
|
||||
fOnSubstitution(AMacro,MacroName,Handled,Abort);
|
||||
fOnSubstitution(AMacro,MacroName,Data,Handled,Abort);
|
||||
if Handled then
|
||||
MacroStr:=MacroName
|
||||
else if Abort then begin
|
||||
@ -430,25 +432,25 @@ begin
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_Ext(const Filename:string;
|
||||
var Abort: boolean):string;
|
||||
const Data: PtrInt; var Abort: boolean):string;
|
||||
begin
|
||||
Result:=ExtractFileExt(Filename);
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_Path(const Filename:string;
|
||||
var Abort: boolean):string;
|
||||
const Data: PtrInt; var Abort: boolean):string;
|
||||
begin
|
||||
Result:=TrimFilename(ExtractFilePath(Filename));
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_Name(const Filename:string;
|
||||
var Abort: boolean):string;
|
||||
const Data: PtrInt; var Abort: boolean):string;
|
||||
begin
|
||||
Result:=ExtractFilename(Filename);
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_NameOnly(const Filename:string;
|
||||
var Abort: boolean):string;
|
||||
const Data: PtrInt; var Abort: boolean):string;
|
||||
var Ext:string;
|
||||
begin
|
||||
Result:=ExtractFileName(Filename);
|
||||
@ -457,7 +459,7 @@ begin
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_MakeDir(const Filename: string;
|
||||
var Abort: boolean): string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
begin
|
||||
Result:=Filename;
|
||||
if (Result<>'') and (Result[length(Result)]<>PathDelim) then
|
||||
@ -466,7 +468,7 @@ begin
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_MakeFile(const Filename: string;
|
||||
var Abort: boolean): string;
|
||||
const Data: PtrInt; var Abort: boolean): string;
|
||||
var
|
||||
ChompLen: integer;
|
||||
begin
|
||||
@ -480,8 +482,8 @@ begin
|
||||
Result:=TrimFilename(Result);
|
||||
end;
|
||||
|
||||
function TTransferMacroList.MF_Trim(const Filename: string; var Abort: boolean
|
||||
): string;
|
||||
function TTransferMacroList.MF_Trim(const Filename: string; const Data: PtrInt;
|
||||
var Abort: boolean): string;
|
||||
begin
|
||||
Result:=TrimFilename(Filename);
|
||||
end;
|
||||
|
@ -8279,6 +8279,7 @@ end;
|
||||
function TGtkWidgetSet.SetFocus(hWnd: HWND): HWND;
|
||||
{off $DEFINE VerboseFocus}
|
||||
|
||||
|
||||
function FindFocusWidget(AWidget: PGtkWidget): PGtkWidget;
|
||||
var
|
||||
WinWidgetInfo: PWinWidgetInfo;
|
||||
|
@ -529,7 +529,7 @@ type
|
||||
|
||||
const
|
||||
pupAllAuto = [pupAsNeeded,pupOnRebuildingAll];
|
||||
|
||||
|
||||
type
|
||||
TIterateComponentClassesEvent =
|
||||
procedure(PkgComponent: TPkgComponent) of object;
|
||||
@ -607,7 +607,7 @@ type
|
||||
procedure SetPackageEditor(const AValue: TBasePackageEditor);
|
||||
procedure SetPackageType(const AValue: TLazPackageType);
|
||||
procedure OnMacroListSubstitution(TheMacro: TTransferMacro; var s: string;
|
||||
var Handled, Abort: boolean);
|
||||
const Data: PtrInt; var Handled, Abort: boolean);
|
||||
procedure SetUserReadOnly(const AValue: boolean);
|
||||
procedure GetWritableOutputDirectory(var AnOutDir: string);
|
||||
procedure Clear;
|
||||
@ -645,7 +645,8 @@ type
|
||||
function GetUnitPath(RelativeToBaseDir: boolean): string;
|
||||
function GetIncludePath(RelativeToBaseDir: boolean): string;
|
||||
function NeedsDefineTemplates: boolean;
|
||||
function SubstitutePkgMacro(const s: string): string;
|
||||
function SubstitutePkgMacro(const s: string;
|
||||
PlatformIndependent: boolean): string;
|
||||
procedure WriteInheritedUnparsedOptions;
|
||||
// files
|
||||
function IndexOfPkgFile(PkgFile: TPkgFile): integer;
|
||||
@ -1915,11 +1916,14 @@ end;
|
||||
{ TLazPackage }
|
||||
|
||||
procedure TLazPackage.OnMacroListSubstitution(TheMacro: TTransferMacro;
|
||||
var s: string; var Handled, Abort: boolean);
|
||||
var s: string; const Data: PtrInt; var Handled, Abort: boolean);
|
||||
begin
|
||||
if CompareText(s,'PkgOutDir')=0 then begin
|
||||
Handled:=true;
|
||||
s:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir);
|
||||
if Data=CompilerOptionMacroNormal then
|
||||
s:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir)
|
||||
else
|
||||
s:=CompilerOptions.ParsedOpts.GetParsedPIValue(pcosOutputDir);
|
||||
end
|
||||
else if CompareText(s,'PkgDir')=0 then begin
|
||||
Handled:=true;
|
||||
@ -1933,10 +1937,14 @@ begin
|
||||
FUserReadOnly:=AValue;
|
||||
end;
|
||||
|
||||
function TLazPackage.SubstitutePkgMacro(const s: string): string;
|
||||
function TLazPackage.SubstitutePkgMacro(const s: string;
|
||||
PlatformIndependent: boolean): string;
|
||||
begin
|
||||
Result:=s;
|
||||
FMacros.SubstituteStr(Result);
|
||||
if PlatformIndependent then
|
||||
FMacros.SubstituteStr(Result,CompilerOptionMacroPlatformIndependent)
|
||||
else
|
||||
FMacros.SubstituteStr(Result,CompilerOptionMacroNormal);
|
||||
end;
|
||||
|
||||
procedure TLazPackage.WriteInheritedUnparsedOptions;
|
||||
|
@ -1196,7 +1196,6 @@ end;
|
||||
|
||||
function TPkgManager.DoWriteMakefile(APackage: TLazPackage): TModalResult;
|
||||
var
|
||||
CompilerOptionStrings: TInheritedCompOptsStrings;
|
||||
PathDelimNeedsReplace: Boolean;
|
||||
|
||||
procedure Replace(var s: string; const SearchTxt, ReplaceTxt: string);
|
||||
@ -1209,36 +1208,17 @@ var
|
||||
s:=copy(s,1,p-1)+ReplaceTxt+copy(s,p+length(SearchTxt),length(s));
|
||||
until false;
|
||||
end;
|
||||
|
||||
function ConvertLazarusToDummyMakros(const s: string): string;
|
||||
begin
|
||||
Result:=s;
|
||||
Replace(Result,'$(TargetCPU)','%(CPU_TARGET)');
|
||||
Replace(Result,'$(TargetOS)','%(OS_TARGET)');
|
||||
Replace(Result,'$(LCLWidgetType)','%(LCL_PLATFORM)');
|
||||
end;
|
||||
|
||||
function ConvertDummyToMakefileMakros(const s: string): string;
|
||||
begin
|
||||
Result:=s;
|
||||
Replace(Result,'%(CPU_TARGET)','$(CPU_TARGET)');
|
||||
Replace(Result,'%(OS_TARGET)','$(OS_TARGET)');
|
||||
Replace(Result,'%(LCL_PLATFORM)','$(LCL_PLATFORM)');
|
||||
end;
|
||||
|
||||
function ConvertLazarusToMakefileMakros(const s: string): string;
|
||||
begin
|
||||
Result:=ConvertLazarusToDummyMakros(s);
|
||||
Result:=APackage.SubstitutePkgMacro(Result);
|
||||
Result:=ParseString(APackage.CompilerOptions.ParsedOpts,Result);
|
||||
Result:=ConvertDummyToMakefileMakros(Result);
|
||||
end;
|
||||
|
||||
function ConvertPIMakrosToMakefileMakros(const s: string): string;
|
||||
begin
|
||||
Result:=s;
|
||||
Replace(Result,'%(','$(');
|
||||
end;
|
||||
|
||||
function ConvertLazarusToMakefileSearchPath(const s: string): string;
|
||||
begin
|
||||
Result:=CreateRelativeSearchPath(
|
||||
TrimSearchPath(ConvertLazarusToMakefileMakros(s),''),
|
||||
APackage.Directory);
|
||||
Result:=ConvertPIMakrosToMakefileMakros(s);
|
||||
Result:=CreateRelativeSearchPath(TrimSearchPath(Result,''),APackage.Directory);
|
||||
Replace(Result,';',' ');
|
||||
if PathDelimNeedsReplace then
|
||||
Replace(Result,PathDelim,'/');
|
||||
@ -1246,119 +1226,12 @@ var
|
||||
|
||||
function ConvertLazarusToMakefileDirectory(const s: string): string;
|
||||
begin
|
||||
Result:=CreateRelativePath(TrimFilename(
|
||||
ConvertLazarusToMakefileMakros(s)),APackage.Directory);
|
||||
Result:=ConvertPIMakrosToMakefileMakros(s);
|
||||
Result:=CreateRelativePath(TrimFilename(Result),APackage.Directory);
|
||||
if PathDelimNeedsReplace then
|
||||
Replace(Result,PathDelim,'/');
|
||||
end;
|
||||
|
||||
procedure AddCompilerOptions(ParsedOpts: TParsedCompilerOptions);
|
||||
var
|
||||
o: TInheritedCompilerOption;
|
||||
UnparsedOption: String;
|
||||
ParsedOption: String;
|
||||
CurOptions: String;
|
||||
begin
|
||||
for o:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption)
|
||||
do begin
|
||||
// get values with makros
|
||||
UnparsedOption:=ParsedOpts.UnparsedValues[
|
||||
InheritedToParsedCompilerOption[o]];
|
||||
//if o=icoUnitPath then
|
||||
// DebugLn('GatherCompilerOptions Unparsed Unitpath="',UnparsedOption,'"');
|
||||
// replace package specific makros
|
||||
// TODO
|
||||
if ParsedOpts.OnLocalSubstitute<>nil then
|
||||
UnparsedOption:=ParsedOpts.OnLocalSubstitute(UnparsedOption);
|
||||
//if o=icoUnitPath then
|
||||
// DebugLn('GatherCompilerOptions Without locals in Unitpath="',UnparsedOption,'"');
|
||||
// save system specific makros for Makefile
|
||||
UnparsedOption:=ConvertLazarusToDummyMakros(UnparsedOption);
|
||||
// replace the remaining Makros and extend paths
|
||||
ParsedOption:=ParsedOpts.DoParseOption(UnparsedOption,
|
||||
InheritedToParsedCompilerOption[o],false);
|
||||
// restore system specific makros for Makefile
|
||||
ParsedOption:=ConvertDummyToMakefileMakros(ParsedOption);
|
||||
|
||||
if ParsedOption<>'' then begin
|
||||
CurOptions:=CompilerOptionStrings[o];
|
||||
//if o=icoUnitPath then
|
||||
// DebugLn('GatherCompilerOptions OldUnitPath="',CurOptions,'" ParsedOption="',ParsedOption,'"');
|
||||
case o of
|
||||
icoUnitPath,icoIncludePath,icoSrcPath,icoObjectPath,icoLibraryPath:
|
||||
begin
|
||||
CurOptions:=TrimSearchPath(CurOptions,'');
|
||||
CurOptions:=MergeSearchPaths(CurOptions,ParsedOption);
|
||||
end;
|
||||
icoLinkerOptions:
|
||||
begin
|
||||
CurOptions:=MergeLinkerOptions(CurOptions,ParsedOption);
|
||||
end;
|
||||
icoCustomOptions:
|
||||
begin
|
||||
CurOptions:=MergeCustomOptions(CurOptions,ParsedOption);
|
||||
end;
|
||||
else
|
||||
RaiseException('GatherInheritedOptions');
|
||||
end;
|
||||
CompilerOptionStrings[o]:=CurOptions;
|
||||
//if o=icoUnitPath then
|
||||
// DebugLn('GatherCompilerOptions NewUnitPath="',CurOptions,'"');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure GatherInheritedCompilerOptions;
|
||||
var
|
||||
OptionsList: TList;
|
||||
AddOptions: TAdditionalCompilerOptions;
|
||||
i: Integer;
|
||||
begin
|
||||
OptionsList:=nil;
|
||||
APackage.CompilerOptions.GetInheritedCompilerOptions(OptionsList);
|
||||
if OptionsList<>nil then begin
|
||||
//GatherInheritedOptions(OptionsList,false,InheritedOptionStrings);
|
||||
for i:=0 to OptionsList.Count-1 do begin
|
||||
AddOptions:=TAdditionalCompilerOptions(OptionsList[i]);
|
||||
if (not (AddOptions is TAdditionalCompilerOptions)) then continue;
|
||||
//DebugLn('GatherCompilerOptions ',
|
||||
// (AddOptions.Owner as TLazPackage).IDAsString,
|
||||
// ' UnitPath="',AddOptions.GetOption(icoUnitPath),'"');
|
||||
AddCompilerOptions(AddOptions.ParsedOpts);
|
||||
end;
|
||||
|
||||
//DebugLn('GatherCompilerOptions Total Inherited UnitPath="',CompilerOptionStrings[icoUnitPath],'"');
|
||||
OptionsList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure GatherCompilerOptions;
|
||||
var
|
||||
o: TInheritedCompilerOption;
|
||||
BaseDir: String;
|
||||
begin
|
||||
GatherInheritedCompilerOptions;
|
||||
|
||||
AddCompilerOptions(APackage.CompilerOptions.ParsedOpts);
|
||||
|
||||
BaseDir:=APackage.Directory;
|
||||
for o:=Low(TInheritedCompilerOption) to High(TInheritedCompilerOption) do
|
||||
begin
|
||||
case o of
|
||||
icoUnitPath,icoIncludePath,icoSrcPath,icoObjectPath,icoLibraryPath:
|
||||
begin
|
||||
CompilerOptionStrings[o]:=CreateRelativeSearchPath(
|
||||
CompilerOptionStrings[o]+';.',BaseDir);
|
||||
Replace(CompilerOptionStrings[o],';',' ');
|
||||
if PathDelimNeedsReplace then
|
||||
Replace(CompilerOptionStrings[o],PathDelim,'/');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
//DebugLn('GatherCompilerOptions Total UnitPath="',CompilerOptionStrings[icoUnitPath],'"');
|
||||
end;
|
||||
|
||||
var
|
||||
s: String;
|
||||
e: string;
|
||||
@ -1369,20 +1242,22 @@ var
|
||||
UnitPath: String;
|
||||
FPCMakeTool: TExternalToolOptions;
|
||||
CodeBuffer: TCodeBuffer;
|
||||
MainSrcFile: String;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
PathDelimNeedsReplace:=PathDelim<>'/';
|
||||
|
||||
GatherCompilerOptions;
|
||||
|
||||
SrcFilename:=APackage.GetSrcFilename;
|
||||
MainUnitName:=lowercase(ExtractFileNameOnly((SrcFilename)));
|
||||
UnitPath:=CompilerOptionStrings[icoUnitPath];
|
||||
UnitOutputPath:=APackage.CompilerOptions.GetUnitOutPath(false,false);
|
||||
UnitPath:=APackage.CompilerOptions.GetUnitPath(true,
|
||||
coptParsedPlatformIndependent);
|
||||
UnitOutputPath:=APackage.CompilerOptions.GetUnitOutPath(true,
|
||||
coptParsedPlatformIndependent);
|
||||
|
||||
|
||||
//DebugLn('TPkgManager.DoWriteMakefile ',APackage.Name,' makefile UnitPath="',UnitPath,'"');
|
||||
UnitPath:=ConvertLazarusToMakefileSearchPath(UnitPath);
|
||||
UnitOutputPath:=ConvertLazarusToMakefileDirectory(UnitOutputPath);
|
||||
MainSrcFile:=CreateRelativePath(SrcFilename,APackage.Directory);
|
||||
|
||||
e:=LineEnding;
|
||||
s:='';
|
||||
@ -1398,7 +1273,7 @@ begin
|
||||
s:=s+'options=-gl'+e; // ToDo do the other options
|
||||
s:=s+''+e;
|
||||
s:=s+'[target]'+e;
|
||||
s:=s+'units='+CreateRelativePath(SrcFilename,APackage.Directory)+e;
|
||||
s:=s+'units='+MainSrcFile+e;
|
||||
//s:=s+'implicitunits=syntextdrawer'+e; // TODO list all unit names
|
||||
s:=s+''+e;
|
||||
s:=s+'[clean]'+e;
|
||||
@ -1414,6 +1289,8 @@ begin
|
||||
s:=s+' -$(DEL) $(COMPILER_UNITTARGETDIR)/'+MainUnitName+'$(PPUEXT)'+e;
|
||||
s:=s+''+e;
|
||||
s:=s+'all: cleartarget $(COMPILER_UNITTARGETDIR) '+MainUnitName+'$(PPUEXT)'+e;
|
||||
|
||||
//DebugLn('TPkgManager.DoWriteMakefile [',s,']');
|
||||
|
||||
MakefileFPCFilename:=AppendPathDelim(APackage.Directory)+'Makefile.fpc';
|
||||
|
||||
@ -4190,7 +4067,7 @@ begin
|
||||
PkgList.Free;
|
||||
if AddOptionsList<>nil then begin
|
||||
// combine options of same type
|
||||
GatherInheritedOptions(AddOptionsList,true,InheritedOptionStrings);
|
||||
GatherInheritedOptions(AddOptionsList,coptParsed,InheritedOptionStrings);
|
||||
AddOptionsList.Free;
|
||||
end;
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
fpcsrc (2.0.3)
|
||||
|
||||
* Bugfixes
|
||||
|
||||
-- Mattias Gaertner <mattias@cvs.freepascal.org> 01/11/2006
|
||||
|
||||
fpcsrc (1.0.10)
|
||||
|
||||
* Bugfixes
|
||||
|
@ -5,8 +5,9 @@ Priority: optional
|
||||
Maintainer: Mattias Gaertner <mattias@cvs.freepascal.org>
|
||||
Architecture: i386
|
||||
Description: Free Pascal Sources
|
||||
The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit
|
||||
Pascal Compiler. It comes with fully TP 7.0 compatible run-time library.
|
||||
The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible
|
||||
32/64bit Object Pascal Compiler. It comes with fully TP 7.0
|
||||
compatible run-time library.
|
||||
Some extensions are added to the language, like function overloading. Shared
|
||||
libraries can be linked and created. Basic Delphi support is already
|
||||
implemented (classes,exceptions,ansistrings). This package contains the
|
||||
|
@ -2,7 +2,7 @@ Package: lazarus
|
||||
Version: LAZVERSION
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Mattias Gaertner <mattias@cvs.freepascal.org>
|
||||
Maintainer: Mattias Gaertner <mattias@freepascal.org>
|
||||
Architecture: i386
|
||||
Depends: fp-compiler (>=FPCVERSION),
|
||||
fp-units-base (>=FPCVERSION), fp-units-db (>=FPCVERSION),
|
||||
|
@ -4,6 +4,44 @@ The package was originally put together by:
|
||||
From sources obtained from:
|
||||
CVSROOT=:pserver:cvs@cvs.freepascal.org:/FPC/CVS
|
||||
|
||||
The files and libraries are released under the terms of the GNU
|
||||
Library General Public License, which can be found in the file
|
||||
/usr/share/common-licenses/LGPL-2 on a Debian system.
|
||||
The Lazarus sources consists of several parts and each part has its own
|
||||
license. Three licenses are in use. The GPL 2, a modified LGPL and the MPL. In
|
||||
general, each file contains a header, describing the license of the file.
|
||||
|
||||
The license directory tree:
|
||||
|
||||
<lazarus>/ (mostly GPL2, but with a few files under modified LGPL)
|
||||
|
|
||||
+- designer (mostly GPL2, but with a few files under modified LGPL)
|
||||
|
|
||||
+- debugger (GPL2)
|
||||
|
|
||||
+- packager (GPL2)
|
||||
|
|
||||
+- tools (GPL2)
|
||||
|
|
||||
+- examples (GPL2)
|
||||
|
|
||||
+- lcl (modified LGPL, see there)
|
||||
|
|
||||
+- ideintf (modified LGPL)
|
||||
|
|
||||
+- components/
|
||||
|
|
||||
+- synedit (MPL - Mozilla public license)
|
||||
|
|
||||
+- codetools (GPL 2)
|
||||
|
|
||||
+- gtk
|
||||
| |
|
||||
| +- gtkglarea (modified LGPL, with one exception: nvgl.pp)
|
||||
|
|
||||
+- xxx There are various packages under various licenses. Mostly the
|
||||
modified LGPL. See the license in the package files for details.
|
||||
|
||||
|
||||
The IDE files are the files in the <lazarus>, designer, packager and debugger
|
||||
directory. They are under the GPL 2, with the following exceptions:
|
||||
transfermacros.pp, wordcompletion.pp, patheditordlg.pas, outputfilter.pas,
|
||||
inputfiledialog.pas, findreplacedialog.pp, findinfilesdlg.pas
|
||||
These files are under the modified LGPL as described in COPYING.modifiedLGPL.
|
||||
|
Loading…
Reference in New Issue
Block a user