More circularity fixes

db4
Slava Pestov 2008-01-05 20:37:13 -04:00
parent c3deb44f43
commit 825601ccc7
22 changed files with 105 additions and 125 deletions

View File

@ -14,7 +14,7 @@ IN: bootstrap.stage2
vm file-name windows? [ >lower ".exe" ?tail drop ] when vm file-name windows? [ >lower ".exe" ?tail drop ] when
".image" append "output-image" set-global ".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 "" "exclude" set-global
parse-command-line parse-command-line

View File

@ -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. ! See http://factorcode.org/license.txt for BSD license.
USING: classes classes.union words kernel sequences USING: classes classes.union words kernel sequences
definitions prettyprint.backend ; definitions prettyprint.backend combinators ;
IN: classes.mixin IN: classes.mixin
PREDICATE: union-class mixin-class "mixin" word-prop ; 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. ! INSTANCE: declaration from a source file updates the mixin.
TUPLE: mixin-instance loc class 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 ;
: <mixin-instance> ( class mixin -- definition ) : <mixin-instance> ( class mixin -- definition )
{ set-mixin-instance-class set-mixin-instance-mixin } { set-mixin-instance-class set-mixin-instance-mixin }
mixin-instance construct ; mixin-instance construct ;

View File

@ -136,21 +136,4 @@ forget-junk
"xabbabbja" forget-vocab "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 forget-junk

View File

@ -1 +0,0 @@
USE: vocabs.loader.test.f

View File

@ -1,4 +0,0 @@
USE: vocabs.loader.test.e
! a syntax error
123 iterate-next

View File

@ -1 +0,0 @@

View File

@ -4,6 +4,9 @@ parser vocabs.loader ;
IN: bootstrap.help IN: bootstrap.help
: load-help : load-help
"alien.syntax" require
"compiler" require
t load-help? set-global t load-help? set-global
[ vocab ] load-vocab-hook [ [ vocab ] load-vocab-hook [

View File

@ -4,7 +4,7 @@ USING: vocabs.loader sequences ;
"bootstrap.image" "bootstrap.image"
"tools.annotations" "tools.annotations"
"tools.crossref" "tools.crossref"
"tools.deploy" ! "tools.deploy"
"tools.memory" "tools.memory"
"tools.profiler" "tools.profiler"
"tools.test" "tools.test"

View File

@ -2,7 +2,7 @@ USING: help help.markup help.syntax help.topics
namespaces words sequences classes assocs vocabs kernel namespaces words sequences classes assocs vocabs kernel
arrays prettyprint.backend kernel.private io tools.browser arrays prettyprint.backend kernel.private io tools.browser
generic math tools.profiler system ui strings sbufs vectors 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 IN: help.handbook
ARTICLE: "conventions" "Conventions" ARTICLE: "conventions" "Conventions"

View File

@ -400,5 +400,3 @@ HELP: ABOUT:
HELP: vocab-help HELP: vocab-help
{ $values { "vocab" "a vocabulary specifier" } { "help" "a help article" } } { $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: } "." } ; { $description "Outputs the main help article for a vocabulary. The main help article can be set with " { $link POSTPONE: ABOUT: } "." } ;
USE: help.lint

View File

@ -56,7 +56,3 @@ HOOK: process-stream* io-backend ( desc -- stream )
: <process-stream> ( obj -- stream ) : <process-stream> ( obj -- stream )
>descriptor process-stream* ; >descriptor process-stream* ;
unix? [ "io.unix.launcher" require ] when
windows? [ "io.windows.launcher" require ] when
winnt? [ "io.windows.nt.launcher" require ] when

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Doug Coleman. ! Copyright (C) 2007 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: continuations io.backend kernel quotations sequences USING: continuations io.backend kernel quotations sequences
system alien sequences.private combinators vocabs.loader ; system alien sequences.private ;
IN: io.mmap IN: io.mmap
TUPLE: mapped-file length address handle closed? ; TUPLE: mapped-file length address handle closed? ;
@ -34,8 +34,3 @@ HOOK: (close-mapped-file) io-backend ( mmap -- )
>r <mapped-file> r> >r <mapped-file> r>
[ keep ] curry [ keep ] curry
[ close-mapped-file ] [ ] cleanup ; inline [ close-mapped-file ] [ ] cleanup ; inline
{
{ [ unix? ] [ "io.unix.mmap" ] }
{ [ windows? ] [ "io.windows.mmap" ] }
} cond require

2
extra/io/unix/unix.factor Normal file → Executable file
View File

@ -1,6 +1,8 @@
USE: io.unix.backend USE: io.unix.backend
USE: io.unix.files USE: io.unix.files
USE: io.unix.sockets USE: io.unix.sockets
USE: io.unix.launcher
USE: io.unix.mmap
USE: io.backend USE: io.backend
USE: namespaces USE: namespaces

View File

@ -1,5 +1,6 @@
USING: io.backend io.windows io.windows.ce.backend 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 IN: io.windows.ce
T{ windows-ce-io } io-backend set-global T{ windows-ce-io } io-backend set-global

View File

@ -1,6 +1,6 @@
USING: continuations destructors io.buffers io.nonblocking io.windows USING: continuations destructors io.buffers io.nonblocking
io.windows.nt io.windows.nt.backend kernel libc math io.windows io.windows.nt.backend kernel libc math threads
threads windows windows.kernel32 ; windows windows.kernel32 ;
IN: io.windows.nt.files IN: io.windows.nt.files
M: windows-nt-io CreateFile-flags ( DWORD -- DWORD ) M: windows-nt-io CreateFile-flags ( DWORD -- DWORD )

2
extra/io/windows/nt/nt.factor Normal file → Executable file
View File

@ -4,6 +4,8 @@ USE: io.windows
USE: io.windows.nt.backend USE: io.windows.nt.backend
USE: io.windows.nt.files USE: io.windows.nt.files
USE: io.windows.nt.sockets USE: io.windows.nt.sockets
USE: io.windows.nt.launcher
USE: io.windows.mmap
USE: io.backend USE: io.backend
USE: namespaces USE: namespaces

View File

@ -1,6 +1,6 @@
USING: alien alien.c-types byte-arrays continuations destructors USING: alien alien.c-types byte-arrays continuations destructors
io.nonblocking io io.sockets io.sockets.impl namespaces 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 ; windows.winsock kernel libc math sequences threads tuples.lib ;
IN: io.windows.nt.sockets IN: io.windows.nt.sockets

View File

@ -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 .
<process-stream>
dup duplex-stream-out stream-close
copy-lines ;
SYMBOL: deploy-implementation
HOOK: deploy* deploy-implementation ( vocab -- )

5
extra/tools/deploy/deploy-docs.factor Normal file → Executable file
View File

@ -19,11 +19,6 @@ $nl
ABOUT: "tools.deploy" 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 HELP: deploy
{ $values { "vocab" "a vocabulary specifier" } } { $values { "vocab" "a vocabulary specifier" } }
{ $description "Deploys " { $snippet "vocab" } ", saving the deployed image as " { $snippet { $emphasis "vocab" } ".image" } "." } ; { $description "Deploys " { $snippet "vocab" } ", saving the deployed image as " { $snippet { $emphasis "vocab" } ".image" } "." } ;

View File

@ -1,68 +1,9 @@
! 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: namespaces continuations.private kernel.private init USING: tools.deploy.backend system vocabs.loader kernel ;
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 IN: tools.deploy
<PRIVATE : deploy ( vocab -- ) deploy* ;
: 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 ;
: stage2 ( vm flags -- )
>r "-i=" boot-image-name append 2array r> append dup .
<process-stream>
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 -- )
macosx? [ "tools.deploy.macosx" require ] when macosx? [ "tools.deploy.macosx" require ] when
winnt? [ "tools.deploy.windows" require ] when winnt? [ "tools.deploy.windows" require ] when

View File

@ -1,8 +1,8 @@
! 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: io io.files io.launcher kernel namespaces sequences USING: io io.files io.launcher kernel namespaces sequences
system tools.deploy tools.deploy.config assocs hashtables system tools.deploy.backend tools.deploy.config assocs
prettyprint io.unix.backend cocoa cocoa.plists hashtables prettyprint io.unix.backend cocoa cocoa.plists
cocoa.application cocoa.classes qualified ; cocoa.application cocoa.classes qualified ;
QUALIFIED: unix QUALIFIED: unix
IN: tools.deploy.macosx IN: tools.deploy.macosx
@ -71,13 +71,14 @@ T{ macosx-deploy-implementation } deploy-implementation set-global
over <NSString> rot parent-directory <NSString> over <NSString> rot parent-directory <NSString>
-> selectFile:inFileViewerRootedAtPath: drop ; -> selectFile:inFileViewerRootedAtPath: drop ;
M: macosx-deploy-implementation deploy ( vocab -- ) M: macosx-deploy-implementation deploy* ( vocab -- )
stage1
".app deploy tool" assert.app ".app deploy tool" assert.app
"." resource-path cd "." resource-path cd
dup deploy-config [ dup deploy-config [
bundle-name rm bundle-name rm
[ bundle-name create-app-dir ] keep [ bundle-name create-app-dir ] keep
[ bundle-name deploy.app-image ] keep [ bundle-name deploy.app-image ] keep
namespace deploy* namespace stage2
bundle-name show-in-finder bundle-name show-in-finder
] bind ; ] bind ;

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007 Slava Pestov. ! Copyright (C) 2007 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 sequences system USING: io io.files kernel namespaces sequences system
tools.deploy tools.deploy.config assocs hashtables prettyprint tools.deploy.backend tools.deploy.config assocs hashtables
windows.shell32 windows.user32 ; prettyprint windows.shell32 windows.user32 ;
IN: tools.deploy.windows IN: tools.deploy.windows
: copy-vm ( executable bundle-name -- vm ) : copy-vm ( executable bundle-name -- vm )
@ -33,11 +33,13 @@ TUPLE: windows-deploy-implementation ;
T{ windows-deploy-implementation } deploy-implementation set-global T{ windows-deploy-implementation } deploy-implementation set-global
M: windows-deploy-implementation deploy M: windows-deploy-implementation deploy*
stage1
"." resource-path cd "." resource-path cd
dup deploy-config [ dup deploy-config [
[
[ deploy-name get create-exe-dir ] keep [ deploy-name get create-exe-dir ] keep
[ deploy-name get image-name ] keep [ deploy-name get image-name ] keep
namespace deploy-name get
deploy-name get open-in-explorer ] bind
] bind deploy* ; ] keep stage2 open-in-explorer ;