]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/cocoa/cocoa.factor
basis: use lint.vocabs tool to trim using lists
[factor.git] / basis / cocoa / cocoa.factor
index b78bb020d0cf6140229f009f1a27ca15e76138e9..d3ac8522993930d5f1cc6d17a8286cb66d3bed95 100644 (file)
@@ -1,37 +1,48 @@
 ! Copyright (C) 2006, 2009 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
-core-foundation.bundles namespaces assocs hashtables
-compiler.units lexer init ;
+USING: assocs cocoa.messages compiler.units core-foundation.bundles
+io kernel lexer namespaces sequences vocabs ;
 IN: cocoa
 
-: (remember-send) ( selector variable -- )
-    [ dupd ?set-at ] change-global ;
-
 SYMBOL: sent-messages
 
+sent-messages [ H{ } clone ] initialize
 : remember-send ( selector -- )
-    sent-messages (remember-send) ;
+    dup sent-messages get set-at ;
+
+SYNTAX: ->
+    scan-token dup remember-send
+    [ lookup-objc-method suffix! ] [ suffix! ] bi \ send suffix! ;
 
-SYNTAX: -> scan dup remember-send parsed \ send parsed ;
+SYNTAX: ?->
+    dup last cache-stubs
+    scan-token dup remember-send
+    suffix! \ send suffix! ;
+
+SYNTAX: SEL:
+    scan-token dup remember-send
+    <selector> suffix! \ cocoa.messages:selector suffix! ;
 
 SYMBOL: super-sent-messages
 
+super-sent-messages [ H{ } clone ] initialize
+
 : remember-super-send ( selector -- )
-    super-sent-messages (remember-send) ;
+    dup super-sent-messages get set-at ;
 
-SYNTAX: SUPER-> scan dup remember-super-send parsed \ super-send parsed ;
+SYNTAX: SUPER->
+    scan-token dup remember-super-send
+    [ lookup-objc-method suffix! ] [ suffix! ] bi \ super-send suffix! ;
 
 SYMBOL: frameworks
 
 frameworks [ V{ } clone ] initialize
 
-[ frameworks get [ load-framework ] each ] "cocoa" add-init-hook
+STARTUP-HOOK: [ frameworks get [ load-framework ] each ]
 
-SYNTAX: FRAMEWORK: scan [ load-framework ] [ frameworks get push ] bi ;
+SYNTAX: FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
 
-SYNTAX: IMPORT: scan [ ] import-objc-class ;
+SYNTAX: IMPORT: scan-token [ ] import-objc-class ;
 
 "Importing Cocoa classes..." print
 
@@ -39,15 +50,23 @@ SYNTAX: IMPORT: scan [ ] import-objc-class ;
 
 [
     {
+        "NSAlert"
+        "NSAppearance"
+        "NSAppleScript"
         "NSApplication"
         "NSArray"
         "NSAutoreleasePool"
+        "NSBitmapImageRep"
         "NSBundle"
+        "NSButton"
+        "NSColorSpace"
+        "NSCustomTouchBarItem"
         "NSData"
         "NSDictionary"
         "NSError"
         "NSEvent"
         "NSException"
+        "NSImage"
         "NSMenu"
         "NSMenuItem"
         "NSMutableDictionary"
@@ -60,12 +79,16 @@ SYNTAX: IMPORT: scan [ ] import-objc-class ;
         "NSOpenGLPixelFormat"
         "NSOpenGLView"
         "NSOpenPanel"
+        "NSPanel"
         "NSPasteboard"
+        "NSPopover"
         "NSPropertyListSerialization"
         "NSResponder"
         "NSSavePanel"
         "NSScreen"
         "NSString"
+        "NSTouchBar"
+        "NSTouchBarItem"
         "NSView"
         "NSWindow"
         "NSWorkspace"