From: Claudius Pyka
Subject: macros in lisp.h in acl
Date: 
Message-ID: <claude.709382817@nats1>
Hi,

I am writing some C code to map Lisp values of all types into C
data objects.  To this end, I started to use the macros defined
in lisp.h as delivered by Allegro Common Lisp 4.0.1 in lib/misc.
My environment: Sparc2 with SunOS4.1.1.

Now, there is a commentary at the beginning of lisp.h, saying

** Note that not all data types are represented by C macros

and that's bad news.  Beside the data types that are included
in lisp.h, I also need to map structures (defstructs) from Lisp
representation to C representation.  What I found is that Lisp
structures have type number 15, as can be inquired by macro GetType().

But how are Lisp structures represented internally?  What C
structure encodes Lisp structures?  Does anybody have a more
complete macro library for this purpose (mapping Lisp to C)?

Help needed!

cu --- Claude.
From: Steve Haflich
Subject: Re: macros in lisp.h in acl
Date: 
Message-ID: <1992Jun25.002837.100@franz.com>
> ... Beside the data types that are included
>in lisp.h, I also need to map structures (defstructs) from Lisp
>representation to C representation.  What I found is that Lisp
>structures have type number 15, as can be inquired by macro GetType().
>
>But how are Lisp structures represented internally?  What C
>structure encodes Lisp structures?  Does anybody have a more
>complete macro library for this purpose (mapping Lisp to C)?

The type code of an instance of a defstruct has type code 61, not 15.
See the #define for StructType.  The layout of the instance itself is
isomorphic to a simple vector.  The zeroth slot (the first word after
the header) contains the symbol naming the structure type, followed by
zero or more slots.  The macro Vecdata is appropriate to access slots.