api changes of reader/parser

This commit is contained in:
Yuichi Nishiwaki 2014-06-25 15:39:04 +09:00
parent 0b087b785e
commit da4a4fd449
4 changed files with 17 additions and 16 deletions

View File

@ -152,7 +152,8 @@ bool pic_interned_p(pic_state *, pic_sym);
char *pic_strdup(pic_state *, const char *);
char *pic_strndup(pic_state *, const char *, size_t);
pic_value pic_read(pic_state *, const char *);
pic_value pic_read(pic_state *, struct pic_port *);
pic_value pic_read_cstr(pic_state *, const char *);
pic_list pic_parse_file(pic_state *, FILE *); /* #f for incomplete input */
pic_list pic_parse_cstr(pic_state *, const char *);
@ -180,7 +181,7 @@ struct pic_lib *pic_find_library(pic_state *, pic_value);
#define pic_deflibrary_helper__(i, prev_lib, spec) \
for (int i = 0; ! i; ) \
for (struct pic_lib *prev_lib; ! i; ) \
for ((prev_lib = pic->lib), pic_make_library(pic, pic_read(pic, spec)), pic_in_library(pic, pic_read(pic, spec)); ! i++; pic->lib = prev_lib)
for ((prev_lib = pic->lib), pic_make_library(pic, pic_read_cstr(pic, spec)), pic_in_library(pic, pic_read_cstr(pic, spec)); ! i++; pic->lib = prev_lib)
void pic_import(pic_state *, pic_value);
void pic_export(pic_state *, pic_sym);

View File

@ -68,7 +68,7 @@ new_analyze_state(pic_state *pic)
state->pic = pic;
state->scope = NULL;
stdlib = pic_find_library(pic, pic_read(pic, "(scheme base)"));
stdlib = pic_find_library(pic, pic_read_cstr(pic, "(scheme base)"));
/* native VM procedures */
register_renamed_symbol(pic, state, rCONS, stdlib, "cons");

View File

@ -119,8 +119,8 @@ pic_open(int argc, char *argv[], char **envp)
pic_init_core(pic);
/* set library */
pic_make_library(pic, pic_read(pic, "(picrin user)"));
pic_in_library(pic, pic_read(pic, "(picrin user)"));
pic_make_library(pic, pic_read_cstr(pic, "(picrin user)"));
pic_in_library(pic, pic_read_cstr(pic, "(picrin user)"));
return pic;
}

View File

@ -39,16 +39,16 @@ import_repllib(pic_state *pic)
{
int ai = pic_gc_arena_preserve(pic);
pic_import(pic, pic_read(pic, "(scheme base)"));
pic_import(pic, pic_read(pic, "(scheme load)"));
pic_import(pic, pic_read(pic, "(scheme process-context)"));
pic_import(pic, pic_read(pic, "(scheme write)"));
pic_import(pic, pic_read(pic, "(scheme file)"));
pic_import(pic, pic_read(pic, "(scheme inexact)"));
pic_import(pic, pic_read(pic, "(scheme cxr)"));
pic_import(pic, pic_read(pic, "(scheme lazy)"));
pic_import(pic, pic_read(pic, "(scheme time)"));
pic_import(pic, pic_read(pic, "(picrin macro)"));
pic_import(pic, pic_read_cstr(pic, "(scheme base)"));
pic_import(pic, pic_read_cstr(pic, "(scheme load)"));
pic_import(pic, pic_read_cstr(pic, "(scheme process-context)"));
pic_import(pic, pic_read_cstr(pic, "(scheme write)"));
pic_import(pic, pic_read_cstr(pic, "(scheme file)"));
pic_import(pic, pic_read_cstr(pic, "(scheme inexact)"));
pic_import(pic, pic_read_cstr(pic, "(scheme cxr)"));
pic_import(pic, pic_read_cstr(pic, "(scheme lazy)"));
pic_import(pic, pic_read_cstr(pic, "(scheme time)"));
pic_import(pic, pic_read_cstr(pic, "(picrin macro)"));
#if DEBUG
puts("* imported repl libraries");
@ -289,7 +289,7 @@ main(int argc, char *argv[], char **envp)
parse_opt(argc, argv);
if (mode == INTERACTIVE_MODE || mode == ONE_LINER_MODE) {
import_repllib(pic);
// import_repllib(pic);
}
switch (mode) {