BinIO, webpage :)

ANOQ of the Sun anoq@hardcoreprocessing.com
Mon, 15 Nov 1999 10:11:28 -0800


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01BF2F94.93B4772A
Content-Type: text/plain;
	charset="windows-1252"

Hello!


Here's BinIO... it was just some simple cut & (a little) paste
(compared to TextIO) that I did. And as for Windows,
I assume it works except that when linking, the compiler
complains about undefined references to:
S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH.

So I guess that removing the last 4 flags in this line
will do:

in flags[irusr, iwusr, irgrp, iwgrp, iroth, iwoth]

But I haven't tried it yet... because how do I
recompile the basis-lib without recompiling/reinstalling
the compiler?

I have reinstalled and recompiled my Win32 version of MLTon
and while doing this I have written up a document about how
to make MLTon crosscompile:
http://www.HardcoreProcessing.com/Freeware/MLTonWin32.html

The presentation is still a little rough and I've not linked
to the document from the rest of the site yet, but that's
the official guide :)

But now I would like to avoid recompiling it all again
just for 4 flags :)


Cheers
-- 
http://www.HardcoreProcessing.com


------_=_NextPart_000_01BF2F94.93B4772A
Content-Type: text/plain;
	name="build-basis"
Content-Disposition: attachment;
	filename="build-basis"

misc/primitive.sml
top-level/infixes.sml
misc/basic.sml
general/general.sig
general/general.sml
misc/util.sml
general/option.sig
general/option.sml
list/list.sig
list/list.sml
list/list-pair.sig
list/list-pair.sml
arrays-and-vectors/sequence.sig
arrays-and-vectors/sequence.fun
arrays-and-vectors/vector.sig
arrays-and-vectors/vector.sml
arrays-and-vectors/array.sig
arrays-and-vectors/array.sml
arrays-and-vectors/array2.sig
arrays-and-vectors/array2.sml
text/string0.sml
text/char0.sml
misc/reader.sig
misc/reader.sml
text/string-cvt.sig
text/string-cvt.sml
general/bool.sig
general/bool.sml
integer/integer.sig
integer/integer.fun
integer/int32.sml
# integer/int31.sml
text/char.sig
text/char.sml
text/string.sig
text/string.sml
misc/C.sig
misc/C.sml
text/substring.sig
text/substring.sml
integer/word.sig
integer/word.fun
integer/word32.sml
integer/word8.sml
integer/int-inf.sig
integer/int-inf.sml
integer/patch.sml
real/IEEE-real.sig
real/IEEE-real.sml
real/math.sig
real/real.sig
real/real.sml

top-level/overloads.sml

arrays-and-vectors/mono-vector.sig
arrays-and-vectors/mono-vector.sml
arrays-and-vectors/mono-array.sig
arrays-and-vectors/mono-array.sml
arrays-and-vectors/mono-array2.sig
arrays-and-vectors/mono-array2.sml
integer/pack-word.sig
integer/pack32.sml
text/byte.sig
text/byte.sml

misc/unique-id.sig
misc/unique-id.fun
misc/cleaner.sig
misc/cleaner.fun

system/primitive.sml
system/time.sig
system/time.sml
system/date.sig
system/date.sml

posix/primitive.sml
posix/error.sig
posix/error.sml
posix/flags.sig
posix/flags.sml
posix/signal.sig
posix/signal.sml
posix/process.sig
posix/process.sml
posix/proc-env.sig
posix/proc-env.sml
posix/file-sys.sig
posix/file-sys.sml
posix/io.sig
posix/io.sml
posix/sys-db.sig
posix/sys-db.sml
posix/tty.sig
posix/tty.sml
posix/posix.sig
posix/posix.sml

system/path.sig
system/path.sml
system/file-sys.sig
system/file-sys.sml
system/process.sig
system/process.sml
system/io.sig
system/io.sml
system/os.sig
system/os.sml

io/io.sig
io/io.sml
io/stream-io.sig
io/text-stream-io.sig
io/text-io.sig
io/text-io.sml
io/bin-io.sig
io/bin-io.sml

system/command-line.sig
system/command-line.sml

