Move breakpoint word from tools.annotations to tools.walker to reduce amount of dependencies tools.annotations pulls into a minimal image

db4
Slava Pestov 2009-09-22 03:16:31 -05:00
parent 962d039852
commit fe948f0b26
5 changed files with 32 additions and 31 deletions

View File

@ -8,9 +8,6 @@ $nl
"Printing messages when a word is called or returns:"
{ $subsection watch }
{ $subsection watch-vars }
"Starting the walker when a word is called:"
{ $subsection breakpoint }
{ $subsection breakpoint-if }
"Timing words:"
{ $subsection reset-word-timing }
{ $subsection add-timing }
@ -34,14 +31,6 @@ HELP: watch
{ watch watch-vars reset } related-words
HELP: breakpoint
{ $values { "word" word } }
{ $description "Annotates a word definition to enter the single stepper when executed." } ;
HELP: breakpoint-if
{ $values { "quot" { $quotation "( -- ? )" } } { "word" word } }
{ $description "Annotates a word definition to enter the single stepper if the quotation yields true." } ;
HELP: reset
{ $values
{ "word" word } }

View File

@ -2,9 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel math sorting words parser io summary
quotations sequences prettyprint continuations effects
definitions compiler.units namespaces assocs tools.walker
tools.time generic inspector fry tools.continuations
locals generalizations macros ;
definitions compiler.units namespaces assocs tools.time generic
inspector fry locals generalizations macros ;
IN: tools.annotations
<PRIVATE
@ -90,12 +89,6 @@ PRIVATE>
: watch-vars ( word vars -- )
dupd '[ [ _ _ ] dip (watch-vars) ] annotate ;
: breakpoint ( word -- )
[ add-breakpoint ] annotate ;
: breakpoint-if ( word quot -- )
'[ [ _ [ [ break ] when ] ] dip 3append ] annotate ;
SYMBOL: word-timing
word-timing [ H{ } clone ] initialize

View File

@ -1,5 +1,26 @@
IN: tools.walker
USING: help.syntax help.markup tools.continuations ;
USING: help.syntax help.markup tools.continuations sequences math words ;
HELP: breakpoint
{ $values { "word" word } }
{ $description "Annotates a word definition to enter the single stepper when executed." } ;
HELP: breakpoint-if
{ $values { "quot" { $quotation "( -- ? )" } } { "word" word } }
{ $description "Annotates a word definition to enter the single stepper if the quotation yields true." } ;
HELP: B
{ $description "An alias for " { $link break } ", defined in the " { $vocab-link "syntax" } " vocabulary so that it is always available." } ;
{ $description "An alias for " { $link break } ", defined in the " { $vocab-link "syntax" } " vocabulary so that it is always available." } ;
ARTICLE: "breakpoints" "Setting breakpoints"
"In addition to invoking the walker explicitly through the UI, it is possible to set breakpoints on words using words in the " { $vocab-link "tools.walker" } " vocabulary."
$nl
"Annotating a word with a breakpoint (see " { $link "tools.annotations" } "):"
{ $subsection breakpoint }
{ $subsection breakpoint-if }
"Breakpoints can be inserted directly into code:"
{ $subsection break }
{ $subsection POSTPONE: B }
"Note that because the walker calls various core library and UI words while rendering its own user interface, setting a breakpoint on a word such as " { $link append } " or " { $link + } " will hang the UI." ;
ABOUT: "breakpoints"

View File

@ -5,7 +5,7 @@ sequences math namespaces.private continuations.private
concurrency.messaging quotations kernel.private words
sequences.private assocs models models.arrow arrays accessors
generic generic.standard definitions make sbufs
tools.continuations parser ;
tools.continuations parser tools.annotations fry ;
IN: tools.walker
SYMBOL: show-walker-hook ! ( status continuation thread -- )
@ -158,6 +158,12 @@ SYMBOL: +stopped+
"Walker on " self name>> append spawn
[ associate-thread ] keep ;
: breakpoint ( word -- )
[ add-breakpoint ] annotate ;
: breakpoint-if ( word quot -- )
'[ [ _ [ [ break ] when ] ] dip 3append ] annotate ;
! For convenience
IN: syntax

View File

@ -23,14 +23,6 @@ ARTICLE: "ui-walker-step" "Stepping through code"
$nl
"The " { $link com-back } " command travels backwards through time, and restore stacks. This does not undo side effects (modifying array entries, writing to files, formatting the hard drive, etc) and therefore can only be used reliably on referentially transparent code." ;
ARTICLE: "breakpoints" "Setting breakpoints"
"In addition to invoking the walker explicitly through the UI, it is possible to set breakpoints on words. See " { $link "tools.annotations" } "."
$nl
"Breakpoints can be inserted directly into code:"
{ $subsection break }
{ $subsection POSTPONE: B }
"Note that because the walker calls various core library and UI words while rendering its own user interface, setting a breakpoint on a word such as " { $link append } " or " { $link draw-gadget } " will hang the UI." ;
ARTICLE: "ui-walker" "UI walker"
"The walker single-steps through quotations. To use the walker, enter a piece of code in the listener's input area and press " { $operation walk } "."
$nl