26#define REDUCT_ITEM_TYPE_NONE 0
27#define REDUCT_ITEM_TYPE_ATOM 1
28#define REDUCT_ITEM_TYPE_LIST 2
29#define REDUCT_ITEM_TYPE_FUNCTION 3
30#define REDUCT_ITEM_TYPE_CLOSURE 4
31#define REDUCT_ITEM_TYPE_LIST_NODE 5
37#define REDUCT_ITEM_FLAG_NONE 0
38#define REDUCT_ITEM_FLAG_FALSY (1 << 0)
39#define REDUCT_ITEM_FLAG_INT_SHAPED (1 << 1)
40#define REDUCT_ITEM_FLAG_FLOAT_SHAPED (1 << 2)
41#define REDUCT_ITEM_FLAG_INTRINSIC (1 << 3)
42#define REDUCT_ITEM_FLAG_NATIVE (1 << 4)
43#define REDUCT_ITEM_FLAG_QUOTED (1 << 5)
44#define REDUCT_ITEM_FLAG_GC_MARK (1 << 6)
46#define REDUCT_ITEM_PAYLOAD_MAX 48
56typedef struct reduct_item
77_Static_assert(
sizeof(
reduct_item_t) == 64,
"reduct_item_t must be 64 bytes");
80#define REDUCT_ITEM_BLOCK_MAX 255
88typedef struct reduct_item_block
90 struct reduct_item_block*
next;
97 "reduct_item_block_t must be a power of two");
Atom representation and operations.
REDUCT_API const char * reduct_item_type_str(reduct_item_type_t type)
Get the string representation of an Reduct item type.
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.
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.
reduct_uint8_t reduct_item_flags_t
Item flags enumeration.
reduct_uint8_t reduct_item_type_t
Item type enumeration.
REDUCT_API void reduct_item_free(struct reduct *reduct, reduct_item_t *item)
Free an Reduct item.
REDUCT_API reduct_item_t * reduct_item_new(struct reduct *reduct)
Allocate a new Reduct item.
#define REDUCT_ITEM_PAYLOAD_MAX
The maximum size of the item payload.
#define REDUCT_ITEM_BLOCK_MAX
The maximum number of items in a block.
Compiled function structure.
struct reduct_item_block * next
reduct_uint32_t position
The position in the input buffer where the item was parsed.
reduct_list_t list
A list.
reduct_closure_t closure
A closure.
reduct_uint32_t length
Common length for the item. (Stored in the union to save space due to padding rules....
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_list_node_t node
A list node.
reduct_uint16_t retainCount
The reference count for GC retention.
reduct_item_type_t type
The type of the item.