]> gitweb.factorcode.org Git - factor.git/blob - core/io/streams/memory/memory.factor
ui.listener: document that ~/.factor-history persists input history
[factor.git] / core / io / streams / memory / memory.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See https://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 C: <memory-stream> memory-stream
9
10 INSTANCE: memory-stream input-stream
11
12 M: memory-stream stream-element-type drop +byte+ ; inline
13
14 M: memory-stream stream-read1
15     [ 1 over <displaced-alien> ] change-alien drop
16     0 alien-unsigned-1 ; inline
17
18 : with-memory-reader ( alien quot -- )
19     [ <memory-stream> ] dip with-input-stream* ; inline