PROCEDURE match( patterns : string255; {these patterns } delim : char; {separated by this delimiter} source : string255; {against this source string} var status : boolean ); {returning this flag } {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LAST EDITED: 03/03/84 rep RETURNS: 'status' true if any of the patterns appear in the source string. DECLARE: TYPE string0 = string 0; string255 = string 255; CALL AS: match ( 'YES!yes!NO!no', '!', ans,flag ); match ( $s, '!', ans,flag ); Required: function vlength(); from ASL.REL procedure setlength(); Pascal/Z supplied extension. function index(); Pascal/Z supplied extension. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} TYPE nodeptr = ^node; node = record data : STRING 18; { MATCH MAXIMUM OF 18 CHARACTERS PER ARGUMENT } next : nodeptr end; VAR i : integer; a, root: nodeptr; {$C-,F-,R-,S-,M-} { NAME MATCH ENTRY MATCH } { setlength - forces the length of string 's' to length 'n' } PROCEDURE setlength ( VAR s: string0; n: integer ); external; { vlength - returns length of ANY length string. super fast! } FUNCTION vlength ( VAR s: string0 ): integer; external; { index - returns the position of pattern in source else 0 } FUNCTION index ( source,pattern: string255 ): integer; external; { MATCH: } BEGIN root := NIL; append(patterns,delim); i := 0; WHILE ivlength(patterns)) OR (patterns[i]=delim)) DO BEGIN append(a^.data,patterns[i]); i := i+1 END END; a := root; status := false; WHILE (a<>NIL) AND (status=false) DO BEGIN status := (index(source,a^.data)<>0); a := a^.next END END{match};