1 USING: help.markup help.syntax words parser quotations strings
5 ARTICLE: "tools.annotations" "Word annotations"
6 "The word annotation feature modifies word definitions to add debugging code. You can restore the old definition by calling " { $link reset } " on the word in question."
8 { $subsection breakpoint }
9 { $subsection breakpoint-if }
10 "All of the above words are implemented using a single combinator which applies a quotation to a word definition to yield a new definition:"
11 { $subsection annotate } ;
13 ABOUT: "tools.annotations"
16 { $values { "word" "a word" } { "quot" "a quotation with stack effect " { $snippet "( word def -- def )" } } }
17 { $description "Changes a word definition to the result of applying a quotation to the old definition." }
18 { $notes "This word is used to implement " { $link watch } "." } ;
21 { $values { "word" word } }
22 { $description "Annotates a word definition to print the data stack on entry and exit." } ;
24 { watch watch-vars reset } related-words
27 { $values { "word" word } }
28 { $description "Annotates a word definition to enter the single stepper when executed." } ;
31 { $values { "quot" "a quotation with stack effect" { $snippet "( -- ? )" } } { "word" word } }
32 { $description "Annotates a word definition to enter the single stepper if the quotation yields true." } ;
34 HELP: annotate-methods
36 { "word" word } { "quot" quotation } }
37 { $description "Annotates the word -- for generic words, all its methods -- with the quotation." } ;
42 { $description "Prints a message and the inputs to the word before the word has been called." } ;
47 { $description "Prints a message and the outputs from a word after a word has been called." } ;
52 { $description "Resets any annotations on a word." }
53 { $notes "This word will remove a " { $link watch } "." } ;
57 { "word" word } { "vars" "a sequence of symbols" } }
58 { $description "Annotates a word definition to print the " { $snippet "vars" } " upon entering the word. This word is useful for debugging." } ;
64 { $description "Makes a sequence of the inputs to a word by counting the number of inputs in the stack effect and saving that many items from the datastack." } ;