Untangling more dependencies

db4
Slava Pestov 2008-12-08 16:02:31 -06:00
parent ba6f63ff56
commit 7940020491
18 changed files with 90 additions and 79 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman. ! Copyright (C) 2005, 2008 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays calendar combinators generic init 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 ; quotations assocs math.order ;
IN: alarms IN: alarms

View File

@ -1,7 +1,11 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: vocabs vocabs.loader kernel ;
IN: bootstrap.threads IN: bootstrap.threads
USE: io.thread USE: io.thread
USE: threads USE: threads
USE: debugger.threads
"debugger" vocab [
"debugger.threads" require
] when

View File

@ -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. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.syntax io kernel namespaces core-foundation USING: alien alien.syntax io kernel namespaces core-foundation
core-foundation.run-loop cocoa.messages cocoa cocoa.classes core-foundation.run-loop cocoa.messages cocoa cocoa.classes
cocoa.runtime sequences threads debugger init summary cocoa.runtime sequences threads init summary kernel.private
kernel.private assocs ; assocs ;
IN: cocoa.application IN: cocoa.application
: <NSString> ( str -- alien ) <CFString> -> autorelease ; : <NSString> ( str -- alien ) <CFString> -> autorelease ;

View File

@ -2,21 +2,17 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.strings arrays assocs USING: accessors alien alien.c-types alien.strings arrays assocs
continuations combinators compiler compiler.alien kernel math continuations combinators compiler compiler.alien kernel math
namespaces make parser prettyprint prettyprint.sections namespaces make parser quotations sequences strings words
quotations sequences strings words cocoa.runtime io macros cocoa.runtime io macros memoize io.encodings.ascii
memoize debugger io.encodings.ascii effects libc libc.private effects libc libc.private parser lexer init core-foundation fry
parser lexer init core-foundation fry generalizations generalizations specialized-arrays.direct.alien ;
specialized-arrays.direct.alien ;
IN: cocoa.messages IN: cocoa.messages
: make-sender ( method function -- quot ) : make-sender ( method function -- quot )
[ over first , f , , second , \ alien-invoke , ] [ ] make ; [ over first , f , , second , \ alien-invoke , ] [ ] make ;
: sender-stub-name ( method function -- string )
[ % "_" % unparse % ] "" make ;
: sender-stub ( method function -- word ) : sender-stub ( method function -- word )
[ sender-stub-name f <word> dup ] 2keep [ "( sender-stub )" f <word> dup ] 2dip
over first large-struct? [ "_stret" append ] when over first large-struct? [ "_stret" append ] when
make-sender define ; make-sender define ;
@ -78,12 +74,8 @@ MACRO: (send) ( selector super? -- quot )
: send ( receiver args... selector -- return... ) f (send) ; inline : 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 ( receiver args... selector -- return... ) t (send) ; inline
\ super-send soft "break-after" set-word-prop
! Runtime introspection ! Runtime introspection
SYMBOL: class-init-hooks SYMBOL: class-init-hooks
@ -216,17 +208,6 @@ assoc-union alien>objc-types set-global
: register-objc-methods ( class -- ) : register-objc-methods ( class -- )
[ register-objc-method ] each-method-in-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 ; : class-exists? ( string -- class ) objc_getClass >boolean ;
: define-objc-class-word ( quot name -- ) : define-objc-class-word ( quot name -- )
@ -238,11 +219,8 @@ assoc-union alien>objc-types set-global
: import-objc-class ( name quot -- ) : import-objc-class ( name quot -- )
over define-objc-class-word over define-objc-class-word
'[
_
[ objc-class register-objc-methods ] [ objc-class register-objc-methods ]
[ objc-meta-class register-objc-methods ] bi [ objc-meta-class register-objc-methods ] bi ;
] try ;
: root-class ( class -- root ) : root-class ( class -- root )
dup class_getSuperclass [ root-class ] [ ] ?if ; dup class_getSuperclass [ root-class ] [ ] ?if ;

View File

@ -1,9 +1,9 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel locals.private quotations classes.tuple make USING: kernel quotations classes.tuple make combinators generic
combinators generic words interpolate namespaces sequences words interpolate namespaces sequences io.streams.string fry
io.streams.string fry classes.mixin effects lexer parser classes.mixin effects lexer parser classes.tuple.parser
classes.tuple.parser effects.parser ; effects.parser locals.types locals.parser locals.rewrite.closures ;
IN: functors IN: functors
: scan-param ( -- obj ) : scan-param ( -- obj )
@ -101,6 +101,6 @@ DEFER: ;FUNCTOR delimiter
CREATE CREATE
parse-locals parse-locals
parse-functor-body swap pop-locals <lambda> parse-functor-body swap pop-locals <lambda>
lambda-rewrite first ; rewrite-closures first ;
: FUNCTOR: (FUNCTOR:) define ; parsing : FUNCTOR: (FUNCTOR:) define ; parsing

View File

@ -1,7 +1,7 @@
USING: help help.markup help.syntax help.definitions help.topics USING: help help.markup help.syntax help.definitions help.topics
namespaces words sequences classes assocs vocabs kernel arrays namespaces words sequences classes assocs vocabs kernel arrays
prettyprint.backend kernel.private io generic math system prettyprint.backend prettyprint.custom kernel.private io generic
strings sbufs vectors byte-arrays quotations math system strings sbufs vectors byte-arrays quotations
io.streams.byte-array classes.builtin parser lexer io.streams.byte-array classes.builtin parser lexer
classes.predicate classes.union classes.intersection classes.predicate classes.union classes.intersection
classes.singleton classes.tuple tools.vocabs.browser math.parser classes.singleton classes.tuple tools.vocabs.browser math.parser

View File

@ -10,7 +10,7 @@ sequences sequences.private slots.private strings
strings.private system threads.private classes.tuple strings.private system threads.private classes.tuple
classes.tuple.private vectors vectors.private words definitions classes.tuple.private vectors vectors.private words definitions
words.private assocs summary compiler.units system.private 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 quotations.private stack-checker.values
stack-checker.alien stack-checker.alien
stack-checker.state stack-checker.state

View File

@ -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 ;

View File

@ -0,0 +1 @@
unportable

View File

@ -89,7 +89,8 @@ DEFER: ?make-staging-image
[ drop ] [ make-staging-image ] if ; [ drop ] [ make-staging-image ] if ;
: make-deploy-config ( vocab -- file ) : 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 ; [ utf8 set-file-contents ] keep ;
: deploy-command-line ( image vocab config -- flags ) : deploy-command-line ( image vocab config -- flags )

View File

