]> gitweb.factorcode.org Git - factor.git/blob - core/io/streams/memory/memory.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[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: kernel accessors alien alien.accessors math io ;
4 IN: io.streams.memory
5
6 TUPLE: memory-stream alien index ;
7
8 : <memory-stream> ( alien -- stream )
9     0 memory-stream boa ;
10
11 M: memory-stream stream-element-type drop +byte+ ;
12
13 M: memory-stream stream-read1
14     [ [ alien>> ] [ index>> ] bi alien-unsigned-1 ]
15     [ [ 1 + ] change-index drop ] bi ;