From 582b6be470dd10a80fd8a4a31bce3d92e4b509f2 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 2 Sep 2013 17:14:31 -0400 Subject: Pass along the *repl-stack* fluid so that nested REPLs work right. --- 2d/game-loop.scm | 7 +++++-- 2d/repl/repl.scm | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/2d/game-loop.scm b/2d/game-loop.scm index 844ddb5..af4966f 100644 --- a/2d/game-loop.scm +++ b/2d/game-loop.scm @@ -172,14 +172,17 @@ is the unused accumulator time." (define (time-left current-time next-time) (max (floor (- next-time current-time)) 0)) -(define (run-repl-thunk thunk input output error) +(define (run-repl-thunk thunk input output error stack) (put-mvar repl-output-mvar (with-input-from-port input (lambda () (with-output-to-port output (lambda () - (with-error-to-port error thunk))))))) + (with-error-to-port error + (lambda () + (with-fluids ((*repl-stack* stack)) + (thunk)))))))))) (define (run-repl) "Execute a thunk from the REPL is there is one." diff --git a/2d/repl/repl.scm b/2d/repl/repl.scm index 58b79e3..e6077cd 100644 --- a/2d/repl/repl.scm +++ b/2d/repl/repl.scm @@ -206,7 +206,8 @@ #:on-error (repl-option-ref repl 'on-error))) (current-input-port) (current-output-port) - (current-error-port))) + (current-error-port) + (fluid-ref *repl-stack*))) ;; Read the results back from ;; game-mvar. Will block until results ;; are available. -- cgit v1.2.3