An item is a generic container for all data types and heap alloacted structures within Reduct.
To optimize memory cacheing and reduce fragmentation, all items are 64 bytes and aligned to cache lines.
◆ REDUCT_ITEM_TYPE_NONE
| #define REDUCT_ITEM_TYPE_NONE 0 |
No type.
Definition at line 26 of file item.h.
◆ REDUCT_ITEM_TYPE_ATOM
| #define REDUCT_ITEM_TYPE_ATOM 1 |
An atom.
Definition at line 27 of file item.h.
◆ REDUCT_ITEM_TYPE_LIST
| #define REDUCT_ITEM_TYPE_LIST 2 |
A list.
Definition at line 28 of file item.h.
◆ REDUCT_ITEM_TYPE_FUNCTION
| #define REDUCT_ITEM_TYPE_FUNCTION 3 |
A function.
Definition at line 29 of file item.h.
◆ REDUCT_ITEM_TYPE_CLOSURE
| #define REDUCT_ITEM_TYPE_CLOSURE 4 |
A closure.
Definition at line 30 of file item.h.
◆ REDUCT_ITEM_TYPE_LIST_NODE
| #define REDUCT_ITEM_TYPE_LIST_NODE 5 |
A list node.
Definition at line 31 of file item.h.
◆ REDUCT_ITEM_FLAG_NONE
| #define REDUCT_ITEM_FLAG_NONE 0 |
No flags.
Definition at line 37 of file item.h.
◆ REDUCT_ITEM_FLAG_FALSY
| #define REDUCT_ITEM_FLAG_FALSY (1 << 0) |
Item is falsy.
Definition at line 38 of file item.h.
◆ REDUCT_ITEM_FLAG_INT_SHAPED
| #define REDUCT_ITEM_FLAG_INT_SHAPED (1 << 1) |
Item is an integer shaped atom.
Definition at line 39 of file item.h.
◆ REDUCT_ITEM_FLAG_FLOAT_SHAPED
| #define REDUCT_ITEM_FLAG_FLOAT_SHAPED (1 << 2) |
Item is a float shaped atom.
Definition at line 40 of file item.h.
◆ REDUCT_ITEM_FLAG_INTRINSIC
| #define REDUCT_ITEM_FLAG_INTRINSIC (1 << 3) |
Item is an atom and a intrinsic.
Definition at line 41 of file item.h.
◆ REDUCT_ITEM_FLAG_NATIVE
| #define REDUCT_ITEM_FLAG_NATIVE (1 << 4) |
Item is an atom and a native function.
Definition at line 42 of file item.h.
◆ REDUCT_ITEM_FLAG_QUOTED
| #define REDUCT_ITEM_FLAG_QUOTED (1 << 5) |
Item is a quoted atom.
Definition at line 43 of file item.h.
◆ REDUCT_ITEM_FLAG_GC_MARK
| #define REDUCT_ITEM_FLAG_GC_MARK (1 << 6) |
Item is marked by GC.
Definition at line 44 of file item.h.
◆ REDUCT_ITEM_PAYLOAD_MAX
| #define REDUCT_ITEM_PAYLOAD_MAX 48 |
The maximum size of the item payload.
Definition at line 46 of file item.h.
◆ REDUCT_ITEM_BLOCK_MAX
| #define REDUCT_ITEM_BLOCK_MAX 255 |
The maximum number of items in a block.
Definition at line 80 of file item.h.
◆ reduct_item_type_t
Item type enumeration.
Definition at line 25 of file item.h.
◆ reduct_item_flags_t
Item flags enumeration.
Definition at line 36 of file item.h.
◆ reduct_item_new()
Allocate a new Reduct item.
- Parameters
-
| reduct | Pointer to the Reduct structure. |
- Returns
- A pointer to the newly created item.
◆ reduct_item_free()
Free an Reduct item.
- Parameters
-
| reduct | Pointer to the Reduct structure. |
| item | Pointer to the item to free. |
◆ reduct_item_get_int()
Get the integer value of an item if it is number shaped.
- Parameters
-
- Returns
- The integer value, or 0 if not number shaped.
Definition at line 113 of file item_impl.h.
◆ reduct_item_get_float()
Get the float value of an item if it is number shaped.
- Parameters
-
- Returns
- The float value, or 0.0 if not number shaped.
Definition at line 126 of file item_impl.h.
◆ reduct_item_type_str()
Get the string representation of an Reduct item type.
- Parameters
-
- Returns
- The string representation of the item type.
Definition at line 139 of file item_impl.h.