factor/basis/cocoa/cocoa.factor

97 lines
2.2 KiB
Factor
Raw Normal View History

! Copyright (C) 2006, 2009 Slava Pestov
2007-09-20 18:09:08 -04:00
! See http://factorcode.org/license.txt for BSD license.
USING: assocs cocoa.messages compiler.units core-foundation.bundles
hashtables init io kernel lexer namespaces sequences vocabs ;
2007-09-20 18:09:08 -04:00
IN: cocoa
SYMBOL: sent-messages
sent-messages [ H{ } clone ] initialize
2007-09-20 18:09:08 -04:00
: remember-send ( selector -- )
dup sent-messages get set-at ;
2007-09-20 18:09:08 -04:00
SYNTAX: ->
scan-token dup remember-send
[ lookup-method suffix! ] [ suffix! ] bi \ send suffix! ;
2007-09-20 18:09:08 -04:00
SYNTAX: ?->
dup last cache-stubs
scan-token dup remember-send
suffix! \ send suffix! ;
2013-03-30 16:44:11 -04:00
SYNTAX: SEL:
scan-token dup remember-send
<selector> suffix! \ cocoa.messages:selector suffix! ;
2013-03-30 16:44:11 -04:00
2007-09-20 18:09:08 -04:00
SYMBOL: super-sent-messages
super-sent-messages [ H{ } clone ] initialize
2007-09-20 18:09:08 -04:00
: remember-super-send ( selector -- )
dup super-sent-messages get set-at ;
2007-09-20 18:09:08 -04:00
SYNTAX: SUPER->
scan-token dup remember-super-send
[ lookup-method suffix! ] [ suffix! ] bi \ super-send suffix! ;
2007-09-20 18:09:08 -04:00
SYMBOL: frameworks
frameworks [ V{ } clone ] initialize
[ frameworks get [ load-framework ] each ] "cocoa" add-startup-hook
SYNTAX: FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
SYNTAX: IMPORT: scan-token [ ] import-objc-class ;
"Importing Cocoa classes..." print
2007-09-20 18:09:08 -04:00
"cocoa.classes" create-vocab drop
[
{
"NSAlert"
"NSAppleScript"
"NSApplication"
"NSArray"
"NSAutoreleasePool"
"NSBitmapImageRep"
"NSBundle"
"NSButton"
"NSColorSpace"
2017-05-30 13:09:02 -04:00
"NSCustomTouchBarItem"
"NSData"
2008-04-05 09:30:02 -04:00
"NSDictionary"
"NSError"
"NSEvent"
"NSException"
"NSMenu"
"NSMenuItem"
2008-04-05 09:30:02 -04:00
"NSMutableDictionary"
"NSNib"
"NSNotification"
"NSNotificationCenter"
"NSNumber"
"NSObject"
"NSOpenGLContext"
"NSOpenGLPixelFormat"
"NSOpenGLView"
"NSOpenPanel"
"NSPanel"
"NSPasteboard"
2008-07-19 18:17:12 -04:00
"NSPropertyListSerialization"
"NSResponder"
"NSSavePanel"
"NSScreen"
"NSString"
"NSTouchBar"
"NSTouchBarItem"
"NSView"
"NSWindow"
"NSWorkspace"
} [
[ ] import-objc-class
] each
] with-compilation-unit