if by "filetype" you mean a 3 byte extension (like .pas or .txt)
and you can constrain the character set (say to case-indifferent
alpha, digits and a few special characters like '$' and ' ' and
'_') then you have about 40^3 (about 65k)  possible file types.

you could comfortably hold an array of 65k byte codes for
"include/exclude/whatever" and map each 3byte filetype directly
to an integer index into this array.

BTW you can use a similar trick to quickly generate the
index into the table from the 3 byte filetype: construct
3 tables of 256 integers (1 for each possible character in each
of the 3 positions 1,2,3 of the filetype) - then sum those integers
to create the index into the 65k array.

if you have a lot of filetypes this will be faster than doing
searching lookups into a table of 65000 codes.



-ns
http://www.roserox.co.th


----- Original Message -----
From: "Alistair George" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Tuesday, October 15, 2002 07:02
Subject: [DUG]: To CASE or not?


> Hi all.
> I am writing a backup routine which includes or excludes bunches of
> files/folders.
> For example, during the backup process the compressor must be told which
file
> types to exclude.
> My concern is that if this bunch of types is numerous that the
> processing/parsing could be quite resource intensive.
>
> Any suggestions to achieve this would be appreciated. My own feeling is to
run
> with a dynamic CASE statement, but even this would seem to take a pretty
big
> chunk of processing time given each file is parsed?
> Thanks,
> Alistair George+
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to