x-engine-c v0.2.13
The C engine for x-lang
Loading...
Searching...
No Matches
Argument Unpacking Helpers

Variadic helpers for extracting arguments from x-lang arg lists. More...

Functions

static void __attribute__ ((unused)) x_args(x_obj_t *p_base
 
 va_start (ap, count)
 
 for (i=0;i< count;i++)
 
 va_end (ap)
 
 x_heap_root_push (p_cell, roots[0])
 
 x_heap_root_push (p_cell, roots[1])
 
 x_heap_root_pop (p_cell)
 

Variables

static void x_obj_tp_args
 
static void x_obj_t int count
 
static void x_obj_t int int i
 
int held = 0
 
x_obj_t ** p_cell = x_heap_root_slot(p_base)
 
x_spair_t roots [2]
 

Detailed Description

Variadic helpers for extracting arguments from x-lang arg lists.

Function Documentation

◆ __attribute__()

static void __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); // skip self, extract 2
static void x_obj_t * p_args
Definition x-prim.h:56
Parameters
p_baseBase/execution context (for the improper-spine raise).
p_argsArgument list (pair chain).
countNumber 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 the same call shape.

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); // skip self, eval+extract 2
Parameters
p_baseBase/execution context.
p_argsArgument list (pair chain).
countNumber of positions to unpack.
...Pointers to x_obj_t* slots (or NULL to skip).

◆ for()

for ( )

◆ va_end()

va_end ( ap  )

◆ va_start()

va_start ( ap  ,
count   
)

◆ x_heap_root_pop()

x_heap_root_pop ( p_cell  )

◆ x_heap_root_push() [1/2]

x_heap_root_push ( p_cell  ,
roots  [0] 
)

◆ x_heap_root_push() [2/2]

x_heap_root_push ( p_cell  ,
roots  [1] 
)

Variable Documentation

◆ count

static void x_obj_t int count

◆ held

int held = 0

◆ i

static void x_obj_t int int i
Initial value:
{
va_list ap

◆ p_args

static void x_obj_t * p_args

◆ p_cell

x_obj_t** p_cell = x_heap_root_slot(p_base)

◆ roots

x_spair_t roots[2]
Initial value:
= {
{ NULL }, { NULL }),
{ NULL }, { NULL })
}
Definition x-obj.h:212
@ X_OBJ_FLAG_NONE
Definition x-obj.h:129
#define x_obj_set(T, F,...)
Definition x-obj.h:342
x_satom_t x_type_pair_obj
Definition x-obj.c:32