| 
									
										
										
										
											2009-04-20 19:44:45 -04:00
										 |  |  | ! Copyright (C) 2008, 2009 Slava Pestov. | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | USING: accessors kernel namespaces stack-checker.recursive-state.tree ;
 | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  | IN: stack-checker.recursive-state | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | TUPLE: recursive-state quotations inline-words ;
 | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | : <recursive-state> ( -- state ) recursive-state new ; inline
 | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | <recursive-state> recursive-state set-global
 | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-20 19:44:45 -04:00
										 |  |  | : add-local-quotation ( rstate quot -- rstate )
 | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  |     swap clone [ dupd store ] change-quotations ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : add-inline-word ( word label -- rstate )
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  |     swap recursive-state get clone [ store ] change-inline-words ;
 | 
					
						
							| 
									
										
										
										
											2008-11-13 01:07:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : inline-recursive-label ( word -- label/f )
 | 
					
						
							|  |  |  |     recursive-state get inline-words>> lookup ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : recursive-quotation? ( quot -- ? )
 | 
					
						
							|  |  |  |     recursive-state get quotations>> lookup ;
 |