blob: 577133a66e3777213d795175e11d7cafec3c282f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
|