Merge branch 'master' of git://factorcode.org/git/factor
commit
420e2d2308
|
@ -76,13 +76,13 @@ MACRO: (send) ( selector super? -- quot )
|
||||||
: super-send ( receiver args... selector -- return... ) t (send) ; inline
|
: super-send ( receiver args... selector -- return... ) t (send) ; inline
|
||||||
|
|
||||||
! Runtime introspection
|
! Runtime introspection
|
||||||
SYMBOL: class-startup-hooks
|
SYMBOL: class-init-hooks
|
||||||
|
|
||||||
class-startup-hooks [ H{ } clone ] initialize
|
class-init-hooks [ H{ } clone ] initialize
|
||||||
|
|
||||||
: (objc-class) ( name word -- class )
|
: (objc-class) ( name word -- class )
|
||||||
2dup execute dup [ 2nip ] [
|
2dup execute dup [ 2nip ] [
|
||||||
drop over class-startup-hooks get at [ call( -- ) ] when*
|
drop over class-init-hooks get at [ call( -- ) ] when*
|
||||||
2dup execute dup [ 2nip ] [
|
2dup execute dup [ 2nip ] [
|
||||||
2drop "No such class: " prepend throw
|
2drop "No such class: " prepend throw
|
||||||
] if
|
] if
|
||||||
|
@ -229,7 +229,7 @@ ERROR: no-objc-type name ;
|
||||||
: 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 -- )
|
||||||
[ class-startup-hooks get set-at ]
|
[ class-init-hooks get set-at ]
|
||||||
[
|
[
|
||||||
[ "cocoa.classes" create ] [ '[ _ objc-class ] ] bi
|
[ "cocoa.classes" create ] [ '[ _ objc-class ] ] bi
|
||||||
(( -- class )) define-declared
|
(( -- class )) define-declared
|
||||||
|
@ -237,8 +237,10 @@ ERROR: no-objc-type name ;
|
||||||
|
|
||||||
: import-objc-class ( name quot -- )
|
: import-objc-class ( name quot -- )
|
||||||
over define-objc-class-word
|
over define-objc-class-word
|
||||||
|
dup objc_getClass [
|
||||||
[ objc-class register-objc-methods ]
|
[ objc-class register-objc-methods ]
|
||||||
[ objc-meta-class register-objc-methods ] bi ;
|
[ objc-meta-class register-objc-methods ] bi
|
||||||
|
] [ drop ] if ;
|
||||||
|
|
||||||
: root-class ( class -- root )
|
: root-class ( class -- root )
|
||||||
dup class_getSuperclass [ root-class ] [ ] ?if ;
|
dup class_getSuperclass [ root-class ] [ ] ?if ;
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs byte-arrays calendar classes
|
USING: accessors assocs byte-arrays calendar classes combinators
|
||||||
combinators combinators.short-circuit concurrency.promises
|
combinators.short-circuit concurrency.promises continuations
|
||||||
continuations destructors ftp io io.backend io.directories
|
destructors ftp io io.backend io.directories io.encodings
|
||||||
io.encodings io.encodings.binary
|
io.encodings.binary tools.files io.encodings.utf8 io.files
|
||||||
tools.files io.encodings.utf8 io.files io.files.info
|
io.files.info io.pathnames io.servers.connection io.sockets
|
||||||
io.pathnames io.launcher.unix.parser io.servers.connection
|
io.streams.duplex io.streams.string io.timeouts kernel make math
|
||||||
io.sockets io.streams.duplex io.streams.string io.timeouts
|
math.bitwise math.parser namespaces sequences splitting threads
|
||||||
kernel make math math.bitwise math.parser namespaces sequences
|
unicode.case logging calendar.format strings io.files.links
|
||||||
splitting threads unicode.case logging calendar.format
|
io.files.types io.encodings.8-bit.latin1 simple-tokenizer ;
|
||||||
strings io.files.links io.files.types io.encodings.8-bit.latin1 ;
|
|
||||||
IN: ftp.server
|
IN: ftp.server
|
||||||
|
|
||||||
SYMBOL: server
|
SYMBOL: server
|
||||||
|
@ -24,7 +23,7 @@ TUPLE: ftp-command raw tokenized ;
|
||||||
dup \ <ftp-command> DEBUG log-message
|
dup \ <ftp-command> DEBUG log-message
|
||||||
ftp-command new
|
ftp-command new
|
||||||
over >>raw
|
over >>raw
|
||||||
swap tokenize-command >>tokenized ;
|
swap tokenize >>tokenized ;
|
||||||
|
|
||||||
TUPLE: ftp-get path ;
|
TUPLE: ftp-get path ;
|
||||||
: <ftp-get> ( path -- obj )
|
: <ftp-get> ( path -- obj )
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
IN: io.launcher.unix.parser.tests
|
|
||||||
USING: io.launcher.unix.parser tools.test ;
|
|
||||||
|
|
||||||
[ "" tokenize-command ] must-fail
|
|
||||||
[ " " tokenize-command ] must-fail
|
|
||||||
[ V{ "a" } ] [ "a" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc" } ] [ "abc" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc" } ] [ "abc " tokenize-command ] unit-test
|
|
||||||
[ V{ "abc" } ] [ " abc" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc" "def" } ] [ "abc def" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc def" } ] [ "abc\\ def" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc\\" "def" } ] [ "abc\\\\ def" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc\\ def" } ] [ "\"abc\\\\ def\"" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc\\ def" } ] [ " \"abc\\\\ def\"" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc\\ def" "hey" } ] [ "\"abc\\\\ def\" hey" tokenize-command ] unit-test
|
|
||||||
[ V{ "abc def" "hey" } ] [ "\"abc def\" \"hey\"" tokenize-command ] unit-test
|
|
||||||
[ "\"abc def\" \"hey" tokenize-command ] must-fail
|
|
||||||
[ "\"abc def" tokenize-command ] must-fail
|
|
||||||
[ V{ "abc def" "h\"ey" } ] [ "\"abc def\" \"h\\\"ey\" " tokenize-command ] unit-test
|
|
||||||
|
|
||||||
[
|
|
||||||
V{
|
|
||||||
"Hello world.app/Contents/MacOS/hello-ui"
|
|
||||||
"-i=boot.macosx-ppc.image"
|
|
||||||
"-include= math compiler ui"
|
|
||||||
"-deploy-vocab=hello-ui"
|
|
||||||
"-output-image=Hello world.app/Contents/Resources/hello-ui.image"
|
|
||||||
"-no-stack-traces"
|
|
||||||
"-no-user-init"
|
|
||||||
}
|
|
||||||
] [
|
|
||||||
"\"Hello world.app/Contents/MacOS/hello-ui\" -i=boot.macosx-ppc.image \"-include= math compiler ui\" -deploy-vocab=hello-ui \"-output-image=Hello world.app/Contents/Resources/hello-ui.image\" -no-stack-traces -no-user-init" tokenize-command
|
|
||||||
] unit-test
|
|
|
@ -1 +0,0 @@
|
||||||
unix
|
|
|
@ -1,15 +1,14 @@
|
||||||
! Copyright (C) 2007, 2008 Slava Pestov.
|
! Copyright (C) 2007, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.c-types arrays assocs combinators
|
USING: accessors alien.c-types arrays assocs combinators
|
||||||
continuations environment io io.backend io.backend.unix
|
continuations environment io io.backend io.backend.unix
|
||||||
io.files io.files.private io.files.unix io.launcher
|
io.files io.files.private io.files.unix io.launcher io.pathnames
|
||||||
io.launcher.unix.parser io.pathnames io.ports kernel math
|
io.ports kernel math namespaces sequences strings system threads
|
||||||
namespaces sequences strings system threads unix
|
unix unix.process unix.ffi simple-tokenizer ;
|
||||||
unix.process unix.ffi ;
|
|
||||||
IN: io.launcher.unix
|
IN: io.launcher.unix
|
||||||
|
|
||||||
: get-arguments ( process -- seq )
|
: get-arguments ( process -- seq )
|
||||||
command>> dup string? [ tokenize-command ] when ;
|
command>> dup string? [ tokenize ] when ;
|
||||||
|
|
||||||
: assoc>env ( assoc -- env )
|
: assoc>env ( assoc -- env )
|
||||||
[ "=" glue ] { } assoc>map ;
|
[ "=" glue ] { } assoc>map ;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Slava Pestov
|
|
@ -0,0 +1,13 @@
|
||||||
|
USING: help.markup help.syntax strings ;
|
||||||
|
IN: simple-tokenizer
|
||||||
|
|
||||||
|
HELP: tokenize
|
||||||
|
{ $values { "input" string } { "ast" "a sequence of strings" } }
|
||||||
|
{ $description
|
||||||
|
"Tokenize a string. Supported syntax:"
|
||||||
|
{ $list
|
||||||
|
{ { $snippet "foo bar baz" } " - simple tokens" }
|
||||||
|
{ { $snippet "foo\\ bar" } " - token with an escaped space"}
|
||||||
|
{ { $snippet "\"foo bar\"" } " - quoted token" }
|
||||||
|
}
|
||||||
|
} ;
|
|
@ -0,0 +1,33 @@
|
||||||
|
IN: simple-tokenizer.tests
|
||||||
|
USING: simple-tokenizer tools.test ;
|
||||||
|
|
||||||
|
[ "" tokenize ] must-fail
|
||||||
|
[ " " tokenize ] must-fail
|
||||||
|
[ V{ "a" } ] [ "a" tokenize ] unit-test
|
||||||
|
[ V{ "abc" } ] [ "abc" tokenize ] unit-test
|
||||||
|
[ V{ "abc" } ] [ "abc " tokenize ] unit-test
|
||||||
|
[ V{ "abc" } ] [ " abc" tokenize ] unit-test
|
||||||
|
[ V{ "abc" "def" } ] [ "abc def" tokenize ] unit-test
|
||||||
|
[ V{ "abc def" } ] [ "abc\\ def" tokenize ] unit-test
|
||||||
|
[ V{ "abc\\" "def" } ] [ "abc\\\\ def" tokenize ] unit-test
|
||||||
|
[ V{ "abc\\ def" } ] [ "\"abc\\\\ def\"" tokenize ] unit-test
|
||||||
|
[ V{ "abc\\ def" } ] [ " \"abc\\\\ def\"" tokenize ] unit-test
|
||||||
|
[ V{ "abc\\ def" "hey" } ] [ "\"abc\\\\ def\" hey" tokenize ] unit-test
|
||||||
|
[ V{ "abc def" "hey" } ] [ "\"abc def\" \"hey\"" tokenize ] unit-test
|
||||||
|
[ "\"abc def\" \"hey" tokenize ] must-fail
|
||||||
|
[ "\"abc def" tokenize ] must-fail
|
||||||
|
[ V{ "abc def" "h\"ey" } ] [ "\"abc def\" \"h\\\"ey\" " tokenize ] unit-test
|
||||||
|
|
||||||
|
[
|
||||||
|
V{
|
||||||
|
"Hello world.app/Contents/MacOS/hello-ui"
|
||||||
|
"-i=boot.macosx-ppc.image"
|
||||||
|
"-include= math compiler ui"
|
||||||
|
"-deploy-vocab=hello-ui"
|
||||||
|
"-output-image=Hello world.app/Contents/Resources/hello-ui.image"
|
||||||
|
"-no-stack-traces"
|
||||||
|
"-no-user-init"
|
||||||
|
}
|
||||||
|
] [
|
||||||
|
"\"Hello world.app/Contents/MacOS/hello-ui\" -i=boot.macosx-ppc.image \"-include= math compiler ui\" -deploy-vocab=hello-ui \"-output-image=Hello world.app/Contents/Resources/hello-ui.image\" -no-stack-traces -no-user-init" tokenize
|
||||||
|
] unit-test
|
|
@ -1,13 +1,9 @@
|
||||||
! Copyright (C) 2008 Slava Pestov
|
! Copyright (C) 2008, 2010 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: peg peg.ebnf arrays sequences strings kernel ;
|
USING: peg peg.ebnf arrays sequences strings kernel ;
|
||||||
IN: io.launcher.unix.parser
|
IN: simple-tokenizer
|
||||||
|
|
||||||
! Our command line parser. Supported syntax:
|
EBNF: tokenize
|
||||||
! foo bar baz -- simple tokens
|
|
||||||
! foo\ bar -- escaping the space
|
|
||||||
! "foo bar" -- quotation
|
|
||||||
EBNF: tokenize-command
|
|
||||||
space = " "
|
space = " "
|
||||||
escaped-char = "\" .:ch => [[ ch ]]
|
escaped-char = "\" .:ch => [[ ch ]]
|
||||||
quoted = '"' (escaped-char | [^"])*:a '"' => [[ a ]]
|
quoted = '"' (escaped-char | [^"])*:a '"' => [[ a ]]
|
|
@ -0,0 +1 @@
|
||||||
|
text
|
|
@ -61,18 +61,17 @@ M: pathname uses string>> source-file top-level-form>> [ uses ] [ { } ] if* ;
|
||||||
! To make UI browser happy
|
! To make UI browser happy
|
||||||
M: vocab uses drop f ;
|
M: vocab uses drop f ;
|
||||||
|
|
||||||
GENERIC: crossref-def ( defspec -- )
|
: crossref-def ( defspec -- )
|
||||||
|
|
||||||
M: object crossref-def
|
|
||||||
dup uses crossref get add-vertex ;
|
dup uses crossref get add-vertex ;
|
||||||
|
|
||||||
M: word crossref-def
|
|
||||||
[ call-next-method ] [ subwords [ crossref-def ] each ] bi ;
|
|
||||||
|
|
||||||
: defs-to-crossref ( -- seq )
|
: defs-to-crossref ( -- seq )
|
||||||
[
|
[
|
||||||
all-words [ generic? not ] filter
|
all-words
|
||||||
|
[ [ generic? not ] filter ]
|
||||||
|
[ [ subwords ] map concat ] bi
|
||||||
|
|
||||||
all-articles [ >link ] map
|
all-articles [ >link ] map
|
||||||
|
|
||||||
source-files get keys [ <pathname> ] map
|
source-files get keys [ <pathname> ] map
|
||||||
] append-outputs ;
|
] append-outputs ;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ ARTICLE: "prepare-deploy" "Preparing to deploy an application"
|
||||||
ARTICLE: "deploy-resources" "Deployed resource files"
|
ARTICLE: "deploy-resources" "Deployed resource files"
|
||||||
"To include additional files in your deployed application, specify their names in a vocabulary's " { $snippet "resources.txt" } " file. The " { $snippet "resources.txt" } " file contains one glob pattern per line. These patterns are expanded relative to the vocabulary directory; files outside of the vocabulary directory cannot be referenced. If a file inside the vocabulary directory matches any of these patterns, it will be included in deployed applications that reference the vocabulary. If a subdirectory matches, its contents will be included recursively."
|
"To include additional files in your deployed application, specify their names in a vocabulary's " { $snippet "resources.txt" } " file. The " { $snippet "resources.txt" } " file contains one glob pattern per line. These patterns are expanded relative to the vocabulary directory; files outside of the vocabulary directory cannot be referenced. If a file inside the vocabulary directory matches any of these patterns, it will be included in deployed applications that reference the vocabulary. If a subdirectory matches, its contents will be included recursively."
|
||||||
$nl
|
$nl
|
||||||
"If the deployed vocabulary includes an icon file for the current platform (" { $snippet "icon.ico" } " on Windows, or " { $snippet "icon.icns" } " on MacOS X), it will be embedded in the deployed application as its GUI icon." ;
|
"If the deployed vocabulary includes an icon file for the current platform, it will be embedded in the deployed application as its GUI icon. See " { $link "vocabs.icons" } "." ;
|
||||||
|
|
||||||
ARTICLE: "tools.deploy.usage" "Deploy tool usage"
|
ARTICLE: "tools.deploy.usage" "Deploy tool usage"
|
||||||
"Once the necessary deployment flags have been set, the application can be deployed:"
|
"Once the necessary deployment flags have been set, the application can be deployed:"
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
linux
|
||||||
|
freebsd
|
||||||
|
netbsd
|
||||||
|
openbsd
|
|
@ -1 +0,0 @@
|
||||||
untested
|
|
|
@ -1 +0,0 @@
|
||||||
unix
|
|
|
@ -1,22 +1,20 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien.syntax unix.utmpx unix.bsd.netbsd accessors
|
USING: alien.syntax unix unix.utmpx unix.ffi.bsd.netbsd accessors
|
||||||
unix.utmpx system kernel unix combinators ;
|
system kernel combinators ;
|
||||||
IN: unix.utmpx.netbsd
|
IN: unix.utmpx.netbsd
|
||||||
|
|
||||||
TUPLE: netbsd-utmpx-record < utmpx-record termination exit
|
TUPLE: netbsd-utmpx-record < utmpx-record
|
||||||
sockaddr ;
|
termination exit sockaddr ;
|
||||||
|
|
||||||
M: netbsd new-utmpx-record ( -- utmpx-record )
|
M: netbsd new-utmpx-record ( -- utmpx-record )
|
||||||
netbsd-utmpx-record new ;
|
netbsd-utmpx-record new ;
|
||||||
|
|
||||||
M: netbsd utmpx>utmpx-record ( utmpx -- record )
|
M: netbsd utmpx>utmpx-record ( utmpx -- record )
|
||||||
[ new-utmpx-record ] keep
|
[ new-utmpx-record ] dip
|
||||||
{
|
|
||||||
[
|
[
|
||||||
utmpx-ut_exit
|
ut_exit>>
|
||||||
[ exit_struct-e_termination >>termination ]
|
[ e_termination>> >>termination ]
|
||||||
[ exit_struct-e_exit >>exit ] bi
|
[ e_exit>> >>exit ] bi
|
||||||
]
|
]
|
||||||
[ utmpx-ut_ss >>sockaddr ]
|
[ ut_ss>> >>sockaddr ] bi ;
|
||||||
} cleave ;
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
unix
|
macosx
|
||||||
|
netbsd
|
||||||
|
|
|
@ -2,23 +2,36 @@ USING: help.markup help.syntax strings ;
|
||||||
IN: vocabs.metadata
|
IN: vocabs.metadata
|
||||||
|
|
||||||
ARTICLE: "vocabs.metadata" "Vocabulary metadata"
|
ARTICLE: "vocabs.metadata" "Vocabulary metadata"
|
||||||
"Vocabulary summaries:"
|
"Vocabulary directories can contain text files with metadata:"
|
||||||
|
{ $list
|
||||||
|
{ { $snippet "authors.txt" } " - a series of lines, with one author name per line. These are listed under " { $link "vocab-authors" } "." }
|
||||||
|
{ { $snippet "platforms.txt" } " - a series of lines, with one operating system name per line." }
|
||||||
|
{ { $snippet "resources.txt" } " - a series of lines, with one file glob pattern per line. Files inside the vocabulary directory whose names match any of these glob patterns will be included with the compiled application as " { $link "deploy-resources" } "." }
|
||||||
|
{ { $snippet "summary.txt" } " - a one-line description." }
|
||||||
|
{ { $snippet "tags.txt" } " - a series of lines, with one tag per line. Tags help classify the vocabulary. Consult " { $link "vocab-tags" } " for a list of existing tags you can reuse." }
|
||||||
|
}
|
||||||
|
"Words for reading and writing " { $snippet "summary.txt" } ":"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
vocab-summary
|
vocab-summary
|
||||||
set-vocab-summary
|
set-vocab-summary
|
||||||
}
|
}
|
||||||
"Vocabulary authors:"
|
"Words for reading and writing " { $snippet "authors.txt" } ":"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
vocab-authors
|
vocab-authors
|
||||||
set-vocab-authors
|
set-vocab-authors
|
||||||
}
|
}
|
||||||
"Vocabulary tags:"
|
"Words for reading and writing " { $snippet "tags.txt" } ":"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
vocab-tags
|
vocab-tags
|
||||||
set-vocab-tags
|
set-vocab-tags
|
||||||
add-vocab-tags
|
add-vocab-tags
|
||||||
}
|
}
|
||||||
"Vocabulary resources:"
|
"Words for reading and writing " { $snippet "platforms.txt" } ":"
|
||||||
|
{ $subsections
|
||||||
|
vocab-platforms
|
||||||
|
set-vocab-platforms
|
||||||
|
}
|
||||||
|
"Words for reading and writing " { $snippet "resources.txt" } ":"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
vocab-resources
|
vocab-resources
|
||||||
set-vocab-resources
|
set-vocab-resources
|
||||||
|
@ -55,6 +68,16 @@ HELP: set-vocab-tags
|
||||||
{ $values { "tags" "a sequence of strings" } { "vocab" "a vocabulary specifier" } }
|
{ $values { "tags" "a sequence of strings" } { "vocab" "a vocabulary specifier" } }
|
||||||
{ $description "Stores a list of short tags classifying the vocabulary to the " { $snippet "tags.txt" } " file in the vocabulary's directory." } ;
|
{ $description "Stores a list of short tags classifying the vocabulary to the " { $snippet "tags.txt" } " file in the vocabulary's directory." } ;
|
||||||
|
|
||||||
|
HELP: vocab-platforms
|
||||||
|
{ $values { "vocab" "a vocabulary specifier" } { "platforms" "a sequence of operating system symbols" } }
|
||||||
|
{ $description "Outputs a list of operating systems supported by " { $snippet "vocab" } ", as specified by the " { $snippet "platforms.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." }
|
||||||
|
{ $notes "Operating system symbols are defined in the " { $vocab-link "system" } " vocabulary." } ;
|
||||||
|
|
||||||
|
HELP: set-vocab-platforms
|
||||||
|
{ $values { "platforms" "a sequence of operating system symbols" } { "vocab" "a vocabulary specifier" } }
|
||||||
|
{ $description "Stores a list of operating systems supported by " { $snippet "vocab" } " to the " { $snippet "platforms.txt" } " file in the vocabulary's directory." }
|
||||||
|
{ $notes "Operating system symbols are defined in the " { $vocab-link "system" } " vocabulary." } ;
|
||||||
|
|
||||||
HELP: vocab-resources
|
HELP: vocab-resources
|
||||||
{ $values { "vocab" "a vocabulary specifier" } { "patterns" "a sequence of glob patterns" } }
|
{ $values { "vocab" "a vocabulary specifier" } { "patterns" "a sequence of glob patterns" } }
|
||||||
{ $description "Outputs a list of glob patterns matching files that will be deployed with an application that includes " { $snippet "vocab" } ", as specified by the " { $snippet "resources.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." }
|
{ $description "Outputs a list of glob patterns matching files that will be deployed with an application that includes " { $snippet "vocab" } ", as specified by the " { $snippet "resources.txt" } " file in the vocabulary's directory. Outputs an empty array if the file doesn't exist." }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2008, 2009 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays sequences kernel kernel.private accessors math
|
USING: arrays sequences kernel kernel.private accessors math
|
||||||
alien.accessors byte-arrays io io.encodings io.encodings.utf8
|
alien.accessors byte-arrays io io.encodings io.encodings.utf8
|
||||||
|
@ -37,17 +37,16 @@ M: string string>alien
|
||||||
|
|
||||||
M: tuple string>alien drop underlying>> ;
|
M: tuple string>alien drop underlying>> ;
|
||||||
|
|
||||||
HOOK: alien>native-string os ( alien -- string )
|
HOOK: native-string-encoding os ( -- encoding ) foldable
|
||||||
|
|
||||||
M: windows alien>native-string utf16n alien>string ;
|
M: unix native-string-encoding utf8 ;
|
||||||
|
M: windows native-string-encoding utf16n ;
|
||||||
|
|
||||||
M: unix alien>native-string utf8 alien>string ;
|
: alien>native-string ( alien -- string )
|
||||||
|
native-string-encoding alien>string ; inline
|
||||||
|
|
||||||
HOOK: native-string>alien os ( string -- alien )
|
: native-string>alien ( string -- alien )
|
||||||
|
native-string-encoding string>alien ; inline
|
||||||
M: windows native-string>alien utf16n string>alien ;
|
|
||||||
|
|
||||||
M: unix native-string>alien utf8 string>alien ;
|
|
||||||
|
|
||||||
: dll-path ( dll -- string )
|
: dll-path ( dll -- string )
|
||||||
path>> alien>native-string ;
|
path>> alien>native-string ;
|
||||||
|
|
|
@ -27,10 +27,11 @@ ARTICLE: "vocabs.roots" "Vocabulary roots"
|
||||||
"You can store your own vocabularies in the " { $snippet "work" } " directory."
|
"You can store your own vocabularies in the " { $snippet "work" } " directory."
|
||||||
{ $subsections "add-vocab-roots" } ;
|
{ $subsections "add-vocab-roots" } ;
|
||||||
|
|
||||||
|
ARTICLE: "vocabs.icons" "Vocabulary icons"
|
||||||
|
"An icon file representing the vocabulary can be provided for use by " { $link "tools.deploy" } ". A file named " { $snippet "icon.ico" } " will be used as the application icon when the application is deployed on Windows. A file named " { $snippet "icon.icns" } " will be used when the application is deployed on MacOS X." ;
|
||||||
|
|
||||||
ARTICLE: "vocabs.loader" "Vocabulary loader"
|
ARTICLE: "vocabs.loader" "Vocabulary loader"
|
||||||
"The vocabulary loader combines the vocabulary system with " { $link "parser" } " in order to implement automatic loading of vocabulary source files. The vocabulary loader is implemented in the " { $vocab-link "vocabs.loader" } " vocabulary."
|
"The " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " words load vocabularies using the vocabulary loader. The vocabulary loader is implemented in the " { $vocab-link "vocabs.loader" } " vocabulary."
|
||||||
$nl
|
|
||||||
"When an attempt is made to use a vocabulary that has not been loaded into the image, the vocabulary loader is asked to locate the vocabulary's source files, and load them."
|
|
||||||
$nl
|
$nl
|
||||||
"The vocabulary loader searches for vocabularies in a set of directories known as vocabulary roots."
|
"The vocabulary loader searches for vocabularies in a set of directories known as vocabulary roots."
|
||||||
{ $subsections "vocabs.roots" }
|
{ $subsections "vocabs.roots" }
|
||||||
|
@ -45,17 +46,8 @@ $nl
|
||||||
{ { $snippet "foo/bar/bar-docs.factor" } " - documentation, see " { $link "writing-help" } }
|
{ { $snippet "foo/bar/bar-docs.factor" } " - documentation, see " { $link "writing-help" } }
|
||||||
{ { $snippet "foo/bar/bar-tests.factor" } " - unit tests, see " { $link "tools.test" } }
|
{ { $snippet "foo/bar/bar-tests.factor" } " - unit tests, see " { $link "tools.test" } }
|
||||||
}
|
}
|
||||||
"Finally, four optional text files may contain metadata:"
|
"Optional text files may contain metadata."
|
||||||
{ $list
|
{ $subsections "vocabs.metadata" "vocabs.icons" }
|
||||||
{ { $snippet "foo/bar/authors.txt" } " - a series of lines, with one author name per line. These are listed under " { $link "vocab-authors" } "." }
|
|
||||||
{ { $snippet "foo/bar/resources.txt" } " - a series of lines with one file glob pattern per line. Files inside the vocabulary directory whose names match any of these glob patterns will be included with the compiled application as " { $link "deploy-resources" } "." }
|
|
||||||
{ { $snippet "foo/bar/summary.txt" } " - a one-line description." }
|
|
||||||
{ { $snippet "foo/bar/tags.txt" } " - a whitespace-separated list of tags which classify the vocabulary. Consult " { $link "vocab-tags" } " for a list of existing tags you can reuse." }
|
|
||||||
}
|
|
||||||
"An icon file representing the vocabulary can also be provided. A file named " { $snippet "icon.ico" } " will be used as the application icon when the application is deployed on Windows. A file named " { $snippet "icon.icns" } " will be used when the application is deployed on MacOS X."
|
|
||||||
$nl
|
|
||||||
"The " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } " words load vocabularies which have not been loaded yet, as needed."
|
|
||||||
$nl
|
|
||||||
"Vocabularies can also be loaded at run time, without altering the vocabulary search path. This is done by calling a word which loads a vocabulary if it is not in the image, doing nothing if it is:"
|
"Vocabularies can also be loaded at run time, without altering the vocabulary search path. This is done by calling a word which loads a vocabulary if it is not in the image, doing nothing if it is:"
|
||||||
{ $subsections require }
|
{ $subsections require }
|
||||||
"The above word will only ever load a vocabulary once in a given session. There is another word which unconditionally loads vocabulary from disk, regardless of whether or not is has already been loaded:"
|
"The above word will only ever load a vocabulary once in a given session. There is another word which unconditionally loads vocabulary from disk, regardless of whether or not is has already been loaded:"
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
! Copyright (C) 2009 Doug Coleman.
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io.files.windows io.streams.duplex kernel math
|
USING: io.files.windows io.streams.duplex kernel math
|
||||||
math.bitwise windows.kernel32 accessors alien.c-types
|
math.bitwise windows windows.kernel32 windows.errors accessors
|
||||||
windows io.files.windows fry locals continuations
|
alien.c-types fry locals continuations classes.struct ;
|
||||||
classes.struct ;
|
|
||||||
IN: io.serial.windows
|
IN: io.serial.windows
|
||||||
|
|
||||||
: <serial-stream> ( path encoding -- duplex )
|
: <serial-stream> ( path encoding -- duplex )
|
||||||
|
|
|
@ -1,26 +1,24 @@
|
||||||
USING: alien.c-types alien.syntax io io.encodings.utf16n
|
! Copyright (C) 2009 Phil Dawes.
|
||||||
io.encodings.utf8 io.files kernel namespaces sequences system threads
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.c-types alien.strings alien.syntax io
|
||||||
|
io.encodings.utf8 io.files kernel sequences system threads
|
||||||
unix.utilities ;
|
unix.utilities ;
|
||||||
IN: native-thread-test
|
IN: native-thread-test
|
||||||
|
|
||||||
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
|
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
|
||||||
|
|
||||||
HOOK: native-string-encoding os ( -- encoding )
|
|
||||||
M: windows native-string-encoding utf16n ;
|
|
||||||
M: unix native-string-encoding utf8 ;
|
|
||||||
|
|
||||||
: start-vm-in-os-thread ( args -- threadhandle )
|
: start-vm-in-os-thread ( args -- threadhandle )
|
||||||
\ vm get-global prefix
|
vm prefix
|
||||||
[ length ] [ native-string-encoding strings>alien ] bi
|
[ length ] [ native-string-encoding strings>alien ] bi
|
||||||
start_standalone_factor_in_new_thread ;
|
start_standalone_factor_in_new_thread ;
|
||||||
|
|
||||||
: start-tetris-in-os-thread ( -- )
|
: start-tetris-in-os-thread ( -- )
|
||||||
{ "-run=tetris" } start-vm-in-os-thread drop ;
|
{ "-run=tetris" } start-vm-in-os-thread drop ;
|
||||||
|
|
||||||
: start-testthread-in-os-thread ( -- )
|
: start-test-thread-in-os-thread ( -- )
|
||||||
{ "-run=native-thread-test" } start-vm-in-os-thread drop ;
|
{ "-run=native-thread-test" } start-vm-in-os-thread drop ;
|
||||||
|
|
||||||
: testthread ( -- )
|
: test-thread ( -- )
|
||||||
"/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
|
"/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
|
||||||
|
|
||||||
MAIN: testthread
|
MAIN: test-thread
|
||||||
|
|
Loading…
Reference in New Issue