diff options
author | Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> | 2004-06-27 12:34:54 +0000 |
---|---|---|
committer | Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> | 2004-06-27 12:34:54 +0000 |
commit | 9fcf3cbb818cb3568f8649b6b8f8b2635caeaa6f (patch) | |
tree | 415527d595b5518767c4a7d3977ad725bf21b2b8 /libguile/debug.c | |
parent | 90df793f6794d18810de7e07b7532a2e67325145 (diff) | |
download | guile-9fcf3cbb818cb3568f8649b6b8f8b2635caeaa6f.tar.gz |
* backtrace.c (display_expression, display_frame): Call
scm_i_unmemoize_expr for unmemoizing a memoized object holding a
single memoized expression.
* debug.c (memoized_print): Don't try to unmemoize the memoized
object, since we can't know whether it holds a single expression
or a body.
(scm_mem_to_proc): Removed check for lambda expression, since it
was moot anyway. Whoever uses these functions for debugging
purposes should know what they do: Creating invalid memoized code
will cause crashes, independent of whether this check is present
or not.
(scm_proc_to_mem): Take the closure's code as it is and don't
append a SCM_IM_LAMBDA isym. To allow easier debugging, the
memoized code should not be modified.
* debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
scm_unmemoize from public use, but made scm_i_unmemoize_expr
available as a guile internal function instead. However,
scm_i_unmemoize_expr will only work on memoized objects that hold
a single memoized expression. It won't work with bodies.
* debug.c (scm_procedure_source), macros.c (macro_print), print.c
(scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
i. e. a list of expressions.
* eval.c (unmemoize_exprs): Drop internal body markers from the
output during unmemoization.
* eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
as guile internal functions instead. scm_i_unmemoize_expr will
only work on a single memoized expression, while
scm_i_unmemocopy_body will only work on bodies.
Diffstat (limited to 'libguile/debug.c')
-rw-r--r-- | libguile/debug.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/libguile/debug.c b/libguile/debug.c index ac2c4fe43..8fda04c7c 100644 --- a/libguile/debug.c +++ b/libguile/debug.c @@ -123,11 +123,7 @@ memoized_print (SCM obj, SCM port, scm_print_state *pstate) int writingp = SCM_WRITINGP (pstate); scm_puts ("#<memoized ", port); SCM_SET_WRITINGP (pstate, 1); -#ifdef GUILE_DEBUG scm_iprin1 (SCM_MEMOIZED_EXP (obj), port, pstate); -#else - scm_iprin1 (scm_unmemoize (obj), port, pstate); -#endif SCM_SET_WRITINGP (pstate, writingp); scm_putc ('>', port); return 1; @@ -246,7 +242,7 @@ SCM_DEFINE (scm_memcons, "memcons", 2, 1, 0, SCM_DEFINE (scm_mem_to_proc, "mem->proc", 1, 0, 0, (SCM obj), - "Convert a memoized object (which must be a lambda expression)\n" + "Convert a memoized object (which must represent a body)\n" "to a procedure.") #define FUNC_NAME s_scm_mem_to_proc { @@ -254,9 +250,7 @@ SCM_DEFINE (scm_mem_to_proc, "mem->proc", 1, 0, 0, SCM_VALIDATE_MEMOIZED (1, obj); env = SCM_MEMOIZED_ENV (obj); obj = SCM_MEMOIZED_EXP (obj); - if (!SCM_CONSP (obj) || !SCM_EQ_P (SCM_CAR (obj), SCM_IM_LAMBDA)) - SCM_MISC_ERROR ("expected lambda expression", scm_list_1 (obj)); - return scm_closure (SCM_CDR (obj), env); + return scm_closure (obj, env); } #undef FUNC_NAME @@ -266,20 +260,19 @@ SCM_DEFINE (scm_proc_to_mem, "proc->mem", 1, 0, 0, #define FUNC_NAME s_scm_proc_to_mem { SCM_VALIDATE_CLOSURE (1, obj); - return scm_make_memoized (scm_cons (SCM_IM_LAMBDA, SCM_CODE (obj)), - SCM_ENV (obj)); + return scm_make_memoized (SCM_CODE (obj), SCM_ENV (obj)); } #undef FUNC_NAME #endif /* GUILE_DEBUG */ -SCM_DEFINE (scm_unmemoize, "unmemoize", 1, 0, 0, +SCM_DEFINE (scm_i_unmemoize_expr, "unmemoize-expr", 1, 0, 0, (SCM m), "Unmemoize the memoized expression @var{m},") -#define FUNC_NAME s_scm_unmemoize +#define FUNC_NAME s_scm_i_unmemoize_expr { SCM_VALIDATE_MEMOIZED (1, m); - return scm_unmemocopy (SCM_MEMOIZED_EXP (m), SCM_MEMOIZED_ENV (m)); + return scm_i_unmemocopy_expr (SCM_MEMOIZED_EXP (m), SCM_MEMOIZED_ENV (m)); } #undef FUNC_NAME @@ -342,7 +335,7 @@ SCM_DEFINE (scm_procedure_source, "procedure-source", 1, 0, 0, const SCM env = SCM_EXTEND_ENV (formals, SCM_EOL, SCM_ENV (proc)); return scm_cons2 (scm_sym_lambda, scm_i_finite_list_copy (formals), - scm_unmemocopy (body, env)); + scm_i_unmemocopy_body (body, env)); } } case scm_tcs_struct: |