[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.2.5.6 Accessing Cell Entries
For a non-immediate Scheme object x, the object type can be
determined by reading the cell type entry using the SCM_CELL_TYPE
macro. For each different type of cell it is known which cell entries
hold Scheme objects and which cell entries hold raw C data. To access
the different cell entries appropriately, the following macros are
provided.
- Macro: scm_t_bits SCM_CELL_WORD (SCM x, unsigned int n)
Deliver the cell entry n of the heap cell referenced by the non-immediate Scheme object x as raw data. It is illegal, to access cell entries that hold Scheme objects by using these macros. For convenience, the following macros are also provided.
- SCM_CELL_WORD_0 (x) ⇒ SCM_CELL_WORD (x, 0)
- SCM_CELL_WORD_1 (x) ⇒ SCM_CELL_WORD (x, 1)
- …
- SCM_CELL_WORD_n (x) ⇒ SCM_CELL_WORD (x, n)
- Macro: SCM SCM_CELL_OBJECT (SCM x, unsigned int n)
Deliver the cell entry n of the heap cell referenced by the non-immediate Scheme object x as a Scheme object. It is illegal, to access cell entries that do not hold Scheme objects by using these macros. For convenience, the following macros are also provided.
- SCM_CELL_OBJECT_0 (x) ⇒ SCM_CELL_OBJECT (x, 0)
- SCM_CELL_OBJECT_1 (x) ⇒ SCM_CELL_OBJECT (x, 1)
- …
- SCM_CELL_OBJECT_n (x) ⇒ SCM_CELL_OBJECT (x, n)
- Macro: void SCM_SET_CELL_WORD (SCM x, unsigned int n, scm_t_bits w)
Write the raw C value w into entry number n of the heap cell referenced by the non-immediate Scheme value x. Values that are written into cells this way may only be read from the cells using the
SCM_CELL_WORD
macros or, in case cell entry 0 is written, using theSCM_CELL_TYPE
macro. For the special case of cell entry 0 it has to be made sure that w contains a cell type information which does not describe a Scheme object. For convenience, the following macros are also provided.- SCM_SET_CELL_WORD_0 (x, w) ⇒ SCM_SET_CELL_WORD (x, 0, w)
- SCM_SET_CELL_WORD_1 (x, w) ⇒ SCM_SET_CELL_WORD (x, 1, w)
- …
- SCM_SET_CELL_WORD_n (x, w) ⇒ SCM_SET_CELL_WORD (x, n, w)
- Macro: void SCM_SET_CELL_OBJECT (SCM x, unsigned int n, SCM o)
Write the Scheme object o into entry number n of the heap cell referenced by the non-immediate Scheme value x. Values that are written into cells this way may only be read from the cells using the
SCM_CELL_OBJECT
macros or, in case cell entry 0 is written, using theSCM_CELL_TYPE
macro. For the special case of cell entry 0 the writing of a Scheme object into this cell is only allowed if the cell forms a Scheme pair. For convenience, the following macros are also provided.- SCM_SET_CELL_OBJECT_0 (x, o) ⇒ SCM_SET_CELL_OBJECT (x, 0, o)
- SCM_SET_CELL_OBJECT_1 (x, o) ⇒ SCM_SET_CELL_OBJECT (x, 1, o)
- …
- SCM_SET_CELL_OBJECT_n (x, o) ⇒ SCM_SET_CELL_OBJECT (x, n, o)
Summary:
-
For a non-immediate Scheme object x of unknown type, get the type
information by using
SCM_CELL_TYPE (x)
. - As soon as the cell type information is available, only use the appropriate access methods to read and write data to the different cell entries.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.