Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2008-10-02 12:52:42 -05:00
commit 695d3dd2d2
793 changed files with 103 additions and 1010 deletions

0
basis/alarms/alarms-docs.factor Executable file → Normal file
View File

0
basis/alarms/alarms-tests.factor Executable file → Normal file
View File

0
basis/alarms/alarms.factor Executable file → Normal file
View File

0
basis/alias/alias.factor Executable file → Normal file
View File

0
basis/alien/arrays/arrays-docs.factor Executable file → Normal file
View File

0
basis/alien/c-types/c-types-docs.factor Executable file → Normal file
View File

0
basis/alien/c-types/c-types-tests.factor Executable file → Normal file
View File

0
basis/alien/c-types/c-types.factor Executable file → Normal file
View File

0
basis/alien/remote-control/remote-control.factor Executable file → Normal file
View File

0
basis/alien/strings/strings.factor Executable file → Normal file
View File

0
basis/alien/structs/structs-docs.factor Executable file → Normal file
View File

0
basis/alien/structs/structs.factor Executable file → Normal file
View File

0
basis/alien/syntax/syntax-docs.factor Executable file → Normal file
View File

0
basis/alien/syntax/syntax.factor Executable file → Normal file
View File

0
basis/ascii/ascii-docs.factor Executable file → Normal file
View File

0
basis/ascii/ascii.factor Executable file → Normal file
View File

0
basis/bit-arrays/bit-arrays-tests.factor Executable file → Normal file
View File

0
basis/bit-arrays/bit-arrays.factor Executable file → Normal file
View File

0
basis/bit-vectors/bit-vectors-docs.factor Executable file → Normal file
View File

0
basis/bit-vectors/bit-vectors-tests.factor Executable file → Normal file
View File

0
basis/bit-vectors/bit-vectors.factor Executable file → Normal file
View File

0
basis/bootstrap/compiler/compiler.factor Executable file → Normal file
View File

0
basis/bootstrap/handbook/handbook.factor Executable file → Normal file
View File

0
basis/bootstrap/help/help.factor Executable file → Normal file
View File

0
basis/bootstrap/image/image-tests.factor Executable file → Normal file
View File

0
basis/bootstrap/image/image.factor Executable file → Normal file
View File

0
basis/bootstrap/image/upload/upload.factor Executable file → Normal file
View File

0
basis/bootstrap/io/io.factor Executable file → Normal file
View File

0
basis/bootstrap/random/random.factor Executable file → Normal file
View File

0
basis/bootstrap/stage2.factor Executable file → Normal file
View File

0
basis/bootstrap/tools/tools.factor Executable file → Normal file
View File

0
basis/bootstrap/ui/tools/tools.factor Executable file → Normal file
View File

0
basis/bootstrap/unicode/unicode.factor Executable file → Normal file
View File

0
basis/boxes/boxes-docs.factor Executable file → Normal file
View File

0
basis/boxes/boxes-tests.factor Executable file → Normal file
View File

0
basis/boxes/boxes.factor Executable file → Normal file
View File

0
basis/calendar/calendar-tests.factor Executable file → Normal file
View File

0
basis/calendar/calendar.factor Executable file → Normal file
View File

0
basis/calendar/format/format-tests.factor Executable file → Normal file
View File

0
basis/calendar/format/format.factor Executable file → Normal file
View File

0
basis/calendar/model/model.factor Executable file → Normal file
View File

0
basis/calendar/windows/windows.factor Executable file → Normal file
View File

0
basis/channels/channels-tests.factor Executable file → Normal file
View File

0
basis/channels/channels.factor Executable file → Normal file
View File

0
basis/channels/examples/examples.factor Executable file → Normal file
View File

0
basis/channels/remote/remote.factor Executable file → Normal file
View File

0
basis/checksums/adler-32/adler-32-docs.factor Executable file → Normal file
View File

0
basis/checksums/md5/md5-docs.factor Executable file → Normal file
View File

0
basis/checksums/md5/md5-tests.factor Executable file → Normal file
View File

0
basis/checksums/md5/md5.factor Executable file → Normal file
View File

0
basis/checksums/sha1/sha1-tests.factor Executable file → Normal file
View File

0
basis/checksums/sha1/sha1.factor Executable file → Normal file
View File

0
basis/checksums/sha2/sha2-tests.factor Executable file → Normal file
View File

0
basis/checksums/sha2/sha2.factor Executable file → Normal file
View File

0
basis/circular/circular-tests.factor Executable file → Normal file
View File

0
basis/circular/circular.factor Executable file → Normal file
View File

View File

