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

Integer type implementation. More...

#include <ctype.h>
#include "x-type/int.h"
#include "x-token/sexp/int.h"

Functions

x_obj_tx_make_int (x_obj_t *p_base, x_obj_flag_t flags, x_int_t i)
 
x_obj_tx_type_int_save (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_int_struct (x_obj_t *p_base, x_obj_t *p_obj)
 
x_obj_tx_type_int_register (x_obj_t *p_base, x_obj_t *p_args)
 
x_obj_tx_type_int_make (x_obj_t *p_base, x_obj_t *p_args)
 

Variables

x_satom_t x_type_int_name = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { .s = (x_char_t *)X_TYPE_INT_NAME })
 
x_satom_t x_type_int_make_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_int_make })
 
x_satom_t x_type_int_struct_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_int_struct })
 
x_satom_t x_type_int_save_prim = x_obj_set(x_type_atom_obj, X_OBJ_FLAG_NONE, { (x_obj_t *)&x_type_int_save })
 

Detailed Description

Integer type implementation.

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

Function Documentation

◆ x_make_int()

x_obj_t * x_make_int ( x_obj_t p_base,
x_obj_flag_t  flags,
x_int_t  i 
)

Allocate a heap integer object with a given value.

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

Parameters
p_basex_obj_t* – Base (execution context)
flagsx_obj_flag_t – Object flags
ix_int_t – Integer value
Returns
x_obj_t* – New heap-allocated integer object

◆ x_type_int_make()

x_obj_t * x_type_int_make ( x_obj_t p_base,
x_obj_t p_args 
)

Type-system make callback for integer objects.

Extracts the integer 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* – (int-value . (flags | nil))
Returns
x_obj_t* – New heap-allocated integer object

◆ x_type_int_register()

x_obj_t * x_type_int_register ( x_obj_t p_base,
x_obj_t p_args 
)

Register or retrieve the integer type on the base context.

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

◆ x_type_int_save()

x_obj_t * x_type_int_save ( x_obj_t p_base,
x_obj_t p_args 
)

Build the integer type descriptor struct.

Populates name, make, analyse, read, and write callbacks.

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

◆ x_type_int_struct()

x_obj_t * x_type_int_struct ( x_obj_t p_base,
x_obj_t p_args 
)

Build the integer type descriptor struct.

Variable Documentation

◆ x_type_int_make_prim

◆ x_type_int_name

◆ x_type_int_save_prim

◆ x_type_int_struct_prim