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/smlnj-lib/PP/tests/base.sml
ViewVC logotype

Annotation of /sml/trunk/src/smlnj-lib/PP/tests/base.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 7 (* base.sml
2 :     *
3 :     * COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
4 :     *
5 :     * Some common code for testing.
6 :     *)
7 :    
8 :     CM.make(); (* to compile and load the PP library *)
9 :    
10 :     structure TextToken =
11 :     struct
12 :     type token = string
13 :     type style = unit
14 :     fun string t = t
15 :     fun style t = ()
16 :     fun size t = String.size t
17 :     end;
18 :    
19 :     structure PP = PPDebugFn(PPStreamFn(
20 :     structure Token = TextToken
21 :     structure Device = SimpleTextIODev));
22 :    
23 :     fun withPP (name, wid) ppFn = let
24 :     val saveStrm = !PP.debugStrm
25 :     val _ = PP.debugStrm := TextIO.openAppend("out")
26 :     val ppStrm =
27 :     PP.openStream(SimpleTextIODev.openDev{dst=TextIO.stdOut, wid=wid})
28 :     in
29 :     print(concat[name, ": width = ", Int.toString wid, "\n"]);
30 :     ppFn ppStrm;
31 :     PP.closeStream ppStrm;
32 :     print "\n";
33 :     TextIO.closeOut (!PP.debugStrm);
34 :     PP.debugStrm := saveStrm
35 :     end;
36 :    

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