aboutsummaryrefslogtreecommitdiff
path: root/src/env.h
blob: 7d4ceac58a9cb34ac5705564776bf8a081869be0 (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
31
#ifndef ENV_H
#define ENV_H

#include "list.h"

// #include "value.h"
typedef struct value * _value_t;

typedef struct env * env_t;
#define ENV_EMPTY NULL

enum env_kv_flag {
    ENV_KV_FREE_KEY     = 1,
    ENV_KV_CIRCULAR_REF = 2
};

env_t env_create(env_t parent);
void env_destroy(env_t env);

int env_insert(env_t env, char *key, _value_t value,
               _value_t *prevval, int flags);
int env_query(env_t env, char *key, _value_t *data);

env_t env_copy(env_t env);
int env_depend(env_t parent, env_t dep);

#ifdef DEBUG
void env_print(env_t env);
#endif

#endif