mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:49:13 +02:00
* pas2jni: Accept partial names in inclusion/exclusion lists. Use wildcard * at the end of a partial name.
git-svn-id: trunk@41323 -
This commit is contained in:
parent
fe8b98ded3
commit
d55f1b69c0
@ -104,6 +104,7 @@ type
|
|||||||
procedure WriteClassTable;
|
procedure WriteClassTable;
|
||||||
|
|
||||||
procedure WriteFileComment(st: TTextOutStream);
|
procedure WriteFileComment(st: TTextOutStream);
|
||||||
|
function FindInStringList(list: TStringList; const s: string): integer;
|
||||||
|
|
||||||
procedure ProcessRules(d: TDef; const Prefix: string = '');
|
procedure ProcessRules(d: TDef; const Prefix: string = '');
|
||||||
function GetUniqueNum: integer;
|
function GetUniqueNum: integer;
|
||||||
@ -358,11 +359,11 @@ end;
|
|||||||
|
|
||||||
function TWriter.DoCheckItem(const ItemName: string): TCheckItemResult;
|
function TWriter.DoCheckItem(const ItemName: string): TCheckItemResult;
|
||||||
begin
|
begin
|
||||||
if IncludeList.IndexOf(ItemName) >= 0 then
|
if FindInStringList(ExcludeList, ItemName) >= 0 then
|
||||||
Result:=crInclude
|
|
||||||
else
|
|
||||||
if ExcludeList.IndexOf(ItemName) >= 0 then
|
|
||||||
Result:=crExclude
|
Result:=crExclude
|
||||||
|
else
|
||||||
|
if FindInStringList(IncludeList, ItemName) >= 0 then
|
||||||
|
Result:=crInclude
|
||||||
else
|
else
|
||||||
Result:=crDefault;
|
Result:=crDefault;
|
||||||
end;
|
end;
|
||||||
@ -373,6 +374,36 @@ begin
|
|||||||
st.WriteLn('// Do not edit this file.');
|
st.WriteLn('// Do not edit this file.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWriter.FindInStringList(list: TStringList; const s: string): integer;
|
||||||
|
var
|
||||||
|
len, cnt: integer;
|
||||||
|
ss: string;
|
||||||
|
begin
|
||||||
|
if list.Find(s, Result) or (Result < 0) then
|
||||||
|
exit;
|
||||||
|
if Result < list.Count then begin
|
||||||
|
cnt:=3;
|
||||||
|
if Result > 0 then
|
||||||
|
Dec(Result)
|
||||||
|
else
|
||||||
|
Dec(cnt);
|
||||||
|
if Result + cnt > list.Count then
|
||||||
|
Dec(cnt);
|
||||||
|
while cnt > 0 do begin
|
||||||
|
ss:=list[Result];
|
||||||
|
len:=Length(ss);
|
||||||
|
if (len > 1) and (ss[len] = '*') then begin
|
||||||
|
Dec(len);
|
||||||
|
if AnsiCompareText(Copy(s, 1, len), Copy(ss, 1, len)) = 0 then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Inc(Result);
|
||||||
|
Dec(cnt);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=-1;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TWriter.ProcessRules(d: TDef; const Prefix: string);
|
procedure TWriter.ProcessRules(d: TDef; const Prefix: string);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -385,14 +416,11 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
s:=Prefix + d.Name;
|
s:=Prefix + d.Name;
|
||||||
i:=IncludeList.IndexOf(s);
|
if FindInStringList(ExcludeList, s) >= 0 then
|
||||||
if i >= 0 then begin
|
d.SetNotUsed
|
||||||
d.IsUsed:=True;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if ExcludeList.IndexOf(s) >= 0 then begin
|
if FindInStringList(IncludeList, s) >= 0 then
|
||||||
d.SetNotUsed;
|
d.IsUsed:=True;
|
||||||
end;
|
|
||||||
if not (d.DefType in [dtUnit, dtClass]) then
|
if not (d.DefType in [dtUnit, dtClass]) then
|
||||||
exit;
|
exit;
|
||||||
s:=s + '.';
|
s:=s + '.';
|
||||||
|
Loading…
Reference in New Issue
Block a user