|
x-engine-c v0.2.13
The C engine for x-lang
|
Primitive type – construction, registration, and unified callable dispatch. More...
#include "x-type/prim.h"#include "x-type/procedure.h"#include "x-type/operative.h"#include "x-eval.h"Functions | |
| x_obj_t * | x_make_prim (x_obj_t *p_base, x_obj_flag_t flags, x_fn_t fn) |
| x_obj_t * | x_type_prim_save (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_prim_struct (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_prim_register (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_type_prim_make (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_callable_call (x_obj_t *p_base, x_obj_t *p_args) |
| x_obj_t * | x_callable_apply (x_obj_t *p_base, x_obj_t *p_args) |
Primitive type – construction, registration, and unified callable dispatch.
Unified apply dispatch with TCO trampoline support.
Like x_callable_call() but uses the non-TCO apply path for procedures (args already evaluated) and a trampoline for operatives.
| p_base | Base (execution context). |
| p_args | Argument list: (callable . args). |
Unified call dispatch for all callable types.
All callables store a function pointer in slot 0:
| p_base | Base (execution context). |
| p_args | Argument list: (callable . args). |
| x_obj_t * x_make_prim | ( | x_obj_t * | p_base, |
| x_obj_flag_t | flags, | ||
| x_fn_t | fn | ||
| ) |
Allocate a PRIMITIVE object wrapping a C function pointer.
| p_base | Base (execution context). |
| flags | Object flags. |
| fn | C function pointer to wrap. |
Type-system make handler for PRIMITIVE objects.
Extracts the function pointer from p_args[0] and optional flags from p_args[1], then allocates a pair-length object via x_obj_make().
| p_base | Base (execution context). |
| p_args | Argument list: (fn-atom [flags-atom]). |
Register (or retrieve) the PRIMITIVE type in the type alist.
| p_base | Base (execution context). |
| p_args | Unused. |
Build the PRIMITIVE type struct descriptor.
Populates name, make, and call hooks.
| p_base | Base (execution context). |
| p_args | Unused. |
Build the PRIMITIVE type struct descriptor.
| x_satom_t x_callable_call_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_callable_call }) |
| x_satom_t x_type_prim_make_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_prim_make }) |
| x_satom_t x_type_prim_name = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .s = (x_char_t *)X_TYPE_PRIM_NAME }) |
Static atom: type name.
| x_satom_t x_type_prim_save_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_prim_save }) |
| x_satom_t x_type_prim_struct_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_prim_struct }) |