57 if (result !=
nullptr) {
80 int len = snprintf(
nullptr, 0,
"gensym_%" PRIu64,
id);
81 PANIC_IF(len < 0,
"This should never happen!");
85 (void)snprintf(name, len + 1,
"gensym_%" PRIu64,
id);
void * srn_allocate(const srn_context_t *ctx, size_t size, size_t alignment)
srn_value_t * srn_value_make(srn_context_t *ctx, srn_value_tag_t tag, srn_metadata_t *metadata, void *payload)
Creates a new serene value.
#define AS_STRING(value_ref)
srn_object_id_t srn_allocate_object_id(srn_engine_t *engine)
void * hmap_lookup(srn_context_t *ctx, const hmap_t *hmap, const hmap_key_t *k, void *default_value)
Lookup the given k in the given hmap and return the value if it's been found.
hmap_t hmap_insert(srn_context_t *ctx, const hmap_t *hmap, hmap_key_t *k, void *v)
Insert the given key k with the value v in the given hash hmap and return the new map.
hmap_key_t * hmap_make_key(srn_context_t *ctx, void *data, size_t len)
Create a new key out of the given data, with the given len.
This is an implementation of Compressed Hash-Array Mapped Prefix-tree, which is a bit-partitioned,...
srn_value_t * srn_string_make(srn_context_t *ctx, srn_metadata_t *metadata, const char *src)
Create a string from a null terminated C string.
bool srn_string_is_empty(const srn_string_t *s)
srn_string_t * srn_string_copy(srn_context_t *ctx, const srn_string_t *src)
Copy the src string to dst string.
Note: For key equality we use the memcpy function.
srn_engine_t * engine
Long term state of the compiler.
hmap_t sym_table
A mapping symbol names to (srn_value_t with type symbol).
srn_spinlock_t sym_table_lock
size_t size
Size of the buffer.
uint8_t buffer[]
The buffer that holds the WTF8 sequence.
srn_value_t * srn_symbol_make(srn_context_t *ctx, srn_metadata_t *metadata, srn_namespace_t *ns, srn_string_t *name)
Create a new symbol. IT DOES NOT INTERNALIZE THE SYMBOL.
srn_value_t * srn_symbol_intern(srn_context_t *ctx, srn_metadata_t *metadata, srn_namespace_t *ns, srn_string_t *symbol_name)
srn_value_t * srn_symbol_gen(srn_context_t *ctx, srn_metadata_t *metadata, srn_namespace_t *ns, srn_string_t *optional_name)
#define PANIC_IF_NULL(ptr)
static void srn_spinlock_lock(srn_spinlock_t *lock)
#define PANIC_IF(cond, msg)
static void srn_spinlock_unlock(srn_spinlock_t *lock)