30#define ARRAY_INITIAL_CAPACITY 16
103 const char *value,
size_t value_len);
void snobol_array_release(snobol_array_t *array)
Release (decrement refcount) an array; frees when refcount reaches 0.
snobol_array_t * snobol_array_create(int32_t bounds_hint)
Create a new sparse array.
const char * snobol_array_get(const snobol_array_t *array, int32_t key)
Get the value at a given key.
const char * snobol_array_get_ex(const snobol_array_t *array, int32_t key, size_t *out_len)
Get the value at a given key (NUL-safe).
char ** snobol_array_values(const snobol_array_t *array, size_t *out_count)
Get all active values.
bool snobol_array_set(snobol_array_t *array, int32_t key, const char *value)
Set a value at the given key.
bool snobol_array_set_ex(snobol_array_t *array, int32_t key, const char *value, size_t value_len)
Set a value at the given key (NUL-safe byte-exact variant).
bool snobol_array_delete(snobol_array_t *array, int32_t key)
Delete the entry at a given key (marks as tombstone).
void snobol_array_clear(snobol_array_t *array)
Clear all entries from the array (resets to empty).
bool snobol_array_has(const snobol_array_t *array, int32_t key)
Check whether a key has an active entry.
size_t snobol_array_size(const snobol_array_t *array)
Return the number of active entries.
int32_t * snobol_array_keys(const snobol_array_t *array, size_t *out_count)
Get all active keys.
struct array_entry array_entry_t
A single entry in the sparse array.
snobol_array_t * snobol_array_retain(snobol_array_t *array)
Retain (increment refcount) an array.
struct snobol_array snobol_array_t
Sparse array state.
Portable function-attribute macros for SNOBOL4.
A single entry in the sparse array.