[delphizip] Re: Wildcard Rules (was: Apologies to Eric and questions)

  • From: "Russell Peters" <russellpeters@xxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Fri, 22 Mar 2002 14:24:34 +1100

Thanks for the clarification, I come to the conclusion that they must have come 
from UNIX (but had not researched it yet) after all (as far as I remember) 
"zip" was born in UNIX, and yes I prefer them to the windows version (based on 
crippled Unix to fit DOS then expanded to work with directories).
The need to speed up "match" can be seen from the following formula -
number of times called is proportional to 2 * ((f+n)/n)*f^n where f is number 
of files in archive and n is the number of filespecs to seek.
(This only applies if all files is not flagged)
This can be halved by only checking files once (ie clear a "selected" flag when 
file is rejected while working out total files and total size instead of then 
doing the whole lot again to select them).
I have not checked yet but does "zip" file selection follow the same rules 
under Windows or were they adapted for Windows. (come to think of it, I think I 
can remember trying to use wildcards in path selection without success - I 
tried something like "program files\c*\*.*" but it did not select anything. I 
do know that "excluding" files from zipping shares almost the same routine as 
extracting)
A reasonable compromise for Windows might be to split the specification into 3 
parts (path,name,ext) and confine operation of wildcards to each. I will try 
this and see what it does.

I did the following to speed up the existing match.c.
1 - only initial the case table on first call instead of all (millions of) 
calls - has the side effect of "locking" the case table until the dll unloads [ 
actually if character mapping was likely to change during thread operation the 
case table should be added to "Globals" ]
2 - instead of allocating two character buffers to hold both strings, I create 
one big enough for both (believe it or not this makes a large saving)
3 - got rid of recursion - would be very difficult if matching unix-like
4 - don't try to match more than you need to - if name doesn't match, don't try 
path and/or ext

Thanks - Russell

  ----- Original Message ----- 
  From: Eric.Engler@xxxxxxxxxxxxxx 
  To: delphizip@xxxxxxxxxxxxx 
  Sent: Friday, March 22, 2002 9:53 AM
  Subject: [delphizip] Wildcard Rules (was: Apologies to Eric and questions)


  Wildcard rules in Delphi Zip
  Eric

  -----Original Message-----
  From: Russell Peters [mailto:russellpeters@xxxxxxxxxxx]
  Sent: Thursday, March 21, 2002 5:18 PM
  To: delphizip@xxxxxxxxxxxxx
  Subject: [delphizip] Apologies to Eric and questions

   I must apologise - I my thoughts on Unzip's match were most uncomplimentary.
    - Russell Peters

Other related posts: