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
|
||||
] when
|
||||
] when
|
||||
|
||||
macosx? [ "ui.tools.deploy" require ] when
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
USING: cocoa.application debugger quotations help.markup
|
||||
help.syntax strings alien core-foundation ;
|
||||
USING: debugger quotations help.markup help.syntax strings alien
|
||||
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
|
||||
{ $values { "quot" quotation } }
|
||||
|
|
|
@ -5,6 +5,10 @@ cocoa cocoa.classes cocoa.runtime sequences threads debugger
|
|||
init inspector kernel.private ;
|
||||
IN: cocoa.application
|
||||
|
||||
: <NSString> ( str -- alien ) <CFString> -> autorelease ;
|
||||
|
||||
: <NSArray> ( seq -- alien ) <CFArray> -> autorelease ;
|
||||
|
||||
: NSApplicationDelegateReplySuccess 0 ;
|
||||
: NSApplicationDelegateReplyCancel 1 ;
|
||||
: 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 ;
|
||||
IN: cocoa
|
||||
|
||||
HELP: ->
|
||||
{ $syntax "-> selector" }
|
||||
|
@ -15,18 +16,6 @@ HELP: SUPER->
|
|||
|
||||
{ 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"
|
||||
"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 }
|
||||
|
|
|
@ -12,8 +12,6 @@ CLASS: {
|
|||
[ data-gc "x" set 2drop ]
|
||||
} ;
|
||||
|
||||
recompile
|
||||
|
||||
: test-foo
|
||||
Foo -> alloc -> init
|
||||
dup 1.0 2.0 101.0 102.0 <NSRect> -> foo:
|
||||
|
@ -36,13 +34,11 @@ CLASS: {
|
|||
[ 2drop test-foo "x" get ]
|
||||
} ;
|
||||
|
||||
recompile
|
||||
|
||||
Bar [
|
||||
-> alloc -> init
|
||||
dup -> bar "x" set
|
||||
-> release
|
||||
] compile-1
|
||||
] compile-call
|
||||
|
||||
[ 1 ] [ "x" get NSRect-x ] unit-test
|
||||
[ 2 ] [ "x" get NSRect-y ] unit-test
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: compiler io kernel cocoa.runtime cocoa.subclassing
|
||||
cocoa.messages cocoa.types sequences words vocabs parser
|
||||
core-foundation namespaces assocs hashtables ;
|
||||
core-foundation namespaces assocs hashtables definitions ;
|
||||
IN: cocoa
|
||||
|
||||
: (remember-send) ( selector variable -- )
|
||||
|
@ -32,37 +32,36 @@ SYMBOL: super-sent-messages
|
|||
|
||||
{
|
||||
"cocoa" "cocoa.runtime" "cocoa.messages" "cocoa.subclassing"
|
||||
} [ words ] map concat compile-batch
|
||||
} [ words ] map concat compile
|
||||
|
||||
"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>
|
||||
{ $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
|
||||
{ $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-name f <word> dup ] 2keep
|
||||
over first large-struct? [ "_stret" append ] when
|
||||
make-sender define-compound dup compile ;
|
||||
make-sender define ;
|
||||
|
||||
SYMBOL: message-senders
|
||||
SYMBOL: super-message-senders
|
||||
|
@ -196,7 +196,7 @@ H{
|
|||
: define-objc-class-word ( name quot -- )
|
||||
[
|
||||
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 -- )
|
||||
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
|
||||
{ $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?
|
||||
{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "?" "a boolean" } }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: cocoa.subclassing help.markup help.syntax strings alien
|
||||
hashtables ;
|
||||
USING: help.markup help.syntax strings alien hashtables ;
|
||||
IN: cocoa.subclassing
|
||||
|
||||
HELP: define-objc-class
|
||||
{ $values { "hash" hashtable } { "imeth" "a sequence of instance method definitions" } }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.c-types arrays assocs combinators compiler
|
||||
hashtables kernel libc math namespaces parser sequences words
|
||||
cocoa.messages cocoa.runtime ;
|
||||
cocoa.messages cocoa.runtime definitions ;
|
||||
IN: cocoa.subclassing
|
||||
|
||||
: init-method ( method alien -- )
|
||||
|
@ -86,7 +86,9 @@ IN: cocoa.subclassing
|
|||
] [ ] make define-temp ;
|
||||
|
||||
: prepare-methods ( methods -- methods )
|
||||
[ first4 prepare-method 3array ] map ;
|
||||
[
|
||||
[ first4 prepare-method 3array ] map
|
||||
] with-compilation-unit ;
|
||||
|
||||
: redefine-objc-methods ( imeth name -- )
|
||||
dup class-exists? [
|
||||
|
@ -102,16 +104,13 @@ SYMBOL: +superclass+
|
|||
: define-objc-class ( imeth hash -- )
|
||||
clone [
|
||||
prepare-methods
|
||||
+name+ get "cocoa.classes" create drop
|
||||
+name+ get 2dup redefine-objc-methods swap [
|
||||
+protocols+ get , +superclass+ get , +name+ get , ,
|
||||
\ (define-objc-class) ,
|
||||
] [ ] make import-objc-class
|
||||
] bind ;
|
||||
|
||||
: define-objc-class-early ( hash -- )
|
||||
+name+ swap at "cocoa.classes" create drop ;
|
||||
|
||||
: CLASS:
|
||||
parse-definition unclip >r parsed r>
|
||||
>hashtable dup define-objc-class-early parsed
|
||||
\ define-objc-class parsed ; parsing
|
||||
parse-definition unclip
|
||||
>hashtable define-objc-class ; parsing
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
USING: cocoa.types math help.markup help.syntax ;
|
||||
USING: math help.markup help.syntax ;
|
||||
IN: cocoa.types
|
||||
|
||||
HELP: <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>
|
||||
{ $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>
|
||||
{ $values { "rect" "an " { $snippet "NSRect" } } { "window" "an " { $snippet "NSWindow" } } }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: core-foundation alien strings arrays help.markup
|
||||
help.syntax ;
|
||||
USING: alien strings arrays help.markup help.syntax ;
|
||||
IN: core-foundation
|
||||
|
||||
HELP: CF>array
|
||||
{ $values { "alien" "a " { $snippet "CFArray" } } { "array" "an array of " { $link alien } " instances" } }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! Copyright (C) 2006 Chris Double.
|
||||
! 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
|
||||
{ $values
|
||||
|
|
|
@ -3,13 +3,13 @@ quotations io strings words definitions ;
|
|||
IN: tools.profiler
|
||||
|
||||
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
|
||||
"Calls to primitives are not counted."
|
||||
{ "Calls to " { $link POSTPONE: inline } " words from words compiled with the optimizing compiler 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."
|
||||
"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 are not counted.." }
|
||||
"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 }
|
||||
"After a quotation has been profiled, call counts can be presented in various ways:"
|
||||
{ $subsection profile. }
|
||||
|
|
Loading…
Reference in New Issue