## prettyprint-output-stream.api
#
# The point of this API is to isolate the core prettyprinter logic in
#
#
src/lib/prettyprint/big/src/core-prettyprinter-g.pkg#
# from concerns about how its output gets marked up with HTML
# or ANSI terminal escape sequences or whatever. (We also
# isolate the prettyprinter proper from concerns about
# just where its output is going.)
#
# The idea is to define abstract Textstyles which represent
# text characteristics like bold, blinking, green or whatever,
# pass these through the core prettyprinter logic as opaque
# data, then do the actual markup/escapesequence generation
# in the Prettyprint_Output_Stream object once the actual
# prettyprinting algorithm is finished.
#
# We provide two mechanisms for passing Textstyle information
# through the core prettyprinter logic:
#
# o The user can supply Styled_Strings instead of plain Strings,
# where Styled_Strings include Textstyle information internally.
#
# o The user can push/pop Textstyles on a prettyprinter stack;
# all Strings entered into the prettyprinter will be given
# the Textstyle specified by the top of this stack.
#
# These two are internally equivalent; a Traitful_Text
# (string,textstyle)
# is processed into a sequence
# { PUSH_TT textstyle;
# TEXT string;
# POP_TT;
# }
#
# A third more general mechanism is also provided allowing arbitrary
# output stream control function calls to be passed through the
# prettyprinter proper to the output stream -- see 'control' in
#
src/lib/prettyprint/big/src/base-prettyprinter.api#
# Prettyprinter_Output_Streams is an unimplemented base API
# from which we derive the apis defined and implemented in
#
#
src/lib/prettyprint/big/src/out/plain-prettyprint-output-stream.pkg#
src/lib/prettyprint/big/src/out/ansi-terminal-prettyprint-output-stream.pkg#
src/lib/prettyprint/big/src/out/html-prettyprint-output-stream.pkg# Compiled by:
#
src/lib/prettyprint/big/prettyprinter.libapi Prettyprint_Output_Stream {
#
Prettyprint_Output_Stream; # The output stream object accepts output from the prettyprint mill and optionally adds HTML (or whatever) markup.
Texttraits; # Texttraits specifies text attributes like bold/italic/color/... (Note[1])
same_texttraits: (Texttraits, Texttraits) -> Bool; # Are two textstyles the same?
push_texttraits: (Prettyprint_Output_Stream, Texttraits) -> Void; # Push texttraits onto the output stream's texttraits stack.
pop_texttraits: Prettyprint_Output_Stream -> Void; # Pop texttraits from the output stream's texttraits stack. A pop on an empty texttraits stack is a no-op.
default_texttraits: Prettyprint_Output_Stream -> Texttraits; # The default texttraits for the stream. These are the current texttraits if the texttraits stack is empty.
put_string: (Prettyprint_Output_Stream, String) -> Void; # Append a string in the current textstyle to the output stream.
flush: Prettyprint_Output_Stream -> Void; # Flush output_stream contents.
close: Prettyprint_Output_Stream -> Void; # Close output_stream.
};
##############################################
# Note[1]
# Texttraits specifies text attributes like bold/italic/color/... (Note[1])
# A buffer keeps a stack of texttraits, with the
# top of stack holding the currently active texttraits.
#
# Implementers of this api should extend it
# with functions for creating texttrait values.
## COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.