1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 2004-2007 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
9 functor ObjptrTycon (S: OBJPTR_TYCON_STRUCTS): OBJPTR_TYCON =
14 datatype t = T of {index: int ref}
17 fun make f (T r) = f r
19 val index = ! o (make #index)
25 fun new () = T {index = ref (Counter.next c)}
28 fun setIndex (T {index = r}, i) = r := i
30 fun fromIndex i = T {index = ref i}
32 fun compare (opt, opt') = Int.compare (index opt, index opt')
34 fun equals (opt, opt') = index opt = index opt'
36 val op <= = fn (opt, opt') => index opt <= index opt'
38 fun toString (opt: t): string =
39 concat ["opt_", Int.toString (index opt)]
41 val layout = Layout.str o toString
48 val word8Vector = new ()
49 val word16Vector = new ()
50 val word32Vector = new ()
51 val word64Vector = new ()
53 fun wordVector (b: Bits.t): t =
59 | _ => Error.bug "ObjptrTycon.wordVector"