(guile.info.gz) Relationship between SCM and scm_t_bits
Info Catalog
(guile.info.gz) Unpacking the SCM type
(guile.info.gz) Immediate objects
18.2.7.1 Relationship between `SCM' and `scm_t_bits'
....................................................
A variable of type `SCM' is guaranteed to hold a valid Scheme object.
A variable of type `scm_t_bits', on the other hand, may hold a
representation of a `SCM' value as a C integral type, but may also hold
any C value, even if it does not correspond to a valid Scheme object.
For a variable X of type `SCM', the Scheme object's type information
is stored in a form that is not directly usable. To be able to work on
the type encoding of the scheme value, the `SCM' variable has to be
transformed into the corresponding representation as a `scm_t_bits'
variable Y by using the `SCM_UNPACK' macro. Once this has been done,
the type of the scheme object X can be derived from the content of the
bits of the `scm_t_bits' value Y, in the way illustrated by the example
earlier in this chapter ( Cheaper Pairs). Conversely, a valid
bit encoding of a Scheme value as a `scm_t_bits' variable can be
transformed into the corresponding `SCM' value using the `SCM_PACK'
macro.
-- Macro: scm_t_bits SCM_UNPACK (SCM X)
Transforms the `SCM' value X into its representation as an
integral type. Only after applying `SCM_UNPACK' it is possible to
access the bits and contents of the `SCM' value.
-- Macro: SCM SCM_PACK (scm_t_bits X)
Takes a valid integral representation of a Scheme object and
transforms it into its representation as a `SCM' value.
Info Catalog
(guile.info.gz) Unpacking the SCM type
(guile.info.gz) Immediate objects
automatically generated byinfo2html