


## prettyprint-stream.api
## All rights reserved.
# Compiled by:
# src/lib/prettyprint/big/src/prettyprinting.sublib# This interface provides an output stream interface to pretty printing.
#
# A typical use protocol looks like so:
#
# prettyprint_device
# =
# { consumer => (fn string = file::write (file::stdout, string)),
# linewidth => 2000, # Arbitrary large number.
# flush => .{ file::flush file::stdout; }
# };
#
# prettyprint_stream
# =
# prettyprint::open_stream prettyprint_device;
#
#
# unparse_package_language::unparse_api
# prettyprint_stream
# (a, symbolmapstack, /* max prettyprint recursion depth: */ 200);
#
# prettyprint::flush_stream prettyprint_stream;
#
# Above example cribbed from: src/app/makelib/main/makelib-g.pkgapi Prettyprint_Stream {
Device;
Stream;
Token;
# Tokens are an abstraction of strings (allowing for different
# widths and style information).
Style;
Indent = BOX_RELATIVE Int # Indent relative to outer indentation
| CURSOR_RELATIVE Int; # Indent relative to start of box
open_stream: Device -> Stream;
get_device: Stream -> Device;
flush_stream: Stream -> Void;
close_stream: Stream -> Void;
begin_horizontal_box: Stream -> Void;
begin_vertical_box: Stream -> Void;
begin_horizontal_else_vertical_box: Stream -> Void;
begin_wrap_box: Stream -> Void;
begin_wrap'_box: Stream -> Void;
end_box: Stream -> Void;
begin_indented_vertical_box: Stream -> Indent -> Void;
begin_indented_horizontal_else_vertical_box: Stream -> Indent -> Void;
begin_indented_wrap_box: Stream -> Indent -> Void;
begin_indented_wrap'_box: Stream -> Indent -> Void;
horizontal_box: Stream -> (Void -> Void) -> Void;
vertical_box: Stream -> (Void -> Void) -> Void;
horizontal_else_vertical_box: Stream -> (Void -> Void) -> Void;
wrap_box: Stream -> (Void -> Void) -> Void;
wrap'_box: Stream -> (Void -> Void) -> Void;
token: Stream -> Token -> Void;
string: Stream -> String -> Void;
push_style: ((Stream, Style)) -> Void;
pop_style: Stream -> Void;
break: Stream -> { spaces: Int, indent_on_wrap: Int } -> Void;
space: Stream -> Int -> Void; # space n == break { spaces=n, indent_on_wrap=0 }
cut: Stream -> Void; # Cut == break { spaces=0, indent_on_wrap=0 }
newline: Stream -> Void;
nonbreakable_spaces: Stream -> Int -> Void; # Emit a nonbreakable space
control: Stream -> (Device -> Void) -> Void;
};
## COPYRIGHT (c) 2005 John Reppy (http://www.cs.uchicago.edu/~jhr)
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


