|
x-engine-c v0.2.13
The C engine for x-lang
|
Pair type for the x-lang type system. More...
#include "x-type.h"Go to the source code of this file.
Macros | |
| #define | X_TYPE_PAIR_NAME "PAIR" |
| #define | x_obj_type_ispair(B, X) x_obj_is_type((B), (X), X_TYPE_PAIR_NAME) |
| #define | x_mkpair(B, P1, P2) x_make_pair((B), X_OBJ_FLAG_NONE, (P1), (P2)) |
| #define | x_mkfpair(B, F, P1, P2) x_make_pair((B), (F), (P1), (P2)) |
Functions | |
| x_obj_t * | x_make_pair (x_obj_t *p_base, x_obj_flag_t flags, void *p1, void *p2) |
| x_obj_t * | x_type_pair_register (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_pair_struct (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_pair_make (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_pair_length (x_obj_t *p_base, x_obj_t *p_args) |
Pair type for the x-lang type system.
| #define x_mkfpair | ( | B, | |
| F, | |||
| P1, | |||
| P2 | |||
| ) | x_make_pair((B), (F), (P1), (P2)) |
Make a pair with explicit flags F.
| #define x_mkpair | ( | B, | |
| P1, | |||
| P2 | |||
| ) | x_make_pair((B), X_OBJ_FLAG_NONE, (P1), (P2)) |
Make a pair with default flags.
| #define x_obj_type_ispair | ( | B, | |
| X | |||
| ) | x_obj_is_type((B), (X), X_TYPE_PAIR_NAME) |
Test whether object X is a pair on base B.
| #define X_TYPE_PAIR_NAME "PAIR" |
Type-system name string
| x_obj_t * x_make_pair | ( | x_obj_t * | p_base, |
| x_obj_flag_t | flags, | ||
| void * | p1, | ||
| void * | p2 | ||
| ) |
Allocate a heap pair from first/rest pointers.
Allocate a heap pair from first/rest pointers.
Wraps p1 and p2 in stack-allocated objects, builds a stack arg list, and delegates to x_type_pair_make.
| p_base | x_obj_t* – Base (execution context) |
| flags | x_obj_flag_t – Object flags |
| p1 | void* – First element |
| p2 | void* – Rest element |
Compute the length of a pair list.
Compute the length of a pair list by walking rest pointers.
| p_base | x_obj_t* – Base (execution context) |
| p_args | x_obj_t* – (pair-object . ...) |
Type-system make callback for pair.
Type-system make callback for pair objects.
Extracts first/rest from the pair arg and optional flags, then allocates a heap pair via x_obj_make.
| p_base | x_obj_t* – Base (execution context) |
| p_args | x_obj_t* – (pair-value . (flags | nil)) |
Register (or retrieve) the pair type struct on p_base.
Register or retrieve the pair type on the base context.
| p_base | x_obj_t* – Base (execution context) |
| p_args | x_obj_t* – Unused |
Build the pair type descriptor struct.
Build the pair type descriptor struct.
Populates name, units, make, length, and write callbacks.
| p_base | x_obj_t* – Base (execution context) |
| p_args | x_obj_t* – Unused |