summaryrefslogtreecommitdiff
path: root/libguile/eval.c
diff options
context:
space:
mode:
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2003-04-20 19:18:43 +0000
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2003-04-20 19:18:43 +0000
commit5cb22e9606839c40aef241e24686f58e6a75a3f7 (patch)
tree21daffa488763bee508c7620045bd789fa0537e7 /libguile/eval.c
parenta44a9715eb32e78b6cc0ed6908694ce43564ac02 (diff)
downloadguile-5cb22e9606839c40aef241e24686f58e6a75a3f7.tar.gz
* eval.c, eval.h, evalext.c, evalext.h (scm_sym_setter,
scm_m_generalized_set_x, scm_init_evalext): Move the declaration and definition of the memoizer for the generalized set! macro from evalext.[ch] to eval.[ch]. Use the SCM_SYNTAX snarfer macro to define the macro object. * eval.c, eval.h (s_set_x, scm_s_set_x, scm_m_set_x, scm_m_generalized_set_x): Since now scm_s_set_x is only used in eval.c, it is made static and renamed to s_set_x. * evalext.c (scm_defined_p, scm_m_undefine): Prefer !SCM_<foo> over SCM_N<foo>.
Diffstat (limited to 'libguile/eval.c')
-rw-r--r--libguile/eval.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/libguile/eval.c b/libguile/eval.c
index d4e8ef4b0..f7d1c584c 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -475,16 +475,16 @@ scm_m_if (SCM xorig, SCM env SCM_UNUSED)
/* Will go into the RnRS module when Guile is factorized.
-SCM_SYNTAX (scm_s_set_x,"set!", scm_makmmacro, scm_m_set_x); */
-const char scm_s_set_x[] = "set!";
-SCM_GLOBAL_SYMBOL (scm_sym_set_x, scm_s_set_x);
+SCM_SYNTAX (s_set_x, "set!", scm_makmmacro, scm_m_set_x); */
+static const char s_set_x[] = "set!";
+SCM_GLOBAL_SYMBOL (scm_sym_set_x, s_set_x);
SCM
scm_m_set_x (SCM xorig, SCM env SCM_UNUSED)
{
SCM x = SCM_CDR (xorig);
- SCM_ASSYNT (scm_ilength (x) == 2, scm_s_expression, scm_s_set_x);
- SCM_ASSYNT (SCM_SYMBOLP (SCM_CAR (x)), scm_s_variable, scm_s_set_x);
+ SCM_ASSYNT (scm_ilength (x) == 2, scm_s_expression, s_set_x);
+ SCM_ASSYNT (SCM_SYMBOLP (SCM_CAR (x)), scm_s_variable, s_set_x);
return scm_cons (SCM_IM_SET_X, x);
}
@@ -794,6 +794,24 @@ scm_m_delay (SCM xorig, SCM env SCM_UNUSED)
}
+SCM_SYNTAX (s_gset_x, "set!", scm_makmmacro, scm_m_generalized_set_x);
+SCM_SYMBOL (scm_sym_setter, "setter");
+
+SCM
+scm_m_generalized_set_x (SCM xorig, SCM env SCM_UNUSED)
+{
+ SCM x = SCM_CDR (xorig);
+ SCM_ASSYNT (2 == scm_ilength (x), scm_s_expression, s_set_x);
+ if (SCM_SYMBOLP (SCM_CAR (x)))
+ return scm_cons (SCM_IM_SET_X, x);
+ else if (SCM_CONSP (SCM_CAR (x)))
+ return scm_cons (scm_list_2 (scm_sym_setter, SCM_CAAR (x)),
+ scm_append (scm_list_2 (SCM_CDAR (x), SCM_CDR (x))));
+ else
+ scm_misc_error (s_set_x, scm_s_variable, SCM_EOL);
+}
+
+
SCM_SYNTAX (s_future, "future", scm_makmmacro, scm_m_future);
SCM_GLOBAL_SYMBOL (scm_sym_future, s_future);