diff: io.nu.nl: io__write, io__read, io__get_output_line_num
Fergus Henderson
fjh at cs.mu.oz.au
Fri Sep 26 22:37:26 AEST 1997
library/io.nu.nl:
Add Prolog versions of io__write, io__read, and
io__get_output_line_number.
Index: io.nu.nl
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/io.nu.nl,v
retrieving revision 1.55
diff -u -u -r1.55 io.nu.nl
--- io.nu.nl 1997/09/26 12:19:14 1.55
+++ io.nu.nl 1997/09/26 12:23:34
@@ -298,7 +298,10 @@
io__putback_byte(_Stream, _Char, IO, IO) :-
error("io__putback_byte: binary IO is not implemented for Prolog.").
-io__read_anything(S, Result) -->
+io__read_anything(S, R) -->
+ io__read(S, R).
+
+io__read(S, Result) -->
{ read(S, Term) },
{ eof(Term) ->
Result = eof
@@ -306,7 +309,10 @@
Result = ok(Term)
}.
-io__read_anything(Result) -->
+io__read_anything(R) -->
+ io__read(R).
+
+io__read(Result) -->
{ read(Term) },
{ eof(Term) ->
Result = eof
@@ -339,6 +345,9 @@
io__update_state.
io__write_anything(S, I) -->
+ io__write(S, I).
+
+io__write(S, I) -->
{ write(S, I) },
io__update_state.
@@ -370,8 +379,11 @@
io__write_float(Stream, Float).
io__write_anything(Term) -->
+ io__write(Term).
+
+io__write(Term) -->
io__output_stream(Stream),
- io__write_anything(Stream, Term).
+ io__write(Stream, Term).
io__flush_output -->
io__output_stream(Stream),
@@ -487,6 +499,13 @@
N1 = N0
),
io__adjust_line_num(Cs, N1, N).
+
+io__get_output_line_number(LineNumber) -->
+ { currentOutput(Stream) },
+ io__get_output_line_number(Stream, LineNumber).
+
+io__get_output_line_number(Stream, LineNumber) -->
+ { lineCount(Stream, LineNumber) }.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list