


## simple-textio-dev.pkg
## A simple (no styles) pretty-printing device for output to file outstreams.
# Compiled by:
# src/lib/prettyprint/big/devices/prettyprint-devices.sublib### "Teach us delight in simple things,
### and mirth that has no bitter springs."
###
### -- Rudyard Kipling
stipulate
package fil = file__premicrothread; # file__premicrothread is from src/lib/std/src/posix/file--premicrothread.pkgherein
package simple_text_io_device: (weak)
api {
include Prettyprint_Device; # Prettyprint_Device is from src/lib/prettyprint/big/src/prettyprint-device.api open_device: { dst: fil::Output_Stream,
wid: Int
} -> Device;
}
{
Device = DEV {
dst: fil::Output_Stream,
wid: Int
};
Style = Void; # No style support
fun same_style _ = TRUE;
fun push_style _ = ();
fun pop_style _ = ();
fun default_style _ = ();
open_device = DEV;
fun depth _ = NULL; # Maximum printing depth (in terms of boxes)
# The width of the device
#
fun line_width (DEV { wid, ... } ) = THE wid;
fun text_width _ = NULL; # The suggested maximum width of text on a line.
fun space (DEV { dst, ... }, n) # Output some number of spaces to the device.
=
fil::write (dst, number_string::pad_left ' ' n "");
fun newline (DEV { dst, ... } ) # Output a newline to the device.
=
fil::write_one (dst, '\n');
fun string (DEV { dst, ... }, s) = fil::write (dst, s); # Output a string in the current style to the device:
fun char (DEV { dst, ... }, c) = fil::write_one (dst, c); # Output a character in the current style to the device:
fun flush (DEV { dst, ... } ) = fil::flush dst; # Flush any buffered output.
};
end;
## COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


