Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/cm/util/seek.sml
ViewVC logotype

View of /sml/trunk/src/cm/util/seek.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 295 - (download) (annotate)
Wed May 26 09:20:25 1999 UTC (20 years, 6 months ago) by blume
File size: 697 byte(s)
most of recompilation/execution machinery in place
(*
 * Seek in an instream.
 *
 * (C) 1999 Lucent Technologies, Bell Laboratories
 *
 * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
 *)
signature SEEK = sig

    exception UnableToSeek

    val seek : BinIO.instream * int -> unit
end

structure Seek :> SEEK = struct

    exception UnableToSeek

    val emptyVector = Word8Vector.fromList []
    
    fun seek (s, pos) = let
	val fs = BinIO.getInstream s
	val (r, _) = BinIO.StreamIO.getReader fs
	val BinPrimIO.RD { setPos, ... } = r
    in
	case setPos of
	    NONE => raise UnableToSeek
	  | SOME sp => let
		val _ = sp pos
		val fs' = BinIO.StreamIO.mkInstream (r, emptyVector)
	    in
		BinIO.setInstream (s, fs')
	    end
    end
end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0