mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:49:24 +02:00
codetools: searching compiler: search first in dir of fpc.exe, then in PATH
git-svn-id: trunk@37262 -
This commit is contained in:
parent
3cc9256141
commit
5a6462019e
@ -340,6 +340,7 @@ function ReadTilPascalBracketClose(const Source: string;
|
|||||||
function GetAtomLength(p: PChar; NestedComments: boolean): integer;
|
function GetAtomLength(p: PChar; NestedComments: boolean): integer;
|
||||||
function GetAtomString(p: PChar; NestedComments: boolean): string;
|
function GetAtomString(p: PChar; NestedComments: boolean): string;
|
||||||
function FindStartOfAtom(const Source: string; Position: integer): integer;
|
function FindStartOfAtom(const Source: string; Position: integer): integer;
|
||||||
|
function FindEndOfAtom(const Source: string; Position: integer): integer;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -2233,9 +2234,10 @@ begin
|
|||||||
else
|
else
|
||||||
inc(p);
|
inc(p);
|
||||||
c2:=p^;
|
c2:=p^;
|
||||||
// test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **
|
// test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **, .., ><
|
||||||
if ((c2='=') and (IsEqualOperatorStartChar[c1]))
|
if ((c2='=') and (IsEqualOperatorStartChar[c1]))
|
||||||
or ((c1='<') and (c2='>'))
|
or ((c1='<') and (c2='>'))
|
||||||
|
or ((c1='>') and (c2='<'))
|
||||||
or ((c1='.') and (c2='.'))
|
or ((c1='.') and (c2='.'))
|
||||||
or ((c1='*') and (c2='*'))
|
or ((c1='*') and (c2='*'))
|
||||||
then
|
then
|
||||||
@ -2345,6 +2347,9 @@ begin
|
|||||||
'$':
|
'$':
|
||||||
// hex number
|
// hex number
|
||||||
dec(Result);
|
dec(Result);
|
||||||
|
'&':
|
||||||
|
// &keyword
|
||||||
|
dec(Result);
|
||||||
end;
|
end;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -2455,7 +2460,7 @@ begin
|
|||||||
else
|
else
|
||||||
if Result>1 then begin
|
if Result>1 then begin
|
||||||
c2:=Source[Result-1];
|
c2:=Source[Result-1];
|
||||||
// test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **, ><
|
// test for double char operators :=, +=, -=, /=, *=, <>, <=, >=, **, ><, ..
|
||||||
if ((c2='=') and (IsEqualOperatorStartChar[c]))
|
if ((c2='=') and (IsEqualOperatorStartChar[c]))
|
||||||
or ((c='<') and (c2='>'))
|
or ((c='<') and (c2='>'))
|
||||||
or ((c='>') and (c2='<'))
|
or ((c='>') and (c2='<'))
|
||||||
@ -2469,6 +2474,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FindEndOfAtom(const Source: string; Position: integer): integer;
|
||||||
|
var
|
||||||
|
p: PChar;
|
||||||
|
begin
|
||||||
|
Result:=FindStartOfAtom(Source,Position);
|
||||||
|
if (Result>=1) and (Result<=length(Source)) then begin
|
||||||
|
p:=@Source[Result];
|
||||||
|
case p^ of
|
||||||
|
#0..#31,' ': exit;
|
||||||
|
'{': exit;
|
||||||
|
'/': if p[1]='/' then exit;
|
||||||
|
'(': if p[1]='*' then exit;
|
||||||
|
end;
|
||||||
|
inc(Result,GetAtomLength(p,false));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function LineEndCount(const Txt: string;
|
function LineEndCount(const Txt: string;
|
||||||
out LengthOfLastLine: integer): integer;
|
out LengthOfLastLine: integer): integer;
|
||||||
begin
|
begin
|
||||||
|
@ -7265,15 +7265,22 @@ function TFPCTargetConfigCache.FindRealCompilerInPath(aTargetCPU: string;
|
|||||||
|
|
||||||
function Search(const ShortFileName: string): string;
|
function Search(const ShortFileName: string): string;
|
||||||
begin
|
begin
|
||||||
if ShortFileName='' then Result:='';
|
// fpc.exe first searches in -XP
|
||||||
// try in PATH
|
// Maybe: extact -XP from extra options
|
||||||
|
|
||||||
|
// then fpc.exe searches in its own directory
|
||||||
|
if Compiler<>'' then begin
|
||||||
|
Result:=ExtractFilePath(Compiler);
|
||||||
|
if FilenameIsAbsolute(Result) then begin
|
||||||
|
Result+=ShortFileName;
|
||||||
|
if FileExistsCached(Result) then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
// finally fpc.exe searches in PATH
|
||||||
Result:=SearchFileInPath(ShortFileName,GetCurrentDirUTF8,
|
Result:=SearchFileInPath(ShortFileName,GetCurrentDirUTF8,
|
||||||
GetEnvironmentVariableUTF8('PATH'),PathSeparator,ctsfcDefault);
|
GetEnvironmentVariableUTF8('PATH'),PathSeparator,ctsfcDefault);
|
||||||
if (Result<>'') or (Compiler='') then exit;
|
if (Result<>'') or (Compiler='') then exit;
|
||||||
// try in directory of compiler
|
|
||||||
Result:=ExtractFilePath(Compiler)+ShortFileName;
|
|
||||||
if not FileExistsCached(Result) then
|
|
||||||
Result:='';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -41,16 +41,16 @@ type
|
|||||||
procedure FreeNodeData;
|
procedure FreeNodeData;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure FreeTVNodeData(TV: TCustomTreeView);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ TCodyTreeView }
|
procedure FreeTVNodeData(TV: TCustomTreeView);
|
||||||
|
|
||||||
procedure TCodyTreeView.FreeNodeData;
|
|
||||||
var
|
var
|
||||||
Node: TTreeNode;
|
Node: TTreeNode;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
TV.BeginUpdate;
|
||||||
Node:=Items.GetFirstNode;
|
Node:=TV.Items.GetFirstNode;
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
if Node.Data<>nil then begin
|
if Node.Data<>nil then begin
|
||||||
TObject(Node.Data).Free;
|
TObject(Node.Data).Free;
|
||||||
@ -58,7 +58,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
Node:=Node.GetNext;
|
Node:=Node.GetNext;
|
||||||
end;
|
end;
|
||||||
EndUpdate;
|
TV.EndUpdate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TCodyTreeView }
|
||||||
|
|
||||||
|
procedure TCodyTreeView.FreeNodeData;
|
||||||
|
begin
|
||||||
|
FreeTVNodeData(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user