diff options
Diffstat (limited to 'src/env.h')
-rw-r--r-- | src/env.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/env.h b/src/env.h new file mode 100644 index 0000000..577133a --- /dev/null +++ b/src/env.h @@ -0,0 +1,30 @@ +#ifndef ENV_H +#define ENV_H + +// #include "value.h" +typedef struct value * value_t; + +#include "hashtable.h" + +typedef struct symbol_table *env_t; +#define ENV_EMPTY NULL + +typedef void (*env_destroy_func)(char *key, value_t value); + +struct symbol_table { + hashtable_t table; + + struct symbol_table *parent; + size_t refs; + + env_destroy_func destroy_func; +}; + +env_t env_create(env_t parent, env_destroy_func destroy_func); +void env_destroy(env_t env); + +int env_insert(env_t env, value_t key, value_t data); +int env_query (env_t env, value_t key, value_t *data); +int env_delete(env_t env, value_t key); + +#endif |