From 7d64852b88561654983f97233e9508b6ff808de9 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 15 Sep 2014 15:36:27 +0900 Subject: [PATCH] add definition of pic_set --- vm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vm.c b/vm.c index ad265e9b..be82543f 100644 --- a/vm.c +++ b/vm.c @@ -445,6 +445,20 @@ pic_ref(pic_state *pic, struct pic_lib *lib, const char *name) return xh_val(xh_get_int(&pic->globals, rename), pic_value); } +void +pic_set(pic_state *pic, struct pic_lib *lib, const char *name, pic_value val) +{ + pic_sym sym, rename; + + sym = pic_intern_cstr(pic, name); + + if (! pic_find_rename(pic, lib->env, sym, &rename)) { + pic_errorf(pic, "symbol \"%s\" not defined in library ~s", name, lib->name); + } + + xh_put_int(&pic->globals, rename, &val); +} + pic_value pic_funcall(pic_state *pic, const char *name, pic_list args) {