2013-10-10 03:15:41 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "picrin.h"
|
|
|
|
|
2013-10-11 04:36:51 -04:00
|
|
|
static struct pic_env *
|
|
|
|
pic_new_empty_env()
|
|
|
|
{
|
|
|
|
struct pic_env *env;
|
|
|
|
|
|
|
|
env = (struct pic_env *)malloc(sizeof(struct pic_env));
|
|
|
|
env->assoc = pic_nil_value();
|
|
|
|
env->parent = NULL;
|
|
|
|
|
|
|
|
return env;
|
|
|
|
}
|
|
|
|
|
2013-10-10 03:15:41 -04:00
|
|
|
pic_state *
|
|
|
|
pic_open()
|
|
|
|
{
|
|
|
|
pic_state *pic;
|
|
|
|
|
2013-10-11 04:36:51 -04:00
|
|
|
pic = (pic_state *)malloc(sizeof(pic_state));
|
|
|
|
pic->global_env = pic_new_empty_env();
|
2013-10-10 03:15:41 -04:00
|
|
|
|
|
|
|
return pic;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pic_close(pic_state *pic)
|
|
|
|
{
|
|
|
|
free(pic);
|
|
|
|
}
|