%% Copyright (c) 1995,1996 by the University of Pennsylvania		%%

%% For information about the distributaion, copying, and modification	%%
%% of this software, please read the file COPYING located in the root	%%
%% directory of this distribnutaion. If you did not receive the file	%%
%% COPYING write to Philip Wickline at the address below.		%%

%% This program is distributed in the hope that it will be useful but	%%
%% WITHOUT ANY WARRANTY; without even the implied warranty of		%%
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file	%%
%% COPYING for more details.						%%

%% For information about the structure of the Terzo lambdaProlog	%%
%% implementation, see the file src/README in this distribution. Please	%%
%% address any questions about this code or the Terzo lambdaProlog	%%
%% implementation to Philip Wickline at <philipw@saul.cis.upenn.edu>.	%%

%% Author:								%%
%%	Philip Wickline <philipw@saul.cis.upenn.edu>			%%

module StreamIo.

	% These are built-in.
	%kind	in_stream, out_stream	type.

	% The obvious UNIX/C equivalents - These are built in
	%type	std_in			in_stream.
	%type	std_out, std_err	out_stream.

	type	open_string		string -> in_stream -> o.
	% open_string str
	%	Open_string creates an in_stream whose contents are
	%	str.

	type	output			out_stream -> string -> o.
	% output strm str
	%	Outputs str on the stream strm.

	type	input			in_stream -> int -> string -> o.
	% input strm i
	%	Inputs at most i characters from strm. Block until i
	%	characters are available, or EOF is reached.
	
	type	input_line		in_stream -> string -> o.
	% input_line strm
	%	Blocks until a newline or EOF has been read from strm,
	%	and then returns all characters up to and including
	%	that first newline or EOF.
	
	type	lookahead		in_stream -> string -> o.
	% lookahead strm
	%	returns the next character from strm without removing
	%	it from the stream, or the empty string if at the end
	%	of file. Blocks until a character of EOF are available.
	
	type	eof			in_stream -> o.
	% eof strm
	%	Succeeds if at the end of stream of strm.

	type	flush			out_stream -> o.
	% flush strm
	% 	writes any buffered output to strm.