From: Florian Weimer
Subject: Representation clauses
Date: 
Message-ID: <874r4lf5od.fsf@deneb.enyo.de>
Ada has a nifty features called representation clauses: You can
specify the memory layout for objects of some record type, and the Ada
implementation will generate appropriate code to access record
components or signal a compile-time error if the architecture doesn't
support the layout.

I'm looking for a similar feature for Lisp, but not to contral the
in-memory layout of objects, but to create code which marshals and
unmarshels objects to byte streams, in predefined layouts.  The layout
description can be quite complicated, as it hasn't been designed for
easy parsing (think of IP or DNS packets---especially the latter are
far beyond Ada representation clauses, but one can hope 8-).

From: Rudi Schlatte
Subject: Re: Representation clauses
Date: 
Message-ID: <87r87p7x5y.fsf@semmel.constantly.at>
Florian Weimer <··@deneb.enyo.de> writes:

> Ada has a nifty features called representation clauses: You can
> specify the memory layout for objects of some record type, and the Ada
> implementation will generate appropriate code to access record
> components or signal a compile-time error if the architecture doesn't
> support the layout.
>
> I'm looking for a similar feature for Lisp, but not to contral the
> in-memory layout of objects, but to create code which marshals and
> unmarshels objects to byte streams, in predefined layouts.  The layout
> description can be quite complicated, as it hasn't been designed for
> easy parsing (think of IP or DNS packets---especially the latter are
> far beyond Ada representation clauses, but one can hope 8-).

Have a look at <URL:http://www.cliki.net/Binary-types>; perhaps this
does what you need.

Regards,

Rudi
-- 
whois DRS1020334-NICAT                    http://constantly.at/pubkey.gpg.asc
     Key fingerprint = C182 F738 6B9A 83AF 9C25  62D9 EFAE 45A6 9A69 0867
From: Florian Weimer
Subject: Re: Representation clauses
Date: 
Message-ID: <87ist0jpmp.fsf@deneb.enyo.de>
Rudi Schlatte <·········@ist.tu-graz.ac.at> writes:

> Have a look at <URL:http://www.cliki.net/Binary-types>; perhaps this
> does what you need.

Hmm. Looks quite usable, but I'm not sure if you can use it to parse
DNS packets. 8-/
From: Barry Margolin
Subject: Re: Representation clauses
Date: 
Message-ID: <Gabra.3$H_2.498@paloalto-snr1.gtei.net>
In article <··············@deneb.enyo.de>,
Florian Weimer  <··@deneb.enyo.de> wrote:
>Ada has a nifty features called representation clauses: You can
>specify the memory layout for objects of some record type, and the Ada
>implementation will generate appropriate code to access record
>components or signal a compile-time error if the architecture doesn't
>support the layout.
>
>I'm looking for a similar feature for Lisp, but not to contral the
>in-memory layout of objects, but to create code which marshals and
>unmarshels objects to byte streams, in predefined layouts.  The layout
>description can be quite complicated, as it hasn't been designed for
>easy parsing (think of IP or DNS packets---especially the latter are
>far beyond Ada representation clauses, but one can hope 8-).

Genera has a pretty nice internal facility called (I think) DEFSTRUCTURE
that's used for things like network packets and file system structures.
You use it similarly to DEFSTRUCT.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Carl Shapiro
Subject: Re: Representation clauses
Date: 
Message-ID: <ouyof2qo8bz.fsf@panix3.panix.com>
Barry Margolin <··············@level3.com> writes:

> Genera has a pretty nice internal facility called (I think) DEFSTRUCTURE
> that's used for things like network packets and file system structures.
> You use it similarly to DEFSTRUCT.

I don't know anything about DEFSTRUCTURE, but the LMFS package exports
a macro called DEFSTORAGE which allows one to define packed
structures.  DEFSTORAGE is used by at least a few network services for
block oriented input and output.  It also serves as a great example of
why displaced arrays are truly indispensable.
From: Barry Margolin
Subject: Re: Representation clauses
Date: 
Message-ID: <xmdra.14$H_2.467@paloalto-snr1.gtei.net>
In article <···············@panix3.panix.com>,
Carl Shapiro  <·············@panix.com> wrote:
>Barry Margolin <··············@level3.com> writes:
>
>> Genera has a pretty nice internal facility called (I think) DEFSTRUCTURE
>> that's used for things like network packets and file system structures.
>> You use it similarly to DEFSTRUCT.
>
>I don't know anything about DEFSTRUCTURE, but the LMFS package exports
>a macro called DEFSTORAGE which allows one to define packed
>structures.  DEFSTORAGE is used by at least a few network services for
>block oriented input and output.  It also serves as a great example of
>why displaced arrays are truly indispensable.

Yes, that's what I was thinking of.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Florian Weimer
Subject: Re: Representation clauses
Date: 
Message-ID: <87bry9sqoe.fsf@deneb.enyo.de>
Carl Shapiro <·············@panix.com> writes:

> I don't know anything about DEFSTRUCTURE, but the LMFS package exports
> a macro called DEFSTORAGE which allows one to define packed
> structures.

Is this facility documented in any easily accessible document?
From: Franz Kafka
Subject: Re: Representation clauses
Date: 
Message-ID: <fJuva.5937$0x5.1339@news02.roc.ny.frontiernet.net>
"Florian Weimer" <··@deneb.enyo.de> wrote in message
···················@deneb.enyo.de...
> Carl Shapiro <·············@panix.com> writes:
>
> > I don't know anything about DEFSTRUCTURE, but the LMFS package exports
> > a macro called DEFSTORAGE which allows one to define packed
> > structures.
>
> Is this facility documented in any easily accessible document?
>

LMFS is the Lisp Machine File System from Symbolics.

The best place to look for this is in the Documentation that
came with your Lisp Machine.

The documentation might be avail. on line, or you could
do an interlibrary loan for it. The documentation is an 11 vol.
set.

Symbolics Internals forgot vol. number might have infomation
about it.

typing:
(ed #'defstorage)
in a Lispm will bring up the source to defstorage which may or
may not have documentation.

Also in Genera 8.x
try typing
Show Documentation LMFS
at the command prompt.

If you are having trouble finding doumentation, e-mail me and
I will look it up for you. Or, post a reply asking me too look it up
4 U
From: Florian Weimer
Subject: Re: Representation clauses
Date: 
Message-ID: <87of1q56nr.fsf@deneb.enyo.de>
"Franz Kafka" <Symbolics _ XL1201 _ Sebek _ Budo _ Kafka @ hotmail . com> writes:

> The best place to look for this is in the Documentation that
> came with your Lisp Machine.
>
> The documentation might be avail. on line,

Unfortunately, it is not.  As a result, it doesn't make sense to mimic
this particular interface because I would have to write documentation
for it anyway.
From: Timothy Moore
Subject: Re: Representation clauses
Date: 
Message-ID: <bata6c$aru$0@216.39.145.192>
Florian Weimer <··@deneb.enyo.de> writes:

> "Franz Kafka" <Symbolics _ XL1201 _ Sebek _ Budo _ Kafka @ hotmail . com> writes:
> 
> > The best place to look for this is in the Documentation that
> > came with your Lisp Machine.
> >
> > The documentation might be avail. on line,
> 
> Unfortunately, it is not.  As a result, it doesn't make sense to mimic
> this particular interface because I would have to write documentation
> for it anyway.

There is a book, Lisp Lore, which provides a good overview of the user
and programming features of the Lisp Machine.
http://www.amazon.com/exec/obidos/tg/detail/-/0898382289/

I just put my copy in a box and I miss it already :)

Tim