* eval.c (unmemocopy, SCM_APPLY, scm_map, scm_for_each,
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Mon, 21 Apr 2003 01:07:09 +0000 (01:07 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Mon, 21 Apr 2003 01:07:09 +0000 (01:07 +0000)
scm_copy_tree): Place assignment expressions which are part of
other expressions into an expression of their own.

libguile/ChangeLog
libguile/eval.c

index 3e38bb9..791af93 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-21  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * eval.c (unmemocopy, SCM_APPLY, scm_map, scm_for_each,
+       scm_copy_tree): Place assignment expressions which are part of
+       other expressions into an expression of their own.
+
 2003-04-21  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * goops.c (TEST_CHANGE_CLASS, scm_sys_initialize_object): Don't
index f7d1c58..7c2d6e8 100644 (file)
@@ -1422,7 +1422,8 @@ unmemocopy (SCM x, SCM env)
        if (SCM_IMP (b))
          {
            SCM_SETCDR (y, SCM_EOL);
-           ls = scm_cons (scm_sym_let, z = scm_cons (y, SCM_UNSPECIFIED));
+            z = scm_cons (y, SCM_UNSPECIFIED);
+            ls = scm_cons (scm_sym_let, z);
            break;
          }
        do
@@ -1438,7 +1439,8 @@ unmemocopy (SCM x, SCM env)
        while (SCM_NIMP (b));
        SCM_SETCDR (z, SCM_EOL);
       letstar:
-       ls = scm_cons (scm_sym_letstar, z = scm_cons (y, SCM_UNSPECIFIED));
+        z = scm_cons (y, SCM_UNSPECIFIED);
+        ls = scm_cons (scm_sym_letstar, z);
        break;
       }
     case SCM_BIT7 (SCM_IM_OR):
@@ -3636,10 +3638,9 @@ tail:
       else
        {
          SCM tl = args = scm_cons (SCM_CAR (arg1), SCM_UNSPECIFIED);
-         while (arg1 = SCM_CDR (arg1), SCM_CONSP (arg1))
+         for (arg1 = SCM_CDR (arg1); SCM_CONSP (arg1); arg1 = SCM_CDR (arg1))
            {
-             SCM_SETCDR (tl, scm_cons (SCM_CAR (arg1),
-                                       SCM_UNSPECIFIED));
+             SCM_SETCDR (tl, scm_cons (SCM_CAR (arg1), SCM_UNSPECIFIED));
              tl = SCM_CDR (tl);
            }
          SCM_SETCDR (tl, arg1);
@@ -3648,8 +3649,8 @@ tail:
       args = EXTEND_ENV (SCM_CLOSURE_FORMALS (proc), args, SCM_ENV (proc));
       proc = SCM_CLOSURE_BODY (proc);
     again:
-      arg1 = proc;
-      while (!SCM_NULLP (arg1 = SCM_CDR (arg1)))
+      arg1 = SCM_CDR (proc);
+      while (!SCM_NULLP (arg1))
        {
          if (SCM_IMP (SCM_CAR (proc)))
            {
@@ -3668,6 +3669,7 @@ tail:
          else
            SCM_CEVAL (SCM_CAR (proc), args);
          proc = arg1;
+          arg1 = SCM_CDR (proc);
        }
       RETURN (EVALCAR (proc, args));
     case scm_tc7_smob:
@@ -4140,7 +4142,8 @@ scm_map (SCM proc, SCM arg1, SCM args)
        }
       return res;
     }
-  args = scm_vector (arg1 = scm_cons (arg1, args));
+  arg1 = scm_cons (arg1, args);
+  args = scm_vector (arg1);
   ve = SCM_VELTS (args);
   check_map_args (args, len, g_map, proc, arg1, s_map);
   while (1)
@@ -4202,7 +4205,8 @@ scm_for_each (SCM proc, SCM arg1, SCM args)
        }
       return SCM_UNSPECIFIED;
     }
-  args = scm_vector (arg1 = scm_cons (arg1, args));
+  arg1 = scm_cons (arg1, args);
+  args = scm_vector (arg1);
   ve = SCM_VELTS (args);
   check_map_args (args, len, g_for_each, proc, arg1, s_for_each);
   while (1)
@@ -4339,7 +4343,7 @@ SCM_DEFINE (scm_copy_tree, "copy-tree", 1, 0, 0,
   ans = tl = scm_cons_source (obj,
                              scm_copy_tree (SCM_CAR (obj)),
                              SCM_UNSPECIFIED);
-  while (obj = SCM_CDR (obj), SCM_CONSP (obj))
+  for (obj = SCM_CDR (obj); SCM_CONSP (obj); obj = SCM_CDR (obj))
     {
       SCM_SETCDR (tl, scm_cons (scm_copy_tree (SCM_CAR (obj)),
                                SCM_UNSPECIFIED));