2005-03-07 22:11:36 -05:00
|
|
|
! Copyright (C) 2004, 2005 Slava Pestov.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
2005-12-24 18:29:31 -05:00
|
|
|
IN: walker
|
|
|
|
USING: errors hashtables inspector interpreter io kernel
|
2006-05-15 01:01:47 -04:00
|
|
|
listener math namespaces prettyprint sequences strings
|
2005-12-24 18:29:31 -05:00
|
|
|
vectors words ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
2006-03-25 01:06:52 -05:00
|
|
|
: &s ( -- ) meta-d get stack. ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
2006-05-15 01:37:11 -04:00
|
|
|
: &r ( -- ) meta-r get stack. ;
|
2005-08-26 18:18:07 -04:00
|
|
|
|
2006-05-15 01:37:11 -04:00
|
|
|
: meta-c*
|
|
|
|
[ meta-c get % meta-executing get , meta-cf get , ] { } make ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
2006-05-15 01:37:11 -04:00
|
|
|
: &c ( -- ) meta-c* stack. ;
|
|
|
|
|
|
|
|
: &get ( var -- value ) meta-name get hash-stack ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
2005-03-20 19:05:57 -05:00
|
|
|
: report ( -- ) meta-cf get . ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
2006-03-25 01:06:52 -05:00
|
|
|
: step ( -- ) next do-1 report ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
2006-03-25 01:06:52 -05:00
|
|
|
: into ( -- ) next do report ;
|
2005-03-20 19:05:57 -05:00
|
|
|
|
2006-03-25 01:06:52 -05:00
|
|
|
: end-walk ( -- )
|
2006-05-15 01:37:11 -04:00
|
|
|
\ call push-c meta-cf get push-c meta-interp continue ;
|
2005-03-07 22:11:36 -05:00
|
|
|
|
|
|
|
: walk-banner ( -- )
|
2006-05-15 01:37:11 -04:00
|
|
|
"&s &r &c show stepper stacks" print
|
2005-08-23 22:27:05 -04:00
|
|
|
"&get ( var -- value ) get stepper variable value" print
|
2005-08-21 01:17:37 -04:00
|
|
|
"step -- single step over" print
|
|
|
|
"into -- single step into" print
|
2005-09-24 23:21:09 -04:00
|
|
|
"bye -- continue execution" print
|
2005-03-07 22:11:36 -05:00
|
|
|
report ;
|
|
|
|
|
2005-09-28 20:09:10 -04:00
|
|
|
: set-walk-hooks ( -- )
|
2005-12-22 18:38:10 -05:00
|
|
|
[ meta-d get ] datastack-hook set
|
2005-09-28 20:09:10 -04:00
|
|
|
"walk " listener-prompt set ;
|
2005-03-20 19:05:57 -05:00
|
|
|
|
2005-03-07 22:11:36 -05:00
|
|
|
: walk ( quot -- )
|
2006-05-15 01:37:11 -04:00
|
|
|
datastack dup pop*
|
|
|
|
retainstack
|
|
|
|
callstack
|
|
|
|
namestack
|
|
|
|
catchstack [
|
|
|
|
meta-catch set
|
|
|
|
meta-name set
|
|
|
|
meta-c set
|
|
|
|
meta-r set
|
|
|
|
meta-d set
|
2005-09-28 20:09:10 -04:00
|
|
|
meta-cf set
|
|
|
|
meta-executing off
|
|
|
|
set-walk-hooks
|
|
|
|
walk-banner
|
|
|
|
listener end-walk
|
2005-03-20 19:05:57 -05:00
|
|
|
] with-scope ;
|