[comp.sys.mac.programmer] compressed resources

andyp@treehouse.uucp (Andy Peterman) (01/06/91)

I just encountered something real strange with some files from the
System 7.0 CD ROM - compressed resources.  The latest ResEdit seems to
recognize them, but when running under System 6.0.x, they don't load
correctly when using GetResource.  Does anyone know anything about them???

I searched through the IM Vol VI and there isn't a word about these!
There seems to be a resource attribute bit to indicate that it's
compressed, but nothing describing how to deal with it.  Yet another 7.0
mystery.....

--
Andy Peterman                       |   Opinions expressed
treehouse!andyp@gvgpsa.gvg.tek.com  | are definitely those of
(916) 273-4569                      |      my employer!

ralph@computing-maths.cardiff.ac.uk (Ralph Martin) (01/22/91)

The new ResEdit has a checkbox to show some whether a resource is
compressed or not. Some of the resources in System 7.0b1 are indeed
compressed.  However, I can find NO documentation on compressed
resources. There seems to be no mention of them in the Inside Mac
Volume 6 resource manager or other chapters. Can anyone either point
me to the documentation, or explain how they work?  

I've found a reference in Types.r to compressed resource guard
mechanisms, and ResEdit itself seems to contain some code for
decompressing resources, but thats about all I can find. I have some
resources of my own it would be very handy to compress, and want to
know if resource compression is (or will be) available for general
use, or just for the System etc. The obvious trick of clicking on the
compressed checkbox in ResEdit does NOT compress a resource. It seems
to be read-only.

Ralph

time@tbomb.ice.com (Tim Endres) (01/22/91)

In article <1991Jan22.110540.3139@computing-maths.cardiff.ac.uk>, ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
> I've found a reference in Types.r to compressed resource guard
> mechanisms, and ResEdit itself seems to contain some code for
> decompressing resources, but thats about all I can find. I have some
> resources of my own it would be very handy to compress, and want to
> know if resource compression is (or will be) available for general
> use, or just for the System etc. The obvious trick of clicking on the
> compressed checkbox in ResEdit does NOT compress a resource. It seems
> to be read-only.

I wonder if the Resource Manager has been designed to be "smart" about
when to compress resources, once again leaving the programmer on the
short end of the design process.

tim.

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |
Whitmore Lake MI. 48189   |  (313) 449 8288

lance@hermix.UUCP (Lance Ellinghouse) (03/22/91)

Is there a way for us developers to create compressed resources
under System 7.0? I have a HUGE (125K now and soon MUCH more
to be added) string resource. I would love to be able to
compress this on the disk and have it uncompressed at usage time.

Thanks,
Lance Ellinghouse
Mark V Systems, Ltd.
hermix!lance@anes.ucla.edu

Greg@AppleLink.Apple.Com (Greg Marriott) (03/22/91)

In article <222@hermix.UUCP>, lance@hermix.UUCP (Lance Ellinghouse) writes:
> 
> Is there a way for us developers to create compressed resources
> under System 7.0? I have a HUGE (125K now and soon MUCH more
> to be added) string resource. I would love to be able to
> compress this on the disk and have it uncompressed at usage time.

Sorry, but the answer is no.

The reason is that the way decompression is implemented in 7.0 isn't much
of an architecture (it's more of a hack).  It was added to enable us to
make floppies that you can use to install System 7.

We are working on a more "complete" solution, one which we will feel
comfortable supporting as a useful addition to the toolbox.  We will
document it when it's ready.

Until then treat it as an undocumented black box subject to change at the
drop of a hat.

Greg Marriott
Blue Meanie
Apple Computer, Inc.

deadman@garnet.berkeley.edu (Ben Haller) (03/24/91)

In article <12678@goofy.Apple.COM> Greg@AppleLink.Apple.Com (Greg Marriott) writes:
>In article <222@hermix.UUCP>, lance@hermix.UUCP (Lance Ellinghouse) writes:
>> Is there a way for us developers to create compressed resources
>> under System 7.0? I have a HUGE (125K now and soon MUCH more
>> to be added) string resource. I would love to be able to
>> compress this on the disk and have it uncompressed at usage time.
>Sorry, but the answer is no.
>The reason is...the way decompression is implemented in 7.0...
>We are working on a more "complete" solution, one which we will feel
>drop of a hat.

  Of course, you have the alternative of using your own
compression/decompression code.  I'm afraid this sounds
like an advertisement, but I have code available that
does LZW decompression and compression of individual
resources.  I use the code to great advantage in my
game Solarian II (~740K compressed, ~1100K uncompressed).
The source is available for $25 from me at:
   Stick Software
   c/o Ben Haller
   32 Deer Haven Dr.
   Ithaca, N.Y. 14850

-Ben Haller (deadman@garnet.berkeley.edu)