|
x-engine-c v0.2.31
The C engine for x-lang
|
The type-keyed primitive registry stored in the base's prims slot. More...
Data Structures | |
| struct | x_prim_entry_t |
Functions | |
| x_obj_t * | x_prims (x_obj_t *p_base) |
| void | x_prims_bind_table (x_obj_t *p_base, const x_prim_entry_t *table, int count) |
The type-keyed primitive registry stored in the base's prims slot.
The catalogue 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.
The primitives catalogue (the prims-slot value); nil before registration. Catalogue 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 catalogue value (car of the prims cell); nil before any registration.
| 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 catalogued entries (those with ns). The env binding is transitional – de-registration drops it, leaving the catalogue as the single source.
Bind a table into the env and file its catalogued 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 catalogue under (ns . ((method . prim) ...)). De-registration removes the env binding here, leaving the catalogue as the single source.
| p_base | x_obj_t* – Base (execution context) |
| table | const x_prim_entry_t* – Array of entries |
| count | int – Number of entries |