Load fixes for Mac OS X-related libraries
parent
fa72e695a4
commit
005319da1a
|
@ -8,5 +8,3 @@ USING: kernel vocabs vocabs.loader sequences system ;
|
||||||
"ui.cocoa.tools" require
|
"ui.cocoa.tools" require
|
||||||
] when
|
] when
|
||||||
] when
|
] when
|
||||||
|
|
||||||
macosx? [ "ui.tools.deploy" require ] when
|
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
USING: cocoa.application debugger quotations help.markup
|
USING: debugger quotations help.markup help.syntax strings alien
|
||||||
help.syntax strings alien core-foundation ;
|
core-foundation ;
|
||||||
|
IN: cocoa.application
|
||||||
|
|
||||||
|
HELP: <NSString>
|
||||||
|
{ $values { "str" string } { "alien" alien } }
|
||||||
|
{ $description "Allocates an autoreleased " { $snippet "CFString" } "." } ;
|
||||||
|
|
||||||
|
{ <NSString> <CFString> CF>string } related-words
|
||||||
|
|
||||||
|
HELP: <NSArray>
|
||||||
|
{ $values { "seq" "a sequence of " { $link alien } " instances" } { "alien" alien } }
|
||||||
|
{ $description "Allocates an autoreleased " { $snippet "CFArray" } "." } ;
|
||||||
|
|
||||||
|
{ <NSArray> <CFArray> } related-words
|
||||||
|
|
||||||
HELP: with-autorelease-pool
|
HELP: with-autorelease-pool
|
||||||
{ $values { "quot" quotation } }
|
{ $values { "quot" quotation } }
|
||||||
|
|
|
@ -5,6 +5,10 @@ cocoa cocoa.classes cocoa.runtime sequences threads debugger
|
||||||
init inspector kernel.private ;
|
init inspector kernel.private ;
|
||||||
IN: cocoa.application
|
IN: cocoa.application
|
||||||
|
|
||||||
|
: <NSString> ( str -- alien ) <CFString> -> autorelease ;
|
||||||
|
|
||||||
|
: <NSArray> ( seq -- alien ) <CFArray> -> autorelease ;
|
||||||
|
|
||||||
: NSApplicationDelegateReplySuccess 0 ;
|
: NSApplicationDelegateReplySuccess 0 ;
|
||||||
: NSApplicationDelegateReplyCancel 1 ;
|
: NSApplicationDelegateReplyCancel 1 ;
|
||||||
: NSApplicationDelegateReplyFailure 2 ;
|
: NSApplicationDelegateReplyFailure 2 ;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
USING: cocoa cocoa.messages help.markup help.syntax strings
|
USING: cocoa.messages help.markup help.syntax strings
|
||||||
alien core-foundation ;
|
alien core-foundation ;
|
||||||
|
IN: cocoa
|
||||||
|
|
||||||
HELP: ->
|
HELP: ->
|
||||||
{ $syntax "-> selector" }
|
{ $syntax "-> selector" }
|
||||||
|
@ -15,18 +16,6 @@ HELP: SUPER->
|
||||||
|
|
||||||
{ send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words
|
{ send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words
|
||||||
|
|
||||||
HELP: <NSString>
|
|
||||||
{ $values { "str" string } { "alien" alien } }
|
|
||||||
{ $description "Allocates an autoreleased " { $snippet "CFString" } "." } ;
|
|
||||||
|
|
||||||
{ <NSString> <CFString> CF>string } related-words
|
|
||||||
|
|
||||||
HELP: <NSArray>
|
|
||||||
{ $values { "seq" "a sequence of " { $link alien } " instances" } { "alien" alien } }
|
|
||||||
{ $description "Allocates an autoreleased " { $snippet "CFArray" } "." } ;
|
|
||||||
|
|
||||||
{ <NSArray> <CFArray> } related-words
|
|
||||||
|
|
||||||
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."
|
||||||
{ $subsection import-objc-class }
|
{ $subsection import-objc-class }
|
||||||
|
|
|
@ -12,8 +12,6 @@ CLASS: {
|
||||||
[ data-gc "x" set 2drop ]
|
[ data-gc "x" set 2drop ]
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
recompile
|
|
||||||
|
|
||||||
: test-foo
|
: test-foo
|
||||||
Foo -> alloc -> init
|
Foo -> alloc -> init
|
||||||
dup 1.0 2.0 101.0 102.0 <NSRect> -> foo:
|
dup 1.0 2.0 101.0 102.0 <NSRect> -> foo:
|
||||||
|
@ -36,13 +34,11 @@ CLASS: {
|
||||||
[ 2drop test-foo "x" get ]
|
[ 2drop test-foo "x" get ]
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
recompile
|
|
||||||
|
|
||||||
Bar [
|
Bar [
|
||||||
-> alloc -> init
|
-> alloc -> init
|
||||||
dup -> bar "x" set
|
dup -> bar "x" set
|
||||||
-> release
|
-> release
|
||||||
] compile-1
|
] compile-call
|
||||||
|
|
||||||
[ 1 ] [ "x" get NSRect-x ] unit-test
|
[ 1 ] [ "x" get NSRect-x ] unit-test
|
||||||
[ 2 ] [ "x" get NSRect-y ] unit-test
|
[ 2 ] [ "x" get NSRect-y ] unit-test
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: compiler io kernel cocoa.runtime cocoa.subclassing
|
USING: compiler io kernel cocoa.runtime cocoa.subclassing
|
||||||
cocoa.messages cocoa.types sequences words vocabs parser
|
cocoa.messages cocoa.types sequences words vocabs parser
|
||||||
core-foundation namespaces assocs hashtables ;
|
core-foundation namespaces assocs hashtables definitions ;
|
||||||
IN: cocoa
|
IN: cocoa
|
||||||
|
|
||||||
: (remember-send) ( selector variable -- )
|
: (remember-send) ( selector variable -- )
|
||||||
|
@ -32,37 +32,36 @@ SYMBOL: super-sent-messages
|
||||||
|
|
||||||
{
|
{
|
||||||
"cocoa" "cocoa.runtime" "cocoa.messages" "cocoa.subclassing"
|
"cocoa" "cocoa.runtime" "cocoa.messages" "cocoa.subclassing"
|
||||||
} [ words ] map concat compile-batch
|
} [ words ] map concat compile
|
||||||
|
|
||||||
"Importing Cocoa classes..." print
|
"Importing Cocoa classes..." print
|
||||||
{
|
|
||||||
"NSApplication"
|
|
||||||
"NSArray"
|
|
||||||
"NSAutoreleasePool"
|
|
||||||
"NSBundle"
|
|
||||||
"NSError"
|
|
||||||
"NSEvent"
|
|
||||||
"NSException"
|
|
||||||
"NSMenu"
|
|
||||||
"NSMenuItem"
|
|
||||||
"NSNib"
|
|
||||||
"NSNotification"
|
|
||||||
"NSNotificationCenter"
|
|
||||||
"NSObject"
|
|
||||||
"NSOpenGLContext"
|
|
||||||
"NSOpenGLPixelFormat"
|
|
||||||
"NSOpenGLView"
|
|
||||||
"NSOpenPanel"
|
|
||||||
"NSPasteboard"
|
|
||||||
"NSResponder"
|
|
||||||
"NSSavePanel"
|
|
||||||
"NSView"
|
|
||||||
"NSWindow"
|
|
||||||
"NSWorkspace"
|
|
||||||
} [
|
|
||||||
[ ] import-objc-class
|
|
||||||
] each
|
|
||||||
|
|
||||||
: <NSString> ( str -- alien ) <CFString> -> autorelease ;
|
[
|
||||||
|
{
|
||||||
: <NSArray> ( seq -- alien ) <CFArray> -> autorelease ;
|
"NSApplication"
|
||||||
|
"NSArray"
|
||||||
|
"NSAutoreleasePool"
|
||||||
|
"NSBundle"
|
||||||
|
"NSError"
|
||||||
|
"NSEvent"
|
||||||
|
"NSException"
|
||||||
|
"NSMenu"
|
||||||
|
"NSMenuItem"
|
||||||
|
"NSNib"
|
||||||
|
"NSNotification"
|
||||||
|
"NSNotificationCenter"
|
||||||
|
"NSObject"
|
||||||
|
"NSOpenGLContext"
|
||||||
|
"NSOpenGLPixelFormat"
|
||||||
|
"NSOpenGLView"
|
||||||
|
"NSOpenPanel"
|
||||||
|
"NSPasteboard"
|
||||||
|
"NSResponder"
|
||||||
|
"NSSavePanel"
|
||||||
|
"NSView"
|
||||||
|
"NSWindow"
|
||||||
|
"NSWorkspace"
|
||||||
|
} [
|
||||||
|
[ ] import-objc-class
|
||||||
|
] each
|
||||||
|
] with-compilation-unit
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: cocoa.dialogs help.markup help.syntax ;
|
USING: help.markup help.syntax ;
|
||||||
|
IN: cocoa.dialogs
|
||||||
|
|
||||||
HELP: <NSOpenPanel>
|
HELP: <NSOpenPanel>
|
||||||
{ $values { "panel" "an " { $snippet "NSOpenPanel" } } }
|
{ $values { "panel" "an " { $snippet "NSOpenPanel" } } }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: cocoa.messages help.markup help.syntax strings alien ;
|
USING: help.markup help.syntax strings alien ;
|
||||||
|
IN: cocoa.messages
|
||||||
|
|
||||||
HELP: send
|
HELP: send
|
||||||
{ $values { "args..." "method arguments" } { "receiver" alien } { "selector" string } { "return..." "value returned by method, if any" } }
|
{ $values { "args..." "method arguments" } { "receiver" alien } { "selector" string } { "return..." "value returned by method, if any" } }
|
||||||
|
|
|
@ -16,7 +16,7 @@ IN: cocoa.messages
|
||||||
: sender-stub ( method function -- word )
|
: sender-stub ( method function -- word )
|
||||||
[ sender-stub-name f <word> dup ] 2keep
|
[ sender-stub-name f <word> dup ] 2keep
|
||||||
over first large-struct? [ "_stret" append ] when
|
over first large-struct? [ "_stret" append ] when
|
||||||
make-sender define-compound dup compile ;
|
make-sender define ;
|
||||||
|
|
||||||
SYMBOL: message-senders
|
SYMBOL: message-senders
|
||||||
SYMBOL: super-message-senders
|
SYMBOL: super-message-senders
|
||||||
|
@ -196,7 +196,7 @@ H{
|
||||||
: define-objc-class-word ( name quot -- )
|
: define-objc-class-word ( name quot -- )
|
||||||
[
|
[
|
||||||
over , , \ unless-defined , dup , \ objc-class ,
|
over , , \ unless-defined , dup , \ objc-class ,
|
||||||
] [ ] make >r "cocoa.classes" create r> define-compound ;
|
] [ ] make >r "cocoa.classes" create r> define ;
|
||||||
|
|
||||||
: import-objc-class ( name quot -- )
|
: import-objc-class ( name quot -- )
|
||||||
2dup unless-defined
|
2dup unless-defined
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: help.markup help.syntax cocoa.nibs strings ;
|
USING: help.markup help.syntax strings ;
|
||||||
|
IN: cocoa.nibs
|
||||||
|
|
||||||
HELP: load-nib
|
HELP: load-nib
|
||||||
{ $values { "name" string } }
|
{ $values { "name" string } }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: cocoa.pasteboard help.markup help.syntax strings ;
|
USING: help.markup help.syntax strings ;
|
||||||
|
IN: cocoa.pasteboard
|
||||||
|
|
||||||
HELP: pasteboard-string?
|
HELP: pasteboard-string?
|
||||||
{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "?" "a boolean" } }
|
{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "?" "a boolean" } }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: cocoa.subclassing help.markup help.syntax strings alien
|
USING: help.markup help.syntax strings alien hashtables ;
|
||||||
hashtables ;
|
IN: cocoa.subclassing
|
||||||
|
|
||||||
HELP: define-objc-class
|
HELP: define-objc-class
|
||||||
{ $values { "hash" hashtable } { "imeth" "a sequence of instance method definitions" } }
|
{ $values { "hash" hashtable } { "imeth" "a sequence of instance method definitions" } }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types arrays assocs combinators compiler
|
USING: alien alien.c-types arrays assocs combinators compiler
|
||||||
hashtables kernel libc math namespaces parser sequences words
|
hashtables kernel libc math namespaces parser sequences words
|
||||||
cocoa.messages cocoa.runtime ;
|
cocoa.messages cocoa.runtime definitions ;
|
||||||
IN: cocoa.subclassing
|
IN: cocoa.subclassing
|
||||||
|
|
||||||
: init-method ( method alien -- )
|
: init-method ( method alien -- )
|
||||||
|
@ -86,7 +86,9 @@ IN: cocoa.subclassing
|
||||||
] [ ] make define-temp ;
|
] [ ] make define-temp ;
|
||||||
|
|
||||||
: prepare-methods ( methods -- methods )
|
: prepare-methods ( methods -- methods )
|
||||||
[ first4 prepare-method 3array ] map ;
|
[
|
||||||
|
[ first4 prepare-method 3array ] map
|
||||||
|
] with-compilation-unit ;
|
||||||
|
|
||||||
: redefine-objc-methods ( imeth name -- )
|
: redefine-objc-methods ( imeth name -- )
|
||||||
dup class-exists? [
|
dup class-exists? [
|
||||||
|
@ -102,16 +104,13 @@ SYMBOL: +superclass+
|
||||||
: define-objc-class ( imeth hash -- )
|
: define-objc-class ( imeth hash -- )
|
||||||
clone [
|
clone [
|
||||||
prepare-methods
|
prepare-methods
|
||||||
|
+name+ get "cocoa.classes" create drop
|
||||||
+name+ get 2dup redefine-objc-methods swap [
|
+name+ get 2dup redefine-objc-methods swap [
|
||||||
+protocols+ get , +superclass+ get , +name+ get , ,
|
+protocols+ get , +superclass+ get , +name+ get , ,
|
||||||
\ (define-objc-class) ,
|
\ (define-objc-class) ,
|
||||||
] [ ] make import-objc-class
|
] [ ] make import-objc-class
|
||||||
] bind ;
|
] bind ;
|
||||||
|
|
||||||
: define-objc-class-early ( hash -- )
|
|
||||||
+name+ swap at "cocoa.classes" create drop ;
|
|
||||||
|
|
||||||
: CLASS:
|
: CLASS:
|
||||||
parse-definition unclip >r parsed r>
|
parse-definition unclip
|
||||||
>hashtable dup define-objc-class-early parsed
|
>hashtable define-objc-class ; parsing
|
||||||
\ define-objc-class parsed ; parsing
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: cocoa.types math help.markup help.syntax ;
|
USING: math help.markup help.syntax ;
|
||||||
|
IN: cocoa.types
|
||||||
|
|
||||||
HELP: <NSRect>
|
HELP: <NSRect>
|
||||||
{ $values { "x" real } { "y" real } { "w" real } { "h" real } { "rect" "an " { $snippet "NSRect" } } }
|
{ $values { "x" real } { "y" real } { "w" real } { "h" real } { "rect" "an " { $snippet "NSRect" } } }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: cocoa.views help.syntax help.markup ;
|
USING: help.syntax help.markup ;
|
||||||
|
IN: cocoa.views
|
||||||
|
|
||||||
HELP: <PixelFormat>
|
HELP: <PixelFormat>
|
||||||
{ $values { "pixelfmt" "an " { $snippet "NSOpenGLPixelFormat" } } }
|
{ $values { "pixelfmt" "an " { $snippet "NSOpenGLPixelFormat" } } }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: cocoa.windows help.markup help.syntax ;
|
USING: help.markup help.syntax ;
|
||||||
|
IN: cocoa.windows
|
||||||
|
|
||||||
HELP: <NSWindow>
|
HELP: <NSWindow>
|
||||||
{ $values { "rect" "an " { $snippet "NSRect" } } { "window" "an " { $snippet "NSWindow" } } }
|
{ $values { "rect" "an " { $snippet "NSRect" } } { "window" "an " { $snippet "NSWindow" } } }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: core-foundation alien strings arrays help.markup
|
USING: alien strings arrays help.markup help.syntax ;
|
||||||
help.syntax ;
|
IN: core-foundation
|
||||||
|
|
||||||
HELP: CF>array
|
HELP: CF>array
|
||||||
{ $values { "alien" "a " { $snippet "CFArray" } } { "array" "an array of " { $link alien } " instances" } }
|
{ $values { "alien" "a " { $snippet "CFArray" } } { "array" "an array of " { $link alien } " instances" } }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2006 Chris Double.
|
! Copyright (C) 2006 Chris Double.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: help.markup help.syntax parser-combinators ;
|
USING: help.markup help.syntax ;
|
||||||
|
IN: parser-combinators
|
||||||
|
|
||||||
HELP: list-of
|
HELP: list-of
|
||||||
{ $values
|
{ $values
|
||||||
|
|
|
@ -3,13 +3,13 @@ quotations io strings words definitions ;
|
||||||
IN: tools.profiler
|
IN: tools.profiler
|
||||||
|
|
||||||
ARTICLE: "profiling" "Profiling code"
|
ARTICLE: "profiling" "Profiling code"
|
||||||
"The " { $vocab-link "tools.profiler" } " vocabulary implements a simple call counting profiler. The profiler has three main limitations:"
|
"The " { $vocab-link "tools.profiler" } " vocabulary implements a simple call counting profiler. The profiler is completely accurate with words which are compiled with the non-optimizing compiler. Some optimizations performed by the optimizing compiler can inhibit accurate call counting, however:"
|
||||||
{ $list
|
{ $list
|
||||||
"Calls to primitives are not counted."
|
"The optimizing compiler open-codes certain primitives with inline machine code, and in some cases optimizes them out altogether; this includes stack shuffling operations, conditionals, and many object allocation operations."
|
||||||
{ "Calls to " { $link POSTPONE: inline } " words from words compiled with the optimizing compiler are not counted." }
|
{ "Calls to " { $link POSTPONE: inline } " words are not counted.." }
|
||||||
"Certain types of tail-recursive words compiled with the optimizing compiler will only count the initial invocation of the word, not every tail call."
|
"Tail-recursive loops will only count the initial invocation of the word, not every tail call."
|
||||||
}
|
}
|
||||||
"Quotations can be passed to a combinator which calls them with word call counting enabled:"
|
"Quotations can be passed to a combinator which calls them with the profiler enabled:"
|
||||||
{ $subsection profile }
|
{ $subsection profile }
|
||||||
"After a quotation has been profiled, call counts can be presented in various ways:"
|
"After a quotation has been profiled, call counts can be presented in various ways:"
|
||||||
{ $subsection profile. }
|
{ $subsection profile. }
|
||||||
|
|
Loading…
Reference in New Issue