| Standard ML Basis Library |
functor TextIOFn(structure OSPrimIO :
sig
include OS_PRIM_IO
val stdIn : unit -> PrimIO.reader
val stdOut : unit -> PrimIO.writer
val stdErr : unit -> PrimIO.writer
val strReader : string -> PrimIO.reader
end
where PrimIO = TextPrimIO) : TEXT_IO =
struct
structure PIO = OSPrimIO.PrimIO
structure A = CharArray
structure V = CharVector
structure AS = CharArraySlice
structure VS = CharVectorSlice
structure StreamIO =
struct
type vector = V.vector
type elem = V.elem
type reader = PIO.reader
type writer = PIO.writer
type pos = PIO.pos
datatype instream = ISTRM of in_buffer * int
datatype in_buffer =
IBUF of
{basePos : pos option, more : more ref, data : vector, info : info}
datatype more = MORE of in_buffer | EOS of in_buffer | NOMORE | TERMINATED
datatype info =
INFO of
{
reader : reader,
readVec : int -> vector,
readVecNB : (int -> vector) option,
closed : bool ref,
getPos : unit -> pos option,
tail : more ref ref,
cleanTag : CleanIO.tag
}
datatype outstream =
OSTRM of
{
buf : A.array,
pos : int ref,
closed : bool ref,
bufferMode : IO.buffer_mode ref,
writer : writer,
writeArr : {buf : A.array, i : int, sz : int option} -> unit,
writeVec : {buf : V.vector, i : int, sz : int option} -> unit,
cleanTag : CleanIO.tag
}
datatype out_pos = OUTP of {pos : PIO.pos, strm : outstream}
exception WouldBlock
val infoOfIBuf
val chunkSzOfIBuf
val readVec
val inputExn
val extendStream
val getBuffer
val readChunk
val generalizedInput
val terminate
val input : instream -> vector * instream
val input1 : instream -> (elem * instream) option
val inputN : instream * int -> vector * instream
val inputAll : instream -> vector * instream
val canInput : instream * int -> int option
val closeIn : instream -> unit
val endOfStream : instream -> bool
val mkInstream : reader * vector -> instream
val getReader : instream -> reader * vector
val filePosIn : instream -> pos
val inputLine : instream -> string * instream
val outputExn
val isNL
val isClosedOut
val flushBuffer
val lineBufCopyVec
val blockBufCopyVec
val output : outstream * vector -> unit
val output1 : outstream * elem -> unit
val flushOut : outstream -> unit
val closeOut : outstream -> unit
val mkOutstream : writer * IO.buffer_mode -> outstream
val getWriter : outstream -> writer * IO.buffer_mode
val getPosOut : outstream -> out_pos
val filePosOut : out_pos -> pos
val setPosOut : out_pos -> unit
val outputSubstr : outstream * substring -> unit
val setBufferMode : outstream * IO.buffer_mode -> unit
val getBufferMode : outstream -> IO.buffer_mode
end
type vector = V.vector
type elem = V.elem
type instream = StreamIO.instream ref
type outstream = StreamIO.outstream ref
val someElem
val vecExtract
val vecSub
val arrUpdate
val substringBase
val empty
val input : instream -> vector
val input1 : instream -> elem option
val inputN : instream * int -> vector
val inputAll : instream -> vector
val canInput : instream * int -> int option
val lookahead : instream -> elem option
val closeIn : instream -> unit
val endOfStream : instream -> bool
val output : outstream * vector -> unit
val output1 : outstream * elem -> unit
val flushOut : outstream -> unit
val closeOut : outstream -> unit
val getPosOut : outstream -> StreamIO.out_pos
val setPosOut : outstream * StreamIO.out_pos -> unit
val mkInstream : StreamIO.instream -> instream
val getInstream : instream -> StreamIO.instream
val setInstream : instream * StreamIO.instream -> unit
val mkOutstream : StreamIO.outstream -> outstream
val getOutstream : outstream -> StreamIO.outstream
val setOutstream : outstream * StreamIO.outstream -> unit
val bufferMode
val openIn : string -> instream
val openOut : string -> outstream
val openAppend : string -> outstream
val inputLine : instream -> string
val outputSubstr : outstream * substring -> unit
val openString : string -> instream
val stdIn : instream
val stdOut : outstream
val stdErr : outstream
val print : string -> unit
val scanStream
: ((elem, StreamIO.instream) StringCvt.reader ->
('a, StreamIO.instream) StringCvt.reader) ->
instream -> 'a option
end
Type detail |
---|
type vector = V.vector
type elem = V.elem
type instream = StreamIO.instream ref
type outstream = StreamIO.outstream ref
Value detail |
---|
val someElem
val vecExtract
val vecSub
val arrUpdate
val substringBase
val empty
val input : instream -> vector
val input1 : instream -> elem option
val inputN : instream * int -> vector
val inputAll : instream -> vector
val canInput : instream * int -> int option
val lookahead : instream -> elem option
val closeIn : instream -> unit
val endOfStream : instream -> bool
val output : outstream * vector -> unit
val output1 : outstream * elem -> unit
val flushOut : outstream -> unit
val closeOut : outstream -> unit
val getPosOut : outstream -> StreamIO.out_pos
val setPosOut : outstream * StreamIO.out_pos -> unit
val mkInstream : StreamIO.instream -> instream
val getInstream : instream -> StreamIO.instream
val setInstream : instream * StreamIO.instream -> unit
val mkOutstream : StreamIO.outstream -> outstream
val getOutstream : outstream -> StreamIO.outstream
val setOutstream : outstream * StreamIO.outstream -> unit
val bufferMode
val openIn : string -> instream
val openOut : string -> outstream
val openAppend : string -> outstream
val inputLine : instream -> string
val outputSubstr : outstream * substring -> unit
val openString : string -> instream
val stdIn : instream
val stdOut : outstream
val stdErr : outstream
val scanStream
: ((elem, StreamIO.instream) StringCvt.reader ->
('a, StreamIO.instream) StringCvt.reader) ->
instream -> 'a option
| Standard ML Basis Library |
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2003 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
University Press.
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America). |