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"
{ $code "IMPORT: NSAlert [
{ $code "import: NSAlert [
NSAlert -> new
[ -> retain ] [
\"Raptor\" <CFString> &CFRelease

View File

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

View File

@ -16,16 +16,16 @@ HELP: SUPER->
{ send super-send postpone: -> postpone: SUPER-> } related-words
HELP: IMPORT:
{ $syntax "IMPORT: name" }
HELP: import:
{ $syntax "import: name" }
{ $description "Makes an Objective C class available for use." }
{ $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"
"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."
$nl
"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: IMPORT: scan-token [ ] import-objc-class ;
SYNTAX: import: scan-token [ ] import-objc-class ;
"Importing Cocoa classes..." print

View File

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