Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.

Previous: , Up: The SCM Type in Guile   [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.

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.

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 the SCM_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.

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 the SCM_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.

Summary:


Previous: , Up: The SCM Type in Guile   [Contents][Index]