-
Notifications
You must be signed in to change notification settings - Fork 14
/
io-util.sml
executable file
·67 lines (58 loc) · 2.05 KB
/
io-util.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
structure TextIOUtil
:>
IO_UTIL
where type outstream = TextIO.outstream
=
struct
type outstream = TextIO.outstream
val nullOut =
TextIO.mkOutstream
(TextIO.StreamIO.mkOutstream
(TextPrimIO.WR
{
name = "null",
chunkSize = 1,
writeVec = SOME (fn vec => CharVectorSlice.length vec),
writeArr = SOME (fn arr => CharArraySlice.length arr),
writeVecNB = SOME (fn vec => SOME (CharVectorSlice.length vec)),
writeArrNB = SOME (fn arr => SOME (CharArraySlice.length arr)),
block = SOME (fn () => ()),
canOutput = SOME (fn () => true),
getPos = SOME (fn () => 0),
setPos = SOME (fn _ => ()),
endPos = SOME (fn () => 0),
verifyPos = SOME (fn () => 0),
close = (fn () => ()),
ioDesc = NONE
},
IO.NO_BUF))
end
structure BinIOUtil
:>
IO_UTIL
where type outstream = BinIO.outstream
=
struct
type outstream = BinIO.outstream
val nullOut =
BinIO.mkOutstream
(BinIO.StreamIO.mkOutstream
(BinPrimIO.WR
{
name = "null",
chunkSize = 1,
writeVec = SOME (fn vec => Word8VectorSlice.length vec),
writeArr = SOME (fn arr => Word8ArraySlice.length arr),
writeVecNB = SOME (fn vec => SOME (Word8VectorSlice.length vec)),
writeArrNB = SOME (fn arr => SOME (Word8ArraySlice.length arr)),
block = SOME (fn () => ()),
canOutput = SOME (fn () => true),
getPos = SOME (fn () => 0),
setPos = SOME (fn _ => ()),
endPos = SOME (fn () => 0),
verifyPos = SOME (fn () => 0),
close = (fn () => ()),
ioDesc = NONE
},
IO.NO_BUF))
end