factor: IMPORT: -> import:

locals-and-roots
Doug Coleman 2016-06-04 17:16:47 -07:00
parent 4e700098bd
commit d6a35b5892
5 changed files with 30 additions and 29 deletions

View File

@ -482,7 +482,7 @@ xyz
} }
{ $slide "Cocoa FFI" { $slide "Cocoa FFI"
{ $code "IMPORT: NSAlert [ { $code "import: NSAlert [
NSAlert -> new NSAlert -> new
[ -> retain ] [ [ -> retain ] [
\"Raptor\" <CFString> &CFRelease \"Raptor\" <CFString> &CFRelease

View File

@ -5,7 +5,7 @@ core-graphics.types kernel math.bitwise literals ;
in: webkit-demo in: webkit-demo
FRAMEWORK: /System/Library/Frameworks/WebKit.framework FRAMEWORK: /System/Library/Frameworks/WebKit.framework
IMPORT: WebView import: WebView
: rect ( -- rect ) 0 0 700 500 <CGRect> ; : rect ( -- rect ) 0 0 700 500 <CGRect> ;

View File

@ -16,16 +16,16 @@ HELP: SUPER->
{ send super-send postpone: -> postpone: SUPER-> } related-words { send super-send postpone: -> postpone: SUPER-> } related-words
HELP: IMPORT: HELP: import:
{ $syntax "IMPORT: name" } { $syntax "import: name" }
{ $description "Makes an Objective C class available for use." } { $description "Makes an Objective C class available for use." }
{ $examples { $examples
{ $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" } { $code "import: QTMovie" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
} ; } ;
ARTICLE: "objc-calling" "Calling Objective C code" ARTICLE: "objc-calling" "Calling Objective C code"
"Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed." "Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed."
{ $subsections postpone: IMPORT: } { $subsections postpone: import: }
"Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked." "Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked."
$nl $nl
"Messages can be sent to classes and instances using a pair of parsing words:" "Messages can be sent to classes and instances using a pair of parsing words:"

View File

@ -35,6 +35,7 @@ frameworks [ V{ } clone ] initialize
SYNTAX: FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ; SYNTAX: FRAMEWORK: scan-token [ load-framework ] [ frameworks get push ] bi ;
SYNTAX: IMPORT: scan-token [ ] import-objc-class ; SYNTAX: IMPORT: scan-token [ ] import-objc-class ;
SYNTAX: import: scan-token [ ] import-objc-class ;
"Importing Cocoa classes..." print "Importing Cocoa classes..." print

View File

@ -52,29 +52,29 @@ CONSTANT: QTErrorDeviceExcludedByAnotherDevice 1302 ;
FRAMEWORK: /System/Library/Frameworks/QTKit.framework FRAMEWORK: /System/Library/Frameworks/QTKit.framework
IMPORT: QTCaptureAudioPreviewOutput import: QTCaptureAudioPreviewOutput
IMPORT: QTCaptureConnection import: QTCaptureConnection
IMPORT: QTCaptureDecompressedAudioOutput import: QTCaptureDecompressedAudioOutput
IMPORT: QTCaptureDecompressedVideoOutput import: QTCaptureDecompressedVideoOutput
IMPORT: QTCaptureDevice import: QTCaptureDevice
IMPORT: QTCaptureDeviceInput import: QTCaptureDeviceInput
IMPORT: QTCaptureFileOutput import: QTCaptureFileOutput
IMPORT: QTCaptureInput import: QTCaptureInput
IMPORT: QTCaptureLayer import: QTCaptureLayer
IMPORT: QTCaptureMovieFileOutput import: QTCaptureMovieFileOutput
IMPORT: QTCaptureOutput import: QTCaptureOutput
IMPORT: QTCaptureSession import: QTCaptureSession
IMPORT: QTCaptureVideoPreviewOutput import: QTCaptureVideoPreviewOutput
IMPORT: QTCaptureView import: QTCaptureView
IMPORT: QTCompressionOptions import: QTCompressionOptions
IMPORT: QTDataReference import: QTDataReference
IMPORT: QTFormatDescription import: QTFormatDescription
IMPORT: QTMedia import: QTMedia
IMPORT: QTMovie import: QTMovie
IMPORT: QTMovieLayer import: QTMovieLayer
IMPORT: QTMovieView import: QTMovieView
IMPORT: QTSampleBuffer import: QTSampleBuffer
IMPORT: QTTrack import: QTTrack
: <movie> ( filename -- movie ) : <movie> ( filename -- movie )
QTMovie swap <NSString> f -> movieWithFile:error: -> retain ; QTMovie swap <NSString> f -> movieWithFile:error: -> retain ;