general/sml90.sig
general/sml90.sml

mlton/signals.sig
mlton/signals.sml
mlton/callcc.fun
mlton/mlton.sig
mlton/mlton.sml

system/unix.sig
system/unix.sml
system/timer.sig
system/timer.sml

sml-nj/sml-nj.sig
sml-nj/sml-nj.sml
sml-nj/unsafe-array.sig
sml-nj/unsafe-mono-array.sig
sml-nj/unsafe-mono-array.fun
sml-nj/unsafe-vector.sig
sml-nj/unsafe-mono-vector.sig
sml-nj/unsafe-mono-vector.fun
sml-nj/unsafe.sig
sml-nj/unsafe.sml

------_=_NextPart_000_01BF2F94.93B4772A
Content-Type: application/x-unknown-content-type-sml_auto_file;
	name="top-level.sml"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="top-level.sml"

(* Copyright (C) 1997-1999 NEC Research Institute.
 * Please see the file LICENSE for license information.
 *)
signature ARRAY =3D ARRAY
signature ARRAY2 =3D ARRAY2
signature BOOL =3D BOOL
signature BYTE =3D BYTE
signature CHAR =3D CHAR
signature COMMAND_LINE =3D COMMAND_LINE
signature DATE =3D DATE
signature GENERAL =3D GENERAL
signature IEEE_REAL =3D IEEE_REAL
signature INTEGER =3D INTEGER
signature INT_INF =3D INT_INF
signature IO =3D IO
signature LIST =3D LIST
signature LIST_PAIR =3D LIST_PAIR
signature MATH =3D MATH
signature MONO_ARRAY =3D MONO_ARRAY
signature MONO_ARRAY2 =3D MONO_ARRAY2
signature MONO_VECTOR =3D MONO_VECTOR
signature OPTION =3D OPTION
signature OS =3D OS
signature PACK_WORD =3D PACK_WORD
signature POSIX =3D POSIX
signature POSIX_ERROR =3D POSIX_ERROR
signature POSIX_SIGNAL =3D POSIX_SIGNAL
signature POSIX_PROCESS =3D POSIX_PROCESS
signature POSIX_PROC_ENV =3D POSIX_PROC_ENV
signature POSIX_FILESYS =3D POSIX_FILESYS
signature POSIX_IO =3D POSIX_IO
signature POSIX_SYS_DB =3D POSIX_SYS_DB
signature POSIX_TTY =3D POSIX_TTY
signature REAL =3D REAL
signature SML90 =3D SML90
signature STRING =3D STRING
signature STRING_CVT =3D STRING_CVT
signature SUBSTRING =3D SUBSTRING
signature TEXT_IO =3D TEXT_IO
signature BIN_IO =3D BIN_IO
signature TIME =3D TIME
signature UNIX =3D UNIX
signature VECTOR =3D VECTOR
signature WORD =3D WORD
  =20
structure Array: ARRAY =3D Array
structure Array2: ARRAY2 =3D Array2
structure Bool: BOOL =3D Bool
structure BoolArray: MONO_ARRAY =3D BoolArray
structure BoolArray2: MONO_ARRAY2 =3D BoolArray2
structure BoolVector: MONO_VECTOR =3D BoolVector
structure Byte: BYTE =3D Byte
structure Char: CHAR =3D Char
structure CharArray: MONO_ARRAY =3D CharArray
structure CharArray2: MONO_ARRAY2 =3D CharArray2
structure CharVector: MONO_VECTOR =3D CharVector
structure CommandLine: COMMAND_LINE =3D CommandLine
structure Date: DATE =3D Date
structure General: GENERAL =3D General
structure IEEEReal: IEEE_REAL =3D IEEEReal
structure Int: INTEGER =3D Int
structure Int32: INTEGER =3D Int32
structure IntArray: MONO_ARRAY =3D IntArray
structure IntArray2: MONO_ARRAY2 =3D IntArray2
structure IntVector: MONO_VECTOR =3D IntVector
structure IntInf: INT_INF =3D IntInf
structure IO: IO =3D IO
(* Add the : INTEGER constraint as soon as div and mod are implemented
 * in LargeInt
 *)
