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

SCM Repository

[smlnj] View of /smlnj-lib/branches/rt-transition/PP/tests/base.sml
ViewVC logotype

View of /smlnj-lib/branches/rt-transition/PP/tests/base.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4070 - (download) (annotate)
Thu Jun 11 12:33:25 2015 UTC (3 years, 11 months ago) by jhr
File size: 891 byte(s)
update to 110.78 version of SML/NJ Library
(* base.sml
 *
 * COPYRIGHT (c) 2013 The Fellowship of SML/NJ (http://www.smlnj.org)
 * All rights reserved.
 *
 * Some common code for testing.
 *)

CM.make "sources.cm"; (* to compile and load the PP library *)

structure TextToken =
  struct
    type token = string
    type style = unit
    fun string t = t
    fun style t = ()
    fun size t = String.size t
  end;

structure PP = PPDebugFn(PPStreamFn(
    structure Token = TextToken
    structure Device = SimpleTextIODev));

fun withPP (name, wid) ppFn = let
      val saveStrm = !PP.debugStrm
      val _ = PP.debugStrm := TextIO.openAppend("out")
      val ppStrm =
	    PP.openStream(SimpleTextIODev.openDev{dst=TextIO.stdOut, wid=wid})
      in
	print(concat[name, ": width = ", Int.toString wid, "\n"]);
	ppFn ppStrm;
	PP.closeStream ppStrm;
	print "\n";
	TextIO.closeOut (!PP.debugStrm);
	PP.debugStrm := saveStrm
      end;


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