[m-rev.] io__current_input_stream vs io__input_stream
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Feb 23 17:50:00 AEDT 2003
On 23-Feb-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> 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.
Here's a patch which implements this proposal.
Estimated hours taken: 1
Branches: main
library/io.m:
Deprecate io__current_(binary_)?(input|output)_stream,
because these procedures were identical with the
procedures named io__(binary_)?(input|output)_stream.
browser/browse.m:
Use io__output_stream instead of io__current_output_stream.
deep_profiler/mdprof_cgi.m:
Use io__binary_(in|out)put_stream instead of
io__current_binary_(in|out)put_stream.
NEWS:
Mention the changes to library/io.m.
Workspace: /home/ceres/fjh/mercury
Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.303
diff -u -d -r1.303 NEWS
--- NEWS 21 Feb 2003 01:54:36 -0000 1.303
+++ NEWS 23 Feb 2003 06:43:02 -0000
@@ -92,6 +92,9 @@
* getopt.m now accepts a `maybe_string_special' option type.
+* builtin.m now contains types and insts `unify' and `compare' for use
+ in defining user-defined equality and comparison predicates.
+
* We've fixed some problems with the use of `cc_nondet'.
The incorrect cc_nondet modes of the following predicates have been removed:
@@ -105,8 +108,17 @@
These have been replaced by cc_multi versions in which success or failure
is indicated by returning a maybe type.
-* builtin.m now contains types and insts `unify' and `compare' for use
- in defining user-defined equality and comparison predicates.
+* The following predicates, which were added in 0.10, have been deprecated:
+ io.current_input_stream/3
+ io.current_output_stream/3
+ io.current_binary_input_stream/3
+ io.current_binary_output_stream/3
+ They were identical to the following long-existing predicates with
+ similar names:
+ io.input_stream/3
+ io.output_stream/3
+ io.binary_input_stream/3
+ io.binary_output_stream/3
Changes to the extras distribution:
Index: browser/browse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browse.m,v
retrieving revision 1.35
diff -u -d -r1.35 browse.m
--- browser/browse.m 3 Dec 2002 10:21:16 -0000 1.35
+++ browser/browse.m 23 Feb 2003 06:14:03 -0000
@@ -528,11 +528,11 @@
io__state::di, io__state::uo) is cc_multi.
portray_flat_write_browser_term(plain_term(Univ)) -->
- io__current_output_stream(Stream),
+ io__output_stream(Stream),
io__write_univ(Stream, include_details_cc, Univ).
portray_flat_write_browser_term(synthetic_term(Functor, Args, MaybeReturn)) -->
io__write_string(Functor),
- io__current_output_stream(Stream),
+ io__output_stream(Stream),
( { Args = [] } ->
[]
;
Index: deep_profiler/mdprof_cgi.m
===================================================================
RCS file: /home/mercury1/repository/mercury/deep_profiler/mdprof_cgi.m,v
retrieving revision 1.4
diff -u -d -r1.4 mdprof_cgi.m
--- deep_profiler/mdprof_cgi.m 2 Dec 2002 11:24:33 -0000 1.4
+++ deep_profiler/mdprof_cgi.m 23 Feb 2003 06:37:07 -0000
@@ -369,9 +369,9 @@
io__close_output(StdOut),
io__stderr_stream(StdErr),
io__close_output(StdErr),
- io__current_binary_input_stream(BinaryStdIn),
+ io__binary_input_stream(BinaryStdIn),
io__close_binary_input(BinaryStdIn),
- io__current_binary_output_stream(BinaryStdOut),
+ io__binary_output_stream(BinaryStdOut),
io__close_binary_output(BinaryStdOut)
;
{ ChildHasParent = child_has_no_parent },
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.292
diff -u -d -r1.292 io.m
--- library/io.m 22 Feb 2003 11:17:34 -0000 1.292
+++ library/io.m 23 Feb 2003 06:10:28 -0000
@@ -566,12 +566,6 @@
% 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
@@ -669,12 +663,6 @@
% 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
@@ -952,13 +940,6 @@
% 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
@@ -1034,13 +1015,6 @@
% 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
@@ -1126,28 +1100,6 @@
% File handling predicates
-:- pragma obsolete(io__tmpnam/3). % use io__make_temp/3 instead
-:- pred io__tmpnam(string, io__state, io__state).
-:- mode io__tmpnam(out, di, uo) is det.
- % io__tmpnam(Name, IO0, IO) binds `Name' to a temporary
- % file name which is different to the name of any existing file.
- % It will reside in /tmp if the TMPDIR environment variable
- % is not set, or in the directory specified by TMPDIR if it
- % is set.
- % Use of this predicate is deprecated, because it may
- % result in race conditions. Use io__make_temp/3 instead.
-
-:- pragma obsolete(io__tmpnam/5). % use io__make_temp/5 instead
-:- pred io__tmpnam(string, string, string, io__state, io__state).
-:- mode io__tmpnam(in, in, out, di, uo) is det.
- % io__tmpnam(Dir, Prefix, Name, IO0, IO) binds `Name' to a
- % temporary file name which is different to the name of any
- % existing file. It will reside in the directory specified by
- % `Dir' and have a prefix using up to the first 5 characters
- % of `Prefix'.
- % Use of this predicate is deprecated, because it may
- % result in race conditions. Use io__make_temp/5 instead.
-
:- pred io__make_temp(string, io__state, io__state).
:- mode io__make_temp(out, di, uo) is det.
% io__make_temp(Name, IO0, IO) creates an empty file
@@ -1207,17 +1159,6 @@
:- pred io__report_stats(io__state, io__state).
:- mode io__report_stats(di, uo) is det.
- % Write complete memory usage statistics to stderr,
- % including information about all procedures and types.
- % (You need to compile with memory profiling enabled.)
- %
- % OBSOLETE: call io__report_stats/3 instead, with the first
- % specified as "full_memory_stats".
-
-:- pragma obsolete(io__report_full_memory_stats/2).
-:- pred io__report_full_memory_stats(io__state, io__state).
-:- mode io__report_full_memory_stats(di, uo) is det.
-
% Write statistics to stderr; what statistics will be written
% is controlled by the first argument, which acts a selector.
% What selector values cause what statistics to be printed
@@ -1292,6 +1233,66 @@
% code.
%-----------------------------------------------------------------------------%
+%
+% Deprecated predicates.
+%
+% Do not use these in new programs!
+% They may be deleted in the next release.
+
+ % use io__input_stream/3 instead -- it has identical semantics
+:- pragma obsolete(io__current_input_stream/3).
+:- pred io__current_input_stream(io__input_stream, io__state, io__state).
+:- mode io__current_input_stream(out, di, uo) is det.
+
+ % use io__output_stream/3 instead -- it has identical semantics
+:- pragma obsolete(io__current_output_stream/3).
+:- pred io__current_output_stream(io__output_stream, io__state, io__state).
+:- mode io__current_output_stream(out, di, uo) is det.
+
+ % use io__binary_input_stream/3 instead -- it has identical semantics
+:- pragma obsolete(io__current_binary_input_stream/3).
+:- 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.
+
+ % use io__binary_output_stream/3 instead -- it has identical semantics
+:- pragma obsolete(io__current_binary_output_stream/3).
+:- 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.
+
+:- pragma obsolete(io__tmpnam/3). % use io__make_temp/3 instead
+:- pred io__tmpnam(string, io__state, io__state).
+:- mode io__tmpnam(out, di, uo) is det.
+ % io__tmpnam(Name, IO0, IO) binds `Name' to a temporary
+ % file name which is different to the name of any existing file.
+ % It will reside in /tmp if the TMPDIR environment variable
+ % is not set, or in the directory specified by TMPDIR if it
+ % is set.
+ % Use of this predicate is deprecated, because it may
+ % result in race conditions. Use io__make_temp/3 instead.
+
+:- pragma obsolete(io__tmpnam/5). % use io__make_temp/5 instead
+:- pred io__tmpnam(string, string, string, io__state, io__state).
+:- mode io__tmpnam(in, in, out, di, uo) is det.
+ % io__tmpnam(Dir, Prefix, Name, IO0, IO) binds `Name' to a
+ % temporary file name which is different to the name of any
+ % existing file. It will reside in the directory specified by
+ % `Dir' and have a prefix using up to the first 5 characters
+ % of `Prefix'.
+ % Use of this predicate is deprecated, because it may
+ % result in race conditions. Use io__make_temp/5 instead.
+
+ % OBSOLETE: call io__report_stats/3 instead, with the first argument
+ % specified as "full_memory_stats".
+:- pragma obsolete(io__report_full_memory_stats/2).
+:- pred io__report_full_memory_stats(io__state, io__state).
+:- mode io__report_full_memory_stats(di, uo) is det.
+ % Write complete memory usage statistics to stderr,
+ % including information about all procedures and types.
+ % (You need to compile with memory profiling enabled.)
+
+%-----------------------------------------------------------------------------%
:- implementation.
% Everything below here is not intended to be part of the public interface,
@@ -4943,37 +4944,10 @@
MR_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;
- MR_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;
- MR_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;
- MR_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;
- MR_update_io(IO0, IO);
-").
+current_input_stream(S) --> input_stream(S).
+current_output_stream(S) --> output_stream(S).
+current_binary_input_stream(S) --> binary_input_stream(S).
+current_binary_output_stream(S) --> binary_output_stream(S).
% io__set_input_stream(NewStream, OldStream, IO0, IO1)
% Changes the current input stream to the stream specified.
--
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