DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(guile.info.gz) Accessing Cell Entries

Info Catalog (guile.info.gz) Heap Cell Type Information (guile.info.gz) Unpacking the SCM type (guile.info.gz) Basic Rules for Accessing Cell Entries
 
 18.2.7.5 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 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.
         * 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 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.
         * 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.
 
Info Catalog (guile.info.gz) Heap Cell Type Information (guile.info.gz) Unpacking the SCM type (guile.info.gz) Basic Rules for Accessing Cell Entries
automatically generated byinfo2html