Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / basis-library / io / prim-io.sig
1 (* Copyright (C) 2002-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 *)
7
8 signature PRIM_IO =
9 sig
10 type elem
11 type vector
12 type vector_slice
13 type array
14 type array_slice
15
16 eqtype pos
17 val compare: pos * pos -> order
18
19 datatype reader =
20 RD of {avail: unit -> int option,
21 block: (unit -> unit) option,
22 canInput: (unit -> bool) option,
23 chunkSize: int,
24 close: unit -> unit,
25 endPos: (unit -> pos) option,
26 getPos: (unit -> pos) option,
27 ioDesc: OS.IO.iodesc option,
28 name: string,
29 readArr: (array_slice -> int) option,
30 readArrNB: (array_slice -> int option) option,
31 readVec: (int -> vector) option,
32 readVecNB: (int -> vector option) option,
33 setPos: (pos -> unit) option,
34 verifyPos: (unit -> pos) option}
35
36 datatype writer =
37 WR of {block: (unit -> unit) option,
38 canOutput: (unit -> bool) option,
39 chunkSize: int,
40 close: unit -> unit,
41 endPos: (unit -> pos) option,
42 getPos: (unit -> pos) option,
43 ioDesc: OS.IO.iodesc option,
44 name: string,
45 setPos: (pos -> unit) option,
46 verifyPos: (unit -> pos) option,
47 writeArr: (array_slice -> int) option,
48 writeArrNB: (array_slice -> int option) option,
49 writeVec: (vector_slice -> int) option,
50 writeVecNB: (vector_slice -> int option) option}
51
52 val openVector: vector -> reader
53 val nullRd: unit -> reader
54 val nullWr: unit -> writer
55
56 val augmentReader: reader -> reader
57 val augmentWriter: writer -> writer
58 end