diff --git a/piclib/CMakeLists.txt b/piclib/CMakeLists.txt index 9e87e251..9157fda4 100644 --- a/piclib/CMakeLists.txt +++ b/piclib/CMakeLists.txt @@ -17,4 +17,7 @@ list(APPEND PICLIB_SCHEME_LIBS ${PROJECT_SOURCE_DIR}/piclib/srfi/60.scm ${PROJECT_SOURCE_DIR}/piclib/srfi/95.scm ${PROJECT_SOURCE_DIR}/piclib/srfi/111.scm + + ${PROJECT_SOURCE_DIR}/piclib/picrin/user.scm + ${PROJECT_SOURCE_DIR}/piclib/picrin/repl.scm ) diff --git a/tools/main.scm b/piclib/picrin/repl.scm similarity index 83% rename from tools/main.scm rename to piclib/picrin/repl.scm index 7d1637e0..32c6f20b 100644 --- a/tools/main.scm +++ b/piclib/picrin/repl.scm @@ -1,16 +1,3 @@ -(define-library (picrin user) - (import (scheme base) - (scheme load) - (scheme process-context) - (scheme read) - (scheme write) - (scheme file) - (scheme inexact) - (scheme cxr) - (scheme lazy) - (scheme time) - (picrin macro))) - (define-library (picrin repl) (import (scheme base) (scheme read) @@ -80,8 +67,3 @@ (main-loop)))) (export repl)) - -(import (picrin repl)) - -(repl) - diff --git a/piclib/picrin/user.scm b/piclib/picrin/user.scm new file mode 100644 index 00000000..db615a43 --- /dev/null +++ b/piclib/picrin/user.scm @@ -0,0 +1,14 @@ +; the default repl environment + +(define-library (picrin user) + (import (scheme base) + (scheme load) + (scheme process-context) + (scheme read) + (scheme write) + (scheme file) + (scheme inexact) + (scheme cxr) + (scheme lazy) + (scheme time) + (picrin macro))) diff --git a/tools/main.c b/tools/main.c index dc342d82..e241a277 100644 --- a/tools/main.c +++ b/tools/main.c @@ -13,7 +13,8 @@ main(int argc, char *argv[], char **envp) pic = pic_open(argc, argv, envp); pic_try { - pic_load(pic, "/Users/yuichi/workspace/picrin/tools/main.scm"); + pic_import(pic, pic_read_cstr(pic, "(picrin repl)")); + pic_funcall(pic, "repl", pic_nil_value()); } pic_catch { pic_print_backtrace(pic, pic->err);