|
x-engine-c v0.2.31
The C engine for x-lang
|
The vector layout's constructor and static lengths, and the slot vector a base holds (see x-vector.h, x-eval-slots.h). More...
Functions | |
| x_obj_t * | x_vector_make (x_obj_t *p_base, x_obj_t *p_type, x_obj_flag_t flags, x_int_t length,...) |
| x_obj_t * | x_slots_make (x_obj_t *p_base, x_int_t length) |
Variables | |
| x_satom_t | x_vector_length_objs [X_VECTOR_LENGTH_STATIC_LEN] |
The vector layout's constructor and static lengths, and the slot vector a base holds (see x-vector.h, x-eval-slots.h).
Make a slot vector of length slots, every one empty.
The slot vector is a vector: its first data unit holds its length, and its slots follow. It has no type, and must not be given one: the vector sits in the base's tree, where the collector's mark reaches it, and an object with no type is marked and not descended – its elements are function pointers, not objects. It is allocated with X_OBJ_FLAG_SHARED, so a sweep keeps it for as long as the base lives, and its length is a static atom or a SHARED one for the same reason.
| p_base | Base the vector belongs to (allocation context). |
| length | The number of slots. |
| x_obj_t * x_vector_make | ( | x_obj_t * | p_base, |
| x_obj_t * | p_type, | ||
| x_obj_flag_t | flags, | ||
| x_int_t | length, | ||
| ... | |||
| ) |
Allocate a vector and initialize its elements.
A vector of length elements has its length in its first data unit and its elements after it (see x-vector.h). The length is one of the static length atoms when there is one for it, and an atom of its own otherwise.
| p_base | Base (allocation context). |
| p_type | The type object to assign, or NULL. |
| flags | Initial object flags. |
| length | The number of elements. |
| ... | The elements, length of them, each an x_obj_t *. |
| x_satom_t x_vector_length_objs[X_VECTOR_LENGTH_STATIC_LEN] |
Static atoms holding the lengths 0 to X_VECTOR_LENGTH_STATIC_LEN - 1.