1(*
2    Title:      Standard Basis Library: Primitive IO Signature
3    Author:     David Matthews
4    Copyright   David Matthews 1999, 2005
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10    
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15    
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19*)
20
21(* G&R 2004 done. *)
22
23
24signature PRIM_IO =
25sig
26    type elem
27    type vector
28    type vector_slice
29    type array
30    type array_slice
31    eqtype pos
32
33    val compare : pos * pos -> General.order
34
35    datatype reader
36    = RD of {
37        name : string,
38        chunkSize : int,
39        readVec : (int -> vector) Option.option,
40        readArr : (array_slice -> int) Option.option,
41        readVecNB : (int -> vector Option.option) Option.option,
42        readArrNB : (array_slice -> int Option.option) Option.option,
43        block : (unit -> unit) Option.option,
44        canInput : (unit -> bool) Option.option,
45        avail : unit -> int Option.option,
46        getPos : (unit -> pos) Option.option,
47        setPos : (pos -> unit) Option.option,
48        endPos : (unit -> pos) Option.option,
49        verifyPos : (unit -> pos) Option.option,
50        close : unit -> unit,
51        ioDesc : OS.IO.iodesc Option.option
52    }
53
54    datatype writer = WR of {
55        name : string,
56        chunkSize : int,
57        writeVec : (vector_slice -> int) Option.option,
58        writeArr : (array_slice -> int) Option.option,
59        writeVecNB : (vector_slice -> int Option.option) Option.option,
60        writeArrNB : (array_slice -> int Option.option) Option.option,
61        block : (unit -> unit) Option.option,
62        canOutput : (unit -> bool) Option.option,
63        getPos : (unit -> pos) Option.option,
64        setPos : (pos -> unit) Option.option,
65        endPos : (unit -> pos) Option.option,
66        verifyPos : (unit -> pos) Option.option,
67        close : unit -> unit,
68        ioDesc : OS.IO.iodesc Option.option
69    }
70
71    val openVector: vector -> reader
72    val nullRd: unit -> reader
73    val nullWr: unit -> writer
74
75    val augmentReader : reader -> reader
76    val augmentWriter : writer -> writer
77end;
78