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/src/pp-device-sig.sml
ViewVC logotype

View of /smlnj-lib/branches/rt-transition/PP/src/pp-device-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2980 - (download) (annotate)
Sat Apr 12 15:01:15 2008 UTC (11 years, 2 months ago) by jhr
File size: 1586 byte(s)
  Create branch of SML/NJ Library to work around missing APIs.
(* pp-device-sig.sml
 *
 * COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
 *
 * A pretty-printer device is an abstraction of an output stream.
 *)

signature PP_DEVICE =
  sig
    type device
	(* a device is an abstraction of an output stream. *)

    type style
	(* an abstraction of font and color information.  A device keeps a stack
	 * of styles, with the top of stack being the "current" style.
	 * Implementers of this signature should extend it with functions for
	 * creating style values.
	 *)

    val sameStyle : (style * style) -> bool
	(* are two styles the same? *)

    val pushStyle : (device * style) -> unit
    val popStyle  : device -> unit
	(* push/pop a style from the devices style stack.  A pop on an
	 * empty style stack is a nop.
	 *)
 
    val defaultStyle : device -> style
	(* the default style for the device (this is the current style,
	 * if the style stack is empty).
	 *)

    val depth : device -> int option
	(* maximum printing depth (in terms of boxes) *)
    val lineWidth : device -> int option
	(* the width of the device *)
    val textWidth : device -> int option
	(* the suggested maximum width of text on a line *)

    val space : (device * int) -> unit
	(* output some number of spaces to the device *)

    val newline : device -> unit
	(* output a new-line to the device *)

    val string : (device * string) -> unit
    val char : (device * char) -> unit
	(* output a string/character in the current style to the device *)

    val flush : device -> unit
	(* if the device is buffered, then flush any buffered output *)

  end;


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