summaryrefslogtreecommitdiff
path: root/2d/repl
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-01-12 14:42:59 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-01-12 14:42:59 -0500
commit8fc6bc5b72ae336796626cee454ee87b9a2e9761 (patch)
tree5c75facb37bfeffe294677d459fdd88a87dfb241 /2d/repl
parenta5aed61e0872a52a66f41b0b3d5d7df45ba3cb74 (diff)
Clean up custom REPL code.
* 2d/repl/repl.scm (add-to-repl-mvar, run-repl): Cleanup.
Diffstat (limited to '2d/repl')
-rw-r--r--2d/repl/repl.scm27
1 files changed, 12 insertions, 15 deletions
diff --git a/2d/repl/repl.scm b/2d/repl/repl.scm
index dbdabd3..9e56c74 100644
--- a/2d/repl/repl.scm
+++ b/2d/repl/repl.scm
@@ -33,9 +33,7 @@
#:use-module (2d agenda)
#:use-module (2d game)
#:use-module (2d mvars)
- #:export (repl-input-mvar
- repl-output-mvar
- start-repl
+ #:export (start-repl
run-repl))
@@ -152,11 +150,11 @@ INPUT, OUTPUT, and ERROR ports."
(with-fluids ((*repl-stack* stack))
(thunk))))))))))
-(define (add-to-repl-mvar thunk-ports-and-stack)
+(define (add-to-repl-mvar thunk input output error stack)
;; Insert thunk into repl-mvar. The game loop will schedule it and
;; run it on the next tick. We also pass along the
;; input/output/error ports and the REPL stack.
- (put-mvar repl-input-mvar thunk-ports-and-stack)
+ (put-mvar repl-input-mvar (list thunk input output error stack))
;; Read the results back from game-mvar. Will block until results
;; are available.
(take-mvar repl-output-mvar))
@@ -238,16 +236,15 @@ INPUT, OUTPUT, and ERROR ports."
(repl-parse repl exp))))))
(run-hook before-eval-hook exp)
(add-to-repl-mvar
- (list
- (lambda ()
- (call-with-error-handling
- (lambda ()
- (with-stack-and-prompt thunk))
- #:on-error (repl-option-ref repl 'on-error)))
- (current-input-port)
- (current-output-port)
- (current-error-port)
- (fluid-ref *repl-stack*))))
+ (lambda ()
+ (call-with-error-handling
+ (lambda ()
+ (with-stack-and-prompt thunk))
+ #:on-error (repl-option-ref repl 'on-error)))
+ (current-input-port)
+ (current-output-port)
+ (current-error-port)
+ (fluid-ref *repl-stack*)))
(lambda (k) (values))))
(lambda l
(for-each (lambda (v)