On 01 Oct 2012, at 13:30, Levente Uzonyi <leves@elte.hu> wrote:
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. So you can decide it by checking the first byte (head -c 1). If you only support the old interpreter format, then the following bash expression should work:
[ $(head -c 1 $IMAGE_NAME) == 'f' ]
SmalltalkImage current imagePath asFileReference readStreamDo: [ :stream | stream binary. (stream next: 2) reversed asInteger ]. to express your description in Smalltalk code then. Thanks for the explanation. -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill