From 6b99b04531b5cc5d35225b600a38642ab6297e55 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 15 Feb 2009 19:53:21 -0600 Subject: [PATCH] Add vocab: for vocab-relative paths --- basis/bootstrap/help/help.factor | 2 +- basis/bootstrap/stage2.factor | 6 +- basis/cpu/ppc/linux/bootstrap.factor | 2 +- basis/cpu/ppc/macosx/bootstrap.factor | 2 +- basis/cpu/x86/32/bootstrap.factor | 2 +- basis/cpu/x86/64/bootstrap.factor | 2 +- basis/cpu/x86/64/unix/bootstrap.factor | 2 +- basis/cpu/x86/64/winnt/bootstrap.factor | 2 +- basis/help/html/html.factor | 2 +- basis/html/templates/chloe/chloe-tests.factor | 2 +- basis/html/templates/fhtml/fhtml-tests.factor | 2 +- basis/http/http-tests.factor | 4 +- basis/images/bitmap/bitmap-tests.factor | 8 +-- basis/io/encodings/8-bit/8-bit.factor | 2 +- basis/io/encodings/chinese/chinese.factor | 2 +- basis/io/encodings/iana/iana.factor | 2 +- basis/io/encodings/japanese/japanese.factor | 4 +- basis/io/sockets/secure/secure-tests.factor | 4 +- basis/io/sockets/secure/secure.factor | 2 +- .../io/sockets/secure/unix/debug/debug.factor | 4 +- basis/mime/types/types.factor | 2 +- basis/openssl/openssl-tests.factor | 10 +-- .../porter-stemmer-tests.factor | 4 +- basis/syndication/syndication-tests.factor | 6 +- basis/tools/crossref/crossref-tests.factor | 2 +- basis/tools/deploy/deploy-tests.factor | 2 +- basis/tools/deploy/shaker/shaker.factor | 8 +-- basis/tools/vocabs/vocabs.factor | 6 ++ basis/unicode/breaks/breaks-tests.factor | 4 +- basis/unicode/breaks/breaks.factor | 2 +- .../unicode/collation/collation-tests.factor | 2 +- basis/unicode/collation/collation.factor | 2 +- basis/unicode/data/data.factor | 8 +-- .../unicode/normalize/normalize-tests.factor | 2 +- basis/unicode/script/script.factor | 2 +- basis/xml/entities/html/html.factor | 2 +- basis/xml/tests/encodings.factor | 24 +++---- basis/xml/tests/funny-dtd.factor | 2 +- basis/xml/tests/soap.factor | 2 +- basis/xml/tests/test.factor | 4 +- basis/xml/tests/xmltest.factor | 2 +- basis/xml/tests/xmode-dtd.factor | 2 +- basis/xml/writer/writer-tests.factor | 2 +- basis/xmode/catalog/catalog.factor | 4 +- basis/xmode/utilities/utilities-tests.factor | 2 +- core/bootstrap/primitives.factor | 6 +- core/bootstrap/stage1.factor | 4 +- core/io/encodings/encodings-tests.factor | 8 +-- core/io/files/files-tests.factor | 4 +- core/io/io-tests.factor | 2 +- core/io/pathnames/pathnames.factor | 22 ++++-- core/parser/parser-tests.factor | 2 +- core/vocabs/loader/loader.factor | 67 +++++++++---------- core/vocabs/vocabs.factor | 38 +++++------ extra/benchmark/crc32/crc32.factor | 2 +- extra/benchmark/md5/md5.factor | 2 +- extra/benchmark/sha1/sha1.factor | 2 +- extra/benchmark/xml/xml.factor | 2 +- extra/webapps/todo/todo.factor | 4 +- .../concatenative/concatenative.factor | 4 +- 60 files changed, 172 insertions(+), 163 deletions(-) diff --git a/basis/bootstrap/help/help.factor b/basis/bootstrap/help/help.factor index 145738ff45..bd994a160d 100644 --- a/basis/bootstrap/help/help.factor +++ b/basis/bootstrap/help/help.factor @@ -10,7 +10,7 @@ IN: bootstrap.help t load-help? set-global - [ drop ] load-vocab-hook [ + [ vocab ] load-vocab-hook [ dictionary get values [ docs-loaded?>> not ] filter [ load-docs ] each diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index b521244fe0..070618ebb4 100644 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -93,9 +93,9 @@ SYMBOL: bootstrap-time "tools.deploy.shaker" run ] [ "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 "output-image" get save-image-and-exit @@ -104,6 +104,6 @@ SYMBOL: bootstrap-time drop [ load-help? off - "resource:basis/bootstrap/bootstrap-error.factor" run-file + "vocab:bootstrap/bootstrap-error.factor" run-file ] with-scope ] recover diff --git a/basis/cpu/ppc/linux/bootstrap.factor b/basis/cpu/ppc/linux/bootstrap.factor index fd9bab4835..cf6517b664 100644 --- a/basis/cpu/ppc/linux/bootstrap.factor +++ b/basis/cpu/ppc/linux/bootstrap.factor @@ -6,5 +6,5 @@ IN: bootstrap.ppc : c-area-size ( -- n ) 10 bootstrap-cells ; : lr-save ( -- n ) bootstrap-cell ; -<< "resource:basis/cpu/ppc/bootstrap.factor" parse-file parsed >> +<< "vocab:cpu/ppc/bootstrap.factor" parse-file parsed >> call diff --git a/basis/cpu/ppc/macosx/bootstrap.factor b/basis/cpu/ppc/macosx/bootstrap.factor index f2ddc42688..0c383c2fb0 100644 --- a/basis/cpu/ppc/macosx/bootstrap.factor +++ b/basis/cpu/ppc/macosx/bootstrap.factor @@ -6,5 +6,5 @@ IN: bootstrap.ppc : c-area-size ( -- n ) 14 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 diff --git a/basis/cpu/x86/32/bootstrap.factor b/basis/cpu/x86/32/bootstrap.factor index f29dec128c..5d88f699b8 100644 --- a/basis/cpu/x86/32/bootstrap.factor +++ b/basis/cpu/x86/32/bootstrap.factor @@ -30,5 +30,5 @@ IN: bootstrap.x86 (JMP) drop ] 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 diff --git a/basis/cpu/x86/64/bootstrap.factor b/basis/cpu/x86/64/bootstrap.factor index efa3de3065..ddf5791009 100644 --- a/basis/cpu/x86/64/bootstrap.factor +++ b/basis/cpu/x86/64/bootstrap.factor @@ -30,5 +30,5 @@ IN: bootstrap.x86 temp1 JMP ! go ] 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 diff --git a/basis/cpu/x86/64/unix/bootstrap.factor b/basis/cpu/x86/64/unix/bootstrap.factor index 20a953b6d5..e48a20a9de 100644 --- a/basis/cpu/x86/64/unix/bootstrap.factor +++ b/basis/cpu/x86/64/unix/bootstrap.factor @@ -7,5 +7,5 @@ IN: bootstrap.x86 : stack-frame-size ( -- n ) 4 bootstrap-cells ; : arg ( -- reg ) RDI ; -<< "resource:basis/cpu/x86/64/bootstrap.factor" parse-file parsed >> +<< "vocab:cpu/x86/64/bootstrap.factor" parse-file parsed >> call diff --git a/basis/cpu/x86/64/winnt/bootstrap.factor b/basis/cpu/x86/64/winnt/bootstrap.factor index 3accca400f..ff15ef27af 100644 --- a/basis/cpu/x86/64/winnt/bootstrap.factor +++ b/basis/cpu/x86/64/winnt/bootstrap.factor @@ -7,5 +7,5 @@ IN: bootstrap.x86 : stack-frame-size ( -- n ) 8 bootstrap-cells ; : arg ( -- reg ) RCX ; -<< "resource:basis/cpu/x86/64/bootstrap.factor" parse-file parsed >> +<< "vocab:cpu/x86/64/bootstrap.factor" parse-file parsed >> call diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index cccf320e44..f8d06064f0 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -54,7 +54,7 @@ M: f topic>filename* drop \ f topic>filename* ; M: topic url-of topic>filename ; : help-stylesheet ( -- string ) - "resource:basis/help/html/stylesheet.css" ascii file-contents + "vocab:help/html/stylesheet.css" ascii file-contents [XML XML] ; : help>html ( topic -- xml ) diff --git a/basis/html/templates/chloe/chloe-tests.factor b/basis/html/templates/chloe/chloe-tests.factor index 4e454dcee4..86f86a8468 100644 --- a/basis/html/templates/chloe/chloe-tests.factor +++ b/basis/html/templates/chloe/chloe-tests.factor @@ -10,7 +10,7 @@ IN: html.templates.chloe.tests "?>" split1 nip ; inline : test-template ( name -- template ) - "resource:basis/html/templates/chloe/test/" + "vocab:html/templates/chloe/test/" prepend ; [ "Hello world" ] [ diff --git a/basis/html/templates/fhtml/fhtml-tests.factor b/basis/html/templates/fhtml/fhtml-tests.factor index 6cebb55688..55cf90c2dd 100644 --- a/basis/html/templates/fhtml/fhtml-tests.factor +++ b/basis/html/templates/fhtml/fhtml-tests.factor @@ -4,7 +4,7 @@ tools.test sequences parser splitting prettyprint ; IN: html.templates.fhtml.tests : test-template ( path -- ? ) - "resource:basis/html/templates/fhtml/test/" + "vocab:html/templates/fhtml/test/" prepend [ ".fhtml" append [ call-template ] with-string-writer ] [ ".html" append utf8 file-contents ] bi diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 4f685945aa..229d05615e 100644 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -213,7 +213,7 @@ test-db [ add-quit-action - "resource:basis/http/test" >>default + "vocab:http/test" >>default "nested" add-responder [ URL" redirect-loop" ] >>display @@ -226,7 +226,7 @@ test-db [ >url clone "port" get >>port ; [ 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 = ] unit-test diff --git a/basis/images/bitmap/bitmap-tests.factor b/basis/images/bitmap/bitmap-tests.factor index 102c13c295..e250d81ae5 100644 --- a/basis/images/bitmap/bitmap-tests.factor +++ b/basis/images/bitmap/bitmap-tests.factor @@ -3,16 +3,16 @@ io.files io.files.unique kernel tools.test ; IN: images.bitmap.tests : test-bitmap24 ( -- path ) - "resource:basis/images/test-images/thiswayup24.bmp" ; + "vocab:images/test-images/thiswayup24.bmp" ; : test-bitmap8 ( -- path ) - "resource:basis/images/test-images/rgb8bit.bmp" ; + "vocab:images/test-images/rgb8bit.bmp" ; : test-bitmap4 ( -- path ) - "resource:basis/images/test-images/rgb4bit.bmp" ; + "vocab:images/test-images/rgb4bit.bmp" ; : test-bitmap1 ( -- path ) - "resource:basis/images/test-images/1bit.bmp" ; + "vocab:images/test-images/1bit.bmp" ; [ t ] [ diff --git a/basis/io/encodings/8-bit/8-bit.factor b/basis/io/encodings/8-bit/8-bit.factor index a11edeb703..b3519a7990 100644 --- a/basis/io/encodings/8-bit/8-bit.factor +++ b/basis/io/encodings/8-bit/8-bit.factor @@ -33,7 +33,7 @@ IN: io.encodings.8-bit } ; : encoding-file ( file-name -- stream ) - "resource:basis/io/encodings/8-bit/" swap ".TXT" + "vocab:io/encodings/8-bit/" swap ".TXT" 3append ascii ; : process-contents ( lines -- assoc ) diff --git a/basis/io/encodings/chinese/chinese.factor b/basis/io/encodings/chinese/chinese.factor index b0013b6e08..1d6ef52d8d 100644 --- a/basis/io/encodings/chinese/chinese.factor +++ b/basis/io/encodings/chinese/chinese.factor @@ -80,7 +80,7 @@ VALUE: gb>u VALUE: u>gb VALUE: mapping -"resource:basis/io/encodings/chinese/gb-18030-2000.xml" +"vocab:io/encodings/chinese/gb-18030-2000.xml" ascii xml>gb-data [ ranges-u>gb to: u>gb ] [ ranges-gb>u to: gb>u ] bi >biassoc to: mapping diff --git a/basis/io/encodings/iana/iana.factor b/basis/io/encodings/iana/iana.factor index 6afae92429..07b0429696 100644 --- a/basis/io/encodings/iana/iana.factor +++ b/basis/io/encodings/iana/iana.factor @@ -44,7 +44,7 @@ ERROR: missing-name encoding ; PRIVATE> -"resource:basis/io/encodings/iana/character-sets" +"vocab:io/encodings/iana/character-sets" utf8 make-aliases aliases set-global n>e-table [ initial-n>e ] initialize diff --git a/basis/io/encodings/japanese/japanese.factor b/basis/io/encodings/japanese/japanese.factor index 194ade377b..8f38f597ca 100644 --- a/basis/io/encodings/japanese/japanese.factor +++ b/basis/io/encodings/japanese/japanese.factor @@ -44,10 +44,10 @@ TUPLE: jis assoc ; : make-jis ( filename -- jis ) ascii file-lines process-jis ; -"resource:basis/io/encodings/japanese/CP932.txt" +"vocab:io/encodings/japanese/CP932.txt" 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 : small? ( char -- ? ) diff --git a/basis/io/sockets/secure/secure-tests.factor b/basis/io/sockets/secure/secure-tests.factor index 557bba52d2..b5af130168 100644 --- a/basis/io/sockets/secure/secure-tests.factor +++ b/basis/io/sockets/secure/secure-tests.factor @@ -5,8 +5,8 @@ USING: accessors kernel io.sockets io.sockets.secure tools.test ; [ ] [ - "resource:basis/openssl/test/server.pem" >>key-file - "resource:basis/openssl/test/dh1024.pem" >>dh-file + "vocab:openssl/test/server.pem" >>key-file + "vocab:openssl/test/dh1024.pem" >>dh-file "password" >>password [ ] with-secure-context ] unit-test diff --git a/basis/io/sockets/secure/secure.factor b/basis/io/sockets/secure/secure.factor index c4a1475f48..bff2dbaf1a 100644 --- a/basis/io/sockets/secure/secure.factor +++ b/basis/io/sockets/secure/secure.factor @@ -26,7 +26,7 @@ ephemeral-key-bits ; secure-config new SSLv23 >>method 1024 >>ephemeral-key-bits - "resource:basis/openssl/cacert.pem" >>ca-file + "vocab:openssl/cacert.pem" >>ca-file t >>verify ; TUPLE: secure-context config handle disposed ; diff --git a/basis/io/sockets/secure/unix/debug/debug.factor b/basis/io/sockets/secure/unix/debug/debug.factor index d32cdee2ed..10df82ae7b 100644 --- a/basis/io/sockets/secure/unix/debug/debug.factor +++ b/basis/io/sockets/secure/unix/debug/debug.factor @@ -5,7 +5,7 @@ IN: io.sockets.secure.unix.debug : with-test-context ( quot -- ) - "resource:basis/openssl/test/server.pem" >>key-file - "resource:basis/openssl/test/dh1024.pem" >>dh-file + "vocab:openssl/test/server.pem" >>key-file + "vocab:openssl/test/dh1024.pem" >>dh-file "password" >>password swap with-secure-context ; inline diff --git a/basis/mime/types/types.factor b/basis/mime/types/types.factor index ac5233c543..5693aa9162 100644 --- a/basis/mime/types/types.factor +++ b/basis/mime/types/types.factor @@ -5,7 +5,7 @@ splitting kernel namespaces fry memoize ; IN: mime.types 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 ; : nonstandard-mime-types ( -- assoc ) diff --git a/basis/openssl/openssl-tests.factor b/basis/openssl/openssl-tests.factor index 93af70b3e0..aaae521a62 100644 --- a/basis/openssl/openssl-tests.factor +++ b/basis/openssl/openssl-tests.factor @@ -4,17 +4,17 @@ openssl namespaces accessors tools.test continuations kernel ; openssl secure-socket-backend [ [ ] [ - "resource:basis/openssl/test/server.pem" >>key-file - "resource:basis/openssl/test/root.pem" >>ca-file - "resource:basis/openssl/test/dh1024.pem" >>dh-file + "vocab:openssl/test/server.pem" >>key-file + "vocab:openssl/test/root.pem" >>ca-file + "vocab:openssl/test/dh1024.pem" >>dh-file "password" >>password [ ] with-secure-context ] unit-test [ - "resource:basis/openssl/test/server.pem" >>key-file - "resource:basis/openssl/test/root.pem" >>ca-file + "vocab:openssl/test/server.pem" >>key-file + "vocab:openssl/test/root.pem" >>ca-file "wrong password" >>password [ ] with-secure-context ] must-fail diff --git a/basis/porter-stemmer/porter-stemmer-tests.factor b/basis/porter-stemmer/porter-stemmer-tests.factor index 72bf5c0bb5..4403541608 100644 --- a/basis/porter-stemmer/porter-stemmer-tests.factor +++ b/basis/porter-stemmer/porter-stemmer-tests.factor @@ -57,8 +57,8 @@ io.files io.encodings.utf8 ; [ "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 - "resource:basis/porter-stemmer/test/output.txt" utf8 file-lines + "vocab:porter-stemmer/test/output.txt" utf8 file-lines [ 2array ] 2map [ first2 = not ] filter ] unit-test diff --git a/basis/syndication/syndication-tests.factor b/basis/syndication/syndication-tests.factor index 8cfdc9e1d5..616ce2723a 100644 --- a/basis/syndication/syndication-tests.factor +++ b/basis/syndication/syndication-tests.factor @@ -25,7 +25,7 @@ IN: syndication.tests f } } -} ] [ "resource:basis/syndication/test/rss1.xml" load-news-file ] unit-test +} ] [ "vocab:syndication/test/rss1.xml" load-news-file ] unit-test [ T{ feed 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 } } } } -} ] [ "resource:basis/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 ] unit-test +[ ] [ "vocab:syndication/test/atom.xml" load-news-file feed>xml xml>string drop ] unit-test diff --git a/basis/tools/crossref/crossref-tests.factor b/basis/tools/crossref/crossref-tests.factor index 3d09802576..d4f2fea2e5 100755 --- a/basis/tools/crossref/crossref-tests.factor +++ b/basis/tools/crossref/crossref-tests.factor @@ -7,7 +7,7 @@ GENERIC: 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 ] [ \ foo usage [ pathname? ] any? ] unit-test diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index 8b36947f43..600b1d8d55 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -65,7 +65,7 @@ M: quit-responder call-responder* [ ] [ add-quot-responder - "resource:basis/http/test" >>default + "vocab:http/test" >>default test-httpd ] unit-test diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index c894a8931b..0a0aa82c52 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -42,21 +42,21 @@ IN: tools.deploy.shaker : strip-debugger ( -- ) strip-debugger? "debugger" vocab and [ "Stripping debugger" show - "resource:basis/tools/deploy/shaker/strip-debugger.factor" + "vocab:tools/deploy/shaker/strip-debugger.factor" run-file ] when ; : strip-libc ( -- ) "libc" vocab [ "Stripping manual memory management debug code" show - "resource:basis/tools/deploy/shaker/strip-libc.factor" + "vocab:tools/deploy/shaker/strip-libc.factor" run-file ] when ; : strip-cocoa ( -- ) "cocoa" vocab [ "Stripping unused Cocoa methods" show - "resource:basis/tools/deploy/shaker/strip-cocoa.factor" + "vocab:tools/deploy/shaker/strip-cocoa.factor" run-file ] when ; @@ -380,7 +380,7 @@ SYMBOL: deploy-vocab dup next-method-quot "next-method-quot" set-word-prop ] assoc-each ] each - "resource:basis/tools/deploy/shaker/next-methods.factor" run-file ; + "vocab:tools/deploy/shaker/next-methods.factor" run-file ; : strip ( -- ) init-stripper diff --git a/basis/tools/vocabs/vocabs.factor b/basis/tools/vocabs/vocabs.factor index fe380e0afe..6167a5be23 100644 --- a/basis/tools/vocabs/vocabs.factor +++ b/basis/tools/vocabs/vocabs.factor @@ -241,6 +241,12 @@ M: vocab-link summary vocab-summary ; swap [ "." glue ] with map ] unless-empty ; +: vocab-dir? ( root name -- ? ) + over + [ ".factor" vocab-dir+ append-path exists? ] + [ 2drop f ] + if ; + : vocabs-in-dir ( root name -- ) dupd (all-child-vocabs) [ 2dup vocab-dir? [ dup >vocab-link , ] when diff --git a/basis/unicode/breaks/breaks-tests.factor b/basis/unicode/breaks/breaks-tests.factor index b91cb2b26c..d8e220cf18 100644 --- a/basis/unicode/breaks/breaks-tests.factor +++ b/basis/unicode/breaks/breaks-tests.factor @@ -10,10 +10,10 @@ IN: unicode.breaks.tests dup last-grapheme head last-grapheme ] unit-test : grapheme-break-test ( -- filename ) - "resource:basis/unicode/breaks/GraphemeBreakTest.txt" ; + "vocab:unicode/breaks/GraphemeBreakTest.txt" ; : word-break-test ( -- filename ) - "resource:basis/unicode/breaks/WordBreakTest.txt" ; + "vocab:unicode/breaks/WordBreakTest.txt" ; : parse-test-file ( file-name -- tests ) utf8 file-lines diff --git a/basis/unicode/breaks/breaks.factor b/basis/unicode/breaks/breaks.factor index 6bcf8b50cc..2f8daef8b2 100644 --- a/basis/unicode/breaks/breaks.factor +++ b/basis/unicode/breaks/breaks.factor @@ -127,7 +127,7 @@ to: grapheme-table VALUE: word-break-table -"resource:basis/unicode/data/WordBreakProperty.txt" load-script +"vocab:unicode/data/WordBreakProperty.txt" load-script to: word-break-table C-ENUM: wOther wCR wLF wNewline wExtend wFormat wKatakana wALetter wMidLetter diff --git a/basis/unicode/collation/collation-tests.factor b/basis/unicode/collation/collation-tests.factor index d3d0b8199d..f53a1382ae 100644 --- a/basis/unicode/collation/collation-tests.factor +++ b/basis/unicode/collation/collation-tests.factor @@ -4,7 +4,7 @@ tools.test assocs words ; IN: unicode.collation.tests : parse-test ( -- strings ) - "resource:basis/unicode/collation/CollationTest_SHIFTED.txt" + "vocab:unicode/collation/CollationTest_SHIFTED.txt" utf8 file-lines 5 tail [ ";" split1 drop " " split [ hex> ] "" map-as ] map ; diff --git a/basis/unicode/collation/collation.factor b/basis/unicode/collation/collation.factor index a8bd788e2a..78727b16e2 100755 --- a/basis/unicode/collation/collation.factor +++ b/basis/unicode/collation/collation.factor @@ -28,7 +28,7 @@ TUPLE: weight primary secondary tertiary ignorable? ; lines filter-comments [ parse-line ] H{ } map>assoc ; -"resource:basis/unicode/collation/allkeys.txt" +"vocab:unicode/collation/allkeys.txt" ascii parse-ducet to: ducet ! Fix up table for long contractions diff --git a/basis/unicode/data/data.factor b/basis/unicode/data/data.factor index 2407b740b0..d40024eb1e 100644 --- a/basis/unicode/data/data.factor +++ b/basis/unicode/data/data.factor @@ -38,7 +38,7 @@ VALUE: properties ascii file-lines [ split-; ] map ; : load-data ( -- data ) - "resource:basis/unicode/data/UnicodeData.txt" data ; + "vocab:unicode/data/UnicodeData.txt" data ; : filter-comments ( lines -- lines ) [ "#@" split first ] map harvest ; @@ -68,7 +68,7 @@ VALUE: properties [ " " split [ hex> ] map ] assoc-map ; : exclusions-file ( -- filename ) - "resource:basis/unicode/data/CompositionExclusions.txt" ; + "vocab:unicode/data/CompositionExclusions.txt" ; : exclusions ( -- set ) exclusions-file utf8 file-lines @@ -147,7 +147,7 @@ C: code-point ! Extra properties : properties-lines ( -- lines ) - "resource:basis/unicode/data/PropList.txt" + "vocab:unicode/data/PropList.txt" ascii file-lines ; : parse-properties ( -- {{[a,b],prop}} ) @@ -166,7 +166,7 @@ C: code-point ! Special casing data : load-special-casing ( -- special-casing ) - "resource:basis/unicode/data/SpecialCasing.txt" data + "vocab:unicode/data/SpecialCasing.txt" data [ length 5 = ] filter [ [ set-code-point ] each ] H{ } make-assoc ; diff --git a/basis/unicode/normalize/normalize-tests.factor b/basis/unicode/normalize/normalize-tests.factor index 1242e1d358..f3ecb96af9 100644 --- a/basis/unicode/normalize/normalize-tests.factor +++ b/basis/unicode/normalize/normalize-tests.factor @@ -23,7 +23,7 @@ IN: unicode.normalize.tests [ "\u00d55c" ] [ "\u001112\u001161\u0011ab" nfc ] unit-test : parse-test ( -- tests ) - "resource:basis/unicode/normalize/NormalizationTest.txt" + "vocab:unicode/normalize/NormalizationTest.txt" utf8 file-lines filter-comments [ ";" split 5 head [ " " split [ hex> ] "" map-as ] map ] map ; diff --git a/basis/unicode/script/script.factor b/basis/unicode/script/script.factor index aaa6767685..383f9e3de3 100644 --- a/basis/unicode/script/script.factor +++ b/basis/unicode/script/script.factor @@ -9,7 +9,7 @@ IN: unicode.script VALUE: script-table -"resource:basis/unicode/script/Scripts.txt" load-script +"vocab:unicode/script/Scripts.txt" load-script to: script-table : script-of ( char -- script ) diff --git a/basis/xml/entities/html/html.factor b/basis/xml/entities/html/html.factor index f1e52319f1..04c0b66063 100644 --- a/basis/xml/entities/html/html.factor +++ b/basis/xml/entities/html/html.factor @@ -11,7 +11,7 @@ VALUE: html-entities : get-html ( -- table ) { "lat1" "special" "symbol" } [ - "resource:basis/xml/entities/html/xhtml-" + "vocab:xml/entities/html/xhtml-" swap ".ent" 3append read-entities-file ] map first3 assoc-union assoc-union ; diff --git a/basis/xml/tests/encodings.factor b/basis/xml/tests/encodings.factor index aec3e40a52..2f1d73f9ca 100644 --- a/basis/xml/tests/encodings.factor +++ b/basis/xml/tests/encodings.factor @@ -1,15 +1,15 @@ USING: xml xml.data xml.traversal tools.test accessors kernel io.encodings.8-bit ; -[ "\u000131" ] [ "resource:basis/xml/tests/latin5.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/xml/tests/latin1.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/xml/tests/spaces.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/xml/tests/utf8.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/xml/tests/utf16be.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/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" ] [ "resource:basis/xml/tests/utf16le-bom.xml" file>xml children>string ] unit-test -[ "\u0000e9" ] [ "resource:basis/xml/tests/prologless.xml" file>xml children>string ] unit-test -[ "e" ] [ "resource:basis/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 +[ "\u000131" ] [ "vocab:xml/tests/latin5.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/latin1.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/spaces.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/utf8.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/utf16.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/utf16be.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/utf16le.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/utf16be-bom.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/utf16le-bom.xml" file>xml children>string ] unit-test +[ "\u0000e9" ] [ "vocab:xml/tests/prologless.xml" file>xml children>string ] unit-test +[ "e" ] [ "vocab:xml/tests/ascii.xml" file>xml children>string ] unit-test +[ "\u0000e9" "x" ] [ "vocab:xml/tests/unitag.xml" file>xml [ name>> main>> ] [ children>string ] bi ] unit-test diff --git a/basis/xml/tests/funny-dtd.factor b/basis/xml/tests/funny-dtd.factor index 1160af62bc..e9a38ae96b 100644 --- a/basis/xml/tests/funny-dtd.factor +++ b/basis/xml/tests/funny-dtd.factor @@ -4,6 +4,6 @@ IN: xml.tests USING: xml xml.writer io.files io.encodings.utf8 tools.test kernel ; [ 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 = ] unit-test diff --git a/basis/xml/tests/soap.factor b/basis/xml/tests/soap.factor index 3d1ac2379e..464002b060 100644 --- a/basis/xml/tests/soap.factor +++ b/basis/xml/tests/soap.factor @@ -10,6 +10,6 @@ IN: xml.tests [ assemble-data ] map ; [ "http://www.foxnews.com/oreilly/" ] [ - "resource:basis/xml/tests/soap.xml" file>xml + "vocab:xml/tests/soap.xml" file>xml parse-result first first ] unit-test diff --git a/basis/xml/tests/test.factor b/basis/xml/tests/test.factor index 0372132736..818a28c892 100644 --- a/basis/xml/tests/test.factor +++ b/basis/xml/tests/test.factor @@ -13,11 +13,11 @@ sequences.deep accessors io.streams.string ; SYMBOL: xml-file [ ] [ - "resource:basis/xml/tests/test.xml" + "vocab:xml/tests/test.xml" [ file>xml ] with-html-entities xml-file set ] unit-test [ 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 = ] unit-test [ "1.0" ] [ xml-file get prolog>> version>> ] unit-test diff --git a/basis/xml/tests/xmltest.factor b/basis/xml/tests/xmltest.factor index 80472fc788..2ab9ff98dd 100644 --- a/basis/xml/tests/xmltest.factor +++ b/basis/xml/tests/xmltest.factor @@ -17,7 +17,7 @@ TUPLE: xml-test id uri sections description type ; : parse-tests ( xml -- tests ) "TEST" tags-named [ >xml-test ] map ; -: base "resource:basis/xml/tests/xmltest/" ; +: base "vocab:xml/tests/xmltest/" ; MACRO: drop-output ( quot -- newquot ) dup infer out>> '[ @ _ ndrop ] ; diff --git a/basis/xml/tests/xmode-dtd.factor b/basis/xml/tests/xmode-dtd.factor index 4408655d9c..ae223bf82f 100644 --- a/basis/xml/tests/xmode-dtd.factor +++ b/basis/xml/tests/xmode-dtd.factor @@ -4,5 +4,5 @@ USING: xml xml.data kernel tools.test ; IN: xml.tests [ t ] [ - "resource:basis/xmode/xmode.dtd" file>dtd dtd? + "vocab:xmode/xmode.dtd" file>dtd dtd? ] unit-test diff --git a/basis/xml/writer/writer-tests.factor b/basis/xml/writer/writer-tests.factor index 23fb7a5074..f2802abbe0 100644 --- a/basis/xml/writer/writer-tests.factor +++ b/basis/xml/writer/writer-tests.factor @@ -61,7 +61,7 @@ IN: xml.writer.tests [ " bar " string>xml pprint-xml>string ] unit-test [ "" ] [ "" xml>string ] unit-test -: test-file "resource:basis/xml/writer/test.xml" ; +: test-file "vocab:xml/writer/test.xml" ; [ ] [ "" string>xml test-file utf8 [ write-xml ] with-file-writer ] unit-test [ "x" ] [ test-file file>xml body>> name>> main>> ] unit-test diff --git a/basis/xmode/catalog/catalog.factor b/basis/xmode/catalog/catalog.factor index 4e3af0af56..47186d2090 100644 --- a/basis/xmode/catalog/catalog.factor +++ b/basis/xmode/catalog/catalog.factor @@ -25,7 +25,7 @@ TAGS> ] keep ; MEMO: modes ( -- modes ) - "resource:basis/xmode/modes/catalog" + "vocab:xmode/modes/catalog" file>xml parse-modes-tag ; MEMO: mode-names ( -- modes ) @@ -37,7 +37,7 @@ MEMO: mode-names ( -- modes ) MEMO: (load-mode) ( name -- rule-sets ) modes at [ file>> - "resource:basis/xmode/modes/" prepend + "vocab:xmode/modes/" prepend utf8 parse-mode ] [ "text" (load-mode) diff --git a/basis/xmode/utilities/utilities-tests.factor b/basis/xmode/utilities/utilities-tests.factor index 45238ca2b1..1339430cf8 100644 --- a/basis/xmode/utilities/utilities-tests.factor +++ b/basis/xmode/utilities/utilities-tests.factor @@ -47,6 +47,6 @@ TAGS> "PUBLIC" } ] [ - "resource:basis/xmode/utilities/test.xml" + "vocab:xmode/utilities/test.xml" file>xml parse-company-tag ] unit-test diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor index f1e8b8b65e..ceeab571b8 100644 --- a/core/bootstrap/primitives.factor +++ b/core/bootstrap/primitives.factor @@ -16,9 +16,9 @@ crossref off 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" } { "winnt-x86.64" "x86/64/winnt" } { "unix-x86.64" "x86/64/unix" } @@ -27,7 +27,7 @@ H{ } clone sub-primitives set { "arm" "arm" } } 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 diff --git a/core/bootstrap/stage1.factor b/core/bootstrap/stage1.factor index 9a40796bda..1da2dfee59 100644 --- a/core/bootstrap/stage1.factor +++ b/core/bootstrap/stage1.factor @@ -9,7 +9,7 @@ IN: bootstrap.stage1 "Bootstrap stage 1..." print flush -"resource:core/bootstrap/primitives.factor" run-file +"vocab:bootstrap/primitives.factor" run-file load-help? off { "resource:core" } vocab-roots set @@ -40,7 +40,7 @@ load-help? off "bootstrap.layouts" require [ - "resource:basis/bootstrap/stage2.factor" + "vocab:bootstrap/stage2.factor" dup exists? [ run-file ] [ diff --git a/core/io/encodings/encodings-tests.factor b/core/io/encodings/encodings-tests.factor index ea74490858..cb066dd3a5 100644 --- a/core/io/encodings/encodings-tests.factor +++ b/core/io/encodings/encodings-tests.factor @@ -4,7 +4,7 @@ namespaces accessors io.encodings ; IN: io.streams.encodings.tests [ { } ] -[ "resource:core/io/test/empty-file.txt" ascii lines ] +[ "vocab:io/test/empty-file.txt" ascii lines ] unit-test : lines-test ( stream -- line1 line2 ) @@ -14,7 +14,7 @@ unit-test "This is a line." "This is another line." ] [ - "resource:core/io/test/windows-eol.txt" + "vocab:io/test/windows-eol.txt" ascii lines-test ] unit-test @@ -22,7 +22,7 @@ unit-test "This is a line." "This is another line." ] [ - "resource:core/io/test/mac-os-eol.txt" + "vocab:io/test/mac-os-eol.txt" ascii lines-test ] unit-test @@ -30,7 +30,7 @@ unit-test "This is a line." "This is another line." ] [ - "resource:core/io/test/unix-eol.txt" + "vocab:io/test/unix-eol.txt" ascii lines-test ] unit-test diff --git a/core/io/files/files-tests.factor b/core/io/files/files-tests.factor index 152d1bb85d..c49fcb7aea 100644 --- a/core/io/files/files-tests.factor +++ b/core/io/files/files-tests.factor @@ -14,14 +14,14 @@ IN: io.files.tests [ "This is a line.\rThis is another line.\r" ] [ - "resource:core/io/test/mac-os-eol.txt" latin1 + "vocab:io/test/mac-os-eol.txt" latin1 [ 500 read ] with-input-stream ] unit-test [ 255 ] [ - "resource:core/io/test/binary.txt" latin1 + "vocab:io/test/binary.txt" latin1 [ read1 ] with-input-stream >fixnum ] unit-test diff --git a/core/io/io-tests.factor b/core/io/io-tests.factor index cf6b935215..f0cbd33114 100644 --- a/core/io/io-tests.factor +++ b/core/io/io-tests.factor @@ -2,7 +2,7 @@ USING: io parser tools.test words ; IN: io.tests [ f ] [ - "resource:core/io/test/no-trailing-eol.factor" run-file + "vocab:io/test/no-trailing-eol.factor" run-file "foo" "io.tests" lookup ] unit-test diff --git a/core/io/pathnames/pathnames.factor b/core/io/pathnames/pathnames.factor index 1673e73083..96ac872826 100644 --- a/core/io/pathnames/pathnames.factor +++ b/core/io/pathnames/pathnames.factor @@ -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. USING: accessors combinators io.backend kernel math math.order namespaces sequences splitting strings system ; @@ -71,10 +71,17 @@ PRIVATE> [ f ] } cond ; +: special-path? ( path -- rest ? ) + { + { [ "resource:" ?head ] [ t ] } + { [ "vocab:" ?head ] [ t ] } + [ f ] + } cond ; + : absolute-path? ( path -- ? ) { { [ dup empty? ] [ f ] } - { [ dup "resource:" head? ] [ t ] } + { [ dup special-path? nip ] [ t ] } { [ os windows? ] [ windows-absolute-path? ] } { [ dup first path-separator? ] [ t ] } [ f ] @@ -107,7 +114,7 @@ PRIVATE> dup root-directory? [ trim-tail-separators dup last-path-separator [ 1+ tail ] [ - drop "resource:" ?head [ file-name ] when + drop special-path? [ file-name ] when ] if ] unless ; @@ -117,6 +124,8 @@ PRIVATE> : resource-path ( path -- newpath ) "resource-path" get prepend-path ; +GENERIC: vocab-path ( path -- newpath ) + GENERIC: (normalize-path) ( path -- path' ) M: string (normalize-path) @@ -124,7 +133,12 @@ M: string (normalize-path) trim-head-separators resource-path (normalize-path) ] [ - current-directory get prepend-path + "vocab:" ?head [ + trim-head-separators vocab-path + (normalize-path) + ] [ + current-directory get prepend-path + ] if ] if ; M: object normalize-path ( path -- path' ) diff --git a/core/parser/parser-tests.factor b/core/parser/parser-tests.factor index 2870be9a4f..3fcf489413 100644 --- a/core/parser/parser-tests.factor +++ b/core/parser/parser-tests.factor @@ -402,7 +402,7 @@ IN: parser.tests [ t ] [ "foo" "parser.tests" lookup symbol? ] unit-test ] times -[ "resource:core/parser/test/assert-depth.factor" run-file ] +[ "vocab:parser/test/assert-depth.factor" run-file ] [ got>> { 1 2 3 } sequence= ] must-fail-with diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor index 48e8737fd2..00c4df92a6 100644 --- a/core/vocabs/loader/loader.factor +++ b/core/vocabs/loader/loader.factor @@ -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. USING: namespaces make sequences io io.files io.pathnames kernel assocs words vocabs definitions parser continuations hashtables @@ -18,6 +18,22 @@ V{ : add-vocab-root ( root -- ) vocab-roots get adjoin ; +SYMBOL: root-cache + +root-cache [ H{ } clone ] initialize + +ERROR: not-found-in-roots path ; + + + : vocab-dir ( vocab -- dir ) vocab-name { { CHAR: . CHAR: / } } substitute ; @@ -26,25 +42,9 @@ V{ [ [ dup peek ] dip append suffix ] when* "/" join ; -: vocab-dir? ( root name -- ? ) - over - [ ".factor" vocab-dir+ append-path exists? ] - [ 2drop f ] - if ; - -SYMBOL: root-cache - -H{ } clone root-cache set-global - - - : 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 ) swap find-vocab-root dup [ prepend-path ] [ 2drop f ] if ; @@ -104,14 +104,14 @@ SYMBOL: blacklist : add-to-blacklist ( error vocab -- ) vocab-name blacklist get dup [ set-at ] [ 3drop ] if ; -GENERIC: (load-vocab) ( name -- ) +GENERIC: (load-vocab) ( name -- vocab ) M: vocab (load-vocab) [ dup source-loaded?>> +parsing+ eq? [ dup source-loaded?>> [ dup load-source ] unless dup docs-loaded?>> [ dup load-docs ] unless - ] unless drop + ] unless ] [ [ swap add-to-blacklist ] keep rethrow ] recover ; M: vocab-link (load-vocab) @@ -120,22 +120,15 @@ M: vocab-link (load-vocab) M: string (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> -: 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-link where vocab-where ; +M: vocab-spec where vocab-source-path dup [ 1 2array ] when ; diff --git a/core/vocabs/vocabs.factor b/core/vocabs/vocabs.factor index fb9ce54672..977eac2b35 100644 --- a/core/vocabs/vocabs.factor +++ b/core/vocabs/vocabs.factor @@ -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. USING: accessors assocs strings kernel sorting namespaces sequences definitions ; @@ -21,18 +21,26 @@ SYMBOL: +done+ swap >>name H{ } clone >>words ; +TUPLE: vocab-link name ; + +C: vocab-link + +UNION: vocab-spec vocab vocab-link ; + 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 ) M: vocab vocab ; 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 ) M: vocab vocab-words words>> ; @@ -62,11 +70,6 @@ M: f vocab-main ; ERROR: no-vocab name ; -SYMBOL: load-vocab-hook ! ( name -- ) - -: load-vocab ( name -- vocab ) - dup load-vocab-hook get call vocab ; - : vocabs ( -- seq ) dictionary get keys natural-sort ; @@ -88,17 +91,6 @@ SYMBOL: load-vocab-hook ! ( name -- ) : child-vocabs ( vocab -- seq ) vocab-name vocabs [ child-vocab? ] with filter ; -TUPLE: vocab-link name ; - -: ( 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 ) M: vocab-spec >vocab-link ; @@ -110,3 +102,7 @@ M: string >vocab-link dup vocab [ ] [ ] ?if ; vocab-name dictionary get delete-at ; M: vocab-spec forget* forget-vocab ; + +SYMBOL: load-vocab-hook ! ( name -- vocab ) + +: load-vocab ( name -- vocab ) load-vocab-hook get call ; \ No newline at end of file diff --git a/extra/benchmark/crc32/crc32.factor b/extra/benchmark/crc32/crc32.factor index 2fea4eb1f1..03d1585574 100755 --- a/extra/benchmark/crc32/crc32.factor +++ b/extra/benchmark/crc32/crc32.factor @@ -3,7 +3,7 @@ IN: benchmark.crc32 : crc32-file ( -- ) 10 [ - "resource:basis/mime/multipart/multipart-tests.factor" + "vocab:mime/multipart/multipart-tests.factor" crc32 checksum-file drop ] times ; diff --git a/extra/benchmark/md5/md5.factor b/extra/benchmark/md5/md5.factor index 24578ec677..5030cb6904 100644 --- a/extra/benchmark/md5/md5.factor +++ b/extra/benchmark/md5/md5.factor @@ -2,6 +2,6 @@ USING: checksums checksums.md5 io.files kernel ; IN: benchmark.md5 : 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 diff --git a/extra/benchmark/sha1/sha1.factor b/extra/benchmark/sha1/sha1.factor index 585368e836..8e19ba9a8f 100644 --- a/extra/benchmark/sha1/sha1.factor +++ b/extra/benchmark/sha1/sha1.factor @@ -2,6 +2,6 @@ USING: checksums checksums.sha1 io.files kernel ; IN: benchmark.sha1 : 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 diff --git a/extra/benchmark/xml/xml.factor b/extra/benchmark/xml/xml.factor index a32a98a133..5f8955b97c 100644 --- a/extra/benchmark/xml/xml.factor +++ b/extra/benchmark/xml/xml.factor @@ -5,7 +5,7 @@ sequences xml ; IN: benchmark.xml : xml-benchmark ( -- ) - "resource:basis/xmode/modes/" [ + "vocab:xmode/modes/" [ [ utf8 read-xml drop ] each ] with-directory-files ; diff --git a/extra/webapps/todo/todo.factor b/extra/webapps/todo/todo.factor index 6ef60c198f..4f6edee031 100755 --- a/extra/webapps/todo/todo.factor +++ b/extra/webapps/todo/todo.factor @@ -143,8 +143,8 @@ io.sockets.secure ; : ( -- config ) ! This is only suitable for testing! - "resource:basis/openssl/test/dh1024.pem" >>dh-file - "resource:basis/openssl/test/server.pem" >>key-file + "vocab:openssl/test/dh1024.pem" >>dh-file + "vocab:openssl/test/server.pem" >>key-file "password" >>password ; : ( -- responder ) diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor index 35a1129338..d7b132d4f2 100644 --- a/extra/websites/concatenative/concatenative.factor +++ b/extra/websites/concatenative/concatenative.factor @@ -69,8 +69,8 @@ SYMBOL: dh-file init-factor-db ; : init-testing ( -- ) - "resource:basis/openssl/test/dh1024.pem" dh-file set-global - "resource:basis/openssl/test/server.pem" key-file set-global + "vocab:openssl/test/dh1024.pem" dh-file set-global + "vocab:openssl/test/server.pem" key-file set-global "password" key-password set-global common-configuration