1#ifndef REDUCT_ITEM_IMPL_H
2#define REDUCT_ITEM_IMPL_H 1
71 reduct->
block = block;
73 item = &block->
items[0];
Core definitions and structures.
#define REDUCT_MALLOC(_size)
#define REDUCT_UNLIKELY(_x)
#define REDUCT_ASSERT(_cond)
#define REDUCT_MEMSET(_ptr, _val, _size)
REDUCT_API void reduct_atom_deinit(struct reduct *reduct, reduct_atom_t *atom)
Deinitialize an atom.
REDUCT_API void reduct_closure_deinit(reduct_closure_t *closure)
Deinitialize a closure structure.
#define REDUCT_ERROR_INTERNAL(_reduct,...)
Throw an internal error using the jump buffer in the error structure.
REDUCT_API void reduct_function_deinit(reduct_function_t *func)
Deinitialize a function structure.
REDUCT_API void reduct_gc_if_needed(reduct_t *reduct)
Optionally run the garbage collector if the number of allocated blocks exceeds the threshold.
#define REDUCT_ITEM_TYPE_LIST
A list.
REDUCT_API const char * reduct_item_type_str(reduct_item_type_t type)
Get the string representation of an Reduct item type.
#define REDUCT_ITEM_TYPE_ATOM
An atom.
REDUCT_API reduct_float_t reduct_item_get_float(reduct_item_t *item)
Get the float value of an item if it is number shaped.
#define REDUCT_ITEM_TYPE_FUNCTION
A function.
REDUCT_API reduct_int64_t reduct_item_get_int(reduct_item_t *item)
Get the integer value of an item if it is number shaped.
#define REDUCT_ITEM_FLAG_INT_SHAPED
Item is an integer shaped atom.
reduct_uint8_t reduct_item_type_t
Item type enumeration.
#define REDUCT_ITEM_FLAG_FLOAT_SHAPED
Item is a float shaped atom.
#define REDUCT_ITEM_TYPE_NONE
No type.
#define REDUCT_ITEM_TYPE_CLOSURE
A closure.
#define REDUCT_ITEM_BLOCK_MAX
The maximum number of items in a block.
#define REDUCT_ITEM_TYPE_LIST_NODE
A list node.
static void reduct_item_init(reduct_item_t *item)
REDUCT_API void reduct_item_free(reduct_t *reduct, reduct_item_t *item)
REDUCT_API reduct_item_t * reduct_item_new(reduct_t *reduct)
static reduct_item_t * reduct_item_pop_free_list(reduct_t *reduct)
reduct_int64_t integerValue
Pre-computed integer value, item must have REDUCT_ITEM_FLAG_INT_SHAPED.
reduct_float_t floatValue
Pre-computed float value, item must have REDUCT_ITEM_FLAG_FLOAT_SHAPED.
struct reduct_item_block * next
reduct_item_t items[REDUCT_ITEM_BLOCK_MAX]
reduct_uint32_t position
The position in the input buffer where the item was parsed.
reduct_closure_t closure
A closure.
struct reduct_input * input
The parsed input that created this item.
reduct_function_t function
A function.
reduct_item_flags_t flags
Flags for the item.
struct reduct_item * free
The next free item in the free list.
reduct_atom_t atom
An atom.
reduct_uint16_t retainCount
The reference count for GC retention.
reduct_item_type_t type
The type of the item.
reduct_item_block_t * block
reduct_item_block_t firstBlock
struct reduct_item * freeList
reduct_size_t blocksAllocated