[m-rev.] io__current_input_stream vs io__input_stream

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Feb 23 17:00:29 AEDT 2003


The change below added new predicates io__current_input_stream,
io__current_output_stream, etc. to library/io.m.
This was a mistake, because there were already procedures for
doing that, named io__input_stream. io__output_stream, etc.
Hence I think we should delete the predicates added by this change.

Unfortunately I didn't spot this until now, so the duplicate names were
included in 0.11.  Therefore rather than removing them straight away,
I proposed to deprecate them now and delete them after the next release.

Comments?

P.S. The diff below was posted as part of a larger change,
"printing higher order values and typeinfos in the debugger".

On 22-Feb-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> library/io.m:
> 	Add predicates to retrieve the current input and output streams.
...
> Index: library/io.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/io.m,v
> retrieving revision 1.243
> diff -u -b -r1.243 io.m
> --- library/io.m	18 Feb 2002 07:01:04 -0000	1.243
> +++ library/io.m	21 Feb 2002 12:38:12 -0000
> @@ -529,6 +531,12 @@
>  %		Retrieves the standard input stream.
>  %		Does not modify the IO state.
>  
> +:- pred io__current_input_stream(io__input_stream, io__state, io__state).
> +:- mode io__current_input_stream(out, di, uo) is det.
> +%       io__current_input_stream(CurrentStream, IO0, IO1)
> +%		Returns the current input stream in CurrentStream.
> +%		Does not modify the IO state.
> +
>  :- pred io__input_stream_name(string, io__state, io__state).
>  :- mode io__input_stream_name(out, di, uo) is det.
>  %	Retrieves the human-readable name associated with the current input
> @@ -626,6 +634,12 @@
>  %		Retrieves the standard error stream.
>  %		Does not modify the IO state.
>  
> +:- pred io__current_output_stream(io__output_stream, io__state, io__state).
> +:- mode io__current_output_stream(out, di, uo) is det.
> +%       io__current_output_stream(CurrentStream, IO0, IO1)
> +%		Returns the current output stream in CurrentStream.
> +%		Does not modify the IO state.
> +
>  :- pred io__output_stream_name(string, io__state, io__state).
>  :- mode io__output_stream_name(out, di, uo) is det.
>  %	Retrieves the human-readable name associated with the current
> @@ -834,6 +848,13 @@
>  %		Retrieves the standard binary input stream.
>  %		Does not modify the IO state.
>  
> +:- pred io__current_binary_input_stream(io__binary_input_stream,
> +			io__state, io__state).
> +:- mode io__current_binary_input_stream(out, di, uo) is det.
> +%       io__current_binary_input_stream(CurrentStream, IO0, IO1)
> +%		Returns the current binary input stream in CurrentStream.
> +%		Does not modify the IO state.
> +
>  :- pred io__binary_input_stream_name(string, io__state, io__state).
>  :- mode io__binary_input_stream_name(out, di, uo) is det.
>  %	Retrieves the human-readable name associated with the current binary
> @@ -909,6 +930,13 @@
>  %		Changes the current binary output stream to the stream
>  %		specified. Returns the previous stream.
>  
> +:- pred io__current_binary_output_stream(io__binary_output_stream,
> +			io__state, io__state).
> +:- mode io__current_binary_output_stream(out, di, uo) is det.
> +%       io__current_binary_output_stream(CurrentStream, IO0, IO1)
> +%		Returns the current binary output stream in CurrentStream.
> +%		Does not modify the IO state.
> +
>  :- pred io__binary_output_stream_name(string, io__state, io__state).
>  :- mode io__binary_output_stream_name(out, di, uo) is det.
>  %	Retrieves the human-readable name associated with the current
> @@ -4432,6 +4482,38 @@
>  	update_io(IO0, IO);
>  }").
>  	
> +:- pragma foreign_proc("C",
> +	io__current_input_stream(OutStream::out, IO0::di, IO::uo),
> +		[will_not_call_mercury, promise_pure, tabled_for_io],
> +"
> +	OutStream = (MR_Word) mercury_current_text_input;
> +	update_io(IO0, IO);
> +").
> +
> +:- pragma foreign_proc("C",
> +	io__current_output_stream(OutStream::out, IO0::di, IO::uo),
> +		[will_not_call_mercury, promise_pure, tabled_for_io],
> +"
> +	OutStream = (MR_Word) mercury_current_text_output;
> +	update_io(IO0, IO);
> +").
> +
> +:- pragma foreign_proc("C",
> +	io__current_binary_input_stream(OutStream::out, IO0::di, IO::uo),
> +		[will_not_call_mercury, promise_pure, tabled_for_io],
> +"
> +	OutStream = (MR_Word) mercury_current_binary_input;
> +	update_io(IO0, IO);
> +").
> +
> +:- pragma foreign_proc("C",
> +	io__current_binary_output_stream(OutStream::out, IO0::di, IO::uo),
> +		[will_not_call_mercury, promise_pure, tabled_for_io],
> +"
> +	OutStream = (MR_Word) mercury_current_binary_output;
> +	update_io(IO0, IO);
> +").
> +
>  % io__set_input_stream(NewStream, OldStream, IO0, IO1)
>  %	Changes the current input stream to the stream specified.
>  %	Returns the previous stream.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list