PreviousUpNext

15.4.838  src/lib/prettyprint/big/src/out/plain-prettyprint-output-stream.pkg

## plain-prettyprint-output-stream.pkg([^A-Za-z0-9_])#
# A simple (no textstyles) prettyprinter output stream.
# This is what we use 99% of the time in practice.
#
# For an overview of prettyprinter output stream functionality see
#
#     src/lib/prettyprint/big/src/out/prettyprint-output-stream.api
#
# Compare to:
#
#     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.lib

###                 "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.pkg
herein

    api Plain_Prettyprint_Output_Stream {
        #
        include api Prettyprint_Output_Stream;                                                                          # Prettyprint_Output_Stream     is from   src/lib/prettyprint/big/src/out/prettyprint-output-stream.api

        make_plain_prettyprinter_output_stream
            :
            { output_stream:  fil::Output_Stream
            }
            -> Prettyprint_Output_Stream;
    };
    

    package  plain_prettyprint_output_stream
    : (weak) Plain_Prettyprint_Output_Stream
    {
        Prettyprint_Output_Stream
            =
            PRETTYPRINT_OUTPUT_STREAM
              {
                output_stream:  fil::Output_Stream
              };

        Texttraits = Void;            # No texttraits support 

        fun same_texttraits    _ = TRUE;
        fun push_texttraits    _ = ();
        fun pop_texttraits     _ = ();
        fun default_texttraits _ = ();

        make_plain_prettyprinter_output_stream
            =
            PRETTYPRINT_OUTPUT_STREAM;

        fun put_string (PRETTYPRINT_OUTPUT_STREAM { output_stream, ... }, s) =  fil::write       (output_stream, s);    # Append a string    in the current texttraits to the output stream:
        fun flush (PRETTYPRINT_OUTPUT_STREAM { output_stream, ... }        ) =  fil::flush        output_stream;        # 
        fun close (PRETTYPRINT_OUTPUT_STREAM { output_stream, ... }        ) =  fil::close_output output_stream;        # 
    };
end;


## COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext