-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.h
More file actions
29 lines (21 loc) · 658 Bytes
/
env.h
File metadata and controls
29 lines (21 loc) · 658 Bytes
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
#ifndef ENV_H
#define ENV_H
#include "value.h"
typedef struct {
char* name;
Value value;
} Binding;
typedef struct Environment {
struct Environment* parent;
Binding* bindings;
int count;
int capacity;
} Environment;
void envInit(Environment* env, Environment* parent);
void envFree(Environment* env);
int envDefine(Environment* env, const char* name, Value value);
int envAssign(Environment* env, const char* name, Value value);
int envGet(const Environment* env, const char* name, Value* outValue);
Value* envGetRef(Environment* env, const char* name);
int envExistsInCurrent(const Environment* env, const char* name);
#endif