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

Opaque pointer type – construction and registration. More...

#include "x-type/ptr.h"
#include "x-eval.h"

Functions

x_obj_tx_make_ptr (x_obj_t *p_base, x_obj_flag_t flags, void *p)
 
x_obj_tx_type_ptr_save (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_ptr_struct (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_ptr_register (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_ptr_make (x_obj_t *p_base, x_obj_t *p_args)
 

Variables

x_satom_t x_type_ptr_name = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .s = (x_char_t *)X_TYPE_PTR_NAME })
 
x_satom_t x_type_ptr_make_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_ptr_make })
 
x_satom_t x_type_ptr_struct_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_ptr_struct })
 
x_satom_t x_type_ptr_save_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_ptr_save })
 

Detailed Description

Opaque pointer type – construction and registration.

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

Function Documentation

◆ x_make_ptr()

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

Allocate a POINTER object wrapping a raw void pointer.

Packs p and flags into stack-allocated args and delegates to x_type_ptr_make() for type-system allocation.

Parameters
p_baseBase (execution context).
flagsObject flags (e.g. X_OBJ_FLAG_OWN).
pRaw pointer to wrap.
Returns
Newly allocated POINTER object.

◆ x_type_ptr_make()

x_obj_t * x_type_ptr_make ( x_obj_t p_base,
x_obj_t p_args 
)

Type-system make handler for POINTER objects.

Extracts the raw pointer from p_args[0] and optional flags from p_args[1], then allocates via x_obj_make().

Parameters
p_baseBase (execution context).
p_argsArgument list: (pointer-atom [flags-atom]).
Returns
Newly allocated POINTER object.

◆ x_type_ptr_register()

x_obj_t * x_type_ptr_register ( x_obj_t p_base,
x_obj_t p_args 
)

Register (or retrieve) the POINTER type in the type alist.

Calls x_type_struct_get() with the POINTER name and struct constructor.

Parameters
p_baseBase (execution context).
p_argsUnused.
Returns
The registered POINTER type object.

◆ x_type_ptr_save()

x_obj_t * x_type_ptr_save ( x_obj_t p_base,
x_obj_t p_args 
)

Build the POINTER type struct descriptor.

Populates name and make hooks for the type system.

Parameters
p_baseBase (execution context).
p_argsUnused.
Returns
Type struct pair-tree for POINTER.

◆ x_type_ptr_struct()

x_obj_t * x_type_ptr_struct ( x_obj_t p_base,
x_obj_t p_args 
)

Build the POINTER type struct descriptor.

Variable Documentation

◆ x_type_ptr_make_prim

◆ x_type_ptr_name

◆ x_type_ptr_save_prim

◆ x_type_ptr_struct_prim