mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 08:56:18 +02:00
IDE: fpc msg parser, use console or system codepage depending on compiler version, bug #26623
git-svn-id: trunk@48038 -
This commit is contained in:
parent
8f8725a3c5
commit
e30dfa934a
@ -971,6 +971,7 @@ function GetDefaultSrcOS2ForTargetOS(const TargetOS: string): string;
|
|||||||
function GetDefaultSrcCPUForTargetCPU(const TargetCPU: string): string;
|
function GetDefaultSrcCPUForTargetCPU(const TargetCPU: string): string;
|
||||||
procedure SplitLazarusCPUOSWidgetCombo(const Combination: string;
|
procedure SplitLazarusCPUOSWidgetCombo(const Combination: string;
|
||||||
var CPU, OS, WidgetSet: string);
|
var CPU, OS, WidgetSet: string);
|
||||||
|
function GetCompiledFPCVersion: integer;
|
||||||
function GetCompiledTargetOS: string;
|
function GetCompiledTargetOS: string;
|
||||||
function GetCompiledTargetCPU: string;
|
function GetCompiledTargetCPU: string;
|
||||||
function GetDefaultCompilerFilename(const TargetCPU: string = ''; Cross: boolean = false): string;
|
function GetDefaultCompilerFilename(const TargetCPU: string = ''; Cross: boolean = false): string;
|
||||||
@ -1013,6 +1014,7 @@ function RunFPCInfo(const CompilerFilename: string;
|
|||||||
InfoTypes: TFPCInfoTypes; const Options: string =''): string;
|
InfoTypes: TFPCInfoTypes; const Options: string =''): string;
|
||||||
function ExtractFPCFrontEndParameters(const CmdLineParams: string;
|
function ExtractFPCFrontEndParameters(const CmdLineParams: string;
|
||||||
const Kinds: TFPCFrontEndParams = AllFPCFrontEndParams): string;
|
const Kinds: TFPCFrontEndParams = AllFPCFrontEndParams): string;
|
||||||
|
function FPCVersionToNumber(const FPCVersionString: string): integer;
|
||||||
function SplitFPCVersion(const FPCVersionString: string;
|
function SplitFPCVersion(const FPCVersionString: string;
|
||||||
out FPCVersion, FPCRelease, FPCPatch: integer): boolean;
|
out FPCVersion, FPCRelease, FPCPatch: integer): boolean;
|
||||||
function ParseFPCVerbose(List: TStrings; // fpc -va output
|
function ParseFPCVerbose(List: TStrings; // fpc -va output
|
||||||
@ -1471,6 +1473,16 @@ begin
|
|||||||
Add('V',ParamV);
|
Add('V',ParamV);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FPCVersionToNumber(const FPCVersionString: string): integer;
|
||||||
|
var
|
||||||
|
FPCVersion, FPCRelease, FPCPatch: integer;
|
||||||
|
begin
|
||||||
|
if SplitFPCVersion(FPCVersionString,FPCVersion,FPCRelease,FPCPatch) then
|
||||||
|
Result:=FPCVersion*10000+FPCRelease*100+FPCPatch
|
||||||
|
else
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
function SplitFPCVersion(const FPCVersionString: string; out FPCVersion,
|
function SplitFPCVersion(const FPCVersionString: string; out FPCVersion,
|
||||||
FPCRelease, FPCPatch: integer): boolean;
|
FPCRelease, FPCPatch: integer): boolean;
|
||||||
// for example 2.5.1
|
// for example 2.5.1
|
||||||
@ -2786,6 +2798,11 @@ begin
|
|||||||
WidgetSet:=copy(Combination,StartPos,EndPos-StartPos);
|
WidgetSet:=copy(Combination,StartPos,EndPos-StartPos);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetCompiledFPCVersion: integer;
|
||||||
|
begin
|
||||||
|
Result:=FPCVersionToNumber({$I %FPCVERSION%});
|
||||||
|
end;
|
||||||
|
|
||||||
function GetCompiledTargetOS: string;
|
function GetCompiledTargetOS: string;
|
||||||
begin
|
begin
|
||||||
Result:=lowerCase({$I %FPCTARGETOS%});
|
Result:=lowerCase({$I %FPCTARGETOS%});
|
||||||
@ -7976,21 +7993,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPCTargetConfigCache.GetFPC_FULLVERSION: integer;
|
function TFPCTargetConfigCache.GetFPC_FULLVERSION: integer;
|
||||||
var
|
|
||||||
v: String;
|
|
||||||
FPCVersion: integer;
|
|
||||||
FPCRelease: integer;
|
|
||||||
FPCPatch: integer;
|
|
||||||
begin
|
begin
|
||||||
if Defines<>nil then
|
if Defines<>nil then
|
||||||
Result:=StrToIntDef(Defines['FPC_FULLVERSION'],0)
|
Result:=StrToIntDef(Defines['FPC_FULLVERSION'],0)
|
||||||
else
|
else
|
||||||
Result:=0;
|
Result:=0;
|
||||||
if Result=0 then begin
|
if Result=0 then
|
||||||
v:={$I %FPCVERSION%};
|
Result:=GetCompiledFPCVersion;
|
||||||
SplitFPCVersion(v,FPCVersion,FPCRelease,FPCPatch);
|
|
||||||
Result:=(FPCVersion*100+FPCRelease)*100+FPCPatch;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPCTargetConfigCache.IndexOfUsedCfgFile: integer;
|
function TFPCTargetConfigCache.IndexOfUsedCfgFile: integer;
|
||||||
|
@ -204,10 +204,11 @@ type
|
|||||||
TranslationFilename: string; // e.g. /path/to/fpcsrc/compiler/msg/errord.msg
|
TranslationFilename: string; // e.g. /path/to/fpcsrc/compiler/msg/errord.msg
|
||||||
TranslationFile: TFPCMsgFilePoolItem;
|
TranslationFile: TFPCMsgFilePoolItem;
|
||||||
InstantFPCCache: string; // with trailing pathdelim
|
InstantFPCCache: string; // with trailing pathdelim
|
||||||
|
FPC_FullVersion: cardinal;
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Init; override; // called after macros resolved, before starting thread (main thread)
|
procedure Init; override; // called after macros resolved, before starting thread (main thread)
|
||||||
procedure InitReading; override; // called if process started, before first line (worker thread)
|
procedure InitReading; override; // called when process started, before first line (worker thread)
|
||||||
procedure Done; override; // called after process stopped (worker thread)
|
procedure Done; override; // called after process stopped (worker thread)
|
||||||
procedure ReadLine(Line: string; OutputIndex: integer; var Handled: boolean); override;
|
procedure ReadLine(Line: string; OutputIndex: integer; var Handled: boolean); override;
|
||||||
procedure AddMsgLine(MsgLine: TMessageLine); override;
|
procedure AddMsgLine(MsgLine: TMessageLine); override;
|
||||||
@ -1066,9 +1067,17 @@ var
|
|||||||
p: PChar;
|
p: PChar;
|
||||||
aTargetOS: String;
|
aTargetOS: String;
|
||||||
aTargetCPU: String;
|
aTargetCPU: String;
|
||||||
|
FPCVersion: integer;
|
||||||
|
FPCRelease: integer;
|
||||||
|
FPCPatch: integer;
|
||||||
begin
|
begin
|
||||||
inherited Init;
|
inherited Init;
|
||||||
|
|
||||||
|
// get FPC version
|
||||||
|
CodeToolBoss.GetFPCVersionForDirectory(Tool.WorkerDirectory, FPCVersion,
|
||||||
|
FPCRelease, FPCPatch);
|
||||||
|
FPC_FullVersion:=FPCVersion*10000+FPCRelease*100+FPCPatch;
|
||||||
|
|
||||||
if FPCMsgFilePool<>nil then begin
|
if FPCMsgFilePool<>nil then begin
|
||||||
aTargetOS:='';
|
aTargetOS:='';
|
||||||
aTargetCPU:='';
|
aTargetCPU:='';
|
||||||
@ -2255,6 +2264,7 @@ begin
|
|||||||
FFilesToIgnoreUnitNotUsed:=TStringList.Create;
|
FFilesToIgnoreUnitNotUsed:=TStringList.Create;
|
||||||
HideHintsSenderNotUsed:=true;
|
HideHintsSenderNotUsed:=true;
|
||||||
HideHintsUnitNotUsedInMainSource:=true;
|
HideHintsUnitNotUsedInMainSource:=true;
|
||||||
|
FPC_FullVersion:=GetCompiledFPCVersion;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEFPCParser.FileExists(const Filename: string; aSynchronized: boolean
|
function TIDEFPCParser.FileExists(const Filename: string; aSynchronized: boolean
|
||||||
@ -2524,6 +2534,9 @@ var
|
|||||||
p: PChar;
|
p: PChar;
|
||||||
begin
|
begin
|
||||||
if Line='' then exit;
|
if Line='' then exit;
|
||||||
|
if FPC_FullVersion>=20701 then
|
||||||
|
Line:=LazUTF8.ConsoleToUTF8(Line)
|
||||||
|
else
|
||||||
Line:=LazUTF8.SysToUTF8(Line);
|
Line:=LazUTF8.SysToUTF8(Line);
|
||||||
p:=PChar(Line);
|
p:=PChar(Line);
|
||||||
fOutputIndex:=OutputIndex;
|
fOutputIndex:=OutputIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user