let make_library return a library

This commit is contained in:
Yuichi Nishiwaki 2013-12-07 18:44:14 -08:00
parent c764d28878
commit 35b99d11a8
3 changed files with 7 additions and 4 deletions

View File

@ -123,8 +123,8 @@ pic_value pic_apply_argv(pic_state *pic, struct pic_proc *, size_t, ...);
struct pic_proc *pic_codegen(pic_state *, pic_value);
pic_value pic_macroexpand(pic_state *, pic_value);
void pic_make_library(pic_state *, pic_value);
void pic_in_library(pic_state *, pic_value);
struct pic_lib *pic_make_library(pic_state *, pic_value);
struct pic_lib *pic_find_library(pic_state *, pic_value);
void pic_abort(pic_state *, const char *);

View File

@ -4,7 +4,7 @@
#include "picrin/macro.h"
#include "xhash/xhash.h"
void
struct pic_lib *
pic_make_library(pic_state *pic, pic_value name)
{
struct pic_lib *lib;
@ -13,7 +13,10 @@ pic_make_library(pic_state *pic, pic_value name)
lib->senv = pic_core_syntactic_env(pic);
lib->exports = xh_new();
/* register! */
pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl);
return lib;
}
void

View File

@ -119,8 +119,8 @@ pic_open(int argc, char *argv[], char **envp)
pic_gc_arena_restore(pic, ai);
/* set library */
pic_make_library(pic, pic_symbol_value(pic_intern_cstr(pic, "user")));
pic_in_library(pic, pic_symbol_value(pic_intern_cstr(pic, "user")));
pic_make_library(pic, pic_parse(pic, "user"));
pic_in_library(pic, pic_parse(pic, "user"));
pic_init_core(pic);