tools.interpreter cleanup
parent
3914576d25
commit
1ef514ebdb
|
@ -18,8 +18,6 @@ ARTICLE: "meta-interp-travel" "Backwards time travel"
|
||||||
{ $subsection history }
|
{ $subsection history }
|
||||||
"If this variable holds a vector, the interpreter state is automatically saved after every step. It can be saved at other points manually:"
|
"If this variable holds a vector, the interpreter state is automatically saved after every step. It can be saved at other points manually:"
|
||||||
{ $subsection save-interpreter }
|
{ $subsection save-interpreter }
|
||||||
"You can also restore any prior state:"
|
|
||||||
{ $subsection restore-interpreter }
|
|
||||||
"Or restore the most recently saved state:"
|
"Or restore the most recently saved state:"
|
||||||
{ $subsection step-back } ;
|
{ $subsection step-back } ;
|
||||||
|
|
||||||
|
@ -48,10 +46,6 @@ HELP: history
|
||||||
HELP: save-interpreter
|
HELP: save-interpreter
|
||||||
{ $description "Snapshots the single stepper state and saves it in " { $link history } "." } ;
|
{ $description "Snapshots the single stepper state and saves it in " { $link history } "." } ;
|
||||||
|
|
||||||
HELP: restore-interpreter
|
|
||||||
{ $values { "ns" continuation } }
|
|
||||||
{ $description "Restores the single stepper to a former state, which must have been saved by a call to " { $link save-interpreter } "." } ;
|
|
||||||
|
|
||||||
HELP: step
|
HELP: step
|
||||||
{ $description "Evaluates the object in the single stepper using Factor evaluation semantics:"
|
{ $description "Evaluates the object in the single stepper using Factor evaluation semantics:"
|
||||||
{ $list
|
{ $list
|
||||||
|
|
|
@ -26,8 +26,7 @@ M: continuation restore
|
||||||
clone interpreter set ;
|
clone interpreter set ;
|
||||||
|
|
||||||
M: pair restore
|
M: pair restore
|
||||||
first2 clone interpreter set
|
first2 restore [ nip f ] curry with-interpreter-datastack ;
|
||||||
[ nip f ] curry with-interpreter-datastack ;
|
|
||||||
|
|
||||||
M: f restore
|
M: f restore
|
||||||
drop interpreter off ;
|
drop interpreter off ;
|
||||||
|
@ -73,12 +72,9 @@ SYMBOL: history
|
||||||
: save-interpreter ( -- )
|
: save-interpreter ( -- )
|
||||||
history get [ interpreter get clone swap push ] when* ;
|
history get [ interpreter get clone swap push ] when* ;
|
||||||
|
|
||||||
: restore-interpreter ( interp -- )
|
|
||||||
clone interpreter set ;
|
|
||||||
|
|
||||||
: step-back ( -- )
|
: step-back ( -- )
|
||||||
history get dup empty?
|
history get dup empty?
|
||||||
[ drop ] [ pop restore-interpreter ] if ;
|
[ drop ] [ pop restore ] if ;
|
||||||
|
|
||||||
: (continue) ( continuation -- )
|
: (continue) ( continuation -- )
|
||||||
>continuation<
|
>continuation<
|
||||||
|
|
Loading…
Reference in New Issue