]> gitweb.factorcode.org Git - factor.git/blob - core/io/streams/memory/memory.factor
core: cleanup USING lists.
[factor.git] / core / io / streams / memory / memory.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien alien.accessors io kernel ;
4 IN: io.streams.memory
5
6 TUPLE: memory-stream alien ;
7
8 : <memory-stream> ( alien -- stream )
9     memory-stream boa ;
10
11 INSTANCE: memory-stream input-stream
12
13 M: memory-stream stream-element-type drop +byte+ ;
14
15 M: memory-stream stream-read1
16     [ 1 over <displaced-alien> ] change-alien drop
17     0 alien-unsigned-1 ; inline
18
19 : with-memory-reader ( alien quot -- )
20     [ <memory-stream> ] dip with-input-stream* ; inline