SCM Repository
[smlnj] / MLRISC / trunk / graphs / snap-shot.sml |
View of /MLRISC/trunk/graphs/snap-shot.sml
Parent Directory | Revision Log
Revision 2126 -
(download)
(annotate)
Thu Nov 2 16:11:29 2006 UTC (12 years, 11 months ago) by blume
File size: 884 byte(s)
Thu Nov 2 16:11:29 2006 UTC (12 years, 11 months ago) by blume
File size: 884 byte(s)
moved MLRISC to toplevel
(* * This combinator allows you to get a cached copy of a graph. * * -- Allen *) signature GRAPH_SNAPSHOT = sig val snapshot : ('n,'e,'g) Graph.graph -> { picture : ('n,'e,'g) Graph.graph, button : unit -> unit } end (* * This is a naive implementation. *) functor GraphSnapShot(GI : GRAPH_IMPLEMENTATION) : GRAPH_SNAPSHOT = struct structure G = Graph fun snapshot (G.GRAPH G) = let val pict as G.GRAPH G' = GI.graph(#name G,#graph_info G,#capacity G ()) fun clear() = #forall_nodes G' (fn (n,_) => #remove_node G' n) fun copy() = (#forall_nodes G (#add_node G'); #forall_edges G (#add_edge G'); #set_entries G' (#entries G ()); #set_exits G' (#exits G ()) ) fun button() = (clear(); copy()) in copy(); { picture = pict, button = button } end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |