[m-dev.] FYI: MC patch to the Melbourne compiler

Peter Ross peter.ross at miscrit.be
Tue Aug 22 23:07:47 AEST 2000


For your information: here is the patch required to turn the Melbourne
mercury compiler into the one used at Mission Critical.

The exception.m changes are needed because exporting a predicate from a
different module then it is defined in is broken under the mlds (the wrong
module name is used).

The patch to io.m should be fixed by the use of some utility predicates
to convert a bi_stream into a input or output stream.

The patch to ml.in should be autoconfed somehow, not sure yet how.

Pete

Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.28
diff -u -r1.28 exception.m
--- library/exception.m	2000/08/02 14:13:07	1.28
+++ library/exception.m	2000/08/18 12:23:34
@@ -330,6 +330,10 @@
 	builtin_catch(wrap_success_or_failure(Goal), wrap_exception, Result).
 *********************/
 
+	% XXX we export this mode of try/2 so that the nasty people
+	% at Mission Critical can change its semantics.
+:- pragma export(try(pred(out) is det, out(cannot_fail)), "ML_try").
+
 try(Goal, Result) :-
 	get_determinism(Goal, Detism),
 	try(Detism, Goal, Result).
@@ -400,6 +404,11 @@
 				wrap_success(Goal, R)),
 			wrap_exception, Result)),
 		AccPred, Acc0, Acc).
+
+	% XXX we export this mode of try_io/4 so that the nasty people
+	% at Mission Critical can change its semantics.
+:- pragma export(try_io(pred(out, di, uo) is det, out(cannot_fail), di, uo),
+		"ML_try_io").
 
 try_io(IO_Goal, Result) -->
 	{ get_determinism_2(IO_Goal, Detism) },
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.201
diff -u -r1.201 io.m
--- library/io.m	2000/08/11 16:50:15	1.201
+++ library/io.m	2000/08/18 12:23:51
@@ -40,19 +40,23 @@
 
 :- type io__state.
 
-	% Opaque handles for text I/O streams.
+:- type io__stream.
+:- type io__bi_stream == io__stream.
 
-:- type io__input_stream.
+	% Non-opaque handles for text I/O streams.
+	% Needed to allow sockets to uses streams as input and output.
 
-:- type io__output_stream.
+:- type io__input_stream == io__stream.
 
+:- type io__output_stream == io__stream.
+
 	% Opaque handles for binary I/O streams.
 
 :- type io__binary_input_stream		==	io__binary_stream.
 
 :- type io__binary_output_stream	==	io__binary_stream.
 
-:- type io__binary_stream.
+:- type io__binary_stream == io__stream.
 
 	% Various types used for the result from the access predicates
 
@@ -1033,10 +1037,20 @@
 
 :- pred io__error_message(io__error, string).
 :- mode io__error_message(in, out) is det.
+:- mode io__error_message(out, in) is det.
 %	io__error_message(ErrorCode, ErrorMessage).
 %		Look up the error message corresponding to a particular error
 %		code.
 
+:- pred io__stream_name(io__stream, string, io__state, io__state).
+:- mode io__stream_name(in, out, di, uo) is det.
+
+:- pred io__delete_stream_name(io__stream, io__state, io__state).
+:- mode io__delete_stream_name(in, di, uo) is det.
+
+:- pred io__insert_stream_name(io__stream, string, io__state, io__state).
+:- mode io__insert_stream_name(in, in, di, uo) is det.
+
 %-----------------------------------------------------------------------------%
 :- implementation.
 
@@ -1117,10 +1131,10 @@
 :- type io__stream_names ==	map(io__stream, string).
 :- type io__stream_putback ==	map(io__stream, list(char)).
 
-:- type io__input_stream ==	io__stream.
-:- type io__output_stream ==	io__stream.
+%:- type io__input_stream ==	io__stream.
+%:- type io__output_stream ==	io__stream.
 
-:- type io__binary_stream ==	io__stream.
+%:- type io__binary_stream ==	io__stream.
 
 :- type io__stream == c_pointer.
 
@@ -2411,9 +2425,6 @@
 io__binary_output_stream_name(Stream, Name) -->
 	io__stream_name(Stream, Name).
 
-:- pred io__stream_name(io__stream, string, io__state, io__state).
-:- mode io__stream_name(in, out, di, uo) is det.
-
 io__stream_name(Stream, Name) -->
 	io__get_stream_names(StreamNames),
 	{ map__search(StreamNames, Stream, Name1) ->
@@ -2441,16 +2452,10 @@
 	update_io(IO0, IO);
 ").
 
-:- pred io__delete_stream_name(io__stream, io__state, io__state).
-:- mode io__delete_stream_name(in, di, uo) is det.
-
 io__delete_stream_name(Stream) -->
 	io__get_stream_names(StreamNames0),
 	{ map__delete(StreamNames0, Stream, StreamNames) },
 	io__set_stream_names(StreamNames).
-
-:- pred io__insert_stream_name(io__stream, string, io__state, io__state).
-:- mode io__insert_stream_name(in, in, di, uo) is det.
 
 io__insert_stream_name(Stream, Name) -->
 	io__get_stream_names(StreamNames0),
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.79
diff -u -r1.79 ml.in
--- scripts/ml.in	2000/08/17 05:31:10	1.79
+++ scripts/ml.in	2000/08/18 12:23:52
@@ -34,6 +34,10 @@
 SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS@"}
 TMPDIR=${TMPDIR=/tmp}
 
+# XXX needed by the MSVC linker so that the compiler doesn't run out of
+# stack space when compiling the compiler.
+export LINK=/stack:10000000
+
 # On some systems (Solaris for exemple), we need libraries to be able to 
 # use sockets. The name of the needed libraries is determined by autoconf
 # and passed through this variable.

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list