Add vocab: for vocab-relative paths

db4
Slava Pestov 2009-02-15 19:53:21 -06:00
parent 1bea447e4d
commit 6b99b04531
60 changed files with 172 additions and 163 deletions

View File

@ -10,7 +10,7 @@ IN: bootstrap.help
t load-help? set-global t load-help? set-global
[ drop ] load-vocab-hook [ [ vocab ] load-vocab-hook [
dictionary get values dictionary get values
[ docs-loaded?>> not ] filter [ docs-loaded?>> not ] filter
[ load-docs ] each [ load-docs ] each

View File

@ -93,9 +93,9 @@ SYMBOL: bootstrap-time
"tools.deploy.shaker" run "tools.deploy.shaker" run
] [ ] [
"staging" get [ "staging" get [
"resource:basis/bootstrap/finish-staging.factor" run-file "vocab:bootstrap/finish-staging.factor" run-file
] [ ] [
"resource:basis/bootstrap/finish-bootstrap.factor" run-file "vocab:bootstrap/finish-bootstrap.factor" run-file
] if ] if
"output-image" get save-image-and-exit "output-image" get save-image-and-exit
@ -104,6 +104,6 @@ SYMBOL: bootstrap-time
drop drop
[ [
load-help? off load-help? off
"resource:basis/bootstrap/bootstrap-error.factor" run-file "vocab:bootstrap/bootstrap-error.factor" run-file
] with-scope ] with-scope
] recover ] recover

View File

@ -6,5 +6,5 @@ IN: bootstrap.ppc
: c-area-size ( -- n ) 10 bootstrap-cells ; : c-area-size ( -- n ) 10 bootstrap-cells ;
: lr-save ( -- n ) bootstrap-cell ; : lr-save ( -- n ) bootstrap-cell ;
<< "resource:basis/cpu/ppc/bootstrap.factor" parse-file parsed >> << "vocab:cpu/ppc/bootstrap.factor" parse-file parsed >>
call call

View File

@ -6,5 +6,5 @@ IN: bootstrap.ppc
: c-area-size ( -- n ) 14 bootstrap-cells ; : c-area-size ( -- n ) 14 bootstrap-cells ;
: lr-save ( -- n ) 2 bootstrap-cells ; : lr-save ( -- n ) 2 bootstrap-cells ;
<< "resource:basis/cpu/ppc/bootstrap.factor" parse-file parsed >> << "vocab:cpu/ppc/bootstrap.factor" parse-file parsed >>
call call

View File

@ -30,5 +30,5 @@ IN: bootstrap.x86
(JMP) drop (JMP) drop
] rc-relative rt-primitive 1 jit-primitive jit-define ] rc-relative rt-primitive 1 jit-primitive jit-define
<< "resource:basis/cpu/x86/bootstrap.factor" parse-file parsed >> << "vocab:cpu/x86/bootstrap.factor" parse-file parsed >>
call call

View File

@ -30,5 +30,5 @@ IN: bootstrap.x86
temp1 JMP ! go temp1 JMP ! go
] rc-absolute-cell rt-primitive 1 rex-length + jit-primitive jit-define ] rc-absolute-cell rt-primitive 1 rex-length + jit-primitive jit-define
<< "resource:basis/cpu/x86/bootstrap.factor" parse-file parsed >> << "vocab:cpu/x86/bootstrap.factor" parse-file parsed >>
call call

View File

@ -7,5 +7,5 @@ IN: bootstrap.x86
: stack-frame-size ( -- n ) 4 bootstrap-cells ; : stack-frame-size ( -- n ) 4 bootstrap-cells ;
: arg ( -- reg ) RDI ; : arg ( -- reg ) RDI ;
<< "resource:basis/cpu/x86/64/bootstrap.factor" parse-file parsed >> << "vocab:cpu/x86/64/bootstrap.factor" parse-file parsed >>
call call

View File

@ -7,5 +7,5 @@ IN: bootstrap.x86
: stack-frame-size ( -- n ) 8 bootstrap-cells ; : stack-frame-size ( -- n ) 8 bootstrap-cells ;
: arg ( -- reg ) RCX ; : arg ( -- reg ) RCX ;
<< "resource:basis/cpu/x86/64/bootstrap.factor" parse-file parsed >> << "vocab:cpu/x86/64/bootstrap.factor" parse-file parsed >>
call call

View File

@ -54,7 +54,7 @@ M: f topic>filename* drop \ f topic>filename* ;
M: topic url-of topic>filename ; M: topic url-of topic>filename ;
: help-stylesheet ( -- string ) : help-stylesheet ( -- string )
"resource:basis/help/html/stylesheet.css" ascii file-contents "vocab:help/html/stylesheet.css" ascii file-contents
[XML <style><-></style> XML] ; [XML <style><-></style> XML] ;
: help>html ( topic -- xml ) : help>html ( topic -- xml )

View File

@ -10,7 +10,7 @@ IN: html.templates.chloe.tests
"?>" split1 nip ; inline "?>" split1 nip ; inline
: test-template ( name -- template ) : test-template ( name -- template )
"resource:basis/html/templates/chloe/test/" "vocab:html/templates/chloe/test/"
prepend <chloe> ; prepend <chloe> ;
[ "Hello world" ] [ [ "Hello world" ] [

View File

@ -4,7 +4,7 @@ tools.test sequences parser splitting prettyprint ;
IN: html.templates.fhtml.tests IN: html.templates.fhtml.tests
: test-template ( path -- ? ) : test-template ( path -- ? )
"resource:basis/html/templates/fhtml/test/" "vocab:html/templates/fhtml/test/"
prepend prepend
[ ".fhtml" append <fhtml> [ call-template ] with-string-writer ] [ ".fhtml" append <fhtml> [ call-template ] with-string-writer ]
[ ".html" append utf8 file-contents ] bi [ ".html" append utf8 file-contents ] bi

View File

@ -213,7 +213,7 @@ test-db [
<dispatcher> <dispatcher>
add-quit-action add-quit-action
<dispatcher> <dispatcher>
"resource:basis/http/test" <static> >>default "vocab:http/test" <static> >>default
"nested" add-responder "nested" add-responder
<action> <action>
[ URL" redirect-loop" <temporary-redirect> ] >>display [ URL" redirect-loop" <temporary-redirect> ] >>display
@ -226,7 +226,7 @@ test-db [
>url clone "port" get >>port ; >url clone "port" get >>port ;
[ t ] [ [ t ] [
"resource:basis/http/test/foo.html" ascii file-contents "vocab:http/test/foo.html" ascii file-contents
"http://localhost/nested/foo.html" add-port http-get nip = "http://localhost/nested/foo.html" add-port http-get nip =
] unit-test ] unit-test

View File

@ -3,16 +3,16 @@ io.files io.files.unique kernel tools.test ;
IN: images.bitmap.tests IN: images.bitmap.tests
: test-bitmap24 ( -- path ) : test-bitmap24 ( -- path )
"resource:basis/images/test-images/thiswayup24.bmp" ; "vocab:images/test-images/thiswayup24.bmp" ;
: test-bitmap8 ( -- path ) : test-bitmap8 ( -- path )
"resource:basis/images/test-images/rgb8bit.bmp" ; "vocab:images/test-images/rgb8bit.bmp" ;
: test-bitmap4 ( -- path ) : test-bitmap4 ( -- path )
"resource:basis/images/test-images/rgb4bit.bmp" ; "vocab:images/test-images/rgb4bit.bmp" ;
: test-bitmap1 ( -- path ) : test-bitmap1 ( -- path )
"resource:basis/images/test-images/1bit.bmp" ; "vocab:images/test-images/1bit.bmp" ;
[ t ] [ t ]
[ [

View File

@ -33,7 +33,7 @@ IN: io.encodings.8-bit
} ; } ;
: encoding-file ( file-name -- stream ) : encoding-file ( file-name -- stream )
"resource:basis/io/encodings/8-bit/" swap ".TXT" "vocab:io/encodings/8-bit/" swap ".TXT"
3append ascii <file-reader> ; 3append ascii <file-reader> ;
: process-contents ( lines -- assoc ) : process-contents ( lines -- assoc )

View File

@ -80,7 +80,7 @@ VALUE: gb>u
VALUE: u>gb VALUE: u>gb
VALUE: mapping VALUE: mapping
"resource:basis/io/encodings/chinese/gb-18030-2000.xml" "vocab:io/encodings/chinese/gb-18030-2000.xml"
ascii <file-reader> xml>gb-data ascii <file-reader> xml>gb-data
[ ranges-u>gb to: u>gb ] [ ranges-gb>u to: gb>u ] bi [ ranges-u>gb to: u>gb ] [ ranges-gb>u to: gb>u ] bi
>biassoc to: mapping >biassoc to: mapping

View File

@ -44,7 +44,7 @@ ERROR: missing-name encoding ;
PRIVATE> PRIVATE>
"resource:basis/io/encodings/iana/character-sets" "vocab:io/encodings/iana/character-sets"
utf8 <file-reader> make-aliases aliases set-global utf8 <file-reader> make-aliases aliases set-global
n>e-table [ initial-n>e ] initialize n>e-table [ initial-n>e ] initialize

View File

@ -44,10 +44,10 @@ TUPLE: jis assoc ;
: make-jis ( filename -- jis ) : make-jis ( filename -- jis )
ascii file-lines process-jis <jis> ; ascii file-lines process-jis <jis> ;
"resource:basis/io/encodings/japanese/CP932.txt" "vocab:io/encodings/japanese/CP932.txt"
make-jis to: windows-31j-table make-jis to: windows-31j-table
"resource:basis/io/encodings/japanese/sjis-0208-1997-std.txt" "vocab:io/encodings/japanese/sjis-0208-1997-std.txt"
make-jis to: shift-jis-table make-jis to: shift-jis-table
: small? ( char -- ? ) : small? ( char -- ? )

View File

@ -5,8 +5,8 @@ USING: accessors kernel io.sockets io.sockets.secure tools.test ;
[ ] [ [ ] [
<secure-config> <secure-config>
"resource:basis/openssl/test/server.pem" >>key-file "vocab:openssl/test/server.pem" >>key-file
"resource:basis/openssl/test/dh1024.pem" >>dh-file "vocab:openssl/test/dh1024.pem" >>dh-file
"password" >>password "password" >>password
[ ] with-secure-context [ ] with-secure-context
] unit-test ] unit-test

View File

@ -26,7 +26,7 @@ ephemeral-key-bits ;
secure-config new secure-config new
SSLv23 >>method SSLv23 >>method
1024 >>ephemeral-key-bits 1024 >>ephemeral-key-bits
"resource:basis/openssl/cacert.pem" >>ca-file "vocab:openssl/cacert.pem" >>ca-file
t >>verify ; t >>verify ;
TUPLE: secure-context config handle disposed ; TUPLE: secure-context config handle disposed ;

View File

@ -5,7 +5,7 @@ IN: io.sockets.secure.unix.debug
: with-test-context ( quot -- ) : with-test-context ( quot -- )
<secure-config> <secure-config>
"resource:basis/openssl/test/server.pem" >>key-file "vocab:openssl/test/server.pem" >>key-file
"resource:basis/openssl/test/dh1024.pem" >>dh-file "vocab:openssl/test/dh1024.pem" >>dh-file
"password" >>password "password" >>password
swap with-secure-context ; inline swap with-secure-context ; inline

View File

@ -5,7 +5,7 @@ splitting kernel namespaces fry memoize ;
IN: mime.types IN: mime.types
MEMO: mime-db ( -- seq ) MEMO: mime-db ( -- seq )
"resource:basis/mime/types/mime.types" ascii file-lines "vocab:mime/types/mime.types" ascii file-lines
[ "#" head? not ] filter [ " \t" split harvest ] map harvest ; [ "#" head? not ] filter [ " \t" split harvest ] map harvest ;
: nonstandard-mime-types ( -- assoc ) : nonstandard-mime-types ( -- assoc )

View File

@ -4,17 +4,17 @@ openssl namespaces accessors tools.test continuations kernel ;
openssl secure-socket-backend [ openssl secure-socket-backend [
[ ] [ [ ] [
<secure-config> <secure-config>
"resource:basis/openssl/test/server.pem" >>key-file "vocab:openssl/test/server.pem" >>key-file
"resource:basis/openssl/test/root.pem" >>ca-file "vocab:openssl/test/root.pem" >>ca-file
"resource:basis/openssl/test/dh1024.pem" >>dh-file "vocab:openssl/test/dh1024.pem" >>dh-file
"password" >>password "password" >>password
[ ] with-secure-context [ ] with-secure-context
] unit-test ] unit-test
[ [
<secure-config> <secure-config>
"resource:basis/openssl/test/server.pem" >>key-file "vocab:openssl/test/server.pem" >>key-file
"resource:basis/openssl/test/root.pem" >>ca-file "vocab:openssl/test/root.pem" >>ca-file
"wrong password" >>password "wrong password" >>password
[ ] with-secure-context [ ] with-secure-context
] must-fail ] must-fail

View File

@ -57,8 +57,8 @@ io.files io.encodings.utf8 ;
[ "mate" ] [ "mate" step5 "" like ] unit-test [ "mate" ] [ "mate" step5 "" like ] unit-test
[ { } ] [ [ { } ] [
"resource:basis/porter-stemmer/test/voc.txt" utf8 file-lines "vocab:porter-stemmer/test/voc.txt" utf8 file-lines
[ stem ] map [ stem ] map
"resource:basis/porter-stemmer/test/output.txt" utf8 file-lines "vocab:porter-stemmer/test/output.txt" utf8 file-lines
[ 2array ] 2map [ first2 = not ] filter [ 2array ] 2map [ first2 = not ] filter
] unit-test ] unit-test

View File

@ -25,7 +25,7 @@ IN: syndication.tests
f f
} }
} }
} ] [ "resource:basis/syndication/test/rss1.xml" load-news-file ] unit-test } ] [ "vocab:syndication/test/rss1.xml" load-news-file ] unit-test
[ T{ [ T{
feed feed
f f
@ -42,5 +42,5 @@ IN: syndication.tests
T{ timestamp f 2003 12 13 8 29 29 T{ duration f 0 0 0 -4 0 0 } } T{ timestamp f 2003 12 13 8 29 29 T{ duration f 0 0 0 -4 0 0 } }
} }
} }
} ] [ "resource:basis/syndication/test/atom.xml" load-news-file ] unit-test } ] [ "vocab:syndication/test/atom.xml" load-news-file ] unit-test
[ ] [ "resource:basis/syndication/test/atom.xml" load-news-file feed>xml xml>string drop ] unit-test [ ] [ "vocab:syndication/test/atom.xml" load-news-file feed>xml xml>string drop ] unit-test

View File

@ -7,7 +7,7 @@ GENERIC: foo
M: integer foo + ; M: integer foo + ;
"resource:basis/tools/crossref/test/foo.factor" run-file "vocab:tools/crossref/test/foo.factor" run-file
[ t ] [ integer \ foo method \ + usage member? ] unit-test [ t ] [ integer \ foo method \ + usage member? ] unit-test
[ t ] [ \ foo usage [ pathname? ] any? ] unit-test [ t ] [ \ foo usage [ pathname? ] any? ] unit-test

View File

@ -65,7 +65,7 @@ M: quit-responder call-responder*
[ ] [ [ ] [
<dispatcher> <dispatcher>
add-quot-responder add-quot-responder
"resource:basis/http/test" <static> >>default "vocab:http/test" <static> >>default
test-httpd test-httpd
] unit-test ] unit-test

View File

@ -42,21 +42,21 @@ IN: tools.deploy.shaker
: strip-debugger ( -- ) : strip-debugger ( -- )
strip-debugger? "debugger" vocab and [ strip-debugger? "debugger" vocab and [
"Stripping debugger" show "Stripping debugger" show
"resource:basis/tools/deploy/shaker/strip-debugger.factor" "vocab:tools/deploy/shaker/strip-debugger.factor"
run-file run-file
] when ; ] when ;
: strip-libc ( -- ) : strip-libc ( -- )
"libc" vocab [ "libc" vocab [
"Stripping manual memory management debug code" show "Stripping manual memory management debug code" show
"resource:basis/tools/deploy/shaker/strip-libc.factor" "vocab:tools/deploy/shaker/strip-libc.factor"
run-file run-file
] when ; ] when ;
: strip-cocoa ( -- ) : strip-cocoa ( -- )
"cocoa" vocab [ "cocoa" vocab [
"Stripping unused Cocoa methods" show "Stripping unused Cocoa methods" show
"resource:basis/tools/deploy/shaker/strip-cocoa.factor" "vocab:tools/deploy/shaker/strip-cocoa.factor"
run-file run-file
] when ; ] when ;
@ -380,7 +380,7 @@ SYMBOL: deploy-vocab
dup next-method-quot "next-method-quot" set-word-prop dup next-method-quot "next-method-quot" set-word-prop
] assoc-each ] assoc-each
] each ] each
"resource:basis/tools/deploy/shaker/next-methods.factor" run-file ; "vocab:tools/deploy/shaker/next-methods.factor" run-file ;
: strip ( -- ) : strip ( -- )
init-stripper init-stripper

View File

@ -241,6 +241,12 @@ M: vocab-link summary vocab-summary ;
swap [ "." glue ] with map swap [ "." glue ] with map
] unless-empty ; ] unless-empty ;
: vocab-dir? ( root name -- ? )
over
[ ".factor" vocab-dir+ append-path exists? ]
[ 2drop f ]
if ;
: vocabs-in-dir ( root name -- ) : vocabs-in-dir ( root name -- )
dupd (all-child-vocabs) [ dupd (all-child-vocabs) [
2dup vocab-dir? [ dup >vocab-link , ] when 2dup vocab-dir? [ dup >vocab-link , ] when

View File

@ -10,10 +10,10 @@ IN: unicode.breaks.tests
dup last-grapheme head last-grapheme ] unit-test dup last-grapheme head last-grapheme ] unit-test
: grapheme-break-test ( -- filename ) : grapheme-break-test ( -- filename )
"resource:basis/unicode/breaks/GraphemeBreakTest.txt" ; "vocab:unicode/breaks/GraphemeBreakTest.txt" ;
: word-break-test ( -- filename ) : word-break-test ( -- filename )
"resource:basis/unicode/breaks/WordBreakTest.txt" ; "vocab:unicode/breaks/WordBreakTest.txt" ;
: parse-test-file ( file-name -- tests ) : parse-test-file ( file-name -- tests )
utf8 file-lines utf8 file-lines

View File

@ -127,7 +127,7 @@ to: grapheme-table
VALUE: word-break-table VALUE: word-break-table
"resource:basis/unicode/data/WordBreakProperty.txt" load-script "vocab:unicode/data/WordBreakProperty.txt" load-script
to: word-break-table to: word-break-table
C-ENUM: wOther wCR wLF wNewline wExtend wFormat wKatakana wALetter wMidLetter C-ENUM: wOther wCR wLF wNewline wExtend wFormat wKatakana wALetter wMidLetter

View File

@ -4,7 +4,7 @@ tools.test assocs words ;
IN: unicode.collation.tests IN: unicode.collation.tests
: parse-test ( -- strings ) : parse-test ( -- strings )
"resource:basis/unicode/collation/CollationTest_SHIFTED.txt" "vocab:unicode/collation/CollationTest_SHIFTED.txt"
utf8 file-lines 5 tail utf8 file-lines 5 tail
[ ";" split1 drop " " split [ hex> ] "" map-as ] map ; [ ";" split1 drop " " split [ hex> ] "" map-as ] map ;

View File

@ -28,7 +28,7 @@ TUPLE: weight primary secondary tertiary ignorable? ;
lines filter-comments lines filter-comments
[ parse-line ] H{ } map>assoc ; [ parse-line ] H{ } map>assoc ;
"resource:basis/unicode/collation/allkeys.txt" "vocab:unicode/collation/allkeys.txt"
ascii <file-reader> parse-ducet to: ducet ascii <file-reader> parse-ducet to: ducet
! Fix up table for long contractions ! Fix up table for long contractions

View File

@ -38,7 +38,7 @@ VALUE: properties
ascii file-lines [ split-; ] map ; ascii file-lines [ split-; ] map ;
: load-data ( -- data ) : load-data ( -- data )
"resource:basis/unicode/data/UnicodeData.txt" data ; "vocab:unicode/data/UnicodeData.txt" data ;
: filter-comments ( lines -- lines ) : filter-comments ( lines -- lines )
[ "#@" split first ] map harvest ; [ "#@" split first ] map harvest ;
@ -68,7 +68,7 @@ VALUE: properties
[ " " split [ hex> ] map ] assoc-map ; [ " " split [ hex> ] map ] assoc-map ;
: exclusions-file ( -- filename ) : exclusions-file ( -- filename )
"resource:basis/unicode/data/CompositionExclusions.txt" ; "vocab:unicode/data/CompositionExclusions.txt" ;
: exclusions ( -- set ) : exclusions ( -- set )
exclusions-file utf8 file-lines exclusions-file utf8 file-lines
@ -147,7 +147,7 @@ C: <code-point> code-point
! Extra properties ! Extra properties
: properties-lines ( -- lines ) : properties-lines ( -- lines )
"resource:basis/unicode/data/PropList.txt" "vocab:unicode/data/PropList.txt"
ascii file-lines ; ascii file-lines ;
: parse-properties ( -- {{[a,b],prop}} ) : parse-properties ( -- {{[a,b],prop}} )
@ -166,7 +166,7 @@ C: <code-point> code-point
! Special casing data ! Special casing data
: load-special-casing ( -- special-casing ) : load-special-casing ( -- special-casing )
"resource:basis/unicode/data/SpecialCasing.txt" data "vocab:unicode/data/SpecialCasing.txt" data
[ length 5 = ] filter [ length 5 = ] filter
[ [ set-code-point ] each ] H{ } make-assoc ; [ [ set-code-point ] each ] H{ } make-assoc ;

View File

@ -23,7 +23,7 @@ IN: unicode.normalize.tests
[ "\u00d55c" ] [ "\u001112\u001161\u0011ab" nfc ] unit-test [ "\u00d55c" ] [ "\u001112\u001161\u0011ab" nfc ] unit-test
: parse-test ( -- tests ) : parse-test ( -- tests )
"resource:basis/unicode/normalize/NormalizationTest.txt" "vocab:unicode/normalize/NormalizationTest.txt"
utf8 file-lines filter-comments utf8 file-lines filter-comments
[ ";" split 5 head [ " " split [ hex> ] "" map-as ] map ] map ; [ ";" split 5 head [ " " split [ hex> ] "" map-as ] map ] map ;

View File

@ -9,7 +9,7 @@ IN: unicode.script
VALUE: script-table VALUE: script-table
"resource:basis/unicode/script/Scripts.txt" load-script "vocab:unicode/script/Scripts.txt" load-script
to: script-table to: script-table
: script-of ( char -- script ) : script-of ( char -- script )

View File

@ -11,7 +11,7 @@ VALUE: html-entities
: get-html ( -- table ) : get-html ( -- table )
{ "lat1" "special" "symbol" } [ { "lat1" "special" "symbol" } [
"resource:basis/xml/entities/html/xhtml-" "vocab:xml/entities/html/xhtml-"
swap ".ent" 3append read-entities-file swap ".ent" 3append read-entities-file
] map first3 assoc-union assoc-union ; ] map first3 assoc-union assoc-union ;

View File

@ -1,15 +1,15 @@
USING: xml xml.data xml.traversal tools.test accessors kernel USING: xml xml.data xml.traversal tools.test accessors kernel
io.encodings.8-bit ; io.encodings.8-bit ;
[ "\u000131" ] [ "resource:basis/xml/tests/latin5.xml" file>xml children>string ] unit-test [ "\u000131" ] [ "vocab:xml/tests/latin5.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/latin1.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/latin1.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/spaces.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/spaces.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/utf8.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/utf8.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/utf16.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16be.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/utf16be.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16le.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/utf16le.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16be-bom.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/utf16be-bom.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16le-bom.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/utf16le-bom.xml" file>xml children>string ] unit-test
[ "\u0000e9" ] [ "resource:basis/xml/tests/prologless.xml" file>xml children>string ] unit-test [ "\u0000e9" ] [ "vocab:xml/tests/prologless.xml" file>xml children>string ] unit-test
[ "e" ] [ "resource:basis/xml/tests/ascii.xml" file>xml children>string ] unit-test [ "e" ] [ "vocab:xml/tests/ascii.xml" file>xml children>string ] unit-test
[ "\u0000e9" "x" ] [ "resource:basis/xml/tests/unitag.xml" file>xml [ name>> main>> ] [ children>string ] bi ] unit-test [ "\u0000e9" "x" ] [ "vocab:xml/tests/unitag.xml" file>xml [ name>> main>> ] [ children>string ] bi ] unit-test

View File

@ -4,6 +4,6 @@ IN: xml.tests
USING: xml xml.writer io.files io.encodings.utf8 tools.test kernel ; USING: xml xml.writer io.files io.encodings.utf8 tools.test kernel ;
[ t ] [ [ t ] [
"resource:basis/xml/tests/funny-dtd.xml" utf8 file-contents string>xml "vocab:xml/tests/funny-dtd.xml" utf8 file-contents string>xml
dup xml>string string>xml = dup xml>string string>xml =
] unit-test ] unit-test

View File

@ -10,6 +10,6 @@ IN: xml.tests
[ assemble-data ] map ; [ assemble-data ] map ;
[ "http://www.foxnews.com/oreilly/" ] [ [ "http://www.foxnews.com/oreilly/" ] [
"resource:basis/xml/tests/soap.xml" file>xml "vocab:xml/tests/soap.xml" file>xml
parse-result first first parse-result first first
] unit-test ] unit-test

View File

@ -13,11 +13,11 @@ sequences.deep accessors io.streams.string ;
SYMBOL: xml-file SYMBOL: xml-file
[ ] [ [ ] [
"resource:basis/xml/tests/test.xml" "vocab:xml/tests/test.xml"
[ file>xml ] with-html-entities xml-file set [ file>xml ] with-html-entities xml-file set
] unit-test ] unit-test
[ t ] [ [ t ] [
"resource:basis/xml/tests/test.xml" binary file-contents "vocab:xml/tests/test.xml" binary file-contents
[ bytes>xml ] with-html-entities xml-file get = [ bytes>xml ] with-html-entities xml-file get =
] unit-test ] unit-test
[ "1.0" ] [ xml-file get prolog>> version>> ] unit-test [ "1.0" ] [ xml-file get prolog>> version>> ] unit-test

View File

@ -17,7 +17,7 @@ TUPLE: xml-test id uri sections description type ;
: parse-tests ( xml -- tests ) : parse-tests ( xml -- tests )
"TEST" tags-named [ >xml-test ] map ; "TEST" tags-named [ >xml-test ] map ;
: base "resource:basis/xml/tests/xmltest/" ; : base "vocab:xml/tests/xmltest/" ;
MACRO: drop-output ( quot -- newquot ) MACRO: drop-output ( quot -- newquot )
dup infer out>> '[ @ _ ndrop ] ; dup infer out>> '[ @ _ ndrop ] ;

View File

@ -4,5 +4,5 @@ USING: xml xml.data kernel tools.test ;
IN: xml.tests IN: xml.tests
[ t ] [ [ t ] [
"resource:basis/xmode/xmode.dtd" file>dtd dtd? "vocab:xmode/xmode.dtd" file>dtd dtd?
] unit-test ] unit-test

View File

@ -61,7 +61,7 @@ IN: xml.writer.tests
[ "<foo> bar </foo>" string>xml pprint-xml>string ] unit-test [ "<foo> bar </foo>" string>xml pprint-xml>string ] unit-test
[ "<foo'>" ] [ "<foo'>" <unescaped> xml>string ] unit-test [ "<foo'>" ] [ "<foo'>" <unescaped> xml>string ] unit-test
: test-file "resource:basis/xml/writer/test.xml" ; : test-file "vocab:xml/writer/test.xml" ;
[ ] [ "<?xml version='1.0' encoding='UTF-16BE'?><x/>" string>xml test-file utf8 [ write-xml ] with-file-writer ] unit-test [ ] [ "<?xml version='1.0' encoding='UTF-16BE'?><x/>" string>xml test-file utf8 [ write-xml ] with-file-writer ] unit-test
[ "x" ] [ test-file file>xml body>> name>> main>> ] unit-test [ "x" ] [ test-file file>xml body>> name>> main>> ] unit-test

View File

@ -25,7 +25,7 @@ TAGS>
] keep ; ] keep ;
MEMO: modes ( -- modes ) MEMO: modes ( -- modes )
"resource:basis/xmode/modes/catalog" "vocab:xmode/modes/catalog"
file>xml parse-modes-tag ; file>xml parse-modes-tag ;
MEMO: mode-names ( -- modes ) MEMO: mode-names ( -- modes )
@ -37,7 +37,7 @@ MEMO: mode-names ( -- modes )
MEMO: (load-mode) ( name -- rule-sets ) MEMO: (load-mode) ( name -- rule-sets )
modes at [ modes at [
file>> file>>
"resource:basis/xmode/modes/" prepend "vocab:xmode/modes/" prepend
utf8 <file-reader> parse-mode utf8 <file-reader> parse-mode
] [ ] [
"text" (load-mode) "text" (load-mode)

View File

@ -47,6 +47,6 @@ TAGS>
"PUBLIC" "PUBLIC"
} }
] [ ] [
"resource:basis/xmode/utilities/test.xml" "vocab:xmode/utilities/test.xml"
file>xml parse-company-tag file>xml parse-company-tag
] unit-test ] unit-test

View File

@ -16,9 +16,9 @@ crossref off
H{ } clone sub-primitives set H{ } clone sub-primitives set
"resource:core/bootstrap/syntax.factor" parse-file "vocab:bootstrap/syntax.factor" parse-file
"resource:basis/cpu/" architecture get { "vocab:cpu/" architecture get {
{ "x86.32" "x86/32" } { "x86.32" "x86/32" }
{ "winnt-x86.64" "x86/64/winnt" } { "winnt-x86.64" "x86/64/winnt" }
{ "unix-x86.64" "x86/64/unix" } { "unix-x86.64" "x86/64/unix" }
@ -27,7 +27,7 @@ H{ } clone sub-primitives set
{ "arm" "arm" } { "arm" "arm" }
} at "/bootstrap.factor" 3append parse-file } at "/bootstrap.factor" 3append parse-file
"resource:core/bootstrap/layouts/layouts.factor" parse-file "vocab:bootstrap/layouts/layouts.factor" parse-file
! Now we have ( syntax-quot arch-quot layouts-quot ) on the stack ! Now we have ( syntax-quot arch-quot layouts-quot ) on the stack

View File

@ -9,7 +9,7 @@ IN: bootstrap.stage1
"Bootstrap stage 1..." print flush "Bootstrap stage 1..." print flush
"resource:core/bootstrap/primitives.factor" run-file "vocab:bootstrap/primitives.factor" run-file
load-help? off load-help? off
{ "resource:core" } vocab-roots set { "resource:core" } vocab-roots set
@ -40,7 +40,7 @@ load-help? off
"bootstrap.layouts" require "bootstrap.layouts" require
[ [
"resource:basis/bootstrap/stage2.factor" "vocab:bootstrap/stage2.factor"
dup exists? [ dup exists? [
run-file run-file
] [ ] [

View File

@ -4,7 +4,7 @@ namespaces accessors io.encodings ;
IN: io.streams.encodings.tests IN: io.streams.encodings.tests
[ { } ] [ { } ]
[ "resource:core/io/test/empty-file.txt" ascii <file-reader> lines ] [ "vocab:io/test/empty-file.txt" ascii <file-reader> lines ]
unit-test unit-test
: lines-test ( stream -- line1 line2 ) : lines-test ( stream -- line1 line2 )
@ -14,7 +14,7 @@ unit-test
"This is a line." "This is a line."
"This is another line." "This is another line."
] [ ] [
"resource:core/io/test/windows-eol.txt" "vocab:io/test/windows-eol.txt"
ascii <file-reader> lines-test ascii <file-reader> lines-test
] unit-test ] unit-test
@ -22,7 +22,7 @@ unit-test
"This is a line." "This is a line."
"This is another line." "This is another line."
] [ ] [
"resource:core/io/test/mac-os-eol.txt" "vocab:io/test/mac-os-eol.txt"
ascii <file-reader> lines-test ascii <file-reader> lines-test
] unit-test ] unit-test
@ -30,7 +30,7 @@ unit-test
"This is a line." "This is a line."
"This is another line." "This is another line."
] [ ] [
"resource:core/io/test/unix-eol.txt" "vocab:io/test/unix-eol.txt"
ascii <file-reader> lines-test ascii <file-reader> lines-test
] unit-test ] unit-test

View File

@ -14,14 +14,14 @@ IN: io.files.tests
[ [
"This is a line.\rThis is another line.\r" "This is a line.\rThis is another line.\r"
] [ ] [
"resource:core/io/test/mac-os-eol.txt" latin1 <file-reader> "vocab:io/test/mac-os-eol.txt" latin1 <file-reader>
[ 500 read ] with-input-stream [ 500 read ] with-input-stream
] unit-test ] unit-test
[ [
255 255
] [ ] [
"resource:core/io/test/binary.txt" latin1 <file-reader> "vocab:io/test/binary.txt" latin1 <file-reader>
[ read1 ] with-input-stream >fixnum [ read1 ] with-input-stream >fixnum
] unit-test ] unit-test

View File

@ -2,7 +2,7 @@ USING: io parser tools.test words ;
IN: io.tests IN: io.tests
[ f ] [ [ f ] [
"resource:core/io/test/no-trailing-eol.factor" run-file "vocab:io/test/no-trailing-eol.factor" run-file
"foo" "io.tests" lookup "foo" "io.tests" lookup
] unit-test ] unit-test

View File

@ -1,4 +1,4 @@
! Copyright (C) 2004, 2008 Slava Pestov, Doug Coleman. ! Copyright (C) 2004, 2009 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators io.backend kernel math math.order USING: accessors combinators io.backend kernel math math.order
namespaces sequences splitting strings system ; namespaces sequences splitting strings system ;
@ -71,10 +71,17 @@ PRIVATE>
[ f ] [ f ]
} cond ; } cond ;
: special-path? ( path -- rest ? )
{
{ [ "resource:" ?head ] [ t ] }
{ [ "vocab:" ?head ] [ t ] }
[ f ]
} cond ;
: absolute-path? ( path -- ? ) : absolute-path? ( path -- ? )
{ {
{ [ dup empty? ] [ f ] } { [ dup empty? ] [ f ] }
{ [ dup "resource:" head? ] [ t ] } { [ dup special-path? nip ] [ t ] }
{ [ os windows? ] [ windows-absolute-path? ] } { [ os windows? ] [ windows-absolute-path? ] }
{ [ dup first path-separator? ] [ t ] } { [ dup first path-separator? ] [ t ] }
[ f ] [ f ]
@ -107,7 +114,7 @@ PRIVATE>
dup root-directory? [ dup root-directory? [
trim-tail-separators trim-tail-separators
dup last-path-separator [ 1+ tail ] [ dup last-path-separator [ 1+ tail ] [
drop "resource:" ?head [ file-name ] when drop special-path? [ file-name ] when
] if ] if
] unless ; ] unless ;
@ -117,6 +124,8 @@ PRIVATE>
: resource-path ( path -- newpath ) : resource-path ( path -- newpath )
"resource-path" get prepend-path ; "resource-path" get prepend-path ;
GENERIC: vocab-path ( path -- newpath )
GENERIC: (normalize-path) ( path -- path' ) GENERIC: (normalize-path) ( path -- path' )
M: string (normalize-path) M: string (normalize-path)
@ -124,7 +133,12 @@ M: string (normalize-path)
trim-head-separators resource-path trim-head-separators resource-path
(normalize-path) (normalize-path)
] [ ] [
current-directory get prepend-path "vocab:" ?head [
trim-head-separators vocab-path
(normalize-path)
] [
current-directory get prepend-path
] if
] if ; ] if ;
M: object normalize-path ( path -- path' ) M: object normalize-path ( path -- path' )

View File

@ -402,7 +402,7 @@ IN: parser.tests
[ t ] [ "foo" "parser.tests" lookup symbol? ] unit-test [ t ] [ "foo" "parser.tests" lookup symbol? ] unit-test
] times ] times
[ "resource:core/parser/test/assert-depth.factor" run-file ] [ "vocab:parser/test/assert-depth.factor" run-file ]
[ got>> { 1 2 3 } sequence= ] [ got>> { 1 2 3 } sequence= ]
must-fail-with must-fail-with

View File

