mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 05:36:22 +02:00
codetools: started reading fpc source rules
git-svn-id: trunk@25050 -
This commit is contained in:
parent
8214147870
commit
7787ab48a2
@ -552,6 +552,7 @@ type
|
||||
Priority: integer;
|
||||
Targets: string; // comma separated list of OS, CPU, e.g. win32,unix,i386 or * for all
|
||||
function FitsTargets(const FilterTargets: string): boolean;
|
||||
function FitsFilename(const aFilename: string): boolean;
|
||||
end;
|
||||
|
||||
{ TFPCSourceRules }
|
||||
@ -5859,7 +5860,10 @@ begin
|
||||
while true do begin
|
||||
Rule:=TFPCSourceRule(Node.Data);
|
||||
cmp:=CompareStr(Rule.Filename,Filename);
|
||||
if cmp=0 then break;
|
||||
if cmp=0 then begin
|
||||
inc(Result,Rule.Priority);
|
||||
break;
|
||||
end;
|
||||
if cmp<0 then begin
|
||||
if Node.Left<>nil then
|
||||
Node:=Node.Left
|
||||
@ -5873,7 +5877,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
// find lowest
|
||||
|
||||
while Node<>nil do begin
|
||||
Node:=RulesSortedForFilenameStart.FindPrecessor(Node);
|
||||
if Node=nil then exit;
|
||||
Rule:=TFPCSourceRule(Node.Data);
|
||||
if not Rule.FitsFilename(Filename) then exit;
|
||||
inc(Result,Rule.Priority);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TFPCSourceRule }
|
||||
@ -5912,6 +5922,12 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TFPCSourceRule.FitsFilename(const aFilename: string): boolean;
|
||||
begin
|
||||
Result:=(length(Filename)<=length(aFilename))
|
||||
and CompareMem(Pointer(Filename),Pointer(aFilename),length(Filename));
|
||||
end;
|
||||
|
||||
initialization
|
||||
InitDefaultFPCSourceRules;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user