From 75d9329f066401d50572c81b59a780efdaab0ff2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 25 Nov 2007 04:35:16 -0500 Subject: [PATCH] 'watch' now respects effect-in/effect-out --- extra/tools/annotations/annotations.factor | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/extra/tools/annotations/annotations.factor b/extra/tools/annotations/annotations.factor index d24d60cef6..e97f292416 100644 --- a/extra/tools/annotations/annotations.factor +++ b/extra/tools/annotations/annotations.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel words parser io inspector quotations sequences -prettyprint continuations ; +prettyprint continuations effects ; IN: tools.annotations : annotate ( word quot -- ) @@ -9,17 +9,29 @@ IN: tools.annotations swap define-compound do-parse-hook ; 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 rot [ leaving ] curry swapd 3append ; : watch ( word -- ) - dup word-name swap [ (watch) ] annotate ; + dup [ (watch) ] annotate ; : breakpoint ( word -- ) [ \ break add* ] annotate ;