@ -1,4 +1,4 @@
! Copyright (C) 2007, 2008 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2007, 2009 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: namespaces make sequences io io.files io.pathnames kernel USING: namespaces make sequences io io.files io.pathnames kernel
assocs words vocabs definitions parser continuations hashtables assocs words vocabs definitions parser continuations hashtables
@ -18,6 +18,22 @@ V{
: add-vocab-root ( root -- ) : add-vocab-root ( root -- )
vocab-roots get adjoin ; vocab-roots get adjoin ;
SYMBOL: root-cache
root-cache [ H{ } clone ] initialize
ERROR: not-found-in-roots path ;
<PRIVATE
: find-root-for ( path -- path/f )
vocab-roots get [ prepend-path exists? ] with find nip ;
M: string vocab-path ( string -- path/f )
dup find-root-for [ prepend-path ] [ not-found-in-roots ] if* ;
PRIVATE>
: vocab-dir ( vocab -- dir ) : vocab-dir ( vocab -- dir )
vocab-name { { CHAR: . CHAR: / } } substitute ; vocab-name { { CHAR: . CHAR: / } } substitute ;
@ -26,25 +42,9 @@ V{
[ [ dup peek ] dip append suffix ] when* [ [ dup peek ] dip append suffix ] when*
"/" join ; "/" join ;
: vocab-dir? ( root name -- ? )
over
[ ".factor" vocab-dir+ append-path exists? ]
[ 2drop f ]
if ;
SYMBOL: root-cache
H{ } clone root-cache set-global
<PRIVATE
: (find-vocab-root) ( name -- path/f )
vocab-roots get swap [ vocab-dir? ] curry find nip ;
PRIVATE>
: find-vocab-root ( vocab -- path/f ) : find-vocab-root ( vocab -- path/f )
vocab-name dup root-cache get at [ ] [ (find-vocab-root) ] ?if ; vocab-name dup root-cache get at
[ ] [ ".factor" vocab-dir+ find-root-for ] ?if ;
: vocab-append-path ( vocab path -- newpath ) : vocab-append-path ( vocab path -- newpath )
swap find-vocab-root dup [ prepend-path ] [ 2drop f ] if ; swap find-vocab-root dup [ prepend-path ] [ 2drop f ] if ;
@ -104,14 +104,14 @@ SYMBOL: blacklist
: add-to-blacklist ( error vocab -- ) : add-to-blacklist ( error vocab -- )
vocab-name blacklist get dup [ set-at ] [ 3drop ] if ; vocab-name blacklist get dup [ set-at ] [ 3drop ] if ;
GENERIC: (load-vocab) ( name -- ) GENERIC: (load-vocab) ( name -- vocab )
M: vocab (load-vocab) M: vocab (load-vocab)
[ [
dup source-loaded?>> +parsing+ eq? [ dup source-loaded?>> +parsing+ eq? [
dup source-loaded?>> [ dup load-source ] unless dup source-loaded?>> [ dup load-source ] unless
dup docs-loaded?>> [ dup load-docs ] unless dup docs-loaded?>> [ dup load-docs ] unless
] unless drop ] unless
] [ [ swap add-to-blacklist ] keep rethrow ] recover ; ] [ [ swap add-to-blacklist ] keep rethrow ] recover ;
M: vocab-link (load-vocab) M: vocab-link (load-vocab)
@ -120,22 +120,15 @@ M: vocab-link (load-vocab)
M: string (load-vocab) M: string (load-vocab)
create-vocab (load-vocab) ; create-vocab (load-vocab) ;
[
[
dup vocab-name blacklist get at* [ rethrow ] [
drop dup find-vocab-root
[ [ (load-vocab) ] with-compiler-errors ]
[ dup vocab [ drop ] [ no-vocab ] if ]
if
] if
] with-compiler-errors
] load-vocab-hook set-global
PRIVATE> PRIVATE>
: vocab-where ( vocab -- loc ) [
vocab-source-path dup [ 1 2array ] when ; dup vocab-name blacklist get at* [ rethrow ] [
drop dup find-vocab-root
[ [ (load-vocab) ] with-compiler-errors ]
[ dup vocab [ ] [ no-vocab ] ?if ]
if
] if
] load-vocab-hook set-global
M: vocab where vocab-where ; M: vocab-spec where vocab-source-path dup [ 1 2array ] when ;
M: vocab-link where vocab-where ;

View File

@ -1,4 +1,4 @@
! Copyright (C) 2007, 2008 Eduardo Cavazos, Slava Pestov. ! Copyright (C) 2007, 2009 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs strings kernel sorting namespaces USING: accessors assocs strings kernel sorting namespaces
sequences definitions ; sequences definitions ;
@ -21,18 +21,26 @@ SYMBOL: +done+
swap >>name swap >>name
H{ } clone >>words ; H{ } clone >>words ;
TUPLE: vocab-link name ;
C: <vocab-link> vocab-link
UNION: vocab-spec vocab vocab-link ;
GENERIC: vocab-name ( vocab-spec -- name ) GENERIC: vocab-name ( vocab-spec -- name )
M: vocab vocab-name name>> ;
M: vocab-link vocab-name name>> ;
M: string vocab-name ;
GENERIC: vocab ( vocab-spec -- vocab ) GENERIC: vocab ( vocab-spec -- vocab )
M: vocab vocab ; M: vocab vocab ;
M: object vocab ( name -- vocab ) vocab-name dictionary get at ; M: object vocab ( name -- vocab ) vocab-name dictionary get at ;
M: vocab vocab-name name>> ;
M: string vocab-name ;
GENERIC: vocab-words ( vocab-spec -- words ) GENERIC: vocab-words ( vocab-spec -- words )
M: vocab vocab-words words>> ; M: vocab vocab-words words>> ;
@ -62,11 +70,6 @@ M: f vocab-main ;
ERROR: no-vocab name ; ERROR: no-vocab name ;
SYMBOL: load-vocab-hook ! ( name -- )
: load-vocab ( name -- vocab )
dup load-vocab-hook get call vocab ;
: vocabs ( -- seq ) : vocabs ( -- seq )
dictionary get keys natural-sort ; dictionary get keys natural-sort ;
@ -88,17 +91,6 @@ SYMBOL: load-vocab-hook ! ( name -- )
: child-vocabs ( vocab -- seq ) : child-vocabs ( vocab -- seq )
vocab-name vocabs [ child-vocab? ] with filter ; vocab-name vocabs [ child-vocab? ] with filter ;
TUPLE: vocab-link name ;
: <vocab-link> ( name -- vocab-link )
vocab-link boa ;
M: vocab-link hashcode* name>> hashcode* ;
M: vocab-link vocab-name name>> ;
UNION: vocab-spec vocab vocab-link ;
GENERIC: >vocab-link ( name -- vocab ) GENERIC: >vocab-link ( name -- vocab )
M: vocab-spec >vocab-link ; M: vocab-spec >vocab-link ;
@ -110,3 +102,7 @@ M: string >vocab-link dup vocab [ ] [ <vocab-link> ] ?if ;
vocab-name dictionary get delete-at ; vocab-name dictionary get delete-at ;
M: vocab-spec forget* forget-vocab ; M: vocab-spec forget* forget-vocab ;
SYMBOL: load-vocab-hook ! ( name -- vocab )
: load-vocab ( name -- vocab ) load-vocab-hook get call ;

View File

@ -3,7 +3,7 @@ IN: benchmark.crc32
: crc32-file ( -- ) : crc32-file ( -- )
10 [ 10 [
"resource:basis/mime/multipart/multipart-tests.factor" "vocab:mime/multipart/multipart-tests.factor"
crc32 checksum-file drop crc32 checksum-file drop
] times ; ] times ;

View File

@ -2,6 +2,6 @@ USING: checksums checksums.md5 io.files kernel ;
IN: benchmark.md5 IN: benchmark.md5
: md5-file ( -- ) : md5-file ( -- )
"resource:basis/mime/multipart/multipart-tests.factor" md5 checksum-file drop ; "vocab:mime/multipart/multipart-tests.factor" md5 checksum-file drop ;
MAIN: md5-file MAIN: md5-file

View File

@ -2,6 +2,6 @@ USING: checksums checksums.sha1 io.files kernel ;
IN: benchmark.sha1 IN: benchmark.sha1
: sha1-file ( -- ) : sha1-file ( -- )
"resource:basis/mime/multipart/multipart-tests.factor" sha1 checksum-file drop ; "vocab:mime/multipart/multipart-tests.factor" sha1 checksum-file drop ;
MAIN: sha1-file MAIN: sha1-file

View File

@ -5,7 +5,7 @@ sequences xml ;
IN: benchmark.xml IN: benchmark.xml
: xml-benchmark ( -- ) : xml-benchmark ( -- )
"resource:basis/xmode/modes/" [ "vocab:xmode/modes/" [
[ utf8 <file-reader> read-xml drop ] each [ utf8 <file-reader> read-xml drop ] each
] with-directory-files ; ] with-directory-files ;

View File

@ -143,8 +143,8 @@ io.sockets.secure ;
: <todo-secure-config> ( -- config ) : <todo-secure-config> ( -- config )
! This is only suitable for testing! ! This is only suitable for testing!
<secure-config> <secure-config>
"resource:basis/openssl/test/dh1024.pem" >>dh-file "vocab:openssl/test/dh1024.pem" >>dh-file
"resource:basis/openssl/test/server.pem" >>key-file "vocab:openssl/test/server.pem" >>key-file
"password" >>password ; "password" >>password ;
: <todo-app> ( -- responder ) : <todo-app> ( -- responder )

View File

@ -69,8 +69,8 @@ SYMBOL: dh-file
init-factor-db ; init-factor-db ;
: init-testing ( -- ) : init-testing ( -- )
"resource:basis/openssl/test/dh1024.pem" dh-file set-global "vocab:openssl/test/dh1024.pem" dh-file set-global
"resource:basis/openssl/test/server.pem" key-file set-global "vocab:openssl/test/server.pem" key-file set-global
"password" key-password set-global "password" key-password set-global
common-configuration common-configuration
<factor-website> <factor-website>