Home My Page Projects Code Snippets Project Openings SML/NJ
 Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

# SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/graphs/printgraph.sml
 [smlnj] / sml / trunk / src / MLRISC / graphs / printgraph.sml

# Annotation of /sml/trunk/src/MLRISC/graphs/printgraph.sml

Revision 411 - (view) (download)
Original Path: sml/branches/SMLNJ/src/MLRISC/graphs/printgraph.sml

 1 : monnier 245 (* 2 : * Print a graph 3 : monnier 411 * 4 : * -- Allen 5 : monnier 245 *) 6 : 7 : signature PRINT_GRAPH = 8 : sig 9 : 10 : val toString : ('n,'e,'g) Graph.graph -> string 11 : 12 : end 13 : 14 : structure PrintGraph : PRINT_GRAPH = 15 : struct 16 : 17 : structure G = Graph 18 : 19 : fun toString (G.GRAPH G) = 20 : let fun showEdges es = 21 : String.concat( 22 : map (fn (i,j,_) => Int.toString i^" -> "^Int.toString j^"\n") es) 23 : fun showNodes ns = 24 : String.concat(map (fn n => Int.toString n^" ") ns)^"\n" 25 : in 26 : #name G ^ "\n" ^ 27 : "nodes: "^showNodes(map #1 (#nodes G ()))^ 28 : "edges:\n"^showEdges(#edges G ())^ 29 : "entry edges:\n"^ 30 : showEdges(List.concat(map (#entry_edges G o #1) (#nodes G ())))^ 31 : "exit edges:\n"^ 32 : showEdges(List.concat(map (#exit_edges G o #1) (#nodes G ())))^ 33 : "entries: "^showNodes(#entries G ())^ 34 : "exits: "^showNodes(#exits G ()) 35 : end 36 : end 37 :

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