On 01.10.2012 13:30, Levente Uzonyi wrote:
On Mon, 1 Oct 2012, Max Leske wrote:

Hi guys

Is there a way to find out (from outside of the image), if an image has been saved with Cog? What I would like to do is something like this:

$ head -20 myImage.image | grep <some expression>

The use case for this is seaside hosting, where we only have squeak VMs to run images, so when an image is uploaded that was saved with Cog that image cause trouble.
Any ideas?

Currently there are 3 image formats around 6502 (old interpreter format, no closures), 6504 (new interpreter format with closures), 6505 (Cog format). The first two bytes of the image file contain the image format in little-endian (IIRC) format.
Endianness in header depends on the platform the image was saved on.
Which for all practical purposes, means little-endian these days.

There is no symmetry in the format which allows you to bit-test endianness in a platform independent manner, afaik, the only "rule" is that format numbers which read as an existing format in the opposite endianness is disallowed.

Cheers,
Henry

Reply via email to