[m-rev.] for review: allow library to compile with high level data on .NET

Peter Ross pro at missioncriticalit.com
Tue Jul 2 20:38:56 AEST 2002


Hi,

For Fergus or Tyson to review.


===================================================================


Estimated hours taken: 120
Branches: main

Allow the library to compile in the grade il (high level data).

compiler/ml_util.m:
	Add more types which need to be represented using the low level
	representation because of how they are handled in the library.

compiler/mlds_to_il.m:
	Remove an XXX which is no longer necessary.
	Add the heap_pointer type to the list of types whose RTTI is defined
	by hand.

library/exception.m:
	Move the definition of Exception from the runtime to the local module.
	This is needed for when univ/0 is no longer represented as a low level
	type.

runtime/mercury_mcpp.cpp:
	Remove the implementation of Exception that is now in exception.m.

library/Mmakefile:
	The lowlevel Exception type is now defined in the library not the
	runtime, so add rules to ensure that the foreign code is built in
	the correct order.

library/io.m:
	Reimplement io__stream as a foreign_type.  This makes the code more
	type safe and avoids problems with the different representation of
	the io__stream type when using high and low level data.
	Change io__command_line_arguments so that it throws an exception
	when we use high level data, as I am yet to work out how to access
	high level lists.

library/rtti_implementation.m:
	Add a comment that get_subterm doesn't work with high level data.
	Fix some bugs with the default versions of type_ctor_compare_pred and
	type_ctor_unify_pred.

library/sparse_bitset.m:
	Remove the foreign_proc implementation of make_bitset_elem as it
	will not work with both data representations and their is a Mercury
	implementation.

library/string.m:
	Remove the foreign_proc implementation of all the predicates which
	manipulate lists as they all have a Mercury implementation, as I am yet
	to work out how to access high level lists.
	Add a Mercury implementation for string__join_list.

runtime/mercury_mcpp.h:
library/array.m:
library/builtin.m:
library/private_builtin.m:
library/type_desc.m:
	Define and use typedefs where appropiate for type_info/0, type_info/1,
	comparison_result/0 and univ/0, as there representation may change in
	the future between using high level and low level data.
	

Index: compiler/ml_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_util.m,v
retrieving revision 1.21
diff -u -r1.21 ml_util.m
--- compiler/ml_util.m	1 Jul 2002 14:37:33 -0000	1.21
+++ compiler/ml_util.m	2 Jul 2002 10:17:48 -0000
@@ -624,6 +624,7 @@
 	mercury_private_builtin_module(PrivateBuiltin),
 	RttiImplementation = unqualified("rtti_implementation"),
 	StdUtil = unqualified("std_util"),
+	TypeDesc = unqualified("type_desc"),
 	( TypeName = qualified(PrivateBuiltin, "base_typeclass_info")
 	; TypeName = qualified(PrivateBuiltin, "type_ctor_info")
 	; TypeName = qualified(PrivateBuiltin, "typeclass_info")
@@ -640,11 +641,19 @@
 	; TypeName = qualified(RttiImplementation, "type_info")
 	; TypeName = qualified(RttiImplementation, "type_layout")
 
+	; TypeName = qualified(TypeDesc, "type_desc")
+	; TypeName = qualified(TypeDesc, "type_ctor_desc")
+
+		% Types which don't have a Mercury representation.
+	; TypeName = qualified(PrivateBuiltin, "heap_pointer")
+	; TypeName = qualified(Builtin, "c_pointer")
+
 		% XXX These two types are referenced in IL and C# code,
 		% so it is easier to just keep their low level representation
 		% for the moment.
 	; TypeName = qualified(Builtin, "comparison_result")
 	; TypeName = qualified(StdUtil, "univ")
+	; TypeName = qualified(StdUtil, "mutvar")
 	).
 	
 
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.117
diff -u -r1.117 mlds_to_il.m
--- compiler/mlds_to_il.m	1 Jul 2002 14:37:34 -0000	1.117
+++ compiler/mlds_to_il.m	2 Jul 2002 10:17:52 -0000
@@ -1092,17 +1092,7 @@
 			[], UnivMercuryType) },	
 		{ UnivMLDSType = mercury_type(UnivMercuryType,
 				user_type, non_foreign_type(UnivMercuryType)) },
