Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / basis-library / io / text-io.sml
1 (* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9 structure TextIO: TEXT_IO_EXTRA =
10 struct
11 structure IO =
12 ImperativeIOExtra
13 (structure Array = CharArray
14 structure ArraySlice = CharArraySlice
15 structure PrimIO = TextPrimIO
16 structure Vector = CharVector
17 structure VectorSlice = CharVectorSlice
18 val chunkSize = Int32.toInt (Primitive.Controls.bufSize)
19 val fileTypeFlags = [PrimitiveFFI.Posix.FileSys.O.TEXT]
20 val line = SOME {isLine = fn c => c = #"\n",
21 lineElem = #"\n"}
22 val mkReader = Posix.IO.mkTextReader
23 val mkWriter = Posix.IO.mkTextWriter
24 val someElem = (#"\000": Char.char)
25 val xlatePos = SOME {fromInt = fn i => i,
26 toInt = fn i => i})
27 open IO
28
29 structure StreamIO =
30 struct
31 open StreamIO
32
33 fun outputSubstr (s, ss) = outputSlice (s, ss)
34 end
35
36 val outputSubstr = outputSlice
37
38 val openString = openVector
39
40 fun print (s: string) = (output (stdOut, s); flushOut stdOut)
41 end
42
43 structure TextIOGlobal: TEXT_IO_GLOBAL = TextIO
44 open TextIOGlobal