|
x-engine-c v0.2.31
The C engine for x-lang
|
Vector type – an object whose first data unit holds its length and whose other data units are its elements. More...
Go to the source code of this file.
Macros | |
| #define | X_TYPE_VECTOR_NAME "VECTOR" |
| #define | X_TYPE_VECTOR_UNITS (-X_VECTOR_UNITS_LENGTH) |
Predicates | |
| #define | x_obj_type_isvector(B, X) x_obj_is_type((B), (X), X_TYPE_VECTOR_NAME) |
Constructors | |
| #define | x_mkvector(B, N, ...) x_make_vector((B), X_OBJ_FLAG_NONE, (N), __VA_ARGS__) |
Functions | |
| x_obj_t * | x_make_vector (x_obj_t *p_base, x_obj_flag_t flags, x_int_t length,...) |
| x_obj_t * | x_type_vector_struct (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_vector_register (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_vector_length (x_obj_t *p_base, x_obj_t *p_args) |
Vector type – an object whose first data unit holds its length and whose other data units are its elements.
The layout is x-expr's (x-vector.h); the type is this file's. A vector's elements are objects, and the collector follows them: the type declares its units as one leading unit, the length, and a payload counted by it, every unit a reference.
A base's slot vector has this layout and no type. Its elements are function pointers, which the collector must not follow: the vector sits in the base's tree, where the mark reaches it, and an object with no type is marked and not descended.
| #define x_mkvector | ( | B, | |
| N, | |||
| ... | |||
| ) | x_make_vector((B), X_OBJ_FLAG_NONE, (N), __VA_ARGS__) |
Create a vector of the N objects that follow, with default flags.
| #define x_obj_type_isvector | ( | B, | |
| X | |||
| ) | x_obj_is_type((B), (X), X_TYPE_VECTOR_NAME) |
Test whether X is a VECTOR object.
| #define X_TYPE_VECTOR_NAME "VECTOR" |
Canonical type name.
| #define X_TYPE_VECTOR_UNITS (-X_VECTOR_UNITS_LENGTH) |
The type's declared unit count: one leading unit, and a payload whose count that unit holds (see x_type_units_count()).
| x_obj_t * x_make_vector | ( | x_obj_t * | p_base, |
| x_obj_flag_t | flags, | ||
| x_int_t | length, | ||
| ... | |||
| ) |
Allocate a VECTOR object holding the length objects that follow.
Allocate a VECTOR object holding the objects that follow.
The length is an INTEGER object of its own, as the length of a vector x-lang makes is, so the two are read the same way.
| p_base | Base (execution context). |
| flags | Object flags. |
| length | The number of elements. |
| ... | The elements, length of them, each an x_obj_t *. |
Type-system length handler for VECTOR objects.
Type-system length handler for VECTOR objects.
| p_base | Base (execution context). |
| p_args | Argument list: (vector . ...). |
Register (or retrieve) the VECTOR type in the type alist.
Register (or retrieve) the VECTOR type in the type alist.
Calls x_type_struct_get() with the VECTOR name and struct constructor,
| p_base | Base (execution context). |
| p_args | Unused. |
Build the VECTOR type struct descriptor.
Build the VECTOR type struct descriptor.
Populates the name, the unit count and the length handler for the type system. With no save handler of its own the type takes the default, which writes the units the count declares: the length, then the elements, each a reference.
| p_base | Base (execution context). |
| p_args | Unused. |