From a3c2dabcc7e0375ff0973f1afe823308831c3ef2 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 18 Nov 2013 01:46:28 +0900 Subject: [PATCH] add feature function --- src/init.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/init.c b/src/init.c index 19f72790..89a72523 100644 --- a/src/init.c +++ b/src/init.c @@ -64,6 +64,23 @@ pic_load_stdlib(pic_state *pic) #endif } +#define PUSH_SYM(pic, lst, name) \ + lst = pic_cons(pic, pic_symbol_value(pic_intern_cstr(pic, name)), lst) + +static pic_value +pic_features(pic_state *pic) +{ + pic_value fs = pic_nil_value(); + + pic_get_args(pic, ""); + + PUSH_SYM(pic, fs, "r7rs"); + PUSH_SYM(pic, fs, "ieee-float"); + PUSH_SYM(pic, fs, "picrin"); + + return fs; +} + #define DONE pic_gc_arena_restore(pic, ai); void @@ -89,4 +106,6 @@ pic_init_core(pic_state *pic) pic_init_str(pic); DONE; pic_load_stdlib(pic); DONE; + + pic_defun(pic, "features", pic_features); }