Added eval of general scheme code and added exit proc.
This commit is contained in:
21
shell.scm
21
shell.scm
@@ -4,11 +4,26 @@
|
|||||||
(gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history"))
|
(gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history"))
|
||||||
(repl-prompt (lambda () "$ "))
|
(repl-prompt (lambda () "$ "))
|
||||||
|
|
||||||
|
(define config-file (make-parameter (string-append (or (getenv "HOME") ".") "/.hintz-shellrc")))
|
||||||
|
(when (file-exists? (config-file))
|
||||||
|
(load (config-file)))
|
||||||
|
|
||||||
|
(define exit? (make-parameter #f))
|
||||||
|
(define (exit) (exit? #t))
|
||||||
|
|
||||||
(define (shell-repl)
|
(define (shell-repl)
|
||||||
(let ((x (read)))
|
(if (exit?)
|
||||||
(if (eq? x 'exit)
|
|
||||||
#t
|
#t
|
||||||
(begin (execute (list x))
|
(let ((x (read)))
|
||||||
|
(begin (handle-exceptions
|
||||||
|
exn
|
||||||
|
(handle-exceptions
|
||||||
|
exn
|
||||||
|
(begin (print-error-message exn)
|
||||||
|
(display (with-output-to-string (lambda () (print-call-chain)))))
|
||||||
|
(execute (list x)))
|
||||||
|
(display (eval x))
|
||||||
|
(newline))
|
||||||
(newline)
|
(newline)
|
||||||
(shell-repl)))))
|
(shell-repl)))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user