1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 00:30:21 +02:00

remove evaluator-traps-interface

* libguile/debug.h:
* libguile/debug.c (scm_with_traps):
* libguile/eval.c (scm_evaluator_traps, scm_evaluator_trap_table):
  Remove these procedures. Note that scm_evaluator_traps was known in
  Scheme as `evaluator-traps-interface'.

* libguile/private-options.h (SCM_TRAPS_P, SCM_ENTER_FRAME_P)
  (SCM_APPLY_FRAME_P, SCM_EXIT_FRAME_P, SCM_ENTER_FRAME_HDLR)
  (SCM_APPLY_FRAME_HDLR, SCM_EXIT_FRAME_HDLR, SCM_MEMOIZE_P)
  (SCM_MEMOIZE_HDLR): Remove these private interfaces.

* module/ice-9/boot-9.scm (traps, trap-enable, trap-disable, trap-set!):
  Remove.

* module/ice-9/scm-style-repl.scm (error-catching-loop): Remove
  with-traps wrap.

* doc/ref/api-options.texi (Low level options interfaces):
  (User level options interfaces, Evaluator trap options)
* doc/ref/api-evaluation.texi (Evaluator Behavior): Remove references to
  the evaluator traps interface.
This commit is contained in:
Andy Wingo 2010-09-24 18:44:21 +02:00
parent 178e9d237b
commit 925c1bae1f
8 changed files with 9 additions and 262 deletions

View file

@ -18,7 +18,6 @@ loading, evaluating, and compiling Scheme code at run time.
* Loading:: Loading Scheme code from file. * Loading:: Loading Scheme code from file.
* Character Encoding of Source Files:: Loading non-ASCII Scheme code from file. * Character Encoding of Source Files:: Loading non-ASCII Scheme code from file.
* Delayed Evaluation:: Postponing evaluation until it is needed. * Delayed Evaluation:: Postponing evaluation until it is needed.
* Evaluator Behaviour:: Modifying Guile's evaluator.
* VM Behaviour:: Modifying Guile's virtual machine. * VM Behaviour:: Modifying Guile's virtual machine.
@end menu @end menu
@ -789,48 +788,6 @@ value.
@end deffn @end deffn
@node Evaluator Behaviour
@subsection Evaluator Behaviour
@c FIXME::martin: Maybe this node name is bad, but the old name clashed with
@c `Evaluator options' under `Options and Config'.
The behaviour of Guile's evaluator can be modified by manipulating the
evaluator options. For more information about options, @xref{User level
options interfaces}.
@c FIXME::martin: Why aren't these procedure named like the other options
@c procedures?
@deffn {Scheme Procedure} traps [setting]
Display the current settings of the evaluator traps options. If
@var{setting} is omitted, only a short form of the current evaluator
traps options is printed. Otherwise, @var{setting} should be one of the
following symbols:
@table @code
@item help
Display the complete option settings.
@item full
Like @code{help}, but also print programmer options.
@end table
@end deffn
@deffn {Scheme Procedure} trap-enable option-name
@deffnx {Scheme Procedure} trap-disable option-name
@deffnx {Scheme Procedure} trap-set! option-name value
Modify the evaluator options. @code{trap-enable} should be used with boolean
options and switches them on, @code{trap-disable} switches them off.
@code{trap-set!} can be used to set an option to a specific value.
See @ref{Evaluator trap options} for more information on the available
trap handlers.
@end deffn
@deffn {Scheme Procedure} evaluator-traps-interface [setting]
@deffnx {C Function} scm_evaluator_traps (setting)
Option interface for the evaluator trap options.
@end deffn
@node VM Behaviour @node VM Behaviour
@subsection VM Behaviour @subsection VM Behaviour

View file

