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/compiler/Semant/basics/persstamps.sml
ViewVC logotype

View of /sml/trunk/src/compiler/Semant/basics/persstamps.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 224 - (download) (annotate)
Sat Apr 17 16:27:01 1999 UTC (21 years, 3 months ago) by monnier
File size: 907 byte(s)
This commit was generated by cvs2svn to compensate for changes in r223,
which included commits to RCS files with non-trunk default branches.
(* Copyright 1992 by AT&T Bell Laboratories *)
(* persstamps.sml *)

(* 
 * DBM: was an abstraction, but persstamp needs to be an equality type 
 * so that conrep is. 
 *)

structure PersStamps : PERSSTAMPS =
struct
  datatype persstamp = PS of Word8Vector.vector

  fun compare (PS v1, PS v2) =
        String.compare(Byte.bytesToString v1, Byte.bytesToString v2)

  fun toBytes (PS x) = x

  fun fromBytes v = 
    if Word8Vector.length v = 16 then PS v
    else ErrorMsg.impossible "PersStamps.stringToStamp"

  (* convert the persstamp to a printable representation (hex digits) *)
  fun toHex (PS pid) = 
    let fun cvtByte b = StringCvt.padLeft #"0" 2 (Word8.toString b)
	fun f (b, l) = cvtByte b :: l
     in String.concat (Word8Vector.foldr f [] pid)
    end

end (* structure PersStamps *)



(*
 * $Log: persstamps.sml,v $
 * Revision 1.1.1.1  1998/04/08 18:39:34  george
 * Version 110.5
 *
 *)

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