io.streams.memory: adding with-memory-reader.

db4
John Benediktsson 2012-06-18 17:24:21 -07:00
parent 7a10a8eb0d
commit 752b5c6887
3 changed files with 5 additions and 5 deletions

View File

@ -26,8 +26,8 @@ M: windows unset-os-env ( key -- )
M: windows (os-envs) ( -- seq ) M: windows (os-envs) ( -- seq )
GetEnvironmentStrings [ GetEnvironmentStrings [
<memory-stream> [ [
utf16n decode-input utf16n decode-input
[ "\0" read-until drop dup empty? not ] [ ] produce nip [ "\0" read-until drop dup empty? not ] [ ] produce nip
] with-input-stream* ] with-memory-reader
] [ FreeEnvironmentStrings win32-error=0/f ] bi ; ] [ FreeEnvironmentStrings win32-error=0/f ] bi ;

View File

@ -15,3 +15,6 @@ M: memory-stream stream-element-type drop +byte+ ;
M: memory-stream stream-read1 M: memory-stream stream-read1
[ 1 over <displaced-alien> ] change-alien drop [ 1 over <displaced-alien> ] change-alien drop
0 alien-unsigned-1 ; inline 0 alien-unsigned-1 ; inline
: with-memory-reader ( alien quot -- )
[ <memory-stream> ] dip with-input-stream* ; inline

View File

@ -3,8 +3,5 @@
USING: io io.streams.memory serialize kernel ; USING: io io.streams.memory serialize kernel ;
IN: tokyo.utils IN: tokyo.utils
: with-memory-reader ( memory quot -- )
[ <memory-stream> ] dip with-input-stream* ; inline
: memory>object ( memory -- object ) : memory>object ( memory -- object )
[ deserialize ] with-memory-reader ; [ deserialize ] with-memory-reader ;