[WASTE-list] Re: Endian issues

Marco Piovanelli marco.piovanelli at pobox.com
Mon May 8 06:31:27 EDT 2006


On Sat, 6 May 2006 10:53:12 -0400,
Kurt Spaker (kspaker at asar.com) wrote:



>On Mar 31, 2006, Marco Piovanelli wrote:

>

>> While I haven't tried recompiling WASTE 2.x as a UB,

>> I expect there to be a number of endian issues you

>> should be careful about.

>>

>> For one thing, WASTE 2.x uses a number of proprietary,

>> binary scrap formats (WEcf, WEpf, WEst, WEru, FISH, SOUP)

>> that need to be flipped when crossing an endian boundary.

>> If you make use of any of these formats, either directly

>> or indirectly (by simply allowing rich text exchange with

>> other WASTE-using applications via drag and drop or the

>> clipboard), you may need to write your own endian flippers.

>

>Now that you've addressed the endian issues in WASTE 3, could you provide

>more specifics how to deal with WASTE 2?

>

>The WASTE 2 source code is all I've got left to deal with for a universal

>binary, but as this is not my code, figuring out exactly where all the

endian

>problems are is a bit daunting.


As I said, most of the endian issues in WASTE (2.x or 3.0) revolve
around the building and parsing of proprietary, binary scrap formats
used to carry rich text information. In version 3.0, these
proprietary formats are being phased out in favor of RTF, but in
version 2.x they're still the most reliable way to represet the full
gamut of text attributes.

The way I dealt with these scrap formats in WASTE 3.0 was by writing
core endian flippers for the most straightforward formats: 'WEcf'/'WEpf'
(which are just arrays of <32-bit offset, 32-bit index> pairs),
'FISH' (a fixed-length header + a variable number of "font table
entries" + packed font names) and 'SOUP' (embedded object data).

The 'WEst' and 'WEru' scraps, on the other hand, are basically
Mac OS 9-style flattened Apple event lists, with nested records
and sublists. It's a pretty complicated format, and writing a core
endian flipper for it would mean duplicating a lot of parsing code
already found elsewhere in WASTE. Instead I decided to stipulate
that this format is always big-endian, and the Intel build just
swaps everything on the fly when parsing or generating it.

I'm not sure I can get more specific without showing you the code. ;-)


-- marco

--
It's not the data universe only, it's human conversation.
They want to turn it into a one-way flow that they have entirely
monetized. I look at the collective human mind as a kind of
ecosystem. They want to clear cut it. They want to go into the
rainforest of human thought and mow the thing down.



More information about the WASTE-list mailing list