From 54ef674a99361a107d6aa75f8c4a152b6e8894e0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 26 Aug 2017 14:55:18 -0500 Subject: [PATCH] cocoa: -> to send\ ?-> to ?send\ SUPER-> to super\ --- basis/cocoa/apple-script/apple-script.factor | 6 +- basis/cocoa/application/application.factor | 20 +++--- basis/cocoa/cocoa-docs.factor | 12 ++-- basis/cocoa/cocoa-tests.factor | 18 +++--- basis/cocoa/cocoa.factor | 6 +- basis/cocoa/dialogs/dialogs.factor | 28 ++++---- basis/cocoa/enumeration/enumeration.factor | 2 +- basis/cocoa/messages/messages-docs.factor | 2 +- basis/cocoa/nibs/nibs.factor | 8 +-- basis/cocoa/pasteboard/pasteboard.factor | 8 +-- basis/cocoa/plists/plists.factor | 20 +++--- basis/cocoa/touchbar/touchbar.factor | 18 +++--- basis/cocoa/views/views.factor | 14 ++-- basis/cocoa/windows/windows.factor | 18 +++--- basis/images/loader/cocoa/cocoa.factor | 8 +-- basis/tools/deploy/test/14/14.factor | 4 +- basis/ui/backend/cocoa/cocoa.factor | 68 ++++++++++---------- basis/ui/backend/cocoa/tools/tools.factor | 6 +- basis/ui/backend/cocoa/views/views.factor | 54 ++++++++-------- extra/qtkit/qtkit.factor | 12 ++-- extra/webkit-demo/webkit-demo.factor | 10 +-- 21 files changed, 171 insertions(+), 171 deletions(-) diff --git a/basis/cocoa/apple-script/apple-script.factor b/basis/cocoa/apple-script/apple-script.factor index 9c12817fdc..f210c2aa65 100644 --- a/basis/cocoa/apple-script/apple-script.factor +++ b/basis/cocoa/apple-script/apple-script.factor @@ -7,9 +7,9 @@ multiline words ; IN: cocoa.apple-script : run-apple-script ( str -- ) - [ NSAppleScript -> alloc ] dip - -> initWithSource: -> autorelease - f -> executeAndReturnError: drop ; + [ NSAppleScript send\ alloc ] dip + send\ initWithSource: send\ autorelease + f send\ executeAndReturnError: drop ; SYNTAX: \APPLESCRIPT: scan-new-word scan-object diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index 86cd177916..b266ac2401 100644 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -4,16 +4,16 @@ USING: alien.c-types alien.syntax cocoa cocoa.classes cocoa.runtime core-foundation.strings kernel sequences ; IN: cocoa.application -: ( str -- alien ) -> autorelease ; +: ( str -- alien ) send\ autorelease ; CONSTANT: NSApplicationDelegateReplySuccess 0 CONSTANT: NSApplicationDelegateReplyCancel 1 CONSTANT: NSApplicationDelegateReplyFailure 2 : with-autorelease-pool ( quot -- ) - NSAutoreleasePool -> new [ call ] [ -> release ] bi* ; inline + NSAutoreleasePool send\ new [ call ] [ send\ release ] bi* ; inline -: NSApp ( -- app ) NSApplication -> sharedApplication ; +: NSApp ( -- app ) NSApplication send\ sharedApplication ; CONSTANT: NSAnyEventMask 0xffffffff @@ -24,24 +24,24 @@ FUNCTION: void NSBeep ( ) : add-observer ( observer selector name object -- ) [ - [ NSNotificationCenter -> defaultCenter ] 2dip + [ NSNotificationCenter send\ defaultCenter ] 2dip sel_registerName - ] 2dip -> addObserver:selector:name:object: ; + ] 2dip send\ addObserver:selector:name:object: ; : remove-observer ( observer -- ) - [ NSNotificationCenter -> defaultCenter ] dip - -> removeObserver: ; + [ NSNotificationCenter send\ defaultCenter ] dip + send\ removeObserver: ; : cocoa-app ( quot -- ) - [ call NSApp -> run ] with-cocoa ; inline + [ call NSApp send\ run ] with-cocoa ; inline : install-delegate ( receiver delegate -- ) - -> alloc -> init -> setDelegate: ; + send\ alloc send\ init send\ setDelegate: ; : running.app? ( -- ? ) ! Test if we're running a .app. ".app" - NSBundle -> mainBundle -> bundlePath CF>string + NSBundle send\ mainBundle send\ bundlePath CF>string subseq? ; : assert.app ( message -- ) diff --git a/basis/cocoa/cocoa-docs.factor b/basis/cocoa/cocoa-docs.factor index 8c3c1dd049..f4e4525c8a 100644 --- a/basis/cocoa/cocoa-docs.factor +++ b/basis/cocoa/cocoa-docs.factor @@ -2,25 +2,25 @@ USING: cocoa.messages help.markup help.syntax strings alien core-foundation ; IN: cocoa -HELP: -> +HELP: send\ { $syntax "-> selector" } { $values { "selector" "an Objective C method name" } } { $description "A sugared form of the following:" } { $code "\"selector\" send" } ; -HELP: SUPER-> +HELP: super\ { $syntax "-> selector" } { $values { "selector" "an Objective C method name" } } { $description "A sugared form of the following:" } { $code "\"selector\" send-super" } ; -{ send super-send postpone: -> postpone: SUPER-> } related-words +{ send super-send postpone: send\ postpone: super\ } related-words HELP: IMPORT: { $syntax "IMPORT: name" } { $description "Makes an Objective C class available for use." } { $examples - { $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" f -> movieWithFile:error:" } + { $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" f send\ movieWithFile:error:" } } ; ARTICLE: "objc-calling" "Calling Objective C code" @@ -30,8 +30,8 @@ ARTICLE: "objc-calling" "Calling Objective C code" $nl "Messages can be sent to classes and instances using a pair of parsing words:" { $subsections - postpone: -> - postpone: SUPER-> + postpone: send\ + postpone: super\ } "These parsing words are actually syntax sugar for a pair of ordinary words; they can be used instead of the parsing words if the selector name is dynamically computed:" { $subsections diff --git a/basis/cocoa/cocoa-tests.factor b/basis/cocoa/cocoa-tests.factor index 8b661b908d..1c98c52b52 100644 --- a/basis/cocoa/cocoa-tests.factor +++ b/basis/cocoa/cocoa-tests.factor @@ -10,9 +10,9 @@ IN: cocoa.tests ;CLASS> : test-foo ( -- ) - Foo -> alloc -> init - dup 1.0 2.0 101.0 102.0 -> foo: - -> release ; + Foo send\ alloc send\ init + dup 1.0 2.0 101.0 102.0 send\ foo: + send\ release ; { } [ test-foo ] unit-test @@ -27,9 +27,9 @@ IN: cocoa.tests { } [ Bar [ - -> alloc -> init - dup -> bar "x" set - -> release + send\ alloc send\ init + dup send\ bar "x" set + send\ release ] compile-call ] unit-test @@ -47,8 +47,8 @@ IN: cocoa.tests { 144 } [ Bar [ - -> alloc -> init - dup 12 -> babb: - swap -> release + send\ alloc send\ init + dup 12 send\ babb: + swap send\ release ] compile-call ] unit-test diff --git a/basis/cocoa/cocoa.factor b/basis/cocoa/cocoa.factor index 72c9a559b3..373fcd6691 100644 --- a/basis/cocoa/cocoa.factor +++ b/basis/cocoa/cocoa.factor @@ -12,9 +12,9 @@ SYMBOL: sent-messages : remember-send ( selector -- ) sent-messages (remember-send) ; -SYNTAX: -> scan-token dup remember-send suffix! \ send suffix! ; +SYNTAX: \send\ scan-token dup remember-send suffix! \ send suffix! ; -SYNTAX: ?-> scan-token dup remember-send suffix! \ ?send suffix! ; +SYNTAX: \?send\ scan-token dup remember-send suffix! \ ?send suffix! ; SYNTAX: \SEL: scan-token @@ -26,7 +26,7 @@ SYMBOL: super-sent-messages : remember-super-send ( selector -- ) super-sent-messages (remember-send) ; -SYNTAX: SUPER-> scan-token dup remember-super-send suffix! \ super-send suffix! ; +SYNTAX: \super\ scan-token dup remember-super-send suffix! \ super-send suffix! ; SYMBOL: frameworks diff --git a/basis/cocoa/dialogs/dialogs.factor b/basis/cocoa/dialogs/dialogs.factor index 74387d63ef..f29b66f77e 100644 --- a/basis/cocoa/dialogs/dialogs.factor +++ b/basis/cocoa/dialogs/dialogs.factor @@ -5,27 +5,27 @@ core-foundation.strings kernel splitting ; IN: cocoa.dialogs : ( -- panel ) - NSOpenPanel -> openPanel - dup 1 -> setCanChooseFiles: - dup 0 -> setCanChooseDirectories: - dup 1 -> setResolvesAliases: - dup 1 -> setAllowsMultipleSelection: ; + NSOpenPanel send\ openPanel + dup 1 send\ setCanChooseFiles: + dup 0 send\ setCanChooseDirectories: + dup 1 send\ setResolvesAliases: + dup 1 send\ setAllowsMultipleSelection: ; : ( -- panel ) - dup 1 -> setCanChooseDirectories: ; + dup 1 send\ setCanChooseDirectories: ; : ( -- panel ) - NSSavePanel -> savePanel - dup 1 -> setCanChooseFiles: - dup 0 -> setCanChooseDirectories: - dup 0 -> setAllowsMultipleSelection: ; + NSSavePanel send\ savePanel + dup 1 send\ setCanChooseFiles: + dup 0 send\ setCanChooseDirectories: + dup 0 send\ setAllowsMultipleSelection: ; CONSTANT: NSOKButton 1 CONSTANT: NSCancelButton 0 : (open-panel) ( panel -- paths ) - dup -> runModal NSOKButton = - [ -> filenames CF>string-array ] [ drop f ] if ; + dup send\ runModal NSOKButton = + [ send\ filenames CF>string-array ] [ drop f ] if ; : open-panel ( -- paths ) (open-panel) ; @@ -36,5 +36,5 @@ CONSTANT: NSCancelButton 0 : save-panel ( path -- path/f ) [ dup ] dip - split-path -> runModalForDirectory:file: NSOKButton = - [ -> filename CF>string ] [ drop f ] if ; + split-path send\ runModalForDirectory:file: NSOKButton = + [ send\ filename CF>string ] [ drop f ] if ; diff --git a/basis/cocoa/enumeration/enumeration.factor b/basis/cocoa/enumeration/enumeration.factor index 4f5a69697a..e86acefa70 100644 --- a/basis/cocoa/enumeration/enumeration.factor +++ b/basis/cocoa/enumeration/enumeration.factor @@ -17,7 +17,7 @@ CONSTANT: NS-EACH-BUFFER-SIZE 16 ] with-destructors ; inline :: (NSFastEnumeration-each) ( ... object quot: ( ... elt -- ) state stackbuf count -- ... ) - object state stackbuf count -> countByEnumeratingWithState:objects:count: :> items-count + object state stackbuf count send\ countByEnumeratingWithState:objects:count: :> items-count items-count 0 = [ state itemsPtr>> [ items-count id ] [ stackbuf ] if* :> items items-count [ items nth quot call ] each diff --git a/basis/cocoa/messages/messages-docs.factor b/basis/cocoa/messages/messages-docs.factor index a0eed26c5b..c41a547b4b 100644 --- a/basis/cocoa/messages/messages-docs.factor +++ b/basis/cocoa/messages/messages-docs.factor @@ -14,7 +14,7 @@ HELP: super-send HELP: objc-class { $values { "string" string } { "class" alien } } { $description "Outputs the Objective C class named by " { $snippet "string" } ". This class can then be used as the receiver in message sends calling class methods, for example:" -{ $code "NSMutableArray -> alloc" } } +{ $code "NSMutableArray send\ alloc" } } { $errors "Throws an error if there is no class named by " { $snippet "string" } "." } ; HELP: objc-meta-class diff --git a/basis/cocoa/nibs/nibs.factor b/basis/cocoa/nibs/nibs.factor index 2d242b49db..1439d652cd 100644 --- a/basis/cocoa/nibs/nibs.factor +++ b/basis/cocoa/nibs/nibs.factor @@ -6,15 +6,15 @@ IN: cocoa.nibs : load-nib ( name -- ) NSBundle - swap NSApp -> loadNibNamed:owner: + swap NSApp send\ loadNibNamed:owner: drop ; : nib-named ( nib-name -- anNSNib ) - NSNib -> alloc swap f -> initWithNibNamed:bundle: - dup [ -> autorelease ] when ; + NSNib send\ alloc swap f send\ initWithNibNamed:bundle: + dup [ send\ autorelease ] when ; : nib-objects ( anNSNib -- objects/f ) f - { void* } [ -> instantiateNibWithOwner:topLevelObjects: ] + { void* } [ send\ instantiateNibWithOwner:topLevelObjects: ] with-out-parameters swap [ CF>array ] [ drop f ] if ; diff --git a/basis/cocoa/pasteboard/pasteboard.factor b/basis/cocoa/pasteboard/pasteboard.factor index f98d69fe81..18d7172ec5 100644 --- a/basis/cocoa/pasteboard/pasteboard.factor +++ b/basis/cocoa/pasteboard/pasteboard.factor @@ -8,19 +8,19 @@ IN: cocoa.pasteboard CONSTANT: NSStringPboardType "NSStringPboardType" : pasteboard-string? ( pasteboard -- ? ) - NSStringPboardType swap -> types CF>string-array member? ; + NSStringPboardType swap send\ types CF>string-array member? ; : pasteboard-string ( pasteboard -- str ) - NSStringPboardType -> stringForType: + NSStringPboardType send\ stringForType: dup [ CF>string ] when ; : set-pasteboard-types ( seq pasteboard -- ) - swap -> autorelease f -> declareTypes:owner: drop ; + swap send\ autorelease f send\ declareTypes:owner: drop ; : set-pasteboard-string ( str pasteboard -- ) NSStringPboardType dup 1array pick set-pasteboard-types - [ swap ] dip -> setString:forType: drop ; + [ swap ] dip send\ setString:forType: drop ; : pasteboard-error ( error -- f ) "Pasteboard does not hold a string" diff --git a/basis/cocoa/plists/plists.factor b/basis/cocoa/plists/plists.factor index dccb43d026..cc97c2938f 100644 --- a/basis/cocoa/plists/plists.factor +++ b/basis/cocoa/plists/plists.factor @@ -8,10 +8,10 @@ core-foundation.utilities fry io.backend kernel macros math quotations sequences ; IN: cocoa.plists -: >plist ( value -- plist ) >cf -> autorelease ; +: >plist ( value -- plist ) >cf send\ autorelease ; : write-plist ( assoc path -- ) - [ >plist ] [ normalize-path ] bi* 0 -> writeToFile:atomically: + [ >plist ] [ normalize-path ] bi* 0 send\ writeToFile:atomically: [ "write-plist failed" throw ] unless ; DEFER: plist> @@ -19,30 +19,30 @@ DEFER: plist> ) ( NSNumber -- number ) - dup -> doubleValue dup >integer = - [ -> longLongValue ] [ -> doubleValue ] if ; + dup send\ doubleValue dup >integer = + [ send\ longLongValue ] [ send\ doubleValue ] if ; : (plist-NSData>) ( NSData -- byte-array ) - dup -> length [ -> getBytes: ] keep ; + dup send\ length [ send\ getBytes: ] keep ; : (plist-NSArray>) ( NSArray -- vector ) [ plist> ] NSFastEnumeration-map ; : (plist-NSDictionary>) ( NSDictionary -- hashtable ) - dup [ [ nip ] [ -> valueForKey: ] 2bi [ plist> ] bi@ ] with + dup [ [ nip ] [ send\ valueForKey: ] 2bi [ plist> ] bi@ ] with NSFastEnumeration>hashtable ; : (read-plist) ( NSData -- id ) NSPropertyListSerialization swap kCFPropertyListImmutable f { void* } - [ -> propertyListFromData:mutabilityOption:format:errorDescription: ] + [ send\ propertyListFromData:mutabilityOption:format:errorDescription: ] with-out-parameters - [ -> release "read-plist failed" throw ] when* ; + [ send\ release "read-plist failed" throw ] when* ; MACRO: objc-class-case ( alist -- quot ) [ dup callable? - [ first2 [ '[ dup _ execute -> isKindOfClass: c-bool> ] ] dip 2array ] + [ first2 [ '[ dup _ execute send\ isKindOfClass: c-bool> ] ] dip 2array ] unless ] map '[ _ cond ] ; @@ -63,5 +63,5 @@ ERROR: invalid-plist-object object ; : read-plist ( path -- assoc ) normalize-path - NSData swap -> dataWithContentsOfFile: + NSData swap send\ dataWithContentsOfFile: [ (read-plist) plist> ] [ "read-plist failed" throw ] if* ; diff --git a/basis/cocoa/touchbar/touchbar.factor b/basis/cocoa/touchbar/touchbar.factor index 8b9bfd4284..e0ddadcb7f 100644 --- a/basis/cocoa/touchbar/touchbar.factor +++ b/basis/cocoa/touchbar/touchbar.factor @@ -10,22 +10,22 @@ ENUM: default-touchbar refresh-all-action auto-use-action ; : enum>CFStringArray ( seq -- alien ) enum>keys - NSArray -> alloc - swap -> initWithArray: ; + NSArray send\ alloc + swap send\ initWithArray: ; : make-touchbar ( enum self -- touchbar ) - [ NSTouchBar -> alloc -> init dup ] dip -> setDelegate: { - [ swap enum>CFStringArray { void { id SEL id } } ?-> setDefaultItemIdentifiers: ] - [ swap enum>CFStringArray { void { id SEL id } } ?-> setCustomizationAllowedItemIdentifiers: ] + [ NSTouchBar send\ alloc send\ init dup ] dip send\ setDelegate: { + [ swap enum>CFStringArray { void { id SEL id } } ?send\ setDefaultItemIdentifiers: ] + [ swap enum>CFStringArray { void { id SEL id } } ?send\ setCustomizationAllowedItemIdentifiers: ] [ nip ] } 2cleave ; :: make-NSTouchBar-button ( self identifier label-string action-string -- button ) - NSCustomTouchBarItem -> alloc - identifier { id { id SEL id } } ?-> initWithIdentifier: :> item + NSCustomTouchBarItem send\ alloc + identifier { id { id SEL id } } ?send\ initWithIdentifier: :> item NSButton label-string self - action-string lookup-selector { id { id SEL id id SEL } } ?-> buttonWithTitle:target:action: :> button - item button -> setView: + action-string lookup-selector { id { id SEL id id SEL } } ?send\ buttonWithTitle:target:action: :> button + item button send\ setView: item ; diff --git a/basis/cocoa/views/views.factor b/basis/cocoa/views/views.factor index 6235e7df16..1dd910e4d9 100644 --- a/basis/cocoa/views/views.factor +++ b/basis/cocoa/views/views.factor @@ -59,21 +59,21 @@ CONSTANT: NSOpenGLProfileVersion3_2Core 0x3200 CONSTANT: NSOpenGLProfileVersion4_1Core 0x4100 : ( class dim pixel-format -- view ) - [ -> alloc ] + [ send\ alloc ] [ [ 0 0 ] dip first2 ] [ handle>> ] tri* - -> initWithFrame:pixelFormat: - dup 1 -> setPostsBoundsChangedNotifications: - dup 1 -> setPostsFrameChangedNotifications: ; + send\ initWithFrame:pixelFormat: + dup 1 send\ setPostsBoundsChangedNotifications: + dup 1 send\ setPostsFrameChangedNotifications: ; : view-dim ( view -- dim ) - -> bounds + send\ bounds [ CGRect-w >fixnum ] [ CGRect-h >fixnum ] bi 2array ; : mouse-location ( view event -- loc ) [ - -> locationInWindow f -> convertPoint:fromView: + send\ locationInWindow f send\ convertPoint:fromView: [ x>> ] [ y>> ] bi - ] [ drop -> frame CGRect-h ] 2bi + ] [ drop send\ frame CGRect-h ] 2bi swap - [ >integer ] bi@ 2array ; diff --git a/basis/cocoa/windows/windows.factor b/basis/cocoa/windows/windows.factor index 6031d29e26..2631256cd3 100644 --- a/basis/cocoa/windows/windows.factor +++ b/basis/cocoa/windows/windows.factor @@ -22,19 +22,19 @@ CONSTANT: NSBackingStoreNonretained 1 CONSTANT: NSBackingStoreBuffered 2 : ( rect style class -- window ) - [ -> alloc ] curry 2dip NSBackingStoreBuffered 1 - -> initWithContentRect:styleMask:backing:defer: ; + [ send\ alloc ] curry 2dip NSBackingStoreBuffered 1 + send\ initWithContentRect:styleMask:backing:defer: ; : class-for-style ( style -- NSWindow/NSPanel ) 0x1ef0 bitand zero? NSWindow NSPanel ? ; : ( view rect style -- window ) - dup class-for-style [ swap -> setContentView: ] keep - dup dup -> contentView -> setInitialFirstResponder: - dup 1 -> setAcceptsMouseMovedEvents: - dup 0 -> setReleasedWhenClosed: ; + dup class-for-style [ swap send\ setContentView: ] keep + dup dup send\ contentView send\ setInitialFirstResponder: + dup 1 send\ setAcceptsMouseMovedEvents: + dup 0 send\ setReleasedWhenClosed: ; : window-content-rect ( window -- rect ) - dup -> class swap - [ -> frame ] [ -> styleMask ] bi - -> contentRectForFrameRect:styleMask: ; + dup send\ class swap + [ send\ frame ] [ send\ styleMask ] bi + send\ contentRectForFrameRect:styleMask: ; diff --git a/basis/images/loader/cocoa/cocoa.factor b/basis/images/loader/cocoa/cocoa.factor index 4b0b48b33d..d29115f1bf 100644 --- a/basis/images/loader/cocoa/cocoa.factor +++ b/basis/images/loader/cocoa/cocoa.factor @@ -15,9 +15,9 @@ os macosx? [ : ( byte-array -- image-rep ) [ NSBitmapImageRep ] dip - -> autorelease - -> imageRepWithData: - -> CGImage ; + send\ autorelease + send\ imageRepWithData: + send\ CGImage ; :: CGImage>image ( image -- image ) image CGImageGetWidth :> w @@ -29,7 +29,7 @@ os macosx? [ : image>CGImage ( image -- image ) [ bitmap>> ] [ dim>> first2 ] bi 8 pick 4 * bitmap-color-space bitmap-flags - CGBitmapContextCreate -> autorelease + CGBitmapContextCreate send\ autorelease CGBitmapContextCreateImage ; M: ns-image stream>image* diff --git a/basis/tools/deploy/test/14/14.factor b/basis/tools/deploy/test/14/14.factor index d1872afff3..367d99c6a3 100644 --- a/basis/tools/deploy/test/14/14.factor +++ b/basis/tools/deploy/test/14/14.factor @@ -15,8 +15,8 @@ IN: tools.deploy.test.14 ;CLASS> : main ( -- ) - Bar -> alloc -> init - S{ CGRect f S{ CGPoint f 1.0 2.0 } S{ CGSize f 3.0 4.0 } } -> bar: + Bar send\ alloc send\ init + S{ CGRect f S{ CGPoint f 1.0 2.0 } S{ CGSize f 3.0 4.0 } } send\ bar: 10.0 assert= ; MAIN: main diff --git a/basis/ui/backend/cocoa/cocoa.factor b/basis/ui/backend/cocoa/cocoa.factor index 08cc6136a5..7e00072055 100644 --- a/basis/ui/backend/cocoa/cocoa.factor +++ b/basis/ui/backend/cocoa/cocoa.factor @@ -47,10 +47,10 @@ CONSTANT: attrib-table H{ M: cocoa-ui-backend (make-pixel-format) nip { } attrib-table pixel-format-attributes>int-array - NSOpenGLPixelFormat -> alloc swap -> initWithAttributes: ; + NSOpenGLPixelFormat send\ alloc swap send\ initWithAttributes: ; M: cocoa-ui-backend (free-pixel-format) - handle>> -> release ; + handle>> send\ release ; TUPLE: pasteboard handle ; @@ -63,7 +63,7 @@ M: pasteboard set-clipboard-contents handle>> set-pasteboard-string ; : init-clipboard ( -- ) - NSPasteboard -> generalPasteboard + NSPasteboard send\ generalPasteboard clipboard set-global selection set-global ; @@ -76,32 +76,32 @@ M: pasteboard set-clipboard-contents ! after register-window. dup { 0 0 } = [ drop - ui-windows get-global length 1 <= [ -> center ] [ + ui-windows get-global length 1 <= [ send\ center ] [ ui-windows get-global last second window-loc>> - dupd first2 -> cascadeTopLeftFromPoint: - -> setFrameTopLeftPoint: + dupd first2 send\ cascadeTopLeftFromPoint: + send\ setFrameTopLeftPoint: ] if - ] [ first2 -> setFrameTopLeftPoint: ] if ; + ] [ first2 send\ setFrameTopLeftPoint: ] if ; M: cocoa-ui-backend set-title ( string world -- ) - handle>> window>> swap -> setTitle: ; + handle>> window>> swap send\ setTitle: ; : enter-fullscreen ( world -- ) handle>> view>> - NSScreen -> mainScreen - f -> enterFullScreenMode:withOptions: + NSScreen send\ mainScreen + f send\ enterFullScreenMode:withOptions: drop ; : exit-fullscreen ( world -- ) handle>> - [ view>> f -> exitFullScreenModeWithOptions: ] - [ [ window>> ] [ view>> ] bi -> makeFirstResponder: drop ] bi ; + [ view>> f send\ exitFullScreenModeWithOptions: ] + [ [ window>> ] [ view>> ] bi send\ makeFirstResponder: drop ] bi ; M: cocoa-ui-backend (set-fullscreen) ( world ? -- ) [ enter-fullscreen ] [ exit-fullscreen ] if ; M: cocoa-ui-backend (fullscreen?) ( world -- ? ) - handle>> view>> -> isInFullScreenMode zero? not ; + handle>> view>> send\ isInFullScreenMode zero? not ; ! XXX: Until someone tests OSX with a tiling window manager, ! dialog-window is the same as normal-title-window @@ -121,8 +121,8 @@ CONSTANT: window-control>styleMask window-controls>> window-control>styleMask symbols>flags ; : make-context-transparent ( view -- ) - -> openGLContext - 0 int NSOpenGLCPSurfaceOpacity -> setValues:forParameter: ; + send\ openGLContext + 0 int NSOpenGLCPSurfaceOpacity send\ setValues:forParameter: ; M:: cocoa-ui-backend (open-window) ( world -- ) world [ [ dim>> ] dip ] @@ -130,27 +130,27 @@ M:: cocoa-ui-backend (open-window) ( world -- ) world window-controls>> textured-background swap member-eq? [ view make-context-transparent ] when view world [ world>NSRect ] [ world>styleMask ] bi :> window - view -> release + view send\ release world view register-window window world window-loc>> auto-position world window save-position window install-window-delegate view window world handle<< - window f -> makeKeyAndOrderFront: + window f send\ makeKeyAndOrderFront: t world active?<< ; M: cocoa-ui-backend (close-window) ( handle -- ) [ - view>> dup -> isInFullScreenMode zero? + view>> dup send\ isInFullScreenMode zero? [ drop ] - [ f -> exitFullScreenModeWithOptions: ] if - ] [ window>> -> release ] bi ; + [ f send\ exitFullScreenModeWithOptions: ] if + ] [ window>> send\ release ] bi ; M: cocoa-ui-backend (grab-input) ( handle -- ) 0 CGAssociateMouseAndMouseCursorPosition drop CGMainDisplayID CGDisplayHideCursor drop - window>> -> frame CGRect>rect rect-center - NSScreen -> screens 0 -> objectAtIndex: -> frame CGRect-h + window>> send\ frame CGRect>rect rect-center + NSScreen send\ screens 0 send\ objectAtIndex: send\ frame CGRect-h [ drop first ] [ swap second - ] 2bi [ GetCurrentButtonState zero? not ] [ yield ] while CGWarpMouseCursorPosition drop ; @@ -163,35 +163,35 @@ M: cocoa-ui-backend (ungrab-input) ( handle -- ) M: cocoa-ui-backend close-window ( gadget -- ) find-world [ handle>> [ - window>> -> close + window>> send\ close ] when* ] when* ; M: cocoa-ui-backend raise-window* ( world -- ) handle>> [ - window>> dup f -> orderFront: -> makeKeyWindow - NSApp 1 -> activateIgnoringOtherApps: + window>> dup f send\ orderFront: send\ makeKeyWindow + NSApp 1 send\ activateIgnoringOtherApps: ] when* ; M: window-handle select-gl-context ( handle -- ) - view>> -> openGLContext -> makeCurrentContext ; + view>> send\ openGLContext send\ makeCurrentContext ; M: window-handle flush-gl-context ( handle -- ) - view>> -> openGLContext -> flushBuffer ; + view>> send\ openGLContext send\ flushBuffer ; M: cocoa-ui-backend beep ( -- ) NSBeep ; M: cocoa-ui-backend resize-window - [ handle>> window>> ] [ first2 ] bi* -> setContentSize: ; + [ handle>> window>> ] [ first2 ] bi* send\ setContentSize: ; M: cocoa-ui-backend system-alert - NSAlert -> alloc -> init -> autorelease [ + NSAlert send\ alloc send\ init send\ autorelease [ { - [ swap -> setInformativeText: ] - [ swap -> setMessageText: ] - [ "OK" -> addButtonWithTitle: drop ] - [ -> runModal drop ] + [ swap send\ setInformativeText: ] + [ swap send\ setMessageText: ] + [ "OK" send\ addButtonWithTitle: drop ] + [ send\ runModal drop ] } cleave ] [ 2drop ] if* ; @@ -222,7 +222,7 @@ M: cocoa-ui-backend (with-ui) stop-io-thread init-thread-timer reset-thread-timer - NSApp -> run + NSApp send\ run ] ui-running ] with-cocoa ; diff --git a/basis/ui/backend/cocoa/tools/tools.factor b/basis/ui/backend/cocoa/tools/tools.factor index feed1a53dc..daa405422a 100644 --- a/basis/ui/backend/cocoa/tools/tools.factor +++ b/basis/ui/backend/cocoa/tools/tools.factor @@ -12,7 +12,7 @@ IN: ui.backend.cocoa.tools : finder-run-files ( alien -- ) CF>string-array listener-run-files NSApp NSApplicationDelegateReplySuccess - -> replyToOpenOrPrint: ; + send\ replyToOpenOrPrint: ; : menu-run-files ( -- ) open-panel [ listener-run-files ] when* ; @@ -71,8 +71,8 @@ IN: ui.backend.cocoa.tools : register-services ( -- ) NSApp - FactorServiceProvider -> alloc -> init - -> setServicesProvider: ; + FactorServiceProvider send\ alloc send\ init + send\ setServicesProvider: ; FUNCTION: void NSUpdateDynamicServices ( ) diff --git a/basis/ui/backend/cocoa/views/views.factor b/basis/ui/backend/cocoa/views/views.factor index 34785ac748..43c129b8d2 100644 --- a/basis/ui/backend/cocoa/views/views.factor +++ b/basis/ui/backend/cocoa/views/views.factor @@ -17,8 +17,8 @@ IN: ui.backend.cocoa.views ! Issue #1453 : button ( event -- n ) - ! Cocoa -> Factor UI button mapping - -> buttonNumber { + ! Cocoa send\ Factor UI button mapping + send\ buttonNumber { { 0 [ 1 ] } { 1 [ 3 ] } { 2 [ 2 ] } @@ -69,11 +69,11 @@ CONSTANT: key-codes } : key-code ( event -- string ? ) - dup -> keyCode key-codes at - [ t ] [ -> charactersIgnoringModifiers CF>string f ] ?if ; + dup send\ keyCode key-codes at + [ t ] [ send\ charactersIgnoringModifiers CF>string f ] ?if ; : event-modifiers ( event -- modifiers ) - -> modifierFlags modifiers modifier ; + send\ modifierFlags modifiers modifier ; : key-event>gesture ( event -- modifiers keycode action? ) [ event-modifiers ] [ key-code ] bi ; @@ -82,7 +82,7 @@ CONSTANT: key-codes swap window [ propagate-key-gesture ] [ drop ] if* ; : interpret-key-event ( view event -- ) - NSArray swap -> arrayWithObject: -> interpretKeyEvents: ; + NSArray swap send\ arrayWithObject: send\ interpretKeyEvents: ; : send-key-down-event ( view event -- ) [ key-event>gesture send-key-event ] @@ -110,7 +110,7 @@ CONSTANT: key-codes [ send-button-up ] [ 2drop ] if* ; : send-scroll$ ( view event -- ) - [ nip [ -> deltaX ] [ -> deltaY ] bi [ neg ] bi@ 2array ] + [ nip [ send\ deltaX ] [ send\ deltaY ] bi [ neg ] bi@ 2array ] [ mouse-location ] [ drop window ] 2tri @@ -167,7 +167,7 @@ CONSTANT: selector>action H{ METHOD: void prepareOpenGL [ self SEL: setWantsBestResolutionOpenGLSurface: - -> respondsToSelector: c-bool> [ + send\ respondsToSelector: c-bool> [ self SEL: setWantsBestResolutionOpenGLSurface: 1 void f "objc_msgSend" { id SEL char } f alien-invoke @@ -245,8 +245,8 @@ CONSTANT: selector>action H{ METHOD: char validateUserInterfaceItem: id event [ self window [ - event -> action utf8 alien>string validate-action - [ >c-bool ] [ drop self event SUPER-> validateUserInterfaceItem: ] if + event send\ action utf8 alien>string validate-action + [ >c-bool ] [ drop self event super\ validateUserInterfaceItem: ] if ] [ 0 ] if* ] ; @@ -278,7 +278,7 @@ CONSTANT: selector>action H{ METHOD: void magnifyWithEvent: id event [ self event - dup -> deltaZ sgn { + dup send\ deltaZ sgn { { 1 [ zoom-in-action send-action$ ] } { -1 [ zoom-out-action send-action$ ] } { 0 [ 2drop ] } @@ -288,12 +288,12 @@ CONSTANT: selector>action H{ METHOD: void swipeWithEvent: id event [ self event - dup -> deltaX sgn { + dup send\ deltaX sgn { { 1 [ left-action send-action$ ] } { -1 [ right-action send-action$ ] } { 0 [ - dup -> deltaY sgn { + dup send\ deltaY sgn { { 1 [ up-action send-action$ ] } { -1 [ down-action send-action$ ] } { 0 [ 2drop ] } @@ -353,7 +353,7 @@ CONSTANT: selector>action H{ METHOD: void unmarkText [ ] ; - METHOD: id validAttributesForMarkedText [ NSArray -> array ] ; + METHOD: id validAttributesForMarkedText [ NSArray send\ array ] ; METHOD: id attributedSubstringFromRange: NSRange range [ f ] ; @@ -376,7 +376,7 @@ CONSTANT: selector>action H{ METHOD: id initWithFrame: NSRect frame pixelFormat: id pixelFormat [ - self frame pixelFormat SUPER-> initWithFrame:pixelFormat: + self frame pixelFormat super\ initWithFrame:pixelFormat: dup dup add-resize-observer ] ; @@ -385,41 +385,41 @@ CONSTANT: selector>action H{ METHOD: void dealloc [ self remove-observer - self SUPER-> dealloc + self super\ dealloc ] ; ;CLASS> : sync-refresh-to-screen ( GLView -- ) - -> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 int + send\ openGLContext send\ CGLContextObj NSOpenGLCPSwapInterval 1 int CGLSetParameter drop ; : ( dim pixel-format -- view ) [ FactorView ] 2dip [ sync-refresh-to-screen ] keep ; : save-position ( world window -- ) - -> frame CGRect-top-left 2array >>window-loc drop ; + send\ frame CGRect-top-left 2array >>window-loc drop ; object -> contentView window - [ notification -> object save-position ] when* + notification send\ object send\ contentView window + [ notification send\ object save-position ] when* ] ; METHOD: void windowDidBecomeKey: id notification [ - notification -> object -> contentView window + notification send\ object send\ contentView window [ focus-world ] when* ] ; METHOD: void windowDidResignKey: id notification [ forget-rollover - notification -> object -> contentView :> view + notification send\ object send\ contentView :> view view window :> window window [ - view -> isInFullScreenMode 0 = + view send\ isInFullScreenMode 0 = [ window unfocus-world ] when ] when ] ; @@ -428,16 +428,16 @@ CONSTANT: selector>action H{ METHOD: void windowWillClose: id notification [ - notification -> object -> contentView + notification send\ object send\ contentView [ window ungraft ] [ unregister-window ] bi ] ; METHOD: void windowDidChangeBackingProperties: id notification [ - notification -> object dup SEL: backingScaleFactor - -> respondsToSelector: c-bool> [ - { double { id SEL } } ?-> backingScaleFactor + notification send\ object dup SEL: backingScaleFactor + send\ respondsToSelector: c-bool> [ + { double { id SEL } } ?send\ backingScaleFactor [ [ 1.0 > ] keep f ? gl-scale-factor set-global ] [ 1.0 > retina? set-global ] bi diff --git a/extra/qtkit/qtkit.factor b/extra/qtkit/qtkit.factor index 919e0d2d29..f7c58612b7 100644 --- a/extra/qtkit/qtkit.factor +++ b/extra/qtkit/qtkit.factor @@ -77,18 +77,18 @@ IMPORT: QTSampleBuffer IMPORT: QTTrack : ( filename -- movie ) - QTMovie swap f -> movieWithFile:error: -> retain ; + QTMovie swap f send\ movieWithFile:error: send\ retain ; : movie-attributes ( movie -- attributes ) - -> movieAttributes plist> ; + send\ movieAttributes plist> ; : play ( movie -- ) - -> play ; + send\ play ; : stop ( movie -- ) - -> stop ; + send\ stop ; : movie-tracks ( movie -- tracks ) - -> tracks NSFastEnumeration>vector ; + send\ tracks NSFastEnumeration>vector ; : track-attributes ( track -- attributes ) - -> trackAttributes plist> ; + send\ trackAttributes plist> ; diff --git a/extra/webkit-demo/webkit-demo.factor b/extra/webkit-demo/webkit-demo.factor index 8f89b1b4ae..9c4bfddec8 100644 --- a/extra/webkit-demo/webkit-demo.factor +++ b/extra/webkit-demo/webkit-demo.factor @@ -10,8 +10,8 @@ IMPORT: WebView : rect ( -- rect ) 0 0 700 500 ; : ( -- id ) - WebView -> alloc - rect f f -> initWithFrame:frameName:groupName: ; + WebView send\ alloc + rect f f send\ initWithFrame:frameName:groupName: ; CONSTANT: window-style flags{ @@ -25,12 +25,12 @@ CONSTANT: window-style rect window-style ; : load-url ( window url -- ) - [ -> contentView ] [ ] bi* -> setMainFrameURL: ; + [ send\ contentView ] [ ] bi* send\ setMainFrameURL: ; : webkit-demo ( -- ) - [ -> center ] - [ f -> makeKeyAndOrderFront: ] + [ send\ center ] + [ f send\ makeKeyAndOrderFront: ] [ "http://factorcode.org" load-url ] tri ; : run-webkit-demo ( -- )