structure LargeInt(*: INTEGER *) =3D LargeInt
structure LargeReal: REAL =3D LargeReal
structure LargeWord: WORD =3D Word
structure List: LIST =3D List
structure ListPair: LIST_PAIR =3D ListPair
structure Math: MATH =3D Real.Math
structure Option: OPTION =3D Option
structure OS: OS =3D OS
structure Pack32Big: PACK_WORD =3D Pack32Big
structure Pack32Little: PACK_WORD =3D Pack32Little
structure Posix: POSIX =3D Posix
structure Real: REAL =3D Real
structure RealArray: MONO_ARRAY =3D RealArray
structure Real64Array: MONO_ARRAY =3D RealArray
structure RealArray2: MONO_ARRAY2 =3D RealArray2
structure RealVector: MONO_VECTOR =3D RealVector
structure SML90:> SML90 =3D SML90
structure String: STRING =3D String
structure StringCvt: STRING_CVT =3D StringCvt
structure Substring: SUBSTRING =3D Substring
structure SysWord: WORD =3D SysWord
structure TextIO:> TEXT_IO =3D TextIO
structure BinIO:> BIN_IO =3D BinIO
structure Time: TIME =3D Time
structure Unix: UNIX =3D Unix
structure Vector: VECTOR =3D Vector
structure Word: WORD =3D Word
structure Word8: WORD =3D Word8
structure Word8Array: MONO_ARRAY =3D Word8Array
structure Word8Array2: MONO_ARRAY2 =3D Word8Array2
structure Word8Vector: MONO_VECTOR =3D Word8Vector
structure Word32: WORD =3D Word32

open ArrayGlobal BoolGlobal CharGlobal IntGlobal GeneralGlobal =
ListGlobal
   OptionGlobal RealGlobal StringGlobal SubstringGlobal TextIOGlobal =
VectorGlobal
   WordGlobal

local
   structure Top: sig
		     val real: int -> real
		     val <> : ''a * ''a -> bool
		     val vector: 'a list -> 'a vector
		  end =3D
		  struct
		     val real =3D real
		     val op <> =3D op <>
		     val vector =3D vector
		  end
in
   open Top
end

datatype ref =3D datatype ref

(*------------------------------------*)
(*            nonstandard             *)
(*------------------------------------*)

signature MLTON =3D MLTON
structure MLton: MLTON =3D MLton

signature SML_OF_NJ =3D SML_OF_NJ
structure SMLofNJ: SML_OF_NJ =3D SMLofNJ

structure Unsafe: UNSAFE =3D Unsafe
structure Timer =3D Timer

------_=_NextPart_000_01BF2F94.93B4772A
Content-Type: application/x-unknown-content-type-sig_auto_file;
	name="bin-io.sig"
Content-Disposition: attachment;
	filename="bin-io.sig"

(*signature TEXT_IO_GLOBAL =
   sig
      val print: string -> unit
   end*)

signature BIN_IO =
   sig
      (*include TEXT_IO_GLOBAL*)
	 
      structure StreamIO: STREAM_IO

      type vector (* = StreamIO.vector *)
      type elem (* = StreamIO.elem *)

      type instream
      val openIn: string -> instream 
      val closeIn: instream -> unit 
      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 endOfStream: instream -> bool
      val lookahead: instream -> elem option

      type outstream
      val openOut: string -> outstream 
      val openAppend: string -> outstream 
      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 mkOutstream: StreamIO.outstream -> outstream
      val getOutstream: outstream -> StreamIO.outstream
      val setOutstream: outstream * StreamIO.outstream -> unit
   end
(*
signature TEXT_IO_EXTRA =
   sig
      include TEXT_IO

      val newIn: Posix.FileSys.file_desc -> instream
      val newOut: Posix.FileSys.file_desc -> outstream
   end
   
*)
------_=_NextPart_000_01BF2F94.93B4772A
Content-Type: application/x-unknown-content-type-sml_auto_file;
	name="bin-io.sml"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="bin-io.sml"

(* Copyright (C) 1997-1999 NEC Research Institute.
 * Please see the file LICENSE for license information.
 *)
