]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 16 May 2009 22:56:06 +0000 (15:56 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 16 May 2009 22:56:06 +0000 (15:56 -0700)
272 files changed:
basis/alien/c-types/c-types.factor
basis/alien/complex/functor/functor.factor
basis/alien/fortran/fortran.factor
basis/alien/structs/structs-docs.factor
basis/alien/syntax/syntax.factor
basis/bitstreams/bitstreams.factor
basis/bootstrap/compiler/compiler.factor
basis/bootstrap/image/image.factor
basis/calendar/format/format.factor
basis/channels/channels.factor
basis/checksums/openssl/openssl-docs.factor
basis/checksums/sha1/sha1.factor
basis/cocoa/messages/messages.factor
basis/command-line/command-line.factor
basis/compiler/cfg/rpo/rpo.factor
basis/compiler/compiler.factor
basis/compiler/tests/alien.factor
basis/compiler/tests/codegen.factor
basis/compiler/tests/intrinsics.factor
basis/compiler/tree/debugger/debugger.factor
basis/compiler/tree/def-use/def-use.factor
basis/compiler/tree/escape-analysis/escape-analysis-tests.factor
basis/compiler/tree/escape-analysis/simple/simple.factor
basis/compiler/tree/normalization/normalization.factor
basis/compiler/tree/propagation/info/info-tests.factor
basis/compiler/tree/propagation/nodes/nodes.factor
basis/compiler/tree/tuple-unboxing/tuple-unboxing-tests.factor
basis/concurrency/distributed/distributed-tests.factor
basis/concurrency/exchangers/exchangers-tests.factor
basis/concurrency/messaging/messaging-docs.factor
basis/core-foundation/data/data.factor
basis/cpu/ppc/assembler/assembler-tests.factor
basis/cpu/ppc/bootstrap.factor
basis/cpu/ppc/ppc.factor
basis/db/errors/postgresql/postgresql.factor
basis/db/tester/tester.factor
basis/db/tuples/tuples-tests.factor
basis/db/tuples/tuples.factor
basis/debugger/debugger.factor
basis/documents/documents.factor
basis/editors/editors.factor
basis/editors/gvim/gvim.factor
basis/editors/macvim/macvim.factor
basis/editors/scite/scite.factor
basis/editors/textedit/textedit.factor
basis/editors/textmate/textmate.factor
basis/editors/vim/vim-docs.factor
basis/editors/vim/vim.factor
basis/environment/unix/unix.factor
basis/eval/eval.factor
basis/farkup/farkup-tests.factor
basis/farkup/farkup.factor
basis/formatting/formatting.factor
basis/ftp/server/server-tests.factor
basis/functors/functors.factor
basis/furnace/sessions/sessions-docs.factor
basis/game-input/iokit/iokit.factor
basis/help/cookbook/cookbook.factor
basis/help/handbook/handbook.factor
basis/help/html/html-tests.factor
basis/help/html/html.factor
basis/help/lint/lint.factor
basis/help/markup/markup.factor
basis/help/syntax/syntax.factor
basis/help/tutorial/tutorial.factor
basis/html/components/components-tests.factor
basis/html/forms/forms-tests.factor
basis/html/streams/streams-tests.factor
basis/html/templates/chloe/chloe-docs.factor
basis/html/templates/chloe/chloe-tests.factor
basis/html/templates/chloe/chloe.factor
basis/html/templates/chloe/syntax/syntax.factor
basis/html/templates/fhtml/fhtml.factor
basis/http/client/client-docs.factor
basis/http/client/client.factor
basis/http/http-tests.factor
basis/http/parsers/parsers.factor
basis/http/server/server.factor
basis/images/loader/loader.factor
basis/images/tesselation/tesselation.factor
basis/interpolate/interpolate.factor
basis/inverse/inverse.factor
basis/io/buffers/buffers.factor
basis/io/encodings/gb18030/gb18030.factor
basis/io/files/info/info-tests.factor
basis/io/files/info/unix/linux/linux.factor
basis/io/launcher/unix/unix.factor
basis/io/mmap/mmap.factor
basis/io/monitors/linux/linux.factor
basis/io/sockets/secure/unix/unix.factor
basis/io/sockets/sockets.factor
basis/io/sockets/unix/unix.factor
basis/io/sockets/windows/nt/nt.factor [changed mode: 0644->0755]
basis/listener/listener-tests.factor
basis/listener/listener.factor
basis/lists/lazy/examples/examples-tests.factor
basis/lists/lazy/examples/examples.factor
basis/lists/lazy/lazy-docs.factor
basis/lists/lazy/lazy.factor
basis/lists/lists-docs.factor
basis/lists/lists-tests.factor
basis/lists/lists.factor
basis/literals/literals-docs.factor
basis/locals/locals-tests.factor
basis/locals/parser/parser.factor
basis/logging/server/server.factor
basis/math/complex/complex-docs.factor
basis/models/range/range.factor
basis/opengl/gl/extensions/extensions.factor
basis/opengl/textures/textures-tests.factor
basis/opengl/textures/textures.factor
basis/peg/ebnf/ebnf.factor
basis/peg/peg-tests.factor
basis/peg/peg.factor
basis/prettyprint/backend/backend.factor
basis/prettyprint/prettyprint-docs.factor
basis/prettyprint/prettyprint-tests.factor
basis/prettyprint/prettyprint.factor
basis/prettyprint/sections/sections-docs.factor
basis/prettyprint/sections/sections.factor
basis/random/dummy/dummy.factor
basis/random/mersenne-twister/mersenne-twister.factor
basis/random/random.factor
basis/regexp/classes/classes.factor
basis/regexp/regexp-docs.factor
basis/see/see-docs.factor
basis/see/see-tests.factor
basis/see/see.factor
basis/serialize/serialize-tests.factor
basis/serialize/serialize.factor
basis/soundex/soundex.factor
basis/stack-checker/call-effect/call-effect-tests.factor
basis/stack-checker/inlining/inlining.factor
basis/stack-checker/known-words/known-words.factor
basis/stack-checker/transforms/transforms.factor
basis/struct-arrays/struct-arrays-tests.factor
basis/tools/deploy/shaker/shaker.factor
basis/tools/files/files.factor
basis/tools/files/unix/unix.factor
basis/tools/memory/memory.factor
basis/tools/test/test.factor
basis/ui/backend/windows/windows.factor
basis/ui/commands/commands.factor
basis/ui/gadgets/buttons/buttons.factor
basis/ui/gadgets/editors/editors.factor
basis/ui/gadgets/gadgets-tests.factor
basis/ui/gadgets/gadgets.factor
basis/ui/gadgets/glass/glass.factor
basis/ui/gadgets/menus/menus.factor
basis/ui/gadgets/panes/panes.factor
basis/ui/gadgets/tables/tables.factor
basis/ui/pixel-formats/pixel-formats-docs.factor
basis/ui/text/text.factor
basis/ui/tools/browser/browser.factor
basis/ui/tools/browser/popups/popups.factor
basis/ui/tools/debugger/debugger-docs.factor
basis/ui/tools/debugger/debugger.factor
basis/ui/tools/deploy/deploy.factor
basis/ui/tools/error-list/error-list.factor
basis/ui/tools/listener/completion/completion.factor
basis/ui/tools/listener/listener-tests.factor
basis/ui/tools/listener/listener.factor
basis/ui/tools/operations/operations.factor
basis/ui/tools/profiler/profiler.factor
basis/ui/ui.factor
basis/unicode/collation/collation.factor
basis/unicode/data/data.factor
basis/unix/debugger/debugger.factor
basis/unix/process/process.factor
basis/unix/stat/netbsd/netbsd.factor
basis/unix/stat/stat.factor
basis/unix/types/types.factor
basis/unix/unix.factor
basis/vocabs/prettyprint/authors.txt [new file with mode: 0644]
basis/vocabs/prettyprint/prettyprint-tests.factor [new file with mode: 0644]
basis/vocabs/prettyprint/prettyprint.factor [new file with mode: 0644]
basis/windows/gdi32/gdi32.factor
basis/windows/kernel32/kernel32.factor
basis/windows/opengl32/opengl32.factor
basis/wrap/wrap.factor
basis/x11/xlib/xlib.factor
basis/xml/syntax/syntax-docs.factor
basis/xml/syntax/syntax-tests.factor
basis/xml/syntax/syntax.factor
basis/xmode/code2html/code2html.factor
basis/xmode/marker/marker.factor
core/assocs/assocs-docs.factor
core/bootstrap/stage1.factor
core/bootstrap/syntax.factor
core/classes/algebra/algebra-tests.factor
core/classes/classes-docs.factor
core/classes/classes-tests.factor
core/classes/intersection/intersection-docs.factor
core/classes/mixin/mixin-tests.factor
core/classes/parser/parser.factor
core/classes/predicate/predicate-tests.factor
core/classes/tuple/parser/parser.factor
core/classes/tuple/tuple-tests.factor
core/classes/union/union-docs.factor
core/combinators/combinators-docs.factor
core/init/init.factor
core/io/backend/backend.factor
core/kernel/kernel-docs.factor
core/make/make-docs.factor
core/parser/notes/authors.txt [new file with mode: 0644]
core/parser/notes/notes-docs.factor [new file with mode: 0644]
core/parser/notes/notes-tests.factor [new file with mode: 0644]
core/parser/notes/notes.factor [new file with mode: 0644]
core/parser/parser-docs.factor
core/parser/parser-tests.factor
core/parser/parser.factor
core/sbufs/sbufs.factor
core/sequences/sequences.factor
core/slots/slots-docs.factor
core/slots/slots.factor
core/sorting/sorting.factor
core/syntax/syntax-docs.factor
core/syntax/syntax.factor
core/vocabs/parser/parser-docs.factor
core/vocabs/parser/parser.factor
core/vocabs/vocabs.factor
core/words/words-docs.factor
core/words/words.factor
extra/4DNav/turtle/turtle.factor
extra/4DNav/window3D/window3D.factor
extra/bank/bank-tests.factor
extra/benchmark/backtrack/backtrack.factor
extra/bloom-filters/bloom-filters-tests.factor
extra/bunny/outlined/outlined.factor
extra/fjsc/fjsc.factor
extra/fuel/eval/eval.factor
extra/fuel/fuel.factor
extra/fuel/xref/xref.factor
extra/google-tech-talk/google-tech-talk.factor
extra/hashcash/hashcash.factor
extra/html/parser/analyzer/analyzer.factor
extra/id3/id3.factor
extra/infix/infix-docs.factor
extra/infix/infix.factor
extra/jamshred/tunnel/tunnel.factor
extra/koszul/koszul.factor
extra/mason/common/common.factor
extra/mason/mason.factor
extra/mason/release/release.factor
extra/math/floating-point/floating-point-tests.factor
extra/math/primes/lists/lists-tests.factor
extra/monads/monads-tests.factor
extra/mongodb/benchmark/benchmark.factor
extra/mongodb/tuple/tuple.factor
extra/otug-talk/otug-talk.factor
extra/parser-combinators/parser-combinators-tests.factor
extra/peg/javascript/parser/parser.factor
extra/project-euler/common/common.factor
extra/roles/roles-tests.factor
extra/sandbox/authors.txt [deleted file]
extra/sandbox/sandbox-tests.factor [deleted file]
extra/sandbox/sandbox.factor [deleted file]
extra/sandbox/summary.txt [deleted file]
extra/sandbox/syntax/syntax.factor [deleted file]
extra/spheres/spheres.factor
extra/terrain/terrain.factor
extra/tetris/game/game-tests.factor
extra/tetris/tetris.factor
extra/ui/gadgets/book-extras/book-extras.factor
extra/vpri-talk/vpri-talk.factor
extra/webapps/site-watcher/site-watcher.factor
extra/webapps/wiki/wiki.factor
unmaintained/sandbox/authors.txt [new file with mode: 0644]
unmaintained/sandbox/sandbox-tests.factor [new file with mode: 0644]
unmaintained/sandbox/sandbox.factor [new file with mode: 0644]
unmaintained/sandbox/summary.txt [new file with mode: 0644]
unmaintained/sandbox/syntax/syntax.factor [new file with mode: 0644]

index df5a5bbba8ea2bc46cfd8ca97f4dfcfc3dc97ce5..6e398667ec374cfc43ae1cb53cf82f80260eee9c 100755 (executable)
@@ -1,11 +1,11 @@
 ! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: byte-arrays arrays assocs kernel kernel.private libc math
-namespaces make parser sequences strings words assocs splitting
-math.parser cpu.architecture alien alien.accessors alien.strings
-quotations layouts system compiler.units io io.files
-io.encodings.binary io.streams.memory accessors combinators effects
-continuations fry classes ;
+namespaces make parser sequences strings words splitting math.parser
+cpu.architecture alien alien.accessors alien.strings quotations
+layouts system compiler.units io io.files io.encodings.binary
+io.streams.memory accessors combinators effects continuations fry
+classes ;
 IN: alien.c-types
 
 DEFER: <int>
index 31af0291b46561f884984714f15dfa7ca9ba1e87..fc9e594be57824f4cb3dbda092498b2f58ca7634 100644 (file)
@@ -23,7 +23,7 @@ WHERE
 : *T ( alien -- z )
     [ T-real ] [ T-imaginary ] bi rect> ; inline
 
-T in get
+T current-vocab
 { { N "real" } { N "imaginary" } }
 define-struct
 
index b27c62b9a1399691b3bae335eeb2bebcddcf78b8..54b799f6750f2b9d3d3fb54ef72a58a43638f0b4 100644 (file)
@@ -421,7 +421,7 @@ PRIVATE>
 : define-fortran-record ( name vocab fields -- )
     [ >lower ] [ ] [ fortran-record>c-struct ] tri* define-struct ;
 
-SYNTAX: RECORD: scan in get parse-definition define-fortran-record ;
+SYNTAX: RECORD: scan current-vocab parse-definition define-fortran-record ;
 
 : set-fortran-abi ( library -- )
     library-fortran-abis get-global at fortran-abi set ;
index 62b8510d1723bf140266355928b760130410b8bf..2f7a7eadc8a2917030e510fdba2349710a143be1 100644 (file)
@@ -1,6 +1,5 @@
-USING: accessors alien.c-types strings help.markup help.syntax
-alien.syntax sequences io arrays kernel words assocs namespaces
-accessors ;
+USING: alien.c-types strings help.markup help.syntax alien.syntax
+sequences io arrays kernel words assocs namespaces ;
 IN: alien.structs
 
 ARTICLE: "c-structs" "C structure types"
index 0cc6d51446bdb82b4abff11912ecd56acc1b1c7a..d479e6d498e5a37b46ab5326f07300c1b3d22223 100644 (file)
@@ -22,7 +22,7 @@ SYNTAX: TYPEDEF:
     scan scan typedef ;
 
 SYNTAX: C-STRUCT:
-    scan in get parse-definition define-struct ;
+    scan current-vocab parse-definition define-struct ;
 
 SYNTAX: C-UNION:
     scan parse-definition define-union ;
index 300ab5c1bfb3d717a5cc4ec4e965ab017fae750d..cb6a753735ca0b7d1f4aebb31129865cadd6559e 100644 (file)
@@ -104,7 +104,7 @@ M:: lsb0-bit-writer poke ( value n bs -- )
     widthed
     bs widthed>> #bits>> 8 swap - split-widthed :> remainder :> byte
     byte bs widthed>> |widthed :> new-byte
-    new-byte #bits>> dup 8 > [ "oops" throw ] when 8 = [
+    new-byte #bits>> 8 = [
         new-byte bits>> bs bytes>> push
         zero-widthed bs (>>widthed)
         remainder widthed>bytes
index 3aefdec29facbbf4b7ad2b6e7856267503e5858b..5e3827efea2579a0691ac8312c220e0e41442c52 100755 (executable)
@@ -1,13 +1,14 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors compiler cpu.architecture vocabs.loader system
+USING: accessors cpu.architecture vocabs.loader system
 sequences namespaces parser kernel kernel.private classes
 classes.private arrays hashtables vectors classes.tuple sbufs
 hashtables.private sequences.private math classes.tuple.private
 growable namespaces.private assocs words command-line vocabs io
-io.encodings.string libc splitting math.parser memory
-compiler.units math.order compiler.tree.builder
-compiler.tree.optimizer compiler.cfg.optimizer ;
+io.encodings.string libc splitting math.parser memory compiler.units
+math.order compiler.tree.builder compiler.tree.optimizer
+compiler.cfg.optimizer ;
+FROM: compiler => enable-optimizer compile-word ;
 IN: bootstrap.compiler
 
 ! Don't bring this in when deploying, since it will store a
index 4a7a558703d57d4aa3fb53f1bd1937622cd980a2..d76588e4e461c4870d0106054278a1747554a96b 100644 (file)
@@ -1,15 +1,14 @@
 ! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien arrays byte-arrays generic assocs hashtables assocs
-hashtables.private io io.binary io.files io.encodings.binary
-io.pathnames kernel kernel.private math namespaces make parser
-prettyprint sequences sequences.private strings sbufs vectors words
-quotations assocs system layouts splitting grouping growable classes
-classes.builtin classes.tuple classes.tuple.private vocabs
-vocabs.loader source-files definitions debugger quotations.private
-sequences.private combinators math.order math.private accessors
-slots.private generic.single.private compiler.units compiler.constants
-fry bootstrap.image.syntax ;
+USING: alien arrays byte-arrays generic hashtables hashtables.private
+io io.binary io.files io.encodings.binary io.pathnames kernel
+kernel.private math namespaces make parser prettyprint sequences
+strings sbufs vectors words quotations assocs system layouts splitting
+grouping growable classes classes.builtin classes.tuple
+classes.tuple.private vocabs vocabs.loader source-files definitions
+debugger quotations.private combinators math.order math.private
+accessors slots.private generic.single.private compiler.units
+compiler.constants fry bootstrap.image.syntax ;
 IN: bootstrap.image
 
 : arch ( os cpu -- arch )
index c2e95f2a9eaba04cad881883883500a1186e9a95..ad43cc2f1d6d17fd811c14c4fbfce6aa641f9e55 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: math math.order math.parser math.functions kernel\r
 sequences io accessors arrays io.streams.string splitting\r
-combinators accessors calendar calendar.format.macros present ;\r
+combinators calendar calendar.format.macros present ;\r
 IN: calendar.format\r
 \r
 : pad-00 ( n -- str ) number>string 2 CHAR: 0 pad-head ;\r
index 9b8c418634183d6cae0c4b9093e4461874354f22..0eb7881f95915c9c336ba09400e731ac2aaf1d1f 100644 (file)
@@ -3,7 +3,7 @@
 !
 ! Channels - based on ideas from newsqueak
 USING: kernel sequences threads continuations
-random math accessors random ;
+random math accessors ;
 IN: channels
 
 TUPLE: channel receivers senders ;
index 234e032406cb5eae5fd45834e77f5579b6edc509..b0cc8f9e539524b96e76201ffa4d182f6643654a 100644 (file)
@@ -30,8 +30,8 @@ ARTICLE: "checksums.openssl" "OpenSSL checksums"
 "An error thrown if the digest name is unrecognized:"
 { $subsection unknown-digest }
 "An example where we compute the SHA1 checksum of a string using the OpenSSL implementation of SHA1:"
-{ $example "USING: byte-arrays checksums checksums.openssl prettyprint ;" "\"hello world\" >byte-array openssl-sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" }
+{ $example "USING: byte-arrays checksums checksums.openssl ;" "\"hello world\" >byte-array openssl-sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" }
 "If we use the Factor implementation, we get the same result, just slightly slower:"
-{ $example "USING: byte-arrays checksums checksums.sha1 prettyprint ;" "\"hello world\" >byte-array sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } ;
+{ $example "USING: byte-arrays checksums checksums.sha1 ;" "\"hello world\" >byte-array sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } ;
 
 ABOUT: "checksums.openssl"
index e7aee0dd098f808a46e36e2f30ec1c51fa4fecfc..707aa66ba6dc0bb79f2f7b24cb5f3f67b2853b71 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays combinators kernel io io.encodings.binary io.files
-io.streams.byte-array math.vectors strings sequences namespaces
+io.streams.byte-array math.vectors strings namespaces
 make math parser sequences assocs grouping vectors io.binary
 hashtables math.bitwise checksums checksums.common
 checksums.stream ;
index fdd4ba81d75d6e88ef1dfdc46c6c22b520cf61fa..a3fa788f209986f9edb9d92b9fd63d0fcab7fa15 100644 (file)
@@ -2,9 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.c-types alien.strings arrays assocs
 continuations combinators compiler compiler.alien stack-checker kernel
-math namespaces make parser quotations sequences strings words
+math namespaces make quotations sequences strings words
 cocoa.runtime io macros memoize io.encodings.utf8 effects libc
-libc.private parser lexer init core-foundation fry generalizations
+libc.private lexer init core-foundation fry generalizations
 specialized-arrays.direct.alien ;
 IN: cocoa.messages
 
index f2da4ebdf53ff90b91d2be8f7affdcd35a138b8d..19421359a395f96168981a6bcb37073c34a20561 100644 (file)
@@ -69,6 +69,4 @@ SYMBOL: main-vocab-hook
 : ignore-cli-args? ( -- ? )
     os macosx? "run" get "ui" = and ;
 
-: script-mode ( -- ) ;
-
 [ default-cli-args ] "command-line" add-init-hook
index 158903b4bf4be368cbcdc1044e2c48bb93a1716c..bb4153da784d49374bfe7f80b5f5487af3d0f5d5 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel accessors namespaces make math sequences sets
-assocs fry compiler.cfg.instructions ;
+assocs fry compiler.cfg compiler.cfg.instructions ;
 IN: compiler.cfg.rpo
 
 SYMBOL: visited
index 01e58461ffedf85b250b979f51def43051a68971..c3d70fdc5bbcdf8eeaf529dd4bcd7e0949488466 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel namespaces arrays sequences io words fry
 continuations vocabs assocs dlists definitions math graphs generic
-generic.single combinators deques search-deques macros io
+generic.single combinators deques search-deques macros
 source-files.errors stack-checker stack-checker.state
 stack-checker.inlining stack-checker.errors combinators.short-circuit
 compiler.errors compiler.units compiler.tree.builder
index f7f24433d7b88823a825beb288a380c791fd33d0..91215baf19dc401c35328ee9da5a1c0d7e9c110a 100755 (executable)
@@ -1,9 +1,8 @@
-USING: alien alien.c-types alien.syntax compiler kernel
-namespaces namespaces tools.test sequences stack-checker
-stack-checker.errors words arrays parser quotations
-continuations effects namespaces.private io io.streams.string
-memory system threads tools.test math accessors combinators
-specialized-arrays.float alien.libraries io.pathnames
+USING: alien alien.c-types alien.syntax compiler kernel namespaces
+sequences stack-checker stack-checker.errors words arrays parser
+quotations continuations effects namespaces.private io
+io.streams.string memory system threads tools.test math accessors
+combinators specialized-arrays.float alien.libraries io.pathnames
 io.backend ;
 IN: compiler.tests.alien
 
index 8fbe13ce51945bca40f457993e40f791ae0feaf8..e0bc917f1c35624ccf9418052ac7277cee97798f 100644 (file)
@@ -1,9 +1,9 @@
-USING: generalizations accessors arrays compiler kernel
-kernel.private math hashtables.private math.private namespaces
-sequences sequences.private tools.test namespaces.private
-slots.private sequences.private byte-arrays alien
+USING: generalizations accessors arrays compiler kernel kernel.private
+math hashtables.private math.private namespaces sequences tools.test
+namespaces.private slots.private sequences.private byte-arrays alien
 alien.accessors layouts words definitions compiler.units io
 combinators vectors grouping make ;
+QUALIFIED: namespaces.private
 IN: compiler.tests.codegen
 
 ! Originally, this file did black box testing of templating
@@ -48,7 +48,7 @@ unit-test
 [ 3 ]
 [
     global [ 3 \ foo set ] bind
-    \ foo [ global >n get ndrop ] compile-call
+    \ foo [ global >n get namespaces.private:ndrop ] compile-call
 ] unit-test
 
 : blech ( x -- ) drop ;
@@ -62,7 +62,7 @@ unit-test
 [ 3 ]
 [
     global [ 3 \ foo set ] bind
-    \ foo [ global [ get ] swap >n call ndrop ] compile-call
+    \ foo [ global [ get ] swap >n call namespaces.private:ndrop ] compile-call
 ] unit-test
 
 [ 3 ]
index 5ca0f3f109905d0a8b2a5c8cb18f74f9284d9fa5..d0cfc127e3e86042448f3c1dac8753af18f8dffd 100644 (file)
@@ -1,10 +1,10 @@
 USING: accessors arrays compiler.units kernel kernel.private math
 math.constants math.private sequences strings tools.test words
 continuations sequences.private hashtables.private byte-arrays
-strings.private system random layouts vectors
+system random layouts vectors
 sbufs strings.private slots.private alien math.order
 alien.accessors alien.c-types alien.syntax alien.strings
-namespaces libc sequences.private io.encodings.ascii
+namespaces libc io.encodings.ascii
 classes compiler ;
 IN: compiler.tests.intrinsics
 
index 60cab92843e58676ef01684d2695e138f98663ce..d1a9f5215ac43c31b791e94a20fe622888ce04c8 100644 (file)
@@ -16,6 +16,7 @@ compiler.tree.builder
 compiler.tree.optimizer
 compiler.tree.combinators
 compiler.tree.checker ;
+FROM: fry => _ ;
 RENAME: _ match => __
 IN: compiler.tree.debugger
 
index 705f44eeb66105c3032cfb23ef9723aa460ef6bf..fa504919a33e9695d3df5b2290d05a81fbed5ac6 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays namespaces assocs sequences kernel generic assocs
+USING: arrays namespaces sequences kernel generic assocs
 classes vectors accessors combinators sets
 stack-checker.state
 stack-checker.branches
index 3d9d77ae56b235c94da3c8356e49691fc2987b98..708992f91875b12fbc2aa9415fb07951e0d0a017 100644 (file)
@@ -322,3 +322,9 @@ C: <ro-box> ro-box
 [ 0 ] [
     [ { null } declare [ 1 ] [ 2 ] if ] count-unboxed-allocations
 ] unit-test
+
+! Doug found a regression
+
+TUPLE: empty-tuple ;
+
+[ ] [ [ empty-tuple boa layout-of ] count-unboxed-allocations drop ] unit-test
\ No newline at end of file
index 729d6a04907f8789aeedbc15d1cd5a46051a9ad7..c0b3982c0edd7cc0bb6bda38a42812ee7f46eb04 100644 (file)
@@ -49,14 +49,10 @@ M: #push escape-analysis*
 
 : slot-offset ( #call -- n/f )
     dup in-d>>
-    [ first node-value-info class>> ]
-    [ second node-value-info literal>> ] 2bi
-    dup fixnum? [
-        {
-            { [ over tuple class<= ] [ 2 - ] }
-            { [ over complex class<= ] [ 1 - ] }
-            [ drop f ]
-        } cond nip
+    [ second node-value-info literal>> ]
+    [ first node-value-info class>> ] 2bi
+    2dup [ fixnum? ] [ tuple class<= ] bi* and [
+        over 2 >= [ drop 2 - ] [ 2drop f ] if
     ] [ 2drop f ] if ;
 
 : record-slot-call ( #call -- )
index ee7bf8672e2515d8d5cf44509faacb77fc644633..7494ed064e5d26ba023c8c8aa7d277d11da258aa 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: fry namespaces sequences math math.order accessors kernel arrays
-combinators compiler.utilities assocs
+combinators assocs
 stack-checker.backend
 stack-checker.branches
 stack-checker.inlining
index 2c3314994b53afd9499db4a7773a81523722a706..72c08dbf1c5f3cd92435e87f452eae28e1c78961 100644 (file)
@@ -1,5 +1,5 @@
 USING: accessors math math.intervals sequences classes.algebra
-math kernel tools.test compiler.tree.propagation.info arrays ;
+kernel tools.test compiler.tree.propagation.info arrays ;
 IN: compiler.tree.propagation.info.tests
 
 [ f ] [ 0.0 -0.0 eql? ] unit-test
index d676102bdea6270fb5d460752f625d18394e2c12..c3f5312601c6d373f6aa0d3e0b773a67b44d5ca0 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2004, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: sequences accessors kernel assocs sequences
+USING: sequences accessors kernel assocs
 compiler.tree
 compiler.tree.propagation.copy
 compiler.tree.propagation.info ;
index 0d5f05fab0592823f6e2eafadadaa99a2e01b2b1..a96fc0501d3e15c5a76187d75dd73eaaa33b2eca 100644 (file)
@@ -1,5 +1,5 @@
 IN: compiler.tree.tuple-unboxing.tests
-USING: tools.test compiler.tree.tuple-unboxing compiler.tree
+USING: tools.test compiler.tree
 compiler.tree.builder compiler.tree.recursive
 compiler.tree.normalization compiler.tree.propagation
 compiler.tree.cleanup compiler.tree.escape-analysis
index 996e3db4c0dfb6c3ccdfe33f8bd3d3568ee84635..6c0d882cacfd56f93fc1f4f2fede094b20fcac5f 100644 (file)
@@ -3,6 +3,7 @@ USING: tools.test concurrency.distributed kernel io.files
 io.files.temp io.directories arrays io.sockets system
 combinators threads math sequences concurrency.messaging
 continuations accessors prettyprint ;
+FROM: concurrency.messaging => receive send ;
 
 : test-node ( -- addrspec )
     {
index 3b5b014fe3854a83b681a39a61ea55c13f208e3c..7ec9db8ad96a21ea1748828c3e4af477817ccd8b 100644 (file)
@@ -1,7 +1,8 @@
 IN: concurrency.exchangers.tests\r
-USING: sequences tools.test concurrency.exchangers\r
+USING: tools.test concurrency.exchangers\r
 concurrency.count-downs concurrency.promises locals kernel\r
 threads ;\r
+FROM: sequences => 3append ;\r
 \r
 :: exchanger-test ( -- string )\r
     [let |\r
index 41beedb6dc7b59c265f309093d476539fe686144..d58df3519bdbb6053facc2dc3c190a184fafda61 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: help.syntax help.markup concurrency.messaging.private
-threads kernel arrays quotations threads strings ;
+threads kernel arrays quotations strings ;
 IN: concurrency.messaging
 
 HELP: send
@@ -53,7 +53,7 @@ ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous sends"
 { $subsection reply-synchronous }
 "An example:"
 { $example
-    "USING: concurrency.messaging kernel prettyprint threads ;"
+    "USING: concurrency.messaging threads ;"
     "IN: scratchpad"
     ": pong-server ( -- )"
     "    receive [ \"pong\" ] dip reply-synchronous ;"
index c708eacecc8ff5ac2c774d9e759f8e27aafb0adf..ef5973888edf872cc898ba16c80ccc15bfa756b4 100644 (file)
@@ -1,7 +1,6 @@
 ! Copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax core-foundation.numbers kernel math
-sequences core-foundation.numbers ;
+USING: alien.c-types alien.syntax kernel math sequences ;
 IN: core-foundation.data
 
 TYPEDEF: void* CFDataRef
index 14327d08b88f0a49ccf15e70c77404a2199041cd..23b1d1e6f422d343529def975ec841d74aaee96d 100644 (file)
@@ -1,6 +1,7 @@
 IN: cpu.ppc.assembler.tests
 USING: cpu.ppc.assembler tools.test arrays kernel namespaces
 make vocabs sequences ;
+FROM: cpu.ppc.assembler => B ;
 
 : test-assembler ( expected quot -- )
     [ 1array ] [ [ B{ } make ] curry ] bi* unit-test ;
index b09938f4b9bbe208ccee56eb42658d76aa074005..cbb914121ea2eb02444ca70340235d3a2c7c7fdc 100644 (file)
@@ -4,6 +4,7 @@ USING: bootstrap.image.private kernel kernel.private namespaces
 system cpu.ppc.assembler compiler.codegen.fixup compiler.units\r
 compiler.constants math math.private layouts words\r
 vocabs slots.private locals.backend ;\r
+FROM: cpu.ppc.assembler => B ;\r
 IN: bootstrap.ppc\r
 \r
 4 \ cell set\r
index dc7108b3a11a143953fe3f9e986ffceed8a4d0e0..617a7c514177fc280489531c953c906b11256088 100644 (file)
@@ -7,6 +7,7 @@ cpu.ppc.assembler cpu.ppc.assembler.backend literals compiler.cfg.registers
 compiler.cfg.instructions compiler.constants compiler.codegen
 compiler.codegen.fixup compiler.cfg.intrinsics
 compiler.cfg.stack-frame compiler.units ;
+FROM: cpu.ppc.assembler => B ;
 IN: cpu.ppc
 
 ! PowerPC register assignments:
index 02b43ecd8800e9922e6283fc2d9ff07e81273a13..3cd0909288bd9fd62c1cadbe04a99223c879054f 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel db.errors peg.ebnf strings sequences math
-combinators.short-circuit accessors math.parser quoting ;
+combinators.short-circuit accessors math.parser quoting
+locals ;
 IN: db.errors.postgresql
 
 EBNF: parse-postgresql-sql-error
index 56bac7efcd411d7a1bfc7fef0b1fa331ad2eb31a..19140259bf1e4b913a4243f8b7abd81ab99b0254 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: concurrency.combinators db.pools db.sqlite db.tuples
 db.types kernel math random threads tools.test db sequences
-io prettyprint db.postgresql db.sqlite accessors io.files.temp
+io prettyprint db.postgresql accessors io.files.temp
 namespaces fry system math.parser ;
 IN: db.tester
 
index afdee3e89f25f61bb0e8d139fd0488993c90b858..6bf8dd3075ffe24b1146605be0d17e36645b9fa8 100644 (file)
@@ -1,11 +1,12 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io.files io.files.temp kernel tools.test db db.tuples classes
-db.types continuations namespaces math math.ranges
+db.types continuations namespaces math
 prettyprint calendar sequences db.sqlite math.intervals
 db.postgresql accessors random math.bitwise system
 math.ranges strings urls fry db.tuples.private db.private
 db.tester ;
+FROM: math.ranges => [a,b] ;
 IN: db.tuples.tests
 
 TUPLE: person the-id the-name the-number the-real
index 19d4be5fc8aa8c238ee97398104aa4093c46748c..388c9ba47e65c4b13b1b25861bbec9b32d75ddbf 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays assocs classes db kernel namespaces
 classes.tuple words sequences slots math accessors
-math.parser io prettyprint db.types continuations
+math.parser io prettyprint continuations
 destructors mirrors sets db.types db.private fry
 combinators.short-circuit db.errors ;
 IN: db.tuples
index bb0268f048e0161ee51196e6c547d8088b272fdc..7994c3ed96884215813cbc064ac1006ab935935c 100644 (file)
@@ -251,8 +251,15 @@ M: already-disposed summary drop "Attempting to operate on disposed object" ;
 M: no-current-vocab summary
     drop "Not in a vocabulary; IN: form required" ;
 
-M: no-word-error error.
-    "No word named ``" write name>> write "'' found in current vocabulary search path" print ;
+M: no-word-error summary
+    name>> "No word named ``" "'' found in current vocabulary search path" surround ;
+
+M: no-word-error error. summary print ;
+
+M: ambiguous-use-error summary
+    words>> first name>> "More than one vocabulary defines a word named ``" "''" surround ;
+
+M: ambiguous-use-error error. summary print ;
 
 M: staging-violation summary
     drop
index 451c91277974fec8bcbd5813d79b5aadc4a202d9..104dea6b98a4942076447b421b74e963d8655e26 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors arrays io kernel math models namespaces make
 sequences strings splitting combinators unicode.categories
 math.order math.ranges fry locals ;
+FROM: models => change-model ;
 IN: documents
 
 : +col ( loc n -- newloc ) [ first2 ] dip + 2array ;
index d5b4b909e3a41ce04a11d87c144ae4bc76346f7f..f81490bcf2c09a3306c5150ee6f8df8d70f5f17e 100644 (file)
@@ -4,7 +4,7 @@ USING: parser lexer kernel namespaces sequences definitions
 io.files io.backend io.pathnames io summary continuations
 tools.crossref vocabs.hierarchy prettyprint source-files
 source-files.errors assocs vocabs vocabs.loader splitting
-accessors debugger prettyprint help.topics ;
+accessors debugger help.topics ;
 IN: editors
 
 TUPLE: no-edit-hook ;
index 15fd52f5eef4f229412ca49416751bee485a2985..277cd734cc5f9871246669c0c26a7fd0cc67e796 100644 (file)
@@ -11,7 +11,10 @@ SINGLETON: gvim
 HOOK: gvim-path io-backend ( -- path )
 
 M: gvim vim-command ( file line -- string )
-    [ gvim-path , "+" swap number>string append , , ] { } make ;
+    [
+        gvim-path ,
+        number>string "+" prepend , ,
+    ] { } make ;
 
 gvim vim-editor set-global
 
index b5f864dcd0791f9fb8b352ebf111cb63dba9ad5f..c178207e49dc85b4a3c544a9af9d95938dfc60d1 100644 (file)
@@ -3,11 +3,9 @@ namespaces prettyprint editors make ;
 
 IN: editors.macvim
 
-: macvim-location ( file line -- )
+: macvim ( file line -- )
     drop
     [ "open" , "-a" , "MacVim", , ] { } make
-    try-process ;
-
-[ macvim-location ] edit-hook set-global
-
+    run-detached drop ;
 
+[ macvim ] edit-hook set-global
index 7e8a540b7331a84eb0135a0660170ef296074093..605b4d53aadb4f5d26c7beed3453513dc6c20e2c 100644 (file)
@@ -25,7 +25,7 @@ IN: editors.scite
         number>string "-goto:" prepend ,
     ] { } make ;
 
-: scite-location ( file line -- )
+: scite ( file line -- )
     scite-command run-detached drop ;
 
-[ scite-location ] edit-hook set-global
+[ scite ] edit-hook set-global
index cccc94b53985d28d94f4db867815ad0ec3665d58..4b5f2c6886e81ab670895e23c0abfe464a8a7496 100644 (file)
@@ -2,9 +2,9 @@ USING: definitions io.launcher kernel math math.parser parser
 namespaces prettyprint editors make ;
 IN: editors.textedit
 
-: textedit-location ( file line -- )
+: textedit ( file line -- )
     drop
     [ "open" , "-a" , "TextEdit", , ] { } make
-    try-process ;
+    run-detached drop ;
 
-[ textedit-location ] edit-hook set-global
+[ textedit ] edit-hook set-global
index 8bea085c7fc5aa86cef860f9f8206a2851097e71..65395bd590d5eb9c60a2b3434e441d6979bf4971 100644 (file)
@@ -1,10 +1,9 @@
 USING: definitions io.launcher kernel math math.parser parser
 namespaces prettyprint editors make ;
-
 IN: editors.textmate
 
-: textmate-location ( file line -- )
+: textmate ( file line -- )
     [ "mate" , "-a" , "-l" , number>string , , ] { } make
-    try-process ;
+    run-detached drop ;
 
-[ textmate-location ] edit-hook set-global
+[ textmate ] edit-hook set-global
index 7f527bf18f2544dc621101b52dd993acf3cac461..1ec3a37061e0bf3de47eefc72dd098f6b2717142 100644 (file)
@@ -3,7 +3,7 @@ USING: definitions editors help help.markup help.syntax io io.files
 IN: editors.vim
 
 ARTICLE: { "vim" "vim" } "Vim support"
-"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim-location } ". The " { $link vim-path } " variable contains the name of the vim executable.  The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "."
+"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim } ". The " { $link vim-path } " variable contains the name of the vim executable.  The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "."
 $nl
 "If you intend to use this module regularly, it helps to have it load during stage 2 bootstrap. On Windows, place the following example " { $snippet ".factor-boot-rc" } " in the directory returned by " { $link home } ":"
 { $code
index f07f2578880fed2b83b8fd7c80bb5cda7202d9be..88c8b8051e859b23160488b1339c5ba782411c78 100644 (file)
@@ -4,7 +4,6 @@ make ;
 IN: editors.vim
 
 SYMBOL: vim-path
-
 SYMBOL: vim-editor
 HOOK: vim-command vim-editor ( file line -- array )
 
@@ -12,12 +11,13 @@ SINGLETON: vim
 
 M: vim vim-command
     [
-        vim-path get , swap , "+" swap number>string append ,
+        vim-path get ,
+        [ , ] [ number>string "+" prepend , ] bi*
     ] { } make ;
 
-: vim-location ( file line -- )
-    vim-command try-process ;
+: vim ( file line -- )
+    vim-command run-detached drop ;
 
 "vim" vim-path set-global
-[ vim-location ] edit-hook set-global
-vim vim-editor set-global
+[ vim ] edit-hook set-global
+vim vim-editor set-global
index 7da19ee47b5f4b954ca1097d48df41539c0b6aee..84dfbbd43e68906717bb819169c3556ce7f56ec3 100644 (file)
@@ -2,8 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.strings alien.syntax kernel
 layouts sequences system unix environment io.encodings.utf8
-unix.utilities vocabs.loader combinators alien.accessors
-alien.syntax ;
+unix.utilities vocabs.loader combinators alien.accessors ;
 IN: environment.unix
 
 HOOK: environ os ( -- void* )
index 4c5b9e8cf9a72c0fb56860cd7cb01b22ef92a8a1..c4eab2d6ab22383fc35846577f5b64932af32e41 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: splitting parser compiler.units kernel namespaces
+USING: splitting parser parser.notes compiler.units kernel namespaces
 debugger io.streams.string fry combinators effects.parser ;
 IN: eval
 
index abee7194a2f76c9b8c0bf33cb6644c1655cc3c47..7d9c900ec2d9a74a99234dfb7066e01e58479b96 100644 (file)
@@ -96,7 +96,7 @@ link-no-follow? off
 [ "<pre><span class=\"KEYWORD3\">int</span> <span class=\"FUNCTION\">main</span><span class=\"OPERATOR\">(</span><span class=\"OPERATOR\">)</span></pre>" ]
 [ "[c{int main()}]" convert-farkup ] unit-test
 
-[ "<p><img src=\"lol.jpg\" alt=\"image:lol.jpg\"/></p>" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
+[ "<p><img src=\"lol.jpg\" alt=\"lol.jpg\"/></p>" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
 [ "<p><img src=\"lol.jpg\" alt=\"teh lol\"/></p>" ] [ "[[image:lol.jpg|teh lol]]" convert-farkup ] unit-test
 [ "<p><a href=\"http://lol.com\">http://lol.com</a></p>" ] [ "[[http://lol.com]]" convert-farkup ] unit-test
 [ "<p><a href=\"http://lol.com\">haha</a></p>" ] [ "[[http://lol.com|haha]]" convert-farkup ] unit-test
@@ -207,3 +207,5 @@ link-no-follow? off
         [ convert-farkup drop t ] [ drop print f ] recover
     ] all?
 ] unit-test
+
+[ "<p><a href=\"http://foo.com/~foo\">http://foo.com/~foo</a></p>" ] [ "[[http://foo.com/~foo]]" convert-farkup ] unit-test
index c400457c0b8ea96ed8f5e743f6313aa3c1d39e12..a008b1d04937be2d982234c23baef92ca2ac1e25 100644 (file)
@@ -70,11 +70,15 @@ DEFER: (parse-paragraph)
         { CHAR: % inline-code }
     } at ;
 
+: or-simple-title ( url title/f quot: ( title -- title' ) -- url title' )
+    [ "" like dup simple-link-title ] if* ; inline
+
 : parse-link ( string -- paragraph-list )
     rest-slice "]]" split1-slice [
         "|" split1
-        [ "" like dup simple-link-title ] unless*
-        [ "image:" ?head ] dip swap [ image boa ] [ parse-paragraph link boa ] if
+        [ "image:" ?head ] dip swap
+        [ [ ] or-simple-title image boa ]
+        [ [ parse-paragraph ] or-simple-title link boa ] if
     ] dip [ (parse-paragraph) cons ] [ 1list ] if* ;
 
 : ?first ( seq -- elt ) 0 swap ?nth ;
index 5a517e4ac498e2328636b04126e8f96f4007b004..f8b9ba501ba68e5c953bb0e5f7aa2f855269f2bb 100644 (file)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2008 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: accessors arrays ascii assocs calendar combinators fry kernel 
-generalizations io io.encodings.ascii io.files io.streams.string
-macros math math.functions math.parser peg.ebnf quotations
-sequences splitting strings unicode.case vectors combinators.smart ;
+USING: accessors arrays assocs calendar combinators fry kernel
+generalizations io io.streams.string macros math math.functions
+math.parser peg.ebnf quotations sequences splitting strings
+unicode.categories unicode.case vectors combinators.smart ;
 
 IN: formatting
 
index d7d9d8384dd70e5b53d45bcd5f3f5734a19ffea7..3484fb447484664b00848dbff36050736c58d7b2 100644 (file)
@@ -2,6 +2,7 @@ USING: calendar ftp.server io.encodings.ascii io.files
 io.files.unique namespaces threads tools.test kernel
 io.servers.connection ftp.client accessors urls
 io.pathnames io.directories sequences fry ;
+FROM: ftp.client => ftp-get ;
 IN: ftp.server.tests
 
 : test-file-contents ( -- string )
index edd4932c66a05a7451168d24a79fea2614044dee..e5eb50e82f1e83b03ba34fc034b75b026e118955 100644 (file)
@@ -146,10 +146,10 @@ DEFER: ;FUNCTOR delimiter
     } ;
 
 : push-functor-words ( -- )
-    functor-words use get push ;
+    functor-words use-words ;
 
 : pop-functor-words ( -- )
-    functor-words use get delq ;
+    functor-words unuse-words ;
 
 : parse-functor-body ( -- form )
     push-functor-words
index 7a4de18eafe8346f1752522c6a7027e326899f02..5c1ceecbf0f9f77cb8cc60347e08db6debee44a2 100644 (file)
@@ -1,5 +1,5 @@
 USING: help.markup help.syntax io.streams.string quotations
-strings calendar serialize kernel furnace.db words words.symbol
+strings calendar serialize furnace.db words words.symbol
 kernel ;
 IN: furnace.sessions
 
index 32440e92b2bb1eabc7471e24411617070c006a81..92c0c7173ae6b9d6948f307437e0c48379e42622 100755 (executable)
@@ -1,7 +1,7 @@
 USING: cocoa cocoa.plists core-foundation iokit iokit.hid
 kernel cocoa.enumeration destructors math.parser cocoa.application 
 sequences locals combinators.short-circuit threads
-namespaces assocs vectors arrays combinators hints alien
+namespaces assocs arrays combinators hints alien
 core-foundation.run-loop accessors sequences.private
 alien.c-types math parser game-input vectors bit-arrays ;
 IN: game-input.iokit
@@ -12,10 +12,11 @@ SYMBOLS: +hid-manager+ +keyboard-state+ +mouse-state+ +controller-states+ ;
 
 iokit-game-input-backend game-input-backend set-global
 
-: hid-manager-matching ( matching-seq -- alien )
-    f 0 IOHIDManagerCreate
-    [ swap >plist IOHIDManagerSetDeviceMatchingMultiple ]
-    keep ;
+: make-hid-manager ( -- alien )
+    f 0 IOHIDManagerCreate ;
+
+: set-hid-manager-matching ( alien matching-seq -- )
+    >plist IOHIDManagerSetDeviceMatchingMultiple ;
 
 : devices-from-hid-manager ( manager -- vector )
     [
@@ -85,9 +86,6 @@ CONSTANT: hat-switch-matching-hash
 : ?hat-switch ( device -- ? )
     hat-switch-matching-hash ?axis ;
 
-: hid-manager-matching-game-devices ( -- alien )
-    game-devices-matching-seq hid-manager-matching ;
-
 : device-property ( device key -- value )
     <NSString> IOHIDDeviceGetProperty [ plist> ] [ f ] if* ;
 : element-property ( element key -- value )
@@ -288,12 +286,13 @@ M: iokit-game-input-backend reset-mouse
     256 <bit-array> +keyboard-state+ set-global ;
 
 M: iokit-game-input-backend (open-game-input)
-    hid-manager-matching-game-devices {
+    make-hid-manager {
         [ initialize-variables ]
         [ device-matched-callback f IOHIDManagerRegisterDeviceMatchingCallback ]
         [ device-removed-callback f IOHIDManagerRegisterDeviceRemovalCallback ]
         [ device-input-callback f IOHIDManagerRegisterInputValueCallback ]
         [ 0 IOHIDManagerOpen mach-error ]
+        [ game-devices-matching-seq set-hid-manager-matching ]
         [
             CFRunLoopGetMain CFRunLoopDefaultMode
             IOHIDManagerScheduleWithRunLoop
index 59486a9c35d17defe1dc643a9eebbccc227d709b..ff385f9a65a55af5928a3def203861bc401b84f5 100644 (file)
@@ -1,4 +1,4 @@
-USING: help.markup help.syntax io kernel math namespaces parser
+USING: help.markup help.syntax io kernel math parser
 prettyprint sequences vocabs.loader namespaces stack-checker
 help command-line multiline see ;
 IN: help.cookbook
@@ -136,7 +136,7 @@ ARTICLE: "cookbook-variables" "Dynamic variables cookbook"
 } ;
 
 ARTICLE: "cookbook-vocabs" "Vocabularies cookbook"
-"Rather than being in one flat list, words belong to vocabularies; every word is contained in exactly one. When parsing a word name, the parser searches the " { $emphasis "vocabulary search path" } ". When working at the listener, a useful set of vocabularies is already available. In a source file, all used vocabularies must be imported."
+"Rather than being in one flat list, words belong to vocabularies; every word is contained in exactly one. When parsing a word name, the parser searches through vocabularies. When working at the listener, a useful set of vocabularies is already available. In a source file, all used vocabularies must be imported."
 $nl
 "For example, a source file containing the following code will print a parse error if you try loading it:"
 { $code "\"Hello world\" print" }
@@ -161,7 +161,7 @@ $nl
 "You would have to place the first definition after the two others for the parser to accept the file."
 { $references
     { }
-    "vocabulary-search"
+    "word-search"
     "words"
     "parser"
 } ;
@@ -286,7 +286,6 @@ ARTICLE: "cookbook-pitfalls" "Pitfalls to avoid"
 { $list
     "Factor only makes use of one native thread, and Factor threads are scheduled co-operatively. C library calls block the entire VM."
     "Factor does not hide anything from the programmer, all internals are exposed. It is your responsibility to avoid writing fragile code which depends too much on implementation detail."
-    { "When a source file uses two vocabularies which define words with the same name, the order of the vocabularies in the " { $link POSTPONE: USE: } " or " { $link POSTPONE: USING: } " forms is important. The " { $link POSTPONE: QUALIFIED: } " word implements qualified naming, which can be used to resolve ambiguities." }
     { "If a literal object appears in a word definition, the object itself is pushed on the stack when the word executes, not a copy. If you intend to mutate this object, you must " { $link clone } " it first. See " { $link "syntax-literals" } "." }
     { "For a discussion of potential issues surrounding the " { $link f } " object, see " { $link "booleans" } "." }
     { "Factor's object system is quite flexible. Careless usage of union, mixin and predicate classes can lead to similar problems to those caused by “multiple inheritance” in other languages. In particular, it is possible to have two classes such that they have a non-empty intersection and yet neither is a subclass of the other. If a generic word defines methods on two such classes, various disambiguation rules are applied to ensure method dispatch remains deterministic, however they may not be what you expect. See " { $link "method-order" } " for details." }
index b83fb22ccfccf5bb0c91f6fe8baf76f3c5bc6921..a18dcd03f72bd4656fc4ed5f34a92e7e97722b8c 100644 (file)
@@ -248,14 +248,14 @@ ARTICLE: "handbook-language-reference" "The language"
 { $subsection "namespaces-global" }
 { $subsection "values" }
 { $heading "Abstractions" }
-{ $subsection "errors" }
+{ $subsection "fry" }
 { $subsection "objects" }
+{ $subsection "errors" }
 { $subsection "destructors" }
-{ $subsection "continuations" }
 { $subsection "memoize" }
 { $subsection "parsing-words" }
 { $subsection "macros" }
-{ $subsection "fry" }
+{ $subsection "continuations" }
 { $heading "Program organization" }
 { $subsection "vocabs.loader" }
 "Vocabularies tagged " { $link T{ vocab-tag { name "extensions" } } } " implement various additional language abstractions." ;
index 61414cdfa2f1dddf9388601a44a18dc7b4bb4222..3ba336be0bff6604596047d2f27dd96c74e04109 100644 (file)
@@ -2,3 +2,5 @@ IN: help.html.tests
 USING: help.html tools.test help.topics kernel ;
 
 [ ] [ "xml" >link help>html drop ] unit-test
+
+[ "article-foobar.html" ] [ "foobar" >link topic>filename ] unit-test
\ No newline at end of file
index 348fcbbbfbb4990da457758ee20ca74cbe8aa921..fbfc42829ee1faaf1d03f2716962ccad2ac48dcb 100644 (file)
@@ -1,11 +1,13 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: io.encodings.utf8 io.encodings.ascii io.encodings.binary
+USING: io.encodings.utf8 io.encodings.binary
 io.files io.files.temp io.directories html.streams help kernel
 assocs sequences make words accessors arrays help.topics vocabs
 vocabs.hierarchy help.vocabs namespaces prettyprint io
-vocabs.loader serialize fry memoize ascii unicode.case math.order
+vocabs.loader serialize fry memoize unicode.case math.order
 sorting debugger html xml.syntax xml.writer math.parser ;
+FROM: io.encodings.ascii => ascii ;
+FROM: ascii => ascii? ;
 IN: help.html
 
 : escape-char ( ch -- )
index 7a5b482270aba92fc56efbbbc8645f846cc015ab..08cf4b2cd4932bdf8235a904ca34bbac9dd65364 100755 (executable)
@@ -66,11 +66,12 @@ PRIVATE>
     ] check-something ;
 
 : check-about ( vocab -- )
-    dup '[ _ vocab-help [ article drop ] when* ] check-something ;
+    vocab-link boa dup
+    '[ _ vocab-help [ article drop ] when* ] check-something ;
 
 : check-vocab ( vocab -- )
     "Checking " write dup write "..." print
-    [ vocab check-about ]
+    [ check-about ]
     [ words [ check-word ] each ]
     [ vocab-articles get at [ check-article ] each ]
     tri ;
index 04b6d90883c59bdd06311f42f43740d32900580f..6f82a6f50be97c8bf74c05c15dab9875e5620846 100644 (file)
@@ -5,6 +5,7 @@ hashtables namespaces make parser prettyprint sequences strings
 io.styles vectors words math sorting splitting classes slots fry
 sets vocabs help.stylesheet help.topics vocabs.loader quotations
 combinators see present ;
+FROM: prettyprint.sections => with-pprint ;
 IN: help.markup
 
 PREDICATE: simple-element < array
@@ -348,8 +349,6 @@ M: f ($instance)
     drop
     "Throws an error if the I/O operation fails." $errors ;
 
-FROM: prettyprint.private => with-pprint ;
-
 : $prettyprinting-note ( children -- )
     drop {
         "This word should only be called from inside the "
index 1844d18d944c9ba56dc24e9aa61431e1a88590a9..af4b9e5e1222f74f3410cca7f3f14c35d8537301 100644 (file)
@@ -16,4 +16,4 @@ SYNTAX: ARTICLE:
     ] dip remember-definition ;
 
 SYNTAX: ABOUT:
-    in get vocab scan-object >>help changed-definition ;
+    current-vocab scan-object >>help changed-definition ;
index 7686022b705305060da28f57c7938e615da5a4d8..a46e57735706b428fee004f7fe37ecc79f735eb2 100644 (file)
@@ -38,7 +38,7 @@ $nl
 $nl
 "Now we have changed the source file, we must reload it into Factor so that we can test the new definition. To do this, simply go to the Factor listener and press " { $command tool "common" refresh-all } ". This will find any previously-loaded source files which have changed on disk, and reload them."
 $nl
-"When you do this, you will get an error about the " { $link dup } " word not being found. This is because this word is part of the " { $vocab-link "kernel" } " vocabulary, but this vocabulary is not part of the source file's " { $link "vocabulary-search" } ". You must explicitly list dependencies in source files. This allows Factor to automatically load required vocabularies and makes larger programs easier to maintain."
+"When you do this, you will get an error about the " { $link dup } " word not being found. This is because this word is part of the " { $vocab-link "kernel" } " vocabulary, but this vocabulary is not part of the source file's " { $link "word-search" } ". You must explicitly list dependencies in source files. This allows Factor to automatically load required vocabularies and makes larger programs easier to maintain."
 $nl
 "To add the word to the search path, first convince yourself that this word is in the " { $vocab-link "kernel" } " vocabulary. Enter " { $snippet "dup" } " in the listener's input area, and press " { $operation com-browse } ". This will open the documentation browser tool, viewing the help for the " { $link dup } " word. One of the subheadings in the help article will mention the word's vocabulary."
 $nl
index da2e5b5991948ad79d8077fbd77b723aadfc9dbe..c901e35e3e8262cdefeaa359f77425cdd76627d2 100644 (file)
@@ -3,6 +3,7 @@ USING: tools.test kernel io.streams.string
 io.streams.null accessors inspector html.streams
 html.components html.forms namespaces
 xml.writer ;
+FROM: html.components => inspector ;
 
 [ ] [ begin-form ] unit-test
 
index d2dc3ed3a3d541cc16becb7ce43c528578a3c633..006a435cf0e8b54243a5ca7d503a5ecb36aa7084 100644 (file)
@@ -1,6 +1,7 @@
 IN: html.forms.tests
 USING: kernel sequences tools.test assocs html.forms validators accessors
 namespaces ;
+FROM: html.forms => values ;
 
 : with-validation ( quot -- messages )
     [
index 835874cbb751030659993b8c186b8f4d4b64e36c..79e8027489b216905d5d9e89266db69fd781216e 100644 (file)
@@ -1,6 +1,6 @@
 USING: html.streams html.streams.private accessors io
 io.streams.string io.styles kernel namespaces tools.test
-xml.writer sbufs sequences inspector colors xml.writer
+sbufs sequences inspector colors xml.writer
 classes.predicate prettyprint ;
 IN: html.streams.tests
 
index fcfd454478348a40b170e5f23e30b485e740d1d6..9716407de880fadb9edd4af71628698427a1b722 100644 (file)
@@ -1,8 +1,9 @@
 IN: html.templates.chloe
-USING: xml.data help.markup help.syntax html.components html.forms
+USING: help.markup help.syntax html.components html.forms
 html.templates html.templates.chloe.syntax
 html.templates.chloe.compiler html.templates.chloe.components
 math strings quotations namespaces ;
+FROM: xml.data => tag ;
 
 HELP: <chloe>
 { $values { "path" "a pathname string without the trailing " { $snippet ".xml" } " extension" } { "chloe" chloe } }
index fd786d355dba983bd4a6a8b0bc1388849b4e9535..8003d71d36a9a179a56eda6ccde8329c681759b3 100644 (file)
@@ -1,7 +1,7 @@
 USING: html.templates html.templates.chloe
 tools.test io.streams.string kernel sequences ascii boxes
 namespaces xml html.components html.forms
-splitting unicode.categories furnace accessors
+splitting furnace accessors
 html.templates.chloe.compiler ;
 IN: html.templates.chloe.tests
 
index 1fe90b08d3d51f56afbd204214c2aa7809a61a9d..f42a5c3bdefe75a21489a11e9144972a3d2b3c4b 100644 (file)
@@ -1,11 +1,11 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel sequences combinators kernel fry
+USING: accessors kernel sequences combinators fry
 namespaces make classes.tuple assocs splitting words arrays io
 io.files io.files.info io.encodings.utf8 io.streams.string
 unicode.case mirrors math urls present multiline quotations xml
 logging
-xml.data xml.writer xml.syntax strings
+xml.writer xml.syntax strings
 html.forms
 html
 html.components
index 7c47a44d9efee186f87e6c7ffff88b65e00b73b0..f7da0fe27742ea3aa029f235a0a5d4ce8f99c4ae 100644 (file)
@@ -1,13 +1,11 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-IN: html.templates.chloe.syntax
-USING: accessors kernel sequences combinators kernel namespaces
-classes.tuple assocs splitting words arrays memoize parser lexer
-io io.files io.encodings.utf8 io.streams.string
-unicode.case mirrors fry math urls
-multiline xml xml.data xml.writer xml.syntax
-html.components
+USING: accessors sequences combinators kernel namespaces classes.tuple
+assocs splitting words arrays memoize parser lexer io io.files
+io.encodings.utf8 io.streams.string unicode.case mirrors fry math urls
+multiline xml xml.data xml.writer xml.syntax html.components
 html.templates ;
+IN: html.templates.chloe.syntax
 
 SYMBOL: tags
 
index 21e9f8352d9119ba6c23edb760de9992022d5382..6c5e78e917b7f75a0f30bb11238427595c9e800e 100644 (file)
@@ -3,7 +3,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: continuations sequences kernel namespaces debugger
 combinators math quotations generic strings splitting accessors
-assocs fry vocabs.parser parser lexer io io.files
+assocs fry vocabs.parser parser parser.notes lexer io io.files
 io.streams.string io.encodings.utf8 html.templates ;
 IN: html.templates.fhtml
 
@@ -60,7 +60,7 @@ SYNTAX: %> lexer get parse-%> ;
     [
         "quiet" on
         parser-notes off
-        "html.templates.fhtml" use+
+        "html.templates.fhtml" use-vocab
         string-lines parse-template-lines
     ] with-file-vocabs ;
 
index e00f8e22636df0eb207625fc53f7cfad6669c80d..890518aa2ab1aab493ee888b124b400f4a71b8ba 100644 (file)
@@ -1,5 +1,5 @@
 USING: http help.markup help.syntax io.pathnames io.streams.string
-io.encodings.8-bit io.encodings.binary kernel strings urls
+io.encodings.8-bit io.encodings.binary kernel urls
 urls.encoding byte-arrays strings assocs sequences destructors
 http.client.post-data.private ;
 IN: http.client
index d1997c73f99a68bac7df3be38f08ecfe3ccb389e..2f6bcfafe9540150229b2ce27c5db7c9c85ce004 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs kernel math math.parser namespaces make
+USING: assocs kernel math math.parser namespaces make
 sequences strings splitting calendar continuations accessors vectors
 math.order hashtables byte-arrays destructors
 io io.sockets io.streams.string io.files io.timeouts
index 5c73377cbe5fb3bed094dc128c823b9f194d031b..f11aa9eaa232242e0e23d40211723d06c214ed03 100644 (file)
@@ -173,10 +173,10 @@ Set-Cookie: oo="bar; a=b"; comment="your mom"; httponly=yes
 ] unit-test
 
 ! Live-fire exercise
-USING: http.server http.server.static furnace.sessions furnace.alloy
-furnace.actions furnace.auth furnace.auth.login furnace.db http.client
-io.servers.connection io.files io.files.temp io.directories io io.encodings.ascii
-accessors namespaces threads
+USING: http.server.static furnace.sessions furnace.alloy
+furnace.actions furnace.auth furnace.auth.login furnace.db
+io.servers.connection io.files io.files.temp io.directories io
+threads
 http.server.responses http.server.redirection furnace.redirection
 http.server.dispatchers db.tuples ;
 
index 2520c35acb9b215eb6fedb5e36bcdd63f8e6fdda..1810617c560ddfcddbc26935952143ba613040c3 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: combinators.short-circuit math math.order math.parser
 kernel sequences sequences.deep peg peg.parsers assocs arrays
-hashtables strings unicode.case namespaces make ascii ;
+hashtables strings namespaces make ascii ;
 IN: http.parsers
 
 : except ( quot -- parser )
index 3beb73049929c3eda95af527c5418a777c893f8a..c838471e3f1b08f674302c79ff24b93f53f9ef89 100755 (executable)
@@ -17,7 +17,6 @@ io.servers.connection
 io.timeouts
 io.crlf
 fry logging logging.insomniac calendar urls urls.encoding
-mime.multipart
 unicode.categories
 http
 http.parsers
@@ -27,6 +26,7 @@ html.templates
 html.streams
 html
 xml.writer ;
+FROM: mime.multipart => parse-multipart ;
 IN: http.server
 
 : check-absolute ( url -- url )
@@ -283,8 +283,6 @@ M: http-server handle-client*
 : http-insomniac ( -- )
     "http.server" { "httpd-hit" } schedule-insomniac ;
 
-USE: vocabs.loader
-
 "http.server.filters" require
 "http.server.dispatchers" require
 "http.server.redirection" require
index 27b726f3c06a1f3c6e825c61c5b5115f3ff02287..d86b275635b48611f8456ec079e174c53ad64ec7 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: constructors kernel splitting unicode.case combinators
 accessors images.bitmap images.tiff images io.pathnames
-images.jpeg images.png ;
+images.png ;
 IN: images.loader
 
 ERROR: unknown-image-extension extension ;
@@ -12,8 +12,8 @@ ERROR: unknown-image-extension extension ;
         { "bmp" [ bitmap-image ] }
         { "tif" [ tiff-image ] }
         { "tiff" [ tiff-image ] }
-        { "jpg" [ jpeg-image ] }
-        { "jpeg" [ jpeg-image ] }
+        { "jpg" [ jpeg-image ] }
+        { "jpeg" [ jpeg-image ] }
         { "png" [ png-image ] }
         [ unknown-image-extension ]
     } case ;
index 694041a28d74f587b173708ea66753da721134e5..cbdf396b4810066e99a3030e82950befe8e0ec2d 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: sequences kernel math grouping fry columns locals accessors
-images math math.vectors arrays ;
+images math.vectors arrays ;
 IN: images.tesselation
 
 : group-rows ( bitmap bitmap-dim -- rows )
index 1de65fa91f8febc1f5002002cb8867f2dda5fd1a..ea965aac5b48e1922c9b946c325bf27326507c3c 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: io kernel macros make multiline namespaces parser
+USING: io kernel macros make multiline namespaces vocabs.parser
 present sequences strings splitting fry accessors ;
 IN: interpolate
 
index 4e807bd9923f18b8691cd22d4c3c9f34767f166b..7690b3441008044b9d0d7ccbe968d33b9174c442 100755 (executable)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007, 2009 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel words summary slots quotations
-sequences assocs math arrays stack-checker effects generalizations
+sequences assocs math arrays stack-checker effects
 continuations debugger classes.tuple namespaces make vectors
 bit-arrays byte-arrays strings sbufs math.functions macros
 sequences.private combinators mirrors splitting combinators.smart
index 49b5357d98a37f5ebcece45a175e6e38c10d1d96..c9396dd0813e04b0d5e48b9cbf4e8ef0f39b18fd 100644 (file)
@@ -3,7 +3,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.accessors alien.c-types
 alien.syntax kernel libc math sequences byte-arrays strings
-hints accessors math.order destructors combinators ;
+hints math.order destructors combinators ;
 IN: io.buffers
 
 TUPLE: buffer
index cecf103162510a5593a5b38df7623b1497711cc5..2be709dbc9bb71bdc14763ccec9e52718d7b84fe 100644 (file)
@@ -2,8 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: xml xml.data kernel io io.encodings interval-maps splitting fry
 math.parser sequences combinators assocs locals accessors math arrays
-byte-arrays values io.encodings.ascii ascii io.files biassocs
-math.order combinators.short-circuit io.binary io.encodings.iana ;
+byte-arrays values ascii io.files biassocs math.order
+combinators.short-circuit io.binary io.encodings.iana ;
+FROM: io.encodings.ascii => ascii ;
 IN: io.encodings.gb18030
 
 SINGLETON: gb18030
index 7b19f56b107b43a73f9b477ad8e13bd632db1d2b..d494e87dd7670afe86799e7ae9980f3e761d31d0 100644 (file)
@@ -1,4 +1,4 @@
-USING: io.files.info io.pathnames io.encodings.utf8 io.files
+USING: io.files.info io.encodings.utf8 io.files
 io.directories kernel io.pathnames accessors tools.test
 sequences io.files.temp ;
 IN: io.files.info.tests
index 72401004ae96dd0cf77222273e3e0f85eeddbb51..a8eb9b65a040ce940439728d1d2f155a6613e730 100644 (file)
@@ -6,6 +6,7 @@ io.files.unix kernel math.order namespaces sequences sorting
 system unix unix.statfs.linux unix.statvfs.linux io.files.links
 specialized-arrays.direct.uint arrays io.files.info.unix assocs
 io.pathnames unix.types ;
+FROM: csv => delimiter ;
 IN: io.files.info.unix.linux
 
 TUPLE: linux-file-system-info < unix-file-system-info
index 5d7502f68118b2ecd294f06c8e576c82340b7c31..5424ab423823c3d4bc0e88670cfd66a9673c66fb 100644 (file)
@@ -4,13 +4,10 @@ USING: accessors alien.c-types arrays assocs combinators
 continuations environment io io.backend io.backend.unix
 io.files io.files.private io.files.unix io.launcher
 io.launcher.unix.parser io.pathnames io.ports kernel math
-namespaces sequences strings system threads unix unix
+namespaces sequences strings system threads unix
 unix.process ;
 IN: io.launcher.unix
 
-! Search unix first
-USE: unix
-
 : get-arguments ( process -- seq )
     command>> dup string? [ tokenize-command ] when ;
 
index e03d5fb30b8c3f2954c08b0b9139b91d4f99762d..9a4443e8e5a738c87dd0d0ff2f42a85feeca9ad8 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: continuations destructors io.files io.files.info
 io.backend kernel quotations system alien alien.accessors
-accessors system vocabs.loader combinators alien.c-types
+accessors vocabs.loader combinators alien.c-types
 math ;
 IN: io.mmap
 
index e914f32a48da6b6923ba887e1da317d10047ae20..9097e7e864fe2cc923f332c894b13b2b941e2136 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel io.backend io.monitors io.monitors.recursive
-io.files io.pathnames io.buffers io.monitors io.ports io.timeouts
+io.files io.pathnames io.buffers io.ports io.timeouts
 io.backend.unix io.encodings.utf8 unix.linux.inotify assocs
 namespaces make threads continuations init math math.bitwise
 sets alien alien.strings alien.c-types vocabs.loader accessors
index f1f39a0559e93c0e0f377fa2513f35d2e2e93344..6580af891db57e6a7558ab6bd3c76f6dfded4656 100644 (file)
@@ -7,6 +7,7 @@ openssl.libcrypto openssl.libssl io io.files io.ports
 io.backend.unix io.sockets.unix io.encodings.ascii io.buffers
 io.sockets io.sockets.secure io.sockets.secure.openssl
 io.timeouts system summary fry ;
+FROM: io.ports => shutdown ;
 IN: io.sockets.secure.unix
 
 M: ssl-handle handle-fd file>> handle-fd ;
index a0beb1f421b3ac20602737ef597a49b859cd7c52..98b9a2ce237decfce4cf4f7fa54a882defe1fd79 100644 (file)
@@ -1,18 +1,17 @@
 ! Copyright (C) 2007, 2008 Slava Pestov, Doug Coleman,
 ! Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: generic kernel io.backend namespaces continuations
-sequences arrays io.encodings io.ports io.streams.duplex
-io.encodings.ascii alien.strings io.binary accessors destructors
-classes byte-arrays system combinators parser
-alien.c-types math.parser splitting grouping math assocs summary
-system vocabs.loader combinators present fry vocabs.parser ;
+USING: generic kernel io.backend namespaces continuations sequences
+arrays io.encodings io.ports io.streams.duplex io.encodings.ascii
+alien.strings io.binary accessors destructors classes byte-arrays
+parser alien.c-types math.parser splitting grouping math assocs
+summary system vocabs.loader combinators present fry vocabs.parser ;
 IN: io.sockets
 
 << {
     { [ os windows? ] [ "windows.winsock" ] }
     { [ os unix? ] [ "unix" ] }
-} cond use+ >>
+} cond use-vocab >>
 
 ! Addressing
 GENERIC: protocol-family ( addrspec -- af )
index 799dfa78d53be343e6224a08b653cf1458e37226..fe136cd88732b63636a410f0d9ad228944d109fe 100644 (file)
@@ -1,13 +1,13 @@
 ! Copyright (C) 2004, 2008 Slava Pestov, Ivan Tikhonov. 
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types alien.strings generic kernel math
-namespaces threads sequences byte-arrays io.ports
-io.binary io.backend.unix io.streams.duplex
-io.backend io.ports io.pathnames io.files.private
-io.encodings.utf8 math.parser continuations libc combinators
-system accessors destructors unix locals init ;
-
-EXCLUDE: io => read write close ;
+USING: alien alien.c-types alien.strings generic kernel math threads
+sequences byte-arrays io.binary io.backend.unix io.streams.duplex
+io.backend io.pathnames io.files.private io.encodings.utf8 math.parser
+continuations libc combinators system accessors destructors unix
+locals init ;
+
+EXCLUDE: namespaces => bind ;
+EXCLUDE: io => read write ;
 EXCLUDE: io.sockets => accept ;
 
 IN: io.sockets.unix
old mode 100644 (file)
new mode 100755 (executable)
index 49a1b2a..6d082f9
@@ -1,6 +1,6 @@
 USING: alien alien.accessors alien.c-types byte-arrays
 continuations destructors io.ports io.timeouts io.sockets
-io.sockets io namespaces io.streams.duplex io.backend.windows
+io namespaces io.streams.duplex io.backend.windows
 io.sockets.windows io.backend.windows.nt windows.winsock kernel
 libc math sequences threads system combinators accessors ;
 IN: io.sockets.windows.nt
index 7ed082234a0542847dc07a0a6a1b34c2071fd3c3..907c45360d9ca868c8744e5371aa1e2ad4c965a7 100644 (file)
@@ -15,8 +15,6 @@ SYNTAX: hello "Hi" print ;
 ] with-file-vocabs
 
 [
-    "debugger" use+
-
     [ [ \ + 1 2 3 4 ] ]
     [
         [
index 68777f2f73043fb34005f226d42a6e1a0979a2b1..4563f61ab79a146f08bf20a6d5a5dd6bcf0af38e 100644 (file)
@@ -10,7 +10,7 @@ IN: listener
 GENERIC: stream-read-quot ( stream -- quot/f )
 
 : parse-lines-interactive ( lines -- quot/f )
-    [ parse-lines in get ] with-compilation-unit in set ;
+    [ parse-lines ] with-compilation-unit ;
 
 : read-quot-step ( lines -- quot/f )
     [ parse-lines-interactive ] [
@@ -98,7 +98,7 @@ t error-summary? set-global
     ] [ drop ] if ;
 
 : prompt. ( -- )
-    in get auto-use? get [ " - auto" append ] when "( " " )" surround
+    current-vocab name>> auto-use? get [ " - auto" append ] when "( " " )" surround
     H{ { background T{ rgba f 1 0.7 0.7 1 } } } format bl flush ;
 
 :: (listener) ( datastack -- )
index 04886e2c1c8bae6c4c8cc1deda58ddef82774620..f21775bd9b7aee1cddf52ed002781fb1f4fbc8d8 100644 (file)
@@ -1,4 +1,4 @@
-USING: lists.lazy.examples lists.lazy tools.test ;
+USING: lists.lazy.examples lists.lazy lists tools.test ;
 IN: lists.lazy.examples.tests
 
 [ { 1 3 5 7 } ] [ 4 odds ltake list>array ] unit-test
index 1d5bb49f358960b5ab7723b1d3210829164b7a5c..11047f3e7c6b34da2b2e718d5edc49b8d5250594 100644 (file)
@@ -2,7 +2,7 @@
 ! Copyright (C) 2004 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 
-USING: lists.lazy math kernel sequences quotations ;
+USING: lists lists.lazy math kernel sequences quotations ;
 IN: lists.lazy.examples
 
 : naturals ( -- list ) 0 lfrom ;
index c46d3251a94f34ee201cc594a0ed1bd8c80e3070..0b1bfe2d02a06950ff5a8d790f1ff4fbc43cdb0c 100644 (file)
@@ -14,7 +14,7 @@ ARTICLE: "lists.lazy" "Lazy lists"
 
 ARTICLE: { "lists.lazy" "combinators" } "Combinators for manipulating lazy lists"
 "The following combinators create lazy lists from other lazy lists:"
-{ $subsection lmap }
+{ $subsection lazy-map }
 { $subsection lfilter }
 { $subsection luntil }
 { $subsection lwhile }
@@ -93,22 +93,12 @@ HELP: luntil
 { $values { "list" "a cons object" } { "quot" { $quotation "( X -- ? )" } } { "result" "resulting cons object" } }
 { $description "Outputs a lazy list containing the first items in the list until after " { $snippet "quot" } " evaluates to t. No evaluation of the list elements occurs initially but a " { $link <lazy-while> } " object is returned with conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required." } ;
 
-HELP: list>vector
-{ $values { "list" "a cons object" } { "vector" "the list converted to a vector" } }
-{ $description "Convert a list to a vector. If the list is a lazy infinite list then this will enter an infinite loop." } 
-{ $see-also list>array } ;
-
-HELP: list>array
-{ $values { "list" "a cons object" } { "array" "the list converted to an array" } }
-{ $description "Convert a list to an array. If the list is a lazy infinite list then this will enter an infinite loop." } 
-{ $see-also list>vector } ;
-
 HELP: lappend
 { $values { "list1" "a cons object" } { "list2" "a cons object" } { "result" "a lazy list of list2 appended to list1" } }
 { $description "Perform a similar functionality to that of the " { $link append } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-append> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required. Successive calls to " { $link cdr } " will iterate through list1, followed by list2." } ;
 
 HELP: lfrom-by
-{ $values { "n" "an integer" } { "quot" { $quotation "( -- int )" } } { "lazy-from-by" "a lazy list of integers" } }
+{ $values { "n" "an integer" } { "quot" { $quotation "( -- n )" } } { "lazy-from-by" "a lazy list of integers" } }
 { $description "Return an infinite lazy list of values starting from n, with each successive value being the result of applying quot to n." } ;
 
 HELP: lfrom
@@ -117,7 +107,7 @@ HELP: lfrom
 
 HELP: seq>list
 { $values { "index" "an integer 0 or greater" } { "seq" "a sequence" } { "list" "a list" } }
-{ $description "Convert the sequence into a list, starting from the 'index' offset into the sequence." } 
+{ $description "Convert the sequence into a list, starting from " { $snippet "index" } "." }
 { $see-also >list } ;
 
 HELP: >list
@@ -154,7 +144,7 @@ HELP: lmerge
 { $values { "list1" "a list" } { "list2" "a list" } { "result" "lazy list merging list1 and list2" } }
 { $description "Return the result of merging the two lists in a lazy manner." } 
 { $examples
-  { $example "USING: lists.lazy prettyprint ;" "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" }
+  { $example "USING: lists lists.lazy prettyprint ;" "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" }
 } ;
 
 HELP: lcontents
index 64a3f099a0ed5056ecfe327aa3482fa38dc4e905..49aee471bf8f407feabc8f6cc6757d3f0c12515f 100644 (file)
@@ -178,12 +178,6 @@ M: lazy-filter nil? ( lazy-filter -- bool )
         ] if
     ] if ;
 
-: list>vector ( list -- vector )
-    [ [ , ] leach ] V{ } make ;
-
-: list>array ( list -- array )
-    [ [ , ] leach ] { } make ;
-
 TUPLE: lazy-append list1 list2 ;
 
 C: <lazy-append> lazy-append
index 8782c3d9b4082d4026140a1a2128ce005eb2d115..1fdce5d51da9dc5b25319135788a061cd5190e02 100644 (file)
@@ -14,7 +14,7 @@ ARTICLE: "lists" "Lists"
 { $vocab-subsection "Lazy lists" "lists.lazy" } ;
 
 ARTICLE: { "lists" "protocol" } "The list protocol"
-"Lists are instances of a mixin class"
+"Lists are instances of a mixin class:"
 { $subsection list }
 "Instances of the mixin must implement the following words:"
 { $subsection car }
@@ -25,8 +25,7 @@ ARTICLE: { "lists" "strict" } "Constructing strict lists"
 "Strict lists are simply cons cells where the car and cdr have already been evaluated. These are the lists of Lisp. To construct a strict list, the following words are provided:"
 { $subsection cons }
 { $subsection swons }
-{ $subsection sequence>cons }
-{ $subsection deep-sequence>cons }
+{ $subsection sequence>list }
 { $subsection 1list }
 { $subsection 2list }
 { $subsection 3list } ;
@@ -38,7 +37,6 @@ ARTICLE: { "lists" "combinators" } "Combinators for lists"
 { $subsection foldl }
 { $subsection foldr }
 { $subsection lmap>array }
-{ $subsection lmap-as }
 { $subsection traverse } ;
 
 ARTICLE: { "lists" "manipulation" } "Manipulating lists"
@@ -54,21 +52,21 @@ ARTICLE: { "lists" "manipulation" } "Manipulating lists"
 { $subsection lcut } ;
 
 HELP: cons 
-{ $values { "car" "the head of the list cell" } { "cdr" "the tail of the list cell" } { "cons" "a cons object" } }
+{ $values { "car" "the head of the list cell" } { "cdr" "the tail of the list cell" } { "cons" list } }
 { $description "Constructs a cons cell." } ;
 
 HELP: swons 
-{ $values { "cdr" "the tail of the list cell" } { "car" "the head of the list cell" } { "cons" "a cons object" } }
+{ $values { "cdr" "the tail of the list cell" } { "car" "the head of the list cell" } { "cons" list } }
 { $description "Constructs a cons cell." } ;
 
 { cons swons uncons unswons } related-words
 
 HELP: car
-{ $values { "cons" "a cons object" } { "car" "the first item in the list" } }
+{ $values { "cons" list } { "car" "the first item in the list" } }
 { $description "Returns the first item in the list." } ;
 
 HELP: cdr
-{ $values { "cons" "a cons object" } { "cdr" "a cons object" } }
+{ $values { "cons" list } { "cdr" list } }
 { $description "Returns the tail of the list." } ;
 
 { car cdr } related-words
@@ -86,51 +84,51 @@ HELP: nil?
 { 1list 2list 3list } related-words
 
 HELP: 1list
-{ $values { "obj" "an object" } { "cons" "a cons object" } }
+{ $values { "obj" "an object" } { "cons" list } }
 { $description "Create a list with 1 element." } ;
 
 HELP: 2list
-{ $values { "a" "an object" } { "b" "an object" } { "cons" "a cons object" } }
+{ $values { "a" "an object" } { "b" "an object" } { "cons" list } }
 { $description "Create a list with 2 elements." } ;
 
 HELP: 3list
-{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" "a cons object" } }
+{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" list } }
 { $description "Create a list with 3 elements." } ;
 
 HELP: lnth
-{ $values { "n" "an integer index" } { "list" "a cons object" } { "elt" "the element at the nth index" } }
+{ $values { "n" "an integer index" } { "list" list } { "elt" "the element at the nth index" } }
 { $description "Outputs the nth element of the list." } 
 { $see-also llength cons car cdr } ;
 
 HELP: llength
-{ $values { "list" "a cons object" } { "n" "a non-negative integer" } }
+{ $values { "list" list } { "n" "a non-negative integer" } }
 { $description "Outputs the length of the list. This should not be called on an infinite list." } 
 { $see-also lnth cons car cdr } ;
 
 HELP: uncons
-{ $values { "cons" "a cons object" } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
+{ $values { "cons" list } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
 { $description "Put the head and tail of the list on the stack." } ;
 
 HELP: unswons
-{ $values { "cons" "a cons object" } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
+{ $values { "cons" list } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
 { $description "Put the head and tail of the list on the stack." } ;
 
 { leach foldl lmap>array } related-words
 
 HELP: leach
-{ $values { "list" "a cons object" } { "quot" { $quotation "( obj -- )" } } }
+{ $values { "list" list } { "quot" { $quotation "( obj -- )" } } }
 { $description "Call the quotation for each item in the list." } ;
 
 HELP: foldl
-{ $values { "list" "a cons object" } { "identity" "an object" } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
+{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
 { $description "Combines successive elements of the list (in a left-assocative order) using a binary operation and outputs the final result." } ;
 
 HELP: foldr
-{ $values { "list" "a cons object" } { "identity" "an object" } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
+{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation "( prev elt -- next )" } } { "result" "the final result" } }
 { $description "Combines successive elements of the list (in a right-assocative order) using a binary operation, and outputs the final result." } ;
 
 HELP: lmap
-{ $values { "list" "a cons object" } { "quot" { $quotation "( old -- new )" } } { "result" "the final result" } }
+{ $values { "list" list } { "quot" { $quotation "( old -- new )" } } { "result" "the final result" } }
 { $description "Applies the quotation to each element of the list in order, collecting the new elements into a new list." } ;
 
 HELP: lreverse
@@ -138,23 +136,11 @@ HELP: lreverse
 { $description "Reverses the input list, outputing a new, reversed list. The output is a strict cons list." } ;
 
 HELP: list>array    
-{ $values { "list" "a cons object" } { "array" array } }
-{ $description "Turns the given cons object into an array, maintaing order." } ;
-
-HELP: sequence>cons
-{ $values { "sequence" sequence } { "list" cons } }
-{ $description "Turns the given array into a cons object, maintaing order." } ;
-
-HELP: deep-list>array
 { $values { "list" list } { "array" array } }
-{ $description "Recursively turns the given cons object into an array, maintaing order and also converting nested lists." } ;
-
-HELP: deep-sequence>cons
-{ $values { "sequence" sequence } { "cons" cons } }
-{ $description "Recursively turns the given sequence into a cons object, maintaing order and also converting nested lists." } ;
+{ $description "Convert a list into an array." } ;
 
 HELP: traverse    
-{ $values { "list"  "a cons object" } { "pred" { $quotation "( list/elt -- ? )" } }
+{ $values { "list"  list } { "pred" { $quotation "( list/elt -- ? )" } }
           { "quot" { $quotation "( list/elt -- result)" } }  { "result" "a new cons object" } }
 { $description "Recursively traverses the list object, replacing any elements (which can themselves be sublists) that pred" 
  " returns true for with the result of applying quot to." } ;
@@ -178,6 +164,3 @@ HELP: lmap>array
 { $values { "list" list } { "quot" quotation } { "array" array } }
 { $description "Executes the quotation on each element of the list, collecting the results in an array." } ;
 
-HELP: lmap-as
-{ $values { "list" list } { "quot" quotation } { "exemplar" sequence } { "sequence" sequence } }
-{ $description "Executes the quotation on each element of the list, collecting the results in a sequence of the type given by the exemplar." } ;
index 13d2e03e0f1f816ac7eb865ce2fade09b5a974a6..e34a719c57835a25ebfd610bcd719cd59c53fe2c 100644 (file)
@@ -4,7 +4,7 @@ USING: tools.test lists math kernel ;
 IN: lists.tests
 
 { { 3 4 5 6 7 } } [
-    { 1 2 3 4 5 } sequence>cons [ 2 + ] lmap list>array
+    { 1 2 3 4 5 } sequence>list [ 2 + ] lmap list>array
 ] unit-test
 
 { { 3 4 5 6 } } [
@@ -23,49 +23,24 @@ IN: lists.tests
                 +nil+ } } } } 0 [ + ] foldl
 ] unit-test
     
-{ T{ cons f
-      1
-      T{ cons f
-          2
-          T{ cons f
-              T{ cons f
-                  3
-                  T{ cons f
-                      4
-                      T{ cons f
-                          T{ cons f 5 +nil+ }
-                          +nil+ } } }
-          +nil+ } } }
-} [
-    { 1 2 { 3 4 { 5 } } } deep-sequence>cons
-] unit-test
-    
-{ { 1 2 { 3 4 { 5 } } } } [
-  { 1 2 { 3 4 { 5 } } } deep-sequence>cons deep-list>array
-] unit-test
-    
 { T{ cons f 2 T{ cons f 3 T{ cons f 4 T{ cons f 5 +nil+ } } } } } [
-    { 1 2 3 4 } sequence>cons [ 1+ ] lmap
+    { 1 2 3 4 } sequence>list [ 1+ ] lmap
 ] unit-test
     
 { 15 } [
- { 1 2 3 4 5 } sequence>cons 0 [ + ] foldr
+ { 1 2 3 4 5 } sequence>list 0 [ + ] foldr
 ] unit-test
     
 { { 5 4 3 2 1 } } [
-    { 1 2 3 4 5 } sequence>cons lreverse list>array
+    { 1 2 3 4 5 } sequence>list lreverse list>array
 ] unit-test
     
 { 5 } [
-    { 1 2 3 4 5 } sequence>cons llength
-] unit-test
-    
-{ { 3 4 { 5 6 { 7 } } } } [
-  { 1 2 { 3 4 { 5 } } } deep-sequence>cons [ atom? ] [ 2 + ] traverse deep-list>array
+    { 1 2 3 4 5 } sequence>list llength
 ] unit-test
     
 { { 1 2 3 4 5 6 } } [
-    { 1 2 3 } sequence>cons { 4 5 6 } sequence>cons lappend list>array
+    { 1 2 3 } sequence>list { 4 5 6 } sequence>list lappend list>array
 ] unit-test
 
-[ { 1 } { 2 } ] [ { 1 2 } sequence>cons 1 lcut [ list>array ] bi@ ] unit-test
+[ { 1 } { 2 } ] [ { 1 2 } sequence>list 1 lcut [ list>array ] bi@ ] unit-test
index fecb76f1c0ac33e60bd7d85d6bfdda8b4e4500d3..0eedb808891605748f2857c2d0c1d4bb9d4dcad0 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 James Cash
+! Copyright (C) 2008 James Cash, Daniel Ehrenberg, Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel sequences accessors math arrays vectors classes words
 combinators.short-circuit combinators locals ;
@@ -14,57 +14,45 @@ TUPLE: cons { car read-only } { cdr read-only } ;
 
 C: cons cons
 
-M: cons car ( cons -- car )
-    car>> ;
+M: cons car ( cons -- car ) car>> ;
 
-M: cons cdr ( cons -- cdr )
-    cdr>> ;
+M: cons cdr ( cons -- cdr ) cdr>> ;
 
 SINGLETON: +nil+
 M: +nil+ nil? drop t ;
 M: object nil? drop f ;
 
-: atom? ( obj -- ? )
-    list? not ;
+: atom? ( obj -- ? ) list? not ; inline
 
-: nil ( -- symbol ) +nil+ ; 
+: nil ( -- symbol ) +nil+ ; inline
 
-: uncons ( cons -- car cdr )
-    [ car ] [ cdr ] bi ;
+: uncons ( cons -- car cdr ) [ car ] [ cdr ] bi ; inline
 
-: swons ( cdr car -- cons )
-    swap cons ;
+: swons ( cdr car -- cons ) swap cons ; inline
 
-: unswons ( cons -- cdr car )
-    uncons swap ;
+: unswons ( cons -- cdr car ) uncons swap ; inline
 
-: 1list ( obj -- cons )
-    nil cons ;
+: 1list ( obj -- cons ) nil cons ; inline
 
-: 1list? ( list -- ? )
-    { [ nil? not ] [ cdr nil? ] } 1&& ;
+: 1list? ( list -- ? ) { [ nil? not ] [ cdr nil? ] } 1&& ; inline
 
-: 2list ( a b -- cons )
-    nil cons cons ;
+: 2list ( a b -- cons ) nil cons cons ; inline
 
-: 3list ( a b c -- cons )
-    nil cons cons cons ;
+: 3list ( a b c -- cons ) nil cons cons cons ; inline
 
-: cadr ( list -- elt )    
-    cdr car ;
+: cadr ( list -- elt ) cdr car ; inline
  
-: 2car ( list -- car caar )    
-    [ car ] [ cdr car ] bi ;
+: 2car ( list -- car caar ) [ car ] [ cdr car ] bi ; inline
  
-: 3car ( list -- car cadr caddr )    
-    [ car ] [ cdr car ] [ cdr cdr car ] tri ;
+: 3car ( list -- car cadr caddr ) [ car ] [ cdr car ] [ cdr cdr car ] tri ; inline
 
-: lnth ( n list -- elt )
-    swap [ cdr ] times car ;
+: lnth ( n list -- elt ) swap [ cdr ] times car ; inline
 
 <PRIVATE
+
 : (leach) ( list quot -- cdr quot )
     [ [ car ] dip call ] [ [ cdr ] dip ] 2bi ; inline
+
 PRIVATE>
 
 : leach ( list quot: ( elt -- ) -- )
@@ -93,49 +81,16 @@ PRIVATE>
 
 : lcut ( list index -- before after )
     [ nil ] dip
-    [ [ [ cdr ] [ car ] bi ] dip cons ] times
+    [ [ unswons ] dip cons ] times
     lreverse swap ;
 
-: sequence>cons ( sequence -- list )    
-    <reversed> nil [ swap cons ] reduce ;
-
-<PRIVATE
-: same? ( obj1 obj2 -- ? ) 
-    [ class ] bi@ = ;
-PRIVATE>
-
-: deep-sequence>cons ( sequence -- cons )
-    [ <reversed> ] keep nil
-    [ [ nip ] [ same? ] 2bi [ deep-sequence>cons ] when swons ]
-    with reduce ;
-
-<PRIVATE
-:: (lmap>vector) ( acc list quot: ( elt -- elt' ) -- acc )
-    list nil? [ acc ] [
-        list car quot call acc push
-        acc list cdr quot (lmap>vector)
-    ] if ; inline recursive
-
-: lmap>vector ( list quot -- array )
-    [ V{ } clone ] 2dip (lmap>vector) ; inline
-PRIVATE>
-
-: lmap-as ( list quot exemplar -- sequence )
-    [ lmap>vector ] dip like ; inline
+: sequence>list ( sequence -- list )    
+    <reversed> nil [ swons ] reduce ;
 
 : lmap>array ( list quot -- array )
-    { } lmap-as ; inline
-
-: deep-list>array ( list -- array )    
-    [
-        {
-            { [ dup nil? ] [ drop { } ] }
-            { [ dup list? ] [ deep-list>array ] }
-            [ ]
-        } cond
-    ] lmap>array ;
-
-: list>array ( list -- array )    
+    accumulator [ leach ] dip { } like ; inline
+
+: list>array ( list -- array )  
     [ ] lmap>array ;
 
 :: traverse ( list pred quot: ( list/elt -- result ) -- result )
index 9dd398d962425b56c5a8b7bac3be42bb2b599fc5..9ec8e30133f5df95d918eaabc0a965e2d59f2943 100644 (file)
@@ -65,7 +65,7 @@ ${ five six 7 } .
 ARTICLE: "literals" "Interpolating code results into literal values"
 "The " { $vocab-link "literals" } " vocabulary contains words to run code at parse time and insert the results into more complex literal values."
 { $example <"
-USING: kernel literals math prettyprint ;
+USE: literals
 IN: scratchpad
 
 CONSTANT: five 5
index 1549a776631bf1252af7a32e28917c2f588f7807..414b2da45c96cfb049bc3ce9ebb9ec8ff72bfb54 100644 (file)
@@ -126,14 +126,6 @@ write-test-2 "q" set
 
 [ 9 ] [ 4 write-test-5 ] unit-test
 
-SYMBOL: a
-
-:: use-test ( a b c -- a b c )
-    USE: kernel
-    a b c ;
-
-[ t ] [ a symbol? ] unit-test
-
 :: let-let-test ( n -- n ) [let | n [ n 3 + ] | n ] ;
 
 [ 13 ] [ 10 let-let-test ] unit-test
index 5e9bdfbed6620286d98de669903471bc4d5d2b99..8cfe45d1ba7e53e1265b693c2168342e5da4b5ee 100644 (file)
@@ -25,12 +25,6 @@ SYMBOL: in-lambda?
     [ <local-word> [ dup name>> set ] [ ] [ ] tri ] dip
     "local-word-def" set-word-prop ;
 
-: push-locals ( assoc -- )
-    use get push ;
-
-: pop-locals ( assoc -- )
-    use get delq ;
-
 SINGLETON: lambda-parser
 
 SYMBOL: locals
@@ -39,7 +33,9 @@ SYMBOL: locals
     '[
         in-lambda? on
         lambda-parser quotation-parser set
-        [ locals set ] [ push-locals @ ] [ pop-locals ] tri
+        [ locals set ]
+        [ use-words @ ]
+        [ unuse-words ] tri
     ] with-scope ; inline
     
 : (parse-lambda) ( assoc -- quot )
@@ -81,9 +77,9 @@ M: lambda-parser parse-quotation ( -- quotation )
 
 : parse-bindings* ( end -- words assoc )
     [
-        namespace push-locals
+        namespace use-words
         (parse-bindings)
-        namespace pop-locals
+        namespace unuse-words
     ] with-bindings ;
 
 : parse-let* ( -- form )
index 7dced852fd18411963168d10c871a36a0c38bf04..8374ab421bd214dfcd4ea71c0ee3b8815a923bd4 100644 (file)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2008 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: namespaces kernel io io.files io.pathnames io.directories\r
-io.sockets io.encodings.utf8\r
-calendar calendar.format sequences continuations destructors\r
-prettyprint assocs math.parser words debugger math combinators\r
-concurrency.messaging threads arrays init math.ranges strings ;\r
+io.encodings.utf8 calendar calendar.format sequences continuations\r
+destructors prettyprint assocs math.parser words debugger math\r
+combinators concurrency.messaging threads arrays init math.ranges\r
+strings ;\r
 IN: logging.server\r
 \r
 : log-root ( -- string )\r
index a51b86ff0b44a8330592d2f5fed8b2b6b112458f..9cb80447e55a19ee1e35c483bb8fec56c656f3df 100644 (file)
@@ -4,9 +4,9 @@ IN: math.complex
 
 ARTICLE: "complex-numbers-zero" "Embedding of real numbers in complex numbers"
 "Constructing a complex number with an imaginary component equal to an integer zero simply returns the real number corresponding to the real component:"
-{ $example "USING: math prettyprint ;" "C{ 1 2 } C{ 3 -2 } + ." "4" }
+{ $example "C{ 1 2 } C{ 3 -2 } + ." "4" }
 "Constructing a complex number with an imaginary component equal to floating point zero will still output a new complex number, however:"
-{ $example "USING: math prettyprint ;" "C{ 0.0 2.0 } C{ 0.0 1.0 } * ." "C{ -2.0 0.0 }" }
+{ $example "C{ 0.0 2.0 } C{ 0.0 1.0 } * ." "C{ -2.0 0.0 }" }
 "Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero." ;
 
 ARTICLE: "complex-numbers" "Complex numbers"
index a1abd9aeea1b79fc3254b12b441e73066301f4b1..c8bc8d8e54f0de954b0d3da675d12e049b57eeff 100644 (file)
@@ -2,6 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: accessors kernel models arrays sequences math math.order\r
 models.product ;\r
+FROM: models.product => product ;\r
 IN: models.range\r
 \r
 TUPLE: range < product ;\r
index ccd3f5fad74e2ed9806fe53f5b349fe91a3efd47..9aa4ee429d869ab3882277ad943e3fb819e082fe 100644 (file)
@@ -9,7 +9,7 @@ ERROR: unknown-gl-platform ;
     { [ os macosx? ]  [ "opengl.gl.macosx" ] }
     { [ os unix? ] [ "opengl.gl.unix" ] }
     [ unknown-gl-platform ]
-} cond use+ >>
+} cond use-vocab >>
 
 SYMBOL: +gl-function-number-counter+
 SYMBOL: +gl-function-pointers+
index 3efdb43cd8b9616c4a662b5fe3458ce5fb06af79..24f43c52ac4b0fcf248133ffc7ef5d51c3135c48 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: tools.test opengl.textures opengl.textures.private
-opengl.textures.private images kernel namespaces accessors
-sequences ;
+images kernel namespaces accessors sequences ;
 IN: opengl.textures.tests
 
 [
index 49725d22427d2a5dcd494aeab97bb05766e1e460..f0edab23a3bef96cf3775dbbd3ee57ca8180f370 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs cache colors.constants destructors fry kernel
+USING: accessors assocs cache colors.constants destructors kernel
 opengl opengl.gl opengl.capabilities combinators images
 images.tesselation grouping specialized-arrays.float sequences math
 math.vectors math.matrices generalizations fry arrays namespaces
index b50ba685b8c06582583cb370ca972ac4660859a8..f3d555d5a1447bcbef67ce63df5c83398ba593dd 100644 (file)
@@ -1,11 +1,13 @@
 ! Copyright (C) 2007 Chris Double.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: kernel compiler.units words arrays strings math.parser\r
+USING: kernel words arrays strings math.parser\r
 sequences quotations vectors namespaces make math assocs\r
 continuations peg peg.parsers unicode.categories multiline\r
 splitting accessors effects sequences.deep peg.search\r
 combinators.short-circuit lexer io.streams.string stack-checker\r
 io combinators parser summary ;\r
+FROM: compiler.units => with-compilation-unit ;\r
+FROM: vocabs.parser => search ;\r
 IN: peg.ebnf\r
 \r
 : rule ( name word -- parser )\r
@@ -441,7 +443,7 @@ M: ebnf-sequence build-locals ( code ast -- code )
       drop \r
     ] [ \r
       [\r
-        "USING: locals sequences ;  [let* | " %\r
+        "FROM: locals => [let* ; FROM: sequences => nth ; [let* | " %\r
           dup length swap [\r
             dup ebnf-var? [\r
               name>> % \r
@@ -459,7 +461,7 @@ M: ebnf-sequence build-locals ( code ast -- code )
 \r
 M: ebnf-var build-locals ( code ast -- )\r
   [\r
-    "USING: locals kernel ;  [let* | " %\r
+    "FROM: locals => [let* ; FROM: kernel => dup nip ; [let* | " %\r
     name>> % " [ dup ] " %\r
     " | " %\r
     %  \r
index cae1e05dc820c37a684a53da5181f2803c5c89f6..501b8ed85630ccf34d231a7eb20d90bb2de35176 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 !
 USING: kernel tools.test strings namespaces make arrays sequences 
-       peg peg.private peg.parsers accessors words math accessors ;
+       peg peg.private peg.parsers words math accessors ;
 IN: peg.tests
 
 [ ] [ reset-pegs ] unit-test
index dda36432e729aafd7184a96e9d2f46f323425128..12e6d59fc01885484737f7ea572688b851df947d 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2007, 2008 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel sequences strings fry namespaces make math assocs
-io vectors arrays math.parser math.order vectors combinators
+io vectors arrays math.parser math.order combinators
 classes sets unicode.categories compiler.units parser words
-quotations effects memoize accessors locals effects splitting
+quotations memoize accessors locals splitting
 combinators.short-circuit generalizations ;
 IN: peg
 
index 3dcd7fb0ede27ec5079c4488793191d1d723be25..27416e0f89d9b35277f017301bf2bc582aecdc2d 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2003, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays byte-arrays byte-vectors generic hashtables io
+USING: accessors arrays byte-arrays byte-vectors generic hashtables
 assocs kernel math namespaces make sequences strings sbufs vectors
 words prettyprint.config prettyprint.custom prettyprint.sections
 quotations io io.pathnames io.styles math.parser effects classes.tuple
@@ -188,6 +188,7 @@ M: tuple >pprint-sequence
     [ 1array ] [ [ f 2array ] dip append ] if-empty ;
 
 M: object pprint-narrow? drop f ;
+M: byte-vector pprint-narrow? drop f ;
 M: array pprint-narrow? drop t ;
 M: vector pprint-narrow? drop t ;
 M: hashtable pprint-narrow? drop t ;
index f938ab30f763b32e77383b9b253f60bcbcdcdddd..fbbece46028ae2bb7f9b991bd9a15fd03f035d66 100644 (file)
@@ -1,5 +1,5 @@
 USING: prettyprint.backend prettyprint.config prettyprint.custom
-prettyprint.sections prettyprint.private help.markup help.syntax
+prettyprint.sections help.markup help.syntax
 io kernel words definitions quotations strings generic classes
 prettyprint.private ;
 IN: prettyprint
@@ -161,10 +161,6 @@ $nl
 
 ABOUT: "prettyprint"
 
-HELP: with-pprint
-{ $values { "obj" object } { "quot" quotation } }
-{ $description "Sets up the prettyprinter and calls the quotation in a new scope. The quotation should add sections to the top-level block. When the quotation returns, the top-level block is printed to " { $link output-stream } "." } ;
-
 HELP: pprint
 { $values { "obj" object } }
 { $description "Prettyprints an object to " { $link output-stream } ". Output is influenced by many variables; see " { $link "prettyprint-variables" } "." }
@@ -225,8 +221,3 @@ HELP: .r
 
 HELP: .s
 { $description "Displays the contents of the data stack, with the top of the stack printed first." } ;
-
-HELP: in.
-{ $values { "vocab" "a vocabulary specifier" } }
-{ $description "Prettyprints a " { $snippet "IN:" } " declaration." }
-$prettyprinting-note ;
\ No newline at end of file
index 25ee83985ef58e61eedfeef6319c9a18e09dff0d..cd10278760c5b2e466adc7dc5b08c91515082359 100644 (file)
@@ -91,15 +91,13 @@ unit-test
 
 : check-see ( expect name -- ? )
     [
-        use [ clone ] change
-
         [
             [ parse-fresh drop ] with-compilation-unit
             [
                 "prettyprint.tests" lookup see
             ] with-string-writer "\n" split but-last
         ] keep =
-    ] with-scope ;
+    ] with-interactive-vocabs ;
 
 GENERIC: method-layout ( a -- b )
 
index 2286417dd1d71aef5a6fa12ec0228e9e12319d30..99913a803abaaa5788df469c15b6c38743759458 100644 (file)
@@ -4,78 +4,16 @@ USING: arrays accessors assocs colors combinators grouping io
 io.streams.string io.styles kernel make math math.parser namespaces
 parser prettyprint.backend prettyprint.config prettyprint.custom
 prettyprint.sections quotations sequences sorting strings vocabs
-vocabs.parser words sets ;
+vocabs.prettyprint words sets ;
 IN: prettyprint
 
-<PRIVATE
-
-: make-pprint ( obj quot -- block in use )
-    [
-        0 position set
-        H{ } clone pprinter-use set
-        V{ } clone recursion-check set
-        V{ } clone pprinter-stack set
-        over <object
-        call
-        pprinter-block
-        pprinter-in get
-        pprinter-use get keys
-    ] with-scope ; inline
-
-: with-pprint ( obj quot -- )
-    make-pprint 2drop do-pprint ; inline
-
-: pprint-vocab ( vocab -- )
-    dup vocab present-text ;
-
-: write-in ( vocab -- )
-    [ \ IN: pprint-word pprint-vocab ] with-pprint ;
-
-: in. ( vocab -- )
-    [ write-in ] when* ;
-
-: use. ( seq -- )
-    [
-        natural-sort [
-            \ USING: pprint-word
-            [ pprint-vocab ] each
-            \ ; pprint-word
-        ] with-pprint
-    ] unless-empty ;
-
-: use/in. ( in use -- )
-    over "syntax" 2array diff
-    [ nip use. ]
-    [ empty? not and [ nl ] when ]
-    [ drop in. ]
-    2tri ;
-
-: vocab-names ( words -- vocabs )
-    dictionary get
-    [ [ words>> eq? nip ] with assoc-find 2drop ] curry map sift ;
-
-: prelude. ( -- )
-    in get use get vocab-names prune in get ".private" append swap remove use/in. ;
-
-[
-    nl
-    { { font-style bold } { font-name "sans-serif" } } [
-        "Restarts were invoked adding vocabularies to the search path." print
-        "To avoid doing this in the future, add the following USING:" print
-        "and IN: forms at the top of the source file:" print nl
-    ] with-style
-    { { page-color T{ rgba f 0.8 0.8 0.8 1.0 } } } [ prelude. ] with-nesting
-    nl nl
-] print-use-hook set-global
-
-PRIVATE>
-
 : with-use ( obj quot -- )
-    make-pprint [ use/in. ] [ empty? not or [ nl ] when ] 2bi
+    make-pprint (pprint-manifest
+    [ pprint-manifest) ] [ [ drop nl ] unless-empty ] bi
     do-pprint ; inline
 
 : with-in ( obj quot -- )
-    make-pprint drop [ write-in bl ] when* do-pprint ; inline
+    make-pprint current-vocab>> [ pprint-in bl ] when* do-pprint ; inline
 
 : pprint ( obj -- ) [ pprint* ] with-pprint ;
 
index ce7430d04046ff1c408347aa336671d67cf3dd9e..f0d369297c42fec64d0b29e9ac261cad4e6c63ea 100644 (file)
@@ -1,6 +1,6 @@
 USING: prettyprint io kernel help.markup help.syntax
 prettyprint.config words hashtables math
-strings definitions ;
+strings definitions quotations ;
 IN: prettyprint.sections
 
 HELP: position
@@ -13,7 +13,6 @@ HELP: line-limit?
 { $values { "?" "a boolean" } }
 { $description "Tests if the line number limit has been reached, and thus if prettyprinting should stop." } ;
 
-
 HELP: do-indent
 { $description "Outputs the current indent nesting to " { $link output-stream } "." } ;
 
@@ -211,3 +210,7 @@ $prettyprinting-note ;
 HELP: do-pprint
 { $values { "block" block } }
 { $description "Recursively output all children of the given block. The continuation is restored and output terminates if the line length is exceeded; this test is performed in " { $link fresh-line } "." } ;
+
+HELP: with-pprint
+{ $values { "obj" object } { "quot" quotation } }
+{ $description "Sets up the prettyprinter and calls the quotation in a new scope. The quotation should add sections to the top-level block. When the quotation returns, the top-level block is printed to " { $link output-stream } "." } ;
index faa254be6914688fc8afe28a9e2cfcf6b00142bc..b4eb40757d7d974bab75d85a201a38fe70f7564e 100644 (file)
@@ -1,9 +1,9 @@
-! Copyright (C) 2003, 2008 Slava Pestov.
+! Copyright (C) 2003, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays generic hashtables io kernel math assocs
 namespaces make sequences strings io.styles vectors words
 prettyprint.config splitting classes continuations
-accessors sets ;
+accessors sets vocabs.parser combinators vocabs ;
 IN: prettyprint.sections
 
 ! State
@@ -19,8 +19,16 @@ TUPLE: pprinter last-newline line-count indent ;
 
 : <pprinter> ( -- pprinter ) 0 1 0 pprinter boa ;
 
+: (record-vocab) ( vocab -- )
+    dup pprinter-in get dup [ vocab-name ] when =
+    [ drop ] [ pprinter-use get conjoin ] if ;
+
 : record-vocab ( word -- )
-    vocabulary>> [ pprinter-use get conjoin ] when* ;
+    vocabulary>> {
+        { f [ ] }
+        { "syntax" [ ] }
+        [ (record-vocab) ]
+    } case ;
 
 ! Utility words
 : line-limit? ( -- ? )
@@ -326,3 +334,25 @@ M: block long-section ( block -- )
             ] each
         ] each
     ] if-nonempty ;
+
+: pprinter-manifest ( -- manifest )
+    <manifest>
+    [ [ pprinter-use get keys >vector ] dip (>>search-vocabs) ]
+    [ [ pprinter-in get ] dip (>>current-vocab) ]
+    [ ]
+    tri ;
+
+: make-pprint ( obj quot -- block manifest )
+    [
+        0 position set
+        H{ } clone pprinter-use set
+        V{ } clone recursion-check set
+        V{ } clone pprinter-stack set
+        over <object
+        call
+        pprinter-block
+        pprinter-manifest
+    ] with-scope ; inline
+
+: with-pprint ( obj quot -- )
+    make-pprint drop do-pprint ; inline
\ No newline at end of file
index e0cb83c33030bec8d896f94f798ec904fa2409a2..dadf93fd439f09593663e2459c89f8352a0ce483 100644 (file)
@@ -1,4 +1,4 @@
-USING: kernel random math accessors random ;
+USING: kernel math accessors random ;
 IN: random.dummy
 
 TUPLE: random-dummy i ;
index 361ba7719e2304ab5eb0adbbb2484d45e71dc4f0..a02abbb8ac8262d03dd51e933070f0d724955cc0 100644 (file)
@@ -69,8 +69,6 @@ M: mersenne-twister random-32* ( mt -- r )
     [ seq>> nth-unsafe mt-temper ]
     [ [ 1+ ] change-i drop ] tri ;
 
-USE: init
-
 [
     [ 32 random-bits ] with-system-random
     <mersenne-twister> random-generator set-global
index 661e77125805dc683bde2953e6de78528a0fd7d3..1962857d573181a1da1b5a2a3291d2825a8ae8cb 100755 (executable)
@@ -86,8 +86,6 @@ PRIVATE>
     [ 1.0 swap - log -2.0 * sqrt ]
     bi* * * + ;
 
-USE: vocabs.loader
-
 {
     { [ os windows? ] [ "random.windows" require ] }
     { [ os unix? ] [ "random.unix" require ] }
index a1c4e3ca2a53cc3e01725d62f307a8a45b3e823c..e3e2f0bcf3fda5a0d63e7379fd5eec6de0cc2fdf 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2008, 2009 Doug Coleman, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel math math.order words combinators locals
-ascii unicode.categories combinators.short-circuit sequences
+unicode.categories combinators.short-circuit sequences
 fry macros arrays assocs sets classes mirrors unicode.script
 unicode.data ;
+FROM: ascii => ascii? ;
 IN: regexp.classes
 
 SINGLETONS: dot letter-class LETTER-class Letter-class digit-class
index 2ff31f0cecdba204c80f231728bc5b89b50b33e1..3eb4e8a9bfe7206b6add7550503356025ef81d04 100644 (file)
@@ -31,7 +31,7 @@ ARTICLE: { "regexp" "intro" } "A quick introduction to regular expressions"
 "To search a file for all lines that match a given regular expression, you could use code like this:"
 { $code <" "file.txt" ascii file-lines [ R/ (f|b)oo+/ re-contains? ] filter "> }
 "To test if a string in its entirety matches a regular expression, the following can be used:"
-{ $example <" USING: regexp prettyprint ; "fooo" R/ (b|f)oo+/ matches? . "> "t" }
+{ $example <" USE: regexp "fooo" R/ (b|f)oo+/ matches? . "> "t" }
 "Regular expressions can't be used for all parsing tasks. For example, they are not powerful enough to match balancing parentheses." ;
 
 ARTICLE: { "regexp" "construction" } "Constructing regular expressions"
index b2e99843c7ca230e641f456a2e745699382d01a7..1674c9a747f5b3300853077616204d05cb8a6e32 100644 (file)
@@ -1,6 +1,6 @@
+USING: help.markup help.syntax strings definitions generic words classes ;
+FROM: prettyprint.sections => with-pprint ;
 IN: see
-USING: help.markup help.syntax strings prettyprint.private
-definitions generic words classes ;
 
 HELP: synopsis
 { $values { "defspec" "a definition specifier" } { "str" string } }
@@ -25,7 +25,7 @@ HELP: see-methods
 { $contract "Prettyprints the methods defined on a generic word or class." } ;
 
 HELP: definer
-{ $values { "defspec" "a definition specifier" } { "start" word } { "end" "a word or " { $link f } } }
+{ $values { "defspec" "a definition specifier" } { "start" word } { "end" { $maybe word } } }
 { $contract "Outputs the parsing words which delimit the definition." }
 { $examples
     { $example "USING: definitions prettyprint ;"
index 3f11ec987e495e0cbc0f0c5a76b78e889d2cb32a..ba81bf5e2f6c50dc56ed9af1bbbb9bc886082018 100644 (file)
@@ -1,5 +1,5 @@
 IN: see.tests
-USING: see tools.test io.streams.string math ;
+USING: see tools.test io.streams.string math words ;
 
 CONSTANT: test-const 10
 [ "IN: see.tests\nCONSTANT: test-const 10 inline\n" ]
@@ -9,3 +9,5 @@ ALIAS: test-alias +
 
 [ "USING: math ;\nIN: see.tests\nALIAS: test-alias + inline\n" ]
 [ [ \ test-alias see ] with-string-writer ] unit-test
+
+[ ] [ gensym see ] unit-test
\ No newline at end of file
index 37153b522903cc86fe3a21ab01142ab59fd81e94..a8d78a68e467b745d343521269c474f471dd9101 100644 (file)
@@ -7,7 +7,7 @@ generic.single generic.standard generic.hook io io.pathnames
 io.streams.string io.styles kernel make namespaces prettyprint
 prettyprint.backend prettyprint.config prettyprint.custom
 prettyprint.sections sequences sets sorting strings summary words
-words.symbol words.constant words.alias ;
+words.symbol words.constant words.alias vocabs ;
 IN: see
 
 GENERIC: synopsis* ( defspec -- )
@@ -44,7 +44,7 @@ M: word print-stack-effect? drop t ;
 <PRIVATE
 
 : seeing-word ( word -- )
-    vocabulary>> pprinter-in set ;
+    vocabulary>> dup [ vocab ] when pprinter-in set ;
 
 : word-synopsis ( word -- )
     {
index d23c8be84b928aef2aa3ed69c719918dd0e98711..b6a4b1a86fb915194abc8d1e3b24331811da8e20 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
 ! 
-USING: tools.test kernel serialize io io.streams.byte-array math
+USING: tools.test kernel serialize io io.streams.byte-array
 alien arrays byte-arrays bit-arrays specialized-arrays.double
 sequences math prettyprint parser classes math.constants
 io.encodings.binary random assocs serialize.private ;
index 4a0d3777b82d0d8dbdc0ac5c9db01d6b7604b983..4e94b6a51dc30dd039046ed2b35684c956fb4d70 100644 (file)
@@ -90,16 +90,6 @@ M: float (serialize) ( obj -- )
     CHAR: F write1
     double>bits serialize-cell ;
 
-M: complex (serialize) ( obj -- )
-    CHAR: c write1
-    [ real-part (serialize) ]
-    [ imaginary-part (serialize) ] bi ;
-
-M: ratio (serialize) ( obj -- )
-    CHAR: r write1
-    [ numerator (serialize) ]
-    [ denominator (serialize) ] bi ;
-
 : serialize-seq ( obj code -- )
     [
         write1
@@ -205,12 +195,6 @@ SYMBOL: deserialized
 : deserialize-float ( -- float )
     deserialize-cell bits>double ;
 
-: deserialize-ratio ( -- ratio )
-    (deserialize) (deserialize) / ;
-
-: deserialize-complex ( -- complex )
-    (deserialize) (deserialize) rect> ;
-
 : (deserialize-string) ( -- string )
     deserialize-cell read utf8 decode ;
 
@@ -279,7 +263,6 @@ SYMBOL: deserialized
             { CHAR: T [ deserialize-tuple ] }
             { CHAR: W [ deserialize-wrapper ] }
             { CHAR: a [ deserialize-array ] }
-            { CHAR: c [ deserialize-complex ] }
             { CHAR: h [ deserialize-hashtable ] }
             { CHAR: m [ deserialize-negative-integer ] }
             { CHAR: n [ deserialize-false ] }
@@ -287,7 +270,6 @@ SYMBOL: deserialized
             { CHAR: o [ deserialize-unknown ] }
             { CHAR: p [ deserialize-positive-integer ] }
             { CHAR: q [ deserialize-quotation ] }
-            { CHAR: r [ deserialize-ratio ] }
             { CHAR: s [ deserialize-string ] }
             { CHAR: w [ deserialize-word ] }
             { CHAR: G [ deserialize-word ] }
index 2fd928252fbffff51e5d696064e5e63818b13b03..37eaf088227452257ac002768b44823404d9b0a3 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: sequences grouping assocs kernel ascii ascii tr ;
+USING: sequences grouping assocs kernel ascii tr ;
 IN: soundex
 
 TR: soundex-tr
index b222cbbcf75ce374c6133953f1e6e20199133209..0ad64cace3b18a157fe178f8a9e22c50b636e6b5 100644 (file)
@@ -1,4 +1,4 @@
-USING: stack-checker.call-effect tools.test math kernel math effects ;
+USING: stack-checker.call-effect tools.test kernel math effects ;
 IN: stack-checker.call-effect.tests
 
 [ t ] [ \ + (( a b -- c )) execute-effect-unsafe? ] unit-test
index 23283fb6e309064e8bd185f67ffa803befb846d3..c99e0f02521032af919b3bd44407c3e9cd222b6e 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: fry namespaces assocs kernel sequences words accessors
 definitions math math.order effects classes arrays combinators
-vectors arrays hints
+vectors hints
 stack-checker.state
 stack-checker.errors
 stack-checker.values
index 56ef67d2a8d2a0973d8a9dd60f4837a74cfbe035..70382c0829bbf7fb36e407005b0f972464bd959a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: fry accessors alien alien.accessors arrays byte-arrays classes
-sequences.private continuations.private effects generic hashtables
+continuations.private effects generic hashtables
 hashtables.private io io.backend io.files io.files.private
 io.streams.c kernel kernel.private math math.private
 math.parser.private memory memory.private namespaces
@@ -11,7 +11,7 @@ strings.private system threads.private classes.tuple
 classes.tuple.private vectors vectors.private words definitions assocs
 summary compiler.units system.private combinators
 combinators.short-circuit locals locals.backend locals.types
-quotations.private combinators.private stack-checker.values
+combinators.private stack-checker.values
 generic.single generic.single.private
 alien.libraries
 stack-checker.alien
index 8113a662d6582d7d90c16e2a2cb3688957a01f25..a85cd44a47ad42ca313b475754f1a8aa7544da77 100755 (executable)
@@ -3,7 +3,7 @@
 USING: fry accessors arrays kernel kernel.private combinators.private
 words sequences generic math math.order namespaces quotations
 assocs combinators combinators.short-circuit classes.tuple
-classes.tuple.private effects summary hashtables classes generic sets
+classes.tuple.private effects summary hashtables classes sets
 definitions generic.standard slots.private continuations locals
 sequences.private generalizations stack-checker.backend
 stack-checker.state stack-checker.visitor stack-checker.errors
index a8ce98888cd91d91247d2b306d7ba7d9d1fc2ec9..8ce45ccc15345577d1d6013cd6f1139a4bff2997 100755 (executable)
@@ -1,7 +1,6 @@
 IN: struct-arrays.tests
 USING: struct-arrays tools.test kernel math sequences
-alien.syntax alien.c-types destructors libc accessors
-destructors ;
+alien.syntax alien.c-types destructors libc accessors ;
 
 C-STRUCT: test-struct
 { "int" "x" }
index 5a64878aee8c1f847b0dade9aa97271aeae222e4..46572de47bee63c1777f43d8617463e0401b48cd 100755 (executable)
@@ -1,12 +1,12 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays accessors io.backend io.streams.c init fry namespaces
-math make assocs kernel parser lexer strings.parser vocabs sequences
-sequences.private words memory kernel.private continuations io
-vocabs.loader system strings sets vectors quotations byte-arrays
-sorting compiler.units definitions generic generic.standard
-generic.single tools.deploy.config combinators classes
-slots.private ;
+math make assocs kernel parser parser.notes lexer strings.parser
+vocabs sequences sequences.private words memory kernel.private
+continuations io vocabs.loader system strings sets vectors quotations
+byte-arrays sorting compiler.units definitions generic
+generic.standard generic.single tools.deploy.config combinators
+classes slots.private ;
 QUALIFIED: bootstrap.stage2
 QUALIFIED: command-line
 QUALIFIED: compiler.errors
index 146a119a631ce0f745336c17d58e4f64662b4a08..29d3674b60a7761d0055c82732f4bb5dde09bd62 100755 (executable)
@@ -74,9 +74,9 @@ M: object file-spec>string ( file-listing spec -- string )
 
 : list-files-slow ( listing-tool -- array )
     [ path>> ] [ sort>> ] [ specs>> ] tri '[
-            [ dup name>> file-info file-listing boa ] map
-            _ [ sort-by ] when*
-            [ _ [ file-spec>string ] with map ] map
+        [ dup name>> link-info file-listing boa ] map
+        _ [ sort-by ] when*
+        [ _ [ file-spec>string ] with map ] map
     ] with-directory-entries ; inline
 
 : list-files ( listing-tool -- array ) 
@@ -115,11 +115,14 @@ SYMBOLS: +device-name+ +mount-point+ +type+
     [ file-systems-info ]
     [ [ unparse ] map ] bi prefix simple-table. ;
 
-: file-systems. ( -- )
+CONSTANT: default-file-systems-spec
     {
         +device-name+ +available-space+ +free-space+ +used-space+
         +total-space+ +percent-used+ +mount-point+
-    } print-file-systems ;
+    }
+
+: file-systems. ( -- )
+    default-file-systems-spec print-file-systems ;
 
 {
     { [ os unix? ] [ "tools.files.unix" ] }
index 90e91529a1388925ca6ec2bb269022692304bfc4..d5fdd6c88909d530ff5f295bbbc31fe77675b946 100755 (executable)
@@ -4,7 +4,7 @@ USING: accessors combinators kernel system unicode.case io.files
 io.files.info io.files.info.unix generalizations
 strings arrays sequences math.parser unix.groups unix.users
 tools.files.private unix.stat math fry macros combinators.smart
-io.files.info.unix io tools.files math.order prettyprint ;
+io tools.files math.order prettyprint ;
 IN: tools.files.unix
 
 <PRIVATE
index 3d9166aafa5a3fc30bbe22fd5032a878a10def1a..81785f7ea47875d8a684b13b0893079d278e8ce1 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences vectors arrays generic assocs io math
-namespaces parser prettyprint strings io.styles vectors words
+USING: kernel sequences arrays generic assocs io math
+namespaces parser prettyprint strings io.styles words
 system sorting splitting grouping math.parser classes memory
 combinators fry ;
 IN: tools.memory
index 3dc7b8740b171b1da5c60b78f47ef5c796333923..7b07311ded119dc7923ef76212d7ef1339540132 100644 (file)
@@ -2,11 +2,11 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators compiler.units
 continuations debugger effects fry generalizations io io.files
-io.styles kernel lexer locals macros math.parser namespaces
-parser prettyprint quotations sequences source-files splitting
+io.styles kernel lexer locals macros math.parser namespaces parser
+vocabs.parser prettyprint quotations sequences source-files splitting
 stack-checker summary unicode.case vectors vocabs vocabs.loader
-vocabs.files words tools.errors source-files.errors
-io.streams.string make compiler.errors ;
+vocabs.files words tools.errors source-files.errors io.streams.string
+make compiler.errors ;
 IN: tools.test
 
 TUPLE: test-failure < source-file-error continuation ;
index 1ca3e85232540039ab4da4a24655859b10e8f8c7..e28776a51cec81326efb9559048831406e8c1bf1 100755 (executable)
@@ -8,8 +8,8 @@ math.vectors namespaces make sequences strings vectors words
 windows.kernel32 windows.gdi32 windows.user32 windows.opengl32
 windows.messages windows.types windows.offscreen windows.nt
 threads libc combinators fry combinators.short-circuit continuations
-command-line shuffle opengl ui.render ascii math.bitwise locals
-accessors math.rectangles math.order ascii calendar
+command-line shuffle opengl ui.render math.bitwise locals
+accessors math.rectangles math.order calendar ascii
 io.encodings.utf16n windows.errors literals ui.pixel-formats 
 ui.pixel-formats.private memoize classes struct-arrays ;
 IN: ui.backend.windows
index 28529b013bf9ca19e7da6ea57d0fea955a8d471b..f45c3f8b05c73c9523f6fc9880cac7565cddb42b 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays definitions kernel sequences strings
-math assocs words generic namespaces make assocs quotations
+math assocs words generic namespaces make quotations
 splitting ui.gestures unicode.case unicode.categories tr fry ;
 IN: ui.commands
 
index 0504231972e655c3b1010ee50aef53156b922042..ec11bac2d35f9dc516cca0bba3d42529a798a7c3 100644 (file)
@@ -7,6 +7,7 @@ ui.gadgets.borders ui.gadgets.labels ui.gadgets.tracks
 ui.gadgets.packs ui.gadgets.worlds ui.gestures ui.pens ui.pens.solid
 ui.pens.image ui.pens.tile math.rectangles locals fry
 combinators.smart ;
+FROM: models => change-model ;
 IN: ui.gadgets.buttons
 
 TUPLE: button < border pressed? selected? quot ;
index 9461b2348f5f877052431b3c95d13b12d2015edd..aa2b9ca58c58a18541aea7fa2693e24950feaa9e 100755 (executable)
@@ -3,7 +3,7 @@
 USING: accessors arrays documents documents.elements kernel math
 math.ranges models models.arrow namespaces locals fry make opengl
 opengl.gl sequences strings math.vectors math.functions sorting colors
-colors.constants combinators assocs math.order fry calendar alarms
+colors.constants combinators assocs math.order calendar alarms
 continuations ui.clipboards ui.commands ui.gadgets ui.gadgets.borders
 ui.gadgets.buttons ui.gadgets.labels ui.gadgets.scrollers
 ui.gadgets.menus ui.gadgets.wrappers ui.render ui.pens.solid
index 77860ba5b571bf3d5157ef4a8dfc188d6ca5e093..ade5c8101ebae19ba6f2145adace76f9a15e72e7 100644 (file)
@@ -1,8 +1,7 @@
-USING: accessors ui.gadgets ui.gadgets.private ui.gadgets.packs
-ui.gadgets.worlds tools.test namespaces models kernel dlists deques
-math sets math.parser ui sequences hashtables assocs io arrays
-prettyprint io.streams.string math.rectangles ui.gadgets.private
-sets generic ;
+USING: accessors ui.gadgets ui.gadgets.packs ui.gadgets.worlds
+tools.test namespaces models kernel dlists deques math
+math.parser ui sequences hashtables assocs io arrays prettyprint
+io.streams.string math.rectangles ui.gadgets.private sets generic ;
 IN: ui.gadgets.tests
 
 [ { 300 300 } ]
index 5dd1710cdd0e66042b98732a0b76ed4d021d68b9..6a289ec1d6b60faf2d40f37388a9927461387941 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays hashtables kernel models math namespaces
+USING: accessors arrays hashtables kernel math namespaces
 make sequences quotations math.vectors combinators sorting
 binary-search vectors dlists deques models threads
 concurrency.flags math.order math.rectangles fry locals ;
index 945e16150dbfe74d0eab8c80cce347c4f1163e5e..d6b87193ca1be9b6633ca40094a219f19b93c245 100644 (file)
@@ -3,6 +3,7 @@
 USING: accessors kernel namespaces ui.gadgets ui.gadgets.worlds
 ui.gadgets.wrappers ui.gestures math.rectangles
 math.rectangles.positioning combinators vectors ;
+FROM: ui.gadgets.wrappers => wrapper ;
 IN: ui.gadgets.glass
 
 GENERIC: hide-glass-hook ( gadget -- )
index 734190e7e79151b4daccb1df72978fdf9129c1e9..159da59be5a1e0013be2ad79898c7552fd7eaa9a 100644 (file)
@@ -3,7 +3,7 @@
 USING: colors.constants kernel locals math.rectangles namespaces
 sequences ui.commands ui.gadgets ui.gadgets.borders ui.gadgets.buttons
 ui.gadgets.glass ui.gadgets.packs ui.gadgets.frames ui.gadgets.worlds
-ui.gadgets.frames ui.gadgets.corners ui.gestures ui.operations
+ui.gadgets.corners ui.gestures ui.operations
 ui.render ui.pens ui.pens.solid opengl math.vectors words accessors
 math math.order sorting ;
 IN: ui.gadgets.menus
index 6f6e7ee95f52da0029c088c6712b5d62c77e00d4..eb741f13b6217d5e9178aa30c0a4055e30ad2752 100644 (file)
@@ -11,6 +11,7 @@ ui.gadgets.menus ui.clipboards ui.gestures ui.traverse ui.render
 ui.text ui.gadgets.presentations ui.gadgets.grids ui.gadgets.tracks
 ui.gadgets.icons ui.gadgets.grid-lines ui.baseline-alignment
 colors io.styles ;
+FROM: io.styles => foreground background ;
 IN: ui.gadgets.panes
 
 TUPLE: pane < track
index ba3b5a2f789bba08637e2392e6ad49e02d80df14..390e652ac6c80c275617aa6cd2008593421439fa 100644 (file)
@@ -5,7 +5,7 @@ math.functions math.rectangles math.order math.vectors namespaces
 opengl sequences ui.gadgets ui.gadgets.scrollers ui.gadgets.status-bar
 ui.gadgets.worlds ui.gestures ui.render ui.pens.solid ui.text
 ui.commands ui.images ui.gadgets.menus ui.gadgets.line-support
-math.rectangles models math.ranges sequences combinators
+models math.ranges combinators
 combinators.short-circuit fonts locals strings ;
 IN: ui.gadgets.tables
 
index 003b205c3daf2664995f9fad79db3217cfee02d2..b1ab1bc398dc5a28ab2421978be4b2c90d0b1ab7 100644 (file)
@@ -1,12 +1,12 @@
 USING: destructors help.markup help.syntax kernel math multiline sequences
-vocabs vocabs.parser words ;
+vocabs vocabs.parser words namespaces ;
 IN: ui.pixel-formats
 
 ! break circular dependency
 <<
     "ui.gadgets.worlds" create-vocab drop
     "world" "ui.gadgets.worlds" create drop
-    "ui.gadgets.worlds" (use+)
+    "ui.gadgets.worlds" vocab-words use-words
 >>
 
 ARTICLE: "ui.pixel-formats-attributes" "Pixel format attributes"
index c1f05182e6f4f44206584dbe1254f607f918b3dd..6d5c7e56a6e3e93c3128861de533b0a9d4cfdc60 100755 (executable)
@@ -73,7 +73,7 @@ M: array draw-text
         ] with each
     ] do-matrix ;
 
-USING: vocabs.loader namespaces system combinators ;
+USING: vocabs.loader system combinators ;
 
 {
     { [ os macosx? ] [ "core-text" ] }
index 1b8af1dd031311aa9d5cbe26d398b84dc8faecc7..21d827da9be632842aa4e67e16bc1d596b6dda3b 100644 (file)
@@ -1,13 +1,14 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: debugger classes help help.topics help.crossref help.home kernel models
-compiler.units assocs words vocabs accessors fry arrays
-combinators.short-circuit namespaces sequences models help.apropos
+USING: debugger classes help help.topics help.crossref help.home
+kernel models compiler.units assocs words vocabs accessors fry arrays
+combinators.short-circuit namespaces sequences help.apropos
 combinators ui ui.commands ui.gadgets ui.gadgets.panes
 ui.gadgets.scrollers ui.gadgets.tracks ui.gestures ui.gadgets.buttons
 ui.gadgets.packs ui.gadgets.editors ui.gadgets.labels
-ui.gadgets.status-bar ui.gadgets.glass ui.gadgets.borders ui.gadgets.viewports
-ui.tools.common ui.tools.browser.popups ui.tools.browser.history ;
+ui.gadgets.status-bar ui.gadgets.glass ui.gadgets.borders
+ui.gadgets.viewports ui.tools.common ui.tools.browser.popups
+ui.tools.browser.history ;
 IN: ui.tools.browser
 
 TUPLE: browser-gadget < tool history pane scroller search-field popup ;
index 2cd90ab3356aaee1015e69501cd8c8efdf423ecf..ac4318fa92ee8b9a43b3821648640d5e4f742d3c 100644 (file)
@@ -6,6 +6,7 @@ sorting definitions.icons tools.crossref ui.gadgets ui.gadgets.glass
 ui.gadgets.labeled ui.gadgets.scrollers ui.gadgets.tables
 ui.gadgets.search-tables ui.gadgets.wrappers ui.gestures ui.operations
 ui.pens.solid ui.images ;
+FROM: ui.gadgets.wrappers => wrapper ;
 IN: ui.tools.browser.popups
 
 SINGLETON: link-renderer
index b68b34977428bea9eb557e27738ba065fb2ed00d..21a0e95eb46eacee8f1d1b1fc8d0fc8a80800a77 100644 (file)
@@ -1,5 +1,5 @@
 USING: ui.gadgets help.markup help.syntax kernel quotations
-continuations debugger ui continuations ;
+continuations debugger ui ;
 IN: ui.tools.debugger
 
 HELP: <debugger>
index 4d6960306cd75811f8a86fdb315b80d3ea604d8b..024442a2647ae2f1ccf874c54a95700cc2aa9d63 100755 (executable)
@@ -1,12 +1,11 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays hashtables io kernel math models
-colors.constants namespaces sequences sequences words continuations
-debugger prettyprint help editors fonts ui ui.commands ui.gestures
-ui.gadgets ui.pens.solid ui.gadgets.worlds ui.gadgets.packs
-ui.gadgets.buttons ui.gadgets.labels ui.gadgets.panes
-ui.gadgets.presentations ui.gadgets.viewports ui.gadgets.tables
-ui.gadgets.tracks ui.gadgets.scrollers ui.gadgets.panes
+colors.constants namespaces sequences words continuations debugger
+prettyprint help editors fonts ui ui.commands ui.gestures ui.gadgets
+ui.pens.solid ui.gadgets.worlds ui.gadgets.packs ui.gadgets.buttons
+ui.gadgets.labels ui.gadgets.presentations ui.gadgets.viewports
+ui.gadgets.tables ui.gadgets.tracks ui.gadgets.scrollers
 ui.gadgets.borders ui.gadgets.status-bar ui.tools.traceback
 ui.tools.inspector ui.tools.browser ui.debugger ;
 IN: ui.tools.debugger
@@ -60,7 +59,8 @@ M: debugger focusable-child*
 
 GENERIC: error-in-debugger? ( error -- ? )
 
-M: world-error error-in-debugger? world>> children>> [ f ] [ first debugger? ] if-empty ;
+M: world-error error-in-debugger?
+    world>> children>> [ f ] [ first debugger? ] if-empty ;
 
 M: object error-in-debugger? drop f ;
 
index d3c1278bf55bfe93cfa07d09a7e0f7376e114662..cf6f1c066d77d72fd1d5c15c136557b9c1915921 100644 (file)
@@ -1,12 +1,11 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: colors kernel namespaces models tools.deploy.config
-tools.deploy.config.editor tools.deploy vocabs
-namespaces models.mapping sequences system accessors fry
-ui.gadgets ui.render ui.gadgets.buttons ui.gadgets.packs
-ui.gadgets.labels ui.gadgets.editors ui.gadgets.borders ui.gestures
-ui.commands assocs ui.gadgets.tracks ui ui.tools.listener
-ui.tools.browser ;
+USING: colors kernel models tools.deploy.config
+tools.deploy.config.editor tools.deploy vocabs namespaces
+models.mapping sequences system accessors fry ui.gadgets ui.render
+ui.gadgets.buttons ui.gadgets.packs ui.gadgets.labels
+ui.gadgets.editors ui.gadgets.borders ui.gestures ui.commands assocs
+ui.gadgets.tracks ui ui.tools.listener ui.tools.browser ;
 IN: ui.tools.deploy
 
 TUPLE: deploy-gadget < pack vocab settings ;
index 704ae112e5ad65ffc07e647e18a49118d6ff0683..e9d4b50bac41edb385d4e2f811d51ef5726af35b 100644 (file)
@@ -8,7 +8,7 @@ models.arrow.smart models.search models.mapping debugger
 namespaces summary locals ui ui.commands ui.gadgets ui.gadgets.panes
 ui.gadgets.tables ui.gadgets.labeled ui.gadgets.tracks ui.gestures
 ui.operations ui.tools.browser ui.tools.common ui.gadgets.scrollers
-ui.tools.inspector ui.gadgets.status-bar ui.operations
+ui.tools.inspector ui.gadgets.status-bar
 ui.gadgets.buttons ui.gadgets.borders ui.gadgets.packs
 ui.gadgets.labels ui.baseline-alignment ui.images
 compiler.errors tools.errors tools.errors.model ;
index fdba400c3df7e4af3bce116da4dce5073b035181..f215e297ffcb7de1ec41c0722db13c638b592c9d 100644 (file)
@@ -20,7 +20,7 @@ SLOT: history
     [ dup string>> { { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
     <reversed> ;
 
-TUPLE: word-completion vocabs ;
+TUPLE: word-completion manifest ;
 C: <word-completion> word-completion
 
 SINGLETONS: vocab-completion char-completion history-completion ;
@@ -62,8 +62,8 @@ M: definition-completion row-columns
     2array ;
 
 M: word-completion row-color
-    [ vocabulary>> ] [ vocabs>> ] bi* {
-        { [ 2dup [ vocab-words ] dip memq? ] [ COLOR: black ] }
+    [ vocabulary>> ] [ manifest>> ] bi* {
+        { [ 2dup search-vocabs>> memq? ] [ COLOR: black ] }
         { [ over ".private" tail? ] [ COLOR: dark-red ] }
         [ COLOR: dark-gray ]
     } cond 2nip ;
@@ -87,7 +87,7 @@ M: vocab-completion row-color
     [ { 0 0 } ] 2dip doc-range ;
 
 : completion-mode ( interactor -- symbol )
-    [ vocabs>> ] [ editor-caret ] [ model>> ] tri up-to-caret " \r\n" split
+    [ manifest>> ] [ editor-caret ] [ model>> ] tri up-to-caret " \r\n" split
     {
         { [ dup { [ complete-IN:/USE:? ] [ complete-USING:? ] } 1|| ] [ 2drop vocab-completion ] }
         { [ dup complete-CHAR:? ] [ 2drop char-completion ] }
index e06e17374fa99e704e9364e00f9aa2fec8449dad..fbbac8f3fa137e97b17ecb5ff8479bbeea747c52 100644 (file)
@@ -2,7 +2,7 @@ USING: continuations documents
 ui.tools.listener hashtables kernel namespaces parser sequences
 tools.test ui.commands ui.gadgets ui.gadgets.editors
 ui.gadgets.panes vocabs words ui.gadgets.debug slots.private
-threads arrays generic threads accessors listener math
+arrays generic threads accessors listener math
 calendar concurrency.promises io ui.tools.common ;
 IN: ui.tools.listener.tests
 
@@ -146,7 +146,7 @@ CONSTANT: text "Hello world.\nThis is a test."
     [ ] [ "listener" get com-end ] unit-test
 ] with-grafted-gadget
 
-[ ] [ \ + <interactor> vocabs>> use-if-necessary ] unit-test
+[ ] [ \ + <interactor> manifest>> use-if-necessary ] unit-test
 
 [ ] [ <listener-gadget> "l" set ] unit-test
 [ ] [ "l" get com-scroll-up ] unit-test
index 6ed3577a064dcce326cbdb91ae49df753868a549..e12e59d2599f328bc4c785931b68a3520f1ee124 100644 (file)
@@ -38,13 +38,12 @@ output history flag mailbox thread waiting token-model word-model popup ;
         [ thread>> dup [ thread-registered? ] when ]
     } 1&& not ;
 
-SLOT: vocabs
+SLOT: manifest
 
-M: interactor vocabs>>
+M: interactor manifest>>
     dup interactor-busy? [ drop f ] [
-        use swap
         interactor-continuation name>>
-        assoc-stack
+        manifest swap assoc-stack
     ] if ;
 
 : vocab-exists? ( name -- ? )
@@ -56,7 +55,9 @@ M: vocab-completion (word-at-caret)
     drop dup vocab-exists? [ >vocab-link ] [ drop f ] if ;
 
 M: word-completion (word-at-caret)
-    vocabs>> assoc-stack ;
+    manifest>> dup [
+        '[ _ _ search-manifest ] [ drop f ] recover
+    ] [ 2drop f ] if ;
 
 M: char-completion (word-at-caret)
     2drop f ;
@@ -300,15 +301,15 @@ M: listener-operation invoke-command ( target command -- )
 : clear-stack ( listener -- )
     [ [ clear ] \ clear ] dip (call-listener) ;
 
-: use-if-necessary ( word seq -- )
+: use-if-necessary ( word manifest -- )
     2dup [ vocabulary>> ] dip and [
-        2dup [ assoc-stack ] keep = [ 2drop ] [
-            [ vocabulary>> vocab-words ] dip push
-        ] if
+        manifest [
+            vocabulary>> use-vocab
+        ] with-variable
     ] [ 2drop ] if ;
 
 M: word accept-completion-hook
-    interactor>> vocabs>> use-if-necessary ;
+    interactor>> manifest>> use-if-necessary ;
 
 M: object accept-completion-hook 2drop ;
 
index 650d751ee29d741fb323d2324011f50a0cb8cd57..4944cba1d637c7183f461e60f8fc744c9761632d 100644 (file)
@@ -131,13 +131,13 @@ M: quotation com-stack-effect infer. ;
 
 M: word com-stack-effect 1quotation com-stack-effect ;
 
-: com-enter-in ( vocab -- ) vocab-name set-in ;
+: com-enter-in ( vocab -- ) vocab-name set-current-vocab ;
 
 [ vocab? ] \ com-enter-in H{
     { +listener+ t }
 } define-operation
 
-: com-use-vocab ( vocab -- ) vocab-name use+ ;
+: com-use-vocab ( vocab -- ) vocab-name use-vocab ;
 
 [ vocab-spec? ] \ com-use-vocab H{
     { +secondary+ t }
index 5fef64ea8857e72b395f36a6f69529b49df93506..8be357b4093f46ebd49ccfa484f7c9ee83bacbb0 100644 (file)
@@ -6,10 +6,9 @@ vocabs tools.profiler words prettyprint combinators.smart
 definitions.icons see ui ui.commands ui.gadgets ui.gadgets.panes
 ui.gadgets.scrollers ui.gadgets.tracks ui.gestures ui.gadgets.buttons
 ui.gadgets.tables ui.gadgets.search-tables ui.gadgets.labeled
-ui.gadgets.buttons ui.gadgets.packs ui.gadgets.labels
-ui.gadgets.tabbed ui.gadgets.status-bar ui.gadgets.borders
-ui.tools.browser ui.tools.common ui.baseline-alignment
-ui.operations ui.images ;
+ui.gadgets.packs ui.gadgets.labels ui.gadgets.tabbed
+ui.gadgets.status-bar ui.gadgets.borders ui.tools.browser
+ui.tools.common ui.baseline-alignment ui.operations ui.images ;
 FROM: models.arrow => <arrow> ;
 FROM: models.arrow.smart => <smart-arrow> ;
 FROM: models.product => <product> ;
index b1bfce26e6a5e3a06ecbd155da96c171215a9e86..144530399c5b5b8a0ebb539a5b7fc194018e4d4f 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays assocs io kernel math models namespaces make dlists
-deques sequences threads sequences words continuations init
+deques sequences threads words continuations init
 combinators combinators.short-circuit hashtables concurrency.flags
 sets accessors calendar fry destructors ui.gadgets ui.gadgets.private
 ui.gadgets.worlds ui.gadgets.tracks ui.gestures ui.backend ui.render
index b6eddccae074f7257f9226af3e3f217c6b02bb5e..f8beca3c600cd6334522c499c570e1875b80d465 100755 (executable)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2008 Daniel Ehrenberg.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: combinators.short-circuit sequences io.files\r
-io.encodings.ascii kernel values splitting accessors math.parser\r
-ascii io assocs strings math namespaces make sorting combinators\r
-math.order arrays unicode.normalize unicode.data locals\r
-macros sequences.deep words unicode.breaks\r
-quotations combinators.short-circuit simple-flat-file ;\r
+USING: sequences io.files io.encodings.ascii kernel values splitting\r
+accessors math.parser ascii io assocs strings math namespaces make\r
+sorting combinators math.order arrays unicode.normalize unicode.data\r
+locals macros sequences.deep words unicode.breaks quotations\r
+combinators.short-circuit simple-flat-file ;\r
 IN: unicode.collation\r
 \r
 <PRIVATE\r
index 779ae64d485b3ee293c251183b5217d697a995df..318a56627bbd0e4ef90e9062b3673efd133a274e 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: combinators.short-circuit assocs math kernel sequences
 io.files hashtables quotations splitting grouping arrays io
-math.parser hash2 math.order byte-arrays words namespaces words
+math.parser hash2 math.order byte-arrays namespaces
 compiler.units parser io.encodings.ascii values interval-maps
 ascii sets combinators locals math.ranges sorting make
 strings.parser io.encodings.utf8 memoize simple-flat-file ;
index e059e1a1844171d3659ab9a87695f07698bd2e05..4e276373e1ae73440d98bfea2be4ec7d58db9e96 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: debugger prettyprint accessors unix io kernel ;
+USING: debugger prettyprint accessors unix kernel ;
+FROM: io => write print nl ;
 IN: unix.debugger
 
 M: unix-error error.
index 22757cdbe1b5741ec03552b40a55f9d54447229b..da8b1e63e3f11f7eafacc778486c0aed12238f05 100644 (file)
@@ -1,6 +1,6 @@
-USING: kernel alien.c-types alien.strings sequences math alien.syntax unix
-vectors kernel namespaces continuations threads assocs vectors
-io.backend.unix io.encodings.utf8 unix.utilities fry ;
+USING: kernel alien.c-types alien.strings sequences math alien.syntax
+unix namespaces continuations threads assocs io.backend.unix
+io.encodings.utf8 unix.utilities fry ;
 IN: unix.process
 
 ! Low-level Unix process launching utilities. These are used
index b60a0b1adc35a626d16733b3146a580572273eec..3b145d8af548b4df32bf8f2bf30a8c449bae6c36 100644 (file)
@@ -6,33 +6,3 @@ cell-bits {
     { 64 [ "unix.stat.netbsd.64" require ] }
 } case
 
-CONSTANT: _VFS_NAMELEN    32  
-CONSTANT: _VFS_MNAMELEN   1024
-
-C-STRUCT: statvfs
-    { "ulong"   "f_flag" }   
-    { "ulong"   "f_bsize" }
-    { "ulong"   "f_frsize" }  
-    { "ulong"   "f_iosize" }  
-    { "fsblkcnt_t" "f_blocks" }       
-    { "fsblkcnt_t" "f_bfree" } 
-    { "fsblkcnt_t" "f_bavail" }       
-    { "fsblkcnt_t" "f_bresvd" }       
-    { "fsfilcnt_t" "f_files" }
-    { "fsfilcnt_t" "f_ffree" }
-    { "fsfilcnt_t" "f_favail" }       
-    { "fsfilcnt_t" "f_fresvd" }       
-    { "uint64_t"   "f_syncreads" }    
-    { "uint64_t"   "f_syncwrites" }   
-    { "uint64_t"   "f_asyncreads" }   
-    { "uint64_t"   "f_asyncwrites" }  
-    { "fsid_t"    "f_fsidx" }
-    { "ulong"   "f_fsid" }
-    { "ulong"   "f_namemax" }      
-    { "uid_t"   "f_owner" }
-    { { "uint32_t" 4 } "f_spare" }     
-    { { "char" _VFS_NAMELEN } "f_fstypename" }
-    { { "char" _VFS_NAMELEN } "f_mntonname" }
-    { { "char" _VFS_NAMELEN } "f_mntfromname" } ;
-
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
index 156be961906773f4a231932a1f5b860070983891..c3ab099d380e90a08381e7cfb86702c664cbc864 100644 (file)
@@ -15,10 +15,6 @@ CONSTANT: S_IFLNK  OCT: 120000   ! Symbolic link.
 CONSTANT: S_IFSOCK OCT: 140000   ! Socket.
 CONSTANT: S_IFWHT  OCT: 160000   ! Whiteout.
 
-FUNCTION: int chmod ( char* path, mode_t mode ) ;
-FUNCTION: int fchmod ( int fd, mode_t mode ) ;
-FUNCTION: int mkdir ( char* path, mode_t mode ) ;
-
 C-STRUCT: fsid
     { { "int" 2 } "__val" } ;
 
index f7ce6406feded723f2aae32427cce2cddc53eba3..4ca2c4368a584712f1647e8f5a7ad04c9a3bf570 100644 (file)
@@ -1,5 +1,4 @@
-USING: kernel system alien.syntax combinators vocabs.loader
-system ;
+USING: kernel system alien.syntax combinators vocabs.loader ;
 IN: unix.types
 
 TYPEDEF: char int8_t
index 95dca2cb34d3541efc517b215ce322df8c48d353..9c4251dd1e44fec167f7f55beafc0428f4820096 100644 (file)
@@ -5,7 +5,7 @@ USING: alien alien.c-types alien.syntax kernel libc
 sequences continuations byte-arrays strings math namespaces
 system combinators vocabs.loader accessors
 stack-checker macros locals generalizations unix.types
-io vocabs vocabs.loader ;
+io vocabs ;
 IN: unix
 
 CONSTANT: PROT_NONE   0
@@ -132,6 +132,7 @@ FUNCTION: int ioctl ( int fd, ulong request, char* argp ) ;
 FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
 FUNCTION: int listen ( int s, int backlog ) ;
 FUNCTION: off_t lseek ( int fildes, off_t offset, int whence ) ;
+FUNCTION: int mkdir ( char* path, mode_t mode ) ;
 FUNCTION: void* mmap ( void* addr, size_t len, int prot, int flags, int fd, off_t offset ) ;
 FUNCTION: int munmap ( void* addr, size_t len ) ;
 FUNCTION: uint ntohl ( uint n ) ;
diff --git a/basis/vocabs/prettyprint/authors.txt b/basis/vocabs/prettyprint/authors.txt
new file mode 100644 (file)
index 0000000..d4f5d6b
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
\ No newline at end of file
diff --git a/basis/vocabs/prettyprint/prettyprint-tests.factor b/basis/vocabs/prettyprint/prettyprint-tests.factor
new file mode 100644 (file)
index 0000000..9ad0aae
--- /dev/null
@@ -0,0 +1,44 @@
+IN: vocabs.prettyprint.tests
+USING: vocabs.prettyprint tools.test io.streams.string multiline eval ;
+
+: manifest-test-1 ( -- string )
+    <" USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
+
+    << manifest get pprint-manifest >> "> ;
+
+[
+<" USING: kernel namespaces vocabs.parser vocabs.prettyprint ;">
+]
+[ [ manifest-test-1 eval( -- ) ] with-string-writer ] unit-test
+
+: manifest-test-2 ( -- string )
+    <" USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
+    IN: vocabs.prettyprint.tests
+
+    << manifest get pprint-manifest >> "> ;
+
+[
+<" USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
+IN: vocabs.prettyprint.tests">
+]
+[ [ manifest-test-2 eval( -- ) ] with-string-writer ] unit-test
+
+: manifest-test-3 ( -- string )
+    <" USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
+    FROM: math => + - ;
+    QUALIFIED: system
+    QUALIFIED-WITH: assocs a
+    EXCLUDE: parser => run-file ;
+    IN: vocabs.prettyprint.tests
+
+    << manifest get pprint-manifest >> "> ;
+
+[
+<" USING: kernel namespaces vocabs.parser vocabs.prettyprint ;
+FROM: math => + - ;
+QUALIFIED: system
+QUALIFIED-WITH: assocs a
+EXCLUDE: parser => run-file ;
+IN: vocabs.prettyprint.tests">
+]
+[ [ manifest-test-3 eval( -- ) ] with-string-writer ] unit-test
\ No newline at end of file
diff --git a/basis/vocabs/prettyprint/prettyprint.factor b/basis/vocabs/prettyprint/prettyprint.factor
new file mode 100644 (file)
index 0000000..0e150ef
--- /dev/null
@@ -0,0 +1,91 @@
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel sorting sequences vocabs io io.styles arrays assocs
+namespaces sets parser colors prettyprint.backend prettyprint.sections
+vocabs.parser make fry math.order ;
+IN: vocabs.prettyprint
+
+: pprint-vocab ( vocab -- )
+    [ vocab-name ] [ vocab ] bi present-text ;
+
+: pprint-in ( vocab -- )
+    [ \ IN: pprint-word pprint-vocab ] with-pprint ;
+
+<PRIVATE
+
+: sort-vocabs ( seq -- seq' )
+    [ [ vocab-name ] compare ] sort ;
+
+: pprint-using ( seq -- )
+    [ "syntax" vocab = not ] filter
+    sort-vocabs [
+        \ USING: pprint-word
+        [ pprint-vocab ] each
+        \ ; pprint-word
+    ] with-pprint ;
+
+GENERIC: pprint-qualified ( qualified -- )
+
+M: qualified pprint-qualified ( qualified -- )
+    [
+        dup [ vocab>> vocab-name ] [ prefix>> ] bi = [
+            \ QUALIFIED: pprint-word
+            vocab>> pprint-vocab
+        ] [
+            \ QUALIFIED-WITH: pprint-word
+            [ vocab>> pprint-vocab ] [ prefix>> text ] bi
+        ] if
+    ] with-pprint ;
+
+M: from pprint-qualified ( from -- )
+    [
+        \ FROM: pprint-word
+        [ vocab>> pprint-vocab "=>" text ]
+        [ names>> [ text ] each ] bi
+        \ ; pprint-word
+    ] with-pprint ;
+
+M: exclude pprint-qualified ( exclude -- )
+    [
+        \ EXCLUDE: pprint-word
+        [ vocab>> pprint-vocab "=>" text ]
+        [ names>> [ text ] each ] bi
+        \ ; pprint-word
+    ] with-pprint ;
+
+M: rename pprint-qualified ( rename -- )
+    [
+        \ RENAME: pprint-word
+        [ word>> text ]
+        [ vocab>> text "=>" text ]
+        [ words>> >alist first first text ]
+        tri
+    ] with-pprint ;
+
+PRIVATE>
+
+: (pprint-manifest ( manifest -- quots )
+    [
+        [ search-vocabs>> [ '[ _ pprint-using ] , ] unless-empty ]
+        [ qualified-vocabs>> [ extra-words? not ] filter [ '[ _ pprint-qualified ] , ] each ]
+        [ current-vocab>> [ '[ _ pprint-in ] , ] when* ]
+        tri
+    ] { } make ;
+
+: pprint-manifest) ( quots -- )
+    [ nl ] [ call( -- ) ] interleave ;
+
+: pprint-manifest ( manifest -- )
+    (pprint-manifest pprint-manifest) ;
+
+[
+    nl
+    { { font-style bold } { font-name "sans-serif" } } [
+        "Restarts were invoked adding vocabularies to the search path." print
+        "To avoid doing this in the future, add the following forms" print
+        "at the top of the source file:" print nl
+    ] with-style
+    { { page-color T{ rgba f 0.8 0.8 0.8 1.0 } } }
+    [ manifest get pprint-manifest ] with-nesting
+    nl nl
+] print-use-hook set-global
\ No newline at end of file
index 0699c92be336e8998af9e591fc85080eea3ef2b2..5187c3f6609398c332b65aa753b725f767436b05 100755 (executable)
@@ -233,6 +233,7 @@ CONSTANT: PFD_DRAW_TO_WINDOW 4
 CONSTANT: PFD_DRAW_TO_BITMAP 8
 CONSTANT: PFD_SUPPORT_GDI 16
 CONSTANT: PFD_SUPPORT_OPENGL 32
+CONSTANT: PFD_SUPPORT_DIRECTDRAW 8192
 CONSTANT: PFD_GENERIC_FORMAT 64
 CONSTANT: PFD_NEED_PALETTE 128
 CONSTANT: PFD_NEED_SYSTEM_PALETTE HEX: 00000100
index e654b68bdc034f33a3cd9dfe3795c27324e9cad7..38c63abc725d03d2651dfe978231c68931bb4a06 100755 (executable)
@@ -180,8 +180,6 @@ CONSTANT: SEC_COMMIT HEX: 08000000
 CONSTANT: SEC_NOCACHE HEX: 10000000
 ALIAS: MEM_IMAGE SEC_IMAGE
 
-CONSTANT: ERROR_ALREADY_EXISTS 183
-
 CONSTANT: FILE_MAP_ALL_ACCESS HEX: f001f
 CONSTANT: FILE_MAP_READ   4
 CONSTANT: FILE_MAP_WRITE  2
index 4173332dc32749e5b6484878900c0b98325de374..63f705263cef449b91f0d0e6cee0fb7c5a12e1f5 100755 (executable)
@@ -5,36 +5,6 @@ math math.bitwise windows.types init assocs splitting
 sequences libc opengl.gl opengl.gl.extensions opengl.gl.windows ;
 IN: windows.opengl32
 
-! PIXELFORMATDESCRIPTOR flags
-CONSTANT: PFD_DOUBLEBUFFER            HEX: 00000001
-CONSTANT: PFD_STEREO                  HEX: 00000002
-CONSTANT: PFD_DRAW_TO_WINDOW          HEX: 00000004
-CONSTANT: PFD_DRAW_TO_BITMAP          HEX: 00000008
-CONSTANT: PFD_SUPPORT_GDI             HEX: 00000010
-CONSTANT: PFD_SUPPORT_OPENGL          HEX: 00000020
-CONSTANT: PFD_GENERIC_FORMAT          HEX: 00000040
-CONSTANT: PFD_NEED_PALETTE            HEX: 00000080
-CONSTANT: PFD_NEED_SYSTEM_PALETTE     HEX: 00000100
-CONSTANT: PFD_SWAP_EXCHANGE           HEX: 00000200
-CONSTANT: PFD_SWAP_COPY               HEX: 00000400
-CONSTANT: PFD_SWAP_LAYER_BUFFERS      HEX: 00000800
-CONSTANT: PFD_GENERIC_ACCELERATED     HEX: 00001000
-CONSTANT: PFD_SUPPORT_DIRECTDRAW      HEX: 00002000
-
-! PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only
-CONSTANT: PFD_DEPTH_DONTCARE          HEX: 20000000
-CONSTANT: PFD_DOUBLEBUFFER_DONTCARE   HEX: 40000000
-CONSTANT: PFD_STEREO_DONTCARE         HEX: 80000000
-
-! pixel types
-CONSTANT: PFD_TYPE_RGBA        0
-CONSTANT: PFD_TYPE_COLORINDEX  1
-! layer types
-CONSTANT: PFD_MAIN_PLANE       0
-CONSTANT: PFD_OVERLAY_PLANE    1
-CONSTANT: PFD_UNDERLAY_PLANE   -1
-
 CONSTANT: LPD_TYPE_RGBA        0
 CONSTANT: LPD_TYPE_COLORINDEX  1
 
index 482d50ab5f31dc089bf5ef2acb2ea73d73bd22c9..c648f6bd61bdef0408bac6b111a48d3e2c9b2cf0 100644 (file)
@@ -68,8 +68,7 @@ SYMBOL: line-ideal
     0 <paragraph> ;
 
 : post-process ( paragraph -- array )
-    lines>> deep-list>array
-    [ [ contents>> ] map ] map ;
+    lines>> [ [ contents>> ] lmap>array ] lmap>array ;
 
 : initialize ( elements -- elements paragraph )
     <reversed> unclip-slice 1paragraph 1array ;
index 638f5c8d565ede521f3d127ba81a503d77d445cd..65338dc88bb41d8590f4b9aa3231bad9784376c0 100644 (file)
@@ -447,9 +447,6 @@ X-FUNCTION: Status XDrawString (
 
 ! 8.7 - Transferring Images between Client and Server
 
-CONSTANT: XYBitmap 0
-CONSTANT: XYPixmap 1
-CONSTANT: ZPixmap  2
 CONSTANT: AllPlanes -1
 
 C-STRUCT: XImage-funcs
index 34473fecfcb193a3db96ef5201da261bb0031597..0f04f1b7b2e5cbc7b3df4c647bdce87ab2984d2b 100644 (file)
@@ -50,7 +50,7 @@ ARTICLE: { "xml.syntax" "interpolation" } "XML interpolation syntax"
 $nl
 "These forms can be used where a tag might go, as in " { $snippet "[XML <foo><-></foo> XML]" } " or where an attribute might go, as in " { $snippet "[XML <foo bar=<->/> XML]" } ". When an attribute is spliced in, it is not included if the value is " { $snippet "f" } " and if the value is not a string, the value is put through " { $link present } ". Here is an example of the fry style of XML interpolation:"
 { $example 
-{" USING: splitting sequences xml.writer xml.syntax ;
+{" USING: splitting xml.writer xml.syntax ;
 "one two three" " " split
 [ [XML <item><-></item> XML] ] map
 <XML <doc><-></doc> XML> pprint-xml"}
@@ -86,7 +86,7 @@ $nl
 {" <?xml version="1.0" encoding="UTF-8"?>
 <x number="3" url="http://factorcode.org/" string="hello" word="drop"/>"} }
 "XML interpolation can also be used, in conjunction with " { $vocab-link "inverse" } " in pattern matching. For example:"
-{ $example {" USING: sequences xml.syntax inverse ;
+{ $example {" USING: xml.syntax inverse ;
 : dispatch ( xml -- string )
     {
         { [ [XML <a><-></a> XML] ] [ "a" prepend ] }
index 6fcaf780cc368ac9a59b801f542777fdcab0b4c4..06ba2028a67a1d4e10ae7b12cffa2bcde735ef56 100644 (file)
@@ -100,8 +100,6 @@ XML-NS: foo http://blah.com
 
 [ "" ] [ [XML XML] concat ] unit-test
 
-USE: inverse
-
 [ "foo" ] [ [XML <a>foo</a> XML] [ [XML <a><-></a> XML] ] undo ] unit-test
 [ "foo" ] [ [XML <a bar='foo'/> XML] [ [XML <a bar=<-> /> XML] ] undo ] unit-test
 [ "foo" "baz" ] [ [XML <a bar='foo'>baz</a> XML] [ [XML <a bar=<->><-></a> XML] ] undo ] unit-test
index f39592036cd35e17c4606a1f2c587167c4fcc98c..7561d674820f7ff7fe7918ef0522bac0e9eafa28 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2009 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
-USING: words assocs kernel accessors parser effects.parser
-sequences summary lexer splitting combinators locals xml.data
+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
index b5141f6cc4bbe0959fd881f7dd7a3ff390c9e9d0..a4c2094da77fe0e21f9e1175ab93e1746abb5ca1 100644 (file)
@@ -1,6 +1,6 @@
-USING: xmode.tokens xmode.marker xmode.catalog kernel locals
-io io.files sequences words io.encodings.utf8
-namespaces xml.entities accessors xml.syntax locals xml.writer ;
+USING: xmode.tokens xmode.marker xmode.catalog kernel io io.files
+sequences words io.encodings.utf8 namespaces xml.entities accessors
+xml.syntax locals xml.writer ;
 IN: xmode.code2html
 
 : htmlize-tokens ( tokens -- xml )
index b4c1cd6a48dfaf50410a75d1da25adbb5275171e..febfc2b40f6a189a38c8b19251ce62025a1c3ded 100755 (executable)
@@ -3,8 +3,7 @@
 USING: kernel namespaces make xmode.rules xmode.tokens
 xmode.marker.state xmode.marker.context xmode.utilities
 xmode.catalog sequences math assocs combinators strings
-regexp splitting unicode.case ascii
-combinators.short-circuit accessors ;
+regexp splitting ascii combinators.short-circuit accessors ;
 IN: xmode.marker
 
 ! Next two words copied from parser-combinators
index d4046a4dcfe5f3a348a236e1ccbae77c708a8f26..e56fedbd26ea63a1709a201d8cddb306b9483333 100755 (executable)
@@ -21,7 +21,7 @@ ARTICLE: "enums" "Enumerations"
 { $subsection enum }
 { $subsection <enum> }
 "Inverting a permutation using enumerations:"
-{ $example "USING: assocs sorting prettyprint ;" "IN: scratchpad" ": invert ( perm -- perm' )" "    <enum> >alist sort-values keys ;" "{ 2 0 4 1 3 } invert ." "{ 1 3 0 4 2 }" } ;
+{ $example "IN: scratchpad" ": invert ( perm -- perm' )" "    <enum> >alist sort-values keys ;" "{ 2 0 4 1 3 } invert ." "{ 1 3 0 4 2 }" } ;
 
 HELP: enum
 { $class-description "An associative structure which wraps a sequence and maps integers to the corresponding elements of the sequence."
index 1da2dfee59c36bd363479685456c124c0f40a35e..088a8a632019ce8c9e545600a297ca753fe1940a 100644 (file)
@@ -1,10 +1,10 @@
-! Copyright (C) 2004, 2008 Slava Pestov.
+! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays debugger generic hashtables io assocs
-kernel.private kernel math memory namespaces make parser
-prettyprint sequences vectors words system splitting
-init io.files bootstrap.image bootstrap.image.private vocabs
-vocabs.loader system debugger continuations ;
+USING: arrays debugger generic hashtables io assocs kernel.private
+kernel math memory namespaces make parser prettyprint sequences
+vectors words system splitting init io.files vocabs vocabs.loader
+debugger continuations ;
+QUALIFIED: bootstrap.image.private
 IN: bootstrap.stage1
 
 "Bootstrap stage 1..." print flush
@@ -51,4 +51,4 @@ load-help? off
         ] if
     ] %
 ] [ ] make
-bootstrap-boot-quot set
+bootstrap.image.private:bootstrap-boot-quot set
index 55b92df215e3cda1c8430b3eb3a8a83b58b01fb7..f5182a02100b548208c4e4355870680eee642b51 100644 (file)
@@ -51,6 +51,7 @@ IN: bootstrap.syntax
     "UNION:"
     "INTERSECTION:"
     "USE:"
+    "UNUSE:"
     "USING:"
     "QUALIFIED:"
     "QUALIFIED-WITH:"
index 3069c4b555333a8b2bcbd0eb8d1f59eb46d8c253..a1e83ff72ca9ac5a8306cfb025ad219c2b5a3023 100644 (file)
@@ -1,6 +1,6 @@
 USING: alien arrays definitions generic assocs hashtables io\r
 kernel math namespaces parser prettyprint sequences strings\r
-tools.test vectors words quotations classes classes.algebra\r
+tools.test words quotations classes classes.algebra\r
 classes.private classes.union classes.mixin classes.predicate\r
 vectors definitions source-files compiler.units growable\r
 random stack-checker effects kernel.private sbufs math.order\r
index f8a2ff415c734f183d76c788e29cd1ea3ed1a8cf..109a3b8089d58038cdf889c5d1ab169899823006 100644 (file)
@@ -1,6 +1,6 @@
 USING: help.markup help.syntax kernel kernel.private
-namespaces sequences words arrays layouts effects math
-layouts classes.private classes.union classes.mixin
+namespaces sequences words arrays effects math
+classes.private classes.union classes.mixin
 classes.predicate quotations ;
 IN: classes
 
index 61d153f064c1557e45479b0413abc9237b735317..d7fba97977959b0948afc89bcc819265ab2b5e8c 100644 (file)
@@ -1,4 +1,4 @@
-USING: alien arrays definitions generic assocs hashtables io
+USING: alien arrays generic assocs hashtables io
 io.streams.string kernel math namespaces parser prettyprint
 sequences strings tools.test vectors words quotations classes
 classes.private classes.union classes.mixin classes.predicate
index e9ca706d63924871353b2b166b22b6a80aab18b3..fbd41f5407ea39c4ce75b65541f00c7e026bf214 100644 (file)
@@ -1,5 +1,5 @@
 USING: generic help.markup help.syntax kernel kernel.private
-namespaces sequences words arrays layouts help effects math
+namespaces sequences words arrays help effects math
 layouts classes.private classes compiler.units ;
 IN: classes.intersection
 
index f44642fdd5eaf7588d83ecaba07cf651fa2bc52a..a9a7952c51672b99e6d927a93e0c9ddb6a9410a7 100644 (file)
@@ -1,9 +1,8 @@
-USING: alien arrays definitions generic assocs hashtables io
-kernel math namespaces parser prettyprint sequences strings
-tools.test vectors words quotations classes
-classes.private classes.union classes.mixin classes.predicate
-classes.algebra vectors definitions source-files
-compiler.units kernel.private sorting vocabs eval ;
+USING: alien arrays definitions generic assocs hashtables io kernel
+math namespaces parser prettyprint sequences strings tools.test words
+quotations classes classes.private classes.union classes.mixin
+classes.predicate classes.algebra vectors source-files compiler.units
+kernel.private sorting vocabs eval ;
 IN: classes.mixin.tests
 
 ! Test mixins
index 17a7b235528dfae9ef114791ac11f2cb39113eed..bd2e6ea4a07e3f28b3a3f85b95d3484c153c933f 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: parser words kernel classes compiler.units lexer ;
+USING: parser vocabs.parser words kernel classes compiler.units lexer ;
 IN: classes.parser
 
 : save-class-location ( class -- )
index 80613f4f2e6ac0704fe2ee6368a2d5d9b690b546..951608931bd415f0d3776f95af4ac88ca1d381d5 100644 (file)
@@ -29,6 +29,6 @@ PREDICATE: tuple-c < tuple-b slot>> ;
 
 GENERIC: ptest ( tuple -- )
 M: tuple-a ptest drop ;
-IN: classes.predicate.tests USING: kernel ; M: tuple-c ptest drop ;
+M: tuple-c ptest drop ;
 
 [ ] [ tuple-b new ptest ] unit-test
index 85a6249dd3090dab000b4a641d1d55e19fe3dd68..efb77e32746b2cc1791fd338da086a10de80a1ef 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel sets namespaces make sequences parser
 lexer combinators words classes.parser classes.tuple arrays
-slots math assocs ;
+slots math assocs parser.notes ;
 IN: classes.tuple.parser
 
 : slot-names ( slots -- seq )
index 466b221877569b55eba738610fa87ba4a269524f..e3452194c69b9bec1777f77b98e41e94abfb71c8 100644 (file)
@@ -5,7 +5,7 @@ generic.standard effects classes.tuple classes.tuple.private arrays
 vectors strings compiler.units accessors classes.algebra calendar
 prettyprint io.streams.string splitting summary columns math.order
 classes.private slots slots.private eval see words.symbol
-compiler.errors ;
+compiler.errors parser.notes ;
 IN: classes.tuple.tests
 
 TUPLE: rect x y w h ;
index 3d7312a88986ebc16b38bd91fdc27fd0c6c45508..4117010fff015593943295e54dae1c327c8f11b7 100644 (file)
@@ -1,6 +1,6 @@
 USING: generic help.markup help.syntax kernel kernel.private
-namespaces sequences words arrays layouts help effects math
-layouts classes.private classes compiler.units ;
+namespaces sequences words arrays help effects math
+classes.private classes compiler.units ;
 IN: classes.union
 
 ARTICLE: "unions" "Union classes"
index 1a17e8c1fbf34e99549600db5c7a7feac1573150..72602c25b90abcb5f383dc697d1e5280dbd6f58a 100755 (executable)
@@ -152,7 +152,6 @@ ARTICLE: "compositional-examples" "Examples of compositional combinator usage"
 { $code ": subtract-n ( seq n -- seq' ) swap [ over - ] map nip ;" }
 "Three shuffle words are required to pass the value around. Instead, the loop-invariant value can be partially applied to a quotation using " { $link curry } ", yielding a new quotation that is passed to " { $link map } ":"
 { $example
-  "USING: kernel math prettyprint sequences ;"
   ": subtract-n ( seq n -- seq' ) [ - ] curry map ;"
   "{ 10 20 30 } 5 subtract-n ."
   "{ 5 15 25 }"
@@ -163,7 +162,6 @@ $nl
 { $code ": n-subtract ( n seq -- seq' ) swap [ swap - ] curry map ;" }
 "Since this pattern comes up often, " { $link with } " encapsulates it:"
 { $example
-  "USING: kernel math prettyprint sequences ;"
   ": n-subtract ( n seq -- seq' ) [ - ] with map ;"
   "30 { 10 20 30 } n-subtract ."
   "{ 20 10 0 }"
index 0140fcc0e8cd51fa7678e9bb10a5451e372ceb09..5d8e88b85f5b2ee4a78109e618f868d8773cf913 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: continuations continuations.private kernel
-kernel.private sequences assocs namespaces namespaces.private
-continuations continuations.private ;
+kernel.private sequences assocs namespaces namespaces.private ;
 IN: init
 
 SYMBOL: init-hooks
index ac3fbef8d06da264ab77d0613f82cd629c089347..84d1f52b9caec53491da3d2632c73371502ddb1a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: init kernel system namespaces io io.encodings
-io.encodings.utf8 init assocs splitting alien ;
+io.encodings.utf8 assocs splitting alien ;
 IN: io.backend
 
 SYMBOL: io-backend
index 22e0e76451f87222df5e0d88e836fee8b3b0ff46..b617544084c32516abaa295d1c7279f273dea7e6 100644 (file)
@@ -1,6 +1,6 @@
 USING: generic help.markup help.syntax math memory
 namespaces sequences kernel.private layouts classes
-kernel.private vectors combinators quotations strings words
+vectors combinators quotations strings words
 assocs arrays math.order ;
 IN: kernel
 
index d3ec6c3e57a2db8943e7479881afd3c1f20ce3f5..7808872588b0a90187c06a74306ff6608bb9507b 100644 (file)
@@ -48,7 +48,7 @@ $nl
 "The accumulator sequence can be accessed directly from inside a " { $link make } ":"
 { $subsection building }
 { $example
-  "USING: make math.parser io ;"
+  "USING: make math.parser ;"
   "[ \"Language #\" % CHAR: \\s , 5 # ] \"\" make print"
   "Language # 5"
 }
diff --git a/core/parser/notes/authors.txt b/core/parser/notes/authors.txt
new file mode 100644 (file)
index 0000000..d4f5d6b
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
\ No newline at end of file
diff --git a/core/parser/notes/notes-docs.factor b/core/parser/notes/notes-docs.factor
new file mode 100644 (file)
index 0000000..f9a86c6
--- /dev/null
@@ -0,0 +1,10 @@
+USING: help.markup help.syntax io ;
+IN: parser.notes
+
+HELP: parser-notes
+{ $var-description "A boolean controlling whether the parser will print various notes. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ;
+
+HELP: parser-notes?
+{ $values { "?" "a boolean" } }
+{ $description "Tests if the parser will print various notes and warnings. To disable parser notes, either set " { $link parser-notes } " to " { $link f } ", or pass the " { $snippet "-quiet" } " command line switch." } ;
+
diff --git a/core/parser/notes/notes-tests.factor b/core/parser/notes/notes-tests.factor
new file mode 100644 (file)
index 0000000..78fa9e2
--- /dev/null
@@ -0,0 +1,4 @@
+USING: lexer namespaces parser.notes source-files tools.test ;
+IN: parser.notes.tests
+
+[ ] [ f lexer set f file set "Hello world" note. ] unit-test
\ No newline at end of file
diff --git a/core/parser/notes/notes.factor b/core/parser/notes/notes.factor
new file mode 100644 (file)
index 0000000..3f702d3
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2009 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: namespaces kernel source-files lexer accessors io math.parser ;
+IN: parser.notes
+
+SYMBOL: parser-notes
+
+t parser-notes set-global
+
+: parser-notes? ( -- ? )
+    parser-notes get "quiet" get not and ;
+
+: note. ( str -- )
+    parser-notes? [
+        file get [ path>> write ":" write ] when* 
+        lexer get [ line>> number>string write ": " write ] when*
+        "Note:" print dup print
+    ] when drop ;
\ No newline at end of file
index 98f41ae39aac72ab8f5441e425b0a7b2f469f7f5..ec0810509bf2df1ff171d93dfd7365ef74e8b4db 100644 (file)
@@ -1,7 +1,7 @@
 USING: help.markup help.syntax kernel sequences words
 math strings vectors quotations generic effects classes
 vocabs.loader definitions io vocabs source-files
-quotations namespaces compiler.units assocs lexer
+namespaces compiler.units assocs lexer
 words.symbol words.alias words.constant vocabs.parser ;
 IN: parser
 
@@ -70,7 +70,8 @@ $nl
 { $subsection "reading-ahead" }
 { $subsection "parsing-word-nest" }
 { $subsection "defining-words" }
-{ $subsection "parsing-tokens" } ;
+{ $subsection "parsing-tokens" }
+{ $subsection "word-search-parsing" } ;
 
 ARTICLE: "parser-files" "Parsing source files"
 "The parser can run source files:"
@@ -84,7 +85,7 @@ $nl
 ARTICLE: "top-level-forms" "Top level forms"
 "Any code outside of a definition is known as a " { $emphasis "top-level form" } "; top-level forms are run after the entire source file has been parsed, regardless of their position in the file."
 $nl
-"Top-level forms do not have access to the " { $link in } " and " { $link use } " variables that were set at parse time, nor do they run inside " { $link with-compilation-unit } "; so meta-programming might require extra work in a top-level form compared with a parsing word."
+"Top-level forms cannot access the parse-time manifest (" { $link "word-search-parsing" } "), nor do they run inside " { $link with-compilation-unit } "; as a result, meta-programming might require extra work in a top-level form compared with a parsing word."
 $nl
 "Also, top-level forms run in a new dynamic scope, so using " { $link set } " to store values is almost always wrong, since the values will be lost after the top-level form completes. To save values computed by a top-level form, either use " { $link set-global } " or define a new word with the value." ;
 
@@ -109,56 +110,9 @@ HELP: save-location
 { $values { "definition" "a definition specifier" } }
 { $description "Saves the location of a definition and associates this definition with the current source file." } ;
 
-HELP: parser-notes
-{ $var-description "A boolean controlling whether the parser will print various notes. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ;
-
-HELP: parser-notes?
-{ $values { "?" "a boolean" } }
-{ $description "Tests if the parser will print various notes and warnings. To disable parser notes, either set " { $link parser-notes } " to " { $link f } ", or pass the " { $snippet "-quiet" } " command line switch." } ;
-
 HELP: bad-number
 { $error-description "Indicates the parser encountered an invalid numeric literal." } ;
 
-HELP: use
-{ $var-description "A variable holding the current vocabulary search path as a sequence of assocs." } ;
-
-{ use in use+ (use+) set-use set-in POSTPONE: USING: POSTPONE: USE: with-file-vocabs with-interactive-vocabs } related-words
-
-HELP: in
-{ $var-description "A variable holding the name of the current vocabulary for new definitions." } ;
-
-HELP: current-vocab
-{ $values { "str" "a vocabulary" } }
-{ $description "Returns the vocabulary stored in the " { $link in } " symbol. Throws an error if the current vocabulary is " { $link f } "." } ;
-
-HELP: (use+)
-{ $values { "vocab" "an assoc mapping strings to words" } }
-{ $description "Adds an assoc at the front of the search path." }
-$parsing-note ;
-
-HELP: use+
-{ $values { "vocab" string } }
-{ $description "Adds a new vocabulary at the front of the search path after loading it if necessary. Subsequent word lookups by the parser will search this vocabulary first." }
-$parsing-note
-{ $errors "Throws an error if the vocabulary does not exist." } ;
-
-HELP: set-use
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Sets the vocabulary search path. Later vocabularies take precedence." }
-{ $errors "Throws an error if one of the vocabularies does not exist." }
-$parsing-note ;
-
-HELP: add-use
-{ $values { "seq" "a sequence of strings" } }
-{ $description "Adds multiple vocabularies to the search path, with later vocabularies taking precedence." }
-{ $errors "Throws an error if one of the vocabularies does not exist." }
-$parsing-note ;
-
-HELP: set-in
-{ $values { "name" string } }
-{ $description "Sets the current vocabulary where new words will be defined, creating the vocabulary first if it does not exist." }
-$parsing-note ;
-
 HELP: create-in
 { $values { "str" "a word name" } { "word" "a new word" } }
 { $description "Creates a word in the current vocabulary. Until re-defined, the word throws an error when invoked." }
@@ -178,11 +132,6 @@ HELP: no-word
 { $values { "name" string } { "newword" word } }
 { $description "Throws a " { $link no-word-error } "." } ;
 
-HELP: search
-{ $values { "str" string } { "word/f" "a word or " { $link f } } }
-{ $description "Searches for a word by name in the current vocabulary search path. If no such word could be found, outputs " { $link f } "." }
-$parsing-note ;
-
 HELP: scan-word
 { $values { "word/number/f" "a word, number or " { $link f } } }
 { $description "Reads the next token from parser input. If the token is a valid number literal, it is converted to a number, otherwise the dictionary is searched for a word named by the token. Outputs " { $link f } " if the end of the input has been reached." }
@@ -290,4 +239,4 @@ HELP: staging-violation
 
 HELP: auto-use?
 { $var-description "If set to a true value, the behavior of the parser when encountering an unknown word name is changed. If only one loaded vocabulary has a word with this name, instead of throwing an error, the parser adds the vocabulary to the search path and prints a parse note. Off by default." }
-{ $notes "This feature is intended to help during development. To generate a " { $link POSTPONE: USING: } " form automatically, enable " { $link auto-use? } ", load the source file, and copy and paste the " { $link POSTPONE: USING: } " form printed by the parser back into the file, then disable " { $link auto-use? } ". See " { $link "vocabulary-search-errors" } "." } ;
+{ $notes "This feature is intended to help during development. To generate a " { $link POSTPONE: USING: } " form automatically, enable " { $link auto-use? } ", load the source file, and copy and paste the " { $link POSTPONE: USING: } " form printed by the parser back into the file, then disable " { $link auto-use? } ". See " { $link "word-search-errors" } "." } ;
index e944ecc6f29ed0a1963a03117b7388dc5f69231b..a9e0bd08abff874a95767251f3560a6cc9653155 100644 (file)
@@ -4,7 +4,7 @@ sequences strings io.files io.pathnames definitions
 continuations sorting classes.tuple compiler.units debugger
 vocabs vocabs.loader accessors eval combinators lexer
 vocabs.parser words.symbol multiline source-files.errors
-tools.crossref ;
+tools.crossref grouping ;
 IN: parser.tests
 
 [
@@ -87,18 +87,6 @@ IN: parser.tests
     [ "OCT: 999" eval( -- obj ) ] must-fail
     [ "BIN: --0" eval( -- obj ) ] must-fail
 
-    ! Another funny bug
-    [ t ] [
-        [
-            "scratchpad" in set
-            { "scratchpad" "arrays" } set-use
-            [
-                ! This shouldn't modify in/use in the outer scope!
-            ] with-file-vocabs
-
-            use get { "scratchpad" "arrays" } set-use use get =
-        ] with-scope
-    ] unit-test
     DEFER: foo
 
     "IN: parser.tests USING: math prettyprint ; SYNTAX: foo 2 2 + . ;" eval( -- )
@@ -493,8 +481,6 @@ DEFER: blahy
 [ "IN: parser.tests USE: kernel TUPLE: blahy < tuple ; : blahy ( -- ) ; TUPLE: blahy < tuple ; : blahy ( -- ) ;" eval( -- ) ]
 [ error>> error>> def>> \ blahy eq? ] must-fail-with
 
-[ ] [ f lexer set f file set "Hello world" note. ] unit-test
-
 [ "CHAR: \\u9999999999999" eval( -- n ) ] must-fail
 
 SYMBOLS: a b c ;
@@ -583,3 +569,53 @@ EXCLUDE: qualified.tests.bar => x ;
 
 [ t ] [ "is-not-deferred" "parser.tests" lookup >boolean ] unit-test
 [ t ] [ "is-not-deferred" "parser.tests" lookup deferred? ] unit-test
+
+! Forward-reference resolution case iterated using list in the wrong direction
+[ [ ] ] [
+    "IN: parser.tests.forward-ref-1 DEFER: x DEFER: y"
+    <string-reader> "forward-ref-1" parse-stream
+] unit-test
+
+[ [ ] ] [
+    "IN: parser.tests.forward-ref-2 DEFER: x DEFER: y"
+    <string-reader> "forward-ref-2" parse-stream
+] unit-test
+
+[ [ ] ] [
+    "IN: parser.tests.forward-ref-3 FROM: parser.tests.forward-ref-1 => x y ; FROM: parser.tests.forward-ref-2 => x y ; : z ( -- ) x y ;"
+    <string-reader> "forward-ref-3" parse-stream
+] unit-test
+
+[ t ] [
+    "z" "parser.tests.forward-ref-3" lookup def>> [ vocabulary>> ] map all-equal?
+] unit-test
+
+[ [ ] ] [
+    "FROM: parser.tests.forward-ref-1 => x y ; FROM: parser.tests.forward-ref-2 => x y ; IN: parser.tests.forward-ref-3 : x ( -- ) ; : z ( -- ) x y ;"
+    <string-reader> "forward-ref-3" parse-stream
+] unit-test
+
+[ f ] [
+    "z" "parser.tests.forward-ref-3" lookup def>> [ vocabulary>> ] map all-equal?
+] unit-test
+
+[ [ ] ] [
+    "IN: parser.tests.forward-ref-3 FROM: parser.tests.forward-ref-1 => x y ; FROM: parser.tests.forward-ref-2 => x y ; : z ( -- ) x y ;"
+    <string-reader> "forward-ref-3" parse-stream
+] unit-test
+
+[ t ] [
+    "z" "parser.tests.forward-ref-3" lookup def>> [ vocabulary>> ] map all-equal?
+] unit-test
+
+[ [ dup ] ] [
+    "USE: kernel dup" <string-reader> "unuse-test" parse-stream
+] unit-test
+
+[
+    "dup" <string-reader> "unuse-test" parse-stream
+] [ error>> error>> error>> no-word-error? ] must-fail-with
+
+[
+    "USE: kernel UNUSE: kernel dup" <string-reader> "unuse-test" parse-stream
+] [ error>> error>> error>> no-word-error? ] must-fail-with
\ No newline at end of file
index 01e0b18887d3ef7d5a2cf4b1cb0b87988bbd58c0..8d52dcaa2cb50269031cf1ec3fbc4c85f7406f7e 100644 (file)
@@ -5,7 +5,7 @@ sequences strings vectors words words.symbol quotations io
 combinators sorting splitting math.parser effects continuations
 io.files vocabs io.encodings.utf8 source-files classes
 hashtables compiler.units accessors sets lexer vocabs.parser
-effects.parser slots ;
+effects.parser slots parser.notes ;
 IN: parser
 
 : location ( -- loc )
@@ -15,32 +15,8 @@ IN: parser
 : save-location ( definition -- )
     location remember-definition ;
 
-SYMBOL: parser-notes
-
-t parser-notes set-global
-
-: parser-notes? ( -- ? )
-    parser-notes get "quiet" get not and ;
-
-: note. ( str -- )
-    parser-notes? [
-        file get [ path>> write ":" write ] when* 
-        lexer get [ line>> number>string write ": " write ] when*
-        "Note:" print dup print
-    ] when drop ;
-
 M: parsing-word stack-effect drop (( parsed -- parsed )) ;
 
-TUPLE: no-current-vocab ;
-
-: no-current-vocab ( -- vocab )
-    \ no-current-vocab boa
-    { { "Define words in scratchpad vocabulary" "scratchpad" } }
-    throw-restarts dup set-in ;
-
-: current-vocab ( -- str )
-    in get [ no-current-vocab ] unless* ;
-
 : create-in ( str -- word )
     current-vocab create dup set-word dup save-location ;
 
@@ -48,17 +24,13 @@ TUPLE: no-current-vocab ;
 
 : CREATE-WORD ( -- word ) CREATE dup reset-generic ;
 
-SYMBOL: amended-use
-
 SYMBOL: auto-use?
 
 : no-word-restarted ( restart-value -- word )
     dup word? [
         dup vocabulary>>
-        [ (use+) ]
-        [ amended-use get dup [ push ] [ 2drop ] if ]
-        [ "Added \"" "\" vocabulary to search path" surround note. ]
-        tri
+        [ auto-use-vocab ]
+        [ "Added \"" "\" vocabulary to search path" surround note. ] bi
     ] [ create-in ] if ;
 
 : no-word ( name -- newword )
@@ -68,19 +40,6 @@ SYMBOL: auto-use?
     [ <no-word-error> throw-restarts no-word-restarted ]
     if ;
 
-: check-forward ( str word -- word/f )
-    dup forward-reference? [
-        drop
-        use get
-        [ at ] with map sift
-        [ forward-reference? not ] find nip
-    ] [
-        nip
-    ] if ;
-
-: search ( str -- word/f )
-    dup use get assoc-stack check-forward ;
-
 : scan-word ( -- word/number/f )
     scan dup [
         dup search [ ] [
@@ -147,8 +106,9 @@ SYMBOL: bootstrap-syntax
 
 : with-file-vocabs ( quot -- )
     [
-        f in set { "syntax" } set-use
-        bootstrap-syntax get [ use get push ] when*
+        <manifest> manifest set
+        "syntax" use-vocab
+        bootstrap-syntax get [ use-words ] when*
         call
     ] with-scope ; inline
 
@@ -208,8 +168,9 @@ SYMBOL: interactive-vocabs
 
 : with-interactive-vocabs ( quot -- )
     [
-        "scratchpad" in set
-        interactive-vocabs get set-use
+        <manifest> manifest set
+        "scratchpad" set-current-vocab
+        interactive-vocabs get only-use-vocabs
         call
     ] with-scope ; inline
 
@@ -219,9 +180,8 @@ print-use-hook [ [ ] ] initialize
 
 : parse-fresh ( lines -- quot )
     [
-        V{ } clone amended-use set
         parse-lines
-        amended-use get empty? [ print-use-hook get call( -- ) ] unless
+        auto-used? [ print-use-hook get call( -- ) ] when
     ] with-file-vocabs ;
 
 : parsing-file ( file -- )
index 5590432ef4ca3908facee7aadd6fb31fcb704b26..0b2c170c1e6dacb46f29af1afae00b77256b4942 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2004, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel math strings sequences.private sequences
+USING: accessors kernel math sequences.private sequences
 strings growable strings.private ;
 IN: sbufs
 
index dd48501fa03ec6060c848dfe5ca6f35708768f62..99dddb8aedf744a9943b7c0af6ed5c6749236e5f 100755 (executable)
@@ -834,11 +834,20 @@ PRIVATE>
     [ [ 2unclip-slice ] dip [ call ] keep ] dip
     compose 2reduce ; inline
 
-: map-find ( seq quot -- result elt )
-    [ f ] 2dip
-    [ [ nip ] dip call dup ] curry find
+<PRIVATE
+
+: (map-find) ( seq quot find-quot -- result elt )
+    [ [ f ] 2dip [ [ nip ] dip call dup ] curry ] dip call
     [ [ drop f ] unless ] dip ; inline
 
+PRIVATE>
+
+: map-find ( seq quot -- result elt )
+    [ find ] (map-find) ; inline
+
+: map-find-last ( seq quot -- result elt )
+    [ find-last ] (map-find) ; inline
+
 : unclip-last-slice ( seq -- butlast-slice last )
     [ but-last-slice ] [ peek ] bi ; inline
 
index 1e5f9bf1ddbf4e7fcc4e4547724c7f4817be690e..eb0e07c71d7547a3f2eadc347ff39701eb60c574 100644 (file)
@@ -1,8 +1,7 @@
 USING: help.markup help.syntax generic kernel.private parser
-words kernel quotations namespaces sequences words arrays
-effects generic.standard classes.builtin
-slots.private classes strings math assocs byte-arrays alien
-math classes.tuple ;
+kernel quotations namespaces sequences arrays effects
+generic.standard classes.builtin slots.private classes strings math
+assocs byte-arrays alien classes.tuple ;
 IN: slots
 
 ARTICLE: "accessors" "Slot accessors"
index 6bb854daf625d05d8598dc365f492d3f902723c8..304ded0adbb5e836fb05732c9d5f4a8290735604 100755 (executable)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: arrays byte-arrays kernel kernel.private math namespaces
-make sequences strings words effects generic generic.standard
+make sequences strings effects generic generic.standard
 classes classes.algebra slots.private combinators accessors
 words sequences.private assocs alien quotations hashtables ;
 IN: slots
index f2fa6b8771542826c235e8b37df3f99741fd3b97..0c0951bbceb5d150ccd64fde3bad33762e3ab62e 100644 (file)
@@ -1,7 +1,7 @@
-! Copyright (C) 2005, 2008 Slava Pestov.
+! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays kernel math sequences vectors math.order
-sequences sequences.private math.order ;
+USING: accessors arrays kernel math vectors math.order
+sequences sequences.private ;
 IN: sorting
 
 ! Optimized merge-sort:
index fff355fb951e6a34316eb2e47fadb14837d7d3d8..d408da4bc742e4ef5181a64cee00756dbf39c21f 100644 (file)
@@ -1,7 +1,7 @@
 USING: generic help.syntax help.markup kernel math parser words
-effects classes generic.standard classes.tuple generic.math
-generic.standard generic.single arrays io.pathnames vocabs.loader io
-sequences assocs words.symbol words.alias words.constant combinators ;
+effects classes classes.tuple generic.math generic.single arrays
+io.pathnames vocabs.loader io sequences assocs words.symbol
+words.alias words.constant combinators vocabs.parser ;
 IN: syntax
 
 ARTICLE: "parser-algorithm" "Parser algorithm"
@@ -179,7 +179,7 @@ $nl
 ARTICLE: "syntax" "Syntax"
 "Factor has two main forms of syntax: " { $emphasis "definition" } " syntax and " { $emphasis "literal" } " syntax. Code is data, so the syntax for code is a special case of object literal syntax. This section documents literal syntax. Definition syntax is covered in " { $link "words" } ". Extending the parser is the main topic of " { $link "parser" } "."
 { $subsection "parser-algorithm" }
-{ $subsection "vocabulary-search" }
+{ $subsection "word-search" }
 { $subsection "top-level-forms" }
 { $subsection "syntax-comments" }
 { $subsection "syntax-literals" }
@@ -427,18 +427,33 @@ HELP: FORGET:
 HELP: USE:
 { $syntax "USE: vocabulary" }
 { $values { "vocabulary" "a vocabulary name" } }
-{ $description "Adds a new vocabulary at the front of the search path. Subsequent word lookups by the parser will search this vocabulary first." }
+{ $description "Adds a new vocabulary to the search path, loading it first if necessary." }
+{ $notes "If adding the vocabulary introduces ambiguity, referencing the ambiguous names will throw a " { $link ambiguous-use-error } "." }
+{ $errors "Throws an error if the vocabulary does not exist or could not be loaded." } ;
+
+HELP: UNUSE:
+{ $syntax "UNUSE: vocabulary" }
+{ $values { "vocabulary" "a vocabulary name" } }
+{ $description "Removes a vocabulary from the search path." }
 { $errors "Throws an error if the vocabulary does not exist." } ;
 
 HELP: USING:
 { $syntax "USING: vocabularies... ;" }
 { $values { "vocabularies" "a list of vocabulary names" } }
-{ $description "Adds a list of vocabularies to the front of the search path, with later vocabularies taking precedence." }
+{ $description "Adds a list of vocabularies to the search path." }
+{ $notes "If adding the vocabularies introduces ambiguity, referencing the ambiguous names will throw a " { $link ambiguous-use-error } "." }
 { $errors "Throws an error if one of the vocabularies does not exist." } ;
 
 HELP: QUALIFIED:
 { $syntax "QUALIFIED: vocab" }
-{ $description "Similar to " { $link POSTPONE: USE: } " but loads vocabulary with prefix." }
+{ $description "Adds the vocabulary's words, prefixed with the vocabulary name, to the search path." }
+{ $notes "If adding the vocabulary introduces ambiguity, the vocabulary will take precedence when resolving any ambiguous names. This is a rare case; for example, suppose a vocabulary " { $snippet "fish" } " defines a word named " { $snippet "go:fishing" } ", and a vocabulary named " { $snippet "go" } " defines a word named " { $snippet "finishing" } ". Then, the following will call the latter word:"
+  { $code
+  "USE: fish"
+  "QUALIFIED: go"
+  "go:fishing"
+  }
+}
 { $examples { $example
     "USING: prettyprint ;"
     "QUALIFIED: math"
@@ -447,7 +462,7 @@ HELP: QUALIFIED:
 
 HELP: QUALIFIED-WITH:
 { $syntax "QUALIFIED-WITH: vocab word-prefix" }
-{ $description "Works like " { $link POSTPONE: QUALIFIED: } " but uses " { $snippet "word-prefix" } " as prefix." }
+{ $description "Like " { $link POSTPONE: QUALIFIED: } " but uses " { $snippet "word-prefix" } " as prefix." }
 { $examples { $code
     "USING: prettyprint ;"
     "QUALIFIED-WITH: math m"
@@ -457,19 +472,25 @@ HELP: QUALIFIED-WITH:
 
 HELP: FROM:
 { $syntax "FROM: vocab => words ... ;" }
-{ $description "Imports " { $snippet "words" } " from " { $snippet "vocab" } "." }
-{ $examples { $code
-    "FROM: math.parser => bin> hex> ; ! imports only bin> and hex>" } } ;
+{ $description "Adds " { $snippet "words" } " from " { $snippet "vocab" } " to the search path." }
+{ $notes "If adding the words introduces ambiguity, the words will take precedence when resolving any ambiguous names." }
+{ $examples
+  "Both the " { $vocab-link "vocabs.parser" } " and " { $vocab-link "binary-search" } " vocabularies define a word named " { $snippet "search" } ". The following will throw an " { $link ambiguous-use-error } ":"
+  { $code "USING: vocabs.parser binary-search ;" "... search ..." }
+  "Because " { $link POSTPONE: FROM: } " takes precedence over a " { $link POSTPONE: USING: } ", the ambiguity can be resolved explicitly. Suppose you wanted the " { $vocab-link "binary-search" } " vocabulary's " { $snippet "search" } " word:"
+  { $code "USING: vocabs.parser binary-search ;" "FROM: binary-search => search ;" "... search ..." }
+ } ;
 
 HELP: EXCLUDE:
 { $syntax "EXCLUDE: vocab => words ... ;" }
-{ $description "Imports everything from " { $snippet "vocab" } " excluding " { $snippet "words" } "." }
+{ $description "Adds all words except for " { $snippet "words" } " from " { $snippet "vocab" } "  to the search path." }
 { $examples { $code
-    "EXCLUDE: math.parser => bin> hex> ; ! imports everything but bin> and hex>" } } ;
+    "EXCLUDE: math.parser => bin> hex> ;" "! imports everything but bin> and hex>" } } ;
 
 HELP: RENAME:
-{ $syntax "RENAME: word vocab => newname" }
-{ $description "Imports " { $snippet "word" } " from " { $snippet "vocab" } ", but renamed to " { $snippet "newname" } "." }
+{ $syntax "RENAME: word vocab => new-name" }
+{ $description "Imports " { $snippet "word" } " from " { $snippet "vocab" } ", but renamed to " { $snippet "new-name" } "." }
+{ $notes "If adding the words introduces ambiguity, the words will take precedence when resolving any ambiguous names." }
 { $examples { $example
     "USING: prettyprint ;"
     "RENAME: + math => -"
@@ -740,7 +761,7 @@ HELP: MAIN:
 
 HELP: <PRIVATE
 { $syntax "<PRIVATE ... PRIVATE>" }
-{ $description "Marks the start of a block of private word definitions. Private word definitions are placed in a vocabulary named by suffixing the current vocabulary with " { $snippet ".private" } "." }
+{ $description "Begins a block of private word definitions. Private word definitions are placed in the current vocabulary name, suffixed with " { $snippet ".private" } "." }
 { $notes
     "The following is an example of usage:"
     { $code
@@ -770,7 +791,7 @@ HELP: <PRIVATE
 
 HELP: PRIVATE>
 { $syntax "<PRIVATE ... PRIVATE>" }
-{ $description "Marks the end of a block of private word definitions." } ;
+{ $description "Ends a block of private word definitions." } ;
 
 { POSTPONE: <PRIVATE POSTPONE: PRIVATE> } related-words
 
index 7d710717aaa93b4939c9af1d0a773b900a0ece18..56ac9fa36e1ba5880a11d359535a1dd5f8b949f0 100644 (file)
@@ -41,28 +41,28 @@ IN: bootstrap.syntax
 
     "#!" [ POSTPONE: ! ] define-core-syntax
 
-    "IN:" [ scan set-in ] define-core-syntax
+    "IN:" [ scan set-current-vocab ] define-core-syntax
 
-    "PRIVATE>" [ in get ".private" ?tail drop set-in ] define-core-syntax
+    "<PRIVATE" [ begin-private ] define-core-syntax
 
-    "<PRIVATE" [
-        POSTPONE: PRIVATE> in get ".private" append set-in
-    ] define-core-syntax
+    "PRIVATE>" [ end-private ] define-core-syntax
+
+    "USE:" [ scan use-vocab ] define-core-syntax
 
-    "USE:" [ scan use+ ] define-core-syntax
+    "UNUSE:" [ scan unuse-vocab ] define-core-syntax
 
-    "USING:" [ ";" parse-tokens add-use ] define-core-syntax
+    "USING:" [ ";" parse-tokens [ use-vocab ] each ] define-core-syntax
 
     "QUALIFIED:" [ scan dup add-qualified ] define-core-syntax
 
     "QUALIFIED-WITH:" [ scan scan add-qualified ] define-core-syntax
 
     "FROM:" [
-        scan "=>" expect ";" parse-tokens swap add-words-from
+        scan "=>" expect ";" parse-tokens add-words-from
     ] define-core-syntax
 
     "EXCLUDE:" [
-        scan "=>" expect ";" parse-tokens swap add-words-excluding
+        scan "=>" expect ";" parse-tokens add-words-excluding
     ] define-core-syntax
 
     "RENAME:" [
@@ -227,7 +227,7 @@ IN: bootstrap.syntax
         "))" parse-effect parsed
     ] define-core-syntax
 
-    "MAIN:" [ scan-word in get vocab (>>main) ] define-core-syntax
+    "MAIN:" [ scan-word current-vocab (>>main) ] define-core-syntax
 
     "<<" [
         [
index 71862402cdefaac3b58da02987ab8155582f6660..e54993b6ebc0f628854fe2c1df868b03ac4d0b54 100644 (file)
@@ -1,43 +1,7 @@
-USING: help.markup help.syntax parser ;
+USING: help.markup help.syntax parser strings words assocs vocabs ;
 IN: vocabs.parser
 
-ARTICLE: "vocabulary-search-shadow" "Shadowing word names"
-"If adding a vocabulary to the search path results in a word in another vocabulary becoming inaccessible due to the new vocabulary defining a word with the same name, we say that the old word has been " { $emphasis "shadowed" } "."
-$nl
-"Here is an example where shadowing occurs:"
-{ $code
-    "IN: foe"
-    "USING: sequences io ;"
-    ""
-    ": append"
-    "    \"foe::append calls sequences:append\" print  append ;"
-    ""
-    "IN: fee"
-    ""
-    ": append"
-    "    \"fee::append calls fee:append\" print  append ;"
-    ""
-    "IN: fox"
-    "USE: foe"
-    ""
-    ": append"
-    "    \"fox::append calls foe:append\" print  append ;"
-    ""
-    "\"1234\" \"5678\" append print"
-    ""
-    "USE: fox"
-    "\"1234\" \"5678\" append print"
-}
-"When placed in a source file and run, the above code produces the following output:"
-{ $code
-    "foe:append calls sequences:append"
-    "12345678"
-    "fee:append calls foe:append"
-    "foe:append calls sequences:append"
-    "12345678"
-} ;
-
-ARTICLE: "vocabulary-search-errors"  "Word lookup errors"
+ARTICLE: "word-search-errors"  "Word lookup errors"
 "If the parser cannot not find a word in the current vocabulary search path, it attempts to look for the word in all loaded vocabularies."
 $nl
 "If " { $link auto-use? } " mode is off, a restartable error is thrown with a restart for each vocabulary in question, together with a restart which defers the word in the current vocabulary, as if " { $link POSTPONE: DEFER: } " was used."
@@ -47,34 +11,154 @@ $nl
 "If any restarts were invoked, or if " { $link auto-use? } " is on, the parser will print the correct " { $link POSTPONE: USING: } " after parsing completes. This form can be copy and pasted back into the source file."
 { $subsection auto-use? } ;
 
-ARTICLE: "vocabulary-search" "Vocabulary search path"
-"When the parser reads a token, it attempts to look up a word named by that token. The lookup is performed by searching each vocabulary in the search path, in order."
-$nl
-"For a source file the vocabulary search path starts off with one vocabulary:"
-{ $code "syntax" }
-"The " { $vocab-link "syntax" } " vocabulary consists of a set of parsing words for reading Factor data and defining new words."
-$nl
-"In the listener, the " { $vocab-link "scratchpad" } " is the default vocabulary for new word definitions. However, when loading source files, there is no default vocabulary. Defining words before declaring a vocabulary with " { $link POSTPONE: IN: } " results in an error."
-$nl
-"At the interactive listener, the default search path contains many more vocabularies. Details on the default search path and parser invocation are found in " { $link "parser" } "."
-$nl
-"Three parsing words deal with the vocabulary search path:"
-{ $subsection POSTPONE: IN: }
+ARTICLE: "word-search-syntax" "Syntax to control word lookup"
+"Parsing words which make all words in a vocabulary available:"
 { $subsection POSTPONE: USE: }
 { $subsection POSTPONE: USING: }
-"There are some additional parsing words give more control over word lookup than is offered by " { $link POSTPONE: USE: } " and " { $link POSTPONE: USING: } ":"
 { $subsection POSTPONE: QUALIFIED: }
 { $subsection POSTPONE: QUALIFIED-WITH: }
+"Parsing words which make a subset of all words in a vocabulary available:"
 { $subsection POSTPONE: FROM: }
 { $subsection POSTPONE: EXCLUDE: }
 { $subsection POSTPONE: RENAME: }
-"These words are useful when there is no way to avoid using two vocabularies with identical word names in the same source file."
+"Removing vocabularies from the search path:"
+{ $subsection POSTPONE: UNUSE: }
+"In the listener, the " { $vocab-link "scratchpad" } " is the default vocabulary for new word definitions. In source files, there is no default vocabulary. Defining words before declaring a vocabulary with " { $link POSTPONE: IN: } " results in an error."
+{ $subsection POSTPONE: IN: } ;
+
+ARTICLE: "word-search-semantics" "Resolution of ambiguous word names"
+"There is a distinction between parsing words which perform “open” imports versus “closed” imports. An open import introduces all words from a vocabulary as identifiers, except possibly a finite set of exclusions. The " { $link POSTPONE: USE: } ", " { $link POSTPONE: USING: } " and " { $link POSTPONE: EXCLUDE: } " words perform open imports. A closed import only adds a fixed set of identifiers. The " { $link POSTPONE: FROM: } ", " { $link POSTPONE: RENAME: } ", " { $link POSTPONE: QUALIFIED: } " and " { $link POSTPONE: QUALIFIED-WITH: } " words perform closed imports. Note that the latter two are considered as closed imports, due to the fact that all identifiers they introduce are unambiguously qualified with a prefix. The " { $link POSTPONE: IN: } " parsing word also performs a closed import of the newly-created vocabulary."
+$nl
+"When the parser encounters a reference to a word, it first searches the closed imports, in order. Closed imports are searched from the most recent to least recent. If the word could not be found this way, it searches open imports. Unlike closed imports, with open imports, the order does not matter -- instead, if more than one vocabulary defines a word with this name, an error is thrown."
+{ $subsection ambiguous-use-error }
+"To resolve the error, add a closed import, using " { $link POSTPONE: FROM: } ", " { $link POSTPONE: QUALIFIED: } " or " { $link POSTPONE: QUALIFIED-WITH: } ". The closed import will then take precedence over the open imports, and the ambiguity will be resolved."
 $nl
-"Private words can be defined; note that this is just a convention and they can be called from other vocabularies anyway:"
+"The rationale for this behavior is as follows. Open imports are named such because they are open to future extension; if a future version of a vocabulary that you use adds new words, those new words will now be in scope in your source file, too. To avoid problems, any references to the new word have to be resolved since the parser cannot safely determine which vocabulary was meant. This problem can be avoided entirely by using only closed imports, but this leads to additional verbosity."
+$nl
+"In practice, a small set of guidelines helps avoid name clashes:"
+{ $list
+  "Keep vocabularies small"
+  { "Hide internal words using " { $link POSTPONE: <PRIVATE } }
+  { "Make good use of " { $link POSTPONE: FROM: } ", " { $link POSTPONE: QUALIFIED: } " or " { $link POSTPONE: QUALIFIED-WITH: } }
+} ;
+
+ARTICLE: "word-search-private" "Private words"
+"Words which only serve as implementation detail should be defined in a private code block. Words in a private code blocks get defined in a vocabulary whose name is the name of the current vocabulary suffixed with " { $snippet ".private" } ". Privacy is not enforced by the system; private words can be called from other vocabularies, and from the listener. However, this should be avoided where possible."
 { $subsection POSTPONE: <PRIVATE }
-{ $subsection POSTPONE: PRIVATE> }
-{ $subsection "vocabulary-search-errors" }
-{ $subsection "vocabulary-search-shadow" }
+{ $subsection POSTPONE: PRIVATE> } ;
+
+ARTICLE: "word-search" "Parse-time word lookup"
+"When the parser reads a word name, it resolves the word at parse-time, looking up the " { $link word } " instance in the right vocabulary and adding it to the parse tree."
+$nl
+"Initially, only words from the " { $vocab-link "syntax" } " vocabulary are available in source files. Since most files will use words in other vocabularies, they will need to make those words available using a set of parsing words."
+{ $subsection "word-search-syntax" }
+{ $subsection "word-search-private" }
+{ $subsection "word-search-semantics" }
+{ $subsection "word-search-errors" }
 { $see-also "words" } ;
 
-ABOUT: "vocabulary-search"
+ARTICLE: "word-search-parsing" "Word lookup in parsing words"
+"The parsing words described in " { $link "word-search-syntax" } " are implemented using the below words, which you can also call from your own parsing words."
+$nl
+"The current state used for word search is stored in a " { $emphasis "manifest" } ":"
+{ $subsection manifest }
+"Words for working with the current manifest:"
+{ $subsection use-vocab }
+{ $subsection unuse-vocab }
+{ $subsection only-use-vocabs }
+{ $subsection add-qualified }
+{ $subsection add-words-from }
+{ $subsection add-words-excluding }
+"Words used to implement " { $link POSTPONE: IN: } ":"
+{ $subsection current-vocab }
+{ $subsection set-current-vocab }
+"Words used to implement " { $link "word-search-private" } ":"
+{ $subsection begin-private }
+{ $subsection end-private } ;
+
+ABOUT: "word-search"
+
+HELP: manifest
+{ $var-description "The current manifest. Only set at parse time." }
+{ $class-description "Encapsulates the current vocabulary, as well as the vocabulary search path." } ;
+
+HELP: <manifest>
+{ $values { "manifest" manifest } }
+{ $description "Creates a new manifest." } ;
+
+HELP: set-current-vocab
+{ $values { "name" string } }
+{ $description "Sets the current vocabulary where new words will be defined, creating the vocabulary first if it does not exist." }
+{ $notes "This word is used to implement " { $link POSTPONE: IN: } "." } ;
+
+HELP: no-current-vocab
+{ $error-description "Thrown when a new word is defined in a source file that does not have an " { $link POSTPONE: IN: } " form." } ;
+
+HELP: current-vocab
+{ $values { "vocab" vocab } }
+{ $description "Returns the current vocabulary, where new words will be defined." }
+{ $errors "Throws an error if the current vocabulary has not been set." } ;
+
+HELP: begin-private
+{ $description "Begins a block of private word definitions. Private word definitions are placed in the current vocabulary name, suffixed with " { $snippet ".private" } "." }
+{ $notes "This word is used to implement " { $link POSTPONE: <PRIVATE } "." } ;
+
+HELP: end-private
+{ $description "Ends a block of private word definitions." }
+{ $notes "This word is used to implement " { $link POSTPONE: PRIVATE> } "." } ;
+
+HELP: use-vocab
+{ $values { "vocab" "a vocabulary specifier" } }
+{ $description "Adds a vocabulary to the current manifest." }
+{ $notes "This word is used to implement " { $link POSTPONE: USE: } "." } ;
+
+HELP: unuse-vocab
+{ $values { "vocab" "a vocabulary specifier" } }
+{ $description "Removes a vocabulary from the current manifest." }
+{ $notes "This word is used to implement " { $link POSTPONE: UNUSE: } "." } ;
+
+HELP: only-use-vocabs
+{ $values { "vocabs" "a sequence of vocabulary specifiers" } }
+{ $description "Replaces the current manifest's vocabulary search path with the given set of vocabularies." } ;
+
+HELP: add-qualified
+{ $values { "vocab" "a vocabulary specifier" } { "prefix" string } }
+{ $description "Adds the vocabulary's words, prefixed with the given string, to the current manifest." }
+{ $notes "If adding the vocabulary introduces ambiguity, the vocabulary will take precedence when resolving any ambiguous names. See the example in " { $link POSTPONE: QUALIFIED: } " for further explanation." } ;
+
+HELP: add-words-from
+{ $values { "vocab" "a vocabulary specifier" } { "words" "a sequence of word names" } }
+{ $description "Adds " { $snippet "words" } " from " { $snippet "vocab" } " to the current manifest." }
+{ $notes "This word is used to implement " { $link POSTPONE: FROM: } "." } ;
+
+HELP: add-words-excluding
+{ $values { "vocab" "a vocabulary specifier" } { "words" "a sequence of word names" } }
+{ $description "Adds all words except for " { $snippet "words" } " from " { $snippet "vocab" } "  to the manifest." }
+{ $notes "This word is used to implement " { $link POSTPONE: EXCLUDE: } "." } ;
+
+HELP: add-renamed-word
+{ $values { "word" string } { "vocab" "a vocabulary specifier" } { "new-name" string } }
+{ $description "Imports " { $snippet "word" } " from " { $snippet "vocab" } ", but renamed to " { $snippet "new-name" } "." }
+{ $notes "This word is used to implement " { $link POSTPONE: RENAME: } "." } ;
+
+HELP: use-words
+{ $values { "assoc" assoc } }
+{ $description "Adds an assoc mapping word names to words to the current manifest." }
+{ $notes "This word is used by " { $link "locals" } " to implement lexically-scoped names." } ;
+
+HELP: unuse-words
+{ $values { "assoc" assoc } }
+{ $description "Removes an assoc mapping word names to words from the current manifest." }
+{ $notes "This word is used by " { $link "locals" } " to implement lexically-scoped names." } ;
+
+HELP: ambiguous-use-error
+{ $error-description "Thrown when a word name referenced in source file is available in more than one vocabulary in the manifest. Such cases must be explicitly disambiguated using " { $link POSTPONE: FROM: } ", " { $link POSTPONE: EXCLUDE: } ", " { $link POSTPONE: QUALIFIED: } ", or " { $link POSTPONE: QUALIFIED-WITH: } "." } ;
+
+HELP: search-manifest
+{ $values { "name" string } { "manifest" manifest } { "word/f" { $maybe word } } }
+{ $description "Searches for a word by name in the given manifest. If no such word could be found, outputs " { $link f } "." } ;
+
+HELP: search
+{ $values { "name" string } { "word/f" { $maybe word } } }
+{ $description "Searches for a word by name in the current manifest. If no such word could be found, outputs " { $link f } "." }
+$parsing-note ;
index e8783c0dbe1655fcadf5d7a141659fbd8ee0a87b..45084ae8ffb20da295ab49013ad68b25fde439fd 100644 (file)
 ! Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs hashtables kernel namespaces sequences
-sets strings vocabs sorting accessors arrays ;
+sets strings vocabs sorting accessors arrays compiler.units
+combinators vectors splitting continuations math
+parser.notes ;
 IN: vocabs.parser
 
 ERROR: no-word-error name ;
 
-: word-restarts ( name possibilities -- restarts )
+: word-restarts ( possibilities -- restarts )
     natural-sort
-    [ [ vocabulary>> "Use the " " vocabulary" surround ] keep ] { } map>assoc
+    [ [ vocabulary>> "Use the " " vocabulary" surround ] keep ] { } map>assoc ;
+
+: word-restarts-with-defer ( name possibilities -- restarts )
+    word-restarts
     swap "Defer word in current vocabulary" swap 2array
     suffix ;
 
 : <no-word-error> ( name possibilities -- error restarts )
-    [ drop \ no-word-error boa ] [ word-restarts ] 2bi ;
+    [ drop \ no-word-error boa ] [ word-restarts-with-defer ] 2bi ;
 
-SYMBOL: use
-SYMBOL: in
+TUPLE: manifest
+current-vocab
+{ search-vocab-names hashtable }
+{ search-vocabs vector }
+{ qualified-vocabs vector }
+{ extra-words vector }
+{ auto-used vector } ;
 
-: (use+) ( vocab -- )
-    vocab-words use get push ;
+: <manifest> ( -- manifest )
+    manifest new
+        H{ } clone >>search-vocab-names
+        V{ } clone >>search-vocabs
+        V{ } clone >>qualified-vocabs
+        V{ } clone >>extra-words
+        V{ } clone >>auto-used ;
 
-: use+ ( vocab -- )
-    load-vocab (use+) ;
+M: manifest clone
+    call-next-method
+        [ clone ] change-search-vocab-names
+        [ clone ] change-search-vocabs
+        [ clone ] change-qualified-vocabs
+        [ clone ] change-extra-words
+        [ clone ] change-auto-used ;
 
-: add-use ( seq -- ) [ use+ ] each ;
+TUPLE: extra-words words ;
 
-: set-use ( seq -- )
-    [ vocab-words ] V{ } map-as sift use set ;
+M: extra-words equal?
+    over extra-words? [ [ words>> ] bi@ eq? ] [ 2drop f ] if ;
 
-: add-qualified ( vocab prefix -- )
-    [ load-vocab vocab-words ] [ CHAR: : suffix ] bi*
+C: <extra-words> extra-words
+
+<PRIVATE
+
+: clear-manifest ( -- )
+    manifest get
+    [ search-vocab-names>> clear-assoc ]
+    [ search-vocabs>> delete-all ]
+    [ qualified-vocabs>> delete-all ]
+    tri ;
+
+: (add-qualified) ( qualified -- )
+    manifest get qualified-vocabs>> push ;
+
+: (from) ( vocab words -- vocab words words' assoc )
+    2dup swap load-vocab words>> ;
+
+: extract-words ( seq assoc -- assoc' )
+    extract-keys dup [ [ drop ] [ no-word-error ] if ] assoc-each ;
+
+: (lookup) ( name assoc -- word/f )
+    at dup forward-reference? [ drop f ] when ;
+
+: (use-words) ( assoc -- extra-words seq )
+    <extra-words> manifest get qualified-vocabs>> ;
+
+PRIVATE>
+
+: set-current-vocab ( name -- )
+    create-vocab
+    [ manifest get (>>current-vocab) ]
+    [ words>> <extra-words> (add-qualified) ] bi ;
+
+TUPLE: no-current-vocab ;
+
+: no-current-vocab ( -- vocab )
+    \ no-current-vocab boa
+    { { "Define words in scratchpad vocabulary" "scratchpad" } }
+    throw-restarts dup set-current-vocab ;
+
+: current-vocab ( -- vocab )
+    manifest get current-vocab>> [ no-current-vocab ] unless* ;
+
+: begin-private ( -- )
+    manifest get current-vocab>> vocab-name ".private" ?tail
+    [ drop ] [ ".private" append set-current-vocab ] if ;
+
+: end-private ( -- )
+    manifest get current-vocab>> vocab-name ".private" ?tail
+    [ set-current-vocab ] [ drop ] if ;
+
+: using-vocab? ( vocab -- ? )
+    vocab-name manifest get search-vocab-names>> key? ;
+
+: use-vocab ( vocab -- )
+    dup using-vocab?
+    [ vocab-name "Already using ``" "'' vocabulary" surround note. ] [
+        manifest get
+        [ [ vocab-name ] dip search-vocab-names>> conjoin ]
+        [ [ load-vocab ] dip search-vocabs>> push ]
+        2bi
+    ] if ;
+
+: auto-use-vocab ( vocab -- )
+    [ use-vocab ] [ manifest get auto-used>> push ] bi ;
+
+: auto-used? ( -- ? ) manifest get auto-used>> length 0 > ;
+
+: unuse-vocab ( vocab -- )
+    dup using-vocab? [
+        manifest get
+        [ [ vocab-name ] dip search-vocab-names>> delete-at ]
+        [ [ load-vocab ] dip search-vocabs>> delq ]
+        2bi
+    ] [ drop ] if ;
+
+: only-use-vocabs ( vocabs -- )
+    clear-manifest [ vocab ] filter [ use-vocab ] each ;
+
+TUPLE: qualified vocab prefix words ;
+
+: <qualified> ( vocab prefix -- qualified )
+    2dup
+    [ load-vocab words>> ] [ CHAR: : suffix ] bi*
     [ swap [ prepend ] dip ] curry assoc-map
-    use get push ;
+    qualified boa ;
+
+: add-qualified ( vocab prefix -- )
+    <qualified> (add-qualified) ;
+
+TUPLE: from vocab names words ;
+
+: <from> ( vocab words -- from )
+    (from) extract-words from boa ;
+
+: add-words-from ( vocab words -- )
+    <from> (add-qualified) ;
+
+TUPLE: exclude vocab names words ;
 
-: partial-vocab ( words vocab -- assoc )
-    load-vocab vocab-words
-    [ dupd at [ no-word-error ] unless* ] curry { } map>assoc ;
+: <exclude> ( vocab words -- from )
+    (from) [ nip ] [ extract-words ] 2bi assoc-diff exclude boa ;
 
-: add-words-from ( words vocab -- )
-    partial-vocab use get push ;
+: add-words-excluding ( vocab words -- )
+    <exclude> (add-qualified) ;
 
-: partial-vocab-excluding ( words vocab -- assoc )
-    load-vocab [ vocab-words keys swap diff ] keep partial-vocab ;
+TUPLE: rename word vocab words ;
 
-: add-words-excluding ( words vocab -- )
-    partial-vocab-excluding use get push ;
+: <rename> ( word vocab new-name -- rename )
+    [ 2dup load-vocab words>> dupd at [ ] [ no-word-error ] ?if ] dip
+    associate rename boa ;
 
 : add-renamed-word ( word vocab new-name -- )
-    [ load-vocab vocab-words dupd at [ ] [ no-word-error ] ?if ] dip
-    associate use get push ;
+    <rename> (add-qualified) ;
+
+: use-words ( assoc -- ) (use-words) push ;
+
+: unuse-words ( assoc -- ) (use-words) delete ;
+
+TUPLE: ambiguous-use-error words ;
+
+: <ambiguous-use-error> ( words -- error restarts )
+    [ \ ambiguous-use-error boa ] [ word-restarts ] bi ;
+
+<PRIVATE
+
+: (vocab-search) ( name assocs -- words n )
+    [ words>> (lookup) ] with map
+    sift dup length ;
+
+: vocab-search ( name manifest -- word/f )
+    search-vocabs>>
+    (vocab-search) {
+        { 0 [ drop f ] }
+        { 1 [ first ] }
+        [
+            drop <ambiguous-use-error> throw-restarts
+            dup [ vocabulary>> ] [ name>> 1array ] bi add-words-from
+        ]
+    } case ;
+
+: qualified-search ( name manifest -- word/f )
+    qualified-vocabs>>
+    (vocab-search) 0 = [ drop f ] [ peek ] if ;
+
+PRIVATE>
 
-: check-vocab-string ( name -- name )
-    dup string? [ "Vocabulary name must be a string" throw ] unless ;
+: search-manifest ( name manifest -- word/f )
+    2dup qualified-search dup [ 2nip ] [ drop vocab-search ] if ;
 
-: set-in ( name -- )
-    check-vocab-string dup in set create-vocab (use+) ;
\ No newline at end of file
+: search ( name -- word/f )
+    manifest get search-manifest ;
index 6c12b7b325b48a47586feb5e963b9c048dc1e2be..914f1cd601c4d9bf1dcf3bf5236d5228ed2d34ba 100644 (file)
@@ -78,7 +78,13 @@ GENERIC: vocabs-changed ( obj -- )
 : notify-vocab-observers ( -- )
     vocab-observers get [ vocabs-changed ] each ;
 
+ERROR: bad-vocab-name name ;
+
+: check-vocab-name ( name -- name )
+    dup string? [ bad-vocab-name ] unless ;
+
 : create-vocab ( name -- vocab )
+    check-vocab-name
     dictionary get [ <vocab> ] cache
     notify-vocab-observers ;
 
index 3725086f70d7d8dc52a3c0847e0dda7a12f9c64c..574f8afe8198152d48fc2eb19fbbeb87a116be29 100644 (file)
@@ -8,7 +8,7 @@ ARTICLE: "interned-words" "Looking up and creating words"
 $nl
 "Words whose names are known at parse time -- that is, most words making up your program -- can be referenced in source code by stating their name. However, the parser itself, and sometimes code you write, will need to create look up words dynamically."
 $nl
-"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $vocab-link "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "vocabulary-search" } ")."
+"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $vocab-link "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "word-search" } ")."
 { $subsection create }
 { $subsection create-in }
 { $subsection lookup } ;
@@ -237,7 +237,7 @@ HELP: set-word
 { $description "Sets the recently defined word." } ;
 
 HELP: lookup
-{ $values { "name" string } { "vocab" string } { "word" "a word or " { $link f } } }
+{ $values { "name" string } { "vocab" string } { "word" { $maybe word } } }
 { $description "Looks up a word in the dictionary. If the vocabulary or the word is not defined, outputs " { $link f } "." } ;
 
 HELP: reveal
index c01cf13bcd1d270c978718b65029107fffe62f9b..2ebdb8b7a8ad0d9433be545d98c84ea3e1f26dd4 100755 (executable)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays definitions graphs assocs kernel
-kernel.private kernel.private slots.private math namespaces sequences
+USING: accessors arrays definitions graphs kernel
+kernel.private slots.private math namespaces sequences
 strings vectors sbufs quotations assocs hashtables sorting vocabs
 math.order sets ;
 IN: words
@@ -180,12 +180,12 @@ M: word reset-word
 ERROR: bad-create name vocab ;
 
 : check-create ( name vocab -- name vocab )
-    2dup [ string? ] both?
+    2dup [ string? ] [ [ string? ] [ vocab? ] bi or ] bi* and
     [ bad-create ] unless ;
 
 : create ( name vocab -- word )
     check-create 2dup lookup
-    dup [ 2nip ] [ drop <word> dup reveal ] if ;
+    dup [ 2nip ] [ drop vocab-name <word> dup reveal ] if ;
 
 : constructor-word ( name vocab -- word )
     [ "<" ">" surround ] dip create ;
index 664645c466890f553ddc56e4351c456b979c8720..71f7f2618568c2510b5aabd30c84976f3b447963 100755 (executable)
@@ -1,9 +1,6 @@
-USING: kernel math arrays math.vectors math.matrices
-namespaces make
-math.constants math.functions
-math.vectors
-splitting grouping math.trig
-  sequences accessors 4DNav.deep models vars ;
+USING: kernel math arrays math.vectors math.matrices namespaces make
+math.constants math.functions splitting grouping math.trig sequences
+accessors 4DNav.deep models vars ;
 IN: 4DNav.turtle
 
 ! replacement of self
index 6bb57cf9405f0bff0c3797815252fbaf0620430d..e83e88401911f728c95cce9ba5c2c0523146698b 100755 (executable)
@@ -15,7 +15,6 @@ accessors
 namespaces\r
 adsoda \r
 models\r
-accessors\r
 prettyprint\r
 ;\r
 \r
index 5014d530195780d9da4823f7aeb467fabe4c9cb9..0d11b11acf947a54cf6797c36876fd9a6660197a 100644 (file)
@@ -1,5 +1,6 @@
 USING: accessors arrays bank calendar kernel math math.functions
 namespaces make tools.test tools.walker ;
+FROM: bank => balance>> ;
 IN: bank.tests
 
 SYMBOL: my-account
index 0ae7d792dd8dd27035d225df3d83cd80ca19a355..27040edac3e5909afc5d852916f78b5ba93a8ba2 100755 (executable)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: backtrack shuffle math math.ranges quotations locals fry
-kernel words io memoize macros io prettyprint sequences assocs
+kernel words io memoize macros prettyprint sequences assocs
 combinators namespaces ;
 IN: benchmark.backtrack
 
index 6dce1c2ca9d4ace4c67a4b4af91e86b5342ec565..9b5bf48912d94f6c6239572baf08cdc00dd417e3 100644 (file)
@@ -24,10 +24,7 @@ IN: bloom-filters.tests
 [ 4 32 ] [ 0.05 5 size-bloom-filter ] unit-test
 
 ! This is a lot of bits.
-: oversized-filter-params ( -- error-rate n-objects )
-    0.00000001 400000000000000 ;
-! [ oversized-filter-params size-bloom-filter ] [ capacity-error? ]  must-fail-with
-! [ oversized-filter-params <bloom-filter> ] [ capacity-error? ] must-fail-with
+[ 0.00000001 max-array-capacity size-bloom-filter ] [ capacity-error? ]  must-fail-with
 
 ! Other error conditions.
 [ 1.0 2000 <bloom-filter> ] [ invalid-error-rate? ] must-fail-with
index 7d614ff94769a56345f44f516300e8312fd6d5f9..88560324886595dc6936900e985e73fda24c9cc9 100755 (executable)
@@ -3,6 +3,7 @@ destructors kernel math multiline opengl opengl.shaders
 opengl.framebuffers opengl.gl opengl.textures opengl.demo-support fry
 opengl.capabilities sequences ui.gadgets combinators accessors
 macros locals ;
+FROM: opengl.demo-support => rect-vertices ;
 IN: bunny.outlined
 
 STRING: outlined-pass1-fragment-shader-main-source
index bc6b8a092fa84092d7434163b6069946e4e60469..b6b5ff3b08c9b79cce7a449b5f05a1aa93e20c44 100755 (executable)
@@ -2,8 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors kernel peg strings sequences math math.parser
 namespaces make words quotations arrays hashtables io
-io.streams.string assocs ascii peg.parsers accessors
-words.symbol ;
+io.streams.string assocs ascii peg.parsers words.symbol ;
 IN: fjsc
 
 TUPLE: ast-number value ;
index 3f7ce863c7023dee38a455ff0be2486c078d9b4c..7c83fc6e902a6aef0432e52f4c2547fc11f14b21 100644 (file)
@@ -6,7 +6,7 @@ vectors vocabs.parser ;
 
 IN: fuel.eval
 
-TUPLE: fuel-status in use restarts ;
+TUPLE: fuel-status manifest restarts ;
 
 SYMBOL: fuel-status-stack
 V{ } clone fuel-status-stack set-global
@@ -24,7 +24,7 @@ t fuel-eval-res-flag set-global
     fuel-eval-res-flag get-global ;
 
 : fuel-push-status ( -- )
-    in get use get clone restarts get-global clone
+    manifest get clone restarts get-global clone
     fuel-status boa
     fuel-status-stack get push ;
 
@@ -34,9 +34,9 @@ t fuel-eval-res-flag set-global
 : fuel-pop-status ( -- )
     fuel-status-stack get empty? [
         fuel-status-stack get pop
-        [ in>> in set ]
-        [ use>> clone use set ]
-        [ restarts>> fuel-pop-restarts ] tri
+        [ manifest>> clone manifest set ]
+        [ restarts>> fuel-pop-restarts ]
+        bi
     ] unless ;
 
 : fuel-forget-error ( -- ) f error set-global ;
@@ -60,11 +60,11 @@ t fuel-eval-res-flag set-global
     [ print-error ] recover ;
 
 : (fuel-eval-usings) ( usings -- )
-    [ [ use+ ] curry [ drop ] recover ] each
+    [ [ use-vocab ] curry [ drop ] recover ] each
     fuel-forget-error fuel-forget-output ;
 
 : (fuel-eval-in) ( in -- )
-    [ in set ] when* ;
+    [ set-current-vocab ] when* ;
 
 : (fuel-eval-in-context) ( lines in usings -- )
     (fuel-begin-eval)
index a9ed17877ee9ebc6e095ea8c8f8beaa9419cd3e5..5d4149867b520c3cf5c1bea49ecc56756daf1ab5 100644 (file)
@@ -3,7 +3,7 @@
 
 USING: accessors assocs compiler.units continuations fuel.eval fuel.help
 fuel.remote fuel.xref help.topics io.pathnames kernel namespaces parser
-sequences tools.scaffold vocabs.loader words ;
+sequences tools.scaffold vocabs.loader vocabs.parser words ;
 
 IN: fuel
 
@@ -46,7 +46,7 @@ SYMBOL: :uses-suggestions
     dup length 1 = [ first restart ] [ drop ] if ;
 
 : fuel-set-use-hook ( -- )
-    [ amended-use get clone :uses prefix fuel-eval-set-result ]
+    [ manifest get auto-used>> clone :uses prefix fuel-eval-set-result ]
     print-use-hook set ;
 
 : (fuel-get-uses) ( lines -- )
index 160b7212c4c870b821dc08f58ed46ec3ebe325df..3e3279ece7ebbac5c9bdb649a081befaf91d6c77 100644 (file)
@@ -35,7 +35,9 @@ MEMO: (vocab-words) ( name -- seq )
     >vocab-link words [ name>> ] map ;
 
 : current-words ( -- seq )
-    use get [ keys ] map concat ; inline
+    manifest get
+    [ search-vocabs>> ] [ qualified-vocabs>> ] bi [ words>> ] bi@
+    assoc-union keys ; inline
 
 : vocabs-words ( names -- seq )
     prune [ (vocab-words) ] map concat ; inline
index 8e2eeeb1a7fd0bbb88ff156231fe154f74764539..5f33af04fec51daa9cd455876bcf7f398a61f64a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: slides help.markup math arrays hashtables namespaces
-sequences kernel sequences parser memoize io.encodings.binary
+kernel sequences parser memoize io.encodings.binary
 locals kernel.private help.vocabs assocs quotations
 urls peg.ebnf tools.annotations tools.crossref
 help.topics math.functions compiler.tree.optimizer
index 1eb690b20ff081a0d6cc2e3a527845a38759e0db..a77ebf2577071e2d6cd12ab9b43a131a12697175 100755 (executable)
@@ -1,9 +1,8 @@
 ! Copyright (C) 2009 Diego Martinelli.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors byte-arrays calendar calendar.format 
-checksums checksums.openssl classes.tuple 
-fry kernel make math math.functions math.parser math.ranges 
-present random sequences splitting strings syntax ;
+USING: accessors byte-arrays calendar calendar.format checksums
+checksums.openssl classes.tuple fry kernel make math math.functions
+math.parser math.ranges present random sequences splitting strings ;
 IN: hashcash
 
 ! Hashcash implementation
index 2196f1baaa1493ab4ce485548e9b0c0dac3439b6..02b45ee9396c57d407f49f052138ea69cefbeed1 100755 (executable)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs html.parser kernel math sequences strings ascii
-arrays generalizations shuffle unicode.case namespaces make
+arrays generalizations shuffle namespaces make
 splitting http accessors io combinators http.client urls
 urls.encoding fry prettyprint sets ;
 IN: html.parser.analyzer
index 6acace858276fa25cec8f85a05b209a048ad46a7..6d9b778ee8d1f2ba08bc5f818149d233230dcab4 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Tim Wawrzynczak, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: sequences io io.encodings.binary io.files io.pathnames
-strings kernel math io.mmap io.mmap.uchar accessors syntax
+strings kernel math io.mmap io.mmap.uchar accessors
 combinators math.ranges unicode.categories byte-arrays
 io.encodings.string io.encodings.utf16 assocs math.parser
 combinators.short-circuit fry namespaces combinators.smart
index 4a2ec963eecad92a21d7ba752ccb1df5c197d76c..74831af7fb26026bf26acb5acfbdfdbd3103b7a5 100644 (file)
@@ -54,7 +54,7 @@ $nl
 }
 "The standard precedence rules apply: Grouping with parentheses before " { $snippet "*" } ", " { $snippet "/" } "and " { $snippet "%" } " before " { $snippet "+" } " and " { $snippet "-" } "."
 { $example
-    "USING: infix prettyprint ;"
+    "USE: infix"
     "[infix 5-40/10*2 infix] ."
     "-3"
 }
@@ -65,7 +65,7 @@ $nl
     "The word name must consist of the letters a-z, A-Z, _ or 0-9, and the first character can't be a number."
 }
 { $example
-    "USING: infix locals math math.functions prettyprint ;"
+    "USING: infix locals math.functions ;"
     ":: binary_entropy ( p -- h )"
     "    [infix -(p*log(p) + (1-p)*log(1-p)) / log(2) infix] ;"
     "[infix binary_entropy( sqrt(0.25) ) infix] ."
@@ -74,13 +74,13 @@ $nl
 $nl
 "You can access " { $vocab-link "sequences" } " inside infix expressions with the familiar " { $snippet "arr[index]" } " notation."
 { $example
-    "USING: arrays infix prettyprint ;"
+    "USING: arrays infix ;"
     "[infix| myarr [ { 1 2 3 4 } ] | myarr[4/2]*3 infix] ."
     "9"
 }
 "Please note: in Factor " { $emphasis "fixnums are sequences too." } " If you are not careful with sequence accesses you may introduce subtle bugs:"
 { $example
-    "USING: arrays infix locals prettyprint ;"
+    "USING: arrays infix locals ;"
     ":: add-2nd-element ( x y -- res )"
     "    [infix x[1] + y[1] infix] ;"
     "{ 1 2 3 } 5 add-2nd-element ."
index 5597422898768672224e33f76c05fe8a97b87a0c..ce197800583f5f0231581d6425ddba57e5468172 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors assocs combinators combinators.short-circuit
 effects fry infix.parser infix.ast kernel locals.parser
 locals.types math multiline namespaces parser quotations
-sequences summary words ;
+sequences summary words vocabs.parser ;
 IN: infix
 
 <PRIVATE
@@ -85,12 +85,10 @@ SYNTAX: [infix
     "infix]" [infix-parse parsed \ call parsed ;
 
 <PRIVATE
+
 : parse-infix-locals ( assoc end -- quot )
-    [
-        in-lambda? on
-        [ dup [ locals set ] [ push-locals ] bi ] dip
-        [infix-parse prepare-operand swap pop-locals
-    ] with-scope ;
+    '[ _ [infix-parse prepare-operand ] ((parse-lambda)) ;
+
 PRIVATE>
 
 SYNTAX: [infix|
index 6171c3053b9e2701abc750eadd9cb9a435f73302..7e124dc713b940d677d86a589b614df5e43ee149 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2007, 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays colors combinators kernel literals locals math math.constants math.matrices math.order math.ranges math.vectors math.quadratic random sequences specialized-arrays.float vectors jamshred.oint ;
+FROM: jamshred.oint => distance ;
 IN: jamshred.tunnel
 
 CONSTANT: n-segments 5000
index 4ba8e2f66b34fca014983b88a587f55a7da30be6..1ecd56d416d2df77e1fa02023eebe02cd7f304d9 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2006, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs hashtables assocs io kernel math
+USING: accessors arrays hashtables assocs io kernel math
 math.vectors math.matrices math.matrices.elimination namespaces
 parser prettyprint sequences words combinators math.parser
 splitting sorting shuffle sets math.order ;
index a33e3c5831f668ef9477c7840c343784bf331332..4ac5767009029ef1fb2d3883fd69c7432a6e13f2 100755 (executable)
@@ -4,7 +4,7 @@ USING: kernel namespaces sequences splitting system accessors
 math.functions make io io.files io.pathnames io.directories
 io.directories.hierarchy io.launcher io.encodings.utf8 prettyprint
 combinators.short-circuit parser combinators calendar
-calendar.format arrays mason.config locals system debugger fry
+calendar.format arrays mason.config locals debugger fry
 continuations strings ;
 IN: mason.common
 
index d425985e7632f8ac2244942b41db41a04ba34b54..8818e1cc94f466a9dcfc899281e4928492b366b0 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors calendar continuations debugger debugger io
-io.directories io.files kernel mason.build mason.common
+USING: accessors calendar continuations debugger io
+io.directories io.files kernel mason.common
 mason.email mason.updates namespaces threads ;
+FROM: mason.build => build ;
 IN: mason
 
 : build-loop-error ( error -- )
index fc4ad0b08a6977b9475d3f8125eaef504537b570..a593f000f38ca516678ad0786f20288a7edf605b 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008, 2009 Eduardo Cavazos, Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel debugger namespaces sequences splitting combinators
+USING: kernel debugger namespaces sequences splitting
 combinators io io.files io.launcher prettyprint bootstrap.image
 mason.common mason.release.branch mason.release.tidy
 mason.release.archive mason.release.upload mason.notify ;
index 9e5b5c67aa91bbb9c9b0ea9c7872f4588bfc4838..2f13237c9d20469f4036f26f6d9f1cc30718d015 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test math.floating-point math.constants kernel
-math.constants fry sequences kernel math ;
+USING: tools.test math.floating-point kernel
+math.constants fry sequences math ;
 IN: math.floating-point.tests
 
 [ t ] [ pi >double< >double pi = ] unit-test
index 3bd7d70365d277669bfc0aaeb18fcc034367dd27..5af13415e412e96e97d38e1b3ce33efbcff67330 100644 (file)
@@ -1,4 +1,4 @@
-USING: lists.lazy math.primes.lists tools.test ;
+USING: lists lists.lazy math.primes.lists tools.test ;
 
 { { 2 3 5 7 11 13 17 19 23 29 } } [ 10 lprimes ltake list>array ] unit-test
 { { 101 103 107 109 113 } } [ 5 100 lprimes-from ltake list>array ] unit-test
index ee63b14f3c27d999d6556881af3522ab5291957c..0f1eb8edda53fcf203689f1d7640ecf212b4e903 100644 (file)
@@ -1,4 +1,5 @@
 USING: tools.test math kernel sequences lists promises monads ;
+FROM: monads => do ;
 IN: monads.tests
 
 [ 5 ] [ 1 identity-monad return [ 4 + ] fmap run-identity ] unit-test
index 02dfa8add930441f170ef002a67d03f43fddc0fe..a977224d660fffd82d3d3eea2cd5840691253682 100644 (file)
@@ -1,7 +1,7 @@
 USING: calendar math fry kernel assocs math.ranges bson.reader io.streams.byte-array
 sequences formatting combinators namespaces io tools.time prettyprint io.encodings.binary
-accessors words mongodb.driver strings math.parser tools.walker bson.writer
-tools.continuations ;
+accessors words mongodb.driver strings math.parser bson.writer ;
+FROM: mongodb.driver => find ;
 
 IN: mongodb.benchmark
 
index 677fa09bf9d828d191bed1dc1ae20732ef52ea66..ce76a37ff4a3fa248b98ab3faa9de3510b301293 100644 (file)
@@ -2,6 +2,8 @@ USING: accessors assocs classes.mixin classes.tuple
 classes.tuple.parser compiler.units fry kernel sequences mongodb.driver
 mongodb.msg mongodb.tuple.collection 
 mongodb.tuple.persistent mongodb.tuple.state strings ;
+FROM: mongodb.driver => update delete find count ;
+FROM: mongodb.tuple.persistent => assoc>tuple ;
 
 IN: mongodb.tuple
 
index 35a83a63de6eb4dbfbf2ae8be9e82bfd31e13d6f..0e7702512f6898f081c59084bee0b4fd7ebf34b4 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: slides help.markup math arrays hashtables namespaces
-sequences kernel sequences parser memoize io.encodings.binary
+kernel sequences parser memoize io.encodings.binary
 locals kernel.private help.vocabs assocs quotations
 tools.annotations tools.crossref help.topics math.functions
 compiler.tree.optimizer compiler.cfg.optimizer fry
index 70698daa0bf73bc8fe501b69980d853b8c590d5a..062277ec4d6f2b42dff2ae3d466397d97fa71cd3 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2005 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel lists.lazy tools.test strings math
+USING: kernel lists lists.lazy tools.test strings math
 sequences parser-combinators arrays math.parser unicode.categories ;
 IN: parser-combinators.tests
 
index 7ace52815079f01f2bc354c16e25eb902623d129..82b50c454af5f9714f9d64b2cbb88ba999573575 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Chris Double.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel accessors peg peg.ebnf peg.javascript.ast peg.javascript.tokenizer ;
+USING: kernel accessors sequences
+peg peg.ebnf peg.javascript.ast peg.javascript.tokenizer ;
 IN: peg.javascript.parser
 
 #! Grammar for JavaScript. Based on OMeta-JS example from:
index 84291f2ce83d44a6d81f3eccc74426ddc3d78814..497fc31de7fc41cd89725daee7ff720c28147f6c 100644 (file)
@@ -143,6 +143,6 @@ PRIVATE>
 SYNTAX: SOLUTION:
     scan-word
     [ name>> "-main" append create-in ] keep
-    [ drop in get vocab (>>main) ]
+    [ drop current-vocab (>>main) ]
     [ [ . ] swap prefix (( -- )) define-declared ]
     2bi ;
index fcbc20db16ab8f621d6939fbe10a5bab870e4130..95c2fe11388445a65b8e4cac070e2f5cec819931 100644 (file)
@@ -1,6 +1,7 @@
 ! (c)2009 Joe Groff bsd license
 USING: accessors classes.tuple compiler.units kernel qw roles sequences
 tools.test ;
+FROM: roles => TUPLE: ;
 IN: roles.tests
 
 ROLE: fork tines ;
diff --git a/extra/sandbox/authors.txt b/extra/sandbox/authors.txt
deleted file mode 100644 (file)
index f97e1bf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Maxim Savchenko
diff --git a/extra/sandbox/sandbox-tests.factor b/extra/sandbox/sandbox-tests.factor
deleted file mode 100644 (file)
index 5d0496e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-! Copyright (C) 2009 Maxim Savchenko
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: kernel accessors continuations lexer vocabs vocabs.parser
-       combinators.short-circuit sandbox tools.test ;
-
-IN: sandbox.tests
-
-<< "sandbox.syntax" load-vocab drop >>
-USE: sandbox.syntax.private
-
-: run-script ( x lines -- y )
-    H{ { "kernel" "kernel" } { "math" "math" } { "sequences" "sequences" } }
-    parse-sandbox call( x -- x! ) ;
-
-[ 120 ]
-[
-    5
-    {
-        "! Simple factorial example"
-        "APPLYING: kernel math sequences ;"
-        "1 swap [ 1+ * ] each"
-    } run-script
-] unit-test
-
-[
-    5
-    {
-        "! Jailbreak attempt with USE:"
-        "USE: io"
-        "\"Hello world!\" print"
-    } run-script
-]
-[
-    {
-        [ lexer-error? ]
-        [ error>> condition? ]
-        [ error>> error>> no-word-error? ]
-        [ error>> error>> name>> "USE:" = ]
-    } 1&&
-] must-fail-with
-
-[
-    5
-    {
-        "! Jailbreak attempt with unauthorized APPLY:"
-        "APPLY: io"
-        "\"Hello world!\" print"
-    } run-script
-]
-[
-    {
-        [ lexer-error? ]
-        [ error>> sandbox-error? ]
-        [ error>> vocab>> "io" = ]
-    } 1&&
-] must-fail-with
diff --git a/extra/sandbox/sandbox.factor b/extra/sandbox/sandbox.factor
deleted file mode 100644 (file)
index 097a7c8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-! Copyright (C) 2009 Maxim Savchenko.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: kernel sequences vectors assocs namespaces parser lexer vocabs
-       combinators.short-circuit vocabs.parser ;
-
-IN: sandbox
-
-SYMBOL: whitelist
-
-: with-sandbox-vocabs ( quot -- )
-    "sandbox.syntax" load-vocab vocab-words 1vector
-    use [ auto-use? off call ] with-variable ; inline
-
-: parse-sandbox ( lines assoc -- quot )
-    whitelist [ [ parse-lines ] with-sandbox-vocabs ] with-variable ;
-
-: reveal-in ( name -- )
-    [ { [ search ] [ no-word ] } 1|| ] keep current-vocab vocab-words set-at ;
-
-SYNTAX: REVEAL: scan reveal-in ;
-
-SYNTAX: REVEALING: ";" parse-tokens [ reveal-in ] each ;
diff --git a/extra/sandbox/summary.txt b/extra/sandbox/summary.txt
deleted file mode 100644 (file)
index 3ca1e25..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Basic sandboxing
diff --git a/extra/sandbox/syntax/syntax.factor b/extra/sandbox/syntax/syntax.factor
deleted file mode 100644 (file)
index 2ff5f07..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-! Copyright (C) 2009 Maxim Savchenko.
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: kernel sequences assocs namespaces lexer vocabs.parser sandbox ;
-IN: sandbox.syntax
-
-<PRIVATE
-
-ERROR: sandbox-error vocab ;
-
-: sandbox-use+ ( alias -- )
-    dup whitelist get at [ use+ ] [ sandbox-error ] ?if ;
-
-PRIVATE>
-
-SYNTAX: APPLY: scan sandbox-use+ ;
-
-SYNTAX: APPLYING: ";" parse-tokens [ sandbox-use+ ] each ;
-
-REVEALING:
-    ! #!
-    HEX: OCT: BIN: f t CHAR: "
-    [ { T{
-    ] } ;
-
-REVEAL: ;
index 710c953ed104862d0fe741be3937e0efa6c79ef3..1a8f41b4a2e974f5ec2ee4a38cc163f6a212d55c 100755 (executable)
@@ -3,6 +3,7 @@ opengl.shaders opengl.framebuffers opengl.capabilities multiline
 ui.gadgets accessors sequences ui.render ui math locals arrays
 generalizations combinators ui.gadgets.worlds
 literals ui.pixel-formats ;
+FROM: opengl.demo-support => rect-vertices ;
 IN: spheres
 
 STRING: plane-vertex-shader
index fb326ef534475d0a8aac50ddaad6b56f6b0b5aa8..cfacfeb700d27f9505233998a0da60343f111b5e 100644 (file)
@@ -6,13 +6,15 @@ opengl.shaders opengl.textures opengl.textures.private
 sequences sequences.product specialized-arrays.float
 terrain.generation terrain.shaders ui ui.gadgets
 ui.gadgets.worlds ui.pixel-formats game-worlds method-chains
-math.affine-transforms noise ui.gestures ;
+math.affine-transforms noise ui.gestures combinators.short-circuit ;
 IN: terrain
 
 CONSTANT: FOV $[ 2.0 sqrt 1+ ]
 CONSTANT: NEAR-PLANE $[ 1.0 1024.0 / ]
 CONSTANT: FAR-PLANE 2.0
 CONSTANT: PLAYER-START-LOCATION { 0.5 0.51 0.5 }
+CONSTANT: VELOCITY-MODIFIER-NORMAL { 1.0 1.0 1.0 }
+CONSTANT: VELOCITY-MODIFIER-FAST { 2.0 1.0 2.0 }
 CONSTANT: PLAYER-HEIGHT $[ 1.0 256.0 / ]
 CONSTANT: GRAVITY $[ 1.0 4096.0 / ]
 CONSTANT: JUMP $[ 1.0 1024.0 / ]
@@ -28,13 +30,23 @@ CONSTANT: terrain-vertex-distance { $[ 1.0 512.0 / ] $[ 1.0 512.0 / ] }
 CONSTANT: terrain-vertex-row-length $[ 512 1 + 2 * ]
 
 TUPLE: player
-    location yaw pitch velocity velocity-modifier ;
+    location yaw pitch velocity velocity-modifier
+    reverse-time ;
 
 TUPLE: terrain-world < game-world
     player
     sky-image sky-texture sky-program
     terrain terrain-segment terrain-texture terrain-program
-    terrain-vertex-buffer ;
+    terrain-vertex-buffer
+    history ;
+
+: <player> ( -- player )
+    player new
+        PLAYER-START-LOCATION >>location
+        0.0 >>yaw
+        0.0 >>pitch
+        { 0.0 0.0 0.0 } >>velocity
+        VELOCITY-MODIFIER-NORMAL >>velocity-modifier ;
 
 M: terrain-world tick-length
     drop 1000 30 /i ;
@@ -140,12 +152,17 @@ terrain-world H{
 :: handle-input ( world -- )
     world player>> :> player
     read-keyboard keys>> :> keys
-    key-left-shift keys nth [
-        { 2.0 1.0 2.0 } player (>>velocity-modifier)
-    ] when
-    key-left-shift keys nth [
-        { 1.0 1.0 1.0 } player (>>velocity-modifier)
-    ] unless
+
+    key-left-shift keys nth
+    VELOCITY-MODIFIER-FAST VELOCITY-MODIFIER-NORMAL ? player (>>velocity-modifier)
+
+    {
+        [ key-1 keys nth 1  f ? ]
+        [ key-2 keys nth 2  f ? ]
+        [ key-3 keys nth 3  f ? ]
+        [ key-4 keys nth 4  f ? ]
+        [ key-5 keys nth 10000 f ? ]
+    } 0|| player (>>reverse-time)
 
     key-w keys nth [ player walk-forward ] when 
     key-s keys nth [ player walk-backward ] when 
@@ -199,11 +216,30 @@ terrain-world H{
 : scaled-velocity ( player -- velocity )
     [ velocity>> ] [ velocity-modifier>> ] bi v* ;
 
-: tick-player ( world player -- )
+: save-history ( world player -- )
+    clone swap history>> push ;
+
+:: tick-player-reverse ( world player -- )
+    player reverse-time>> :> reverse-time
+    world history>> :> history
+    history length 0 > [
+        history length reverse-time 1 - - 1 max history set-length
+        history pop world (>>player)
+    ] when ;
+
+: tick-player-forward ( world player -- )
+    2dup save-history
     [ apply-friction apply-gravity ] change-velocity
     dup scaled-velocity [ v+ [ terrain-segment>> ] dip collide ] curry with change-location
     drop ;
 
+: tick-player ( world player -- )
+    dup reverse-time>> [
+        tick-player-reverse
+    ] [
+        tick-player-forward
+    ] if ;
+
 M: terrain-world tick*
     [ dup focused?>> [ handle-input ] [ drop ] if ]
     [ dup player>> tick-player ] bi ;
@@ -226,7 +262,8 @@ BEFORE: terrain-world begin-world
     GL_DEPTH_TEST glEnable
     GL_TEXTURE_2D glEnable
     GL_VERTEX_ARRAY glEnableClientState
-    PLAYER-START-LOCATION 0.0 0.0 { 0.0 0.0 0.0 } { 1.0 1.0 1.0 } player boa >>player
+    <player> >>player
+    V{ } clone >>history
     <perlin-noise-table> 0.01 0.01 <scale> { 512 512 } perlin-noise-image
     [ >>sky-image ] keep
     make-texture [ set-texture-parameters ] keep >>sky-texture
index 047c20d05318aae25b6fb388f66dba32184e9ddf..e505691c3a384010d4e9a19897cc820ce496a318 100644 (file)
@@ -1,5 +1,6 @@
 USING: accessors kernel tetris.game tetris.board tetris.piece tools.test
 sequences ;
+FROM: tetris.game => level>> ;
 
 [ t ] [ <default-tetris> [ current-piece ] [ next-piece ] bi and t f ? ] unit-test
 [ t ] [ <default-tetris> { 1 1 } can-move? ] unit-test
index 66f69bb0533d9c88b5426b6dc50cc335c8150506..dbdb666e4a39042aedff5c9276023441a3567b0a 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2006, 2007, 2008 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alarms arrays calendar kernel make math math.rectangles math.parser namespaces sequences system tetris.game tetris.gl ui.gadgets ui.gadgets.labels ui.gadgets.worlds ui.gadgets.status-bar ui.gestures ui.render ui ;
+FROM: tetris.game => level>> ;
 IN: tetris
 
 TUPLE: tetris-gadget < gadget { tetris tetris } { alarm } ;
index b9d859962fb806ed9594fd3e8509f3dacc2caa24..9e9474791986899c17f54ec8eece1bc666a97655 100644 (file)
@@ -1,4 +1,5 @@
 USING: accessors kernel fry math models ui.gadgets ui.gadgets.books ui.gadgets.buttons ;
+FROM: models => change-model ;
 IN: ui.gadgets.book-extras
 : <book*> ( pages -- book ) 0 <model> <book> ;
 : |<< ( book -- ) 0 swap set-control-value ;
index 4ee499bf50c08fa7cffbc92784cfe2760b0b551d..518462d7bb26e9338c67ee65bdad6f550807eb23 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: slides help.markup math arrays hashtables namespaces
-sequences kernel sequences parser memoize io.encodings.binary
+kernel sequences parser memoize io.encodings.binary
 locals kernel.private help.vocabs assocs quotations urls
 peg.ebnf tools.annotations tools.crossref help.topics
 math.functions compiler.tree.optimizer compiler.cfg.optimizer
index f82eb6dcd88594f3a1dcac50baa6e5494f58753d..5ecd3bc6a8c0fb35eef5259e9de839ae0ca9dcc1 100644 (file)
@@ -37,7 +37,7 @@ IN: webapps.site-watcher
             "twitter" value >>twitter
             "sms" value >>sms
             update-tuple
-            site-list-url <redirect>
+            f <redirect>
         ] >>submit
     <protected>
         "update notification details" >>description ;
index 2341b020a84fdb0e495a0c584b0f0bcb48bc262f..5689f23d4ea6cfd60f3e30e1ac2f5e8f574316c9 100644 (file)
@@ -15,7 +15,7 @@ furnace.auth.login
 furnace.boilerplate
 furnace.syndication
 validators
-db.types db.tuples lcs farkup urls ;
+db.types db.tuples lcs urls ;
 IN: webapps.wiki
 
 : wiki-url ( rest path -- url )
diff --git a/unmaintained/sandbox/authors.txt b/unmaintained/sandbox/authors.txt
new file mode 100644 (file)
index 0000000..f97e1bf
--- /dev/null
@@ -0,0 +1 @@
+Maxim Savchenko
diff --git a/unmaintained/sandbox/sandbox-tests.factor b/unmaintained/sandbox/sandbox-tests.factor
new file mode 100644 (file)
index 0000000..5d0496e
--- /dev/null
@@ -0,0 +1,57 @@
+! Copyright (C) 2009 Maxim Savchenko
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel accessors continuations lexer vocabs vocabs.parser
+       combinators.short-circuit sandbox tools.test ;
+
+IN: sandbox.tests
+
+<< "sandbox.syntax" load-vocab drop >>
+USE: sandbox.syntax.private
+
+: run-script ( x lines -- y )
+    H{ { "kernel" "kernel" } { "math" "math" } { "sequences" "sequences" } }
+    parse-sandbox call( x -- x! ) ;
+
+[ 120 ]
+[
+    5
+    {
+        "! Simple factorial example"
+        "APPLYING: kernel math sequences ;"
+        "1 swap [ 1+ * ] each"
+    } run-script
+] unit-test
+
+[
+    5
+    {
+        "! Jailbreak attempt with USE:"
+        "USE: io"
+        "\"Hello world!\" print"
+    } run-script
+]
+[
+    {
+        [ lexer-error? ]
+        [ error>> condition? ]
+        [ error>> error>> no-word-error? ]
+        [ error>> error>> name>> "USE:" = ]
+    } 1&&
+] must-fail-with
+
+[
+    5
+    {
+        "! Jailbreak attempt with unauthorized APPLY:"
+        "APPLY: io"
+        "\"Hello world!\" print"
+    } run-script
+]
+[
+    {
+        [ lexer-error? ]
+        [ error>> sandbox-error? ]
+        [ error>> vocab>> "io" = ]
+    } 1&&
+] must-fail-with
diff --git a/unmaintained/sandbox/sandbox.factor b/unmaintained/sandbox/sandbox.factor
new file mode 100644 (file)
index 0000000..097a7c8
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2009 Maxim Savchenko.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel sequences vectors assocs namespaces parser lexer vocabs
+       combinators.short-circuit vocabs.parser ;
+
+IN: sandbox
+
+SYMBOL: whitelist
+
+: with-sandbox-vocabs ( quot -- )
+    "sandbox.syntax" load-vocab vocab-words 1vector
+    use [ auto-use? off call ] with-variable ; inline
+
+: parse-sandbox ( lines assoc -- quot )
+    whitelist [ [ parse-lines ] with-sandbox-vocabs ] with-variable ;
+
+: reveal-in ( name -- )
+    [ { [ search ] [ no-word ] } 1|| ] keep current-vocab vocab-words set-at ;
+
+SYNTAX: REVEAL: scan reveal-in ;
+
+SYNTAX: REVEALING: ";" parse-tokens [ reveal-in ] each ;
diff --git a/unmaintained/sandbox/summary.txt b/unmaintained/sandbox/summary.txt
new file mode 100644 (file)
index 0000000..3ca1e25
--- /dev/null
@@ -0,0 +1 @@
+Basic sandboxing
diff --git a/unmaintained/sandbox/syntax/syntax.factor b/unmaintained/sandbox/syntax/syntax.factor
new file mode 100644 (file)
index 0000000..f04b05a
--- /dev/null
@@ -0,0 +1,26 @@
+! Copyright (C) 2009 Maxim Savchenko.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel sequences assocs namespaces lexer vocabs.parser sandbox ;
+IN: sandbox.syntax
+
+<PRIVATE
+
+ERROR: sandbox-error vocab ;
+
+: sandbox-use+ ( alias -- )
+    dup whitelist get at [ add-use ] [ sandbox-error ] ?if ;
+
+PRIVATE>
+
+SYNTAX: APPLY: scan sandbox-use+ ;
+
+SYNTAX: APPLYING: ";" parse-tokens [ sandbox-use+ ] each ;
+
+REVEALING:
+    ! #!
+    HEX: OCT: BIN: f t CHAR: "
+    [ { T{
+    ] } ;
+
+REVEAL: ;