cleanup some use of with-scope.
parent
6c8c5992a1
commit
1a73e79ef7
|
@ -161,36 +161,30 @@ STRUCT: struct-test-string-ptr
|
||||||
|
|
||||||
[ "S{ struct-test-foo { x 0 } { y 7654 } { z f } }" ]
|
[ "S{ struct-test-foo { x 0 } { y 7654 } { z f } }" ]
|
||||||
[
|
[
|
||||||
[
|
H{ { boa-tuples? f } { c-object-pointers? f } } [
|
||||||
boa-tuples? off
|
|
||||||
c-object-pointers? off
|
|
||||||
struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
|
struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
|
||||||
] with-scope
|
] with-variables
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "S@ struct-test-foo B{ 0 0 0 0 0 0 0 0 0 0 0 0 }" ]
|
[ "S@ struct-test-foo B{ 0 0 0 0 0 0 0 0 0 0 0 0 }" ]
|
||||||
[
|
[
|
||||||
[
|
H{ { c-object-pointers? t } } [
|
||||||
c-object-pointers? on
|
|
||||||
12 <byte-array> struct-test-foo memory>struct [ pprint ] with-string-writer
|
12 <byte-array> struct-test-foo memory>struct [ pprint ] with-string-writer
|
||||||
] with-scope
|
] with-variables
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "S{ struct-test-foo f 0 7654 f }" ]
|
[ "S{ struct-test-foo f 0 7654 f }" ]
|
||||||
[
|
[
|
||||||
[
|
H{ { boa-tuples? t } { c-object-pointers? f } } [
|
||||||
boa-tuples? on
|
|
||||||
c-object-pointers? off
|
|
||||||
struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
|
struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer
|
||||||
] with-scope
|
] with-variables
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "S@ struct-test-foo f" ]
|
[ "S@ struct-test-foo f" ]
|
||||||
[
|
[
|
||||||
[
|
H{ { c-object-pointers? f } } [
|
||||||
c-object-pointers? off
|
|
||||||
f struct-test-foo memory>struct [ pprint ] with-string-writer
|
f struct-test-foo memory>struct [ pprint ] with-string-writer
|
||||||
] with-scope
|
] with-variables
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "USING: alien.c-types classes.struct ;
|
[ "USING: alien.c-types classes.struct ;
|
||||||
|
|
|
@ -118,13 +118,12 @@ M: topic url-of topic>filename ;
|
||||||
all-topics [ '[ _ generate-help-file ] try ] each ;
|
all-topics [ '[ _ generate-help-file ] try ] each ;
|
||||||
|
|
||||||
: generate-help-files ( -- )
|
: generate-help-files ( -- )
|
||||||
[
|
H{
|
||||||
recent-searches off
|
{ recent-searches f }
|
||||||
recent-words off
|
{ recent-words f }
|
||||||
recent-articles off
|
{ recent-articles f }
|
||||||
recent-vocabs off
|
{ recent-vocabs f }
|
||||||
(generate-help-files)
|
} [ (generate-help-files) ] with-variables ;
|
||||||
] with-scope ;
|
|
||||||
|
|
||||||
: generate-help ( -- )
|
: generate-help ( -- )
|
||||||
"docs" cache-file
|
"docs" cache-file
|
||||||
|
|
|
@ -5,7 +5,8 @@ FROM: namespaces => set ;
|
||||||
IN: help.markup.tests
|
IN: help.markup.tests
|
||||||
|
|
||||||
: with-markup-test ( quot -- )
|
: 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 ;
|
TUPLE: blahblah quux ;
|
||||||
|
|
||||||
|
|
|
@ -19,15 +19,14 @@ M: mock-responder call-responder*
|
||||||
main-responder get call-responder
|
main-responder get call-responder
|
||||||
write-response get ;
|
write-response get ;
|
||||||
|
|
||||||
[
|
<dispatcher>
|
||||||
<dispatcher>
|
|
||||||
"foo" <mock-responder> "foo" add-responder
|
"foo" <mock-responder> "foo" add-responder
|
||||||
"bar" <mock-responder> "bar" add-responder
|
"bar" <mock-responder> "bar" add-responder
|
||||||
<dispatcher>
|
<dispatcher>
|
||||||
"123" <mock-responder> "123" add-responder
|
"123" <mock-responder> "123" add-responder
|
||||||
"default" <mock-responder> >>default
|
"default" <mock-responder> >>default
|
||||||
"baz" add-responder
|
"baz" add-responder
|
||||||
main-responder set
|
main-responder [
|
||||||
|
|
||||||
[ "foo" ] [
|
[ "foo" ] [
|
||||||
{ "foo" } main-responder get find-responder path>> nip
|
{ "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
|
||||||
[ t ] [ "123" "baz///123" check-dispatch ] unit-test
|
[ t ] [ "123" "baz///123" check-dispatch ] unit-test
|
||||||
|
|
||||||
] with-scope
|
] with-variable
|
||||||
|
|
||||||
[
|
<dispatcher>
|
||||||
<dispatcher>
|
|
||||||
"default" <mock-responder> >>default
|
"default" <mock-responder> >>default
|
||||||
main-responder set
|
main-responder [
|
||||||
|
|
||||||
[ "/default" ] [ "/default" main-responder get find-responder drop ] unit-test
|
[ "/default" ] [ "/default" main-responder get find-responder drop ] unit-test
|
||||||
] with-scope
|
] with-variable
|
||||||
|
|
||||||
! Make sure path for default responder isn't chopped
|
! Make sure path for default responder isn't chopped
|
||||||
TUPLE: path-check-responder ;
|
TUPLE: path-check-responder ;
|
||||||
|
|
|
@ -41,8 +41,7 @@ yield
|
||||||
[ datagram-client delete-file ] ignore-errors
|
[ datagram-client delete-file ] ignore-errors
|
||||||
|
|
||||||
[
|
[
|
||||||
[
|
datagram-server <local> <datagram> "d" [
|
||||||
datagram-server <local> <datagram> "d" set
|
|
||||||
|
|
||||||
"Receive 1" print
|
"Receive 1" print
|
||||||
|
|
||||||
|
@ -67,7 +66,7 @@ yield
|
||||||
"Done" print
|
"Done" print
|
||||||
|
|
||||||
datagram-server delete-file
|
datagram-server delete-file
|
||||||
] with-scope
|
] with-variable
|
||||||
] "Test" spawn drop
|
] "Test" spawn drop
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
|
@ -56,10 +56,7 @@ frequency pass-number ;
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: parse-mtab ( -- array )
|
: parse-mtab ( -- array )
|
||||||
[
|
CHAR: \s [ "/etc/mtab" utf8 file>csv ] with-delimiter
|
||||||
"/etc/mtab" utf8 <file-reader>
|
|
||||||
CHAR: \s delimiter set csv
|
|
||||||
] with-scope
|
|
||||||
[ mtab-csv>mtab-entry ] map ;
|
[ mtab-csv>mtab-entry ] map ;
|
||||||
|
|
||||||
M: linux file-systems
|
M: linux file-systems
|
||||||
|
|
|
@ -7,7 +7,7 @@ IN: math.matrices.elimination
|
||||||
SYMBOL: matrix
|
SYMBOL: matrix
|
||||||
|
|
||||||
: with-matrix ( matrix quot -- )
|
: 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 ;
|
: nth-row ( row# -- seq ) matrix get nth ;
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,7 @@ IN: pack.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } ] [
|
[ 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
|
{ 1 2 3 4 5 } "cstiq" pack-le
|
||||||
] with-scope
|
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ { 1 2 3 4 5 } ] [
|
[ { 1 2 3 4 5 } ] [
|
||||||
|
|
|
@ -354,15 +354,16 @@ M: block long-section ( block -- )
|
||||||
|
|
||||||
: make-pprint ( obj quot -- block manifest )
|
: make-pprint ( obj quot -- block manifest )
|
||||||
[
|
[
|
||||||
0 position set
|
0 position ,,
|
||||||
H{ } clone pprinter-use set
|
H{ } clone pprinter-use ,,
|
||||||
V{ } clone recursion-check set
|
V{ } clone recursion-check ,,
|
||||||
V{ } clone pprinter-stack set
|
V{ } clone pprinter-stack ,,
|
||||||
|
] H{ } make [
|
||||||
over <object
|
over <object
|
||||||
call
|
call
|
||||||
pprinter-block
|
pprinter-block
|
||||||
pprinter-manifest
|
pprinter-manifest
|
||||||
] with-scope ; inline
|
] with-variables ; inline
|
||||||
|
|
||||||
: with-pprint ( obj quot -- )
|
: with-pprint ( obj quot -- )
|
||||||
make-pprint drop do-pprint ; inline
|
make-pprint drop do-pprint ; inline
|
||||||
|
|
|
@ -29,10 +29,9 @@ yield
|
||||||
|
|
||||||
:: spawn-namespace-test ( -- ? )
|
:: spawn-namespace-test ( -- ? )
|
||||||
<promise> :> p gensym :> g
|
<promise> :> p gensym :> g
|
||||||
[
|
g "x" [
|
||||||
g "x" set
|
|
||||||
[ "x" get p fulfill ] "B" spawn drop
|
[ "x" get p fulfill ] "B" spawn drop
|
||||||
] with-scope
|
] with-variable
|
||||||
p ?promise g eq? ;
|
p ?promise g eq? ;
|
||||||
|
|
||||||
[ t ] [ spawn-namespace-test ] unit-test
|
[ t ] [ spawn-namespace-test ] unit-test
|
||||||
|
|
|
@ -193,10 +193,7 @@ TUPLE: tag value ;
|
||||||
: <tag> ( -- <tag> ) 4 tag boa ;
|
: <tag> ( -- <tag> ) 4 tag boa ;
|
||||||
|
|
||||||
: with-ber ( quot -- )
|
: with-ber ( quot -- )
|
||||||
[
|
[ <tag> tagnum ] dip with-variable ; inline
|
||||||
<tag> tagnum set
|
|
||||||
call
|
|
||||||
] with-scope ; inline
|
|
||||||
|
|
||||||
: set-tag ( value -- )
|
: set-tag ( value -- )
|
||||||
tagnum get value<< ;
|
tagnum get value<< ;
|
||||||
|
|
|
@ -4,7 +4,7 @@ USING: io io.encodings.ascii math.parser sequences splitting
|
||||||
kernel assocs io.files combinators math.order math namespaces
|
kernel assocs io.files combinators math.order math namespaces
|
||||||
arrays sequences.deep accessors alien.c-types alien.data
|
arrays sequences.deep accessors alien.c-types alien.data
|
||||||
game.models game.models.util gpu.shaders images game.models.loader
|
game.models game.models.util gpu.shaders images game.models.loader
|
||||||
prettyprint specialized-arrays ;
|
prettyprint specialized-arrays make ;
|
||||||
QUALIFIED-WITH: alien.c-types c
|
QUALIFIED-WITH: alien.c-types c
|
||||||
SPECIALIZED-ARRAYS: c:float c:uint ;
|
SPECIALIZED-ARRAYS: c:float c:uint ;
|
||||||
IN: game.models.obj
|
IN: game.models.obj
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types alien.data arrays
|
USING: accessors alien alien.c-types alien.data arrays
|
||||||
byte-arrays combinators combinators.smart destructors
|
byte-arrays combinators combinators.smart destructors
|
||||||
io.encodings.ascii io.encodings.string kernel libc locals math
|
io.encodings.ascii io.encodings.string kernel libc locals make
|
||||||
namespaces opencl.ffi sequences shuffle specialized-arrays
|
math namespaces opencl.ffi sequences shuffle specialized-arrays
|
||||||
variants ;
|
variants ;
|
||||||
IN: opencl
|
IN: opencl
|
||||||
SPECIALIZED-ARRAYS: void* char size_t ;
|
SPECIALIZED-ARRAYS: void* char size_t ;
|
||||||
|
|
Loading…
Reference in New Issue