mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 21:10:42 +02:00
Merge r52530 #e31a4d74d3 manually. IDE: Make CompilerMode selection more robust.
git-svn-id: branches/fixes_1_6@52619 -
This commit is contained in:
parent
40ac8cb06f
commit
4df3b960a7
@ -31,37 +31,48 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function SyntaxModeToCaption(const Mode: string): string;
|
||||
const
|
||||
// CompilerMode names to be shown after -M...
|
||||
CompilerModesPretty: array[TCompilerMode] of shortstring = (
|
||||
'fpc', 'Delphi', 'DelphiUnicode', 'gpc', 'tp', 'ObjFPC', 'MacPas', 'iso'
|
||||
);
|
||||
// CompilerMode descriptions.
|
||||
CompilerModesDescr: array[TCompilerMode] of shortstring = (
|
||||
'Free Pascal', 'Delphi', 'Delphi Unicode', 'GNU Pascal', 'Turbo Pascal',
|
||||
'Object Pascal', 'Mac Pascal', 'ISO/IEC 7185 Pascal'
|
||||
);
|
||||
|
||||
function SyntaxModeToCaption(const ModeStr: string): string;
|
||||
var
|
||||
cm: TCompilerMode;
|
||||
begin
|
||||
if CompareText(Mode, 'ObjFPC') = 0 then
|
||||
Result := lisObjectPascalDefault + ' (-Mobjfpc)'
|
||||
else if CompareText(Mode, 'Delphi') = 0 then
|
||||
Result := lisDelphi + ' (-Mdelphi)'
|
||||
else if CompareText(Mode, 'tp') = 0 then
|
||||
Result := lisTurboPascal + ' (-Mtp)'
|
||||
else if CompareText(Mode, 'fpc') = 0 then
|
||||
Result := lisFreePascal + ' (-Mfpc)'
|
||||
else if CompareText(Mode, 'macpas') = 0 then
|
||||
Result := lisMacPascal + ' (-Mmacpas)'
|
||||
else
|
||||
Result := '';
|
||||
Result := '';
|
||||
for cm := Low(TCompilerMode) to High(TCompilerMode) do
|
||||
if CompareText(ModeStr, CompilerModeNames[cm]) = 0 then
|
||||
begin
|
||||
if cm = cmOBJFPC then
|
||||
Result := lisObjectPascalDefault // Is this needed?
|
||||
else
|
||||
Result := CompilerModesDescr[cm];
|
||||
Result := Result + ' (-M' + CompilerModesPretty[cm] + ')';
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CaptionToSyntaxMode(const Caption: string): string;
|
||||
var
|
||||
cm: TCompilerMode;
|
||||
begin
|
||||
if Pos('-Mdelphi', Caption) > 0 then
|
||||
Result := 'Delphi'
|
||||
else if Pos('-Mtp', Caption) > 0 then
|
||||
Result := 'tp'
|
||||
else if Pos('-Mmacpas', Caption) > 0 then
|
||||
Result := 'macpas'
|
||||
else if Pos('-Mfpc', Caption) > 0 then
|
||||
Result := 'fpc'
|
||||
else
|
||||
Result := 'ObjFPC';
|
||||
Result := 'ObjFPC';
|
||||
// Some modes would go wrong if iterated forward, thus iterate backwards.
|
||||
for cm := High(TCompilerMode) downto Low(TCompilerMode) do
|
||||
if Pos('-M' + CompilerModesPretty[cm], Caption) > 0 then
|
||||
begin
|
||||
Result := CompilerModesPretty[cm];
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TCompilerParsingOptionsFrame }
|
||||
|
||||
function TCompilerParsingOptionsFrame.GetTitle: string;
|
||||
|
Loading…
Reference in New Issue
Block a user