[m-dev.] for review: fixes for MC++ support in IL backend.

Tyson Dowd trd at cs.mu.OZ.AU
Thu Jan 11 22:47:39 AEDT 2001


Hi,

I plan to commit this on the release branch too, as it is causing
problems for users (hi Pete!).

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


Estimated hours taken: 1.0

A few fixes for the MC++ support in the IL backend.

compiler/mlds_to_ilasm.m:
	Add mercury:: to the front of types generated by the MC++
	interface.  This fixes most of the references to the mercury
	namespace.

	Add 
		using namespace mercury;
	back to the MC++ output.  We are still using llds_out to
	generate some of the MC++ code, and it isn't aware of the need
	to put mercury:: in front of types.

runtime/Mmakefile:
	Add mercury_mcpp.h to the list of header files to be installed.
		


Index: compiler/mlds_to_ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_ilasm.m,v
retrieving revision 1.6
diff -u -r1.6 mlds_to_ilasm.m
--- compiler/mlds_to_ilasm.m	2001/01/01 04:03:34	1.6
+++ compiler/mlds_to_ilasm.m	2001/01/11 10:30:08
@@ -182,6 +182,13 @@
 		"#using ""mercury_mcpp.dll""\n",
 		"#using ""mercury_il.dll""\n",
 		"#using """, ModuleNameStr, ".dll""\n",
+
+		% XXX We have to use the mercury namespace, as
+		% llds_out still generates some of the code used in the
+		% MC++ interface, and so it doesn't have "mercury::"
+		% namespace qualifiers.
+		"using namespace mercury;\n",
+
 		% XXX this supresses problems caused by references to 
 		% float.  If you don't do this, you'll get link errors.
 		% Revisit this when the .NET implementation has matured.
@@ -590,13 +597,13 @@
 :- pred write_il_simple_type_as_managed_cpp_type(simple_type::in,
 	io__state::di, io__state::uo) is det.
 write_il_simple_type_as_managed_cpp_type(int8) --> 
-	io__write_string("MR_Integer8").
+	io__write_string("mercury::MR_Integer8").
 write_il_simple_type_as_managed_cpp_type(int16) --> 
-	io__write_string("MR_Integer16").
+	io__write_string("mercury::MR_Integer16").
 write_il_simple_type_as_managed_cpp_type(int32) --> 
-	io__write_string("MR_Integer").
+	io__write_string("mercury::MR_Integer").
 write_il_simple_type_as_managed_cpp_type(int64) --> 
-	io__write_string("MR_Integer64").
+	io__write_string("mercury::MR_Integer64").
 write_il_simple_type_as_managed_cpp_type(uint8) --> 
 	io__write_string("unsigned int").
 write_il_simple_type_as_managed_cpp_type(uint16) --> 
@@ -606,24 +613,24 @@
 write_il_simple_type_as_managed_cpp_type(uint64) --> 
 	io__write_string("unsigned int").
 write_il_simple_type_as_managed_cpp_type(native_int) --> 
-	io__write_string("MR_Integer").
+	io__write_string("mercury::MR_Integer").
 write_il_simple_type_as_managed_cpp_type(native_uint) --> 
 	io__write_string("unsigned int").
 write_il_simple_type_as_managed_cpp_type(float32) --> 
 	io__write_string("float").
 write_il_simple_type_as_managed_cpp_type(float64) --> 
-	io__write_string("MR_Float").
+	io__write_string("mercury::MR_Float").
 write_il_simple_type_as_managed_cpp_type(native_float) --> 
-	io__write_string("MR_Float").
+	io__write_string("mercury::MR_Float").
 write_il_simple_type_as_managed_cpp_type(bool) --> 
-	io__write_string("MR_Integer").
+	io__write_string("mercury::MR_Integer").
 write_il_simple_type_as_managed_cpp_type(char) --> 
-	io__write_string("MR_Char").
+	io__write_string("mercury::MR_Char").
 write_il_simple_type_as_managed_cpp_type(refany) --> 
-	io__write_string("MR_RefAny").
+	io__write_string("mercury::MR_RefAny").
 write_il_simple_type_as_managed_cpp_type(class(ClassName)) --> 
 	( { ClassName = il_generic_class_name } ->
-		io__write_string("MR_Box")
+		io__write_string("mercury::MR_Box")
 	;
 		io__write_string("public class "),
 		write_managed_cpp_class_name(ClassName),
@@ -641,7 +648,7 @@
 	io__write_string(" *").
 		% XXX this needs more work
 write_il_simple_type_as_managed_cpp_type('[]'(_Type, _Bounds)) --> 
-	io__write_string("MR_Word").
+	io__write_string("mercury::MR_Word").
 write_il_simple_type_as_managed_cpp_type('&'(Type)) --> 
 	io__write_string("MR_Ref("),
 	write_il_type_as_managed_cpp_type(Type),
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.65
diff -u -r1.65 Mmakefile
--- runtime/Mmakefile	2001/01/01 04:04:01	1.65
+++ runtime/Mmakefile	2001/01/11 06:28:14
@@ -59,6 +59,7 @@
 			mercury_label.h		\
 			mercury_layout_util.h	\
 			mercury_library_types.h	\
+			mercury_mcpp.h		\
 			mercury_memory.h	\
 			mercury_memory_zones.h	\
 			mercury_memory_handlers.h	\


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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