summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Templeton <bpt@hcoop.net>2010-08-14 19:00:20 -0400
committerAndy Wingo <wingo@pobox.com>2010-12-07 13:21:01 +0100
commita8aa4c0b56624dc77b71d6b4892f6b14ad9e751d (patch)
treef1d729f9007c0056fab2bf7fdc8b01b483f2cb3b
parentef94624eaf549ca9c730d4650b9dfed2ee48521b (diff)
variable-unset!
* libguile/variable.c (scm_variable_unset_x): New function. * libguile/variable.h (scm_variable_unset_x): New prototype.
-rw-r--r--libguile/variable.c12
-rw-r--r--libguile/variable.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/libguile/variable.c b/libguile/variable.c
index a97444c0b..76fbf1821 100644
--- a/libguile/variable.c
+++ b/libguile/variable.c
@@ -111,6 +111,18 @@ SCM_DEFINE (scm_variable_set_x, "variable-set!", 2, 0, 0,
}
#undef FUNC_NAME
+SCM_DEFINE (scm_variable_unset_x, "variable-unset!", 1, 0, 0,
+ (SCM var),
+ "Ensure that @var{var} is not bound to a value.\n"
+ "@var{var} must be a variable object.")
+#define FUNC_NAME s_scm_variable_unset_x
+{
+ SCM_VALIDATE_VARIABLE (1, var);
+ SCM_VARIABLE_SET (var, SCM_UNDEFINED);
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+
SCM_DEFINE (scm_variable_bound_p, "variable-bound?", 1, 0, 0,
(SCM var),
"Return @code{#t} iff @var{var} is bound to a value.\n"
diff --git a/libguile/variable.h b/libguile/variable.h
index 8faced4ec..20daf853f 100644
--- a/libguile/variable.h
+++ b/libguile/variable.h
@@ -42,6 +42,7 @@ SCM_API SCM scm_make_undefined_variable (void);
SCM_API SCM scm_variable_p (SCM obj);
SCM_API SCM scm_variable_ref (SCM var);
SCM_API SCM scm_variable_set_x (SCM var, SCM val);
+SCM_API SCM scm_variable_unset_x (SCM var);
SCM_API SCM scm_variable_bound_p (SCM var);
SCM_INTERNAL void scm_i_variable_print (SCM var, SCM port, scm_print_state *pstate);