diff --git a/piclib/scheme/base.scm b/piclib/scheme/base.scm index 186b2f57..efb0a61a 100644 --- a/piclib/scheme/base.scm +++ b/piclib/scheme/base.scm @@ -7,6 +7,20 @@ (export define set! lambda quote if begin define-syntax) + ;; call/cc + + (define real-callcc call-with-current-continuation) + + (set! call-with-current-continuation + (lambda (f) + (real-callcc + (lambda (c) + (f (lambda args (apply continue c args))))))) + + (define call/cc call-with-current-continuation) + + (export call/cc) + ;; core syntax (define-syntax syntax-error @@ -840,6 +854,10 @@ (export define-record-type) + (export (rename floor-remainder modulo) + (rename truncate-quotient quotient) + (rename truncate-remainder remainder)) + ;; 6.4 Pairs and lists (export pair? @@ -920,7 +938,10 @@ (define (string . objs) (list->string objs)) - (export string string->list list->string) + (export string + string->list + list->string + (rename string-copy substring)) ;; 6.8. Vector diff --git a/src/init.c b/src/init.c index 76b51d35..6ff9eac0 100644 --- a/src/init.c +++ b/src/init.c @@ -35,11 +35,19 @@ pic_libraries(pic_state *pic) return libs; } +void pic_init_eval(pic_state *); +void pic_init_file(pic_state *); +void pic_init_load(pic_state *); +void pic_init_macro2(pic_state *); +void pic_init_system(pic_state *); +void pic_init_time(pic_state *); + void pic_init_contrib(pic_state *); + void pic_load_piclib(pic_state *); void -pic_init_misc(pic_state *pic) +pic_init_picrin(pic_state *pic) { pic_deflibrary (pic, "(picrin library)") { pic_defun(pic, "libraries", pic_libraries); @@ -47,7 +55,16 @@ pic_init_misc(pic_state *pic) pic_deflibrary (pic, "(scheme base)") { pic_defun(pic, "features", pic_features); + + pic_init_eval(pic); + pic_init_file(pic); + pic_init_load(pic); + pic_init_macro2(pic); + pic_init_system(pic); + pic_init_time(pic); + pic_init_contrib(pic); + pic_load_piclib(pic); } } diff --git a/src/main.c b/src/main.c index 617d4a0d..d37bbdca 100644 --- a/src/main.c +++ b/src/main.c @@ -13,6 +13,8 @@ main(int argc, char *argv[], char **envp) pic = pic_open(argc, argv, envp); + pic_init_picrin(pic); + pic_try { pic_import(pic, pic_read_cstr(pic, "(picrin main)")); pic_funcall(pic, "main", pic_nil_value());