guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-5-216-g93


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-5-216-g93dbc31
Date: Mon, 14 Dec 2009 23:21:02 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=93dbc31b9aa9442ad49cf41677bee6e9f1d24306

The branch, master has been updated
       via  93dbc31b9aa9442ad49cf41677bee6e9f1d24306 (commit)
      from  5b98517a652ea51cbb0fd03e87a50c0b3add9707 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 93dbc31b9aa9442ad49cf41677bee6e9f1d24306
Author: Andy Wingo <address@hidden>
Date:   Tue Dec 15 00:20:47 2009 +0100

    expose frame-previous, once again
    
    * libguile/frames.h:
    * libguile/frames.c (scm_frame_previous): Rename from scm_c_frame_prev,
      and expose to Scheme. Skip boot frames.
    
    * libguile/stacks.c (stack_depth, narrow_stack, scm_make_stack)
      (scm_stack_ref): Adjust for scm_frame_previous skipping boot frames.

-----------------------------------------------------------------------

Summary of changes:
 libguile/frames.c |   23 +++++++++++++++++------
 libguile/frames.h |    3 +--
 libguile/stacks.c |   20 ++++++++++----------
 3 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/libguile/frames.c b/libguile/frames.c
index e38fc00..80c556b 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -264,23 +264,34 @@ SCM_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 
1, 0, 0,
 }
 #undef FUNC_NAME
 
-extern SCM
-scm_c_frame_prev (SCM frame)
+SCM_DEFINE (scm_frame_previous, "frame-previous", 1, 0, 0,
+           (SCM frame),
+           "")
+#define FUNC_NAME s_scm_frame_previous
 {
   SCM *this_fp, *new_fp, *new_sp;
+
+  SCM_VALIDATE_VM_FRAME (1, frame);
+
+ again:
   this_fp = SCM_VM_FRAME_FP (frame);
   new_fp = SCM_FRAME_DYNAMIC_LINK (this_fp);
   if (new_fp) 
     { new_fp = RELOC (frame, new_fp);
       new_sp = SCM_FRAME_LOWER_ADDRESS (this_fp) - 1;
-      return scm_c_make_frame (SCM_VM_FRAME_STACK_HOLDER (frame),
-                               new_fp, new_sp,
-                               SCM_FRAME_RETURN_ADDRESS (this_fp),
-                               SCM_VM_FRAME_OFFSET (frame));
+      frame = scm_c_make_frame (SCM_VM_FRAME_STACK_HOLDER (frame),
+                                new_fp, new_sp,
+                                SCM_FRAME_RETURN_ADDRESS (this_fp),
+                                SCM_VM_FRAME_OFFSET (frame));
+      if (SCM_PROGRAM_IS_BOOT (scm_frame_procedure (frame)))
+        goto again;
+      else
+        return frame;
     }
   else
     return SCM_BOOL_F;
 }
+#undef FUNC_NAME
 
 
 void
diff --git a/libguile/frames.h b/libguile/frames.h
index 45ade5a..0636fe8 100644
--- a/libguile/frames.h
+++ b/libguile/frames.h
@@ -120,8 +120,7 @@ SCM_API SCM scm_frame_instruction_pointer (SCM frame);
 SCM_API SCM scm_frame_return_address (SCM frame);
 SCM_API SCM scm_frame_mv_return_address (SCM frame);
 SCM_API SCM scm_frame_dynamic_link (SCM frame);
-
-SCM_API SCM scm_c_frame_prev (SCM frame);
+SCM_API SCM scm_frame_previous (SCM frame);
 
 SCM_INTERNAL void scm_bootstrap_frames (void);
 SCM_INTERNAL void scm_init_frames (void);
diff --git a/libguile/stacks.c b/libguile/stacks.c
index 60f0159..61b7be3 100644
--- a/libguile/stacks.c
+++ b/libguile/stacks.c
@@ -69,9 +69,8 @@ stack_depth (SCM frame, SCM *fp)
   long n;
   /* count frames, skipping boot frames */
   for (; scm_is_true (frame) && SCM_VM_FRAME_FP (frame) > fp;
-       frame = scm_c_frame_prev (frame))
-    if (!SCM_PROGRAM_IS_BOOT (scm_frame_procedure (frame)))
-      ++n;
+       frame = scm_frame_previous (frame))
+    ++n;
   return n;
 }
 
@@ -112,7 +111,7 @@ narrow_stack (SCM stack, long inner, SCM inner_key, long 
outer, SCM outer_key)
       for (; inner && len; --inner)
         {
           len--;
-          frame = scm_c_frame_prev (frame);
+          frame = scm_frame_previous (frame);
         }
     }
   else
@@ -122,7 +121,7 @@ narrow_stack (SCM stack, long inner, SCM inner_key, long 
outer, SCM outer_key)
         {
           SCM proc = scm_frame_procedure (frame);
           len--;
-          frame = scm_c_frame_prev (frame);
+          frame = scm_frame_previous (frame);
           if (scm_is_eq (proc, inner_key))
             break;
         }
@@ -231,6 +230,11 @@ SCM_DEFINE (scm_make_stack, "make-stack", 1, 0, 1,
       /* not reached */
     }
 
+  /* FIXME: is this even possible? */
+  if (scm_is_true (frame)
+      && SCM_PROGRAM_IS_BOOT (scm_frame_procedure (frame)))
+    frame = scm_frame_previous (frame);
+  
   if (scm_is_false (frame))
     return SCM_BOOL_F;
 
@@ -351,11 +355,7 @@ SCM_DEFINE (scm_stack_ref, "stack-ref", 2, 0, 0,
   c_index = scm_to_unsigned_integer (index, 0, SCM_STACK_LENGTH(stack)-1);
   frame = SCM_STACK_FRAME (stack);
   while (c_index--)
-    {
-      frame = scm_c_frame_prev (frame);
-      while (SCM_PROGRAM_IS_BOOT (scm_frame_procedure (frame)))
-        frame = scm_c_frame_prev (frame);
-    }
+    frame = scm_frame_previous (frame);
   return frame;
 }
 #undef FUNC_NAME


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]