declare all built-in functions and variables in (scheme base) library

This commit is contained in:
Yuichi Nishiwaki 2013-12-07 20:48:24 -08:00
parent 47dd186535
commit fb2e7ac498
2 changed files with 19 additions and 4 deletions

View File

@ -3,6 +3,8 @@
#include "picrin.h"
#include "picrin/pair.h"
#include "picrin/lib.h"
#include "picrin/macro.h"
void pic_init_bool(pic_state *);
void pic_init_pair(pic_state *);
@ -90,9 +92,22 @@ pic_features(pic_state *pic)
void
pic_init_core(pic_state *pic)
{
int ai;
int ai = pic_gc_arena_preserve(pic);
pic_make_library(pic, pic_parse(pic, "(scheme base)"));
pic_in_library(pic, pic_parse(pic, "(scheme base)"));
/* load core syntaces */
pic->lib->senv = pic_core_syntactic_env(pic);
pic_export(pic, pic_intern_cstr(pic, "define"));
pic_export(pic, pic_intern_cstr(pic, "set!"));
pic_export(pic, pic_intern_cstr(pic, "quote"));
pic_export(pic, pic_intern_cstr(pic, "lambda"));
pic_export(pic, pic_intern_cstr(pic, "if"));
pic_export(pic, pic_intern_cstr(pic, "begin"));
pic_export(pic, pic_intern_cstr(pic, "define-macro"));
pic_export(pic, pic_intern_cstr(pic, "define-syntax"));
ai = pic_gc_arena_preserve(pic);
pic_init_bool(pic); DONE;
pic_init_pair(pic); DONE;
pic_init_port(pic); DONE;

View File

@ -118,12 +118,12 @@ pic_open(int argc, char *argv[], char **envp)
register_core_symbol(pic, sGE, ">=");
pic_gc_arena_restore(pic, ai);
pic_init_core(pic);
/* set library */
pic_make_library(pic, pic_parse(pic, "user"));
pic_in_library(pic, pic_parse(pic, "user"));
pic_init_core(pic);
return pic;
}