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

Atom type implementation – opaque pointer wrapper. More...

#include "x-type/atom.h"
#include "x-type/int.h"
#include "x-obj.h"
#include "x-eval.h"

Functions

x_obj_tx_make_atom (x_obj_t *p_base, x_obj_flag_t flags, void *p)
 
x_obj_tx_type_atom_struct (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_atom_register (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_atom_make (x_obj_t *p_base, x_obj_t *p_args)
 

Variables

x_satom_t x_type_atom_name = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .s = (x_char_t *)X_TYPE_ATOM_NAME })
 
x_satom_t x_type_atom_make_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_atom_make })
 
x_satom_t x_type_atom_struct_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_atom_struct })
 

Detailed Description

Atom type implementation – opaque pointer wrapper.

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

Function Documentation

◆ x_make_atom()

x_obj_t * x_make_atom ( x_obj_t p_base,
x_obj_flag_t  flags,
void *  p 
)

Allocate a heap atom wrapping an opaque pointer.

Builds a stack-based argument list and delegates to x_type_atom_make.

Parameters
p_basex_obj_t* – Base (execution context)
flagsx_obj_flag_t – Object flags (e.g. X_OBJ_FLAG_NONE)
pvoid* – Raw pointer to wrap
Returns
x_obj_t* – New heap-allocated atom object

◆ x_type_atom_make()

x_obj_t * x_type_atom_make ( x_obj_t p_base,
x_obj_t p_args 
)

Type-system make callback for atom objects.

Extracts the pointer value and optional flags from p_args, then allocates a heap object via x_obj_make.

Parameters
p_basex_obj_t* – Base (execution context)
p_argsx_obj_t* – (atom-value . (flags | nil))
Returns
x_obj_t* – New heap-allocated atom object

◆ x_type_atom_register()

x_obj_t * x_type_atom_register ( x_obj_t p_base,
x_obj_t p_args 
)

Register or retrieve the atom type on the base context.

Calls x_type_struct_get with the atom name and struct builder.

Parameters
p_basex_obj_t* – Base (execution context)
p_argsx_obj_t* – Unused
Returns
x_obj_t* – Registered type object

◆ x_type_atom_struct()

x_obj_t * x_type_atom_struct ( x_obj_t p_base,
x_obj_t p_args 
)

Build the atom type descriptor struct.

Populates name and make callbacks for the atom type.

Parameters
p_basex_obj_t* – Base (execution context)
p_argsx_obj_t* – Unused
Returns
x_obj_t* – Type descriptor pair list

Variable Documentation

◆ x_type_atom_make_prim

◆ x_type_atom_name

◆ x_type_atom_struct_prim