Node:Non-immediate objects, Next:Heap Cell Type Information, Previous:Immediate objects, Up:Unpacking the SCM type
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
|(scm_t_cell *) SCM2PTR (SCM x)||Macro|
Extract and return the heap cell pointer from a non-immediate |
|SCM PTR2SCM (scm_t_cell * x)||Macro|
Return a |
Note that it is also possible to transform a non-immediate
value by using
SCM_UNPACK into a
However, the result of
SCM_UNPACK may not be used as a pointer to
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.
SCMvalues for which
(scm_t_cell *) SCM_UNPACK (x)! Use
PTR2SCMfor anything but a cell pointer!