diff --git a/scheme/inspector.scm b/scheme/inspector.scm index fb7bb37..5f8f70a 100644 --- a/scheme/inspector.scm +++ b/scheme/inspector.scm @@ -99,9 +99,6 @@ -(define (inspect-value val) - (error "not yet")) - (define key-d 100) (define key-u 117) (define key-return 10) @@ -136,7 +133,8 @@ (define (inspect-next-continuation) (if (continuation? val) (push-val! (continuation-parent val)) - (set-header-message! header + (set-header-message! + header "Can't go down from a non-continuation."))) (define (pop-val!) @@ -206,4 +204,15 @@ (debug-message "inspector did not handle message " message)))))) (register-plugin! - (make-view-plugin make-inspector exception-continuation?)) + (make-view-plugin make-inspector + exception-continuation?)) + +(define-record-type inspection-object :inspection-object + (make-inspection-object val) + inspection-object? + (val inspection-object-val)) + +(register-plugin! + (make-view-plugin (lambda (iv buffer) + (make-inspector (inspection-object-val iv) buffer)) + inspection-object?)) \ No newline at end of file diff --git a/scheme/nuit-engine.scm b/scheme/nuit-engine.scm index 5548d9d..bd9a00d 100644 --- a/scheme/nuit-engine.scm +++ b/scheme/nuit-engine.scm @@ -288,8 +288,9 @@ (define (eval-command-in-scheme-mode command-line) - (with-fatal-error-handler* - display-error-and-continue + (with-fatal-and-capturing-error-handler + (lambda (condition raw-continuation continuation decline) + raw-continuation) (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 ad74e2d..3f46113 100644 --- a/scheme/nuit-packages.scm +++ b/scheme/nuit-packages.scm @@ -432,10 +432,13 @@ ;;; inspector -(define-interface nuit-inspector-interface - (export inspect-value)) +(define-interface inspection-objects-interface + (export make-inspection-object + inspection-object?)) -(define-structure nuit-inspector-plugin nuit-inspector-interface +(define-structures + ((nuit-inspector-plugin (export)) + (inspection-objects inspection-objects-interface)) (open scheme inspector-internal continuations @@ -514,6 +517,7 @@ package-commands-internal package-mutation + inspection-objects eval-environment) (files scheme-commands)) diff --git a/scheme/scheme-commands.scm b/scheme/scheme-commands.scm index d0862ad..58dcdbd 100644 --- a/scheme/scheme-commands.scm +++ b/scheme/scheme-commands.scm @@ -2,7 +2,7 @@ (define (split-scheme-command-line command-line) (let ((tokens (string-tokenize command-line))) - (values (string->symbol (string-drop (car tokens) 1)) + (values (string-drop (car tokens) 1) (cdr tokens)))) (define (scheme-command-line? command-line) @@ -10,8 +10,8 @@ command-prefix)) (define (eval-scheme-command command args) - (case command - ((in) + (case (string->symbol command) + ((in) (set-evaluation-package! (string->symbol (car args))) (string-append "moved to package " (car args))) ((open) @@ -24,4 +24,11 @@ ((user) (set-evaluation-package! 'nuit-eval) "moved to package nuit-eval") - (else (error "unknwon scheme command")))) + ((inspect) + (if (null? args) + ",inspect requires an argument" + (make-inspection-object + (eval-string (string-join args))))) + ((exit) + (exit)) + (else (error "unknwon scheme command" command))))