]> gitweb.factorcode.org Git - factor.git/blob - basis/cocoa/cocoa.factor
01ee91007f1c28bc1a6fcbb71afbc9c80d9fcbeb
[factor.git] / basis / cocoa / cocoa.factor
1 ! Copyright (C) 2006, 2009 Slava Pestov
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs cocoa.messages compiler.units core-foundation.bundles
4 hashtables init io kernel lexer namespaces sequences vocabs ;
5 IN: cocoa
6
7 SYMBOL: sent-messages
8
9 sent-messages [ H{ } clone ] initialize
10 : remember-send ( selector -- )
11     dup sent-messages get set-at ;
12
13 SYNTAX: ->
14     scan-token dup remember-send
15     [ lookup-objc-method suffix! ] [ suffix! ] bi \ send suffix! ;
16
17 SYNTAX: ?->
18     dup last cache-stubs
19     scan-token dup remember-send
20     suffix! \ send suffix! ;
21
22 SYNTAX: SEL:
23     scan-token dup remember-send
24     <selector> suffix! \ cocoa.messages:selector suffix! ;
25
26 SYMBOL: super-sent-messages
27
28 super-sent-messages [ H{ } clone ] initialize
29
30 : remember-super-send ( selector -- )
31     dup super-sent-messages get set-at ;
32
33 SYNTAX: SUPER->
34     scan-token dup remember-super-send
35     [ lookup-objc-method suffix! ] [ suffix! ] bi \ super-send suffix! ;
36
37 SYMBOL: frameworks
38
39 frameworks [ V{ } clone ] initialize
40
41 STARTUP-HOOK: [ frameworks get [ load-framework ] each ]
42
43 SYNTAX: FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
44
45 SYNTAX: IMPORT: scan-token [ ] import-objc-class ;
46
47 "Importing Cocoa classes..." print
48
49 "cocoa.classes" create-vocab drop
50
51 [
52     {
53         "NSAlert"
54         "NSAppearance"
55         "NSAppleScript"
56         "NSApplication"
57         "NSArray"
58         "NSAutoreleasePool"
59         "NSBitmapImageRep"
60         "NSBundle"
61         "NSButton"
62         "NSColorSpace"
63         "NSCustomTouchBarItem"
64         "NSData"
65         "NSDictionary"
66         "NSError"
67         "NSEvent"
68         "NSException"
69         "NSImage"
70         "NSMenu"
71         "NSMenuItem"
72         "NSMutableDictionary"
73         "NSNib"
74         "NSNotification"
75         "NSNotificationCenter"
76         "NSNumber"
77         "NSObject"
78         "NSOpenGLContext"
79         "NSOpenGLPixelFormat"
80         "NSOpenGLView"
81         "NSOpenPanel"
82         "NSPanel"
83         "NSPasteboard"
84         "NSPopover"
85         "NSPropertyListSerialization"
86         "NSResponder"
87         "NSSavePanel"
88         "NSScreen"
89         "NSString"
90         "NSTouchBar"
91         "NSTouchBarItem"
92         "NSView"
93         "NSWindow"
94         "NSWorkspace"
95     } [
96         [ ] import-objc-class
97     ] each
98 ] with-compilation-unit