@ -392,7 +392,6 @@ configure @emph{reading}, @emph{printing}, @emph{debugging} or
* Reader options:: * Reader options::
* Printing options:: * Printing options::
* Debugger options:: * Debugger options::
* Evaluator trap options::
* Examples of option use:: * Examples of option use::
@end menu @end menu
@ -403,12 +402,9 @@ configure @emph{reading}, @emph{printing}, @emph{debugging} or
@deffn {Scheme Procedure} read-options-interface [setting] @deffn {Scheme Procedure} read-options-interface [setting]
@deffnx {Scheme Procedure} print-options-interface [setting] @deffnx {Scheme Procedure} print-options-interface [setting]
@deffnx {Scheme Procedure} debug-options-interface [setting] @deffnx {Scheme Procedure} debug-options-interface [setting]
@deffnx {Scheme Procedure} evaluator-traps-interface [setting]
@deffnx {C Function} scm_read_options (setting) @deffnx {C Function} scm_read_options (setting)
@deffnx {C Function} scm_eval_options_interface (setting)
@deffnx {C Function} scm_print_options (setting) @deffnx {C Function} scm_print_options (setting)
@deffnx {C Function} scm_debug_options (setting) @deffnx {C Function} scm_debug_options (setting)
@deffnx {C Function} scm_evaluator_traps (setting)
If one of these procedures is called with no arguments (or with If one of these procedures is called with no arguments (or with
@code{setting == SCM_UNDEFINED} in C code), it returns a list describing @code{setting == SCM_UNDEFINED} in C code), it returns a list describing
the current setting of the read, eval, print, debug or evaluator traps the current setting of the read, eval, print, debug or evaluator traps
@ -443,7 +439,6 @@ set of options.
@deffnx {Scheme Procedure} read-options [arg] @deffnx {Scheme Procedure} read-options [arg]
@deffnx {Scheme Procedure} print-options [arg] @deffnx {Scheme Procedure} print-options [arg]
@deffnx {Scheme Procedure} debug-options [arg] @deffnx {Scheme Procedure} debug-options [arg]
@deffnx {Scheme Procedure} traps [arg]
These functions list the options in their group. The optional argument These functions list the options in their group. The optional argument
@var{arg} is a symbol which modifies the form in which the options are @var{arg} is a symbol which modifies the form in which the options are
presented. presented.
@ -465,7 +460,6 @@ up?]
@deffnx {Scheme Procedure} read-enable option-symbol @deffnx {Scheme Procedure} read-enable option-symbol
@deffnx {Scheme Procedure} print-enable option-symbol @deffnx {Scheme Procedure} print-enable option-symbol
@deffnx {Scheme Procedure} debug-enable option-symbol @deffnx {Scheme Procedure} debug-enable option-symbol
@deffnx {Scheme Procedure} trap-enable option-symbol
These functions set the specified @var{option-symbol} in their options These functions set the specified @var{option-symbol} in their options
group. They only work if the option is boolean, and throw an error group. They only work if the option is boolean, and throw an error
otherwise. otherwise.
@ -476,7 +470,6 @@ otherwise.
@deffnx {Scheme Procedure} read-disable option-symbol @deffnx {Scheme Procedure} read-disable option-symbol
@deffnx {Scheme Procedure} print-disable option-symbol @deffnx {Scheme Procedure} print-disable option-symbol
@deffnx {Scheme Procedure} debug-disable option-symbol @deffnx {Scheme Procedure} debug-disable option-symbol
@deffnx {Scheme Procedure} trap-disable option-symbol
These functions turn off the specified @var{option-symbol} in their These functions turn off the specified @var{option-symbol} in their
options group. They only work if the option is boolean, and throw an options group. They only work if the option is boolean, and throw an
error otherwise. error otherwise.
@ -487,7 +480,6 @@ error otherwise.
@deffnx syntax read-set! option-symbol value @deffnx syntax read-set! option-symbol value
@deffnx syntax print-set! option-symbol value @deffnx syntax print-set! option-symbol value
@deffnx syntax debug-set! option-symbol value @deffnx syntax debug-set! option-symbol value
@deffnx syntax trap-set! option-symbol value
These functions set a non-boolean @var{option-symbol} to the specified These functions set a non-boolean @var{option-symbol} to the specified
@var{value}. @var{value}.
@end deffn @end deffn
@ -546,101 +538,6 @@ closure-hook #f Hook for printing closures.
@end smallexample @end smallexample
@node Evaluator trap options
@subsubsection Evaluator trap options
[FIXME: These flags, together with their corresponding handlers, are not
user level options. Probably this entire section should be moved to the
documentation about the low-level programmer debugging interface.]
Here is the list of evaluator trap options generated by typing
@code{(traps 'full)} in Guile. You can also see the default values.
@smallexample
exit-frame no Trap when exiting eval or apply.
apply-frame no Trap when entering apply.
enter-frame no Trap when eval enters new frame.
memoize-symbol no Trap when eval memoizes a symbol's value
traps yes Enable evaluator traps.
@end smallexample
@deffn apply-frame-handler key cont tailp
Called when a procedure is being applied.
Called if:
@itemize @bullet
@item
evaluator traps are enabled [traps interface], and
@item
either
@itemize @minus
@item
@code{apply-frame} is enabled [traps interface], or
@item
trace mode is on [debug-options interface], and the procedure being
called has the trace property enabled.
@end itemize
@end itemize
@var{cont} is a ``debug object'', which means that it can be passed to
@code{make-stack} to discover the stack at the point of the trap. The
apply frame handler's code can capture a restartable continuation if it
wants to by using @code{call-with-current-continuation} in the usual way.
@var{tailp} is true if this is a tail call
@end deffn
@deffn exit-frame-handler key cont retval
Called when a value is returned from a procedure.
Called if:
@itemize @bullet
@item
evaluator traps are enabled [traps interface], and
@item
either
@itemize @minus
@item
@code{exit-frame} is enabled [traps interface], or
@item
trace mode is on [debug-options interface], and the procedure being
called has the trace property enabled.
@end itemize
@end itemize
@var{cont} is a ``debug object'', which means that it can be passed to
@code{make-stack} to discover the stack at the point of the trap. The
exit frame handler's code can capture a restartable continuation if it
wants to by using @code{call-with-current-continuation} in the usual
way.
@var{retval} is the return value.
@end deffn
@deffn memoize-symbol-handler key cont expression env
Called when the evaluator memoizes the value of a procedure symbol
@var{cont} is a ``debug object'', which means that it can be passed to
@code{make-stack} to discover the stack at the point of the trap. The
exit frame handler's code can capture a restartable continuation if it
wants to by using @code{call-with-current-continuation} in the usual
way.
@var{retval} is the return value.
@end deffn
@deffn {Scheme Procedure} with-traps thunk
@deffnx {C Function} scm_with_traps (thunk)
Call @var{thunk} with traps enabled.
@end deffn
@deffn {Scheme Procedure} debug-object? obj
@deffnx {C Function} scm_debug_object_p (obj)
Return @code{#t} if @var{obj} is a debug object.
@end deffn
@node Debugger options @node Debugger options
@subsubsection Debugger options @subsubsection Debugger options

View file

@ -89,44 +89,6 @@ SCM_DEFINE (scm_debug_options, "debug-options-interface", 0, 1, 0,
} }
#undef FUNC_NAME #undef FUNC_NAME
static void
with_traps_before (void *data)
{
int *trap_flag = data;
*trap_flag = SCM_TRAPS_P;
SCM_TRAPS_P = 1;
}
static void
with_traps_after (void *data)
{
int *trap_flag = data;
SCM_TRAPS_P = *trap_flag;
}
static SCM
with_traps_inner (void *data)
{
SCM thunk = SCM_PACK ((scm_t_bits) data);
return scm_call_0 (thunk);
}
SCM_DEFINE (scm_with_traps, "with-traps", 1, 0, 0,
(SCM thunk),
"Call @var{thunk} with traps enabled.")
#define FUNC_NAME s_scm_with_traps
{
int trap_flag;
SCM_VALIDATE_THUNK (1, thunk);
return scm_internal_dynamic_wind (with_traps_before,
with_traps_inner,
with_traps_after,
(void *) SCM_UNPACK (thunk),
&trap_flag);
}
#undef FUNC_NAME
SCM_SYMBOL (scm_sym_source, "source"); SCM_SYMBOL (scm_sym_source, "source");

View file

@ -44,8 +44,6 @@ typedef union scm_t_debug_info
SCM_API SCM scm_reverse_lookup (SCM env, SCM data); SCM_API SCM scm_reverse_lookup (SCM env, SCM data);
SCM_API SCM scm_procedure_source (SCM proc); SCM_API SCM scm_procedure_source (SCM proc);
SCM_API SCM scm_procedure_name (SCM proc); SCM_API SCM scm_procedure_name (SCM proc);
SCM_API SCM scm_with_traps (SCM thunk);
SCM_API SCM scm_evaluator_traps (SCM setting);
SCM_API SCM scm_debug_options (SCM setting); SCM_API SCM scm_debug_options (SCM setting);
SCM_INTERNAL void scm_init_debug (void); SCM_INTERNAL void scm_init_debug (void);

View file

@ -478,48 +478,6 @@ scm_t_option scm_debug_opts[] = {
}; };
/*
* this ordering is awkward and illogical, but we maintain it for
* compatibility. --hwn
*/
scm_t_option scm_evaluator_trap_table[] = {
{ SCM_OPTION_BOOLEAN, "traps", 0, "Enable evaluator traps." },
{ SCM_OPTION_BOOLEAN, "enter-frame", 0, "Trap when eval enters new frame." },
{ SCM_OPTION_BOOLEAN, "apply-frame", 0, "Trap when entering apply." },
{ SCM_OPTION_BOOLEAN, "exit-frame", 0, "Trap when exiting eval or apply." },
{ SCM_OPTION_SCM, "enter-frame-handler", (unsigned long)SCM_BOOL_F, "Handler for enter-frame traps." },
{ SCM_OPTION_SCM, "apply-frame-handler", (unsigned long)SCM_BOOL_F, "Handler for apply-frame traps." },
{ SCM_OPTION_SCM, "exit-frame-handler", (unsigned long)SCM_BOOL_F, "Handler for exit-frame traps." },
{ SCM_OPTION_BOOLEAN, "memoize-symbol", 0, "Trap when memoizing a symbol." },
{ SCM_OPTION_SCM, "memoize-symbol-handler", (unsigned long)SCM_BOOL_F, "The handler for memoization." },
{ 0 }
};
SCM_DEFINE (scm_evaluator_traps, "evaluator-traps-interface", 0, 1, 0,
(SCM setting),
"Option interface for the evaluator trap options.")
#define FUNC_NAME s_scm_evaluator_traps
{
SCM ans;
scm_options_try (setting,
scm_evaluator_trap_table,
FUNC_NAME, 1);
SCM_CRITICAL_SECTION_START;
ans = scm_options (setting,
scm_evaluator_trap_table,
FUNC_NAME);
/* njrev: same again. */
SCM_CRITICAL_SECTION_END;
return ans;
}
#undef FUNC_NAME
/* Simple procedure calls /* Simple procedure calls
@ -1111,9 +1069,6 @@ scm_init_eval ()
{ {
SCM primitive_eval; SCM primitive_eval;
scm_init_opts (scm_evaluator_traps,
scm_evaluator_trap_table);
f_apply = scm_c_define_gsubr ("apply", 2, 0, 1, scm_apply); f_apply = scm_c_define_gsubr ("apply", 2, 0, 1, scm_apply);
scm_tc16_boot_closure = scm_make_smob_type ("boot-closure", 0); scm_tc16_boot_closure = scm_make_smob_type ("boot-closure", 0);

View file

@ -25,21 +25,6 @@
#ifndef PRIVATE_OPTIONS #ifndef PRIVATE_OPTIONS
#define PRIVATE_OPTIONS #define PRIVATE_OPTIONS
/*
evaluator
*/
SCM_API scm_t_option scm_evaluator_trap_table[];
#define SCM_TRAPS_P scm_evaluator_trap_table[0].val
#define SCM_ENTER_FRAME_P scm_evaluator_trap_table[1].val
#define SCM_APPLY_FRAME_P scm_evaluator_trap_table[2].val
#define SCM_EXIT_FRAME_P scm_evaluator_trap_table[3].val
#define SCM_ENTER_FRAME_HDLR (SCM_PACK (scm_evaluator_trap_table[4].val))
#define SCM_APPLY_FRAME_HDLR (SCM_PACK (scm_evaluator_trap_table[5].val))
#define SCM_EXIT_FRAME_HDLR (SCM_PACK (scm_evaluator_trap_table[6].val))
#define SCM_MEMOIZE_P scm_evaluator_trap_table[7].val
#define SCM_MEMOIZE_HDLR (SCM_PACK (scm_evaluator_trap_table[8].val))
/* /*
debugging. debugging.
*/ */

View file

@ -2649,11 +2649,6 @@ module '(ice-9 q) '(make-q q-length))}."
(debug-options debug-enable debug-disable) (debug-options debug-enable debug-disable)
(debug-set!))) (debug-set!)))
(define-option-interface
(evaluator-traps-interface
(traps trap-enable trap-disable)
(trap-set!)))
(define-option-interface (define-option-interface
(read-options-interface (read-options-interface
(read-options read-enable read-disable) (read-options read-enable read-disable)

View file

@ -81,18 +81,16 @@
(lambda () (lambda ()
(call-with-unblocked-asyncs (call-with-unblocked-asyncs
(lambda () (lambda ()
(with-traps (first)
(lambda ()
(first)
;; This line is needed because mark ;; This line is needed because mark
;; doesn't do closures quite right. ;; doesn't do closures quite right.
;; Unreferenced locals should be ;; Unreferenced locals should be
;; collected. ;; collected.
(set! first #f) (set! first #f)
(let loop ((v (thunk))) (let loop ((v (thunk)))
(loop (thunk))) (loop (thunk)))
#f))))) #f)))
(lambda (key . args) (lambda (key . args)
(case key (case key