[m-rev.] diff: Fix problems with io in the IL backend

Jonathan Morgan jonmmorgan at gmail.com
Sat Jun 16 22:36:33 AEST 2007


Why does io provide functions stdin_stream/0 and friends (that don't
access the IO state), and predicates stdin_stream/3 and friends (that
are passed the IO state, but comments say that they don't modify it)?

Jon

=============================================================
Estimated hours taken: 0.2
Branches: main

Added implementations of a few procedures to the IL backend that are used by
io.init_state/2.

library/io.m:
	Added C# implementations of stdin_stream_2, stdout_stream_2, and
	stderr_stream_2.

Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.391
diff -u -r1.391 io.m
--- library/io.m	6 Jun 2007 07:21:59 -0000	1.391
+++ library/io.m	15 Jun 2007 07:48:00 -0000
@@ -7545,6 +7545,13 @@
     Stream = &mercury_stdin;
 ").

+:- pragma foreign_proc("C#",
+    io.stdin_stream_2 = (Stream::out),
+    [will_not_call_mercury, promise_pure, thread_safe,
does_not_affect_liveness],
+"
+    Stream = mercury_stdin;
+").
+
 io.stdin_stream(input_stream(Stream), !IO) :-
     io.stdin_stream_2(Stream, !IO).

@@ -7568,6 +7575,13 @@
     Stream = &mercury_stdout;
 ").

+:- pragma foreign_proc("C#",
+    io.stdout_stream_2 = (Stream::out),
+    [will_not_call_mercury, promise_pure, thread_safe,
does_not_affect_liveness],
+"
+    Stream = mercury_stdout;
+").
+
 io.stdout_stream(output_stream(Stream), !IO) :-
     io.stdout_stream_2(Stream, !IO).

@@ -7588,6 +7602,13 @@
     [will_not_call_mercury, promise_pure, thread_safe,
does_not_affect_liveness],
 "
     Stream = &mercury_stderr;
+").
+
+:- pragma foreign_proc("C#",
+    io.stderr_stream_2 = (Stream::out),
+    [will_not_call_mercury, promise_pure, thread_safe,
does_not_affect_liveness],
+"
+    Stream = mercury_stderr;
 ").

 io.stderr_stream(output_stream(Stream), !IO) :-
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list