From e918cf6de0c16d0880f34db0f53ce9b778b6b487 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 21 Feb 2008 15:22:49 -0600 Subject: [PATCH] More changes wrt encodings --- core/bootstrap/image/image.factor | 3 +- core/io/encodings/ascii/ascii.factor | 8 ++-- core/io/encodings/ascii/authors.txt | 1 + core/io/encodings/binary/binary.factor | 2 + core/io/encodings/encodings.factor | 27 +++++++------ core/io/encodings/latin1/latin1.factor | 4 +- core/io/encodings/utf16/utf16.factor | 5 +-- core/io/encodings/utf8/utf8.factor | 5 +-- core/io/files/authors.txt | 1 + core/io/files/files.factor | 11 ++--- core/io/streams/c/c.factor | 14 +++---- core/io/streams/plain/plain.factor | 17 ++++++-- core/io/streams/string/string.factor | 47 +++++++++++----------- extra/db/sqlite/test.db | Bin 0 -> 2048 bytes extra/io/buffers/buffers-docs.factor | 2 +- extra/io/launcher/launcher-docs.factor | 3 +- extra/io/launcher/launcher.factor | 7 ++-- extra/io/nonblocking/nonblocking.factor | 8 ++-- extra/io/sockets/authors.txt | 1 + extra/io/sockets/sockets-docs.factor | 6 +-- extra/io/sockets/sockets.factor | 17 ++++---- extra/io/unix/backend/backend.factor | 4 +- extra/io/unix/launcher/launcher.factor | 4 +- extra/io/unix/sockets/sockets.factor | 4 +- extra/io/unix/unix-tests.factor | 4 +- extra/irc/irc.factor | 5 ++- extra/smtp/smtp.factor | 6 +-- extra/tools/deploy/backend/backend.factor | 4 +- extra/webapps/cgi/cgi.factor | 4 +- 29 files changed, 125 insertions(+), 99 deletions(-) create mode 100644 core/io/encodings/ascii/authors.txt create mode 100644 extra/db/sqlite/test.db diff --git a/core/bootstrap/image/image.factor b/core/bootstrap/image/image.factor index 73085450a8..610f57cb8d 100755 --- a/core/bootstrap/image/image.factor +++ b/core/bootstrap/image/image.factor @@ -416,7 +416,8 @@ M: curry ' "Writing image to " write architecture get boot-image-name resource-path dup write "..." print flush - binary [ (write-image) ] with-file-writer ; + ! binary + [ (write-image) ] with-stream ; PRIVATE> diff --git a/core/io/encodings/ascii/ascii.factor b/core/io/encodings/ascii/ascii.factor index d767f26cdd..410c07f1ca 100644 --- a/core/io/encodings/ascii/ascii.factor +++ b/core/io/encodings/ascii/ascii.factor @@ -1,8 +1,10 @@ -USING: io io.encodings strings kernel ; +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. +USING: io io.encodings strings kernel math sequences byte-arrays io.encodings ; IN: io.encodings.ascii : encode-check>= ( string max -- byte-array ) - dupd [ >= ] curry all? [ >byte-array ] [ encoding-error ] if ; + dupd [ >= ] curry all? [ >byte-array ] [ encode-error ] if ; TUPLE: ascii ; @@ -10,4 +12,4 @@ M: ascii encode-string drop 127 encode-check>= ; M: ascii decode-step - 3drop over push f f ; + 3drop dup 127 >= [ encode-error ] when over push f f ; diff --git a/core/io/encodings/ascii/authors.txt b/core/io/encodings/ascii/authors.txt new file mode 100644 index 0000000000..f990dd0ed2 --- /dev/null +++ b/core/io/encodings/ascii/authors.txt @@ -0,0 +1 @@ +Daniel Ehrenberg diff --git a/core/io/encodings/binary/binary.factor b/core/io/encodings/binary/binary.factor index 8a8d09464b..b8bcc0f87a 100644 --- a/core/io/encodings/binary/binary.factor +++ b/core/io/encodings/binary/binary.factor @@ -1 +1,3 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. IN: io.encodings.binary SYMBOL: binary diff --git a/core/io/encodings/encodings.factor b/core/io/encodings/encodings.factor index cd9d4b585b..c1fd2c018c 100755 --- a/core/io/encodings/encodings.factor +++ b/core/io/encodings/encodings.factor @@ -1,8 +1,9 @@ -! Copyright (C) 2006, 2007 Daniel Ehrenberg. +! Copyright (C) 2008 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: math kernel sequences sbufs vectors namespaces -growable strings io classes continuations -io.styles io.streams.nested io.encodings.binary ; +growable strings io classes continuations combinators +io.styles io.streams.plain io.encodings.binary splitting +io.streams.string io.streams.duplex ; IN: io.encodings ! Decoding @@ -134,18 +135,20 @@ M: encoded stream-write1 >r 1string r> stream-write ; M: encoded stream-write - [ encoding-code encode-string ] keep delegate stream-write ; + [ encoded-code encode-string ] keep delegate stream-write ; M: encoded dispose delegate dispose ; -M: encoded stream-nl - CHAR: \n swap stream-write1 ; +INSTANCE: encoded plain-writer -M: encoded stream-format - nip stream-write ; +! Rebinding duplex streams which have not read anything yet -M: encoded make-span-stream - ; +: reencode ( stream encoding -- newstream ) + over encoded? [ >r delegate r> ] when ; -M: encoded make-block-stream - nip ; +: redecode ( stream encoding -- newstream ) + over decoded? [ >r delegate r> ] when ; + +: ( duplex-stream encoding -- duplex-stream ) + swap { duplex-stream-in duplex-stream-out } get-slots + pick reencode >r swap redecode r> ; diff --git a/core/io/encodings/latin1/latin1.factor b/core/io/encodings/latin1/latin1.factor index d6e643fd96..7e867b15af 100755 --- a/core/io/encodings/latin1/latin1.factor +++ b/core/io/encodings/latin1/latin1.factor @@ -1,4 +1,6 @@ -USING: io io.encodings strings kernel io.encodings.ascii ; +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. +USING: io io.encodings strings kernel io.encodings.ascii sequences ; IN: io.encodings.latin1 TUPLE: latin1 ; diff --git a/core/io/encodings/utf16/utf16.factor b/core/io/encodings/utf16/utf16.factor index 1dd317d3c0..a241913fb5 100755 --- a/core/io/encodings/utf16/utf16.factor +++ b/core/io/encodings/utf16/utf16.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2006, 2007 Daniel Ehrenberg. +! Copyright (C) 2006, 2008 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: math kernel sequences sbufs vectors namespaces io.binary io.encodings combinators splitting io byte-arrays ; @@ -116,19 +116,16 @@ SYMBOL: ignore } cond ; TUPLE: utf16le ; -INSTANCE: utf16le encoding-stream M: utf16le encode-string drop encode-utf16le ; M: utf16le decode-step drop decode-utf16le-step ; TUPLE: utf16be ; -INSTANCE: utf16be encoding-stream M: utf16be encode-string drop encode-utf16be ; M: utf16be decode-step drop decode-utf16be-step ; TUPLE: utf16 encoding ; -INSTANCE: utf16 encoding-stream M: utf16 underlying-stream delegate dup delegate [ ] [ ] ?if ; ! necessary? M: utf16 set-underlying-stream delegate set-delegate ; ! necessary? diff --git a/core/io/encodings/utf8/utf8.factor b/core/io/encodings/utf8/utf8.factor index 7f211f92de..2e7585b8a9 100644 --- a/core/io/encodings/utf8/utf8.factor +++ b/core/io/encodings/utf8/utf8.factor @@ -1,7 +1,7 @@ -! Copyright (C) 2006, 2007 Daniel Ehrenberg. +! Copyright (C) 2006, 2008 Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. USING: math kernel sequences sbufs vectors growable io continuations -namespaces io.encodings combinators strings io.streams.c ; +namespaces io.encodings combinators strings ; IN: io.encodings.utf8 ! Decoding UTF-8 @@ -78,7 +78,6 @@ SYMBOL: quad3 ! Interface for streams TUPLE: utf8 ; -INSTANCE: utf8 encoding-stream M: utf8 encode-string drop encode-utf8 ; M: utf8 decode-step drop decode-utf8-step ; diff --git a/core/io/files/authors.txt b/core/io/files/authors.txt index 1901f27a24..a44f8d7f8d 100644 --- a/core/io/files/authors.txt +++ b/core/io/files/authors.txt @@ -1 +1,2 @@ Slava Pestov +Daniel Ehrenberg diff --git a/core/io/files/files.factor b/core/io/files/files.factor index daa5d6df7e..c96cb1578c 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -1,9 +1,10 @@ -! Copyright (C) 2004, 2008 Slava Pestov. +! Copyright (C) 2004, 2008 Slava Pestov, Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. IN: io.files USING: io.backend io.files.private io hashtables kernel math memory namespaces sequences strings assocs arrays definitions -system combinators splitting sbufs continuations io.encodings ; +system combinators splitting sbufs continuations io.encodings +io.encodings.binary ; HOOK: cd io-backend ( path -- ) @@ -16,13 +17,13 @@ HOOK: file-writer* io-backend ( path -- stream ) HOOK: file-appender* io-backend ( path -- stream ) : ( path encoding -- stream ) - swap file-reader* swap ; + swap file-reader* swap ; : ( path encoding -- stream ) - swap file-writer* swap ; + swap file-writer* swap ; : ( path encoding -- stream ) - swap file-appender* swap ; + swap file-appender* swap ; HOOK: delete-file io-backend ( path -- ) diff --git a/core/io/streams/c/c.factor b/core/io/streams/c/c.factor index 73b8bb32b9..8a6430eb86 100755 --- a/core/io/streams/c/c.factor +++ b/core/io/streams/c/c.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel kernel.private namespaces io +USING: kernel kernel.private namespaces io io.encodings strings sequences math generic threads.private classes -io.backend io.streams.duplex io.files continuations ; +io.backend io.streams.duplex io.files continuations +io.encodings.utf8 ; IN: io.streams.c TUPLE: c-writer handle ; @@ -49,9 +50,7 @@ M: c-reader dispose c-reader-handle fclose ; : ( in out -- stream ) - >r r> - - ; + >r r> ; M: object init-io ; @@ -60,8 +59,9 @@ M: object init-io ; : stderr-handle 38 getenv ; M: object init-stdio - stdin-handle stdout-handle stdio set-global - stderr-handle stderr set-global ; + stdin-handle stdout-handle + utf8 stdio set-global + stderr-handle utf8 stderr set-global ; M: object io-multiplex (sleep) ; diff --git a/core/io/streams/plain/plain.factor b/core/io/streams/plain/plain.factor index e6cf9c8afa..4898a58fb1 100644 --- a/core/io/streams/plain/plain.factor +++ b/core/io/streams/plain/plain.factor @@ -1,7 +1,18 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. +USING: kernel io io.streams.nested ; IN: io.streams.plain -USING: io.encodings.latin1 io.encodings ; -: ( stream -- new-stream ) - latin1 ; +MIXIN: plain-writer + +M: plain-writer stream-nl + CHAR: \n swap stream-write1 ; + +M: plain-writer stream-format + nip stream-write ; + +M: plain-writer make-span-stream + ; + +M: plain-writer make-block-stream + nip ; diff --git a/core/io/streams/string/string.factor b/core/io/streams/string/string.factor index a45c616b9a..f74f91c5bd 100755 --- a/core/io/streams/string/string.factor +++ b/core/io/streams/string/string.factor @@ -2,8 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. IN: io.streams.string USING: io kernel math namespaces sequences sbufs strings -generic splitting io.streams.plain io.streams.lines growable -continuations ; +generic splitting growable continuations io.streams.plain ; M: growable dispose drop ; @@ -12,31 +11,12 @@ M: growable stream-write push-all ; M: growable stream-flush drop ; : ( -- stream ) - 512 ; + 512 ; : with-string-writer ( quot -- str ) swap [ stdio get ] compose with-stream* >string ; inline -: format-column ( seq ? -- seq ) - [ - [ 0 [ length max ] reduce ] keep - swap [ CHAR: \s pad-right ] curry map - ] unless ; - -: map-last ( seq quot -- seq ) - swap dup length - [ zero? rot [ call ] keep swap ] 2map nip ; inline - -: format-table ( table -- seq ) - flip [ format-column ] map-last - flip [ " " join ] map ; - -M: plain-writer stream-write-table - [ drop format-table [ print ] each ] with-stream* ; - -M: plain-writer make-cell-stream 2drop ; - M: growable stream-read1 dup empty? [ drop f ] [ pop ] if ; : harden-as ( seq growble-exemplar -- newseq ) @@ -69,7 +49,28 @@ M: growable stream-read-partial stream-read ; : ( str -- stream ) - >sbuf dup reverse-here ; + >sbuf dup reverse-here ; : with-string-reader ( str quot -- ) >r r> with-stream ; inline + +INSTANCE: growable plain-writer + +: format-column ( seq ? -- seq ) + [ + [ 0 [ length max ] reduce ] keep + swap [ CHAR: \s pad-right ] curry map + ] unless ; + +: map-last ( seq quot -- seq ) + swap dup length + [ zero? rot [ call ] keep swap ] 2map nip ; inline + +: format-table ( table -- seq ) + flip [ format-column ] map-last + flip [ " " join ] map ; + +M: plain-writer stream-write-table + [ drop format-table [ print ] each ] with-stream* ; + +M: plain-writer make-cell-stream 2drop ; diff --git a/extra/db/sqlite/test.db b/extra/db/sqlite/test.db new file mode 100644 index 0000000000000000000000000000000000000000..e483c47cea528c95f10fcf66fcbb67ffa351ffd1 GIT binary patch literal 2048 zcmWFz^vNtqRY=P(%1ta$FlJz3U}R))P*7lCU|k literal 0 HcmV?d00001 diff --git a/extra/io/buffers/buffers-docs.factor b/extra/io/buffers/buffers-docs.factor index def3e475f7..cf069f17aa 100644 --- a/extra/io/buffers/buffers-docs.factor +++ b/extra/io/buffers/buffers-docs.factor @@ -30,7 +30,7 @@ $nl ABOUT: "buffers" HELP: buffer -{ $class-description "The class of I/O buffers, which resemble FIFO queues, but are optimize for holding bytes, are have underlying storage allocated at a fixed address. Buffers must be de-allocated manually." +{ $class-description "The class of I/O buffers, which resemble FIFO queues, but are optimized for holding bytes, are have underlying storage allocated at a fixed address. Buffers must be de-allocated manually." $nl "Buffers have two internal pointers:" { $list diff --git a/extra/io/launcher/launcher-docs.factor b/extra/io/launcher/launcher-docs.factor index 3a557e9fd5..10e7f2414b 100755 --- a/extra/io/launcher/launcher-docs.factor +++ b/extra/io/launcher/launcher-docs.factor @@ -148,8 +148,9 @@ HELP: process-stream HELP: { $values { "desc" "a launch descriptor" } + { "encoding" "an encoding descriptor" } { "stream" "a bidirectional stream" } } -{ $description "Launches a process and redirects its input and output via a pair of pipes which may be read and written as a stream." } +{ $description "Launches a process and redirects its input and output via a pair of pipes which may be read and written as a stream of the given encoding." } { $notes "Closing the stream will block until the process exits." } ; HELP: with-process-stream diff --git a/extra/io/launcher/launcher.factor b/extra/io/launcher/launcher.factor index dce893dcaf..11eb8466a1 100755 --- a/extra/io/launcher/launcher.factor +++ b/extra/io/launcher/launcher.factor @@ -117,12 +117,13 @@ M: process get-lapse process-lapse ; M: process timed-out kill-process ; HOOK: process-stream* io-backend ( desc -- stream process ) +! Process streams are always latin1 for now; will be updated TUPLE: process-stream process ; -: ( desc -- stream ) - >descriptor - [ process-stream* ] keep +: ( desc encoding -- stream ) + swap >descriptor + [ process-stream* >r swap r> ] keep +timeout+ swap at [ over set-timeout ] when* { set-delegate set-process-stream-process } process-stream construct ; diff --git a/extra/io/nonblocking/nonblocking.factor b/extra/io/nonblocking/nonblocking.factor index dfdd05af53..0ae41f08fc 100755 --- a/extra/io/nonblocking/nonblocking.factor +++ b/extra/io/nonblocking/nonblocking.factor @@ -45,10 +45,10 @@ GENERIC: close-handle ( handle -- ) : ( handle -- stream ) output-port ; -: handle>duplex-stream ( in-handle out-handle -- stream ) - - [ >r r> ] [ ] [ dispose ] - cleanup ; +: handle>duplex-stream ( in-handle out-handle encoding -- stream ) + [ swap swap ] keep + [ -rot >r swap r> ] + [ ] [ dispose ] cleanup ; : pending-error ( port -- ) dup port-error f rot set-port-error [ throw ] when* ; diff --git a/extra/io/sockets/authors.txt b/extra/io/sockets/authors.txt index 1901f27a24..a44f8d7f8d 100644 --- a/extra/io/sockets/authors.txt +++ b/extra/io/sockets/authors.txt @@ -1 +1,2 @@ Slava Pestov +Daniel Ehrenberg diff --git a/extra/io/sockets/sockets-docs.factor b/extra/io/sockets/sockets-docs.factor index 9136c3ca22..510d47ff2b 100755 --- a/extra/io/sockets/sockets-docs.factor +++ b/extra/io/sockets/sockets-docs.factor @@ -92,11 +92,11 @@ HELP: inet6 } ; HELP: -{ $values { "addrspec" "an address specifier" } { "stream" "a bidirectional stream" } } -{ $description "Opens a network connection and outputs a bidirectional stream." } +{ $values { "addrspec" "an address specifier" } { "encoding" "an encding descriptor" } { "stream" "a bidirectional stream" } } +{ $description "Opens a network connection and outputs a bidirectional stream using the given encoding." } { $errors "Throws an error if the connection cannot be established." } { $examples - { $code "\"www.apple.com\" \"http\" " } + { $code "\"www.apple.com\" \"http\" utf8 " } } ; HELP: diff --git a/extra/io/sockets/sockets.factor b/extra/io/sockets/sockets.factor index 1afffcc7b2..6cf75f2f60 100755 --- a/extra/io/sockets/sockets.factor +++ b/extra/io/sockets/sockets.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2007 Slava Pestov. +! Copyright (C) 2007, 2008 Slava Pestov, Daniel Ehrenberg. ! See http://factorcode.org/license.txt for BSD license. IN: io.sockets USING: generic kernel io.backend namespaces continuations -sequences arrays ; +sequences arrays io.encodings ; TUPLE: local path ; @@ -28,11 +28,12 @@ TUPLE: client-stream addr ; HOOK: (client) io-backend ( addrspec -- stream ) -GENERIC: ( addrspec -- stream ) +GENERIC: client* ( addrspec -- stream ) +M: array client* [ (client) ] attempt-all ; +M: object client* (client) ; -M: array [ (client) ] attempt-all ; - -M: object (client) ; +: ( addrspec encoding -- stream ) + >r client* r> ; HOOK: io-backend ( addrspec -- server ) @@ -48,7 +49,7 @@ HOOK: resolve-host io-backend ( host serv passive? -- seq ) HOOK: host-name io-backend ( -- string ) -M: inet +M: inet client* dup inet-host swap inet-port f resolve-host dup empty? [ "Host name lookup failed" throw ] when - ; + client* ; diff --git a/extra/io/unix/backend/backend.factor b/extra/io/unix/backend/backend.factor index 7d9f76c686..d6e384f255 100755 --- a/extra/io/unix/backend/backend.factor +++ b/extra/io/unix/backend/backend.factor @@ -181,8 +181,8 @@ M: unix-io io-multiplex ( ms -- ) mx get-global wait-for-events ; M: unix-io init-stdio ( -- ) - 0 1 handle>duplex-stream io:stdio set-global - 2 io:stderr set-global ; + 0 1 utf8 handle>duplex-stream io:stdio set-global + 2 utf8 io:stderr set-global ; ! mx io-task for embedding an fd-based mx inside another mx TUPLE: mx-port mx ; diff --git a/extra/io/unix/launcher/launcher.factor b/extra/io/unix/launcher/launcher.factor index 5adf0d7453..4e5f9e0fdf 100755 --- a/extra/io/unix/launcher/launcher.factor +++ b/extra/io/unix/launcher/launcher.factor @@ -4,7 +4,7 @@ USING: io io.backend io.launcher io.unix.backend io.unix.files io.nonblocking sequences kernel namespaces math system alien.c-types debugger continuations arrays assocs combinators unix.process parser-combinators memoize -promises strings threads unix ; +promises strings threads unix io.encodings.latin1 ; IN: io.unix.launcher ! Search unix first @@ -99,7 +99,7 @@ M: unix-io kill-process* ( pid -- ) M: unix-io process-stream* [ - spawn-process-stream >r handle>duplex-stream r> + spawn-process-stream >r latin1 handle>duplex-stream r> ] with-descriptor ; : find-process ( handle -- process ) diff --git a/extra/io/unix/sockets/sockets.factor b/extra/io/unix/sockets/sockets.factor index 59a9a8ac2e..84d4cc33f8 100755 --- a/extra/io/unix/sockets/sockets.factor +++ b/extra/io/unix/sockets/sockets.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2004, 2008 Slava Pestov, Ivan Tikhonov. +! Copyright (C) 2004, 2008 Slava Pestov, Ivan Tikhonov. ! See http://factorcode.org/license.txt for BSD license. ! We need to fiddle with the exact search order here, since @@ -92,7 +92,7 @@ USE: io.sockets dup rot make-sockaddr/size bind zero? [ dup close (io-error) ] unless ; -M: unix-io ( addrspec -- stream ) +M: unix-io ( addrspec -- server ) [ SOCK_STREAM server-fd dup 10 listen zero? [ dup close (io-error) ] unless diff --git a/extra/io/unix/unix-tests.factor b/extra/io/unix/unix-tests.factor index 85d450dac9..54d2573396 100755 --- a/extra/io/unix/unix-tests.factor +++ b/extra/io/unix/unix-tests.factor @@ -1,6 +1,6 @@ USING: io.files io.sockets io kernel threads namespaces tools.test continuations strings byte-arrays sequences -prettyprint system io.encodings.binary ; +prettyprint system io.encodings.binary io.encodings.ascii ; IN: temporary ! Unix domain stream sockets @@ -24,7 +24,7 @@ yield [ { "Hello world" "FOO" } ] [ [ - "unix-domain-socket-test" resource-path + "unix-domain-socket-test" resource-path ascii [ readln , "XYZ" print flush diff --git a/extra/irc/irc.factor b/extra/irc/irc.factor index 44c682e671..8a39846fc4 100755 --- a/extra/irc/irc.factor +++ b/extra/irc/irc.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2007 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays calendar io io.sockets kernel match namespaces -sequences splitting strings continuations threads ascii ; +sequences splitting strings continuations threads ascii +io.encodings.utf8 ; IN: irc ! "setup" objects @@ -97,7 +98,7 @@ SYMBOL: irc-client " hostname servername :irc.factor" irc-print ; : connect* ( server port -- ) - irc-client get set-irc-client-stream ; + utf8 irc-client get set-irc-client-stream ; : connect ( server -- ) 6667 connect* ; diff --git a/extra/smtp/smtp.factor b/extra/smtp/smtp.factor index 47bc16e029..14230e2c7c 100755 --- a/extra/smtp/smtp.factor +++ b/extra/smtp/smtp.factor @@ -3,7 +3,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: namespaces io io.timeouts kernel logging io.sockets sequences combinators sequences.lib splitting assocs strings -math.parser random system calendar ; +math.parser random system calendar io.encodings.ascii ; IN: smtp @@ -20,7 +20,7 @@ SYMBOL: esmtp t esmtp set-global : with-smtp-connection ( quot -- ) smtp-host get smtp-port get 2dup log-smtp-connection - [ + ascii [ ! ASCII until encodings reconsidered smtp-domain [ host-name or ] change read-timeout get stdio get set-timeout call @@ -180,4 +180,4 @@ TUPLE: email from to subject body ; : send ( email -- ) { email-body email-subject email-to email-from } get-slots - send-simple-message ; \ No newline at end of file + send-simple-message ; diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor index 2439ef8636..bcdc0f806f 100755 --- a/extra/tools/deploy/backend/backend.factor +++ b/extra/tools/deploy/backend/backend.factor @@ -6,7 +6,7 @@ continuations math definitions mirrors splitting parser classes inspector layouts vocabs.loader prettyprint.config prettyprint debugger io.streams.c io.streams.duplex io.files io.backend quotations io.launcher words.private tools.deploy.config -bootstrap.image ; +bootstrap.image io.encodings.utf8 ; IN: tools.deploy.backend : (copy-lines) ( stream -- ) @@ -20,7 +20,7 @@ IN: tools.deploy.backend [ +arguments+ set +stdout+ +stderr+ set - ] H{ } make-assoc + ] H{ } make-assoc utf8 dup duplex-stream-out dispose dup copy-lines process-stream-process wait-for-process zero? [ diff --git a/extra/webapps/cgi/cgi.factor b/extra/webapps/cgi/cgi.factor index 967036a797..255aee0fbd 100644 --- a/extra/webapps/cgi/cgi.factor +++ b/extra/webapps/cgi/cgi.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: namespaces kernel assocs io.files combinators arrays io.launcher io http.server.responders webapps.file -sequences strings math.parser unicode.case ; +sequences strings math.parser unicode.case io.encodings.binary ; IN: webapps.cgi SYMBOL: cgi-root @@ -50,7 +50,7 @@ SYMBOL: cgi-root : (do-cgi) ( name -- ) "200 CGI output follows" response - stdio get swap cgi-descriptor [ + stdio get swap cgi-descriptor binary [ post? [ "raw-response" get write flush ] when