diff --git a/core/bootstrap/stage2.factor b/core/bootstrap/stage2.factor index 3f0fac3882..5587f54c16 100755 --- a/core/bootstrap/stage2.factor +++ b/core/bootstrap/stage2.factor @@ -14,7 +14,7 @@ IN: bootstrap.stage2 vm file-name windows? [ >lower ".exe" ?tail drop ] when ".image" append "output-image" set-global - "math tools compiler help ui ui.tools io" "include" set-global + "math tools help compiler ui ui.tools io" "include" set-global "" "exclude" set-global parse-command-line diff --git a/core/classes/mixin/mixin.factor b/core/classes/mixin/mixin.factor index a60a51c948..b56e3d771e 100755 --- a/core/classes/mixin/mixin.factor +++ b/core/classes/mixin/mixin.factor @@ -1,7 +1,7 @@ -! Copyright (C) 2004, 2007 Slava Pestov. +! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: classes classes.union words kernel sequences -definitions prettyprint.backend ; +definitions prettyprint.backend combinators ; IN: classes.mixin PREDICATE: union-class mixin-class "mixin" word-prop ; @@ -44,6 +44,14 @@ TUPLE: check-mixin-class mixin ; ! INSTANCE: declaration from a source file updates the mixin. TUPLE: mixin-instance loc class mixin ; +M: mixin-instance equal? + { + { [ over mixin-instance? not ] [ f ] } + { [ 2dup [ mixin-instance-class ] 2apply = not ] [ f ] } + { [ 2dup [ mixin-instance-mixin ] 2apply = not ] [ f ] } + { [ t ] [ t ] } + } cond 2nip ; + : ( class mixin -- definition ) { set-mixin-instance-class set-mixin-instance-mixin } mixin-instance construct ; diff --git a/core/vocabs/loader/loader-tests.factor b/core/vocabs/loader/loader-tests.factor index 82e3187c75..1d20cb7370 100755 --- a/core/vocabs/loader/loader-tests.factor +++ b/core/vocabs/loader/loader-tests.factor @@ -136,21 +136,4 @@ forget-junk "xabbabbja" forget-vocab -"bootstrap.help" vocab [ - [ - "again" off - - [ "vocabs.loader.test.e" require ] catch drop - - [ 3 ] [ restarts get length ] unit-test - - [ ] [ - "again" get not restarts get length 3 = and [ - "again" on - :2 - ] when - ] unit-test - ] with-scope -] when - forget-junk diff --git a/core/vocabs/loader/test/e/e.factor b/core/vocabs/loader/test/e/e.factor deleted file mode 100644 index bf9ba22f5b..0000000000 --- a/core/vocabs/loader/test/e/e.factor +++ /dev/null @@ -1 +0,0 @@ -USE: vocabs.loader.test.f diff --git a/core/vocabs/loader/test/f/f-docs.factor b/core/vocabs/loader/test/f/f-docs.factor deleted file mode 100644 index 1beaa99ba2..0000000000 --- a/core/vocabs/loader/test/f/f-docs.factor +++ /dev/null @@ -1,4 +0,0 @@ -USE: vocabs.loader.test.e - -! a syntax error -123 iterate-next diff --git a/core/vocabs/loader/test/f/f.factor b/core/vocabs/loader/test/f/f.factor deleted file mode 100644 index 8b13789179..0000000000 --- a/core/vocabs/loader/test/f/f.factor +++ /dev/null @@ -1 +0,0 @@ - diff --git a/extra/bootstrap/help/help.factor b/extra/bootstrap/help/help.factor index 13e9adf651..e88091105b 100755 --- a/extra/bootstrap/help/help.factor +++ b/extra/bootstrap/help/help.factor @@ -4,6 +4,9 @@ parser vocabs.loader ; IN: bootstrap.help : load-help + "alien.syntax" require + "compiler" require + t load-help? set-global [ vocab ] load-vocab-hook [ diff --git a/extra/bootstrap/tools/tools.factor b/extra/bootstrap/tools/tools.factor index fab6a093ee..7b909ea1f6 100755 --- a/extra/bootstrap/tools/tools.factor +++ b/extra/bootstrap/tools/tools.factor @@ -4,7 +4,7 @@ USING: vocabs.loader sequences ; "bootstrap.image" "tools.annotations" "tools.crossref" - "tools.deploy" + ! "tools.deploy" "tools.memory" "tools.profiler" "tools.test" diff --git a/extra/help/handbook/handbook.factor b/extra/help/handbook/handbook.factor index 772345a243..0fb6b72805 100755 --- a/extra/help/handbook/handbook.factor +++ b/extra/help/handbook/handbook.factor @@ -2,7 +2,7 @@ USING: help help.markup help.syntax help.topics namespaces words sequences classes assocs vocabs kernel arrays prettyprint.backend kernel.private io tools.browser generic math tools.profiler system ui strings sbufs vectors -byte-arrays bit-arrays float-arrays quotations ; +byte-arrays bit-arrays float-arrays quotations help.lint ; IN: help.handbook ARTICLE: "conventions" "Conventions" diff --git a/extra/help/help-docs.factor b/extra/help/help-docs.factor index 2be3f65c4b..fc795572fb 100755 --- a/extra/help/help-docs.factor +++ b/extra/help/help-docs.factor @@ -400,5 +400,3 @@ HELP: ABOUT: HELP: vocab-help { $values { "vocab" "a vocabulary specifier" } { "help" "a help article" } } { $description "Outputs the main help article for a vocabulary. The main help article can be set with " { $link POSTPONE: ABOUT: } "." } ; - -USE: help.lint diff --git a/extra/io/launcher/launcher.factor b/extra/io/launcher/launcher.factor index 7de9d91bc7..806b56a092 100755 --- a/extra/io/launcher/launcher.factor +++ b/extra/io/launcher/launcher.factor @@ -56,7 +56,3 @@ HOOK: process-stream* io-backend ( desc -- stream ) : ( obj -- stream ) >descriptor process-stream* ; - -unix? [ "io.unix.launcher" require ] when -windows? [ "io.windows.launcher" require ] when -winnt? [ "io.windows.nt.launcher" require ] when diff --git a/extra/io/mmap/mmap.factor b/extra/io/mmap/mmap.factor index 37ae0617f8..26378a06aa 100755 --- a/extra/io/mmap/mmap.factor +++ b/extra/io/mmap/mmap.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: continuations io.backend kernel quotations sequences -system alien sequences.private combinators vocabs.loader ; +system alien sequences.private ; IN: io.mmap TUPLE: mapped-file length address handle closed? ; @@ -34,8 +34,3 @@ HOOK: (close-mapped-file) io-backend ( mmap -- ) >r r> [ keep ] curry [ close-mapped-file ] [ ] cleanup ; inline - -{ - { [ unix? ] [ "io.unix.mmap" ] } - { [ windows? ] [ "io.windows.mmap" ] } -} cond require diff --git a/extra/io/unix/unix.factor b/extra/io/unix/unix.factor old mode 100644 new mode 100755 index 030b1185da..7114f388e0 --- a/extra/io/unix/unix.factor +++ b/extra/io/unix/unix.factor @@ -1,6 +1,8 @@ USE: io.unix.backend USE: io.unix.files USE: io.unix.sockets +USE: io.unix.launcher +USE: io.unix.mmap USE: io.backend USE: namespaces diff --git a/extra/io/windows/ce/ce.factor b/extra/io/windows/ce/ce.factor index 4c0237761e..ac5066e7ae 100755 --- a/extra/io/windows/ce/ce.factor +++ b/extra/io/windows/ce/ce.factor @@ -1,5 +1,6 @@ USING: io.backend io.windows io.windows.ce.backend -io.windows.ce.files io.windows.ce.sockets namespaces ; +io.windows.ce.files io.windows.ce.sockets io.windows.ce.launcher +namespaces ; IN: io.windows.ce T{ windows-ce-io } io-backend set-global diff --git a/extra/io/windows/nt/files/files.factor b/extra/io/windows/nt/files/files.factor index 5eed39224c..375f35176c 100755 --- a/extra/io/windows/nt/files/files.factor +++ b/extra/io/windows/nt/files/files.factor @@ -1,6 +1,6 @@ -USING: continuations destructors io.buffers io.nonblocking io.windows -io.windows.nt io.windows.nt.backend kernel libc math -threads windows windows.kernel32 ; +USING: continuations destructors io.buffers io.nonblocking +io.windows io.windows.nt.backend kernel libc math threads +windows windows.kernel32 ; IN: io.windows.nt.files M: windows-nt-io CreateFile-flags ( DWORD -- DWORD ) diff --git a/extra/io/windows/nt/nt.factor b/extra/io/windows/nt/nt.factor old mode 100644 new mode 100755 index 7469410238..9ec97b33c6 --- a/extra/io/windows/nt/nt.factor +++ b/extra/io/windows/nt/nt.factor @@ -4,6 +4,8 @@ USE: io.windows USE: io.windows.nt.backend USE: io.windows.nt.files USE: io.windows.nt.sockets +USE: io.windows.nt.launcher +USE: io.windows.mmap USE: io.backend USE: namespaces diff --git a/extra/io/windows/nt/sockets/sockets.factor b/extra/io/windows/nt/sockets/sockets.factor index 47ab7795b0..e86f070719 100755 --- a/extra/io/windows/nt/sockets/sockets.factor +++ b/extra/io/windows/nt/sockets/sockets.factor @@ -1,6 +1,6 @@ USING: alien alien.c-types byte-arrays continuations destructors io.nonblocking io io.sockets io.sockets.impl namespaces -io.streams.duplex io.windows io.windows.nt io.windows.nt.backend +io.streams.duplex io.windows io.windows.nt.backend windows.winsock kernel libc math sequences threads tuples.lib ; IN: io.windows.nt.sockets diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor new file mode 100755 index 0000000000..b7b3da7411 --- /dev/null +++ b/extra/tools/deploy/backend/backend.factor @@ -0,0 +1,59 @@ +! Copyright (C) 2007, 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: namespaces continuations.private kernel.private init +assocs kernel vocabs words sequences memory io system arrays +continuations math definitions mirrors splitting parser classes +inspector layouts vocabs.loader prettyprint.config prettyprint +debugger io.streams.c io.streams.duplex io.files io.backend +quotations io.launcher words.private tools.deploy.config +bootstrap.image ; +IN: tools.deploy.backend + +: boot-image-name ( -- string ) + "boot." my-arch ".image" 3append ; + +: stage1 ( -- ) + #! If stage1 image doesn't exist, create one. + boot-image-name resource-path exists? + [ my-arch make-image ] unless ; + +: (copy-lines) ( stream -- stream ) + dup stream-readln [ print flush (copy-lines) ] when* ; + +: copy-lines ( stream -- ) + [ (copy-lines) ] [ stream-close ] [ ] cleanup ; + +: ?append swap [ append ] [ drop ] if ; + +: profile-string ( config -- string ) + [ + "" + deploy-math? get " math" ?append + deploy-compiler? get " compiler" ?append + deploy-ui? get " ui" ?append + native-io? " io" ?append + ] bind ; + +: deploy-command-line ( vm image vocab config -- vm flags ) + [ + "-include=" swap profile-string append , + + "-deploy-vocab=" swap append , + + "-output-image=" swap append , + + "-no-stack-traces" , + + "-no-user-init" , + ] { } make ; + +: stage2 ( vm image vocab config -- ) + deploy-command-line + >r "-i=" boot-image-name append 2array r> append dup . + + dup duplex-stream-out stream-close + copy-lines ; + +SYMBOL: deploy-implementation + +HOOK: deploy* deploy-implementation ( vocab -- ) diff --git a/extra/tools/deploy/deploy-docs.factor b/extra/tools/deploy/deploy-docs.factor old mode 100644 new mode 100755 index f6e9cb2882..b225236249 --- a/extra/tools/deploy/deploy-docs.factor +++ b/extra/tools/deploy/deploy-docs.factor @@ -19,11 +19,6 @@ $nl ABOUT: "tools.deploy" -HELP: deploy* -{ $values { "vm" "a pathname string" } { "image" "a pathname string" } { "vocab" "a vocabulary specifier" } { "config" assoc } } -{ $description "Deploys " { $snippet "vocab" } ", which must have a " { $link POSTPONE: MAIN: } " hook, using the specified VM and configuration. The deployed image is saved as " { $snippet "image" } "." } -{ $notes "This is a low-level word and in most cases " { $link deploy } " should be called instead." } ; - HELP: deploy { $values { "vocab" "a vocabulary specifier" } } { $description "Deploys " { $snippet "vocab" } ", saving the deployed image as " { $snippet { $emphasis "vocab" } ".image" } "." } ; diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor index 7a3fbb8fdd..f12512f510 100755 --- a/extra/tools/deploy/deploy.factor +++ b/extra/tools/deploy/deploy.factor @@ -1,68 +1,9 @@ -! Copyright (C) 2007 Slava Pestov. +! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: namespaces continuations.private kernel.private init -assocs kernel vocabs words sequences memory io system arrays -continuations math definitions mirrors splitting parser classes -inspector layouts vocabs.loader prettyprint.config prettyprint -debugger io.streams.c io.streams.duplex io.files io.backend -quotations io.launcher words.private tools.deploy.config -bootstrap.image ; +USING: tools.deploy.backend system vocabs.loader kernel ; IN: tools.deploy -r "-i=" boot-image-name append 2array r> append dup . - - dup duplex-stream-out stream-close - copy-lines ; - -: ?append swap [ append ] [ drop ] if ; - -: profile-string ( config -- string ) - [ - "" - deploy-math? get " math" ?append - deploy-compiler? get " compiler" ?append - deploy-ui? get " ui" ?append - native-io? " io" ?append - ] bind ; - -: deploy-command-line ( vm image vocab config -- vm flags ) - [ - "-include=" swap profile-string append , - - "-deploy-vocab=" swap append , - - "-output-image=" swap append , - - "-no-stack-traces" , - - "-no-user-init" , - ] { } make ; - -PRIVATE> - -: deploy* ( vm image vocab config -- ) - stage1 deploy-command-line stage2 ; - -SYMBOL: deploy-implementation - -HOOK: deploy deploy-implementation ( vocab -- ) +: deploy ( vocab -- ) deploy* ; macosx? [ "tools.deploy.macosx" require ] when winnt? [ "tools.deploy.windows" require ] when diff --git a/extra/tools/deploy/macosx/macosx.factor b/extra/tools/deploy/macosx/macosx.factor index 7624fbeb9c..e6f41c6923 100755 --- a/extra/tools/deploy/macosx/macosx.factor +++ b/extra/tools/deploy/macosx/macosx.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2007 Slava Pestov. +! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: io io.files io.launcher kernel namespaces sequences -system tools.deploy tools.deploy.config assocs hashtables -prettyprint io.unix.backend cocoa cocoa.plists +system tools.deploy.backend tools.deploy.config assocs +hashtables prettyprint io.unix.backend cocoa cocoa.plists cocoa.application cocoa.classes qualified ; QUALIFIED: unix IN: tools.deploy.macosx @@ -71,13 +71,14 @@ T{ macosx-deploy-implementation } deploy-implementation set-global over rot parent-directory -> selectFile:inFileViewerRootedAtPath: drop ; -M: macosx-deploy-implementation deploy ( vocab -- ) +M: macosx-deploy-implementation deploy* ( vocab -- ) + stage1 ".app deploy tool" assert.app "." resource-path cd dup deploy-config [ bundle-name rm [ bundle-name create-app-dir ] keep [ bundle-name deploy.app-image ] keep - namespace deploy* + namespace stage2 bundle-name show-in-finder ] bind ; diff --git a/extra/tools/deploy/windows/windows.factor b/extra/tools/deploy/windows/windows.factor index 34580cf6f9..89dc0d8cc3 100755 --- a/extra/tools/deploy/windows/windows.factor +++ b/extra/tools/deploy/windows/windows.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: io io.files kernel namespaces sequences system -tools.deploy tools.deploy.config assocs hashtables prettyprint -windows.shell32 windows.user32 ; +tools.deploy.backend tools.deploy.config assocs hashtables +prettyprint windows.shell32 windows.user32 ; IN: tools.deploy.windows : copy-vm ( executable bundle-name -- vm ) @@ -33,11 +33,13 @@ TUPLE: windows-deploy-implementation ; T{ windows-deploy-implementation } deploy-implementation set-global -M: windows-deploy-implementation deploy +M: windows-deploy-implementation deploy* + stage1 "." resource-path cd dup deploy-config [ - [ deploy-name get create-exe-dir ] keep - [ deploy-name get image-name ] keep - namespace - deploy-name get open-in-explorer - ] bind deploy* ; + [ + [ deploy-name get create-exe-dir ] keep + [ deploy-name get image-name ] keep + deploy-name get + ] bind + ] keep stage2 open-in-explorer ;