structure BinIO: BIN_IO =3D
   struct
      structure FS =3D Posix.FileSys
      structure PIO =3D Posix.IO
	=20
      structure Array =3D Word8Array
      structure Vector =3D Word8Vector
	=20
      type vector =3D Vector.vector
      type elem =3D Vector.elem

      val bufSize =3D 4096

      (*---------------------------------------------------*)
      (*                     outstream                     *)
      (*---------------------------------------------------*)

      datatype buf =3D
	 Buf of {size: int ref,
		 array: Array.array}

      fun isFull(Buf{size, ...}) =3D !size =3D bufSize

      (* write out to fd size bytes of buf starting at index i *)
      fun flushGen(fd: FS.file_desc,
		   buf: 'a,
		   i: int,
		   size: int,
		   write: FS.file_desc * {buf: 'a,
					   i: int,
					   sz: int option} -> int): unit =3D
	 let
	    val max =3D i + size
	    fun loop i =3D
	       if i =3D max
		  then ()
	       else
		  loop(i + write(fd, {buf =3D buf,
				      i =3D i,
				      sz =3D SOME(max - i)}))
	 in loop i
	 end

      fun flush(fd, Buf{size, array}) =3D
	 (flushGen(fd, array, 0, !size, PIO.writeArr)
	  ; size :=3D 0)
	=20
      datatype bufStyle =3D
	 Unbuffered
       | Line of buf
       | Buffered of buf
	=20
      datatype outstream' =3D
	 Out of {fd: FS.file_desc,
		 closed: bool ref,
		 bufStyle: bufStyle}
      type outstream =3D outstream' ref

      val mkOutstream =3D ref
      val getOutstream =3D !
      val setOutstream =3D op :=3D
	=20
      fun flushOut(ref(Out{fd, bufStyle, closed, ...})): unit =3D
	 (case (!closed, bufStyle) of
	     (true, _) =3D> ()
	   | (_,    Unbuffered) =3D> ()
	   | (_,    Line b) =3D> flush(fd, b)
	   | (_,    Buffered b) =3D> flush(fd, b))
	 handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				   function =3D "flushOut",
				   cause =3D exn}

      val openOuts: outstream list ref =3D ref []

      fun closeOut(out as ref(Out{fd, closed, ...})): unit =3D
	 if !closed then ()
	 else (flushOut out;
	       closed :=3D true;
	       PIO.close fd;
	       openOuts :=3D List.filter (fn out' =3D> not(out =3D out')) =
(!openOuts))

      val newOut =3D
	 ((* These side-effect is here so that the dead code elimination won't
	   * get rid of it as long as newOut is used
	   *)
	  AtSaveWorld.addNewCleaner(fn () =3D> List.app flushOut (!openOuts));
	  AtExit.addNewCleaner
	  (fn () =3D>
	   List.app
	   (fn out as ref(Out{fd,...}) =3D>
	    (flushOut out;
	     if fd =3D FS.stdout orelse fd =3D FS.stderr
		then ()
	     else closeOut out))
	   (!openOuts));
	  (* end stupidity *)
	  fn fd =3D>
	  let
	     val bufStyle =3D
		if fd =3D FS.stderr
		   then Unbuffered
		else (if Posix.ProcEnv.isatty fd then Line else Buffered)
		   (Buf{size =3D ref 0,
			array =3D Array.array(bufSize, 0w0)})
	     val out =3D ref(Out{fd =3D fd,
			       closed =3D ref false,
			       bufStyle =3D bufStyle})
	  in openOuts :=3D out :: !openOuts;
	     out
	  end)

      local
	 val readWrite =3D
	    let open FS.S
	    in flags[irusr, iwusr, irgrp, iwgrp, iroth, iwoth]
	    end
      in
	 fun openOut path =3D
	    (newOut(FS.creat(path, readWrite)))
	    handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				      function =3D "openOut",
				      cause =3D exn}
	      =20
	 fun openAppend path =3D
	    (newOut(FS.createf(path, FS.O_WRONLY, FS.O.append, readWrite)))
	    handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				      function =3D "openAppend",
				      cause =3D exn}
      end
     =20
      fun output(out as ref(Out{fd, closed, bufStyle, ...}), v): unit =
