| 1 |
4 |
tbourke |
(* $Id: typeddotio.sml 63 2008-08-22 06:26:33Z tbourke $
|
| 2 |
62 |
tbourke |
*
|
| 3 |
|
|
* Copyright (c) 2008 Timothy Bourke (University of NSW and NICTA)
|
| 4 |
|
|
* All rights reserved.
|
| 5 |
|
|
*
|
| 6 |
|
|
* This program is free software; you can redistribute it and/or modify it
|
| 7 |
|
|
* under the terms of the "BSD License" which is distributed with the
|
| 8 |
|
|
* software in the file LICENSE.
|
| 9 |
|
|
*
|
| 10 |
|
|
* This program is distributed in the hope that it will be useful, but
|
| 11 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD
|
| 13 |
|
|
* License for more details.
|
| 14 |
|
|
*
|
| 15 |
63 |
tbourke |
* Tie the various PP and DotPP functors together to write TypedDot graphs
|
| 16 |
|
|
* to TextIO outstreams.
|
| 17 |
4 |
tbourke |
*)
|
| 18 |
|
|
|
| 19 |
|
|
structure TypedDotIO :
|
| 20 |
|
|
sig
|
| 21 |
|
|
val output : TextIO.outstream * TypedDot.graph -> unit
|
| 22 |
|
|
end
|
| 23 |
|
|
=
|
| 24 |
|
|
struct
|
| 25 |
|
|
structure PPStrm = PPStreamFn (structure Token = StringToken
|
| 26 |
|
|
and Device = SimpleTextIODev)
|
| 27 |
|
|
structure TypedDotPP = DotPPFn (structure PPStream = PPStrm and Dot = TypedDot)
|
| 28 |
|
|
|
| 29 |
|
|
fun output (ostrm, graph) = let
|
| 30 |
|
|
val dev = SimpleTextIODev.openDev {dst=ostrm, wid=78}
|
| 31 |
|
|
val ppstrm = PPStrm.openStream dev
|
| 32 |
|
|
in
|
| 33 |
|
|
TypedDotPP.output (ppstrm, graph);
|
| 34 |
|
|
PPStrm.closeStream ppstrm
|
| 35 |
|
|
end
|
| 36 |
|
|
end
|
| 37 |
|
|
|