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

Atom type – opaque pointer wrapper for the x-lang type system. More...

#include "x-type.h"

Go to the source code of this file.

Macros

#define X_TYPE_ATOM_NAME   "ATOM"
 
#define x_obj_type_isatom(B, X)   x_obj_is_type((B), (X), X_TYPE_ATOM_NAME)
 
#define x_atomval(X)   x_atomptr(X)
 
#define x_mkatom(B, P)   x_make_atom((B), X_OBJ_FLAG_NONE, (P))
 
#define x_mkfatom(B, F, P)   x_make_atom((B), (F), (P))
 

Functions

x_obj_tx_make_atom (x_obj_t *p_base, x_obj_flag_t flags, void *p)
 
x_obj_tx_type_atom_register (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_atom_struct (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)
 
x_obj_tx_type_atom_call (x_obj_t *p_base, x_obj_t *p_args)
 

Variables

x_satom_t x_type_atom_name
 
x_satom_t x_type_atom_make_prim
 
x_satom_t x_type_atom_call_prim
 
x_satom_t x_type_atom_struct_prim
 

Detailed Description

Atom type – opaque pointer wrapper for the x-lang type system.

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

Macro Definition Documentation

◆ x_atomval

#define x_atomval (   X)    x_atomptr(X)

Extract the raw pointer from an atom object.

◆ x_mkatom

#define x_mkatom (   B,
 
)    x_make_atom((B), X_OBJ_FLAG_NONE, (P))

Make an atom with default flags.

◆ x_mkfatom

#define x_mkfatom (   B,
  F,
 
)    x_make_atom((B), (F), (P))

Make an atom with explicit flags F.

◆ x_obj_type_isatom

#define x_obj_type_isatom (   B,
 
)    x_obj_is_type((B), (X), X_TYPE_ATOM_NAME)

Test whether object X is an atom on base B.

◆ X_TYPE_ATOM_NAME

#define X_TYPE_ATOM_NAME   "ATOM"

Type-system name string

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 pointer 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_call()

x_obj_t * x_type_atom_call ( x_obj_t p_base,
x_obj_t p_args 
)

Type-system call callback for atom.

◆ 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.

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 struct on p_base.

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.

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_call_prim

x_satom_t x_type_atom_call_prim

◆ x_type_atom_make_prim

x_satom_t x_type_atom_make_prim

◆ x_type_atom_name

x_satom_t x_type_atom_name
extern

◆ x_type_atom_struct_prim

x_satom_t x_type_atom_struct_prim