x-engine-c v0.2.13
The C engine for x-lang
Loading...
Searching...
No Matches
Base Meta Field Accessors

Navigate the metadata section (profile + hooks) of the base tree. More...

Macros

#define x_base_field_meta_group(X)   x_restobj(x_restobj(x_base(X)))
 
#define x_base_field_profile(X)   x_firstobj(x_firstobj(x_base_field_meta_group(X)))
 
#define x_base_field_profile_allocs(X)   x_firstobj(x_base_field_profile(X))
 
#define x_base_field_hooks(X)   x_restobj(x_firstobj(x_base_field_meta_group(X)))
 
#define x_base_field_hook_type_name(X)   x_firstobj(x_base_field_hooks(X))
 
#define x_base_field_hook_units(X)   x_firstobj(x_restobj(x_base_field_hooks(X)))
 
#define x_base_field_hook_length(X)   x_firstobj(x_restobj(x_restobj(x_base_field_hooks(X))))
 
#define x_base_field_hook_error(X)   x_firstobj(x_restobj(x_restobj(x_restobj(x_base_field_hooks(X)))))
 

Detailed Description

Navigate the metadata section (profile + hooks) of the base tree.

Macro Definition Documentation

◆ x_base_field_hook_error

#define x_base_field_hook_error (   X)    x_firstobj(x_restobj(x_restobj(x_restobj(x_base_field_hooks(X)))))

Get the error hook field. Value: atom with void pointer to function.

Note
Unlike the other hooks, the error hook does NOT follow the x_fn_t signature. Its actual signature is: void (*)(x_obj_t *p_base, x_char_t *message, x_obj_t *p_obj). It is dispatched via a cast from x_firstptr(), not x_atomfn().

◆ x_base_field_hook_length

#define x_base_field_hook_length (   X)    x_firstobj(x_restobj(x_restobj(x_base_field_hooks(X))))

Get the length hook field. Value: atom with x_fn_t function pointer. Same calling convention as type_name. Must return an integer atom with the logical length, or NULL.

◆ x_base_field_hook_type_name

#define x_base_field_hook_type_name (   X)    x_firstobj(x_base_field_hooks(X))

Get the type_name hook field. Value: atom with x_fn_t function pointer. Signature: x_obj_t *(*)(x_obj_t *p_base, x_obj_t *p_args) – p_args is a pair list whose first element is the object to name. Must return a type name atom (string data), or NULL.

◆ x_base_field_hook_units

#define x_base_field_hook_units (   X)    x_firstobj(x_restobj(x_base_field_hooks(X)))

Get the units hook field. Value: atom with x_fn_t function pointer. Same calling convention as type_name. Must return an integer atom with the number of data units, or NULL.

◆ x_base_field_hooks

#define x_base_field_hooks (   X)    x_restobj(x_firstobj(x_base_field_meta_group(X)))

Get the hooks list (type-name, units, length, error).

Hooks are only dispatched for objects whose type pointer is NOT one of the built-in static types (x_type_atom_obj, x_type_pair_obj). Dispatch priority: check static type (pointer identity, O(1)), then call the hook if set, then fall back to NULL.

◆ x_base_field_meta_group

#define x_base_field_meta_group (   X)    x_restobj(x_restobj(x_base(X)))

Get the meta group list (profile+hooks, heap, alloc; the tail past alloc is the embedding layer's extension point).

◆ x_base_field_profile

#define x_base_field_profile (   X)    x_firstobj(x_firstobj(x_base_field_meta_group(X)))

Get the profile pair (counters).

◆ x_base_field_profile_allocs

#define x_base_field_profile_allocs (   X)    x_firstobj(x_base_field_profile(X))

Get the allocation counter field. Value: integer atom, incremented by x_obj_alloc().