aboutsummaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2024-09-22 15:35:40 +0300
committerkartofen <mladenovnasko0@gmail.com>2024-09-22 15:35:40 +0300
commit7edffea39a3d666098ebeca27ea398769e8b981b (patch)
treed114e34f34fdc01e1d61126a0989a1b91c449642 /src/env.h
parentf60047d4b013eb7f75ad4f5c63eda63153a4bf8e (diff)
make env opaque
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/env.h b/src/env.h
index 6f3e169..a233a09 100644
--- a/src/env.h
+++ b/src/env.h
@@ -4,24 +4,19 @@
// #include "value.h"
typedef struct value * _value_t;
-#include "hashtable.h"
-
-typedef struct symbol_table *env_t;
+typedef struct env * 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_t env_create(env_t parent, env_destroy_func destroy_func);
+void env_destroy(env_t env);
- env_destroy_func destroy_func;
-};
+int env_insert(env_t env, char *key, _value_t data,
+ char **prevkey, _value_t *prevdata);
+int env_query(env_t env, char *key, _value_t *data);
-env_t env_create(env_t parent, env_destroy_func destroy_func);
env_t env_copy(env_t env);
-void env_destroy(env_t env);
+env_t env_parent(env_t env);
#endif