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/visualization/graphViewer.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/visualization/graphViewer.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 411 (*
2 :     * This module starts a graph viewer.
3 :     *
4 :     * -- Allen
5 :     *)
6 :    
7 : george 545 functor GraphViewer(D : GRAPH_DISPLAY) : GRAPH_VIEWER =
8 : monnier 245 struct
9 :    
10 :     structure L = GraphLayout
11 :     structure G = Graph
12 :     structure FileSys = OS.FileSys
13 :    
14 :     fun display exec (layout as G.GRAPH l) filename =
15 :     let val filename = filename ^ D.suffix()
16 :     val _ = print("[ "^ #name l^": "^
17 : monnier 411 D.program() ^ " " ^ filename ^
18 :     " "^Int.toString(#order l ())^" nodes"^
19 :     " "^Int.toString(#size l ())^" edges");
20 : monnier 245 val file = TextIO.openOut filename
21 :     val out = fn s => TextIO.output(file,s)
22 :     val _ = D.visualize out layout
23 :     val _ = TextIO.closeOut file
24 : monnier 411 val _ = print(" ]\n")
25 : monnier 245 val _ = exec filename
26 :     in
27 :     ()
28 :     end handle e =>
29 :     (print("[Uncaught exception in "^exnName e^" graph viewer]\n"); raise e)
30 :    
31 :     fun system filename = (OS.Process.system
32 :     ((D.program()) ^ " " ^ filename);
33 :     FileSys.remove filename)
34 :    
35 : monnier 411 fun fork filename = (OS.Process.system(
36 :     "(" ^ (D.program()) ^ " " ^ filename ^
37 :     "; /bin/rm " ^ filename ^ ") &"))
38 :    
39 : monnier 245 fun view layout = display system layout (FileSys.tmpName())
40 :     end
41 :    

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