2008-09-05 20:01:39 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								USING:  help.markup  help.syntax  words  parser  quotations  strings  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								system sequences ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								IN:  tools.annotations  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "tools.annotations"  "Word annotations" 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-21 21:18:24 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"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."  
						 
					
						
							
								
									
										
										
										
											2008-12-06 01:20:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$nl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"Printing messages when a word is called or returns:"  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $subsection watch }
							 
						 
					
						
							
								
									
										
										
										
											2008-12-06 01:20:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsection watch-vars }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"Starting the walker when a word is called:"  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $subsection breakpoint }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsection breakpoint-if }
							 
						 
					
						
							
								
									
										
										
										
											2008-12-06 01:20:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Timing words:"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsection reset-word-timing }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsection add-timing }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsection word-timing. }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"All of the above words are implemented using a single combinator which applies a quotation to a word definition to yield a new definition:"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsection annotate } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ABOUT: "tools.annotations" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  annotate  
						 
					
						
							
								
									
										
										
										
											2009-07-14 12:43:11 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "word"  "a word"  } { "quot"  { $quotation "( old-def -- new-def )"  } } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Changes a word definition to the result of applying a quotation to the old definition."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word is used to implement "  { $link watch } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  watch  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "word"  word } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Annotates a word definition to print the data stack on entry and exit."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-09-05 20:01:39 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ watch watch-vars reset } related-words
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  breakpoint  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "word"  word } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Annotates a word definition to enter the single stepper when executed."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  breakpoint-if  
						 
					
						
							
								
									
										
										
										
											2008-11-16 10:08:38 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "quot"  { $quotation "( -- ? )"  } } { "word"  word } }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Annotates a word definition to enter the single stepper if the quotation yields true."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-05 20:01:39 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  reset  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { "word"  word } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Resets any annotations on a word."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "This word will remove a "  { $link watch } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  watch-vars  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { "word"  word } { "vars"  "a sequence of symbols"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Annotates a word definition to print the "  { $snippet "vars"  } " upon entering the word. This word is useful for debugging."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-06 01:20:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  add-timing  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "word"  word } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Adds timing code to a word, which records its total running time, including that of words it calls, on every invocation."  }
							 
						 
					
						
							
								
									
										
										
										
											2008-12-06 04:47:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $see-also "timing"  "profiling"  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-06 01:20:49 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  reset-word-timing  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Resets the word timing table."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  word-timing.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Prints the word timing table."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-28 07:49:03 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  cannot-annotate-twice  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $error-description "Thrown when attempting to annotate a word that's already been annotated. If a word already has an annotation such as a watch or a breakpoint, you must first "  { $link reset } " the word before adding another annotation."  } ;