=3D
	 let
	 in if !closed
	       then raise IO.Io{name =3D "<unimplemented>",
				function =3D "output1",
				cause =3D IO.ClosedStream}
	    else
	       let
		  val vecSize =3D Vector.length v
		  fun store(b as Buf{size, array}) =3D
		     let
			val curSize =3D !size
			val newSize =3D vecSize + curSize
		     in
			if newSize > bufSize
			   then
			      let
				 (* flush the current buffer + a prefix of the
				  * vector, if the current buffer is empty
				  *)
				 val veci =3D
				    if curSize =3D 0
				       then 0
				    else
				       let val fill =3D bufSize - curSize
				       in Array.copyVec{src =3D v,
							si =3D 0,
							len =3D SOME fill,
							dst =3D array,
							di =3D curSize} ;
					  size :=3D bufSize ;
					  flush(fd, b) ;
					  fill
				       end
				 (* flush out as much of the vector as needed
				  * so that <=3D bufSize remains
				  *)
				 fun loop i =3D
				    let val remaining =3D vecSize - i
				    in if remaining <=3D bufSize
					  then
					     (Array.copyVec{src =3D v,
							    si =3D i,
							    len =3D SOME remaining,
							    dst =3D array,
							    di =3D 0} ;
					      size :=3D remaining)
				       else
					  (flushGen(fd, v, i, bufSize, PIO.writeVec);
					   loop(i + bufSize))
				    end
			      in loop veci
			      end
			else (Array.copyVec{src =3D v, si =3D 0, len =3D NONE,
					    dst =3D array, di =3D curSize} ;
			      size :=3D newSize)
		     end
	       in case bufStyle of
		  Unbuffered =3D> flushGen(fd, v, 0, vecSize, PIO.writeVec)
		| Line b =3D> (store b)
		| Buffered b =3D> store b
	       end handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
					     function =3D "output1",
					     cause =3D exn}
	 end
     =20
      fun output1(out, c: elem): unit =3D output(out, str c)
	   =20
      (*---------------------------------------------------*)
      (*                     instream                      *)
      (*---------------------------------------------------*)

      datatype instream =3D
	 In of {fd: FS.file_desc,
		closed: bool ref,
		eof: bool ref,
		first: int ref, (* index of first character *)
		last: int ref,  (* one past the index of the last char *)
		buf: Array.array}

      fun newIn fd =3D In{fd =3D fd,
			eof =3D ref false,
			closed =3D ref false,
			first =3D ref 0,
			last =3D ref 0,
			buf =3D Array.array(bufSize, 0w0)}

      fun openIn path =3D
	 newIn(FS.openf(path, FS.O_RDONLY, FS.O.flags[]))
	 handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				   function =3D "openIn",
				   cause =3D exn}

      fun updateIn(In{fd, closed, eof, first, last, buf, ...}): unit =
