]> 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 34bac0a5055229e13b7a738190f577359fd3ab7e..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 suffix! \ send suffix! ;
+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 suffix! \ super-send suffix! ;
+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-startup-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"
@@ -62,11 +81,14 @@ SYNTAX: IMPORT: scan [ ] import-objc-class ;
         "NSOpenPanel"
         "NSPanel"
         "NSPasteboard"
+        "NSPopover"
         "NSPropertyListSerialization"
         "NSResponder"
         "NSSavePanel"
         "NSScreen"
         "NSString"
+        "NSTouchBar"
+        "NSTouchBarItem"
         "NSView"
         "NSWindow"
         "NSWorkspace"