From 7653cb4bb1b0e02009f106bb0814783daaaa7cee Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 7 Aug 2014 11:14:58 +0900 Subject: [PATCH] add libraries function --- src/init.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/init.c b/src/init.c index 8e9f933e..d9a48cf6 100644 --- a/src/init.c +++ b/src/init.c @@ -24,6 +24,20 @@ pic_features(pic_state *pic) return features; } +static pic_value +pic_libraries(pic_state *pic) +{ + pic_value libs = pic_nil_value(), lib; + + pic_get_args(pic, ""); + + pic_for_each (lib, pic->libs) { + libs = pic_cons(pic, pic_car(pic, lib), libs); + } + + return libs; +} + void pic_init_bool(pic_state *); void pic_init_pair(pic_state *); void pic_init_port(pic_state *); @@ -96,10 +110,12 @@ pic_init_core(pic_state *pic) pic_init_lib(pic); DONE; pic_load_piclib(pic); DONE; - pic_init_contrib(pic); DONE; pic_defun(pic, "features", pic_features); + } + pic_deflibrary (pic, "(picrin library)") { + pic_defun(pic, "libraries", pic_libraries); } }