]> gitweb.factorcode.org Git - factor.git/commitdiff
cleanup some use of with-scope.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 19 Jul 2012 20:55:34 +0000 (13:55 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 19 Jul 2012 20:55:34 +0000 (13:55 -0700)
17 files changed:
basis/classes/struct/struct-tests.factor
basis/help/html/html.factor
basis/help/markup/markup-tests.factor
basis/http/server/dispatchers/dispatchers-tests.factor
basis/io/backend/unix/unix-tests.factor
basis/io/files/info/unix/linux/linux.factor
basis/math/matrices/elimination/elimination.factor
basis/nmake/nmake.factor
basis/pack/pack-tests.factor
basis/prettyprint/sections/sections.factor
basis/refs/refs-tests.factor
basis/threads/threads-tests.factor
basis/ui/render/render.factor
extra/asn1/asn1.factor
extra/game/models/obj/obj.factor
extra/model-viewer/model-viewer.factor
extra/opencl/opencl.factor

index b619c5abcd6a3fb05f24e9a3c4f608aeabad5f45..45373a96ac6fc76b6539d83330ccb55b35b7cc83 100644 (file)
@@ -161,36 +161,30 @@ STRUCT: struct-test-string-ptr
 
 [ "S{ struct-test-foo { x 0 } { y 7654 } { z f } }" ]
 [
-    [
-        boa-tuples? off
-        c-object-pointers? off
+    H{ { boa-tuples? f } { c-object-pointers? f } } [
         struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
-    ] with-scope
+    ] with-variables
 ] unit-test
 
 [ "S@ struct-test-foo B{ 0 0 0 0 0 0 0 0 0 0 0 0 }" ]
 [
-    [
-        c-object-pointers? on
+    H{ { c-object-pointers? t } } [
         12 <byte-array> struct-test-foo memory>struct [ pprint ] with-string-writer
-    ] with-scope
+    ] with-variables
 ] unit-test
 
 [ "S{ struct-test-foo f 0 7654 f }" ]
 [
-    [
-        boa-tuples? on
-        c-object-pointers? off
+    H{ { boa-tuples? t } { c-object-pointers? f } } [
         struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
-    ] with-scope
+    ] with-variables
 ] unit-test
 
 [ "S@ struct-test-foo f" ]
 [
-    [
-        c-object-pointers? off
+    H{ { c-object-pointers? f } } [
         f struct-test-foo memory>struct [ pprint ] with-string-writer
-    ] with-scope
+    ] with-variables
 ] unit-test
 
 [ "USING: alien.c-types classes.struct ;
index e4a30319493d7552feaed9e7d85102d2f5e0471c..53b75bc44cbca2e889dee5ab8b323a11ccd402da 100644 (file)
@@ -118,13 +118,12 @@ M: topic url-of topic>filename ;
     all-topics [ '[ _ generate-help-file ] try ] each ;
 
 : generate-help-files ( -- )
-    [
-        recent-searches off
-        recent-words off
-        recent-articles off
-        recent-vocabs off
-        (generate-help-files)
-    ] with-scope ;
+    H{
+        { recent-searches f }
+        { recent-words f }
+        { recent-articles f }
+        { recent-vocabs f }
+    } [ (generate-help-files) ] with-variables ;
 
 : generate-help ( -- )
     "docs" cache-file
index 4a89e98dc64178fba5f7a2d72c551f9827229a05..658f7c98cd97ac6a427b98634adb47e9ad4eb671 100644 (file)
@@ -5,7 +5,8 @@ FROM: namespaces => set ;
 IN: help.markup.tests
 
 : with-markup-test ( quot -- )
-    '[ f last-element set _ with-string-writer ] with-scope ; inline
+    [ f last-element ] dip
+    '[ _ with-string-writer ] with-variable ; inline
 
 TUPLE: blahblah quux ;
 
index 08974aca3b54c208b7905aa2266fabbe4cea8cf2..da4c4c78ec9f73463d0c75d298d48749900b57e1 100644 (file)
@@ -19,15 +19,14 @@ M: mock-responder call-responder*
     main-responder get call-responder
     write-response get ;
 
-[
+<dispatcher>
+    "foo" <mock-responder> "foo" add-responder
+    "bar" <mock-responder> "bar" add-responder
     <dispatcher>
-        "foo" <mock-responder> "foo" add-responder
-        "bar" <mock-responder> "bar" add-responder
-        <dispatcher>
-            "123" <mock-responder> "123" add-responder
-            "default" <mock-responder> >>default
-        "baz" add-responder
-    main-responder set
+        "123" <mock-responder> "123" add-responder
+        "default" <mock-responder> >>default
+    "baz" add-responder
+main-responder [
 
     [ "foo" ] [
         { "foo" } main-responder get find-responder path>> nip
@@ -46,15 +45,14 @@ M: mock-responder call-responder*
     [ t ] [ "123" "baz/123" check-dispatch ] unit-test
     [ t ] [ "123" "baz///123" check-dispatch ] unit-test
 
-] with-scope
+] with-variable
 
-[
-    <dispatcher>
-        "default" <mock-responder> >>default
-    main-responder set
+<dispatcher>
+    "default" <mock-responder> >>default
+main-responder [
 
     [ "/default" ] [ "/default" main-responder get find-responder drop ] unit-test
-] with-scope
+] with-variable
 
 ! Make sure path for default responder isn't chopped
 TUPLE: path-check-responder ;
index 6eb4227855b829ddbdab2ddc6c81ec869589140f..caf4c3691adccb2a1e6e0cfeeeb91a647b6d5116 100644 (file)
@@ -41,13 +41,12 @@ yield
 [ datagram-client delete-file ] ignore-errors
 
 [
-    [
-        datagram-server <local> <datagram> "d" set
+    datagram-server <local> <datagram> "d" [
 
         "Receive 1" print
 
         "d" get receive [ reverse ] dip
-        
+
         "Send 1" print
         dup .
 
@@ -56,7 +55,7 @@ yield
         "Receive 2" print
 
         "d" get receive [ " world" append ] dip
-        
+
         "Send 1" print
         dup .
 
@@ -67,7 +66,7 @@ yield
         "Done" print
 
         datagram-server delete-file
-    ] with-scope
+    ] with-variable
 ] "Test" spawn drop
 
 yield
index 982301104595fb52097bb37a0ad79322f32b6c4e..cb5d0114af388a99e79c822d90f4da092414298c 100644 (file)
@@ -56,10 +56,7 @@ frequency pass-number ;
     } cleave ;
 
 : parse-mtab ( -- array )
-    [
-        "/etc/mtab" utf8 <file-reader>
-        CHAR: \s delimiter set csv
-    ] with-scope
+    CHAR: \s [ "/etc/mtab" utf8 file>csv ] with-delimiter
     [ mtab-csv>mtab-entry ] map ;
 
 M: linux file-systems
index 6dfcf9f0ca453e312625eac37c355beb4afc8480..c3beb6b0dd855f71c505ab6913fe0ca8ac3ffbc1 100644 (file)
@@ -7,7 +7,7 @@ IN: math.matrices.elimination
 SYMBOL: matrix
 
 : with-matrix ( matrix quot -- )
-    [ swap matrix set call matrix get ] with-scope ; inline
+    matrix swap [ matrix get ] compose with-variable ; inline
 
 : nth-row ( row# -- seq ) matrix get nth ;
 
index 912bb17218b9c5ee23f2cf2bde6f79719577ca6f..b4dc3871d4ed2dab5391d8d9d69a2061fffbea90 100644 (file)
@@ -4,7 +4,7 @@ USING: namespaces sequences math.parser kernel macros
 generalizations sequences.generalizations locals ;
 IN: nmake
 
-SYMBOL: building-seq 
+SYMBOL: building-seq
 : get-building-seq ( n -- seq )
     building-seq get nth ;
 
index 999a9521748834eb1523aa0f3f9f90d407ed4829..440d6a03693859ab620d79bd3d6b788561425ccf 100644 (file)
@@ -13,9 +13,7 @@ IN: pack.tests
 ] unit-test
 
 [ B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } ] [
-    [
-        { 1 2 3 4 5 } "cstiq" pack-le
-    ] with-scope
+    { 1 2 3 4 5 } "cstiq" pack-le
 ] unit-test
 
 [ { 1 2 3 4 5 } ] [
index e9aae02c332cddaf69a9729800f6f53ba99acdc8..e38a65135f64145f4278eb96196dbacf2c132540 100644 (file)
@@ -354,15 +354,16 @@ M: block long-section ( block -- )
 
 : make-pprint ( obj quot -- block manifest )
     [
-        0 position set
-        H{ } clone pprinter-use set
-        V{ } clone recursion-check set
-        V{ } clone pprinter-stack set
+        0 position ,,
+        H{ } clone pprinter-use ,,
+        V{ } clone recursion-check ,,
+        V{ } clone pprinter-stack ,,
+    ] H{ } make [
         over <object
         call
         pprinter-block
         pprinter-manifest
-    ] with-scope ; inline
+    ] with-variables ; inline
 
 : with-pprint ( obj quot -- )
     make-pprint drop do-pprint ; inline
index bf58aaf43d43f49d1e6b15005be414a65192be81..afa6817bf2375f296fd318d5cc9984fa6c5cbe55 100644 (file)
@@ -32,7 +32,7 @@ SYMBOLS: lion giraffe elephant rabbit ;
 [ rabbit f ] [ rabbit <obj-ref> [ take ] keep get-ref ] unit-test
 [ lion ] [ rabbit <obj-ref> dup [ drop lion ] change-ref get-ref ] unit-test
 
-! var-refs 
+! var-refs
 [ giraffe ] [ [ giraffe rabbit set rabbit <var-ref> get-ref ] with-scope ] unit-test
 
 [ rabbit ]
index 35ffb3e4c30358f6976a59b93707db85036efe5d..e5812c3fc19bc69f3cb7bb8e195b41c048ae3ad7 100644 (file)
@@ -29,10 +29,9 @@ yield
 
 :: spawn-namespace-test ( -- ? )
     <promise> :> p gensym :> g
-    [
-        g "x" set
+    g "x" [
         [ "x" get p fulfill ] "B" spawn drop
-    ] with-scope
+    ] with-variable
     p ?promise g eq? ;
 
 [ t ] [ spawn-namespace-test ] unit-test
index 84edbc35c36426bdb34f63be5ef5c9fd6fb0b1d1..872c50f6eb8af09b4af2e541c149c2065107867d 100644 (file)
@@ -136,7 +136,7 @@ M: gadget draw-children
             [ gadget-background ]
             [ gadget-foreground ]
         } cleave [
-            
+
             {
                 [ [ selected-gadgets set ] when* ]
                 [ [ selection-background set ] when* ]
index 14fc02f8824fd9e6f115629388e3f8280b0a58e8..ac43c94d0a69682c956c95b85075259eaab9a3f0 100644 (file)
@@ -193,10 +193,7 @@ TUPLE: tag value ;
 : <tag> ( -- <tag> ) 4 tag boa ;
 
 : with-ber ( quot -- )
-    [
-        <tag> tagnum set
-        call
-    ] with-scope ; inline
+    [ <tag> tagnum ] dip with-variable ; inline
 
 : set-tag ( value -- )
     tagnum get value<< ;
index 1bfe01c9200fea6c6637d57c8da7ee0815744e1c..eef576d419745fb7b3b6e34ed46b79330e67e0fe 100644 (file)
@@ -4,7 +4,7 @@ USING: io io.encodings.ascii math.parser sequences splitting
 kernel assocs io.files combinators math.order math namespaces
 arrays sequences.deep accessors alien.c-types alien.data
 game.models game.models.util gpu.shaders images game.models.loader
-prettyprint specialized-arrays ;
+prettyprint specialized-arrays make ;
 QUALIFIED-WITH: alien.c-types c
 SPECIALIZED-ARRAYS: c:float c:uint ;
 IN: game.models.obj
index 72d603540d78bfe0fcd941904d4a0ef12f9a1ac7..ef1308d9722ac98f4946a7db32b4c5acf7c3ba78 100644 (file)
@@ -100,7 +100,7 @@ TUPLE: vbo
         BGR >>component-order
         ubyte-components >>component-type
         B{ 0 0 0 } >>bitmap ;
-        
+
 : make-texture ( pathname alt -- texture )
     swap [ nip load-image ] [ ] if*
     [
@@ -115,7 +115,7 @@ TUPLE: vbo
     [
         0 swap [ allocate-texture-image ] 3keep 2drop
     ] bi ;
-        
+
 : <model-buffers> ( models -- buffers )
     [
         {
index a5753fe42743f964a0db795f737a7433aa65033b..e1c105959d44d79ef509ec2a3d538cd48d082316 100644 (file)
@@ -2,8 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.c-types alien.data arrays
 byte-arrays combinators combinators.smart destructors
-io.encodings.ascii io.encodings.string kernel libc locals math
-namespaces opencl.ffi sequences shuffle specialized-arrays
+io.encodings.ascii io.encodings.string kernel libc locals make
+math namespaces opencl.ffi sequences shuffle specialized-arrays
 variants ;
 IN: opencl
 SPECIALIZED-ARRAYS: void* char size_t ;