PreviousUpNext

15.3.493  src/lib/std/src/io/winix-pure-file-for-os–premicrothread.api

## winix-pure-file-for-os--premicrothread.api
#
# Here we define the "pure" sub-api of
#
#     src/lib/std/src/io/winix-file-for-os--premicrothread.api
#
# where we support side-effect-free file input.
#
# We define pure-functional input streams,
# in which reading a line (or whatever) leaves the
# input stream unchanged: Each call returns the
# line read and a new input stream equal to the
# original one minus the amount read.
#
# Despite our name, we do not attempt side-effect-free
# output; our output streams are the same as the
# regular ones.

# Compiled by:
#     src/lib/std/src/standard-core.sublib

# Included in:
#
#     src/lib/std/src/io/winix-pure-text-file-for-os--premicrothread.api

# Used in:
#
#     src/lib/std/src/io/winix-file-for-os--premicrothread.api

stipulate
    package iox =  io_exceptions;                       # io_exceptions                 is from   src/lib/std/src/io/io-exceptions.pkg
herein

    api Winix_Pure_File_For_Os__Premicrothread {
        #
        Vector;
        Element;

        Filereader;
        Filewriter;

        Input_Stream;
        Output_Stream;

        File_Position;
        Out_Position;

        make_instream:         (Filereader, Vector) -> Input_Stream;

        read:                            Input_Stream -> (Vector, Input_Stream);
        read_one:                        Input_Stream -> Null_Or( (Element, Input_Stream) );

        read_n:                         (Input_Stream, Int) -> (Vector, Input_Stream);
        read_all:                        Input_Stream       -> (Vector, Input_Stream);

        close_input:                     Input_Stream -> Void;
        end_of_stream:                   Input_Stream -> Bool;

        get_reader:             Input_Stream -> (Filereader, Vector);
        file_position_in:       Input_Stream -> File_Position;



        make_outstream:        (Filewriter, iox::Buffering_Mode) -> Output_Stream;

        write:                 (Output_Stream, Vector ) -> Void;
        write_one:             (Output_Stream, Element) -> Void;

        flush:                  Output_Stream -> Void;
        close_output:           Output_Stream -> Void;

        set_buffering_mode:    (Output_Stream,   iox::Buffering_Mode) -> Void;
        get_buffering_mode:     Output_Stream -> iox::Buffering_Mode;

        get_writer:             Output_Stream -> (Filewriter, iox::Buffering_Mode);

        file_pos_out:           Out_Position -> File_Position;

        get_output_position:    Output_Stream -> Out_Position;
        set_output_position:    Out_Position -> Void;
    };
end;


## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext