diff --git a/basis/alarms/alarms.factor b/basis/alarms/alarms.factor index ad1838b3df..9cc05b4159 100644 --- a/basis/alarms/alarms.factor +++ b/basis/alarms/alarms.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays calendar combinators generic init -kernel math namespaces sequences heaps boxes threads debugger +kernel math namespaces sequences heaps boxes threads quotations assocs math.order ; IN: alarms diff --git a/basis/bootstrap/threads/threads.factor b/basis/bootstrap/threads/threads.factor index 6c30489bb4..8b751f8458 100644 --- a/basis/bootstrap/threads/threads.factor +++ b/basis/bootstrap/threads/threads.factor @@ -1,7 +1,11 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. +USING: vocabs vocabs.loader kernel ; IN: bootstrap.threads USE: io.thread USE: threads -USE: debugger.threads + +"debugger" vocab [ + "debugger.threads" require +] when diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index ab12a93a31..e2c853ea77 100644 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -1,9 +1,9 @@ -! Copyright (C) 2006, 2007 Slava Pestov +! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.syntax io kernel namespaces core-foundation core-foundation.run-loop cocoa.messages cocoa cocoa.classes -cocoa.runtime sequences threads debugger init summary -kernel.private assocs ; +cocoa.runtime sequences threads init summary kernel.private +assocs ; IN: cocoa.application : ( str -- alien ) -> autorelease ; diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor index e33217a691..5f548bdeb8 100644 --- a/basis/cocoa/messages/messages.factor +++ b/basis/cocoa/messages/messages.factor @@ -2,21 +2,17 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.c-types alien.strings arrays assocs continuations combinators compiler compiler.alien kernel math -namespaces make parser prettyprint prettyprint.sections -quotations sequences strings words cocoa.runtime io macros -memoize debugger io.encodings.ascii effects libc libc.private -parser lexer init core-foundation fry generalizations -specialized-arrays.direct.alien ; +namespaces make parser quotations sequences strings words +cocoa.runtime io macros memoize io.encodings.ascii +effects libc libc.private parser lexer init core-foundation fry +generalizations specialized-arrays.direct.alien ; IN: cocoa.messages : make-sender ( method function -- quot ) [ over first , f , , second , \ alien-invoke , ] [ ] make ; -: sender-stub-name ( method function -- string ) - [ % "_" % unparse % ] "" make ; - : sender-stub ( method function -- word ) - [ sender-stub-name f dup ] 2keep + [ "( sender-stub )" f dup ] 2dip over first large-struct? [ "_stret" append ] when make-sender define ; @@ -78,12 +74,8 @@ MACRO: (send) ( selector super? -- quot ) : send ( receiver args... selector -- return... ) f (send) ; inline -\ send soft "break-after" set-word-prop - : super-send ( receiver args... selector -- return... ) t (send) ; inline -\ super-send soft "break-after" set-word-prop - ! Runtime introspection SYMBOL: class-init-hooks @@ -216,17 +208,6 @@ assoc-union alien>objc-types set-global : register-objc-methods ( class -- ) [ register-objc-method ] each-method-in-class ; -: method. ( method -- ) - { - [ method_getName sel_getName ] - [ method-return-type ] - [ method-arg-types ] - [ method_getImplementation ] - } cleave 4array . ; - -: methods. ( class -- ) - [ method. ] each-method-in-class ; - : class-exists? ( string -- class ) objc_getClass >boolean ; : define-objc-class-word ( quot name -- ) @@ -238,11 +219,8 @@ assoc-union alien>objc-types set-global : import-objc-class ( name quot -- ) over define-objc-class-word - '[ - _ - [ objc-class register-objc-methods ] - [ objc-meta-class register-objc-methods ] bi - ] try ; + [ objc-class register-objc-methods ] + [ objc-meta-class register-objc-methods ] bi ; : root-class ( class -- root ) dup class_getSuperclass [ root-class ] [ ] ?if ; diff --git a/basis/functors/functors.factor b/basis/functors/functors.factor index 7126806c3d..7dab80c22d 100644 --- a/basis/functors/functors.factor +++ b/basis/functors/functors.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel locals.private quotations classes.tuple make -combinators generic words interpolate namespaces sequences -io.streams.string fry classes.mixin effects lexer parser -classes.tuple.parser effects.parser ; +USING: kernel quotations classes.tuple make combinators generic +words interpolate namespaces sequences io.streams.string fry +classes.mixin effects lexer parser classes.tuple.parser +effects.parser locals.types locals.parser locals.rewrite.closures ; IN: functors : scan-param ( -- obj ) @@ -101,6 +101,6 @@ DEFER: ;FUNCTOR delimiter CREATE parse-locals parse-functor-body swap pop-locals - lambda-rewrite first ; + rewrite-closures first ; : FUNCTOR: (FUNCTOR:) define ; parsing diff --git a/basis/help/handbook/handbook.factor b/basis/help/handbook/handbook.factor index 2ed86a0a19..cc36e9faab 100644 --- a/basis/help/handbook/handbook.factor +++ b/basis/help/handbook/handbook.factor @@ -1,7 +1,7 @@ USING: help help.markup help.syntax help.definitions help.topics namespaces words sequences classes assocs vocabs kernel arrays -prettyprint.backend kernel.private io generic math system -strings sbufs vectors byte-arrays quotations +prettyprint.backend prettyprint.custom kernel.private io generic +math system strings sbufs vectors byte-arrays quotations io.streams.byte-array classes.builtin parser lexer classes.predicate classes.union classes.intersection classes.singleton classes.tuple tools.vocabs.browser math.parser diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index 0442d4c227..a998e5394b 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -10,7 +10,7 @@ sequences sequences.private slots.private strings strings.private system threads.private classes.tuple classes.tuple.private vectors vectors.private words definitions words.private assocs summary compiler.units system.private -combinators locals locals.backend locals.private words.private +combinators locals locals.backend locals.types words.private quotations.private stack-checker.values stack-checker.alien stack-checker.state diff --git a/basis/tools/cocoa/cocoa.factor b/basis/tools/cocoa/cocoa.factor new file mode 100644 index 0000000000..a8cdf6f41c --- /dev/null +++ b/basis/tools/cocoa/cocoa.factor @@ -0,0 +1,16 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays cocoa.messages cocoa.runtime combinators +prettyprint ; +IN: tools.cocoa + +: method. ( method -- ) + { + [ method_getName sel_getName ] + [ method-return-type ] + [ method-arg-types ] + [ method_getImplementation ] + } cleave 4array . ; + +: methods. ( class -- ) + [ method. ] each-method-in-class ; diff --git a/basis/tools/cocoa/tags.txt b/basis/tools/cocoa/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/tools/cocoa/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/tools/deploy/backend/backend.factor b/basis/tools/deploy/backend/backend.factor index f33e4840eb..ee8615ac5a 100644 --- a/basis/tools/deploy/backend/backend.factor +++ b/basis/tools/deploy/backend/backend.factor @@ -89,7 +89,8 @@ DEFER: ?make-staging-image [ drop ] [ make-staging-image ] if ; : make-deploy-config ( vocab -- file ) - [ deploy-config unparse-use ] [ "deploy-config-" prepend ] bi + [ deploy-config unparse-use ] + [ "deploy-config-" prepend temp-file ] bi [ utf8 set-file-contents ] keep ; : deploy-command-line ( image vocab config -- flags ) diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index 9cc48972fa..af065c9bf6 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -31,6 +31,10 @@ urls math.parser ; [ t ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test +os macosx? [ + [ t ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test +] when + : run-temp-image ( -- ) vm "-i=" "test.image" temp-file append diff --git a/basis/tools/deploy/macosx/macosx.factor b/basis/tools/deploy/macosx/macosx.factor index d3464993e1..1f0e482441 100644 --- a/basis/tools/deploy/macosx/macosx.factor +++ b/basis/tools/deploy/macosx/macosx.factor @@ -1,10 +1,11 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.files kernel namespaces make sequences -system tools.deploy.backend tools.deploy.config assocs -hashtables prettyprint io.unix.backend cocoa io.encodings.utf8 -io.backend cocoa.application cocoa.classes cocoa.plists -qualified combinators ; +USING: io io.files kernel namespaces make sequences system +tools.deploy.backend tools.deploy.config +tools.deploy.config.editor assocs hashtables prettyprint +io.unix.backend cocoa io.encodings.utf8 io.backend +cocoa.application cocoa.classes cocoa.plists qualified +combinators ; IN: tools.deploy.macosx : bundle-dir ( -- dir ) diff --git a/basis/tools/deploy/shaker/strip-cocoa.factor b/basis/tools/deploy/shaker/strip-cocoa.factor index d5249dc20c..773b2d0f3b 100644 --- a/basis/tools/deploy/shaker/strip-cocoa.factor +++ b/basis/tools/deploy/shaker/strip-cocoa.factor @@ -25,11 +25,6 @@ H{ } clone \ pool [ global [ "stop-after-last-window?" "ui" lookup set - "ui.cocoa" vocab [ - [ "MiniFactor.nib" load-nib ] - "cocoa-init-hook" "ui.cocoa" lookup set-global - ] when - ! Only keeps those methods that we actually call sent-messages get super-sent-messages get assoc-union objc-methods [ assoc-intersect pool-values ] change diff --git a/basis/ui/cocoa/cocoa.factor b/basis/ui/cocoa/cocoa.factor index 42063fbf73..b90f4d34fe 100644 --- a/basis/ui/cocoa/cocoa.factor +++ b/basis/ui/cocoa/cocoa.factor @@ -3,9 +3,10 @@ USING: accessors math arrays assocs cocoa cocoa.application command-line kernel memory namespaces cocoa.messages cocoa.runtime cocoa.subclassing cocoa.pasteboard cocoa.types -cocoa.windows cocoa.classes cocoa.application sequences system -ui ui.backend ui.clipboards ui.gadgets ui.gadgets.worlds -ui.cocoa.views core-foundation threads math.geometry.rect fry ; +cocoa.windows cocoa.classes cocoa.application cocoa.nibs +sequences system ui ui.backend ui.clipboards ui.gadgets +ui.gadgets.worlds ui.cocoa.views core-foundation threads +math.geometry.rect fry ; IN: ui.cocoa TUPLE: handle view window ; @@ -110,7 +111,9 @@ CLASS: { SYMBOL: cocoa-init-hook -cocoa-init-hook global [ [ install-app-delegate ] or ] change-at +cocoa-init-hook global [ + [ "MiniFactor.nib" load-nib install-app-delegate ] or +] change-at M: cocoa-ui-backend ui "UI" assert.app [ diff --git a/basis/ui/tools/deploy/deploy.factor b/basis/ui/tools/deploy/deploy.factor index f023b0959a..f233c9f162 100644 --- a/basis/ui/tools/deploy/deploy.factor +++ b/basis/ui/tools/deploy/deploy.factor @@ -1,11 +1,11 @@ -! Copyright (C) 2007 Slava Pestov. +! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: ui.gadgets colors kernel ui.render namespaces models models.mapping sequences ui.gadgets.buttons ui.gadgets.packs -ui.gadgets.labels tools.deploy.config namespaces -ui.gadgets.editors ui.gadgets.borders ui.gestures ui.commands -assocs ui.gadgets.tracks ui ui.tools.listener tools.deploy -vocabs ui.tools.workspace system accessors fry ; +ui.gadgets.labels tools.deploy.config tools.deploy.config.editor +namespaces ui.gadgets.editors ui.gadgets.borders ui.gestures +ui.commands assocs ui.gadgets.tracks ui ui.tools.listener +tools.deploy vocabs ui.tools.workspace system accessors fry ; IN: ui.tools.deploy TUPLE: deploy-gadget < pack vocab settings ; diff --git a/basis/unix/debugger/debugger.factor b/basis/unix/debugger/debugger.factor new file mode 100644 index 0000000000..713c2202d4 --- /dev/null +++ b/basis/unix/debugger/debugger.factor @@ -0,0 +1,18 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: debugger prettyprint accessors io ; +IN: unix.debugger + +M: unix-error error. + "Unix system call failed:" print + nl + dup message>> write " (" write errno>> pprint ")" print ; + +M: unix-system-call-error error. + "Unix system call ``" write dup word>> pprint "'' failed:" print + nl + dup message>> write " (" write dup errno>> pprint ")" print + nl + "It was called with the following arguments:" print + nl + args>> stack. ; diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index d917425bf9..555f8e2c7d 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -1,10 +1,10 @@ -! Copyright (C) 2005, 2007 Slava Pestov. +! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.syntax kernel libc sequences continuations byte-arrays strings math namespaces system combinators vocabs.loader qualified accessors stack-checker macros locals generalizations unix.types -debugger io prettyprint io.files ; +io io.files vocabs vocabs.loader ; IN: unix : PROT_NONE 0 ; inline @@ -60,26 +60,12 @@ FUNCTION: char* strerror ( int errno ) ; ERROR: unix-error errno message ; -M: unix-error error. - "Unix system call failed:" print - nl - dup message>> write " (" write errno>> pprint ")" print ; - : (io-error) ( -- * ) err_no dup strerror unix-error ; : io-error ( n -- ) 0 < [ (io-error) ] when ; ERROR: unix-system-call-error args errno message word ; -M: unix-system-call-error error. - "Unix system call ``" write dup word>> pprint "'' failed:" print - nl - dup message>> write " (" write dup errno>> pprint ")" print - nl - "It was called with the following arguments:" print - nl - args>> stack. ; - MACRO:: unix-system-call ( quot -- ) [let | n [ quot infer in>> ] word [ quot first ] | @@ -236,3 +222,7 @@ FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ; { [ os bsd? ] [ "unix.bsd" require ] } { [ os solaris? ] [ "unix.solaris" require ] } } cond + +"debugger" vocab [ + "unix.debugger" require +] when diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index 767c2a1f79..3ae50a9a15 100644 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -78,7 +78,7 @@ M: pathname forget* SYMBOL: file -TUPLE: source-file-error file error ; +TUPLE: source-file-error error file ; : ( msg -- error ) \ source-file-error new