@ -26,6 +26,10 @@ HELP: with-cocoa
{ $values { "quot" quotation } } { $values { "quot" quotation } }
{ $description "Sets up an autorelease pool, initializes the " { $snippet "NSApplication" } " singleton, and calls the quotation." } ; { $description "Sets up an autorelease pool, initializes the " { $snippet "NSApplication" } " singleton, and calls the quotation." } ;
HELP: cocoa-app
{ $values { "quot" quotation } }
{ $description "Initializes Cocoa, calls the quotation, and starts the Cocoa event loop." } ;
HELP: do-event HELP: do-event
{ $values { "app" "an " { $snippet "NSApplication" } } { "?" "a boolean" } } { $values { "app" "an " { $snippet "NSApplication" } } { "?" "a boolean" } }
{ $description "Processes a pending event in the queue, if any, returning a boolean indicating if there was one. Does not block." } ; { $description "Processes a pending event in the queue, if any, returning a boolean indicating if there was one. Does not block." } ;
@ -46,13 +50,16 @@ HELP: objc-error
{ $error-description "Thrown by the Objective C runtime when an error occurs, for example, sending a message to an object with an unrecognized selector." } ; { $error-description "Thrown by the Objective C runtime when an error occurs, for example, sending a message to an object with an unrecognized selector." } ;
ARTICLE: "cocoa-application-utils" "Cocoa application utilities" ARTICLE: "cocoa-application-utils" "Cocoa application utilities"
"Utilities:"
{ $subsection NSApp } { $subsection NSApp }
{ $subsection with-autorelease-pool }
{ $subsection with-cocoa }
{ $subsection do-event } { $subsection do-event }
{ $subsection add-observer } { $subsection add-observer }
{ $subsection remove-observer } { $subsection remove-observer }
{ $subsection install-delegate } ; { $subsection install-delegate }
"Combinators:"
{ $subsection cocoa-app }
{ $subsection with-autorelease-pool }
{ $subsection with-cocoa } ;
IN: cocoa.application IN: cocoa.application
ABOUT: "cocoa-application-utils" ABOUT: "cocoa-application-utils"

9
basis/cocoa/application/application.factor Executable file → Normal file
View File

@ -30,7 +30,7 @@ IN: cocoa.application
FUNCTION: void NSBeep ( ) ; FUNCTION: void NSBeep ( ) ;
: with-cocoa ( quot -- ) : with-cocoa ( quot -- )
[ NSApp drop call ] with-autorelease-pool ; [ NSApp drop call ] with-autorelease-pool ; inline
: next-event ( app -- event ) : next-event ( app -- event )
0 f CFRunLoopDefaultMode 1 0 f CFRunLoopDefaultMode 1
@ -50,6 +50,13 @@ FUNCTION: void NSBeep ( ) ;
: finish-launching ( -- ) NSApp -> finishLaunching ; : finish-launching ( -- ) NSApp -> finishLaunching ;
: cocoa-app ( quot -- )
[
call
finish-launching
NSApp -> run
] with-cocoa ; inline
: install-delegate ( receiver delegate -- ) : install-delegate ( receiver delegate -- )
-> alloc -> init -> setDelegate: ; -> alloc -> init -> setDelegate: ;

View File

