2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								USING:  help.markup  help.syntax  quotations  strings  ;
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								IN:  init  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  boot  
						 
					
						
							
								
									
										
										
										
											2012-07-19 12:47:14 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Called on startup as part of the boot quotation to initialize the runtime and prepare it for running user code."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-20 01:55:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ boot startup-quot set-startup-quot } related-words
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-20 01:55:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  startup-quot  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $values { "quot"  quotation } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs the initial quotation called by the VM on startup."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-20 01:55:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  set-startup-quot  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $values { "quot"  quotation } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Sets the initial quotation called by the VM on startup. This quotation must begin with a call to "  { $link boot } ". The image must be saved for changes to the boot quotation to take effect."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $notes "The "  { $link "tools.deploy"  } " tool uses this word."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  startup-hooks  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $var-description "An association list mapping string identifiers to quotations to be run on startup."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  shutdown-hooks  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $var-description "An association list mapping string identifiers to quotations to be run on shutdown."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  do-startup-hooks  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Calls all initialization hook quotations."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  do-shutdown-hooks  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Calls all shutdown hook quotations."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  add-startup-hook  
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $values { "quot"  quotation } { "name"  string  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Registers a startup hook. The hook will always run when Factor is started. If the hook was not already defined, this word also calls it immediately."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ startup-hooks do-startup-hooks add-startup-hook add-shutdown-hook do-shutdown-hooks shutdown-hooks } related-words
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "init"  "Initialization and startup" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"When Factor starts, the first thing it does is call a word:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections boot }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"Next, initialization hooks are called:"  
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections do-startup-hooks }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"Initialization hooks can be defined:"  
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections add-startup-hook }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"Corresponding shutdown hooks may also be defined:"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsections add-shutdown-hook }
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"The boot quotation can be changed:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
									
										
										
										
											2009-11-20 01:55:16 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    startup-quot
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set-startup-quot
							 
						 
					
						
							
								
									
										
										
										
											2009-10-19 22:17:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"When quitting Factor, shutdown hooks are called:"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsection do-shutdown-hooks } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-20 18:09:08 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ABOUT: "init"