2#ifndef REDUCT_CORE_IMPL_H
3#define REDUCT_CORE_IMPL_H 1
18 reduct->
error = error;
145 input->
end = buffer + length;
146 input->
flags = flags;
149 reduct->
input = input;
Atom representation and operations.
Core definitions and structures.
REDUCT_API void reduct_constant_register(reduct_t *reduct, const char *name, reduct_item_t *item)
#define REDUCT_MALLOC(_size)
#define REDUCT_PI
PI constant.
#define REDUCT_CONTAINER_OF(_ptr, _type, _member)
Container of macro.
#define REDUCT_E
E constant.
#define REDUCT_ASSERT(_cond)
#define REDUCT_STRNCPY(dest, src, n)
#define REDUCT_PATH_MAX
Maximum path length for Reduct.
#define REDUCT_FREE(_ptr)
#define REDUCT_CALLOC(_nmemb, _size)
Error handling and reporting.
Virtual machine evaluation.
REDUCT_API reduct_atom_t * reduct_atom_lookup(struct reduct *reduct, const char *str, reduct_size_t len, reduct_atom_lookup_flags_t flags)
Lookup an atom in the Reduct structure.
REDUCT_API reduct_atom_t * reduct_atom_lookup_int(struct reduct *reduct, reduct_int64_t value)
Lookup an atom by integer value.
REDUCT_API reduct_atom_t * reduct_atom_lookup_float(struct reduct *reduct, reduct_float_t value)
Lookup an atom by float value.
@ REDUCT_ATOM_LOOKUP_NONE
No flags.
REDUCT_API reduct_t * reduct_new(reduct_error_t *error)
Create a new Reduct structure.
#define REDUCT_CONSTANTS_MAX
Maximum amount of predefined constants.
#define REDUCT_GC_THRESHOLD_INITIAL
Initial blocks allocated threshold for garbage collection.
reduct_input_flags_t
Input flags.
REDUCT_API reduct_input_t * reduct_input_new(reduct_t *reduct, const char *buffer, reduct_size_t length, const char *path, reduct_input_flags_t flags)
Create a new input structure and push it onto the input stack.
REDUCT_API void reduct_free(reduct_t *reduct)
Free the Reduct structure.
REDUCT_API void reduct_args_set(reduct_t *reduct, int argc, char **argv)
Set the command line arguments for the Reduct structure.
@ REDUCT_INPUT_FLAG_OWNED
The input buffer is owned by the input structure and should be freed.
#define REDUCT_ERROR_THROW(_error, _item, _type,...)
Throw an error using the jump buffer in the error structure.
#define REDUCT_ERROR_INTERNAL(_reduct,...)
Throw an internal error using the jump buffer in the error structure.
REDUCT_API void reduct_eval_state_deinit(reduct_eval_state_t *state)
Deinitialize an evaluation state structure.
#define REDUCT_GC_RETAIN_ITEM(_reduct, _item)
Retain a item, preventing it from being collected by the GC.
REDUCT_API void reduct_intrinsic_register_all(struct reduct *reduct)
Registers all Reduct intrinsics with the given Reduct instance.
REDUCT_API void reduct_item_free(struct reduct *reduct, reduct_item_t *item)
Free an Reduct item.
#define REDUCT_ITEM_FLAG_FALSY
Item is falsy.
#define REDUCT_ITEM_BLOCK_MAX
The maximum number of items in a block.
REDUCT_API reduct_list_t * reduct_list_new(struct reduct *reduct)
Create a new editable list.
struct reduct_atom * name
struct reduct_item * item
struct reduct_item_block * next
reduct_item_t items[REDUCT_ITEM_BLOCK_MAX]
reduct_item_flags_t flags
Flags for the item.
reduct_size_t gcThreshold
reduct_item_block_t * block
struct reduct_eval_state * evalState
reduct_constant_t constants[REDUCT_CONSTANTS_MAX]
reduct_item_block_t firstBlock
reduct_input_t firstInput
reduct_uint32_t constantCount
reduct_item_t * falseItem