Overview  Index  Help 
Standard ML Basis Library

TextIOFn.StreamIO

Enclosing Modules:

TextIOFn


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 -> vectoroption,
             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 * instreamoption
  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 detail

vector

type vector = V.vector


elem

type elem = V.elem


reader

type reader = PIO.reader


writer

type writer = PIO.writer


pos

type pos = PIO.pos

 
Datatype detail

instream

datatype instream = ISTRM of in_buffer * int


in_buffer

datatype in_buffer =
         IBUF of
         {basePos : pos option, more : more ref, data : vector, info : info}


more

datatype more = MORE of in_buffer | EOS of in_buffer | NOMORE | TERMINATED


info

datatype info =
         INFO of
         {
           reader : reader,
           readVec : int -> vector,
           readVecNB : (int -> vectoroption,
           closed : bool ref,
           getPos : unit -> pos option,
           tail : more ref ref,
           cleanTag : CleanIO.tag
         }


outstream

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
         }


out_pos

datatype out_pos = OUTP of {pos : PIO.pos, strm : outstream}

Position operations on outstreams *

 
DataConstructor detail

ISTRM

constructor ISTRM : in_buffer * int -> instream


IBUF

constructor IBUF
            : {
                basePos : pos option,
                more : more ref,
                data : vector,
                info : info
              } ->
                in_buffer


MORE

constructor MORE : in_buffer -> more


EOS

constructor EOS : in_buffer -> more


NOMORE

constructor NOMORE : more


TERMINATED

constructor TERMINATED : more


INFO

constructor INFO
            : {
                reader : reader,
                readVec : int -> vector,
                readVecNB : (int -> vectoroption,
                closed : bool ref,
                getPos : unit -> pos option,
                tail : more ref ref,
                cleanTag : CleanIO.tag
              } ->
                info


OSTRM

constructor OSTRM
            : {
                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
              } ->
                outstream


OUTP

constructor OUTP : {pos : PIO.pos, strm : outstream} -> out_pos

 
Value detail

infoOfIBuf

val infoOfIBuf


chunkSzOfIBuf

val chunkSzOfIBuf


readVec

val readVec


inputExn

val inputExn


extendStream

val extendStream


getBuffer

val getBuffer


readChunk

val readChunk


generalizedInput

val generalizedInput


terminate

val terminate


input

val input : instream -> vector * instream


input1

val input1 : instream -> (elem * instreamoption


inputN

val inputN : instream * int -> vector * instream


inputAll

val inputAll : instream -> vector * instream


canInput

val canInput : instream * int -> int option


closeIn

val closeIn : instream -> unit


endOfStream

val endOfStream : instream -> bool


mkInstream

val mkInstream : reader * vector -> instream


getReader

val getReader : instream -> reader * vector


filePosIn

val filePosIn : instream -> pos


inputLine

val inputLine : instream -> string * instream

Text stream specific operations *


outputExn

val outputExn


isNL

val isNL


isClosedOut

val isClosedOut


flushBuffer

val flushBuffer


lineBufCopyVec

val lineBufCopyVec


blockBufCopyVec

val blockBufCopyVec


output

val output : outstream * vector -> unit


output1

val output1 : outstream * elem -> unit


flushOut

val flushOut : outstream -> unit


closeOut

val closeOut : outstream -> unit


mkOutstream

val mkOutstream : writer * IO.buffer_mode -> outstream


getWriter

val getWriter : outstream -> writer * IO.buffer_mode


getPosOut

val getPosOut : outstream -> out_pos


filePosOut

val filePosOut : out_pos -> pos


setPosOut

val setPosOut : out_pos -> unit


outputSubstr

val outputSubstr : outstream * substring -> unit

Text stream specific operations *


setBufferMode

val setBufferMode : outstream * IO.buffer_mode -> unit


getBufferMode

val getBufferMode : outstream -> IO.buffer_mode

 
Exception detail

WouldBlock

exception WouldBlock


Overview  Index  Help 
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).