x-engine-c v0.2.13
The C engine for x-lang
Loading...
Searching...
No Matches
Primitives Catalog

The type-keyed primitive registry stored in the base's prims slot. More...

Data Structures

struct  x_prim_entry_t
 

Functions

x_obj_tx_prims (x_obj_t *p_base)
 
void x_prims_bind_table (x_obj_t *p_base, const x_prim_entry_t *table, int count)
 

Detailed Description

The type-keyed primitive registry stored in the base's prims slot.

The catalog is an alist-of-alists ((type . ((method . prim) ...)) ...) keyed by type/section namespace, with bare method names. It is the transitional home for primitives ahead of mapping them onto the type objects as static methods. Namespace and method names are interned, so the find accessors compare by pointer identity.

Function Documentation

◆ x_prims()

x_obj_t * x_prims ( x_obj_t p_base)

The primitives catalog (the prims-slot value); nil before registration. Catalog LOOKUP is pure x-lang (boot/registry.x over tools/contract/base-paths.x); C only files entries, via x_prims_bind_table below.

The catalog value (car of the prims cell); nil before any registration.

◆ x_prims_bind_table()

void x_prims_bind_table ( x_obj_t p_base,
const x_prim_entry_t table,
int  count 
)

Bind a table into the env AND file its cataloged entries (those with ns). The env binding is transitional – de-registration drops it, leaving the catalog as the single source.

Bind a table into the env and file its cataloged entries.

Each entry is bound into the env by name (transitional, so existing code keeps working) and, when it carries a namespace, filed into the catalog under (ns . ((method . prim) ...)). De-registration removes the env binding here, leaving the catalog as the single source.

Parameters
p_basex_obj_t* – Base (execution context)
tableconst x_prim_entry_t* – Array of entries
countint – Number of entries