[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.2.5.3 Non-immediate objects
A Scheme object of type SCM
that does not fulfill the
SCM_IMP
predicate holds an encoded reference to a heap cell.
This reference can be decoded to a C pointer to a heap cell using the
SCM2PTR
macro. The encoding of a pointer to a heap cell into a
SCM
value is done using the PTR2SCM
macro.
- Macro: scm_t_cell * SCM2PTR (SCM x)
Extract and return the heap cell pointer from a non-immediate
SCM
object x.
- Macro: SCM PTR2SCM (scm_t_cell * x)
Return a
SCM
value that encodes a reference to the heap cell pointer x.
Note that it is also possible to transform a non-immediate SCM
value by using SCM_UNPACK
into a scm_t_bits
variable.
However, the result of SCM_UNPACK
may not be used as a pointer to
a scm_t_cell
: only SCM2PTR
is guaranteed to transform a
SCM
object into a valid pointer to a heap cell. Also, it is not
allowed to apply PTR2SCM
to anything that is not a valid pointer
to a heap cell.
Summary:
-
Only use
SCM2PTR
onSCM
values for whichSCM_IMP
is false! -
Don’t use
(scm_t_cell *) SCM_UNPACK (x)
! UseSCM2PTR (x)
instead! -
Don’t use
PTR2SCM
for anything but a cell pointer!
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.