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/compiler/Basics/print/printcontrol.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/Basics/print/printcontrol.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1126 - (view) (download)

1 : blume 902 (* printcontrol.sml
2 :     *
3 :     * (C) 2001 Lucent Technologies, Bell Labs
4 :     *)
5 :     signature PRINTCONTROL = sig
6 :     val printDepth : int ref
7 :     val printLength : int ref
8 :     val stringDepth : int ref
9 :     val printLoop : bool ref
10 :     val signatures : int ref
11 :     val printOpens : bool ref
12 :     val out : {say : string -> unit, flush : unit -> unit} ref
13 :     val linewidth : int ref
14 :     val say : string -> unit
15 :     val flush: unit -> unit
16 :     end
17 :    
18 :     structure Control_Print : PRINTCONTROL = struct
19 : blume 1126
20 :     val m = Controls.module { name = "compiler print settings",
21 :     priority = [10, 10, 2],
22 :     obscurity = 2,
23 :     prefix = "print-",
24 :     default_suffix = SOME "-default",
25 :     mk_ename = NONE }
26 :    
27 :     val flag_r = Controls.registry m Controls.bool
28 :    
29 :     val int_r = Controls.registry m Controls.int
30 :    
31 :     fun new (r, s, d, f) =
32 :     Controls.new_ref r { stem = s, descr = d, fallback = f }
33 :    
34 :     val printDepth = new (int_r, "depth", "max print depth", 5)
35 :     val printLength = new (int_r, "length", "max print length", 12)
36 :     val stringDepth = new (int_r, "string-depth", "max string print depth", 70)
37 :     val printLoop =
38 :     new (flag_r, "loop", "print loop", true) (* ? *)
39 :     val signatures =
40 :     new (int_r, "signatures", "max signature expansion depth", 2) (* ? *)
41 :     val printOpens = new (flag_r, "opens", "print `open'", true)
42 : blume 902 val out = ref{
43 :     say = fn s => TextIO.output(TextIO.stdOut,s),
44 :     flush = fn () => TextIO.flushOut TextIO.stdOut
45 :     }
46 : blume 1126 val linewidth = new (int_r, "linewidth",
47 :     "line-width hint for pretty printer", 79)
48 : blume 902 fun say s = #say (!out) s
49 :     fun flush() = #flush (!out) ()
50 :     end

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