[uim-commit] r2130 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Sun Nov 13 13:47:25 PST 2005
Author: yamaken
Date: 2005-11-13 13:47:21 -0800 (Sun, 13 Nov 2005)
New Revision: 2130
Modified:
branches/r5rs/sigscheme/error.c
branches/r5rs/sigscheme/eval.c
branches/r5rs/sigscheme/operations-nonstd.c
branches/r5rs/sigscheme/sigscheme.h
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/storage-continuation.c
Log:
* sigscheme/sigscheme.h
- (SigScm_ShowBacktrace): Add argument 'trace_stack' to receive
trace stack explicitly. This is required to be used with SRFI-34
* sigscheme/error.c
- (SigScm_ShowBacktrace): Ditto
- (Scm_ThrowException, SigScm_Die): Follow the API change of
SigScm_ShowBacktrace()
* sigscheme/operations-nonstd.c
- (ScmOp_sscm_backtrace): Ditto
* sigscheme/eval.c
- (Scm_eval): Follow the API change of Scm_PushTraceFrame()
* sigscheme/sigschemeinternal.h
- (struct trace_frame): Removed
- (MAKE_TRACE_FRAME, TRACE_FRAME_OBJ, TRACE_FRAME_ENV): New macro
- (Scm_PushTraceFrame): Change argument
- (Scm_TraceStack): Change return type
* sigscheme/storage-continuation.c
- (trace_stack): Change type
- (SigScm_InitContinuation, Scm_CallWithCurrentContinuation,
Scm_PopTraceFrame): Follow the type change of trace_stack
- (Scm_PushTraceFrame):
* Change argument
* Follow the type change of trace_stack
- (Scm_TraceStack):
* Change return type
* Follow the type change of trace_stack
Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c 2005-11-13 16:05:33 UTC (rev 2129)
+++ branches/r5rs/sigscheme/error.c 2005-11-13 21:47:21 UTC (rev 2130)
@@ -72,7 +72,7 @@
if (FALSEP(CURRENT_EXCEPTION_CONTINUATION())) {
/* outermost exception handler */
if (SigScm_DebugCategories() & SCM_DBG_BACKTRACE)
- SigScm_ShowBacktrace();
+ SigScm_ShowBacktrace(Scm_TraceStack());
exit(EXIT_FAILURE);
} else {
@@ -81,7 +81,7 @@
}
#else
if (SigScm_DebugCategories() & SCM_DBG_BACKTRACE)
- SigScm_ShowBacktrace();
+ SigScm_ShowBacktrace(Scm_TraceStack());
#endif
exit(EXIT_FAILURE);
@@ -95,7 +95,7 @@
}
if (SigScm_DebugCategories() & SCM_DBG_BACKTRACE)
- SigScm_ShowBacktrace();
+ SigScm_ShowBacktrace(Scm_TraceStack());
exit(EXIT_FAILURE);
/* NOTREACHED */
@@ -148,14 +148,14 @@
Scm_ThrowException(Scm_NewStringCopying("ERROR"));
}
-void SigScm_ShowBacktrace(void)
+void SigScm_ShowBacktrace(ScmObj trace_stack)
{
#define UNBOUNDP(var, env) \
(NULLP(Scm_LookupEnvironment(var, env)) \
&& !SCM_SYMBOL_BOUNDP(var))
#if SCM_DEBUG
- const struct trace_frame *f;
+ ScmObj frame;
ScmObj env;
ScmObj obj;
ScmObj proc;
@@ -163,13 +163,13 @@
SigScm_ErrorPrintf(SCM_BACKTRACE_HEADER);
/* show each frame's obj */
- for (f = Scm_TraceStack(); f; f = f->prev) {
+ for (frame = trace_stack; !NULLP(frame); frame = CDR(frame)) {
#if SCM_DEBUG_BACKTRACE_SEP
SigScm_ErrorPrintf("------------------------------\n");
#endif /* SCM_DEBUG_BACKTRACE_SEP */
- env = f->env;
- obj = f->obj;
+ env = TRACE_FRAME_ENV(frame);
+ obj = TRACE_FRAME_OBJ(frame);
SigScm_WriteToPort(scm_current_error_port, obj);
SigScm_ErrorNewline();
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-11-13 16:05:33 UTC (rev 2129)
+++ branches/r5rs/sigscheme/eval.c 2005-11-13 21:47:21 UTC (rev 2130)
@@ -483,9 +483,7 @@
ScmEvalState state = {0};
#if SCM_DEBUG
- struct trace_frame frame;
-
- Scm_PushTraceFrame(&frame, obj, env);
+ Scm_PushTraceFrame(obj, env);
#endif
state.env = env;
Modified: branches/r5rs/sigscheme/operations-nonstd.c
===================================================================
--- branches/r5rs/sigscheme/operations-nonstd.c 2005-11-13 16:05:33 UTC (rev 2129)
+++ branches/r5rs/sigscheme/operations-nonstd.c 2005-11-13 21:47:21 UTC (rev 2130)
@@ -92,7 +92,7 @@
{
DECLARE_FUNCTION("%%backtrace", ProcedureFixed0);
- SigScm_ShowBacktrace();
+ SigScm_ShowBacktrace(Scm_TraceStack());
return SCM_UNDEF;
}
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-11-13 16:05:33 UTC (rev 2129)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-11-13 21:47:21 UTC (rev 2130)
@@ -629,7 +629,7 @@
int SigScm_Die(const char *msg, const char *filename, int line);
void SigScm_Error(const char *msg, ...) SCM_NORETURN;
void SigScm_ErrorObj(const char *msg, ScmObj obj) SCM_NORETURN;
-void SigScm_ShowBacktrace(void);
+void SigScm_ShowBacktrace(ScmObj trace_stack);
/* debug.c */
int SigScm_DebugCategories(void);
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-13 16:05:33 UTC (rev 2129)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-13 21:47:21 UTC (rev 2130)
@@ -48,13 +48,6 @@
/*=======================================
Type Definitions
=======================================*/
-/* for debugging */
-struct trace_frame {
- struct trace_frame *prev;
- ScmObj obj;
- ScmObj env;
-};
-
typedef struct ScmSpecialCharInfo_ ScmSpecialCharInfo;
struct ScmSpecialCharInfo_ {
unsigned int code; /* character code as ASCII/Unicode */
@@ -96,6 +89,11 @@
#define TRUE (!FALSE)
#endif /* TRUE */
+/* trace stack for debugging */
+#define MAKE_TRACE_FRAME(obj, env) (CONS(obj, env))
+#define TRACE_FRAME_OBJ CAR
+#define TRACE_FRAME_ENV CDR
+
/* FreeCell Handling Macros */
#if SCM_OBJ_COMPACT
#define SCM_FREECELLP(a) (SCM_CONSP(a))
@@ -344,9 +342,9 @@
ScmObj Scm_CallWithCurrentContinuation(ScmObj proc, ScmEvalState *eval_state);
void Scm_CallContinuation(ScmObj cont, ScmObj ret);
ScmObj Scm_DynamicWind(ScmObj before, ScmObj thunk, ScmObj after);
-void Scm_PushTraceFrame(struct trace_frame *frame, ScmObj obj, ScmObj env);
+void Scm_PushTraceFrame(ScmObj obj, ScmObj env);
void Scm_PopTraceFrame(void);
-const struct trace_frame *Scm_TraceStack(void);
+ScmObj Scm_TraceStack(void);
/* storage-symbol.c */
void SigScm_InitSymbol(void);
Modified: branches/r5rs/sigscheme/storage-continuation.c
===================================================================
--- branches/r5rs/sigscheme/storage-continuation.c 2005-11-13 16:05:33 UTC (rev 2129)
+++ branches/r5rs/sigscheme/storage-continuation.c 2005-11-13 21:47:21 UTC (rev 2130)
@@ -82,7 +82,7 @@
static ScmObj continuation_thrown_obj = NULL;
static ScmObj continuation_stack = NULL;
-static struct trace_frame *trace_stack = NULL;
+static ScmObj trace_stack = NULL;
/*=======================================
File Local Function Declarations
@@ -109,7 +109,7 @@
{
initialize_dynamic_extent();
initialize_continuation_env();
- trace_stack = NULL;
+ trace_stack = SCM_NULL;
}
void SigScm_FinalizeContinuation(void)
@@ -258,7 +258,7 @@
ScmObj cont = SCM_FALSE;
ScmObj ret = SCM_FALSE;
struct continuation_frame cont_frame;
- struct trace_frame *saved_trace_stack;
+ ScmObj saved_trace_stack;
cont = Scm_NewContinuation();
CONTINUATION_SET_FRAME(cont, &cont_frame);
@@ -336,20 +336,20 @@
/*============================================================================
Trace Stack
============================================================================*/
-void Scm_PushTraceFrame(struct trace_frame *frame, ScmObj obj, ScmObj env)
+void Scm_PushTraceFrame(ScmObj obj, ScmObj env)
{
- frame->prev = trace_stack;
- frame->obj = obj;
- frame->env = env;
- trace_stack = frame;
+ ScmObj frame;
+
+ frame = MAKE_TRACE_FRAME(obj, env);
+ trace_stack = CONS(frame, trace_stack);
}
void Scm_PopTraceFrame(void)
{
- trace_stack = trace_stack->prev;
+ trace_stack = CDR(trace_stack);
}
-const struct trace_frame *Scm_TraceStack(void)
+ScmObj Scm_TraceStack(void)
{
return trace_stack;
}
More information about the uim-commit
mailing list