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 1715 - (download) (annotate)
Wed Nov 24 20:27:30 2004 UTC (15 years, 4 months ago) by mblume
File size: 706 byte(s)
support for 64-bit Position.int (not enabled by default)
(*
 * 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 * Position.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