[m-rev.] diff: fix io__command_line_arguments in il grade

Peter Ross pro at missioncriticalit.com
Thu Nov 28 22:45:12 AEDT 2002


Hi,


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


Estimated hours taken: 1
Branches: main

Get io__command_line_arguments working with high-level data on the il
backend.

library/io.m:
	Re-enable the code for MC++.

library/list.m:
	Export ML_empty_list and ML_cons which respectively create an
	empty list and a cons cell.

runtime/mercury_mcpp.h:
	Use ML_empty_list and ML_cons to define MR_list_nil and
	ML_list_cons.  We cannot call the constructors directly
	because __identifier([]_0) doesn't successfully escape the
	class name for the C compiler.

Index: runtime/mercury_mcpp.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.h,v
retrieving revision 1.22
diff -u -r1.22 mercury_mcpp.h
--- runtime/mercury_mcpp.h	1 Aug 2002 11:52:26 -0000	1.22
+++ runtime/mercury_mcpp.h	28 Nov 2002 11:14:57 -0000
@@ -219,6 +219,13 @@
 // Note that this is very dependent on the data representation chosen
 // by the compiler.
 
+#ifdef MR_HIGHLEVEL_DATA
+#define MR_list_nil(List)					\
+	List = mercury::list::mercury_code::ML_empty_list(NULL)
+
+#define MR_list_cons(List, Head, Tail)				\
+	List = mercury::list::mercury_code::ML_cons(NULL, Head, Tail)
+#else
 #define MR_list_cons(List, Head, Tail)				\
     	do {							\
 		MR_Word _tmp;					\
@@ -230,6 +237,7 @@
 
 #define MR_list_nil(List)					\
     	MR_newobj(List, 0, 0);
+#endif
 
 #define MR_list_is_cons(List)	\
 	(System::Convert::ToInt32((List)->GetValue(0)))
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.277
diff -u -r1.277 io.m
--- library/io.m	21 Nov 2002 08:00:54 -0000	1.277
+++ library/io.m	28 Nov 2002 11:14:59 -0000
@@ -5632,9 +5632,6 @@
 	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);
@@ -5643,7 +5640,6 @@
 		MR_list_cons(Args, arg_vector[i], Args);
 	}
 	MR_update_io(IO0, IO);
-#endif
 ").
 
 :- pragma foreign_proc("MC++",
Index: library/list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.108
diff -u -r1.108 list.m
--- library/list.m	16 Sep 2002 06:07:45 -0000	1.108
+++ library/list.m	28 Nov 2002 11:14:59 -0000
@@ -1518,6 +1518,16 @@
 	).
 
 %-----------------------------------------------------------------------------%
+
+:- func empty_list = list(T).
+:- pragma export(empty_list = out, "ML_empty_list").
+empty_list = [].
+
+:- func cons(T, list(T)) = list(T).
+:- pragma export((cons(in, in) = (out)), "ML_cons").
+cons(H, T) = [H | T].
+
+%-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 % Ralph Becket <rwab1 at cam.sri.com> 27/04/99
 %       Function forms added.

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