factor/basis/cocoa/cocoa.factor

85 lines
1.9 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: cocoa.messages compiler.units core-foundation.bundles
hashtables init io kernel lexer namespaces sequences vocabs ;
QUALIFIED: cocoa.messages
2007-09-20 18:09:08 -04:00
IN: cocoa
SYMBOL: sent-messages
: (remember-send) ( selector variable -- )
[ dupd ?set-at ] change-global ;
2007-09-20 18:09:08 -04:00
: remember-send ( selector -- )
sent-messages (remember-send) ;
2007-09-20 18:09:08 -04:00
SYNTAX: -> scan-token dup remember-send suffix! \ send suffix! ;
2007-09-20 18:09:08 -04:00
2013-03-30 16:44:11 -04:00
SYNTAX: SEL:
scan-token
[ remember-send ]
[ <selector> suffix! \ cocoa.messages:selector suffix! ] bi ;
2013-03-30 16:44:11 -04:00
2007-09-20 18:09:08 -04:00
SYMBOL: super-sent-messages
: remember-super-send ( selector -- )
super-sent-messages (remember-send) ;
2007-09-20 18:09:08 -04:00
SYNTAX: SUPER-> scan-token dup remember-super-send suffix! \ 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"
"NSColorSpace"
"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"
"NSView"
"NSWindow"
"NSWorkspace"
} [
[ ] import-objc-class
] each
] with-compilation-unit