;;D. C. Broad 18 JUN 2002
;;Following Bill Wilkerson's (TT's?) example this
;;will return the first matching pair of word and pattern
(defun wcmatch-list-list (words patterns / r)
(vl-some
(function
(lambda (w / uw)
(setq uw (strcase w))
(vl-some
(function
(lambda (p)
(and (wcmatch uw (strcase p))
(setq r (cons w p)))))
patterns)))
words)
r)
;;Example
;;(wcmatch-list-list '("this" "is" "a" "test") '("abc" "a*"))
;;Returns ("a" . "a*")
Regards,
Doug
Bill happens to be the CAD manager and senior
in-house developer for one of my largest clients.
He's not been around here since that little fiasco,
though and I really can't blame 'em.
"Doug Broad" <dbr...@earthlink.net> wrote in message
news:244B08D3339F0F52...@in.WebX.maYIadrTaRb...
"Tony Tanzillo" <tony.tanzillo at caddzone dot com> wrote in message news:D073D9B5D2AB7C34...@in.WebX.maYIadrTaRb...
Can you illustrate some cool uses for it?
Jim
"Doug Broad" <dbr...@earthlink.net> wrote in message
news:244B08D3339F0F52...@in.WebX.maYIadrTaRb...
I came up with it as part of another program that automatically labels
titleblocks and re-keys all the reference symbols within the boundaries
of the titleblock. I wanted the program to recognize a variety of naming
conventions for titleblocks without asking the user what size the titleblock
was.
NENTSEL returns the most deeply nested entity and also returns each
parent nested entity. With a list of nested block names, it was necessary
to check each of those names against a list of recognizable pattern
strings. In order to stop at the first found match, I used the nested loop.
A return value of T or nil didn't seem as useful as which block name was
matching so that's how I wrote it.
Lets say a line, part of a generic titleblock, part of a project titleblock with
a name that relates just to the project is selected.
(nestedblocks (nentsel)) might return '("tblockd" "tblockkhawk")
But the generic titleblock name could also be tblockd1, tbld or some other
form
(wcmatch-list-list '("tblockd" "tblockhawk") '("tb*d" "*blkd" "t*d#"))
would return a non-nil value and keep me from having to enumerate each
possible titleblock name. Of course my name is too long. Should have
been "wcmatch-lists"
That's one application. Can you think of more? Sorry if this is rambling on.
One limitation is that it won't work in R14.
Regards,
Doug
"Jim Short" <jim.not.tahlinc.com> wrote in message news:01E1DE2ABF1A3E56...@in.WebX.maYIadrTaRb...
--
R. Robert Bell, MCSE
www.AcadX.com
"Doug Broad" <dbr...@earthlink.net> wrote in message
news:40531B8480BE7432...@in.WebX.maYIadrTaRb...