32#define REDUCT_ATOM_SMALL_MAX 15
47typedef struct reduct_atom
62#define REDUCT_FNV_PRIME 16777619U
63#define REDUCT_FNV_OFFSET 2166136261U
77 hash ^= (
unsigned char)str[i];
reduct_bool_t
Boolean type.
#define REDUCT_MEMCMP(_s1, _s2, _size)
#define REDUCT_ALWAYS_INLINE
#define REDUCT_ASSERT(_cond)
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_atom_lookup_flags_t
Atom lookup flags.
static REDUCT_ALWAYS_INLINE reduct_bool_t reduct_atom_is_equal(reduct_atom_t *atom, const char *str, reduct_size_t len)
Check if an atom is equal to a string.
#define REDUCT_FNV_PRIME
FNV-1a 32-bit prime.
static void reduct_atom_init(reduct_atom_t *atom)
Initialize an atom.
#define REDUCT_ATOM_SMALL_MAX
The maximum length of a small atom.
REDUCT_API reduct_atom_t * reduct_atom_lookup_int(struct reduct *reduct, reduct_int64_t value)
Lookup an atom by integer value.
REDUCT_API void reduct_atom_deinit(struct reduct *reduct, reduct_atom_t *atom)
Deinitialize an atom.
static REDUCT_ALWAYS_INLINE reduct_uint32_t reduct_hash(const char *str, reduct_size_t len)
Hash a string.
REDUCT_API reduct_atom_t * reduct_atom_lookup_float(struct reduct *reduct, reduct_float_t value)
Lookup an atom by float value.
REDUCT_API void reduct_atom_normalize(struct reduct *reduct, reduct_atom_t *atom)
Normalize an atom, determining its shape and parsing escape sequences.
#define REDUCT_FNV_OFFSET
FNV-1a 32-bit offset basis.
@ REDUCT_ATOM_LOOKUP_NONE
No flags.
@ REDUCT_ATOM_LOOKUP_QUOTED
Atom should be explicitly quoted.
reduct_uint8_t reduct_intrinsic_t
Intrinsic types.
reduct_handle_t(* reduct_native_fn)(struct reduct *reduct, reduct_size_t argc, reduct_handle_t *argv)
Native function pointer type.
Native function registration.
reduct_native_fn native
Native function, item must have REDUCT_ITEM_FLAG_NATIVE.
reduct_int64_t integerValue
Pre-computed integer value, item must have REDUCT_ITEM_FLAG_INT_SHAPED.
reduct_uint32_t hash
The hash of the string.
reduct_uint32_t length
The length of the string (must be first, check the reduct_item_t structure).
char * string
Pointer to the string.
struct reduct_atom * next
Pointer to the next atom in the hash map.
reduct_float_t floatValue
Pre-computed float value, item must have REDUCT_ITEM_FLAG_FLOAT_SHAPED.
reduct_intrinsic_t intrinsic
Cached intrinsic, item must have REDUCT_ITEM_FLAG_INTRINSIC.