x-engine-c v0.2.13
The C engine for x-lang
Loading...
Searching...
No Matches
prim.c File Reference

Object-level primitive operations (make, call dispatch). More...

#include "x-obj.h"
#include "x-type.h"
#include "x-type/procedure.h"

Functions

x_obj_tx_obj_prim_make (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_obj_prim_call (x_obj_t *p_base, x_obj_t *p_args)
 

Detailed Description

Object-level primitive operations (make, call dispatch).

Author
Jon Ruttan (jonru.nosp@m.ttan.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)

Function Documentation

◆ x_obj_prim_call()

x_obj_t * x_obj_prim_call ( x_obj_t p_base,
x_obj_t p_args 
)

Invoke an object's type-dispatch call handler.

Looks up the call field on the object's type struct and dispatches. For procedure-typed call handlers, invokes via x_type_procedure_call to support closures as type callbacks.

Parameters
p_basex_obj_t* – Base (execution context)
p_argsx_obj_t* – (callable . args)
Returns
Result of the call, or NULL if no call handler

◆ x_obj_prim_make()

x_obj_t * x_obj_prim_make ( x_obj_t p_base,
x_obj_t p_args 
)

Construct a new object via its type's make callback.

Dispatches to the appropriate constructor based on the object's type (static atom, static pair, or registered type with make handler).

Parameters
p_basex_obj_t* – Base (execution context)
p_argsx_obj_t* – (prototype-obj flags data...)
Returns
Newly allocated object, or NULL on failure