'watch' now respects effect-in/effect-out
parent
efde1afc2f
commit
75d9329f06
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2005, 2007 Slava Pestov.
|
! Copyright (C) 2005, 2007 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel words parser io inspector quotations sequences
|
USING: kernel words parser io inspector quotations sequences
|
||||||
prettyprint continuations ;
|
prettyprint continuations effects ;
|
||||||
IN: tools.annotations
|
IN: tools.annotations
|
||||||
|
|
||||||
: annotate ( word quot -- )
|
: annotate ( word quot -- )
|
||||||
|
@ -9,17 +9,29 @@ IN: tools.annotations
|
||||||
swap define-compound do-parse-hook ;
|
swap define-compound do-parse-hook ;
|
||||||
inline
|
inline
|
||||||
|
|
||||||
: entering ( str -- ) "! Entering: " write print .s flush ;
|
: entering ( str -- )
|
||||||
|
"/-- Entering: " write dup .
|
||||||
|
stack-effect [
|
||||||
|
>r datastack r> effect-in length tail* stack.
|
||||||
|
] [
|
||||||
|
.s
|
||||||
|
] if* "\\--" print flush ;
|
||||||
|
|
||||||
: leaving ( str -- ) "! Leaving: " write print .s flush ;
|
: leaving ( str -- )
|
||||||
|
"/-- Leaving: " write dup .
|
||||||
|
stack-effect [
|
||||||
|
>r datastack r> effect-out length tail* stack.
|
||||||
|
] [
|
||||||
|
.s
|
||||||
|
] if* "\\--" print flush ;
|
||||||
|
|
||||||
: (watch) ( str def -- def )
|
: (watch) ( word def -- def )
|
||||||
over [ entering ] curry
|
over [ entering ] curry
|
||||||
rot [ leaving ] curry
|
rot [ leaving ] curry
|
||||||
swapd 3append ;
|
swapd 3append ;
|
||||||
|
|
||||||
: watch ( word -- )
|
: watch ( word -- )
|
||||||
dup word-name swap [ (watch) ] annotate ;
|
dup [ (watch) ] annotate ;
|
||||||
|
|
||||||
: breakpoint ( word -- )
|
: breakpoint ( word -- )
|
||||||
[ \ break add* ] annotate ;
|
[ \ break add* ] annotate ;
|
||||||
|
|
Loading…
Reference in New Issue