Added eval of general scheme code and added exit proc.
This commit is contained in:
25
shell.scm
25
shell.scm
@@ -4,12 +4,27 @@
|
||||
(gnu-history-install-file-manager (string-append (or (getenv "HOME") ".") "/.csi.history"))
|
||||
(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)
|
||||
(let ((x (read)))
|
||||
(if (eq? x 'exit)
|
||||
(if (exit?)
|
||||
#t
|
||||
(begin (execute (list x))
|
||||
(newline)
|
||||
(shell-repl)))))
|
||||
(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)
|
||||
(shell-repl)))))
|
||||
|
||||
(shell-repl)
|
||||
Reference in New Issue
Block a user