@@ -24,7 +24,7 @@ end = struct
2424 datatype device =
2525 DEV of { filename: string,
2626 buffer : string list ref ,
27- wid : int }
27+ wid : int option ref }
2828
2929 (* no style support *)
3030 type style = unit
@@ -34,7 +34,7 @@ end = struct
3434 fun defaultStyle _ = ()
3535
3636 (* Allocate an empty buffer and remember the file name. *)
37- fun openOut (f, w) = DEV { filename = f, buffer = ref [], wid = w }
37+ fun openOut (f, w) = DEV { filename = f, buffer = ref [], wid = ref ( SOME w) }
3838
3939 (* Calculate the final output and compare it with the current
4040 * contents of the file. If they do not coincide, write the file. *)
@@ -55,20 +55,30 @@ end = struct
5555 end handle _ => write ()
5656 end
5757
58- (* maximum printing depth (in terms of boxes) *)
59- fun depth _ = NONE
58+ (* placeholders for the unsupported property functions *)
59+ fun maxDepth _ = NONE
60+ fun depth _ = NONE (* DEPRECATED *)
61+ fun setMaxDepth _ = ()
62+ fun ellipses _ = (" " , 0 )
63+ fun setEllipses _ = ()
64+ fun setEllipsesWithSz _ = ()
65+ fun maxIndent _ = NONE
66+ fun setMaxIndent _ = ()
67+ fun textWidth _ = NONE
68+ fun setTextWidth _ = ()
6069
6170 (* the width of the device *)
62- fun lineWidth (DEV{wid, ...}) = SOME wid
63- (* the suggested maximum width of text on a line *)
64- fun textWidth _ = NONE
71+ fun lineWidth (DEV{wid, ...}) = !wid
72+ fun setLineWidth (DEV{wid, ...}, w) = wid := w
6573
6674 (* output a string/character in the current style to the device *)
6775 fun string (DEV { buffer, ... }, s) = buffer := s :: !buffer
68-
69- fun char (d, c) = string (d, String.str c)
76+ (* output some number of spaces to the device *)
7077 fun space (d, n) = string (d, StringCvt.padLeft #" " n " " )
78+ val indent = space
79+ (* output a new-line to the device *)
7180 fun newline d = string (d, " \n " )
72-
81+ fun char (d, c) = string (d, String.str c)
82+ (* nothing to flush *)
7383 fun flush d = ()
7484end
0 commit comments