@ -16,9 +16,16 @@ HELP: SUPER->
{ send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words { send super-send POSTPONE: -> 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\" <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."
{ $subsection import-objc-class } { $subsection 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:"

12
basis/cocoa/cocoa.factor Executable file → Normal file
View File

@ -3,7 +3,7 @@
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 compiler.units core-foundation namespaces assocs hashtables compiler.units
lexer ; lexer init ;
IN: cocoa IN: cocoa
: (remember-send) ( selector variable -- ) : (remember-send) ( selector variable -- )
@ -27,6 +27,16 @@ SYMBOL: super-sent-messages
scan dup remember-super-send parsed \ super-send parsed ; scan dup remember-super-send parsed \ super-send parsed ;
parsing parsing
SYMBOL: frameworks
frameworks global [ V{ } clone or ] change-at
[ frameworks get [ load-framework ] each ] "cocoa.messages" add-init-hook
: FRAMEWORK: scan [ load-framework ] [ frameworks get push ] bi ; parsing
: IMPORT: scan [ ] import-objc-class ; parsing
"Compiling Objective C bridge..." print "Compiling Objective C bridge..." print
"cocoa.classes" create-vocab drop "cocoa.classes" create-vocab drop

View File

@ -32,11 +32,7 @@ HELP: alien>objc-types
HELP: import-objc-class HELP: import-objc-class
{ $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( -- )" } } } { $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( -- )" } } }
{ $description "If a class named " { $snippet "name" } " is already known to the Objective C interface, does nothing. Otherwise, first calls the quotation. The quotation should make the class available to the Objective C runtime if necessary, either by loading a framework or defining it directly. After the quotation returns, this word makes the class available to Factor programs by importing methods and creating a class word the class object in the " { $vocab-link "cocoa.classes" } " vocabulary." } { $description "If a class named " { $snippet "name" } " is already known to the Objective C interface, does nothing. Otherwise, first calls the quotation. The quotation should make the class available to the Objective C runtime if necessary, either by loading a framework or defining it directly. After the quotation returns, this word makes the class available to Factor programs by importing methods and creating a class word the class object in the " { $vocab-link "cocoa.classes" } " vocabulary." } ;
{ $notes "In most cases, the quotation should be " { $link f } "." }
{ $examples
{ $code "\"QTMovie\" f import-objc-class" "QTMovie \"My Movie.mov\" <NSString> f -> movieWithFile:error:" }
} ;
HELP: root-class HELP: root-class
{ $values { "class" alien } { "root" alien } } { $values { "class" alien } { "root" alien } }

3
basis/cocoa/messages/messages.factor Executable file → Normal file
View File

@ -4,7 +4,8 @@ USING: accessors alien alien.c-types alien.strings arrays assocs
combinators compiler kernel math namespaces make parser combinators compiler kernel math namespaces make parser
prettyprint prettyprint.sections quotations sequences strings prettyprint prettyprint.sections quotations sequences strings
words cocoa.runtime io macros memoize debugger words cocoa.runtime io macros memoize debugger
io.encodings.ascii effects compiler.generator libc libc.private ; io.encodings.ascii effects compiler.generator libc libc.private
parser lexer init core-foundation ;
IN: cocoa.messages IN: cocoa.messages
: make-sender ( method function -- quot ) : make-sender ( method function -- quot )

0
basis/cocoa/pasteboard/pasteboard.factor Executable file → Normal file
View File

0
basis/cocoa/subclassing/subclassing.factor Executable file → Normal file
View File

0
basis/cocoa/windows/windows.factor Executable file → Normal file
View File

0
basis/combinators/short-circuit/short-circuit.factor Executable file → Normal file
View File

0
basis/compiler/compiler-docs.factor Executable file → Normal file
View File

0
basis/compiler/compiler.factor Executable file → Normal file
View File

0
basis/compiler/constants/constants.factor Executable file → Normal file
View File

0
basis/compiler/generator/fixup/fixup.factor Executable file → Normal file
View File

0
basis/compiler/generator/generator-docs.factor Executable file → Normal file
View File

0
basis/compiler/generator/generator.factor Executable file → Normal file
View File

0
basis/compiler/generator/registers/registers.factor Executable file → Normal file
View File

0
basis/compiler/tests/alien.factor Executable file → Normal file
View File

0
basis/compiler/tests/curry.factor Executable file → Normal file
View File

0
basis/compiler/tests/float.factor Executable file → Normal file
View File

0
basis/compiler/tests/intrinsics.factor Executable file → Normal file
View File

0
basis/compiler/tests/optimizer.factor Executable file → Normal file
View File

0
basis/compiler/tests/simple.factor Executable file → Normal file
View File

0
basis/compiler/tests/stack-trace.factor Executable file → Normal file
View File

0
basis/compiler/tests/templates-early.factor Executable file → Normal file
View File

0
basis/compiler/tests/templates.factor Executable file → Normal file
View File

0
basis/compiler/tests/tuples.factor Executable file → Normal file
View File

0
basis/compiler/tree/dead-code/simple/simple.factor Executable file → Normal file
View File

0
basis/compiler/tree/def-use/def-use-tests.factor Executable file → Normal file
View File

0
basis/compiler/tree/def-use/def-use.factor Executable file → Normal file
View File

0
basis/compiler/tree/propagation/propagation.factor Executable file → Normal file
View File

0
basis/compiler/tree/tree.factor Executable file → Normal file
View File

0
basis/concurrency/combinators/combinators-docs.factor Executable file → Normal file
View File

0
basis/concurrency/combinators/combinators-tests.factor Executable file → Normal file
View File

0
basis/concurrency/combinators/combinators.factor Executable file → Normal file
View File

0
basis/concurrency/conditions/conditions.factor Executable file → Normal file
View File

0
basis/concurrency/count-downs/count-downs-docs.factor Executable file → Normal file
View File

0
basis/concurrency/count-downs/count-downs-tests.factor Executable file → Normal file
View File

0
basis/concurrency/count-downs/count-downs.factor Executable file → Normal file
View File

0
basis/concurrency/distributed/distributed-docs.factor Executable file → Normal file
View File

0
basis/concurrency/distributed/distributed-tests.factor Executable file → Normal file
View File

2
basis/concurrency/distributed/distributed.factor Executable file → Normal file
View File

@ -10,7 +10,7 @@ SYMBOL: local-node
: handle-node-client ( -- ) : handle-node-client ( -- )
deserialize deserialize
[ first2 get-process send ] [ stop-server ] if* ; [ first2 get-process send ] [ stop-this-server ] if* ;
: <node-server> ( addrspec -- threaded-server ) : <node-server> ( addrspec -- threaded-server )
<threaded-server> <threaded-server>

0
basis/concurrency/exchangers/exchangers-docs.factor Executable file → Normal file
View File

0
basis/concurrency/exchangers/exchangers-tests.factor Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More