mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-11 23:17:34 +02:00
Guarding @import expressions from the repl.
This commit is contained in:
parent
4452607836
commit
b840602d6c
1 changed files with 31 additions and 26 deletions
|
@ -195,18 +195,23 @@
|
|||
(mod+imps (eval `(resolve-import ',mod-name)
|
||||
meta-env)))
|
||||
(if (pair? mod+imps)
|
||||
(let ((env (if (eq? op 'import-only)
|
||||
(let ((env (make-environment)))
|
||||
(interaction-environment env)
|
||||
env)
|
||||
env))
|
||||
(imp-env
|
||||
(vector-ref
|
||||
(eval `(load-module ',(car mod+imps))
|
||||
meta-env)
|
||||
1)))
|
||||
(%import env imp-env (cdr mod+imps) #f)
|
||||
(continue module env meta-env))
|
||||
(guard
|
||||
(exn
|
||||
(else
|
||||
(print-exception exn (current-error-port))
|
||||
(fail "error loading module:" mod-name)))
|
||||
(let ((env (if (eq? op 'import-only)
|
||||
(let ((env (make-environment)))
|
||||
(interaction-environment env)
|
||||
env)
|
||||
env))
|
||||
(imp-env
|
||||
(vector-ref
|
||||
(eval `(load-module ',(car mod+imps))
|
||||
meta-env)
|
||||
1)))
|
||||
(%import env imp-env (cdr mod+imps) #f)
|
||||
(continue module env meta-env)))
|
||||
(fail "couldn't find module:" mod-name))))
|
||||
((in)
|
||||
(let ((name (read/ss in)))
|
||||
|
@ -269,20 +274,20 @@
|
|||
(for-each
|
||||
(lambda (expr)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(eval (list 'begin expr) env))
|
||||
(lambda res-list
|
||||
(cond
|
||||
((not (or (null? res-list)
|
||||
(equal? res-list
|
||||
(list (if #f #f)))))
|
||||
(write/ss (car res-list) out)
|
||||
(for-each
|
||||
(lambda (res)
|
||||
(write-char #\space out)
|
||||
(write/ss res out))
|
||||
(cdr res-list))
|
||||
(newline out))))))
|
||||
(lambda ()
|
||||
(eval (list 'begin expr) env))
|
||||
(lambda res-list
|
||||
(cond
|
||||
((not (or (null? res-list)
|
||||
(equal? res-list
|
||||
(list (if #f #f)))))
|
||||
(write/ss (car res-list) out)
|
||||
(for-each
|
||||
(lambda (res)
|
||||
(write-char #\space out)
|
||||
(write/ss res out))
|
||||
(cdr res-list))
|
||||
(newline out))))))
|
||||
expr-list))))))
|
||||
;; If an interrupt occurs while the child thread is
|
||||
;; still running, terminate it, otherwise wait for it
|
||||
|
|
Loading…
Add table
Reference in a new issue