1 ! Copyright (C) 2003, 2006 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
4 USING: errors generic hashtables kernel namespaces sequences
10 : close ( -- ) stdio get stream-close ;
12 : readln ( -- str/f ) stdio get stream-readln ;
13 : read1 ( -- ch/f ) stdio get stream-read1 ;
14 : read ( n -- str/f ) stdio get stream-read ;
16 : write1 ( ch -- ) stdio get stream-write1 ;
17 : write ( str -- ) stdio get stream-write ;
18 : flush ( -- ) stdio get stream-flush ;
20 : terpri ( -- ) stdio get stream-terpri ;
21 : format ( str style -- ) stdio get stream-format ;
23 : with-nesting ( style quot -- )
24 swap stdio get with-nested-stream ;
26 : tabular-output ( grid style quot -- )
27 swap stdio get with-stream-table ;
29 : with-style ( style quot -- )
31 [ drop call ] [ stdio get with-stream-style ] if ;
33 : print ( string -- ) stdio get stream-print ;
35 : with-stream* ( stream quot -- )
36 [ swap stdio set call ] with-scope ; inline
38 : with-stream ( stream quot -- )
39 swap [ [ close ] cleanup ] with-stream* ; inline
41 : bl ( -- ) " " write ;
43 : write-object ( str obj -- )
44 presented associate format ;
46 : write-outliner ( str obj content -- )
47 outline associate [ write-object ] with-nesting ;