]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor into conditional
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Fri, 19 Mar 2010 10:46:16 +0000 (06:46 -0400)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Fri, 19 Mar 2010 10:46:16 +0000 (06:46 -0400)
33 files changed:
basis/bootstrap/compiler/compiler.factor
basis/bootstrap/handbook/handbook.factor
basis/bootstrap/threads/threads.factor
basis/bootstrap/ui/tools/tools.factor
basis/classes/struct/struct.factor
basis/http/client/client.factor
basis/locals/locals.factor
basis/math/rectangles/rectangles.factor
basis/math/vectors/simd/simd.factor
basis/mirrors/mirrors.factor
basis/peg/peg.factor
basis/regexp/regexp.factor
basis/specialized-arrays/specialized-arrays.factor
basis/typed/typed.factor
basis/ui/gadgets/gadgets.factor
basis/unix/unix.factor
basis/urls/urls.factor
basis/windows/com/syntax/syntax.factor
basis/x11/x11.factor
basis/xml/syntax/inverse/inverse.factor [new file with mode: 0644]
basis/xml/syntax/syntax.factor
core/vocabs/loader/loader-docs.factor
core/vocabs/loader/loader-tests.factor
core/vocabs/loader/loader.factor
core/vocabs/loader/test/m/m.factor [new file with mode: 0644]
core/vocabs/loader/test/m/tags.txt [new file with mode: 0644]
core/vocabs/loader/test/n/n.factor [new file with mode: 0644]
core/vocabs/loader/test/n/tags.txt [new file with mode: 0644]
core/vocabs/loader/test/o/o.factor [new file with mode: 0644]
core/vocabs/loader/test/o/tags.txt [new file with mode: 0644]
core/vocabs/vocabs.factor
extra/game/loop/loop.factor
extra/gpu/shaders/shaders.factor

index 0bdb2494f88957bfa5031cef2bf4d8351c0ec6ec..393e4eab27d033ff9fde27291a47e23f11cb76fe 100644 (file)
@@ -20,11 +20,11 @@ IN: bootstrap.compiler
     "alien.remote-control" require
 ] unless
 
-"prettyprint" vocab [
-    "stack-checker.errors.prettyprint" require
-    "alien.prettyprint" require
-    "alien.debugger" require
-] when
+{
+    "stack-checker.errors.prettyprint"
+    "alien.prettyprint"
+    "alien.debugger"
+} [ "prettyprint" swap require-when ] each
 
 "cpu." cpu name>> append require
 
index 51aa9eefafb7b560c99f8931d4b913624472938e..11f7349b7962d320429563cdb54068a72aad90f1 100644 (file)
@@ -1,4 +1,4 @@
 USING: vocabs.loader vocabs kernel ;\r
 IN: bootstrap.handbook\r
 \r
-"bootstrap.help" vocab [ "help.handbook" require ] when\r
+"bootstrap.help" "help.handbook" require-when\r
index 24cbba6af815eab92c0c103940c7677d56884979..3a8fe98cf408ba39610365bec70fb32c67678e1e 100644 (file)
@@ -1,11 +1,9 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: vocabs vocabs.loader kernel io.thread threads
+USING: vocabs.loader kernel io.thread threads
 compiler.utilities namespaces ;
 IN: bootstrap.threads
 
-"debugger" vocab [
-    "debugger.threads" require
-] when
+"debugger" "debugger.threads" require-when
 
-[ yield ] yield-hook set-global
\ No newline at end of file
+[ yield ] yield-hook set-global
index 5cf05aef91a539723bb8292f7ec1a039066d76de..7db69ce9c12e560b4192bfe8403a57023fff599e 100644 (file)
@@ -4,9 +4,7 @@ USING: kernel vocabs vocabs.loader sequences system ;
 [ "bootstrap." prepend vocab ] all? [
     "ui.tools" require
 
-    "ui.backend.cocoa" vocab [
-        "ui.backend.cocoa.tools" require
-    ] when
+    "ui.backend.cocoa" "ui.backend.cocoa.tools" require-when
 
     "ui.tools.walker" require
 ] when
index 79dea73d8cd4a0478226a9caca2edc2f9bf119b5..ffde2337486cfb5182c32f0e7658aae6c2c954b4 100644 (file)
@@ -404,4 +404,4 @@ FUNCTOR-SYNTAX: STRUCT:
 
 USING: vocabs vocabs.loader ;
 
