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

Integer type for the x-lang type system. More...

#include "x-type.h"

Go to the source code of this file.

Macros

#define X_TYPE_INT_NAME   "INTEGER"
 
#define x_obj_type_isint(B, X)   x_obj_is_type((B), (X), X_TYPE_INT_NAME)
 
#define x_intval(X)   x_firstint((X))
 
#define x_mkint(B, I)   x_make_int((B), X_OBJ_FLAG_NONE, (I))
 
#define x_mkfint(B, F, I)   x_make_int((B), (F), (I))
 

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_register (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_args)
 
x_obj_tx_type_int_make (x_obj_t *p_base, x_obj_t *p_args)
 

Detailed Description

Integer type 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_intval

#define x_intval (   X)    x_firstint((X))

Extract the integer value from an integer object.

◆ x_mkfint

#define x_mkfint (   B,
  F,
 
)    x_make_int((B), (F), (I))

Make an integer with explicit flags F.

◆ x_mkint

#define x_mkint (   B,
 
)    x_make_int((B), X_OBJ_FLAG_NONE, (I))

Make an integer with default flags.

◆ x_obj_type_isint

#define x_obj_type_isint (   B,
 
)    x_obj_is_type((B), (X), X_TYPE_INT_NAME)

Test whether object X is an integer on base B.

◆ X_TYPE_INT_NAME

#define X_TYPE_INT_NAME   "INTEGER"

Type-system symbol name

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

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

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_struct()

x_obj_t * x_type_int_struct ( x_obj_t p_base,
x_obj_t p_args 
)

Build the integer type descriptor struct.