Variadic helpers for extracting arguments from x-lang arg lists.
More...
Variadic helpers for extracting arguments from x-lang arg lists.
◆ __attribute__()
| static x_obj_t __attribute__ |
( |
(unused) |
| ) |
|
|
static |
Unpack count elements from an args list into output pointers.
NULL pointers skip that position (like _ in pattern matching).
x_args(p_base,
p_args, 3, NULL, &a, &b);
static void x_obj_t * p_args
Definition x-prim.h:56
- Parameters
-
| p_base | Base/execution context (for the improper-spine raise). |
| p_args | Argument list (pair chain). |
| count | Number of positions to unpack. |
| ... | Pointers to x_obj_t* slots (or NULL to skip). |
- Note
- Walking off the proper prefix of an IMPROPER list used to read the tail atom's value word as a pair pointer (#487). The nil test below ends a proper list; x_eval_spine_guard raises on the atom a dotted tail ends with, which is the same catchable error an applicative already gave for a call with a dotted tail.
Unpack and evaluate count elements from an args list.
NULL pointers skip that position without evaluating.
x_eargs(p_base,
p_args, 3, NULL, &a, &b);
- Parameters
-
| p_base | Base/execution context. |
| p_args | Argument list (pair chain). |
| count | Number of positions to unpack. |
| ... | Pointers to x_obj_t* slots (or NULL to skip). |
The args list past its first count positions, or nil if it is shorter.
For a prim that unpacks a fixed prefix with x_args/x_eargs and then takes the tail as a body or a variadic rest. Walking there with x_11/x_111 reads rest of nil when the call is short – (fn), (eval) – which is a SIGSEGV where x_args had already stopped at the end.
- Parameters
-
| p_base | Base/execution context (for the improper-spine raise). |
| p_args | Argument list (pair chain). |
| count | Number of positions to skip. |
- Returns
- The remaining list, or nil.
◆ for()
◆ va_end()
◆ va_start()
◆ x_heap_root_pop()
◆ x_heap_root_push() [1/2]
◆ x_heap_root_push() [2/2]
◆ count
Initial value:{
}
static void x_obj_t int count
Definition x-prim.h:57
void x_eval_spine_guard(x_obj_t *p_base, x_obj_t *p_obj)
Definition x-eval.c:375
#define x_restobj(X)
Definition x-obj.h:439
◆ held
◆ p_args
◆ p_cell
| x_obj_t** p_cell = x_heap_root_slot(p_base) |
◆ roots
Initial value:= {
{ NULL }, { NULL }),
{ NULL }, { NULL })
}
@ X_OBJ_FLAG_NONE
Definition x-obj.h:131
#define x_obj_set(T, F,...)
Definition x-obj.h:344
x_satom_t x_type_pair_obj
Definition x-obj.c:32