Subject: Re: endianess ?
From: Hubert Figuiere (hfiguiere@teaser.fr)
Date: Mon Jan 31 2000 - 05:43:49 CST
According to Paul Rohr <paul@abisource.com>:
> At 04:35 PM 1/28/00 +0100, Hubert Figuiere wrote:
> >Is there anyway using the XP code from AbiWord to determine the endianess of
> >the system it is compiled for ? I'd also like to know if there are endianess
> >change functions.
> 
> Here are a few different answers.  Take your pick:
> 
> 1.  Are you *sure* you want to know local endianness? 
Yes.
> Other importers which 
> read binary files are written to do so without making assumptions about 
> local endian conventions.  For example, see what Caolan has done in wv to 
> make sure that he's reading specific bits and bytes out of the file.
I'll look at it. The problem is that I do have a file with data in
little-endian, and I need to know whether I have to do byte-swapping or not.
> 2.  There is a flag -- OS_ENDIAN, set in abi/src/config/platforms/*.mk -- 
> which determines which variant of american.hash to install with AbiWord.  
> AFAIK, it's not used in code anywhere, just to choose one of a pair of files 
> by name.  However, the only reason we're forced to do this is because ispell 
> was originally written in an endian-sensitive way.
:-/
I'll look at 1.
[...]
> >I need it for an import filter I'm writting.
> 
> Hmm.  Does the content you're importing change depending on the platform 
> you're currently running on?  
It is always little endian. 
> What happens if somebody tries to open that 
> same content on a different platform?  
It should work. That's why I do need to know the endian.
Hub
This archive was generated by hypermail 2b25 : Mon Jan 31 2000 - 05:43:51 CST