@ -31,6 +31,10 @@ urls math.parser ;
[ t ] [ "bunny" shake-and-bake 2500000 small-enough? ] unit-test [ 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 ( -- ) : run-temp-image ( -- )
vm vm
"-i=" "test.image" temp-file append "-i=" "test.image" temp-file append

View File

@ -1,10 +1,11 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io io.files kernel namespaces make sequences USING: io io.files kernel namespaces make sequences system
system tools.deploy.backend tools.deploy.config assocs tools.deploy.backend tools.deploy.config
hashtables prettyprint io.unix.backend cocoa io.encodings.utf8 tools.deploy.config.editor assocs hashtables prettyprint
io.backend cocoa.application cocoa.classes cocoa.plists io.unix.backend cocoa io.encodings.utf8 io.backend
qualified combinators ; cocoa.application cocoa.classes cocoa.plists qualified
combinators ;
IN: tools.deploy.macosx IN: tools.deploy.macosx
: bundle-dir ( -- dir ) : bundle-dir ( -- dir )

View File

@ -25,11 +25,6 @@ H{ } clone \ pool [
global [ global [
"stop-after-last-window?" "ui" lookup set "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 ! Only keeps those methods that we actually call
sent-messages get super-sent-messages get assoc-union sent-messages get super-sent-messages get assoc-union
objc-methods [ assoc-intersect pool-values ] change objc-methods [ assoc-intersect pool-values ] change

View File

@ -3,9 +3,10 @@
USING: accessors math arrays assocs cocoa cocoa.application USING: accessors math arrays assocs cocoa cocoa.application
command-line kernel memory namespaces cocoa.messages command-line kernel memory namespaces cocoa.messages
cocoa.runtime cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.runtime cocoa.subclassing cocoa.pasteboard cocoa.types
cocoa.windows cocoa.classes cocoa.application sequences system cocoa.windows cocoa.classes cocoa.application cocoa.nibs
ui ui.backend ui.clipboards ui.gadgets ui.gadgets.worlds sequences system ui ui.backend ui.clipboards ui.gadgets
ui.cocoa.views core-foundation threads math.geometry.rect fry ; ui.gadgets.worlds ui.cocoa.views core-foundation threads
math.geometry.rect fry ;
IN: ui.cocoa IN: ui.cocoa
TUPLE: handle view window ; TUPLE: handle view window ;
@ -110,7 +111,9 @@ CLASS: {
SYMBOL: cocoa-init-hook 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 M: cocoa-ui-backend ui
"UI" assert.app [ "UI" assert.app [

View File

@ -1,11 +1,11 @@
! Copyright (C) 2007 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: ui.gadgets colors kernel ui.render namespaces models USING: ui.gadgets colors kernel ui.render namespaces models
models.mapping sequences ui.gadgets.buttons ui.gadgets.packs models.mapping sequences ui.gadgets.buttons ui.gadgets.packs
ui.gadgets.labels tools.deploy.config namespaces ui.gadgets.labels tools.deploy.config tools.deploy.config.editor
ui.gadgets.editors ui.gadgets.borders ui.gestures ui.commands namespaces ui.gadgets.editors ui.gadgets.borders ui.gestures
assocs ui.gadgets.tracks ui ui.tools.listener tools.deploy ui.commands assocs ui.gadgets.tracks ui ui.tools.listener
vocabs ui.tools.workspace system accessors fry ; tools.deploy vocabs ui.tools.workspace system accessors fry ;
IN: ui.tools.deploy IN: ui.tools.deploy
TUPLE: deploy-gadget < pack vocab settings ; TUPLE: deploy-gadget < pack vocab settings ;

View File

@ -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. ;

View File

@ -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. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.syntax kernel libc USING: alien alien.c-types alien.syntax kernel libc
sequences continuations byte-arrays strings math namespaces sequences continuations byte-arrays strings math namespaces
system combinators vocabs.loader qualified accessors system combinators vocabs.loader qualified accessors
stack-checker macros locals generalizations unix.types stack-checker macros locals generalizations unix.types
debugger io prettyprint io.files ; io io.files vocabs vocabs.loader ;
IN: unix IN: unix
: PROT_NONE 0 ; inline : PROT_NONE 0 ; inline
@ -60,26 +60,12 @@ FUNCTION: char* strerror ( int errno ) ;
ERROR: unix-error errno message ; 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) ( -- * ) err_no dup strerror unix-error ;
: io-error ( n -- ) 0 < [ (io-error) ] when ; : io-error ( n -- ) 0 < [ (io-error) ] when ;
ERROR: unix-system-call-error args errno message word ; 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 -- ) MACRO:: unix-system-call ( quot -- )
[let | n [ quot infer in>> ] [let | n [ quot infer in>> ]
word [ quot first ] | word [ quot first ] |
@ -236,3 +222,7 @@ FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
{ [ os bsd? ] [ "unix.bsd" require ] } { [ os bsd? ] [ "unix.bsd" require ] }
{ [ os solaris? ] [ "unix.solaris" require ] } { [ os solaris? ] [ "unix.solaris" require ] }
} cond } cond
"debugger" vocab [
"unix.debugger" require
] when

View File

@ -78,7 +78,7 @@ M: pathname forget*
SYMBOL: file SYMBOL: file
TUPLE: source-file-error file error ; TUPLE: source-file-error error file ;
: <source-file-error> ( msg -- error ) : <source-file-error> ( msg -- error )
\ source-file-error new \ source-file-error new