=3D
	 if !closed
	    then raise IO.Io{name =3D "<unimplemented>",
			     function =3D "<unknown>",
			     cause =3D IO.ClosedStream}
	 else if !eof
		 then ()
	      else=20
		 if !first =3D !last
		    then (* need to read *)
		       let
			  val bytesRead =3D
			     PIO.readArr(fd, {buf =3D buf, i =3D 0, sz =3D NONE})
		       in if bytesRead =3D 0
			     then eof :=3D true
			  else (first :=3D 0; last :=3D bytesRead)
		       end
		 else ()

      val empty =3D ""
	=20
      fun input(ins as In{eof, buf, first, last, ...}): vector =3D
	 (updateIn ins
	  ; if !eof
	       then (eof :=3D false; empty)
	    else
	       (
		(Array.extract(buf, !first, SOME(!last - !first)))
		before first :=3D !last))
	 handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				   function =3D "input",
				   cause =3D exn}

      fun lookahead(ins as In{eof, buf, first, ...}): elem option =3D
	 (if !eof
	     then NONE
	  else (updateIn ins
		; if !eof
		     then NONE
		  else SOME((Array.sub(buf, !first)))))
	 handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				   function =3D "lookahead",
				   cause =3D exn}

      fun input1(ins as In{buf, first, ...}): elem option =3D
	 (case lookahead ins of
	     NONE =3D> NONE
	   | res as SOME _ =3D> (first :=3D 1 + !first;
			       res))
	 handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				   function =3D "input1",
				   cause =3D exn}

      fun inputN(ins as In{fd, eof, first, last, buf, ...},
		 bytesToRead: int): vector =3D
	 (if Int.geu(bytesToRead, Array.maxLen)
	     then raise Size
	  else
	     if !eof
		then (eof :=3D false; empty)
	     else
		let val size =3D !last - !first
		in if size >=3D bytesToRead
		      then (
			    (Array.extract(buf, !first, SOME bytesToRead))
			    before first :=3D bytesToRead + !first)
		   else
		      let val dst =3D Array.array(bytesToRead, 0w0)
			 val _ =3D
			    (Array.copy{src =3D buf, si =3D !first, len =3D SOME size,
					dst =3D dst, di =3D 0} ;
			     first :=3D !last)
			 fun loop(bytesRead: int): int =3D
			    if bytesRead =3D bytesToRead
			       then bytesRead
			    else let
				    val bytesRead' =3D
				       PIO.readArr
				       (fd, {buf =3D dst, i =3D bytesRead,
					     sz =3D SOME(bytesToRead - bytesRead)})
				 in if bytesRead' =3D 0
				       then (eof :=3D true ;
					     bytesRead)
				    else loop(bytesRead + bytesRead')
				 end
			 val bytesRead =3D loop size
		      in if bytesRead =3D bytesToRead
			    then
			         (Primitive.Vector.fromArray dst)
			 else (
			       (Array.extract(dst, 0, SOME bytesRead)))
		      end
		end)
	     handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				       function =3D "inputN",
				       cause =3D exn}

      fun inputAll(ins as In{fd, eof, first, last, buf, ...}) =3D
	 if !eof
	    then (eof :=3D false; empty)
	 else
	    (let val vs =3D [Array.extract(buf, !first, SOME(!last - !first))]
		 fun loop vs =3D
		    let val v =3D PIO.readVec(fd, bufSize)
		    in if Vector.length v =3D 0
			  then (Vector.concat(rev vs))
		       else loop(v :: vs)
		    end
	     in loop vs
	     end)
	    handle exn =3D> raise IO.Io{name =3D "<unimplemented>",
				      function =3D "inputN",
				      cause =3D exn}

      (* not entirely correct - really needs to do non blocking =
lookahead *)
      fun canInput(ins as In{eof, first, last, ...}, n) =3D
	 (updateIn ins
	  ; if !eof
	       then SOME 0
	    else SOME(Int.min(n, !last - !first)))

      fun closeIn(In{fd, closed, ...}) =3D
	 (PIO.close fd; closed :=3D true)
	   =20
      fun endOfStream(ins as In{eof, ...}) =3D
	 !eof orelse (updateIn ins; !eof)

      (* This is all just a hack so that I can emulate scanStream *)
      structure StreamIO =3D
	 struct
	    type outstream =3D outstream'

	    datatype state =3D
	       Uneval of instream
	     | Eval of (char * lazy) option
	    withtype lazy =3D state ref

	    type instream =3D lazy
(*
	    fun make ins =3D ref(Uneval ins)

	    fun input1' r =3D
	       case !r of
		  Eval v =3D> v
		| Uneval ins =3D> let val v =3D (case input1 ins of
						NONE =3D> NONE
					      | SOME c =3D> SOME(c, make ins))
				in r :=3D Eval v; v
				end
	    val input1 =3D input1'*)
	 end
(*
      fun scanStream f ins =3D
	 case f StreamIO.input1 (StreamIO.make ins) of
	    NONE =3D> NONE
	  | SOME(v, _) =3D> SOME v	*)
   end
(*
structure TextIOGlobal: TEXT_IO_GLOBAL =3D TextIO
open TextIO
*)
------_=_NextPart_000_01BF2F94.93B4772A--