| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! Copyright (C) 2006 Slava Pestov | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							|  |  |  | USING: compiler io kernel cocoa.runtime cocoa.subclassing | 
					
						
							|  |  |  | cocoa.messages cocoa.types sequences words vocabs parser | 
					
						
							| 
									
										
										
										
											2008-01-09 04:52:08 -05:00
										 |  |  | core-foundation namespaces assocs hashtables compiler.units ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | IN: cocoa | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : (remember-send) ( selector variable -- )
 | 
					
						
							|  |  |  |     global [ dupd ?set-at ] change-at ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SYMBOL: sent-messages | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : remember-send ( selector -- )
 | 
					
						
							|  |  |  |     sent-messages (remember-send) ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : -> | 
					
						
							|  |  |  |     scan dup remember-send parsed \ send parsed ;
 | 
					
						
							|  |  |  |     parsing | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SYMBOL: super-sent-messages | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : remember-super-send ( selector -- )
 | 
					
						
							|  |  |  |     super-sent-messages (remember-send) ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : SUPER-> | 
					
						
							|  |  |  |     scan dup remember-super-send parsed \ super-send parsed ;
 | 
					
						
							|  |  |  |     parsing | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "Compiling Objective C bridge..." print
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "cocoa.classes" create-vocab drop
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     "cocoa" "cocoa.runtime" "cocoa.messages" "cocoa.subclassing" | 
					
						
							| 
									
										
										
										
											2008-01-09 01:36:11 -05:00
										 |  |  | } [ words ] map concat compile | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | "Importing Cocoa classes..." print
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-09 01:36:11 -05:00
										 |  |  | [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         "NSApplication" | 
					
						
							|  |  |  |         "NSArray" | 
					
						
							|  |  |  |         "NSAutoreleasePool" | 
					
						
							|  |  |  |         "NSBundle" | 
					
						
							|  |  |  |         "NSError" | 
					
						
							|  |  |  |         "NSEvent" | 
					
						
							|  |  |  |         "NSException" | 
					
						
							|  |  |  |         "NSMenu" | 
					
						
							|  |  |  |         "NSMenuItem" | 
					
						
							|  |  |  |         "NSNib" | 
					
						
							|  |  |  |         "NSNotification" | 
					
						
							|  |  |  |         "NSNotificationCenter" | 
					
						
							|  |  |  |         "NSObject" | 
					
						
							|  |  |  |         "NSOpenGLContext" | 
					
						
							|  |  |  |         "NSOpenGLPixelFormat" | 
					
						
							|  |  |  |         "NSOpenGLView" | 
					
						
							|  |  |  |         "NSOpenPanel" | 
					
						
							|  |  |  |         "NSPasteboard" | 
					
						
							|  |  |  |         "NSResponder" | 
					
						
							|  |  |  |         "NSSavePanel" | 
					
						
							|  |  |  |         "NSView" | 
					
						
							|  |  |  |         "NSWindow" | 
					
						
							|  |  |  |         "NSWorkspace" | 
					
						
							|  |  |  |     } [ | 
					
						
							|  |  |  |         [ ] import-objc-class | 
					
						
							|  |  |  |     ] each
 | 
					
						
							|  |  |  | ] with-compilation-unit |