gzip & Mac File Types

Rob Cozens rcozens at pon.net
Mon Sep 16 10:39:01 EDT 2002


Richard, et al:

>It's simple enough to use a text file for this, but just a tad simpler to
>use a stack file.  Compare whatever parsing routines you were going to write
>with the simple, robust, and ultra-fast one-liner syntax of getting a custom
>property.

The text file approach is completed and just about finished testing; 
so I'll stick with it for now.  However, I always consider a message 
from you as a word to the wise; so I'll try to find time to check out 
the issues you raise.

>And expanding the notion to work with multiple files becomes even more
>convenient with Rev's array notation.

The issue here is the complexity of gathering and storing individual 
files from an unknown number of folders nested to an unknown number 
of levels.  I am happy working with individual files, and will leave 
that issue to someone who wants to build a commercial archiver

>
>In fact, if you later find you need to add any other info at all (such as
>directives on what to do with the uncompressed files -- run them in an app,
>leave 'em be, etc.) you can just add another property or property array to
>the stack file, and you never need to worry about breaking your format.

You are certainly correct if that need arises.  (I'm already 
capturing creation & modification dates even though decompress does 
nothing with that info presently.)

>
>With a text file you also have the potential risk that whatever delimiters
>you use may appear in data.  With Rev's ability to store binary data in
>custom properties you never need to think about how it's delimited.

Its not a problem: I don't search for a delimiter to find the end of 
the data fork and the beginning of the resource fork: I save the byte 
length of the data fork in the footer.  The footer format is creation 
date in seconds [10 char], modification date in seconds [10]char, 
creator/file type [8 char],end of fixed header ["#"], and the length 
of the data fork.


The only parsing done is to read backwards from char -1 until "#". 
Once that position (& with it the length of the data fork) is known, 
the position of each element in the file is known as well.


-- 

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.com/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the Use-livecode mailing list