| 1 | (* Copyright (C) 2009 Matthew Fluet. |
| 2 | * Copyright (C) 2004-2007 Henry Cejtin, Matthew Fluet, Suresh |
| 3 | * Jagannathan, and Stephen Weeks. |
| 4 | * |
| 5 | * MLton is released under a BSD-style license. |
| 6 | * See the file MLton-LICENSE for details. |
| 7 | *) |
| 8 | |
| 9 | functor ProfileLabel (S: PROFILE_LABEL_STRUCTS): PROFILE_LABEL = |
| 10 | struct |
| 11 | open S |
| 12 | |
| 13 | datatype t = T of {plist: PropertyList.t, |
| 14 | uniq: int} |
| 15 | |
| 16 | local |
| 17 | fun make f (T r) = f r |
| 18 | in |
| 19 | val plist = make #plist |
| 20 | end |
| 21 | |
| 22 | local |
| 23 | val c = Counter.new 0 |
| 24 | in |
| 25 | fun new () = T {plist = PropertyList.new (), |
| 26 | uniq = Counter.next c} |
| 27 | end |
| 28 | |
| 29 | fun toString (T {uniq, ...}) = |
| 30 | concat ["MLtonProfile", Int.toString uniq] |
| 31 | |
| 32 | val layout = Layout.str o toString |
| 33 | |
| 34 | val clear = PropertyList.clear o plist |
| 35 | end |