* eval.c, eval.h, evalext.c, evalext.h (scm_sym_setter,
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Sun, 20 Apr 2003 19:18:43 +0000 (19:18 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Sun, 20 Apr 2003 19:18:43 +0000 (19:18 +0000)
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>.

libguile/ChangeLog
libguile/eval.c
libguile/eval.h
libguile/evalext.c
libguile/evalext.h

index 8986d01..a5413dd 100644 (file)
@@ -1,3 +1,18 @@
+2003-04-20  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * 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>.
+
 2003-04-20  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * eval.c, root.h (scm_undefineds, SCM_NUM_PROTECTS, undefineds,
@@ -10,7 +25,7 @@
 
 2003-04-20  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
-       * eval.c (SCM_BIT8, SCM_BIT8, unmemocopy, SCM_CEVAL): Renamed
+       * eval.c (SCM_BIT7, SCM_BIT8, unmemocopy, SCM_CEVAL): Renamed
        file-local macro SCM_BIT8 to SCM_BIT7, which is more appropriate.
 
 2003-04-20  Dirk Herrmann  <D.Herrmann@tu-bs.de>
index d4e8ef4..f7d1c58 100644 (file)
@@ -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);
 
index bff1a64..9ecb881 100644 (file)
@@ -134,7 +134,6 @@ SCM_API const char scm_s_bindings[];
 SCM_API const char scm_s_variable[];
 SCM_API const char scm_s_clauses[];
 SCM_API const char scm_s_formals[];
-SCM_API const char scm_s_set_x[];
 
 SCM_API SCM scm_sym_and;
 SCM_API SCM scm_sym_begin;
@@ -187,6 +186,7 @@ SCM_API SCM scm_m_letstar (SCM xorig, SCM env);
 SCM_API SCM scm_m_do (SCM xorig, SCM env);
 SCM_API SCM scm_m_quasiquote (SCM xorig, SCM env);
 SCM_API SCM scm_m_delay (SCM xorig, SCM env);
+SCM_API SCM scm_m_generalized_set_x (SCM xorig, SCM env);
 SCM_API SCM scm_m_future (SCM xorig, SCM env);
 SCM_API SCM scm_m_define (SCM x, SCM env);
 SCM_API SCM scm_m_letrec (SCM xorig, SCM env);
index dec340c..3643e0c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998,1999,2000,2001,2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include "libguile/validate.h"
 #include "libguile/evalext.h"
 
-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, scm_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 (scm_s_set_x, scm_s_variable, SCM_EOL);
-}
-
 SCM_DEFINE (scm_defined_p, "defined?", 1, 1, 0,
             (SCM sym, SCM env),
            "Return @code{#t} if @var{sym} is defined in the lexical "
@@ -66,12 +50,12 @@ SCM_DEFINE (scm_defined_p, "defined?", 1, 1, 0,
        {
          SCM_ASSERT (SCM_CONSP (frames), env, SCM_ARG2, FUNC_NAME);
          b = SCM_CAR (frames);
-         if (SCM_NFALSEP (scm_procedure_p (b)))
+         if (!SCM_FALSEP (scm_procedure_p (b)))
            break;
          SCM_ASSERT (SCM_CONSP (b), env, SCM_ARG2, FUNC_NAME);
          for (b = SCM_CAR (b); SCM_NIMP (b); b = SCM_CDR (b))
            {
-             if (SCM_NCONSP (b))
+             if (!SCM_CONSP (b))
                {
                  if (SCM_EQ_P (b, sym))
                    return SCM_BOOL_T;
@@ -108,7 +92,7 @@ scm_m_undefine (SCM x, SCM env)
   x = SCM_CAR (x);
   SCM_ASSYNT (SCM_SYMBOLP (x), scm_s_variable, s_undefine);
   arg1 = scm_sym2var (x, scm_env_top_level (env), SCM_BOOL_F);
-  SCM_ASSYNT (SCM_NFALSEP (arg1) && !SCM_UNBNDP (SCM_VARIABLE_REF (arg1)),
+  SCM_ASSYNT (!SCM_FALSEP (arg1) && !SCM_UNBNDP (SCM_VARIABLE_REF (arg1)),
              "variable already unbound ", s_undefine);
   SCM_VARIABLE_SET (arg1, SCM_UNDEFINED);
 #ifdef SICP
@@ -175,7 +159,6 @@ SCM_DEFINE (scm_self_evaluating_p, "self-evaluating?", 1, 0, 0,
 void 
 scm_init_evalext ()
 {
-  scm_make_synt (scm_s_set_x, scm_makmmacro, scm_m_generalized_set_x);
 #include "libguile/evalext.x"
 }
 
index 3bb6345..defb8a1 100644 (file)
@@ -26,7 +26,6 @@
 
 \f
 
-SCM_API SCM scm_m_generalized_set_x (SCM xorig, SCM env);
 SCM_API SCM scm_defined_p (SCM sym, SCM env);
 SCM_API SCM scm_self_evaluating_p (SCM obj);
 SCM_API void scm_init_evalext (void);