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

Guile provides both ordinary cells with two slots, and double cells with four slots. The following two function are the most primitive way to allocate such cells.

If the caller intends to use it as a header for some other type, she must pass an appropriate magic value in word_0, to mark it as a member of that type, and pass whatever value as word_1, etc that the type expects. You should generally not need these functions, unless you are implementing a new datatype, and thoroughly understand the code in <libguile/tags.h>.

If you just want to allocate pairs, use scm_cons.

Function: SCM scm_cell (scm_t_bits word_0, scm_t_bits word_1)

Allocate a new cell, initialize the two slots with word_0 and word_1, and return it.

Note that word_0 and word_1 are of type scm_t_bits. If you want to pass a SCM object, you need to use SCM_UNPACK.

Function: SCM scm_double_cell (scm_t_bits word_0, scm_t_bits word_1, scm_t_bits word_2, scm_t_bits word_3)

Like scm_cell, but allocates a double cell with four slots.