diff --git a/extra/delegate/protocols/protocols.factor b/extra/delegate/protocols/protocols.factor index f1ad068fe2..c1d7e1e4ab 100755 --- a/extra/delegate/protocols/protocols.factor +++ b/extra/delegate/protocols/protocols.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. USING: delegate sequences.private sequences assocs prettyprint.sections -io definitions kernel continuations ; +io definitions kernel continuations listener ; IN: delegate.protocols PROTOCOL: sequence-protocol @@ -12,8 +12,10 @@ PROTOCOL: assoc-protocol at* assoc-size >alist set-at assoc-clone-like { assoc-find 1 } delete-at clear-assoc new-assoc assoc-like ; -PROTOCOL: stream-protocol - stream-read1 stream-read stream-read-until dispose +PROTOCOL: input-stream-protocol + stream-read1 stream-read stream-read-until stream-read-quot ; + +PROTOCOL: output-stream-protocol stream-flush stream-write1 stream-write stream-format stream-nl make-span-stream make-block-stream stream-readln make-cell-stream stream-write-table ; diff --git a/extra/http/client/client.factor b/extra/http/client/client.factor index 41bf380927..7f8241a818 100755 --- a/extra/http/client/client.factor +++ b/extra/http/client/client.factor @@ -3,7 +3,8 @@ USING: assocs http kernel math math.parser namespaces sequences io io.sockets io.streams.string io.files io.timeouts strings splitting calendar continuations accessors vectors math.order -io.encodings.8-bit io.encodings.binary fry debugger inspector ; +io.encodings.8-bit io.encodings.binary io.streams.duplex +fry debugger inspector ; IN: http.client : max-redirects 10 ; diff --git a/extra/http/server/auth/admin/admin.factor b/extra/http/server/auth/admin/admin.factor index e762103d7b..21e1a6181b 100644 --- a/extra/http/server/auth/admin/admin.factor +++ b/extra/http/server/auth/admin/admin.factor @@ -82,10 +82,8 @@ IN: http.server.auth.admin same-password-twice - user new "username" value >>username select-tuple [ - user-exists? on - validation-failed - ] when + user new "username" value >>username select-tuple + [ user-exists ] when "username" value "realname" value >>realname diff --git a/extra/io/server/server.factor b/extra/io/server/server.factor index 45e3b1de66..1d626a9e15 100755 --- a/extra/io/server/server.factor +++ b/extra/io/server/server.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2003, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.sockets io.files logging continuations kernel -math math.parser namespaces parser sequences strings -prettyprint debugger quotations calendar +USING: io io.sockets io.files io.streams.duplex logging +continuations kernel math math.parser namespaces parser +sequences strings prettyprint debugger quotations calendar threads concurrency.combinators assocs ; IN: io.server diff --git a/extra/io/streams/duplex/duplex.factor b/extra/io/streams/duplex/duplex.factor index 4841d3b3c4..cb96d8017a 100755 --- a/extra/io/streams/duplex/duplex.factor +++ b/extra/io/streams/duplex/duplex.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel continuations io io.encodings io.encodings.private -io.timeouts debugger inspector listener accessors ; +io.timeouts debugger inspector listener accessors delegate +delegate.protocols ; IN: io.streams.duplex ! We ensure that the stream can only be closed once, to preserve @@ -28,50 +29,9 @@ M: stream-closed-twice summary PRIVATE> -M: duplex-stream stream-flush - out stream-flush ; +CONSULT: input-stream-protocol duplex-stream in ; -M: duplex-stream stream-readln - in stream-readln ; - -M: duplex-stream stream-read1 - in stream-read1 ; - -M: duplex-stream stream-read-until - in stream-read-until ; - -M: duplex-stream stream-read-partial - in stream-read-partial ; - -M: duplex-stream stream-read - in stream-read ; - -M: duplex-stream stream-write1 - out stream-write1 ; - -M: duplex-stream stream-write - out stream-write ; - -M: duplex-stream stream-nl - out stream-nl ; - -M: duplex-stream stream-format - out stream-format ; - -M: duplex-stream make-span-stream - out make-span-stream ; - -M: duplex-stream make-block-stream - out make-block-stream ; - -M: duplex-stream make-cell-stream - out make-cell-stream ; - -M: duplex-stream stream-write-table - out stream-write-table ; - -M: duplex-stream stream-read-quot - in stream-read-quot ; +CONSULT: output-stream-protocol duplex-stream out ; M: duplex-stream set-timeout [ in set-timeout ] [ out set-timeout ] 2bi ; diff --git a/extra/io/unix/pipes/pipes-tests.factor b/extra/io/unix/pipes/pipes-tests.factor index 755809de36..997c54775b 100644 --- a/extra/io/unix/pipes/pipes-tests.factor +++ b/extra/io/unix/pipes/pipes-tests.factor @@ -4,13 +4,13 @@ IN: io.unix.pipes.tests [ { 0 0 } ] [ { "ls" "grep x" } with-pipeline ] unit-test -! [ ] [ -! { -! "ls" -! [ -! input-stream [ utf8 ] change -! input-stream get lines reverse [ print ] each f -! ] -! "grep x" -! } with-pipeline -! ] unit-test +[ { 0 f 0 } ] [ + { + "ls" + [ + input-stream [ utf8 ] change + input-stream get lines reverse [ print ] each f + ] + "grep x" + } with-pipeline +] unit-test