summaryrefslogtreecommitdiff
path: root/libguile/frames.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-12-15 00:20:47 +0100
committerAndy Wingo <wingo@pobox.com>2009-12-15 00:22:02 +0100
commit93dbc31b9aa9442ad49cf41677bee6e9f1d24306 (patch)
tree8623d93229abde54753eb2e3de75404a94ece118 /libguile/frames.c
parent5b98517a652ea51cbb0fd03e87a50c0b3add9707 (diff)
downloadguile-93dbc31b9aa9442ad49cf41677bee6e9f1d24306.tar.gz
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.
Diffstat (limited to 'libguile/frames.c')
-rw-r--r--libguile/frames.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libguile/frames.c b/libguile/frames.c
index e38fc00ac..80c556b45 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