Vector type – construction and registration.
More...
#include <stdarg.h>
#include "x-type/vector.h"
#include "x-type/int.h"
#include "x-eval.h"
#include "x-eval-slots.h"
#include "x-obj/prim.h"
Vector type – construction and registration.
- Author
- Jon Ruttan (jonru.nosp@m.ttan.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
- Copyright
- 2026 Jon Ruttan @license MIT No Attribution (MIT-0)
◆ x_make_vector()
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.
- Parameters
-
| p_base | Base (execution context). |
| flags | Object flags. |
| length | The number of elements. |
| ... | The elements, length of them, each an x_obj_t *. |
- Returns
- Newly allocated VECTOR object.
◆ x_type_vector_length()
Type-system length handler for VECTOR objects.
- Parameters
-
| p_base | Base (execution context). |
| p_args | Argument list: (vector . ...). |
- Returns
- The vector's length object.
◆ x_type_vector_register()
Register (or retrieve) the VECTOR type in the type alist.
Calls x_type_struct_get() with the VECTOR name and struct constructor,
- Parameters
-
| p_base | Base (execution context). |
| p_args | Unused. |
- Returns
- The registered VECTOR type object.
◆ x_type_vector_struct()
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.
- Parameters
-
| p_base | Base (execution context). |
| p_args | Unused. |
- Returns
- Type struct pair-tree for VECTOR.
◆ x_type_vector_length_prim
◆ x_type_vector_name
◆ x_type_vector_struct_prim
◆ x_type_vector_units_obj
Initial value:=
#define X_TYPE_VECTOR_UNITS
Definition vector.h:40
@ X_OBJ_FLAG_NONE
Definition x-obj.h:131
#define x_obj_set(T, F,...)
Definition x-obj.h:344
The type's unit count: a bare count, so every unit is a reference.