-		%
-		% XXX Nasty hack alert!
-		%
-		% Currently the library doesn't build with --high-level-data.
-		% So here we explicitly set --high-level-data to `no'
-		% to reflect the fact that we're linking against the
-		% version of the library compiled with --low-level-data.
-		%
-		{ XXX_LibraryDataRep = DataRep ^ highlevel_data := no },
-		{ UnivType = mlds_type_to_ilds_type(XXX_LibraryDataRep,
-			UnivMLDSType) },
+		{ UnivType = mlds_type_to_ilds_type(DataRep, UnivMLDSType) },
 
 		{ RenameNode = (func(N) = list__map(RenameRets, N)) },
 
@@ -3319,6 +3309,7 @@
 				; Name = "type_info", Arity = 1
 				; Name = "base_typeclass_info", Arity = 1
 				; Name = "typeclass_info", Arity = 1
+				; Name = "heap_pointer", Arity = 0
 				)
 			)		  
 		;
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.93
diff -u -r1.93 Mmakefile
--- library/Mmakefile	22 Jun 2002 19:16:03 -0000	1.93
+++ library/Mmakefile	2 Jul 2002 10:17:52 -0000
@@ -230,6 +230,9 @@
 mercury_mcpp.dll: ../runtime/mercury_mcpp.dll
 	cp ../runtime/mercury_mcpp.dll .
 
+exception__csharp_code.dll : exception__cpp_code.dll
+CSHARP_ASSEMBLY_REFS-exception__csharp_code += /addmodule:exception__cpp_code.dll
+
 else	# GRADE != il
 
 # The following dependency is just there to improve compilation speed;
@@ -248,6 +251,7 @@
 		grep '^INIT ' $$file; \
 		echo "INIT mercury__`basename $$file .m`__init"; \
 	done > $(STD_LIB_NAME).init
+
 
 else
 
Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.109
diff -u -r1.109 array.m
--- library/array.m	14 Jun 2002 10:18:45 -0000	1.109
+++ library/array.m	2 Jul 2002 10:17:53 -0000
@@ -609,7 +609,7 @@
     MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(array, array, 1, MR_TYPECTOR_REP_ARRAY)
 
     static int
-    special___Unify___array_1_0(MR_Word type_info, MR_Array x, MR_Array y)
+    special___Unify___array_1_0(MR_TypeInfo type_info, MR_Array x, MR_Array y)
     {
             return mercury::array::mercury_code::ML_array_equal(
 	    	type_info, x, y);
@@ -617,14 +617,14 @@
 
     static void
     special___Compare___array_1_0(
-            MR_Word type_info, MR_Word_Ref result, MR_Array x, MR_Array y)
+            MR_TypeInfo type_info, MR_ComparisonResult *result, MR_Array x, MR_Array y)
     {
             mercury::array::mercury_code::ML_array_compare(
 	    	type_info, result, x, y);
     }
 
     static int
-    do_unify__array_1_0(MR_Word type_info, MR_Box x, MR_Box y)
+    do_unify__array_1_0(MR_TypeInfo type_info, MR_Box x, MR_Box y)
     {
             return mercury::array__cpp_code::mercury_code::special___Unify___array_1_0(
                     type_info, 
@@ -634,7 +634,7 @@
 
     static void
     do_compare__array_1_0(
-            MR_Word type_info, MR_Word_Ref result, MR_Box x, MR_Box y)
+            MR_TypeInfo type_info, MR_ComparisonResult *result, MR_Box x, MR_Box y)
     {
             mercury::array__cpp_code::mercury_code::special___Compare___array_1_0(
                     type_info, result, 
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.74
diff -u -r1.74 builtin.m
--- library/builtin.m	14 Jun 2002 10:18:46 -0000	1.74
+++ library/builtin.m	2 Jul 2002 10:17:53 -0000
@@ -496,26 +496,30 @@
 
 :- pragma foreign_code("MC++", "
 
-static void compare_3(MR_TypeInfo TypeInfo_for_T, MR_Word_Ref Res, 
+static void compare_3(MR_TypeInfo TypeInfo_for_T,
+		MR_Ref(MR_ComparisonResult) Res, 
 		MR_Box X, MR_Box Y) 
 {
 	mercury::builtin::mercury_code::call_rtti_generic_compare_3(
 			TypeInfo_for_T, Res, X, Y);
 }
 
-void compare_3_m1(MR_TypeInfo TypeInfo_for_T, MR_Word_Ref Res, 
+void compare_3_m1(MR_TypeInfo TypeInfo_for_T,
+		MR_Ref(MR_ComparisonResult) Res, 
 		MR_Box X, MR_Box Y) 
 {
 	compare_3(TypeInfo_for_T, Res, X, Y);
 }
 
-void compare_3_m2(MR_TypeInfo TypeInfo_for_T, MR_Word_Ref Res, 
+void compare_3_m2(MR_TypeInfo TypeInfo_for_T,
+		MR_Ref(MR_ComparisonResult) Res, 
 		MR_Box X, MR_Box Y) 
 {
 	compare_3(TypeInfo_for_T, Res, X, Y);
 }
 
-void compare_3_m3(MR_TypeInfo TypeInfo_for_T, MR_Word_Ref Res, 
+void compare_3_m3(MR_TypeInfo TypeInfo_for_T,
+		MR_Ref(MR_ComparisonResult) Res, 
 		MR_Box X, MR_Box Y) 
 {
 	compare_3(TypeInfo_for_T, Res, X, Y);
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.65
diff -u -r1.65 exception.m
--- library/exception.m	12 Jun 2002 06:46:32 -0000	1.65
+++ library/exception.m	2 Jul 2002 10:17:54 -0000
@@ -1097,6 +1097,22 @@
 	% For the .NET backend we override throw_impl as it is easier to 
 	% implement these things using foreign_proc.
 
+:- pragma foreign_decl("MC++", "
+namespace mercury {
+	namespace runtime {
+		__gc public class Exception : public System::Exception
+		{
+		public:
+		   Exception(MR_Univ data) 
+		   {
+			mercury_exception = data;	
+		   }
+		   MR_Univ mercury_exception;
+		};
+	}
+}
+").
+
 :- pragma foreign_proc("C#", throw_impl(T::in),
 		[will_not_call_mercury, promise_pure], "
 	throw new mercury.runtime.Exception(T);
@@ -2047,7 +2063,7 @@
 report_uncaught_exception_2(Exception, unit) -->
 	io__flush_output,
 	io__stderr_stream(StdErr),
-	io__write_string(StdErr, "Uncaught exception:\n"),
+	io__write_string(StdErr, "Uncaught Mercury exception:\n"),
 	( { univ_to_type(Exception, software_error(Message)) } ->
 		io__format(StdErr, "Software Error: %s\n", [s(Message)])
 	;
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.262
diff -u -r1.262 io.m
--- library/io.m	2 Jul 2002 07:39:20 -0000	1.262
+++ library/io.m	2 Jul 2002 10:17:55 -0000
@@ -1303,8 +1303,12 @@
 ").
 
 :- pragma foreign_code("MC++", "
+#ifdef MR_HIGHLEVEL_DATA
+	static mercury::tree234::tree234_2 __gc	*ML_io_stream_names;
+#else
 	static MR_Word		ML_io_stream_names;
-	static MR_Word		ML_io_user_globals;
+#endif
+	static MR_Univ		ML_io_user_globals;
 	static int next_id;
 	static System::Text::ASCIIEncoding *ascii_encoder;
 ").
@@ -1318,7 +1322,10 @@
 
 :- type io__binary_stream ==	io__stream.
 
-:- type io__stream == c_pointer.
+:- type io__stream.
+:- pragma foreign_type(c, io__stream, "MercuryFile *").
+:- pragma foreign_type(il, io__stream,
+		"class [mercury]mercury.io__cpp_code.MR_MercuryFileStruct").
 
 	% a unique identifier for an IO stream
 :- type io__stream_id == int.
@@ -1911,8 +1918,7 @@
 		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, thread_safe],
 "{
-	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile mf = Stream;
 	if (mf->stream->get_CanSeek()) {
 		Size = mf->stream->get_Length();
 	} else {
@@ -3109,8 +3115,7 @@
 :- pragma foreign_proc("MC++",
 	io__get_stream_id(Stream::in, Id::out), 
 		[will_not_call_mercury, promise_pure], "
-	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile,
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile mf = Stream;
 	Id = mf->id;
 ").
 
@@ -3373,6 +3378,8 @@
 
 	// XXX currently we only handle text streams.
 
+namespace mercury {
+namespace io__cpp_code {
 __gc struct MR_MercuryFileStruct {
 public:
 	// Note that stream reader and writer might be null, if they are
@@ -3388,6 +3395,9 @@
 
 typedef __gc struct MR_MercuryFileStruct *MR_MercuryFile;
 
+}
+}
+
 	// These macros aren't very safe -- they don't enforce
 	// safe casts in anyway.  Make sure you use them for good
 	// and not evil.
@@ -3958,8 +3968,7 @@
 :- pragma foreign_proc("MC++", 
 	io__read_char_code(File::in, CharCode::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure], "
-	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(File));
+	MR_MercuryFile mf = File;
 	CharCode = mercury_getc(mf);
 	update_io(IO0, IO);
 ").
@@ -3968,8 +3977,7 @@
 	io__putback_char(File::in, Character::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure], "{
 
-	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile,
-		MR_word_to_c_pointer(File));
+	MR_MercuryFile mf = File;
 	if (Character == '\\n') {
 		mf->line_number--;
 	}
@@ -3981,8 +3989,7 @@
 	io__putback_byte(File::in, _Character::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure], "{
 
-	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(File));
+	MR_MercuryFile mf = File;
 	mf->stream->Seek(-1, System::IO::SeekOrigin::Current);
 	update_io(IO0, IO);
 }").
@@ -4356,8 +4363,7 @@
 	io__write_string(Stream::in, Message::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io], 
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	mercury_print_string(stream, Message);
 	update_io(IO0, IO);
 }").
@@ -4366,8 +4372,7 @@
 	io__write_char(Stream::in, Character::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io], 
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	System::IO::StreamWriter *w = new System::IO::StreamWriter(
 		mercury_current_binary_output->stream);
 	w->Write(Character);
@@ -4379,8 +4384,7 @@
 	io__write_int(Stream::in, Val::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	System::IO::StreamWriter *w = new System::IO::StreamWriter(
 		mercury_current_binary_output->stream);
 	w->Write(Val.ToString());
@@ -4392,8 +4396,7 @@
 	io__write_float(Stream::in, Val::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	System::IO::StreamWriter *w = new System::IO::StreamWriter(
 		mercury_current_binary_output->stream);
 	w->Write(Val.ToString());
@@ -4407,8 +4410,7 @@
 "{
 	mercury::runtime::Errors::SORRY(""foreign code for this function"");
 		// something like this...
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	System::IO::StreamWriter *w = new System::IO::StreamWriter(
 		mercury_current_binary_output->stream);
 	w->Write(Byte.ToString());
@@ -4420,8 +4422,7 @@
 	io__write_bytes(Stream::in, Message::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	mercury_print_binary_string(stream, Message);
 	update_io(IO0, IO);
 }").
@@ -4430,8 +4431,7 @@
 	io__flush_output(Stream::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	stream->stream->Flush();
 	update_io(IO0, IO);
 }").
@@ -4440,8 +4440,7 @@
 	io__flush_binary_output(Stream::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	stream->stream->Flush();
 	update_io(IO0, IO);
 }").
@@ -4497,7 +4496,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "
-	Stream = (MR_Word) &mercury_stdin;
+	Stream = &mercury_stdin;
 	update_io(IO0, IO);
 ").
 
@@ -4506,7 +4505,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "
-	Stream = (MR_Word) &mercury_stdout;
+	Stream = &mercury_stdout;
 	update_io(IO0, IO);
 ").
 
@@ -4515,7 +4514,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "
-	Stream = (MR_Word) &mercury_stderr;
+	Stream = &mercury_stderr;
 	update_io(IO0, IO);
 ").
 
@@ -4524,7 +4523,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "
-	Stream = (MR_Word) &mercury_stdin_binary;
+	Stream = &mercury_stdin_binary;
 	update_io(IO0, IO);
 ").
 
@@ -4533,7 +4532,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "
-	Stream = (MR_Word) &mercury_stdout_binary;
+	Stream = &mercury_stdout_binary;
 	update_io(IO0, IO);
 ").
 
@@ -4541,7 +4540,7 @@
 	io__input_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	Stream = (MR_Word) mercury_current_text_input;
+	Stream = mercury_current_text_input;
 	update_io(IO0, IO);
 ").
 
@@ -4549,7 +4548,7 @@
 	io__output_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	Stream = (MR_Word) mercury_current_text_output;
+	Stream = mercury_current_text_output;
 	update_io(IO0, IO);
 ").
 
@@ -4557,7 +4556,7 @@
 	io__binary_input_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	Stream = (MR_Word) mercury_current_binary_input;
+	Stream = mercury_current_binary_input;
 	update_io(IO0, IO);
 ").
 
@@ -4565,7 +4564,7 @@
 	io__binary_output_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	Stream = (MR_Word) mercury_current_binary_output;
+	Stream = mercury_current_binary_output;
 	update_io(IO0, IO);
 ").
 
@@ -4642,7 +4641,7 @@
 	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;
+	OutStream = mercury_current_text_input;
 	update_io(IO0, IO);
 ").
 
@@ -4650,7 +4649,7 @@
 	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;
+	OutStream = mercury_current_text_output;
 	update_io(IO0, IO);
 ").
 
@@ -4658,7 +4657,7 @@
 	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;
+	OutStream = mercury_current_binary_input;
 	update_io(IO0, IO);
 ").
 
@@ -4666,7 +4665,7 @@
 	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;
+	OutStream = mercury_current_binary_output;
 	update_io(IO0, IO);
 ").
 
@@ -4678,7 +4677,7 @@
 		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	OutStream = (MR_Word) mercury_current_text_input;
+	OutStream = mercury_current_text_input;
 	mercury_current_text_input = (MercuryFile *) NewStream;
 	update_io(IO0, IO);
 ").
@@ -4688,7 +4687,7 @@
 		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	OutStream = (MR_Word) mercury_current_text_output;
+	OutStream = mercury_current_text_output;
 	mercury_current_text_output = (MercuryFile *) NewStream;
 	update_io(IO0, IO);
 ").
@@ -4698,7 +4697,7 @@
 		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	OutStream = (MR_Word) mercury_current_binary_input;
+	OutStream = mercury_current_binary_input;
 	mercury_current_binary_input = (MercuryFile *) NewStream;
 	update_io(IO0, IO);
 ").
@@ -4708,7 +4707,7 @@
 		IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	OutStream = (MR_Word) mercury_current_binary_output;
+	OutStream = mercury_current_binary_output;
 	mercury_current_binary_output = (MercuryFile *) NewStream;
 	update_io(IO0, IO);
 ").
@@ -4718,7 +4717,7 @@
 		[will_not_call_mercury, promise_pure, thread_safe,
 			tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_stdin);
+	Stream = mercury_stdin;
 	update_io(IO0, IO);
 ").
 
@@ -4727,7 +4726,7 @@
 		[will_not_call_mercury, promise_pure, thread_safe,
 			tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_stdout);
+	Stream = mercury_stdout;
 	update_io(IO0, IO);
 ").
 
@@ -4736,7 +4735,7 @@
 		[will_not_call_mercury, promise_pure, thread_safe,
 			tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_stderr);
+	Stream = mercury_stderr;
 	update_io(IO0, IO);
 ").
 
@@ -4745,7 +4744,7 @@
 		[will_not_call_mercury, promise_pure, thread_safe,
 			tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_stdin_binary);
+	Stream = mercury_stdin_binary;
 	update_io(IO0, IO);
 ").
 
@@ -4754,7 +4753,7 @@
 		[will_not_call_mercury, promise_pure, thread_safe,
 			tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_stdout_binary);
+	Stream = mercury_stdout_binary;
 	update_io(IO0, IO);
 ").
 
@@ -4762,7 +4761,7 @@
 	io__input_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_current_text_input);
+	Stream = mercury_current_text_input;
 	update_io(IO0, IO);
 ").
 
@@ -4770,7 +4769,7 @@
 	io__output_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_current_text_output);
+	Stream = mercury_current_text_output;
 	update_io(IO0, IO);
 ").
 
@@ -4778,7 +4777,7 @@
 	io__binary_input_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_current_binary_input);
+	Stream = mercury_current_binary_input;
 	update_io(IO0, IO);
 ").
 
@@ -4786,7 +4785,7 @@
 	io__binary_output_stream(Stream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
-	MR_c_pointer_to_word(Stream, mercury_current_binary_output);
+	Stream = mercury_current_binary_output;
 	update_io(IO0, IO);
 ").
 
@@ -4802,8 +4801,7 @@
 	io__get_line_number(Stream::in, LineNum::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	LineNum = stream->line_number;
 	update_io(IO0, IO);
 }").
@@ -4820,8 +4818,7 @@
 	io__set_line_number(Stream::in, LineNum::in, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	stream->line_number = LineNum;
 	update_io(IO0, IO);
 }").
@@ -4836,8 +4833,7 @@
 :- pragma foreign_proc("MC++",
 	io__get_output_line_number(Stream::in, LineNum::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io], "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	LineNum = stream->line_number;
 	update_io(IO0, IO);
 }").
@@ -4852,8 +4848,7 @@
 :- pragma foreign_proc("MC++",
 	io__set_output_line_number(Stream::in, LineNum::in, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io], "{
-	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile stream = Stream;
 	stream->line_number = LineNum;
 	update_io(IO0, IO);
 }").
@@ -4864,18 +4859,16 @@
 :- pragma foreign_proc("MC++",
 	io__set_input_stream(NewStream::in, OutStream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io], "
-	MR_c_pointer_to_word(OutStream, mercury_current_text_input);
-	mercury_current_text_input = 
-		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
+	OutStream = mercury_current_text_input;
+	mercury_current_text_input = NewStream;
 	update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
 	io__set_output_stream(NewStream::in, OutStream::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io], "
-	MR_c_pointer_to_word(OutStream, mercury_current_text_output);
-	mercury_current_text_output = 
-		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
+	OutStream = mercury_current_text_output;
+	mercury_current_text_output = NewStream;
 	update_io(IO0, IO);
 ").
 
@@ -4883,9 +4876,8 @@
 	io__set_binary_input_stream(NewStream::in, OutStream::out,
 		IO0::di, IO::uo), 
 		[will_not_call_mercury, promise_pure, tabled_for_io], "
-	MR_c_pointer_to_word(OutStream, mercury_current_binary_input);
-	mercury_current_binary_input = 
-		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
+	OutStream = mercury_current_binary_input;
+	mercury_current_binary_input = NewStream;
 	update_io(IO0, IO);
 ").
 
@@ -4893,9 +4885,8 @@
 	io__set_binary_output_stream(NewStream::in, OutStream::out,
 		IO0::di, IO::uo), 
 		[will_not_call_mercury, promise_pure, tabled_for_io], "
-	MR_c_pointer_to_word(OutStream, mercury_current_binary_output);
-	mercury_current_binary_output = 
-		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
+	OutStream = mercury_current_binary_output;
+	mercury_current_binary_output = NewStream;
 	update_io(IO0, IO);
 ").
 
@@ -5035,7 +5026,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe],
 "
-	Stream = (MR_Word) mercury_open(FileName, Mode);
+	Stream = mercury_open(FileName, Mode);
 	update_io(IO0, IO);
 ").
@@ -5047,7 +5038,7 @@
 			thread_safe],
 "
 	MR_MercuryFile mf = mercury_open(FileName, Mode);
-	MR_c_pointer_to_word(Stream, mf);
+	Stream = mf;
 	update_io(IO0, IO);
 ").
@@ -5083,8 +5074,7 @@
 
 :- pragma foreign_proc("MC++", io__close_stream(Stream::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, tabled_for_io, thread_safe], "
-	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
-		MR_word_to_c_pointer(Stream));
+	MR_MercuryFile mf = Stream;
 	mercury_close(mf);
 	update_io(IO0, IO);
 ").
@@ -5234,14 +5224,18 @@
 	io__command_line_arguments(Args::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io,
 			thread_safe], "
+#ifdef MR_HIGHLEVEL_DATA
+	mercury::runtime::Errors::SORRY(""io__command_line_arguments"");
+#else
 	MR_String arg_vector __gc[] = System::Environment::GetCommandLineArgs();
 	int i = arg_vector->Length;
 	MR_list_nil(Args);
-		/* We don't get the 0th argument: it is the executable name */
+		// We don't get the 0th argument: it is the executable name
 	while (--i > 0) {
 		MR_list_cons(Args, arg_vector[i], Args);
 	}
 	update_io(IO0, IO);
+#endif
 ").
 
 :- pragma foreign_proc("MC++",
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.104
diff -u -r1.104 private_builtin.m
--- library/private_builtin.m	14 Jun 2002 10:18:50 -0000	1.104
+++ library/private_builtin.m	2 Jul 2002 10:17:55 -0000
@@ -567,7 +567,7 @@
 
 	tmp = dynamic_cast<MR_Word> (tcinfo[0]);
 	t1 = System::Convert::ToInt32(tmp[0]) + index;
-	return dynamic_cast<MR_Word> (tcinfo[t1]);
+	return dynamic_cast<MR_TypeInfo> (tcinfo[t1]);
 }
 static MR_TypeInfo MR_typeclass_info_unconstrained_type_info(
 	MR_TypeClassInfo tcinfo, int index) 
Index: library/rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.19
diff -u -r1.19 rtti_implementation.m
--- library/rtti_implementation.m	14 Jun 2002 10:18:51 -0000	1.19
+++ library/rtti_implementation.m	2 Jul 2002 10:17:56 -0000
@@ -979,6 +979,7 @@
 :- pragma foreign_proc("C#",
 	get_subterm(TypeInfo::in, Term::in, Index::in,
 		TagOffset::in) = (Arg::out), [promise_pure], "
+	// XXX This will not work for high level data.
 	Arg = ((object[]) Term)[Index + TagOffset];
 	TypeInfo_for_T = TypeInfo;
 ").
@@ -1293,10 +1294,6 @@
 			exist_info_field_nums.tcis];
 ").
 
-
-
-
-
 :- func exist_arg_num(typeinfo_locn) = int.
 
 exist_arg_num(X::in) = (unsafe_cast(X)::out) :- 
@@ -1340,8 +1337,6 @@
 		Index, TypeInfo
 			`with_type` private_builtin__type_info(int)).
 
-
-
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
@@ -1372,8 +1367,6 @@
 	NewTypeInfo = OldTypeInfo;
 ").
 
-
-
 :- pred semidet_unimplemented(string::in) is semidet.
 semidet_unimplemented(S) :-
 	( std_util__semidet_succeed ->
@@ -1428,7 +1421,7 @@
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
 	UnifyPred = (MR_Integer) tci->MR_type_ctor_unify_pred;
 ").
-type_ctor_unify_pred(_) = _ :-
+type_ctor_unify_pred(_) = "dummy value" :-
 	% This version is only used for back-ends for which there is no
 	% matching foreign_proc version.
 	private_builtin__sorry("type_ctor_unify_pred").
@@ -1448,7 +1441,7 @@
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
 	UnifyPred = (MR_Integer) tci->MR_type_ctor_compare_pred;
 ").
-type_ctor_compare_pred(_) = _ :-
+type_ctor_compare_pred(_) = "dummy value" :-
 	% This version is only used for back-ends for which there is no
 	% matching foreign_proc version.
 	private_builtin__sorry("type_ctor_compare_pred").
Index: library/sparse_bitset.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.15
diff -u -r1.15 sparse_bitset.m
--- library/sparse_bitset.m	14 Jun 2002 10:18:51 -0000	1.15
+++ library/sparse_bitset.m	2 Jul 2002 10:17:56 -0000
@@ -780,18 +780,6 @@
 	MR_field(MR_mktag(ML_BITSET_TAG), Pair, 1) = B;
 }").
 
-% XXX this needs to take reserve-tag into account too
-:- pragma foreign_proc("C#", make_bitset_elem(A::in, B::in) = (Pair::out),
-		[will_not_call_mercury, promise_pure, thread_safe],
-"{
-#if MR_RESERVE_TAG
-    #error ""sparse_bitset not implemented for .NET in .rt grades""
-#endif
-	Pair = mercury.runtime.LowLevelData.make_MR_Word(0, 2);
-	mercury.runtime.LowLevelData.set_MR_Word_field(Pair, 1, A);
-	mercury.runtime.LowLevelData.set_MR_Word_field(Pair, 2, B);
-}").
-
 make_bitset_elem(Offset, Bits) = bitset_elem(Offset, Bits).
 
 %-----------------------------------------------------------------------------%
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.172
diff -u -r1.172 string.m
--- library/string.m	24 Jun 2002 11:09:06 -0000	1.172
+++ library/string.m	2 Jul 2002 10:17:57 -0000
@@ -742,40 +742,6 @@
 	Str[size] = '\\0';
 }").
 
-:- pragma foreign_proc("MC++", string__to_char_list(Str::in, CharList::uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        MR_Integer length, i; 
-        MR_Word tmp;
-        MR_Word prev;
-
-        length = Str->get_Length();
-      
-        MR_list_nil(prev);
-
-        for (i = length - 1; i >= 0; i--) {
-		MR_list_cons(tmp, __box(Str->get_Chars(i)), prev);
-		prev = tmp;
-        }
-        CharList = tmp;
-}").
-
-:- pragma foreign_proc("MC++", string__to_char_list(Str::uo, CharList::in),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        System::Text::StringBuilder *tmp;
-	MR_Char c;
-       
-        tmp = new System::Text::StringBuilder();
-        while (1) {
-            if (MR_list_is_cons(CharList)) {
-		c = System::Convert::ToChar(MR_list_head(CharList));
-                tmp->Append(c);
-                CharList = MR_list_tail(CharList);
-            } else {
-                break;
-            }
-        }
-        Str = tmp->ToString();
-}").
 
 string__to_char_list(Str::in, CharList::uo) :-
 	string__to_char_list_2(Str, 0, CharList).
@@ -843,40 +809,6 @@
 	}
 }").
 
-:- pragma foreign_proc("MC++", string__to_char_list(Str::in, CharList::uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        MR_Integer length, i; 
-        MR_Word tmp;
-        MR_Word prev;
-
-        length = Str->get_Length();
-      
-        MR_list_nil(prev);
-
-        for (i = length - 1; i >= 0; i--) {
-		MR_list_cons(tmp, __box(Str->get_Chars(i)), prev);
-		prev = tmp;
-        }
-        CharList = tmp;
-}").
-
-:- pragma foreign_proc("MC++", string__to_char_list(Str::uo, CharList::in),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        System::Text::StringBuilder *tmp;
-	MR_Char c;
-       
-        tmp = new System::Text::StringBuilder();
-        while (1) {
-            if (MR_list_is_cons(CharList)) {
-		c = System::Convert::ToChar(MR_list_head(CharList));
-                tmp->Append(c);
-                CharList = MR_list_tail(CharList);
-            } else {
-                break;
-            }
-        }
-        Str = tmp->ToString();
-}").
 
 string__from_rev_char_list(Chars::in, Str::out) :- 
 	Str = string__from_char_list(list__reverse(Chars)).
@@ -1079,20 +1011,6 @@
 	Str[len] = '\\0';
 }").
 
-:- pragma foreign_proc("C#",
-		string__append_list(Strs::in) = (Str::uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-{
-        System.Text.StringBuilder tmp = new System.Text.StringBuilder();
-
-	while (mercury.runtime.LowLevelData.list_is_cons(Strs)) {
-		tmp.Append(mercury.runtime.LowLevelData.list_get_head(Strs));
-		Strs = mercury.runtime.LowLevelData.list_get_tail(Strs);
-	}
-	Str = tmp.ToString();
-}
-").
-
 string__append_list(Strs::in) = (Str::uo) :-
 	( Strs = [X | Xs] ->
 		Str = X ++ append_list(Xs)
@@ -1100,23 +1018,16 @@
 		Str = ""
 	).
 
-:- pragma foreign_proc("C#",
-		string__join_list(Sep::in, Strs::in) = (Str::uo),
-		[will_not_call_mercury, promise_pure, thread_safe], "
-{	
-	System.Text.StringBuilder tmpStr = new System.Text.StringBuilder();
+string__join_list(_, []) = "".
+string__join_list(Sep, [H|T]) = H ++ string__join_list_2(Sep, T).
 
-	while(mercury.runtime.LowLevelData.list_is_cons(Strs)) {
-		tmpStr.Append(mercury.runtime.LowLevelData.list_get_head(Strs));
-		Strs = mercury.runtime.LowLevelData.list_get_tail(Strs);
+:- func string__join_list_2(string::in, list(string)::in) = (string::uo) is det.
 
-		if (mercury.runtime.LowLevelData.list_is_cons(Strs)) {
-			tmpStr.Append(Sep);
-		}
-	}
+string__join_list_2(_, []) = "".
+string__join_list_2(Sep, [H|T]) = Sep ++ H ++ string__join_list_2(Sep, T).
+
+	
 
-	Str = tmpStr.ToString();
-}").
 
 %-----------------------------------------------------------------------------%
 
@@ -1838,23 +1749,6 @@
 		IntList = MR_list_cons_msg((MR_UnsignedChar) *p, IntList,
 			MR_PROC_LABEL);
 	}
-}").
-:- pragma foreign_proc("MC++",
-	string__to_int_list(Str::in, IntList::out),
-		[will_not_call_mercury, promise_pure, thread_safe], "{
-        MR_Integer length, i; 
-        MR_Word tmp;
-        MR_Word prev;
-
-        length = Str->get_Length();
-      
-        MR_list_nil(prev);
-
-        for (i = length - 1; i >= 0; i--) {
-		MR_list_cons(tmp, __box((MR_Integer) Str->get_Chars(i)), prev);
-		prev = tmp;
-        }
-        IntList = tmp;
 }").
 string__to_int_list(String, IntList) :-
 	string__to_char_list(String, CharList),
Index: library/type_desc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.12
diff -u -r1.12 type_desc.m
--- library/type_desc.m	14 Jun 2002 10:18:55 -0000	1.12
+++ library/type_desc.m	2 Jul 2002 10:17:58 -0000
@@ -368,23 +368,29 @@
 MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(type_desc, type_desc, 0, 
 	MR_TYPECTOR_REP_TYPEDESC)
 
-static int MR_compare_type_info(MR_Word t1, MR_Word t2) {
-	MR_Word res;
+static int MR_compare_type_info(MR_TypeInfo_0 t1, MR_TypeInfo_0 t2) {
+	MR_ComparisonResult res;
 
 	mercury::type_desc::mercury_code::ML_call_rtti_compare_type_infos(
 		&res, t1, t2);
+/*
+#ifdef MR_HIGHLEVEL_DATA
+	return res->data_tag;
+#else
+*/
 	return System::Convert::ToInt32(res[0]);
+// #endif
 }
 
 static void
 __Compare____type_ctor_desc_0_0(
-	MR_Word_Ref result, MR_Word x, MR_Word y)
+	MR_ComparisonResult *result, MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	mercury::runtime::Errors::SORRY(""foreign code for comparing type_ctor_descs"");
 }
 
 static MR_bool
-__Unify____type_ctor_desc_0_0(MR_Word x, MR_Word y)
+__Unify____type_ctor_desc_0_0(MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	mercury::runtime::Errors::SORRY(""foreign code for unifying type_ctor_descs"");
 	return 0;
@@ -392,13 +398,13 @@
 
 static void
 special___Compare___type_ctor_desc_0_0(
-	MR_Word_Ref result, MR_Word x, MR_Word y)
+	MR_ComparisonResult *result, MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	mercury::runtime::Errors::SORRY(""foreign code for comparing type_ctor_descs"");
 }
 
 static MR_bool
-special___Unify___type_ctor_desc_0_0(MR_Word x, MR_Word y)
+special___Unify___type_ctor_desc_0_0(MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	mercury::runtime::Errors::SORRY(""foreign code for unifying type_ctor_descs"");
 	return 0;
@@ -408,44 +414,44 @@
 do_unify__type_ctor_desc_0_0(MR_Box x, MR_Box y)
 {
 	return mercury::type_desc__cpp_code::mercury_code::__Unify____type_ctor_desc_0_0(
-		dynamic_cast<MR_Word>(x),
-		dynamic_cast<MR_Word>(y));
+		dynamic_cast<MR_TypeInfo_0>(x),
+		dynamic_cast<MR_TypeInfo_0>(y));
 }
 
 static void
 do_compare__type_ctor_desc_0_0(
-	MR_Word_Ref result, MR_Box x, MR_Box y)
+	MR_ComparisonResult *result, MR_Box x, MR_Box y)
 {
 	mercury::type_desc__cpp_code::mercury_code::__Compare____type_ctor_desc_0_0(
 		result,
-		dynamic_cast<MR_Word>(x),
-		dynamic_cast<MR_Word>(y));
+		dynamic_cast<MR_TypeInfo_0>(x),
+		dynamic_cast<MR_TypeInfo_0>(y));
 }
 
 static void
 __Compare____type_desc_0_0(
-	MR_Word_Ref result, MR_Word x, MR_Word y)
+	MR_ComparisonResult *result, MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	mercury::type_desc::mercury_code::ML_call_rtti_compare_type_infos(
 		result, x, y);
 }
 
 static MR_bool
-__Unify____type_desc_0_0(MR_Word x, MR_Word y)
+__Unify____type_desc_0_0(MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	return (MR_compare_type_info(x, y) == MR_COMPARE_EQUAL);
 }
 
 static void
 special___Compare___type_desc_0_0(
-	MR_Word_Ref result, MR_Word x, MR_Word y)
+	MR_ComparisonResult *result, MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	mercury::type_desc::mercury_code::ML_call_rtti_compare_type_infos(
 		result, x, y);
 }
 
 static MR_bool
-special___Unify___type_desc_0_0(MR_Word x, MR_Word y)
+special___Unify___type_desc_0_0(MR_TypeInfo_0 x, MR_TypeInfo_0 y)
 {
 	return (MR_compare_type_info(x, y) == MR_COMPARE_EQUAL);
 }
@@ -454,18 +460,18 @@
 do_unify__type_desc_0_0(MR_Box x, MR_Box y)
 {
 	return mercury::type_desc__cpp_code::mercury_code::__Unify____type_desc_0_0(
-		dynamic_cast<MR_Word>(x),
-		dynamic_cast<MR_Word>(y));
+		dynamic_cast<MR_TypeInfo_0>(x),
+		dynamic_cast<MR_TypeInfo_0>(y));
 }
 
 static void
 do_compare__type_desc_0_0(
-	MR_Word_Ref result, MR_Box x, MR_Box y)
+	MR_ComparisonResult *result, MR_Box x, MR_Box y)
 {
 	mercury::type_desc__cpp_code::mercury_code::__Compare____type_desc_0_0(
 		result,
-		dynamic_cast<MR_Word>(x),
-		dynamic_cast<MR_Word>(y));
+		dynamic_cast<MR_TypeInfo_0>(x),
+		dynamic_cast<MR_TypeInfo_0>(y));
 }
 
 ").
@@ -523,7 +529,7 @@
 	TypeInfo_for_T = TypeInfo;
 ").
 
-has_type(_, _) :-
+has_type("dummy value", _) :-
 	% This version is only used for back-ends for which there is no
 	% matching foreign_proc version.
 	private_builtin__sorry("has_type").
Index: runtime/mercury_mcpp.cpp
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.cpp,v
retrieving revision 1.13
diff -u -r1.13 mercury_mcpp.cpp
--- runtime/mercury_mcpp.cpp	27 Mar 2002 05:18:49 -0000	1.13
+++ runtime/mercury_mcpp.cpp	2 Jul 2002 10:17:59 -0000
@@ -25,19 +25,6 @@
 
 namespace runtime {
 
-	// A user exception -- really just a wrapper for the exception
-	// data.
-
-__gc public class Exception : public System::Exception
-{
-public:
-   Exception(MR_Word data) 
-   {
-   	mercury_exception = data;	
-   }
-   MR_Word mercury_exception;
-};
-
 __gc public class SystemException : public System::Exception
 {
 public:
Index: runtime/mercury_mcpp.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.h,v
retrieving revision 1.20
diff -u -r1.20 mercury_mcpp.h
--- runtime/mercury_mcpp.h	24 Apr 2002 07:37:38 -0000	1.20
+++ runtime/mercury_mcpp.h	2 Jul 2002 10:17:59 -0000
@@ -49,7 +49,20 @@
 typedef MR_Ref(MR_Box) MR_Box_Ref;
 typedef MR_Ref(MR_Word) MR_Word_Ref;
 
-typedef __gc public class System::Object * MR_TypeInfo[];
+/*
+#ifdef MR_HIGHLEVEL_DATA
+  typedef __gc public class mercury::private_builtin::type_info_1* MR_TypeInfo;
+  typedef __gc public class mercury::rtti_implementation::type_info_0* MR_TypeInfo_0;
+  typedef __gc public class mercury::builtin::comparison_result_0 *MR_ComparisonResult;
+  typedef __gc public class mercury::std_util::univ_0 *MR_Univ;
+#else
+*/
+  typedef __gc public class System::Object * MR_TypeInfo[];
+  typedef __gc public class System::Object * MR_TypeInfo_0[];
+  typedef __gc public class System::Object * MR_ComparisonResult[];
+  typedef __gc public class System::Object * MR_Univ[];
+// #endif
+
 typedef __gc public class System::Object * MR_TypeCtorInfo[];
 typedef __gc public class System::Object * MR_TypeInfoParams[];
 typedef __gc public class System::Object * MR_TypeClassInfo[];

--------------------------------------------------------------------------
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