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 657 - (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 : leunga 657
14 :     val tmpName = MLRiscControl.getString "tmpName"
15 : monnier 245
16 :     fun display exec (layout as G.GRAPH l) filename =
17 :     let val filename = filename ^ D.suffix()
18 :     val _ = print("[ "^ #name l^": "^
19 : monnier 411 D.program() ^ " " ^ filename ^
20 :     " "^Int.toString(#order l ())^" nodes"^
21 :     " "^Int.toString(#size l ())^" edges");
22 : monnier 245 val file = TextIO.openOut filename
23 :     val out = fn s => TextIO.output(file,s)
24 :     val _ = D.visualize out layout
25 :     val _ = TextIO.closeOut file
26 : monnier 411 val _ = print(" ]\n")
27 : monnier 245 val _ = exec filename
28 :     in
29 :     ()
30 :     end handle e =>
31 :     (print("[Uncaught exception in "^exnName e^" graph viewer]\n"); raise e)
32 :    
33 :     fun system filename = (OS.Process.system
34 :     ((D.program()) ^ " " ^ filename);
35 :     FileSys.remove filename)
36 :    
37 : monnier 411 fun fork filename = (OS.Process.system(
38 :     "(" ^ (D.program()) ^ " " ^ filename ^
39 :     "; /bin/rm " ^ filename ^ ") &"))
40 :    
41 : leunga 657 fun getTmpName() =
42 :     if !tmpName = "" then FileSys.tmpName() else !tmpName
43 :    
44 :     fun view layout = display system layout (getTmpName())
45 : monnier 245 end
46 :    

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