Hm, not exactly. I have examined ByteArray a bit and found out, that FFI
extends it with some methods
to support ExternalStructure and co. This is nice, but the problem is,
that it is not XDR compatible, meaning
(and correct me if I'm wrong), it will not work across machines with
different architectures (e.g. Cray, VAX, etc.).
The problem is mainly, that ByteArray methods do not align the saved
data to 4 bytes and not every method
supports little/big endian encoding. Also the methods that have no
endian flag are using a primitive call to the FFI
plugin, those having the flag are making the conversion in-method, which
is not very good I think, having the same
implementation both in plugin and in image. An ideal solution would be
to support XDR en/decoding in the FFI plugin
by calling the xdr_* methods from <rpc/xdr.h>, but I don't know how
difficult it would be to modify the FFI plugin
sources.
Cheers,
Elod
Jason Johnson wrote:
> This is what the FFI package does, no?
>
> On 8/24/07, Elod Kironsky <
[hidden email]> wrote:
>
>> Hi!
>>
>> I wonder if there is any package in Squeak that would en/de-code
>> standard C types to a byte-array, as the RFC 1014 - XDR: eXtrenal Data
>> Representation standard does. I'm currently working on a client program
>> to Player/Stage and it would save me a lot of work, as the communication
>> is done via TCP packages. I know ByteArray can do byte, short, long and
>> even double, but is it XDR compatible? Also, is there an equivalent of
>> the C function gettimeofday(), that would return me a double, or
>> something, that I can put into a ByteArray with doubleAt:put:bigEndian:?
>>
>> Cheers,
>>
>> Elod
>>
>>
>>
>
>
>