1(*
2    Title:      Standard Basis Library: Primitive Text IO
3    Copyright   David C.J. Matthews 2000
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9    
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14    
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18*)
19
20
21(* QUESTION: What is the relationship between TextPrimIO and TextIO?
22   Is TextIO.StreamIO.reader supposed to be the same as TextPrimIO.reader
23   and similarly for writer? Assume yes.  Yes, in G&R these are explicit*)
24structure TextPrimIO :>
25sig
26    include PRIM_IO
27    where type vector = CharVector.vector
28    where type elem = Char.char
29    where type array = CharArray.array
30    where type pos = Position.int
31    where type vector_slice = CharVectorSlice.slice
32    where type array_slice = CharArraySlice.slice
33end =
34    PrimIO (
35        structure Array = CharArray
36        structure Vector = CharVector
37        structure ArraySlice = CharArraySlice
38        structure VectorSlice = CharVectorSlice
39        val someElem : Array.elem = #" " (* Initialise to spaces. *)
40        (* BinPrimIO.pos is defined to be Position.int.  TextPrimIO.pos
41           may be abstract.  It's very convenient to be able to build
42           additional readers and that requires pos to be non-abstract. *)
43        type pos = Position.int
44        val compare = Position.compare
45    );
46