Next: Basic Rules for Accessing Cell Entries, Previous: Heap Cell Type Information, Up: Unpacking the SCM type
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.
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)
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)
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)
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:
SCM_CELL_TYPE (
x)
.