From 85a258237ce97878e09ae3149b0e1e47929709b5 Mon Sep 17 00:00:00 2001 From: eknauel Date: Tue, 27 Sep 2005 16:33:27 +0000 Subject: [PATCH] Introduce with-inspector-handler to turn an exception into a value for the inspector part of darcs patch Thu Sep 22 14:13:30 EEST 2005 Martin Gasbichler --- scheme/eval-environment.scm | 8 ++------ scheme/inspector.scm | 11 +++++++---- scheme/nuit-engine.scm | 4 +--- scheme/nuit-packages.scm | 9 ++++++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scheme/eval-environment.scm b/scheme/eval-environment.scm index b63aaf9..10ac017 100644 --- a/scheme/eval-environment.scm +++ b/scheme/eval-environment.scm @@ -17,17 +17,13 @@ (read string-port))) (define (eval-string str) - (with-fatal-and-capturing-error-handler - (lambda (condition raw-continuation continuation decline) - raw-continuation) + (with-inspector-handler (lambda () (eval (read-sexp-from-string str) (evaluation-environment))))) (define (eval-s-expr s-expr) - (with-fatal-and-capturing-error-handler - (lambda (condition raw-continuation continuation decline) - raw-continuation) + (with-inspector-handler (lambda () (eval s-expr (evaluation-environment))))) diff --git a/scheme/inspector.scm b/scheme/inspector.scm index c11dbdd..ae7c603 100644 --- a/scheme/inspector.scm +++ b/scheme/inspector.scm @@ -207,9 +207,6 @@ (else (debug-message "inspector did not handle message " message)))))) -(register-plugin! - (make-view-plugin make-inspector - exception-continuation?)) (define-record-type inspection-object :inspection-object (make-inspection-object val) @@ -219,4 +216,10 @@ (register-plugin! (make-view-plugin (lambda (iv buffer) (make-inspector (inspection-object-val iv) buffer)) - inspection-object?)) \ No newline at end of file + inspection-object?)) + +(define (with-inspector-handler thunk) + (with-fatal-and-capturing-error-handler + (lambda (condition raw-continuation continuation decline) + (make-inspection-object (cons condition raw-continuation))) + thunk)) \ No newline at end of file diff --git a/scheme/nuit-engine.scm b/scheme/nuit-engine.scm index bd9a00d..d06d58a 100644 --- a/scheme/nuit-engine.scm +++ b/scheme/nuit-engine.scm @@ -288,9 +288,7 @@ (define (eval-command-in-scheme-mode command-line) - (with-fatal-and-capturing-error-handler - (lambda (condition raw-continuation continuation decline) - raw-continuation) + (with-inspector-handler (lambda () (if (scheme-command-line? command-line) (process-scheme-command command-line) diff --git a/scheme/nuit-packages.scm b/scheme/nuit-packages.scm index 3f46113..a4e1ebf 100644 --- a/scheme/nuit-packages.scm +++ b/scheme/nuit-packages.scm @@ -433,7 +433,8 @@ ;;; inspector (define-interface inspection-objects-interface - (export make-inspection-object + (export with-inspector-handler + make-inspection-object inspection-object?)) (define-structures @@ -451,6 +452,7 @@ (subset srfi-13 (string-join)) debug-data (subset disclosers (template-debug-data)) + inspect-exception focus-table ncurses @@ -499,7 +501,7 @@ (open scheme srfi-6 - inspect-exception + inspection-objects rt-modules) (files eval-environment)) @@ -912,7 +914,7 @@ srfi-8 srfi-13 debugging - inspect-exception + inspection-objects tty-debug threads rendezvous @@ -928,6 +930,7 @@ initial-tty nuit-windows modal-window + inspect-exception configuration command-line-parser