Hi,
I have a stream from which I'm receiving (and later, sending)
structured messages. The message structure is read from a file and
can include floats, integers, etc. as well as arrays. There's a
prespecified way, in the system I'm trying to interface with, of
serializing such a message onto a stream, roughly like a little-endian
C-struct. I'm looking for a simple way to read in the message
structure, and given this, deserialize such messages from a stream.
One possibility seems to be to use the alien data types provided by
sbcl/cmucl. But there's still the problem of taking the raw bytes
from the stream and populating an instance of the alien type - the
equivalent of a C memcpy. Is there an existing way to do this (and
the inverse operation of serializing alien objects back onto the
stream in the required form)?
Thanks,
Bhaskara
From: Stephen Compall
Subject: Re: deserializing alien objects from a stream
Date:
Message-ID: <m27ibnpzrp.fsf@member.fsf.org>
basman <········@gmail.com> writes:
> There's a prespecified way, in the system I'm trying to interface
> with, of serializing such a message onto a stream, roughly like a
> little-endian C-struct. I'm looking for a simple way to read in the
> message structure, and given this, deserialize such messages from a
> stream.
Check out chapter 24 of /Practical Common Lisp/ and see if it's what
you're looking for. The publisher offers the source on its website.
--
But you know how reluctant paranormal phenomena are to reveal
themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003
On Jul 14, 8:55 pm, Stephen Compall <····@member.fsf.org> wrote:
> basman <········@gmail.com> writes:
> > There's a prespecified way, in the system I'm trying to interface
> > with, of serializing such a message onto a stream, roughly like a
> > little-endian C-struct. I'm looking for a simple way to read in the
> > message structure, and given this, deserialize such messages from a
> > stream.
>
> Check out chapter 24 of /Practical Common Lisp/ and see if it's what
> you're looking for. The publisher offers the source on its website.
>
> --
> But you know how reluctant paranormal phenomena are to reveal
> themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003
Yes, that seems like it could do it. Thanks.
- Bhaskara