mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 01:00:00 +02:00
rtl/amiga: added some basic infrastructure to MatchFirst to improve pattern matching in the future
This commit is contained in:
parent
98dd448ce8
commit
3608be8f13
@ -228,8 +228,16 @@ begin
|
||||
NextDosEntry:=dlist;
|
||||
end;
|
||||
|
||||
// Very first dirty version of MatchFirst/Next/End)
|
||||
//TODO: pattern detection, for now only simple "*" or "#?" or full name (without patterns) is supported
|
||||
{ helper function used by MatchFirst, all input is expected to be lowercase }
|
||||
function NameMatchesPattern(pattern: AnsiString; filename: AnsiString): boolean;
|
||||
begin
|
||||
NameMatchesPattern:=(pattern = '*') or (pattern = '#?') or (pattern = filename);
|
||||
if not NameMatchesPattern then
|
||||
begin
|
||||
// TODO: pattern detection
|
||||
end;
|
||||
end;
|
||||
|
||||
function MatchFirst(pat : PChar;
|
||||
anchor: PAnchorPath): LongInt; public name '_fpc_amiga_matchfirst';
|
||||
var
|
||||
@ -310,7 +318,7 @@ begin
|
||||
if Res = 0 then
|
||||
break;
|
||||
// include some nifty pattern compare here? later maybe!
|
||||
if (FileN = '*') or (FileN = '#?') or (FileN = lowercase(AnsiString(ib.fib_FileName))) then
|
||||
if NameMatchesPattern(FileN, lowercase(AnsiString(fib^.fib_FileName))) then
|
||||
begin
|
||||
// Match found
|
||||
// new chain
|
||||
|
Loading…
Reference in New Issue
Block a user