From d0624e391be5f644a301e31df9ea54386e2cd7e5 Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Wed, 4 Jun 2003 05:28:34 +0000 Subject: [PATCH] * __scm.h, gc-card.c (SCM_DEBUG_DEBUGGER_SUPPORT, SCM_DEBUG_DEBUGGING_SUPPORT): Renamed macro SCM_DEBUG_DEBUGGER_SUPPORT to SCM_DEBUG_DEBUGGING_SUPPORT and generalized it to apply not only to C level functions but also to scheme level functions. * debug.c, debug.h, eval.c (make-iloc, scm_make_iloc, iloc?, scm_iloc_p, dbg-make-iloc, scm_dbg_make_iloc, dbg-iloc?, scm_dbg_iloc_p): Moved functions scm_make_iloc, scm_iloc_p to eval.c, made them available under SCM_DEBUG_DEBUGGING_SUPPORT == 1 only and renamed them to scm_dbg_make_iloc, scm_dbg_iloc_p, respectively. * deprecated.h, eval.c, eval.h (SCM_ILOC00, SCM_IDINC, SCM_IDSTMSK): Deprecated. The macro definitions are moved from eval.h into eval.c and a copy is placed into deprecated.h. * eval.c, eval.h (SCM_MAKE_ILOC): Removed from eval.h and placed into eval.c. This definition was not part of the API in any officially released version of guile and thus does not need to go through a phase of deprecation. --- NEWS | 5 +++++ libguile/ChangeLog | 34 +++++++++++++++++++++++++----- libguile/__scm.h | 25 +++++++++++----------- libguile/debug.c | 23 -------------------- libguile/debug.h | 2 -- libguile/deprecated.h | 7 +++++++ libguile/eval.c | 49 +++++++++++++++++++++++++++++++++++++++++++ libguile/eval.h | 9 -------- libguile/gc-card.c | 2 +- 9 files changed, 104 insertions(+), 52 deletions(-) diff --git a/NEWS b/NEWS index cb6c3ffe7..741eb37aa 100644 --- a/NEWS +++ b/NEWS @@ -867,6 +867,11 @@ SCM_EVALIM, SCM_XEVAL, SCM_XEVALCAR These macros were used in the implementation of the evaluator. It's unlikely that they have been used by user code. +** Deprecated macros for iloc handling: SCM_ILOC00, SCM_IDINC, SCM_IDSTMSK + +These macros were used in the implementation of the evaluator. It's unlikely +that they have been used by user code. + ** Removed definitions: scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify, scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify, scm_m_1_ify, scm_debug_newcell, diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 397929857..16bc52577 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,13 +1,37 @@ +2003-06-04 Dirk Herrmann + + * __scm.h, gc-card.c (SCM_DEBUG_DEBUGGER_SUPPORT, + SCM_DEBUG_DEBUGGING_SUPPORT): Renamed macro + SCM_DEBUG_DEBUGGER_SUPPORT to SCM_DEBUG_DEBUGGING_SUPPORT and + generalized it to apply not only to C level functions but also to + scheme level functions. + + * debug.c, debug.h, eval.c (make-iloc, scm_make_iloc, iloc?, + scm_iloc_p, dbg-make-iloc, scm_dbg_make_iloc, dbg-iloc?, + scm_dbg_iloc_p): Moved functions scm_make_iloc, scm_iloc_p to + eval.c, made them available under SCM_DEBUG_DEBUGGING_SUPPORT == 1 + only and renamed them to scm_dbg_make_iloc, scm_dbg_iloc_p, + respectively. + + * deprecated.h, eval.c, eval.h (SCM_ILOC00, SCM_IDINC, + SCM_IDSTMSK): Deprecated. The macro definitions are moved from + eval.h into eval.c and a copy is placed into deprecated.h. + + * eval.c, eval.h (SCM_MAKE_ILOC): Removed from eval.h and placed + into eval.c. This definition was not part of the API in any + officially released version of guile and thus does not need to go + through a phase of deprecation. + 2003-06-02 Dirk Herrmann - * deprecated.c, deprecated.h, eval.c, eval.h: Deprecated - scm_s_expression, scm_s_test, scm_s_body, scm_s_bindings, - scm_s_variable, scm_s_clauses, scm_s_formals. In eval.c the + * deprecated.c, deprecated.h, eval.c, eval.h (scm_s_expression, + scm_s_test, scm_s_body, scm_s_bindings, scm_s_variable, + scm_s_clauses, scm_s_formals): Deprecated. In eval.c the definitions are make static and renamed from scm_s_xxx to s_xxx. In deprecated.c the original definitions are copied. - * deprecated.h, eval.c, eval: Deprecated SCM_EVALIM2, SCM_EVALIM, - SCM_XEVAL and SCM_XEVALCAR. The macro definitions are moved from + * deprecated.h, eval.c, eval (SCM_EVALIM2, SCM_EVALIM, SCM_XEVAL, + SCM_XEVALCAR): Deprecated. The macro definitions are moved from eval.h into eval.c and a copy (slightly modified to work in user code) is placed into deprecated.h. diff --git a/libguile/__scm.h b/libguile/__scm.h index a2cf5de71..94113496b 100644 --- a/libguile/__scm.h +++ b/libguile/__scm.h @@ -256,19 +256,20 @@ #define SCM_DEBUG_TYPING_STRICTNESS 1 #endif -/* If SCM_DEBUG_DEBUGGER_SUPPORT is set to 1, guile will provide a set of - * special functions that support debugging with a debugger like gdb. The - * behaviour of guile is not changed by this macro, only the set of functions - * that are available will differ. All functions that are introduced this way - * have the prefix 'scm_dbg_'. This allows to easily determine the set of - * support functions, given that your debugger provides automatic name - * completion. Note that these functions are intended to be used during - * interactive debugging sessions only. They are not considered part of - * guile's official API. They may change or disappear without notice or - * deprecation phase. +/* If SCM_DEBUG_DEBUGGING_SUPPORT is set to 1, guile will provide a set of + * special functions that support debugging with a debugger like gdb or + * debugging of guile internals on the scheme level. The behaviour of guile + * is not changed by this macro, only the set of functions that are available + * will differ. All functions that are introduced this way have the prefix + * 'scm_dbg_' on the C level and the prefix 'dbg-' on the scheme level. This + * allows to easily determine the set of support functions, given that your + * debugger or repl provide automatic name completion. Note that these + * functions are intended to be used during interactive debugging sessions + * only. They are not considered part of guile's official API. They may + * change or disappear without notice or deprecation phase. */ -#ifndef SCM_DEBUG_DEBUGGER_SUPPORT -#define SCM_DEBUG_DEBUGGER_SUPPORT SCM_DEBUG +#ifndef SCM_DEBUG_DEBUGGING_SUPPORT +#define SCM_DEBUG_DEBUGGING_SUPPORT SCM_DEBUG #endif diff --git a/libguile/debug.c b/libguile/debug.c index c9ced6fed..2ec0a0c8c 100644 --- a/libguile/debug.c +++ b/libguile/debug.c @@ -211,29 +211,6 @@ scm_make_memoized (SCM exp, SCM env) #include "libguile/variable.h" #include "libguile/procs.h" -SCM_DEFINE (scm_make_iloc, "make-iloc", 3, 0, 0, - (SCM frame, SCM binding, SCM cdrp), - "Return a new iloc with frame offset @var{frame}, binding\n" - "offset @var{binding} and the cdr flag @var{cdrp}.") -#define FUNC_NAME s_scm_make_iloc -{ - SCM_VALIDATE_INUM (1, frame); - SCM_VALIDATE_INUM (2, binding); - return SCM_MAKE_ILOC (SCM_INUM (frame), - SCM_INUM (binding), - !SCM_FALSEP (cdrp)); -} -#undef FUNC_NAME - -SCM_DEFINE (scm_iloc_p, "iloc?", 1, 0, 0, - (SCM obj), - "Return @code{#t} if @var{obj} is an iloc.") -#define FUNC_NAME s_scm_iloc_p -{ - return SCM_BOOL(SCM_ILOCP (obj)); -} -#undef FUNC_NAME - SCM_DEFINE (scm_memcons, "memcons", 2, 1, 0, (SCM car, SCM cdr, SCM env), "Return a new memoized cons cell with @var{car} and @var{cdr}\n" diff --git a/libguile/debug.h b/libguile/debug.h index 96d69ac25..ee272629d 100644 --- a/libguile/debug.h +++ b/libguile/debug.h @@ -170,8 +170,6 @@ SCM_API SCM scm_make_debugobj (scm_t_debug_frame *debug); SCM_API void scm_init_debug (void); #ifdef GUILE_DEBUG -SCM_API SCM scm_make_iloc (SCM frame, SCM binding, SCM cdrp); -SCM_API SCM scm_iloc_p (SCM obj); SCM_API SCM scm_memcons (SCM car, SCM cdr, SCM env); SCM_API SCM scm_mem_to_proc (SCM obj); SCM_API SCM scm_proc_to_mem (SCM obj); diff --git a/libguile/deprecated.h b/libguile/deprecated.h index 5c20c786d..981e9823d 100644 --- a/libguile/deprecated.h +++ b/libguile/deprecated.h @@ -27,6 +27,13 @@ #if (SCM_ENABLE_DEPRECATED == 1) +/* From eval.h: Macros for handling ilocs. These were deprecated in guile + * 1.7.0 on 2003-06-04. */ +#define SCM_ILOC00 SCM_MAKE_ITAG8(0L, scm_tc8_iloc) +#define SCM_IDINC (0x00100000L) +#define SCM_IDSTMSK (-SCM_IDINC) + + /* From eval.h: Error messages of the evaluator. These were deprecated in * guile 1.7.0 on 2003-06-02. */ SCM_API const char scm_s_expression[]; diff --git a/libguile/eval.c b/libguile/eval.c index ceaa8e13c..60e82d54d 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -85,6 +85,55 @@ char *alloca (); +/* {Ilocs} + * + * Ilocs are memoized references to variables in local environment frames. + * They are represented as three values: The relative offset of the + * environment frame, the number of the binding within that frame, and a + * boolean value indicating whether the binding is the last binding in the + * frame. + */ +#define SCM_ILOC00 SCM_MAKE_ITAG8(0L, scm_tc8_iloc) +#define SCM_IDINC (0x00100000L) +#define SCM_IDSTMSK (-SCM_IDINC) +#define SCM_MAKE_ILOC(frame_nr, binding_nr, last_p) \ + SCM_PACK ( \ + ((frame_nr) << 8) \ + + ((binding_nr) << 20) \ + + ((last_p) ? SCM_ICDR : 0) \ + + scm_tc8_iloc ) + +#if (SCM_DEBUG_DEBUGGING_SUPPORT == 1) + +SCM scm_dbg_make_iloc (SCM frame, SCM binding, SCM cdrp); +SCM_DEFINE (scm_dbg_make_iloc, "dbg-make-iloc", 3, 0, 0, + (SCM frame, SCM binding, SCM cdrp), + "Return a new iloc with frame offset @var{frame}, binding\n" + "offset @var{binding} and the cdr flag @var{cdrp}.") +#define FUNC_NAME s_scm_dbg_make_iloc +{ + SCM_VALIDATE_INUM (1, frame); + SCM_VALIDATE_INUM (2, binding); + return SCM_MAKE_ILOC (SCM_INUM (frame), + SCM_INUM (binding), + !SCM_FALSEP (cdrp)); +} +#undef FUNC_NAME + +SCM scm_dbg_iloc_p (SCM obj); +SCM_DEFINE (scm_dbg_iloc_p, "dbg-iloc?", 1, 0, 0, + (SCM obj), + "Return @code{#t} if @var{obj} is an iloc.") +#define FUNC_NAME s_scm_dbg_iloc_p +{ + return SCM_BOOL (SCM_ILOCP (obj)); +} +#undef FUNC_NAME + +#endif + + + #define SCM_VALIDATE_NON_EMPTY_COMBINATION(x) \ do { \ if (SCM_EQ_P ((x), SCM_EOL)) \ diff --git a/libguile/eval.h b/libguile/eval.h index b9ff5743b..c6f7a9bc3 100644 --- a/libguile/eval.h +++ b/libguile/eval.h @@ -59,21 +59,12 @@ SCM_API SCM scm_eval_options_interface (SCM setting); * */ #define SCM_ILOCP(n) (SCM_ITAG8(n)==scm_tc8_iloc) -#define SCM_ILOC00 SCM_MAKE_ITAG8(0L, scm_tc8_iloc) -#define SCM_IDINC (0x00100000L) #define SCM_ICDR (0x00080000L) #define SCM_IFRINC (0x00000100L) -#define SCM_IDSTMSK (-SCM_IDINC) #define SCM_IFRAME(n) ((long)((SCM_ICDR-SCM_IFRINC)>>8) \ & (SCM_UNPACK (n) >> 8)) #define SCM_IDIST(n) (SCM_UNPACK (n) >> 20) #define SCM_ICDRP(n) (SCM_ICDR & SCM_UNPACK (n)) -#define SCM_MAKE_ILOC(frame_nr, binding_nr, last_p) \ - SCM_PACK ( \ - ((frame_nr) << 8) \ - + ((binding_nr) << 20) \ - + ((last_p) ? SCM_ICDR : 0) \ - + scm_tc8_iloc ) diff --git a/libguile/gc-card.c b/libguile/gc-card.c index a1dd86692..0deb1667c 100644 --- a/libguile/gc-card.c +++ b/libguile/gc-card.c @@ -325,7 +325,7 @@ scm_i_init_card_freelist (scm_t_cell * card, SCM *free_list, } -#if (SCM_DEBUG_DEBUGGER_SUPPORT == 1) +#if (SCM_DEBUG_DEBUGGING_SUPPORT == 1) typedef struct scm_dbg_t_list_cell { scm_t_bits car;