librelist archives

« back to archive

Fixing shy headers for OSX PPC Users

Fixing shy headers for OSX PPC Users

From:
i5m
Date:
2010-03-22 @ 11:48
If anyone is still using OSX PPC, then I came across an issue with Shy files
and the headers. Basically if I created a Shy file on Windows I could not
open that on OSX PPC and vice versa.

Turns out it is because of Array.Pack using S and L which will pick up the
Endianness of the platform being used.
http://ruby-doc.org/core/classes/Array.html#M002222

<http://ruby-doc.org/core/classes/Array.html#M002222>So a simple fix for OSX
PPC users is just to change the LAYOUT to "A4vV" from "A4SL" which will
force little endian on reading and writing Shy files.
http://github.com/i5m/shoes/blob/osxppc/lib/shoes/shy.rb#L15
I've committed a change to an OSXPPC branch. Seeing as how PPC is on the way
out, probably not worth changing the master Shoes branch; instead I'll write
up a known issue for Shoes 2 or something.


-----------------------
i5m.co.uk
GPG Key: 0xA18A602B

Re: [shoes] Fixing shy headers for OSX PPC Users

From:
Cecil Coupe
Date:
2010-03-23 @ 03:43
Nice catch! I wouldn't discount future endian issues so quickly as you.
Perhaps that iPad processor is little endian (for all I know). With all
the mobile devices and ebook readers and the like arriving. I think I'll
look in the ARM architecture. There used to be a chip that would run big
or little endian depending on the signal of one pin. 

On Mon, 2010-03-22 at 11:48 +0000, i5m wrote:
> If anyone is still using OSX PPC, then I came across an issue with Shy
> files and the headers. Basically if I created a Shy file on Windows I
> could not open that on OSX PPC and vice versa.
> 
> 
> Turns out it is because of Array.Pack using S and L which will pick up
> the Endianness of the platform being used.
> http://ruby-doc.org/core/classes/Array.html#M002222
> 
> 
> So a simple fix for OSX PPC users is just to change the LAYOUT to
> "A4vV" from "A4SL" which will force little endian on reading and
> writing Shy files. 
> http://github.com/i5m/shoes/blob/osxppc/lib/shoes/shy.rb#L15
> I've committed a change to an OSXPPC branch. Seeing as how PPC is on
> the way out, probably not worth changing the master Shoes branch;
> instead I'll write up a known issue for Shoes 2 or something.
> 
> 
> 
> -----------------------
> i5m.co.uk
> GPG Key: 0xA18A602B
> 

Re: [shoes] Fixing shy headers for OSX PPC Users

From:
Devyn Cairns
Date:
2010-03-23 @ 04:48
Is there not a way to explicitly set the endianness for all platforms? That
would be a good way to make it independent.

On Mon, Mar 22, 2010 at 8:43 PM, Cecil Coupe <ccoupe@cableone.net> wrote:

> Nice catch! I wouldn't discount future endian issues so quickly as you.
> Perhaps that iPad processor is little endian (for all I know). With all
> the mobile devices and ebook readers and the like arriving. I think I'll
> look in the ARM architecture. There used to be a chip that would run big
> or little endian depending on the signal of one pin.
>
> On Mon, 2010-03-22 at 11:48 +0000, i5m wrote:
> > If anyone is still using OSX PPC, then I came across an issue with Shy
> > files and the headers. Basically if I created a Shy file on Windows I
> > could not open that on OSX PPC and vice versa.
> >
> >
> > Turns out it is because of Array.Pack using S and L which will pick up
> > the Endianness of the platform being used.
> > http://ruby-doc.org/core/classes/Array.html#M002222
> >
> >
> > So a simple fix for OSX PPC users is just to change the LAYOUT to
> > "A4vV" from "A4SL" which will force little endian on reading and
> > writing Shy files.
> > http://github.com/i5m/shoes/blob/osxppc/lib/shoes/shy.rb#L15
> > I've committed a change to an OSXPPC branch. Seeing as how PPC is on
> > the way out, probably not worth changing the master Shoes branch;
> > instead I'll write up a known issue for Shoes 2 or something.
> >
> >
> >
> > -----------------------
> > i5m.co.uk
> > GPG Key: 0xA18A602B
> >
>
>
>


-- 
   ~devyn

Re: [shoes] Fixing shy headers for OSX PPC Users

From:
i5m
Date:
2010-03-23 @ 09:29
Devyn,

On Tue, Mar 23, 2010 at 4:48 AM, Devyn Cairns <devyn.cairns@gmail.com>wrote:

> Is there not a way to explicitly set the endianness for all platforms? That
> would be a good way to make it independent.
>
> Yep, setting the LAYOUT to "A4vV" would force little endian on all
platforms. So we could switch to that for everyone.

Re: [shoes] Fixing shy headers for OSX PPC Users

From:
Satoshi Asakawa
Date:
2010-03-23 @ 13:43
Hi i5m,

Great hack. Awesome!
Okay, I'll set the LAYOUT to "A4vV" on my github repo.

ashbb