New tools.interpreter.debug vocab for interactively testing single stepper
parent
e950e03c99
commit
d37a17bd68
|
@ -0,0 +1,17 @@
|
||||||
|
! Copyright (C) 2004, 2007 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: tools.interpreter namespaces kernel arrays continuations
|
||||||
|
threads sequences ;
|
||||||
|
IN: tools.interpreter.debug
|
||||||
|
|
||||||
|
: run-interpreter ( -- )
|
||||||
|
interpreter get [ step-into run-interpreter ] when ;
|
||||||
|
|
||||||
|
: init-interpreter ( quot -- )
|
||||||
|
[
|
||||||
|
"out" set
|
||||||
|
[ f swap 2array restore "out" get continue ] callcc0
|
||||||
|
] swap [ datastack "datastack" set stop ] 3append callcc0 ;
|
||||||
|
|
||||||
|
: test-interpreter ( quot -- )
|
||||||
|
init-interpreter run-interpreter "datastack" get ;
|
|
@ -1,22 +1,11 @@
|
||||||
USING: tools.interpreter io io.streams.string kernel math
|
USING: tools.interpreter io io.streams.string kernel math
|
||||||
math.private namespaces prettyprint sequences tools.test
|
math.private namespaces prettyprint sequences tools.test
|
||||||
continuations math.parser threads arrays ;
|
continuations math.parser threads arrays
|
||||||
|
tools.interpreter.debug ;
|
||||||
IN: temporary
|
IN: temporary
|
||||||
|
|
||||||
[ "Ooops" throw ] break-hook set
|
[ "Ooops" throw ] break-hook set
|
||||||
|
|
||||||
: run-interpreter ( -- )
|
|
||||||
interpreter get [ step-into run-interpreter ] when ;
|
|
||||||
|
|
||||||
: init-interpreter ( quot -- )
|
|
||||||
[
|
|
||||||
"out" set
|
|
||||||
[ f swap 2array restore "out" get continue ] callcc0
|
|
||||||
] swap [ datastack "datastack" set stop ] 3append callcc0 ;
|
|
||||||
|
|
||||||
: test-interpreter ( quot -- )
|
|
||||||
init-interpreter run-interpreter "datastack" get ;
|
|
||||||
|
|
||||||
[ { } ] [
|
[ { } ] [
|
||||||
[ ] test-interpreter
|
[ ] test-interpreter
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
Loading…
Reference in New Issue