let make_library return a library
This commit is contained in:
parent
c764d28878
commit
35b99d11a8
|
@ -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);
|
struct pic_proc *pic_codegen(pic_state *, pic_value);
|
||||||
pic_value pic_macroexpand(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);
|
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);
|
struct pic_lib *pic_find_library(pic_state *, pic_value);
|
||||||
|
|
||||||
void pic_abort(pic_state *, const char *);
|
void pic_abort(pic_state *, const char *);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "picrin/macro.h"
|
#include "picrin/macro.h"
|
||||||
#include "xhash/xhash.h"
|
#include "xhash/xhash.h"
|
||||||
|
|
||||||
void
|
struct pic_lib *
|
||||||
pic_make_library(pic_state *pic, pic_value name)
|
pic_make_library(pic_state *pic, pic_value name)
|
||||||
{
|
{
|
||||||
struct pic_lib *lib;
|
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->senv = pic_core_syntactic_env(pic);
|
||||||
lib->exports = xh_new();
|
lib->exports = xh_new();
|
||||||
|
|
||||||
|
/* register! */
|
||||||
pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl);
|
pic->lib_tbl = pic_acons(pic, name, pic_obj_value(lib), pic->lib_tbl);
|
||||||
|
|
||||||
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -119,8 +119,8 @@ pic_open(int argc, char *argv[], char **envp)
|
||||||
pic_gc_arena_restore(pic, ai);
|
pic_gc_arena_restore(pic, ai);
|
||||||
|
|
||||||
/* set library */
|
/* set library */
|
||||||
pic_make_library(pic, pic_symbol_value(pic_intern_cstr(pic, "user")));
|
pic_make_library(pic, pic_parse(pic, "user"));
|
||||||
pic_in_library(pic, pic_symbol_value(pic_intern_cstr(pic, "user")));
|
pic_in_library(pic, pic_parse(pic, "user"));
|
||||||
|
|
||||||
pic_init_core(pic);
|
pic_init_core(pic);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue