factor: rename system:vm -> vm-path to differentiate it from vm:vm (which is a STRUCT:)

db4
Doug Coleman 2015-07-20 00:03:00 -07:00
parent 1e22e9b814
commit 618330b31e
17 changed files with 46 additions and 46 deletions

View File

@ -21,7 +21,7 @@ SYMBOL: bootstrap-time
] when ;
: default-image-name ( -- string )
vm file-name os windows? [ "." split1-last drop ] when
vm-path file-name os windows? [ "." split1-last drop ] when
".image" append resource-path ;
: load-components ( -- )
@ -45,7 +45,7 @@ SYMBOL: bootstrap-time
"Bootstrapping is complete." print
"Now, you can run Factor:" print
vm write " -i=" write "output-image" get print flush ;
vm-path write " -i=" write "output-image" get print flush ;
: save/restore-error ( quot -- )
error get-global

View File

@ -6,11 +6,11 @@ IN: command-line.startup
: cli-usage ( -- )
"""
Usage: """ write vm file-name write """ [Factor arguments] [script] [script arguments]
Usage: """ write vm-path file-name write """ [Factor arguments] [script] [script arguments]
Common arguments:
-help print this message and exit
-i=<image> load Factor image file <image> (default """ write vm file-stem write """.image)
-i=<image> load Factor image file <image> (default """ write vm-path file-stem write """.image)
-run=<vocab> run the MAIN: entry point of <vocab>
-run=listener run terminal listener
-run=ui.tools run Factor development UI

View File

@ -7,7 +7,7 @@ IN: compiler.tests.callback-error
: run-vm-with-script ( -- lines )
<process>
[ vm , callback-error-script , ] { } make >>command
[ vm-path , callback-error-script , ] { } make >>command
+closed+ >>stdin
+stdout+ >>stderr
ascii <process-reader> stream-lines ;

View File

@ -140,7 +140,7 @@ datagram-client delete-file
! closing stdin caused some problems
{ } [
[
vm ,
vm-path ,
"-i=" image append ,
"-run=none" ,
"-e=USING: destructors namespaces io calendar threads ; input-stream get dispose 1 seconds sleep" ,

View File

@ -3,4 +3,4 @@
USING: tools.test io.files.info.windows system kernel ;
IN: io.files.info.windows.tests
[ ] [ vm file-times 3drop ] unit-test
[ ] [ vm-path file-times 3drop ] unit-test

View File

@ -74,14 +74,14 @@ IN: io.launcher.windows.tests
try-output-process
] must-fail
: console-vm ( -- path )
vm ".exe" ?tail [ ".com" append ] when ;
: console-vm-path ( -- path )
vm-path ".exe" ?tail [ ".com" append ] when ;
SYMBOLS: out-path err-path ;
[ ] [
<process>
console-vm "-run=hello-world" 2array >>command
console-vm-path "-run=hello-world" 2array >>command
"out.txt" unique-file [ out-path set-global ] keep >>stdout
try-process
] unit-test
@ -92,7 +92,7 @@ SYMBOLS: out-path err-path ;
[ "IN: scratchpad " ] [
<process>
console-vm "-run=listener" 2array >>command
console-vm-path "-run=listener" 2array >>command
+closed+ >>stdin
+stdout+ >>stderr
utf8 [ lines last ] with-process-reader
@ -104,7 +104,7 @@ SYMBOLS: out-path err-path ;
[ ] [
launcher-test-path [
<process>
console-vm "-script" "stderr.factor" 3array >>command
console-vm-path "-script" "stderr.factor" 3array >>command
"out.txt" unique-file [ out-path set-global ] keep >>stdout
"err.txt" unique-file [ err-path set-global ] keep >>stderr
try-process
@ -122,7 +122,7 @@ SYMBOLS: out-path err-path ;
[ ] [
launcher-test-path [
<process>
console-vm "-script" "stderr.factor" 3array >>command
console-vm-path "-script" "stderr.factor" 3array >>command
"out.txt" unique-file [ out-path set-global ] keep >>stdout
+stdout+ >>stderr
try-process
@ -136,7 +136,7 @@ SYMBOLS: out-path err-path ;
[ "output" ] [
launcher-test-path [
<process>
console-vm "-script" "stderr.factor" 3array >>command
console-vm-path "-script" "stderr.factor" 3array >>command
"err2.txt" unique-file [ err-path set-global ] keep >>stderr
utf8 <process-reader> stream-lines first
] with-directory
@ -151,7 +151,7 @@ SYMBOLS: out-path err-path ;
[ t ] [
launcher-test-path [
<process>
console-vm "-script" "env.factor" 3array >>command
console-vm-path "-script" "env.factor" 3array >>command
utf8 [ contents ] with-process-reader
] with-directory eval( -- alist )
@ -161,7 +161,7 @@ SYMBOLS: out-path err-path ;
[ t ] [
launcher-test-path [
<process>
console-vm "-script" "env.factor" 3array >>command
console-vm-path "-script" "env.factor" 3array >>command
+replace-environment+ >>environment-mode
os-envs >>environment
utf8 [ contents ] with-process-reader
@ -173,7 +173,7 @@ SYMBOLS: out-path err-path ;
[ "B" ] [
launcher-test-path [
<process>
console-vm "-script" "env.factor" 3array >>command
console-vm-path "-script" "env.factor" 3array >>command
{ { "A" "B" } } >>environment
utf8 [ contents ] with-process-reader
] with-directory eval( -- alist )
@ -184,7 +184,7 @@ SYMBOLS: out-path err-path ;
[ f ] [
launcher-test-path [
<process>
console-vm "-script" "env.factor" 3array >>command
console-vm-path "-script" "env.factor" 3array >>command
{ { "USERPROFILE" "XXX" } } >>environment
+prepend-environment+ >>environment-mode
utf8 [ contents ] with-process-reader
@ -209,7 +209,7 @@ SYMBOLS: out-path err-path ;
2 [
launcher-test-path [
<process>
console-vm "-script" "append.factor" 3array >>command
console-vm-path "-script" "append.factor" 3array >>command
out-path get-global <appender> >>stdout
try-process
] with-directory
@ -219,18 +219,18 @@ SYMBOLS: out-path err-path ;
] unit-test
[ "IN: scratchpad " ] [
console-vm "-run=listener" 2array
console-vm-path "-run=listener" 2array
ascii [ "USE: system 0 exit" print flush lines last ] with-process-stream
] unit-test
[ ] [
console-vm "-run=listener" 2array
console-vm-path "-run=listener" 2array
ascii [ "USE: system 0 exit" print ] with-process-writer
] unit-test
[ ] [
<process>
console-vm "-run=listener" 2array >>command
console-vm-path "-run=listener" 2array >>command
"vocab:io/launcher/windows/test/input.txt" >>stdin
try-process
] unit-test

View File

@ -12,8 +12,8 @@ tools.deploy.libraries vocabs.metadata.resources
tools.deploy.embed locals ;
IN: tools.deploy.backend
: copy-vm ( executable bundle-name -- vm )
prepend-path vm over copy-file ;
: copy-vm ( executable bundle-name -- vm-path )
prepend-path vm-path over copy-file ;
TUPLE: vocab-manifest vocabs libraries ;
@ -87,14 +87,14 @@ ERROR: can't-deploy-library-file library ;
] bi
] { } make ;
: run-factor ( vm flags -- )
: run-factor ( vm-path flags -- )
swap prefix dup . run-with-output ; inline
DEFER: ?make-staging-image
: make-staging-image ( profile -- )
dup [ but-last ?make-staging-image ] unless-empty
vm swap staging-command-line run-factor ;
vm-path swap staging-command-line run-factor ;
: ?make-staging-image ( profile -- )
dup staging-image-name exists?
@ -124,19 +124,19 @@ DEFER: ?make-staging-image
[ "invalid vocab manifest!" throw ] if
] if-empty ;
:: make-deploy-image ( vm image vocab config -- manifest )
:: make-deploy-image ( vm-path image vocab config -- manifest )
make-boot-image
config [
bootstrap-profile :> profile
vocab "vocab-manifest-" prepend temp-file :> manifest-file
image vocab manifest-file profile deploy-command-line :> flags
profile ?make-staging-image
vm flags run-factor
vm-path flags run-factor
manifest-file parse-vocab-manifest-file
] with-variables ;
:: make-deploy-image-executable ( vm image vocab config -- manifest )
vm image vocab config make-deploy-image
image vm embed-image ;
:: make-deploy-image-executable ( vm-path image vocab config -- manifest )
vm-path image vocab config make-deploy-image
image vm-path embed-image ;
HOOK: deploy* os ( vocab -- )

View File

@ -13,7 +13,7 @@ ERROR: no-vocab-main vocab ;
dup find-vocab-root [ check-vocab-main deploy* ] [ no-vocab ] if ;
: deploy-image-only ( vocab image -- )
[ vm ] 2dip
[ vm-path ] 2dip
swap dup deploy-config make-deploy-image drop ;
{

View File

@ -18,4 +18,4 @@ IN: tools.deploy.embed
swap [ copy-file ] keep embed-image ;
: make-embedded-image ( from-image to-executable -- )
vm swap make-embedded-image* ;
vm-path swap make-embedded-image* ;

View File

@ -12,7 +12,7 @@ IN: tools.deploy.macosx
: bundle-dir ( -- dir )
running.app?
[ vm parent-directory parent-directory parent-directory ]
[ vm-path parent-directory parent-directory parent-directory ]
[ "resource:Factor.app" ]
if ;

View File

@ -398,7 +398,7 @@ IN: tools.deploy.shaker
input-stream
output-stream
error-stream
vm
vm-path
image
current-directory
} %

View File

@ -10,7 +10,7 @@ IN: tools.deploy.test
: shake-and-bake ( vocab -- )
[ test-image temp-file delete-file ] ignore-errors
[
[ vm test-image temp-file ] dip
[ vm-path test-image temp-file ] dip
dup deploy-config make-deploy-image drop
] with-resource-directory ;
@ -27,7 +27,7 @@ ERROR: image-too-big actual-size max-size ;
: deploy-test-command ( -- args )
os macosx?
"resource:Factor.app/Contents/MacOS/factor" normalize-path vm ?
"resource:Factor.app/Contents/MacOS/factor" normalize-path vm-path ?
"-i=" test-image temp-file append 2array ;
: run-temp-image ( -- )

View File

@ -9,19 +9,19 @@ IN: tools.deploy.windows
CONSTANT: app-icon-resource-id "APPICON"
:: copy-vm ( executable bundle-name extension -- vm )
vm "." split1-last drop extension append
:: copy-vm ( executable bundle-name extension -- vm-path )
vm-path "." split1-last drop extension append
bundle-name executable ".exe" append append-path
[ copy-file ] keep ;
: create-exe-dir ( vocab bundle-name -- vm )
: create-exe-dir ( vocab bundle-name -- vm-path )
deploy-console? get ".com" ".exe" ? copy-vm ;
: open-in-explorer ( dir -- )
[ f "open" ] dip absolute-path normalize-separators
f f SW_SHOWNORMAL ShellExecute drop ;
: embed-ico ( vm vocab -- )
: embed-ico ( vm-path vocab -- )
dup vocab-windows-icon-path vocab-append-path dup exists?
[ binary file-contents app-icon-resource-id embed-icon-resource ]
[ 2drop ] if ;

View File

@ -84,6 +84,6 @@ PRIVATE>
[
cwd current-directory set-global
OBJ-IMAGE special-object alien>native-string cwd prepend-path \ image set-global
OBJ-EXECUTABLE special-object alien>native-string cwd prepend-path \ vm set-global
OBJ-EXECUTABLE special-object alien>native-string cwd prepend-path \ vm-path set-global
init-resource-path
] "io.files" add-startup-hook

View File

@ -10,7 +10,7 @@ ARTICLE: "system" "System interface"
}
"Getting the path to the Factor VM and image:"
{ $subsections
vm
vm-path
image
}
"Getting a monotonically increasing nanosecond count:"
@ -76,6 +76,6 @@ HELP: image
{ $values { "path" "a pathname string" } }
{ $description "Outputs the pathname of the currently running Factor image." } ;
HELP: vm
HELP: vm-path
{ $values { "path" "a pathname string" } }
{ $description "Outputs the pathname of the currently running Factor VM." } ;

View File

@ -63,7 +63,7 @@ PRIVATE>
: image ( -- path ) \ image get-global ;
: vm ( -- path ) \ vm get-global ;
: vm-path ( -- path ) \ vm-path get-global ;
: embedded? ( -- ? ) OBJ-EMBEDDED special-object ;

View File

@ -8,7 +8,7 @@ IN: native-thread-test
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, c-string* argv )
: start-vm-in-os-thread ( args -- threadhandle )
vm prefix
vm-path prefix
[ length ] [ native-string-encoding strings>alien ] bi
start_standalone_factor_in_new_thread ;