-"prettyprint" vocab [ "classes.struct.prettyprint" require ] when
+"prettyprint" "classes.struct.prettyprint" require-when
index 2ce0ec9dfce9dcceea45b3b0a9f20fe84a74fde9..1221ee39f35ae8165694c90096dd047ce61e294e 100644 (file)
@@ -196,4 +196,4 @@ ERROR: download-failed response ;
 
 USING: vocabs vocabs.loader ;
 
-"debugger" vocab [ "http.client.debugger" require ] when
+"debugger" "http.client.debugger" require-when
index 8e940bfdd8b8100fb9eedc68c0253e0b8411d795..7d67881c47624227ddc86ddad7886c24812d3cae 100644 (file)
@@ -26,7 +26,5 @@ SYNTAX: MEMO:: (::) define-memoized ;
     "locals.fry"
 } [ require ] each
 
-"prettyprint" vocab [
-    "locals.definitions" require
-    "locals.prettyprint" require
-] when
+"prettyprint" "locals.definitions" require-when
+"prettyprint" "locals.prettyprint" require-when
index db3794cbb0edb3ead4e93397b78135d745207b19..78ac5457bcce14f59a18427935717d98449ec58a 100644 (file)
@@ -62,6 +62,6 @@ M: rect contains-point?
     [ [ dim>> ] dip (>>dim) ]
     2bi ; inline
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [ "math.rectangles.prettyprint" require ] when
+"prettyprint" "math.rectangles.prettyprint" require-when
index 8d804247d3af681298ff2acea8227e91c816f12c..65d6e113bfed1e5591cc05f12213dcfa68bdff6e 100644 (file)
@@ -339,6 +339,4 @@ M: short-8 v*hs+
 M: int-4 v*hs+
     int-4-rep [ (simd-v*hs+) ] [ call-next-method ] vv->v-op longlong-2-cast ; inline
 
-"mirrors" vocab [
-    "math.vectors.simd.mirrors" require
-] when
+"mirrors" "math.vectors.simd.mirrors" require-when
index 65978f0b46af4d4b68d93744740e2949c6f7d012..f12d34e1701bfb3005bc8d4f79bfa974d61ee0bf 100644 (file)
@@ -59,7 +59,3 @@ M: hashtable make-mirror ;
 M: integer make-mirror drop f ;
 M: enumerated-sequence make-mirror <enum> ;
 M: object make-mirror <mirror> ;
-
-"specialized-arrays" vocab [
-    "specialized-arrays.mirrors" require
-] when
index cc480c30b2cfe56e1c36757ffae06e225bb3806e..ca7d28bb97a18d9f29a7a1995631813c95d4ec6d 100644 (file)
@@ -630,6 +630,4 @@ SYNTAX: PEG:
 
 USING: vocabs vocabs.loader ;
 
-"debugger" vocab [
-    "peg.debugger" require
-] when
+"debugger" "peg.debugger" require-when
index e5ac1df1514b5ea64e02a107306114bb502c15a2..eea0a26ea5fa4aebe59a692b04befae601d427d2 100644 (file)
@@ -218,6 +218,4 @@ SYNTAX: R| CHAR: | parsing-regexp ;
 
 USING: vocabs vocabs.loader ;
 
-"prettyprint" vocab [
-    "regexp.prettyprint" require
-] when
+"prettyprint" "regexp.prettyprint" require-when
index 11b050d5fcbb32d4147fc0b826dfda19cccad023..c82ebd78c80f71560c5f277eb4ef3da90a37b29c 100644 (file)
@@ -173,10 +173,6 @@ SYNTAX: SPECIALIZED-ARRAYS:
 SYNTAX: SPECIALIZED-ARRAY:
     scan-c-type define-array-vocab use-vocab ;
 
-"prettyprint" vocab [
-    "specialized-arrays.prettyprint" require
-] when
+"prettyprint" "specialized-arrays.prettyprint" require-when
 
-"mirrors" vocab [
-    "specialized-arrays.mirrors" require
-] when
+"mirrors" "specialized-arrays.mirrors" require-when
index 6ab4e0334de98af8508bea547f95ff05378f9af1..df46303b796df3a2ad46324eb06324fdd8686861 100644 (file)
@@ -166,4 +166,4 @@ SYNTAX: TYPED::
 
 USING: vocabs vocabs.loader ;
 
-"prettyprint" vocab [ "typed.prettyprint" require ] when
+"prettyprint" "typed.prettyprint" require-when
index 7e47bf627ba83b7652dab0a3cecddb772e5ffc20..dca340cd3b26fb8525d4da66d451d1067e29d9e2 100644 (file)
@@ -393,6 +393,6 @@ M: f request-focus-on 2drop ;
 : focus-path ( gadget -- seq )
     [ focus>> ] follow ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [ "ui.gadgets.prettyprint" require ] when
+"prettyprint" "ui.gadgets.prettyprint" require-when
index 4e77a41713a64a50beb95b9c0dc565ff8a6a5678..e747e4843393518605288bfe0342ffb92644f886 100644 (file)
@@ -74,8 +74,6 @@ M: unix open-file [ open ] unix-system-call ;
 
 <<
 
-"debugger" vocab [
-    "unix.debugger" require
-] when
+"debugger" "unix.debugger" require-when
 
 >>
index bf4a9bb76c9d6cd83cd1c3bf815fa333468fa737..cd470a451ab346f715ed166f750b9b8d0450d8ae 100644 (file)
@@ -183,8 +183,6 @@ PRIVATE>
 ! Literal syntax
 SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [
-    "urls.prettyprint" require
-] when
+"prettyprint" "urls.prettyprint" require-when
index 49c9272d9bb7d742c1f8be0006e815b6c07769ca..78a3c0e6d2c5280c2a7f577c48bb3c29c5c0328e 100644 (file)
@@ -94,8 +94,6 @@ SYNTAX: COM-INTERFACE:
 
 SYNTAX: GUID: scan string>guid suffix! ;
 
-USING: vocabs vocabs.loader ;
+USE: vocabs.loader
 
-"prettyprint" vocab [
-    "windows.com.prettyprint" require
-] when
+"prettyprint" "windows.com.prettyprint" require-when
index 09328c6f6ea895a6b13a087b6fd6b0799961da1b..e91c6a690973a63cf0d98833faab0cc6c3271f1b 100644 (file)
@@ -33,4 +33,4 @@ SYMBOL: root
 : with-x ( display-string quot -- )
     [ init-x ] dip [ close-x ] [ ] cleanup ; inline
 
-"io.backend.unix" vocab [ "x11.io.unix" require ] when
\ No newline at end of file
+"io.backend.unix" "x11.io.unix" require-when
diff --git a/basis/xml/syntax/inverse/inverse.factor b/basis/xml/syntax/inverse/inverse.factor
new file mode 100644 (file)
index 0000000..002f60a
--- /dev/null
@@ -0,0 +1,75 @@
+! Copyright (C) 2005, 2009 Daniel Ehrenberg
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs combinators
+combinators.short-circuit fry generalizations inverse kernel
+namespaces sequences sorting strings unicode.categories
+xml.data xml.syntax xml.syntax.private ;
+IN: xml.syntax.inverse
+
+: remove-blanks ( seq -- newseq )
+    [ { [ string? not ] [ [ blank? ] all? not ] } 1|| ] filter ;
+
+GENERIC: >xml ( xml -- tag )
+M: xml >xml body>> ;
+M: tag >xml ;
+M: xml-chunk >xml
+    remove-blanks
+    [ length 1 =/fail ]
+    [ first dup tag? [ fail ] unless ] bi ;
+M: object >xml fail ;
+
+: 1chunk ( object -- xml-chunk )
+    1array <xml-chunk> ;
+
+GENERIC: >xml-chunk ( xml -- chunk )
+M: xml >xml-chunk body>> 1chunk ;
+M: xml-chunk >xml-chunk ;
+M: object >xml-chunk 1chunk ;
+
+GENERIC: [undo-xml] ( xml -- quot )
+
+M: xml [undo-xml]
+    body>> [undo-xml] '[ >xml @ ] ;
+
+M: xml-chunk [undo-xml]
+    seq>> [undo-xml] '[ >xml-chunk @ ] ;
+
+: undo-attrs ( attrs -- quot: ( attrs -- ) )
+    [
+        [ main>> ] dip dup interpolated?
+        [ var>> '[ _ attr _ set ] ]
+        [ '[ _ attr _ =/fail ] ] if
+    ] { } assoc>map '[ _ cleave ] ;
+
+M: tag [undo-xml] ( tag -- quot: ( tag -- ) )
+    {
+        [ name>> main>> '[ name>> main>> _ =/fail ] ]
+        [ attrs>> undo-attrs ] 
+        [ children>> [undo-xml] '[ children>> @ ] ]
+    } cleave '[ _ _ _ tri ] ;
+
+: firstn-strong ( seq n -- ... )
+    [ swap length =/fail ]
+    [ firstn ] 2bi ; inline
+
+M: sequence [undo-xml] ( sequence -- quot: ( seq -- ) )
+    remove-blanks [ length ] [ [ [undo-xml] ] { } map-as ] bi
+    '[ remove-blanks _ firstn-strong _ spread ] ;
+
+M: string [undo-xml] ( string -- quot: ( string -- ) )
+    '[ _ =/fail ] ;
+
+M: xml-data [undo-xml] ( datum -- quot: ( datum -- ) )
+    '[ _ =/fail ] ;
+
+M: interpolated [undo-xml]
+    var>> '[ _ set ] ;
+
+: >enum ( assoc -- enum )
+    ! Assumes keys are 0..n
+    >alist sort-keys values <enum> ;
+
+: undo-xml ( xml -- quot )
+    [undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
+
+\ interpolate-xml 1 [ undo-xml ] define-pop-inverse
index c56dd23db75b1eb26864dafeec1a777f6efb6cc9..a58526faa36c7cfbff04b2abc68d6e204cf7ad80 100644 (file)
@@ -4,7 +4,7 @@ USING: words assocs kernel accessors parser vocabs.parser effects.parser
 sequences summary lexer splitting combinators locals
 memoize sequences.deep xml.data xml.state xml namespaces present
 arrays generalizations strings make math macros multiline
-inverse combinators.short-circuit sorting fry unicode.categories
+combinators.short-circuit sorting fry unicode.categories
 effects ;
 IN: xml.syntax
 
@@ -175,74 +175,6 @@ SYNTAX: <XML
 SYNTAX: [XML
     "XML]" [ string>chunk ] parse-def ;
 
-<PRIVATE
-
-: remove-blanks ( seq -- newseq )
-    [ { [ string? not ] [ [ blank? ] all? not ] } 1|| ] filter ;
-
-GENERIC: >xml ( xml -- tag )
-M: xml >xml body>> ;
-M: tag >xml ;
-M: xml-chunk >xml
-    remove-blanks
-    [ length 1 =/fail ]
-    [ first dup tag? [ fail ] unless ] bi ;
-M: object >xml fail ;
-
-: 1chunk ( object -- xml-chunk )
-    1array <xml-chunk> ;
-
-GENERIC: >xml-chunk ( xml -- chunk )
-M: xml >xml-chunk body>> 1chunk ;
-M: xml-chunk >xml-chunk ;
-M: object >xml-chunk 1chunk ;
-
-GENERIC: [undo-xml] ( xml -- quot )
+USE: vocabs.loader
 
-M: xml [undo-xml]
-    body>> [undo-xml] '[ >xml @ ] ;
-
-M: xml-chunk [undo-xml]
-    seq>> [undo-xml] '[ >xml-chunk @ ] ;
-
-: undo-attrs ( attrs -- quot: ( attrs -- ) )
-    [
-        [ main>> ] dip dup interpolated?
-        [ var>> '[ _ attr _ set ] ]
-        [ '[ _ attr _ =/fail ] ] if
-    ] { } assoc>map '[ _ cleave ] ;
-
-M: tag [undo-xml] ( tag -- quot: ( tag -- ) )
-    {
-        [ name>> main>> '[ name>> main>> _ =/fail ] ]
-        [ attrs>> undo-attrs ] 
-        [ children>> [undo-xml] '[ children>> @ ] ]
-    } cleave '[ _ _ _ tri ] ;
-
-: firstn-strong ( seq n -- ... )
-    [ swap length =/fail ]
-    [ firstn ] 2bi ; inline
-
-M: sequence [undo-xml] ( sequence -- quot: ( seq -- ) )
-    remove-blanks [ length ] [ [ [undo-xml] ] { } map-as ] bi
-    '[ remove-blanks _ firstn-strong _ spread ] ;
-
-M: string [undo-xml] ( string -- quot: ( string -- ) )
-    '[ _ =/fail ] ;
-
-M: xml-data [undo-xml] ( datum -- quot: ( datum -- ) )
-    '[ _ =/fail ] ;
-
-M: interpolated [undo-xml]
-    var>> '[ _ set ] ;
-
-: >enum ( assoc -- enum )
-    ! Assumes keys are 0..n
-    >alist sort-keys values <enum> ;
-
-: undo-xml ( xml -- quot )
-    [undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
-
-\ interpolate-xml 1 [ undo-xml ] define-pop-inverse
-
-PRIVATE>
+"inverse" "xml.syntax.inverse" require-when
index 08ab729b6daecd36a806459738b82c10ed8c1fac..d5a6be53359b0867660beca3966508fb226d763b 100755 (executable)
@@ -50,7 +50,9 @@ $nl
 { $subsections "vocabs.metadata" "vocabs.icons" }
 "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 }
-"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. Sometimes, two vocabularies require special code to interact. The following word is used to load one vocabulary when another is present:"
+{ $subsections require-when }
+"There is another word which unconditionally loads vocabulary from disk, regardless of whether or not is has already been loaded:"
 { $subsections reload }
 "For interactive development in the listener, calling " { $link reload } " directly is usually not necessary, since a better facility exists for " { $link "vocabs.refresh" } "."
 $nl
@@ -111,6 +113,12 @@ HELP: require
 { $description "Loads a vocabulary if it has not already been loaded." }
 { $notes "To unconditionally reload a vocabulary, use " { $link reload } ". To reload changed source files only, use the words in " { $link "vocabs.refresh" } "." } ;
 
+HELP: require-when
+{ $values { "if" "a vocabulary specifier" } { "then" "a vocabulary specifier" } }
+{ $description "Loads the " { $snippet "then" } " vocabulary if it is not loaded and the " { $snippet "if" } " vocabulary is. If the " { $snippet "if" } " vocabulary is not loaded now, but it is later, then the " { $snippet "then" } " vocabulary will be loaded along with it at that time." }
+{ $notes "This is used to express a joint dependency of vocabularies. If vocabularies " { $snippet "a" } " and " { $snippet "b" } " use code in vocabulary " { $snippet "c" } " to interact, then the following line can be placed in " { $snippet "a" } " in order express the dependency."
+{ $code "\"b\" \"c\" require-when" } } ;
+
 HELP: run
 { $values { "vocab" "a vocabulary specifier" } }
 { $description "Runs a vocabulary's main entry point. The main entry point is set with the " { $link POSTPONE: MAIN: } " parsing word." } ;
index 09f28541e0ba92c844a24b84e346d837b3b86f7d..89afb50af7b15bd83ef9e567e2783b3318752520 100644 (file)
@@ -170,3 +170,21 @@ forget-junk
 ] with-compilation-unit
 
 [ ] [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test
+
+[ ] [ "vocabs.loader.test.m" require ] unit-test
+[ f ] [ "vocabs.loader.test.n" vocab ] unit-test
+[ ] [ "vocabs.loader.test.o" require ] unit-test
+[ t ] [ "vocabs.loader.test.n" vocab >boolean ] unit-test
+
+[
+    "mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
+] with-compilation-unit
+
+[ ] [ "vocabs.loader.test.o" require ] unit-test
+[ f ] [ "vocabs.loader.test.n" vocab ] unit-test
+[ ] [ "vocabs.loader.test.m" require ] unit-test
+[ t ] [ "vocabs.loader.test.n" vocab >boolean ] unit-test
+
+[
+    "mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
+] with-compilation-unit
index c8cf77b795612145bc2a0acbe6fda1d21ff1d6d0..59fe06e6fd2b1a6bd27cd6082350f1cd8f12ef74 100644 (file)
@@ -62,8 +62,15 @@ SYMBOL: check-vocab-hook
 
 check-vocab-hook [ [ drop ] ] initialize
 
+DEFER: require
+
 <PRIVATE
 
+: load-conditional-requires ( vocab-name -- )
+    conditional-requires get
+    [ at [ require ] each ] 
+    [ delete-at ] 2bi ;
+
 : load-source ( vocab -- )
     dup check-vocab-hook get call( vocab -- )
     [
@@ -71,7 +78,8 @@ check-vocab-hook [ [ drop ] ] initialize
         dup vocab-source-path [ parse-file ] [ [ ] ] if*
         [ +parsing+ >>source-loaded? ] dip
         [ % ] [ call( -- ) ] if-bootstrapping
-        +done+ >>source-loaded? drop
+        +done+ >>source-loaded?
+        vocab-name load-conditional-requires
     ] [ ] [ f >>source-loaded? ] cleanup ;
 
 : load-docs ( vocab -- )
@@ -88,6 +96,12 @@ PRIVATE>
 : require ( vocab -- )
     load-vocab drop ;
 
+: require-when ( if then -- )
+    over vocab
+    [ nip require ]
+    [ swap conditional-requires get [ swap suffix ] change-at ]
+    if ;
+
 : reload ( name -- )
     dup vocab
     [ [ load-source ] [ load-docs ] bi ]
diff --git a/core/vocabs/loader/test/m/m.factor b/core/vocabs/loader/test/m/m.factor
new file mode 100644 (file)
index 0000000..d6d3bd8
--- /dev/null
@@ -0,0 +1,4 @@
+USE: vocabs.loader
+IN: vocabs.loader.test.m
+
+"vocabs.loader.test.o" "vocabs.loader.test.n" require-when
diff --git a/core/vocabs/loader/test/m/tags.txt b/core/vocabs/loader/test/m/tags.txt
new file mode 100644 (file)
index 0000000..5d77766
--- /dev/null
@@ -0,0 +1 @@
+untested
diff --git a/core/vocabs/loader/test/n/n.factor b/core/vocabs/loader/test/n/n.factor
new file mode 100644 (file)
index 0000000..b3cedb3
--- /dev/null
@@ -0,0 +1 @@
+IN: vocabs.loader.test.n
diff --git a/core/vocabs/loader/test/n/tags.txt b/core/vocabs/loader/test/n/tags.txt
new file mode 100644 (file)
index 0000000..5d77766
--- /dev/null
@@ -0,0 +1 @@
+untested
diff --git a/core/vocabs/loader/test/o/o.factor b/core/vocabs/loader/test/o/o.factor
new file mode 100644 (file)
index 0000000..cc8051a
--- /dev/null
@@ -0,0 +1 @@
+IN: vocabs.loader.test.o
diff --git a/core/vocabs/loader/test/o/tags.txt b/core/vocabs/loader/test/o/tags.txt
new file mode 100644 (file)
index 0000000..5d77766
--- /dev/null
@@ -0,0 +1 @@
+untested
index 239b88a2e80b6030285b0390602445a292072f7c..e48d6c3031317965d7c24f9dd80acd5d0c680604 100644 (file)
@@ -1,7 +1,7 @@
 ! 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 ;
+sequences definitions sets ;
 IN: vocabs
 
 SYMBOL: dictionary
@@ -83,6 +83,9 @@ ERROR: bad-vocab-name name ;
 : check-vocab-name ( name -- name )
     dup string? [ bad-vocab-name ] unless ;
 
+SYMBOL: conditional-requires
+conditional-requires [ H{ } clone ] initialize
+
 : create-vocab ( name -- vocab )
     check-vocab-name
     dictionary get [ <vocab> ] cache
@@ -118,8 +121,8 @@ M: vocab-spec >vocab-link ;
 M: string >vocab-link dup vocab [ ] [ <vocab-link> ] ?if ;
 
 : forget-vocab ( vocab -- )
-    dup words forget-all
-    vocab-name dictionary get delete-at
+    [ words forget-all ]
+    [ vocab-name dictionary get delete-at ] bi
     notify-vocab-observers ;
 
 M: vocab-spec forget* forget-vocab ;
index 00fe14c3cdb5e3c9a4b1c8acd2032163738da22a..ffe5acd879cf600c2430001f822f29a2d0ae840c 100644 (file)
@@ -114,4 +114,4 @@ M: game-loop dispose
 
 USING: vocabs vocabs.loader ;
 
-"prettyprint" vocab [ "game.loop.prettyprint" require ] when
+"prettyprint" "game.loop.prettyprint" require-when
index 025acba896f12fa06b8df35da26a9dd373c949b8..7c03e00851991127f13fb00cccf21abdbf84cdbb 100755 (executable)
@@ -575,4 +575,4 @@ M: program-instance dispose
     [ world>> ] [ program>> instances>> ] [ ] tri ?delete-at
     reset-memos ;
 
-"prettyprint" vocab [ "gpu.shaders.prettyprint" require ] when
+"prettyprint" "gpu.shaders.prettyprint" require-when