summaryrefslogtreecommitdiff
path: root/libguile/vm-engine.c
diff options
context:
space:
mode:
authorBrian Templeton <bpt@hcoop.net>2010-08-14 18:35:17 -0400
committerAndy Wingo <wingo@pobox.com>2010-12-07 13:21:01 +0100
commitef94624eaf549ca9c730d4650b9dfed2ee48521b (patch)
tree5cc8343605d2fa9e9aac28bd3328ab71cdb01e7b /libguile/vm-engine.c
parentd1079217947013dac495a95e433ad5da9f7aa80a (diff)
downloadguile-ef94624eaf549ca9c730d4650b9dfed2ee48521b.tar.gz
unbound fluids
* libguile/fluids.c (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New functions. (fluid_ref): New function; like scm_fluid_ref, but will not throw an error for unbound fluids. (scm_fluid_ref, swap_fluid): Use `fluid_ref'. * libguile/fluids.h (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New prototypes. * libguile/vm-i-system.c (fluid_ref): If fluid is unbound, jump to `vm_error_unbound_fluid'. * libguile/vm-engine.c (VM_NAME)[vm_error_unbound_fluid]: New error message. * test-suite/tests/fluids.test ("unbound fluids")["fluid-ref of unbound fluid", "fluid-bound? of bound fluid", "fluid-bound? of unbound fluid", "unbound fluids can be set", "bound fluids can be unset"]: New tests.
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r--libguile/vm-engine.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 2e3a87644..e69167f31 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -146,6 +146,13 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
scm_list_1 (finish_args), SCM_BOOL_F);
goto vm_error;
+ vm_error_unbound_fluid:
+ SYNC_ALL ();
+ err_msg = scm_from_locale_string ("Unbound fluid: ~s");
+ scm_error_scm (scm_misc_error_key, program, err_msg,
+ scm_list_1 (finish_args), SCM_BOOL_F);
+ goto vm_error;
+
vm_error_apply_to_non_list:
scm_error (scm_arg_type_key, "apply", "Apply to non-list: ~S",
finish_args, finish_args);