home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
dos_util
/
af126.zip
/
AF.INC
< prev
next >
Wrap
Text File
|
1991-11-06
|
2KB
|
53 lines
Function sCheck(Mask,Nom:String):Boolean;
Var i,j,k:Byte;
Pile:Array[1..9] of Record a,b:Byte; End;
PileP:Byte;
lm:Byte absolute Mask;
ln:Byte absolute Nom;
Impasse:Boolean;
Begin
i:=1; j:=1; sCheck:=False; PileP:=0; Impasse:=False;
Repeat
if Mask[i]<>'*' then
if (j<=ln) and ((Mask[i]='?') or (Mask[i]=Nom[j]) or
((Mask[i]='#') and (Nom[j]>='0') and (Nom[j]<='9'))) then
Begin
Inc(i); Inc(j);
End else
Impasse:=True else
Begin
if i=lm then Begin sCheck:=True; Exit; End else
Begin
k:=j;
While (k<=ln) and (Nom[k]<>Mask[i+1]) and
(Mask[i+1]<>'?') and
((Mask[i+1]<>'#') or not (Nom[k] in ['0'..'9']))
do Inc(k);
if k<=ln then
Begin
Inc(PileP);
With Pile[PileP] do
Begin
a:=i; b:=k+1;
End;
Inc(i,2); j:=k+1;
if j>ln then
if (i=Length(Mask)) and (Mask[i]='*')
then Inc(i) else Impasse:=True;
End else Impasse:=True;
End;
End;
if (i>lm) then if (j>ln) then
Begin
sCheck:=True; Exit;
End else Impasse:=True;
if Impasse then
if PileP>0 then
Begin
With Pile[PileP] do Begin i:=a; j:=b; End; Dec(PileP);
Impasse:=False;
if j>ln then Exit;
End else Exit;
Until false;
End;