mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 06:49:27 +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 WriteFileComment(st: TTextOutStream);
|
||||
function FindInStringList(list: TStringList; const s: string): integer;
|
||||
|
||||
procedure ProcessRules(d: TDef; const Prefix: string = '');
|
||||
function GetUniqueNum: integer;
|
||||
@ -358,11 +359,11 @@ end;
|
||||
|
||||
function TWriter.DoCheckItem(const ItemName: string): TCheckItemResult;
|
||||
begin
|
||||
if IncludeList.IndexOf(ItemName) >= 0 then
|
||||
Result:=crInclude
|
||||
if FindInStringList(ExcludeList, ItemName) >= 0 then
|
||||
Result:=crExclude
|
||||
else
|
||||
if ExcludeList.IndexOf(ItemName) >= 0 then
|
||||
Result:=crExclude
|
||||
if FindInStringList(IncludeList, ItemName) >= 0 then
|
||||
Result:=crInclude
|
||||
else
|
||||
Result:=crDefault;
|
||||
end;
|
||||
@ -373,6 +374,36 @@ begin
|
||||
st.WriteLn('// Do not edit this file.');
|
||||
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);
|
||||
var
|
||||
i: integer;
|
||||
@ -385,14 +416,11 @@ begin
|
||||
exit;
|
||||
end;
|
||||
s:=Prefix + d.Name;
|
||||
i:=IncludeList.IndexOf(s);
|
||||
if i >= 0 then begin
|
||||
d.IsUsed:=True;
|
||||
end
|
||||
if FindInStringList(ExcludeList, s) >= 0 then
|
||||
d.SetNotUsed
|
||||
else
|
||||
if ExcludeList.IndexOf(s) >= 0 then begin
|
||||
d.SetNotUsed;
|
||||
end;
|
||||
if FindInStringList(IncludeList, s) >= 0 then
|
||||
d.IsUsed:=True;
|
||||
if not (d.DefType in [dtUnit, dtClass]) then
|
||||
exit;
|
||||
s:=s + '.';
|
||||
|
Loading…
Reference in New Issue
Block a user